Patent ID: 8041123

Claim:
A template matching processing apparatus comprising: a first calculating device for calculating a plurality of correlation values, each of which indicates a correlation between an inputted detection image and a predetermined template image, by a pixel unit while shifting the template image by the pixel unit with respect to the detection image, wherein said first calculating device calculates the plurality of correlation values by each of the pixel units which are distributed in a matrix; a second calculating device for subtracting a predetermined reference value from each of the plurality of correlation values and then calculating a coordinate position of the detection image on the basis of a coordinate position of a center of gravity of the plurality of correlation values from each of which the reference value is subtracted; and a judging device for judging a magnitude-relation between two correlation values which are adjacent to a maximum value of the plurality of correlation values in a column direction and magnitude-relation between two correlation values which are adjacent to the maximum value in a row direction, and said second calculating device subtracts, as a reference value, an average value of correlation values in an edge portion on the side on which correlation value judged to be small by said judging device is located, out of the correlation values in each column or row of the pixel units which are distributed in the matrix, from each of the plurality of correlation values and then calculates the coordinate position of the detection image on the basis of the coordinate position of the center of gravity of the plurality of correlation values from each of which the average value is subtracted.