在立体视觉中将一个图像的像素映射到另一个图像

Mapping pixel from one image to the other image in stereo vision

现在我有两个摄像头并完成了立体校准步骤以获取内部和外部参数。我在左相机中提取了几个特征点,想知道有什么方法可以将它们映射到右图像上。有人可以帮忙吗?

我试过像这样通过每个相机的旋转和平移矩阵来计算它们。

通过openCV中的SolvePnP函数,我得到了左摄像头R1 T1和右摄像头R2 T2。

到同一个世界点[X,Y,Z],我可以得到

[x1,y1,z1] = R1[X,Y,Z]+T1

[x2,y2,z2] = R2[X,Y,Z]+T2 

哪个相机在自己的坐标系中坐标。

当我尝试通过

映射 [x1,y1,z1] 和 [x2,y2,z2] 时
R2*inv(R1)[x1,x2,x3]+(T2-R2*inv(R1)*T1) = [x2,y2,z2]

我得到了这个结果。

左图是左图用上述方法映射棋盘角的结果;右图是findChessBoardCorner计算的右图角点:

旋转和平移矩阵将世界坐标系中的3D坐标映射到相机本地3D坐标为了找到2D-2D变换i建议你使用单应性:

https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=findhomography#findhomography

Results From function "findHomography"

通过"findHomography"计算点映射关系只适用于棋盘的平面(我从棋盘的角落得到关系)。然而,当我用 H 计算 foreground/background 点时,结果如上所示。

问题应该是"matrix H is work on 2-D coordinate system(or object on a plane like chessboard above, that`s why it woks if i reflect a chessboard point to the other image), object of fore/background their coordinate is on a 3-D coordinate system which mapping on image, that means the matrix failed working(actually i think its not failed working, it mapped the point on the extend position of chessboard)"

解决上述问题,我认为的思路是"reproject image point to a 3d coordinate system(perhaps with help of ToF camera or other way), call 'solvePnP' function to get pose relation R,T between world point on left and right camera. pick any point on left image, reproject back on 3D coordinate system, and back-project to right image by R,T"