mirror of
https://github.com/opencv/opencv.git
synced 2026-12-03 21:48:25 -06:00
fix calcCovarMatrix vector mean ROI handling
This commit is contained in:
@@ -757,17 +757,15 @@ void calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mea
|
||||
if( (flags & cv::COVAR_USE_AVG) != 0 )
|
||||
{
|
||||
CV_Assert( _mean.size() == size );
|
||||
Mat mean0 = _mean.getMat();
|
||||
|
||||
if( mean.type() != ctype )
|
||||
if( mean0.isContinuous() && mean0.type() == ctype )
|
||||
mean = mean0.reshape(1, 1);
|
||||
else
|
||||
{
|
||||
mean = _mean.getMat();
|
||||
_mean.create(mean.size(), ctype);
|
||||
Mat tmp = _mean.getMat();
|
||||
mean.convertTo(tmp, ctype);
|
||||
mean = tmp;
|
||||
mean0.convertTo(mean, ctype);
|
||||
mean = mean.reshape(1, 1);
|
||||
}
|
||||
|
||||
mean = _mean.getMat().reshape(1, 1);
|
||||
}
|
||||
|
||||
calcCovarMatrix( _data, _covar, mean, (flags & ~(cv::COVAR_ROWS|cv::COVAR_COLS)) | cv::COVAR_ROWS, ctype );
|
||||
|
||||
Reference in New Issue
Block a user