我收到错误
No module named cv2
请指导我应该输入什么命令来安装CV2(sudo qpt-get install ..?) 谢谢
import numpy as np
import cv2
cap = cv2.VideoCapture('vtest.avi')
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
答案 0 :(得分:5)
使用pip
命令行:
pip install opencv-python
答案 1 :(得分:2)
sudo apt-get install python-openCV
答案 2 :(得分:0)
你也可以使用conda install cv2:
conda install -c opencv3