I'm trying to use OpenCV's cv2 python bindings on an Amazon server running Ubuntu 14.04 and I can't seem to get VideoCapture to work properly.
I tried opening the default capture as follows:
import cv2
cap = cv2.VideoCapture(0)
cap.isOpened() #Returns false
I tested this on my local machine and it was true as expected, so there is something wrong with my open CV configuration. I've tried a variety of things:
- Using an actual filepath that I confirmed points to an .mp4 file
- Using -1 and 1 in place of 0 on the second line
- Installing ffmpeg (from a ppa as it isn't available by default on Ubuntu 14.04) and rebuilding OpenCV
- Removing my OpenCV directory entirely and rebuilding using the script here
- Verifying and reinstalling various other libraries including x264, gstreamer, and gtk
I'm kind of out of ideas at this point. Any ideas of what could be going wrong?
Edit: OpenCV version is 2.4.9.
VideoCapture
is for capturing video from camera but Amazon servers have not camera. – furasVideoCapture(0)
meansuse default camera
. Probabably need more code to do this. – furasVideoCapture(0)
withVideoCapture("/path/to/video/video.mp4")
returns the same error. – The Bearded Templar