【Linux基礎】安裝python-opencv並呼叫攝像頭資料

NO IMAGE

安裝好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()