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

Module2 - Image Enhancement SD - Presentation

The document discusses techniques for enhancing images in the spatial domain. It covers topics like gray-level transformations including logarithmic, power-law, and piecewise-linear functions. Histogram processing techniques like equalization and matching are also covered. Both global and local enhancement methods are discussed.

Uploaded by

Divya murthy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Module2 - Image Enhancement SD - Presentation

The document discusses techniques for enhancing images in the spatial domain. It covers topics like gray-level transformations including logarithmic, power-law, and piecewise-linear functions. Histogram processing techniques like equalization and matching are also covered. Both global and local enhancement methods are discussed.

Uploaded by

Divya murthy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Module 2

Image Enhancement
in the Spatial Domain
Image
Image Enhancement
Enhancement inin the
the
Spatial
Spatial Domain
Domain

• The spatial domain:


– The image plane
– For a digital image is a Cartesian coordinate system of discrete rows
and columns. At the intersection of each row and column is a pixel.
Each pixel has a value, which we will call intensity.
• The frequency domain :
– A (2-dimensional) discrete Fourier transform of the spatial domain
– We will discuss it in chapter 6.
• Enhancement :
– To “improve” the usefulness of an image by using some
transformation on the image.
– Often the improvement is to help make the image “better” looking,
such as increasing the intensity or contrast.
Background

• A mathematical representation of spatial


domain enhancement:
g ( x, y )  T [ f ( x, y )]
where f(x, y): the input image
g(x, y): the processed image
T: an operator on f, defined over some neighborhood of
(x, y)
Gray-level
Gray-level Transformation
Transformation
Some
Some Basic
Basic Gray
Gray Level
Level Transformations
Transformations
Image
Image Negatives
Negatives

• Let the range of gray level be [0, L-1], then


s  L 1 r
Log
Log Transformations
Transformations

s  c log(1  r )
where c : constant

r0
Power-Law
Power-Law Transformation
Transformation

s  cr 
where c, : positive constants
Power-Law
Power-Law Transformation
Transformation
Example
Example 1:
1: Gamma
Gamma Correction
Correction

  0.4
Power-Law
Power-Law Transformation
Transformation
Example
Example 2:
2: Gamma
Gamma Correction
Correction

 1   0.6

  0.4   0.3
Power-Law
Power-Law Transformation
Transformation
Example
Example 3:
3: Gamma
Gamma Correction
Correction

 1   3.0

  4.0   5.0
Piecewise-Linear
Piecewise-Linear Transformation
Transformation Functions
Functions
Case
Case 1:
1: Contrast
Contrast Stretching
Stretching
Piecewise-Linear
Piecewise-Linear Transformation
Transformation Functions
Functions
Case
Case 2:Gray-level
2:Gray-level Slicing
Slicing

An image Result of using the transformation in (a)


Piecewise-Linear
Piecewise-Linear Transformation
Transformation Functions
Functions
Case
Case 3:Bit-plane
3:Bit-plane Slicing
Slicing

• Bit-plane slicing:
– It can highlight the contribution made to total image appearance by
specific bits.
– Each pixel in an image represented by 8 bits.
– Image is composed of eight 1-bit planes, ranging from bit-plane 0 for
the least significant bit to bit plane 7 for the most significant bit.
Piecewise-Linear
Piecewise-Linear Transformation
Transformation Functions
Functions
Bit-plane
Bit-plane Slicing:
Slicing: A
A Fractal
Fractal Image
Image
Piecewise-Linear
Piecewise-Linear Transformation
Transformation Functions
Functions
Bit-plane
Bit-plane Slicing:
Slicing: A
A Fractal
Fractal Image
Image

7 6

5 4 3

2 1 0
Histogram
Histogram Processing
Processing
Histogram
Histogram Processing
Processing
Histogram
Histogram Equalization
Equalization

• Histogram equalization:
– To improve the contrast of an image
– To transform an image in such a way that the transformed image has a
nearly uniform distribution of pixel values
• Transformation:
– Assume r has been normalized to the interval [0,1], with r = 0
representing black and r = 1 representing white
s  T (r ) 0  r 1
– The transformation function satisfies the following conditions:
• T(r) is single-valued and monotonically increasing in the interval 0  r  1
• 0  T (r )  1 for 0  r  1
Histogram
Histogram Equalization
Equalization

• For example:
Histogram
Histogram Equalization
Equalization

• Histogram equalization is based on a transformation of the


probability density function of a random variable.
• Let pr(r) and ps(s) denote the probability density function of
random variable r and s, respectively.
• If pr(r) and T(r) are known, then the probability density
function ps(s) of the transformed variable s can be obtained
dr
p s ( s )  pr ( r )
ds r
• Define a transformation function s  T (r )  0 pr ( w)dw
where w is a dummy variable of integration
and the right side of this equation is the cumulative
distribution function of random variable r.
Histogram
Histogram Equalization
Equalization

r
• Given transformation function T(r), T (r )  0 pr ( w)dw
dr dT (r ) d  r   p (r )
dr  0
  p ( w) dw
ds dr
r  r

dr 1
p s ( s )  pr ( r )  pr ( r ) 1 0  s 1
ds pr ( r )
ps(s) now is a uniform probability density function.
• T(r) depends on pr(r), but the resulting ps(s) always is uniform.
Histogram
Histogram Equalization
Equalization

• In discrete version:
– The probability of occurrence of gray level rk in an image is
nk
pr ( r )  k  0,1,2,..., L  1
n
n : the total number of pixels in the image
nk : the number of pixels that have gray level rk
L : the total number of possible gray levels in the image
– The transformation function is

k k nj
sk  T (rk )   pr (rj )   k  0,1,2,..., L  1
j 0 j 0 n
– Thus, an output image is obtained by mapping each pixel with level rk
in the input image into a corresponding pixel with level sk.
Histogram
Histogram Equalization
Equalization
Histogram
Histogram Equalization
Equalization

• Transformation functions (1) through (4) were obtained form the


histograms of the images in Fig 3.17(1), using Eq. (3.3-8).
Histogram
Histogram Matching
Matching

• Histogram matching is similar to histogram equalization,


except that instead of trying to make the output image have a
flat histogram, we would like it to have a histogram of a
specified shape, say pz(z).
• We skip the details of implementation.
Local
Local Enhancement
Enhancement

• The histogram processing methods discussed above are


global, in the sense that pixels are modified by a
transformation function based on the gray-level content of an
entire image.
• However, there are cases in which it is necessary to enhance
details over small areas in an image.

original global local


Use
Use of
of Histogram
Histogram Statistics
Statistics for
for Image
Image Enhancement
Enhancement

• Moments can be determined directly from a histogram much faster than


they can from the pixels directly.
• Let r denote a discrete random variable representing discrete gray-levels in
the range [0,L-1], and p(ri) denote the normalized histogram component
corresponding to the ith value of r, then the nth moment of r about its
L 1
mean is defined as
 n (r )   (ri  m) p(ri )
n

i 0
where m is the mean value of r
L 1
m   ri p (ri )
i 0
• For example, the second moment (also the variance of r) is
L 1
 2 (r )   (ri  m) 2 p (ri )
i 0
Use
Use of
of Histogram
Histogram Statistics
Statistics for
for Image
Image Enhancement
Enhancement

• Two uses of the mean and variance for enhancement


purposes:
– The global mean and variance (global means for the entire
image) are useful for adjusting overall contrast and
intensity.
– The mean and standard deviation for a local region are
useful for correcting for large-scale changes in intensity
and contrast. ( See equations 3.3-21 and 3.3-22.)
Use
Use of
of Histogram
Histogram Statistics
Statistics for
for Image
Image Enhancement
Enhancement
Example:
Example: Enhancement
Enhancement based
based onon local
local statistics
statistics
Use
Use of
of Histogram
Histogram Statistics
Statistics for
for Image
Image Enhancement
Enhancement
Example:
Example: Enhancement
Enhancement based
based onon local
local statistics
statistics
Use
Use of
of Histogram
Histogram Statistics
Statistics for
for Image
Image Enhancement
Enhancement
Example:
Example: Enhancement
Enhancement based
based onon local
local statistics
statistics
Enhancement
Enhancement Using
Using Arithmetic/Logic
Arithmetic/Logic Operations
Operations

• Two images of the same size can be combined using


operations of addition, subtraction, multiplication, division,
logical AND, OR, XOR and NOT. Such operations are done on
pairs of their corresponding pixels.
• Often only one of the images is a real picture while the other
is a machine generated mask. The mask often is a binary
image consisting only of pixel values 0 and 1.
• Example: Figure 3.27
Enhancement
Enhancement Using
Using Arithmetic/Logic
Arithmetic/Logic Operations
Operations

AND

OR
Image
Image Subtraction
Subtraction
Example
Example 11
Image
Image Averaging
Averaging

• When taking pictures in reduced lighting (i.e., low


illumination), image noise becomes apparent.
• A noisy image g(x,y) can be defined by
g ( x, y )  f ( x, y )   ( x, y )
where f (x, y): an original image
 ( x, y ): the addition of noise
• One simple way to reduce this granular noise is to
take several identical pictures and average them, thus
smoothing out the randomness.
Noise
Noise Reduction
Reduction by
by Image
Image Averaging
Averaging
Example:
Example: Adding
Adding Gaussian
Gaussian Noise
Noise

• Figure 3.30 (a): An image


of Galaxy Pair NGC3314.
• Figure 3.30 (b): Image
corrupted by additive
Gaussian noise with zero
mean and a standard
deviation of 64 gray
levels.
• Figure 3.30 (c)-(f): Results
of averaging K=8,16,64,
and 128 noisy images.
Noise
Noise Reduction
Reduction by
by Image
Image Averaging
Averaging
Example:
Example: Adding
Adding Gaussian
Gaussian Noise
Noise

• Figure 3.31 (a):


From top to bottom:
Difference images
between Fig. 3.30 (a)
and the four images in
Figs. 3.30 (c) through
(f), respectively.

• Figure 3.31 (b):


Corresponding
histogram.

You might also like