View source: R/ootb_sky_reconstruction.R
ootb_sky_reconstruction  R Documentation 
Build an above canopy image from a single below canopy image
ootb_sky_reconstruction(
r,
z,
a,
bin,
filling_source = NULL,
dist_to_plant = 3,
sun_coord = NULL,
general_sky_type = NULL,
twilight = TRUE,
rmse = TRUE,
method = "BFGS",
try_grids = TRUE,
thin_points = TRUE,
refine_sun_coord = TRUE,
try_optims = TRUE,
force_sampling = TRUE,
interpolate = TRUE
)
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

filling_source 
SpatRaster. An actual or reconstructed
abovecanopy image to complement the sky pixels detected through the gaps
of 
dist_to_plant 
Numeric vector of length one or 
sun_coord 
An object of class list. The result of a call to

general_sky_type 
Character vector of length one. It could be any of these: "Overcast", "Clear", or "Partly cloudy". See Table 1 from \insertCiteLi2016;textualrcaiman for additional details. 
twilight 
Logical vector of length one. If it is 
rmse 
Logical vector of length one. If it is 
method 
Optimization method to use. See 
try_grids 
Logical vector of length one. 
thin_points 
Logical vector of length one. 
refine_sun_coord 
Logical vector of length one. 
try_optims 
Logical vector of length one. 
force_sampling 
Logical vector of length one. 
interpolate 
Logical vector of length one. If 
This function is a hardcoded version of a pipeline that uses these main
functions fit_cie_sky_model()
and interpolate_sky_points()
.
The pipeline is an automatic version of the \insertCiteLang2010;textualrcaiman method.
Providing a filling source
triggers an alternative pipeline in which the
sky is fully reconstructed with interpolate_sky_points()
after a dense
sampling (1 \times 1
degree cells), which is supported by the fact that
sky digital numbers will be available for every pixel, either from r
gaps
or from the filling source.
If a filling source is not provided, the result is an object from the
class list that includes the following: (1) the reconstructed sky
(SpatRaster), (2) the output produced by fit_cie_sky_model()
, (3)
the outofrange index (see fit_cie_sky_model()
), (4) sky points that
were not involved in obtaining (2), (5) an object from the class lm
(see
stats::lm()
) that is the result of validating (1) with (4) and the method
recommended by \insertCitePineiro2008;textualrcaiman, and (6) a
binarized image produced with (1), the coefficients from (4) and
thr_mblt()
with apply_thr()
, using 'w=0.95'. If a filling source is
provided, only a reconstructed sky (SpatRaster) is returned.
Other Sky Reconstruction Functions:
cie_sky_model_raster()
,
fit_cie_sky_model()
,
fit_coneshaped_model()
,
fit_trend_surface()
,
fix_reconstructed_sky()
,
interpolate_sky_points()
## Not run:
caim < read_caim()
z < zenith_image(ncol(caim), lens())
a < azimuth_image(z)
m < !is.na(z)
m < !is.na(z)
mn < quantile(caim$Blue[m], 0.01)
mx < quantile(caim$Blue[m], 0.99)
r < normalize(caim$Blue, mn, mx, TRUE)
bin < find_sky_pixels(r, z, a)
bin < ootb_mblt(r, z, a, bin)
plot(bin$bin)
mx < optim_normalize(caim, m)
r < normalize(caim$Blue)
caim < normalize(caim, mx = mx, force_range = TRUE)
bin < ootb_obia(caim, z, a, m, HSV(239, 0.85, 0.5), gamma = NULL)
plot(bin)
bin < ootb_mblt(r, z, a, bin)$bin
plot(bin)
set.seed(7)
sky < ootb_sky_reconstruction(r, z, a, bin)
sky$sky
sky$validation %>% summary()
plot(sky$sky)
plot(r/sky$sky)
hist(r/sky$sky, xlim = c(0, 2), breaks = 255)
hist((r/sky$sky)[bin], xlim = c(0, 2), breaks = 255)
plot((r/sky$sky)>1.1)
plot(sky$bin)
sky2 < ootb_sky_reconstruction(r, z, a, sky$bin, sky$sky)
plot(sky2)
plot(r/sky2)
hist(r/sky2, xlim = c(0, 2), breaks = 255)
hist((r/sky2)[sky$bin], xlim = c(0, 2), breaks = 255)
plot((r/sky2)>1.1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.