Spatial Filtering

Linear Spatial Filtering
1. The linear spatial filtering is implemented by using imfilter function havin
g = imfilter (f, w, filtering_mode, boundary_options, size_options)
2. The most common syntax for imfilter is:
g = imfilter (f, w, ‘replicate’)
3. To perform convolution when working with filters that are neither
pre-rotated nor symmetric, two options can be used.
a. Use the following syntax for imfilter:
g = imfilter (f, w, ‘conv’, ‘replicate’)
b. Use the function rot90 (w, 2) to rotate w to 180 degrees and then use
g = imfilter (f, w, ‘replicate’)
4. Options for function imfilter:

Nonlinear Spatial Filtering
1. Two functions are used to perform nonlinear filtering: nlfilter and colfilt.
2. Function colfilt organizes the data in the form of columns and is faster
than nlfilter.
3. The colfilt function has syntax as:
g = colfilt (f, [m n], ‘sliding’, @fun)
4. The function padarray is used for padding the input image explicitly:
fp = padarray (f, [r c], method, direction)

5. Options for function padarray:

Linear Spatial Filters
1. The function fspecial is used to generate a filter mask, having syntax:
w = fspecial (‘type’, parameters)
2. Spatial filters supported by function fspecial:

Nonlinear Spatial Filters
1. The ordfilt2 function, which generates order-static filters, is used for
generating non linear spatial filters, having syntax:
g = ordfilt2 (f, order, domain)
2. The function medfilt2 is used for median filtering, having syntax:
g = medfilt2 (f, [m n], padopt)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s