View source: R/interpolate_sky_points.R
interpolate_sky_points | R Documentation |
Interpolate values from canopy photographs.
interpolate_sky_points(sky_points, r, k = 3, p = 2, rmax = 200, col_id = "rl")
sky_points |
An object of class data.frame. The data.frame returned by
|
r |
SpatRaster. The image from which |
k |
Numeric vector of length one. Number of k-nearest neighbors. |
p |
Numeric vector of length one. Power for inverse-distance weighting. |
rmax |
Numeric vector of length one. Maximum radius where to search for knn. |
col_id |
Numeric vector of length one. ID of the column with the values to interpolate. |
This function use lidR::knnidw()
as workhorse function, so
arguments k
, p
, and rmax
are passed to it.
This function is based on \insertCiteLang2010;textualrcaiman. In theory,
the best result would be obtained with data showing a linear relation between
digital numbers and the amount of light reaching the sensor. See
extract_radiometry()
and read_caim_raw()
for further details. As a
compromise solution, gbc()
can be used.
Default parameters are the ones used by
\insertCiteLang2010;textualrcaiman. The argument rmax
should
account for between 15 to 20 degrees, but it is expressed in pixels units.
So, image resolution and lens projections should be taken into account to set
this argument properly.
An object of class SpatRaster.
Other Sky Reconstruction Functions:
cie_sky_model_raster()
,
fit_cie_sky_model()
,
fit_coneshaped_model()
,
fit_trend_surface()
,
fix_reconstructed_sky()
,
ootb_sky_reconstruction()
## 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)
bin <- ootb_obia(caim, z, a, m, HSV(239, 0.85, 0.5), gamma = NULL)
g <- sky_grid_segmentation(z, a, 10)
sky_points <- extract_sky_points(r, bin, g, dist_to_plant = 3)
plot(bin)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)
sky_points <- extract_dn(r, sky_points)
sky <- interpolate_sky_points(sky_points, r, col_id = 3)
plot(sky)
plot(r/sky)
# A quick demonstration of how to use trend surface fitting to smooth the
# interpolation
persp(terra::aggregate(sky, 10), theta = 45, phi = 30)
sky_s <- fit_trend_surface(sky, z, a, !is.na(z))
persp(terra::aggregate(sky_s$image, 10), theta = 45, phi = 30)
plot(sky_s$image)
plot(r)
plot(r/sky_s$image)
plot(apply_thr(r/sky_s$image, 0.5))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.