# Spatial Filtering - George Mason University

Spatial Filtering Enhancement 02/22/20 Spatial Filtering 1 References 1. Gonzalez and Woods, Digital Image Processing, 2nd Edition, Prentice Hall, 2002. 2. Jain, Fundamentals of Digital Image Processing, Prentice Hall 1989 02/22/20

Spatial Filtering 2 Filters Powerful Imaging Tool Frequency domain is often used Enhancement by accentuating the features of interest Spatial domain Linear Think of this as weighted average over a mask / filter region Compare to convolution imaging (smoothing) filters are often symmetric

02/22/20 Spatial Filtering 3 Spatial Filtering Computations Result for 3x3 mask g(x,y) = w(-1,-1)f(x-1,y-1) w(-1,0)f(x-1,y) + w(-1,1) f(x-1,y+1) . + w(1,1)f(x+1,y+1) +

Result for mxn mask g(x,y) = a b w(s,t) f(x+s,y+t) s=-a t=-b a = (m-1)/2 b = (n-1)/2 If image size is MxN, then x=0,1,M-1 and y=0,1,..N-1.

From [1] 02/22/20 Spatial Filtering 4 Smoothing Filters Weighted average Low pass filter

Reduce the noise; remove small artifacts Blurring of edges Two masks: Note multiplication is by 2n, divide once at end of process g(x,y) = a b a b w(s,t) f(x+s,y+t) / w(s,t) s= -a t= -b

02/22/20 Spatial Filtering s= -a t= -b 5 Smoothing - Examples Suppressed small objects in the scene 02/22/20 Spatial Filtering

6 Median Filter Example of Order Statistics Filter. Other examples max filter or min filter Effective for impulse noise (salt and pepper noise) Median half the values <= the median value NxN neighborhood, where N is odd Replace center of mask with the median value

Stray values are eliminated; uniform neighborhoods not affected 02/22/20 Spatial Filtering 7 Sharpening Filters Smoothing Blurring Averaging Sharpening is the reverse process Smoothing is the result of integration Sharpening involves differentiation Enhances discontinuities Noise Edges

De-emphasizes uniform parts of the image 02/22/20 Spatial Filtering 8 Differentiation Numeric Techniques Derivatives are defined in terms of differences First order derivative f ' (x) = (f (x) f (x - )) / Second order derivative f '' (x) = (f ' (x+) f ' (x)) / =({f (x + ) f (x)} {f (x) f (x - )}) / 2

=({f (x + ) 2f (x) f (x - )}) / 2 = smallest unit; for images = 1. 02/22/20 Spatial Filtering 9 Example of Derivative Computation Isolated point (noise?) 02/22/20 Spatial Filtering

10 Use Derivatives with care What is the gradient? Slope at a local point, may be quite different than the overall trend Often use a smoothing filter to reduce impact of noise Higher the order of the derivative, higher is the impact of local discontinuities 02/22/20 Spatial Filtering 11

Laplacian for Enhancement Second order derivatives are better at highlighting finer details Imaging requires derivatives in 2D Laplacian 2 f = fxx + fyy , where fxx = f(x+1,y) + f(x-1,y) 2 f(x,y) fyy= f(x,y+1) + f(x, y-1) 2 f(x,y)

02/22/20 Spatial Filtering 12 Composite Laplacian for Enhancement Laplacian highlights discontinuities (b and c) The uniform regions are suppressed To restore the balance, for image enhancement the original image is added to the Laplacian g(x,y)=f(x,y) - 2 f (x,y)

if 2 f (x,y) < 0 g(x,y)=f(x,y) + 2 f (x,y) if 2 f (x,y) >= 0 In difference form g(x,y)=5f(x,y)-{f(x+1,y)+ f(x-1,y)+f(x,y+1)+f(x,y-1)} Leads to new mask Next slide 02/22/20 Spatial Filtering 13 Application of Composite Masks

02/22/20 Spatial Filtering 14 High Boost Filters For image enhancement the augmented original image is added to the Laplacian g(x,y)= Af(x,y) - 2 f (x,y) if 2 f (x,y) < 0 g(x,y)= Af(x,y) + 2 f (x,y) if 2 f (x,y) >= 0 In difference form

g(x,y)=(A+4)f(x,y)-{f(x+1,y)+ f(x-1,y)+f(x,y+1)+f(x,y-1)} 02/22/20 Spatial Filtering 15 High Boost Filter with Different A - values 02/22/20 Spatial Filtering 16

Sobel Mask Detects Edges 02/22/20 Spatial Filtering 19 Multiple Step Spatial Enhancement 02/22/20 Spatial Filtering 20

## Recently Viewed Presentations

• * * Alcatel-Lucent AT&T Bigband Networks CableLabs Cisco Systems DTS Ericsson ETRI Huawei IneoQuest Technologies Intel JDSU Juniper LG Electronics Microsoft Motorola Nagravision NEC Corporation of America Nielsen Company Nokia Siemens Networks Philips Consumer Electronics Qwest RGB Networks Rogers Wireless...
• Yes, some states require intrastate motor carriers to comply with federal requirements and obtain DOT# AL, AK, AZ, CO, CT, FL, GA, IN, IA, KS, KY, ME, MD, MI, MN, MO, MT, NY, NE, OH, OR, PA, SC, N, TX,...
• Equation method first: Let x represent Kimberly's final amount after spending \$50. Mike only spent \$25 so he now has \$25 more than Kimberly. Since Mike's money is 50% more than Kimberly's, the \$25 must correspond with the 50%, so...
• Tapping the Web and the New Media Chapter 12 Democratization of Information Internet is revolutionary in so many ways As a media form it is characterized by: Widespread broadband=high speed communication Wireless accessibility and "smart" mobile devices Free or inexpensive...
• Matt Carroll Candy Riedlinger Kastiney Smith. Olibia Bardwell Josh Ward Sheri Overman. Tracy Domit Karl Wrisley Tracy Domit Lex Areta Meaghan Ward Rachel Miller Sally Sullivan Shelly Williams Stephanie Payne Healing. Miracles. Tongues. Bill Riedlinger Rick Bardwell Interpretation of Tongues....
• Formatted Output Secure Coding in C and C++ Robert C. Seacord Agenda Formatted Output Variadic Functions Formatted Output Functions Exploiting Formatted Output Functions Stack Randomization Mitigation Strategies Notable Vulnerabilities Summary Formatted Output - 1 Formatted output functions consist of a...
• Overall Engagement Group Purpose & Objectives. Purpose . The Distribution System Planning Stakeholder Engagement Group (EG) is an openforum for stakeholders who are activelyengaged in the REV process and the Distributed System Implementation Plan (DSIP) filings to provide input to,...
• As per National Skill Development Policy 2015, National Skill Development Corporation (NSDC) would constitute SSCs with following functions: Identification of skill development needs including preparing a catalogue of types of skills, range and depth of skills. Development of a sector...