View source: R/correct_vignetting.R
correct_vignetting | R Documentation |
Apply a vignetting correction to an image using a polynomial model.
correct_vignetting(r, z, lens_coef_v)
r |
terra::SpatRaster of one or more layers (e.g., RGB channels or binary masks) in fisheye projection. |
z |
terra::SpatRaster generated with |
lens_coef_v |
numeric vector. Coefficients of the vignetting function
|
Vignetting is the gradual reduction of image brightness toward the periphery. This function corrects it by applying a device-specific correction as a function of the zenith angle at each pixel.
terra::SpatRaster with the same content as r
but with
pixel values adjusted to correct for vignetting, preserving all other
properties (layers, names, extent, and CRS).
## Not run:
path <- system.file("external/APC_0836.jpg", package = "rcaiman")
caim <- read_caim(path)
z <- zenith_image(2132, lens("Olloclip"))
a <- azimuth_image(z)
zenith_colrow <- c(1063, 771)
caim <- expand_noncircular(caim, z, zenith_colrow)
m <- !is.na(caim$Red) & !is.na(z)
caim[!m] <- 0
bin <- binarize_with_thr(caim$Blue, thr_isodata(caim$Blue[m]))
display_caim(caim$Blue, bin)
caim <- invert_gamma_correction(caim, 2.2)
caim <- correct_vignetting(caim, z, c(-0.0546, -0.561, 0.22)) %>%
normalize_minmax()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.