Home > PR > sharp.m

sharp

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 clc;
0002 echo off;
0003 
0004 %% LOAD IMAGE
0005 
0006 disp('Loading image');
0007 
0008 load barbara256;
0009 figure;
0010 imshow(Im/255);
0011 title('Original image');
0012 
0013 %% DEGRADE IMAGE
0014 
0015 disp('Degrading image (almost denoising)');
0016 
0017 % Cutoff frequency of the blurring operator
0018 fc = 24;
0019 Val_min = 0.001;
0020 
0021 % Frecuency band of the noise
0022 % In this case: white noise
0023 lim_frec = [0 3];
0024 
0025 % Noise variance
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 (fc = ' num2str(fc) ',sigma^2 = ' num2str(vari)]);
0032 
0033 disp('Press any key...');
0034 pause;
0035 
0036 
0037 
0038 
0039 Nlambdas = 60;
0040 
0041 lambdas = logspace(-4,3,Nlambdas);
0042 
0043 %% RESTORE IMAGE: SECOND DERIVATIVE OPERATOR
0044 
0045 disp(['Restoring image using L2 (' num2str(Nlambdas) ' values of lambda)']);
0046 
0047 imrl2=restaura2(Id,'L2',PSF,lambdas);
0048 
0049 figure;
0050 imshow(imrl2/255);
0051 title('Restored (L2)');
0052 
0053 disp('Press any key...');
0054 pause;
0055 
0056 
0057 %% RESTORE IMAGE: CSF OPERATOR
0058 
0059 disp(['Restoring image using CSF (' num2str(Nlambdas) ' values of lambda)']);
0060 
0061 imrcsf=restaura2(Id,'CSF',PSF,lambdas);
0062 
0063 figure;
0064 imshow(imrcsf/255);
0065 title('Restored (CSF)');
0066 
0067 disp('Press any key...');
0068 pause;
0069 
0070 
0071 %% RESTORE IMAGE: AR4 OPERATOR
0072 
0073 
0074 disp(['Restoring image using AR4 (' num2str(Nlambdas) ' values of lambda)']);
0075 
0076 imrar4=restaura2(Id,'AR4',PSF,lambdas);
0077 
0078 figure;
0079 imshow(imrar4/255);
0080 title('Restored (AR4)');
0081 
0082 disp('Press any key...');
0083 pause;
0084 
0085 
0086 
0087 %% RESTORE IMAGE: AR8 OPERATOR
0088 
0089 
0090 disp(['Restoring image using AR8 (' num2str(Nlambdas) ' values of lambda)']);
0091 
0092 imrar8=restaura2(Id,'AR8',PSF,lambdas);
0093 
0094 figure;
0095 imshow(imrar8/255);
0096 title('Restored (AR8)');
0097 
0098 disp('Press any key...');
0099 pause;
0100 
0101 
0102 
0103 
0104 %% RESTORE IMAGE: AR12 OPERATOR
0105 
0106 
0107 disp(['Restoring image using AR12 (' num2str(Nlambdas) ' values of lambda)']);
0108 
0109 imrar12=restaura2(Id,'AR12',PSF,lambdas);
0110 
0111 figure;
0112 imshow(imrar12/255);
0113 title('Restored (AR12)');
0114 
0115 disp('Press any key...');
0116 pause;
0117 
0118 
0119 
0120 %% RESTORE IMAGE: PERCEPTUAL OPERATOR
0121 
0122 
0123 disp(['Restoring image using PERCEPTUAL (' num2str(Nlambdas) ' values of lambda)']);
0124 
0125 imrper=restaura2(Id,'PER',PSF,lambdas);
0126 
0127 figure;
0128 imshow(imrper/255);
0129 title('Restored (PERCEPTUAL)');
0130 
0131 
0132 
0133 disp('ERROR MEASURES:');
0134 
0135 disp('PSNR');
0136 cad = sprintf('L2: %6.3f,\t CSF: %6.3f, AR4: %6.3f, AR8: %6.3f, AR12: %6.3f, PER: %6.3f',psnr(Im,imrl2),psnr(Im,imrcsf),psnr(Im,imrar4),psnr(Im,imrar8),psnr(Im,imrar12),psnr(Im,imrper));
0137 disp(cad);
0138 
0139 
0140 disp('MSE');
0141 cad = sprintf('L2: %6.3f,\t CSF: %6.3f, AR4: %6.3f, AR8: %6.3f, AR12: %6.3f, PER: %6.3f',mse(Im,imrl2),mse(Im,imrcsf),mse(Im,imrar4),mse(Im,imrar8),mse(Im,imrar12),mse(Im,imrper));
0142 disp(cad);
0143 
0144 
0145 disp('Press any key...');
0146 pause;
0147

Generated on Wed 29-Nov-2006 16:19:19 by m2html © 2003