Grayscale image to binary image

2 views (last 30 days)
mado
mado on 17 Nov 2013
Commented: Image Analyst on 18 Nov 2013
I want to read grayscale image amd change it to one row binary bits without loss quality then return it back again to grayscale image.

Answers (2)

Walter Roberson
Walter Roberson on 17 Nov 2013
binary_vector = reshape(dec2bin(YourGrayscaleImage, 8).' - '0', [], 1);
  2 Comments
mado
mado on 17 Nov 2013
it doesnot work
Image Analyst
Image Analyst on 18 Nov 2013
Thanks for letting us know. Most helpful.

Sign in to comment.


Image Analyst
Image Analyst on 17 Nov 2013
See my bitslice demo, attached below in blue.
  2 Comments
mado
mado on 18 Nov 2013
Thank you but
1-I want higher resolution 2-where is the binary vector?
Image Analyst
Image Analyst on 18 Nov 2013
  1. How are you defining resolution? Your image will have a certain number of rows and columns, and each gray scale pixel will have an 8 or 16 bit value. Now, which of those are you calling resolution? And higher than what ?
  2. What vector? You have 2D images. A vector is a 1D array, or a list of (x,y) coordinates. What you have is a 2D image, so what is the vector you want to get? All the pixels values strung together in a 1D array like yourImage(:)?

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!