Download - Image Enhancement Spatial Domain
Resmi N.G.Reference:
Digital Signal ProcessingRafael C. GonzalezRichard E. Woods
Overview� Spatial Domain Methods
� Point Processing� Linear (Image Negatives and Identity)� Logarithmic (Log and Inverse Log)� Power Law (nth power and nth root)� Piece-wise Linear
� Contrast Stretching� Gray-Level Slicing� Bit-Plane Slicing
� Histogram Processing� Histogram Equalization� Histogram Matching or Histogram Specification
� Enhancement using Arithmetic/ Logic Operations� Image Subtraction� Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 2
� Mask Processing /Filtering� Linear Spatial Filtering� Non-Linear Spatial Filtering� Smoothing Spatial Filters
� Smoothing Linear Filters� Box-Filter� Weighted Average Filter
� Order-Statistics Filters (Non-Linear Spatial Filters)� Median Filter� Median Filter� Max-filter� Min-filter
� Sharpening Spatial Filters� Second-Order Derivatives
� Laplacian� Unsharp Masking� High Boost Filtering and its Application
� First-Order Derivatives (Gradient)
3/20/2012 CS04 804B Image Processing - Module2 3
Image Enhancement� To process an image so that the result is more suitable
than the original image for a specific application.
� Two categories:� Two categories:� Spatial domain methods
� Direct manipulation of pixels
� Frequency domain methods� Modifying the Fourier Transform of an image.
3/20/2012 4CS04 804B Image Processing - Module2
� Spatial Domain Methods� Point Processing
� Linear (Image Negatives and Identity)� Logarithmic (Log and Inverse Log)� Power Law (nth power and nth root)� Piece-wise Linear
� Contrast Stretching� Gray-Level Slicing� Bit-Plane Slicing
� Histogram Processing� Histogram Equalization� Histogram Matching or Histogram Specification
� Enhancement using Arithmetic/ Logic Operations� Image Subtraction� Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 5
Spatial Domain Methods� Operates directly on pixels.
� Denoted by the expressiong(x,y) = T[f(x,y)]� g(x,y) = T[f(x,y)]
� where f(x,y) is the input image, g(x,y) is the processedimage, T is an operator on f defined over someneighbourhood of (x,y).
� T can also operate on a set of input images.
3/20/2012 6CS04 804B Image Processing - Module2
� Neighbourhood – square or rectangular sub-image area centred at (x,y).
� T is applied at each (x,y) to obtain output g at that location.
3/20/2012 7CS04 804B Image Processing - Module2
� Simplest form of T –� when neighbourhood is of size 1x1 (a single pixel).� g depends only on the value of f at (x,y)� s = T(r)
� Enhancement at any point in an image depends only on thegray level at that point (Point Processing or Gray-LevelTransformation).
� Larger neighbourhoods – Mask Processing or SpatialFiltering.
3/20/2012 8CS04 804B Image Processing - Module2
� Spatial Domain Methods� Point Processing
� Linear (Image Negatives and Identity)� Logarithmic (Log and Inverse Log)� Power Law (nth power and nth root)� Piece-wise Linear
� Contrast Stretching� Gray-Level Slicing� Bit-Plane Slicing
� Histogram Processing� Histogram Equalization� Histogram Matching or Histogram Specification
� Enhancement using Arithmetic/ Logic Operations� Image Subtraction� Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 9
Gray Level Transformations
� Three basic types:� Linear (Image Negatives and Identity)� Linear (Image Negatives and Identity)� Logarithmic (Log and Inverse Log)� Power Law (nth power and nth root)
3/20/2012 10CS04 804B Image Processing - Module2
3/20/2012 CS04 804B Image Processing - Module2 11
Image Negatives
� The negative of an image with gray levels in the range[0,L-1] is obtained by using the transformation given by
� s = L-1-r� Reverses the intensity levels of an image.� For enhancing gray or white detail embedded in dark
regions of an image.
3/20/2012 CS04 804B Image Processing - Module2 12
Log Transformation� General form: s = c log(1+r)
where c is a constant and r ≥ 0.
� Maps a narrow range of low-level gray values in the inputimage into a wider range of output levels.image into a wider range of output levels.
� Maps a wide range of high-level gray values in the input imageinto a lower range of output levels.
� For expanding the values of dark pixels while compressinghigher-level values.
� Compresses the dynamic range of images with large variationsin pixel values.
3/20/2012 CS04 804B Image Processing - Module2 13
3/20/2012 CS04 804B Image Processing - Module2 14
Power-Law Transformation� Basic form:s = crγ
where c and γ are positive constants.� Power-law curves with fractional values of γ (γ <1)
produces similar effect as log transformation.produces similar effect as log transformation.� Power-law curves with γ >1 have exactly the opposite
effect as compared to those with γ <1.� When c = γ = 1, it reduces to identity transformation.
� Gamma correction-� General purpose contrast manipulation-
3/20/2012 CS04 804B Image Processing - Module2 15
3/20/2012 CS04 804B Image Processing - Module2 16
� Spatial Domain Methods� Point Processing
� Linear (Image Negatives and Identity)� Logarithmic (Log and Inverse Log)� Power Law (nth power and nth root)� Piece-wise Linear
� Contrast Stretching� Gray-Level Slicing� Bit-Plane Slicing
� Histogram Processing� Histogram Equalization� Histogram Matching or Histogram Specification
� Enhancement using Arithmetic/ Logic Operations� Image Subtraction� Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 17
Piecewise-Linear Transformations� Contrast Stretching� Gray-Level Slicing� Bit-Plane Slicing
� Advantage – Piecewise functions can be complex.� Disadvantage – Specification requires more user input.
3/20/2012 CS04 804B Image Processing - Module2 18
Contrast Stretching� Increases the dynamic range of gray levels in input
image.
� Causes for low contrast images:� Causes for low contrast images:� Poor illumination� Lack of dynamic range in imaging sensor� Wrong setting of lens aperture during image
acquisition.
3/20/2012 CS04 804B Image Processing - Module2 19
3/20/2012 CS04 804B Image Processing - Module2 20
3/20/2012 CS04 804B Image Processing - Module2 21
Gray-Level Slicing� Highlights a specific range of gray levels in an image.
� Approach 1 - Assigns a high value for all gray levels inthe range of interest and a low value for all other graythe range of interest and a low value for all other graylevels.
� Produces binary image.
� Approach 2 – Brightens the desired range of gray levelsbut preserves the background and gray-level tonalities inthe image.
3/20/2012 CS04 804B Image Processing - Module2 22
3/20/2012 CS04 804B Image Processing - Module2 23
3/20/2012 CS04 804B Image Processing - Module2 24
Bit-Plane Slicing� Highlights the contribution made to total image
appearance by specific bits.� Useful in analyzing the relative importance of each bit of� Useful in analyzing the relative importance of each bit of
the image.� Helps to determine the number of bits used to quantize
each pixel.� Useful for image compression.
3/20/2012 CS04 804B Image Processing - Module2 25
3/20/2012 CS04 804B Image Processing - Module2 26
3/20/2012 CS04 804B Image Processing - Module2 27
3/20/2012 CS04 804B Image Processing - Module2 28
� Spatial Domain Methods� Point Processing
� Linear (Image Negatives and Identity)� Logarithmic (Log and Inverse Log)� Power Law (nth power and nth root)� Piece-wise Linear
� Contrast Stretching� Gray-Level Slicing� Bit-Plane Slicing
� Histogram Processing� Histogram Equalization� Histogram Matching or Histogram Specification
� Enhancement using Arithmetic/ Logic Operations� Image Subtraction� Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 29
Histogram Processing� Contrast adjustment is done using histogram of an image.
� Intensities can be better distributed.
� Advantage – invertible; if histogram equalization functionis known, the original image can be recovered.
� Disadvantage – May increase the contrast of backgroundnoise.
3/20/2012 CS04 804B Image Processing - Module2 30
� Histogram Equalization� Automatically determines a transformation function to
produce image with a uniform histogram.
� Histogram Matching/ Histogram Specification� Produces an output image with a specified histogram.
3/20/2012 CS04 804B Image Processing - Module2 31
Histogram� Histogram of a digital image with gray levels in the range
[0, L-1] is a discrete function h(rk) = nk where rk is the kth
gray level.
� p(rk) is the probability of occurrence of gray level rk.
3/20/2012 CS04 804B Image Processing - Module2 32
3/20/2012 CS04 804B Image Processing - Module2 33
3/20/2012 CS04 804B Image Processing - Module2 34
� High contrast image � – histogram covers a broad range of the grayscale.� - distribution of pixels nearly uniform.� - distribution of pixels nearly uniform.� - exhibits large variety of gray tones.
3/20/2012 CS04 804B Image Processing - Module2 35
Histogram Equalization: ; [0,1]
: ; [0,1]
:
r gray level of input image r
s gray level of output image s
T Transformation function
∈
∈
� T(r) satisfies the conditions:a) T(r) is single-valued and monotonically increasing in the
interval 0 ≤ r ≤ 1.b) 0 ≤ T(r) ≤ 1 for 0 ≤ r ≤ 1.
3/20/2012 CS04 804B Image Processing - Module2 36
:
( );0 1
T Transformation function
s T r r= ≤ ≤
� Condition (a) that T(r) be single-valued guarantees that aninverse transformation exists.
� ( f(x) = x2 is non-invertible for domain of real numbers.)
� Invesre transformation from s to r:� r = T-1(s), 0 ≤ s ≤ 1
� Monotonicity condition preserves the increasing orderfrom black to white in the output image.
� Condition (b) guarantees that the output image gray levelswill be in the same range as the input levels.
3/20/2012 CS04 804B Image Processing - Module2 37
3/20/2012 CS04 804B Image Processing - Module2 38
1
( ) :
( ) :
( ) ( ) ( ) ( ),
( ) ( ) (1)
r
s
r
s r
p r probability density functionof r
p s probability density functionof s
If p r and T r are knownand T s satisfies a then
drp s p r
ds
−
= − − −
3/20/2012 CS04 804B Image Processing - Module2 39
0
( ) ( ) (1)
( ) ( ) (2)
s r
r
r
dsAtransformation functionhas the form
s T r p w dw
RHS is
= = − − −∫.thecumulativedistribution functionof r
( ), ( ) (1).
, ( )
( )
( )
s
r
r
GivenT r are known p s canbeobtained using
Weknow s T r
ds dT rdr dr
dp w dw
dr
=
=
=
∫
3/20/2012 CS04 804B Image Processing - Module2 40
0
0
( )
( ) (3)
( ' : . . .
r
r
r
dr
dp w dw
dr
p r
Leibniz s rule derivativeof a definite integral w r t
its upper limit is theintegrand evaluat
=
= − − −
∫
∫
.)ed at that limit
(3) (1)
( ) ( )
1( )
( )
s r
r
Substituting in gives
drp s p r
ds
p rp r
=
=
3/20/2012 CS04 804B Image Processing - Module2 41
( )
1; 0 1
( ) :
.
( ).
r
s
r
p r
s
p s is therefore
always auniform probability density function
independent of p r
= ≤ ≤
−
−
3/20/2012 CS04 804B Image Processing - Module2 42
� Discrete Version:
(3) (1)
( ) , 0,1,..., 1
( ) ( )
kr k
k
Substituting in gives
np r k L
n
s T r p r
= = −
= =∑
3/20/2012 CS04 804B Image Processing - Module2 43
0
0
( ) ( )
, 0,1,..., 1
.
k k r jj
kj
j
s T r p r
nk L
n
This transformationis called histogramequalization
=
=
= =
= = −
∑
∑
3/20/2012 CS04 804B Image Processing - Module2 44
3/20/2012 45CS04 804B Image Processing - Module2
3/20/2012 46CS04 804B Image Processing - Module2
3/20/2012 47CS04 804B Image Processing - Module2
Histogram Matching� To generate an image that has a specified histogram.
:
:
( ) :r
r gray level of input image
z gray level of output image
p r pdf of input image
3/20/2012 CS04 804B Image Processing - Module2 48
0
0
( ) :
( ) :
( ) ( ) (1)
( ) ( ) (2)
r
z
r
r
z
z
p r pdf of input image
p z specified pdf of output image
Let s T r p w dw
Define G z p t dt s
= = − − −
= = − − −
∫
∫
1 1
(1) (2),
( ) ( )
( ) [ ( )] (3)
From and
G z T r
and zmust satisfy thecondition
z G s G T r− −
=
= = − − −
� T(r) can be obtained from (1) once pr(r) has beenestimated.
� G(z) can be obtained from (2) because pz(z) is given.
3/20/2012 CS04 804B Image Processing - Module2 49
( ) [ ( )] (3)z G s G T r= = − − −
� Assume G-1 exists and satisfies (a) and (b). Image with specified histogram can then be obtained as follows:
� Obtain the transformation function T(r) using (1).� Use (2) to obtain the transformation function G(z).� Obtain the inverse transformation function G-1.� Obtain the output image by applying (3) to all the pixels in
the input image.
The resultant image will have gray levels z with specified probabilitiy density function pz(z).
3/20/2012 CS04 804B Image Processing - Module2 50
� Discrete formulation:
0
0
( ) ( )
, 0,1,..., 1
k
k k r jj
kj
j
k
s T r p r
nk L
n
=
=
= =
= = −
∑
∑
3/20/2012 CS04 804B Image Processing - Module2 51
0
1
1
( ) ( )
[ ( )], 0,1,..., 1
,
( ), 0,1,..., 1
k
k k z i ki
k k
k k
v G z p z s
z G T r k L
Or
z G s k L
=
−
−
= = =
= = −
= = −
∑
3/20/2012 52CS04 804B Image Processing - Module2
3/20/2012 53CS04 804B Image Processing - Module2
Global and Local Enhancement
� Global – pixels are modified based on the gray levelcontent of entire image.
� Local – pixels are modified based on the gray leveldistribution in the neighbourhood of every pixel.
3/20/2012 CS04 804B Image Processing - Module2 54
Use of Histogram Statistics� Global mean – measure of average gray level for entire
image.� Local mean – measure of average gray level in the
neighborhood (sub-image).neighborhood (sub-image).
� Global variance – measure of contrast for entire image.� Local variance – measure of contrast in a
neighborhood.
3/20/2012 CS04 804B Image Processing - Module2 55
� Spatial Domain Methods� Point Processing
� Linear (Image Negatives and Identity)� Logarithmic (Log and Inverse Log)� Power Law (nth power and nth root)� Piece-wise Linear
� Contrast Stretching� Gray-Level Slicing� Bit-Plane Slicing
� Histogram Processing� Histogram Equalization� Histogram Matching or Histogram Specification
� Enhancement using Arithmetic/ Logic Operations� Image Subtraction� Image Averaging
3/20/2012 CS04 804B Image Processing - Module2 56
Enhancement using Arithmetic/Logical Operations
� Arithmetic – operations are performed on a pixel-by-pixelbasis on two or more images.
� Logical – operations are performed on a pixel-by-pixel� Logical – operations are performed on a pixel-by-pixelbasis and pixel values are processed as strings of binarynumbers.� AND and OR – on two or more images
� Used for masking� To highlight an area or differentiate it from rest of the image.
� NOT – on single image.
3/20/2012 CS04 804B Image Processing - Module2 57
AND Operation
OR Operation
3/20/2012 58CS04 804B Image Processing - Module2
Image Subtraction� The difference between two images f(x,y) and h(x,y) is
obtained by computing the difference between all pairs ofcorresponding pixels from f and h.
� g(x,y) = f(x,y) – h(x,y)
� Used to enhance differences between images.� Used in medical imaging.
3/20/2012 CS04 804B Image Processing - Module2 59
Image Averaging� Let g(x,y) be a noisy image formed by the addition of
noise η(x,y) to an image f(x,y). ie;� g(x,y) = f(x,y) + η(x,y)� Assume noise has zero average value.� Assume noise has zero average value.� The noise content in the image can be reduced by adding a
set of noisy images and taking the average
3/20/2012 CS04 804B Image Processing - Module2 60
1
1( , ) ( , )
K
ii
g x y g x yK =
= ∑
Expected value of , { ( , )} ( , )g E g x y f x y=
� Mask Processing /Filtering� Linear Spatial Filtering� Non-Linear Spatial Filtering� Smoothing Spatial Filters
� Smoothing Linear Filters� Box-Filter� Weighted Average Filter
� Order-Statistics Filters (Non-Linear Spatial Filters)� Median Filter� Median Filter� Max-filter� Min-filter
� Sharpening Spatial Filters� Second-Order Derivatives
� Laplacian� Unsharp Masking� High Boost Filtering and its Application
� First-Order Derivatives (Gradient)
3/20/2012 CS04 804B Image Processing - Module2 61
Spatial Filtering� Uses image pixels in the neighborhood (sub-image).� Sub-image is called mask.� Values in a sub-image are called coefficients.� Values in a sub-image are called coefficients.
� Filtering consists of moving the mask from point to pointin an image. At each point (x,y) response of the filter iscomputed using a predefined relationship.
3/20/2012 CS04 804B Image Processing - Module2 62
Linear Spatial Filtering� This involves finding sum of products of filter coefficients
and corresponding pixels in the sub-image.
3/20/2012 CS04 804B Image Processing - Module2 63
3/20/2012 CS04 804B Image Processing - Module2 64
� Linear filtering of an image f of size MxN with a filter ofsize mxn, is given by
( , ) ( , ) ( , )a b
s a t b
g x y w s t f x s y t=− =−
= + +∑ ∑
3/20/2012 CS04 804B Image Processing - Module2 65
1 1, ,
2 20,1,..., 1 0,1,..., 1.
m nwhere a b
for x M and y N
− −= =
= − = −
� For a 3x3 mask,
1 1
1 1
3
3 1 3 11, 1
2 2
( , ) ( , ) ( , )s t
m n
a b
g x y w s t f x s y t=− =−
= =
− −∴ = = = =
= + +∑∑
3/20/2012 CS04 804B Image Processing - Module2 66
1 1
( 1, 1) ( 1, 1) ( 1,0) ( 1, ) ...
(0,0) ( , ) ...
(1,0) ( 1, ) (1,1) ( 1, 1)
s t
w f x y w f x y
w f x y
w f x y w f x y
=− =−
= − − − − + − − +
+ +
+ + + + +
∑∑
� Simplified as
For 3x3 mask,
1 1 2 2
1
... mn mn
mn
i ii
R w z w z w z
w z=
= + + +
=∑� For 3x3 mask,
3/20/2012 CS04 804B Image Processing - Module2 67
1
1 1 2 2 9 9...
mn
i ii
R w z
w z w z w z=
=
= + + +
∑
3/20/2012 CS04 804B Image Processing - Module2 68
� Spatial filtering - Special processing for border pixels� Filter using full mask� Zero padding � Replication of rows or columns.Replication of rows or columns.
3/20/2012 CS04 804B Image Processing - Module2 69
Non-Linear Spatial Filtering
� Filtering operation is based conditionally on the values ofpixels in the neighborhood.
� eg; computing median� eg; computing median
3/20/2012 CS04 804B Image Processing - Module2 70
� Mask Processing /Filtering� Linear Spatial Filtering� Non-Linear Spatial Filtering� Smoothing Spatial Filters
� Smoothing Linear Filters� Box-Filter� Weighted Average Filter
� Order-Statistics Filters (Non-Linear Spatial Filters)� Median Filter� Median Filter� Max-filter� Min-filter
� Sharpening Spatial Filters� Second-Order Derivatives
� Laplacian� Unsharp Masking� High Boost Filtering and its Application
� First-Order Derivatives (Gradient)
3/20/2012 CS04 804B Image Processing - Module2 71
Smoothing Spatial Filters� Smoothing Linear Spatial Filters
� Used for blurring and noise reduction.� Called averaging filters or lowpass filters – Output is the� Called averaging filters or lowpass filters – Output is the
average of pixels contained in the neighborhood of filter mask.
� Replaces every pixel in an image by the average of gray levelsin the neighborhood defined by filter mask.
� Side-effect – blurring of edges and smoothing of falsecontours.
3/20/2012 CS04 804B Image Processing - Module2 72
� Box Filter� Spatial averaging filter in which all coefficients are equal.� Standard average of pixels under the mask.
1
1 mn
ii
R zmn =
= ∑
� Weighted Average Filter� Pixels are multiplied by different filter coefficients, giving
more weight to some pixels.
3/20/2012 CS04 804B Image Processing - Module2 73
1imn =
� Filtering using Weighted Average Filter is given by
( , ) ( , )( , )
( , )
a b
s a t ba b
w s t f x s y tg x y
w s t
=− =−
+ +=∑ ∑
∑ ∑
3/20/2012 CS04 804B Image Processing - Module2 74
( , )
1 1, , .
2 20,1,..., 1 0,1,..., 1.
s a t b
w s t
m nwhere a b mand nareodd
x M and y N
=− =−
− −= =
= − = −
∑ ∑
3/20/2012 CS04 804B Image Processing - Module2 75
� Mask Processing /Filtering� Linear Spatial Filtering� Non-Linear Spatial Filtering� Smoothing Spatial Filters
� Smoothing Linear Filters� Box-Filter� Weighted Average Filter
� Order-Statistics Filters (Non-Linear Spatial Filters)� Median Filter� Median Filter� Max-filter� Min-filter
� Sharpening Spatial Filters� Second-Order Derivatives
� Laplacian� Unsharp Masking� High Boost Filtering and its Application
� First-Order Derivatives (Gradient)
3/20/2012 CS04 804B Image Processing - Module2 76
� Order-Statistics Filters� Response is based on ordering the pixels and then
repalcing the central pixel value with the value determinedby the ranking result.
Median Filter� Median Filter� Sorts pixel values and computes median .� Replaces value of the pixel with median of gray levels in the
neighborhood.� Excellent noise reduction; less blurring.� Effective in the presence of salt and pepper noise.
3/20/2012 CS04 804B Image Processing - Module2 77
� Max Filter� R = max{zk| k=1,2,…mn}.� Used to find the brightest points in an image.
Min Filter� Min Filter� R = min{zk| k=1,2,…mn}.� Used to find the darkest points in an image.
3/20/2012 CS04 804B Image Processing - Module2 78
� Mask Processing /Filtering� Linear Spatial Filtering� Non-Linear Spatial Filtering� Smoothing Spatial Filters
� Smoothing Linear Filters� Box-Filter� Weighted Average Filter
� Order-Statistics Filters (Non-Linear Spatial Filters)� Median Filter� Median Filter� Max-filter� Min-filter
� Sharpening Spatial Filters� Second-Order Derivatives
� Laplacian� Unsharp Masking� High Boost Filtering and its Application
� First-Order Derivatives (Gradient)
3/20/2012 CS04 804B Image Processing - Module2 79
Sharpening Spatial Filters� Used to highlight the fine detail in an image.� To enhance the detail that has been blurred.� To enhance edges, noise etc.� Sharpening is done through spatial differentiation.� Sharpening is done through spatial differentiation.
� Based on first derivatives
� Based on second derivatives
3/20/2012 CS04 804B Image Processing - Module2 80
( 1) ( )f
f x f xx∂
= + −∂
2
2 ( 1) ( 1) 2 ( )f
f x f x f xx∂
= + + − −∂
� First order derivatives� Must be zero in flat segments.� Must be non-zero at the onset of a gray-level step or ramp.� Must be non-zero along ramps.
� Second order derivatives� Second order derivatives� Must be zero in flat areas.� Must be non-zero at the onset and end of a gray-level step or
ramp.� Must be zero along ramps of constant slope.
3/20/2012 CS04 804B Image Processing - Module2 81
� Based on first derivatives� Produces thicker edges� Stronger response to gray-level step.
� Based on second derivativesStronger response to finer detail� Stronger response to finer detail
� Produces double response at step changes.
So second-order derivatives are more suited than first-orderderivatives for enhancing fine details.
3/20/2012 CS04 804B Image Processing - Module2 82
3/20/2012 CS04 804B Image Processing - Module2 83
� Use of Second Derivatives � Laplacian - Laplacian for f(x,y)
2 22
2 2
2
( 1, ) ( 1, ) 2 ( , )
f ff
x y
ff x y f x y f x y
∂ ∂∇ = +
∂ ∂
∂= + + − −
3/20/2012 CS04 804B Image Processing - Module2 84
2
2
2
2
( 1, ) ( 1, ) 2 ( , )
( , 1) ( , 1) 2 ( , )
( 1, ) ( 1, )
( , 1) ( , 1) 4 ( , )
f x y f x y f x yxf
f x y f x y f x yy
f f x y f x y
f x y f x y f x y
= + + − −∂∂
= + + − −∂
∴∇ = + + − +
+ + − −
� Highlights gray-level discontinuities
2( , ) ( , )
( , )
if thecentrecoefficient of thef x y f x y
Laplacianmask is negativeg x y
if thecentrecoefficient of the
−∇
=
3/20/2012 CS04 804B Image Processing - Module2 85
2
( , )
( , ) ( , )
g x yif thecentrecoefficient of the
f x y f x yLaplacianmask is positive
= +∇
� Unsharp Masking� Subtracts blurred version of the image from the original
image.
( , ) ( , ) ( , )sf x y f x y f x y= −
� Used in dark-room photography.
3/20/2012 CS04 804B Image Processing - Module2 86
� High Boost Filtering
( , )
( , ) ( , ) ( , )
( 1) ( , ) ( , ) ( , )
( 1) ( , ) ( , )s
hb
f x y
s
f x y Af x y f x y
A f x y f x y f x y
A f x y f x y
= −
= − + −
= − +
1442443
3/20/2012 CS04 804B Image Processing - Module2 87
( 1) ( , ) ( , )sA f x y f x y= − +
2
2
( , ) ( , )
( , ) ( , )hb
if thecentrecoefficient of theAf x y f x y
Laplacianmask is negativef
if thecentrecoefficient of theAf x y f x y
Laplacianmask is positive
−∇
= +∇
� When A = 1, high-boost filtering becomes standardLaplacian sharpening.
� Application:� To make images lighter.
3/20/2012 CS04 804B Image Processing - Module2 88
� Use of First Derivatives� Uses magnitude of the gradient.
,
fx
Gradient ffy
∂ ∂ ∇ =∂ ∂
� First order derivatives of a digital image are based onvarious approximations of the 2D gradient.
122 2
y
f fMagnitudeof f
x y
∂
∂ ∂ ∇ = + ∂ ∂
3/20/2012 89CS04 804B Image Processing - Module2
� The mathematical implementation of first orderderivatives can be done by masks known as� Roberts cross-gradient operator� Prewitt operator� Sobel operator
• Let the 3 3 area represent the gray levels in a neighborhood of an image, • Let the 3 3 area represent the gray levels in a neighborhood of an image, as shown below
3/20/2012 90CS04 804B Image Processing - Module2
Roberts cross-gradient operator
Equations ( )( )
9 5
8 6
x
y
G z z
G z z
= −
= −
Masks
3/20/2012 91CS04 804B Image Processing - Module2
Prewitt operator
Equations( ) ( )( ) ( )
7 8 9 1 2 3
3 6 9 1 4 7
x
y
G z z z z z z
G z z z z z z
= + + − + +
= + + − + +
Masks
3/20/2012 92CS04 804B Image Processing - Module2
Sobel operator
Equations( ) ( )( ) ( )
7 8 9 1 2 3
3 6 9 1 4 7
2 2
2 2x
y
G z z z z z z
G z z z z z z
= + + − + +
= + + − + +
Masks
3/20/2012 93CS04 804B Image Processing - Module2
Thank YouThank You
3/20/2012 CS04 804B Image Processing - Module2 94