dct_cvip() - performs block-wise discrete cosine transform.



spect = dct_cvip(input_img, block_size)

Input Parameters include:

Output parameters include:


This function computes the discrete cosine transform of the input image. The argument block_size is usually given empty brackets [] so that, the function handles the zero padding itself.Any other value for block_size results in dividing the area of the image into squares of size block_size and taking the Discrete Cosine transform of the small windows.


1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.


Read image

 input_img = imread('Butterfly.tif');

% Block size

 block_size = 256;

% call function

 spect = dct_cvip( input_img, block_size );

% use abs to compute the magnitude (handling imaginary) and use log to brighten display

 S2 = log(1+abs(spect));

 S2 = remap_cvip(S2);

% Display input image

 figure;imshow(input_img);title('Input Image');

% Display Output image

 figure, imshow(S2,[]);title('Output DCT Image');


Author: Mehrdad Alvandipour, March 2017
Copyright © 2017-2018 Scott E Umbaugh
For updates visit CVIP Toolbox Website