0% found this document useful (0 votes)
240 views43 pages

Chapter4 - Image Filtering and Restoration

Image filtering allows modifying pixels in an image based on neighboring pixels. Common filters include linear filters like mean and median filters. Mean filtering replaces each pixel with the average of neighbors, while median filtering replaces each pixel with the median value of neighbors, better preserving edges. The Wiener filter attempts to reduce noise in degraded images in the frequency domain. The Laplacian sharpening filter sharpens important image features like edges using convolution with specific kernels. The Richardson-Lucy deblurring algorithm iteratively deblurs images affected by a point spread function, maintaining non-negativity. Histogram equalization increases image contrast by spreading out pixel intensities on the histogram.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
240 views43 pages

Chapter4 - Image Filtering and Restoration

Image filtering allows modifying pixels in an image based on neighboring pixels. Common filters include linear filters like mean and median filters. Mean filtering replaces each pixel with the average of neighbors, while median filtering replaces each pixel with the median value of neighbors, better preserving edges. The Wiener filter attempts to reduce noise in degraded images in the frequency domain. The Laplacian sharpening filter sharpens important image features like edges using convolution with specific kernels. The Richardson-Lucy deblurring algorithm iteratively deblurs images affected by a point spread function, maintaining non-negativity. Histogram equalization increases image contrast by spreading out pixel intensities on the histogram.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 43

DIGITAL IMAGE

PROCESSING
TMM24
43
CHAPTER4 - IMAGE FILTERING AND
RESTORATION

What is image filtering?


Image filtering allows you to apply various effects on photos.
The type of image filtering described here is 2D filtering.
Image filtering is a process by which we can enhance (or otherwise modify,
warp, and mutilate) images.
What is image filtering?
Modify the pixels in an image based on some function of a local neighborhood of the
pixels.

Simplest: linear filtering


Replace each pixel by a linear combination of its neighbors.

The prescription for the linear combination is called the convolution


kernel.
a kernel, convolution matrix, or mask is a small matrix useful for blurring,
sharpening, embossing, edge-detection, and more. This is accomplished by
means of convolution between a kernel and an image.

What is image filtering?

Depending on the
element values, a kernel
can cause a wide range of
effects.

What is image filtering?

Median Filter
There are also nonlinear neighborhood operations that can be
performed for the purpose of noise reduction that can do a better job
of preserving edges than simple smoothing filters.
One such method is known as median filtering.
In median filtering, the neighboring pixels are ranked according to
brightness (intensity) and the median value becomes the new value
for the central pixel.
Median filters can do an excellent job of removing certain types of
noise, in particular, salt and pepper noise in which some individual
pixels have extreme values.
In the median filtering operation, the pixel values in the
neighborhood window are ranked according to intensity, and the
middle value (the median) becomes the output value for the pixel
under evaluation.

Median Filter

Median Filter

Median Filter
The Median filters offer three advantages:
No reduction in contrast across steps, since output values
available consist only of those present in the neighborhood (no
averages).
Median filtering does not shift boundaries, as can happen with
conventional smoothing filters (a contrast dependent problem).
Since the median is less sensitive than the mean to extreme
values (outliers), those extreme values are more effectively
removed.

Median Filter
The median is, in a sense, a more robust average than the
mean, as it is not affected by outliers (extreme values).
Since the output pixel value is one of the neighboring values,
new unrealistic values are not created near edges.
Since edges are minimally degraded, median filters can be
applied repeatedly, if necessary.
Considerations:
The median filter is more expensive to compute than a
smoothing filter.
Median filters are nonlinear:
Median[A(x)+B(x)] ~= median[A(x)]+median[B(x)]

Median Filter

Median Filter (Conclusion)


Median filter is the nonlinear filter more used to remove the
impulsive noise from an image.
Furthermore, it is a more robust method than the traditional
linear filtering, because it preserves the sharp edges.
Median filter is a spatial filtering
operation, so it uses a 2-D mask that
is applied to each pixel in the input
image. To apply the mask means to
center it in a pixel, evaluating the
covered pixel brightnesses and
determining which brightness value is
the median value. Figure presents the
concept of spatial filtering based on a
3x3 mask, where I is the input image

Mean Filter
Mean filtering is a simple, natural and easy to implement
method of smoothing images, i.e. reducing the amount of
intensity variation between one pixel and the next. It is often
used to reduce noise in images.
The idea of mean filtering is simply to replace each pixel value
in an image with the mean (`average') value of its neighbors,
including itself. This has the effect of eliminating pixel values
which are unrepresentative of their surroundings.
Often a 33 square kernel is used, although larger kernels (e.g.
55 squares) can be used for more severe smoothing. (Note
that a small kernel can be applied more than once in order to
produce a similar but not identical effect as a single pass with a
large kernel.)

Mean Filter

Original Image

Filtered Image

Mean Vs. Median Filters


The median filter considers each pixel in the image in turn and
looks at its nearby neighbors to decide whether or not it is
representative of its surroundings.
It simply replaces the pixel value with the median of those values.
The median is calculated by first sorting all the pixel values from
the surrounding neighborhood into numerical order and then
replacing the pixel being considered with the middle pixel value.
(If the neighborhood under consideration contains an even number
of pixels, the average of the two middle pixel values is used.)
The mean filter on the other hand replaces the pixel value with the
average value of the surrounding pixels, the mean filter works as
convolving the filter with the image and extracts the average of the
operation to be replaced as the new value of the pixel.

Mean Vs. Median Filters

Mean Vs. Median Filters


The median is a more robust average than the mean and so a
single very unrepresentative pixel in a neighborhood will not
affect the median value significantly.
Since the median value must actually be the value of one of
the pixels in the neighborhood, the median filter does not
create new unrealistic pixel values when the filter straddles an
edge. For this reason the median filter is much better at
preserving sharp edges than the mean filter.

Both filters are used to reduce the noise in the digital


image but the result of the median filter is much better
than the mean filter.

Wiener filter
It is a linear filter that is extensively used to restore images
degraded by additive white Gaussian noise .
It attempts to reduce the mean square error (MSE) between the
original and the estimated images.
Likewise, this filter processes degraded images in the frequency
domain.
The equation of Wiener filter is:*

H
R
*
I
2
| H |

Where, (R) is the restored image, (H*) is the complex conjugate of


the PSF, (|H|2) is (H* * PSF), (I) is the degraded image; () is a
constant that represents the noise signal power density ratio.

The Point Spreading Function (PSF)

hg m , n e

( m 2 n 2 )

2 2

h m,n

hg m , n

h
m

n g

Wiener filter (example)

Laplacian Sharpening Filter


This filter sharpens the important features of the image such as lines and edges.
Its usually employs a convolution operation to perform its sharpening task with
a specific mask (kernel).
The Laplacian sharpening method is a linear, spatial domain, and high pass filter.
This filter own two types of masks, firstorder derivative masks and second
order derivative masks.
Some forms of Laplacian kernels can be convolved directly to the image to
obtain the sharpened version of the image, this type of kernels is called first
order derivative.
Other forms of Laplacian kernels are convolved to the image to get a filter
image. Then, this filter image will be subtracted from the blurred image to obtain
the sharpened image, this type of kernels is called secondorder derivative.
An example of the firstorder derivative kernel is the (9) core kernel.
For the secondorder derivative kernels, are (-4) and (-8) core kernels.

Laplacian Sharpening Filter


0

-1

-1

-1

-4

-8

-1

-1

-1

-1

-1

Laplacian Sharpening Filter

Richardson-Lucy deblurring algorithm


The RL is an iterative algorithm.
The RL algorithm has several advantages such as it requires fewer calculations and lower
processing times for any iteration.
Its early iterations are extremely effective.
The RL algorithm is firm against minor PSF errors.
It maintains the non-negativity.
Its late iterations are not that effective due to the slow convergence because its nonlinear.
In the subsequent several iterations, the noise will be accentuated.
The reason is that The R-L algorithm is sensitive to the noise existence, and it is
considered as an inversion settlement.
The RL algorithm may require hundreds or thousands of iterations to restore an image if
the size of the image is large.
The RL algorithm is used in the process of deconvolving images affected by a known PSF.

Richardson-Lucy deblurring algorithm

Richardson-Lucy deblurring algorithm

Histogram Equalization
This method usually increases the global contrast of many images,
especially when the usable data of the image is represented by close
contrast values.
Through this adjustment, the intensities can be better distributed on the
histogram.
This allows for areas of lower local contrast to gain a higher contrast.
Histogram equalization accomplishes this by effectively spreading out the
most frequent intensity values.
The method is useful in images with backgrounds and foregrounds that
are both bright or both dark.
In particular, the method can lead to better views of bone structure in xray images, and to better detail in photographs that are over or underexposed.
The calculation is not computationally intensive.

Histogram Equalization
It may increase the contrast of background noise, while
decreasing the usable signal.
Histogram equalization often produces unrealistic effects in
photographs; however it is very useful for scientific images like
thermal, satellite or x-ray images.
Suppose that u have the following matrix:
8

14

11

15

14

12

15

19

10

13

10

16

12

14

16

12

19

14

19

14

13

16

11

17

14

12

12

11

15

10

13

18

14

13

10

18

12

11

16

18

12

14

17

10

13

Histogram Equalization

Histogram Equalization

Histogram Equalization

Histogram Equalization

Normalization

Normalization

Measuring the image quality


The value of an objective image quality metric is important, it can
play a variety of roles.
First, it can be used to monitor image quality in order to dynamically adjust
it. An example is a network digital video server that examines the
transmission quality and thereby can allocate streaming resources.
Second, the metric can be employed to optimize parameter settings in
image processing systems, such as bit assignment in a compression
algorithm.
Third, it can be used to benchmark image processing systems, a very
important role in the research context.

Image quality is difficult to assess for a number of reasons.


Firstly, image quality is perceptual by nature. This makes it hard to measure
in a standardized way and allows for personal preferences.
Secondly, it can differ vastly between different domains. Acceptable
disturbances in vacation photos are not the same as in x-ray images.

Image quality measurement methods


Average Difference (AD)
This technique is extensively employed to calculate the average
difference between the pixel values of the processed image to
the original image.
Moreover, its mostly used when measuring the results of an
experiment using synthetically degraded images.
M

AD X j,k X ( j ,k ) / MN
J 1 k 1

Where, (X) is denoted as the original image, X^ is the processed


image, and (M, N) are the image dimensions. The lower
outcome from Average Difference (AD) method indicates to
improvement in the image quality and ideally it equals to zero

Image quality measurement methods


Normalized Absolute Error (NAE)
This technique measures exactly what is the difference
between the processed image and the original image.
Its the numerical variance between the restored and the
original image.
The result of this method falls into the interval of values
between [0 and 1].
Moreover, the results that are near to zero means that the
image have high similarity to the Moriginal
one and the results
N
near the value one indicates that
the[image
f i,j f have
i,j ] a very poor

quality .
NAE i 1 j 1
M

The equation of (NAE) is :

[f i,j ]
i 1 j 1

Image quality measurement methods


Root Mean square error (RMSE)
This technique is simply the square root of the mean square
error (MSE) which is the average squared difference between
all the pixels in the original and the restored image.
Furthermore, it measures the volume of alteration per pixel
between the two images.
The lower the results of RMSE mean less error between the
original and the restored image and that means a better image
quality.
The RMSE can be described using the subsequent equation:

1
RMSE MSE
MN

[
X
j
,
k

X
j
,
k
]

j 1 k 1

Image quality measurement methods


Peak Signal to Noise Ratio (PSNR)
This PSNR is an easy well-known technique that is used to
consider the accuracy between the original image and its
reconstructed version.
Furthermore, the greater PSNR value indicates that the resulted
image is more similar to the original one.
Perfectly the value of PSNR is infinity, basically its value falls
into the interval of 25 to 40dB.
In general, higher PSNR the better results.
It is typically expressed as a logarithmic decibel.
The PSNR can be calculated using the subsequent formula :

Image quality measurement methods


Peak Signal to Noise Ratio (PSNR)

Max

PSNR 10 log10
dB
MSE
2

Where, (Max) is the maximum value of the intensities that is


either 1 or 255.
The measuring unit for PSNR is dB.
This technique is used widely to assess the distorted or the
reconstructed images to the original one.
a note should be taken that higher PSNR values do not
constantly reflect a better quality because the signal-to-noise
methods do not associate with human subjective perception.

Image quality measurement methods


(examples)

Images

AD

NAE PSNR RMS


E
Noisy with AWGN 0.16 23.38 0.004
= 0.006
0.005 36
32
6
1
Its Restored
0.004 0.11 25.84 0.002

Image quality measurement methods


(examples)

Images

AD

NAE

PSNR

RMSE

1st Image LC (-40)

-6.5228e-005

Its Enhanced Version

-0.0250 0.0855 29.2336 0.0012

0.4165 16.4279 0.0228

Image quality measurement methods


(examples)

Images
1st Image GB
(R=1)

AD
-1.0626e005

NAE

PSNR

RMS
E
0.045 29.272 0.001
0
9
2

THE END

You might also like