lensCorrection: Corrects lens distortion in raw X,Y-coordinates.

Description Usage Arguments Value Note Examples

View source: R/lensCorrection.R

Description

Corrects lens distortion using the formula R = r (ar^3 + br^2 + cr + d ), where r is the distance to the image center and R is the equivalent radius for the corrected image.

Usage

1
lensCorrection(m, imWidth, imHeight, a = 0, b = 0, c = 0)

Arguments

m

a matrix with X,Y-coordinate data labelled 'X' and 'Y'.

imWidth, imHeight

the width and height of the original image.

a, b, c

parameters used to correct lens distortion.

Value

The inputted matrix with corrected X,Y-coordinates.

Note

Ready-made undistortion parameters for particular cameras can be found online (e.g. http://sourceforge.net/projects/hugin/files/PTLens%20Database). Parameters can be estimated manually using a checkerboard calibration image and the undistortion feature in image manipulation programs such as ImageMagick (http://imagemagick.org), or automatically using Hugin's lens calibration tool (http://wiki.panotools.org/Calibrate_lens_gui). See http://www.imagemagick.org/Usage/lens/ for more information on lens correction.

Examples

1
2
3
data(tenebrio_basic)

tenebrio_basic <- lensCorrection(tenebrio_basic, 640, 480, b = -0.022)

JoGall/rubitrail documentation built on May 7, 2019, 10:53 a.m.