# cropimage: Crops a rectangular image to a specified (square) dimension In LS2Wstat: A Multiscale Test of Spatial Stationarity for LS2W Processes

## Description

If the input image is not of dimension 2^n \times 2^n, for some n, then the image is cropped to an optionally specified size.

## Usage

 1 cropimage(image, newsize = NULL, pos = "e") 

## Arguments

 image The image you wish to crop. newsize An optional dimension (smaller than the original image dimension), to which the image should be cropped. pos The position of the subimage to take when cropping an image. See the documentation for mix2images for more details.

## Details

As we often wish to work with images whose dimensions are some power of 2, this function will determine whether the image is of an appropriate size and if not it will crop the image so that it is. The optional pos argument specifies the position of the cropped subimage to be returned; for example pos="e" specifies the central region. See mix2images for more details on the positioning argument.

## Value

 subim A square image with dimension 2^n \times 2^n, where n is either newsize or the largest feasible dyadic power smaller than the original image dimensions.

Matt Nunes

## See Also

mix2images

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 # #Create an image with dimensions not a power of two # testimage <- matrix(rnorm(300^2),nrow=300,ncol=300) # #Crop the image # Newimage <- cropimage(testimage) # # Check new dimension size. # dim(Newimage) # 

LS2Wstat documentation built on March 26, 2020, 6:47 p.m.