⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ezw_encode.m

📁 EZW implementation which will use wavelet transforms and do the compression decompression using EZW
💻 M
字号:
%*********************************%   

%*********EZW encoder*************%

%*********************************%

function [DD,L1,SS,L2]=ezw_encode(X,LEVEL)
Y0=max(X);
Y1=max(Y0); %找到像素中最大值

%设最初门限制
     for i=0:20;
         if 2^i<=Y1 & 2^i>0.5*Y1;
             threshold=2^i;
             initialthreshold=threshold;
             laststeplevel=i+1;
             break;
         end;
     end;
     
sublist=[];
[xx,yy]=size(X);
A=mapping(xx); %排搜索顺序
[m,n]=size(A);

global N;      % Let Morton scanorder vector as a global variable
N=zeros(m*n,2);
    for i=1:m,
        for j=1:n,
            N(A(i,j),1)=i;
            N(A(i,j),2)=j;
        end
    end

order=1; 
L1=[0];
L2=[0];
DD=[];
SS=[];
while threshold ~= 0.5 & order <= LEVEL,  % if threshold~=0.5, do dominantpass and subordinatepass.
    %Dominant Pass
      [D,X,sublist] = dominantpass(X,threshold,sublist); 
      DD=[DD,D];
      L1=[L1,size(D,2)];
    %Subordinate Pass
      threshold=threshold/2;
      if threshold ==0.5,
          break;
      end
      S = subordinatepass(sublist,threshold);
      SS=[SS,S];
      L2=[L2,size(S,2)];
      
    order=order+1; 
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -