Skip to content
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 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()