Algorithm to compute set of bins bounded by a discrete contour
问题 On a discrete grid-based plane (think: pixels of an image), I have a closed contour that can be expressed either by: a set of 2D points (x1,y1);(x2,y2);(x3,y3);... or a 4-connected Freeman code, with a starting point: (x1,y1) + 00001112... I know how to switch from one to the other of these representations. This will be the input data. I want to get the set of grid coordinates that are bounded by the contour. Consider this example, where the red coordinates are the contour, and the gray one