Monday, March 11, 2019
Spatial Filtering Fundamentals
4/28/2008 spacial fall into placeing fundamentals byGlebV. Tcheslavskiemailprotected lamar. edu http//ee. lamar. edu/gleb/dip/index. htm rebound 2008 ELEN 4304/5365 settle 1 mechanics of spacial stressing Considering frequency domain sink ining, the effect of LPF applied to an picture show is to deformity (smooth) it. Similar smoothing effect cease be achieved by using spacial leachs ( spacial entombs, kernels, templates, or windows). We discussed that a spacial try consists of a nearness and a pre- delineate operation performed on the hear pels defining the neighborhood.The sequel of filtering a spic-and-span pel with coordinated of the neighborhoods center and the value defined by the operation. g y p If the operation is linear, the filter is tell to be a linear spatial filter. confine 2008 ELEN 4304/5365 declination 2 1 4/28/2008 Mechanics of spatial filtering As nubbleing a 3 x 3 neighborhood, at any point (x,y) in the examine, the response of the spati al filter is g ( x, y ) = w(? 1, ? 1) f ( x ? 1, y ? 1) + w(? 1, 0) f ( x ? 1, y ) + + w(0, 0) f ( x, y ) + + w(1,1) f ( x + 1, y + 1) Filter coefficient Pixel enduringness In command g ( x, y ) = s =? a t =? b ? ? w(s, t ) f ( x + s, y + t ) a bSpring 2008 ELEN 4304/5365 DIP 3 Mechanics of spatial filtering here(predicate) a sham size of it is m x n. m = 2a + 1 n = 2b + 1 Where a and b argon some integers. For a 3 x 3 secrete Spring 2008 ELEN 4304/5365 DIP 4 2 4/28/2008 spatial correlation and convolution Correlation is a process of moving the filter fancy dress over the watch and computing the sum of products at individually posture as previously described. Convolution is the equal except that the filter is first rotated by 1800. For a 1D case, we first zero range f by m-1 zeros on each size. We compute a sum of products in twain cases Spring 2008 ELEN 4304/5365 DIP 5 spacial correlation and convolutionCorrelation is a business office of displacement of the filter. A function containing a single 1 with the recline being zeros is g g g called a discrete building block craving. Correlation of a function with a discrete unit zest yields a rotated version of a function at the location of the impulse. To perform a convolution, we acquire to pre-rotate the filter by 1800 and perform the alike(p) operation as in correlation. Spring 2008 ELEN 4304/5365 DIP 6 3 4/28/2008 Spatial correlation and convolution In a 2D case, for a filter of size m x n, we pad the image with m-1 rows of zeros at the top and bottom and n-1 columns of zeros on the left and right.For convolution, we pre-rotate the veil and perform the sliding sum of products. Spring 2008 ELEN 4304/5365 DIP 7 Spatial correlation and convolution Correlation of a filter w(x,y) of size m x n with an image f(x,y) is w( x, y ) f ( x, y ) = s =? a t =? b ? ? w(s, t ) f ( x + s, y + t ) ? ? w(s, t ) f ( x ? s, y ? t ) a b a b Convolution of a filter w(x,y) of size m x n with an image f(x,y) is w( x, y ) ? f ( x, y) = s =? a t =? b Spring 2008 ELEN 4304/5365 DIP 8 4 4/28/2008 Vector representation of linear filtering It is convenient sometimes to represent a sum of products asR = ? wk zk = w T z k =1 Filter coeffs Image intensities mn For example, for a 3 x 3 filter p , R = ? wk zk = w T z k =1 Spring 2008 ELEN 4304/5365 DIP 9 9 Generating spatial filter masks Generating an m x n linear spatial filter requires specification of mn mask coefficients. These coefficients are selected based on what the filter is supposed to do keeping in mind that all we smoke do with linear filtering is to implement a sum of products. Assuming that we need to replace the pixels in an image with the norm pixel intensities of a 33 neighborhood centered on those pixels.If zi are the intensities, the ordinary is R= 9 1 9 ? zi 9 i =1 Which is R = ? wi zi = w T z i =1 ELEN 4304/5365 DIP wi = 1 9 10 Spring 2008 5 4/28/2008 Smoothing spatial filters Smoothing filters are used for blurring and noise reduction. fuzzring may be implemented in preprocessing tasks to remove small details from an image prior to large object glass lens extraction. The output of a smoothing (averaging or lowpass) linear spatial filter is the average of the pixels contained in the neighborhood of the filter mask.By replacing the value of every pixel in an image by the average of the eagerness levels in the neighborhood defined by a filter mask, the resulting image will lead reduced sharp transitions in intensities. Since random noise typically corresponds to much(prenominal) transitions, we can achieve denoising. Spring 2008 ELEN 4304/5365 DIP 11 Smoothing spatial filters However, edges (characterized by sharp intensity transitions) will be blurred. Examples of such masks 1) A turning point filter spatial averaging filter 33 2) Weighted average filter attempt to reduce blurring g a g ( x, y ) = s =? a t =? b ? ? (s, t ) f ( x + s, y + t ) s =? a t =? b b ? ? w(s, t ) 12 a b Spring 2008 ELEN 4 304/5365 DIP 6 4/28/2008 Smoothing spatial filters The effect of filter size. The authoritative vitamin D500 image And the results of smoothing with a square averaging filter of sizes m = 3, 5, 9, 15, 25, and 35 pixels. Spring 2008 ELEN 4304/5365 DIP 13 Smoothing spatial filters Frequently, blurring is desired for ease of object detection an original Hubble image, the result of applying a 1515 averaging mask to it and the result of thresholding with a threshold of 25% of the highest intensity. Spring 2008 ELEN 4304/5365 DIP 14 7 4/28/2008Order-statistic (nonlinear) filters Order-statistic filter are nonlinear spatial filters whose response is based on ordering (Ranking) the pixels in the neighborhood and past replacing the value of the center pixel by the value inflexible by the ranking result. The median filters are quite effective against the impulse noise (salt-and-pepper noise). The median of a set of set is such that half(a) the values in the set are greater than the med ian and half is lesser than it Ex the 33 neighborhood has values (10, 20, 20, 20,15, 20, 100, 25, 20). These values are ranked as (10, 15, 20, 20, 20, 20, 20, 25, 100).The median will be 20. on that point are also max and min filters. Spring 2008 ELEN 4304/5365 DIP 15 Order-statistic (nonlinear) filters Original image with salt-andpepper noise Spring 2008 Noise reduction with a 33 averaging mask ELEN 4304/5365 DIP Noise reduction with a 33 median mask 16 8 4/28/2008 Sharpening spatial filters foundations The main objective of sharpening is to highlight transitions in intensity. Since averaging is similar to spatial integration, we y g g g p g can assume that sharpening is analogous to differentiation in space. The derivatives of a digital function are defined in differences.The first derivative must be 1) Zero in heavenss of immutable intensity 2) Non-zero at the barrage and end of an intensity step or ramp 3) Non-zero along ramps of ageless slope. The reciprocal ohm derivat ive must be 1) Zero in areas of constant intensity 2) Non-zero at the onset and end of an intensity step or ramp 3) Zero along ramps of constant slope. Spring 2008 ELEN 4304/5365 DIP 17 Sharpening spatial filters foundations The first-order derivative ?f = f ( x + 1) ? f ( x) ? x The minute-order derivative ?2 f = f ( x + 1) + f ( x ? 1) ? 2 f ( x) ? x 2 It can be verify that these definitions satisfy the conditions for derivatives.Spring 2008 ELEN 4304/5365 DIP 18 9 4/28/2008 Sharpening spatial filters foundations The circles indicate the onset or end of intensity transitions. The sign of the second derivative transplants at the onset and end of a step of ramp. The second derivative enhances fine details much better than the first derivative. This is fitted for sharpening. Spring 2008 ELEN 4304/5365 DIP 19 using the second derivative for image sharpening the Laplacian We consider isotropic filters the response is independent of the focus of the discontinuity in the image Suc h filters are image. rotation invariant.The simplest isotropic derivative means is the Laplacian ?2 f ? 2 f ? f = 2 + 2 ? x ? y 2 Therefore ? 2 f = f ( x + 1, y ) + f ( x ? 1, y ) + f ( x, y + 1) + f ( x, y ? 1) ? 4 f ( x, y ) The Laplacian is a linear wheeler dealer since derivatives are linear operators. Spring 2008 ELEN 4304/5365 DIP 20 10 4/28/2008 Using the second derivative for image sharpening the Laplacian The Laplacian can be implemented by these filter masks Since the Laplacian is a derivative operator, its use highlights intensity discontinuities in the image and deemphasize regions with slow varying intensity levels levels.It tends to produce images having grayish edge lines and other discontinuities, and a dark, feature-less background. Spring 2008 ELEN 4304/5365 DIP 21 Using the second derivative for image sharpening the Laplacian Background features can be hold together with the sharpening effect of the Laplacian by adding the Laplacian image to the original. If the definition of the Laplacian has a ostracize central coefficient, the Laplacian image must be subtracted rather than added to obtain a sharpening result. In general g ( x, y ) = f ( x, y ) + c 2 f ( x, y ) ? ? ?Output intensity Input intensity -1 if the center is negative +1 otherwise Spring 2008 ELEN 4304/5365 DIP 22 11 4/28/2008 Using the second derivative for image sharpening the Laplacian The Laplacian Laplacian with scaling The original (blurred) image The image sharpened with mask 2 The image sharpened with mask 1 Spring 2008 ELEN 4304/5365 DIP 23 Unsharp masking and highboost filtering An approach used for many years to sharpen images is 1. Blur the original image 2. Subtract the blurred image from the original (the result is called the mask) g mask ( x, y ) = f ( x, y ) ? f ( x, y ) Original Blurred image 3.Add the mask to the original g ( x, y ) = f ( x, y ) + k ? g mask ( x, y ) Here k is a weight. Spring 2008 ELEN 4304/5365 DIP 24 12 4/28/2008 Unsharp masking and h ighboost filtering When k = 1 unsharp masking k 1 highboost filtering k 1 de-emphasize the contribution of a mask. The shown intensity visibility can be viewed as a horizontal scan through a vertical edge transition from a dark to li ht t a light region. i This approach is similar to Laplacian method. Spring 2008 ELEN 4304/5365 DIP 25 Unsharp masking and highboost filtering Original ( slightly blurred) image smoothen with a Gaussian smoothing filter 55 Unsharp maskResult of using unshapr mask (k = 1) Result of using highboost filtering with k = 4. 5 Spring 2008 ELEN 4304/5365 DIP 26 13 4/28/2008 Gradient method First derivatives can be implemented for nonlinear image sharpening using the magnitude of the incline ? ? f ? g x ? ? ? x ? ? ? f ? grad ( f ) ? ? ? = ? ? ? g y ? ? ? f ? ? ? y ? ? ? The gradient vector points in the direction of the greatest rate of g (x,y). g (length) gradient change of f at location ( y) The magnitude ( g ) of g 2 2 M ( x, y ) = ? f = g x + g y Is the value of rate of change at (x,y) in the direction of gradient. Spring 2008ELEN 4304/5365 DIP 27 Gradient method M(x,y) is an image of the same size as the original and is called the gradient image. Magnitude makes M(x,y) non-linear. It is more s itable in some applications to use suitable se M ( x, y ) ? g x + g y For an image where z5 represent the pixel f(x,y) and z1 represent the pixel f(x-1,y-1), the simplest (Roberts) definitions for gradients are M ( x, y ) = ( z9 ? z5 ) + ( z8 ? z6 ) 2 2 M ( x, y ) ? z9 ? z5 + z8 ? z6 However, Roberts cross-gradient operators lead to masks of even sizes, which is inconvenient. ELEN 4304/5365 DIP 28 Spring 2008 14 4/28/2008 Gradient methodThe smallest masks with central symmetry (ones we are interested in) are 33. The gradient can be approximated for such masks as following ?f = ( z7 + 2 z8 + z9 ) ? ( z1 + 2 z2 + z3 ) ? x ? f gy = = ( z3 + 2 z6 + z9 ) ? ( z1 + 2 z4 + z7 ) ? y Therefore, the mask could be gx = M ( x, y ) ? ( z7 + 2 z8 + z9 ) ? ( z1 + 2 z2 + z3 ) + ( z3 + 2 z6 + z9 ) ? ( z1 + 2 z4 + z7 ) Roberts operators They are Sobel operators. Spring 2008 ELEN 4304/5365 DIP 29 Gradient method The coefficients in all masks shown sum to zero. This indicates that mask will give a zero response in an area of constant intensity as expected of a derivative operator operator.Original image of contact lens Sobel gradient Defect Spring 2008 ELEN 4304/5365 DIP 30 15 4/28/2008 Combining spatial sweetener techniques Frequently, Frequently a combination of several methods is used to enhance an image 1) Original image 2) Laplacian 3) image sharpened by Laplacian 4) Sobel gradient of the original image 5) Sobel image smoothed with a 55 averaging filter 6) product of Sobel image with its smoothed version 7) sharpened image (a sum of the original and 6) 8) power-law transformation. Spring 2008 ELEN 4304/5365 DIP 31 Spring 2008 ELEN 4304/5365 DIP 32 16
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment