I am trying to get python opencv to read and display images from the integrated camera on my Lenovo Thinkpad SL510. It seems that the software is not detecting the camera. The light next to the camera does not turn on. I am running Ubuntu 16.04, python 2.7, and opencv 3.0. Here is my code:
import cv2
import numpy as np
cap = cv2.VideoCapture()
while True:
ret, frame = cap.read()
cv2.imshow('video', frame)
if cv2.waitKey(0):
break
cap.release()
cv2.destroyAllWindows()
Note that ret==False and frame==None
. I've tried the fixes from several other sites, such as a delay or if statement with the return, but that didn't work. Like I said, I don't think it is detecting the camera. Also I tried cv2.VideoCapture(0)
and VideoCapture(1)
and that doesn't help either. The error is: cv2.error: /io/opencv/modules/highgui/src/window.cpp:325: error: (-215) size.width>0 && size.height>0 in function imshow
Edit:
so I see that the first thing to try is python -c "import cv2; print(cv2.getBuildInformation())" | grep -i ffmpeg
This returned FFMPEG: NO
What should I do?