Other Transforms

Editovat

Cosine Transform

Discrete Cosine Transform (DCT)
  • Uses just functions.

  • We don’t use complex numbers anymore, but we also lose some of the nice properties of the transform (e.g., shift and convolution theorem).

  • Good tool for compression, not so much for signal analysis.

  • Coefficients are divided into "DC" (zero frequency) and "AC" (other frequencies) just like with DFT.

Forward DCT:

Inverse DCT:

Derivation of DCT
  1. Let’s do the following transformation to the original signal of length :

    fa03 dct example
    Note

    The addition of interleaved zeroes is the same as stretching the original signal.

    is even (ready for DFT without complex number), has length , and the following is true:

  2. Apply DFT to :

Fast discrete cosine transform (F-DCT)
  1. Recombine signal of length to get :

  2. Run FFT on .

  3. For each do:

    1. Multiply the k-th Fourier coefficient by factor :

    2. Get only the real part of each Fourier coefficient and normalize the results:

Note

The recombination step, which created , is a clever hack of converting a sequence meant for DCT into something that can be digested by DFT, allowing us to use FFT inside FastDCT.

DCT in 2D
fa03 dct 2d basis functions

Z-transform

Z-transform

It’s a generalization of the (discrete time) Fourier transform. Wheras DTFT projects on the unit circle in the complex plane, Z-transform uses the whole complex plane. Whereas DTFT can only analyze frequencies that are stable, Z-transform can also handle unstable or exploding signals (e.g., screaching sounds or the whole image turns white or black).

  • It’s used to check that recursive linear filters don’t blow up to "infinite white" or are unstable.

  • In optimizing DWT.

  • Understanding and frequency analysis of linear filters.

  • Forward Z-tranform converts discrete time series into a continuous signal (Z-plane).

  • Forward Z-transform applied to discrete signals or linear filters always creats a polynomial with one variable .

Bilateral forward Z-transform:

Inverse Z-transform:

If is a polynomial, that is , then

Linear recursive filters

The idea is that convolution is computationally expensive () but if it could be recursive and use already-convolved neighbors as their input, the complexity would be lower ().

Wavelet Transform

Wavelet transform (WT)
  • Compared to FT, which captures global frequency information, WT provides temporal information as well.

  • Uses wavelets — functions with a peak at zero and brief, diminishing oscillations.

    • The main idea is to constrain the basis functions in time ("wavelet" = "little wave").

    • Parametrized both by frequency and time.

  • It’s not possible to have perfect information about time and frequency at the same time. WT is in the middle.

  • A mother wavelet can be any function that satisfies the wavelet constraints.

  • WT turns a 1D time function into a 2D function of time and frequency .

  • We translate the mother wavelet (shift it in time) or scale it (change its frequency).

    • Translating

    • Scaling

    • Scaling and traslating

  • are the daughter wavelets.

  • The mother wavelet is complex.

    • If it were just real, then when WT would output zero it wouldn’t necessarily mean that there is no wave of the specified frequency because the waves can cancel each other out instead of resonating. We use complex wavelets so that we can take the absolute value of the complex result and avoid this problem.

  • Time vs frequency trade-off: High-time detail for high frequencies. High-frequency detail for low frequencies.

Continuous Wavelet Transform (CWT)
Note
  • We conjugate because it’s complex and dot product works like that with complex numbers.

  • The is a normalization factor it preserves the "energy" of each stretched daughter wavelet so we treat them equally.

Wavelet constraints

Function is a wavelet if:

  1. Admissability condition: It has zero mean. There is no zero frequency component.

  2. Has finite energy. This makes it localized in time.

Well-known mother wavelets
  • Haar — The original wavelet used in DWT. Most educational.

  • Morlet — Complex exponential () + Gaussian. First wavelet used in CWT.

  • Daubechies

  • Shannon

  • Meyer

  • Mexican hat

  • triangular

fa03 haar wavelet
Obrázek 1. The Haar Wavelet

Discrete Wavelet Transform

Discrete wavelet transform (DWT)

Any WT where the wavelets are discretely sampled. In the following general definition, the original signal has length and is the decomposition level.

  • All computations are performed with floating point numbers. No complex numbers are used.

  • One forward step is between two consecutive decomposition levels is just separation of low and high frequencies.

  • One backward step between two consecutive decomposition levels is just merging of low and high frequencies.

  • The complete decomposition of a signal can be done step-by-step (i.e., recursively) or all at once (i.e., with a matrix).

  • The scaling function acts as a "bottom" to the recursion/sub-banding because we need to stop somewhere.

    • That being said, we also have to stop once we reach the resolution of the original signal.

  • The scaling function also shows "trends" in the signal. Thanks to it, we can be sure that we don’t miss any frequencies in the signal. In other words, it fixes the problem which in CWT is addressed by using complex numbers.

Forward DWT:

Inverse DWT:

where

  • and  — Orthogonal scaling and wavelet functions respectively.

  •  — Scaling coefficients, approximations for low frequencies (low = in the sub-band).

  •  — Wavelet coefficients, details for high frequencies (high = in the sub-band).

fa03 dwt coefficients
The Haar scaling and wavelet functions in DWT

We shift and scale the scaling function to cover the whole signal with length :

where:

  •  — Scale (stretch).

  •  — Shift along x-axis.

With growing , covers a smaller fraction of the original signal range:

fa03 dwt scaling function

We shift and scale the Haar wavelet in much the same way:

fa03 dwt haar wavelet
Note
Notice that is a box filter (a low-pass filter), whereas is a difference filter (a high-pass filter). Both functions are orthogonal to their integer shifts because their range is .
Filterbank

An array of bandpass filters that separate the original signal into multiple components, each carrying information about a sub-band.

DWT with the Haar functions
  • and form the basis of the DWT.

  • controls which sub-band is analyzed; it’s the decomposition level.

    • covers all frequencies.

    • focuses on high-frequencies ( is the lowest decomposition level).

  • shifts the focus the k-th "fraction" of the signal being decomposed.

  • Haar wavelets are given explicitly. The other families are enumerated (given by a table of values).

Fast discrete wavelet transform (FastDWT)

Each step corresponds to convolution with a high-pass and low-pass decomposition filter followed by down-sampling.

  • It performs sub-band coding.

  • If it has odd length, we pad it from the right.

  • Has complexity compared to FFT’s .

Fast lifting wavelet transform (LiftingWT)

An even faster DWT than FastDWT. The idea is the same as in FastDWT except the transition between decomposition levels is computed differently. It gets rid off the convolution and tries to "predict" the data instead. Has three broad phases:

  1. Split into odd and even samples. (AKA the lazy wavelet)

  2. Predict the odd samples based on the even samples and store the difference between the actual and predicted values (error) instead of the actual odd samples. (AKA dual lifting)

  3. Update the even samples by adding the error. (AKA primal lifting)

  4. (Normalize the output to avoid boosting the original signal.)

fa03 lifting wt

Compared to FastDWT, LiftingWT:

  • Requires less memory, since it can be computed in-place (overwriting the previous values).

  • Can be computed on integers only, avoiding floating-point arithmetic.

2D DWT

We use these functions:

  • scaling function at row and column .

  • intensity variations along columns.

  • intensity variations along rows.

  • intensity variations along diagonals.

fa03 2d dwt

Used for edge detection, removal of high frequencies, image compression (JPEG 2000) (e.g., for fingerprint databases), image fusion (merging photos)

Questions

Explain the relationship between DFT and DCT.

DCT uses DFT under the hood. It uses some properties of DFT to remove the imaginary part of the result. As a result DCT uses some of the nice properties of DFT.

Describe the F-DCT algorithm and compute .

See F-DCT above.

Sources