Search code examples
c#3dtriangulation

Function that finds 3D position of a point given its position in stereo images


Clarification: You have a point in 3D space and a stereo camera setup that captures the point in its left and right images. Is there a function that uses the pixel coordinates of the point in both images (along with the intrinsic/extrinsic parameters of the stereo rig) and outputs the 3D coordinates of the point?

I've looked through the EMGU library and tried googling others that might have it, but I've had no luck.

Any help would be appreciated.


Solution

  • Assuming the images have been rectified

    Z = (b * f) / (Xleft - Xright)
    

    where

    • Z = point Z coordinate in 3D space
    • b = baseline = distance between stereo cameras
    • f = focal length
    • Xleft = x coordinate of point in left image
    • Xright = x coordinate of point in right image