0% found this document useful (0 votes)
19 views19 pages

Unit IV IntensityTransformation

The fspecial() function in MATLAB creates predefined 2-D filters for image processing tasks such as smoothing, sharpening, and edge detection. It generates a filter matrix that can be applied to images using functions like imfilter() or filter2(). Common filter types include average, Gaussian, Laplacian, Sobel, and Prewitt filters, each serving different purposes in image manipulation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views19 pages

Unit IV IntensityTransformation

The fspecial() function in MATLAB creates predefined 2-D filters for image processing tasks such as smoothing, sharpening, and edge detection. It generates a filter matrix that can be applied to images using functions like imfilter() or filter2(). Common filter types include average, Gaussian, Laplacian, Sobel, and Prewitt filters, each serving different purposes in image manipulation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unit IV

fspecial() Function in MATLAB

The fspecial() function in MATLAB is used to create predefined 2-D filters (filter
masks). These filters are mainly used for image processing operations such as
smoothing, sharpening, edge detection, and motion blurring.

It generates a filter matrix that is usually applied to an image using functions like
imfilter() or filter2().

Syntax
w = fspecial(type)
w = fspecial(type, parameters)

 w → filter (kernel) matrix


 type → type of filter
 parameters → values required for specific filters

Common Filter Types

 Average (Smoothing Filter)

Used to blur or smooth an image.


h = fspecial('average', [3 3]);
Creates a 3×3 averaging filter.

 Gaussian Filter

Used for noise reduction and smoothing.

h = fspecial('gaussian', [5 5], 1.0);


 [5 5] → filter size
 1.0 → standard deviation (sigma)

 Laplacian Filter

Used for edge detection.


h = fspecial('laplacian', 0.2);

 Sobel Filter
Detects edges (horizontal or vertical).
h = fspecial('sobel');
 Prewitt Filter

Another edge detection operator.


h = fspecial('prewitt');

Example –
>> f = imread('[Link]');
>> w = fspecial('gaussian', [5 5], 2);
>> g = imfilter(f, w);
>> imshow(g);

***

You might also like