【发布时间】:2014-10-06 08:40:31
【问题描述】:
在 MATLAB 中存储霍夫曼代码的最佳方法是什么? 例如:
letters = [1:6]; % Distinct symbols the data source can produce
p = [.5 .125 .125 .125 .0625 .0625]; % Probability distribution
[dict,avglen] = huffmandict(letters,p); % Get Huffman code.
sig = randsrc(1,20,[letters; p]) % Create data using p.
comp = huffmanenco(sig,dict) % Encode the data.
-> save('file.mat','comp','dict');
-> clear all;
-> load('file.mat');
deco = huffmandeco(comp,dict) % Decode the encoded signal.
但保存功能不会以低容量存储数据。 我使用了 dlmwrite 功能,但存储量很大。 在其他技术中,例如 JPEG 图像中的 Huffman 代码,如何进行存储? 如您所知,霍夫曼代码用于 JPEG 图像压缩。 [imwrite(mat,'mat.jpeg')]中的霍夫曼编码如何存储在磁盘上?
【问题讨论】:
标签: matlab image-processing huffman-code