Function mrpt::img::camera_geometry::undistort_points_to_unit_plane

Function Documentation

void mrpt::img::camera_geometry::undistort_points_to_unit_plane(const std::vector<mrpt::img::TPixelCoordf> &distortedPixels, std::vector<mrpt::math::TPoint2D> &normalizedCoords, const mrpt::img::TCamera &cameraParams)

Convert distorted pixels to normalized image plane coordinates.

This is the key function for 3D reconstruction and ray casting. It:

  1. Removes lens distortion

  2. Converts to normalized coordinates on the z=1 plane

  3. Returns coordinates that satisfy: pixel ray direction = (x, y, 1)

The output normalized coordinates (x,y) represent the intersection of the pixel’s ray with the z=1 plane in the camera coordinate system. For a 3D point P=(X,Y,Z) in camera frame, it projects to normalized coords (X/Z, Y/Z).

Usage example for 3D ray computation:

TPoint2D norm = normalizedCoords[i];
TPoint3D ray_direction(norm.x, norm.y, 1.0);
// Ray from camera origin: P(t) = camera_origin + t * ray_direction

See also

undistort_points

Note

Output are NOT pixel coordinates but normalized 3D ray parameters

Parameters:
  • distortedPixels – [IN] Distorted pixel coordinates from camera

  • normalizedCoords – [OUT] Normalized coordinates on z=1 plane (resized automatically)

  • cameraParams – [IN] Complete camera model