Professional Documents
Culture Documents
Lect3-Filtering in Spatial Domain I
Lect3-Filtering in Spatial Domain I
Lecture 3
Image Enhancement
Slides modified from materials provided by Drs. Yiming Xiao & Tien Bui
2
In Spatial domain
(Transform on pixels) In Frequency domain
(Fourier transforms)
Linear- Log-
Transform Transform
ation ation
Laplacian-
Median Etc. based Filters
Histogram filter (2nd derivative)
Equalization Average Gradient-
filter based Filters
(1st derivative)
4
Enhancement
equalization
Histogram
https://pyimagesearch.com/
Denoising
Restoration
J. V. Manjon, et al. Journal of Magnetic Resonance Imaging, 2010.
5
Image Enhancement I:
Pixel-wise Operations
6
Pixel
4-Neighbors 8-Neighbors
7
Pixel
T
255
No change
S=T(r)
Black 0 r 255
8
Negative of an image
Original Negative
9
(r2,s2)
(r1,s1)
m
11
original processed
12
s
Gamma Correction
Luminance
Gamma Correction
15
16
Fracture
original γ=0.6
γ=0.4 γ=0.3
17
original γ=3
γ=4 γ=5
18
1
1
0
0
0
0
1
0
194
19
Bit-8 Bit-7
Histogram Processing
9
7
5
Histogram:
Graylevel
21
Histogram Processing
22
Histogram Processing:
• You can also use fewer, larger bins to trade off amplitude
23
Histogram Processing
Example:
25
Take a break!
26
27
Histogram Equalization
• The general idea: map the histogram of the
given image to a flat histogram by performing
a nonlinear operation on the gray value at
each pixel.
Histogram Equalization
• Consider the histogram of the given (continuous grayscale)
image as a pdf p(r), where r is in the interval [0,L-1].eg L=256
– Recall that as a pdf we have
Histogram Equalization
• Consider continuous values of intensity
• r = gray level of image to be equalized in the range [0, L-1]
0 : black
L-1: white
Goal is to design a transformation
(For PDF and CDF see pages 32-34 of the Review Slides)
31
Discrete Case
max intensity
new value input value
32
Example
s0 = 1
s1 = 3
s2 = 5
s3 = 6
s4 = 6 8 grey levels
s5 = 7 n = MxN
s6 = 7
s7 = 7
Example: 3-bit image, L= 8, image size = n = 64x64 = 4096, intensity levels [0,7].
Therefore, p0(r0) = 790/4096 = 0.19, etc…
Note that the gray levels are integers so the values of the equalized histogram
are: s0 = 1, s1 = 3, s2 = 5, s3 = s4 = 6, s5 = s6 = s7 = 7.
33
34
Generalizations
Histogram Matching
• Rather than uniform we want to match as closely as
possible to a desired, given pdf.
• r = pixel value before matching
• z = pixel value after matching
• We can compute from the given image, and is given.
What is the Transformation from r to z ?
• In the continuous case:
Approach
Method:
39
Approach
(L-1)
original target
transform Result
40
original target
Approach
transform Result
Method:
s0 = 1, s1 = 3, s2 = 5, s3 = s4 = 6, s5 = s6 = s7 = 7.
G0 = G1 = G2 = 0, G3 = 1 (round-off), G4 = 2, G5 = 5, G6 = 6, G7 =7.
41
target
original
transform Result
42
Histogram
Equalization
More details
44
target
histogram
Transform
Original
histogram
Result
original
45
scikit-image.org
46
https://www.geeksforgeeks.org/adaptive-histogram-equalization-in-
image-processing-using-matlab/
Multi-Image “Averaging”
• It may be possible to obtain multiple noise-
corrupted images of a scene and average them
to obtain a less noisy result.
• It is important that there be no motion between
the frames, or that the frames be aligned first.
Given:
Compute:
50
Simple Averaging
Example: Additive noise =
Gaussian with zero
mean & standard
deviation of 64 grey
Original add noise levels
k=8 k=16
Averaging k times
k=64 k=128
51
Given:
Compute:
Given the noise statistics of the measured images, what should these
coefficients be to yield the “best” results?
weights
Summary
• Point processing
✓ Contrast stretching
✓ Intensity slicing
✓ Gamma correction
✓ Bit-plane slicing
• Histogram processing
✓ Histogram equalization (global & local)
✓ Histogram matching
• Multi-image averaging
✓ Simple averaging
✓ Optimal/adaptive averaging
55
https://www.youtube.com/watch?v=-RDYHXwJ1LY