barrel and pincushion lens distortion correction

I = LENSDISTORT(I, k)corrects for radially symmetric distortions
6,5K téléchargements
Mise à jour 31 août 2012

Afficher la licence

I = LENSDISTORT(I, k)corrects for radially symmetric distortions, where
I is the input image and k is the distortion parameter. lens distortion
can be one of two types: barrel distortion and pincushion distortion.
In "barrel distortion", image magnification decreases with
distance from the optical axis. The apparent effect is that of an image
which has been mapped around a sphere (or barrel). In "pincushion
distortion", image magnification increases with the distance from the
optical axis. The visible effect is that lines that do not go through the
centre of the image are bowed inwards, towards the centre of the image,
like a pincushion [1].

I = LENSDISTORT(...,PARAM1,VAL1,PARAM2,VAL2,...) creates a new image,
specifying parameters and corresponding values that control various aspects
of the image distortion correction. Parameter names case does not matter.

Parameters include:

'bordertype' String that controls the treatment of the image
edges. Valid strings are 'fit' and 'crop'. By
default, 'bordertype' is set to 'crop'.

'interpolation' String that specifies the interpolating kernel
that the separable resampler uses. Valid
strings are 'cubic', 'linear' and 'nearest'. By
default, the 'interpolation' is set to 'cubic'

'padmethod' string that controls how the resampler
interpolates or assigns values to output elements
that map close to or outside the edge of the input
array. Valid strings are 'bound', circular',
'fill', 'replicate', and symmetric'. By
default, the 'padmethod' is set to 'fill'

'ftype' Integer between 1 and 4 that specifies the
distortion model to be used. The models
available are

'ftype' = 1: s = r.*(1./(1+k.*r));

'ftype' = 2: s = r.*(1./(1+k.*(r.^2)));

'ftype' = 3: s = r.*(1+k.*r);

'ftype' = 4: s = r.*(1+k.*(r.^2));

By default, the 'ftype' is set to 4.

Class Support
An input intensity image can be uint8, int8, uint16, int16, uint32,
int32, single, double, or logical. An input indexed image can be uint8,
uint16, single, double, or logical.

% read image
I = imread('cameraman.tif');

% Distort Image
I2 = lensdistort(I, 0.1);

% Display both images
imshow(I), figure, imshow(I2)

[1], August 2012.

[2] Harri Ojanen, "Automatic Correction of Lens Distortion by Using
Digital Image Processing," July 10, 1999.

[3] G.Vassy and T.Perlaki, "Applying and removing lens distortion in post
production," year???

[4], August 2012.

Created by Jaap de Vries, 8/31/2012


Citation pour cette source

Jaap de Vries (2024). barrel and pincushion lens distortion correction (, MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2012a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
En savoir plus sur Read, Write, and Modify Image dans Help Center et MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version

8-31-2012 Made some spelling corrections and added an example.pdf file and example images