Digitization of polygons. Part 1: Image preprocessing.