Edge enhancement by linear (and nonlinear) filtering Dr. Dileepan Joseph Dept. of Engineering Science University of Oxford, UK
Objectives Learn what edge enhancement is, why it is useful & how it differs from edge detection Define linear and nonlinear spatial filtering Design linear filters to either smoothen or sharpen the edges in an image and show how the two operations are related Appreciate that human vision enhances edges using local operations
Edge enhancement The purpose of edge enhancement is to highlight fine detail in an image or to restore, at least partially, detail that has been blurred (either in error or as a consequence of a particular method of image acquisition) Applications of edge enhancement include electronic printing, medical imaging, industrial inspection, and autonomous target detection in smart weapons
Edge enhancement Edge enhancement involves sharpening the outlines of objects and features with respect to their background Edge detection involves isolating the outlines of objects and features The former is easier to do than the latter
Spatial filtering Image processing in the spatial domain may be expressed as g(x,y) = H{f(x,y)} where f is the input image, g is the output image, and H is an operator on f, defined over some neighbour- hood of pixel (x,y)
Spatial filtering The neighbourhood of pixel (x,y), for image f, may be expressed as a column vector w(x,y) of pixel values e.g. Consider a 3 by 3 square neighbourhood centred on the pixel (x,y) of interest
Spatial filtering A spatial filter H is linear if (and only if) H{a∙f(x,y)} = a∙H{f(x,y)} H{f 1 (x,y)+f 2 (x,y)} = H{f 1 (x,y)}+H{f 2 (x,y)} For any linear spatial filter H, we may write g(x,y) = hw(x,y) where g is the output image, w is the neighbourhood vector of the input image f, and is the inner product operator The column vector h is called a mask and it defines the properties of the linear filter
Spatial filtering It is easier to visualize linear spatial filtering as an inner product of h and w over the shape of the neighbourhood e.g. For a 3 by 3 square neighbourhood centred on the pixel (x,y) of interest g(x,y) = h1h1 h2h2 h3h3 h4h4 h5h5 h6h6 h7h7 h8h8 h9h9 w1w1 w2w2 w3w3 w4w4 w5w5 w6w6 w7w7 w8w8 w9w9 h 1 w 1 +h 2 w 2 …+h 9 w 9 = f(x,y)f(x,y)
Smoothing filter To understand how to sharpen edges, we first consider how to smoothen them The simplest way to smoothen an image f is to use the neighbourhood average of pixel values to define the image g g(x,y) = 1/9 w1w1 w2w2 w3w3 w4w4 w5w5 w6w6 w7w7 w8w8 w9w9 f(x,y)f(x,y)
Smoothing filter Middle region of the original image: Middle region of the smoothed image:
Embossing filter Compared to the original image, edges in the smoothed image are slightly blurred Thus, the difference between the original and smooth images, which may be derived by spatial filtering, holds edge information g(x,y) = −1/9 8/9−1/9 w1w1 w2w2 w3w3 w4w4 w5w5 w6w6 w7w7 w8w8 w9w9 f(x,y)f(x,y)
Embossing filter Middle region of the original image: Middle region of the embossed image:
Sharpening filter The embossed image holds edge inform- ation over a uniform (zero) background Thus, the sum of the original and embossed images, which may be derived by spatial filtering, will reinforce edges of the former g(x,y) = −1/9 17/9−1/9 w1w1 w2w2 w3w3 w4w4 w5w5 w6w6 w7w7 w8w8 w9w9 f(x,y)f(x,y)
Sharpening filter Middle region of the original image: Middle region of the sharpened image:
Edge enhancement Without amplification: Emboss = Original − Smooth Sharp = Original + Emboss = 2∙Original − Smooth With amplification A: Sharp = Original + A∙Emboss = (1+A)∙Original − A∙Smooth e.g. Consider the mask h of a 3 by 3 square neighbourhood
Edge enhancement A = 0A = 1A = 2
Mach Bands illusion This image has three sections: on the left, luminance is at a constant high; on the right, luminance is at a constant low; in the middle, it declines at a constant rate The thin bands seen on either side of the ramp (and named after their discoverer) are illusory
Mach Bands illusion Sensory tissue is often organized so that ex- citation of any location produces inhibition of surrounding nerves In human vision, this lateral inhibition enhances edges by producing overshoot and undershoot
Review Edge enhancement involves sharpening the outlines of objects and features in an image with respect to their background Image processing in the spatial domain may be expressed as g(x,y) = H{f(x,y)} where f is the input image, g is the output image, and H is a linear or nonlinear operator on f, defined over some neighbourhood of pixel (x,y) Linear filtering may be expressed by an inner product of a mask and the neighbourhood
Review Smoothing of edges may be achieved by neighbourhood averaging Sharpening of edges may be achieved by subtracting a multiple, A, of the neighbour- hood average from a larger multiple, 1+A, of the neighbourhood centre The Mach Bands illusion may be understood in terms of edge enhancement by lateral inhibition in human vision
Resources Gonzales and Woods, Digital Image Processing, Second Edition, Prentice Hall, 2002 (get the first two chapters free from Matlab Image Processing Toolbox ch3/mb/mb.html (Mach Bands illusion) ch3/mb/mb.html HyperVis/vision/latinib.htm (lateral inhibition) HyperVis/vision/latinib.htm