ootb_obia: Out-of-the-box object-based image analysis of canopy...

View source: R/ootb_obia.R

ootb_obiaR Documentation

Out-of-the-box object-based image analysis of canopy photographs

Description

Out-of-the-box version of methods first presented in \insertCiteDiaz2015;textualrcaiman.

Usage

ootb_obia(caim, z = NULL, a = NULL, m = NULL, sky_blue = NULL)

Arguments

caim

SpatRaster. The return of a call to read_caim.

z

SpatRaster built with zenith_image.

a

SpatRaster built with azimuth_image.

m

SpatRaster. Default (NULL) is the equivalent to enter !is.na(z) for hemispherical photography, or enter !is.na(caim$Red) for restricted view photography.

sky_blue

color. Is the target_color argument to be passed to membership_to_color. Default (NULL) is the equivalent to enter sRGB(0.1, 0.4, 0.8)–the HEX color code is #1A66CC, it can be entered into a search engine (such as Mozilla Firefox) to see a color swatch.

Details

This function is a hard-coded version of a pipeline that combines these main functions mask_sunlit_canopy, enhance_caim, polar_qtree/qtree, and obia. The code can be easily inspected by calling ootb_obia –no parenthesis. Advanced users can use that code as a template.

Pixels from the synthetic layer returned by obia that lay between 0 and 1 are assigned to the class plant only if they are:

  • 0 after defuzzify with a sky grid segmentation of 10 degrees.

  • 0 after apply_thr with a threshold computed with thr_isodata.

  • Not exclusively surrounded by sky pixels.

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.

If you use this function in your research, please cite \insertCiteDiaz2015;textualrcaiman in addition to this package.

Value

An object of class SpatRaster with values 0 and 1.

See Also

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

Examples

## Not run: 
#circular hemispherical photo
path <- system.file("external/b4_2_5724.jpg", package = "rcaiman")
caim <- read_caim(path, c(1280, 960) - 745, 745 * 2, 745 * 2) %>%
  normalize()
z <- zenith_image(1490, lens("Nikon_FCE9"))
a <- azimuth_image(z)

bin <- ootb_obia(caim, z, a)
plot(bin)

## to compare
blue <- gbc(caim$Blue*255)
plot(apply_thr(blue, thr_isodata(blue[!is.na(z)])))
plot(blue, col = seq(0,1,1/255) %>% grey())

#hemispherical photo from a smartphone
path <- system.file("external/APC_0581.jpg", package = "rcaiman")
caim <- read_caim(path) %>% normalize()
z <- zenith_image(2132/2, lens("Olloclip"))
a <- azimuth_image(z)
zenith_colrow <- c(1063, 771)/2
caim <- expand_noncircular(caim, z, zenith_colrow) %>% normalize()
m <- !is.na(caim$Red) & !is.na(z)
caim[!m] <- 0

bin <- ootb_obia(caim, z, a)
plot(bin)

## to compare
blue <- gbc(caim$Blue*255)
plot(apply_thr(blue, thr_isodata(blue[m])))
plot(blue, col = seq(0,1,1/255) %>% grey())

#restricted view canopy photo
path <- system.file("external/APC_0020.jpg", package = "rcaiman")
caim <- read_caim(path) %>% normalize()

bin <- ootb_obia(caim)
plot(bin)

## to compare
blue <- gbc(caim$Blue*255)
plot(apply_thr(blue, thr_isodata(blue[])))
plot(blue, col = seq(0,1,1/255) %>% grey())

## End(Not run)

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

Related to ootb_obia in rcaiman...