# Convolution a 3-D signal with 2-D signal

I have a 3D signal $M(x,y,t)$ and I want to do convolution with signal $G(x,y)$ and $Et(t)$,

I mean, how to calculate this Convolution below in Matlab?

$$A(x,y,t)=M(x,y,t) \star G(x,y) \star Et(t)$$

In my case, $M(x,y,t)$ is a movie with $k$ frame; $x,y$ are position in image and $t$ depend on frames number and frame rate. $G(x,y)$ is a gaussian shape with $x,y$ and $Et(t)$ is a simple exponential in time.

• lower dimensional signal can be extended to higher dimensional space by considering that the supplementary dimensions contain Zeros. Then you can do convolution as usual. Is that conform with your definition "convolution"? – AlexTP Jun 13 '17 at 8:58
• be careful in extending your signal as I have proposed. It depends how do you interpret your extending operation. For example if you consider $G(x,y)$ is static in time $t$, G(x,y,t) = repmat(G(x,y),1,1,l) where $l$ is duration before $G$ decays. $l=1$ is what I have said above, extending by adding zeros. Otherwise, look the answer of Laurent Duval, and then implement in Matlab depending on your signal model. – AlexTP Jun 13 '17 at 9:17
• Ok , Thanks for time spending on my question. – Sokhan Negar Jun 13 '17 at 9:26

I propose this is an abuse of notations, which can be tackled as follows: the convolution in the time dimension $$t$$ is independent of the one in the space dimensions $$(x,y)$$, in a separable way. In practice, you can convolve each 2D data $$A(x,y,.)$$ with $$G(x,y)$$, then each resulting 1D data $$A'(.,.,t)$$ with $$Et(t)$$, or in the opposite order, which is allowed due to linearity.

A cleaner version would construct the 3D operator by a tensor product operation between $$G$$ and $$Et$$, resulting in:

$$M\ast (G\otimes Et)\,.$$

This is sometimes called a (separable) space-time filter. It is simpler to implement, supposing that the perception rules differ in space and time. However, it reached its limits in following fast motions between time frame (sometimes, non-separable filters or full 3D filters are used in video).

Basically, it combines 2D and 1D filters into a genuine 3D filter $$H_{G,Et}(x,y,t)$$, so that, for each $$(x,y,t)$$:

$$H_{G,Et}(x,y,t) = G(x,y)\cdot Et(t)\,.$$

In practice, using separability is more efficient. In Matlab, if you can load all the data, if you can for instance first 2D filter each 2D frame with $$G$$, then "transpose" to get the time in the first dimension, and apply:

y = filter(b,a,x)

which is vectorized, and revert to the initial data order.

Outside this natural interpretation, I consider the above abuse very abusive.