
Automatically edit a raster image of sky digital numbers (DNs) reconstructed
with functions such as fit_coneshaped_model()
and
fit_trend_surface()
.
fix_reconstructed_sky(sky, z, r, bin)
An object of class SpatRaster. The argument sky
with dimensions unchanged but values edited.
SpatRaster. Sky DNs predicted with functions such as
fit_coneshaped_model()
and fit_trend_surface()
.
SpatRaster built with zenith_image()
.
SpatRaster. The source of the sky DNs used to build
sky
(the data source).
SpatRaster. The binarization of r
used to
select the sky DNs for building the sky
argument.
The predicted sky DNs are usually erroneous near the horizon because either they are a misleading extrapolation or are based on corrupted data (non-pure sky DNs).
The proposed automatic edition consists of:
flattening the values below
the minimum value from the data source defined by r
and
bin
and
forcing the values toward the horizon to become gradually the median value from the data source.
The latter is achieved by calculating
the weighted average of the median value and the predicted sky DNs, using the
ratio of z
to 90
to determine the weights.
Other Sky Reconstruction Functions:
cie_sky_model_raster()
,
fit_cie_sky_model()
,
fit_coneshaped_model()
,
fit_trend_surface()
,
interpolate_sky_points()
,
ootb_sky_reconstruction()
if (FALSE) {
caim <- read_caim()
r <- caim$Blue
caim <- normalize(caim, 0, 20847, TRUE)
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
bin <- find_sky_pixels(r, z, a)
sky <- fit_trend_surface(r, z, a, bin)$image
sky <- fix_reconstructed_sky(sky, z, r, bin)
plot(sky)
}
Run the code above in your browser using DataLab