This commit is contained in:
Chris Proctor
2026-06-22 16:08:23 -04:00
parent 95278c854d
commit 255c189d2f
9 changed files with 111 additions and 68 deletions

View File

@@ -32,6 +32,12 @@ def run(clf):
print("Could not open the webcam.")
return
capture.set(cv2.CAP_PROP_BUFFERSIZE, 1)
# Discard the first several frames while the camera warms up
for _ in range(10):
capture.read()
print("Hold a handwritten digit up to the camera, inside the box.")
print("Press 'q' (with the video window focused) to quit.\n")
@@ -56,7 +62,7 @@ def run(clf):
cv2.putText(frame, label, (left, top - 12), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 200, 0), 2)
cv2.imshow(WINDOW_TITLE, frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
if cv2.waitKey(30) & 0xFF == ord("q"):
break
except KeyboardInterrupt:
pass