Learn R Programming

OpenImageR (version 1.0)

translation: image translation

Description

shift the position of an image by adding/subtracting a value to/from the X or Y coordinates

Usage

translation(image, shift_rows = 0, shift_cols = 0)

Arguments

image
a matrix, data frame or 3-dimensional array
shift_rows
a positive or negative integer specifying the direction that the rows should be shifted
shift_cols
a positive or negative integer specifying the direction that the columns should be shifted

Value

a matrix or 3-dimensional array

Details

If shift_rows is not zero then the image will be sifted row-wise (upsides or downsides depending on the sign). If shift_cols is not zero then the image will be sifted column-wise (right or left depending on the sign).

Examples

Run this code

path = system.file("tmp_images", "1.png", package = "OpenImageR")

image = readImage(path)

res_tr = translation(image, shift_rows = 10, shift_cols = -10)

Run the code above in your browser using DataLab