transzoom: Zoom, translate and rotate array image

Description Usage Arguments Value Author(s) Examples

View source: R/transzoom.R

Description

Zoom/rotate/translate an image relative to its center for images represented as simple arrays.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
transzoom(
  img = NULL,
  zoom = 1,
  shift = c(0, 0),
  angle = 0,
  size = NULL,
  col = "black",
  filter = "bilinear",
  file.in = "",
  file.out = "",
  format = "png",
  show.image = TRUE
)

Arguments

img

n-by-m-by-3 array or n-by-m-by-4 array representing an rgb(+alpha) image.

zoom

zoom factor (>0).

shift

2-vector specifying the vertical+horizontal translation in units of output pixels (i.e. after zooming).

angle

rotation angle in degrees.

size

2-vector specifying the vertical+horizontal dimensions of the output image. If not given, this is taken to be identical to the input image.

col

background color

filter

affine transformation filter; either 'none' or 'bilinear'

file.in

optional input filename, which can be used to load an image instead of providing it via img. This filename is ignored if img is specified.

file.out

optional output filename.

format

one of "png" or "jpg" specifying the file format of the input and output image.

show.image

logical flag specifying whether the image is displayed in the R console.

Value

Returns an n-by-m-by-3 array or n-by-m-by-4 array of the processed image.

Author(s)

Danail Obreschkow

Examples

1
2
img = yinyangyong # this is an example image included in the package
transzoom(img, zoom=2) # zoom by a factor 2

graphx documentation built on Feb. 3, 2022, 5:07 p.m.

Related to transzoom in graphx...