Ask Your Question

cascadeclassifier value

asked 2012-11-28 02:41:47 -0600

Hossein gravatar image

updated 2018-08-29 08:26:23 -0600

hi. how can i get a value from detectmultiscale function that expresses a probability of true detection ?.

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2012-11-28 03:15:06 -0600

venky gravatar image

Hi, You need to write a hack for it. I am actually trying to evaluate at only one location using ::runat, but unfortunately, in the newer version of OpenCV it looks bit more complicated. Somethings are not straight forward.

Check in haar.cpp located in /OpenCV-2.4.3/modules/objdetect/src/haar.cpp and search for "runat", and you will get an idea on how to proceed.

I am not sure if you get the probability of true detection but you get a response > 0 indicating that a face is detected. I hope the above answer helps you a bit.

Thanks Venky

edit flag offensive delete link more


thanks, your comment made to read opencv source code, and i found the answer of my question, as below.

Hossein gravatar imageHossein ( 2012-11-28 07:12:16 -0600 )edit

cascadeclassifire has two detectmultiscale functions that one of them calls another one. the main function is : void CascadeClassifier::detectMultiScale( const Mat& image, vector<Rect>& objects, vector<int>& rejectLevels, vector<double>& levelWeights, double scaleFactor, int minNeighbors, int flags, Size minObjectSize, Size maxObjectSize, bool outputRejectLevels ) we can use levelweight to compute probability of true detection. :)

Hossein gravatar imageHossein ( 2012-11-28 07:17:42 -0600 )edit

Thanks, I will also look into more detail using levelweights. It sounds interesting. I need to spend more time hacking the code now. :) By the way did you manage to use CascadeClassifier::Setiamge and CascadeClassifier::runat by any chance...?

venky gravatar imagevenky ( 2012-11-28 07:29:25 -0600 )edit

not yet !, becuse i dont want to use those individually. i want to use only CascadeClassifier::detectmultiscale() and to build my project.

Hossein gravatar imageHossein ( 2012-11-30 22:24:05 -0600 )edit

answered 2013-04-12 06:07:11 -0600

In order to create a good classification rate, you could simply do the following.

  1. Use as minNeighbor parameter the value 0, incidicating that each detection should be calculated and stored.
  2. Next calculate the overlap between two regions of detection.
  3. The more overlapping regions, who could be merged together, the higher youre output score should be.

This is basically in simple terms what the algorithm does itself based on the neighbors parameter.

edit flag offensive delete link more

answered 2013-04-12 05:01:39 -0600

Hi, would you give any example of your usage of this parameter levelweight ? I'm also looking for the probability of true detection but cannot find a way to compute it. Moreover, I cannot find the function that you are talking about. I found only the basic one with fewer parameters.

edit flag offensive delete link more

Question Tools


Asked: 2012-11-28 02:41:47 -0600

Seen: 894 times

Last updated: Apr 12 '13