520 likes | 646 Views
EECS 373 Design of Microprocessor-Based Systems Farhan Hormasji Matthew Diffenderfer University of Michigan Efficient Algorithms November 27, 2012. Outline. Overview DFT algorithms FFT Cooley–Tukey FFT Bluestein's FFT Goertzel Edge Detection Algorithms Canny Sobel Prewitt
E N D
EECS 373 Design of Microprocessor-Based Systems Farhan Hormasji Matthew Diffenderfer University of Michigan Efficient Algorithms November 27, 2012
Outline • Overview • DFT algorithms • FFT • Cooley–Tukey FFT • Bluestein's FFT • Goertzel • Edge Detection Algorithms • Canny • Sobel • Prewitt • Roberts Cross • Questions
Algorithms What to look for: • Usefulness • Methodology • Implementation Tradeoffs: • Cost • Code Size • Runtime • Availability
Outline • Overview • DFT algorithms • FFT • Cooley–Tukey FFT • Bluestein's FFT • Goertzel • Edge Detection Algorithms • Canny • Sobel • Prewitt • Roberts Cross • Questions
Discrete Fourier Transform (DFT): Overview • What? • Converts a sampled function from time domain to frequency domain • Use? • DFTs reveal periodicities in input data as well as the relative strengths of any periodic components
Discrete Fourier Transform (DFT): Mathematical Interpretation
Discrete Fourier Transform (DFT): Applications • Spectral Analysis • Most signals are sinusoidal • DFT tells you frequency, phase, and amplitude components • Frequency Response of Systems • All input and output signals can be represented as cosine waves • By observing change in magnitude and phase, any linear system can be described • Convolution in the Frequency Domain • Convolution in time domain is multiplication in frequency domain • Speed of computation greatly reduced
Fast Fourier Transform (FFT): Overview • What? • An efficient algorithm to compute the DFT and its inverse • Why use it? • O(Nlog2N) • Tradeoff • Input data must be a power of 2 • If it’s not, data is either truncated or padded with zeros • Many different types
FFT: Cooley-Tukey algorithm • Most common FFT algorithm • Divide and conquer algorithm • Methodology • Breaks up DFT of N samples into N=N1N2 • Benefit • Can be combined with any other DFT algorithm • What Matlabfft function does for optimization
Fast Fourier Transform (FFT): Bluestein • Also called chirp z-transform algorithm • Methodology • Expresses DFT as a convolution • Benefit • Computes DFT of arbitrary sizes • Can be used to compute more general transforms • Tradeoff • Only O(Nlog2N) complexity for prime-sized DFTs
Goertzel Algorithm • Tradeoff • O(NM) • N is number of DFT terms, M is the set of DFT terms to calculate • Benefit • Simple structure of algorithm makes it well suited to small processors • More efficient than FFT for small number of frequencies ( if M < log2N) • Applications • Used to recognize DTMF tones produced by buttons on telephone keypad • Call progress (dial tone, busy)
Outline • Overview • DFT algorithms • FFT • Cooley–Tukey FFT • Bluestein's FFT • Goertzel • Edge Detection Algorithms • Canny • Sobel • Prewitt • Roberts Cross • Questions
Edge DetectionOverview • Use • Tool used in image processing • Goal is to identify points in a digital image where image brightness changes sharply or has discontinuities • Reduce amount of data in image so that further image processing may occur • Reduce images to shapes • Applications • Most image processing
Edge Detection: Canny • Use • Optimal edge detection • the algorithm should mark as many real edges in the image as possible • edges marked should be as close as possible to the edge in the real image • a given edge in the image should only be marked once • image noise should not create false edges • Benefits • Adaptable to most images • Generally has short runtime, well-suited for real time implementations in FPGAs • Constraints • Size of Gaussian filter • Calibration of thresholds
Edge Detection: CannyMethodology • Convolves image with Gaussian filter • To eliminate noise • Uses other types of edge detection to determine intensity gradient vertically, horizontally, and diagonally • 4 filters • Goes through matrix to determine if gradient magnitude is a local maximum based on gradient direction • Determine high and low threshold • Go through image and mark pixel as edge or non-edge based on thresholds
Edge Detection: Sobel • Use • Discrete differentiation operator • Computes the gradient of the image intensity • Benefits • Few number of computations • Can be implemented simply in both hardware and software • Tradeoffs • Poor gradient approximation for high frequency variations in image
Edge Detection: SobelMethodology • 2 kernels convolved with original image to calculate gradient in vertical and horizontal direction • Where A is the original image • Compare gradient value to threshold similar to Canny algorithm
Edge Detection: Prewitt • Same as Sobel algorithm but with two key differences • The two kernels used have slightly different values • Magnitude and Direction of gradient in Sobel: • Magnitude and Direction of gradient in Prewitt:
Edge Detection: Roberts Cross • Use • One of the first edge detectors • Intensity of edges should correspond as close as possible to what a human would perceive • Benefits • Only finds gradient in diagonal direction due to simple kernels, so algorithm has high simplicity • Tradeoffs • Speed of modern computers make this simplicity negligable • Edge detection suffers from sensitivity to noise
Edge Detection: Roberts CrossMethodology • 2 kernels convolved with original image to calculate gradient in diagonal direction • Magnitude and direction of gradient found similar to Sobal • Compare gradient value to threshold similar to Canny algorithm