exp3-图像复原

图像复原中的均值滤波、统计排序滤波,去除高斯、椒盐噪声

im = imread('cameraman.tif');
figure;
imshow(im);
title('Original Image');
exp3-图像复原_第1张图片
im_gaussian = imnoise(im, 'gaussian', 0, 0.01);
figure;
subplot(121);
imshow(im_gaussian);
title('Noise Image');

kernel = ones(3)/9;
im_ = imfilter(im_gaussian, kernel);
subplot(122);
imshow(im_)
title('Result');
suptitle('Gaussian Noise');
exp3-图像复原_第2张图片
im_sp = imnoise(im, 'salt & pepper');
figure;
subplot(121);
imshow(im_sp);
title('Noise Image');
im_ = medfilt2(im_sp);
subplot(122);
imshow(im_);
title('Result');
suptitle('Salt & Papper Noise');
exp3-图像复原_第3张图片

去除周期噪声

f = 0.1;
DW = 2e4;
imsize = size(im);
r = imsize(1)*f;

im_normal = double(im)/255;
[U, V] = meshgrid(1:imsize(2), 1:imsize(1));
R = sqrt((U - imsize(2)/2).^2 + (V - imsize(1)/2).^2);
period_noise = 0.02*cos(2*pi*f*R);
im_period = (im_normal + period_noise)/1.2;

figure;
subplot(121);
imshow(im_period);
title('Noise Image');

H = 1 - exp(-((R.^2 - r^2).^2/DW));
IM = fftshift(fft2(im_period));
IM_ = IM.*H;
im_ = abs(ifft2(fftshift(IM_)));
subplot(122);
imshow(im_);
title('Result');
suptitle('Period Noise');
exp3-图像复原_第4张图片

由退化函数进行图像复原

h = ones(7)/49;
im_blur = imfilter(im_normal, h);
im_blur = imnoise(im_blur, 'Gaussian', 0, 1e-3);
figure;
subplot(121);
imshow(im_blur);
title('Blur Image');

k = 0.08;
r = imsize(1)/2;
H = exp(-k*R.^(5/6)) + 1 - exp(-(R/r).^2);
IM = fft2(im_blur);
IM_ = IM./fftshift(H);
im_ = abs(ifft2(fftshift(IM_)));
subplot(122);
imshow(im_);
title('Result');
suptitle('Inverse Filter');
exp3-图像复原_第5张图片
figure;
subplot(121);
imshow(im_blur);
title('Blur Image');

im_ = wiener2(im_blur, [3 3]);
subplot(122);
imshow(im_);
title('Result');
suptitle('Wiener Filter');
exp3-图像复原_第6张图片

你可能感兴趣的:(exp3-图像复原)