Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions 25 click_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

import cv2

cap = cv2.VideoCapture(0)

img = 0

while True:
ret, frame = cap.read()
cv2.imshow("Image", frame)
k = cv2.waitKey(1)
if k == 27:
# ESC pressed
print("Closing the window...")
break
elif k == 32:
# Press SPACE to click picture
img_name = "opencv_frame.jpg".format(img)
cv2.imwrite(img_name, frame)
print(format(img_name))
img += 1

cap.release()

cv2.destroyAllWindows()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.