Digital image processing img smoothning

52
Digital Image Processing Presentation over image smoothing and sharpening -Vinay Kumar Gupta 0700410088

Transcript of Digital image processing img smoothning

Page 1: Digital image processing img smoothning

Digital Image ProcessingPresentation over image smoothing

and sharpening

-Vinay Kumar Gupta0700410088

Page 2: Digital image processing img smoothning

What is a Digital Image?A digital image is a representation of a two-

dimensional image as a finite set of digital values, called picture elements or pixels.

Page 3: Digital image processing img smoothning

Why Digital Image Processing?Digital image processing focuses on two major tasks:

Improvement of pictorial information for human interpretation.

Processing of image data for storage, transmission and representation for autonomous machine perception

Page 4: Digital image processing img smoothning

Applications:The use of digital image processing techniques has exploded and they are now used for all kinds of tasks in all kinds of areas:

Image enhancement/restorationArtistic effectsMedical visualisationIndustrial inspectionLaw enforcementHuman computer interfaces

Page 5: Digital image processing img smoothning

Examples: The Hubble TelescopeLaunched in 1990 the Hubble telescope can take images of very distant objectsHowever, an incorrect mirror made many of Hubble’s images useless.Image processing techniques were used to fix this

Page 6: Digital image processing img smoothning

Examples: HCITry to make human computer interfaces more natural

Face recognitionGesture recognition

Does anyone remember the user interface from “Minority Report”?

Page 7: Digital image processing img smoothning

Key Stages in Digital Image Processing:

Image Acquisition

Image Restoration

Morphological

Processing

Segmentation

Representation &

Description

Image Enhancemen

t

Object Recognition

Problem Domain

Colour Image

ProcessingImage

Compression

Page 8: Digital image processing img smoothning

Image RepresentationBefore we discuss image acquisition recall that a digital image iscomposed of M rows and N columns of pixels each storing a value

Pixel values are most often grey levels in the range 0-255(black-white)

col

row

f (row, col)

Page 9: Digital image processing img smoothning

Image Representation

Page 10: Digital image processing img smoothning

Image Representation

Page 11: Digital image processing img smoothning

Image Representation

Page 12: Digital image processing img smoothning

What Is Image Enhancement?Image enhancement is the process of making images more usefulThe reasons for doing this include:

Highlighting interesting detail in imagesRemoving noise from imagesMaking images more visually appealing

Page 13: Digital image processing img smoothning

Spatial & Frequency DomainsThere are two broad categories of image enhancement techniques

Spatial domain techniques Direct manipulation of image pixels

Frequency domain techniques Manipulation of Fourier transform or wavelet

transform of an imageFor the moment we will concentrate on techniques that operate in the spatial domain

Page 14: Digital image processing img smoothning

Image HistogramsThe histogram of an image shows us the distribution of grey levels in the image

Grey Levels

Freq

uenc

ies

Page 15: Digital image processing img smoothning

Spatial filtering techniques:Neighbourhood operationsWhat is spatial filtering?Smoothing operationsWhat happens at the edges?

Page 16: Digital image processing img smoothning

Neighbourhood OperationsNeighbourhood operations simply operate on a larger neighbourhood of pixels than point operationsNeighbourhoods are mostly a rectangle around a central pixelAny size rectangle and any shape filter are possible

Origin x

y Image f (x, y)

(x, y)Neighbourhood

Page 17: Digital image processing img smoothning

Simple Neighbourhood OperationsSome simple neighbourhood operations include:

Min: Set the pixel value to the minimum in the

neighbourhoodMax:

Set the pixel value to the maximum in the neighbourhood

Median: The median value of a set of numbers is the midpoint value in that set (e.g. from the set [1, 7, 15, 18, 24] 15 is the median). Sometimes the median works better than the average

Page 18: Digital image processing img smoothning

The Spatial Filtering Processr s t

u v w

x y z

Origin x

y Image f (x, y)

eprocessed = v*e + r*a + s*b + t*c + u*d + w*f + x*g + y*h + z*i

FilterSimple 3*3

Neighbourhood e 3*3 Filter

a b c

d e f

g h iOriginal

Image Pixels

*

The above is repeated for every pixel in the original image to generate the filtered image

Page 19: Digital image processing img smoothning

Smoothing Spatial Filters

1/9 1/9 1/9

1/9 1/9 1/9

1/9 1/9 1/9

One of the simplest spatial filtering operations we can perform is a smoothing operation

Simply average all of the pixels in a neighbourhood around a central value

Especially useful in removing noise from images

Also useful for highlighting gross detail

Simple averaging filter

Page 20: Digital image processing img smoothning

Smoothing Spatial Filtering1/9

1/91/9

1/91/9

1/9

1/91/9

1/9

Origin x

y Image f (x, y)

e = 1/9*106 + 1/9*104 + 1/9*100 + 1/9*108 + 1/9*99 + 1/9*98 + 1/9*95 + 1/9*90 + 1/9*85

= 98.3333

FilterSimple 3*3

Neighbourhood106

104

99

95

100108

98

90 85

1/91/9

1/9

1/91/9

1/9

1/91/9

1/9

3*3 SmoothingFilter

104 100 108

99 106 98

95 90 85

Original Image Pixels

*

The above is repeated for every pixel in the original image to generate the smoothed image

Page 21: Digital image processing img smoothning

Sharpening Spatial FiltersPreviously we have looked at smoothing filters which remove fine detailSharpening spatial filters seek to highlight fine detail

Remove blurring from imagesHighlight edges

Sharpening filters are based on spatial differentiation

Page 22: Digital image processing img smoothning

Spatial DifferentiationDifferentiation measures the rate of change of a functionLet’s consider a simple 1 dimensional example

Page 23: Digital image processing img smoothning

Spatial Differentiation

A B

Page 24: Digital image processing img smoothning

1st DerivativeThe formula for the 1st derivative of a function is as follows:

It’s just the difference between subsequent values and measures the rate of change of the function.

)()1( xfxfxf

Page 25: Digital image processing img smoothning

2nd DerivativeThe formula for the 2nd derivative of a function is as follows:

Simply takes into account the values both before and after the current value

)(2)1()1(2

2

xfxfxfxf

Page 26: Digital image processing img smoothning

Using Second Derivatives For Image EnhancementThe 2nd derivative is more useful for image enhancement than the 1st derivative

Stronger response to fine detailSimpler implementationWe will come back to the 1st order derivative

later onThe first sharpening filter we will look at is the Laplacian

IsotropicOne of the simplest sharpening filtersWe will look at a digital implementation

Page 27: Digital image processing img smoothning

The LaplacianThe Laplacian is defined as follows:

where the partial 1st order derivative in the x direction is defined as follows:

and in the y direction as follows:

yf

xff 2

2

2

22

),(2),1(),1(2

2

yxfyxfyxfxf

),(2)1,()1,(2

2

yxfyxfyxfyf

Page 28: Digital image processing img smoothning

The Laplacian (cont…)So, the Laplacian can be given as follows:

We can easily build a filter based on this

),1(),1([2 yxfyxff )]1,()1,( yxfyxf

),(4 yxf

0 1 0

1 -4 1

0 1 0

Page 29: Digital image processing img smoothning

The Laplacian (cont…)Applying the Laplacian to an image we get a new image that highlights edges and other discontinuities

OriginalImage

LaplacianFiltered Image

LaplacianFiltered Image

Scaled for Display

Page 30: Digital image processing img smoothning

But That Is Not Very Enhanced!The result of a Laplacian filtering is not an enhanced imageWe have to do more work in order to get our final imageSubtract the Laplacian result from the original image to generate our final sharpened enhanced image

LaplacianFiltered Image

Scaled for Displayfyxfyxg 2),(),(

Page 31: Digital image processing img smoothning

Laplacian Image Enhancement

In the final sharpened image edges and fine detail are much more obvious

- =

OriginalImage

LaplacianFiltered Image

SharpenedImage

Page 32: Digital image processing img smoothning

Laplacian Image Enhancement

Page 33: Digital image processing img smoothning

Simplified Image EnhancementThe entire enhancement can be combined into a single filtering operation

),1(),1([),( yxfyxfyxf )1,()1,( yxfyxf

)],(4 yxf

fyxfyxg 2),(),(

),1(),1(),(5 yxfyxfyxf )1,()1,( yxfyxf

Page 34: Digital image processing img smoothning

Simplified Image Enhancement (cont…)This gives us a new filter which does the whole job for us in one step

0 -1 0

-1 5 -1

0 -1 0

Page 35: Digital image processing img smoothning

The Big Idea

=

Any function that periodically repeats itself can be expressed as a sum of sines and cosines of different frequencies each multiplied by a different coefficient – a Fourier series

Page 36: Digital image processing img smoothning

The Discrete Fourier Transform (DFT)The Discrete Fourier Transform of f(x, y), for x = 0, 1, 2…M-1 and y = 0,1,2…N-1, denoted by F(u, v), is given by the equation:

for u = 0, 1, 2…M-1 and v = 0, 1, 2…N-1.

1

0

1

0

)//(2),(),(M

x

N

y

NvyMuxjeyxfvuF

Page 37: Digital image processing img smoothning

DFT & ImagesThe DFT of a two dimensional image can be visualised by showing the spectrum of the images component frequencies

DFT

Page 38: Digital image processing img smoothning

The DFT and Image ProcessingTo filter an image in the frequency domain:

1. Compute F(u,v) the DFT of the image2. Multiply F(u,v) by a filter function H(u,v)3. Compute the inverse DFT of the result

Page 39: Digital image processing img smoothning

Some Basic Frequency Domain FiltersLow Pass Filter

High Pass Filter

Page 40: Digital image processing img smoothning

Smoothing Frequency Domain FiltersSmoothing is achieved in the frequency domain by dropping out the high frequency componentsThe basic model for filtering is:

G(u,v) = H(u,v)F(u,v)where F(u,v) is the Fourier transform of the image being filtered and H(u,v) is the filter transform functionLow pass filters – only pass the low frequencies, drop the high ones.

Page 41: Digital image processing img smoothning

Ideal Low Pass FilterSimply cut off all high frequency components that are a specified distance D0 from the origin of the transform

changing the distance changes the behaviour of the filter

Page 42: Digital image processing img smoothning

Ideal Low Pass Filter (cont…)The transfer function for the ideal low pass filter can be given as:

where D(u,v) is given as:

0

0

),( if 0),( if 1

),(DvuDDvuD

vuH

2/122 ])2/()2/[(),( NvMuvuD

Page 43: Digital image processing img smoothning

Butterworth Low pass FiltersThe transfer function of a Butterworth lowpass filter of order n with cutoff frequency at distance D0 from the origin is defined as:

nDvuDvuH 2

0 ]/),([11),(

Page 44: Digital image processing img smoothning

Gaussian Low pass FiltersThe transfer function of a Gaussian lowpass filter is defined as: 2

02 2/),(),( DvuDevuH

Page 45: Digital image processing img smoothning

Lowpass Filtering ExamplesA low pass Gaussian filter is used to connect broken text

Page 46: Digital image processing img smoothning

Sharpening in the Frequency DomainEdges and fine detail in images are associated with high frequency componentsHigh pass filters – only pass the high frequencies, drop the low ones.High pass frequencies are precisely the reverse of low pass filters, so:

Hhp(u, v) = 1 – Hlp(u, v)

Page 47: Digital image processing img smoothning

Ideal High Pass FiltersThe ideal high pass filter is given as:

where D0 is the cut off distance as before

0

0

),( if 1),( if 0

),(DvuDDvuD

vuH

Page 48: Digital image processing img smoothning

Butterworth High Pass FiltersThe Butterworth high pass filter is given as:

where n is the order and D0 is the cut off distance as before

nvuDDvuH 2

0 )],(/[11),(

Page 49: Digital image processing img smoothning

Gaussian High Pass FiltersThe Gaussian high pass filter is given as:

where D0 is the cut off distance as before

20

2 2/),(1),( DvuDevuH

Page 50: Digital image processing img smoothning

Frequency Domain Filtering & Spatial Domain FilteringSimilar jobs can be done in the spatial and frequency domainsFiltering in the spatial domain can be easier to understandFiltering in the frequency domain can be much faster – especially for large images

Page 51: Digital image processing img smoothning

Questions?

?

Page 52: Digital image processing img smoothning

THANK YOU…!!!