OpenCV矩阵函数的一个例外
我是 OpenCV 的新手,我即将用它完成我的第一个大程序。事实上,如果没有发生令人讨厌的异常,我会的。这里是: OpenCV 错误:错误标志(参数或结构字段)(无法识别或不支持) ed 数组类型)在未知函数中,文件 ........\ocv\opencv\src\cxcore\cxarr ay.cpp,第 2476 行 这是发生异常的行: cvMatMul(&matIntrinsec, &matExtrinsec, &结果); 对于主题来说,了解这三个矩阵相乘可能也很重要:(因为也许我只是用它们做了一些愚蠢的事情)
基本上对于 matIntrinsec 和 matExtrinsec,我从文件中读取值,该文件工作得很好,我已经测试过了。我将这些值放入二维数组中,然后使用 CvMat 函数构建矩阵
cvInitMatHeader(&matIntrinsec, 3, 3,CV_64FC1 , this->intrinsecos);
cvInitMatHeader(&matExtrinsec, 3, 3,CV_64FC1 , this->extrinsecos);
至于“结果”参数,它基本上是一个统一的 CvMat 变量,用于接收乘法的结果:
CvMat 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)
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 OpenCV 的 C API 时,必须手动初始化函数的“目标”参数。由于您知道输出的大小,因此可以使用
cvCreateMat()
轻松实现。或者,您可以切换到 C++ 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 thecv::Mat::create()
function.