How to convert 1D binary data matrix to 2D image matrix?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 4 Jan 2013
[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
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!