crop: Image cropping

Description Usage Arguments Value Examples

Description

image cropping from the center.

Usage

1
crop(x, width=300, height=300, shift=c(0,0))

Arguments

x

A raster or a matrix

width

width for cropping

height

height for cropping

shift

shift of the cropped position from the center

Value

A raster or a matrix

Examples

1
2
3
4
5
6
7
8
9
data(camphora)	
par(mfrow=c(2,2))
image(rot90c(camphora),col=gray(c(0:255)/255), main="original", useRaster=TRUE, axes=FALSE, asp=1)
image(rot90c(crop(camphora,200,100)),col=gray(c(0:255)/255),
main="cropped from the center", useRaster=TRUE, axes=FALSE, asp=0.5)
image(rot90c(crop(camphora,200,200)),col=gray(c(0:255)/255),
main="cropped from the center", useRaster=TRUE, axes=FALSE, asp=1)
image(rot90c(crop(camphora,200,200,shift=c(50,50))),col=gray(c(0:255)/255),
main="cropped from shifted position c(50,50)", useRaster=TRUE, axes=FALSE, asp=1)

Example output



wvtool documentation built on May 1, 2019, 10:27 p.m.

Related to crop in wvtool...