# Applying 2D Sinc Interpolation for Upsampling in the Fourier Domain (DFT / FFT)

Related to The Proper Way to Do Sinc Upsampling (DFT Upsampling) for Uniformly Sampled Discrete Signals with Finite Number of Samples, how can one apply Sinc upsampling in the DFT / FFT domain for a 2D signal?

What are considerations when implementing it in MATLAB?

• Commented Feb 12, 2022 at 11:39
• Please open another question for the downsampling case.
– Royi
Commented Feb 12, 2022 at 14:32

Given a Matrix $$A \in \mathbb{R}^{m \times n}$$ in order to interpolate it into a grid of size $$k \times l$$ where $$k \geq m$$ and $$l \geq n$$ one could use the "Separability" property of the DFT and apply it once over the rows and once over the columns.

Things might be trickier for the case of upsampling on one dimension and downsampling on the other. In higher dimensions it even get trickier.

One of the approaches to implement this would be applying DFT along a single dimension and then apply the same interpolation as in the link per slice (Which has N-1 dimensions).

In the case of 2D it is quite simple as each slice is basically a 1D signal which can be done easily as in the link.

I implemented [ mY ] = DFTUpSample2D( mX, vSizeO ) with the following test:

clear();
close('all');

numRowsI = 5000;
numColsI = 5200;

numRowsO = 10000;
numColsO = 10400;

mY = DFTUpSample2D(mX, [numRowsO, numColsO]);

figure();
imshow(mX, []);
figure();
imshow(mY, []);
figure();
imshow(mYRef, []);

max(abs(mYRef - mY), [], 'all')

function [ mX ] = GenTest( vSize, sincRadius )

vX(end) = [];

The result is 7.2676e-05 which means the interpolation is valid.
The code is available at my StackExchange Codes Signal Processing Q81493 GitHub Repository (Look at the SignalProcessing\Q81493 folder).