我想在我的代碼中計算協方差矩陣,但我得到一個錯誤。我有我想要使用的平均值數組。這裏是我的代碼錯誤在openCv中使用calcCovarMatrix
Mat Zt(Z);
Mat Zttranspose;
Mat covarZ=cvCreateMat(image->nChannels,image->nChannels,CV_32FC1);
Zttranspose=Zt.t();
Mat_<float> arraymean=(Mat_<float>(3,3)<< meanb, meang, meanr);
calcCovarMatrix(Zt,covarZ,arraymean,CV_COVAR_USE_AVG,CV_64F)
,但我得到了以下錯誤:
OpenCV Error: Assertion failed (((flags & CV_COVAR_ROWS) != 0)^((flags & CV_COVAR_COLS) != 0)) in calcCovarMatrix, file /usr/local/src/OpenCV-2.3.0/modules/core/src/matmul.cpp, line 2127 terminate called after throwing an instance of 'cv::Exception'
但根據需要用正確的尺寸正在創建矩陣 – SB26 2012-04-30 17:25:52