Skip to content

fisheye_undistortImage

Image processingfunctionOpenCV 5.0.0
import { fisheye_undistortImage } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSdistorted, undistorted, K, D
FUNCTIONfisheye_undistortImage
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Transforms an image to compensate for fisheye lens distortion.

fisheye_undistortImage(distorted: Mat, undistorted: Mat, K: Mat, D: Mat, Knew: Mat, new_size: Size): void;
3 available overloads
fisheye_undistortImage(distorted: Mat, undistorted: Mat, K: Mat, D: Mat): void;
fisheye_undistortImage(distorted: Mat, undistorted: Mat, K: Mat, D: Mat, Knew: Mat): void;
fisheye_undistortImage(distorted: Mat, undistorted: Mat, K: Mat, D: Mat, Knew: Mat, new_size: Size): void;
distorted

image with fisheye lens distortion.

undistorted

Output destination, filled by the native operation. Output image with compensated fisheye lens distortion.

K

Camera intrinsic matrix cameramatrix{K}.

D

Input vector of distortion coefficients \distcoeffsfisheye.

Knew

Camera intrinsic 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 #cv::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 #cv::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

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.