Colorspace transformations - linear sRGB to HSV

16 views (last 30 days)
Hello all,
I need a color space specialist :-)
I have a set of portraits; on every portrait a person is holding a gray card/color checker next to his/her cheek.
I am trying to determine some mean value of the skin colour (by comparison with reference white) and than do some white balancing...
All the photos are in CR2 (RAW) format; after linearization, demosaicing etc. I do a color conversion of my raw images to (linear) sRGB color space.
Since I am interested in chromaticity, I would like to convert my (linear) sRGB to HSV...and than present i.e. skin colors gamut.
How to do that?
I tried with some tools available, but it is not working...

Accepted Answer

Image Analyst
Image Analyst on 2 Mar 2014
I do calibrated color imaging all the time - it's my "day job". You're doing it backwards, and incorrectly. You white balance FIRST and THEN determine skin color, not the other way around. And you can't do white balancing with just gray cards. You need something like an X-rite Color Checker Chart. Otherwise how can you tell if there is some color shift in your illumination? You might have yellowish or bluish white and want to make sure that you have the true white you're looking for, for example D65.
And I wouldn't go into sRGB space. How can you do that? How can you get standard RGB values when you can get almost any RGB out of the camera that you want just by changing the exposure and other things? I would just go directly from your actual RGB to XYZ and then to LAB. I have a primitive gamut visualization routine here (attached) but the best one is this one
Actually first you do background correction to compensate for lens shading. Then you snap images of a series of gray cards taking up the whole image to determine the opto-electronic conversion function ("gamma"). Then you image the Color Checker chart and background correct and gamma correct it. Then you determine the RGB to XYZ transform. Then you can use the "book formulas" to go from XYZ to LAB, which is the "true" colors.

More Answers (1)

Matija
Matija on 3 Mar 2014
Hello Image Analyst,
I will work with RAW images and use dcraw to get linear responses from sensor in XYZ color space.
Actually first you do background correction to compensate for lens shading.
Please explain this part! Is this vignetting correction?
Then you snap images of a series of gray cards taking up the whole image to determine the opto-electronic conversion function ("gamma").
I guess I am doing this correctly - dcraw is performing linearization!
Then you determine the RGB to XYZ transform.
This is exactly what I get from dcraw.
One more question...
Can you explain or provide me a link to white balancing with an X-rite Color Checker Chart? Why is this neccessary?
Thank you!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!