3.3 Histogram Processing - Histogram (直⽅圖) : - Histogram of a digital image is a distribution function h (r) = n
3.3 Histogram Processing - Histogram (直⽅圖) : - Histogram of a digital image is a distribution function h (r) = n
3 Histogram Processing
- Histogram (直⽅圖)
• Histogram of a digital image is a distribution function
h(rk) = nk
– where rk is the kth gray level
and nk is the number of pixels having gray level rk
nk
Normalized histogram
rk
credit of this slide: Y. P. Hung
Note that the high-contrast image usually has a more flat histogram
Note that the high-contrast image usually has a more flat histogram
Image
Enhancement
Histogram
Equalization
0 £ T (r ) £ L - 1, for 0 £ r £ L - 1
0 £ T (r ) £ L - 1, for 0 £ r £ L - 1
1 dr
1 dr
ps ( s ) = pr (r )ps ( s ) = pr (r ) = pr ( r )
ds ds ds
dr dr
https://www.pbr-book.org/3ed-2018/Monte_Carlo_Integration/Transforming_between_Distributions
1 dr
1 dr
ps ( s ) = pr (r )ps ( s ) = pr (r ) = pr ( r )
ds ds ds
dr dr
• The PDF of the output s is determined by the PDF of
the input r and the transformation T(r), which means
we can determine the histogram of the output image
= ( L - 1) pr (r )
fi
Uniform PDF
Uniform PDF
r
s = T (r ) = ( L - 1) ò pr ( w) dw
0
k
sk = T (rk ) = ( L - 1)å pr (rj )
j =0
(1)
(2)
(3)
(4)
Histogram equalization
does not always provide
the desirable results
rk zk
credit of this slide: C. Nikou
fi
Histogram Equalization:
s0 = 1, s1 = 3, s2 = 5, s3 = 6, s4 = 6, s5 = 7, s6 = 7, s7 = 7
fi
3.3 Histogram Processing
- Example of Histogram Speci cation
It is desired to transform this histogram to:
with z0 = 0, z1 = 1, z2 = 2, z3 = 3, z4 = 4, z5 = 5, z6 = 6, z7 = 7.
credit of this slide: C. Nikou
fi
3.3 Histogram Processing
- Example of Histogram Speci cation
It is desired to transform this histogram to:
Histogram Equalization:
G ( z0 ) = 0 G ( z1 ) = 0 G ( z2 ) = 0 G ( z3 ) = 1
G ( z 4 ) = 2 G ( z5 ) = 5 G ( z 6 ) = 6 G ( z 7 ) = 7
credit of this slide: C. Nikou
fi
3.3 Histogram Processing
- Example of Histogram Speci cation
Notice that G(z) may not be strictly monotonic. We must resolve this
ambiguity by choosing, e.g. the smallest value for the inverse mapping.
fi
3.3 Histogram Processing
- Example of Histogram Speci cation
Notice that due to discretization, the resulting histogram
will rarely be exactly the same as the desired histogram.
fi
3.3 Histogram Processing
- Example of Histogram Speci cation
fi
3.3 Histogram Processing
- Example of Histogram Speci cation
Specified histogram
Resulting histogram
fi
3.3 Histogram Processing
- Histogram Speci cation
• When multiple images of the same scene, but taken
under slightly different lighting conditions, are to be
compared
-- e.g., visual surveillance, image stitching, stereo, etc.
fi
fi
fi
3.3 Histogram Processing
- Local Histogram Processing
Original Image
Global Histogram Local Histogram Equalization
Equalization with a neighborhood of size 3x3
k0 = 0 k2 = 0
k1 = 0.1 k3 = 0.1
C = 22.8
• Coef cients
• Linear Filtering vs
Nonlinear Filtering
(e.g., median ltering)
fi
fi
• Coef cients
• Linear Filtering vs
Nonlinear Filtering
(e.g., median ltering)
fi
fi
3.4 Fundamentals of Spatial Filtering
- Spatial Filtering at the Edges
At the edges of an image we are missing pixels to
form a neighbourhood
Replicate Padding
Mirror Padding