fisheye_to_pano: Fisheye to panoramic

View source: R/fisheye_to_pano.R

fisheye_to_panoR Documentation

Fisheye to panoramic

Description

Reprojects a fisheye (hemispherical) image into a panoramic view using a cylindrical projection. The output is standardized so that rows correspond to zenith angle bands and columns to azimuthal sectors.

Usage

fisheye_to_pano(r, z, a, fun = mean, angle_width = 1)

Arguments

r

terra::SpatRaster of one or more layers (e.g., RGB channels or binary masks) in fisheye projection.

z

terra::SpatRaster generated with zenith_image().

a

terra::SpatRaster generated with azimuth_image().

fun

function taking a numeric/logical vector and returning a single numeric or logical value (default mean).

angle_width

numeric vector of length one. Angle in deg that must divide both 0–360 and 0–90 into an integer number of segments. Retrieve a set of valid values by running lapply(c(45, 30, 18, 10), function(a) vapply(0:6, function(x) a/2^x, 1)).

Details

This function computes a cylindrical projection by aggregating pixel values according to their zenith and azimuth angles. Internally, it creates a segmentation grid with sky_grid_segmentation() and applies extract_feature() to compute a summary statistic (e.g., mean) of pixel values within each cell.

Value

terra::SpatRaster with rows representing zenith angle bands and columns representing azimuthal sectors. The number of layers and names matches that of the input r.

Note

An early version of this function was used in \insertCiteDiaz2021;textualrcaiman.

References

\insertAllCited

Examples

## Not run: 
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
pano <- fisheye_to_pano(caim, z, a)
plotRGB(pano %>% normalize_minmax() %>% multiply_by(255))

## End(Not run)

rcaiman documentation built on Sept. 9, 2025, 5:42 p.m.