OpenCV stereo vision 3D coordinates to 2D camera-plane projection different than triangulating 2D points to 3D

女生的网名这么多〃 提交于 2020-02-02 15:33:30

问题


I get an image point in the left camera (pointL) and the corresponding image point in the right camera (pointR) of my stereo camera using feature matching. The two cameras are parallel and are at the same "hight". There is only a x-translation between them.

I also know the projection matrices for each camera (projL, projR), which I got during calibration using initUndistortRectifyMap.

For triangulating the point, I call: triangulatePoints(projL, projR, pointL, pointR, pos3D) (documentation), where pos3D is the output 3D position of the object.

Now, I want to project the 3D-coordinates to the 2D-image of the left camera:

2Dpos = projL*3dPos

The resulting x-coordinate is correct. But the y-coodinate is about 20 pixels wrong.

How can I fix this?

Edit: Of course, I need to use homogeneous coordinates, in order to multiply it with the projection matrix (3x4). For that reason, I set:

3dPos[0] = x;
3dPos[1] = y;
3dPos[2] = z;
3dPos[3] = 1;

Is it wrong, to set 3dPos[3]to 1?

Note:

  1. All images are remapped, I do this in a kind of preprocessing step.
  2. Of course, I always use the homogeneous coordinates

回答1:


You are likely projecting into the rectified camera. Need to apply the inverse of the rectification warp to obtain the point in the original (undistorted) linear camera coordinates, then apply distortion to get into the original image.



来源:https://stackoverflow.com/questions/36966759/opencv-stereo-vision-3d-coordinates-to-2d-camera-plane-projection-different-than

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!