I = double(imread('images/aerial.png_/degraded_image_average_10.png')); I = I ./ 255;
PSF = Fspecial('average', [7 7]);

O = wienerFilter(I, PSF, 1, .05, 1);
O = (O + ones(size(O))*-min(min(O))) ./ (max(max(O + ones(size(O))*-min(min(O)))));
O = circshift(O,[1.*floor(length(PSF)/2) 1.*floor(length(PSF)/2)]);
D = abs(O-I); D = D ./ max(max(D));
imwrite(D, 'aerial_05_difference.png');
imwrite(O, 'aerial_05.png');


O = wienerFilter(I, PSF, 1, .01, 1);
O = (O + ones(size(O))*-min(min(O))) ./ (max(max(O + ones(size(O))*-min(min(O)))));
O = circshift(O,[1.*floor(length(PSF)/2) 1.*floor(length(PSF)/2)]);
D = abs(O-I); D = D ./ max(max(D));
imwrite(D, 'aerial_01_difference.png');
imwrite(O, 'aerial_01.png');

O = wienerFilter(I, PSF, 1, .1, 1);
O = (O + ones(size(O))*-min(min(O))) ./ (max(max(O + ones(size(O))*-min(min(O)))));
O = circshift(O,[1.*floor(length(PSF)/2) 1.*floor(length(PSF)/2)]);
D = abs(O-I); D = D ./ max(max(D));
imwrite(D, 'aerial_10_difference.png');
imwrite(O, 'aerial_10.png');

O = wienerFilter(I, PSF, 1, .5, 1);
O = (O + ones(size(O))*-min(min(O))) ./ (max(max(O + ones(size(O))*-min(min(O)))));
O = circshift(O,[1.*floor(length(PSF)/2) 1.*floor(length(PSF)/2)]);
D = abs(O-I); D = D ./ max(max(D));
imwrite(D, 'aerial_50_difference.png');
imwrite(O, 'aerial_50.png');


