wangxiongbing
# 摄像头捕获图像或视频
import
numpy as np import cv2
# 创建相机的对象 cap
= cv2.VideoCapture(0) while(True):   # 读取相机所拍到的图片   ret, frame = cap.read()   # 给这个frame添加自适应的颜色   # gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)   # 将这个   # cv2.imshow(\'frame\',gray)
  # 将这个frame显示出来
  cv2.imshow(\'frame\',frame)
# 判断退出的条件
  if cv2.waitKey(1) & 0xFF == ord(\'q\'): break 

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

 

分类:

技术点:

相关文章: