I have an image with gaussian noise and periodic noise. How to remove gaussian noise from image?

5 ビュー (過去 30 日間)
I have an image with gaussian noise and periodic noise. I want to design two filters both of gaussian and periodic. I designed filter for removing periodic noise using DCT. And It works. When I apply to filter to image,periodic noises disappeared. But comes to the gaussian noise, when I apply to the image with just gaussian noise, It works fine. But When I apply to gaussian+periodic noise, It gives nonsense output. Here is my code.
clc;
clear;
cd 'C:\Users\LENOVO\OneDrive\Masaüstü'
I=imread('Coleen.jpg','jpg');
subplot(1,2,1);imshow(I); title('Orjinal görüntü');
J = imnoise(I,'gaussian');
[x, y]=meshgrid(1:1200,1:1400);
noise=15*sin(2*pi/30*x+2*pi/30*y);
noiseimg=double(J)+noise;
noisedct = dct2(noiseimg);
% Reduce peaky high-frequency components
idx = abs(noisedct) > 50;
idx(1:19,:) = false;
idx(:,1:19) = false;
noisedct(idx) = noisedct(idx)/100;
% Convert to image
I2 = idct2(noisedct);
I2 = mat2gray(I2);
% Show the result
imshow(I2)
title('Filtered Image','FontSize',14)
width1 = 3; sigma1 = (width1-1) / 6;
width2 = 7; sigma2 = (width2-1) / 6;
width3 = 13; sigma3 = (width3-1) / 6;
width4 = 19; sigma4 = (width4-1) / 6;
%// Create Gaussian kernels
h1 = fspecial('gaussian', [width1 width1], sigma1);
h2 = fspecial('gaussian', [width2 width2], sigma2);
h3 = fspecial('gaussian', [width3 width3], sigma3);
h4 = fspecial('gaussian', [width4 width4], sigma4);
%// Filter the image using each kernel
out1 = imfilter(noiseimg, h1, 'replicate');
out2 = imfilter(noiseimg, h2, 'replicate');
out3 = imfilter(noiseimg, h3, 'replicate');
out4 = imfilter(noiseimg, h4, 'replicate');
%// Display them all on a figure
figure;
subplot(2,2,1);
imshow(out1);
title('Width = 3');
subplot(2,2,2);
imshow(out2);
title('Width = 7');
subplot(2,2,3);
imshow(out3);
title('Width = 13');
subplot(2,2,4);
imshow(out4);
title('Width = 19');
Here is the output.

採用された回答

yanqi liu
yanqi liu 2021 年 12 月 27 日
clc;
clear all; close all;
I=imread('cameraman.tif');
subplot(1,2,1);imshow(I);
J = imnoise(I,'gaussian');
[x, y]=meshgrid(1:size(I,2),1:size(I,1));
noise=15*sin(2*pi/30*x+2*pi/30*y);
noiseimg=double(J)+noise;
noisedct = dct2(noiseimg);
% Reduce peaky high-frequency components
idx = abs(noisedct) > 50;
idx(1:19,:) = false;
idx(:,1:19) = false;
noisedct(idx) = noisedct(idx)/100;
% Convert to image
I2 = idct2(noisedct);
I2 = mat2gray(I2);
% Show the result
subplot(1,2,2);
imshow(I2)
title('Filtered Image','FontSize',14)
width1 = 3; sigma1 = (width1-1) / 6;
width2 = 7; sigma2 = (width2-1) / 6;
width3 = 13; sigma3 = (width3-1) / 6;
width4 = 19; sigma4 = (width4-1) / 6;
%// Create Gaussian kernels
h1 = fspecial('gaussian', [width1 width1], sigma1);
h2 = fspecial('gaussian', [width2 width2], sigma2);
h3 = fspecial('gaussian', [width3 width3], sigma3);
h4 = fspecial('gaussian', [width4 width4], sigma4);
%// Filter the image using each kernel
out1 = imfilter(noiseimg, h1, 'replicate');
out2 = imfilter(noiseimg, h2, 'replicate');
out3 = imfilter(noiseimg, h3, 'replicate');
out4 = imfilter(noiseimg, h4, 'replicate');
% Display them all on a figure
figure;
subplot(2,2,1);
imshow(out1,[]);
title('Width = 3');
subplot(2,2,2);
imshow(out2,[]);
title('Width = 7');
subplot(2,2,3);
imshow(out3,[]);
title('Width = 13');
subplot(2,2,4);
imshow(out4,[]);
title('Width = 19');

その他の回答 (2 件)

Image Analyst
Image Analyst 2021 年 12 月 26 日
編集済み: Image Analyst 2021 年 12 月 27 日
I'd first get rid of periodic noise to "flatten" the image with Fourier filtering. Then I'd use a wiener filter. wiener2(), to get rid of the Gaussian noise.
Attach 'Coleen.jpg' if you need more help.

Image Analyst
Image Analyst 2022 年 9 月 9 日
Try BM3D - arguably the best image denoising algorithm out there.
I can't post the copyrighted software here.

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by