Usually the filters for detecting edges have the sum of all the values in the filter matrix equal to 0. For example: [-1 -2 -1, 0 0 0, 1 2 1].
Why is it so ?
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.Sign up to join this community
An edge detection filter computes a derivative. A derivative of a discrete image is approximated by finite differences, i.e. you subtract the left pixel from the right pixel. If your filter did not sum up to 0, then you would be weighing the value of one pixel more than the value of the other, and that would be wrong.