extract_sun_coord {rcaiman} | R Documentation |
Extract sun coordinates
Description
Extract the sun coordinates for CIE sky model fitting.
Usage
extract_sun_coord(r, z, a, bin, g, max_angular_dist = 30)
Arguments
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. Angle in degrees to control the potential maximum size of the solar corona. |
Details
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 sun corona. A multi-part segment is created by merging the
sun-corona segments and, finally, the center of its bounding box is
considered as the sun location.
Value
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).
See Also
Other Tool Functions:
colorfulness()
,
correct_vignetting()
,
defuzzify()
,
extract_dn()
,
extract_feature()
,
extract_rl()
,
extract_sky_points_simple()
,
extract_sky_points()
,
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()
Examples
## Not run:
caim <- read_caim()
r <- caim$Blue
caim <- normalize(caim, 0, 20847, TRUE)
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)
plotRGB(caim*255)
bin <- ootb_obia(caim, z, a, m, HSV(239, 0.85, 0.5), gamma = NULL)
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)