Prev: Reading a large mixed CSV file of unknown types and size
Next: Reading a large mixed CSV file of unknown types and size
From: Ibtesam Saleh on 21 Jun 2010 13:34 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 21 Jun 2010 15:03 "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 21 Jun 2010 15:02 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 21 Jun 2010 15:12 > 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 21 Jun 2010 15:21
"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 |