[Math] How does a cropping of a 2D matrix/image affect its DCT transform

discrete mathematicsimage processingmatricestransformation

I apologize in advance: since I am not a mathematician, maybe my question is not well defined, but I hope that some of you will still understand my meaning.

Given a 2D matrix, or an image of dimensions w1,h1.

I preform a DCT 2D transform on the image (DCT = DCT type 2).

I get a 2D result matrix. (This matrix has two frequency axes – x,y. I guess that you can define a "combined" frequency by multiplying x and y).

Now I do a slight cropping of the image. The new dimensions are w2,h2. Slight cropping means that I delete rows and/or columns, but not more than 10% of the original number of rows/columns. w1,w2 are are slightly different, and also h1,h2.

Now I preform a DCT 2D transform on the cropped image.

I got a new result matrix.

I notices that even when I do a very small cropping (even when deleting only one row from the original matrix), the DCT results are MUCH different, compared with the DCT results without the cropping.

My question is: is there any simple mathematical way to describe how slight cropping influence the DCT transform?

My guess (I am not sure) is that since the dimensions of the cropped matrix are different, there are less frequencies, so maybe there is a frequency shift, but I don't know how to describe this shift Mathematically. I also don't understand why a small shift in frequency makes such a big difference in amplitude.

Many thanks for your time & patience.

Best Answer

Briefly, the answer to your question is “No.”

Cropping an image in the spatial domain (cropping the bitmap) is not the same as cropping an image in the frequency domain (cropping the DCT). The latter corresponds more closely to resizing the image to one that's rasterized with a larger pixel.

When you crop an image in the spacial domain, then compute its DCT, you're using an entirely different set of basis functions to represent the image in terms of. I can't think of a way to describe how the DCT changes, and I doubt there's anything much recognizable to spot.

If you think of this in one dimension, it might help.

Suppose you have a signal $(X_1,X_2,\dots,X_{20})$ that's 20 “pixels” long. The DCT of that signal is a set of coefficients $(x_1,x_2,\dots,x_{20})$ that (roughly) represent the relative power of the signal at frequencies (cycles per pixel) $0,\frac{1}{40},\frac{2}{40},\frac{3}{40}\,$, and so on up to $\frac{19}{40}$.

If you crop the image to 18 pixels wide, the DCT gives you the power at frequencies $0,\frac{1}{36},\frac{2}{36},\frac{3}{36}\,$, and so on up to $\frac{17}{36}$.

Except for the power at frequency zero, none of the DCT coefficients for the cropped image represent power at the same frequency as a DCT coefficient for the uncropped image. (Note that the coefficients of the DCT are scaled by $\sqrt{2/N}$, where $N$ is the width of the image, so the frequency-0 coefficient will be slightly different.)

The situation where you would expect to see a DCT that looked like a crop of the DCT of your original image (up to the scaling factor) is if you made your image smaller not by cropping, but by resizing.