A photo is a grid of pixels, each a brightness (0 = black). Take one row of it. Write blur(row): soften the row by mixing each pixel with its two neighbours. Return one value per pixel that has a neighbour on both sides, so a row of 6 pixels gives 4.
One row of a photo, each pixel a brightness drawn as its grey. A window takes each pixel with its two neighbours, slides along, and leaves one blurred pixel under each middle one. You can see each blurred pixel’s grey: what number is it?
blur(row)| row | pixel brightnesses, left to right | e.g. [5, 5, 5, 5, 5] |
| returns | one value per pixel that has both neighbours | |