Time Frequency Analysis and Wavelet Transform Midterm Presentation Edge-Detection and Wavelet Transform 2011.11.24 Kuang-Tsu Shih Outline • • • • • • Introduction to Edge Detection Gradient-Based Methods Canny Edge Detector Wavelet Transform-Based Methods The Lipschitz Exponent Conclusion Outline • • • • • • Introduction to Edge Detection Gradient-Based Methods Canny Edge Detector Wavelet Transform-Based Methods The Lipschitz Exponent Conclusion Edge-Detection • A fundamental element in image analysis • Wide applications: – Pattern recognition – Image segmentation – Scene analysis – …etc. The Definition of An Edge • Definition: – Neighboring pixels with large differences in value. • Edges may be caused by various reasons – Discontinuity in depth (Silhouettes) – Discontinuity in reflectance (texture) – Discontinuity in lighting (shade) • We do not distinguish them in this report. Edge Detector original image a binary edge map Ambiguity in Edge Detection Edge! Edge? Edge? Edge? Fig. The ambiguity of the locality of edges. Outline • • • • • • Introduction to Edge Detection Gradient-Based Methods Canny Edge Detector Wavelet Transform-Based Methods The Lipschitz Exponent Conclusion Gradient-Based Methods • The gradient-based methods check the magnitude of image gradient. – The gradient map is generated by 2D convolution. – Detects edges if the magnitude > threshold. • Sobel operator • Prewitt operator • Robert’s cross operator Gradient-Based Methods • Advantage: – Very simple, very fast. • Disadvantage: – Very susceptible to noise. (main drawback) – Not capable of detecting edges in different scales. – Parameter tuning. Lena image with noise The result by Sobel operator Outline • • • • • • Introduction to Edge Detection Gradient-Based Methods Canny Edge Detector Wavelet Transform-Based Methods The Lipschitz Exponent Conclusion Canny Edge Detector • Filtering – Pass to a low pass kernel (Gaussian) to raise SNR. • Take gradient – The angle of gradient is quantized into four bins. (米) • Non-maximum suppression – Determine local maximum of gradient according to the orientation of the gradient. • Hysteresis Threshold – TH and TL, connectivity of edges. Canny Edge Detector • Advantage – Easy implementation, fast speed. – Relatively robust and cost effect. • Disadvantage – The result can still be affected by strong noise. – Does not examine edges in all scales. Lena with noise Canny result Outline • • • • • • Introduction to Edge Detection Gradient-Based Methods Canny Edge Detector Wavelet Transform-Based Methods The Lipschitz Exponent Conclusion Wavelet Transform • Basic form of continuous wavelet transform (CWT) : The mother wavelet a: The dimension of translation (location axis) b: The dimension of dilation (scale axis) , that is, f (t ) dt . (finite energy) • The functions generated by mother wavelet should be a basis of the space. • f belongs to 2 Wavelet Transform • More on the mother wavelet – Admissibility: ( ) “Wave” 2 d (t )dt 0 “Let” n M x – Regularity: n ( x)dx 0 (vanishing moments) WHY? tp 1 t ( p) W f (0, b) f (0) ( ) dt b b p p! 1 b Decays fast as b is small f (1) (0) f ( 2) (0) f ( n ) (0) 2 3 n 1 n2 f ( 0 ) M b M b M b ... M b O ( b ) 0 1 2 n 1! 2! n! Vanishes! Wavelet Transform We focus on this one Fig. Some common mother wavelets. The Mexican Hat Function • The Mexican hat function 25 / 4 2 t 2 (t ) 1 2t e 3 • In fact, it is the 2nd derivative of the Gaussian function (a “smoothing function”) • If we choose the wavelet to be the pth derivative of Gaussian, d p t 2 (t ) p e dt the wavelet has exactly p vanish moment. Wavelet Transform and Edge Detection • Let f(x) be a function in , (x) be a smoothing function. (impulse response of a low-pass filter) • 1 x Let s ( x) ( ) be the stretched version of (x) . s s • Let and Wavelet Transform and Edge Detection KEY POINT! Wavelet transform Smooth + Differentiation Wavelet transform Smooth + Differentiation Wavelet Transform and Edge Detection Smooth Differentiation Differentiation Wavelet Transform and Edge Detection Fig. Edges can be detected by examine the wavelet transform of the signal. Wavelet Transform and Edge Detection • We can easily generalize this to 2D signals: KEY POINT! Smooth + Differentiation Wavelet transform Wavelet Transform and Edge Detection • The modulus of the wavelet transform at scale s: • A point is a multi-scale edge point at scale s if the magnitude of the gradient attains a local maximum. Original Image Filtered Image s = 24 x y x y 2 s = 21 s = 22 s = 23 s = 24 2 / y tan1 / x Local Maximum of Modulus Local Maximum of Modulus after thresholding s = 21 s = 22 s = 23 s = 24 Outline • • • • • • Introduction to Edge Detection Gradient-Based Methods Canny Edge Detector Wavelet Transform-Based Methods The Lipschitz Exponent Conclusion Wavelet-Based Method with Lipschitz Exponent • In fact, the wavelet-based method with dyadic (2k) scale alone is NOT optimally adapt to noise. • IDEA: We deal with sharp edges in big-scale (lower frequency) and not-so-sharp edges in small-scale (higher frequency). – Equivalently, we use kernels with larger support for sharp edges to better eliminate noise, and vice versa for weak edges. – Spatially variant kernel, none linear filtering. Wavelet-Based Method with Lipschitz Exponent • How do we measure the “singularity” of a function? – Intuitively, an edge is a singular point of the function and the degree of singularity corresponds to the sharpness of an edge. – Note that the functions we care are not necessarily differentiable. • Solution: “The Lipschitz Exponent” Lipschitz Exponent h0 0, s.t. h h0 it is true Lipschitz Exponent (Therefore, any differentiable point has L. E. greater than 1.) (The higher L. E., the smoother a function is, for that point.) KEY POINT This important theorem relates the wavelet transform coefficients to L.E. The rates of change of coefficients across scales are different. Lipschitz Exponent Wavelet-Based Method with Lipschitz Exponent Wavelet-Based Method with Lipschitz Exponent Wavelet-Based Method with Lipschitz Exponent Wavelet-Based Method with Lipschitz Exponent Outline • • • • • • Introduction to Edge Detection Gradient-Based Methods Canny Edge Detector Wavelet Transform-Based Methods The Lipschitz Exponent Conclusion Conclusion • We reviewed several conventional edge detectors and their advantage and disadvantage. • We briefly introduced the concept of wavelet transform. • We proved the relationship between wavelet transform and low-pass filtering + gradient. • We introduced the concept of Lipschitz exponent and its application in edge detection. References • Feng-Ju Chang, “Wavelet for edge detection.” • J. C. Goswami, A. K. Chan, 1999, “Fundamentals of wavelets: theory, algorithms, and applications," John Wiley & Sons, Inc. • G. X. Ritter, J. N. Wilson, 1996, “Handbook of computer vision algorithms in image algebra," CRC Press, Inc. • 謝豪駿, 小波分析於梁構件損傷檢測之應用 • A really friendly guild to wavelet transform, www.polyvalens.com/blog/?page_id=15 • Wikipedia Edge Detection http://en.wikipedia.org/wiki/Edge_detection Canny Edge Detector http://en.wikipedia.org/wiki/Canny_edge_detector • http://140.115.11.235/~chen/course/vision/ch6/ch6.htm