shrink.image {adimpro}R Documentation

Image Processing

Description

Shrink resolution of an image

Usage

shrink.image(img, method = "gap",
             xt = img$dim[1], yt = img$dim[2], ratio = TRUE,
             compress=TRUE)

Arguments

img image data, an object of class "adimpro".
method method to be used to shrink the image. "gap" (default), "mean", or "nearest"
xt target x-dimension
yt target y-dimension
ratio logical. preserve x-y ratio? default: TRUE
compress logical, determines if image data are stored in raw-format.

Details

This function shrinkes the resolution of the image such that the x-y dimension of the resulting image is smaller than the original one. xt and yt give the target dimension of the image. If ratio == TRUE (default) the ratio between x- and y-dimension is preserved.

method "gap" selects a pixel nearest to the new coordinates. method "mean" defines the color of a pixel as the mean of all pixel identified with the new coordinate. method "nearest" set the color of a pixel as color of an representative pixel from the original image.

Value

shrinked image

Author(s)

Karsten Tabelow tabelow@wias-berlin.de, Joerg Polzehl polzehl@wias-berlin.de

Examples

img <- read.image(system.file("img/wias.ppm",package="adimpro"))
X11(height=3,width=9)
par(mfrow=c(1,3))
show.image(img,main="Original Image")
img.shrink1 <- shrink.image(img,method="gap")
img.shrink2 <- shrink.image(img,method="nearest",xt=20,yt=20)
show.image(img.shrink1,main="Shrinked Image (gap)")
show.image(img.shrink2,main="Shrinked Image (nearest)")

[Package adimpro version 0.4.4 Index]