How to create huffman dictionary, encoding and decoding without using built-in functions?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Denoising and Compression in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!