Python大师进化论-Python打开Camera
这一期我们一步一步写一个Python打开Camera应用。
目标:基于Python打开Camera应用。
通过Python+OpenCV实现Python打开Camera应用
预备知识:
OpenCV API函数
Python代码:
import cv2
capture = cv2.VideoCapture(0)
ret, frame = capture.read()读取摄像头1帧数据
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame', gray)
if cv2.waitKey(1) == ord('q'):
break
重要语法:
cv2.VideoCapture()
capture.read()
以上基于Python打开Camera应用,你掌握了吗,欢迎@关注交流!
閱讀更多 程序猿來導事 的文章