3
$\begingroup$

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 ?

$\endgroup$

2 Answers 2

7
$\begingroup$

An edge detection filter is, by definition, a high-pass filter. It is looking for quick changes (i.e. high frequencies), not slow trends. Thus, a good edge detection filter will have a response of 0 at DC. A FIR filter whose taps sum to 0 has a response of 0 at DC.

$\endgroup$
2
  • 1
    $\begingroup$ how can we interpret the response of 0 at DC in terms of image ? $\endgroup$
    – krammer
    Oct 1, 2013 at 19:04
  • 1
    $\begingroup$ It means that it eliminates all of the image averages. For instance, if the image is "reddish", most of the red will go away. In case it's not clear, an edge detection filter is more than just a filter that gets rid of the DC. That's just one characteristic of an edge detection filter. $\endgroup$
    – Jim Clay
    Oct 1, 2013 at 20:35
5
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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