Image Transforms: DCT
It is well known that LSI operators may be implemented in the Fourier
transform domain, leading to computational efficiencies. The energy
compaction property of transforms, such as the discrete Fourier
transform (DFT), discrete cosine transform (DCT), and discrete wavelet
transform (DWT), plays an important role in many image/video
compression techniques. Here we demonstrate image compression using
the DCT transform.
Here we load the package.
![[Graphics:Images/index_gr_89.gif]](Images/index_gr_89.gif)
Here we load an example image.
![[Graphics:Images/index_gr_90.gif]](Images/index_gr_90.gif)
Here we take the block cosine transform of the example image. The blocks are non-overlapping,
with dimensions 8 x 8.
![[Graphics:Images/index_gr_91.gif]](Images/index_gr_91.gif)
Here we show a fragment of the example image and the DCT coefficients.
![[Graphics:Images/index_gr_92.gif]](Images/index_gr_92.gif)
We now retain cosine coefficients located in a low-frequency zone of each block. We then use the inverse DCT to calculate an approximation to the original image. Here is a typical zonal mask.
![[Graphics:Images/index_gr_94.gif]](Images/index_gr_94.gif)
![[Graphics:Images/index_gr_95.gif]](Images/index_gr_95.gif)
This reconstructs an approximation of the original.
![[Graphics:Images/index_gr_96.gif]](Images/index_gr_96.gif)
Here is the processed image and the approximation error.
![[Graphics:Images/index_gr_97.gif]](Images/index_gr_97.gif)
The compression capabilities of the DCT are clearly visible. Using
only 23% of the image's total energy, the reconstructed image (left)
is a reasonable approximation of the original. The error signal is
shown on the right. The approximation is guaranteed to improve as the
number of coefficients is increased.
|