MATLAB File Help: cv.undistortPoints Index
cv.undistortPoints

Computes the ideal point coordinates from the observed point coordinates

dst = cv.undistortPoints(src, cameraMatrix, distCoeffs)
dst = cv.undistortPoints(..., 'OptionName', optionValue, ...)

Input

Output

Options

The function is similar to cv.undistort and cv.initUndistortRectifyMap but it operates on a sparse set of points instead of a raster image. Also the function performs a reverse transformation to cv.projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a planar object, it does, up to a translation vector, if the proper R is specified.

% (u,v) is the input point, (up, vp) is the output point
% camera_matrix = [fx 0 cx; 0 fy cy; 0 0 1]
% P = [fxp 0 cxp tx; 0 fyp cyp ty; 0 0 tz]
xpp = (u - cx)/fx
ypp = (v - cy)/fy
(xp,yp) = cv.undistort(xpp, ypp, dist_coeffs)
[X,Y,W]' = R*[xp yp 1]'
x = X/W, y = Y/W
up = x*fxp + cxp
vp = y*fyp + cyp

where cv.undistort is an approximate iterative algorithm that estimates the normalized original point coordinates out of the normalized distorted point coordinates ("normalized" means that the coordinates do not depend on the camera matrix).

The function can be used for both a stereo camera head or a monocular camera (when R is empty).

See also