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

📄 dominantpass.m

📁 EZW法是一個用matlab寫的程式,是植基於小波的影像壓縮轉換
💻 M
字号:


function [D,X,sublist,sub_list] = dominantpass(X,threshold,sublist,sub_list) 

% Dominant pass function

D=[];

global N;

[m,n]=size(X);

% X is the coefficients matrix

R=zeros(m); % matrix R is a reference matrix, same size as X; '0' means

            %this coefficient is not a descendant from zerotree root;

[a,b]=size(N);



                

              if abs(X(1,1))>=threshold % X(1,1) is DC coefficient

                  sublist=[sublist, abs(X(1,1))]; % put significant coefficients's value to sublist

                  sub_list=[sub_list;N(1,1),N(1,2)];% put the significant coefficients' position in sub_list

                  if X(1,1)>0;

                     D=[D,'p']; 

                  else D=[D,'n'];

                  end  

                  X(1,1)=0;

              else D=[D,'z'];

              end 

              

          for k=2:4,

                if abs(X(N(k,1),N(k,2)))>=threshold, 

                    sublist=[sublist, abs(X(N(k,1),N(k,2)))]; 

                  % append this significant coefficient to the subordinate list;

                    sub_list=[sub_list;N(k,1),N(k,2)];

                                 if X(N(k,1),N(k,2))>0 % determine the sign

                                    D=[D,'p']; % >0,assign a "p"

                                 else D=[D,'n'];% <0,assign a "n"

                                 end

                                 X(N(k,1),N(k,2))=0; 

      % the significent coefficients is replaced by a '0' in the coefficients matrix  

               else

                  % 2,3,4 has no parents,just check its descendants.

                                 result = checkdescendants1( k,X,threshold,0); 

                                 if result==1

                                     D=[D,'z'];

                                 else

                                     D=[D,'t'];

                                     R(N(k,1),N(k,2))=1;   % Zerotree, make all its descendants

                                     R=checkchildren(k,R); % refference matrix component to 1.

                                     

                                 end    

               end

               

           end

               

           

           for k=5:a,

                   if abs(X(N(k,1),N(k,2)))>=threshold, 

                      sublist=[sublist, abs(X(N(k,1),N(k,2)))]; 

                      sub_list=[sub_list;N(k,1),N(k,2)];

                                 if X(N(k,1),N(k,2))>0, % determine the sign

                                    D=[D,'p']; % >0,assign a "p"

                                 else D=[D,'n'];% <0,assign a "n"

                                 end

                                 X(N(k,1),N(k,2))=0; 

                             

                   elseif R(N(k,1),N(k,2))==0

                       

                                 result = checkdescendants1( k,X,threshold,0); 

                      % Check its has significant descendants?               

                                 if result==1,

                                     D=[D,'z']; % isolated zero

                                 else D=[D,'t'];% zerotree

                                     R(N(k,1),N(k,2))=1;  

                                     R=checkchildren(k,R);

                                 % if zerotree, reference matrix coefficients=1

                                 end

                   end

                   

           end

                

                

          

⌨️ 快捷键说明

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