读取一直错误 根本没显示 ,后来查阅了好久发现是ubuntu中的摄像头褐诶主机的摄像头不匹配的问题,
来到主机,将主机中相机权限打开,进行共享,再回到ubuntu进行cheese命令检验,终于实现视频读入操作!可谓艰辛!
附上有用链接一份:
https://blog.csdn.net/qq_30155503/article/details/79460420
代码如下:
# -*- coding: UTF-8 –*-
import numpy as np
import cv2
# Connect the built-in camera to 'cap'
cap = cv2.VideoCapture(0) # release
while (True):
ret,color_frame = cap.read()
cv2.imshow('test.avi', color_frame)
if cv2.waitKey(1) == ord('q'):
break
cap.release()
cv2.destroyAllWindows()