Learn R Programming

imagerExtra (version 1.3.2)

BalanceSimplest: Balance color of image by Simplest Color Balance

Description

Balance color of image by Simplest Color Balance

Usage

BalanceSimplest(im, sleft, sright, range = c(0, 255))

Arguments

im

a grayscale image of class cimg

sleft

left saturation percentage. sleft can be specified by numeric or string, e.g. 1 and "1%". note that sleft is a percentile.

sright

right saturation percentage. sright can be specified by numeric or string. note that sright is a percentile.

range

this function assumes that the range of pixel values of of input image is [0,255] by default. you may prefer [0,1].

Value

a grayscale image of class cimg

References

Nicolas Limare, Jose-Luis Lisani, Jean-Michel Morel, Ana Belen Petro, and Catalina Sbert, Simplest Color Balance, Image Processing On Line, 1 (2011), pp. 297-315. https://doi.org/10.5201/ipol.2011.llmps-scb

Examples

Run this code
# NOT RUN {
dev.new()
par(mfcol = c(1,2))
boats_g <- grayscale(boats)
plot(boats_g, main = "Original")
BalanceSimplest(boats_g, 1, 1) %>% plot(., main = "Simplest Color Balance")
# }

Run the code above in your browser using DataLab