宏CV_IS_ROW_SAMPLE的含意

宏CV_IS_ROW_SAMPLE的含义

     在函数cvCreatMTStumpClassifier中遇到了CV_IS_ROW_SAMPLE,网上查了下资料,很少,现在我总结如下,希望能帮助大家理解。如大家对cvCreatMTStumpClassifier不理解的,请参考我博客中的文章http://blog.csdn.net/ding977921830/article/details/46356789和http://blog.csdn.net/ding977921830/article/details/46412465。


// 函数功能:计算最优弱分类器  
CvClassifier* cvCreateMTStumpClassifier( CvMat* trainData,      // 训练样本HAAR特征值矩阵  
                      int flags,                                // 1.按行排列,0.按列排列  
                      CvMat* trainClasses,                  
                      CvMat* /*typeMask*/,                     
                      CvMat* missedMeasurementsMask,            
                      CvMat* compIdx,                           
                      CvMat* sampleIdx,                         
                      CvMat* weights,                          
                      CvClassifierTrainParams* trainParams )    
{  
.......
}

宏CV_IS_ROW_SAMPLE的具体定义如下:

    /* columns of <trainData> matrix are training samples */
    //矩阵traindata的列是训练样本,对应上述的flags=0
    #define CV_COL_SAMPLE 0

    /* rows of <trainData> matrix are training samples */
    //矩阵traindata的行是训练样本,对应上述的flags=1
    #define CV_ROW_SAMPLE 1

    #define CV_IS_ROW_SAMPLE(flags) ((flags) & CV_ROW_SAMPLE)

宏CV_IS_ROW_SAMPLE(flags)是带有参数的宏,当flags=0时,宏CV_IS_ROW_SAMPLE的含义是0,当flags=1时,宏CV_IS_ROW_SAMPLE的含义是1.

可以看出在opencv的开源库中,c++的编程是非常灵活的,而且内容是具有一定含义和代表性的。