필터 지우기
필터 지우기

Error using huffman code

조회 수: 6 (최근 30일)
kash
kash 2012년 12월 11일
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

답변 (1개)

Walter Roberson
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
kash
kash 2012년 12월 11일
i get same eerror
Error using ==> huffmandict at 97 The symbol and probability vector must have the same length
Error in ==> Untitled28 at 13 [dict,avglen]=huffmandict({'cA', 'cH'}, p);
Walter Roberson
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 CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by