hi,i am doing lossy image compression using discrete cosine transform i had done all the steps of the compression(dct then quantization then zigzag scan) now i have a vector and i want to do huffman encoding i know that the code as follows
[dict,avglen] = huffmandict(symbols,p) comp = huffmanenco(sig,dict)
i am asking now how to get the symbol and p(probability) from the large vector that i have to do the encoding
If your vector is uint8() then one way of doing it is
symbols = unique(YourVector(:)); counts = hist(YourVector(:), symbols); p = double(counts) ./ sum(counts);
This is not the only way.
Play games and win prizes!Learn more