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

📄 dominantpass.m

📁 这是利用matlab所写的ezw影像压缩法
💻 M
字号:


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

% 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))]; 

                  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;

                                 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; 

                                 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)))]; 

                                 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; 

                             

%                  else zerotree = checkancestors( k,R,0);

                   else   zerotree = checkancestors1( k,R,0);



               % check coefficient is descended from zerotree root?   

                        if zerotree==0, % Not descends from zerotree root

                                 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;  

                                 % if zerotree, reference matrix coefficient=1

                                 end

                        end            

                 end

                

            end

                

          

⌨️ 快捷键说明

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