Thread Subject: Lab color space issue

Subject: Lab color space issue

From: rubionelove

Date: 12 Oct, 2009 13:15:21

Message: 1 of 6

Dears all,
I've a color in Lab format

L=69
a=30
b=71

if I fix L value to 30. How can I find a and b values of the colour
since they do not change in a linear way?

thank you very much

Subject: Lab color space issue

From: rubionelove

Date: 12 Oct, 2009 14:30:21

Message: 2 of 6

any suggestions?

Subject: Lab color space issue

From: John D'Errico

Date: 12 Oct, 2009 14:43:21

Message: 3 of 6

"rubionelove " <rubionelove@gmail.com> wrote in message <haveht$as8$1@fred.mathworks.com>...
> any suggestions?

I already responded to your question. I've worked in
color science, gamut mapping, color characterization,
modeling, etc, for 20 years. And I have no idea that
your question is asking.

Please be more specific. Nobody is answering because
nobody else has any idea what you want either.

John

Subject: Lab color space issue

From: ImageAnalyst

Date: 12 Oct, 2009 15:15:56

Message: 4 of 6

I second what John says. This question makes no sense (not to mention
the fact that you were hoping for responses practally instantly). You
need to clarify. If you must have an answer without clarifying, then
I submit this: use a colorimeter or spectrophotometer instrument to
"find" a and b.

Subject: Lab color space issue

From: rubionelove

Date: 12 Oct, 2009 16:24:03

Message: 5 of 6

I'm sorry john and Imageanalyst if the question was not clear.
I'll try to clarify the problem.

I'm currently facing a problem computing the euclidean distance between the "a" and "b" components of two colours.
For example I have 4 colours in rgb format
dark gray, light gray
dark brown and light brown

I converted the four colours in lab space.
I observed that for the two greys the "L" value is different but "a" and "b" remains quite the same, so the euclidean distance between "a" and "b" components of the two grays is very small.

I observed also that for the two browns the euclidean distance between two different colours (dark brown and clear brown) is generally larger than with grays. Because also "a" and "b" components are changing.
In my opinion this is due to the 3dimensional shape of the lab space.



My goal is to remove a selected colour in an image.

    C=makecform('srgb2lab');
    imLAB= applycform(Image,C);
    SelectedColor= applycform(color,C);
    
    % Extract a* and b* values
    imA = imLAB(:,:,2);
    imB = imLAB(:,:,3);
    colA = SelectedColor(1,2);
    colB = SelectedColor(1,3);

    % compute distance from selected color
    distTresh=5;
    imMask = zeros(r,c);
    imDist =hypot(imA-colA ,imB-colB );
    imMask(imDist>distTresh)=1;

This is working good with grays (color= gray). But to have the same result with other colours I've to change the treshold.
So, my idea was to convert all the colours in my image in colors available at L=50 for example. And then to be able to remove a colour from the image without changing the treshold.

thank you very much for answer
I'm a bit confused about working in this colour space

Subject: Lab color space issue

From: John D'Errico

Date: 13 Oct, 2009 00:13:05

Message: 6 of 6

"rubionelove " <rubionelove@gmail.com> wrote in message <havl73$3pj$1@fred.mathworks.com>...
> I'm sorry john and Imageanalyst if the question was not clear.
> I'll try to clarify the problem.
>
> I'm currently facing a problem computing the euclidean distance between the "a" and "b" components of two colours.
> For example I have 4 colours in rgb format
> dark gray, light gray
> dark brown and light brown
>
> I converted the four colours in lab space.
> I observed that for the two greys the "L" value is different but "a" and "b" remains quite the same, so the euclidean distance between "a" and "b" components of the two grays is very small.
>

Neutrals in Lab all fall on the L* axis, where a*=b*=0.

So very logically, the difference between a* and b*
MUST be small for neutrals.


> I observed also that for the two browns the euclidean distance between two different colours (dark brown and clear brown) is generally larger than with grays. Because also "a" and "b" components are changing.
> In my opinion this is due to the 3dimensional shape of the lab space.

I don't think you understand the different color spaces.
But certainly it makes little sense to talk about the
"shape" of these spaces in this context. These color
spaces are simply cartesian coordinate systems, unless
you start talking about a space like LCH, in which case
it is a cylindrical coordinate system.

Regardless, you are asking questions about what are
called color names. We learn from childhood what
colors are described by the color names "red", "blue",
"black", "brown", etc. And of course, everybody might
have a slightly different definition of those boundaries
in a given color space from everyone else.

The color name boundary of the set of colors one
might describe as "neutral", lives in Lab space along
the L* axis, at a*=b*=0. Slightly off that axis, one
has the set of colors described as "near neutrals".
In RGB space, these neutrals live NEAR the line where
R=G=B. It turns out that the neutrals will generally
not be exactly on that line, but they will lie close to
it. The specific RGB space chosen will differ slightly
in where the neutrals will lie. (RGB has a MUCH less
exact definition than does Lab. In fact, there are many
different spaces that can loosely be called RGB.)

How about "brown"? The color name brown describes
a set of colors that live in the first quadrant in the
(a*,b) plane. Whereas the set of neutrals lives along
a roughly linear set in RGB or Lab, the set of browns
lives in more of a "blob".


> My goal is to remove a selected colour in an image.
>
> C=makecform('srgb2lab');
> imLAB= applycform(Image,C);
> SelectedColor= applycform(color,C);
>
> % Extract a* and b* values
> imA = imLAB(:,:,2);
> imB = imLAB(:,:,3);
> colA = SelectedColor(1,2);
> colB = SelectedColor(1,3);
>
> % compute distance from selected color
> distTresh=5;
> imMask = zeros(r,c);
> imDist =hypot(imA-colA ,imB-colB );
> imMask(imDist>distTresh)=1;
>
> This is working good with grays (color= gray). But to have the same result with other colours I've to change the treshold.
> So, my idea was to convert all the colours in my image in colors available at L=50 for example. And then to be able to remove a colour from the image without changing the treshold.
>

Sorry, but this simply will NOT work.

I'd suggest that you try my fuzzycolor tool, found
on the file exchange. It has the ability to identify
pixels in an RGB image that satisfy a given color
name. (If you disagree with my definition of the
color name boundary for brown, you can change
it as you like, using the tools I provide there.)

http://www.mathworks.com/matlabcentral/fileexchange/12326

HTH,
John

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
lab space conve... rubionelove 12 Oct, 2009 09:19:04
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com