如果您拥有查看同一场景的两个图像的完整相对 3D 值(相对 x、y、z),以及它们之间的外部/内部参数,那么如何将一个场景中的点投影到另一个场景中,在opencv中?
一般情况下你不能这样做。有无数个 3D 点(3d 中的一条线)映射到图像空间中的一个点,在另一张图像中,这条线不会映射到单个点,而是一条线(请参见维基百科关于对极几何的文章 http://en.wikipedia.org/wiki/Epipolar_geometry#Epipolar_line)。您可以计算该点必须位于的直线上基本矩阵 http://en.wikipedia.org/wiki/Fundamental_matrix_%28computer_vision%29.
If you do have a depth map, reproject the point into 3D - using the equations on the top of the opencv page on camera calibration http://opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction.html#cv-reprojectimageto3d, especially this one (it's the only one you need):
u and v are your pixel coordinates, the first matrix is your camera matrix (for the image you are looking at currently), the second one is the matrix containing the extrinsic parameters, Z you know (from your depth map), X and Y are the ones you are looking for - you can solve for those parameters, and then use the same equation to project the point into your other camera. You can probably use the PerspectiveTransform function from opencv to do the work for you, however I can't tell you from the top of my head how to build the projection matrix.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)