Image Enhancement - National Cheng Kung University

Download Report

Transcript Image Enhancement - National Cheng Kung University

Chapter 4
Image Enhancement
Analysis and applications of remote
sensing imagery
Instructor: Dr. Cheng-Chien Liu
Department of Earth Sciences
National Cheng Kung University
Last updated: 9 May 2005
Introduction
 Why image enhancement?
• Mind  excellent interpreter
• Eye  poor discriminator
• Computer  amplify the slight differences to make
them readily observable
 Categorization of image enhancement
• Point operation
• Local operation
 Order
• Restoration  noise removal  enhancement
Introduction (cont.)
 Content
•
•
•
•
Contrast manipulation
Spatial feature manipulation
Multi-spectral manipulation
Direct De-correlation Stretch (DDS)
Contrast manipulation
 Gray-level thresholding
• Segment
• Fig 7.11
(a) TM1
(b) TM4
(c) TM4 histogram
(d) TM1 brightness variation in water areas only
 Level-slicing
• Divided into a series of analyst-specified slices
• Fig 7.12
Exercise 1
 Thresholding and level-slicing in ENVI
•
•
•
•
File: C:\RSI\IDL60\examples\data\mineral.png
Examine the histogram of the image
Basic Tools  Segmentation image
Overlay  Density Slice
Apply
Edit range
Options  Set Number of Default Ranges
Options  Apply Default Ranges
Contrast manipulation (cont.)
 Contrast stretching
• Accentuate the contrast between features of interest
• Fig 7.13
 (a) Original histogram
 (b) No stretch
 (c) Linear stretch
 Fig 7.14: linear stretch algorithm, look-up table (LUT) procedure
 (d) Histogram-equalized stretch
 (e) Special stretch
• Fig 7.15: Effect of contrast stretching
 (a) Features of similar brightness are virtually indistinguishable
 (b) Stretch that enhances contrast in bright image areas
 (c) Stretch that enhances contrast in dark image areas
• Non-linear stretching: sinusoidal, exponential, …
• Monochromatic  color composite
Exercise 2
 Equalizing with Histograms
• Source code refer to “Image processing in IDL” page 421
• PRO Chap4Ex2
• ; Import the image from the file.




file = FILEPATH('mineral.png', $
SUBDIRECTORY = ['examples', 'data'])
image = READ_PNG(file, red, green, blue)
imageSize = SIZE(image, /DIMENSIONS)
• ; Initialize the display.
 DEVICE, DECOMPOSED = 0
 TVLCT, red, green, blue
• ; Create a window and display the original image.
 WINDOW, 0, XSIZE = imageSize[0], YSIZE = imageSize[1], $
 TITLE = 'Original Image'
 TV, image
• ; Create another window and display the histogram of the original image.





WINDOW, 1, TITLE = 'Histogram of Image'
PLOT, HISTOGRAM(image), /XSTYLE, /YSTYLE, $
TITLE = 'Mineral Image Histogram', $
XTITLE = 'Intensity Value', $
YTITLE = 'Number of Pixels of That Value'
Exercise 2 (cont.)
 Equalizing with Histograms (cont.)
• ; Histogram-equalize the image.
 equalizedImage = HIST_EQUAL(image)
• ; Create another window and display the equalized image.
 WINDOW, 2, XSIZE = imageSize[0], YSIZE = imageSize[1], $
 TITLE = 'Equalized Image'
 TV, equalizedImage
• ; Create another window and display the histogram of the
equalizied image.
 WINDOW, 3, TITLE = 'Histogram of Equalized Image'
 PLOT, HISTOGRAM(equalizedImage), /XSTYLE, /YSTYLE, $
 TITLE = 'Equalized Image Histogram', $
 XTITLE = 'Intensity Value', $
 YTITLE = 'Number of Pixels of That Value'
• END
Self test 1
 File:
• Chap4SelfTest1Bad.JPG
• Chap4SelfTest1Good.JPG
 Display the pair of images using linear 0 –
255
 Make the display of
Chap4SelfTest1Bad.JPG look similar to the
display of Chap4SelfTest1Good.JPG
• Approach 1: Piecewise linear stretch
• Approach 2: Arbitrary stretch
Exercise 3
 Adaptive Equalizing with Histograms
• Source code refer to “Image processing in IDL” page 421
• PRO Chap4Ex3
• ; Import the image from the file.
 file = FILEPATH('mineral.png', $
 SUBDIRECTORY = ['examples', 'data'])
 image = READ_PNG(file, red, green, blue)
 imageSize = SIZE(image, /DIMENSIONS)
• ; Initialize the display.
 DEVICE, DECOMPOSED = 0
 TVLCT, red, green, blue
• ; Create a window and display the original image.
 WINDOW, 0, XSIZE = imageSize[0], YSIZE = imageSize[1], $
 TITLE = 'Original Image'
 TV, image
Exercise 3 (cont.)
 Adaptive Equalizing with Histograms (cont.)
• ; Create another window and display the histogram of the original image.





WINDOW, 1, TITLE = 'Histogram of Image'
PLOT, HISTOGRAM(image), /XSTYLE, /YSTYLE, $
TITLE = 'Mineral Image Histogram', $
XTITLE = 'Intensity Value', $
YTITLE = 'Number of Pixels of That Value'
• ; Histogram-equalize the image.
 equalizedImage = ADAPT_HIST_EQUAL(image)
• ; Create another window and display the equalized image.
 WINDOW, 2, XSIZE = imageSize[0], YSIZE = imageSize[1], $
 TITLE = 'Adaptive Equalized Image'
 TV, equalizedImage
• ; Create another window and display the histogram of the equalizied image.





WINDOW, 3, TITLE = 'Histogram of Adaptive Equalized Image'
PLOT, HISTOGRAM(equalizedImage), /XSTYLE, /YSTYLE, $
TITLE = 'Adaptive Equalized Image Histogram', $
XTITLE = 'Intensity Value', $
YTITLE = 'Number of Pixels of That Value'
• END
Spatial feature manipulation
 Spatial filtering
• Spectral filter  Spatial filter
• Spatial frequency
Roughness of the tonal variations occurring in an image
High  rough
 e.g. across roads or field borders
Low  smooth
 e.g. large agricultural fields or water bodies
• Spatial filter  local operation
Low pass filter (Fig 7.16b)
 Passing a moving window throughout the original image
High pass filter (Fig 7.16c)
 Subtract a low pass filtered image from the original, unprocessed image
Spatial feature manipulation (cont.)
 Convolution
• The generic image processing operation
Spatial filter  convolution
• Procedure
Establish a moving window (operators/kernels)
Moving the window throughout the original image
• Example
Fig 7.17
 (a) Kernel
 Size: odd number of pixels (3x3, 5x5, 7x7, …)
 Can have different weighting scheme (Gaussian distribution, …)
 (b) original image DN
 (c) convolved image DN
 Pixels around border cannot be convolved
Spatial feature manipulation (cont.)
 Edge enhancement
• Typical procedures
 Roughness  kernel size
 Rough  small
 Smooth  large
 Add back a fraction of gray level to the high frequency component image
 High frequency  exaggerate local contrast but lose low frequency brightness information
 Contrast stretching
• Directional first differencing
 Determine the first derivative of gray levels with respect to a given direction
 Normally add the display value median back to keep all positive values
 Contrast stretching
 Example





Fig 7.20a: original image
Fig 7.20b: horizontal first difference image
Fig 7.20c: vertical first difference image
Fig 7.20d: diagonal first difference image
Fig 7.21: cross-diagonal first difference image  highlight all edges
Exercise 4
 Edge enhancement
•
•
PRO Chap4Ex4
; Import the image from the file.







•
file = FILEPATH('ctscan.dat', $
SUBDIRECTORY = ['examples', 'data'])
openr, lun, file, /get_lun
image = bytarr(256,256)
readu,lun,image
free_lun, lun
imageSize = SIZE(image, /DIMENSIONS)
; Initialize the display.
 DEVICE, DECOMPOSED = 0
 loadct, 0
•
; Create a window and display the original image.
 WINDOW, 0, XSIZE = imageSize[0], YSIZE = imageSize[1], $
 TITLE = 'Original Image'
 TVscl, image
•
; Applying the Sobel filter to enhance the edge.
 SobelImage = Sobel(image)
•
; Create another window and display the equalized image.
 WINDOW, 2, XSIZE = imageSize[0], YSIZE = imageSize[1], $
 TITLE = 'Applying the Sobel filter to enhance the edge'
 TVscl, SobelImage
•
END
Spatial feature manipulation (cont.)
 Fourier analysis
• Spatial domain  frequency domain
• Fourier transform
Quantitative description
Conceptual description
 Fit a continuous function through the discrete DN values if they were plotted along each
row and column in an image
 The “peaks and valleys” along any given row or column can be described mathematically
by a combination of sine and cosine waves with various amplitudes, frequencies, and
phases
• Fourier spectrum
Fig 7.22




Low frequency  center
High frequency  outward
Vertical aligned features  horizontal components
Horizontal aligned features  vertical components
Spatial feature manipulation (cont.)
 Fourier analysis (cont.)
• Inverse Fourier transform
Spatial filtering (Fig 7.23)
Noise elimination (Fig 7.24)
 Noise pattern  vertical band of frequencies  wedge block filter
• Summary
Most image processing  spatial domain
Frequency domain (e.g. Fourier transform)  complicate
and computational expensive
Multi-Spectral manipulation
 Spectral ratioing
• DNi / DNj
• Advantage
Convey the spectral or color characteristics of image features,
regardless of variations in scene illumination conditions
Fig 7.25
 deciduous trees  coniferous trees
 Sunlit side  shadowed side
Example: NIR/Red  stressed and nonstressed vegetation  quantify
relative vegetation greenness and biomass
• Number of ratio combination: Cn2
Landsat MSS: 12
Landsat TM or ETM+: 30
Exercise 5
 Spectral ratioing
• File: cup95eff.int
• Band math: float (b2) / float (b1)
b2: 2.4 mm
b1: 2.3 mm
• Interactive histogram stretch
Find the area where b2/b1 > 1
Self test 2
 Open the USGS mineral spectral library
• C:\RSI\IDL61\products\ENVI41\spec_lib\usgs_min\usgs_min.sli
 Plot the spectra of the following minerals (2.0 – 2.5 mm)
•
•
•
•
•
Alunite1
Budding1
Calcite1
Kaolini1
Muscovi1
 Select two bands that are ideal
for discriminate the region of
Alunite
 Open the hyperspectral data file
• C:\RSI\IDL61\products\ENVI41\data\cup95eff.int
• Use two band ratio to enhance the region of Alunite
Multi-Spectral manipulation (cont.)
 Spectral ratioing (cont.)
• Fig 7.26: ratioed images derived from Landsat TM data
 (a) TM1/TM2: highly correlated  low contrast
 (b) TM3/TM4:
 Red: road, water  lighter tone
 NIR: vegetation  darker tone
 (c) TM5/TM2:
 Green and MIR: vegetation  lighter tone
 But some vegetation looks dark  discriminate vegetation type
 (d) TM3/TM7
 Red: road, water  lighter tone
 MIR: low but varies with water turbidity  water turbidity
• False color composites  twofold advantage
 Too many combination  difficult to choose
 Landsat MSS: C(4, 2)/2 = 6, C(6, 3) = 20
 Landsat TM: C(6, 2)/2 = 15, C(15, 3) = 455
 Optimum index factor (OIF)
 Variance && correlation  OIF
 Best OIF for conveying the overall information in a scene may not be the best OIF for conveying the
specific information  need some trial and error
Multi-Spectral manipulation (cont.)
 Spectral ratioing (cont.)
• Intensity blind  troublesome
Hybrid color ratio composite: one ratio + another band
• Noise removal is an important prelude
Spectral ratioing enhances noise patterns
• Avoid mathematically blow up the ratio
DN΄ = R arctan(DNx/DNy)
 arctan ranges from 0 to 1.571. Typical value of R is chosen to be 162.3 
DN΄ranges from 0 to 255
Multi-Spectral manipulation (cont.)
 Principal and canonical components
• Two techniques
Reduce redundancy in multispectral data
 Extensive interband correlation problem (Fig 7.49)
Prior to visual interpretation or classification
• Example: Fig 7.27
DNI = a11DNA + a12DNB
DNII = a21DNA + a22DNB
Eigenvectors (principal components)
The first principal component (PC1)  the greatest variance
• Example: Fig 7.28  Fig 7.29 (principal component)
(A) alluvial material in a dry stream valley
(B) flat-lying quanternary and tertiary basalts
(C) granite and granodiorite intrusion
Multi-Spectral manipulation (cont.)
 Principal and canonical components (cont.)
• Intrinsic dimensionality (ID)
Landsat MSS: PC1+PC2 explain 99.4% variance  ID = 2
PC4 depicts little more than system noise
PC2 and PC3 illustrate certain features that were obscured by the more
dominant patterns shown in PC1
 Semicircular feature in the upper right portion
• Principal  Canonical
Little prior information concerning a scene is available  Principal
Information about particular features of interest is known  Canonical
Fig 7.27b
 Three different analyst-defined feature types (D, □, +)
 Axes I and II  maximize the separability of these classes and minimize the variance
within each class
Fig 7.30: Canonical component analysis
Exercise 6
 Principal components analysis
• Calculating Forward PC Rotations
Transforms  Principal Components  Forward PC Rotation 
Compute New Statistics and Rotate
Select Covariance Matrix
Select Subset from Eigenvalues
 Number of Output PC Bands: 3
Examine the PC EigenValues plot
• Inversing PC Rotations
Transforms  Principal Components  Forward PC Rotation  PC
Rotation from Existing Stats
Select Covariance Matrix
Select the statistics file saved from the forward PC rotation
Multi-Spectral manipulation (cont.)
 Vegetation components
• AVHRR
 VI (vegetation index)
VI  Ch2  Ch1
 NDVI (normalized difference vegetation index)
• Landsat MSS
NDVI 
Ch2  Ch1
Ch2  Ch1
 Tasseled cap transformation (Fig 7.31)
 Brightness  soil reflectance
 Greenness  amount of green vegetation
 Wetness  canopy and soil moisture
 TVI (transformed vegetation index)
 DN NIR  DN red

TVI  
 0.5
 DN NIR  DN red

1/ 2
 Fig 7.32, Fig 5.8, Plate 14
100
 TVI  green biomass
 Precision crop management, precision farming, irrigation water, fertilizers, herbicides, ranch
management, estimation of forage, …
 GNDVI (green normalized difference vegetation index)
 Same formulation as NDVI, except the green band is substituted for the red band
 Leaf chlorophyll levels, leaf area index values, the photosynthetically active radiation absorbed by a
crop canopy
• MODIS
 EVI (enhanced vegetation index)
Exercise 7
 Calculating various vegetation
components using ENVI
• File
C:\RSI\IDL61\products\ENVI41\data\can_tmr.img
• Transform  NDVI
• Transform  Tasseled Cap transform
Multi-Spectral manipulation (cont.)
 Intensity-Hue-Saturation color space
transform
• Fig 7.33: RGB color cube
28  28  28 =16,777,216
Gray line
True color composite (B, G, R)  false color composite (G, R, NIR)
• Fig 7.34: Planar projection of the RGB color cube
• Fig 7.35: Hexcone color model (RGB  IHS)
Intensity
Hue
Saturation
• Fig 7.36: advantage of HIS transform
Self test 3
 File: C:\RSI\IDL61\examples\data\rose.jpg
 Employ the color transform RGB  IHS
 Take the square root of the original
saturation
 Use the new saturation to employ the color
transform IHS  RGB
 Check the effect of saturation stretch
 Do you have a better way to stretch the
saturation?
Multi-Spectral manipulation (cont.)
 Balance Contrast Enhancement Technique
(BCET)
• Jian-Guo Liu, 1991
• Eliminate the color bias of poor color composite images
 Using a parabolic transform derived from input image
 Stretch the image to a given value range and mean without changing the basic
shape of the image histogram
• BCET transform
 y = A(x-B)2 + C
 Define






l: minimum of the input image X
h: maximum of the input image X
e: mean of the input image X
L: minimum of the Output image Y
H: maximum of the Output image Y
E: mean of the Output image Y
 Conditions
 Given H and L
 Given E
Multi-Spectral manipulation (cont.)
 BCET
(cont.)
Multi-Spectral manipulation (cont.)
 BCET
(cont.)
Multi-Spectral manipulation (cont.)
 BCET (cont.)
• BCET transform (cont.)
Solution
 B = term1 / term2
 term1 = h2(E – L) – s(H – L) + l2(H – E)
 term2 = 2[h(E – L) – e(H – L) + l(H – E)]
 s = (SNi=1xi2)/N
 A = (H – L) / [(h – 1)(h + l – 2B)]
 C = L – A(l – B)2
• Implement BCET in ENVI
Multi-Spectral manipulation (cont.)
 Direct Decorrelation Stretch (DDS)
• Jian-Guo Liu, 1996
• Perform a direct saturation stretch without using HSI
transform
• Advantages
Involves only simple arithmetic operations  fast
Can be controlled quantitatively  effective
• Note
The three bands for decorrelation stretch must be well stretched (e.g.
linear stretch with 99% clip or BCET) before DDS is applied
• DDS transform
rk = r – k min(r, g, b)
gk = g – k min(r, g, b)
bk = b – k min(r, g, b)
Source: Lecture note of “Advanced course on: image processing and remote sensing”, Dr. Jian Guo Liu
Original
BCET
BCET+ICDDS