machinevisiontoolbox.Image.undistort
- Image.undistort(K, dist)
Undistort image
- Parameters:
K (ndarray(3,3)) – camera intrinsics
dist (array_like(5)) – lens distortion parameters
- Returns:
undistorted image
- Return type:
Image
Remove lens distortion from image.
The distortion coefficients are \((k_1, k_2, p_1, p_2, k_3)\) where \(k_i\) are radial distortion coefficients and \(p_i\) are tangential distortion coefficients.
Example:
>>> from machinevisiontoolbox import Image, ImageCollection >>> import numpy as np >>> images = ImageCollection("calibration/*.jpg") >>> K = np.array([[ 534.1, 0, 341.5], [ 0, 534.1, 232.9], [ 0, 0, 1]]) >>> distortion = np.array([ -0.293, 0.1077, 0.00131, -3.109e-05, 0.04348]) >>> out = images[12].undistort(K, distortion) >>> out.disp() <matplotlib.image.AxesImage object at 0x7f6af29ae2b0>
- Seealso:
images2C
opencv.undistort