Posted by
Harry Parker on
Jun 04, 2008; 9:20pm
URL: http://imagej.273.s1.nabble.com/Color-Quantification-or-counting-tp3695993p3695996.html
Hello Kashif,
Everything is possible with ImageJ, but some things are more difficult than others. :-)
Seriously, ImageJ can help, but other software will also be needed.
As you know, colors are 3 dimensional. Several coordinate systems are in common use.
RGB (Red, Green Blue) coordinates in the sRGB (Standard RGB) color space system
are typical for computer displays, but images in JPG format are stored in YCrCb
coordinates, where Y is related to brightness, and Cr and Cb express how far off from
gray a particular color is.
For visual perception work, colors are best expressed in CIE's L* a* b* (LAB) system,
because the color differences, e.g., sqrt( L*L + A*A + B*B), are more perceptually uniform
for different colors when the colors are expressed in LAB coordinates.
Of course, if you are concerned more about how different the colors will look to a computer, then
the coordinate differences of the original digital image are the ones to use.
See Wikipedia's entry on "Color Difference" for a detailed introduction with links to more.
I suggest looking at your images using the " 3D Color Inspector/Color Histogram" plugin
of ImageJ to get some insight into your problem. Try the Lab space and the Wu Quantization
options.
Press the LUT button to get a listing of the colors after they have been quantizer to 256 or fewer.
ImageJ also has the "Color Space Converter" plugin, among others, to convert from RGB to
LAB and other coordinate spaces.
Complications include the fact that colors (and color differences)
are different depending on the type of lighting.
Fluorescent lights change the colors compared to tungsten lights, both as perceived by
you and as perceived by the camera. Daylight is different again.
Another complication is that inexpensive cameras with inexpensive lenses
do not have a uniform response across their images. The images can be much darker
on the sides and corners than in the center.
Another complication is that different cameras have different color sensitivities.
So to be accurate, you must calibrate your camera for both color and uniformity.
This involves taking measurements of images of calibrated color test charts and uniform fields.
Unfortunately, ImageJ has little to offer for the color calibration step.
A free program that does include a color calibration tool is NIP2. See
http://www.vips.ecs.soton.ac.uk/index.php?title=Colour_calibration_with_nip2At work we use an inexpensive commercial program called Imatest for this. See
http://www.imatest.com/Then I use a custom ImageJ macro I wrote to correct the colors to be accurate
in sRGB space. From this calibrated color image I use the Color Space Converter
to convert the image to LAB. Then I use a another macro I wrote to calculate color differences from the LAB coordinates.
A lot depends on how accurate you need to be.
--
Harry Parker
Senior Systems Engineer
Digital Imaging Systems, Inc.
----- Original Message ----
From: Kashif Zeeshan <
[hidden email]>
To:
[hidden email]
Sent: Wednesday, June 4, 2008 9:33:15 AM
Subject: Color Quantification (or counting)
Good Morning,
I want to count different colors present on an image for example when
pellets are of different colors in different media, I want to calculate
those colors numeric values because some times they are lighter in color
from other pellets and at that moment, its difficult to just say that they
are lighter. Instead of this, I want to quantify the colors. Is this
possible with ImageJ?
Thanks a lot.
Cordially.
Kashif ZEESHAN
(00 33 6 74 90 18 10)
Doctorant, Biopesticide Group,
Laboratoire Universitaire de
Biodiversité et d'Ecologie
Microbienne (LUBEM),
6 Rue de l'Université,
29334, Quimper Cedex,
France