fit_coneshaped_model: Fit cone-shaped model

View source: R/fit_coneshaped_model.R

fit_coneshaped_modelR Documentation

Fit cone-shaped model

Description

Statistical modeling for predicting digital numbers from spherical coordinates.

Usage

fit_coneshaped_model(sky_points, use_azimuth_angle = TRUE)

Arguments

sky_points

The data.frame returned by extract_rel_radiance() or a data.frame with same structure and names.

use_azimuth_angle

Logical vector of length one. If TRUE, the Equation 4 from \insertCiteDiaz2018;textualrcaiman) is used: sDN = a + b \cdot \theta + c \cdot \theta^2 + d \cdot sin(\phi) + e \cdot cos(\phi), where sDN is sky digital number, a,b,c,d and e are coefficients, \theta is zenith angle, and \phi is azimuth angle. If FALSE, the next simplified version based on \insertCiteWagner2001;textualrcaiman is used: sDN = a + b \cdot \theta + c \cdot \theta^2.

Details

This method was presented in \insertCiteDiaz2018;textualrcaiman, under the heading Estimation of the sky DN as a previous step for our method. If you use this function in your research, please cite that paper in addition to this package (⁠citation("rcaiman"⁠).

Value

A list of two objects, one of class function and the other of class lm (see stats::lm()). If the fitting fails, it returns NULL. The function requires two arguments–zenith and azimuth in degrees–to return relative radiance

References

\insertAllCited

See Also

thr_mblt()

Other Sky Reconstruction Functions: cie_sky_image(), fit_cie_sky_model(), fit_trend_surface(), interpolate_sky_points(), ootb_fit_cie_sky_model(), ootb_interpolate_and_merge()

Examples

## Not run: 
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1250, 1020) - 745, 745 * 2, 745 * 2)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
a <- azimuth_image(z)
r <- gbc(caim$Blue)
r <- correct_vignetting(r, z, c(0.0638, -0.101)) %>% normalize_minmax()

bin <- regional_thresholding(r, rings_segmentation(z, 30), "thr_isodata")
bin <- bin & select_sky_vault_region(z, 0, 80)
sky_points <- extract_sky_points(r, bin, sky_grid_segmentation(z, a, 3))
sky_points <- extract_rel_radiance(r, z, a, sky_points, no_of_points = NULL)

model <- fit_coneshaped_model(sky_points$sky_points)
summary(model$model)
sky_cs <- model$fun(z, a)
plot(r/sky_cs)
plot(sky_cs)
plot(r/sky_cs > 0.5)

z <- zenith_image(50, lens())
a <- azimuth_image(z)
sky_cs <- model$fun(z, a)
persp(sky_cs, theta = 90, phi = 20)

## End(Not run)

GastonMauroDiaz/rcaiman documentation built on April 14, 2025, 9:39 a.m.