Looking for a formula to calculate DCT/FFT frequencies when cropping a matrix/image. Given:
A is a matrix of dimensions $W_1\times  H_1$ .
Cropping:
Few rows and/or few columns were deleted from matrix A.
We got matrix B of dimensions $W_2 \times H_2$.
Not more than 5% of matrix A rows/columns were deleted, so $W_1\sim W_2$ , $H_1\sim H_2$
DCT or FFT transform:
Matrix AD is the DCT transformation of Matrix A.
Matrix BD is the DCT transformation of Matrix B.
(DCT = DCT 2D type 2).
Looking for a formula to calculate the frequencies:
The dimensions of matrix AD are W1 x H1, so it contains W1 x H1 frequencies.
The dimensions of matrix BD are W1 x H1, so it contains W2 x H2 frequencies.
Lets say that Fij is a single frequency in matrix AD.
i, j are the related indexes in matrix AD.
I am looking for a formula to calculate the corresponding/matching frequency Fuv in matrix BD.
u,v are the related indexes in matrix BD.
The amplitudes of Fij and Fuv are supposed to be similar (identical or very close).
Any ideas?
Here is a numerical example. I calculated the frequencies, and wrote them near the x,y indexes, as suggested in the first answer below (You can save the images to see them in larger view):




I don't see any data from matrix DCT-A in matrix DCT-B, even that matrix B is almost the same as A.
 A: You know that the normalized frequency sample locations for a shifted $M$-point FFT/DFT are given by
$$
f_{m} = 
\begin{cases}
-0.5 + m/M, & \mathrm{if} \,\, M \,\,\mathrm{even} \\
-0.5 + m/M + 1/(2M), & \mathrm{if} \,\, M \,\,\mathrm{odd}
\end{cases}
$$
where $m = 0, 1, \dots, M-1$.
Since we are given $f_{ij} = (f_i, f_j)$ and want to find the frequency sample $f_{uv}$ that is closest to it, what you can do is define the vectors $f_u$ and $f_v$ using the formula above and then simply search for the locations that are closest to $f_i$ and $f_j$. If you want a formula, I think the best you can do would be something like the following. If we consider only the $u$-dimension knowing that the $v$-dimension is handled the same way and we let $M_u$ be the number of samples in the FFT/DCT, then the (zero-based) index of the frequency sample nearest to $f_i$ is
$$
m_u = \operatorname{round} \left( M_u ( f_i - f_{u0} )  \right),
$$
where $f_{u0}$ is the location of the $u$-dimension's first frequency sample. You can then set $m = m_u$ to get the location of the frequency sample or just use $m_u$ to index into the array -- whatever fits your needs.
Note that above uses normalized sample locations and assumes that you have shifted the spectrums so that DC is in the middle. If the spectrum is not shifted, then the above formula for $m_u$ will not work since the location of the frequency samples will not be in increasing order. If you are working with unshifted spectrums you can always revert to looping over each frequency sample location and keeping the ones with the minimum distances to $f_u$ and $f_v$.
