0
$\begingroup$

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

$y[i] = \frac{\sum_{k=-L}^{L} x[i+k] w[k]}{\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).

$\endgroup$
  • $\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 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$ – Laurent Duval Jan 3 at 17:15
0
$\begingroup$

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 $\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?

| improve this answer | |
$\endgroup$
  • 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 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$ – Laurent Duval Jan 3 at 17:29
0
$\begingroup$

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:

$$\bar{x}[i]=\sum_{k=-L}^{L}x[i+k]=\bar{x}[i-1]+x[i+L]-x[i-L-1]$$

| improve this answer | |
$\endgroup$

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.