You are on page 1of 4

Fall Semester 2022-2023

Assignment (3) COM 442


Dr/Hanfy Pattern Recognition

Date: wednesday November16,


2022

1) Differentiate linear spatial filter and non-linear spatial filter.

A linear filter is one that can be done with a convolution, which is just the linear sum of values in a sliding
window. It can be done equivalently in the Fourier domain by multiplying the spectrum by an image. A
blurring filter where you move over the image with a box filter (all the same values in the window) is an
example of a linear filter.
A non-linear filter is one that cannot be done with convolution or Fourier multiplication. A sliding median
filter is a simple example of a non-linear filter.

2) What is meant by Laplacian filter?

The Laplacian is a 2-D isotropic measure of the 2nd spatial derivative of an image. The Laplacian of
an image highlights regions of rapid intensity change and is therefore often used for edge detection
(see zero crossing edge detectors). The Laplacian is often applied to an image that has first been
smoothed with something approximating a Gaussian smoothing filter in order to reduce its
sensitivity to noise, and hence the two variants will be described together here. The operator
normally takes a single graylevel image as input and produces another graylevel image as output.

3) Write the steps involved in frequency domain filtering.

By adjusting the frequencies of components, the image texture adjusting process is the frequency
domain filtering.

 We can make the image texture soften and sharpen by removing low or high-frequency components.
 The frequency-domain filtering is used for this purpose.
 The main focus of frequency domain filtering is smoothening and sharpening.
 This process includes mainly 6 steps.
 First, need to collect the padding elements of the image.
 Using padding find out the Fourier transform of the image.
 Create a filter function for the image.
 Then have to obtain the multiplication product of the transformed image and the filter.
 Then need to find that product's inverse FFT.
 Need to adjust the image to its original size.
4) Explain spatial filtering?

Spatial Filtering technique is used directly on pixels of an image. Mask is usually considered to be
added in size so that it has specific center pixel. This mask is moved on the image such that the center
of the mask traverses all image pixels.

Classification on the basis of linearity:


There are two types:

1. Linear Spatial Filter


2. Non-linear Spatial Filter

General Classification:

Smoothing Spatial Filter: Smoothing filter is used for blurring and noise reduction in the image.
Blurring is pre-processing steps for removal of small details and Noise Reduction is accomplished by
blurring.

Types of Smoothing Spatial Filter:

1. Linear Filter (Mean Filter)


2. Order Statistics (Non-linear) filter

These are explained as following below.

1. Mean Filter:
Linear spatial filter is simply the average of the pixels contained in the neighborhood of the filter mask.
The idea is replacing the value of every pixel in an image by the average of the grey levels in the
neighborhood define by the filter mask.

Types of Mean filter:

o (i) Averaging filter: It is used in reduction of the detail in image. All coefficients are equal.
o (ii) Weighted averaging filter: In this, pixels are multiplied by different coefficients. Center pixel is
multiplied by a higher value than average filter.

2. Order Statistics Filter:


It is based on the ordering the pixels contained in the image area encompassed by the filter. It replaces
the value of the center pixel with the value determined by the ranking result. Edges are better
preserved in this filtering.

Types of Order statistics filter:

o (i) Minimum filter: 0th percentile filter is the minimum filter. The value of the center is replaced by
the smallest value in the window.
o (ii) Maximum filter: 100th percentile filter is the maximum filter. The value of the center is replaced
by the largest value in the window.
o
o (iii) Median filter: Each pixel in the image is considered. First neighboring pixels are sorted and
original values of the pixel is replaced by the median of the list.

Sharpening Spatial Filter: It is also known as derivative filter. The purpose of the sharpening spatial
filter is just the opposite of the smoothing spatial filter. Its main focus in on the removal of blurring and
highlight the edges. It is based on the first and second order derivative.

First order derivative:

 Must be zero in flat segments.


 Must be non zero at the onset of a grey level step.
 Must be non zero along ramps.

First order derivative in 1-D is given by:

f' = f(x+1) - f(x)

Second order derivative:

 Must be zero in flat areas.


 Must be zero at the onset and end of a ramp.
 Must be zero along ramps.

Second order derivative in 1-D is given by:

f'' = f(x+1) + f(x-1) - 2f(x)

5) What is a Median filter?

Median filter is one of the well-known order-statistic filters due to its good performance for some
specific noise types such as “Gaussian,” “random,” and “salt and pepper” noises [3]. According to
the median filter, the center pixel of a M × M neighborhood is replaced by the median value of the
corresponding window. Note that noise pixels are considered to be very different from the median.
Using this idea median filter can remove this type of noise problems [3]. We use this filter to remove
the noise pixels on the protein crystal images before binarization operation.

6) Name the different types of derivative filters?

As an image is a function of two (or more) variables it is necessary to define the direction in which the
derivative is taken.
For the two-dimensional case we have the horizontal direction, the vertical direction, or an arbitrary
direction which can be considered as a combination of the two.
First Order Derivative Filter
Second Order Derivative Filter
Derivative Filter is a type of High pass filter used for sharpening.
First-order derivatives generally produce thicker edges. Second-order derivatives have stronger response
to fine detail
Solve the following:

We want to perform linear filtering of a 256x256 image with a 5x5 filter, with the origin at the center.
(a) What is the size of the resulting image if we do linear filtering directly?
(b) Which rows and columns of the resulting image depend on the assumed values for pixels outside the
original image?
(c) What are the potential problems if we just assume all pixels outside the original image are zero?
Discuss the possible artifacts when the filter is a high-pass filter and a low-pass filter, respectively.
(d) How would you set the values for the pixels outside the original image to alleviate the above
problems?

Answer
a. 260*260
b. Rows: 1~4, 257~260.
Columns: 1~4, 257~260.
c. High-pass filter will detect wrong edge and get high intensity around the
image boundary. Low-pass filter will get low intensities around the image boundary.
d. We can either duplicate the pixel values in the first/last row and column in the
original image, or do symmetric mirrow extension.

You might also like