Mpa 5

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

Digital Image Processing

Image Enhancement-III
Aloke Datta
Enhancement Using Arithmetic/Logic Op.
Arithmetic/logic operations involving images are performed on a
pixel-by-pixel basis between two or more images.

Arithmetic Operations
Addition, Subtraction, Multiplication, and Division

Logic Operations
AND, OR, NOT

H.R. Pourreza
Logic Operation
• Any logical operations can be implemented using only
AND, OR and NOT logic operators.
• When dealing with gray-scale images, pixel values are
processed as strings of binary numbers.
• The NOT logic operator does the same function as the
negative transformation does.
• The AND and OR operations are used for masking; that
is, for selecting subimages in an image.
• Masking is also called as region of interest (ROI)
processing.
Enhancement Using AND and OR Logic Op.

AND

OR

Logic operations are performed on the binary representation of the


pixel intensities
H.R. Pourreza
Image Subtraction
• The difference between two images f(x,y) and h(x,y) is given
as:

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

• The difference image is very useful for evaluating the effect of


setting to zero the lower-order planes.

• Commercial applications
– Mask mode radiography in medical imaging
– Change detection via image subtraction
– tracking moving objects or vehicles
Enhancement Using Arithmetic Op. _ SUB

Original
4
Upper-order
Bit

HE of
Error Error

H.R. Pourreza
Image Averaging
• A noisy image:
g ( x, y )  f ( x, y )  n ( x, y )
• Assume that at every pair of coordinates (x,y) the noise is
uncorrelated and has zero average value.

• Reduce the noise content by adding a set of noisy images, gi(x,y).

• Averaging M different noisy images:


M
1
g ( x, y ) 
M
 g ( x, y )
i 1
i

• As M increases, the variability of the pixel values at each location decreases.

– This means that g(x,y) approaches f(x,y) as the number of noisy images used
in the averaging process increases.
Enhancement Using Arithmetic Op. Averaging
Original image Noise with zero mean

g ( x, y )  f ( x, y )   ( x, y )
1 k
g ( x, y )   g i ( x, y )
k i 1
E g ( x, y )  f ( x, y )
1 2
 g ( x, y )    ( x, y )
2

k
Enhancement Using Averaging

Gaussian Noise
f(x,y) g(x,y) mean = 0
variance = 64

K=8 K = 16

x
-  +
K = 128
K = 32
H.R. Pourreza
Basics of Spatial Filtering - Linear
Spatial filtering are filtering
operations performed on the
pixel intensities of an image
and not on the frequency
components of the image.

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

a = (m - 1) / 2 b = (n - 1) / 2
Smoothing Spatial Filtering - Linear
Averaging (low-pass) Filters
Smoothing filters are used
- Noise reduction
- Smoothing of false contours
- Reduction of irrelevant detail

Undesirable side effect of smoothing filters


- Blur edges

Weighted average filter


reduces blurring in the
smoothing process.

Box Weighted
filter average
Smoothing Spatial Filtering _ Linear
Averaging (low-pass) Filters
n = filter size

n=3

n=5 n=9

n = 35

n = 15
H.R. Pourreza
Smoothing Spatial Filtering
Averaging & Threshold
filter size Threshold Image
n = 15
Order Statistic Filters

Order-statistics filters are nonlinear spatial 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.

3  3 Median filter [10 125 125 135 141 141 144 230 240] = 141
3  3 Max filter [10 125 125 135 141 141 144 230 240] = 240
3  3 Min filter [10 125 125 135 141 141 144 230 240] = 10

Median filter eliminates isolated clusters of pixels that are light or


dark with respect to their neighbors, and whose area is less than
n2/2.
Order Statistic Filters
n=3 n=3
Average Median
filter filter
Sharpening Spatial Filters
The principal objective of sharpening is to highlight fine detail
in an image or to enhance detail that has been blurred.

1 9

9 1
zi
Image Blurred Image
1 9

9 1
z

The derivatives of a digital function are defined in terms of differences.


Sharpening Spatial Filters
Requirements for digital derivative
First derivative
1) Must be zero in flat segment
2) Must be nonzero along ramps.
3) Must be nonzero at the onset of a gray-level step or ramp
Second derivative
1) Must be zero in flat segment
2) Must be zero along ramps.
3) Must be nonzero at the onset and end of a gray-level step or
ramp
f
 f ( x  1)  f ( x)
x
2 f
 f ( x  1)  f ( x  1)  2 f ( x)
x 2
Sharpening Spatial Filters

H.R. Pourreza
Sharpening Spatial Filters

Comparing the response between first- and second-ordered


derivatives:
1) First-order derivative produce thicker edge
2) Second-order derivative have a stronger response to fine detail, such as
thin lines and isolated points.
3) First-order derivatives generally have a stronger response to a gray-
level step
4) Second-order derivatives produce a double response at step changes in
gray level.

In general the second derivative is better than the first derivative for image
enhancement. The principle use of first derivative is for edge extraction.
Use of First Derivative for Edge Extraction
Gradient
First derivatives in image processing are implemented
using the magnitude of the gradient.
t
 f f 
f   z1 z2 z3
 x y 
z4 z5 z6
2 0.5
 f   f  
2
z7 z8 z9
f  mag (f )         Gx  G y
 x   y  
Roberts operator
Gx = (z9-z5) and Gy = (z8 - z6)
Sobel operator
Gy = (z3+2z6 +z9) - (z1+2z4+z7) and
Gx = (z7+2z8+z9) - (z1+2z2+z3)
Use of First Derivative for Edge Extraction
Gradient

Robert operator

Sobel operators
Use of First Derivative for Edge Extraction
Gradient
2nd Derivative _ Laplacian

 f  f 2 2
 f  2  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 ( y, y )]
Use of 2nd Derivative for Enhancement
Laplacian

Isotropic filter response is independent of the direction of the


discontinuities in the image to which the filter is applied.

 2
f  2
f
 f  2  2
2
x y
Use of 2nd Derivative for Enhancement
Laplacian

1 1 1
1 -8 1
1 1 1

If the center coefficient


of the laplacian mask is
negative

 f ( x, y )   2 f ( x, y )
g ( x, y )  
 f ( x , y )   2
f ( x, yH.R.) Pourreza
Use of 2nd Derivative for Enhancement
Laplacian
 2 f  [ f ( x  1, y )  f ( x  1, y )  f ( x, y  1)  f ( x, y  1)  4 f ( x, y )]
0 1 0
g(x,y) = f(x,y) - 1 -4 1 =
0 1 0

 f ( x, y )
2

H.R. Pourreza
Un-sharp Masking and High-boost Filtering

High-boost filtering is used when the original image is


blurred and dark.

f hb  Af ( x, y )   2 f ( x, y ) A>1
Un-sharp Masking and High-boost Filtering

(b)

H.R. Pourreza
Combining Spatial
Enhancement Methods
Combining Spatial
Enhancement Methods
Thank You

You might also like