How to create huffman dictionary, encoding and decoding without using built-in functions?
조회 수: 6 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Denoising and Compression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!