View source: R/interpolate_planar.R
interpolate_planar | R Documentation |
Interpolate values from canopy photographs using inverse distance weighting (IDW) with k-nearest neighbors in image (planar) coordinates. A radius limits neighbor search.
interpolate_planar(sky_points, r, k = 3, p = 2, rmax = 200, col_id = "dn")
sky_points |
|
r |
numeric terra::SpatRaster with one layer. Image from which
|
k , p , rmax |
numeric vector of length one. Parameters passed to
|
col_id |
numeric or character vector of length one. The name or position
of the column in |
Delegates interpolation to lidR::knnidw()
, passing k
, p
, and rmax
unchanged. Defaults follow \insertCiteLang2013;textualrcaiman.
Note that rmax
is given in pixels but intended to approximate 15–20 deg in
angular terms. Therefore, this value needs fine-tuning based on image
resolution and lens projection. For best results, the interpolated quantity
should be linearly related to scene radiance; see extract_radiometry()
and
read_caim_raw()
. For JPEG images, consider invert_gamma_correction()
to reverse gamma
encoding.
Numeric terra::SpatRaster with one layer and the same geometry
as r
.
No consistency checks are performed to ensure that sky_points
and r
are geometrically compatible. Incorrect combinations may lead to invalid
outputs.
## Not run:
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)
r <- caim$Blue
bin <- binarize_by_region(r, ring_segmentation(z, 15), "thr_isodata") &
select_sky_region(z, 0, 88)
g <- sky_grid_segmentation(z, a, 10)
sky_points <- extract_sky_points(r, bin, g, dist_to_black = 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_planar(sky_points, r, col_id = 3)
plot(sky)
plot(r/sky)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.