首页 > 代码库 > icvSetWeightsAndClasses

icvSetWeightsAndClasses



/*
 *icvSetWeightsAndClasses
 *作用:给训练样本的权重和类别赋值
 */
static void icvSetWeightsAndClasses( CvHaarTrainingData* training_data,
                              int num1, float weight1, float cls1,
                              int num2, float weight2, float cls2 )
{
    int j;

    assert( num1 + num2 <= training_data->maxnum );
    //把训练样本前num1个样本的权重更新为weight1。类别更新为cls1
    for( j = 0; j < num1; j++ )
    {
        training_data->weights.data.fl[j] = weight1;
        training_data->cls.data.fl[j] = cls1;
    }
      //把训练样本前num1~num2个样本的权重更新为weight2,类别更新为cls2
     for( j = num1; j < num1 + num2; j++ )
    {
        training_data->weights.data.fl[j] = weight2;
        training_data->cls.data.fl[j] = cls2;
    }
}


icvSetWeightsAndClasses