MATLAB Answers

Image to binary conversion

5 views (last 30 days)
Hi,I would like to convert each pixel value of an image to one byte. how do i do it. I tried
for i=1:a
for j=1:b
k(i,j)=dec2bin(image(i,j));
end;
end;
where a and b are size of the image. But there comes size mismatch error. Please help me to correct it.

  0 Comments

Sign in to comment.

Accepted Answer

Chandra Kurniawan
Chandra Kurniawan on 11 Mar 2012
for i = 1 : a
for j = 1 : b
k{i,j} = dec2bin(image(i,j));
end
end
please use cell-array to store strings, not array.

  2 Comments

Nandhini Rajkumar
Nandhini Rajkumar on 11 Mar 2012
Thank you so much. it worked.
maryam zaman
maryam zaman on 27 Apr 2013
How we can convert each pixel value of image in binary?

Sign in to comment.

More Answers (0)

Sign in to answer this question.