From: Ibtesam Saleh on
What the steps to do that? is convert it directly to binary OR convert it to gray then to binary?
I have confused I want black/white image
I try
img= im2bw(imageName);
but it is became gray scale not black/white
Please help me with the steps to get binary image from colored one

Ibtesam
From: Sean on
"Ibtesam Saleh" <bossy_4me(a)yahoo.com> wrote in message <ht3cla$3e8$1(a)fred.mathworks.com>...
> What the steps to do that? is convert it directly to binary OR convert it to gray then to binary?
> I have confused I want black/white image
> I try
> img= im2bw(imageName);
> but it is became gray scale not black/white
> Please help me with the steps to get binary image from colored one
>
> Ibtesam

-"Gray" it (rgb2gray)
-Pick a threshold
-Ibw = Igray > threshold;
From: Ibtesam Saleh on
> -"Gray" it (rgb2gray)
> -Pick a threshold
> -Ibw = Igray > threshold;

thanks sean for quick response, are you mean like this:
gray= rgb2gray(image);
bw= im2bw(gray);

I don't know what is the second and third steps mean?

From: Ibtesam Saleh on
how pick the suitable threshold?
I did as you advise me..
Igray= rgb2gray(img);
threshold= 70;
Ibw= Igray> threshold;
From: Royi Avital on
"Ibtesam Saleh" <bossy_4me(a)yahoo.com> wrote in message <ht3h5k$53e$1(a)fred.mathworks.com>...
> > -"Gray" it (rgb2gray)
> > -Pick a threshold
> > -Ibw = Igray > threshold;
>
> thanks sean for quick response, are you mean like this:
> gray= rgb2gray(image);
> bw= im2bw(gray);
>
> I don't know what is the second and third steps mean?
>

Once you have a gray image you must chose a threshold.
A value which above it all pixels will be assigned to 1 and beneath to 0.
You may do that in various ways.

In my example, I is a gray scale image:

Threshold = 128;
I(I < 128) = 0;
I(I >= 128) = 1; % Pay attention to the order
I = logical(I); % Casting

I hope that helps.