Ask Your Question

Revision history [back]

There is no problem with both your code and the classifier. I compiled the cpp source code smoothly. Here are screenshots of the result:

C:\fakepath\BananaDetect.png

image description

Surely, there are false detection:

image description

image description

I tuned detectMultiScale() slightly:

    //banana_cascade.detectMultiScale(frame_gray, bananas, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));
banana_cascade.detectMultiScale(frame_gray, bananas, 1.05, 12, 0 |CASCADE_FIND_BIGGEST_OBJECT , Size(100, 100));
cout << "bananas.size() = "<< bananas.size() << endl;

There is no problem with both your code and the classifier. I compiled the cpp source code smoothly. Here are screenshots of the result:

C:\fakepath\BananaDetect.png

image description

Surely, there are false detection:

image description

image description

I tuned detectMultiScale() slightly:

    //banana_cascade.detectMultiScale(frame_gray, bananas, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));
banana_cascade.detectMultiScale(frame_gray, bananas, 1.05, 12, 0 |CASCADE_FIND_BIGGEST_OBJECT , Size(100, 100));
cout << "bananas.size() = "<< bananas.size() << endl;

Full source code here:

https://gist.github.com/melvincabatuan/0ed661fd01781c874c0a

There is no problem with both your code and the classifier. I compiled the cpp source code smoothly. Here are screenshots of the result:

C:\fakepath\BananaDetect.png

image description

Surely, there are false detection:

image description

image description

I tuned detectMultiScale() slightly:

    //banana_cascade.detectMultiScale(frame_gray, bananas, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));
banana_cascade.detectMultiScale(frame_gray, bananas, 1.05, 12, 0 |CASCADE_FIND_BIGGEST_OBJECT , Size(100, 100));
cout << "bananas.size() = "<< bananas.size() << endl;

Full source code here:

https://gist.github.com/melvincabatuan/0ed661fd01781c874c0a BananaDetect.cpp