Assume the following operation on input $x$ with filter $w$ of size $2L+1$:

$$y[i] = \frac{\displaystyle\sum_{k=-L}^{L} x[i+k] w[k]}{\displaystyle\sum_{k=-L}^{L} x[i+k]}$$

In other words, my desired filter does a convolution and divides by the sum. Does this operation has a name (or implemented in conventional software such as MATLAB or python's Scipy)?

In case you are wondering why I need that, this is my problem: I'm having a 1-D temporal signal in which some textures (say edges) are to be discovered. The noise has attenuated locally (in time) some of the textures by some scaling factor which is unknown to me. Now I want to discover the potential time locations where a certain texture happens by normalizing the output of usual filter to the sum of absolute values of my signal (I've dropped the abs() since my signal is positive always).

  • $\begingroup$ That's a strange way of doing things. Any input that that's mean free is going to produce potentially very large output and it's going to look rather noisy. If you want to normalize to the input power, it's typically done by dividing by something derived from the sliding sum of the squares not the signal itself. What are you trying to do ? $\endgroup$
    – Hilmar
    Jan 3 '20 at 16:10
  • $\begingroup$ Edges and textures are somehow different. Is the noise positive as well (since you assume that $x$ including noise is positive)? What do you want the $w$ to like like? $\endgroup$ Jan 3 '20 at 17:15
  • $\begingroup$ Any validation or vote in sight? $\endgroup$ Sep 25 at 8:57

If the signal is positive (or at least non-negative, with no long runs of zeros that could make the sum in denominator zero), then what you have is a basic filter with kernel $w[-n]$, combined with a simple automatic gain control.

Note that the term in the denominator could be implemented recursively:



This is the result of a convolution divided by the result of another convolution. The convolution in the denominator uses all weights of 1.

It is trivial to implement using the convolution function twice, and dividing the two results.


It is not really a convolution, more a weighting. Your expression is $0$ homogeneous in $x$, as you divide $x$s values by $x$s. Specifically:

  • it is not defined if $$\displaystyle\sum_{-K,K} x[i+k] = 0$$
  • if $x[k]$ is locally a constant, the output does not depend on it (because it will be equal to $\sum h[k]$)
  • if $h[k]$ is an averaging filter ($h[k] = \frac{1}{2K+1}$), the output will be $\frac{1}{2K+1}$

So globally I would not consider it as a classical filter for $x$. But it could be seen as an adaptive weighting for $h$, based on a unit-normalized window $\chi$ with $$\chi[n] = \frac{x[n]}{\sum_{|k|\le K} x[n]}.$$ As such, it is easily implemented in Matlab or Python. So far, I don't have a use for it. What was your purpose?

  • 1
    $\begingroup$ I'm aware of the points you mentioned. Specifically, for my signal, the first case never happens as it is always positive. I'm also OK with the second and third properties. I updated my question to address your question. $\endgroup$
    – arash
    Jan 3 '20 at 17:01
  • $\begingroup$ Thank you. It is important to know whether the noise is positive as well, and the shape of the $w$ filter $\endgroup$ Jan 3 '20 at 17:29

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.