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

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

I knew these are the combination of smoothing filter and gradient but how are they combine to get this output ?

pcoder
  • 401
  • 1
  • 7
  • 18
  • 1
    possible duplicate of [Why Sobel operator looks that way?](http://stackoverflow.com/questions/17078131/why-sobel-operator-looks-that-way) – mbrenon Apr 07 '14 at 12:12

2 Answers2

1

The Sobel Kernel is a convolution of the derivation kernel [-1 0 1] with a smoothing kernel [1 2 1]'. The former is straightforward, the later is rather arbitrary - you can see it as some sort of discrete implementation of a 1D Gaussian of a certain sigma if you want.

Ophir Gvirtzer
  • 604
  • 4
  • 8
1

I think edge detection (ie gradient) influence is obvious - if there is a vertical edge. sobel operator Gx will definitely give big values relative to places where there is no edge because you just subtract two different values (intensity on the one side of an edge differs much from intensity on another side). The same thought on horizontal edges.

About smoothing, if you see e.g. mask for gaussian function for simga=1.0: gaussian mask

which actually does smoothing, you can catch an idea: we actaully set a pixel to a value associated to values of its neighbor. It means we 'average' values respectively to the pixel we are considering. In our case, Gx and Gy, it perforsm slightly smoothing in comparision to gaussian, but still idea remains the same.

marol
  • 4,034
  • 3
  • 22
  • 31