91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-01-03
  • 語言: Matlab
  • 標(biāo)簽: matlab??

資源簡介

利用matlab實(shí)現(xiàn)的lzw編碼,能夠高效無損壓縮圖片,gif——lzw

資源截圖

代碼片段和文件信息

function?[outputout_combtable]?=?lzwencode(X)
%函數(shù)輸入
%?X?:?輸入二維圖像矩陣
%函數(shù)輸出
%?output?:壓縮后的十進(jìn)制碼流
%?out_comb?:轉(zhuǎn)換成二進(jìn)制碼流并且合并后在轉(zhuǎn)換成十進(jìn)制碼流
%?table?:?編碼過程中形成的字串表
%創(chuàng)建時(shí)間?2015.05.16
X=im2uint8(X);
[mn]=size(X);
vector=reshape(X1m*n);
vector=double(vector);


tmp.c=0;
tmp.lastCode=-1;
tmp.prefix=[];
tmp.codeLength=1;

%初始化字串表
function?[]=newTable

tmp.c=0;
tmp.lastCode=-1;
tmp.prefix=[];
tmp.codeLength=1;
table.nextCode=2;

table.codes(1:65538)=tmp;

for?c=1:257
????tmp.c=c;
????tmp.lastCode=-1;
????tmp.prefix=[];
????tmp.codeLength=1;
????table.codes(table.nextCode)=tmp;
????table.nextCode=table.nextCode+1;
end;

end

%執(zhí)行添加字串表項(xiàng)工作
????function?[]=addCode(lastCodec)
????????tmp.c=c;
????????tmp.lastCode=lastCode;
????????tmp.prefix=[];
????????tmp.codeLen

評論

共有 條評論