How to create huffman dictionary, encoding and decoding without using built-in functions?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Denoising and Compression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!