resize {EBImage} | R Documentation |
Rotates, mirrors and resizes images.
flip(x) flop(x) resize(x, w, h, blur=1, filter="Lanczos") rotate(x, angle=90) affine(x, m)
x |
An |
w, h |
Width and height of a new image. One of these arguments can be missing to enable proportional resizing. |
blur |
The blur factor, where 1 ( |
filter |
Interpolating sampling filter. |
angle |
Image rotation angle in degrees. |
m |
The affine 3x2 transformation matrix. |
flip
transforms x
in its vertical mirror image by
reflecting the pixels around the central x-axis.
flop
transforms x
in its horizontal mirror image by
reflecting the pixels around the central y-axis.
resize
scales the image to the desired dimensions using the supplied
interpolating filter. Available filters are: Point
, Box
,
Triangle
, Hermite
, Hanning
, Hamming
,
Blackman
, Gaussian
, Quadratic
, Cubic
,
Catrom
, Mitchell
, Lanczos
, Bessel
and
Sinc
. The filter Box
performs a nearest-neighbor
interpolation and is fast but introduces considerable aliasing. The
filter Triangle
performs a bilinear interpolation and is a
good trade-off between speed adn aliasing. Cubic interpolation with
the filter Cubic
is also a good trade-off. High-quality and slower
interpolation is achieved with the Lanczos
filter. The
algorithm used by this ImageMagick function is not well defined.
rotate
rotates the image counter-clockwise with the specified
angle. Rotated images are usually larger than the originals and have
empty triangular corners filled in black. The algorithm used by this
ImageMagick function is not well defined.
affine
returns the affine transformation of the image, where
pixels coordinates, denoted by the matrix px
, are
transformed to cbind(px, 1)%*%m
.
An Image
object or an array, containing the transformed version
of x
.
Oleg Sklyar, osklyar@ebi.ac.uk, 2006-2007
ImageMagick: http://www.imagemagick.org.
translate
x = readImage(system.file("images", "lena.gif", package="EBImage")) if (interactive()) display(x) y = flip(x) if (interactive()) display(y, title='flip(x)') y = flop(x) if (interactive()) display(y, title='flop(x)') y = resize(x, 128) if (interactive()) display(y, title='resize(x, 128)') y = rotate(x, 30) if (interactive()) display(y, title='rotate(x, 30)') m = matrix(c(0.6, 0.2, 0, -0.2, 0.3, 300), nrow=3) if (interactive()) display(affine(x, m), title='affine transform')