Ask Your Question

Revision history [back]

Annoying persistent problem - Assertion failed (dims <= 2 && step[0] > 0) in locateROI, file /home/pi/opencv-3.3.0/modules/core/src/matrix.cpp, line 981

Hello everyone,

I asked this on StackOverflow and no one had an answer:

I've had this issue all day since installing my USB (well technically an AV to USB) camera and testing out just a basic video script.

I have confirmed it is nothing on my code's end but something to do with the format the camera displays at (YUYV).

So far I have tried:

cv2.imshow(img,cv2.imdecode(img,-1)) Note: this gave me a new error of: OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/pi/opencv-3.3.0/modules/ running cap.set(cv2.CAP_PROP_CONVERT_RGB, True) using the qv4l2 tool (worked 100% fine) None of which fixed the problem of getting the camera to work with OpenCV. Does anyone have any possible solutions?

Mega thank yous to anyone who has any idea!

If you would like to see my code, I will gladly post it. I am using a Raspberry Pi 3 for reference.