1

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!

rkellerm
  • 5,362
  • 8
  • 58
  • 95
  • 2
    Each of the Python versions has its own copy of the openCV binaries, and perhaps the two were built with different options? – Dan Mašek Feb 19 '17 at 16:39

1 Answers1

1

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

pip3 uninstall opencv-python

solved it in my case.

Tober
  • 26
  • 1