Skip to contents

remap transforms the source image using the specified maps and interpolation methods.

Usage

remap(
  image,
  map1,
  map2,
  interpolation = "linear",
  border_type = "constant",
  border_color = "black",
  target = "new"
)

Arguments

image

An Image object.

map1, map2

Image objects representing a joint undistortion and rectification transformation as computed by initUndistortRectifyMap.

interpolation

A character string representing the type of interpolation to use during transformation (default: "linear"). See notes for all accepted interpolation methods. It can be any of the following:

"nearest":

nearest neighbor interpolation.

"linear":

bilinear interpolation.

"cubic":

bicubic interpolation.

"Lanczos":

Lanczos interpolation over 8x8 neighborhood.

border_type

A character string indicating the extrapolation method to use when filling empty pixels created during the transformation. It can be any of the following:

"constant" (the default):

iiiiii|abcdefgh|iiiiii with i specified by border_value.

"replicate":

aaaaaa|abcdefgh|hhhhhh.

"reflect":

fedcba|abcdefgh|hgfedc.

"wrap":

cdefgh|abcdefgh|abcdef.

"reflect_101":

gfedcb|abcdefgh|gfedcb.

"transparent":

uvwxyz|abcdefgh|ijklmn.

border_color

A value or vector of any kind of R color specification compatible with col2bgr representing the color of the border (default: "black").

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 but will replace the content of target. Note that target must have the same dimensions, bit depth and number of channels as image but that it cannot be image itself or an error will be thrown.