How do computers find edges in an image?
Of course, to a human this is a trivial task. But to a computer, all that it “sees” is a collection of RGB values.
One popular technique is called the Sobel operator.
Kernels & Convolutions
In image processing, a kernel is also called a “mask” or “filter”.
This is kernel/mask/filter for horizontal edge detection:
This is a kernel for vertical edge detection: