如何从 opencv 2.2 中的文件中读取内在矩阵和畸变矩阵
我已经有了为我的相机制作的“instinsic.xml”和“ Distortion.xml”。现在我正在使用 OpenCV 2.2 接口编写一个程序,因此我主要使用 cv::Mat 数据结构而不是 CvMat。我想将这两个文件加载到相应的 cv::Mat 结构中。对于以前的 OpenCV API,我会写:
CvMat* intrinsic = (CvMat*) cvLoad("Intrinsics.xml");
CvMat* distortion = (CvMat*) cvLoad("Distortions.xml");
如何在 OpenCV 2.2 中实现这一点?是否有一个函数可以将 xml 文件加载到 cv::Mat 中?我查遍了 API 文档,但没有找到。
谢谢,
I already have "instinsic.xml" and "distortion.xml" which was produced for my camera. Now I am writing a program using OpenCV 2.2 interface and therefore I am mainly working with cv::Mat data structure as opposed to CvMat. I want to load these two files into corresponding cv::Mat structure. With previous API for OpenCV I would write:
CvMat* intrinsic = (CvMat*) cvLoad("Intrinsics.xml");
CvMat* distortion = (CvMat*) cvLoad("Distortions.xml");
How can I achieve this in OpenCV 2.2? Is there a function that would load the xml file into a cv::Mat for me? I looked all over the API documentation but could not find it.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的东西应该对你有好处:
代码是某种示例。 OpenCV 的示例目录中还有其他一些非常相关的内容,并且对这些类型的操作有很大帮助...
我热烈建议您也使用 fs.isOpened() 测试打开,代码可以完成...
< a href="http://opencv.willowgarage.com/documentation/cpp/core_xml_yaml_persistence.html" rel="noreferrer">有关更多信息,这是文档
Julien,
Something like this should be good for you :
The code is some sort of a sample. There are others in the samples directory of OpenCV which are really relevant and help a lot in these types of manipulations...
I warmly advise you to test the opening with fs.isOpened() aswell, the code could be completed...
For more info, here is the doc
Julien,