I'm connected to remote system through ssh, and trying to read frames using OpenCV VideoCapture in Python. The same code succeeds when using Python 2.7 and fails when using Python 3.5:
import cv2
cap = cv2.VideoCapture(0)
Python2.7:
print cap.isOpened() # prints True, further read() calls also return True
Python3.5:
print (cap.isOpened()) # prints False, and so are cap.open(), and of course cap.read().
What could cause such behavior?
Thanks!
I had exactly the same problem. OpenCV was installed from the sources. The difference between Python 2 and 3 environment was, that for Python 3 opencv-python was additionally installed via pip3. A
solved it in my case.