1. A method of processing a variable-density image of a target object having a contour which includes straight-line portions, said image comprising edge pixels representing said contour, said method comprising: a line labeling step of setting a different one of labels to each of the directions of said straight-line portions; a pixel labeling step of assigning to those of said edge pixels, which have the same direction as any one of the different directions of said straight-line portions, the same label assigned to said any one different direction; and a line segment extracting step of extracting, as a line segment, an assembly consisting of those of said edge pixels which are continuous on said image and have a same one of said labels assigned thereto, said line labeling step, said pixel labeling step and said line segment extracting step being sequentially carried out.