how to convert a binary code to image

10 Ansichten (letzte 30 Tage)
Hadiid Anugrah
Hadiid Anugrah am 16 Jun. 2015
Kommentiert: Walter Roberson am 18 Jun. 2015
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?

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by