ECE/OPTI533 Digital Image Processing class notes 138 Dr. Robert A. Schowengerdt 2003. IMAGE ENHANCEMENT I (RADIOMETRIC).
IMAGE ENHANCEMENT I (RADIOMETRIC) MOTIVATION • Recorded images often exhibit problems such as: • too dark • too light • not enough contrast
• Image enhancement aims to improve visual quality “Cosmetic” processing
• Usually empirical techniques, with ad hoc parameters (“whatever works”)
137
Dr. Robert A. Schowengerdt
2003
• Distinct from “restoration,” which is processing designed to recover true object using blur and noise reduction on a degraded image
ECE/OPTI533 Digital Image Processing class notes
DN1
LUT
LUT
GLB
GLG
GLR
D/A
D/A
D/A
R
G
B
RGB
IMAGE ENHANCEMENT I (RADIOMETRIC)
DN2
LUT
IMAGE DISPLAY
color image
DN3
• Input quantized image pixel values (integers): Digital Number (DN)
• Output quantized image pixel values (integers): Grey Level (GL)
138
Dr. Robert A. Schowengerdt
GLs are in display space, typically [0..255] in each color (red, green, blue)
ECE/OPTI533 Digital Image Processing class notes
2003
IMAGE ENHANCEMENT I (RADIOMETRIC)
• Mapping from DNs to GLs may be done with discrete hardware or software Look-Up Tables (LUTs) GL = LUT ( DN )
Dr. Robert A. Schowengerdt
2003
• Contrast enhancement techniques are designed to find a LUT that yields “optimal,” or at least “good,” displayed visual quality
139
Result is a radiometric enhancement of the displayed image, i.e features in the image become more easily seen
ECE/OPTI533 Digital Image Processing class notes
“global”
Dr. Robert A. Schowengerdt
“neighborhood”
“local”
IMAGE ENHANCEMENT I (RADIOMETRIC) IMAGE STATISTICS • Global image DN statistics useful for designing an image-specific LUT for entire image • Local image DN statistics useful for “adaptive” contrast enhancement algorithm, with varying LUT across image
140
• Neighborhood DN statistics useful for noise processing and spatial filtering enhancement, not contrast enhancement
ECE/OPTI533 Digital Image Processing class notes
2003
0.15
0.1
0.05
0 0
20
µ−σ
µ
40
60
80
Gaussian image
DN
Dr. Robert A. Schowengerdt
µ+σ
2003
100
Example normalized image histogram compared to the equivalent Gaussian distribution
IMAGE ENHANCEMENT I (RADIOMETRIC) Image Histogram • Number of pixels with the specific DN, tabulated for all DNs hist DN = pixel count ( DN ) • Divide by the total number of pixels in the image N to normalize normhist DN = count ( DN ) ⁄ N ≈ PDF ( DN ) Analogous to the continuous Probability Density Function (PDF) of statistics
141
• Contains no information about the spatial distribution of pixels
ECE/OPTI533 Digital Image Processing class notes
fraction of total pixels
1
0.8
0.6
0.4
0.2
0 0
20
40
60
Gaussian image
80
100
Dr. Robert A. Schowengerdt
DN
Example normalized image cumulative histogram compared to the equivalent Gaussian CDF
IMAGE ENHANCEMENT I (RADIOMETRIC) Cumulative Histogram
DN
∑ hist DN
• Number of pixels with a DN less than or equal to the specified DN
chist DN = DN = DN min
142
• Divide by the total number of pixels in the image N to normalize normchist DN = chist DN ⁄ N ≈ CDF ( DN ) Analogous to the Cumulative Distribution Function (CDF) of statistics
• Monotonic function of DN
ECE/OPTI533 Digital Image Processing class notes
fraction of total pixels
2003
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC) RADIOMETRIC ENHANCEMENT • Point processing every pixel undergoes the same transformation parameters of the transformation are: • fixed, from global statistics (entire image) or • adaptive, from local statistics
• Distinct from neighborhood processing (convolution) or global transforms (e.g. Fourier)
143
• Only improves visual content; does not add information to the data
ECE/OPTI533 Digital Image Processing class notes
2003
100
DNmax
100
150 DN
GL
200
200
250
300
250
255
GL
0
Dr. Robert A. Schowengerdt
DNmin
255 GL = -------------------------------------- ( DN – DN min ) DN max – DN min
150
144
DNmax
2003
DN
IMAGE ENHANCEMENT I (RADIOMETRIC)
DNmin
50
50
Min-Max Mapping
14000 12000 10000 8000 6000 4000
0
2000 0
14000 12000 10000 8000 6000 4000 2000 0 0
ECE/OPTI533 Digital Image Processing class notes
IMAGE ENHANCEMENT I (RADIOMETRIC) Histogram Modification
Dr. Robert A. Schowengerdt
• nonlinear “stretching” of the data to improve contrast
145
based on global or regional image statistics
ECE/OPTI533 Digital Image Processing class notes
2003
IMAGE ENHANCEMENT I (RADIOMETRIC) Histogram Equalization
x = M ( y)
–1
• Modify histogram to achieve uniform distribution of GL
y = M ( x)
• Look at continuous distributions for “proof” Mapping function from input to output:
Output PDF related to input PDF as:
dx PDF ( y ) = PDF ( x ) -----dy
desire output PDF that is flat, i.e. uniform distribution
x
∫ PDF ( α ) dα
146
Dr. Robert A. Schowengerdt
consider a transformation M that is the CDF of x: (we know the answer!)
y = M ( x) =
–∞
ECE/OPTI533 Digital Image Processing class notes
2003
dy ------ = PDF ( x ) dx 255
GL
0 DNmin
DNmax
Dr. Robert A. Schowengerdt
DN
IMAGE ENHANCEMENT I (RADIOMETRIC)
then
–1
x = M ( y)
147
substituting into above equation for PDF(y):
1 PDF ( y ) = PDF ( x ) ⋅ -------------------PDF ( x ) = [ 1 ] x = M –1 ( y ) = 1 • Discrete case is simply, GL = int [ 255chist ( DN ) ]
ECE/OPTI533 Digital Image Processing class notes
2003
50
100 GL
148
150
200
Dr. Robert A. Schowengerdt
250
IMAGE ENHANCEMENT I (RADIOMETRIC) output histogram 14000 12000 10000 8000 6000 4000
0
2000 0
ECE/OPTI533 Digital Image Processing class notes
2003
IMAGE ENHANCEMENT I (RADIOMETRIC) Histogram Matching
2003
• Modify histogram to match “reference” histogram, e.g. Gaussian –1
GL = normchist ref [ normchist ( DN ) ]
Dr. Robert A. Schowengerdt
DNref
• Can also be used to match histogram of one image to that of another, e.g multidate imagery of same scene
normchistref 1
normchist 1
0 DN
149
0
ECE/OPTI533 Digital Image Processing class notes
100 GL
150
200
250
IMAGE ENHANCEMENT I (RADIOMETRIC)
50
output histogram matched to Gaussian
14000 12000 10000 8000 6000 4000
0
2000 0
150
Dr. Robert A. Schowengerdt
• Produces “softer” contrast than histogram equalization
ECE/OPTI533 Digital Image Processing class notes
2003
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC) ADAPTIVE CONTRAST STRETCH • Adapts to “local” contrast differences
151
• Resulting contrast is more uniform across entire image
ECE/OPTI533 Digital Image Processing class notes
2003
152
MIN1, MAX1
MIN5, MAX5
MIN9, MAX9
MIN13, MAX13
Y
MIN2, MAX2 X LA,HA MIN6, MAX6
LD,HD MIN10, MAX10
LG,HG MIN14, MAX14
MIN3, MAX3
MIN7, MAX7
LB,HB
y LE,HE
MIN11, MAX11
LH,HH
MIN15, MAX15
MIN4, MAX4
LC,HC
MIN8, MAX8
LF,HF
MIN12, MAX12
LI,HI
MIN16, MAX16
Dr. Robert A. Schowengerdt
x
IMAGE ENHANCEMENT I (RADIOMETRIC) Local Range Modification (LRM) • Partition image into adjacent blocks, X x Y in size • Find the minimum DN L and maximum DN H in each block
ECE/OPTI533 Digital Image Processing class notes
2003
IMAGE ENHANCEMENT I (RADIOMETRIC)
,
MIN 5 = minimum ( L A, L D )
Dr. Robert A. Schowengerdt
• Find the neighboring minimum and maximum L and H values at the intersecting nodes, e.g. MIN 6 = minimum ( L A, L B, L D, L E ) MAX 6 = maximum ( H A, H B, H D, H E )
=
LA
• In the corners and along the edges, e.g. MIN 1
153
MAX 1 = H A MAX 5 = maximum ( H A, H D )
ECE/OPTI533 Digital Image Processing class notes
2003
IMAGE ENHANCEMENT I (RADIOMETRIC)
• Linearly interpolate the expected output GL minimum and maximum at each pixel from these values x X–x Y–y GL min = ---- ⋅ MIN 7 + ------------ ⋅ MIN 6 ⋅ ------------ X Y X X–x y x + ---- ⋅ MIN 11 + ------------ ⋅ MIN 10 ⋅ -- X Y X x X–x Y–y GL max = ---- ⋅ MAX 7 + ------------ ⋅ MAX 6 ⋅ ------------ X Y X X–x y x + ---- ⋅ MAX 11 + ------------ ⋅ MAX 10 ⋅ -- X Y X
154
Dr. Robert A. Schowengerdt
2003
• Linear interpolation insures that we’re always within a specified output range, e.g. [0..255] MIN ≤ GL min ≤ MAX MIN ≤ GL max ≤ MAX ECE/OPTI533 Digital Image Processing class notes
IMAGE ENHANCEMENT I (RADIOMETRIC)
• Finally, calculate a linear stretch at each pixel using the estimated minimum and maximum range values 255 GL = ------------------------------------ ( DN – GL min ) GL max – GL min • Sensitive to block size too large produces little adaptivity to local contrast too small produces “halo” artifact near high contrast boundaries find “best” block size by trial-and-error
• Reference:
155
Dr. Robert A. Schowengerdt
2003
J. D. Fahnestock and R. A. Schowengerdt, "Spatially - variant Contrast Enhancement using Local Range Modification,” Opt. Eng., 22(3), p. 378 - 381, May - June 1983.
ECE/OPTI533 Digital Image Processing class notes
156
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC) IMAGE EXAMPLES original
ECE/OPTI533 Digital Image Processing class notes
2003
157
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC)
min-max stretched
ECE/OPTI533 Digital Image Processing class notes
2003
158
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC)
histogram equalized
ECE/OPTI533 Digital Image Processing class notes
2003
159
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC)
Gaussian stretched
ECE/OPTI533 Digital Image Processing class notes
2003
160
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC)
LRM stretched (block size = 100)
ECE/OPTI533 Digital Image Processing class notes
2003
161
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC)
LRM stretched (block size = 50)
ECE/OPTI533 Digital Image Processing class notes
2003
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC) COLOR IMAGE CONTRAST ENHANCEMENT • Can apply monochrome techniques to each color component (“band”)
162
• Sometimes leads to undesirable color shifts and poor color balance • More later on color image enhancement . . .
ECE/OPTI533 Digital Image Processing class notes
2003
163
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC) example original
ECE/OPTI533 Digital Image Processing class notes
2003
164
Dr. Robert A. Schowengerdt
IMAGE ENHANCEMENT I (RADIOMETRIC) histogram equalized in each band
ECE/OPTI533 Digital Image Processing class notes
2003