MATLAB Answers

Image to binary conversion

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

로그인 to comment.

답변 수: 1

Answer by Chandra Kurniawan on 11 Mar 2012
 Accepted Answer

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

Thank you so much. it worked.
How we can convert each pixel value of image in binary?

로그인 to comment.



Translated by