0001 clc;
0002 echo off;
0003
0004
0005
0006 disp('Loading image');
0007
0008 load barbara256;
0009 figure;
0010 imshow(Im/255);
0011 title('Original image');
0012
0013
0014
0015 disp('Degrading image (almost denoising)');
0016
0017
0018 fc = 24;
0019 Val_min = 0.001;
0020
0021
0022
0023 lim_frec = [0 3];
0024
0025
0026 vari = 400;
0027
0028 [Id,PSF,H,noise,Blurred]=degrada2(Im,fc,Val_min,lim_frec,vari);
0029 figure;
0030 imshow(Id/255);
0031 title(['Degraded image (f_c = ' num2str(fc) ',\sigma^2 = ' num2str(vari) ')']);
0032
0033 disp('Press any key...');
0034 pause;
0035
0036
0037
0038 disp('SENSITIVITY TO LAMBDA');
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 Nlambdas = 1;
0049 lambdas = 1;
0050
0051 disp(['Restoring image using PERCEPTUAL (' num2str(Nlambdas) ' values of lambda)']);
0052
0053
0054 imrper=restaura2(Id,'PER',PSF,lambdas);
0055
0056 figure;
0057 imshow(imrper/255);
0058 title(['Perceptual, \lambda=' num2str(lambdas)]);
0059
0060
0061
0062
0063
0064
0065 Nlambdas = 1;
0066 lambdas = 2;
0067
0068 disp(['Restoring image using PERCEPTUAL (' num2str(Nlambdas) ' values of lambda)']);
0069
0070
0071 imrper=restaura2(Id,'PER',PSF,lambdas);
0072
0073 figure;
0074 imshow(imrper/255);
0075 title(['Perceptual, \lambda=' num2str(lambdas)]);
0076
0077
0078
0079
0080
0081
0082
0083 Nlambdas = 1;
0084 lambdas = 4;
0085
0086 disp(['Restoring image using PERCEPTUAL (' num2str(Nlambdas) ' values of lambda)']);
0087
0088
0089 imrper=restaura2(Id,'PER',PSF,lambdas);
0090
0091 figure;
0092 imshow(imrper/255);
0093 title(['Perceptual, \lambda=' num2str(lambdas)]);
0094
0095
0096
0097
0098
0099 Nlambdas = 1;
0100 lambdas = 6;
0101
0102 disp(['Restoring image using PERCEPTUAL (' num2str(Nlambdas) ' values of lambda)']);
0103
0104
0105 imrper=restaura2(Id,'PER',PSF,lambdas);
0106
0107 figure;
0108 imshow(imrper/255);
0109 title(['Perceptual, \lambda=' num2str(lambdas)]);
0110
0111
0112
0113
0114
0115 Nlambdas = 1;
0116 lambdas = 10;
0117
0118 disp(['Restoring image using PERCEPTUAL (' num2str(Nlambdas) ' values of lambda)']);
0119
0120
0121 imrper=restaura2(Id,'PER',PSF,lambdas);
0122
0123 figure;
0124 imshow(imrper/255);
0125 title(['Perceptual, \lambda=' num2str(lambdas)]);
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138 Nlambdas = 1;
0139 lambdas = 1;
0140
0141 disp(['Restoring image using AR12 (' num2str(Nlambdas) ' values of lambda)']);
0142
0143
0144 imrar12=restaura2(Id,'AR12',PSF,lambdas);
0145
0146 figure;
0147 imshow(imrar12/255);
0148 title(['AR12, \lambda=' num2str(lambdas)]);
0149
0150
0151
0152
0153
0154 Nlambdas = 1;
0155 lambdas = 2;
0156
0157 disp(['Restoring image using AR12 (' num2str(Nlambdas) ' values of lambda)']);
0158
0159
0160 imrar12=restaura2(Id,'AR12',PSF,lambdas);
0161
0162 figure;
0163 imshow(imrar12/255);
0164 title(['AR12, \lambda=' num2str(lambdas)]);
0165
0166
0167
0168
0169
0170
0171 Nlambdas = 1;
0172 lambdas = 4;
0173
0174 disp(['Restoring image using AR12 (' num2str(Nlambdas) ' values of lambda)']);
0175
0176
0177 imrar12=restaura2(Id,'AR12',PSF,lambdas);
0178
0179 figure;
0180 imshow(imrar12/255);
0181 title(['AR12, \lambda=' num2str(lambdas)]);
0182
0183
0184
0185
0186
0187 Nlambdas = 1;
0188 lambdas = 6;
0189
0190 disp(['Restoring image using AR12 (' num2str(Nlambdas) ' values of lambda)']);
0191
0192
0193 imrar8=restaura2(Id,'AR12',PSF,lambdas);
0194
0195 figure;
0196 imshow(imrar12/255);
0197 title(['AR12, \lambda=' num2str(lambdas)]);
0198
0199
0200
0201
0202
0203
0204 Nlambdas = 1;
0205 lambdas = 10;
0206
0207 disp(['Restoring image using AR12 (' num2str(Nlambdas) ' values of lambda)']);
0208
0209
0210 imrar8=restaura2(Id,'AR12',PSF,lambdas);
0211
0212 figure;
0213 imshow(imrar12/255);
0214 title(['AR12, \lambda=' num2str(lambdas)]);
0215
0216