This module extends the ideas of the Discrete Fourier Transform (DFT) into two-dimensions, which is necessary for any image processing.
2d dft
To perform image restoration (and many other useful image
processing algorithms) in a computer, we need a FourierTransform (FT) that is discrete and two-dimensional.
for
and
.
where the above equation (
)
has finite support for an
x
image.
Inverse 2d dft
As with our regular fourier transforms, the 2D DFT also has
an inverse transform that allows us to reconstruct an imageas a weighted combination of complex sinusoidal basis
functions.
Below we go through the steps of convolving two
two-dimensional arrays. You can think of
as representing an image and
represents a PSF, where
for
and
.
Step 1 (Flip
):
Step 2 (Convolve):
We use the standard 2D convolution equation (
) to find the first element of
our convolved image. In order to better understand what ishappening, we can think of this visually. The basic idea is
to take
and place it "on top" of
, so that just the bottom-right element,
of
overlaps with the top-left element,
, of
. Then, to get the next element of our convolved
image, we slide the flipped matrix,
, over one element to the right and get the
following result:
We continue in this fashion to find all of the elements ofour convolved image,
. Using the above method we define the general
formula to find a particular element of
as:
Using this equation, we can calculate the value for each
position on our final image,
. For example, due to the periodic extension of
the images, when circular convolution is applied we willobserve a
wrap-around effect.
Where the last three terms in
are a result of the wrap-around effect caused
by the presence of the images copies located all around it.
Zero padding
If the support of
is
x
and
is
x
,
then we zero pad
and
to
x
(see
).
Circular Convolution = Regular Convolution
Computing the 2d dft
where in the above equation,
is simply a 1D DFT over
.
This means that we will take the 1D FFT of each row; if wehave
rows, then it will
require
operations per row. We can rewrite this as
where now we take the 1D FFT of each column, which means
that if we have
columns,
then it requires
operations per column.
Therefore the overall complexity of a 2D FFT is
where
equals the number of pixels in the image.