[][src]Function opencv::calib3d::fisheye_undistort_image

pub fn fisheye_undistort_image(
    distorted: &dyn ToInputArray,
    undistorted: &mut dyn ToOutputArray,
    k: &dyn ToInputArray,
    d: &dyn ToInputArray,
    knew: &dyn ToInputArray,
    new_size: Size
) -> Result<()>

Transforms an image to compensate for fisheye lens distortion.

Parameters

  • distorted: image with fisheye lens distortion.
  • undistorted: Output image with compensated fisheye lens distortion.
  • K: Camera matrix inline formula.
  • D: Input vector of distortion coefficients inline formula.
  • Knew: Camera matrix of the distorted image. By default, it is the identity matrix but you may additionally scale and shift the result by using a different matrix.
  • new_size: the new size

The function transforms an image to compensate radial and tangential lens distortion.

The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap (with bilinear interpolation). See the former function for details of the transformation being performed.

See below the results of undistortImage.

  • a) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3, k_4, k_5, k_6) of distortion were optimized under calibration)
  • b) result of fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2, k_3, k_4) of fisheye distortion were optimized under calibration)
  • c) original image was captured with fisheye lens

Pictures a) and b) almost the same. But if we consider points of image located far from the center of image, we can notice that on image a) these points are distorted.

image

C++ default parameters

  • knew: cv::noArray()
  • new_size: Size()