The discrete cosine transform (DCT) is closely related to the discrete Fourier transform. It is a separable linear transformation; that is, the two-dimensional transform is equivalent to a one-dimensional DCT performed along a single dimension followed by a one-dimensional DCT in the other dimension.
Examples
A <- matrix(50* runif(100),10,10)B <- dct2(A)B[which(B <1)]<-0AA <- idct2(B)