apt install python-pip //安装pip
pip --version //查看pip的版本信息
pip install opencv-python //安装opencv-python
# -- coding:utf-8 --
import cv2
cap = cv2.VideoCapture(0) # 打开摄像头
while True:
ret, frame = cap.read() # 读摄像头
cv2.imshow("video", frame)
if cv2.waitKey(1) & 0xFF == ord('q'): # 按q退出
break
cap.release()
cv2.destroyAllWindows() # 基本操作
原文地址:https://www.cnblogs.com/enumx/p/12343085.html
时间: 2024-11-08 11:55:57