how to convert decimal values into 8bit binary values in a 256*256 matrix.

5 vues (au cours des 30 derniers jours)
Abirami
Abirami le 12 Août 2014
Commenté : diwa le 1 Déc 2017
i have taken a 256*256 image and found each of the pixel values. now i need to convert each of these pixel values into 8 bit binary sequence and display it as a 256*256 matrix. i have a problem here...i have used a for loop to compute binary sequence of each value..but only the last value is displayed...please help..the code is as follows
>>a=imread('C:\Users\a.png');
>>disp(a);
>>for i=1:256
>>for j=1:256
>>b= de2bi(a(i,j),8);
>>disp(b)
>>end
>> end
thanks in advance..

Réponse acceptée

Pratik Bajaria
Pratik Bajaria le 12 Août 2014
Modifié(e) : Pratik Bajaria le 12 Août 2014
Its Pretty Simple. You have not made 'b' into an array. do it and its all done.
i.e. Change it to the following
a=imread('C:\Users\a.png'); disp(a); for i=1:256 for j=1:256 b(i,j,:) = de2bi(a(i,j),8); disp(b) end end
Please let me know if in case of further doubts.
Regards, Pratik
  6 commentaires
Abirami
Abirami le 13 Août 2014
Thank u so much....got the 8bit sequences...
diwa
diwa le 1 Déc 2017
Plzz tell me how can I get maximum value among all these binary values of 8 bit

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by