View source: R/extract_sky_points.R
| extract_sky_points | R Documentation |
Sample representative sky pixels for use in model fitting or interpolation.
extract_sky_points(r, bin, g, dist_to_black = 3, method = "grid")
r |
numeric terra::SpatRaster of one layer. Typically the blue band of a canopy image. |
bin |
logical terra::SpatRaster of one layer. Binary image where
|
g |
numeric terra::SpatRaster of one layer. Segmentation grid,
usually built with |
dist_to_black |
numeric vector of length one or |
method |
character vector of length one. Sampling method; either
|
Two sampling strategies are provided:
"grid"select one sky point per cell of a segmentation grid (g)
as the brightest pixel marked TRUE in bin, provided the cell’s white
pixel count exceeds one fourth of the mean across valid cells.
"local_max"detect local maxima within a fixed 9 \times 9
window, restricted to pixels marked TRUE in bin, after removing
patches of connected TRUE pixels that are implausible based on fixed
area/size thresholds. Each detected maximum is taken as a sky point.
Use "grid" to promote an even, representative spatial distribution (good
for model fitting), and "local_max" to be exhaustive for interpolation.
data.frame with columns row and col.
## Not run:
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)
r <- caim$Blue
bin <- binarize_by_region(r, ring_segmentation(z, 15), "thr_isodata") &
select_sky_region(z, 0, 88)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.