Learn R Programming

rcaiman (version 1.2.2)

sky_grid_segmentation: Do sky grid segmentation

Description

Segment the hemisphere view into segments of equal angular resolution for both zenith and azimuth angles.

Usage

sky_grid_segmentation(z, a, angle_width, sequential = FALSE)

Value

An object from the class SpatRaster with segments shaped like windshields, though some of them will look elongated in height. The pattern is two opposite and converging straight sides and two opposite and parallel curvy sides.

Arguments

z

SpatRaster built with zenith_image().

a

SpatRaster built with azimuth_image().

angle_width

Numeric vector of length one. It should be 30, 15, 10, 7.5, 6, 5, 3.75, 3, 2.5, 1.875, 1 or 0.5 degrees. This constrain is rooted in the requirement of a value able to divide both the 0 to 360 and 0 to 90 ranges into a whole number of segments.

sequential

Logical vector of length one. If it is TRUE, the segments are labeled with sequential numbers. By default (FALSE), labeling numbers are not sequential (see Details).

Details

Intersecting rings with sectors makes a grid in which each cell is a portion of the hemisphere. Each pixel of the grid is labeled with an ID that codify both ring and sector IDs. For example, a grid with a regular interval of one degree has segment from 1001 to 360090. This numbers are calculated with: \(sectorID \times 1000 + ringID\), where \(sectorID\) is the ID number of the sector and \(ringID\) is the ID number of the ring.

See Also

Other Segmentation Functions: chessboard(), mask_hs(), mask_sunlit_canopy(), polar_qtree(), qtree(), rings_segmentation(), sectors_segmentation()

Examples

Run this code
z <- zenith_image(600, lens())
a <- azimuth_image(z)
g <- sky_grid_segmentation(z, a, 15)
plot(g == 24005)
if (FALSE) {
g <- sky_grid_segmentation(z, a, 15, sequential = TRUE)
col <- terra::unique(g) %>% nrow() %>% rainbow() %>% sample()
plot(g, col = col)
}

Run the code above in your browser using DataLab