transzoom {cooltools}R Documentation

Zoom, translate and rotate array image

Description

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

Usage

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


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


[Package cooltools version 2.4 Index]