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

CV Lecture 4

The document discusses various image enhancement techniques including histogram equalization, which reassigns intensity values to produce a uniform distribution and improve contrast. Histogram equalization calculates the cumulative distribution function (CDF) of the intensity values and maps each value to its normalized CDF, resulting in an equalized histogram that uses the full dynamic range. Power law transformations and logarithmic transforms can also improve contrast by modifying intensity values according to mathematical functions.

Uploaded by

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

CV Lecture 4

The document discusses various image enhancement techniques including histogram equalization, which reassigns intensity values to produce a uniform distribution and improve contrast. Histogram equalization calculates the cumulative distribution function (CDF) of the intensity values and maps each value to its normalized CDF, resulting in an equalized histogram that uses the full dynamic range. Power law transformations and logarithmic transforms can also improve contrast by modifying intensity values according to mathematical functions.

Uploaded by

Lovely doll
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 52

Computer Vision

CSC-455
Muhammad Najam Dar
Today’s Lecture

 Image Enhancement
 Histogram Equalization
 Image filtering
Image Enhancement
Image Enhancement
Image Enhancement

Process an image so that the result is more suitable than the original image for a
specific application

 Image Enhancement Methods


 Spatial Domain: Direct manipulation of pixels in an
image
 Frequency Domain: Process the image by
modifying the
Fourier transform of an image
This Chapter – Spatial Domain
Types of image enhancement operations

 Point/Pixel operations
Output value at specific coordinates
(x,y) is dependent only on the input
value at (x,y)

 Local operations
The output value at (x,y) is dependent
on the input values in the
neighborhood of (x,y)

 Global operations
The output value at (x,y) is dependent
on all the values in the input image
Point Processing Example: Thresholding

 Segmentation of an object of interest from a


background

1.0 r > threshold


s=
0.0 r <=
threshold
Point Processing Example: Intensity Scaling

s  T (r) 
a.r
Point Processing Example: Negative Images

 Reverses the gray level order


 For L gray levels, the transformation has the
form:
s  (L 1) 
r
 Negative images are useful for enhancing white or grey detail embedded in
dark regions of an image
Point Processing Example: Negative Images
Logarithmic Transformations

 The general form of the log transformation is

s  c  log(1
 r) a narrow range of low input grey level values
The log transformation maps
into a wider range of output values
 The inverse log transformation performs the opposite transformation
Logarithmic Transformations

 Properties
 For lower amplitudes of
input image the range of
gray levels is expanded
 For higher amplitudes
of input image the range
of gray levels is
compressed
Logarithmic Transformations

 Application
 This transformation is suitable for the case when
the dynamic range of a processed image far
exceeds the capability of the display device (e.g.
display of the Fourier spectrum of an image)
 Also called “dynamic-range compression / expansion”
Logarithmic Transformations

Fourier spectrum: image values The result of log


ranging from 0 to 1.5x106 transformation with
c=1
Power Law Transformations

 Power law transformations have the following form

s  c  r
 Map a narrow range
of dark input values
into a wider range of
output values or vice
versa
 Varying γ gives a
whole
family of curves
Power Law Transformations
 For < Expands values of dark pixels, compress
1: values of brighter pixels
 For  > 1: Compresses values of dark
expand pixels,
 If =1 & values of brighter pixels
c=1: Identity transformation (s =
r)
 A variety of devices (image capture, printing, display)
respond to a power law and need to be
according
corrected
Power Law Transformations: Gamma Correction
Power Law
Transformations
Contrast Enhancement

The images to the


right show a
magnetic resonance
(MR) image of a
fractured human
spine
Power Law
Transformations
Contrast Enhancement
γ = 0.6
1
0.
9
Transformed Intensities

0.
8
0.
7
0.
6
0.
5
0.
4 0 0.2 0.4 0.6 1
0.8
0.
3 Old Intensities
0.
2
Power Law
Transformations
Contrast Enhancement
γ = 0.4
1
0.9
Transformed Intensities

0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original Intensities
Power Law
Transformations
Contrast Enhancement
γ = 0.3
1
0.9
Transformed Intensities

0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original Intensities
Power Law
Transformations
Contrast Enhancement

Result after Result after Result after


MR image of
Power law Power law Power law
fractured human spine transformation
transformation transformation
c = 1,  = 0.6 c = 1,  = 0.4 c = 1,  = 0.3
Power Law
Transformations
Contrast Enhancement

When the γ is reduced too


much, the image begins to
reduce contrast to the
point where the image
started to have very slight
“wash-out” look.
Power Law
Transformations
Contrast Enhancement

Image has a washed-out


appearance – needs γ > 1
Power Law
Transformations
Contrast Enhancement
Result of
Aerial
Power law
Image transformation
c = 1,  = 3.0
(suitable)

Result of
Power law
Result of transformation
Power law c = 1,  = 5.0
transformation (high contrast,
c = 1,  = 4.0 some regions are
(suitable too dark)
)
Histogram of a Grayscale Image
Black marks
pixels with
intensity g

Plot of histogram:
number of pixels with intensity g
Histogram of a Color Image
Histogram: Example
Dark image
Components of
histogram are
concentrated on
the low side
of the gray
scale

Bright image
Components of
histogram are
concentrated on
the high side
of the gray
scale
Contrast Stretching

Improve the contrast in an


image by `stretching' the
range of intensity values it
contains to span a desired
range of values, e.g. the
the full range of pixel
values
Contrast Stretching
Histogram
Equalization
Histogram equalization re-assigns the intensity values of pixels in the input
image such that the output image contains a uniform distribution of intensities
HISTOGRAM
EQUALIZATION
AERIAL PHOTOGRAPH OF THE
PENTAGON

Resulting image uses more of dynamic range.


Resulting histogram almost, but not completely,
flat.
Histogram Equalization
Histogram Equalization
before
Luminosity

after

J r, c   255  PI  I r,

c   .
Histogram Equalization: Example

An 8x8 image
Histogram Equalization: Example
Fill in the following table/histogram

Image Histogram (Non-zero values)


Histogram Equalization: Example

Image Histogram (Non-zero values shown)


Histogram Equalization: Example
Histogram Equalization: Example

Cumulative Distribution Function (cdf)

Image Histogram/Prob Mass Function


Histogram Equalization: Example

Cumulative Distribution Function (cdf)


Histogram Equalization: Example

Cumulative Distribution Function (cdf)


Histogram Equalization: Example

Normalized Cumulative Distribution Function (cdf)

Divide each value by total number of


pixels (64) to get the normalized cdf
Histogram Equalization: Example
J r, c   255  PI  I r,
If cdf is normalized
 . (255.cdf (r))
s  cround
If cdf is NOT normalized

cdf (r )
s  round (255. )
M
N
s  round (255. 46 /

64 )
s  183
183

Original Image
Histogram Equalization: Example
Histogram Equalization: Example

Original Image Corresponding histogram (red) and


cumulative histogram (black)

Image after histogram Corresponding histogram (red) and


equalization cumulative histogram (black)
Histogram Equalization: Example

Equalized Histogram
Dark image
Bright image

Equalized Histogram
Histogram Equalization: Example

Equalized Histogram
Low contrast
High Contrast

Equalized Histogram
IMAGE ENHANCEMENT IN THE
SPATIAL DOMAIN
Poorly illuminated CCTV image and the result of histogram
equalisation.
Common Distance Definitions

D4 distance D8 distance
(city-block distance) (checkboard distance)

4 3 2 3 4 2 2 2 2 2
3 2 1 2 3 2 1 1 1 2
2 1 0 1 2 2 1 0 1 2
3 2 1 2 3 2 1 1 1 2
4 3 2 3 4 2 2 2 2 2

Euclidean distance
(2-norm)
References
 Some Slide material has been taken from Dr M. Usman Akram Computer Vision
Lectures
 CSCI 1430: Introduction to Computer Vision by James Tompkin
 Statistical Pattern Recognition: A Review – A.K Jain et al., PAMI (22) 2000
 Pattern Recognition and Analysis Course – A.K. Jain, MSU
 Pattern Classification” by Duda et al., John Wiley & Sons.
 Digital Image Processing”, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley,
2002
 Machine Vision: Automated Visual Inspection and Robot Vision”, David Vernon,
Prentice Hall, 1991
 www.eu.aibo.com/
 Advances in Human Computer Interaction, Shane Pinder, InTech, Austria, October
2008
 Computer Vision A modern Approach by Frosyth
 http://www.cs.cmu.edu/~16385/s18/

You might also like