Cascade Classifier Tutorial Error

asked 2017-02-03 17:42:30 -0500

Hey everyone,

I just copied past the code from the Cascade classifier tutorial , And I always get this error

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.widt h <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core \src\matrix.cpp, line 522

platform: windows 7, visual studio 2013.

Any help please ?

Sincerely, Omar K. Aly

edit retag flag offensive close merge delete

Comments

Actually that error tells you that the image is not loaded correctly because no pixel info was found. Check the paths to the data you are loading please.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-02-04 05:04:59 -0500 )edit

What data? ... you mean the xml files ? its in the same folder as the code and by debugging its loaded correctly.

/** Global variables */ String face_cascade_name = "haarcascade_frontalface_alt.xml"; String eyes_cascade_name = "haarcascade_eye_tree_eyeglasses.xml"; CascadeClassifier face_cascade; CascadeClassifier eyes_cascade;

if (!face_cascade.load(face_cascade_name)){ printf("--(!)Error loading face cascade\n"); return -1; }; if (!eyes_cascade.load(eyes_cascade_name)){ printf("--(!)Error loading eyes cascade\n"); return -1; };

the if conditions aren't returning any errors

Omar K. Aly gravatar imageOmar K. Aly ( 2017-02-04 06:51:19 -0500 )edit

if you have the line below

capture.open( -1 );

try

capture.open( 0 );
sturkmen gravatar imagesturkmen ( 2017-02-04 10:33:24 -0500 )edit

I tried both capture.open(0) and capture(1) because I have to web cams one internal and other external and both give the same error and after debbuging I found the faces.size() vector is something very huge like 112-15 digits number

Omar K. Aly gravatar imageOmar K. Aly ( 2017-02-04 11:04:50 -0500 )edit