disdis_lineal

PURPOSE ^

[MSE,d,dx,MPEx,MPEoo,MPEexpesp]=disdis5(im1,im2,naka_ngan,[norm parametro],expfrec,expesp);

SYNOPSIS ^

function [MSE,d,dx,MPEx,MPEoo,MPEexpesp]=disdis_lineal(im1,im2,naka_ngan,norm,expfrec,expesp);

DESCRIPTION ^

 [MSE,d,dx,MPEx,MPEoo,MPEexpesp]=disdis5(im1,im2,naka_ngan,[norm parametro],expfrec,expesp);

 DISDIS_LINEAL applies the perceptual distortion measure:

    dx(rx,rx+Drx) = ( (abs(Drx').^(expfrec/2)) * (abs(Drx).^(expfrec/2)) )^(1/expfrec)

 to the responses, rx(Ax), of each subblock, Ax, of the given images, im, im+Dim.
 (16*16 blocks assuming fs=64 cpd)

 It employs bock-DCT as local frequential domain before the normalization
 No spatial interactions are employed between blocks...

 This function applies the lineal model using a CSF ('naka100' or 'Ngan')

     naka_ngan = 1 ..... naka
     naka_ngan = 2 ..... ngan

 The spatial differences in each block, dx, are added spatially
 by using the norm expesp:

                         /                \ ^ (1/expesp)
       d(im,im+Dim) =   |  sum dx^(expesp) |
                         \  x             /


 Moreover it gives a Maximum Perceptual Error map:

    MPEx = max( abs(Drxf) )

  and two average MPE:

  - With infinity norm:

     MPEoo  = max( MPEx )

  - With expesp norm:

                      /                  \ ^ (1/expesp)
       MPEexpesp =   |  sum MPEx^(expesp) |
                      \  x               /

 And also the MSE...

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %
0002 % [MSE,d,dx,MPEx,MPEoo,MPEexpesp]=disdis5(im1,im2,naka_ngan,[norm parametro],expfrec,expesp);
0003 %
0004 % DISDIS_LINEAL applies the perceptual distortion measure:
0005 %
0006 %    dx(rx,rx+Drx) = ( (abs(Drx').^(expfrec/2)) * (abs(Drx).^(expfrec/2)) )^(1/expfrec)
0007 %
0008 % to the responses, rx(Ax), of each subblock, Ax, of the given images, im, im+Dim.
0009 % (16*16 blocks assuming fs=64 cpd)
0010 %
0011 % It employs bock-DCT as local frequential domain before the normalization
0012 % No spatial interactions are employed between blocks...
0013 %
0014 % This function applies the lineal model using a CSF ('naka100' or 'Ngan')
0015 %
0016 %     naka_ngan = 1 ..... naka
0017 %     naka_ngan = 2 ..... ngan
0018 %
0019 % The spatial differences in each block, dx, are added spatially
0020 % by using the norm expesp:
0021 %
0022 %                         /                \ ^ (1/expesp)
0023 %       d(im,im+Dim) =   |  sum dx^(expesp) |
0024 %                         \  x             /
0025 %
0026 %
0027 % Moreover it gives a Maximum Perceptual Error map:
0028 %
0029 %    MPEx = max( abs(Drxf) )
0030 %
0031 %  and two average MPE:
0032 %
0033 %  - With infinity norm:
0034 %
0035 %     MPEoo  = max( MPEx )
0036 %
0037 %  - With expesp norm:
0038 %
0039 %                      /                  \ ^ (1/expesp)
0040 %       MPEexpesp =   |  sum MPEx^(expesp) |
0041 %                      \  x               /
0042 %
0043 % And also the MSE...
0044 %
0045 %
0046 
0047 function [MSE,d,dx,MPEx,MPEoo,MPEexpesp]=disdis_lineal(im1,im2,naka_ngan,norm,expfrec,expesp);
0048 
0049 tam=size(im1);
0050 tam=tam(1);
0051 
0052 lcuan=16;
0053 Ncuan=log(tam/lcuan)/log(2);
0054 lados=[tam tam];
0055 imq=zeros(tam,tam);
0056 dctq=zeros(tam,tam);
0057 codq=zeros(tam,tam);
0058 
0059 posai=[tam tam]/2-round(tam/2);
0060 posbd=[tam tam]/2+round(tam/2);
0061 coorcuanai=floor([(posai(1)-1)/lcuan+1 (posai(2)-1)/lcuan+1]);
0062 coorcuanbd=floor([(posbd(1)-1)/lcuan+1 (posbd(2)-1)/lcuan+1]);
0063 if coorcuanai(1)<1
0064 coorcuanai(1)=1;
0065 end
0066 if coorcuanai(2)<1
0067 coorcuanai(2)=1;
0068 end
0069 if coorcuanbd(1)>(2^Ncuan)
0070 coorcuanbd(1)=2^Ncuan;
0071 end
0072 if coorcuanai(2)>(2^Ncuan)
0073 coorcuanbd(2)=2^Ncuan;
0074 
0075 end
0076 
0077 fs=64;
0078 
0079 if naka_ngan==1
0080 kk1 = [0.0034    0.0194    0.0351    0.0316    0.0197    0.0151    0.0138    0.0131    0.0116    0.0092  0.0069    0.0050    0.0035    0.0032    0.0032    0.0032];
0081 else
0082 [kk1,lala]=ngan(32,16);
0083 end
0084 
0085 fact=0.5;
0086 
0087 fx=linspace(0,fs/2-fs/(2*lcuan),lcuan);
0088 
0089 Fx=ones(lcuan,1)*fx;
0090 Fy=Fx';
0091 F=sqrt(Fx.^2+Fy.^2);
0092 
0093 fx=zigzag(Fx);
0094 fy=zigzag(Fy);
0095 f=zigzag(F);
0096 
0097 dcti1=dct2r(im1,Ncuan);
0098 [a1,Lm1]=contrast_2(dcti1,Ncuan,norm);
0099 DC1=Lm1*16;
0100 
0101 dcti2=dct2r(im2,Ncuan);
0102 [a2,Lm2]=contrast_2(dcti2,Ncuan,norm);
0103 DC2=Lm2*16;
0104 
0105 dx=zeros(coorcuanbd(1),coorcuanbd(2));
0106 MPEx=dx;
0107 
0108 pes=ones(16,16);
0109 pes(1,1)=0;
0110 
0111 fprintf('Computing MPE distortion measure using a linear response model\n');
0112 
0113 for ii=coorcuanai(1):coorcuanbd(1)
0114 fprintf('.');
0115 for jj=coorcuanai(2):coorcuanbd(2)
0116 
0117    iii=(ii-1)*lcuan+ceil(lcuan/2);
0118    jjj=(jj-1)*lcuan+ceil(lcuan/2);
0119    blo1=sacasub(a1,[iii jjj],[lcuan lcuan],0);
0120    blo2=sacasub(a2,[iii jjj],[lcuan lcuan],0);
0121 
0122    [R1,CSF]=respue_lineal(blo1,kk1/max(kk1));
0123    [R2,CSF]=respue_lineal(blo2,kk1/max(kk1));
0124 
0125    R1=pes.*R1;
0126    R2=pes.*R2;
0127 
0128    Drf=abs(R1-R2);
0129 
0130    dx(ii,jj)= sum(sum((Drf.^(expfrec/2)).*(Drf.^(expfrec/2)))).^(1/expfrec);
0131    MPEx(ii,jj)=max(max(Drf));
0132 
0133 end
0134 end
0135 
0136 fprintf('\n');
0137 
0138 d=(sum(sum(dx.^(expesp))))^(1/expesp);
0139 
0140 MPEexpesp=(sum(sum(MPEx.^(expesp))))^(1/expesp);
0141 MPEoo=max(max(MPEx));
0142 
0143 MSE = sum(sum( (im1-im2).^2 ))/(tam^2);

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