6/4/2016© 2009 Raymond P. Jefferis III Lect Geographic Information Processing Attribute Plotting Extracting data features Calculating derivatives Edge sharpening Nearest neighbor analysis Gradient calculations Laplacian filtering Chester County, PA W076N40 - USGS DTED Data
6/4/2016© 2009 Raymond P. Jefferis III Lect Data Feature Extraction Spatial derivatives Edges Gradients Curvatures
6/4/2016© 2009 Raymond P. Jefferis III Lect Spatial Derivatives Calculate spatial derivative of attribute(s) Can be one- or two-dimensional Result, because of high-pass nature, will have data noise enhanced Convolution is most rapid computation method
6/4/2016© 2009 Raymond P. Jefferis III Lect Definition A spatial derivative is the rate of change of a function of space, f(x,y), with respect to distance in that space. Since geographical images are 2-dimensional, we can define derivatives in both the x-direction and the y-direction independently.
6/4/2016© 2009 Raymond P. Jefferis III Lect Mathematical Representation
6/4/2016© 2009 Raymond P. Jefferis III Lect Image Derivatives Images are not infinitely divisible They are composed of discrete pixels The value of the spatially varying attribute is known only at these pixels. Continuous derivatives must be approximated by discrete derivatives.
6/4/2016© 2009 Raymond P. Jefferis III Lect Discrete Derivatives
6/4/2016© 2009 Raymond P. Jefferis III Lect Problems Data values may be missing Data may contain noise (corrupted attribute values), derivatives accentuate this noise The accuracy of the derivative calculations may depend upon the spatial frequencies of the image. [High rates of change between pixels will cause errors in the derivatives.]
6/4/2016© 2009 Raymond P. Jefferis III Lect Solutions Filter the data, to reduce noise, before taking derivatives. Curve-fit the data [for example using a spline surface] and take derivatives of the resulting smooth curve. Use Savitsky & Golay derivative convolutes (based on curve fitting method) to calculate derivatives with specified smoothing.
6/4/2016© 2009 Raymond P. Jefferis III Lect Savitsky and Golay Reference Abraham Savitsky and Marcel J. E. Golay, “Smoothing and Differentiation of Data by Simplified Least Squares Procedures,” Analytical Chemistry, 36 (8), (July, 1964).
6/4/2016© 2009 Raymond P. Jefferis III Lect D Derivative by Convolution c = {{0, 0, -2, 0, 0}, {0, 0, -1, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0,0, 2, 0, 0}}; g = {{205, 205, 205, 205, 205, 205, 205}, {205, 205, 205, 204, 205, 205, 205}, {205, 205, 205, 203, 205, 205, 205}, {205, 205, 205, 202, 205, 205, 205}, {205, 205, 205, 201, 205, 205, 205}, {205, 205, 205, 200, 205, 205, 205}, {205, 205, 205, 199, 205, 205, 205}}; h = ListConvolve[c/10, g] output = {{0, 1, 0}, {0, 1, 0}, {0, 1, 0}} c = convolute g = data h = program step to filter data
6/4/2016© 2009 Raymond P. Jefferis III Lect Detecting Edges Derivatives –Act as high-pass spatial filters –Increase noise - results need smoothing Convolution –Derivative kernel (arbitrary size) –Sobel kernels (3 x 3 arrays) One for x-direction One for y-direction
6/4/2016© 2009 Raymond P. Jefferis III Lect Two-Dimensional Derivatives For data field, f(x,y), the derivative vector is defined as: Where,
6/4/2016© 2009 Raymond P. Jefferis III Lect Notes G x is convolution giving x-gradient G y is convolution giving y-gradient Actual gradient is vector sum of these (See next slide for polar coordinate vector)
6/4/2016© 2009 Raymond P. Jefferis III Lect Derivative Magnitude and Direction Can produce gradient vector at each point.
6/4/2016© 2009 Raymond P. Jefferis III Lect Computing Gradients Nearest neighbor differencing –Follows the previous definition –Amplifies data noise (no smoothing) Convolution –Uses special kernels –Can do smoothing simultaneously –Rapid computations (parallel processing)
6/4/2016© 2009 Raymond P. Jefferis III Lect Sobel Convolutes Kernel for generating G y (Sobel gradient template for y-direction) Kernel for generating G x (Sobel gradient template for x-direction)
6/4/2016© 2009 Raymond P. Jefferis III Lect Malvern Calculation Examples Malvern quadrangle Raw elevations pixels 7.5"x7.5" no filtering
6/4/2016© 2009 Raymond P. Jefferis III Lect Sobel Edge Sharpening - x-dir Malvern quadrangle Sobel convolute 3 x 3 array x-direction No prefiltering Accentuates features with steep gradient in x-direction
6/4/2016© 2009 Raymond P. Jefferis III Lect Sobel Edge Sharpening - y-dir Malvern quadrangle Sobel convolute 3 x 3 array y-direction No prefiltering Note edges of Great Valley are accentuated
6/4/2016© 2009 Raymond P. Jefferis III Lect Gradient Vectors (Sobel) Surface gradients calculated from 3x3 Sobel convolutes
6/4/2016© 2009 Raymond P. Jefferis III Lect Savitsky & Golay Convolutes Ref: Analytical Chemistry, 36(8), (1964) 1st derivative convolutes with quadratic smoothing for 7-point computation: h(i)={ -3, -2, -1, 0, 1, 2, 3 } Performs some noise reduction, due to quadratic curve fitting process. Convolution kernel arrays follow:
6/4/2016© 2009 Raymond P. Jefferis III Lect Savitsky & Golay Arrays Kernel for generating G y (quadratic smoothing) Kernel for generating G x (quadratic smoothing)
6/4/2016© 2009 Raymond P. Jefferis III Lect Malvern Quadrangle (Sav./ Gol.) Surface gradient directions calculated by 7-point Savitsky & Golay convolutes
6/4/2016© 2009 Raymond P. Jefferis III Lect Comparison Sobel convolutes –Small arrays (3 x 3) –Some noise remains Savitsky & Golay convolutes –Can use larger arrays (7 x 7 and larger) –More noise reduction
6/4/2016© 2009 Raymond P. Jefferis III Lect Spatial Curvature Second derivative Laplacian operator ( ) on image, I(x,y) Must be (Gaussian) filtered to remove noise caused by high-pass characteristics
6/4/2016© 2009 Raymond P. Jefferis III Lect Laplace-of-Gaussian Filter
6/4/2016© 2009 Raymond P. Jefferis III Lect Laplacian Convolution Kernel
6/4/2016© 2009 Raymond P. Jefferis III Lect Laplacian Image Processing Comments: Peaks accentuated Hills steeper Valleys more pronounced
6/4/2016© 2009 Raymond P. Jefferis III Lect Accentuated Surface Features
6/4/2016© 2009 Raymond P. Jefferis III Lect Comparison NormalLaplacian Note: Laplacian filtered image has more accentuated surface features.
6/4/2016© 2009 Raymond P. Jefferis III Lect Discussion