The present invention is capable of inspecting foreign material with high precision. The present invention is provided with a background value setting part which is located near a pixel of interest, and in addition, determines a value regarded as a background value on the basis of a first pixel value of at least one reference pixel having a predetermined positional relationship with respect to the pixel of interest, and sets the value as the background value of the pixel of interest.
展开▼