i'm getting assertion failed error, while working on face recognition using opencv.

asked 2019-03-08 06:02:14 -0500

OpenCV(3.4.1) Error: Assertion failed (s >= 0) in cv::setSize, file C:\Miniconda3\conda‑bld\opencv‑suite_1533128839831\work\modules\core\src\matrix.cpp, line 235

This is the error i get. I'm using opencv through Anaconda3 - spyder IDE on windows 10.

Please help!

edit retag flag offensive close merge delete


Without code we cannot help you. Did you check data after file i/o ?

LBerger gravatar imageLBerger ( 2019-03-08 08:00:11 -0500 )edit

please update your answer with your code!

brightprogrammer gravatar imagebrightprogrammer ( 2019-03-08 09:52:25 -0500 )edit

Whenever I get an OpenCV assertion that isn't obvious, I look at the source. See what is going on in matrix.cpp at 235 and trace it back to the parameters you pass in. The assertion is saying s must be >= 0, so you might be passing in a negative argument when you don't intend to.

If you can't see the issue immediately, I suggest building with debug information and setting a breakpoint at line 235 and stepping down the stack to see what is going on.

swebb_denver gravatar imageswebb_denver ( 2019-03-08 22:08:09 -0500 )edit

@swebb_denver -- i bet a barrel, that this is just the usual python user's problem -- please go an check all imread() calls in your prog, some images might not have been read, simply (and it would have needed additional checks there)

berak gravatar imageberak ( 2019-03-09 02:39:39 -0500 )edit

Yep...you are probably right...I totally missed the Anaconda part of the question...I was just focused on the assertion.

swebb_denver gravatar imageswebb_denver ( 2019-03-09 17:15:20 -0500 )edit