An image model slides a square window over a picture, and each place it stops makes one pixel of a new picture. The window is window pixels wide, pad blank pixels are added at both ends of the picture first, and the window moves step pixels each time. Write out_size(n, window, pad, step): along one side of the picture, n pixels long, how many places does the window stop? That’s how big the new picture is that way.
A pixel invader, 13 across and 10 down. An image model slides a 3 × 3 window over it and makes one new pixel at each stop. The obvious count, one stop for every pixel, runs off the edges. The goal is a new picture like the one it ends on. Your out_size says how many stops fit along one side.
out_size(n, window, pad, step)| n | how many pixels long one side of the picture is (13 across, 10 down) | e.g. 13 |
| window | how many pixels wide the square window is | e.g. 3 |
| pad | how many blank pixels are added at each end before it slides | e.g. 0 |
| step | how many pixels the window moves each time | e.g. 1 |
| returns | how many places along this side the window stops | |