1

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.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.

3
  • Thank you guys, no need to answer because I have solved the problem. In case that anyone wants to know how it has been solved then just write a comment and I will do that. Thank you Commented Jan 7, 2011 at 21:38
  • Could you tell me how did you resolve ??? Thank you Commented Jan 7, 2011 at 21:38
  • I've answered you, and I hope my answer will be satisfied, text me if you didn't get it Commented Jan 7, 2011 at 23:22

1 Answer 1

4

@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);
Sign up to request clarification or add additional context in comments.

1 Comment

Dude I was actually stuck with this error : M0.type() == CV_32F || M0.type() == CV_64F) && M0.rows == 3 && M0.cols == 3 in function CvWarpPerspective(). But changing the value of matrix to Cv_32FC1 instead of CV_8UC1 solved it ! Thanks :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.