The discrete cosine transform (DCT) helps separate the image into parts (or spectral subbands) of differing importance (with respect to the image's visual quality). The DCT is
similar to the discrete Fourier transform: it transforms a signal or image from the spatial
domain to the frequency domain.
The general equation for a 1D (N data items) DCT is defined by the following equation:
The general equation for a 2D (N by M image) DCT is defined by the following
Where Inverse DCT
p(i,j) = pixel level at the location (i, j)
F(u,v) = DCT coefficient at the frequency indices (u, v).
JPEG divides an image into 8 × 8 image subblocks and applies DCT for each
subblock individually. Hence, we simplify the general 2D-DCT in terms of 8 ×
8 size. The equation for 2D 8 × 8 DCT is modified as:
The inverse of 2D 8 × 8 DCT is expressed as: