开发者

Problem with matrix operation in openCV

开发者 https://www.devze.com 2023-01-31 07:35 出处:网络
I have a problem in my program in openCV when I\'m trying to do matrix operations. for example, if I have 2 matrices and I wanna use the function cvMatMul(&Ma, &Mb, &Mc); let say I wanna m

I have a problem in my program in openCV when I'm trying to do matrix operations. for example, if I have 2 matrices and I wanna use the function cvMatMul(&Ma, &Mb, &Mc); let say I wanna multiply Matrix Ma by another matrix Mb when I compile I get no error but when I'm starting operating the program I get this error:

OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /home/mario/OpenCV-2.2开发者_JAVA技巧.0/modules/core/src/matrix.cpp, line 641 terminate called after throwing an instance of 'cv::Exception'

what(): /home/mario/OpenCV-2.2.0/modules/core/src/matrix.cpp:641: error: (-5) Unknown array type in function cvarrToMat

Can you suggest any solutions.

Thank you.


@Ricardo:

The problem with me was in creating the matrix so you should create the matrix like this

CvMat* name_of_matrix = cvCreateMat(M,N,CV_32FC1);

and then you don't need to put pointers to the matrices when you do multiply it. So for example like this

cvMatMul(first_mat, second_mat, output_mat);
0

精彩评论

暂无评论...
验证码 换一张
取 消