/* returns index at specified position from index matrix of any type.
if matrix is NULL, then specified position is returned */
CV_INLINE
int icvGetIdxAt( CvMat* idx, int pos );
/*
*icvGetIdxAt
*作用:将括号中矩阵idx中第pos个位置的样本序号返回
*/
CV_INLINE
int icvGetIdxAt( CvMat* idx, int pos )
{
if( idx == NULL )
{
return pos;
}
else
{
CvScalar sc; //sc是一个含有四个double型的值的结构体
int type;
type = CV_MAT_TYPE( idx->type );
cvRawDataToScalar( idx->data.ptr + pos *
( (idx->rows == 1) ? CV_ELEM_SIZE( type ) : idx->step ), type, &sc );//将原始数据转化为CvScalar结构体型的数据
return (int) sc.val[0];
}
}