我有一个关于深度感知的keras模型,我想使用tensorflowjs加载它,并将其逐帧应用于我的网络摄像头流。目前,我无法使用HTML捕获网络摄像头视频流。怎么做?
答案 0 :(得分:0)
您可以使用opencv和python轻松捕获视频并对其进行更改。例如,您可以使用以下代码:
import cv2
import sys
from time import sleep
video_capture = cv2.VideoCapture(0)
anterior = 0
while True:
if not video_capture.isOpened():
print('Unable to load camera.')
sleep(5)
pass
# Capture frame-by-frame
ret, frame = video_capture.read()
# Display the resulting frameA
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Display the resulting frame
cv2.imshow('Video', frame)
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()