|
|
@ -696,7 +696,7 @@ void calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, int |
|
|
|
Mat mean; |
|
|
|
Mat mean; |
|
|
|
ctype = std::max(std::max(CV_MAT_DEPTH(ctype >= 0 ? ctype : type), _mean.depth()), CV_32F); |
|
|
|
ctype = std::max(std::max(CV_MAT_DEPTH(ctype >= 0 ? ctype : type), _mean.depth()), CV_32F); |
|
|
|
|
|
|
|
|
|
|
|
if( (flags & CV_COVAR_USE_AVG) != 0 ) |
|
|
|
if( (flags & cv::COVAR_USE_AVG) != 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CV_Assert( _mean.size() == size ); |
|
|
|
CV_Assert( _mean.size() == size ); |
|
|
|
if( _mean.isContinuous() && _mean.type() == ctype ) |
|
|
|
if( _mean.isContinuous() && _mean.type() == ctype ) |
|
|
@ -722,8 +722,8 @@ void calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean, int |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
calcCovarMatrix( _data, covar, mean, (flags & ~(CV_COVAR_ROWS|CV_COVAR_COLS)) | CV_COVAR_ROWS, ctype ); |
|
|
|
calcCovarMatrix( _data, covar, mean, (flags & ~(cv::COVAR_ROWS|cv::COVAR_COLS)) | cv::COVAR_ROWS, ctype ); |
|
|
|
if( (flags & CV_COVAR_USE_AVG) == 0 ) |
|
|
|
if( (flags & cv::COVAR_USE_AVG) == 0 ) |
|
|
|
_mean = mean.reshape(1, size.height); |
|
|
|
_mean = mean.reshape(1, size.height); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -754,7 +754,7 @@ void calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mea |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Mat mean; |
|
|
|
Mat mean; |
|
|
|
if( (flags & CV_COVAR_USE_AVG) != 0 ) |
|
|
|
if( (flags & cv::COVAR_USE_AVG) != 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CV_Assert( _mean.size() == size ); |
|
|
|
CV_Assert( _mean.size() == size ); |
|
|
|
|
|
|
|
|
|
|
@ -770,9 +770,9 @@ void calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mea |
|
|
|
mean = _mean.getMat().reshape(1, 1); |
|
|
|
mean = _mean.getMat().reshape(1, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
calcCovarMatrix( _data, _covar, mean, (flags & ~(CV_COVAR_ROWS|CV_COVAR_COLS)) | CV_COVAR_ROWS, ctype ); |
|
|
|
calcCovarMatrix( _data, _covar, mean, (flags & ~(cv::COVAR_ROWS|cv::COVAR_COLS)) | cv::COVAR_ROWS, ctype ); |
|
|
|
|
|
|
|
|
|
|
|
if( (flags & CV_COVAR_USE_AVG) == 0 ) |
|
|
|
if( (flags & cv::COVAR_USE_AVG) == 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mean = mean.reshape(1, size.height); |
|
|
|
mean = mean.reshape(1, size.height); |
|
|
|
mean.copyTo(_mean); |
|
|
|
mean.copyTo(_mean); |
|
|
@ -781,14 +781,14 @@ void calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mea |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Mat data = _src.getMat(), mean; |
|
|
|
Mat data = _src.getMat(), mean; |
|
|
|
CV_Assert( ((flags & CV_COVAR_ROWS) != 0) ^ ((flags & CV_COVAR_COLS) != 0) ); |
|
|
|
CV_Assert( ((flags & cv::COVAR_ROWS) != 0) ^ ((flags & cv::COVAR_COLS) != 0) ); |
|
|
|
bool takeRows = (flags & CV_COVAR_ROWS) != 0; |
|
|
|
bool takeRows = (flags & cv::COVAR_ROWS) != 0; |
|
|
|
int type = data.type(); |
|
|
|
int type = data.type(); |
|
|
|
int nsamples = takeRows ? data.rows : data.cols; |
|
|
|
int nsamples = takeRows ? data.rows : data.cols; |
|
|
|
CV_Assert( nsamples > 0 ); |
|
|
|
CV_Assert( nsamples > 0 ); |
|
|
|
Size size = takeRows ? Size(data.cols, 1) : Size(1, data.rows); |
|
|
|
Size size = takeRows ? Size(data.cols, 1) : Size(1, data.rows); |
|
|
|
|
|
|
|
|
|
|
|
if( (flags & CV_COVAR_USE_AVG) != 0 ) |
|
|
|
if( (flags & cv::COVAR_USE_AVG) != 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mean = _mean.getMat(); |
|
|
|
mean = _mean.getMat(); |
|
|
|
ctype = std::max(std::max(CV_MAT_DEPTH(ctype >= 0 ? ctype : type), mean.depth()), CV_32F); |
|
|
|
ctype = std::max(std::max(CV_MAT_DEPTH(ctype >= 0 ? ctype : type), mean.depth()), CV_32F); |
|
|
@ -808,8 +808,8 @@ void calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mea |
|
|
|
mean = _mean.getMat(); |
|
|
|
mean = _mean.getMat(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mulTransposed( data, _covar, ((flags & CV_COVAR_NORMAL) == 0) ^ takeRows, |
|
|
|
mulTransposed( data, _covar, ((flags & cv::COVAR_NORMAL) == 0) ^ takeRows, |
|
|
|
mean, (flags & CV_COVAR_SCALE) != 0 ? 1./nsamples : 1, ctype ); |
|
|
|
mean, (flags & cv::COVAR_SCALE) != 0 ? 1./nsamples : 1, ctype ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1171,7 +1171,7 @@ cvCalcCovarMatrix( const CvArr** vecarr, int count, |
|
|
|
if( avgarr ) |
|
|
|
if( avgarr ) |
|
|
|
mean = mean0 = cv::cvarrToMat(avgarr); |
|
|
|
mean = mean0 = cv::cvarrToMat(avgarr); |
|
|
|
|
|
|
|
|
|
|
|
if( (flags & CV_COVAR_COLS) != 0 || (flags & CV_COVAR_ROWS) != 0 ) |
|
|
|
if( (flags & cv::COVAR_COLS) != 0 || (flags & cv::COVAR_ROWS) != 0 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
cv::Mat data = cv::cvarrToMat(vecarr[0]); |
|
|
|
cv::Mat data = cv::cvarrToMat(vecarr[0]); |
|
|
|