extract_sky_points: Extract sky points

View source: R/extract_sky_points.R

extract_sky_pointsR Documentation

Extract sky points

Description

Extract sky points for model fitting

Usage

extract_sky_points(r, bin, g, dist_to_black = 3)

Arguments

r

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

bin

SpatRaster. This should be a preliminary binarization of r useful for masking pixels that are very likely pure sky pixels.

g

SpatRaster built with sky_grid_segmentation() or chessboard().

dist_to_black

Numeric vector of length one or NULL. A minimum distance to a black pixel can be set as a constraint. Useful to avoid mixed pixels since they are close to the silhouette contour.

Details

This function will automatically sample sky pixels from the sky regions delimited by bin. The density and distribution of the sampling points is controlled by the arguments g and dist_to_black.

As the first step, sky pixels from r are evaluated to find the pixel with maximum digital value per cell of the g argument. The dist_to_black argument allows users to establish a buffer zone for bin, meaning a size reduction of the original sky regions.

Value

An object of the class data.frame with two columns named row and col.

See Also

fit_cie_sky_model()

Other Tool Functions: calc_oor_index(), calc_spherical_distance(), colorfulness(), correct_vignetting(), defuzzify(), display_caim(), extract_dn(), extract_feature(), extract_rel_radiance(), extract_sun_coord(), find_sky_pixels(), masking(), optim_dist_to_black(), optim_normalize(), percentage_of_clipped_highlights(), read_bin(), read_caim(), read_caim_raw(), read_ootb_sky_model(), sor_filter(), vicinity_filter(), write_bin(), write_caim(), write_ootb_sky_model()

Examples

## Not run: 
caim <- read_caim()
r <- caim$Blue
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)
bin <- regional_thresholding(r, rings_segmentation(z, 30),
                             method = "thr_isodata")
mx <- optim_normalize(caim, bin)
caim <- normalize_minmax(caim, 0, mx, TRUE)
plotRGB(caim*255)
sky_blue <- polarLAB(50, 17, 293)
ecaim <- enhance_caim(caim, m, sky_blue = sky_blue)
bin <- apply_thr(ecaim, thr_isodata(ecaim[m]))
g <- sky_grid_segmentation(z, a, 10)
sky_points <- extract_sky_points(r, bin, g,
                                 dist_to_black = 3)
plot(bin)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)

## End(Not run)

GastonMauroDiaz/rcaiman documentation built on April 14, 2025, 9:39 a.m.