find_sky_pixels_nonnull {rcaiman} | R Documentation |
Find sky pixels following the non-null criteria
Description
Cells without sky pixels are the so-called null cells. This type of cells are mathematically intractable by models typically used to obtain canopy metrics. This function find sky pixels using increase in number of null cells as the stopping criteria.
Usage
find_sky_pixels_nonnull(r, sky, g, intercept = 0, slope = 1, w = 0.5)
Arguments
r |
SpatRaster. A normalized greyscale image. Typically, the
blue channel extracted from a canopy photograph. Please see |
sky |
An object of class SpatRaster produced with
|
g |
SpatRaster built with |
intercept , slope |
Numeric vector of length one. These are linear function coefficients. |
w |
Numeric vector of length one. Weighting parameter from
Díaz and Lencinas (2018)'s Equation 1. See |
Details
The arguments sky
, intercept
, slope
, and w
are passed to thr_mblt()
whose 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 w
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 Tool Functions:
colorfulness()
,
correct_vignetting()
,
defuzzify()
,
extract_dn()
,
extract_feature()
,
extract_rl()
,
extract_sky_points_simple()
,
extract_sky_points()
,
extract_sun_coord()
,
find_sky_pixels()
,
masking()
,
optim_normalize()
,
percentage_of_clipped_highlights()
,
read_bin()
,
read_caim_raw()
,
read_caim()
,
write_bin()
,
write_caim()
Examples
## Not run:
caim <- read_caim()
r <- caim$Blue %>% normalize()
caim <- normalize(caim, 0, 20847, TRUE)
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)
bin <- ootb_obia(caim, z, a, m, HSV(239, 0.85, 0.5), gamma = NULL)
g <- sky_grid_segmentation(z, a, 3)
sky_points <- extract_sky_points(r, bin, g,
dist_to_plant = 5,
min_raster_dist = 5)
rl <- extract_rl(r, z, a, sky_points)
model <- fit_coneshaped_model(rl$sky_points)
summary(model$model)
sky <- model$fun(z, a)
sky <- fit_trend_surface(sky, z, a, !is.na(z))$image
plot(r/sky)
x <- predict(model$model)
y <- predict(model$model) + model$model$residuals
mblt <- coefficients(lm(x~y))
g <- sky_grid_segmentation(z, a, 10)
bin <- find_sky_pixels_nonnull(r, sky, g, mblt[1], mblt[2], w = 0.1)
plot(bin)
## End(Not run)