Hi,

the more I read research papers or books or FAQ or web articles on the subject, the more I am confused about all these conflicting informations and different mathematics ...

Unfortunately, that is very frequent. A friend of mine,
which incidentally is a true color guru, gave me this
word of advice: Make sure to understand the basics,
on more clearly you got the fundamental concepts, the
more sense (or not) will made those discussions to you.

Please also note not all nice web pages have good
information at all...

Anyway, let's go for your questions.

A) If I need to write a RGB2XYZ matrix to convert my images, what matrix should I use ?

That is one of the most frequent questions, and,  well, you know,
the answer is "it depends". Ok, I'm going to explain what means
this "it depends".

RGB per se means nothing. In fact, there are an infinite number
of different RGB spaces. On depending on which RGB space
you are, a given RGB triplet means one or other color.
For example, if you take a image from your camera, which is
formed by pixels with RGB values and displays it on a
given monitor, you got some colors. Displaying the same image
on a different monitor would yeld different colors, so the
interpretation of the RGB space depends of the device being
used.

This Curve/Matrix thing is a simple math model to convert
from RGB (which is device dependent) to XYZ (which is
device independent) so every device, every camera, etc. would
have a different matrix . Also, devices are far more complex
than matrix-curves, and most times this approach is not enough.
If you were expecting some  magic math, those are bad news.

Now the good news, the goal of ICC profiles is to convert from
RGB (or whatever) to XYZ, so if you have an ICC profile, you
can obtain XYZ, Lab or any other device independent space.

Unfortunately, that means there is no way to obtain reliable
Lab from a "generic" matrix. You must have the right ICC
profile to do that. Assuming sRGB does'nt help, unless you
were happy with a *very* coarse aproximation. Hint: many
cameras marks images as sRGB, but the RGB space is
NOT sRGB but a quite different thing.

Obtaining XYZ or Lab, is easy with lcms, you just
do a color transform from your ICC profile to the built in
XYZ or Lab built-ins. The tutorial covers the procedure to
do that. Obtaining xyY from XYZ is as easy as one function
call. I guess L* would be more suitable for you, as Lab does
a pretty good job separating chroma and luma and is near
perceptually uniform. But anyway, the choice is up to you.

I noticed that LittleCMS has 16-bit XYZ/Yxy/Lab types and even 8-bit Lab. How is this possible ???

Computers are quantized beasts, so there is no
"infinite precission" thing. Even floats and doubles are
using some encoding to store the number in a finite
number of bits representation.

In the case of lcms and XYZ, it uses 16 bits as 1.15 fixed
point. Fixed point is a neat trick to encode real numbers, just
do a google search on the words "fixed point", you will
be amazed on how many applications it has.

Regards
Marti Maria
The littleCMS project
http://www.littlecms.com





----- Original Message ----- From: "FreeImage Team" <[EMAIL PROTECTED]>
To: <lcms-user@lists.sourceforge.net>
Sent: Friday, April 14, 2006 12:32 AM
Subject: [Lcms-user] Color image processing using LittleCMS


Hi to all,

This is a newbie question related to color image processing ...

I've got a lot of computer vision and image processing algorithms that
works on greyscale images, i.e. 8-bit, 16-bit and float greyscale images.
I want to update my algorithms and process color images.
There are very few research papers on color image processing and each
paper use a different method to process such images (e.g. a different
color space, a different white point, ...).
While I'm well versed in computer vision (using greyscale images), I'm a
newbie to color image processing, and the more I read research papers or
books or FAQ or web articles on the subject, the more I am confused
about all these conflicting informations and different mathematics ...
Nevertheless, to sum up what I have learned, this is what I need to do
to convert my algorithms :
1) First, I want to deal with RGB-24-bit, RGB-48-bit and RGB float (also
known as HDR) images
2) To process such images, I need to convert them to Yxy or CIE Lab
color space
3) Then, I need to apply my greyscale algorithms to the Y (Yxy) or to
the L (CIE Lab) component
4) I then have to convert back the transformed image to a RGB color
space (RGB 24-/48-bit or RGB float)
5) for HDR images, once I have a transformed RGB float image, I can
apply a tone mapping algorithm and convert to 48-bit (or 24-bit)

The problems I have are the following :
---------------------------------------
A) If I need to write a RGB2XYZ matrix to convert my images, what matrix
should I use ?
My images are taken from unknown files (LDR, HDR float) or from unknown
camera (JPEG 24-bit or RAW converted to 48-bit, no profile attached), so
do I have to assume they have linear RGB color values or do I have to
assume that they use a sRGB color model or do I need to apply a gamma
correction before the transformation ? In the second case (sRGB) or
third case (gamma correction), the transformation matrix is far more
complex to calculate (from a computationnal standpoint). Is this
computation really needed ?
For example, given this link:
http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html, and
given a RGB file that is not known, do I need to compute these complex
transformations before using a RGB2XYZ matrix ?
=> And what reference white point should I use (e.g. D50, D65) ???

B) Instead of writing my own transformation matrices, does LittleCMS can
do this for me ?
That would mean: converting from RGB 24-/48-bit and RGB float to a float
color space such as Yxy ?
I noticed that LittleCMS has 16-bit XYZ/Yxy/Lab types and even 8-bit
Lab. How is this possible ??? All research papers I could read work with
float images (not double images and even less 8-bit, and this is
something I can easily understand), so how can you represent such color
spaces as 8-bit (even as 16-bit) ?
16-bit is probably correct for images coming from a digital camera, due
to the limitation of the CCD captors, but what about computer generated
images (i.e. most of the HDR images) ?

I know this is a lot of questions, but as I have said, I'm a newbie to
the field of color image processing and I just want to apply greyscale
image processing algorithms to a color image. Is this really possible ?
Is there a *standard way*  or at least a *commonly accepted way* to do
this ?

Thanks in advance for any info or pointers you could give me :)

Hervé Drolon



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to