#Get video from USB camera
cap = cv2.VideoCapture(0)
#Set the size of video as 640*480
cap.set(3.640)
cap.set(4.480)
cv2.namedWindow('camera')
while(1):
ret ,frame = cap.read()
cv2.imshow('camera',frame)
#Hold the video window
cv2.waitKey(1)
cap.release()
cv2.destroyAllWindows()
------------------------------------------------------------------
程序还是很容易阅读,先建立camera.py,打开编辑。先导入cv2.cv包,然后从摄像头获取图像(USB摄像头功能应该是默认使能的),设置分辨率大小。。。。。。。主要说说收获吧,在下面列一下: