We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61a81c8 commit cd661eaCopy full SHA for cd661ea
1 file changed
camera.py
@@ -0,0 +1,25 @@
1
+import cv2
2
+import random
3
+import time
4
+
5
6
+cap = cv2.VideoCapture(0)
7
+count = 0
8
+b = random.randint(1, 10000)
9
+while True:
10
+ ret, img = cap.read()
11
+ cv2.imshow("Camera", img)
12
+ if not ret:
13
+ break
14
+ k = cv2.waitKey(50)
15
+ if k % 256 == 27:
16
+ print("Closing Camera")
17
18
19
+ if k % 256 == 32:
20
+ time.sleep(1)
21
+ file = r'Pictures\img' + str(count) + str(b) + '.jpeg'
22
+ cv2.imwrite(file, img)
23
+ count += 1
24
+cap.release()
25
+cv2.destroyAllWindows()
0 commit comments