0% found this document useful (0 votes)
15 views107 pages

Image Enhancement Techniques Overview

Module 3 covers image enhancement techniques in the spatial domain, including gray level transformations, histogram processing, and spatial filtering methods. It discusses point processing methods such as linear, logarithmic, and power-law transformations, as well as piecewise-linear transformations like contrast stretching and gray-level slicing. The module also addresses histogram equalization and matching, which are essential for improving image contrast and achieving desired tonal distributions.

Uploaded by

resmi.ng
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views107 pages

Image Enhancement Techniques Overview

Module 3 covers image enhancement techniques in the spatial domain, including gray level transformations, histogram processing, and spatial filtering methods. It discusses point processing methods such as linear, logarithmic, and power-law transformations, as well as piecewise-linear transformations like contrast stretching and gray-level slicing. The module also addresses histogram equalization and matching, which are essential for improving image contrast and achieving desired tonal distributions.

Uploaded by

resmi.ng
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Module 3

Image Enhancement
Spatial Domain

Resmi N.G.
Reference:
Digital Image Processing
Rafael C. Gonzalez
Richard E. Woods
Module 3 - Syllabus
Image Enhancement in spatial domain
Basic Gray Level Transformation functions – Image
Negatives; Log Transformations; Power-Law
Transformations.
Piecewise-Linear Transformation Functions: Contrast
Stretching; Gray Level Slicing; Bit Plane Slicing;
Histogram Processing– Equalization; Specification.
Basics of Spatial Filtering –
Smoothing: Smoothing Linear Filters; Ordered
Statistic Filters;
Sharpening: Laplacian; Unsharp Masking and High
Boost Filtering.
CS463 Digital Image Processing 2
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

CS463 Digital Image Processing 3


 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

 Max-filter

 Min-filter

 Sharpening Spatial Filters


 Second-Order Derivatives

 Laplacian

 Unsharp Masking

 High Boost Filtering and its Application

 First-Order Derivatives (Gradient)

CS463 Digital Image Processing 4


Image Enhancement
To process an image so that the result is more suitable
than the original image for a specific application.

Two categories:
Spatial domain methods
 Direct manipulation of pixels

Frequency domain methods


 Modifying the Fourier Transform of an image.

CS463 Digital Image Processing 5


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

CS463 Digital Image Processing 6


Spatial Domain Methods
Operates directly on pixels.

Denoted by the expression


g(x,y) = T[f(x,y)]
where f(x,y) is the input image, g(x,y) is the
processed image, T is an operator on f defined
over some neighbourhood of (x,y).

T can also operate on a set of input images.

CS463 Digital Image Processing 7


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.

CS463 Digital Image Processing 8


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 the


gray level at that point (Point Processing or Gray-Level
Transformation).

Larger neighbourhoods – Mask Processing or Spatial


Filtering.

CS463 Digital Image Processing 9


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

CS463 Digital Image Processing 10


Gray Level Transformations
Three basic types:
Linear (Image Negatives and Identity)
Logarithmic (Log and Inverse Log)
Power Law (nth power and nth root)

CS463 Digital Image Processing 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.

CS463 Digital Image Processing 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 input image


into a wider range of output levels.
Maps a wide range of high-level gray values in the input image
into a lower range of output levels.

For expanding the values of dark pixels while compressing


higher-level values.
Compresses the dynamic range of images with large variations in
pixel values.
CS463 Digital Image Processing 13
CS463 Digital Image Processing 14
CS463 Digital Image Processing 15
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.
Power-law curves with γ >1 have exactly the opposite
effect as compared to those with γ <1.
When c = γ = 1, it reduces to identity transformation.

CS463 Digital Image Processing 16


CS463 Digital Image Processing 17
A variety of devices used for image capture, printing,
and display respond according to a power law. The
exponent in the power-law-equation is referred to as
gamma.

The process used to correct these power-law response


phenomena is called gamma correction.

CS463 Digital Image Processing 18


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

CS463 Digital Image Processing 19


Piecewise-Linear Transformations
Contrast Stretching
Gray-Level Slicing
Bit-Plane Slicing

Advantage – Piecewise functions can be


complex.
Disadvantage – Specification requires more
user input.

CS463 Digital Image Processing 20


Contrast Stretching
Process that expands the range of intensity
levels in an image so that it spans the full
intensity range of the recording medium or
display device.

Causes for low contrast images:


Poor illumination
Lack of dynamic range in imaging sensor
Wrong setting of lens aperture during image
acquisition.

CS463 Digital Image Processing 21


CS463 Digital Image Processing 22
CS463 Digital Image Processing 23
Gray-Level Slicing
Highlights a specific range of gray levels in an image.

Approach 1 - Assigns a high value for all gray levels in


the range of interest and a low value for all other gray
levels.
Produces binary image.

Approach 2 – Brightens the desired range of gray levels


but preserves the background and gray-level tonalities in
the image.
CS463 Digital Image Processing 24
CS463 Digital Image Processing 25
CS463 Digital Image Processing 26
Bit-Plane Slicing
Highlights the contribution made to total image
appearance by specific bits.
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.

CS463 Digital Image Processing 27


CS463 Digital Image Processing 28
CS463 Digital Image Processing 29
CS463 Digital Image Processing 30
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

CS463 Digital Image Processing 31


Histogram Processing
Contrast adjustment is done using histogram of an image.

Intensities can be better distributed.

Advantage – invertible; if histogram equalization function


is known, the original image can be recovered.

Disadvantage – May increase the contrast of background


noise.

CS463 Digital Image Processing 32


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.

CS463 Digital Image Processing 33


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.


CS463 Digital Image Processing 34
CS463 Digital Image Processing 35
CS463 Digital Image Processing 36
High contrast image
– histogram covers a broad range of the grayscale.
- distribution of pixels nearly uniform.
- exhibits large variety of gray tones.

CS463 Digital Image Processing 37


Histogram Equalization
r : gray level of input image; r  [0,1]
s : gray level of output image; s  [0,1]
T :Transformation function
s T (r );0 r 1
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.

CS463 Digital Image Processing 38


Condition (a) that T(r) be single-valued guarantees that an
inverse 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 order


from black to white in the output image.

Condition (b) guarantees that the output image gray levels


will be in the same range as the input levels.
CS463 Digital Image Processing 39
CS463 Digital Image Processing 40
Let pr (r ) : probability density function of r
ps ( s ) : probability density function of s
If pr (r ) and T (r ) are known and T ( r ) is continuous
and differentiable over the range of values of interest ,
then
dr
p s ( s )  pr ( r )    (1)
ds
Atransformation function has the form
r
s T (r ) ( L  1) pr ( w)dw    (2)
0

RHS is the cumulative distribution function of r.


CS463 Digital Image Processing 41
GivenT (r ), ps ( s ) can be obtained using (1).
We know, s T (r )
ds dT (r )

dr dr
d  r

  ( L  1) pr ( w)dw 
dr  0 
d  r

( L  1)  pr ( w)dw 
dr  0 
( L  1) pr (r )    (3)
( Leibniz ' s rule : derivative of a definite integral w.r.t.
its upper limit is the int egrand evaluated at that limit .)
CS463 Digital Image Processing 42
Substituting (3) in (1) gives
dr
ps ( s )  pr (r )
ds
1
 pr (r )
( L  1) pr (r )
L  1; 0 s L  1
ps ( s ) is therefore :
 always a uniform probability density function.
 independent of pr (r ).

CS463 Digital Image Processing 43


CS463 Digital Image Processing 44
Discrete Version:

Substituting (3) in (1) gives


nk
pr (rk )  , k 0,1,..., L  1
n
k
sk T (rk ) ( L  1) pr (rj )
j 0
k nj
( L  1) , k 0,1,..., L  1
j 0 n
This transformation is called histogram equalization.

CS463 Digital Image Processing 45


CS463 Digital Image Processing 46
k
L 1 k
sk T (rk ) ( L  1) pr (r j )   nj
j 0 MN j 0
k 0,1, 2...L  1

s0 T (r0 ) 7 pr (r0 ) 7 0.19 1.33

s1 T (r1 ) 7  pr ( r0 )  pr (r1 ) 
7 (0.19  0.25) 3.08

CS463 Digital Image Processing 47


Values of equalized histogram

CS463 Digital Image Processing 48


CS463 Digital Image Processing 49
CS463 Digital Image Processing 50
CS463 Digital Image Processing 51
CS463 Digital Image Processing 52
Histogram Matching
To generate an image that has a specified histogram.
Let r : gray level of input image
z : gray level of output image
Let pr (r ) : pdf of input image
pz ( z ) : specified pdf of output image
r
Let s T (r ) ( L  1) pr ( w)dw    (1)
0
z
Define G ( z ) ( L  1) p z (t )dt s    (2)
0
CS463 Digital Image Processing 53
From (1) and (2),
G ( z ) T (r )
and z must satisfy the condition
1 1
z G ( s ) G [T (r )]    (3)

T(r) can be obtained from (1) once pr(r) has been


estimated.
G(z) can be obtained from (2) because pz(z) is given.

CS463 Digital Image Processing 54


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 z= G-1(s).
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


probability density function pz(z).

CS463 Digital Image Processing 55


Discrete formulation

 (Eq. 3-20)
Given a specific value of sk, compute the transformation
function
 (Eq. 3-21)

for a value of q so that
 (Eq. 3-22)

Obtain the inverse transformation (Eq. 3-


23)

CS463 Digital Image Processing 56


CS463 Digital Image Processing 57
CS463 Digital Image Processing 58
CS463 Digital Image Processing 59
Values of equalized histogram

CS463 Digital Image Processing 60


CS463 Digital Image Processing 61
CS463 Digital Image Processing 62
CS463 Digital Image Processing 63
CS463 Digital Image Processing 64
Global and Local Enhancement
Global – pixels are modified based on the gray level
content of entire image.

Local – pixels are modified based on the gray level


distribution in the neighbourhood of every pixel.

CS463 Digital Image Processing 65


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).

Global variance – measure of contrast for


entire image.
Local variance – measure of contrast in a
neighborhood.

CS463 Digital Image Processing 66


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

CS463 Digital Image Processing 67


Enhancement using Arithmetic/Logical
Operations
Arithmetic – operations are performed on a pixel-by-pixel
basis on two or more images.

Logical – operations are performed on a pixel-by-pixel basis


and pixel values are processed as strings of binary numbers.
 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.

CS463 Digital Image Processing 68


AND Operation

OR Operation

CS463 Digital Image Processing 69


Image Subtraction
The difference between two images f(x,y) and h(x,y) is
obtained by computing the difference between all pairs of
corresponding pixels from f and h.

 g(x,y) = f(x,y) – h(x,y)

Used to enhance differences between images.


Used in medical imaging.

CS463 Digital Image Processing 70


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.
The noise content in the image can be reduced by adding
a set of noisy images and taking the average
K
1
g ( x, y ) 
K
 g ( x, y )
i 1
i

Expected value of g , E{ g ( x, y)}  f ( x, y)


CS463 Digital Image Processing 71
 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

 Max-filter

 Min-filter

 Sharpening Spatial Filters


 Second-Order Derivatives

 Laplacian

 Unsharp Masking

 High Boost Filtering and its Application

 First-Order Derivatives (Gradient)

CS463 Digital Image Processing 72


Spatial Filtering
Uses image pixels in the neighborhood (sub-image).
Sub-image is called mask.
Values in a sub-image are called coefficients.

Filtering consists of moving the mask from point to point


in an image. At each point (x,y) response of the filter is
computed using a predefined relationship.

CS463 Digital Image Processing 73


Linear Spatial Filtering
This involves finding sum of products of filter
coefficients and corresponding pixels in the sub-image.

CS463 Digital Image Processing 74


CS463 Digital Image Processing 75
Linear filtering of an image f of size MxN with a filter of
size mxn, is given by
a b
g ( x, y )    w(s, t ) f ( x  s, y  t )
s  a t  b

m 1 n 1
where a  ,b  ,
2 2
for x 0,1,..., M  1 and y 0,1,..., N  1.

CS463 Digital Image Processing 76


For a 3x3 mask,
m n 3
3 1 3 1
a  1, b  1
2 2
1 1
g ( x, y )    w( s, t ) f ( x  s, y  t )
s  1 t  1

w( 1,  1) f ( x  1, y  1)  w( 1, 0) f ( x  1, y )  ...


 w(0, 0) f ( x, y )  ...
 w(1, 0) f ( x  1, y )  w(1,1) f ( x  1, y  1)

CS463 Digital Image Processing 77


Simplified as
R w1 z1  w2 z2  ...  wmn zmn
mn
 wi zi
i 1
For 3x3 mask,
mn
R  wi zi
i 1

w1 z1  w2 z2  ...  w9 z9

CS463 Digital Image Processing 78


CS463 Digital Image Processing 79
Spatial filtering - Special processing for border pixels
Filter using full mask
Zero padding
Replication of rows or columns.

CS463 Digital Image Processing 80


Non-Linear Spatial Filtering
Filtering operation is based conditionally on the values of
pixels in the neighborhood.
eg; computing median

CS463 Digital Image Processing 81


 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

 Max-filter

 Min-filter

 Sharpening Spatial Filters


 Second-Order Derivatives

 Laplacian

 Unsharp Masking

 High Boost Filtering and its Application

 First-Order Derivatives (Gradient)

CS463 Digital Image Processing 82


Smoothing Spatial Filters
Smoothing Linear Spatial Filters

Used for blurring and noise reduction.


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 levels


in the neighborhood defined by filter mask.
Side-effect – blurring of edges and smoothing of false
contours.

CS463 Digital Image Processing 83


Box Filter
Spatial averaging filter in which all coefficients are equal.
Standard average of pixels under the mask.

1 mn
R   zi
mn i 1
Weighted Average Filter
Pixels are multiplied by different filter coefficients, giving
more weight to some pixels.

CS463 Digital Image Processing 84


Filtering using Weighted Average Filter is given by

a b

  w(s, t ) f ( x  s, y  t )
g ( x, y )  s  a t  b a b

  w(s, t )
s  a t  b

m 1 n 1
where a  ,b  , m and n are odd .
2 2
x 0,1,..., M  1 and y 0,1,..., N  1.

CS463 Digital Image Processing 85


CS463 Digital Image Processing 86
 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

 Max-filter

 Min-filter

 Sharpening Spatial Filters


 Second-Order Derivatives

 Laplacian

 Unsharp Masking

 High Boost Filtering and its Application

 First-Order Derivatives (Gradient)

CS463 Digital Image Processing 87


Order-Statistics Filters
Response is based on ordering the pixels and then
repalcing the central pixel value with the value determined
by the ranking result.

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.

CS463 Digital Image Processing 88


Max Filter
R = max{zk| k=1,2,…mn}.
Used to find the brightest points in an image.

Min Filter
R = min{zk| k=1,2,…mn}.
Used to find the darkest points in an image.

CS463 Digital Image Processing 89


 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

 Max-filter

 Min-filter

 Sharpening Spatial Filters


 Second-Order Derivatives

 Laplacian

 Unsharp Masking

 High Boost Filtering and its Application

 First-Order Derivatives (Gradient)

CS463 Digital Image Processing 90


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.
Based on first derivatives

f
 f ( x  1)  f ( x)
x
Based on second derivatives

2 f
2
 f ( x  1)  f ( x  1)  2 f ( x)
x
CS463 Digital Image Processing 91
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


 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.

CS463 Digital Image Processing 92


Based on first derivatives
 Produces thicker edges
 Stronger response to gray-level step.

Based on second derivatives


 Stronger response to finer detail
 Produces double response at step changes.

So second-order derivatives are more suited than first-order


derivatives for enhancing fine details.

CS463 Digital Image Processing 93


CS463 Digital Image Processing 94
Use of Second Derivatives
Laplacian - Laplacian for f(x,y)

2 f 2 f
2 f  2  2
x y
2 f
 f ( x  1, y )  f ( x  1, y )  2 f ( x, y )
x 2
2 f
 f ( x, y  1)  f ( x, y  1)  2 f ( x, y )
y 2
2 f  f ( x  1, y )  f ( x  1, y ) 
f ( x, y  1)  f ( x, y  1)  4 f ( x, y )

CS463 Digital Image Processing 95


Laplacian kernels for image enhancement

CS463 Digital Image Processing 96


Highlights gray-level discontinuities

 2 if the centre coefficient of the


 f ( x , y )   f ( x, y )
 Laplacian mask is negative
g ( x, y ) 
 f ( x, y )  2 f ( x, y ) if the centre coefficient of the
 Laplacian mask is positive

CS463 Digital Image Processing 97


Unsharp Masking
Steps:
 Blur the original image.
 Subtract the blurred version of the image from the

original image (resulting difference is called mask.).


 Add the mask to the original.

Used in dark-room photography.

CS463 Digital Image Processing 98


g mask ( x, y )  f ( x, y )  f ( x, y )
f ( x, y ) is the blurred image.
g ( x, y )  f ( x, y )  k * g mask ( x, y )
where k is a weight (k 0).
When k 1, the process is called unsharp masking .
When k  1, the process is called highboost filtering .

CS463 Digital Image Processing 99


High Boost Filtering
g mask ( x, y )  f ( x, y )  f ( x, y )
f ( x, y ) is the blurred image.
g ( x, y )  f ( x, y )  k * g mask ( x, y )
where k is a weight (k 0).
When k 1, the process is called unsharp masking .
When k  1, the process is called highboost filtering .
CS463 Digital Image Processing 100
Use of First Derivatives
Uses magnitude of the gradient.

 f 
 x 
Gradient , f  
 f 
 y 
1
  f  2  f  2  2

Magnitude of f       
  x   y  
First order derivatives of a digital image are based on
various approximations of the 2D gradient.

CS463 Digital Image Processing 101


The mathematical implementation of first order
derivatives 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,
as shown below

CS463 Digital Image Processing 102


Roberts cross-gradient operator
Gx  z9  z5 
Equations
G y  z8  z6 

Masks

CS463 Digital Image Processing 103


Prewitt operator (detects horizontal, vertical
edges)
Gx  z7  z8  z9    z1  z 2  z3 
Equations
G y  z3  z6  z9    z1  z 4  z7 

Masks


 Horizontal mask Vertical
mask CS463 Digital Image Processing 104
Vertical Mask Horizontal Mask

CS463 Digital Image Processing 105


Sobel operator
Gx  z7  2 z8  z9    z1  2 z 2  z3 
Equations
G y  z3  2 z6  z9    z1  2 z 4  z7 

Masks

CS463 Digital Image Processing 106


Thank You

CS463 Digital Image Processing 107

You might also like