Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose I have a signal in the form of N real numbers. I am searching for a continuous pattern within this signal. The pattern is represented by M real numbers. (M < N)

To find the pattern's position within the signal I apply convolution operator c = conv(signal, pattern) and look for the highest value in c.

Should I subtract the mean from the signal and pattern before applying convolution? If so is there a formal justification?

EDIT: (since the above turned out to be trivial)

What if my signal doesn't necessarily contain the pattern and can vary in intensity (as in images) and I'm convolving with a small "patch" as a pattern? It's hard to set a threshold beyond which I decide the pattern is found.

share|improve this question
1  
The position of the maximum after convolution won't change if you subtract a constant from the signal. The justification is that convolution is linear, and the convolution of a constant function with your continuous pattern is just another constant function. –  Thomas Klimpel Oct 14 '12 at 18:14
    
@Thomas Klimpel - thanks, what if my signal doesn't necessarily contain the pattern and can vary in intensity (as in images) and I'm convolving with a small "patch" as a pattern? It's hard to set a threshold beyond which I decide the pattern is found. –  Leo Oct 14 '12 at 21:08
    
I missed the "... and pattern" part. This makes the question more interesting, because the meaning of "subtract the mean from the pattern" is ambiguous. Because of this ambiguity, the explanation from my comment doesn't apply to the case were you "subtract the mean from the pattern". –  Thomas Klimpel Oct 14 '12 at 22:00
add comment

1 Answer

The meaning of "subtract the mean from the pattern" is ambiguous, because already mean is ambiguous in case the pattern is not periodic. What you are probably thinking of it taking a bounding box of the pattern and compute the mean over that bounding box. And you probably want to subtract this mean only inside of the bounding box, and let the pattern function stay zero outside of the bounding box.

The operation described above definitively can influence the position of the maximum, and might be a good idea. One of it's effects is that the integral over the "pattern kernel" will be zero, so that the low frequency content of the signal will get ignored. You might also thing about using a more general window function instead of the indicator function of the bounding box for achieving a similar effect (in case the pattern doesn't clearly indicate where it should end).

Regarding the question about the threshold, the maximum of the convolution of the "pattern kernel" with the (original) pattern gives a good indication how to set the threshold.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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