MATLAB Answers

kush
0

Re-formulate the image into a vector of zeros and ones.

Asked by kush
on 23 Mar 2012

i am working on a project of image processing & i need to convert an image into vector of 0 & 1.in this each pixel needs to be replaced by its binary equivalent

if anyone knows plz help

  0 Comments

2 Answers

Answer by Matt Kindig
on 23 Mar 2012

If your image is an indexed or grayscale image, it is just a matter of comparing the image to a pre-defined threshold. You will need to adjust this threshold based on which features of the image you want to be a 1.

threshold = 0.5;  %or some other threshold
BW = (myImage >= threshold);   %this will be a matrix of ones and zeros.

  1 Comment

kush
on 23 Mar 2012

thank u


Answer by faraz.a
on 25 May 2013

can you please tell me how to convert binary image in to 0's and 1's matrix were 0 is white pixel and 1 is a black pixel. i need the code for that

  1 Comment

Image Analyst
on 25 May 2013

Did you see Matt's answer above?


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!