View source: R/extract_sun_coord.R
extract_sun_coord | R Documentation |
Extract the sun coordinates for CIE sky model fitting.
extract_sun_coord(r, z, a, bin, g, max_angular_dist = 30)
r |
SpatRaster. A normalized greyscale image. Typically, the
blue channel extracted from a canopy photograph. Please see |
z |
SpatRaster built with |
a |
SpatRaster built with |
bin |
SpatRaster. This should be a preliminary binarization of
|
g |
SpatRaster built with |
max_angular_dist |
Numeric vector of length one. Specifies the maximum expected size of the circumsolar region in degrees. |
This function uses an object-based image analyze framework. The segmentation
is given by g
and bin
. For every cell of g
, the pixels from r
that
are equal to one on bin
are selected and its maximum value is calculated.
Then, the 95th percentile of these maximum values is computed and used to
filter out cells below that threshold; i.e, only the cells with at least one
extremely bright sky pixel is selected.
The selected cells are grouped based on adjacency, and new bigger segments
are created from these groups. The degree of membership to the class
Sun is calculated for every new segment by computing the number of
cells that constitute the segment and its mean digital number (values taken
from r
). In other words, the largest and brightest segments are the ones
that score higher. The one with the highest score is selected as the
sun seed.
The angular distance from the sun seed to every other segments are computed,
and only the segments not farther than max_angular_dist
are classified as
part of the circumsolar region. A multi-part segment is created by merging
the circumsolar segments and, finally, the center of its bounding box is
considered as the sun location.
Object of class list with two numeric vectors of length two named row_col and zenith_azimuth. The former is the raster coordinates of the solar disk (row and column), and the other is the angular coordinates (zenith and azimuth angles in degrees).
Other Tool Functions:
calc_oor_index()
,
calc_spherical_distance()
,
colorfulness()
,
correct_vignetting()
,
defuzzify()
,
display_caim()
,
extract_dn()
,
extract_feature()
,
extract_rel_radiance()
,
extract_sky_points()
,
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()
## 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)
sun_coord <- extract_sun_coord(r, z, a, bin, g, max_angular_dist = 30)
points(sun_coord$row_col[2], nrow(caim) - sun_coord$row_col[1],
col = 3, pch = 10)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.