Convolution Operation

How is the convolution Operation recognising the edge?
I understand the process of applying the convolution operation and the overall mechanism but,still, how is it recognising edges (vertical and horizontal)
In the first example taken in the 2nd video from week 1,
the output is [[0,30,30,0],
How is this output equivalent to the middle line in the Image?
I have attached the Image.

Please explain.

Actually, the image you have attached corresponds to the input for the example you are talking about. The image corresponding to the output is the below one

Screenshot 2021-05-29 at 19-02-15 Edge Detection Example Coursera

And I guess now you can match the image with the output