An image processing device comprising: a storage in which a model image is stored, the model image including a respective position of each of a plurality of model-image feature points (51, 71a,..., 78a) of a comparison object and a respective luminance gradient direction at the respective position of the respective model-image feature point (51, 71a,..., 78a); a feature amount acquisition unit configured to acquire a respective position of each of a plurality of input-image feature points (71b,..., 78b) and a respective luminance gradient direction at the respective position of the respective input-image feature point (71b,..., 78b) from an input image; an image comparison unit configured to compare the model image and the input image, wherein the image comparison unit is configured to perform image comparison based on allowable ranges for both the positions of the input-image feature points (71b,..., 78b) and the luminance gradient directions at the positions of the corresponding input-image feature points (71b,..., 78b), characterized in that the image processing device further comprises an allowable range setting unit which previously stores a combination of an allowable deformation pattern and an allowable deformation amount level and a combination of the allowable range for the positions of the input image feature points (71b,..., 78b) and the allowable range for the luminance gradient directions at the positions of the input image feature points (71b,..., 78b) while correlating the combination to each other, wherein the allowable range setting unit is configured to cause a user to set the allowable deformation pattern and the allowable deformation amount level, to receive the allowable deformation pattern and the allowable deformation amount level from the user, and to decide the allowable range for the positions of the input image feature points (71 b,..., 78b) and the allowable range for the luminance gradient directions at the positions of the corresponding input image feature points (71b,..., 78b) based on input from the user. a storage in which a model image is stored, the model image including a respective position of each of a plurality of model-image feature points (51, 71a,..., 78a) of a comparison object and a respective luminance gradient direction at the respective position of the respective model-image feature point (51, 71a,..., 78a); a feature amount acquisition unit configured to acquire a respective position of each of a plurality of input-image feature points (71b,..., 78b) and a respective luminance gradient direction at the respective position of the respective input-image feature point (71b,..., 78b) from an input image; an image comparison unit configured to compare the model image and the input image, wherein the image comparison unit is configured to perform image comparison based on allowable ranges for both the positions of the input-image feature points (71b,..., 78b) and the luminance gradient directions at the positions of the corresponding input-image feature points (71b,..., 78b), characterized in that the image processing device further comprises an allowable range setting unit which previously stores a combination of an allowable deformation pattern and an allowable deformation amount level and a combination of the allowable range for the positions of the input image feature points (71b,..., 78b) and the allowable range for the luminance gradient directions at the positions of the input image feature points (71b,..., 78b) while correlating the combination to each other, wherein the allowable range setting unit is configured to cause a user to set the allowable deformation pattern and the allowable deformation amount level, to receive the allowable deformation pattern and the allowable deformation amount level from the user, and to decide the allowable range for the positions of the input image feature points (71 b,..., 78b) and the allowable range for the luminance gradient directions at the positions of the corresponding input image feature points (71b,..., 78b) based on input from the user.