findpeaks: Find Local Peaks

Description Usage Arguments Value Examples

View source: R/localsurface.R

Description

Locates local peaks on a raster or matrix. A peak is defined as any pixel where all 8 surrounding pixels have lower values, and the center pixel has a positive value.

Usage

1

Arguments

x

A raster or matrix.

Value

A dataframe of local peak locations (x, y) and values (val). The raster or matrix location index (ind), row (row), and column (col) are also listed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# import raster image
data(normforest)

# locate peaks
peaks <- findpeaks(normforest)

# calculate the summit density (# peaks/area)
N <- ncol(normforest)
M <- nrow(normforest)
Sds <- nrow(peaks) / ((N - 1) * (M - 1))

geodiv documentation built on Sept. 5, 2021, 5:26 p.m.