obia: Do object-based image analysis of canopy photographs

View source: R/obia.R

obiaR Documentation

Do object-based image analysis of canopy photographs

Description

Object-based image analysis targeting the canopy silhouette.

Usage

obia(r, z = NULL, a = NULL, bin, segmentation, gf_mn = 0.2, gf_mx = 0.95)

Arguments

r

SpatRaster. A normalized greyscale image. Typically, the blue channel extracted from a canopy photograph. Please see read_caim() and normalize().

z

SpatRaster built with zenith_image().

a

SpatRaster built with azimuth_image().

bin

SpatRaster. This should be a working binarization of r without gross errors.

segmentation

SpatRaster built with polar_qtree() or qtree().

gf_mn, gf_mx

Numeric vector of length one. The minimum/maximum gap fraction that a segment should comply with to be considered as one containing foliage.

Details

This method was first presented in \insertCiteDiaz2015;textualrcaiman. This version is simpler since it relies on a better working binarized image. The version from 2015 uses an automatic selection of samples followed by a knn classification of segments containing foliage. This version uses de gap fraction extracted from bin to classify foliage by defining upper and lower limits through the arguments gf_mx and gf_mn.

This method produces a synthetic layer by computing the ratio of r to the maximum value of r at the segment level. This process is carried out only on the pixels covered by the classes foliage and sky. The latter is defined by bin equal to one. To avoid spurious values, the quantile 0.9 is computed instead of the maximum. Pixels not belonging to the class foliage return as NA.

Default values of z and a allows the processing of restricted view photographs.

If you use this function in your research, please cite \insertCiteDiaz2015;textualrcaiman in addition to this package (⁠citation("rcaiman"⁠).

Value

SpatRaster.

References

\insertAllCited

See Also

Other Binarization Functions: apply_thr(), ootb_mblt(), ootb_obia(), regional_thresholding(), thr_isodata(), thr_mblt()

Examples

## Not run: 
caim <- read_caim() %>% normalize()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)
ecaim <- enhance_caim(caim, m)
bin <- apply_thr(ecaim, thr_isodata(ecaim[m]))
plot(bin)

seg <- polar_qtree(caim, z, a)
synth <- obia(caim$Blue, z, a, bin, seg)
plot(synth)
foliage <- !is.na(synth)
hist(synth[foliage])
synth <- terra::cover(synth, bin)
plot(synth)
hist(synth[foliage])

## End(Not run)

rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.