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

Sign up
Appearance settings

Commit 4dc5e47

Browse files
Update webcam-capture-v1.01.py
1 parent 1bee8f6 commit 4dc5e47

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

‎webcam-capture-v1.01.py‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@
1111
key = cv2.waitKey(1)
1212
if key == ord('s'):
1313
cv2.imwrite(filename='saved_img.jpg', img=frame)
14-
14+
webcam.release()
15+
img_new = cv2.imread('saved_img.jpg', cv2.IMREAD_GRAYSCALE)
16+
img_new = cv2.imshow("Captured Image", img_new)
17+
cv2.waitKey(1650)
18+
cv2.destroyAllWindows()
19+
img_ = cv2.imread('saved_img.jpg', cv2.IMREAD_ANYCOLOR)
20+
gray = cv2.cvtColor(img_, cv2.COLOR_BGR2GRAY)
21+
img_ = cv2.resize(gray,(28,28))
22+
img_resized = cv2.imwrite(filename='saved_img-final.jpg', img=img_)
23+
1524
break
1625
elif key == ord('q'):
26+
print("Turning off camera.")
27+
webcam.release()
28+
print("Camera off.")
29+
print("Program ended.")
30+
cv2.destroyAllWindows()
1731
break
18-
webcam.release()
19-
img_new = cv2.imread('saved_img.jpg', cv2.IMREAD_GRAYSCALE)
20-
img_new = cv2.imshow("Captured Image", img_new)
21-
cv2.waitKey(1650)
22-
cv2.destroyAllWindows()
23-
24-
img_ = cv2.imread('saved_img.jpg', cv2.IMREAD_ANYCOLOR)
25-
gray = cv2.cvtColor(img_, cv2.COLOR_BGR2GRAY)
26-
img_ = cv2.resize(gray,(28,28))
27-
img_resized = cv2.imwrite(filename='saved_img-final.jpg', img=img_)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /