extract_rl: Extract relative luminance

View source: R/extract_rl.R

extract_rlR Documentation

Extract relative luminance

Description

Extract the luminance relative to the zenith digital number

Usage

extract_rl(r, z, a, sky_points, no_of_points = 3, z_thr = 5, use_window = TRUE)

Arguments

r

SpatRaster. A normalized greyscale image. Typically, the blue channel extracted from a canopy photograph. Please see read_caim() and normalize().

z

SpatRaster built with zenith_image().

a

SpatRaster built with azimuth_image().

sky_points

An object of class data.frame. The result of a call to extract_sky_points(). As an alternative, both ImageJ and HSP software package \insertCiteLang2013rcaiman can be used to manually digitize points. See extract_dn() and read_manual_input() for details.

no_of_points

Numeric vector of length one. The number of near-zenith points required for the estimation of the zenith DN.

z_thr

Numeric vector on length one. The starting maximum zenith angle used to search for near-zenith points.

use_window

Logical vector of length one. If TRUE, a 3 \times 3 window will be used to extract the digital number from r.

Details

The search for near-zenith points starts in the region ranged between 0 and z_thr. If the number of near-zenith points is less than no_of_points, the region increases by steps of 2 degrees of zenith angle till the required number of points is reached.

Value

A list of three objects, zenith_dn and max_zenith_angle from the class numeric, and sky_points from the class data.frame; zenith_dn is the estimated zenith digital number, max_zenith_angle is the maximum zenith angle reached in the search for near-zenith sky points, and sky_points is the input argument sky_points with the additional columns: a, z, dn, and rl, which stand for azimuth and zenith angle in degrees, digital number, and relative luminance, respectively. If NULL is provided as no_of_points, then zenith_dn is forced to one and, therefore, dn and rl will be identical.

Note

The point selection tool of ‘ImageJ’ software can be used to manually digitize points and create a CSV file from which to read coordinates (see Examples). After digitizing the points on the image, use the dropdown menu Analyze>Measure to open the Results window. To obtain the CSV file, use File>Save As...

References

\insertAllCited

See Also

Other Tool Functions: colorfulness(), correct_vignetting(), defuzzify(), extract_dn(), extract_feature(), extract_sky_points_simple(), extract_sky_points(), extract_sun_coord(), find_sky_pixels_nonnull(), find_sky_pixels(), masking(), optim_normalize(), percentage_of_clipped_highlights(), read_bin(), read_caim_raw(), read_caim(), write_bin(), write_caim()

Examples

## Not run: 
caim <- read_caim() %>% normalize(., 0, 20847)
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
plotRGB(caim*255)

path <- system.file("external/sky_points.csv",
                    package = "rcaiman")
sky_points <- read.csv(path)
sky_points <- sky_points[c("Y", "X")]
colnames(sky_points) <- c("row", "col")
head(sky_points)
points(sky_points$col, nrow(caim) - sky_points$row, col = 2, pch = 10)
extract_rl(caim$Blue, z, a, sky_points, 1)

## End(Not run)

rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.