How to get 12 specific color values from gamut color map

2 次查看(过去 30 天)
How to get 12 color values from color gamut...
I converted the RGB image to CIELAB,... but i dont know how to get its value....

采纳的回答

Image Analyst
Image Analyst 2014-7-24
You can't do this unless you have a color calibrated system. You will need to get a ColorChecker Passport http://xritephoto.com/ph_product_overview.aspx?ID=1257&action=overview and have this in the field of view. Then you will have to do a least squares regression to create a transform to convert your RGB values into XYZ values. Use this transform to get X, Y, and Z images. Then use the analytical formulas to go from XYZ to LAB values. So then you have an LAB image and it's just a simple matter of clustering.
If you don't care about accuracy at all , then you can use uncalibrated RGB images with "book formula" LAB equations to get your LAB images. Use makecform() as shown in this example http://www.mathworks.com/products/demos/image/color_seg_k/ipexhistology.html
cform = makecform('srgb2lab');
lab_he = applycform(he,cform);
Again, that's for just a quick-and-dirty, proof-of-concept approach. It's not good if you want accurate results. Why? Well the formulas go from sRGB to XYZ. Well your camera gives sRGB doesn't it? That's what they tell you. However you know that you can get any RGB you want by changing exposure time on the camera, or color temperature of your illumination. Did your subject change? No - it's the same tongue. Changing image capture conditions didn't change the tongue. But your RGB changed. So that means that different exposures will give you different LAB values (if you use book formulas) even though the LAB value of the subject tongue didn't change at all.
Either way, then just look at the LAB values of all the pixels in your image and determine what class (C, R, B, P, DR, etc.) they are closest to and assign that pixel to that class number (give each class a number like C=1, R=2, etc.). Now you have a classified image and you can just get area fractions directly
for cl = 1 : numberOfClasses
binaryImage = (classifiedImage(:) == cl);
imshow(binaryImage);
caption = sprintf('Class %d', cl);
title(caption, 'FontSize', 16);
areaFraction(cl) = sum(binaryImage(:));
end
Of course, like I said, all your numbers are totally arbitrary. Well not totally arbitrary (like a totally random numbers) -- the rankings of the different classes may be fairly correct, but each individual area fraction is not really accurate.
  3 个评论
John D'Errico
John D'Errico 2014-9-22
Funny. Despite having spent 20 years at Kodak developing schemes for gamut mapping, creating tools to create profiles (gridfit is the 2-d version of one of my tools) etc., I had no idea what this question was about. Kudos to you.
Image Analyst
Image Analyst 2014-9-22
John, I saw this edit by her also and was dismayed. She drastically changed the question, removing the vast majority of it and most of the context, and I believe some comments. Not sure why she did that. I can understand why thought my answer was curiously insightful. You probably thought I had an advance copy of the mind reading toolbox, but no such luck. If I remember correctly she was wanting to compare colors of tongues from snapshots of different people, or something like that.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by