How to convert 1D binary data matrix to 2D image matrix?
이전 댓글 표시
I have a one-dimensional matrix of size 256X256X8. It has a string of 0 and 1 of the said length. I want to form an 2D Image matrix of size 256x256 from the previous matrix with each eight bits in the original matrix representing an integer in the final matrix. Is there any way to do it?
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2013년 1월 4일
[ii,jj]=find(ones(256,256));
a=randi(2,256,256,8)-1;
b=cell2mat(arrayfun(@(x,y) a(x,y,1:8),ii,jj,'un',0)' );
out=bin2dec(num2str(reshape(b,256*256,8)));
res=zeros(256,256);
res(1:256*256)=out
카테고리
도움말 센터 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!