import cv2
cam_ID=0 ## Change the 0 value to whatever ID your device has.(0 is first camera, 1 is second camera and so on...)
cam = cv2.VideoCapture(cam_ID)
while True:
value, img = cam.read()
cv2.imshow('my webcam', img)
if cv2.waitKey(1) == 27:
break # esc to quit
cv2.destroyAllWindows()
通过USB将手持摄像头连接到计算机,并安装所有必要的驱动程序。然后您可以使用cv2中的任何普通代码进行handycam访问,除非您可能需要更改设备ID
相关问题 更多 >
编程相关推荐