# How to get the DCT energy distribution image in MATLAB,or we may call it the DCT coefficients distribution image?

The picture below is drawn by the DCT coefficients after making DCT to an image :

I want to get an image like the picture above. Here are some problems:

1. Should I do the DCT to the whole image instead of using the block DCT? And what MATLAB function should I use?
2. How to deal with the coefficients? Make it in the range of $[0, 255]$? Or make the coefficients matrix to be a Binary Image?

I would really appreciate if someone can help me!

The general shape of this image can (probably) be obtained with Matlab function DCT2 applied on the whole image (problem 1). I suspect this image comes from the absolute of the actual DCT matrix which generally has positive and negative values (problem 2). The absolute value was probably modified by a non-linear mapping, such as a logarithm or a power. The reason is you almost mostly black values on the bottom-right, probably zeroes at high frequencies. Would you have positive and negative values, this area could appear in mid-gray colors.

The PNG file has 251 colors, so the absolute DCT matrix with real values was somehow rounded to 8 bits, possibly scaled, and not binarized.

On your question: How to deal with the coefficients? you should tell us what you would like to do apart from displaying a grayscale absolute 2D DCT image. You can compute energy concentration in the DCT domain, or identify the two bright lines as two main orientations with high gradients on the original image.

The following code produces a similar image, depicted below.

parBoxCox = 0.15;