1
$\begingroup$

As I know, masks like follow are derivative mask, enter image description here

but I don't get it why they can detect edges and which one of them can find vertical edges and which one can find harizontal edges?

$\endgroup$
1
$\begingroup$

Basically, the triplet 1,0,-1 (and similarly 2,0,-2) is a discrete, 3-point derivative operator. It can be applied column- (left) or row-wise (right). Let us try first with a row: a flat one, f = 0,0,0,0,0,0,0,0, a step-like s = 0,0,0,1,1,1,1,1 and one hat-like 0,0,0,1,1,0,0,0. 0 here denotes black, and 1 white.

The results will be, on the $6$ central points for each:

  • f: 0,0,0,0,0,0
  • s: 0,1,1,0,0,0
  • h: 0,1,1,-1,-1,0

The same reasoning applies to columns. The Sobel operators are composed of a second filter in the opposite direction: 1,2,1 that smoothes the data. So the global effect: it differentiates in one direction, smoothes in the other. THe resulting value will be high or low, positive or negative, depending on the type of contour in the image.

The (close-to-)zero values are features not detected by the derivative (hopefully non-edges). High amplitude values and their signs are hopefully the strength of the edge and the grading (positive: black-to-white, negative: white-to-black).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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