Patent ID: 8498489

Claim:
An image inspection apparatus which acquires a template and a search image and performs template matching on the search image, the apparatus comprising: a computer; and a non-transitory storage medium which stores a control program, wherein: the control program, when executed by the computer, causes the computer to function as: an edge image generation section which generates edge images of the template and the search image; a template matching processing section which performs template matching using the edge images of the template and the search image; a correlation value contribution rate map generation section which generates a correlation value contribution rate map indicating a portion contributing to achieving similarity between the template and the search image, for each of candidate positions in a plurality of matching results obtained by the template matching; a luminance correction section which corrects luminance of the template and the search image based on the correlation value contribution rate maps; a local matching processing section which performs local matching again on a vicinity of each of the candidate positions in the matching results using the template and search image subjected to the luminance correction; and a sorting processing section which sorts the plurality of matching results based on the candidate positions and correlation values newly obtained by the local matching process, and the correlation value contribution rate map generation section generates a correlation value contribution rate map indicating a portion of each of the edge images of the template and the search image which has a pixel value equal to or larger than a predetermined value.