extract_sky_points: Extract sky points

View source: R/extract_sky_points.R

extract_sky_pointsR Documentation

Extract sky points


Extract sky points for model fitting


extract_sky_points(r, bin, g, dist_to_plant = 3, min_raster_dist = 3)



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


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


SpatRaster built with sky_grid_segmentation() or chessboard().

dist_to_plant, min_raster_dist

Numeric vector of length one or NULL.


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, dist_to_plant, and min_raster_dist.

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

The final step is filtering these local maximum values by evaluating the Euclidean distances between them on the raster space. Any new point with a distance from existing points minor than min_raster_dist is discarded. Cell labels determine the order in which the points are evaluated.

To skip a given filtering step, use code NULL as argument input. For instance, min_raster_dist = NULL will return points omitting the final step.


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

See Also


Other Tool Functions: colorfulness(), correct_vignetting(), defuzzify(), extract_dn(), extract_feature(), extract_rl(), extract_sky_points_simple(), extract_sun_coord(), find_sky_pixels_nonnull(), find_sky_pixels(), masking(), optim_normalize(), percentage_of_clipped_highlights(), read_bin(), read_caim_raw(), read_caim(), write_bin(), write_caim()


## Not run: 
caim <- read_caim()
r <- caim$Blue
caim <- normalize(caim, 0, 20847, TRUE)
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
bin <- ootb_obia(caim, z, a, HSV(239, 0.85, 0.5), gamma = NULL)
g <- sky_grid_segmentation(z, a, 10)
sky_points <- extract_sky_points(r, bin, g,
                                 dist_to_plant = 3,
                                 min_raster_dist = 10)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)

## End(Not run)

rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.