views:

20

answers:

1

Hello guys! I am quite a newbie on OpenCV, and I am just about finished my first big program with it. Actually, I would be if a nasty exception wasn't happening. Here it is: OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupport ed array type) in unknown function, file ........\ocv\opencv\src\cxcore\cxarr ay.cpp, line 2476 And here is the line in which the exception happens: cvMatMul(&matIntrinsec, &matExtrinsec, &result); It might also be important for the topic to know what are these three matrixes being multiplied:(cause maybe I am just doing something stupid with them)

Basically for matIntrinsec and matExtrinsec, I read values off a file, which is working just fine, I've tested it already. And I put the values in a two dimentional array and then using the CvMat function to build the matrix

cvInitMatHeader(&matIntrinsec, 3, 3,CV_64FC1 , this->intrinsecos);

cvInitMatHeader(&matExtrinsec, 3, 3,CV_64FC1 , this->extrinsecos);

As for the "result" parameter, its basically an unitialized CvMat variable to receive the result from the multiplication:

CvMat result;

I am very sorry if the question is silly. But please help me!

A: 

When using OpenCV's C API, you must manually initialize the "destination" parameters to functions. Since you know the size of the output, you can easily do so with cvCreateMat(). Alternatively, you could switch to the C++ API, in which functions automatically allocate destination matrices with the cv::Mat::create() function.

Mike Koval