在OpenCV中使用FindExtrinsicCameraParams2 [英] using FindExtrinsicCameraParams2 in OpenCV

查看:1345
本文介绍了在OpenCV中使用FindExtrinsicCameraParams2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个共面点在对象坐标和相应的图像点(在图像平面上)。我想计算物体平面相对于摄像机的相对平移和旋转。



FindExtrinsicCameraParams2应该是解决方案。但我使用它有麻烦。编译时显示错误



有没有人在OpenCV中成功使用此功能?我可以有一些意见或示例代码使用这个函数?



谢谢!

解决方案

我会使用OpenCV函数< a href =http://opencv.willowgarage.com/documentation/python/camera_calibration_and_3d_reconstruction.html#findhomography =nofollow> FindHomography(),因为它更简单,您可以轻松地从单应性转换为外在参数。



您必须像这样调用函数

  FindHomography (srcPoints,dstPoints,H,method,ransacReprojThreshold = 3.0,status = None)

方法是CV_RANSAC。如果你超过4分,RANSAC将选择最好的4点集合来满足模型。



你会得到H的单应性,如果你想将其转换为外部参数,您应该按照帖子中的说明进行操作。


$ b $基本上,外部矩阵(Pose)具有等于tp单应性的第一,第二和第四列。第三列是多余的,因为它是第一列和第二列的交叉产物。


I have 4 coplanar points in object coordinates and the correspoinding image points (on image plane). I want to compute the relative translation and rotation of the object plane with respect to the camera.

FindExtrinsicCameraParams2 is supposed to be the solution. But I'm having troubles with using it. Errors keep on showing when compiling

Has anyone successfully used this function in OpenCV?? Could I have some comments or sample code to use this function??

Thank you!

解决方案

I would use the OpenCV function FindHomography() as it is simpler and you can converto easily from homography to extrinsic parameters.

You have to call the function like this

FindHomography(srcPoints, dstPoints, H, method, ransacReprojThreshold=3.0, status=None)

method is CV_RANSAC. If you pass more than 4 points, RANSAC will select the best 4-point set to satisfy the model.

You will get the homography in H, and if you want to convert it to extrinsic parameters you should do what I explain in this post.

Basically, the extrinsics matrix (Pose), has the first, second and fourth columns equal tp homography. The third column is redundant because it is the crossproduct of columns one and two.

这篇关于在OpenCV中使用FindExtrinsicCameraParams2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆