View source: R/fisheye_to_equidistant.R
| fisheye_to_equidistant | R Documentation |
Reproject a hemispherical image from fisheye to equidistant projection (also known as polar projection) to standardize its geometry for subsequent analysis and comparison between images.
fisheye_to_equidistant(r, z, a, m, radius = NULL, k = 1, p = 1, rmax = 100)
r |
terra::SpatRaster of one or more layers (e.g., RGB channels or binary masks) in fisheye projection. |
z |
terra::SpatRaster generated with |
a |
terra::SpatRaster generated with |
m |
logical terra::SpatRaster with one layer. A binary mask with
|
radius |
numeric vector of length one. Radius (in pixels) of the
reprojected hemispherical image. Must be an integer value (no decimal
part). If |
k, p, rmax |
numeric vector of length one. Parameters passed to
|
Pixel values and coordinates are treated as 3D points and reprojected
using Cartesian interpolation. Internally, this function uses
lidR::knnidw() as interpolation engine, so arguments k, p, and
rmax are passed to it without modification.
terra::SpatRaster with the same number of layers as r,
reprojected to equidistant projection with circular shape and radius
given by 'radius
## Not run:
path <- system.file("external/APC_0836.jpg", package = "rcaiman")
caim <- read_caim(path)
calc_diameter(c(0.801, 0.178, -0.179), 1052, 86.2)
z <- zenith_image(2216, c(0.801, 0.178, -0.179))
a <- azimuth_image(z)
zenith_colrow <- c(1063, 771)
caim <- expand_noncircular(caim, z, zenith_colrow)
m <- !is.na(caim$Red) & select_sky_region(z, 0, 86.2)
caim[!m] <- 0
m2 <- fisheye_to_equidistant(m, z, a, !is.na(z), radius = 600)
m2 <- binarize_with_thr(m2, 0.5) #to turn it logical
caim2[!m2] <- 0
plot(caim)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.