Color Quantification (or counting)

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

Color Quantification (or counting)

Kashif Zeeshan
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
Reply | Threaded
Open this post in threaded view
|

Re: Color Quantification (or counting)

Harry Parker
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_nip2

At 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




Reply | Threaded
Open this post in threaded view
|

Re: Color Quantification (or counting)

Harry Parker
In reply to this post by Kashif Zeeshan
Hi All,

In my last message I wrote (in part):

    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, that formula for color difference, deltaE, should be

    deltaE = sqrt( dL*dL + dA*dA + dB*dB),

where    dL = L-Lr, dA = A-Ar, and dB = B-Br
and "r"  marks the reference color.

The above is the CIE 1976 formula for  color difference. Since then
refinements have been made to this formula to make it better
match human perception. These are described in the Wikipedia article.


--
Harry Parker
Senior Systems Engineer
Digital Imaging Systems, Inc.


----- Original Message ----
From: Harry Parker <[hidden email]>
To: [hidden email]
Sent: Wednesday, June 4, 2008 5:20:55 PM
Subject: Re: Color Quantification (or counting)

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_nip2

At 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



Reply | Threaded
Open this post in threaded view
|

Re: Color Quantification (or counting)

Kashif Zeeshan
Hi,

Thanks a lot for your kind advices. Actually I am new to image analysis and
I don’t know at all these terms. Its my first time that I will try to
quantify the colors. It seems me what you told. I will try to better
understand and follow your advices.

Thanks again.

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
-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Harry
Parker
Envoyé : jeudi 5 juin 2008 20:52
À : [hidden email]
Objet : Re: Color Quantification (or counting)

Hi All,

In my last message I wrote (in part):

    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, that formula for color difference, deltaE, should be

    deltaE = sqrt( dL*dL + dA*dA + dB*dB),

where    dL = L-Lr, dA = A-Ar, and dB = B-Br
and "r"  marks the reference color.

The above is the CIE 1976 formula for  color difference. Since then
refinements have been made to this formula to make it better
match human perception. These are described in the Wikipedia article.


--
Harry Parker
Senior Systems Engineer
Digital Imaging Systems, Inc.


----- Original Message ----
From: Harry Parker <[hidden email]>
To: [hidden email]
Sent: Wednesday, June 4, 2008 5:20:55 PM
Subject: Re: Color Quantification (or counting)

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_nip2

At 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