camera = cv2.VideoCapture(0) # 参数0表示第一个摄像头
# 判断视频是否打开
if (camera.isOpened()):
print('摄像头成功打开')
else:
print('摄像头未打开')
# 测试用,查看视频size
size = (int(camera.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(camera.get(cv2.CAP_PROP_FRAME_HEIGHT)))
print('size:' + repr(size))
02-13
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-22
2035
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-08