【mac】python使用cv2打开本机摄像头
1、代码
# -*- coding:utf8 -*- import cv2 as cv cap = cv.VideoCapture(0) while (True): hx, frame = cap.read() if hx is False: print('read video error') exit(0) cv.imshow('video', frame) if cv.waitKey(1) & 0xFF == ord('q'): break
cap.release() cv.destroyAllWindows()
参考链接:
https://blog.csdn.net/guijianchouxyz/article/details/120719515