Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2015-05-29 05:31:15 -0600

Nbb gravatar image

.detectMultiScale (How to look for the function?)

Hello forum,

I followed this tutorial earlier today, had to edit a few lines to make it work. http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier

My 1st question is, at the line face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); what exactly does the function do i.e. I would like to see the code in .detectMultiScale but have been unsuccessful. i think I know how haar features work but I would like to look at the code to confirm it.

I got to https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/cascadedetect.cpp lines 1627 - 1637. Well, simply put I have no clue where to proceed after that.

My 2nd question is, how do I know which file/folder to visit to look for a certain function ? It seems some of them are stored in opencv/apps and most in opencv/modules

Sorry, I used to use MATLAB. Still kinda new to C++. Have been reading the books but I still get lost at times. Thank you.

.detectMultiScale (How to look for the function?)

Hello forum,

I followed this tutorial earlier today, had to edit a few lines to make it work. http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier

My 1st question is, at the line face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); what exactly does the function do i.e. I would like to see the code in .detectMultiScale but have been unsuccessful. i think I know how haar features work but I would like to look at the code to confirm it.

I got to https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/cascadedetect.cpp lines 1627 - 1637. Well, simply put I have no clue where to proceed after that.

My 2nd question is, how do I know which file/folder to visit to look for a certain function ? It seems some of them are stored in opencv/apps and most in opencv/modules

Sorry, I used to use MATLAB. Still kinda new to C++. Have been reading the books but I still get lost at times. Thank you.

EDIT:

https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/cascadedetect.cpp

Hello, after reading it through I made a little progress ( i think ). There is a .load function being used.

  bool CascadeClassifier::load( const String& filename )
{
    cc = makePtr<CascadeClassifierImpl>();
    if(!cc->load(filename))
        cc.release();
    return !empty();
}

Followed by a .detectMultiScale

void CascadeClassifier::detectMultiScale( InputArray image,
                  CV_OUT std::vector<Rect>& objects,
                  double scaleFactor,
                  int minNeighbors, int flags,
                  Size minSize,
                  Size maxSize )
{
    CV_Assert(!empty());
    cc->detectMultiScale(image, objects, scaleFactor, minNeighbors, flags, minSize, maxSize);
    clipObjects(image.size(), objects, 0, 0);
}

Because of cc-> , the arguments get passed onto the function below

void CascadeClassifierImpl::detectMultiScale( InputArray _image, std::vector<Rect>& objects,
                                      double scaleFactor, int minNeighbors,
                                      int flags, Size minObjectSize, Size maxObjectSize)
{
    std::vector<int> fakeLevels;
    std::vector<double> fakeWeights;
    detectMultiScale( _image, objects, fakeLevels, fakeWeights, scaleFactor,
        minNeighbors, flags, minObjectSize, maxObjectSize );
}

So this is where I am stuck, if all the previous steps are correct. I dont see any function that takes in 9 arguments.