Search code examples
image-processingedge-detectionsobel

Why the sum of all the elements in Edge detection kernel is zero?


For example, In Sobel operator, the Sobel Kernel,

Gx = [-1 0 +1;
      -2 0 +2; 
      -1 0 +1];

Gy = [+1 +2 +1;
       0  0  0; 
      -1 -2 -1];

Why the sum is zero? Is there any specific reason?


Solution

  • An edge kernel is a highpass filter. Low frequencies shall be supressed, high frequencies shall pass such a filter. Edges are parts of an image with a high change of signal (gray value) and so high frequencies.

    If you design such a filter in frequency domain, it will have zeros at low frequencies and bigger values at higher frequencies. When transforming this into spatial domain (to get a kernel like you described), this will always result in a kernel, where the sum is zero.