spatial-based enhancements lecture 3 prepared by r. lathrop 10/99 updated 10/03 erdas field guide...

40
Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Upload: edmund-logan

Post on 11-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Spatial-based Enhancements

Lecture 3

prepared by R. Lathrop 10/99

updated 10/03

ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Page 2: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Spatial frequency

• Spatial frequency is the number of changes in brightness value per unit distance in any part of an image

• low frequency - tonally smooth, gradual changes

• high frequency - tonally rough, abrupt changes

Page 3: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Spatial Frequencies

Zero Spatial frequency Low Spatial frequency High Spatial frequency

Example from ERDAS IMAGINE Field Guide, 5th ed.

Page 4: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Spatial vs. Spectral Enhancement

• Spatial-based Enhancement modifies a pixel’s values based on the values of the surrounding pixels (local operator)

• Spectral-based Enhancement modifies a pixel’s values based solely on the pixel’s values (point operator)

Page 5: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Moving Window concept

Kernel scans across row, then down a row and across again, and so on.

Page 6: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Focal Analysis

• Mathematical calculation of pixel DN values within moving window

• Mean, Median, Std Dev., Majority

• Focal value written to center pixel in moving window

Page 7: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: noise filtering

Page 8: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Texture

• Texture: variation in BV’s in a local region, gives estimate of local variability. Can be used as another layer of data in classification/ interpretation process.

• 1st order statistics: range, variance, std dev

• Window size will affect results

Page 9: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Texture: variance

3x3 texture 7x7 texture

Page 10: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Pixel ConvolutionBV = int [ SUM i->q (SUM j->q fij dij) ]

---------------------------------- F

where

i = row location j = column location

fij = the coefficient of a convolution kernel at position i, j

dij = the BV of the original data at position i, j

q = the dimension of the kernel, assuming a square kernel

F = either the sum of the coefficients of the kernel or 1 if the sum of coefficients is zero

BV = output pixel value

Page 11: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: kernel convolution

8 8 6 6 6

2 8 6 6 6

2 2 8 6 6

2 2 2 8 6

2 2 2 2 8

-1 -1 -1

-1 16 -1

-1 -1 -1

Example from ERDAS IMAGINE Field Guide, 5th ed.

Convolution Kernel

Page 12: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: kernel convolution

Kernel: -1 -1 -1 -1 16 -1 -1 -1 -1

Original: 8 6 6 2 8 6 2 2 8

XResult

= 11

J=1 j=2 j=3

I=1 (-1)(8) + (-1)(6) + (-1)(6) = -8 -6 -6 = -20

I=2 (-1)(2) + (16)(8) + (-1)(6) = -2 +128 -6 = 120

I=3 (-1)(2) + (-1)(2) + (-1)(8) = -2 -2 -8 = -12

F = 16 - 8 = 8 Sum = 88

output BV = 88 / 8 = 11

Page 13: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

11 6 6 6 6

0 11 6 6 6

2 0 11 6 6

2 2 0 11 6

2 2 2 0 11

Example: kernel convolution

8 6 6 6 6

2 8 6 6 6

2 2 8 6 6

2 2 2 8 6

2 2 2 2 8

Input Output

Edge

Page 14: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Low vs. high spatial frequency enhancements

• Low frequency enhancers (low pass filters):Emphasize general trends, smooth image

• High frequency enhancers (high pass filters):Emphasize local detail, highlight edges

Page 15: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: Low Frequency EnhancementKernel: 1 1 1

1 1 11 1 1

Original: 204 200 197 201 100 209 198 200 210

Output: 204 200 197 201 191 209 198 200 210

Original: 64 50 57 61 125 69 58 60 70

Output: 64 50 57 61 65 69 58 60 70

Low value surrounded by higher values

High value surrounded by lower values

From ERDAS Field Guide p.111

Page 16: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Low pass filter

Orignal IKONOS pan 7x7 low pass

Page 17: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: High Frequency EnhancementKernel: -1 -1 -1

-1 16 -1-1 -1 -1

Original: 204 200 197 201 120 209 198 200 199

Output: 204 200 197 201 39 209 198 200 210

Original: 64 50 57 61 125 69 58 60 70

Output: 64 50 57 61 187 69 58 60 70

Low value surrounded by higher values

High value surrounded by lower values

From ERDAS Field Guide p.111

Page 18: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

High Pass filter

3x3 high pass 3x3 edge enhance -1 -1 -1 -1 17 -1 -1 -1 -1

-1 -1 -1 -1 9 -1 -1 -1 -1

Page 19: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Edge detection

• Edge detection process: Smooth out areas of low spatial frequency and highlight edges (local changes) only

• 1) calculating spatial derivatives (differencing)

• 2) edge detecting template (Zero-sum kernels):- directional (compass templates)- non-directional (Laplacian)

• 3) subtracting a smoothed image from the original

Page 20: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Linear Edge Detection techniques

• Directional gradient filters produce output images whose BVs are proportional to the difference between neighboring pixel BVs in a given directional, i.e. they calculate the directional gradient

• Spatial differencing:Vertical: BVi,j = BVi,j - BVi,j+1 + KHorizontal: BVi,j = BVi,j - Bvi-1,j + Kconstant K added to make output positive

Page 21: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Zero sum kernels

• Zero sum kernels: the sum of all coefficients in the kernel equals zero. In this case, F is set = 1 since division by zero is impossible

• zero in areas where all input values are equal

• low in areas of low spatial frequency

• extreme in areas of high spatial frequency (high values become higher, low values lower)

Page 22: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: Linear Edge Detecting Templates

Vertical: -1 0 1 Horizontal: -1 -1 -1-1 0 1 0 0 0 -1 0 1 1 1 1

Diagonal Diagonal(NW-SE): 0 1 1 (NE-SW): 1 1 0

-1 0 1 1 0 -1 -1 -1 0 0 -1 -1

Example: vertical template convolution

Original: 2 2 2 8 8 8 Output: 0 18 18 0 0 2 2 2 8 8 8 0 18 18 0 0 2 2 2 8 8 8 0 18 18 0 0

Page 23: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Linear Edge Detection

Horizontal Edge Vertical Edge

-1 -2 -1 0 0 0 1 2 1

-1 0 1 -2 0 2 -1 0 1

Page 24: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Linear Line Detecting Templates

• Line features (i.e. rivers and roads) can be detected as pairs of edges if they are more than one pixel wide (using linear edge detection templates). If they are a single pixel wide, they can be detected using these templates:

• Vertical: -1 2 -1 Horizontal: -1 -1 -1 -1 2 -1 2 2 2 -1 2 -1 -1 -1 -1

Page 25: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: Linear Line Detecting Templates

Vertical: -1 2 -1 Horizontal: -1 -1 -1-1 2 -1 2 2 2 -1 2 -1 -1 -1 -1Original

2 2 2 8 2 2 22 2 2 8 2 2 22 2 2 8 2 2 2

Linear Edge Detection. 0 18 0 18 0 .. 0 18 0 18 0 .. 0 18 0 18 0 .

Linear Line Detection. 0 -6 12 -6 0 .. 0 -6 12 -6 0 .. 0 -6 12 -6 0 .

Page 26: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Linear Line Detection

Horizontal Edge Vertical Edge

-1 -1 -1 2 2 2 -1 -1 -1

-1 2 -1 -1 2 -1 -1 2 -1

Page 27: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Compass gradient masks

Produce a maximum output for vertical (or horizontal) brightness value changes from the specified direction. For example a North compass gradient mask enhances changes that increase in a northerly direction, i.e. from south to north:

North: 1 1 11 -2 1

-1 -1 -1

Page 28: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Example: Compass gradient masks

North: 1 1 1 South: -1 -1 -11 -2 1 1 -2 1

-1 -1 -1 1 1 1

Example: North vs. south gradient mask

North SouthOriginal: 8 8 8 Output: . . . Output: . . .

8 8 8 0 0 0 0 0 0 8 8 8 18 18 18 -18 -18 -18 2 2 2 18 18 18 -18 -18 -18 2 2 2 0 0 0 0 0 0 2 2 2 . . . . . .

Page 29: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Non-directional Edge Enhancement

• Laplacian is a second derivative and is insensitive to direction. Laplacian highlights points, lines and edges in the image and suppresses uniform, smoothly varying regions

• 0 -1 0 1 -2 1-1 4 -1 -2 4 -2

0 -1 0 1 -2 1

Page 30: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Nonlinear Edge Detection

Sobel edge detector: a nonlinear combination of pixels

Sobel = SQRT(X2 + Y2)

X: -1 0 1 Y: 1 2 1 -2 0 2 0 0 0 -1 0 1 -1 -2 -1

Page 31: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Nondirectional edge filter

Laplacian filter Sobel filter

Page 32: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Edge enhancement

• Edge enhancement process:

• First detect the edges

• Add or subtract the edges back into the original image to increase contrast in the vicinity of the edge

Page 33: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Original IKONOS pan

Edge enhancement

Laplacian

-

Original – edge = edge enhanced

Page 34: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Original IKONOS pan Unsharp masking to enhance detail

7x7 low

-

Original – low pass = edge enhanced

Page 35: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Edge Mapping

• BV thresholding of the edge detector output to create a binary map of edges vs. non-edges

• Threshold too low: too many isolated pixels classified as edges and edge boundaries too thick

• Threshold too high: boundaries will consist of thin, broken segments

Page 36: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Fourier Transform

• Fourier analysis is a mathematical technique for separating an image into its various spatial frequency components.

• Can display the frequency domain to view magnitude and directional of different frequency components, can then filter out unwanted components and back-transform to image space.

• Global rather than local operator• Useful for noise removal

Page 37: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Fourier Analysis Example

Side scan sonar image of sea bottom

Fourier spectrum

Page 38: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Fourier Analysis Example

Fourier spectrum

Low frequencies towards center

High frequencies towards edges

Image noise often shows as thin line, oriented perpendicular to original image

Page 39: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Fourier Analysis Example

Low pass filter Back transformed image

Page 40: Spatial-based Enhancements Lecture 3 prepared by R. Lathrop 10/99 updated 10/03 ERDAS Field Guide 6th Ed. Ch 5:144-152; 171-184

Fourier Analysis Example

Wedge filter Back transformed image