View source: R/invert_gamma_correction.R
invert_gamma_correction | R Documentation |
Approximates the inversion of the gamma encoding applied to JPEG images.
invert_gamma_correction(dn, gamma = 2.2)
dn |
numeric vector or terra::SpatRaster. Digital numbers from a JPEG file (range 0–255, as per standard 8-bit encoding). |
gamma |
numeric vector of length one. Exponent applied in the inverse gamma correction (typically 2.2 for sRGB). |
Digital cameras typically encode images using the sRGB color space, which applies a non-linear transformation—commonly referred to as gamma correction—to the sensor's linear luminance response. This function applies a power transformation to approximate the inverse of that encoding, restoring a response closer to linear.
Same properties as dn
, with values adjusted by
inverse gamma correction and rescaled to the range [0, 1]
.
## 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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.