2
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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"? $\endgroup$ – AlexTP Jun 13 '17 at 8:58
  • 1
    $\begingroup$ 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. $\endgroup$ – AlexTP Jun 13 '17 at 9:17
  • $\begingroup$ Ok , Thanks for time spending on my question. $\endgroup$ – Sokhan Negar Jun 13 '17 at 9:26
0
$\begingroup$

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.

Additional reading on separability:

$\endgroup$
  • 2
    $\begingroup$ excuse me, what is a tensor operation? $\endgroup$ – Sokhan Negar Jun 13 '17 at 9:13
  • $\begingroup$ Can we always calculate spatial and temporal convolution seprate? $\endgroup$ – Sokhan Negar Jun 13 '17 at 9:57
  • $\begingroup$ Now I explain more about my case in question,Can you help me more,please? $\endgroup$ – Sokhan Negar Jun 13 '17 at 10:22
  • $\begingroup$ According to the rules of StackExchange, your initial question is quite generic (non Matlab related). The addition would better be asked as another question, perhaps with more parameters and equations. Some exponential filters can be implemented with recursive equations, more efficient than convolution. Depending on its width, different implementations are possible for the Gaussian $\endgroup$ – Laurent Duval Jun 13 '17 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.