3
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ The width of the frequency spectrum is determined by the pixel spacing in the image domain, so cropping out a few rows/columns does not affect this. What it affects is the location of the frequency samples as described below by Steve Kass. If you want to get the frequency samples at the same location as the uncropped image, zeropad the cropped image back to the original size prior to taking the DCT. How much change you'll see in the DCT is a function of how much energy is removed by the cropping. If it's small amount, then little change and vice verse. $\endgroup$ – AnonSubmitter85 Apr 19 '14 at 20:49
  • $\begingroup$ Or how much energy (at various frequencies) is added. For example, consider the DCT of a solid gray image, which has no power at non-zero frequencies, to the DCT of the same image with a small crop area painted black. Your comment is helpful in thinking about the question, and in realizing how much impact zeroing out a few rows and columns would introduce in the frequency domain. The only time there’d be a “small amount” of change at each basis frequency is when every pixel in the to-be-cropped area was already nearly zero. (The size of the crop has little direct bearing.) $\endgroup$ – Steve Kass Apr 21 '14 at 0:32
  • $\begingroup$ The original image contains w1 x h1 frequencies. The cropped image contains w2 x h2 frequencies. Maybe there is a linear formula to convert each frequency in the original image to the corresponding frequency in the cropped image. I am still trying to find the formula for "combined" 2D DCT frequency, given two axes frequencies. I think I saw the formula somewhere but I can't find it now. Simply multiplying the axes frequencies is probably not correct because [1,3] is not the same frequency as [3,1]. $\endgroup$ – algo-rithm Apr 22 '14 at 15:30
2
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Hello, I am a teacher and wanted your help in a project on resizing an image. I want to give an assignment to my students and after some of them solve it others will pore over the solution and discuss. My question will outline a technique of resizing an image using DCT. Can you help me? $\endgroup$ – Mukesh Kamath Jan 4 '16 at 10:06
  • $\begingroup$ This really isn’t my area of expertise at all (and I have no experience teaching any of this material). Perhaps some of these papers and articles on resizing using DCT will help you design a project: google.com/… $\endgroup$ – Steve Kass Jan 5 '16 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.