Introduction to Computer Vision
Lecture 4
Pixel-wise operations and Histograms
Pixel-wise operations
I[i,j] : gray-value at pixel (i,j)
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
j
Pixel-wise operations
I[i,j] : gray-value at pixel (i,j)
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
I[i,j]=I[2,4]= 8
j
Pixel-wise operations
Pixel-wise operations I -> J
J[i,j] = I[i,j] + 10 for all i,j
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
j
Pixel-wise operations
Pixel-wise operations I -> J
J[i,j] = I[i,j] + 10 for all i,j J[i,j] = I[i,j] * 2 for all i,j
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
j
Pixel-wise operations
Pixel-wise operations I -> J
J[i,j] = I[i,j] + 10 for all i,j J[i,j] = I[i,j] * 2 for all i,j J[i,j] = I[i,j] / 2 + 10
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
j
Pixel-wise operations
Pixel-wise operations I -> J
J[i,j] = I[i,j] + 10 for all i,j J[i,j] = I[i,j] * 2 for all i,j J[i,j] = I[i,j] / 2 + 10
J[i,j] = log(I(i,j)) for all i,j
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
j
Pixel-wise operations
Pixel-wise operations I -> J
J[i,j] = I[i,j] + 10 for all i,j J[i,j] = I[i,j] * 2 for all i,j J[i,j] = I[i,j] / 2 + 10
J[i,j] = log(I(i,j)) for all i,j
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
j
Pixel-wise operations
Pixel-wise operations I -> J
J[i,j] = f(I[i,j]) for all i,j
0 50 61 22 11 11
0 1 2 3 4 5
0 2 200 6 8 10
0 3 250 9 12 15
21 4 8 12 101 20
10 5 10 15 20 25
i
j
Image Histograms
Image Histograms
0 5 6 2 1 1
0 1 2 3 4 7
0 2 2 6 8 6
0 3 2 7 2 6
1 4 8 2 1 2
0 5 1 5 2 2
Consider a 3-bit image:
I[i,j] ∈ {0,1,2,3,4,5,6,7}
histogram:
[ ?, ?, ?, ?, ?, ?, ?, ?]
0 1 2 3 4 5 6 7
Image Histograms
0 5 6 2 1 1
0 1 2 0 4 7
0 2 2 6 8 6
0 3 2 7 2 0
1 4 8 2 1 2
4 5 1 5 2 2
Consider a 3-bit image:
I[i,j] ∈ {0,1,2,3,4,5,6,7}
histogram:
[ ?, ?, ?, ?, ?, ?, ?, ?]
0 1 2 3 4 5 6 7
Image Histograms
0 5 6 2 1 1
0 1 2 0 4 7
0 2 2 6 8 6
0 3 2 7 2 0
1 4 8 2 1 2
4 5 1 5 2 2
Consider a 3-bit image:
I[i,j] ∈ {0,1,2,3,4,5,6,7}
histogram:
[6, ?, ?, ?, ?, ?, ?, ?]
0 1 2 3 4 5 6 7
Image Histograms
0 5 6 2 1 1
0 1 2 0 4 7
0 2 2 6 6 6
0 3 2 7 2 0
1 4 7 2 1 2
4 5 1 5 2 2
Consider a 3-bit image:
I[i,j] ∈ {0,1,2,3,4,5,6,7}
histogram:
[6, 6,10, 1, 3, 3, 4, 3]
0 1 2 3 4 5 6 7
Image Histograms
0 5 6 2 1 1
0 1 2 0 4 7
0 2 2 6 6 6
0 3 2 7 2 0
1 4 7 2 1 2
4 5 1 5 2 2
Consider a 3-bit image:
I[i,j] ∈ {0,1,2,3,4,5,6,7}
histogram:
[6, 6,10, 1, 3, 3, 4, 3]
0 1 2 3 4 5 6 7
hist = [6, 6,10, 1, 3, 3, 4, 3]
hist[v] =
|
{(i,j) | I[i,j] = v}|
Image Histograms
0 5 6 2 1 1
0 1 2 0 4 7
0 2 2 6 6 6
0 3 2 7 2 0
1 4 7 2 1 2
4 5 1 5 2 2
[6, 6,10, 1, 3, 3, 4, 3]
0 1 2 3 4 5 6 7
10 9 8 7 6 5 4 3 2 1
Image Histograms
0 5 6 2 1 1
0 1 2 0 4 7
0 2 2 6 6 6
0 3 2 7 2 0
1 4 7 2 1 2
4 5 1 5 2 2
[6, 6,10, 1, 3, 3, 4, 3]
0 1 2 3 4 5 6 7
10 9 8 7 6 5 4 3 2 1
Area under histogram = ?
Image Histograms
0 5 6 2 1 1
0 1 2 0 4 7
0 2 2 6 6 6
0 3 2 7 2 0
1 4 7 2 1 2
4 5 1 5 2 2
[6, 6,10, 1, 3, 3, 4, 3]
0 1 2 3 4 5 6 7
10 9 8 7 6 5 4 3 2 1
Area under histogram = # of pixels
Algorithms
Normalized Histogram
hist[v] = | {(i,j) | I[i,j] = v} |
norm_hist[v] = | {(i,j) | I[i,j] = v} | / (#pixels)
Normalized Histogram
hist[v] = | {(i,j) | I[i,j] = v} |
norm_hist[v] = | {(i,j) | I[i,j] = v} | / (#pixels)
= | {(i,j) | I[i,j] = v} | / (area-under-histogram)
Normalized Histogram
hist[v] = | {(i,j) | I[i,j] = v} |
norm_hist[v] = | {(i,j) | I[i,j] = v} | / (#pixels)
= | {(i,j) | I[i,j] = v} | / (area-under-histogram)
● Area under normalized-histogram?
Cumulative Histograms
hist[v] = | {(i,j) | I[i,j] = v} |
cumhist[v] = | {(i,j) | I[i,j] ≤ v} |
Cumulative Histograms
hist[v] = | {(i,j) | I[i,j] = v} |
cumhist[v] = | {(i,j) | I[i,j] ≤ v} |
hist = [6, 6,10, 1, 3, 3, 4, 3]
cumhist = ?
Cumulative Histograms
hist[v] = | {(i,j) | I[i,j] = v} |
cumhist[v] = | {(i,j) | I[i,j] ≤ v} |
hist = [6, 6,10, 1, 3, 3, 4, 3]
cumhist = [6,12,22,23,26,29,33,36]
Information inferred
● Dynamic range
● Underexposed and Overexposed (saturated) images
●
Brightness
Properties
● Pixel Location?
Contrast
●
Over-exposed images
Intensity Windowing
Histogram Equalization
Binning
Color Histograms
References
● CS 545/ECE 545 Digital Image Processing, Spring Semester 2014, Prof Emmanuel Agu
● Digital Image Processing: Bernd Girod, 2013 Stanford University