An image processing device that processes a color image in which each pixel has gradation values of three primary colors of RGB, the device comprising: an image acquiring section configured to acquire an image including a recognition target (Pe) and a similar part of which a main color component is different from a main color component of the recognition target and brightness is similar to brightness of the recognition target, as the color image; a difference image generating section configured to: - use a first primary color image (Gr) in which a gradation value of a first primary color that is close to the main color component of the similar part, out of the three primary colors of RGB, is extracted from the color image; - use a second primary color image (Gb) in which a gradation value of a second primary color except the first primary color is extracted from the color image, and - generate a difference image (Gd) having a gradation value based on a difference obtained by subtracting the gradation value of the second primary color image (Gb) from the gradation value of the first primary color image (Gr), and - generate, as the difference image, an image having a gradation value obtained by smoothing the difference image obtained by subtracting the gradation value of the second primary color image from the gradation value of the first primary color image; a recognition image generating section configured to generate a recognition image (Gi) having a gradation value obtained by subtracting the gradation value of the difference image from a gradation value of an image in which any one of the three primary colors of RGB is extracted from the color image; and a recognition processing section configured to perform recognition processing of the recognition target using the recognition image. an image acquiring section configured to acquire an image including a recognition target (Pe) and a similar part of which a main color component is different from a main color component of the recognition target and brightness is similar to brightness of the recognition target, as the color image; a difference image generating section configured to: - use a first primary color image (Gr) in which a gradation value of a first primary color that is close to the main color component of the similar part, out of the three primary colors of RGB, is extracted from the color image; - use a second primary color image (Gb) in which a gradation value of a second primary color except the first primary color is extracted from the color image, and - generate a difference image (Gd) having a gradation value based on a difference obtained by subtracting the gradation value of the second primary color image (Gb) from the gradation value of the first primary color image (Gr), and - generate, as the difference image, an image having a gradation value obtained by smoothing the difference image obtained by subtracting the gradation value of the second primary color image from the gradation value of the first primary color image; - use a first primary color image (Gr) in which a gradation value of a first primary color that is close to the main color component of the similar part, out of the three primary colors of RGB, is extracted from the color image; - use a second primary color image (Gb) in which a gradation value of a second primary color except the first primary color is extracted from the color image, and - generate a difference image (Gd) having a gradation value based on a difference obtained by subtracting the gradation value of the second primary color image (Gb) from the gradation value of the first primary color image (Gr), and - generate, as the difference image, an image having a gradation value obtained by smoothing the difference image obtained by subtracting the gradation value of the second primary color image from the gradation value of the first primary color image; a recognition image generating section configured to generate a recognition image (Gi) having a gradation value obtained by subtracting the gradation value of the difference image from a gradation value of an image in which any one of the three primary colors of RGB is extracted from the color image; and a recognition processing section configured to perform recognition processing of the recognition target using the recognition image.