0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 function [Results_NL_SVR] = entropy_nl_svr(Im,normaliz,To,dUmax,dVmax,epsilonv,bits_inic,K,exponente,tipo_alfa,entropias,directorio,fichero,num_iter)
0023 you_are_here=pwd;
0024
0025 exp_sum = 1:2;
0026
0027 RMSEs = [];
0028 SSIMs = [];
0029 MPEls = [];
0030 MPEnls = [];
0031 MPEnlJMLRs = [];
0032 SCIELabs = zeros(length(entropias),length(exp_sum));
0033 Results_NL_SVR = [];
0034 epsilons = zeros(length(entropias),3);
0035
0036 umbral = 0.005;
0037
0038 N = 256;
0039
0040 pesoY = 0.7;
0041 pesoU = 0.15;
0042 pesoV = 0.15;
0043
0044 fin_bits = 15;
0045 for i = 1:length(entropias)
0046 ini_bits = bits_inic(i);
0047
0048 ImR_NL_SVR = [];
0049 disp(['Modifying SVM insensitivity to achieve the target entropy: ' num2str(entropias(i))]);
0050 for b = ini_bits:0.5:fin_bits
0051
0052 epsilon = [0 0 0];
0053
0054 bits = b .* [1 1 1];
0055
0056 iter = 0;
0057
0058 no_results = 0;
0059
0060 porcentaje = 1;
0061
0062 sentido = 0;
0063
0064 l_min = 0;
0065 l_max = 100000;
0066
0067 entropia_actual = 0;
0068 while((abs(entropias(i) - entropia_actual) > umbral) && (iter <= num_iter))
0069 iter = iter + 1;
0070
0071 if(iter ~= 1 && iter ~= 2)
0072 [epsilon2, l_min, l_max, porcentaje, sentido] = fitting_epsilon_entropy(entropias(i), entropia_actual, epsilon(1), l_min, l_max, porcentaje, sentido);
0073 epsilon = epsilon2 .* [1 1 1];
0074 end
0075
0076 if exist('RESP','var')
0077 RESP=svr_nl_c_encoder_cs(Im,normaliz,To,dUmax,dVmax,bits,epsilon,K,exponente,tipo_alfa,directorio,[fichero '_gutierrez09_c_entropy_' num2str(i)],RESP);
0078 else
0079 RESP=svr_nl_c_encoder_cs(Im,normaliz,To,dUmax,dVmax,bits,epsilon,K,exponente,tipo_alfa,directorio,[fichero '_gutierrez09_c_entropy_' num2str(i)]);
0080 end
0081 close all
0082
0083 D = dir([directorio fichero '_gutierrez09_c_entropy_' num2str(i) '.zip']);
0084 tamanyo = 8 * D.bytes;
0085
0086 entropia_actual = tamanyo / N^2;
0087
0088 disp(['Iterat: ' num2str(iter) ' Entropy: ' num2str(entropia_actual) ' Bits: ' num2str(bits(1)) ' Epsilon: ' num2str(epsilon(1))]);
0089
0090 if((iter == 1) && (entropias(i) - entropia_actual > 0) && (epsilon(1) == 0))
0091 disp('Desired entropy is too large to be reached even with Epsilon=0, thus Bits is increased');
0092 no_results = 1;
0093 break;
0094
0095 elseif((iter == 1) && (abs(entropias(i) - entropia_actual) <= umbral) && (epsilon(1) == 0))
0096
0097 epsilon = epsilonv(i,:);
0098
0099 entropia_actual = 0;
0100
0101 elseif(iter == 1)
0102
0103 epsilon = epsilonv(i,:);
0104 end
0105 end
0106 if(no_results == 0)
0107
0108 epsilons(i,:) = epsilon;
0109
0110 cd(directorio)
0111 unzip([fichero '_gutierrez09_c_entropy_' num2str(i) '.zip']);
0112 ristra = read_code([fichero '_gutierrez09_c_entropy_' num2str(i) '.bin']);
0113
0114 delete([fichero '_gutierrez09_c_entropy_' num2str(i) '.bin']);
0115
0116 ImR_NL_SVR = svr_nl_c_decoder_cs(normaliz,To,dUmax,dVmax,K,exponente,tipo_alfa,directorio,[fichero '_gutierrez09_c_entropy_' num2str(i)]);
0117
0118 [RMSEs(i),SSIMs(i),MPEls(i),MPEnlJMLRs(i),SCIELabs(i,:)] = computing_distortions_c(Im,ImR_NL_SVR,[pesoY pesoU pesoV],exp_sum);
0119
0120 Results_NL_SVR(i).Normalizacion = normaliz;
0121 Results_NL_SVR(i).To = To;
0122 Results_NL_SVR(i).dUmax = dUmax;
0123 Results_NL_SVR(i).dVmax = dVmax;
0124 Results_NL_SVR(i).Bits = bits(1);
0125 Results_NL_SVR(i).Epsilon = epsilon;
0126 Results_NL_SVR(i).Kernel = K;
0127 Results_NL_SVR(i).Exponente = exponente;
0128 Results_NL_SVR(i).Tipo_alfa = tipo_alfa;
0129 Results_NL_SVR(i).RMSE = RMSEs(i);
0130 Results_NL_SVR(i).SSIM = SSIMs(i);
0131
0132 for n = 1:length(exp_sum)
0133 eval(['Results_NL_SVR(i).SCIELab_exp' num2str(exp_sum(n)) ' = SCIELabs(i,n);']);
0134 end
0135 Results_NL_SVR(i).Entropy = entropia_actual;
0136 Results_NL_SVR(i).Image = ImR_NL_SVR;
0137 Results_NL_SVR(i).ristra = ristra;
0138
0139 ini_bits = b;
0140
0141 break;
0142 end
0143 end
0144 end
0145 cd(you_are_here)