Re: {JPEG}Discrete Cosine Transformation

From: Paul Chapman (paul_at_igblan.free-online.co.uk)
Date: 07/15/04


Date: Thu, 15 Jul 2004 00:31:25 +0100

Drian,

> I just want to enhance the answers here. It's important to have a
> fundamental understanding of what the Frequency domain is, and how it
> represents a complex signal.

It certainly is. Unfortunately, judging by the number of mistakes in this
post, you lack even the fundamental understanding of simple trigonometry.

> As you may know, any analog signal can
> be represented as the sum of an infinite set of waveforms...
>
> w(t) = a * cos(t + T) + b * sin(t + T)
>
> Where a and b are constant coefficients that define the shape of the
> sine wave, (T+t) is the period of the wave at time t.

T+t is not the "period of the wave". T appears to be an additional phase
shift, which is unnecessary in this form. The period of this wave is
clearly 2*pi.

> This equation is known as a "waveform".
>
> A signal is the sum of multiple waveforms...
>
> n
> ___
> \
> W(t) = k * / a[i] * cos(2*pi + t + T) + b[i] * sin(2*pi + t + T)
> ---
> i=0

First, cos(2*pi + t + T) = cos(t + T). Who knows why you added the extra
2*pi?

Secondly, your formula simplifies to

    W(t) = k * (A * cos(t + T) + B * sin(t + T))

where A and B are the sums of a[i] and b[i] respectively. A bit of a waste
of time.

Thirdly, where did you get the extra factor k from?

> This summation is called the Fourier Series. If n = infinity, then
> this Fourier Series is "continuous", if n = some finite number, then
> the Fourier series is "discrete". There is a pair of coefficients (a
> and b) for every waveform, which are known in this form as the Fourier
> Coefficients. Using this equation, we can reproduce any signal as
> long as we have the set of the Fourier coefficients.

Using *some* equation, yes, but not the one you present.

> But, what if we just have the signal, and we want to figure out what
> the coefficients are? This is EXACTLY what the Fourier Transform
> does. It takes in a signal and outputs the Fourier coefficients of
> each waveform that makes up that signal.
>
> Why is this important to image processing? Because, most of the
> visual information that our brains can process correlates well with
> low-frequency waveform patterns. That is, waveforms that have
> relatively small values for a and b.

a and b are amplitudes, not frequencies. You left frequency out of your
equations completely, which is why you are struggling to locate something
which represents it now.

> By transforming an image to the
> Fourier domain, we can filter out the high-frequency waveforms,
> leaving only the low-frequency waveforms. This leaves us with a much
> less noisy signal that compresses much, much better.
>
> So, this leads us to the Discrete Cosine Transform. The DCT is simply
> the Fourier Transform, but with the Sine component phase-shifted by 90
> degrees. That's it! That's all it is. The following equation is
> known as the Cosine Series...
>
> n
> ___
> \
> W(t) = k * / a[i] * cos(2*pi + t + T) + b[i] * cos(pi + t
> + T)
> ---
> i=0

I doubt it. For a start,

    a[i] * cos(2*pi + t + T) + b[i] * cos(pi + t + T)
  = a[i] * cos(t + T) - b[i] * cos(t + T)
  = (a[i] - b[i]) * cos(t + T)

Why have you got separate a and b coefficients when they are unnecessary?

All of the objections above also apply here. Once again, you've left out
frequency variation completely.

> There are two reasons why the DCT is important to the JPEG algorithm.
> First, it shifts the origin o the data to a[0], b[0], where as the
> origin of the DFT is always at a[T/2], b[T/2]. The output of the DCT
> is a triangular matrix, with increasing frequency radiating outwards
> from a[0], b[0] to a[T], b[T]. This makes it particularly easy to
> filter out those high-frequencies.
>
> The second reason why the DCT is important is that there is 1/4 less
> information to deal with versus the DFT.

You mean 1/4 *of*, or 3/4 less.

> If you read Guido's and
> Dave's messages, you'll learn that the reason is due to internal
> scaling that takes place somewhat mysteriously. There's nothing
> mysterious about it, and the concept is very, very, very well known
> (Take a discrete math course Guido!). If you take the DFT and simply
> fold in quadrants 1, 2, and 3 onto quadrant 4... then you have a DCT.
> The end result of which is, rather un mysteriously, 1/4 of the
> information required to represent the signal with just as much
> accuracy as the larger DFT.

I really, really hate it when someone sets themselves up as some kind of an
"expert" and then posts nonsense. I am no expert at Fourier Series, but I
know simple trig.

I am not expert enough to provide the correct formulae. But I could look
them up. Which is what I recommend to anyone who wants to know the correct
details.

Cheers, Paul



Relevant Pages

  • Re: {JPEG}Discrete Cosine Transformation
    ... > be represented as the sum of an infinite set of waveforms... ... > Where a and b are constant coefficients that define the shape of the ... > sine wave, is the period of the wave at time t. ... > long as we have the set of the Fourier coefficients. ...
    (comp.programming)
  • Re: Fourier Series on Matlab
    ... When I typed help fourier, I got a couple of comment lines from my ... To approximate the Fourier series, you just feed into ifft the ... you zero out the coefficients cM to ... For some signals, M can be as low as 5 or 6 and you ...
    (comp.soft-sys.matlab)
  • Re: {JPEG}Discrete Cosine Transformation
    ... >>as the cosine part of the discrete Fourier series. ... >>The cosines in the DCT have a phase shift. ... A signal is the sum of multiple waveforms... ...
    (comp.theory)
  • Re: {JPEG}Discrete Cosine Transformation
    ... >>as the cosine part of the discrete Fourier series. ... >>The cosines in the DCT have a phase shift. ... A signal is the sum of multiple waveforms... ...
    (comp.programming)
  • Re: Riemann-Lebseque lemma and rate of convergence
    ... > the classical riemann-lebseque lemma tell us that the fourier series ... >coefficients of a continuous or piecewise continuous function on ... >bounds on the rate of convergence to zero of the fourier coefficients? ...
    (sci.math)