Title: Point Operations and The Histogram
1Point OperationsandThe Histogram
Image Processing - Lesson 3
2Image Operations
- Pixel Operations
- Operation depends on Pixel's value.
- Context free.
- Operation can be performed on the Histogram.
- Example
- Geometric Operations
- Operation depend on Pixel's coordinates.
- Context free.
- Independent of pixels value.
- Example
- Spatial Operations
- Operation depends on Pixel's value and
coordinates. - Context dependent.
- Binary v.s. Gray-Scale images.
- Spatial v.s. Frequency domain.
- Example
3The Image Histogram
- Point operations depend on pixels value and can
be performed on image histogram. - Image Histogram
- Normalized Histogram
- where N is the total number of pixels in the
image I. - PI(k) defines the probability to get the value k
in the image I. - Accumulated Histogram
- A(k) is the prob. that a pixel has a value less
or equal to k - Note that A(k)-A(k-1)P(k)
HI(k) pixels with gray-level k
PI(k)H(k)/N
4Histogram
15000
10000
5000
0
1
2
3
4
5
6
7
8
9
10
gray level
Normalized Histogram
0.25
0.2
0.15
0.1
0.05
0
1
2
3
4
5
6
7
8
9
10
gray level
Accumulated Histogram
1
0.8
0.6
0.4
0.2
0
1
2
3
4
5
6
7
8
9
10
gray level
5The Image Histogram (Cont.)
PI(k)
1
k
PI(k)
1
0.5
k
PI(k)
0.1
k
6- Decreasing the image contrast
- Increasing the new image average
PI(k)
0.1
k
0.5
PI(k)
0.1
k
PI(k)
0.1
k
7Histogram properties
- The image mean
- The image s.t.d.
mean
std
8Uses of the Histogram
- Digitizing parameters
- Auto focus
- Enhancement
- Histogram equalization
- Histogram stretching
- Threshold selection
- Histogram matching
9Auto-Focus
- In some optical equipment (e.g. slide projectors)
inappropriate lens position creates a blurred
(out-of-focus) image. - We would like to automatically adjust the lens.
Demo
10- Blurred image can be detected by its histogram
- Image mean is not affected by blurring.
- Image s.t.d. is decreased by blurring.
- Algorithm Adjust lens according the changes in
the histogram s.t.d.
11Thresholding
knew
F(k)
255
kold
255
Threshold value
12Thresholding Value
Original Image
Binary Image
Threshold too high
Threshold too low
13Segmentation using Thresholding
Original
Histogram
50
75
Threshold 75
Threshold 50
14Original
Histogram
21
Threshold 21
15Point Operations
- A point operation can be defined as a function
- knewF(kold)
- F(k) takes any value kold in the source image
into knew in the destination image. - Example knewF(kold)kold10
- increasing brightness
- knewF(kold)round(kold0.8)
- decreasing contrastbrightness
16Point Operations
- Simplest case - Linear Mapping
-
knew
F(k)
q
p
kold
p
q
17- If it is required to map the full gray-level
range (256 values) to its full range - A
piecewise linear mapping is required
knew
F(k)
255
stretching
kold
255
contraction
18Clipping Function
- If most of the gray-levels in the image are in
u1 u2, the following mapping increases the
image contrast. - What is F(k)?
knew
F(k)
255
kold
u1
u2
255
19knew
255
F(k)
kold
255
?
20Applying Point Operations on an image
- Given a point operation
- kbF(ka)
- F(ka) takes any value ka in image A into kb in
image B.
kb
F(k)
ka
21Image Statistics (Histograms)
Ia
Ha
Aa
F(k)
Ib
Ab
Hb
Histogram of Ia differs from that of Ib.
22Is it possible to obtain Hb directly from Ha and
F(k)?
k
kb
F(k)
ka
Hb
Ha
k
23Is it possible to obtain Ab directly from Aa and
F(k)?
- Requirement F is an increasing function
- (F-1 exists).
- Since F(k) is monotonic, the area under Ha
between 0 and ka is equal to the area under Hb
between 0 and kb
k
kb
F(k)
ka
Hb
Ha
k
24The histogram of image B can be calculated
Ia
Ha
Aa
F(k)
Ib
Ab
Hb
25If F(k) is not increasing?
- Requirement F is a non-decreasing function
(F-1 may/may not exists).
k
kb
F(k)
ka
Hb
Ha
k
26- Is it possible to obtain F(k) directly from Ha
and Hb (Aa and Ab)?
Ia
Ha
Aa
F(k)
Ib
Ab
Hb
27Example Finding F(k) for Gray Level Separation
Visual discrimination between objects depends on
the their gray-level separation. Can we improve
discrimination AFTER image has been quantized?
Hard to discriminate
3 4
Doesnt help
23 24
This is better
23
3
??????
3 4
23 24
28Histogram Equalization
- For better visual discrimination we would like to
re-assign gray-levels with maximal uniformity. - Define a gray-level transformation
- such that
- The histogram Hb is as flat as possible.
- The order of Gray-levels is maintained.
- The histogram bars are not fragmented.
Hb
Ha
k
k
29Histogram Equalization
Ha
Hb
k
k
Aa
Ab
k
k
Define
30Histogram Equalization 2 Pointer Algorithm
Method Aa -gt Ab
Original
Goal
Aa
Ab
k
k
j Pnew
31Histogram Equalization 2 Pointer Algorithm
Method Ha -gt Hb
Original
Goal
Pnew
old
0 1 2 3 4 5 6 7 8 9 10 11 0 0 0 1 1 1 3 5 8 9 9
11
new
3230
25
20
15
10
5
0
0
1
2
3
4
5
6
7
8
9
10
11
old
0 1 2 3 4 5 6 7 8 9 10 11 0 0 0 1 1 1 3 5 8 9 9
11
new
33(No Transcript)
34Histogram Equalization - Example
Original
Equalized
Demo
352 Pointer Algorithm
2-pointer Histogram Equalization Algorithm
Pold 0 Pnew 0 E_levelsum(Hist)/K
BucketE_level while (Pold ? k) if
Hist(Pold) lt Bucket Bucket
Bucket - Hist(Pold) New_Gray(Pold) Pnew
Pold else Hist(Pold)
Hist(Pold)-Bucket Bucket E_level Pnew
end end
K number of gray-level values. Hist A vector
with the original histogram. New_gray A vector
with the gray-level transformation.
36Histogram Matching
- Transforms an image A so that its histogram
matches that of another image B. - Could be used before comparing two images of the
same scene acquired under different lighting
condition.
Aa
Ab
D
D
37Application Texture Synthesis(Heeger Bergen
1995)