Image EnhancementImage 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
Chapter 4Chapter 4
IntroductionIntroduction
Why image enhancement?Why image enhancement?• Mind excellent interpreter• Eye poor discriminator• Computer amplify the slight differences to make
them readily observable
Categorization of image enhancementCategorization of image enhancement• Point operation• Local operation
OrderOrder• Restoration noise removal enhancement
Introduction (cont.)Introduction (cont.)
ContentContent• Contrast manipulation
• Spatial feature manipulation
• Multi-spectral manipulation
• Direct De-correlation Stretch (DDS)
Contrast manipulationContrast manipulation
Gray-level thresholdingGray-level thresholding• Segment• Fig 7.11
(a) TM1(b) TM4(c) TM4 histogram(d) TM1 brightness variation in water areas only
Level-slicingLevel-slicing• Divided into a series of analyst-specified slices• Fig 7.12
Exercise 1Exercise 1
Thresholding and level-slicing in ENVIThresholding 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 SliceApplyEdit rangeOptions Set Number of Default RangesOptions Apply Default Ranges
Contrast manipulation (cont.)Contrast manipulation (cont.)
Contrast stretchingContrast 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 2Exercise 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.)Exercise 2 (cont.)
Equalizing with Histograms (cont.)(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 1Self test 1
File:• Chap4SelfTest1Bad.JPG• Chap4SelfTest1Good.JPG
Display the pair of images using linear 0 – Display the pair of images using linear 0 – 255255
Make the display of Make the display of Chap4SelfTest1Bad.JPG look similar to the Chap4SelfTest1Bad.JPG look similar to the display of Chap4SelfTest1Good.JPGdisplay of Chap4SelfTest1Good.JPG• Approach 1: Piecewise linear stretch• Approach 2: Arbitrary stretch
Exercise 3Exercise 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 = 0TVLCT, 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.)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 manipulationSpatial feature manipulation
Spatial filteringSpatial filtering• Spectral filter Spatial filter• Spatial frequency
Roughness of the tonal variations occurring in an imageHigh rough
e.g. across roads or field borders
Low smooth e.g. large agricultural fields or water bodies
• Spatial filter local operationLow 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.)Spatial feature manipulation (cont.)
ConvolutionConvolution• The generic image processing operation
Spatial filter convolution
• ProcedureEstablish a moving window (operators/kernels)Moving the window throughout the original image
• ExampleFig 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.)Spatial feature manipulation (cont.)
Edge enhancementEdge 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 differencingDetermine the first derivative of gray levels with respect to a given directionNormally add the display value median back to keep all positive valuesContrast stretchingExample
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 4Exercise 4
Edge enhancementEdge 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.)Spatial feature manipulation (cont.)
Fourier analysisFourier analysis• Spatial domain frequency domain• Fourier transform
Quantitative descriptionConceptual 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 spectrumFig 7.22
Low frequency center High frequency outward Vertical aligned features horizontal components Horizontal aligned features vertical components
Spatial feature manipulation (cont.)Spatial feature manipulation (cont.)
Fourier analysis (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
• SummaryMost image processing spatial domainFrequency domain (e.g. Fourier transform) complicate
and computational expensive
Multi-Spectral manipulationMulti-Spectral manipulation
Spectral ratioingSpectral ratioing• DNi / DNj
• AdvantageConvey the spectral or color characteristics of image features,
regardless of variations in scene illumination conditionsFig 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: Cn2Landsat MSS: 12Landsat TM or ETM+: 30
Exercise 5Exercise 5
Spectral ratioingSpectral ratioing• File: cup95eff.int
• Band math: float (b2) / float (b1)b2: 2.4 mb1: 2.3 m
• Interactive histogram stretchFind the area where b2/b1 > 1
Self test 2Self test 2
Open the USGS mineral spectral libraryOpen 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 Plot the spectra of the following minerals (2.0 – 2.5 m)m)• Alunite1• Budding1• Calcite1• Kaolini1• Muscovi1
Select two bands that are ideal Select two bands that are ideal for discriminate the region of for discriminate the region of AluniteAlunite
Open the hyperspectral data fileOpen 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.)Multi-Spectral manipulation (cont.)
Spectral ratioing (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 advantageToo 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.)Multi-Spectral manipulation (cont.)
Spectral ratioing (cont.)Spectral ratioing (cont.)• Intensity blind troublesome
Hybrid color ratio composite: one ratio + another band
• Noise removal is an important preludeSpectral ratioing enhances noise patterns
• Avoid mathematically blow up the ratioDN΄ = 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.)Multi-Spectral manipulation (cont.)
Principal and canonical componentsPrincipal 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.27DNI = 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.)Multi-Spectral manipulation (cont.)
Principal and canonical components (cont.)Principal and canonical components (cont.)• Intrinsic dimensionality (ID)
Landsat MSS: PC1+PC2 explain 99.4% variance ID = 2PC4 depicts little more than system noisePC2 and PC3 illustrate certain features that were obscured by the more
dominant patterns shown in PC1 Semicircular feature in the upper right portion
• Principal CanonicalLittle prior information concerning a scene is available Principal Information about particular features of interest is known CanonicalFig 7.27b
Three different analyst-defined feature types (□, +) Axes I and II maximize the separability of these classes and minimize the variance
within each class
Fig 7.30: Canonical component analysis
Exercise 6Exercise 6
Principal components analysisPrincipal 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 RotationsTransforms Principal Components Forward PC Rotation PC
Rotation from Existing StatsSelect Covariance Matrix Select the statistics file saved from the forward PC rotation
Multi-Spectral manipulation (cont.)Multi-Spectral manipulation (cont.)
Vegetation componentsVegetation components• AVHRR
VI (vegetation index)NDVI (normalized difference vegetation index)
• Landsat MSSTasseled cap transformation (Fig 7.31)
Brightness soil reflectance Greenness amount of green vegetation Wetness canopy and soil moisture
TVI (transformed vegetation index) Fig 7.32, Fig 5.8, Plate 14 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
• MODISEVI (enhanced vegetation index)
12 ChChVI
12
12
ChCh
ChChNDVI
1005.02/1
redNIR
redNIR
DNDN
DNDNTVI
Exercise 7Exercise 7
Calculating various vegetation Calculating various vegetation components using ENVIcomponents using ENVI• File
C:\RSI\IDL61\products\ENVI41\data\can_tmr.img
• Transform NDVI
• Transform Tasseled Cap transform
Multi-Spectral manipulation (cont.)Multi-Spectral manipulation (cont.)
Intensity-Hue-Saturation color space Intensity-Hue-Saturation color space transformtransform• Fig 7.33: RGB color cube
28 28 28 =16,777,216Gray lineTrue 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)
IntensityHueSaturation
• Fig 7.36: advantage of HIS transform
Self test 3Self test 3
File: File: C:\RSI\IDL61\examples\data\rose.jpgC:\RSI\IDL61\examples\data\rose.jpg Employ the color transform RGB Employ the color transform RGB IHSIHS Take the square root of the original Take the square root of the original
saturationsaturation Use the new saturation to employ the color Use the new saturation to employ the color
transform IHS transform IHS RGB RGB Check the effect of saturation stretchCheck the effect of saturation stretch Do you have a better way to stretch the Do you have a better way to stretch the
saturation?saturation?
Multi-Spectral manipulation (cont.)Multi-Spectral manipulation (cont.)
Balance Contrast Enhancement Technique Balance Contrast Enhancement Technique (BCET)(BCET)• Jian-Guo Liu, 1991• Eliminate the color bias of poor color composite images
Using a parabolic transform derived from input imageStretch the image to a given value range and mean without changing the basic
shape of the image histogram
• BCET transformy = A(x-B)2 + CDefine
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.)Multi-Spectral manipulation (cont.)
BCETBCET (cont.) (cont.)
Multi-Spectral manipulation (cont.)Multi-Spectral manipulation (cont.)
BCET BCET (cont.)(cont.)
Multi-Spectral manipulation (cont.)Multi-Spectral manipulation (cont.)
BCET (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 = (N
i=1xi2)/N
A = (H – L) / [(h – 1)(h + l – 2B)] C = L – A(l – B)2
• Implement BCET in ENVI
Multi-Spectral manipulation (cont.)Multi-Spectral manipulation (cont.)
Direct Decorrelation Stretch (DDS)Direct Decorrelation Stretch (DDS)• Jian-Guo Liu, 1996• Perform a direct saturation stretch without using HSI
transform• Advantages
Involves only simple arithmetic operations fastCan be controlled quantitatively effective
• NoteThe three bands for decorrelation stretch must be well stretched (e.g.
linear stretch with 99% clip or BCET) before DDS is applied
• DDS transformrk = 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