Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

shift.im

Apply Vector Translation To Pixel Image


Description

Applies a vector shift to a pixel image

Usage

## S3 method for class 'im'
shift(X, vec=c(0,0), ..., origin=NULL)

Arguments

X

Pixel image (object of class "im").

vec

Vector of length 2 representing a translation.

...

Ignored

origin

Location that will be shifted to the origin. Either a numeric vector of length 2 giving the location, or a point pattern containing only one point, or a list with two entries named x and y, or one of the character strings "centroid", "midpoint", "left", "right", "top", "bottom", "topleft", "bottomleft", "topright" or "bottomright" (partially matched).

Details

The spatial location of each pixel in the image is translated by the vector vec. This is a method for the generic function shift.

If origin is given, the argument vec will be ignored; instead the shift will be performed so that the specified geometric location is shifted to the coordinate origin (0,0). The argument origin should be either a numeric vector of length 2 giving the spatial coordinates of a location, or one of the character strings "centroid", "midpoint", "left", "right", "top", "bottom", "topleft", "bottomleft", "topright" or "bottomright" (partially matched). If origin="centroid" then the centroid of the window will be shifted to the origin. If origin="midpoint" then the centre of the bounding rectangle of the window will be shifted to the origin. If origin="bottomleft" then the bottom left corner of the bounding rectangle of the window will be shifted to the origin, and so on.

Value

Another pixel image (of class "im") representing the result of applying the vector shift.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

# make up an image
 X <- setcov(unit.square())
 plot(X)

 Y <- shift(X, c(10,10))
 plot(Y)
 # no discernible difference except coordinates are different

 shift(X, origin="c")

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.