HOW TO ENCODE AN 8BIT VALUE FROM A MATRIX
Afficher commentaires plus anciens
HELLO
I have generated a 256x256 matrix with an 8bit binary sequence present in each element. I wish to encode the sequence using the following scheme
A=00
B=01
C=10
D=11
i need to encode the whole matrix.please help.the matrix generated is from the following code
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,1} = dec2bin(a(i,j),8);
end
end
disp(b)
M=randint(256,256,[0,256]);
disp(M)
for k=1:1:256
for l=1:1:256
N{k,l,1} = dec2bin(M(k,l),8);
end
end
disp(N)
thanks in advance
Réponse acceptée
Plus de réponses (1)
David Sanchez
le 14 Août 2014
M=randint(256,256,[0,256]);
disp(N)
N=zeros(size(M));
for k=1:256
for l=1:256
N(k,l) = str2double(dec2bin(M(k,l),8));
end
end
Catégories
En savoir plus sur Image Data Workflows 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!