obia: Object-based image analysis of canopy photographs

View source: R/obia.R

obiaR Documentation

Object-based image analysis of canopy photographs


Object-based image analysis targeting the canopy silhouette.


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



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


SpatRaster built with zenith_image.


SpatRaster built with azimuth_image.


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


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.


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.





See Also

Other Binarization Functions: apply_thr(), find_sky_pixels_nonnull(), find_sky_pixels(), ootb_mblt(), ootb_obia(), regional_thresholding(), thr_image(), thr_isodata()


## Not run: 
caim <- read_caim()
r <- caim$Blue %>% gbc()
caim <- normalize(caim)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
a <- azimuth_image(z)
m <- !
m2 <- !mask_sunlit_canopy(caim, m)
ecaim <- enhance_caim(caim, m)
bin <- apply_thr(ecaim, thr_isodata(ecaim[m2]))

seg <- polar_qtree(caim, z, a)
synth <- obia(r, z, a, bin, seg)
foliage <- !
synth <- terra::cover(synth, bin)
bin_obia <- apply_thr(synth, thr_isodata(synth[foliage]))
plot(bin - bin_obia)

## End(Not run)

rcaiman documentation built on Sept. 20, 2022, 1:05 a.m.

Related to obia in rcaiman...