数字图像处理冈萨雷斯N08.pptx
Spatial FilteringBackgroundSmoothing FiltersSharpening FiltersSpatial Filtering no.1linear filter:Spatial filter,mask,template,window.nonlinear filter:Median,minimal,or maximal value of a neighborhood.第1页/共29页Background of Spatial FilteringSpatial Filtering no.2Odd sizeThe border?第2页/共29页Background of Spatial Filtering(cont.)Linear filters:the transfer function and the point spread function of a linear system are inverse Fourier transforms of each other.a)s1s9 intensities of pixels.b)k1k9 mask coefficients.c).Spatial Filtering no.3Convolution mask第3页/共29页Smoothing Filters Smoothing filters are used for blurring and for noise reduction.Lowpass filtering(linear):all the coefficients be positive.Such as,sampled by a Gaussian functionNeighborhood averaging,weighted neighborhood averaging,scaled not to out of the valid gray-level range (for mn mask normalized by 1/(mn).Spatial Filtering no.4第4页/共29页Examples of averaging Filtera)Original image,b)noise corrupted,c)e)results of smoothing template by size of 77,9 9,and 11 11.Spatial Filtering no.5第5页/共29页Examples of averaging FilterSpatial Filtering no.6Irrelevant details vs.Mask size第6页/共29页Example of averaging FilterSpatial Filtering no.7Small objects blended with background,size of mask?第7页/共29页Median filter(nonlinear)The gray level of each pixel is replaced by the median of the gray levels in a neighborhood of that pixel,instead of averaging.To achieve noise reduction rather than blurring.The 5th value of a 33 window,Minimal or maximal.Spatial Filtering no.8第8页/共29页Sharpening FiltersThe objective is to highlight fine detail in an image or to enhance detail that has been blurred.Basic high-pass spatial filteringHigh-boost filteringDerivative filtersLaplacian filtersPrinting,medical,inspection,target detection-1-1-1-1 8-1-1-1-1A classic implementation of sharpening filter,Eliminates zero-frequency termIndicate positive near center,negative in the outer peripherySpatial Filtering no.9第9页/共29页Example of High-pass FilterReducing the average value of image to zero implies that image must have some negative gray levels.Thus involve some form of scaling/clipping so final result span the range 0,L-1Spatial Filtering no.10第10页/共29页High-boost Filtering A high-pass filtered image may be computed as,Highpass=Original LowpassThe definition of high-boost or High-frequency emphasis filter is High boost=(A)Original Lowpass =(A-1)Original+OriginalLowpass =(A-1)Original+Highpass-1-1-1-1 w-1-1-1-1w=9A-1A=1 standard highpass resultA1 part of the original is added back to highpass result,restore low frequency component.Looks more like original with edge enhancement.Spatial Filtering no.11第11页/共29页Example of High-boost Filtera)original,b)Highpass,c)Highboost a=2,d)extend gray-level of(c)Spatial Filtering no.12第12页/共29页Derivative Filters(nonlinear)Averaging pixels over a region tends to blur detail in an image.As averaging is analogous to integration,differentiation can be expected to have the opposite effect and thus sharpen an image.The gradient of f at coordinate(x,y)is defined as the vector,The magnitude of this vector,Spatial Filtering no.13第13页/共29页Derivative Filter approximation Roberts cross-gradient operators10 0-101-10 Prewitt operators-1-1-10 00111-101-1 01-101z1z2z3z4 z5z6z7z8z9Spatial Filtering no.14第14页/共29页Derivative Filter approximation(cont)Sobel operators-1-2-10 00121-101-2 02-101Spatial Filtering no.15第15页/共29页Example of Derivative FilterSpatial Filtering no.16第16页/共29页Laplacian Filters Laplacian operatorSpatial Filtering no.17第17页/共29页Example of DerivativesSpatial Filtering no.18第18页/共29页1D edge detectionSpatial Filtering no.18第19页/共29页1D edge detectionSpatial Filtering no.18Double thin edge or?The zero-crossings of s(x)mark possible edges.第20页/共29页Laplacian enhancementSpatial Filtering no.19第21页/共29页Example of Laplacian FiltersSpatial Filtering no.20第22页/共29页High-boost maskSpatial Filtering no.21第23页/共29页Example of High-boost FilterSpatial Filtering no.22第24页/共29页Example of combined filteringSpatial Filtering no.23第25页/共29页Example of combined filtering(cont.)Spatial Filtering no.24第26页/共29页Review QuestionsnExplain the idea of smoothing filternExplain the idea of sharpening filternExplain the idea of media filter第27页/共29页Recommended Reading Gonzalez+Woods:Chapter 3 Image Enhancement no.37第28页/共29页感谢您的观看!第29页/共29页