Can we take advantage of the fact that high frequency components in the FFT of an image generally correspond to edges, to implement an edge detection algorithm in the fourier domain? I did try multiplying a high pass filter with the FFT of an image. Although the resultant image sort of corresponded to edges, it wasn't exactly the edge detection established using convolution matrices. So is there any way you could do edge detection in the fourier domain, or it's not possible at all?
3 Answers
Since convolution in spatial domain is multiplication in the Fourier (frequency) domain, you can perform edge detection in Fourier domain by multiplying the spectra of image and the edge detection kernel and then perform IFFT on the result.
I think the high-pass filter alone is not appropriate for edge detection since it keeps all high-frequency features (e.g. sharp peaks and corners) which are usually not classified as edges.
More advanced edge detection methods would be tricky in frequency domain since edges are best described in spatial domain (in my opinion).
The question is why to do edge detection using FFT in the first place? Is it because performance considerations? If so, maybe the high-pass filtered image (produced quickly by FFT) can be quickly filtered again to remove non-edge parts.
-
$\begingroup$ Yeah the thought was because of performance considerations, since Matlab takes awfully long to iterate over each pixel of the image. Will try out padding the convolution filter and taking its FFT and filtering the image. Thanks! $\endgroup$– rounakJul 9, 2012 at 7:29
-
$\begingroup$ Edges are based described in some flavour of wavelet domain (in my opinion) ;) $\endgroup$ Jul 9, 2012 at 16:06
-
1$\begingroup$ this depends all on your definition of an edge: if you zoom into it, it would "shift" in the frequency domain to lower frequencies. Thus, an edge it is not sufficient to define it as a high frequency feature. $\endgroup$– meduzJul 12, 2012 at 20:39
Usually the edge detection is done by a convolution of a 2-D filter/kernel like Roberts Cross or a Sobel formulation. Since those are convolutions, LTI rules apply, like being able to equivalently apply them in the frequency domain. That is, take both the kernel and the image into the frequency domain via DFT, multiply them together, and then IDFT the result back into the spatial domain.
I should also add that the kernels in the spatial domain, do in fact try to exploit the high spatial frequency characteristics of the edges. For example, if you look at Roberts, you can see how it is doing a differentiation across the diagonal points - ie, a high pass filtering operation.
Both a single step and a single sawtooth produce a nice linear relationship between frequency and phase in the frequency domain, with the slope of the unwrapped phase depending on the location of the edge in the FFT window. For detecting or estimating the location of an assumed single edge, you could try to unwrap phase in the frequency domain and see if the result has sufficient linear correlation to pass some detection threshold.