Learn R Programming

rcaiman (version 1.2.2)

fisheye_to_equidistant: Fisheye to equidistant

Description

Fisheye to equidistant projection (also known as polar projection).

Usage

fisheye_to_equidistant(
  r,
  z,
  a,
  m = NULL,
  radius = NULL,
  k = NULL,
  p = NULL,
  rmax = 100
)

Arguments

r

SpatRaster. A fish-eye image.

z

SpatRaster built with zenith_image().

a

SpatRaster built with azimuth_image().

m

SpatRaster. A mask. For hemispherical photographs, check mask_hs().

radius

Numeric integer of length one. Radius of the reprojected hemispherical image (i.e., the output).

k

Numeric vector of length one. Number of k-nearest neighbors.

p

Numeric vector of length one. Power for inverse-distance weighting.

rmax

Numeric vector of length one. Maximum radius where to search for knn. Increase this value if pixels with value 0 or FALSE appears where other values are expected.

Details

The pixel values and their image coordinates are treated as points to be reprojected and interpolated. To that end, this function use lidR::knnidw() as workhorse function, so arguments k, p, and rmax are passed to it. If the user does not input values to these arguments, both k and p are automatically defined by default as follow: when a binarized image is provided as argument r, both parameters are set to 1; otherwise, they are set to 9 and 2, respectively.

See Also

Other Lens Functions: azimuth_image(), calc_diameter(), calc_relative_radius(), calc_zenith_colrow(), calibrate_lens(), crosscalibrate_lens(), expand_noncircular(), extract_radiometry(), fisheye_to_pano(), lens(), test_lens_coef(), zenith_image()

Examples

Run this code
if (FALSE) {
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1250, 1020) - 745, 745 * 2, 745 * 2)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
a <- azimuth_image(z)
r <- gbc(caim$Blue)
r <- correct_vignetting(r, z, c(0.0638, -0.101)) %>% normalize()
bin <- ootb_mblt(r, z, a)$bin
bin_equi <- fisheye_to_equidistant(bin, z, a)
plot(bin)
plot(bin_equi)
# Use write_bin(bin, "path/file_name") to have a file ready
# to calcute LAI with CIMES, GLA, CAN-EYE, etc.

# It can be used to reproject RGB photographs
plotRGB(caim)
caim <- fisheye_to_equidistant(caim, z, a)
plotRGB(caim)
}

Run the code above in your browser using DataLab