Digital ImageProcessing allows you to apply powerful transform domain techniques to your data. Transform methods are typically used in filtering, compression, and image texture analysis.

<< ImageProcessing`

Block transform coding

Transform coding compresses image data by representing the original signal with a small number of transform coefficients. It exploits the fact that for typical images a large amount of signal energy is concentrated in a small number of coefficients. Transform coding is an integral part of the Joint Photographic Experts Group (JPEG) standard for lossy image compression.

This loads one of the example images.

A = RawImageData[ImageRead["lena.tif"]] ;

Block transform coding divides an image into blocks of equal size and processes each block independently. Block processing allows the coder to adapt to local image statistics, exploit the correlation present among neighboring image pixels, and reduce computational and storage requirements. The baseline JPEG algorithm uses nonoverlapping blocks of dimensions 8×8.

Here we compute the block discrete cosine trenaform of an example image. As required by JPEG, the image is first normalized with respect to the middle gray level.

𝒜 = 
        BlockProcessing[DCT, A - 128, {8, 8}, {8, 8}, 
          MatrixJoin];

Here a multiblock segment of the original image and the corresponding DCT coefficient blocks are shown.

Show[
        GraphicsArray[(ListDensityPlot[Take[#1,  {41, 72},  {49, 80}], 
                  Mesh -> False, Frame -> False, 
                  PlotRange -> {20, 180},  
                  DisplayFunction -> Identity] &) /@ {A,  
              Abs[𝒜]}]];