contrast_2

PURPOSE ^

CONTRAST normalized amplitudes of local DCT resolution N

SYNOPSIS ^

function [dctf,Lm]=contrast_2(s,Ncuan,norm)

DESCRIPTION ^

 CONTRAST normalized amplitudes of local DCT resolution N
 We can choose different normalizations :

 Norm = 1 ......... Normalized by the average luminance of the subblock considered.

 Norm = 2 ......... Normalized by the average luminance of the subblock considered and
 of the subblock of neighbourhood. The number of neighbourhood sub-blocks must be
 entered as a parameter .

 Norm = 3 ......... Normalized by the average luminance of the entire image.

 Norm = 4 ......... Normalized by the value ( luminance ) introduced as a parameter
 ( Value * L ^ 2 ) , where l is the side of subblock local DCTs .


 NOTE : Speaking of luminance we mean the extent to which the expressed input image.
 Except calibration, the input image is usually expressed in 'gray levels '
 not strictly in luminance .

 Normalizations 1 and 3

 USE:
 [DCTF,Lm] = contrast_2(DSTI,Ncuan,[Norm parameter]);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % CONTRAST normalized amplitudes of local DCT resolution N
0002 % We can choose different normalizations :
0003 %
0004 % Norm = 1 ......... Normalized by the average luminance of the subblock considered.
0005 %
0006 % Norm = 2 ......... Normalized by the average luminance of the subblock considered and
0007 % of the subblock of neighbourhood. The number of neighbourhood sub-blocks must be
0008 % entered as a parameter .
0009 %
0010 % Norm = 3 ......... Normalized by the average luminance of the entire image.
0011 %
0012 % Norm = 4 ......... Normalized by the value ( luminance ) introduced as a parameter
0013 % ( Value * L ^ 2 ) , where l is the side of subblock local DCTs .
0014 %
0015 %
0016 % NOTE : Speaking of luminance we mean the extent to which the expressed input image.
0017 % Except calibration, the input image is usually expressed in 'gray levels '
0018 % not strictly in luminance .
0019 %
0020 % Normalizations 1 and 3
0021 %
0022 % USE:
0023 % [DCTF,Lm] = contrast_2(DSTI,Ncuan,[Norm parameter]);
0024 %
0025 
0026 function [dctf,Lm]=contrast_2(s,Ncuan,norm)
0027 
0028    par=norm(2);
0029    norm=norm(1);
0030    tam=size(s);
0031    tam=tam(1);
0032    lados=[tam tam];
0033 
0034    dctf=zeros(tam,tam);
0035 
0036    lcuan=tam/(2^Ncuan);
0037    posai=[tam tam]/2-round(tam/2);
0038    posbd=[tam tam]/2+round(tam/2);
0039    coorcuanai=floor([(posai(1)-1)/lcuan+1 (posai(2)-1)/lcuan+1]);
0040    coorcuanbd=floor([(posbd(1)-1)/lcuan+1 (posbd(2)-1)/lcuan+1]);
0041    if coorcuanai(1)<1
0042         coorcuanai(1)=1;
0043    end
0044    if coorcuanai(2)<1
0045         coorcuanai(2)=1;
0046    end
0047    if coorcuanbd(1)>(2^Ncuan)
0048         coorcuanbd(1)=2^Ncuan;
0049    end
0050    if coorcuanai(2)>(2^Ncuan)
0051         coorcuanbd(2)=2^Ncuan;
0052    end
0053 
0054    for ii=coorcuanai(1):coorcuanbd(1)
0055        for jj=coorcuanai(2):coorcuanbd(2)
0056 
0057            iii=(ii-1)*lcuan+ceil(lcuan/2);
0058            jjj=(jj-1)*lcuan+ceil(lcuan/2);
0059            blo=sacasub(s,[iii jjj],[lcuan lcuan],0);
0060 
0061            cub=blo;
0062 
0063            fla=0;
0064            if cub(1,1)==0
0065               fla=1;
0066               cub(1,1)=10;
0067            end
0068               if norm==1
0069                  cub(2:lcuan,1)=2*cub(2:lcuan,1)/cub(1,1);
0070                  cub(1,2:lcuan)=2*cub(1,2:lcuan)/cub(1,1);
0071                  cub(2:lcuan,2:lcuan)=4*cub(2:lcuan,2:lcuan)/cub(1,1);
0072                  Lm(ii,jj)=cub(1,1)/lcuan;
0073               elseif norm==2
0074                  Lmed=[];
0075                  for k=-par:par
0076                      for l=-par:par
0077                          cubil=sacasub(s,[iii+k jjj+l],[lcuan lcuan],0);
0078                          med=mean(mean(cubil));
0079                          if med>0
0080                             Lmed=[Lmed med];
0081                          end
0082                      end
0083                  end
0084                  Lmedia=4*mean(Lmed)*lcuan^2;
0085                  cub(2:lcuan,1)=2*cub(2:lcuan,1)/Lmedia;
0086                  cub(1,2:lcuan)=2*cub(1,2:lcuan)/Lmedia;
0087                  cub(2:lcuan,2:lcuan)=4*cub(2:lcuan,2:lcuan)/Lmedia;
0088               elseif norm==3
0089                  Lmedia=par;
0090                  cub11=Lmedia*lcuan;
0091                  cub(2:lcuan,1)=2*cub(2:lcuan,1)/cub11;
0092                  cub(1,2:lcuan)=2*cub(1,2:lcuan)/cub11;
0093                  cub(2:lcuan,2:lcuan)=4*cub(2:lcuan,2:lcuan)/cub11;
0094                  Lm(ii,jj)=cub(1,1)/lcuan;
0095               elseif norm==4
0096                  cub(2:lcuan,1)=2*cub(2:lcuan,1)/(4*par*lcuan^2);
0097                  cub(1,2:lcuan)=2*cub(1,2:lcuan)/(4*par*lcuan^2);
0098                  cub(2:lcuan,2:lcuan)=4*cub(2:lcuan,2:lcuan)/(4*par*lcuan^2);
0099               else
0100                  cub(2:lcuan,1)=cub(2:lcuan,1)/2;
0101                  cub(1,2:lcuan)=cub(1,2:lcuan)/2;
0102               end
0103 
0104            dctf=metesub(dctf,[iii jjj],cub);
0105 
0106        end
0107    end

Generated on Fri 07-Mar-2014 13:29:20 by m2html © 2005