CIELab Color Averaging

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CIELab Color Averaging

Albatross
Was wondering if anyone could explain how the "Average Color" function in ImageJ/Fiji works (i.e., how is it averaging color)?  What is the function doing when "CIELab Averaging" is checked?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: CIELab Color Averaging

dscho
Hi Albatross,

On Tue, 28 Oct 2014, Albatross wrote:

> Was wondering if anyone could explain how the "Average Color" function in
> ImageJ/Fiji works (i.e., how is it averaging color)?  What is the function
> doing when "CIELab Averaging" is checked?

To understand what colors really are, you will need to study color space
theory.

I found a very interesting read some time ago:
http://www.4p8.com/eric.brasseur/gamma.html

Please note that ImageJ does not exactly make a difference between
spectrographs and photographs (and displays spectrographs as if they were
photographs), therefore you will experience exactly the problem described
in the linked article.

Further, I should state right away that there is *no* perfect color space.
Even CIELab is not perfect, while it was designed to reflect human color
perception as well as possible (read: perceptional differences in color
were intended to be reflected very closely in the geometric distance of
the corresponding (L,A,B) coordinates). And I should also stress that
there are actually *two* Lab spaces: Hunter Lab and CIE L*a*b. They are
slightly different, and to this day psychologist disagree which one is
more appropriate.

To make things even more complicated, the (Lab) color spaces require the
specification of a white point, too.

If you truly need to work with colors scientifically, you really need to
know a lot about color theory including color spaces. In particular, you
need a calibrated camera, a calibrated screen and you need to verify
constantly that everything keeps being calibrated.

As a quick starter, I suggest https://en.wikipedia.org/wiki/Color_space
and https://en.wikipedia.org/wiki/Lab_color_space, but this is just the
first step.

Once you understand just how much of a Pandora Box you just stepped into:
The "average color" plugin assumes quite a lot: it assumes that your
images are in sRGB and by necessity it will have rounding issues (as the
result is moved back into integer sRGB values). And if the CIELab checkbox
is unchecked, the averaging makes no sense perceptually, only
arithmetically. In other words, the "average color" plugin is more a toy
than a finished scientific tool (I never had a need to make it more
scientifically rigid as I stopped working on the perception of colors
pretty much exactly when I started working on Fiji).

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: CIELab Color Averaging

Albatross
Thank you for your response, great info.

And some more questions:

1) How can I determine if my image is in the sRGB format?  I am using images from a scanner, the metadata from the image only says that it is an RGB image.

2) So when the 'Average Color' function is using CIELab averaging, is it converting RGB values into the CIELab color space?

3) Is there a better way to get a mean color value for R, G, and B per a ROI (see photo example below)?  Can I batch process this?  I've tried using the multi-measure tool (after splitting the image into R, G, B slices) in the ROI manager, but the data output puts the values in an order that is not very useful.  To be more specific, the time it would take me to reformat the multi-measure output in excel would be too great.  I need the output to be in order by R, G, B per ROI per image so that I can convert the values to H, S, B.

Any help would be greatly appreciated, thank you!

 
Reply | Threaded
Open this post in threaded view
|

Re: CIELab Color Averaging

Peter Haub
Hallo Albatross,

have you thought about treating your images as absorbance images? Maybe
it is worth to try since they look like brightfield reflectance images -
means that the color is probably created by the spectral absorbance of
the object.
If you calculate the values A = -log((I-B)/(Io-B) for the three channels
RGB you can measure the mean absorbance vector for each object. This
vectors should describe the object's absorbance characteristics (-
sometimes called color :-).
I is the intensity of the RGB channel images.
B is a background values (not image but noise background)
I is the maximum intensity in your image (value of a white object)

I have done that by assuming B=10, Io=255.
I calculated the average vector from the absorbance vectors of the
objects. The angle between the vectors and the average are:
Object I (Upper Left):  0.0817°
Object II (Upper Right):  0.1187°
Object III (Lower Left):  0.0855°
Object IV (Lower Right):  0.1433°
I think this results nicely describe the scene (the two left object have
a similar color and are closer to an estimated mean color).

Note, this Lambert-Beer-like approach is very much simplified and is not
really describing physical reality. In any case you have to consider
that the illumination, imaging parameters etc. have to be stable and
unchanged between measurements. The calculation should be performed in
32bit images. If a back-mapping to 8bit is necessary, e.g. to visualize
the combined absorbance values in the 3D Color Inspector, it should be
performed with a unified maximum display value for all 3 channels.

Maybe you will give it a try.

Regards,
Peter


On 31.10.2014 00:33, Albatross wrote:

> Thank you for your response, great info.
>
> And some more questions:
>
> 1) *How can I determine if my image is in the sRGB format?*  I am using
> images from a scanner, the metadata from the image only says that it is an
> RGB image.
>
> 2) *So when the 'Average Color' function is using CIELab averaging, is it
> converting RGB values into the CIELab color space?*
>
> 3) *Is there a better way to get a mean color value for R, G, and B per a
> ROI (see photo example below)?  Can I batch process this?*  I've tried using
> the multi-measure tool (after splitting the image into R, G, B slices) in
> the ROI manager, but the data output puts the values in an order that is not
> very useful.  To be more specific, the time it would take me to reformat the
> multi-measure output in excel would be too great.  I need the output to be
> in order by R, G, B per ROI per image so that I can convert the values to H,
> S, B.
>
> Any help would be greatly appreciated, thank you!
>
> <http://imagej.1557.x6.nabble.com/file/n5010257/20140204_Plastic_Photo_Example_B.jpg>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/CIELab-Color-Averaging-tp5010215p5010257.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html