摘要 |
PURPOSE:To shorten the time for inspection by holding an inputted image as gradation image data, by preparing a histogram of the number of pixels for each gradation level and by setting a threshold value of a binary-coding level between peaks of the histogram. CONSTITUTION:An image of the surface of a workpiece is inputted from a CCD camera 32 and it is inputted as gradation image data to an image gradation density memory 42. An image processor 44 prepares a histogram as the number of pixels for each luminance on the basis of the gradation image data. Since an inspection light is diffused when the surface of the workpiece is a curved surface, the histogram forms two peaks corresponding to a bright part and a dark part. The average value of each luminance forming the peak is made a threshold value of a binary-coding level. Accordingly, there is no possibility that the dark part is mistaken for the bright part on the occasion of binary- coding and that the mistaken part is detected as a defective spot in a subsequent image processing. In the case when the surface of the workpiece is a flat surface, a proper threshold value calculated on the basis of the maximum luminance and the minimum luminance of an inputted image is set. |