Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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, padded_value = 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

padded_value

either a numeric value or a numeric vector of length 3 (corresponding to RGB). If it's not equal to 0 then the values of the shifted rows or columns will be filled with the user-defined padded_value

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).

Value

a matrix or 3-dimensional array

Examples

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

image = readImage(path)

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

OpenImageR

An Image Processing Toolkit

v1.1.8
GPL-3
Authors
Lampros Mouselimis [aut, cre] (<https://orcid.org/0000-0002-8024-1546>), Sight Machine [cph] (findHOGFeatures function of the SimpleCV computer vision platform), Johannes Buchner [cph] (average_hash, dhash and phash functions of the ImageHash python library), Mohammad Haghighat [cph] (Gabor Feature Extraction), Radhakrishna Achanta [cph] (Author of the C++ code of the SLIC and SLICO algorithms (for commercial use please contact the author))
Initial release
2021-05-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.