how to convert decimal values into 8bit binary sequence and represent in a 256*256 matrix
Afficher commentaires plus anciens
hello
I have used the following code to represent decimal values in a matrix to 8bit binary sequences in place of each value. but im not able to get the 8 bit value...instead i get only one bit answer. also in case an 8bit sequence is obtained how should i represent each sequence separately? please help.
>>clc
>>clear all
>>close all
>>a=imread('C:\Users\Abzz\Desktop\lena.png');
>>imshow(a)
>>disp(a)
>>for i=1:1:256
>>for j=1:1:256
>>b(i,j,:)=dec2bin(a(i,j),8);
>>end
>>end
>>disp(b)
thanks in advance
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 13 Août 2014
a=imread('C:\Users\Abzz\Desktop\lena.png');
b=cell2mat(arrayfun(@(x) reshape(dec2bin(x,8)-'0',1,1,8),a,'un',0));
Catégories
En savoir plus sur Vector Fields dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!