I'm new to Discrete Cosine Transform (DCT) and I have a question relating to basis functions. In DCT, basis functions are defined by:

$$\alpha_p\alpha_q\cos\frac{\pi \left(2m+1\right)p}{2M}\cos\frac{\pi \left(2n+1\right)q}{2N},\quad \begin{align}0&\leq p\leq M-1\\0&\leq q\leq N-1\end{align}$$

If $M = N = 64$, we'll have $64$ basis functions. These functions have two variables including $p$ and $q$. Now, to verify, I take the first basis function with $m = n = 0$. Clearly, this function changes with different values of $p$ and $q$. Why it's drawn with same color in the following image (the upper left gray square)? enter image description here


1 Answer 1


Because the upper left square would correspond to values of $p=0$ and $q=0$, and $cos(\alpha) = 1 $ if $\alpha=0$, so you get a constant term, that is why it is all gray. Basically as you increment $p$ and $q$ you get basis images that oscillate more either in vertical or horizontal directions.

  • 1
    $\begingroup$ I think for each basis function, m and n are fixed while p and q change. This means a basis function is a function of two variables p and q. I think the gray square on the top left is representing the basis function corresponding to m = n = 0, and it has 64 values corresponding to different (p,q). $\endgroup$
    – lenhhoxung
    Apr 18, 2016 at 23:34
  • $\begingroup$ Yeah I think you are right. I'll have to take a look at an image processing book to find out exactly how the DCT is built. But i have never seen the $\alpha_p$ and $\alpha_q$ coefficients $\endgroup$
    – bone
    Apr 19, 2016 at 9:26
  • $\begingroup$ m and n are indexes for the MxN array of values. p and q are fixed for a single basis function. $\endgroup$
    – wcochran
    Jun 5, 2019 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.