# How to calculate the output image with the following kernel? What is the advantage of using this equation? I guess we may use Taylor series, but I tried my best and could not get the equation.

• Welcome to SE.DSP. Generally, it is well-appreciated that one rewrites questions instead of doing a copy-paste of a scan. And personal thoughts are a plus – Laurent Duval Dec 18 '16 at 21:13
• I see,it is the first time for me to do so. and I want to ask,what if the drawback of this way? – jenn Dec 19 '16 at 2:07
• K is floor(N/2) – jenn Dec 19 '16 at 2:08
• Homogeneity of the notations and searchability are better when typing: the search engine cannot find words or equations easily in images – Laurent Duval Dec 19 '16 at 3:23
• how did you define the leftmost point and the rightmost one？a little confused – jenn Dec 20 '16 at 2:48

An image is 2D, the kernel seems 1D. So let us double check: from (b), the output image is determined for each fixed $i$, and then only depends in $j$: Equation (1) only uses the second coordinate as the moving index.

So the kernel is effectively a $1\times N$ matrix. Its sum is $1$, and as $N$ is odd, you can interpret it as an equally-weighted moving average filter, applied along lines only. So it can behave like an horizontal motion blur (Question (a)).

The direct convolution requires $N-1$ adds, and one multiply (by $1/N$). Equation (1) tries to make it more efficient, both in terms of operations and calls to samples. It simply uses a recursive formulation for 1D moving average filters (a line of the image, here $x_j = I(.,j)$:

$$\sum_{j=1}^N x_j = \sum_{j=0}^{N-1} x_j - x_0 + x_N$$

I suspect that in your formula, $K$ should be defined as $2K+1=N$. There is consistent with $K=\mathrm{floor}(N/2)$ for $N$ odd.

In other words: instead of doing sums of pixels each time you go to the right, you can reuse previous computations. The novel mean $I_0(i,j)$ is the last mean $I_0(i,j-1)$ minus $1/N$ the leftmost sample (the one that just left the previous frame) plus $1/N$ the rightmost sample (the one that just arrived).

Almost nothing to do with Taylor. The advantages:

• a running buffer of $3$ values only is needed,
• its is independent of the kernel size,
• some computations can be saved if $N$ is relatively large (say $N\ge 5$).
• K is floor(N/2) – jenn Dec 19 '16 at 1:12
• what the disadvantage of this way? – jenn Dec 19 '16 at 1:34
• how did you define the leftmost point and the rightmost one？a little confused – jenn Dec 20 '16 at 2:48