From: Ish Khan on
Hi, I am trying to convert my RGB pic to BInary, the problem is that when i use the usual command, im2bw, i lose some of the part of my pic, can you tell me what should be the proper coding where i do not lose the yellow color of the image?
From: ImageAnalyst on
Yes, that tends to happen when you convert a color image to binary,
which is just a monochrome image in which there is only pure black or
pure white and no color whatsoever. What were you expecting? If you
don't want to lose any color, don't convert to grayscale or binary.

If you just want to extract the yellow pixels, then see my demo on
simple color detection and extraction in RGB space.
http://www.mathworks.com/matlabcentral/fileexchange/26420-simplecolordetection
From: Ish Khan on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <c934eaca-2097-4867-9c8d-06dec1ed62dc(a)r18g2000yqd.googlegroups.com>...
> Yes, that tends to happen when you convert a color image to binary,
> which is just a monochrome image in which there is only pure black or
> pure white and no color whatsoever. What were you expecting? If you
> don't want to lose any color, don't convert to grayscale or binary.
>
> If you just want to extract the yellow pixels, then see my demo on
> simple color detection and extraction in RGB space.
> http://www.mathworks.com/matlabcentral/fileexchange/26420-simplecolordetection


Hi, thanks for your reply, actually i am doing a proj in foot, so that we can distinguish different foot type by studying the image. here is the code that i used, to change the RGB image to binary image,

I = imread ('foot.bmp');
J = rgb2gray (I);
level = graythresh (J);
BW = im2bw (J , level);
imshow (BW);

but my yellow dissapears if i do this, it normally should be all black, as all the color should be 1 in binary, thats what my teacher told me any way,
please help me to find my mistakes, i am totally lost.

Thanks
From: David Young on

> but my yellow dissapears if i do this, it normally should be all black, as all the color should be 1 in binary, thats what my teacher told me any way,
> please help me to find my mistakes, i am totally lost.

"All the color should be 1 in binary" is hard to understand. Can you explain more clearly? And why is yellow special? The conversion to grey scale that you do right after reading the image treats all colours equally.

Sorry to state the obvious, but if your teacher has told you something that doesn't make sense, wouldn't it be a good idea to ask him or her about it? You should get a much more precise answer from the teacher who knows about the problem.
From: ImageAnalyst on
Ish:
I'm not sure you're understand - in grayscale and binary images there
is NO color, much less yellow. If your teacher told you that you'll
have an image with just 0's and 1's (pure black and pure white) after
doing what you did - that's right! No color! So what's the problem?
Why do you want to keep, or expect to keep yellow in the binarized
image, even if it were present in your original image? There is no
mistake in your code, only a mistake in your expectations.

At this point you need to post your image(s) to http://drop.io so we
can see.