find_sky_pixels_nonnull: Find sky pixels following the non-null criteria

View source: R/find_sky_pixels_nonnull.R

find_sky_pixels_nonnullR Documentation

Find sky pixels following the non-null criteria

Description

Find sky pixels using the increase in the number of cells having no sky pixels (the so-called null cells) as stopping criteria.

Usage

find_sky_pixels_nonnull(r, sky, g, slope = 0.5)

Arguments

r

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

sky

An object of class SpatRaster produced with fit_coneshaped_model, fit_trend_surface, fit_cie_sky_model, or ootb_sky_reconstruction.

g

SpatRaster built with sky_grid_segmentation or chessboard.

slope

Numeric vector of length one. See section Details in thr_image.

Details

The arguments sky and slope are passed to thr_image, which output is in turn passed to apply_thr along with r. As a result, r is binarized and used along with g to compute the number of null cells. The process is repeated but increasing slope in steps of 0.05 as long as the number of null cells remains constant.

Value

An object of class SpatRaster with values 0 and 1.

See Also

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

Examples

## Not run: 
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1280, 960) - 745, 745 * 2, 745 * 2)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
a <- azimuth_image(z)
r <- gbc(caim$Blue)
bin <- find_sky_pixels(r, z, a)
g <- sky_grid_segmentation(z, a, 10)
sky_points <- extract_sky_points(r, bin, g)
sky_points <- extract_rl(r, z, a, sky_points, NULL)
model <- fit_coneshaped_model(sky_points$sky_points)
sky_cs <- model$fun(z, a)
g[mask_hs(z, 0, 10) | mask_hs(z, 70, 90)] <- NA
bin <- find_sky_pixels_nonnull(r, sky_cs, g)
plot(bin)

## End(Not run)

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