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.