Error using huffman code
7 次查看(过去 30 天)
显示 更早的评论
I get error
Error using ==> huffmandict at 72
The symbol input must be a vector
Error in ==> Untitled3 at 5
[dict,avglen]=huffmandict(symbols,p)
wen using the code
A=imread('lena.jpg');
A=rgb2gray(A);
[symbols,p]=hist(A,double(unique(A)));
p=p/sum(p)
[dict,avglen]=huffmandict(symbols,p)
comp=huffmanenco(A,dict)
please help
0 个评论
回答(1 个)
Walter Roberson
2012-12-11
Remember that hist() applied to an array (rather than a vector) histograms by column. This behavior is not documented, though: what is documented is that you must hist() a vector.
12 个评论
Walter Roberson
2012-12-11
I think you should go back and study the theory about what a "symbol" is for the purposes of huffman encoding.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Source Coding 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!