Learn R Programming

adimpro (version 0.9.3)

shrink.image: Image Processing

Description

Shrink resolution of an image

Usage

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

Value

shrinked image

Arguments

img

image data, an object of class "adimpro".

method

method to be used to shrink the image. "median" (default), "mean", or "nearest". "median" is supposed to give best results. For a considerably faster result use "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.

Author

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

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 "nearest" 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 "median" set the color of a pixel as color of an L1-generalized median of all pixel identified with the new coordinate.

Examples

Run this code
if (FALSE) demo(manipulate)

Run the code above in your browser using DataLab