And so just to take a couple of examples,
this 30 here corresponds to this three by three region,
where indeed there are bright pixels on top and darker pixels on the bottom.
It's kind of over here.
And so it finds a strong positive edge there.
And this -30 here corresponds to this region,
which is actually brighter on the bottom and darker on top.
So that is a negative edge in this example.
And again, this is kind of an artifact of the fact that we're working
with relatively small images, that this is just a six by six image.
But these intermediate values, like this -10, for
example, just reflects the fact that that filter here, it captures part
of the positive edge on the left and part of the negative edge on the right, and
so blending those together gives you some intermediate value.
But if this was a very large,
say a thousand by a thousand image with this type of checkerboard pattern,
then you won't see these transitions regions of the 10s.
The intermediate values would be quite small relative to the size of the image.
So in summary, different filters allow you to find vertical and horizontal edges.
It turns out that the three by three vertical edge detection filter
we've used is just one possible choice.
And historically, in the computer vision literature,
there was a fair amount of debate about what is the best set of numbers to use.
So here's something else you could use, which is maybe 1, 2,
1, 0, 0, 0, -1, -2, -1.
This is called a Sobel filter.
And the advantage of this is it puts a little bit more weight to the central row,
the central pixel, and this makes it maybe a little bit more robust.
But computer vision researchers will use other sets of numbers as well,
like maybe instead of a 1, 2, 1, it should be a 3, 10, 3, right?
And then -3, -10, -3.
And this is called a Scharr filter.
And this has yet other slightly different properties.
And this is just for vertical edge detection.
And if you flip it 90 degrees, you get horizontal edge detection.
And with the rise of deep learning, one of the things we learned is that when
you really want to detect edges in some complicated image, maybe you don't
need to have computer vision researchers handpick these nine numbers.
Maybe you can just learn them and treat the nine numbers of this matrix
as parameters, which you can then learn using back propagation.
And the goal is to learn nine parameters so that when you take the image,
the six by six image, and convolve it with your three by three filter,
that this gives you a good edge detector.