Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Digital Image and Video Processing (UEC1722)

Unit – I Fundamentals of Image Processing

Dr. C. Vinoth Kumar


Asso. Prof. / ECE, SSNCE
Unit I – Fundamentals of Image Processing

• Image Representation and Formation


• Image sampling and quantization
• Pixel distribution
• Histogram equalization and matching
• Enhancement
• Color image processing
Session Objectives

• To discuss about the smoothing and sharpening filters in


spatial domain for image enhancement
Session Outcomes

• At the end of the session, students will be able to


- Understand and apply various smoothing and
sharpening filters in spatial domain for image
enhancement
Image Enhancement using
Spatial Filtering Technique
- Smoothing Filters
Spatial Filtering:

Mask

w(-1,-
w(-1,0) w(-1,1)
1)
Image f(x,y)
w(0,-1) w(0,0) w(0,1)

w(1,-1) w(1,0) w(1,1)

f(-1,-
f(-1,0) f(-1,1)
1)

f(0,-1) f(0,0) f(0,1)

f(1,-1) f(1,0) f(1,1)


 The output or response of the linear filtering with
the filter mask at a point (x,y) in the image is,

R=w(-1,-1)f(x-1,y-1)+w(-1,0)f(x-1,y)+w(-1,1)f(x-1,y+1)+
w(0,-1)f(x,y-1) + w(0,0)f(x,y) + w(0,1)f(x,y+1)+
w(1,-1)f(x+1,y-1) +w(1,0)f(x+1,y) + w(1,1)f(x+1,y+1)

 In general, linear filtering of an image f of size


MxN with a filter mask of size mxn is given by
expression:
a b
g ( x, y) = ∑ ∑ w(s, t ) f ( x + s, y + t )
s =− a t =−b

a=(m-1)/2 and b=(n-1)/2


 The process of linear filtering is similar to a
frequency domain – convolution.

 Hence, the linear spatial filtering is referred as


“convolving a mask with an image”.

 Filter masks are called as convolution masks /


convolution kernel.
Smoothing spatial filters:

 They are used for blurring and for noise


reduction.

 Blurring is used to remove the small details


from an image prior to object extraction and
bridging of small gaps in lines or curves.
Smoothing Linear Filters:

 The output of a smoothing, linear spatial filter


is simply the average of the pixels contained in
the neighborhood of the filter mask.

 These filters are called as averaging filters or


low pass filters.
 The weighted averaging filter is given by the
expression,

a b

∑ ∑ w( s, t )
s =− a s =−b
f ( x + s, y + t )
g ( x, y ) = a b

∑ ∑ w(s, t )
s =− a s =−b
Order – Statistics Filters:

 These are nonlinear filters whose response is


based on ordering (ranking) the pixels contained
in the image area encompassed by the filter, and
then replacing the value of the center pixel with
the value determined by the ranking result.

 One example is Median filter.

 Median filters provide excellent noise reduction


causing less blurring than linear smoothing
filters of similar size.
 Median filters are particularly effective in the
presence of impulse noise (salt and pepper noise)

 Similarly Max filter is used to find the


brightest points in an image and Min filter is
used to find the opposite.
Image Enhancement using
Spatial Filtering Technique
– Sharpening Filters
Sharpening Spatial Filters:

 The principal objective of sharpening is to


highlight fine detail in an image or to enhance
detail that has been blurred, either in error or as
a natural effect of a particular method of image
acquisition.

 Averaging (Low pass) is analogous to


integration and hence sharpening is
implemented by digital differentiation.
 The strength of the response of a derivative
operator is proportional to the degree of
discontinuity of the image at the point at which the
operator is applied. Thus image differentiation
enhances edges and other discontinuities (such as
noise) and de-emphasizes the areas with slowly
varying gray-level values.

 The sharpening filters are based on first and


second order derivatives.

 The derivatives of a digital function are defined in


terms of differences.
 The properties of first derivative are:

(i) must be zero in flat segments


(ii) must be nonzero at the onset of a gray – level
step or ramp
(iii) must be nonzero along ramps

 The properties of second derivative are:

(i) must be zero in flat areas


(ii) must be nonzero at the onset and end of a gray
– level step or ramp
(iii) must be nonzero along ramps of constant
slope
 The maximum possible gray – level change is
finite and the shortest distance over which that
change occur is between adjacent pixels.

 The basic definition of the first – order derivative


of a one – dimensional function f(x) is the
difference, ∂f
= f ( x + 1) − f ( x)
∂x
 Similarly for the second – order derivative of a
one – dimensional function f(x,y) is,
∂2 f
2
= f ( x + 1) + f ( x − 1) − 2 f ( x)
∂x
 The first order derivatives generally produce
thicker edges in an image and have a stronger
response to a gray – level step.

 The second order derivatives have a stronger


response to fine detail, such as thin lines and
isolated points and produce a double response
at step changes in gray level.
Second order derivatives for Enhancement – The
Laplacian:

 We consider 2D – second order derivatives for


image enhancement.

 The approach consists of defining a discrete


formulation of the second – order derivative
and then constructing a filter mask based on
that formulation.

 Isotropic filters which are rotation invariant, are


implemented.
 The simplest isotropic derivative operator is the
Laplacian, which is defined for an image f(x,y) is,
2 2
2 ∂ f ∂ f
∇ f = 2 + 2
∂x ∂y

 The Laplacian is a linear operator.


 The digital Laplacian using neighborhoods is
defined as,
∂2 f
2
= f ( x + 1, y ) + f ( x − 1, y ) − 2 f ( x, y )
∂x
∂2 f
2
= f ( x, y + 1) + f ( x, y − 1) − 2 f ( x, y )
∂y
∇ 2 f = [ f ( x + 1, y ) + f ( x − 1, y ) + f ( x, y + 1) + f ( x, y − 1)] − 4 f ( x, y )
 The background features can be recovered while
still preserving the sharpening effect of the
Laplacian operation simply adding the original
and Laplacian images.

 f ( x, y ) − ∇ 2 f ( x, y ) if the center coefficient of the



 Laplacian mask is negative

g ( x, y ) = 
 2
 f ( x , y ) + ∇ f ( x, y ) if the center coefficient of the

 Laplacian mask is positive
Simplification:
g ( x, y ) = f ( x, y ) − [ f ( x + 1, y ) + f ( x − 1, y ) + f ( x, y + 1) + f ( x, y − 1)] + 4 f ( x, y )
= 5 f ( x, y ) − [ f ( x + 1, y ) + f ( x − 1, y ) + f ( x, y + 1) + f ( x, y − 1)]
Unsharp masking and high – boost filtering:

 The process to sharpen image by subtracting a


blurred version of an image from the image
itself, is called as Unsharp masking, which is
expressed as,
f s ( x, y ) = f ( x, y ) − f ( x, y )

 The high – boost filtered image, fhb, is defined at


any point (x,y) is,
f hb ( x, y ) = Af ( x, y ) − f ( x, y )
where A ≥ 1
 The equation may be written as,
f hb ( x, y ) = ( A − 1) f ( x, y ) + f ( x, y ) − f ( x, y )
f hb ( x, y ) = ( A − 1) f ( x, y ) + f s ( x, y )

 Using Laplacian,
 Af ( x, y ) − ∇ 2 f ( x, y ) if the center coefficient of the

 Laplacian mask is negative

f hb ( x, y ) = 
 2
 Af ( x , y ) + ∇ f ( x, y ) if the center coefficient of the

 Laplacian mask is positive
Summary

• The smoothing filters in spatial domain such as masking,


averaging and order-statistics for image enhancement are
studied.
• The sharpening filters in spatial domain such as derivatives,
gradient, and Laplacian for image enhancement are
discussed.
Review Questions
1. What is masking operation in image enhancement?
2. What is gradient of an image?
3. How high-boost filtering is performed in an image?
Text Books and References
Text Books:
• Rafael C. Gonzalez, Richard E. Woods, ‘Digital Image Processing’, Pearson,
Third Edition, 2010.
• Anil K. Jain, ‘Fundamentals of Digital Image Processing’, Pearson, 2002.

References:
• Kenneth R. Castleman, ‘Digital Image Processing’, Pearson, 2006.
• Rafael C. Gonzalez, Richard E. Woods, Steven Eddins, ‘Digital Image
Processing using MATLAB’, Pearson Education, Inc., 2011.
• D. E. Dudgeon and RM. Mersereau, ‘Multidimensional Digital Signal
Processing’, Prentice Hall Professional Technical Reference, 1990.
• William K. Pratt, ‘Digital Image Processing’, John Wiley, New York, 2002
• Milan Sonka et al, ‘Image processing, analysis and machine vision’,
Brookes/Cole, Vikas Publishing House, 2nd edition, 1999.
Thank You

You might also like