How to create huffman dictionary, encoding and decoding without using built-in functions?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a digital communication project assigned, i need help with one of the stages. the first stage is i need to format and image and then source encoded and decoded using huffman. the problem is that i can't use the built in functions, and i am to build a tree then a dictionary then encode and decode the image. i first converted it into a gray scale pixel matrix thrn i calculated the probabiltiy. I need help with huffman source coding, i need to build a code but i don't know how.
img = imread('sample.jpg');
imgOriginal = rgb2gray(img);
[rows, cols] = size(imgOriginal);
Image = imgOriginal(:);
[N, M] = size(Image);
Count = zeros(256,1);
for i = 1:N
for j = 1:M
Count(Image(i,j)+1) = Count(Image(i,j)+1)+1;
end
end
p = Count/(M*N);
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Denoising and Compression 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!