Learn R Programming

rcaiman (version 2.0.1)

expand_noncircular: Expand non-circular

Description

Add NA margins to a hemispherical photograph to align radiance at the zenith with the image center. In this context, “zenith” denotes the location in the image that corresponds to the projection of the vertical direction when the optical axis is aligned vertically. Intended for non-circular images.

Usage

expand_noncircular(caim, z, zenith_colrow)

Value

terra::SpatRaster with the same layers and pixel values as caim, but with NA margins added to center the zenith.

Arguments

caim

terra::SpatRaster. Typically the output of read_caim().

z

terra::SpatRaster generated with zenith_image().

zenith_colrow

numeric vector of length two. Raster coordinates of the zenith (column, row). See calc_zenith_colrow(). Coordinates follow the raster convention (column, row), not matrix order.

Examples

Run this code
if (FALSE) {
# Non-circular fisheye images from a smartphone with an auxiliary Lens
# (also applicable to non-circular fisheye images from DSLR cameras)
path <- system.file("external/APC_0836.jpg", package = "rcaiman")
caim <- read_caim(path)
z <- zenith_image(2132/2,  lens("Olloclip"))
a <- azimuth_image(z)
zenith_colrow <- c(1063, 771)/2
caim <- expand_noncircular(caim, z, zenith_colrow)
plot(caim$Blue, col = seq(0, 1, 1/255) %>% grey())
m <- !is.na(caim$Red) & !is.na(z)
plot(m, add = TRUE, alpha = 0.3, legend = FALSE)
}

Run the code above in your browser using DataLab