From: Ibtesam Saleh on
Hi all...

I have colored image and I want to convert it to binary (I mean matrix of zeros and ones)
please how can I do that? Its very urgent issue...

thanks...
From: Sean on
"Ibtesam Saleh" <bossy_4me(a)yahoo.com> wrote in message <hvo7qu$2br$1(a)fred.mathworks.com>...
> Hi all...
>
> I have colored image and I want to convert it to binary (I mean matrix of zeros and ones)
> please how can I do that? Its very urgent issue...
>
> thanks...


threshold = some_value; %Threshold that above is 1 below is 0
Igray = rgb2gray(Irgb); %Convert colors to gray
Ibw = Igray>threshold; %Set everything greater than threshold to 1 and less to 0.
Good luck
From: Walter Roberson on
Ibtesam Saleh wrote:

> I have colored image and I want to convert it to binary (I mean matrix
> of zeros and ones)
> please how can I do that? Its very urgent issue...

BWImage = double(rgb2gray(YourImage) > 0.5);
From: Ibtesam Saleh on
> threshold = some_value; %Threshold that above is 1 below is 0
> Igray = rgb2gray(Irgb); %Convert colors to gray
> Ibw = Igray>threshold; %Set everything greater than threshold to 1 and less to 0.
> Good luck

Thanks Sean...
but how can I select the best threshold value for my images?
From: Sean on
"Ibtesam Saleh" <bossy_4me(a)yahoo.com> wrote in message <hvodim$b62$1(a)fred.mathworks.com>...
> > threshold = some_value; %Threshold that above is 1 below is 0
> > Igray = rgb2gray(Irgb); %Convert colors to gray
> > Ibw = Igray>threshold; %Set everything greater than threshold to 1 and less to 0.
> > Good luck
>
> Thanks Sean...
> but how can I select the best threshold value for my images?

imtool(Igray) %View Igray
%Click on the black and white circle on the menu bar and move the red lines defining the thresholds
%Adjust them to find one that meets you application