Created
December 12, 2018 22:57
-
-
Save athena15/4da6384ea82c0e49b80cd65e78c1f9bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#starts the webcam, uses it as video source | |
camera = cv2.VideoCapture(0) #uses webcam for video | |
while camera.isOpened(): | |
#ret returns True if camera is running, frame grabs each frame of the video feed | |
ret, frame = camera.read() | |
k = cv2.waitKey(10) | |
if k == 32: # if spacebar pressed | |
frame = np.stack((frame,)*3, axis=-1) | |
frame = cv2.resize(frame, (224, 224)) | |
frame = frame.reshape(1, 224, 224, 3) | |
prediction, score = predict_image(frame) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment