# Cake Wavelets

Suppose we want to extract where an image has features that are orientated like \(v \in S^1 = \{ x \in \bbR^2 \mid \| x \| =1 \} \),
such as line or edge in the \(v\) direction.
We can do this by creating a filter/kernel/wavelet that, when convolved with the image,
gives a high response where the input image has that certain local orientation,
and a low response where it does not.
We can create this filter in multiple ways,
but one very nice way to do it is through *cake wavelets*.

Cake wavelets are designed in frequency space, and the reason why we do this is simple. Identifying if a patch of an image has \(v\)-orientated features becomes trivial in frequency space: we just look if it has a frequency component anywhere along the frequencies that are "across" \(v\), i.e. orthogonal to \(v\).

Below on the left we see a "dot" moving around in a frequency space of \(7 \times 7\). In the middle and right we see how this dot in frequency space corresponds to features spatially. Notice that, indeed, if the dot is for exampe on the right (or left), it corresponds to features orientated vertically.

The intuition behind the design of the cake wavelets is as follows. We imagine the full frequency space as a complete cake, and we subdivide this cake into \(n\) parts, each corresponding to a certain range of orientations. We are left with \(n\) cake pieces that can pick up, roughly, \(n\) different orientations.

Below the cake wavelets in the frequency domain are visualized. The last image in this collection is the direct sum of all the wavelets in the frequency domain, and should look like a complete cake except with its center removed. In every image the color black indicates the lowest value, and white indicates the highest value.

Once we have designed the cake wavelets in the frequency domain we take the inverse discrete Fourier transform
and we get the *complex-valued* cake wavelets in the spatial domain.
The *real* part of the spatial wavelets are *line* detectors.
The second collection of pictures shows the real part of the spatial wavelets.
The last image in this collection is again the direct sum of the ones before,
and should look like a radial \(\operatorname{sinc}\).
The *imaginary* parts of spatial wavelets are *edge* detectors.
The third collection of pictures shows the imaginary part of the spatial wavelets.

The real or complex part of the spatial wavelets are convolved against the input image to extract the local orientations. At the bottom of the page you can see the result of this extraction.

## Generate

The drawing illustrates how the settings influence the cake wavelets in the frequency domain.
The \(i_b\) and \(i_e\) labels in the figure correspond to the *inner taper begin* and *inner taper end* settings.
The \(o_b\) and \(o_e\) correspond to *outer taper begin* and *outer taper end*.
The \(a\) label indicates the *angle taper size*.
The cake wavelets give the best result if they look "smooth" in the frequency domain.

## Visualization

### Frequency

### Real Spatial

### Imaginary Spatial

## Input Image

Please choose an image. You can also drop any image onto the page.