how to convert a binary code to image

10 views (last 30 days)
I want to convert binary code like 0 1 1 0 1 0 1 0 1 1
to a binary image. Can it be done? please help?

Accepted Answer

Walter Roberson
Walter Roberson on 16 Jun 2015
Edited: Walter Roberson on 16 Jun 2015
b = [0 1 1 0 1 0 1 0 1 1];
image(logical(b));
colormap(gray(2))
  2 Comments
Hadiid Anugrah
Hadiid Anugrah on 18 Jun 2015
Edited: Hadiid Anugrah on 18 Jun 2015
Can it be converted back to binary code? I mean the image to binary code?
Walter Roberson
Walter Roberson on 18 Jun 2015
Yes.
TheImage = imread('TheFileName.bmp');
ImgBin = im2bw(TheImage, 0.5);
b = ImgBin(1,:);

Sign in to comment.

More Answers (0)

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!