View source: R/fit_coneshaped_model.R
fit_coneshaped_model | R Documentation |
Fit a polynomial model to predict relative radiance from spherical coordinates using data sampled from a canopy photograph.
fit_coneshaped_model(sky_points, method = "zenith_n_azimuth")
sky_points |
|
method |
character. Model type to fit:
|
This model requires only sky_points
, making it useful in workflows where
sun position cannot be reliably estimated, such as in apply_by_direction()
.
Otherwise, fit_cie_model()
is a better choice.
Depending on method
, it can fit:
sDN = a + b\theta + c\theta^2
sDN = a + b\theta + c\theta^2 + d\sin(\phi) + e\cos(\phi)
See \insertCiteDiaz2018;textualrcaiman for details on the full model.
List with the following components:
fun
Function taking zenith
and azimuth
(degrees) and returning
predicted relative radiance.
model
lm
object fitted by stats::lm()
.
Returns NULL
(with a warning) if the number of input points is fewer than 20.
## 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, first_ring_different = TRUE)
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)
rr <- extract_rr(r, z, a, sky_points)
model <- fit_coneshaped_model(rr$sky_points)
summary(model$model)
sky_cs <- model$fun(z, a) * rr$zenith_dn
plot(sky_cs)
z_mini <- zenith_image(50, lens())
sky_cs <- model$fun(z_mini, azimuth_image(z_mini))
persp(sky_cs, theta = 90, phi = 20)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.