1. A template matching processing device for comparing an input image with a template, comprising: a matching unit for obtaining a positional correspondence relation between a design image for matching generated from a design data for manufacturing a desired product and a photographic image obtained by taking a photograph of the product manufactured based on the design data, which is taken by a predetermined photographing device; and a similarity-degree evaluating unit, by referring to a design image for similarity degree evaluation generated from the design data and based on the positional correspondence relation defined by the matching unit, for generating a cumulative histogram of the photographic image or an image obtained by applying a predetermined processing to the photographic image at a corresponding position of a morphology evaluation portion on the design image for similarity degree evaluation and generating a cumulative histogram of the photographic image or an image obtained by applying a predetermined processing to the photographic image at a corresponding position of an out-of-morphology evaluation portion on the design image for similarity degree evaluation, and for evaluating a desired similarity degree between the photographic image and the design image for similarity degree evaluation by referring to both of the histograms.