OpenCV矩阵函数的一个例外

发布于 2024-09-16 00:58:59 字数 666 浏览 2 评论 0原文

我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧夏天 2024-09-23 00:58:59

使用 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 the cv::Mat::create() function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文