0% found this document useful (0 votes)
6 views37 pages

Week 2 Lecture Part 2

The document covers image enhancement techniques in the spatial domain, focusing on histogram processing and equalization. It explains the significance of image histograms in visual detail enhancement and noise reduction. The lecture also introduces concepts like contrast stretching and the transformation functions used in histogram equalization.

Uploaded by

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

Week 2 Lecture Part 2

The document covers image enhancement techniques in the spatial domain, focusing on histogram processing and equalization. It explains the significance of image histograms in visual detail enhancement and noise reduction. The lecture also introduces concepts like contrast stretching and the transformation functions used in histogram equalization.

Uploaded by

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

Computer Vision

Image Enhancement
Histogram Processing
Instructor Name
Ms. Kashia Riaz
Contents
Over the next few lectures we will look at image
enhancement techniques working in the spatial
domain:
▪ Recap
▪ Different kinds of image enhancement
▪ Histograms
▪ Histogram equalization

2
A Note About Grey Levels
▪ So far when we have spoken about image grey level
values, we have said they are in the range [0, 255]
- Where 0 is black and 255 is white

▪ There is no reason why we have to use this range


- The range [0,255] stems from display technologies
▪ For many of the image processing operations in
this lecture grey levels are assumed to be given in
the range [0.0, 1.0]

3
What Is Image Enhancement?

Image enhancement is the process of making


images more useful
The reasons for doing this include:
▪ Highlighting interesting detail in images
▪ Removing noise from images
▪ Making images more visually appealing

4
Image Enhancement Examples

5
Image Enhancement Examples (cont.…)

6
Image Enhancement Examples (cont.…)

7
Spatial & Frequency Domains

There are two broad categories of image enhancement


techniques
▪ Spatial domain techniques
▪ Direct manipulation of image pixels
▪ Frequency domain techniques
▪ Manipulation of Fourier transform or wavelet
transform of an image
For the moment we will concentrate on techniques that
operate in the spatial domain

8
Image Histograms
▪ The histogram of an image shows us the
distribution of grey levels in the image
▪ Massively useful in image processing, especially in
segmentation
Frequencies

Grey Levels 9
Histogram Examples

10
Histogram Examples (cont.…)

11
Histogram Examples (cont.…)
Histogram Examples (cont.…)

13
Histogram Examples (cont.…)

14
Histogram Examples (cont.…)

15
Histogram Examples (cont.…)

16
Histogram Examples (cont…)

17
Histogram Examples (cont.…)

18
Histogram Examples (cont.…)

19
Histogram Examples (cont.…)
▪ A selection of images and
their histograms
▪ Notice the relationships
between the images and
their histograms
▪ Note that the high contrast
image has the most
evenly spaced histogram

20
Contrast Stretching

▪ We can fix images that have poor contrast by


applying a pretty simple contrast specification
▪ The interesting part is how do we decide on
this transformation function?

21
Histogram Equalisation
Spreading out the frequencies in an image (or equalising the
image) is a simple way to improve dark or washed out
images
The formula for histogram
equalisation is given where sk = T ( rk )
▪ rk: input intensity k
▪ sk: processed intensity =  pr ( r j )
▪ k: the intensity range j =1
(e.g 0.0 – 1.0)
k nj
=
▪ nj: the frequency of intensity j
▪ n: the sum of all frequencies
j =1 n
22
Equalisation Transformation Function

23
Equalisation Examples

24
Equalisation Examples

25
Example
▪ Consider a 5x5 image with integer intensities in the
range between one and eight:

1 8 4 3 4
1 1 1 7 8
8 8 3 3 1
2 2 1 5 2
1 1 8 5 2

26
Example

n1 n 2 n3 n 4 n 5 n 6 n 7 n8
1 8 4 3 4
1 1 1 7 8
8 8 3 3 1
2 2 1 5 2
1 1 8 5 2

1 2 3 4 5 6 7 8

27
Histogram Function

n1 n 2 n3 n 4 n 5 n 6 n 7 n8

h( rk ) = nk

1 2 3 4 5 6 7 8

28
Histogram Function

ℎ(𝑟1 ) = 8
ℎ(𝑟2 ) = 4 n1 n 2 n3 n 4 n5 n6 n 7 n8
ℎ(𝑟3 ) = 3
ℎ(𝑟4 ) = 2
ℎ(𝑟5 ) = 2
ℎ(𝑟6 ) = 0
ℎ(𝑟7 ) = 1
ℎ(𝑟8 ) = 5

1 2 3 4 5 6 7 8

29
Normalised Histogram Function
▪ The normalised histogram function is the histogram
function divided by the total number of the pixels
of the image:
h(rk ) nk
p(rk ) = =
n n
▪ It gives a measure of how likely is for a pixel to
have a certain intensity. That is, it gives the
probability of occurrence the intensity.
▪ The sum of the normalised histogram function
over the range of all intensities is 1.

30
Normalised Histogram Function

h( r1 ) = 8 p (r1 ) = 8 / 25 = 0.32
h( r2 ) = 4 p (r2 ) = 4 / 25 = 0.16
h( r3 ) = 3 p (r3 ) = 3 / 25 = 0.12
h( r4 ) = 2 p (r4 ) = 3 / 25 = 0.08
h( r5 ) = 2 p (r5 ) = 2 / 25 = 0.08
h( r6 ) = 0 p (r6 ) = 0 / 25 = 0.00
h( r7 ) = 1 p (r7 ) = 1 / 25 = 0.04
h( r8 ) = 5 p (r8 ) = 5 / 25 = 0.20

31
Histogram Equalization

Normalised Intensity transformation


histogram function function

p (r1 ) = 0.32 T (r1 ) = 0.32


p (r2 ) = 0.16 T (r2 ) = 0.32 + 0.16 = 0.48
p (r3 ) = 0.12 T (r3 ) = 0.32 + 0.16 + 0.12 = 0.60
p (r4 ) = 0.08 T (r4 ) = 0.32 + 0.16 + 0.12 + 0.08 = 0.68
p (r5 ) = 0.08 T (r5 ) =
p (r6 ) = 0.00 T (r6 ) =
p (r7 ) = 0.04 T (r7 ) =
p (r8 ) = 0.20 T (r8 ) =
32
Histogram Equalization

The 32% of the pixels have


intensity r1. We expect
p (r1 ) = 0.32 T (r1 ) = 0.32 them to cover 32% of the
p (r2 ) = 0.16 T (r2 ) = 0.48 possible intensities.
p (r3 ) = 0.12 T (r3 ) = 0.60
The 48% of the pixels have
p (r4 ) = 0.08 T (r4 ) = 0.68 intensity r2 or less. We
p (r5 ) = 0.08 T (r5 ) = 0.76 expect them to cover 48%
of the possible intensities.
p (r6 ) = 0.00 T (r6 ) = 0.76
p (r7 ) = 0.04 T (r7 ) = 0.80 The 60% of the pixels have
intensity r3 or less. We
p (r8 ) = 0.20 T (r8 ) = 1.00 expect them to cover 60%
of the possible intensities.

……………………………
33
Histogram Equalization

34
Summary
We have looked at:
▪ Different kinds of image enhancement
▪ Histograms
▪ Histogram equalisation
Next time we will start to look at point processing
and some neighbourhood operations

35
Next Lecture
▪ What is point processing?
▪ Negative images
▪ Thresholding
▪ Logarithmic transformation
▪ Power law transforms
▪ Grey level slicing
▪ Bit plane slicing

36
THANK YOU

37

You might also like