It depends what you mean by "invert". Additive or multiplicative?
Think of each of the color elements, (red, green, blue) as varying 0 (for none) and 1 (= 100%).
An additive inversion is like B = 1 - A.
A multiplicative inversion is like C = 1/A.
You can do either in a few simple steps with ImageJ using the Image Calculator. (menu Process->Image Calculator...)
Additive is easier. Just subtract the image from a white (all 1's) image.
Just Duplicate your image. Fill one with white.
(Use the menu Edit->Options->Colors... to make the foreground color white. Then use the Fill command.)
Then subtract your image from the white one.
Multiplicative inverse is trickier and less well defined, because you need to deal with fractional values and dividing by zero (black).
You can convert your color image to an RGB stack (Image->Type->RGB Stack).
Then convert those integer values to real, (Image->Type->32 bit).
Then use the Process->Math->Reciprocal function to invert.
You might want to scale the values before and/or after.
You then can do the reverse to get back to integers (Image->Type->8 bit) and convert the integer to RGB (Image->Type->RGB Color).
One complication of all these inversions is that color image values are usually nonlinear.
They usually have an exponential ("gamma function") relation to intensity to compensate for display nonlinearity.
So you may need to do an inverse gamma function on the data to linearize it before the inversion and then reapply a gamma function after you done, to get the expected displayed values.
Hope that helps.
--
Harry Parker
Senior Imaging Systems Engineer
Digital Imaging Systems, Inc.
----- Original Message ----
From: Jon Harman <
[hidden email]>
To:
[hidden email]
Sent: Monday, October 20, 2008 2:27:57 PM
Subject: RGB invert
Hi,
I needed to invert an RGB image, but couldn't find any such routine in
ImageJ's menu. Did I miss it? It would be nice to have.
Jon
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com