Transforms the image to compensate radial and tangential lens distortion.
The camera matrix and distortion parameters can be determined using cvCalibrateCamera2. For every pixel in the output image the function computes coordinates of the corresponding location in the input image using the formulae in the section beginning. Then, the pixel value is computed using bilinear interpolation. If the resolution of images is different from what was used at the calibration stage, fx, fy, cx and cy need to be adjusted appropriately, while the distortion coefficients remain the same

C# | Visual Basic | Visual C++ |
public static Image<C, D> Undistort2<C, D>( Image<C, D> src, IntrinsicCameraParameters intrin ) where C : new(), ColorType where D : new(), IComparable
Public Shared Function Undistort2(Of C As {New, ColorType}, D As {New, IComparable}) ( _ src As Image(Of C, D), _ intrin As IntrinsicCameraParameters _ ) As Image(Of C, D)
public: generic<typename C, typename D> where C : gcnew(), ColorType where D : gcnew(), IComparable static Image<C, D>^ Undistort2( Image<C, D>^ src, IntrinsicCameraParameters^ intrin )

- C
- The color type of the image
- D
- The depth of the image

- src (Image<(Of <(C, D>)>))
- The distorted image
- intrin (IntrinsicCameraParameters)
- The intrinsic camera parameters

The corrected image