0% found this document useful (0 votes)
10 views

Lecture 3 - Chap 3

The document discusses spatial domain processing of images, which directly modifies pixel intensities rather than transform coefficients. This includes basic intensity transformation functions like log, power-law, and gamma transformations as well as histogram processing techniques for enhancement like equalization, matching, and using histogram statistics. Spatial filtering is also covered, including smoothing filters that reduce noise and blur details through weighted averaging in a local neighborhood.

Uploaded by

AB la Gemeloj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lecture 3 - Chap 3

The document discusses spatial domain processing of images, which directly modifies pixel intensities rather than transform coefficients. This includes basic intensity transformation functions like log, power-law, and gamma transformations as well as histogram processing techniques for enhancement like equalization, matching, and using histogram statistics. Spatial filtering is also covered, including smoothing filters that reduce noise and blur details through weighted averaging in a local neighborhood.

Uploaded by

AB la Gemeloj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 59

Intensity Transformation and

Spatial Filtering
Spatial Domain vs. Transform Domain

► Spatial domain
image plane itself, directly process the intensity values of
the image plane

► Transform domain
process the transform coefficients, not directly process the
intensity values of the image plane

10/11/2015 2
Spatial Domain Process

g ( x , y )  T [ f ( x , y)])
f (x , y) : input image g (
x , y) : output image

T : an operator on f defined over


a neighborhood of point (x , y)

10/11/2015 3
Spatial Domain Process

Intensity transformation
function s  T ( r)

10/11/2015
Some Basic Intensity Transformation
Functions

10/11/2015
Example: Log Transformations

10/11/2015
Example: Log Transformations

10/11/2015
Power-Law (Gamma) Transformations


s  cr

10/11/2015
Example: Gamma Transformations

10/11/2015
Example: Gamma Transformations
Cathode ray tube
(CRT) devices have an
intensity-to-voltage
response that is a
power function, with
exponents varying
from approximately 1.8
to 2.5

s  r1/2.5

10/11/2015 10
Example: Gamma Transformations

10/11/2015
Transformations

► Contrast Stretching
— Expands the range of intensity levels in an image so that it spans
the full intensity range of the recording medium or display device.

► Intensity-level Slicing
— Highlighting a specific range of intensities in an image often is
of interest.

10/11/2015
12
10/11/2015 13
Highlight the major
blood vessels and
study the shape of the
flow of the contrast
medium (to detect
blockages, etc.)

Measuring the actual


flow of the contrast
medium as a function
of time in a series of
images 14
Bit-plane Slicing

10/11/2015
Bit-plane Slicing
Bit-plane Slicing

10/11/2015
Histogram Processing

► Histogram Equalization

► Histogram Matching

► Local Histogram Processing

► Using Histogram Statistics for Image Enhancement

10/11/2015 18
Histogram Processing

Histogram h ( rk )  nk
rk is the k th intensity value
nk is the number of pixels in the image with intensity rk
nk
Normalized histogram p ( rk ) 
MN
nk : the number of pixels in the image
of size M  N with intensity rk
10/11/2015 19
10/11/2015 20
10/11/2015 21
Histogram Equalization
The intensity levels in an image may be viewed
as random variables in the interval [0, L-1].
Let pr (r ) and p s (s) denote the probability density
function (PDF) of random variables r and s.

10/11/2015 22
Histogram Equalization

sT(r) 0  r  L 1

a. T(r) is a strictly monotonically increasing function


in the interval 0  r  L -1;
b. 0  T ( r )  L -1 for 0  r  L -1.

23
Histogram Equalization

sT(r) 0  r  L 1

a. T(r) is a strictly monotonically increasing function


in the interval 0  r  L -1;
b. 0  T ( r )  L -1 for 0  r  L -1.

T ( r) is continuous and differentiable.

ps ( s ) ds  pr ( r ) dr
10/11/2015 24
Histogram Equalization

ds dT ( r ) d  r

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

p pr ( r ) dr pr ( r ) pr ( r) 1
s ( s)  ds   ds   ( L 1) pr ( r)  L 1
 
 dr 
10/11/2015 25
Example: Histogram Equalization

10/11/2015
10/11/2015 27
10/11/2015 28
Example of Histogram
Equalization

10/11/2015
Question
Is histogram equalization always good?

No

10/11/2015
Histogram Matching
Histogram matching (histogram specification)
— generate a processed image that has a specified histogram
Let pr (r ) and p z ( z) denote the continous probability
density functions of the variables r and z . p z (z) is the
specified probability density function.
Let s be the random variable with the probability
r

s  T ( r )  ( L 1)0 pr (w) dw
Define a random variable z with the probability
z

G ( z )  (L 1)0 p z (t ) dt  s
10/11/2015 31
Histogram Matching: Procedure

► Obtain pr(r) from the input image and then obtain the values of s
r

s  ( L 1) 0 pr ( w) dw

► Use the specified PDF and obtain the transformation function G(z)
z

G ( z )  ( L 1) 0 p z (t ) dt  s

► Mapping from s to z

z  G 1 ( s)

10/11/2015 32
Local Histogram Processing

Define a neighborhood and move its center from pixel


to pixel

At each location, the histogram of the points in the


neighborhood is computed. Either histogram equalization or
histogram specification transformation function is obtained

Map the intensity of the pixel centered in the neighborhood

Move to the next location and repeat the procedure

10/11/2015 33
Local Histogram Processing: Example

10/11/2015
Using Histogram Statistics for Image
Enhancement
Average Intensity L1 1 M 1 N 1
m rp(r)  f ( x , y)
 ii MN x 0 y0
i0

Variance L1 1 M 1 N 1
  u 2 ( r )  ( ri  m) p ( ri ) 
2 2 2
 f ( x, y )  m 
i0 MN x 0 y0

10/11/2015 35
Using Histogram Statistics for Image
Enhancement

Local average intensity


L1
m  rp (r )
s xy i s xy i
i0

s
xy denotes a neighborhood
Local variance
L1
 m ) 2 p (r )
 (ri
2

s xy s xy s xy i
i0

10/11/2015
Using Histogram Statistics for Image
Enhancement: Example

10/11/2015
Convolution and Correlation

10/11/2015
Spatial Correlation

The correlation of a filter w( x, y ) of size m  n


with an image f (x, y ), denoted as w( x, y ) f (x, y)

a b

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

10/11/2015 39
Spatial Convolution

The convolution of a filter w( x, y ) of size m  n


with an image f (x, y ), denoted as w( x, y ) f (x, y)

a b

w( x, y ) f (x, y )   w( s , t ) f (x  s , y t)


s a t b

10/11/2015 40
10/11/2015 41
Spatial Filtering

A spatial filter consists of (a) a neighborhood, and (b) a


predefined operation

10/11/2015
Spatial Filtering

10/11/2015
Smoothing Spatial Filters

Smoothing filters are used for blurring and for


noise reduction

Blurring is used in removal of small details and bridging


of small gaps in lines or curves

Smoothing spatial filters include linear filters and nonlinear


filters.

10/11/2015
Spatial Smoothing Linear Filters

The general implementation for filtering an M  N image


with a weighted averaging filter of size m  n is given
ab

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

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

where m  2a 1, n  2b 1.

10/11/2015 45
Two Smoothing Averaging Filter Masks

10/11/2015
10/11/2015 47
Example: Gross Representation of Objects

10/11/2015
Order-statistic (Nonlinear) Filters

— Nonlinear

— Based on ordering (ranking) the pixels contained in


the filter mask

— Replacing the value of the center pixel with the


value determined by the ranking result

E.g., median filter, max filter, min filter

10/11/2015
Example: Use of Median Filtering for Noise Reduction

10/11/2015 50
Sharpening Spatial Filters

► Foundation

► Laplacian Operator

► Unsharp Masking and Highboost Filtering

► Using First-Order Derivatives for Nonlinear Image


Sharpening — The Gradient

10/11/2015 51
Sharpening Spatial Filters: Foundation

► The first-order derivative of a one-dimensional function


f(x) is the difference
f
 f ( x 1)  f ( x)
x

► The second-order derivative of f(x) as the difference

2f
f(x1)f(x1)2f(x)
x2

10/11/2015 52
53
Sharpening Spatial Filters: Laplace Operator

The second-order isotropic derivative operator is


the Laplacian for a function (image) f(x,y)
2 f 2 f
2 f   2 
x y2
2 f
 f ( x 1, y )  f ( x 1, y )  2 f ( x, y)
x2
2 f
f(x,y1)f(x,y1)2f(x,y)
y2
2 f  f ( x 1, y )  f ( x 1, y )  f ( x , y 1)  f ( x ,
y 1) - 4 f (x, y)
10/11/2015
Sharpening Spatial Filters: Laplace Operator

10/11/2015
Sharpening Spatial Filters: Laplace Operator

10/11/2015
Sharpening Spatial Filters: Laplace Operator

The 1D Gaussian function

10/11/2015
Sharpening Spatial Filters: Laplace Operator

st nd
1 order derivative of Gaussian 2 order derivative of Gaussian

10/11/2015

You might also like