where.max: Find Location of Maximum in a Pixel Image

View source: R/images.R

where.maxR Documentation

Find Location of Maximum in a Pixel Image

Description

Finds the spatial location(s) where a given pixel image attains its maximum or minimum value.

Usage

  where.max(x, first = TRUE)
  where.min(x, first = TRUE)

Arguments

x

A pixel image (object of class "im") or data that can be converted to a pixel image by as.im.

first

Logical value. If TRUE (the default), then only one location will be returned. If FALSE, then all locations where the maximum is achieved will be returned.

Details

This function finds the spatial location or locations where the pixel image x attains its maximum or minimum value. The result is a point pattern giving the locations.

If first=TRUE (the default), then only one location will be returned, namely the location with the smallest y coordinate value which attains the maximum or minimum. This behaviour is analogous to the functions which.min and which.max.

If first=FALSE, then the function returns the locations of all pixels where the maximum (or minimum) value is attained. This could be a large number of points.

Value

A point pattern (object of class "ppp").

Author(s)

\adrian

See Also

Summary.im for computing the minimum and maximum of pixel values; eval.im and Math.im for mathematical expressions involving images; solutionset for finding the set of pixels where a statement is true.

Examples

   D <- distmap(letterR, invert=TRUE)
   plot(D)
   plot(where.max(D), add=TRUE, pch=16, cols="green")

spatstat.geom documentation built on Oct. 20, 2023, 9:06 a.m.