RESPUE5 compute the response ( and gradient ) to a local DCT2D (expressed in contrast) considering interactions between the coefficients, simulating the HVS frequency detectors. DCTN (f) = ( k1 (f) DCT (f) ) ^ g / (k2 (f) + [ H * ( k1 (f) DCT (f) ) ^ g ] (f) ) Inputs: H, k1, k2 (only frequency dependence) and g, Returns : interac = interaction = H * abs ( a) ^ g Resp = response, Grad = The Jacobian of the response If you decide not to calculate the Jacobian , the program sets GR = 0 The parameters k1 and k2 in a matrix form , KK1 , KK2 NOTE : It is assumed that the block gets into the function is already expressed in contrast ( see CONTRAST) USE : [interac,Resp,Grad,kk1,kk2]=respue5(dctinic,k1,k2,gamm,H,calc_grad)
0001 % 0002 % RESPUE5 compute the response ( and gradient ) to a local DCT2D 0003 % (expressed in contrast) considering interactions between the coefficients, 0004 % simulating the HVS frequency detectors. 0005 % 0006 % DCTN (f) = ( k1 (f) DCT (f) ) ^ g / (k2 (f) + [ H * ( k1 (f) DCT (f) ) ^ g ] (f) ) 0007 % 0008 % Inputs: 0009 % H, k1, k2 (only frequency dependence) and g, 0010 % 0011 % Returns : 0012 % 0013 % interac = interaction = H * abs ( a) ^ g 0014 % Resp = response, 0015 % Grad = The Jacobian of the response 0016 % If you decide not to calculate the Jacobian , the program sets GR = 0 0017 % The parameters k1 and k2 in a matrix form , KK1 , KK2 0018 % 0019 % NOTE : It is assumed that the block gets into the function is already expressed in 0020 % contrast ( see CONTRAST) 0021 % 0022 % USE : [interac,Resp,Grad,kk1,kk2]=respue5(dctinic,k1,k2,gamm,H,calc_grad) 0023 % 0024 0025 function [IN,R,GR,alfa,beta]=respue5(dctinic,k1,k2,gamm,H,calc_grad) 0026 0027 tam=size(dctinic); 0028 tam=tam(1); 0029 lados=[tam tam]; 0030 0031 lcuan=lados(1); 0032 0033 k1=simrev(k1); 0034 k1=zigzag(k1); 0035 k2=simrev(k2); 0036 k2=zigzag(k2); 0037 0038 alfa=k1; 0039 beta=k2; 0040 0041 cub=dctinic; 0042 0043 cub=zigzag(cub); 0044 0045 cub=abs(cub); 0046 0047 cucu=(k1.*cub).^gamm; 0048 0049 interacc=H*[0;cucu(2:length(cucu))]; 0050 0051 R=cucu./(k2+interacc); 0052 R(1)=sqrt(cub(1)); 0053 0054 if calc_grad==1 0055 0056 I=eye(lcuan^2); 0057 GR=zeros(lcuan^2,lcuan^2); 0058 GR(1,1)=1; 0059 0060 for i=2:lcuan^2, 0061 for j=2:lcuan^2, 0062 0063 GR(i,j)= gamm*(abs( (cucu(i).^(1/gamm)).^(gamm-1) )/(k2(i)+interacc(i))*I(i,j)-(cucu(i)*abs( ((cucu(j)).^(1/gamm)).^(gamm-1) )/((k2(i)+interacc(i))^2))*H(i,j)); 0064 end 0065 end 0066 0067 else 0068 GR=0; 0069 end 0070 0071 R=dezigzag(R); 0072 IN=dezigzag(interacc);