View source: R/estimate_sun_angles.R
estimate_sun_angles | R Documentation |
Estimates the sun’s zenith and azimuth angles (deg) from a canopy hemispherical photograph, using either direct detection of the solar disk or indirect cues from the circumsolar region.
estimate_sun_angles(
r,
z,
a,
bin,
g,
angular_radius_sun = 30,
method = "assume_obscured"
)
r |
numeric terra::SpatRaster of one layer. Typically the blue band of a canopy image. |
z |
terra::SpatRaster generated with |
a |
terra::SpatRaster generated with |
bin |
logical terra::SpatRaster of one layer. Binary image where
|
g |
single-layer terra::SpatRaster with integer values. Sky
segmentation map produced by |
angular_radius_sun |
numeric vector of length one. Maximum angular radius (in degrees) used to define the circumsolar region. |
method |
character vector of length one. Estimation mode:
|
This function can operate under two alternative assumptions for estimating the sun position:
The solar disk is visible or partially obscured; the position is inferred from localized brightness peaks.
The solar disk is not visible; the position is inferred from radiometric and spatial cues aggregated over the circumsolar region.
When method = "assume_veiled"
, g
and angular_radius_sun
are ignored.
Estimates refer to positions above the horizon; therefore, estimated angles
may require further manipulation if the photograph was acquired under
crepuscular light.
Named numeric vector of length two, with names z
and a
,
representing the sun’s zenith and azimuth angles (in degrees).
A scientific article presenting and validating this method is currently under preparation.
## 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)
sun_angles <- estimate_sun_angles(r, z, a, bin, g,
angular_radius_sun = 30)
row_col <- row_col_from_zenith_azimuth(z, a,
sun_angles["z"],
sun_angles["a"])
plot(caim$Blue)
points(row_col[1,2], nrow(caim) - row_col[1,1], col = "yellow",
pch = 8, cex = 3)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.