Below we go through the steps of convolving two
two-dimensional arrays. You can think of
ff as representing an image and
hh represents a PSF, where
hmn=0
h
m
n
0
for
mn>1
m
n
1
and
mn<0
m
n
0
.
h=(
h00h01
h10h11
)
h
h
0
0
h
0
1
h
1
0
h
1
1
f=(
f00…f0N−1
⋮ ⋮
fN−10…fN−1N−1
)
f
f
0
0
…
f
0
N
1
⋮
⋮
f
N
1
0
…
f
N
1
N
1
Step 1 (Flip hh):

h−m−n=(
h11h100
h01h000
000
)
h
m
n
h
1
1
h
1
0
0
h
0
1
h
0
0
0
0
0
0

(6)
Step 2 (Convolve):

g00=h00f00
g
0
0
h
0
0
f
0
0

(7)
We use the statndard 2D convolution equation (

Equation 5) to find the first element of
our convolved image. In order to better understand what is
happening, we can think of this visually. The basic idea is
to take

h−m−n
h
m
n
and place it "on top" of

fkl
f
k
l
, so that just the bottom-right element,

h00
h
0
0
of

h−m−n
h
m
n
overlaps with the top-left element,

f00
f
0
0
, of

fkl
f
k
l
. Then, to get the next element of our convolved
image, we slide the fipped matrix,

h−m−n
h
m
n
, over one element to the right and get the
following result:
We continue in this fashion to find all of the elements of
our convolved image,

gmn
g
m
n
. Using the above method we define the general
formula to find a particular element of

gmn
g
m
n
as:

gmn=h00fmn+h01fmm−1+h10fmm−1−n+h11fm−1n−1
g
m
n
h
0
0
f
m
n
h
0
1
f
m
m
1
h
1
0
f
m
m
1
n
h
1
1
f
m
1
n
1

(8)