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 to predict the digital numbers from spherical coordinates.

Usage

fit_coneshaped_model(sky_points, use_azimuth_angle = TRUE)

Arguments

sky_points

The data.frame returned by extract_rl 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 θ + c \cdot θ^2 + d \cdot sin(φ) + e \cdot cos(φ), where sDN is sky digital number, a,b,c,d and e are coefficients, θ is zenith angle, and φ is azimuth angle. If FALSE, the next simplified version based on \insertCiteWagner2001;textualrcaiman is used: sDN = a + b \cdot θ + c \cdot θ^2.

Details

An explanation of this model can be found on \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 \insertCiteDiaz2018;textualrcaiman in addition to this package.

Value

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

References

\insertAllCited

See Also

thr_image

Other Sky Reconstruction Functions: cie_sky_model_raster(), fit_cie_sky_model(), fit_trend_surface(), fix_reconstructed_sky(), interpolate_sky_points(), ootb_sky_reconstruction()

Examples

## Not run: 
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1280, 960) - 745, 745 * 2, 745 * 2)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
a <- azimuth_image(z)
r <- gbc(caim$Blue)
g <- sky_grid_segmentation(z, a, 10)
bin <- find_sky_pixels(r, z, a)
sky_points <- extract_sky_points(r, bin, g)
sky_points <- extract_rl(r, z, a, sky_points, NULL)
model <- fit_coneshaped_model(sky_points$sky_points)
sky_cs <- model$fun(z, a)
persp(sky_cs, theta = 90, phi = 0) #a flipped rounded cone!

## End(Not run)

rcaiman documentation built on Sept. 20, 2022, 1:05 a.m.