# noise removal without a built in function

7 views (last 30 days)
Jake Konnesky on 7 Dec 2016
Edited: Farouk Moukaddem on 14 Dec 2016
I was wondering if there is any other way to remove the gaussian effect without using the built in wiener2 function for matlab ?

Farouk Moukaddem on 14 Dec 2016
Edited: Farouk Moukaddem on 14 Dec 2016
Hi Jake,
There are several ways to remove noise from the 2-D data:
1) You can use the "medfilt2" function from the Image Processing Toolbox, which does 2-D median filtering.
The command above performs median filtering of the matrix A in two dimensions. Each output element of the matrix B contains the median value in the m-by-n neighborhood around the corresponding element in the input matrix A.
For more information about the "medfilt2" function, refer to the documentation by executing the following at the MATLAB Command Line:
web([docroot '/toolbox/images/medfilt2.html'])
2) You can also use the "filter2" Matlab Function
>> Y=filter2(h,X,shape)
This command filters the data in X with the two-dimensional FIR filter in the matrix h. It computes the result, Y, using two-dimensional correlation, and returns the part of the correlation specified by the 'shape' parameter.
web([docroot '/techdoc/ref/filter2.html'])
Also refer to the following code that illustrates the above concepts:
% Set figure window size
dfpos = get(0,'DefaultFigurePosition');
figure('Position',dfpos([1 2 3 4]).*[1 1 1.5 1]);
% Smooth the noisy peaks data with MEDFILT2
ZN_smooth1=medfilt2(ZN, [15 15],'symmetric');
subplot(1,2,1);
surf(ZN_smooth1);
title('Peaks Surface (2-D median filter applied)')
% Smooth the noisy peaks data with FILTER2
h = fspecial('average', [10 10]);
ZN_smooth2=filter2(h,ZN,'valid');
subplot(1,2,2);
surf(ZN_smooth2);
title('Peaks Surface(2-D digital averaging filter applied)')
Thanks,
Farouk

### Categories

Find more on Image Category Classification in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!