!empty() in function detectMultiScale with Java sample app

asked 2016-06-23 12:27:53 -0500

Ste gravatar image

Hi All, I am trying to run the sample application and I think I managed to pack it correctly. Only, I created a maven project as opposed to an ant build. However, I run into this output:

OpenCV Error: Assertion failed (!empty()) in detectMultiScale, file /home/ste/Projects/opencv-3.1.0/modules/objdetect/src/cascadedetect.cpp, line 1639 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: /home/ste/Projects/opencv-3.1.0/modules/objdetect/src/cascadedetect.cpp:1639: error: (-215) !empty() in function detectMultiScale ] at org.opencv.objdetect.CascadeClassifier.detectMultiScale_1(Native Method) at org.opencv.objdetect.CascadeClassifier.detectMultiScale(CascadeClassifier.java:159) at com.funambol.opencv.OpenCVTest.run(OpenCVTest.java:38) at com.funambol.opencv.OpenCVTest.main(OpenCVTest.java:58)

Has anyone any clue of what the problem could be?

edit retag flag offensive close merge delete


error means, that your cascade xml was not loaded.

no idea, how you package your project, just keep in mind, that opencv is basically a c++ library, and thus the CascadeClassifier can't read from a zip or such.

berak gravatar imageberak ( 2016-06-24 02:34:19 -0500 )edit

thanks for the comment, break. How does opencv load the cascade xml? what is this file and where is supposed to be in order to be laoded by the library?

Ste gravatar imageSte ( 2016-06-29 10:16:14 -0500 )edit

you will find the name of it in the CascadeClassifier constructor, or the load() function of that.

"where is it supposed to be ?" somewhere on disk as a plain xml file (not in some zip or jar)

berak gravatar imageberak ( 2016-06-29 10:21:10 -0500 )edit

thanks! I think I've got it.

Ste gravatar imageSte ( 2016-07-20 10:56:11 -0500 )edit