A photo is a grid of pixels, each a brightness. Write edge(patch): given one pixel and its 8 neighbours, a 3 × 3 grid with the pixel in the middle (patch[1][1]), say how strong the edge is there: how fast the brightness changes, per pixel.
A night-sky photo, each pixel a brightness drawn as its grey. Walk across the moon and the brightness climbs, stays flat, then drops: the edges are where it changes, not where it’s brightest. The goal is an edge map like the one it ends on. Your edge(patch) sees one pixel and its 8 neighbours and says how strong the edge is there.
edge(patch)| patch | patch[1][1] is the pixel, patch[0] the row above, patch[: , 0] the column to its left | e.g. [[0, 0, 0], [0, 0, 0], [0, 0, 0]] |
| returns | how strong the edge is at the pixel: how fast the brightness changes, per pixel | |