| shrink.image {adimpro} | R Documentation |
Shrink resolution of an image
shrink.image(img, method = "gap",
xt = img$dim[1], yt = img$dim[2], ratio = TRUE,
compress=TRUE)
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. |
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.
shrinked image
Karsten Tabelow tabelow@wias-berlin.de, Joerg Polzehl polzehl@wias-berlin.de
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)")