I am happily using Python and OpenCV for several projects, and, among the others, I collect images from three different webcam mounted on three different microscopes. Everithing was fine with Python 2.7 and OpenCV 2.x. Now I have to move to Python 3, which support only OpenCV 3.x or higher, but if I try the usual:
cap = cv.VideoCapture(0)
ret, frame = cap.read()
frame now is returned as None. It should not be a matter of pc or drivers: I can reinstall old Python and OpenCV version and the capture from the webcam works again. I also tried with different computers, different Windows versions (7 and 10), different OpenCV version, but it really seems that some new feature in an OpenCV version made it incompatible. Summarizing:
Python 2.7 with OpenCV 2.x: ok
Python 2.7 OpenCV 3.1: ok (even if I don’t know how it was installed, considering Python 2.7 should not support OpenCV 3.x)
Python 3.x with OpenCV 3.x or 4.x: ko.
The only hint I found on the web is about a possible different way to handle hardware acceleration by the new version of OpenCV, but I wasn’t able to go further.
Any idea?