Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gaussian filter in MATLAB

Does the 'gaussian' filter in MATLAB convolve the image with the Gaussian kernel? Also, how do you choose the parameters hsize (size of filter) and sigma? What do you base it on?

like image 757
md86 Avatar asked May 05 '10 13:05

md86


People also ask

What is Gaussian filter Matlab?

Gaussian smoothing filters are commonly used to reduce noise. Read an image into the workspace. I = imread('cameraman. tif'); Filter the image with isotropic Gaussian smoothing kernels of increasing standard deviations.

What is the use of Gaussian filter?

A Gaussian Filter is a low pass filter used for reducing noise (high frequency components) and blurring regions of an image. The filter is implemented as an Odd sized Symmetric Kernel (DIP version of a Matrix) which is passed through each pixel of the Region of Interest to get the desired effect.

What is meant by Gaussian filter?

In electronics and signal processing mainly in digital signal processing, a Gaussian filter is a filter whose impulse response is a Gaussian function (or an approximation to it, since a true Gaussian response would have infinite impulse response).

How do you define a Gaussian function in Matlab?

You can create and evaluate a fismf object that implements the gaussmf membership function. mf = fismf("gaussmf",P); Y = evalmf(mf,X); Here, X , P , and Y correspond to the x , params , and y arguments of gaussmf , respectively.


1 Answers

You first create the filter with fspecial and then convolve the image with the filter using imfilter (which works on multidimensional images as in the example).

You specify sigma and hsize in fspecial.

Code:

%%# Read an image I = imread('peppers.png'); %# Create the gaussian filter with hsize = [5 5] and sigma = 2 G = fspecial('gaussian',[5 5],2); %# Filter it Ig = imfilter(I,G,'same'); %# Display imshow(Ig) 
like image 100
Jacob Avatar answered Oct 08 '22 05:10

Jacob