4
$\begingroup$

I'm wondering how the concept of convolution can be extended to 2D. As example, let us take a constant function $z=f(x,y)=1$ with support on $[0..1]^2 \in \mathbb{R}^2$ (see Fig. 1).

If we now convolute $f$ with itself (see Fig. 2), in the direction $(1,1)^T$, we should end up with a linear hexagonal hat function (see Fig. 3), which has the value $z=1$ at the center.

enter image description here

There are at least two ways to compute the resulting function/surface, but for both these methods I'm not completely sure how to apply them.

  • Integrating, just like convoluting two univariate functions $f(t)$ and $g(t)$: $(f * g)(t) = \int_{-\infty}^\infty f(\tau) g(t-\tau) \; d \tau$ However, in the bivariate case I guess we should use a double integral, since we're convoluting surfaces now, not curves. Moreover, we have to consider the direction in which we convolute, which in this example is $(1,1)^T$.

  • Fourier transformation. Since convolution reduces to multiplication in the frequency domain, this seems a useful method. Suppose that we would know the Fourier transform $\hat{f}$ of $f(x,y)$, how should we then involve the direction?

I hope somebody can demonstrate one or both of these methods, using the example above. References to bivariate convolution, preferably with examples, are of course also welcome!

[Edit]: Ok, using the expression $(f*g)(x,y) = \int f(x',y')g(x-x',y-y')dx'dy'$ I end up with different values than expected. For example, at $(.5,.5)$ the computed value is $.25$, instead of the expected $.5$.

Just to be sure, the convolution of the unit square (i.e. a constant value $z=1$ on $[0..1]^2 \in \mathbb{R}^2$) in the direction $(1,1)^T$ should result in the hexagonal hat function, correct?

enter image description here

Additionally, instead of the function $y$, I got the function $xy$ for the highlighted green part of the resulting function. How does one end up with $y$?

  • 0
    @RahulNarain: Ah I see, that clarifies it. Thanks! Would you consider posting this as an answer?2012-12-28

2 Answers 2

1

It turns out that two different things have been conflated together in your sentence "we now convolute convolve $f$ with itself in the direction $(1,1)^T$".

The convolution of $f$ with itself is $(f*f)(x,y) = \iint f(x',y') f(x-x',y-y')\,\mathrm dx'\,\mathrm dy',$ which for your $f$ being the box function looks like this:

The convolution of $f$ in the direction $(1,1)^T$, on the other hand, is apparently $g(x,y) = \int_0^1 f(x-t,y-t)\,\mathrm dt.$ I haven't seen this terminology before, but that's what your book seems to imply. And yields the hexagon you desire:

  • 0
    Well, you just have to do a bunch of case analysis. The essential problem is to determine, for any $(x,y)$, the range of $t$ such that $(x-t,y-t)$ lies in the region(s) of interest, in this case $[0,1]^2$. You can certainly work this out manually and get the piecewise domains for $g$. But then you'll have to do the same thing over the pieces of $g$ to get the ZP element, and that's much much worse. Best to let a computer algebra system like Mathematica deal with it: `h[x_, y_] = Integrate[g[x + t,$y$- t], {t, 0, 1}];`2012-12-30
1

2D convolution is common in optical calculations, in which there is a cylindrical geometry. The convolution of 2, 2D functions is analogous to that of 2, 1D functions:

$(f \star g)(u,v) = \int_{-\infty}^{\infty} du' dv' f(u-u',v-v')g(u',v')$

Each point $(u,v)$ represents an amount of overlap between the shifted $f$ and $g$ functions. To build the convolution function, you have to find the support in the convolution integral (i.e., where the integral is nonzero), and evaluate the overlap integral for every point in the support.

The Fourier transform stuff is entirely analogous.

  • 0
    If you are convolving$2$regions of finite support, then yes. But it is possible to have a convolution of 2 functions that are not compactly supported (like gaussians, or exponentials, or lorentzians, or...)2012-12-23