Search code examples
pythonopencvtransformationprojection-matrix

Convert 2D point in image(with perspective) to 3D world coordinate


I want to convert a given pixel point P1 (u,v) to a 3D world coordinate (x,y), the problem is that the plane is not vertically aligned to the camera lens which introduces the perspective problem.

I've calibrated my camera and retrieved the extrinsic and intrinsic parameters, moreover, I also know the height on which the camera is mounted on.

If the plane would have been vertically aligned with the camera lens, I would simply have used the pin-hole camera model to retrieve the x,y coordinate:

X = Z / fx * (u - cx)
Y = Z / fy * (v - cy)
[Z = D]

But since I've mounted the camera with an angle to the plane, this is not true anymore. So what method can be used to solve the problem with the given info?


Solution

  • I found a solution to the answer here: https://dsp.stackexchange.com/a/46591/46122

    I also successfully solved it by using the method mentioned here: Computing x,y coordinate (3D) from image point