【Linux基础】安装python-opencv并调用摄像头数据

安装好python2.7后:
sudo apt-get install python-opencv

安装好的opencv版本是2.4.8

调取摄像头的代码:

import numpy as np

cap = cv2.VideoCapture(0)
while(1):
    # get a frame
    ret, frame = cap.read()
    # show a frame
    cv2.imshow("capture", frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows() 


你可能感兴趣的:(Linux基础)