OpenCV矩阵函数的例外 [英] An exception on OpenCV matrix Function
问题描述
我是OpenCV的新手,我即将用它完成我的第一个大型程序.实际上,如果没有发生令人讨厌的异常,我将是这样.这里是: OpenCV错误:标记错误(参数或结构字段)(无法识别或不支持) ed数组类型)在未知函数中,文件........ \ ocv \ opencv \ src \ cxcore \ cxarr ay.cpp,第2476行 这是发生异常的行: cvMatMul(& matIntrinsec,& matExtrinsec,& result); 对于本主题来说,了解这三个矩阵的乘积可能也很重要:(因为也许我只是在对它们做一些愚蠢的事情)
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)
基本上,对于matIntrinsec和matExtrinsec,我从文件中读取值,该文件工作正常,我已经对其进行了测试.然后将值放入二维数组中,然后使用CvMat函数构建矩阵
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(&matIntrinsec, 3, 3,CV_64FC1 , this->intrinsecos);
cvInitMatHeader(& matExtrinsec,3,3,CV_64FC1,this-> extrinsecos);
cvInitMatHeader(&matExtrinsec, 3, 3,CV_64FC1 , this->extrinsecos);
至于结果"参数,它基本上是一个统一的CvMat变量,用于接收来自乘法的结果:
As for the "result" parameter, its basically an unitialized CvMat variable to receive the result from the multiplication:
CvMat结果;
很抱歉,这个问题很愚蠢.但是请帮助我!
I am very sorry if the question is silly. But please help me!
推荐答案
使用OpenCV的C API时,必须手动将函数的目标"参数初始化.由于您知道输出的大小,因此可以使用cvCreateMat()
轻松地做到这一点.或者,您可以切换到C ++ API,在该API中,函数会使用cv::Mat::create()
函数自动分配目标矩阵.
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.
这篇关于OpenCV矩阵函数的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!