| extract_dn | R Documentation |
Obtain digital numbers from a raster at positions defined by sky points, with optional local averaging.
extract_dn(r, sky_points, use_window = TRUE)
r |
terra::SpatRaster. Image from which |
sky_points |
|
use_window |
logical of length one. If |
Wraps terra::extract() to support a 3 \times 3 window centered on
each target pixel (local mean). When it is disabled, only the central
pixel value is retrieved.
data.frame containing the original sky_points plus one column per
layer in r (named after the layers).
For instructions on manually digitizing sky points, see the “Digitizing sky
points with ImageJ” and “Digitizing sky points with QGIS” sections in
fit_cie_model().
extract_sky_points()
## Not run:
caim <- read_caim()
r <- caim$Blue
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
# See fit_cie_model() for details on below file
path <- system.file("external/sky_points.csv",
package = "rcaiman")
sky_points <- read.csv(path)
sky_points <- sky_points[c("Y", "X")]
colnames(sky_points) <- c("row", "col")
head(sky_points)
plot(caim$Blue)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)
sky_points <- extract_dn(caim, sky_points)
head(sky_points)
# To aggregate DNs across points (excluding 'row' and 'col'):
apply(sky_points[, -(1:2)], 2, mean, na.rm = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.