Ask Your Question
0

cascade classifier data structure

asked 2013-02-21 00:39:32 -0500

Bibliarij gravatar image

Hello all! For my own implementation of Viola-Jones algorithm partly I use some methods and structures of OpenCV. For example, reading of images to structure CvMat. Now I need to use cascade classifier. For example, I decide to use class cv::CascadeClassifier. Is there easy way to access members of this class? For example to vector<stage>. This member somehow is protected... Or exists another similar structure? Thanks for the answers.

edit retag flag offensive close merge delete

Comments

btw, i just found, that there's an option in the haartraining tool (from haartraining.htm) :

- mode <BASIC (default) | CORE | ALL>

selects the type of haar features set used in training. BASIC use only upright features, while ALL uses the full set of upright and 45 degree rotated feature set.

so, seems to me, only when ALL is used, it produces tilted features

berak gravatar imageberak ( 2013-02-21 10:45:50 -0500 )edit
1

mmm, ok, thanks

Bibliarij gravatar imageBibliarij ( 2013-02-21 12:00:41 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-02-21 08:40:25 -0500

Bibliarij gravatar image

updated 2013-02-21 10:08:06 -0500

SR gravatar image

It is possible to use CvHaarClassifierCascade structure in such manner:

CvHaarClassifierCascade* c = (CvHaarClassifierCascade*)cvLoad("haarcascade_frontalface_alt.xml", 0, 0, 0);
for (int i = 0; i< c->count; i++)
{
    CvHaarStageClassifier* stage = c->stage_classifier + i;
    for (int j = 0; j < stage->count; j++)
    {
        CvHaarClassifier* hc = stage->classifier + j;
        for (int k = 0; k < hc->count; k++)
        {
            CvHaarFeature* feature = hc->haar_feature + k;
            if(feature->tilted) std::cout << "has titled!";
        }
    }
}
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-02-21 00:39:32 -0500

Seen: 569 times

Last updated: Feb 21 '13