[Image-SIG] Removing specific range of colors from scanned image
Guy K. Kloss
g.kloss at massey.ac.nz
Mon Apr 27 21:33:24 CEST 2009
On Mon, 27 Apr 2009 22:56:00 jcupitt at gmail.com wrote:
> RGB isn't the best colour space for this, but it would sort-of work.
Another issue is that RGB is (usually when encountered "in the wild") the sRGB
colour space. sRGB as well as most other RGB colour spaces is *not* a linear
colour encoding per channel. They have been encoded with a geometrical
function with an exponent of (in the case of sRGB) about 2.2. This is a
historical effect to compensate for the non-linearity of CRT (cathode ray
tube) based screens.
If you want to be at least "sort of" linear, you need to undo the gamma
compensation first:
c' = c ** (1 / gamma)
gamma: the gamma coefficient, usually in the case of sRGB = 2.2
c': linearised RGB colour channel
c: un-linearised (s)RGB colour channel
Now you can perform quantitative sensible computations on the R'G'B' colour
tuples, like comparing colour distance as the Euclidean distance mentioned in
John's post.
Guy
--
Guy K. Kloss
Institute of Information and Mathematical Sciences
Te Kura Pūtaiao o Mōhiohio me Pāngarau
Room 2.63, Quad Block A Building
Massey University, Auckland, Albany
Private Bag 102 904, North Shore Mail Centre
voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181
eMail: G.Kloss at massey.ac.nz http://iims.massey.ac.nz
More information about the Image-SIG
mailing list