# Should mean be subtracted before convolution?

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.

-
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