1. A pattern processing device comprising: an input unit to input an input image containing a plurality of pattern elements; an extraction unit that calculates edge intensities of pixels from the input image so as to extract edge pixels; an evaluation unit that obtains evaluation values for determining whether the pixels are foreground pixels or background pixels, based on comparison result between first thresholds set corresponding to the edge pixels and pixel values of pixels contained in vicinity regions of the edge pixels; a binarization determining unit that determines whether the pixels are the foreground pixels or the background pixels by comparing the evaluation values with a predetermined second threshold, and a coupling component extraction unit that extracts pixel coupling components obtained by coupling the pixels adjacent in any direction among the pixels determined to be the foreground pixels.