opencv haar 分类器记录

读分类器代码如opencv 所写

 for( i = 0; i < cascade->count; i++ )
    {
        AeeHaarStageClassifier* stage_classifier = cascade->stage_classifier + i;
		
        if( !stage_classifier->classifier ||
            stage_classifier->count <= 0 )
        {
            sprintf( errorstr, "header of the stage classifier #%d is invalid "
				"(has null pointers or non-positive classfier count)", i );
            return 0;
        }
		
        max_count = MAX( max_count, stage_classifier->count );
        total_classifiers += stage_classifier->count;
		
        for( j = 0; j < stage_classifier->count; j++ )
        {
            AeeHaarClassifier* classifier = stage_classifier->classifier + j;
			
            total_nodes += classifier->count;
            for( l = 0; l < classifier->count; l++ )
            {
                for( k = 0; k < CV_HAAR_FEATURE_MAX; k++ )
                {
                    if( classifier->haar_feature[l].rect[k].r.width )
                    {
                        CvRect r = classifier->haar_feature[l].rect[k].r;
                        int tilted = classifier->haar_feature[l].tilted;
                        has_tilted_features |= tilted != 0;
                        if( r.width < 0 || r.height < 0 || r.y < 0 ||
                            r.x + r.width > orig_window_size.width
                            ||
                            (!tilted &&
                            (r.x < 0 || r.y + r.height > orig_window_size.height))
                            ||
                            (tilted && (r.x - r.height < 0 ||
                            r.y + r.width + r.height > orig_window_size.height)))
                        {
                            sprintf( errorstr, "rectangle #%d of the classifier #%d of "
								"the stage classifier #%d is not inside "
								"the reference (original) cascade window", k, j, i );
                            return 0;
                        }
                    }
                }
            }
        }
    }




/*

2 //总数total_classifiers
1//节点数total_nodes
2//rects 矩形数
8 19 6 6 0 -1 //&r.x, &r.y,&r.width, &r.height, &band, &(haar_feature.rect[k].weight) 说明分别为 矩形位置信息 和权值
11 19 3 6 0 2
haar_x2
3.213411e-003 0 -1
9.187203e-001 -9.739195e-001 
1
2
3 21 8 3 0 -1
5 21 4 3 0 2
haar_x4
1.327998e-003 0 -1
7.252102e-001 -9.750153e-001 
-2.487092e-001


12
-1
*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

听海拉拉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值