Distinguishing between colors in LAB color space
4 views (last 30 days)
Show older comments
This is a general question which will help me in formulating the algorithm.
I have converted my RGB image to CIELAB color space. Now I will be using the A and the B channels for distinguishing features based on their hues. Hypothetically, if I take a small rectangular image patch within the A channel. Note that this rectangular image patch consists of different hues due to inclusion of two different feature parts within the patch. Then how can I numerically distinguish between the those different hues and classify them to be different from one another? I do know about DeltaE for color comparison but here I am talking about distinguishing hues within one channel of the CIELAB color space.
Any ideas or links would be appreciated.
0 Comments
Answers (2)
Image Analyst
on 1 Jan 2015
"hues within one channel of the CIELAB color space" is a meaningless statement.
If you take a rectangular ROI in your image (and it does not matter if it's the A channel or any other channel), then the pixels in that region will probably have different RGB values and thus different LAB values. So if there are 1000 pixels in the patch, you could have potentially 1000 unique colors. You have to decide what "distinguish" means to you. They are already distinguished because they have different values. To classify the region you have to decide what your classes are, like a certain range of hues or whatever. For example, you could transform the A and B channels into a Hue channel (or better yet, just get it directly from the rgb2hsv() function) and then create 10 color classes of hues, like color1 = hues between 0 and 0.1, and color2 = hues between 0.1 and 0.2, and so on. Then you can just threshold your hue channel image 10 times to get 10 different color classes. Each of the 10 images would show only pixels from that one color class.
You could use delta E if you want to specify some reference color, and then get the delta E of all other pixel colors from that one. I attach a demo where I do that on a sliding window so you get a localized delta E. The delta E's from the mean in the sliding window are computed. High delta E's will appear at places where the color is highly variable (like an edge).
My File Exchange has lots of color segmentation/classification demos, as you probably know. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
10 Comments
Image Analyst
on 17 Jan 2015
mona, what's the status? Did I help you solve this or are you still having problems? If so, what are they?
rain
on 6 Jun 2022
can someone help me, how to extract the color (especially red) then do segmentation to get the pixel value of that color.
I attached a sample image
1 Comment
Image Analyst
on 6 Jun 2022
Please start your own, separate question for this rather than answering someone else's 8 year old question. In the meantime try the Color Thresholder app.
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!