Skip to contents

undistort transforms an image to compensate for radial and tangential lens distortion.

Usage

undistort(
  image,
  camera_matrix,
  dist_coefs,
  new_camera_matrix = camera_matrix,
  target = "new"
)

Arguments

image

An Image object.

camera_matrix

A 3x3 camera intrinsic matrix as returned by calibrateCamera.

dist_coefs

A single row matrix with 4, 5, 8, 12 or 14 elements as returned by calibrateCamera.

new_camera_matrix

A 3x3 camera intrinsic matrix as returned by getOptimalNewCameraMatrix if you chose to execute this optional step (default: camera_matrix).

target

The location where the results should be stored. It can take 3 values:

  • "new":a new Image object is created and the results are stored inside (the default).

  • An Image object:the results are stored in another existing Image object. This is fast and will not replace the content of image but will replace that of target. Note that target must have the same dimensions, bit depth, and number of channels as image.

Value

If target="new", the function returns an Image

object. If target is an Image object, the function returns nothing and modifies that Image object in place.

Author

Simon Garnier, garnier@njit.edu

Examples

# See the help vignette:
if (FALSE)  vignette("z8_calib", package = "Rvision")