Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cascade Classifier - detectmultiscale does not return MatOfRect objects

I work on my android application as It mentioned here . I have difficulties with class Cascade Classifier. I use HAAR classifier. I load a trained cascade classifier in xml and then I use method detectMultiScale with parameters (Mat image, MatOfRect detectedObjects). But when I run the application, I always get detected 0 objects, even If I take a photo with an object in the image. I use Opencv 3.2.0. I tried also LBP classifier and still, it is the same.

I trained my classifier in this application . Does someone have the experience with this GUI training classifier? A type of input image is CV_8UC1.

I don't see the problem with loading xml because the statement below is running well, but without returning detected objects as it was mentioned. I haven't tried to train the classifier in the command line yet. But It would be bit of problem because I am on windows platform. But I'll try it.
Or did I miss something? Let me know.

private CascadeClassifier cascadeClassifier = new CascadeClassifier("/storage/emulated/0/Pics/cascade1.xml");
private MatOfRect matOfRect = new MatOfRect();

public void classifier(Mat object){
        if(!cascadeClassifier.empty()) {

                Imgproc.resize(object, object, new Size(170, 240));
                cascadeClassifier.detectMultiScale(object, matOfRect);

                MyLog.i(MyLog.TAG, matOfRect.size().toString());//It always prints size 1x0


        }
    }

The classifier was trained on this kind of object.

image description