SpatEntropy (version 0.1.0)

coords_pix: Pixel coordinates generation.

Description

coords_pix generates the coordinates of the pixel centroids, given an obervation area and the pixel size. The resulting coordinates may be used as arguments of euclid_dist().

Usage

coords_pix(area, pixel.xsize = diff(area$xrange)/ncol,
  pixel.ysize = diff(area$yrange)/nrow,
  nrow = diff(area$yrange)/pixel.ysize,
  ncol = diff(area$xrange)/pixel.xsize)

Arguments

area

The observation area, an owin object, see package spatstat

pixel.xsize

A scalar, length of the pixel side along the \(x\) axis (unnecessary if ncol is provided)

pixel.ysize

A scalar, length of the pixel side along the \(y\) axis (unnecessary if nrow is provided)

nrow

An integer, number of pixels along the \(y\) axis (unnecessary if pixel.ysize is provided)

ncol

An integer, number of pixels along the \(x\) axis (unnecessary if pixel.xsize is provided)

Value

A two column matrix containing the \(x\) and \(y\) coordinates of the pixel centroids.

Details

When the Euclidean distance is computed between areas, the most common choice is to use the area centroid as the reference point. This function returns the centroids of a regular lattice. You can either provide the number of pixels along the two cardinal directions (using ncol for the \(x\) direction and nrow for the \(y\) direction), or alternatively provide the pixel size along the two directions (rectangular areas are allowed).

Examples

Run this code
# NOT RUN {
ccc=coords_pix(area=square(10), nrow=10, ncol=10)
plot(square(10)); points(ccc)

ccc=coords_pix(area=square(10), pixel.xsize = 2, pixel.ysize = 2)
plot(square(10)); points(ccc, pch=16)

# }

Run the code above in your browser using DataLab