I have this error:
OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type == CV_64FC1 ||
type == CV_32FC2 || type == CV_64FC2)) in gemm, file /build/buildd/opencv-
2.3.1/modules/core/src/matmul.cpp, line 701 terminate called after throwing an instan
ce of 'cv::Exception' what(): /build/buildd/opencv-2.3.1/modules/core/
src/matmul.cpp:701: error: (-215) type == B.type() && (type == CV_32FC1 ||
type == CV_64FC1 || type == CV_32FC2 || type == CV_64FC2) in function gemm
I m sure is generated in a function I use because I used a print function after using that function. Originally what I have to do is translate to C with openCV this matlab's code:
function Xdecorr= color Decorrelation(X,numChannels)
if numChannels >1
mu=mean(X);
X=bsxfun(@minus,X,mu);
A=X'*X;
[V,D,notused]=svd(A);
Xdecorr=X*V;
else
Xdecorr=Xdecorr;
end
I translated in C as:
Mat colorDecorrelation(Mat img,int numColComp){
Mat V,D,A,mu,Xdecorr,img_tr;
SVD svd;
if(numColComp>1){
mu=mean(img);
subtract(img,mu,img);
transpose(img,img_tr);
A = img_tr*img;
V = svd(A).u;
Xdecorr = img*V;
}
else
Xdecorr = img;
return Xdecorr;
}
The error is for sure when I do : A=img_tr*img