JP2018106456A - Image processing device and image processing method - Google Patents

Image processing device and image processing method Download PDF

Info

Publication number
JP2018106456A
JP2018106456A JP2016252740A JP2016252740A JP2018106456A JP 2018106456 A JP2018106456 A JP 2018106456A JP 2016252740 A JP2016252740 A JP 2016252740A JP 2016252740 A JP2016252740 A JP 2016252740A JP 2018106456 A JP2018106456 A JP 2018106456A
Authority
JP
Japan
Prior art keywords
image
defect
defect component
pixel
distance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2016252740A
Other languages
Japanese (ja)
Inventor
小島 広一
Koichi Kojima
広一 小島
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2016252740A priority Critical patent/JP2018106456A/en
Publication of JP2018106456A publication Critical patent/JP2018106456A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide an image processing device and an image processing method capable of detecting defects with high accuracy even in the case that the defects having different contrasts and sizes in a photographic image to be inspected exists in the photographic image.SOLUTION: The image processing device and the image processing method include: an initial stage step image processing process including a first defect component detection image generation step (St2) for generating a defect component detection image about a photographic image, and a first defect component removal image generation step (St3) for generating a defect component removal image about the photographic image; a post stage step image processing process including a second defect component detection image generation step (St4) for generating a defect component detection image about the defect component removal image, and a second defect component removal image generation step (St5) for generating a new defect component removal image obtained by removing a defect component from the defect component removal image; and a defect extraction process for generating a defect extraction image from the photographic image or the defect component removal image obtained in each step.SELECTED DRAWING: Figure 2

Description

本発明は、被検査物を撮像した画像を処理することで、被検査物の傷、異物、シミ、あるいはムラ等のように、背景との輝度差(コントラスト)や大きさが異なる欠陥が撮影画像内に混在する場合でもこれらの欠陥を精度よく検出することが可能な画像処理装置、および、画像処理方法に関するものである。   The present invention processes an image obtained by imaging an object to be inspected, so that a defect having a luminance difference (contrast) or a size different from that of a background such as a scratch, a foreign object, a stain, or unevenness of the object to be inspected is photographed. The present invention relates to an image processing apparatus and an image processing method capable of accurately detecting these defects even when they are mixed in an image.

被検査物の表面の異物や傷の欠陥を検出する場合、被検査物の撮影画像に対して画像処理を行うことで自動化が図られている。例えば、特許文献1に開示されている技術は、被検査物の撮影画像における所定の画素(注目画素)の近傍の複数の画素位置における背景の画素値(画素の輝度値)を算出し、算出した背景画素推定値のそれぞれに対して統計的処理を施すことで、各注目画素に関して背景画素推定値を選択することで背景画像を生成し、撮影画像と背景画素との差分を取ることで欠陥を抽出している。具体的には、注目画素の周囲に所定の間隔で複数の画素(タップ)が1次元配列、若しくは2次元配列で設定され、その設定された複数の画素の輝度値が2次曲線近似若しくは補間されて、これらの画素範囲での輝度変化が近似される。そして、得られた近似曲線に基づき、検査対象画素位置での値が背景画素値として推定されて、背景画像が生成される。この従来技術では、注目画素の周囲のタップの選択から背景画素の推定までがフィルター処理とされる。このフィルター処理では精度を高めるため、上記のタップの間隔が異なる複数のフィルター処理が適用される。そして、フィルター処理毎に、近似に用いた画素と近似曲線との差が求められ、その差の二乗和、若しくは絶対値の和が求められて差分分散評価値とされ、その評価値が最小となるフィルターの結果が選択されて、背景画素値が推定される。   In the case of detecting a foreign matter or a flaw defect on the surface of the inspection object, automation is achieved by performing image processing on a captured image of the inspection object. For example, the technique disclosed in Patent Document 1 calculates a background pixel value (pixel luminance value) at a plurality of pixel positions in the vicinity of a predetermined pixel (target pixel) in a captured image of an inspection object. By performing statistical processing on each of the estimated background pixel values, a background image is generated by selecting a background pixel estimated value for each pixel of interest, and a defect is obtained by taking the difference between the captured image and the background pixel. Is extracted. Specifically, a plurality of pixels (tap) are set around the pixel of interest at a predetermined interval in a one-dimensional array or a two-dimensional array, and the luminance values of the set pixels are quadratic curve approximated or interpolated. Thus, the luminance change in these pixel ranges is approximated. Then, based on the obtained approximate curve, a value at the inspection target pixel position is estimated as a background pixel value, and a background image is generated. In this prior art, the process from the selection of taps around the pixel of interest to the estimation of the background pixel is the filtering process. In order to improve accuracy in this filtering process, a plurality of filtering processes with different tap intervals are applied. Then, for each filtering process, the difference between the pixel used for the approximation and the approximate curve is obtained, and the sum of squares of the differences or the sum of absolute values is obtained as the difference variance evaluation value, and the evaluation value is the minimum. Is selected to estimate the background pixel value.

特開2014−135007号公報JP 2014-135007 A

上記のように、従来技術におけるフィルター処理では、近似が行われる画素の範囲内において、欠陥と背景との境界付近では、推定された背景の画素値と実際の背景の画素値との間に誤差が生じ、正確な欠陥の検出が困難となる。正確な検出を行うためには、タップが、注目画素との間の範囲内に欠陥を全て含むように、なお且つ、欠陥内に入らないように設定する必要がある。しかしながら、タップの設定時に画像のどこにどのような欠陥があるのかを把握することは難しい。このため、従来技術では、欠陥の検出精度に限界があった。特に、背景との輝度値の差が比較的低い低コントラスト欠陥については正確に検出することが困難であった。   As described above, in the filtering process according to the conventional technique, an error is detected between the estimated background pixel value and the actual background pixel value in the vicinity of the boundary between the defect and the background within the range of pixels to be approximated. This makes it difficult to detect defects accurately. In order to perform accurate detection, it is necessary to set the tap so as to include all the defects within the range between the target pixel and not to enter the defects. However, it is difficult to grasp what kind of defect is present in the image when setting the tap. For this reason, the conventional technology has a limit in the accuracy of defect detection. In particular, it has been difficult to accurately detect a low-contrast defect with a relatively low difference in luminance value from the background.

本発明は、このような事情に鑑みてなされたものであり、その目的は、被検査物の撮影画像におけるコントラストや大きさが異なる欠陥が撮影画像内に混在する場合でもこれらの欠陥を精度よく検出することが可能な画像処理装置、および、画像処理方法を提供することにある。   The present invention has been made in view of such circumstances, and an object of the present invention is to accurately detect defects having different contrasts and sizes in a captured image of an inspection object even in the captured image. An object is to provide an image processing apparatus and an image processing method capable of detection.

本発明の画像処理装置は、上記目的を達成するために提案されたものであり、被検査物を撮像して得られた撮影画像について欠陥成分検出画像を作成する第1欠陥成分検出画像作成工程、および、前記撮影画像から欠陥成分を除去した欠陥成分除去画像を作成する第1欠陥成分除去画像作成工程を含む初段ステップ画像処理工程を実行する初段画像処理手段と、
欠陥成分除去画像について欠陥成分検出画像を作成する第2欠陥成分検出画像作成工程、および、欠陥成分除去画像から欠陥成分を除去して新たな欠陥成分除去画像を作成する第2欠陥成分除去画像作成工程を含む後段ステップ画像処理工程を実行する後段画像処理手段と、
前記撮影画像または各ステップで得られた欠陥成分除去画像のうちの任意の画像同士の輝度値の差により欠陥抽出画像を作成する欠陥抽出手段と、
を備え、
前記初段画像処理手段は、
前記第1欠陥成分検出画像作成工程において、
検査対象画素と、前記検査対象画素と比較する比較画素と、の間の画素数を示す画素距離を、第1の距離に設定することで、
前記撮影画像について、構成する画素毎に前記第1の距離に対応するサイズの欠陥成分を検出して欠陥成分検出画像を作成し、
前記第1欠陥成分除去画像作成工程において、
前記撮影画像と前記第1欠陥成分検出画像作成工程で作成した前記欠陥成分検出画像との輝度値の加減算により欠陥成分除去画像を作成し、
前記後段画像処理手段は、
前記第2欠陥成分検出画像作成工程において、
画素距離を前ステップにおける画素距離よりも長い第2の距離に設定することで、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について、構成する画素毎に前記第2の距離に対応する欠陥成分を検出して欠陥成分検出画像を作成し、
前記第2欠陥成分除去画像作成工程において、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像と、前記第2欠陥成分検出画像作成工程で作成した欠陥成分検出画像と、の輝度値の加減算により新たな欠陥成分除去画像を作成する、
ことを特徴とする。
The image processing apparatus of the present invention has been proposed in order to achieve the above object, and a first defect component detection image creation step for creating a defect component detection image for a photographed image obtained by imaging an inspection object. And first-stage image processing means for executing a first-stage step image processing step including a first defect component-removed image creating step for creating a defect component-removed image obtained by removing a defect component from the photographed image;
A second defect component detection image creation step for creating a defect component detection image for the defect component removal image, and a second defect component removal image creation for creating a new defect component removal image by removing the defect component from the defect component removal image A post-stage image processing means for executing a post-stage image processing process including the process;
Defect extraction means for creating a defect extraction image based on a difference in luminance value between arbitrary images of the captured image or the defect component removal image obtained in each step;
With
The first stage image processing means includes:
In the first defect component detection image creation step,
By setting the pixel distance indicating the number of pixels between the inspection target pixel and the comparison pixel to be compared with the inspection target pixel to the first distance,
For the captured image, a defect component detection image is created by detecting a defect component having a size corresponding to the first distance for each pixel constituting the image,
In the first defect component removal image creation step,
Create a defect component removal image by adding and subtracting a luminance value between the captured image and the defect component detection image created in the first defect component detection image creation step,
The latter stage image processing means includes:
In the second defect component detection image creation step,
By setting the pixel distance to a second distance that is longer than the pixel distance in the previous step,
For a defect component removal image having a pixel distance equal to or less than the pixel distance in the current step, a defect component corresponding to the second distance is detected for each pixel constituting the defect component detection image,
In the second defect component removal image creation step,
Creating a new defect component removal image by adding and subtracting luminance values of the defect component removal image whose pixel distance is equal to or less than the pixel distance in the current step and the defect component detection image created in the second defect component detection image creation step;
It is characterized by that.

本発明によれば、ステップごとに画素距離を広げながら欠陥成分検出画像作成工程および陥成分除去画像作成工程が繰り返されて、サイズが小さい欠陥成分から順に検出および除去され、それぞれの欠陥成分の欠陥成分検出画像および欠陥成分除去画像が得られる。そして、これらの欠陥成分除去画像同士の差分により欠陥が抽出されるので、従来技術のような平滑化や近似式を用いることなく、より高い精度で被検査物の撮影画像から欠陥を抽出することが可能となる。特に、撮影画像にコントラストの高い欠陥、低い欠陥が混在している場合においても、誤検出を低減しつつ検出することが可能となる。また、画素距離が異なるステップの欠陥成分除去画像同士を用いて任意のサイズの欠陥を抽出することもできるので、欠陥検出の自由度が向上する。   According to the present invention, the defect component detection image creation step and the defect component removal image creation step are repeated while increasing the pixel distance for each step, and the defect components of the respective defect components are detected and removed in order from the smallest defect component. A component detection image and a defect component removal image are obtained. And since a defect is extracted by the difference between these defect component removal images, it is possible to extract a defect from a captured image of an inspection object with higher accuracy without using smoothing or an approximate expression as in the prior art. Is possible. In particular, even when a high-contrast defect and a low defect are mixed in the captured image, detection can be performed while reducing false detection. In addition, since defects of any size can be extracted using defect component-removed images at different pixel distances, the degree of freedom in defect detection is improved.

また、上記構成において、前記初段画像処理手段は、前記第1欠陥成分検出画像作成工程において、前記撮影画像について検査対象画素に対し前記第1の距離で比較画素を複数設定し、各比較画素の輝度値と当該検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成し、
前記後段画像処理手段は、前記第2欠陥成分検出画像作成工程において、画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について検査対象画素に対し前記第2の距離で比較画素を複数設定し、各比較画素の輝度値と前記検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成する構成を採用することが望ましい。
In the above configuration, the first-stage image processing means sets a plurality of comparison pixels at the first distance with respect to the inspection target pixel for the photographed image in the first defect component detection image creation step, and Create a defect component detection image based on the difference between the luminance value and the luminance value of the pixel to be inspected,
In the second defect component detection image creating step, the subsequent image processing means sets a plurality of comparison pixels at the second distance with respect to the inspection target pixel for a defect component removal image whose pixel distance is equal to or smaller than the pixel distance in the current step. It is desirable to adopt a configuration in which a defect component detection image is created based on the difference between the luminance value of each comparison pixel and the luminance value of the inspection target pixel.

この構成によれば、例えば、撮影画像におけるムラやシミ等の比較的大きいサイズの欠陥の中に、傷等の比較的小さいサイズの欠陥が含まれているような場合や、あるいは、撮影画像内に被検査物の構造物(突起や凹部)等のエッジ(コントラストが急激に変化する部分)が存在する場合においても、サイズが小さい欠陥成分から順次検出・除去されていくので、誤検出が抑制される。   According to this configuration, for example, a relatively large size defect such as unevenness or a spot in the captured image includes a relatively small size defect such as a scratch, or Even when there are edges (parts where the contrast changes abruptly) such as structures (protrusions and recesses) of the object being inspected, it is detected and removed sequentially from the defect components with small sizes, thus suppressing false detection Is done.

また、上記構成において、前記初段画像処理手段および前記後段画像処理手段は、それぞれ前記第1欠陥成分検出画像作成工程および前記第2欠陥成分検出画像作成工程において、検出の対象とする欠陥のサイズに応じて前記画素距離を設定することが望ましい。   Further, in the above configuration, the first-stage image processing means and the second-stage image processing means respectively set the size of the defect to be detected in the first defect component detection image creation step and the second defect component detection image creation step, respectively. It is desirable to set the pixel distance accordingly.

この構成によれば、撮影画像における目的とするサイズの欠陥を検出することが可能となる。   According to this configuration, it is possible to detect a defect of a target size in a captured image.

また、上記構成において、前記後段画像処理手段は、画素距離をステップ毎に順次広げて前記後段ステップ画像処理工程を複数ステップ実行する構成を採用することが望ましい。   In the above configuration, it is preferable that the post-stage image processing means adopts a configuration in which the post-step image processing process is executed in a plurality of steps by sequentially increasing the pixel distance for each step.

この構成によれば、画素距離をステップ毎に順次広げて前記後段ステップ画像処理工程を複数ステップ実行することで、欠陥成分の検出精度をより高めることが可能となる。   According to this configuration, it is possible to further increase the detection accuracy of the defect component by sequentially increasing the pixel distance for each step and executing the subsequent step image processing step a plurality of steps.

また、本発明の画像処理方法は、被検査物を撮像して得られた撮影画像について欠陥成分検出画像を作成する第1欠陥成分検出画像作成工程、および、前記撮影画像から欠陥成分を除去した欠陥成分除去画像を作成する第1欠陥成分除去画像作成工程を含む初段ステップ画像処理工程と、
欠陥成分除去画像について欠陥成分検出画像を作成する第2欠陥成分検出画像作成工程、および、欠陥成分除去画像から欠陥成分を除去して新たな欠陥成分除去画像を作成する第2欠陥成分除去画像作成工程を含む後段ステップ画像処理工程と、
前記撮影画像または各ステップで得られた欠陥成分除去画像のうちの任意の画像同士の輝度値の差により欠陥抽出画像を作成する欠陥抽出工程と、
を含み、
前記第1欠陥成分検出画像作成工程において、
検査対象画素と、前記検査対象画素と比較する比較画素と、の間の画素数を示す画素距離を、第1の距離に設定することで、
前記撮影画像について、構成する画素毎に前記第1の距離に対応するサイズの欠陥成分を検出して欠陥成分検出画像を作成し、
前記第1欠陥成分除去画像作成工程において、
前記撮影画像と前記第1欠陥成分検出画像作成工程で作成した前記欠陥成分検出画像との輝度値の加減算により欠陥成分除去画像を作成し、
前記第2欠陥成分検出画像作成工程において、
検査対象画素と、前記検査対象画素と比較する比較画素と、の間の画素数を示す画素距離を、前ステップにおける画素距離よりも長い第2の距離に設定することで、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について、構成する画素毎に前記第2の距離に対応する欠陥成分を検出して欠陥成分検出画像を作成し、
前記第2欠陥成分除去画像作成工程において、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像と、前記第2欠陥成分検出画像作成工程で作成した欠陥成分検出画像と、の加減算により新たな欠陥成分除去画像を作成する、
ことを特徴とする。
The image processing method of the present invention also includes a first defect component detection image creating step for creating a defect component detection image for a photographed image obtained by imaging the inspection object, and removing the defect component from the photographed image. A first step image processing step including a first defect component removal image creation step of creating a defect component removal image;
A second defect component detection image creation step for creating a defect component detection image for the defect component removal image, and a second defect component removal image creation for creating a new defect component removal image by removing the defect component from the defect component removal image A post-step image processing process including a process;
A defect extraction step of creating a defect extraction image by a difference in luminance value between arbitrary images of the captured image or the defect component removal image obtained in each step;
Including
In the first defect component detection image creation step,
By setting the pixel distance indicating the number of pixels between the inspection target pixel and the comparison pixel to be compared with the inspection target pixel to the first distance,
For the captured image, a defect component detection image is created by detecting a defect component having a size corresponding to the first distance for each pixel constituting the image,
In the first defect component removal image creation step,
Create a defect component removal image by adding and subtracting a luminance value between the captured image and the defect component detection image created in the first defect component detection image creation step,
In the second defect component detection image creation step,
By setting the pixel distance indicating the number of pixels between the inspection target pixel and the comparison pixel to be compared with the inspection target pixel to a second distance longer than the pixel distance in the previous step,
For a defect component removal image having a pixel distance equal to or less than the pixel distance in the current step, a defect component corresponding to the second distance is detected for each pixel constituting the defect component detection image,
In the second defect component removal image creation step,
Creating a new defect component removal image by adding and subtracting the defect component removal image whose pixel distance is equal to or less than the pixel distance in the current step and the defect component detection image created in the second defect component detection image creation step;
It is characterized by that.

本発明によれば、ステップごとに画素距離を広げながら欠陥成分検出画像作成工程および陥成分除去画像作成工程が繰り返されて、サイズが小さい欠陥成分から順に検出および除去され、それぞれの欠陥成分の欠陥成分検出画像および欠陥成分除去画像が得られる。そして、これらの欠陥成分除去画像同士の差分により欠陥が抽出されるので、従来技術のような平滑化や近似式を用いることなく、より高い精度で被検査物の撮影画像から欠陥を抽出することが可能となる。特に、撮影画像にコントラストが相対的に高い欠陥、コントラストが相対的に低い欠陥が混在している場合においても、誤検出を低減しつつ検出することが可能となる。また、画素距離が異なるステップの欠陥成分除去画像同士を用いて任意のサイズの欠陥を抽出することもできるので、欠陥検出の自由度が向上する。   According to the present invention, the defect component detection image creation step and the defect component removal image creation step are repeated while increasing the pixel distance for each step, and the defect components of the respective defect components are detected and removed in order from the smallest defect component. A component detection image and a defect component removal image are obtained. And since a defect is extracted by the difference between these defect component removal images, it is possible to extract a defect from a captured image of an inspection object with higher accuracy without using smoothing or an approximate expression as in the prior art. Is possible. In particular, even when a defect having a relatively high contrast and a defect having a relatively low contrast are mixed in the captured image, detection can be performed while reducing false detection. In addition, since defects of any size can be extracted using defect component-removed images at different pixel distances, the degree of freedom in defect detection is improved.

上記方法において、前記第1欠陥成分検出画像作成工程において、前記撮影画像について検査対象画素に対し前記第1の距離で比較画素を複数設定し、各比較画素の輝度値と当該検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成し、
前記第2欠陥成分検出画像作成工程において、画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について検査対象画素に対し前記第2の距離で比較画素を複数設定し、各比較画素の輝度値と前記検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成することが望ましい。
In the above method, in the first defect component detection image creating step, a plurality of comparison pixels are set at the first distance with respect to the inspection target pixel in the captured image, and the luminance value of each comparison pixel and the luminance of the inspection target pixel are set. Create a defect component detection image based on the difference from the value,
In the second defect component detection image creation step, a plurality of comparison pixels are set at the second distance with respect to a pixel to be inspected for a defect component removal image whose pixel distance is equal to or less than the pixel distance in the current step, and the luminance value of each comparison pixel It is desirable to create a defect component detection image based on the difference between the brightness value of the pixel to be inspected and the inspection target pixel.

これによれば、例えば、撮影画像におけるムラやシミ等の比較的大きいサイズの欠陥の中に、傷等の比較的小さいサイズの欠陥が含まれているような場合や、あるいは、撮影画像内に被検査物の構造物等のエッジが存在する場合においても、サイズが小さい欠陥成分から順次検出・除去されていくので、誤検出が抑制される。   According to this, for example, a relatively large size defect such as unevenness or a stain in the captured image includes a relatively small size defect such as a scratch, or in the captured image. Even when there is an edge such as a structure of the object to be inspected, since the defect components having small sizes are sequentially detected and removed, erroneous detection is suppressed.

また、前記第1欠陥成分検出画像作成工程および前記第2欠陥成分検出画像作成工程において、検出の対象とする欠陥のサイズに応じて前記画素距離を設定することが望ましい。   In the first defect component detection image creation step and the second defect component detection image creation step, it is preferable that the pixel distance is set according to the size of a defect to be detected.

これによれば、撮影画像における目的とするサイズの欠陥を検出することが可能となる。   According to this, it becomes possible to detect a defect of a target size in a captured image.

さらに、前記後段ステップ画像処理工程は、画素距離をステップ毎に順次広げて複数ステップ実行することが望ましい。   Furthermore, it is preferable that the latter step image processing step is executed in a plurality of steps by sequentially increasing the pixel distance for each step.

これによれば、画素距離をステップ毎に順次広げて前記後段ステップ画像処理工程を複数ステップ実行することで、欠陥成分の検出精度をより高めることが可能となる。   According to this, it is possible to further increase the detection accuracy of the defect component by sequentially increasing the pixel distance for each step and executing the subsequent step image processing step a plurality of steps.

本発明の画像処理装置の一形態である欠陥検出装置について説明するブロック図である。It is a block diagram explaining the defect detection apparatus which is one form of the image processing apparatus of this invention. 欠陥検出装置の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of a defect detection apparatus. 処理対象画像(撮影画像)の一例を示している。An example of a processing target image (captured image) is shown. 欠陥成分検出画像作成工程における検査対象画素と比較画素との配置の一例を示す図である。It is a figure which shows an example of arrangement | positioning of a test object pixel and a comparison pixel in a defect component detection image creation process. 変形例における欠陥成分検出画像作成工程で用いられる第1比較画素群について説明する図である。It is a figure explaining the 1st comparison pixel group used at the defective component detection image creation process in a modification. 変形例における欠陥成分検出画像作成工程で用いられる第2比較画素群について説明する図である。It is a figure explaining the 2nd comparison pixel group used at the defective component detection image creation process in a modification. 変形例における欠陥成分検出画像作成工程について説明する工程図である。It is process drawing explaining the defect component detection image creation process in a modification. 変形例における欠陥成分検出画像作成工程について説明する工程図である。It is process drawing explaining the defect component detection image creation process in a modification. 変形例における欠陥成分検出画像作成工程について説明する工程図である。It is process drawing explaining the defect component detection image creation process in a modification. 変形例における欠陥成分検出画像作成工程について説明する工程図である。It is process drawing explaining the defect component detection image creation process in a modification. 変形例における欠陥成分検出画像作成工程について説明する工程図である。It is process drawing explaining the defect component detection image creation process in a modification. 変形例における欠陥成分検出画像作成工程について説明する工程図である。It is process drawing explaining the defect component detection image creation process in a modification. ステップ1明欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of the step 1 bright defect component detection image. ステップ1暗欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of a step 1 dark defect component detection image. ステップ1欠陥成分除去画像の一例を示す図である。It is a figure which shows an example of a step 1 defect component removal image. ステップ2明欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of the step 2 bright defect component detection image. ステップ2暗欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of the step 2 dark defect component detection image. ステップ2欠陥成分除去画像の一例を示す図である。It is a figure which shows an example of a step 2 defect component removal image. ステップ12明欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of the step 12 bright defect component detection image. ステップ12暗欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of the step 12 dark defect component detection image. ステップ12欠陥成分除去画像の一例を示す図である。It is a figure which shows an example of the step 12 defect component removal image. ステップ100明欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of the step 100 bright defect component detection image. ステップ100暗欠陥成分検出画像の一例を示す図である。It is a figure which shows an example of the step 100 dark defect component detection image. ステップ100欠陥成分除去画像の一例を示す図である。It is a figure which shows an example of the step 100 defect component removal image. ステップ2からステップ12までの明欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the bright defect extraction image from step 2 to step 12. ステップ2からステップ12までの暗欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the dark defect extraction image from step 2 to step 12. ステップ1からステップ100までの明欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the bright defect extraction image from step 1 to step 100. FIG. ステップ1からステップ100までの暗欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the dark defect extraction image from step 1 to step 100. FIG. ステップ13からステップ100までの明欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the bright defect extraction image from step 13 to step 100. FIG. ステップ13からステップ100までの暗欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the dark defect extraction image from step 13 to step 100. FIG. ステップ13からステップ100までの欠陥抽出画像からステップ1からステップ12までの欠陥成分を差し引いた場合の明欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the bright defect extraction image at the time of subtracting the defect component from Step 1 to Step 12 from the defect extraction image from Step 13 to Step 100. ステップ13からステップ100までの欠陥抽出画像からステップ1からステップ12までの欠陥成分を差し引いた場合の暗欠陥抽出画像の一例を示す図であるIt is a figure which shows an example of the dark defect extraction image at the time of subtracting the defect component from Step 1 to Step 12 from the defect extraction image from Step 13 to Step 100. 第2の実施形態における処理対象画像としてのパターン画像を示す図である。It is a figure which shows the pattern image as a process target image in 2nd Embodiment. 第2の実施形態におけるステップ1からステップ9までの明欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the bright defect extraction image from step 1 to step 9 in 2nd Embodiment. 第2の実施形態におけるステップ1からステップ9までの暗欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the dark defect extraction image from step 1 to step 9 in 2nd Embodiment. 第2の実施形態におけるステップ1からステップ65までの明欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the bright defect extraction image from Step 1 to Step 65 in 2nd Embodiment. 第2の実施形態におけるステップ1からステップ65までの暗欠陥抽出画像の一例を示す図である。It is a figure which shows an example of the dark defect extraction image from step 1 to step 65 in 2nd Embodiment.

以下、本発明を実施するための形態を、添付図面を参照して説明する。なお、以下に述べる実施の形態では、本発明の好適な具体例として種々の限定がされているが、本発明の範囲は、以下の説明において特に本発明を限定する旨の記載がない限り、これらの態様に限られるものではない。   DESCRIPTION OF EMBODIMENTS Hereinafter, embodiments for carrying out the present invention will be described with reference to the accompanying drawings. In the embodiments described below, various limitations are made as preferred specific examples of the present invention. However, the scope of the present invention is not limited to the following description unless otherwise specified. However, the present invention is not limited to these embodiments.

図1は、本発明に係る画像処理装置の一形態である欠陥検出装置10の構成を示すブロック図である。本実施形態における欠陥検出装置10は、XYステージ2、撮影装置3、コンピューター6、表示装置7、および入力装置8等を備えており、フレキシブル基板、液晶パネル(TFTパネル)、半導体ウェハ、あるいは金属加工品等の被検査物1の表面における傷やシミ等の欠陥を画像処理により検出する。被検査物1は、XYステージ2上に載置され、第1の方向(X方向)と当該第1の方向に直交する第2の方向(Y方向)に移動可能に構成されている。   FIG. 1 is a block diagram showing a configuration of a defect detection apparatus 10 which is an embodiment of an image processing apparatus according to the present invention. The defect detection apparatus 10 in this embodiment includes an XY stage 2, an imaging apparatus 3, a computer 6, a display apparatus 7, an input apparatus 8, and the like, and is a flexible substrate, a liquid crystal panel (TFT panel), a semiconductor wafer, or a metal. Defects such as scratches and spots on the surface of the inspection object 1 such as a processed product are detected by image processing. The inspection object 1 is placed on an XY stage 2 and configured to be movable in a first direction (X direction) and a second direction (Y direction) orthogonal to the first direction.

撮影装置3は、被検査物1を光学的に拡大して欠陥を検出するのに十分な倍率を備えたレンズあるいは顕微鏡からなる光学系や、当該光学系により拡大された被検査物1の像を受光して電気信号に変換するCCD等を備えている。この撮影装置3は、XYステージ2上の被検査物1を撮影し、画像データに変換してコンピューター6に出力する。コンピューター6は、撮影装置3を制御し、当該撮影装置3から得られた画像データに基づいて被検査物1の欠陥を検出する処理を行う画像処理装置である。表示装置7は、コンピューター6に接続された液晶ディスプレイなどの表示装置である。入力装置8は、例えば、キーボードやマウス等からなり、ユーザーの操作を受けて操作信号をコンピューター4に出力する。   The imaging apparatus 3 includes an optical system including a lens or a microscope having a magnification sufficient to optically enlarge the inspection object 1 to detect defects, and an image of the inspection object 1 magnified by the optical system. CCD etc. which receive light and convert it into an electric signal are provided. The photographing apparatus 3 photographs the inspection object 1 on the XY stage 2, converts it into image data, and outputs it to the computer 6. The computer 6 is an image processing device that controls the imaging device 3 and performs processing for detecting defects in the inspection object 1 based on image data obtained from the imaging device 3. The display device 7 is a display device such as a liquid crystal display connected to the computer 6. The input device 8 includes, for example, a keyboard and a mouse, and outputs an operation signal to the computer 4 in response to a user operation.

本実施形態におけるコンピューター6は、演算部11および記憶部12を備えている。記憶部12は、例えばハードディスクドライブから構成され、この記憶部12には、オペレーションシステム、各種アプリケーションプログラム、画像処理用データ等が記憶されている。そして、演算部11は、図示しないCPU、ROM、RAM等を有しており、記憶部12に記憶されたオペレーションシステムに従い、画像処理などの各種の処理を行う。また、演算部11は、画像入力手段13、画像処理手段14、および欠陥抽出手段15を備えている。画像入力手段13には、撮影装置3で撮像された被検査物1の撮影画像データ(以下、単に撮影画像と称する)が入力される。撮影画像は、処理対象画像として記憶部12に記憶される。   The computer 6 in this embodiment includes a calculation unit 11 and a storage unit 12. The storage unit 12 is composed of, for example, a hard disk drive, and the storage unit 12 stores an operation system, various application programs, image processing data, and the like. The calculation unit 11 includes a CPU, a ROM, a RAM, and the like (not shown), and performs various processes such as image processing according to an operation system stored in the storage unit 12. The calculation unit 11 includes an image input unit 13, an image processing unit 14, and a defect extraction unit 15. The image input means 13 is input with captured image data (hereinafter simply referred to as a captured image) of the inspection object 1 imaged by the imaging device 3. The captured image is stored in the storage unit 12 as a processing target image.

画像処理手段14は、処理対象画像(撮影画像)に対して後述するフィルター処理を行うことにより所定の範囲内の欠陥成分を取り出した欠陥成分検出画像を作成したり、処理対象画像と欠陥成分検出画像との輝度値(画素値)の加減算を行うことで処理対象画像から欠陥成分を除去した欠陥成分除去画像を作成したりする。欠陥抽出手段15は、処理対象画像または画像処理手段14が作成した欠陥成分除去画像のうちの任意の画像同士の輝度値の差により欠陥抽出画像を作成する。なお、欠陥成分には、他の画素部分に対して輝度値が高い明欠陥と、輝度値が低い暗欠陥とがある。   The image processing means 14 creates a defect component detection image obtained by extracting a defect component within a predetermined range by performing filter processing described later on the processing target image (captured image), or detects the processing target image and the defect component. A defect component-removed image in which a defect component is removed from the processing target image is created by performing addition / subtraction of a luminance value (pixel value) with the image. The defect extraction unit 15 creates a defect extraction image based on a luminance value difference between arbitrary images of the processing target image or the defect component removed image created by the image processing unit 14. The defect component includes a bright defect having a high luminance value with respect to other pixel portions and a dark defect having a low luminance value.

次に、本実施形態における欠陥検出装置10の動作について説明する。
図2は欠陥検出装置10の動作を説明するフローチャートである。図2に示す動作はコンピューター6上で実行されるプログラムにより実現されている。まず、被検査物1がXYステージ2にセットされると、撮影装置3により被検査物1の画像が撮影されて撮影画像のデータがコンピューター6における演算部11の画像入力手段13に取り込まれる(画像取得工程St1)。このとき撮影画像は、図示しないA/D変換器により所定階調(例えば、4096階調(12ビット))のデジタルデータとして画像入力手段13に取り込まれ、処理対象画像として記憶部12に一旦保存される。
Next, the operation of the defect detection apparatus 10 in this embodiment will be described.
FIG. 2 is a flowchart for explaining the operation of the defect detection apparatus 10. The operation shown in FIG. 2 is realized by a program executed on the computer 6. First, when the inspection object 1 is set on the XY stage 2, the image of the inspection object 1 is imaged by the imaging device 3, and the captured image data is taken into the image input means 13 of the computing unit 11 in the computer 6 ( Image acquisition step St1). At this time, the photographed image is taken into the image input means 13 as digital data of a predetermined gradation (for example, 4096 gradations (12 bits)) by an A / D converter (not shown) and temporarily stored in the storage unit 12 as a processing target image. Is done.

図3は、コンピューター6に取り込まれた処理対象画像(撮影画像)の一例を示している。本実施形態においては被検査物1としての金属加工品の表面における欠陥について検査が行われる。
被検査物1の撮影画像が処理対象画像としてコンピューター6に取り込まれると、当該処理対象画像に対して画像処理手段14により画像処理が行われ、所定の画素距離の範囲内に存在する欠陥成分を検出した欠陥成分検出画像と、処理対象画像から欠陥成分が除去された欠陥成分除去画像と、が、画素距離をステップごとに拡大しながら作成される。画像処理工程は、最初に行われる初段ステップ画像処理工程と、初段ステップ画像処理工程の後に少なくとも1回行われる後段ステップ画像処理工程と、の2つの工程に大別される。なお、ステップ1の処理は、初段ステップ画像処理工程であり、ステップ2以降の処理は後段ステップ画像処理工程である。これらの初段ステップ画像処理工程および後段ステップ画像処理工程は、それぞれ以下で説明するようなフィルター処理からなる。本実施形態におけるフィルター処理は、従来技術のフィルター処理のように比較画素群の平均値やメディアン値との比較は行われず、処理対象画像(撮像画像または下記の欠陥成分除去画像)から欠陥成分を検出した欠陥成分検出画像を作成する欠陥成分検出画像作成工程と、処理対象画像から欠陥成分を取り除いた欠陥成分除去画像を作成する欠陥成分除去画像作成工程とを行うものである。
FIG. 3 shows an example of the processing target image (captured image) captured by the computer 6. In the present embodiment, inspection is performed for defects on the surface of a metal workpiece as the inspection object 1.
When the captured image of the inspection object 1 is captured by the computer 6 as a processing target image, the image processing unit 14 performs image processing on the processing target image, and defect components existing within a predetermined pixel distance range are detected. The detected defect component detection image and the defect component removed image obtained by removing the defect component from the processing target image are created while increasing the pixel distance for each step. The image processing process is roughly divided into two processes: a first step image processing process that is performed first, and a subsequent step image processing process that is performed at least once after the first step image processing process. In addition, the process of step 1 is a first step image processing process, and the process after step 2 is a latter step image processing process. Each of the first-stage step image processing process and the latter-stage step image processing process includes a filter process as described below. In the filter processing in the present embodiment, the comparison with the average value or median value of the comparison pixel group is not performed as in the conventional filter processing, and the defect component is extracted from the processing target image (the captured image or the defect component removal image described below). A defect component detection image creation step for creating a detected defect component detection image and a defect component removal image creation step for creating a defect component removal image obtained by removing the defect component from the processing target image are performed.

画像処理手段14は、本発明における初段画像処理手段として機能し、初段ステップ画像処理工程を行う。この初段ステップ画像処理工程では、まず、処理対象画像としての撮影画像から欠陥成分を検出した欠陥成分検出画像を作成する第1欠陥成分検出画像作成工程St2が行われる。この工程では、処理対象画像において選択された検査対象画素と、その検査対象画素から所定の画素距離だけ離れた位置で設定された複数の比較画素(比較画素群)との輝度値との差分を取ることで欠陥を検出する。この工程において、欠陥部分の輝度値が、周囲の輝度値よりも高くなる明欠陥を検出する場合は、検査対象画素の輝度値と比較画素群の輝度値の最大値との差を取ることで欠陥を検出し、欠陥部分の輝度値が、周囲の輝度値よりも低くなる暗欠陥を検出するときは、比較画素群の輝度値の最小値と検査対象画素の輝度値との差を取る事で欠陥を検出する。   The image processing means 14 functions as the first stage image processing means in the present invention, and performs the first stage step image processing process. In this first-stage step image processing step, first, a first defect component detection image creation step St2 for creating a defect component detection image in which a defect component is detected from a captured image as a processing target image is performed. In this step, the difference between the luminance value of the inspection target pixel selected in the processing target image and a plurality of comparison pixels (comparison pixel group) set at positions away from the inspection target pixel by a predetermined pixel distance is calculated. Detect defects by taking. In this process, when detecting a bright defect in which the luminance value of the defective portion is higher than the surrounding luminance value, the difference between the luminance value of the pixel to be inspected and the maximum luminance value of the comparison pixel group is taken. When detecting a defect and detecting a dark defect in which the luminance value of the defective portion is lower than the surrounding luminance value, the difference between the minimum luminance value of the comparison pixel group and the luminance value of the pixel to be inspected is taken. To detect defects.

図4は、欠陥成分検出画像の作成の際に設定される検査対象画素と比較画素との配置の一例である。同図において、検査対象画素がO1、比較画素がS1〜S8として示されている。また、検査対象画素O1と比較画素との画素距離は6に設定されている。つまり、検査対象画素O1に対して縦方向に並ぶ比較画素S1,S5と検査対象画素O1との間には6個の画素が配置されている。同様に検査対象画素O1に対して横方向に並ぶ比較画素S3,S7と検査対象画素O1との間にも6個の画素が配置されている。また、検査対象画素O1に対して斜めに並ぶ比較画素S2,S4,S6,S8は、検査対象画素O1を中心とし、比較画素S1,S3,S5,S7を通る仮想的な円の円周上に配置されている。すなわち、これらの比較画素S1〜S8は、当該円周上に45度ずつ角度を異ならせてそれぞれ配置されている。なお、画素の形状が方形(正方形)状である関係で検査対象画素O1に対して斜め方向に配置された比較画素S2,S4,S6,S8については、検査対象画素O1との間の画素数が、検査対象画素O1と比較画素S1,S3,S5,S7との間の画素数よりも少ないが(図4の例の場合4つ)、検査対象画素O1との間の中心間距離(一方の画素の中心と他方の画素の中心との距離)が、検査対象画素O1と比較画素S1,S3,S5,S7との中心間距離に最も近くなるような画素が選択される。このような配置では、検査対象画素O1に対して斜めに並ぶ比較画素S2,S4,S6,S8についても画素距離が6の比較画素であるものとする。そして、第1欠陥成分検出画像作成工程St2において設定される画素距離は、検出対象の欠陥のうち最小の欠陥のサイズに応じて設定されるものであり、本発明における第1の距離に相当する。   FIG. 4 is an example of an arrangement of inspection target pixels and comparison pixels set when a defect component detection image is created. In the figure, the inspection target pixel is shown as O1, and the comparison pixels are shown as S1 to S8. The pixel distance between the inspection target pixel O1 and the comparison pixel is set to 6. That is, six pixels are arranged between the comparison pixels S1 and S5 arranged in the vertical direction with respect to the inspection target pixel O1 and the inspection target pixel O1. Similarly, six pixels are arranged between the comparison pixels S3 and S7 aligned in the horizontal direction with respect to the inspection target pixel O1 and the inspection target pixel O1. Further, the comparison pixels S2, S4, S6, and S8 that are arranged obliquely with respect to the inspection target pixel O1 are on the circumference of a virtual circle that passes through the comparison pixels S1, S3, S5, and S7 with the inspection target pixel O1 as the center. Is arranged. That is, these comparison pixels S1 to S8 are arranged at different angles by 45 degrees on the circumference. In addition, regarding the comparison pixels S2, S4, S6, and S8 that are arranged in an oblique direction with respect to the inspection target pixel O1 because the pixel shape is a square (square) shape, the number of pixels between the inspection target pixel O1 Is smaller than the number of pixels between the inspection target pixel O1 and the comparison pixels S1, S3, S5, and S7 (four in the example of FIG. 4), but the center-to-center distance between the inspection target pixel O1 (one side) Is selected such that the distance between the center of the pixel and the center of the other pixel) is closest to the center-to-center distance between the pixel O1 to be inspected and the comparison pixels S1, S3, S5, and S7. In such an arrangement, the comparison pixels S2, S4, S6, and S8 that are arranged obliquely with respect to the inspection target pixel O1 are also comparison pixels having a pixel distance of 6. The pixel distance set in the first defect component detection image creation step St2 is set according to the size of the smallest defect among the defects to be detected, and corresponds to the first distance in the present invention. .

このような欠陥成分検出画像作成は、欠陥部分の輝度が周囲の輝度よりも高くなる明欠陥成分の検出と、欠陥部分の輝度が、周囲の輝度よりも低くなる暗欠陥成分の検出とで、検出処理が異なる。具体的には、明欠陥成分の検出では、検査対象画素O1の輝度値をIo1として、比較画素の輝度値をIs1〜Is8としたときに、明欠陥成分の輝度値Iw1は、以下の式(1)を用いて計算される。
Iw1=Io1−min(max(Is1,Is3,Is5,Is7)
,max(Is2,Is4,Is6,Is8))…(1)
上記式(1)における「min」はその後に続く()内の輝度値のうち最小の輝度値が選択されることを意味し、「max」はその後に続く()内の輝度値のうち最大の輝度値が選択されることを意味する。したがって、Is1,Is3,Is5,Is7のうちの最大の輝度値と、Is2,Is4,Is6,Is8のうちの最大の輝度値とが比較され、小さい方の輝度値が検査対象画素O1における明欠陥成分の輝度値Iw1とされる。なお、式(1)の結果として、負の値が生じる場合、負の値は0で置き換えられる。
同様に、検査対象画素O1における暗欠陥成分の輝度値Ib1は以下の式(2)を用いて計算される。
Ib1=max(min(Is1,Is3,Is5,Is7)
,min(Is2,Is4,Is6,Is8))−Io1…(2)
上記式(2)においても、負の結果となった場合は、0で置き換えられる。
以上の処理が、処理対象画像(撮影画像)全体に適用されることで、つまり、処理対象画像を構成する全画素について明欠陥成分の輝度値Iw1および暗欠陥成分の輝度値Ib1がそれぞれ求められることにより、第1の距離の範囲内に存在する明欠陥成分が検出された明欠陥成分検出画像、同じく第1の距離の範囲内に存在する暗欠陥成分が検出された暗欠陥成分検出画像がそれぞれ作成されて、記憶部12に記憶される。なお、処理対象画像における端部において画素数が不足して比較画素が設定できない場合には、比較画素を設定できるように画素領域を仮想的に広げるパディング処理が行われる(以下の変形例においても同様)。
Such defect component detection image creation includes detection of a bright defect component in which the luminance of the defective portion is higher than the surrounding luminance, and detection of a dark defect component in which the luminance of the defective portion is lower than the surrounding luminance, The detection process is different. Specifically, in the detection of the bright defect component, when the luminance value of the inspection target pixel O1 is Io1 and the luminance values of the comparison pixels are Is1 to Is8, the luminance value Iw1 of the bright defect component is expressed by the following formula ( 1).
Iw1 = Io1-min (max (Is1, Is3, Is5, Is7)
, Max (Is2, Is4, Is6, Is8)) (1)
In the above formula (1), “min” means that the minimum luminance value among the luminance values in () that follows is selected, and “max” is the maximum among the luminance values in the subsequent (). Means that the luminance value of is selected. Therefore, the maximum luminance value of Is1, Is3, Is5, and Is7 is compared with the maximum luminance value of Is2, Is4, Is6, and Is8, and the smaller luminance value is the bright defect in the inspection target pixel O1. The luminance value Iw1 of the component is set. When a negative value is generated as a result of the expression (1), the negative value is replaced with 0.
Similarly, the luminance value Ib1 of the dark defect component in the inspection target pixel O1 is calculated using the following equation (2).
Ib1 = max (min (Is1, Is3, Is5, Is7)
, Min (Is2, Is4, Is6, Is8))-Io1 (2)
Also in the above formula (2), when a negative result is obtained, it is replaced with 0.
By applying the above processing to the entire processing target image (captured image), that is, the brightness value Iw1 of the bright defect component and the brightness value Ib1 of the dark defect component are obtained for all pixels constituting the processing target image. Thus, a bright defect component detection image in which a bright defect component existing in the first distance range is detected, and a dark defect component detection image in which a dark defect component existing in the first distance range is detected. Each is created and stored in the storage unit 12. If the comparison pixel cannot be set because the number of pixels is insufficient at the edge of the processing target image, padding processing is performed to virtually expand the pixel area so that the comparison pixel can be set (also in the following modified examples) The same).

次に、欠陥成分検出画像作成工程の変形例について説明する。
図5は、変形例における欠陥成分検出画像作成工程で用いられる第1比較画素群について説明する図、図6は、変形例における欠陥成分検出画像作成工程で用いられる第2比較画素群について説明する図である。この変形例においても、検査対象画素O1に対して8つの比較画素S1〜S8が設定されるが、これらの比較画素がさらに2つのグループに分けられて欠陥成分が検出される。すなわち、図5に示されるように、比較画素がS1から順に一つ置きに選択されてこれらの比較画素S1,S3,S5,S7から構成される第1比較画素群が設定される。また、図6に示されるように、比較画素がS2順に一つ置きに選択されてこれらの比較画素S2,S4,S6,S8から構成される第2比較画素群が設定される。上述したように、第1欠陥成分検出画像作成工程St2において設定される画素距離は第1の距離である。この変形例においても、上記の例と同様に、明欠陥成分の検出と暗欠陥成分の検出とで処理が異なるため、以下においては、明欠陥成分を検出する例を主に説明する。
Next, a modification of the defect component detection image creation process will be described.
FIG. 5 is a diagram for explaining the first comparison pixel group used in the defect component detection image creation process in the modification, and FIG. 6 is a diagram for explaining the second comparison pixel group used in the defect component detection image creation process in the modification. FIG. Also in this modified example, eight comparison pixels S1 to S8 are set for the inspection target pixel O1, but these comparison pixels are further divided into two groups to detect defective components. That is, as shown in FIG. 5, every other comparison pixel is selected in order from S1, and a first comparison pixel group composed of these comparison pixels S1, S3, S5, and S7 is set. Further, as shown in FIG. 6, every other comparison pixel is selected in the order of S2, and a second comparison pixel group composed of these comparison pixels S2, S4, S6, S8 is set. As described above, the pixel distance set in the first defect component detection image creation step St2 is the first distance. In this modified example, as in the above example, the processing is different between the detection of the bright defect component and the detection of the dark defect component. Therefore, an example in which the bright defect component is detected will be mainly described below.

まず、第1比較画素群に基づいて欠陥成分検出が行われる。この欠陥成分検出を行うに当たり、処理結果を格納するための画像として、処理対象画像と同じ解像度およびサイズで、全画素の輝度値が初期値として0に設定された処理結果格納画像が予め記憶部12に確保される。なお、この処理結果格納画像は、明欠陥用のものと暗欠陥用のものとの2つが用意される。   First, defect component detection is performed based on the first comparison pixel group. In performing this defect component detection, a processing result storage image in which the luminance value of all pixels is set to 0 as an initial value at the same resolution and size as the processing target image is stored in advance as an image for storing the processing result. 12 is secured. Two processing result storage images are prepared, one for bright defects and one for dark defects.

図7〜図9は、第1比較画素群を用いた欠陥成分検出の過程(欠陥強調処理)について説明する図である。これらの図において上段は、処理対象画像の一部分(左端部分)を示す図、下段は処理結果格納画像であって処理対象画像に対応する部分である。この工程では、処理対象画像における検査対象画素O1について、以下の式(3)により輝度値If1が計算される。
If1=Io1−Max(IS1,IS3,IS5,IS7)…(3)
そして、算出されたIf1と、処理結果格納画像の検査対象画素O1に対応する位置の画素の輝度値(初期値=0)とが比較され、図7下段に示されるように、大きいほうの輝度値がIR1として処理結果格納画像の対応する画素位置に格納される。
7 to 9 are diagrams for explaining a defect component detection process (defect enhancement process) using the first comparison pixel group. In these drawings, the upper part shows a part (left end part) of the processing target image, and the lower part is a processing result storage image corresponding to the processing target image. In this step, the luminance value If1 is calculated by the following equation (3) for the inspection target pixel O1 in the processing target image.
If1 = Io1-Max (IS1, IS3, IS5, IS7) (3)
Then, the calculated If1 is compared with the luminance value (initial value = 0) of the pixel corresponding to the inspection target pixel O1 in the processing result storage image, and as shown in the lower part of FIG. The value is stored as IR1 in the corresponding pixel position of the processing result storage image.

続いて、図8上段に示されるように、比較画素S1,S3,S5,S7の位置を固定したまま、検査対象画素O1の1つ上の画素に検査対象画素O2が設定されて、同様にして式(3)により算出された輝度値If2と処理結果格納画像における対応画素位置の輝度値とが比較されて、図8下段に示されるように、大きい方の輝度値がIR2として結果画像の対応画素位置に格納される。同様に、検査対象画素O2の1つ上の検査対象画素O3から比較画素S1の手前の検査対象画素O7について順次処理が行われ、処理結果格納画像に輝度値IR3〜IR7が格納される。要するに、検査対象画素O1に近い検査対象画素から順に処理が行われていく。そして、図9に示されるように、同様な処理が、検査対象画素O1と比較画素S3との間の検査対象画素O8〜O13について、検査対象画素O1から比較画素S5との間の検査対象画素O14〜O19について、および、検査対象画素O1と比較画素S7との間の検査対象画素O20〜O25について、順次行われる。その結果、図9下段に示されるように、処理結果格納画像において検査対象画素O1に対応する輝度値IR1を中心(交点)として十字状に輝度値IR2〜IR25が格納される。   Subsequently, as shown in the upper part of FIG. 8, the inspection target pixel O2 is set to the pixel immediately above the inspection target pixel O1 while the positions of the comparison pixels S1, S3, S5, and S7 are fixed. The brightness value If2 calculated by the equation (3) is compared with the brightness value at the corresponding pixel position in the processing result storage image, and as shown in the lower part of FIG. Stored in the corresponding pixel position. Similarly, processing is sequentially performed from the inspection target pixel O3 immediately above the inspection target pixel O2 to the inspection target pixel O7 before the comparison pixel S1, and the luminance values IR3 to IR7 are stored in the processing result storage image. In short, the processing is performed in order from the inspection target pixel close to the inspection target pixel O1. Then, as shown in FIG. 9, for the inspection target pixels O8 to O13 between the inspection target pixel O1 and the comparison pixel S3, the same processing is performed on the inspection target pixel between the inspection target pixel O1 and the comparison pixel S5. This is sequentially performed for O14 to O19 and for the inspection target pixels O20 to O25 between the inspection target pixel O1 and the comparison pixel S7. As a result, as shown in the lower part of FIG. 9, the luminance values IR2 to IR25 are stored in a cross shape with the luminance value IR1 corresponding to the inspection target pixel O1 as the center (intersection) in the processing result storage image.

次に、図6に示される第2比較画素群を用いて欠陥成分検出が行われる。
図10〜図12は、第2比較画素群を用いた欠陥成分検出の過程について説明する図である。上述したように、処理結果格納画像には、第1比較画素群に基づく処理結果である輝度値が格納されており、そこに第2比較画素群の処理結果である輝度値が格納されていく。この工程では、処理対象画像における検査対象画素O1について、以下の式(4)により輝度値If1が計算される。
If1=Io1−Max(IS2,IS4,IS6,IS8)…(4)
この計算結果If1と処理結果格納画像のIR1とが比較されて大きい方の値が改めてIR1として処理結果格納画像に格納される。図11に示されるように、この処理を第1比較画素群と同様に、検査対象画素O1と比較画素S2との間のO26〜O29について、検査対象画素O1と比較画素S4との間のO30〜O33について、検査対象画素O1と比較画素S6との間のO34〜O37について、および、検査対象画素O1と比較画素S8との間のO38〜O41について、順次行われる。要するに、検査対象画素O1に近い検査対象画素から順に処理が行われていく。その結果、図12に示されるように、処理結果格納画像において検査対象画素O1に対応する輝度値IR1を中心(交点)としてアスタリスク状に輝度値IR2〜IR41が格納される。
Next, defect component detection is performed using the second comparison pixel group shown in FIG.
10 to 12 are diagrams for explaining a defect component detection process using the second comparison pixel group. As described above, the processing result storage image stores the brightness value that is the processing result based on the first comparison pixel group, and the brightness value that is the processing result of the second comparison pixel group is stored therein. . In this step, the luminance value If1 is calculated by the following equation (4) for the inspection target pixel O1 in the processing target image.
If1 = Io1-Max (IS2, IS4, IS6, IS8) (4)
This calculation result If1 is compared with IR1 of the processing result storage image, and the larger value is stored in the processing result storage image as IR1 again. As shown in FIG. 11, this process is performed for O26 to O29 between the inspection target pixel O1 and the comparison pixel S2 as in the first comparison pixel group, as O30 between the inspection target pixel O1 and the comparison pixel S4. ˜O33 are sequentially performed for O34 to O37 between the inspection target pixel O1 and the comparison pixel S6 and for O38 to O41 between the inspection target pixel O1 and the comparison pixel S8. In short, the processing is performed in order from the inspection target pixel close to the inspection target pixel O1. As a result, as shown in FIG. 12, in the processing result storage image, the luminance values IR2 to IR41 are stored in an asterisk shape with the luminance value IR1 corresponding to the inspection target pixel O1 as the center (intersection).

以上の処理が、処理対象画像(撮影画像)全体に適用されることで、つまり、処理対象画像を構成する全画素について明欠陥成分の輝度値がそれぞれ求められる。処理結果格納画像において、新たに求められた輝度値に対応する画素位置に既に輝度値が格納されている場合、両数値の大小が比較され、大きい方の値が改めて当該画素位置の輝度値として処理結果格納画像に格納される。そして、第1の距離の範囲内に存在する明欠陥成分が検出された処理結果格納画像が、二値化処理を経て明欠陥成分検出画像とされる。なお、同じく第1の距離の範囲内に存在する暗欠陥成分の検出における輝度値の計算については、上記式(3)に替えて以下の式(5)が使用され、また、式(4)に替えて以下の式(6)が使用される。
If1=Min(IS1,IS3,IS5,IS7)−Io1…(5)
If1=Min(IS2,IS4,IS6,IS8)−Io1…(6)
そして、明欠陥成分検出画像の作成と同様に、処理対象画像を構成する全画素について暗欠陥成分の輝度値がそれぞれ求められることにより、第1の距離の範囲内に存在する暗欠陥成分が検出された処理結果格納画像が、二値化処理を経て暗欠陥成分検出画像とされ、記憶部12に記憶される。
By applying the above processing to the entire processing target image (captured image), that is, the brightness values of the bright defect components are obtained for all the pixels constituting the processing target image. In the processing result storage image, when the luminance value is already stored in the pixel position corresponding to the newly obtained luminance value, the magnitudes of the two values are compared, and the larger value is renewed as the luminance value of the pixel position. Stored in the processing result storage image. Then, the processing result storage image in which the bright defect component existing within the first distance range is detected is set as the bright defect component detection image through the binarization process. Note that the following formula (5) is used instead of the above formula (3) for the calculation of the luminance value in the detection of the dark defect component existing in the range of the first distance, and the formula (4) Instead of the following equation (6) is used.
If1 = Min (IS1, IS3, IS5, IS7) -Io1 (5)
If1 = Min (IS2, IS4, IS6, IS8) -Io1 (6)
Similarly to the creation of the bright defect component detection image, the dark defect component existing within the first distance is detected by obtaining the luminance values of the dark defect components for all the pixels constituting the processing target image. The processed result storage image is subjected to binarization processing to be a dark defect component detection image, and is stored in the storage unit 12.

図13は、ステップ1明欠陥成分検出画像の一例を示し、図14は、ステップ1暗欠陥成分検出画像の一例を示している。第1欠陥成分検出画像作成工程St2で作成された明欠陥成分検出画像および暗欠陥成分検出画像は、それぞれステップ1明欠陥成分検出画像およびステップ1暗欠陥成分検出画像である。以下においては、特に区別しない限り、ステップ1欠陥成分検出画像とも称する。   FIG. 13 shows an example of the step 1 bright defect component detection image, and FIG. 14 shows an example of the step 1 dark defect component detection image. The bright defect component detection image and the dark defect component detection image created in the first defect component detection image creation step St2 are the step 1 bright defect component detection image and the step 1 dark defect component detection image, respectively. In the following, unless otherwise specified, they are also referred to as step 1 defect component detection images.

以上のようにして、ステップ1欠陥成分検出画像が作成されたならば、続いて、第1欠陥成分除去画像作成工程St3が行われる。   When the step 1 defect component detection image is created as described above, the first defect component removal image creation step St3 is subsequently performed.

図15は、ステップ1欠陥成分除去画像の一例を示す図である。この第1欠陥成分除去画像作成工程では、処理対象画像と欠陥成分検出画像との加減算により欠陥成分除去画像が作成される。より具体的には、処理対象画像の輝度値に対し、ステップ1明欠陥成分検出画像の輝度値が減算されるとともにステップ1暗欠陥成分検出画像の輝度値が加算されることで、図15に示されるように、処理対象画像からステップ1の明欠陥および暗欠陥が除去されたステップ1欠陥成分除去画像が得られる。ここで、輝度値の加算もしくは減算に関し、2つの画像の相互に対応する画素における輝度値について加算若しくは減算を行うことを意味する(以下、同様)。   FIG. 15 is a diagram illustrating an example of a step 1 defect component removal image. In the first defect component removal image creation step, a defect component removal image is created by adding and subtracting the processing target image and the defect component detection image. More specifically, the luminance value of the step 1 bright defect component detection image is subtracted from the luminance value of the processing target image, and the luminance value of the step 1 dark defect component detection image is added to FIG. As shown, a step 1 defect component-removed image in which the bright defect and dark defect of step 1 are removed from the processing target image is obtained. Here, regarding addition or subtraction of luminance values, it means that addition or subtraction is performed on luminance values in pixels corresponding to each other in two images (the same applies hereinafter).

なお、このような欠陥成分検出画像作成工程および欠陥成分除去画像作成工程は、画素距離を維持したまま同一ステップ内で複数回繰り返されてもよい。例えば、上記の比較画素に欠陥成分が存在する場合には検出精度が落ちる。しかしながら、上記の処理を複数回繰り返すことで欠陥成分が順次検出・除去されていくため、比較画素に欠陥成分が含まれる可能性が次第に低減されていく。その結果、検出精度が向上する。このように複数回繰り返す場合、2回目以降の欠陥成分検出画像に関し、処理対象画像から欠陥成分除去画像が減算されて明欠陥成分検出画像が作成される。また、暗欠陥検出画像については、欠陥成分除去画像から処理対象画像を減算することで作成される。このとき、減算処理によって負の値が生じる場合があるが、この場合には値が0に置き換えられて、明欠陥成分検出画像および暗欠陥成分検出画像が作成される。そして、最終的に得られた欠陥成分除去画像が、当該ステップの欠陥成分除去画像とされる。   Note that such a defect component detection image creation step and defect component removal image creation step may be repeated a plurality of times within the same step while maintaining the pixel distance. For example, when a defective component exists in the comparison pixel, the detection accuracy decreases. However, since the defect component is sequentially detected and removed by repeating the above process a plurality of times, the possibility of the defect component being included in the comparison pixel is gradually reduced. As a result, the detection accuracy is improved. In the case of repeating a plurality of times in this manner, regarding the second and subsequent defect component detection images, the defect component removal image is subtracted from the processing target image to create a bright defect component detection image. The dark defect detection image is created by subtracting the processing target image from the defect component removal image. At this time, a negative value may be generated by the subtraction process. In this case, the value is replaced with 0, and a bright defect component detection image and a dark defect component detection image are created. Then, the finally obtained defect component removal image is used as the defect component removal image of the step.

以上のようにして画像処理手段14により、初段ステップ画像処理工程が行われる。この初段ステップ画像処理工程では、設定された画素距離の中で最も小さい第1の距離に対応するサイズの欠陥成分(例えば、ノイズ等)が検出および除去される。以下においては、輝度値が相対的に低い低コントラスト欠陥、および輝度値が相対的に高い高コントラスト欠陥が混在している対象である処理対象画像から、それぞれの欠陥成分を検出するため、画像処理手段14は、後段画像処理手段として機能し、ステップ2以降において画素距離を所定の間隔で広げつつ後段ステップ画像処理工程、すなわち、第2欠陥成分検出画像作成工程St4および第2欠陥成分除去画像作成工程St5を複数ステップ繰り返す。画素距離の最大値は、検出したい最大の欠陥成分のサイズに応じて設定される。   As described above, the first step image processing process is performed by the image processing means 14. In this first step image processing step, a defect component (for example, noise) having a size corresponding to the smallest first distance among the set pixel distances is detected and removed. In the following, since each defect component is detected from a processing target image that is a target in which a low contrast defect having a relatively low luminance value and a high contrast defect having a relatively high luminance value are mixed, image processing is performed. The means 14 functions as a post-stage image processing means, and the post-step image processing process, that is, the second defect component detection image creation process St4 and the second defect component removal image creation, while increasing the pixel distance by a predetermined interval in and after step 2. Step St5 is repeated a plurality of steps. The maximum value of the pixel distance is set according to the size of the largest defect component that is desired to be detected.

第2欠陥成分検出画像作成工程St4では、画素距離が前ステップにおける画素距離よりも拡大される。ここで、後段ステップ画像処理工程が複数回繰り返される場合においては、現ステップ(ステップn)よりも前のステップ(ステップn−1)で設定された画素距離よりも長く(広く)設定された画素距離は、本発明における第2の距離に相当する。本実施形態においては、前ステップにおける画素距離よりも1画素分だけ長い画素距離とされる。各ステップで第2の距離を前ステップの画素距離からどの程度長くするかについては任意に設定することができる。そして、画素距離が現ステップにおける画素距離以下の欠陥成分除去画像(すなわち、現ステップにおいて既に作成された欠陥成分除去画像も含む。以下、同様。)について、構成する画素毎に第2の距離に対応する欠陥成分が検出されて欠陥成分検出画像が作成される。なお、画素距離を変えることなくステップが繰り返される場合、それらのステップは画素距離が同一である限り同一ステップとする。   In the second defect component detection image creation step St4, the pixel distance is expanded more than the pixel distance in the previous step. Here, when the subsequent step image processing process is repeated a plurality of times, pixels set longer (wider) than the pixel distance set in the step (step n-1) before the current step (step n) The distance corresponds to the second distance in the present invention. In the present embodiment, the pixel distance is longer by one pixel than the pixel distance in the previous step. The extent to which the second distance is increased from the pixel distance of the previous step in each step can be arbitrarily set. Then, the defect component removal image whose pixel distance is equal to or less than the pixel distance in the current step (that is, the defect component removal image already created in the current step is also included) is set to the second distance for each constituent pixel. Corresponding defect components are detected and a defect component detection image is created. When steps are repeated without changing the pixel distance, those steps are the same as long as the pixel distance is the same.

図16は、ステップ2明欠陥成分検出画像の一例を示し、図17は、ステップ2暗欠陥成分検出画像の一例を示している。初段ステップ画像処理工程の後に最初に行われる第2ステップ(ステップ2)における第2欠陥成分検出画像作成工程St4では、画素距離が初段ステップ(ステップ1)における第1の距離よりも長い第2の距離に設定される。そして、上記ステップ1欠陥成分除去画像(図15)に対して、上記第1欠陥成分検出画像作成工程St2と同様に、第2の距離のフィルターでステップ2明欠陥成分検出画像(図16)、ステップ2暗欠陥成分検出画像(図17)がそれぞれ作成される。   FIG. 16 shows an example of the step 2 bright defect component detection image, and FIG. 17 shows an example of the step 2 dark defect component detection image. In the second defect component detection image creation step St4 in the second step (step 2) performed first after the first step image processing step, the second pixel distance is longer than the first distance in the first step (step 1). Set to distance. Then, with respect to the step 1 defect component removal image (FIG. 15), similarly to the first defect component detection image creation step St2, the step 2 bright defect component detection image (FIG. 16) is filtered by the second distance filter. Step 2 Dark defect component detection images (FIG. 17) are created.

図18は、ステップ2欠陥成分除去画像の一例を示す図である。
第2欠陥成分検出画像作成工程St4を経てステップ2欠陥成分検出画像(ステップ2明欠陥成分検出画像およびステップ2暗欠陥成分検出画像)が作成されたならば、続いて、第2欠陥成分除去画像作成工程St5が行われる。この工程では、画素距離が現ステップにおける画素距離以下の欠陥成分除去画像の輝度値に対し、ステップ2明欠陥成分検出画像の輝度値を減算するとともにステップ2暗欠陥成分検出画像の輝度値を加算することで、図18に示されるようなステップ2欠陥成分除去画像が得られる。
FIG. 18 is a diagram illustrating an example of a step 2 defect component removal image.
If the step 2 defect component detection image (step 2 bright defect component detection image and step 2 dark defect component detection image) is created through the second defect component detection image creation step St4, then the second defect component removal image is created. The creation process St5 is performed. In this process, the luminance value of the step 2 bright defect component detection image is subtracted from the luminance value of the defect component removal image whose pixel distance is equal to or smaller than the pixel distance in the current step, and the luminance value of the step 2 dark defect component detection image is added. Thus, a step 2 defect component removal image as shown in FIG. 18 is obtained.

図19は、ステップ12明欠陥成分検出画像の一例を示し、図20は、ステップ12暗欠陥成分検出画像の一例を示している。また、図21は、ステップ12欠陥成分除去画像の一例を示している。ステップごとに画素距離を広げながら第2欠陥成分検出画像作成工程St4および第2欠陥成分除去画像作成工程St5が繰り返されて、ステップn明欠陥成分検出画像、ステップn暗欠陥成分検出画像、および、ステップn欠陥成分除去画像がそれぞれ作成される。これにより、サイズが小さい欠陥成分から順に検出および除去され、それぞれの欠陥成分の欠陥成分検出画像および欠陥成分除去画像が得られることになる。例えば、図21に示されるステップ12欠陥成分除去画像では、比較的サイズの小さい傷や点等の欠陥成分が除去されて、シミやムラのような比較的サイズの大きい欠陥成分のみが残っている。   FIG. 19 shows an example of the step 12 bright defect component detection image, and FIG. 20 shows an example of the step 12 dark defect component detection image. FIG. 21 shows an example of the step 12 defect component removal image. The second defect component detection image creation step St4 and the second defect component removal image creation step St5 are repeated while increasing the pixel distance for each step, and a step n bright defect component detection image, a step n dark defect component detection image, and Step n Defect component removed images are respectively created. Thus, the defect components are detected and removed in order from the smallest defect component, and a defect component detection image and a defect component removal image of each defect component are obtained. For example, in the step 12 defect component removal image shown in FIG. 21, defect components such as scratches and spots having relatively small sizes are removed, and only relatively large defect components such as spots and unevenness remain. .

以上のようにして後段ステップ画像処理工程が行われる。なお、上述したように、このような欠陥成分検出画像作成工程および欠陥成分除去画像作成工程は、画素距離を維持したまま(同ステップ内で)複数回繰り返されてもよい。この場合、同一ステップにおいて前回作成された欠陥成分除去画像から今回作成された欠陥成分除去画像が減算されて明欠陥成分検出画像が作成され、今回作成された欠陥成分除去画像から前回作成された欠陥成分除去画像が減算されて暗欠陥成分検出画像が作成される。そして、最終的に得られた欠陥成分除去画像が、当該ステップの欠陥成分除去画像とされる。ここで、相対的に大きいサイズの欠陥に相対的に小さいサイズの欠陥が含まれていると、従来技術では誤検出になる可能性がある。この点に関し、本実施形態においては小さいサイズの欠陥から順に画素距離が拡大されながら欠陥が検出・除去されることにより誤検出が抑えられるので、検出精度が向上する。このため、例えば、撮影画像におけるムラやシミ等の比較的大きいサイズの欠陥の中に、傷等の比較的小さいサイズの欠陥が含まれているような場合や、あるいは、撮影画像内に構造物等のエッジ(コントラストが急激に変化する部分)が存在する場合においても、サイズが小さい欠陥成分から順次検出・除去されていくので、誤検出が抑制される。すなわち、例えば、撮影画像内に上記のエッジ成分が存在する場合でも、比較的小さいサイズの欠陥成分が除去されて得られた欠陥成分除去画像においては、エッジのコントラストが低下して境界がぼやける等が抑制され、当該エッジ成分がそのまま維持される。そして、傷等よりも大きいサイズの欠陥を検出・除去する際には、誤検出の原因となる傷等の比較的小さいサイズの欠陥については既に検出・除去されている欠陥成分除去画像を用いるので、精度よく欠陥を検出・除去することができる。   The post-step image processing process is performed as described above. As described above, such a defect component detection image creation step and defect component removal image creation step may be repeated a plurality of times while maintaining the pixel distance (within the same step). In this case, the defect component removal image created this time is subtracted from the defect component removal image created last time in the same step to create a bright defect component detection image, and the defect created last time from the defect component removal image created this time The component-removed image is subtracted to create a dark defect component detection image. Then, the finally obtained defect component removal image is used as the defect component removal image of the step. Here, if a relatively small size defect is included in a relatively large size defect, there is a possibility of erroneous detection in the related art. In this regard, in the present embodiment, detection errors are suppressed by detecting and removing the defects while increasing the pixel distance in order from a defect having a smaller size, so that the detection accuracy is improved. For this reason, for example, a relatively small size defect such as a scratch is included in a relatively large size defect such as unevenness or a stain in the captured image, or a structure is included in the captured image. Even in the case where there is an edge such as a portion where the contrast changes abruptly, since a defect component having a small size is sequentially detected and removed, erroneous detection is suppressed. That is, for example, even when the above-described edge component exists in the photographed image, in the defect component-removed image obtained by removing the defect component having a relatively small size, the edge contrast is lowered and the boundary is blurred, etc. Is suppressed, and the edge component is maintained as it is. When detecting / removing a defect having a size larger than a scratch or the like, a defect component removal image that has already been detected / removed is used for a relatively small size defect such as a scratch that causes false detection. , Defects can be detected and removed with high accuracy.

各ステップの後段ステップ画像処理工程が終了すると、続いて、現ステップにおける画素距離が予め設定された最大距離であるか否かが判定される(St6)。現ステップにおける画素距離が予め設定された最大距離に満たないと判定された場合(No)、ステップSt4に戻り、画素距離が広げられて次のステップの後段ステップ画像処理工程、すなわち、第2欠陥成分検出画像作成工程St4および第2欠陥成分除去画像作成工程St5が再度実行される。   When the subsequent step image processing step of each step is completed, it is subsequently determined whether or not the pixel distance in the current step is a preset maximum distance (St6). If it is determined that the pixel distance in the current step is less than the preset maximum distance (No), the process returns to step St4, the pixel distance is widened, and the subsequent step image processing step, that is, the second defect The component detection image creation process St4 and the second defect component removal image creation process St5 are executed again.

図22は、ステップ100明欠陥成分検出画像の一例を示す図、図23は、ステップ100暗欠陥成分検出画像の一例を示す図である。また、図24は、ステップ100欠陥成分除去画像の一例を示す図である。本実施形態においては、最大の画素距離に対応するステップ100まで、画素距離を1ずつ広げながら第2欠陥成分検出画像作成工程St4および第2欠陥成分除去画像作成工程St5が繰り返されて、図22のステップ100明欠陥成分検出画像、図23のステップ100暗欠陥成分検出画像、および、図24のステップ100欠陥成分除去画像がそれぞれ作成される。勿論、最大の画素距離に対応するステップ数が100になるとは限られない。   FIG. 22 is a diagram illustrating an example of a step 100 bright defect component detection image, and FIG. 23 is a diagram illustrating an example of a step 100 dark defect component detection image. FIG. 24 is a diagram illustrating an example of a step 100 defect component removal image. In the present embodiment, the second defect component detection image creation step St4 and the second defect component removal image creation step St5 are repeated while increasing the pixel distance by one up to step 100 corresponding to the maximum pixel distance, and FIG. Step 100 bright defect component detection image, Step 100 dark defect component detection image of FIG. 23, and Step 100 defect component removal image of FIG. 24 are respectively created. Of course, the number of steps corresponding to the maximum pixel distance is not necessarily 100.

そして、現ステップにおける画素距離が予め設定された最大距離である判定された場合(St6でYes)、続いて、欠陥抽出手段15は、欠陥抽出工程St7を行う。本実施形態における欠陥抽出工程St7では、各ステップで得られたステップn欠陥成分除去画像のうちの任意の欠陥成分除去画像同士の輝度値の差、または、撮像画像と任意の欠陥成分除去画像との輝度値の差により欠陥抽出画像が作成される。このように、撮像画像と欠陥成分除去画像との差だけではなく、途中の任意のステップの欠陥成分除去画像同士の差を取ることにより、例えば傷などの細かい欠陥成分のみを抽出した欠陥抽出画像、あるいは、例えばシミ、ムラ等の大きい欠陥成分のみを抽出した欠陥抽出画像を作成する事が可能となる。   When it is determined that the pixel distance in the current step is the preset maximum distance (Yes in St6), the defect extraction unit 15 performs a defect extraction step St7. In the defect extraction step St7 in the present embodiment, the difference in luminance value between arbitrary defect component removal images among the step n defect component removal images obtained in each step, or the captured image and the arbitrary defect component removal image A defect extraction image is created based on the difference in luminance values. In this way, not only the difference between the captured image and the defect component removed image, but also the defect extraction image in which only fine defect components such as scratches are extracted by taking the difference between the defect component removed images at any step in the middle. Alternatively, it is possible to create a defect extraction image in which only large defect components such as spots and unevenness are extracted.

例えば、上記ステップ12欠陥成分除去画像(図21)とステップ1欠陥成分除去画像(図15)とに基づき、ステップ2からステップ12までの明欠陥成分および暗欠陥成分を抽出した画像(明欠陥抽出画像および暗欠陥抽出画像)を作成することができる。明欠陥抽出画像については、以下の式(7)により作成される。また、暗欠陥抽出画像については以下の式(8)により作成される。
明欠陥抽出画像=
ステップ1欠陥成分除去画像−ステップ12欠陥成分除去画像…(7)
暗欠陥抽出画像=
ステップ12欠陥成分除去画像−ステップ1欠陥成分除去画像…(8)
For example, based on the step 12 defect component removal image (FIG. 21) and the step 1 defect component removal image (FIG. 15), an image (bright defect extraction) from which the bright defect components and dark defect components from step 2 to step 12 are extracted. Image and dark defect extraction image) can be created. The bright defect extracted image is created by the following equation (7). The dark defect extracted image is created by the following equation (8).
Bright defect extraction image =
Step 1 Defect Component Removal Image-Step 12 Defect Component Removal Image (7)
Dark defect extraction image =
Step 12 Defect Component Removal Image-Step 1 Defect Component Removal Image (8)

図25は、ステップ2からステップ12までの明欠陥抽出画像の一例を示す図、図26は、ステップ2からステップ12までの暗欠陥抽出画像の一例を示す図である。上記のステップ12欠陥成分除去画像は、傷、点等の欠陥成分が除去されており、また、ステップ1欠陥成分除去画像はノイズのようなごく微小な欠陥のみ除去されているので、図25および図26に示される欠陥抽出画像は、主に傷、点等の比較的小さいサイズの欠陥成分が抽出された画像となっている。   FIG. 25 is a diagram illustrating an example of a bright defect extraction image from step 2 to step 12, and FIG. 26 is a diagram illustrating an example of a dark defect extraction image from step 2 to step 12. In the above step 12 defect component-removed image, defect components such as scratches and dots are removed, and in the step 1 defect component-removed image, only very small defects such as noise are removed. The defect extracted image shown in FIG. 26 is an image from which defect components having a relatively small size such as scratches and dots are extracted.

上記欠陥抽出工程St7についてより一般化すると、「ステップm>ステップn」、「n>1」として、ステップnからステップmまでの画素距離に対応するサイズの明欠陥抽出画像、暗欠陥抽出画像を作成する式は、それぞれ以下の式(9)、式(10)で表すことができる。
ステップn〜m明欠陥抽出画像=
ステップ(n−1)欠陥成分除去画像−ステップm欠陥成分除去画像…(9)
ステップn〜m暗欠陥抽出画像=
ステップm欠陥成分除去画像−ステップ(n−1)欠陥成分除去画像…(10)
上記式(9)及び式(10)における(n−1)は、ステップnの一つ前のステップを意味しており、(n−1)に対応するステップが存在しない場合は、撮影画像をステップ(n−1)欠陥成分除去画像として使用する。
When the defect extraction process St7 is more generalized, it is assumed that “step m> step n” and “n> 1”, a bright defect extraction image and a dark defect extraction image having a size corresponding to the pixel distance from step n to step m. Formulas to be created can be represented by the following formulas (9) and (10), respectively.
Step n to m Bright defect extraction image =
Step (n-1) Defect component removed image-Step m Defect component removed image (9)
Steps n to m dark defect extraction image =
Step m Defect component removed image-Step (n-1) Defect component removed image (10)
(N-1) in the above formulas (9) and (10) means the step immediately before step n, and if there is no step corresponding to (n-1), the captured image is Step (n-1) Use as a defect component removed image.

図27は、最初の画素距離に対応するステップ1から本実施形態において最大の画素距離に対応するステップ100までの明欠陥抽出画像の一例を示す図、図28は、ステップ1からステップ100までの暗欠陥抽出画像の一例を示す図である。これらの画像は、m=100、n=1とし、ステップ100欠陥成分除去画像と、ステップ(n−1)欠陥成分除去画像としての撮影画像とを用いて、上記式(9)及び式(10)によりそれぞれ得られた画像である。これらの欠陥抽出画像は、ノイズ等の微小な欠陥成分(画素距離1に対応する欠陥成分)を含めて、ステップ1からステップ100までの画素距離に対応する全てサイズの欠陥成が抽出された画像である。   FIG. 27 is a diagram showing an example of a bright defect extraction image from step 1 corresponding to the first pixel distance to step 100 corresponding to the maximum pixel distance in the present embodiment, and FIG. It is a figure which shows an example of a dark defect extraction image. These images are set to m = 100 and n = 1, and using the step 100 defect component removed image and the captured image as the step (n-1) defect component removed image, the above equations (9) and (10) are used. ), Respectively. These defect extracted images are images in which defect components of all sizes corresponding to the pixel distance from Step 1 to Step 100 are extracted, including minute defect components such as noise (defect components corresponding to the pixel distance 1). It is.

このように、本発明に係る画像処理装置および画像処理方法によれば、ステップごとに画素距離を広げながら欠陥成分検出画像作成工程および陥成分除去画像作成工程が繰り返されて、サイズが小さい欠陥成分から順に検出および除去され、それぞれの欠陥成分の欠陥成分検出画像および欠陥成分除去画像が得られる。そして、これらの欠陥成分除去画像同士の差分により欠陥が抽出されるので、従来技術のような平滑化や近似式を用いることなく、より高い精度で被検査物の撮影画像から欠陥を抽出することが可能となる。特に、撮影画像にコントラストの高い欠陥、低い欠陥が混在している場合においても、誤検出が低減しつつ検出することが可能となる。   As described above, according to the image processing device and the image processing method of the present invention, the defect component detection image creation step and the defect component removal image creation step are repeated while increasing the pixel distance for each step, so that the defect component with a small size is obtained. Are sequentially detected and removed, and a defect component detection image and a defect component removal image of each defect component are obtained. And since a defect is extracted by the difference between these defect component removal images, it is possible to extract a defect from a captured image of an inspection object with higher accuracy without using smoothing or an approximate expression as in the prior art. Is possible. In particular, even when a high-contrast defect and a low-defective defect are mixed in the captured image, it is possible to detect while reducing false detection.

図29は、ステップ13からステップ100までの明欠陥抽出画像の一例を示す図、図30は、ステップ13からステップ100までの暗欠陥抽出画像の一例を示す図である。欠陥抽出工程St7において、例えばステップ100欠陥成分除去画像とステップ12欠陥成分除去画像とを使用して、画素距離13から画素距離100までの明欠陥成分、暗欠陥成分を抽出した画像を作成することもできる。この場合も同様にして、上記式(9)及び式(10)に基づき明欠陥抽出画像および暗欠陥抽出画像が作成される。上記のステップ12欠陥成分除去画像は、例えば傷、点等のようにステップ1〜12までの画素距離の範囲の欠陥成分が除去された画像であり、また、ステップ100欠陥成分除去画像は、例えば、ムラ等の画素距離が1〜100の範囲の欠陥成分が除去された画像である。このため、これらの欠陥成分除去画像を用いて得られた欠陥抽出画像は、主にムラ等の欠陥成分が抽出された画像である。つまり、任意のステップの欠陥成分除去画像同士の差を取ることにより、所望とするサイズの欠陥成分のみを抽出することもできる。これにより、欠陥抽出の自由度が向上する。   FIG. 29 is a diagram illustrating an example of a bright defect extraction image from step 13 to step 100, and FIG. 30 is a diagram illustrating an example of a dark defect extraction image from step 13 to step 100. In the defect extraction step St7, for example, using the step 100 defect component removed image and the step 12 defect component removed image, an image in which the bright defect component and the dark defect component from the pixel distance 13 to the pixel distance 100 are extracted is created. You can also. In this case as well, a bright defect extracted image and a dark defect extracted image are created based on the above equations (9) and (10). The step 12 defect component-removed image is an image obtained by removing defect components in the pixel distance range from step 1 to step 12 such as scratches and dots, and the step 100 defect component-removed image is, for example, This is an image from which defective components having a pixel distance in the range of 1 to 100 such as unevenness are removed. For this reason, the defect extraction image obtained using these defect component removal images is an image in which defect components such as unevenness are mainly extracted. That is, it is possible to extract only a defect component having a desired size by taking a difference between defect component-removed images in an arbitrary step. Thereby, the freedom degree of defect extraction improves.

ここで、上記式(9)及び式(10)により得られる欠陥抽出画像は、(n−1)以下のステップの画素距離に対応するサイズの欠陥成分が含まれない画像となる。すなわち、例えば、図29および図30に示されるステップ13からステップ100までの欠陥抽出画像は、上記のようにステップ12欠陥成分除去画像とステップ100欠陥成分除去画像との差分により作成される。このため、ステップ12までに除去された比較的サイズの小さい欠陥成分は、ステップ13からステップ100までの欠陥抽出画像には含まれておらず、当該欠陥成分は元から存在しないかのように穴埋めされたような画像となる。したがって、ステップ13からステップ100までの欠陥抽出画像からは、ムラ等の比較的サイズの大きい欠陥を把握することができる一方で、ステップ12までに除去された比較的サイズの小さい欠陥成分の存在については把握することができない。ステップ1からステップ12までに対応する欠陥成分について、ステップ13からステップ100までの画素距離に対応するサイズの欠陥抽出画像上で欠陥として抽出するのではなく、欠陥抽出画像から穴埋めされない形で除去する場合には、以下の式(11)および式(12)により欠陥抽出を行えばよい。なお、以下の式における処理対象画像は、撮影画像である。
明欠陥抽出画像=(処理対象画像−ステップ100欠陥成分除去画像)
−(処理対象画像−ステップ12欠陥成分除去画像)…(11)
暗欠陥抽出画像=(ステップ100欠陥成分除去画像−処理対象画像)
−(ステップ12欠陥成分除去画像−処理対象画像)…(12)
上記式(11)、(12)において、例えばノイズを除去した抽出画像を得たい場合には、上記の処理対象画像(撮像画像)に替えて、ステップ1欠陥成分除去画像をノイズ除去画像として用いればよい。すなわち、以下の式(13)および式(14)により欠陥抽出を行う。
明欠陥抽出画像=(ノイズ除去画像−ステップ100欠陥成分除去画像)
−(ノイズ除去画像−ステップ12欠陥成分除去画像)…(13)
暗欠陥抽出画像=(ステップ100欠陥成分除去画像−ノイズ除去画像)
−(ステップ12欠陥成分除去画像−ノイズ除去画像)…(14)
Here, the defect extraction image obtained by the above formulas (9) and (10) is an image that does not include a defect component having a size corresponding to the pixel distance in the steps of (n-1) and subsequent steps. That is, for example, the defect extraction images from step 13 to step 100 shown in FIGS. 29 and 30 are created by the difference between the step 12 defect component removal image and the step 100 defect component removal image as described above. For this reason, the defect component having a relatively small size that has been removed up to step 12 is not included in the defect extraction images from step 13 to step 100, and the defect component is filled as if it did not originally exist. The image looks like this. Therefore, from the defect extraction images from step 13 to step 100, it is possible to grasp a relatively large defect such as unevenness, while the presence of a relatively small defect component removed by step 12 is present. Can not grasp. The defect component corresponding to Step 1 to Step 12 is not extracted as a defect on the defect extraction image having a size corresponding to the pixel distance from Step 13 to Step 100, but is removed from the defect extraction image in a form that is not filled. In this case, defect extraction may be performed by the following formulas (11) and (12). Note that the processing target image in the following expression is a captured image.
Bright defect extracted image = (processing target image−step 100 defect component removed image)
-(Processing target image-Step 12 defect component removed image) (11)
Dark defect extracted image = (Step 100 defect component removed image−processing target image)
-(Step 12 defect component removed image-image to be processed) (12)
In the above formulas (11) and (12), for example, when it is desired to obtain an extracted image from which noise has been removed, the step 1 defect component-removed image is used as the noise-removed image instead of the processing target image (captured image). That's fine. That is, defect extraction is performed by the following formulas (13) and (14).
Bright defect extracted image = (noise-removed image−step 100 defect component-removed image)
-(Noise-removed image-step 12 defect component-removed image) (13)
Dark defect extracted image = (Step 100 defect component removed image−noise removed image)
-(Step 12 defect component removed image-noise removed image) (14)

図31および図32は、ステップ13からステップ100までの欠陥抽出画像からステップ1からステップ12までの欠陥成分を差し引いた場合の欠陥抽出画像の一例を示す図であり、図31は明欠陥抽出画像の一例を示す図、図32は暗欠陥抽出画像の一例を示す図である。
このように、小さい方(前側)のステップの欠陥成分除去画像が、途中(ステップ2以上)のステップの欠陥成分除去画像である場合において、当該ステップよりも前のステップに対応する欠陥成分を穴埋めせずに除去する場合には、一般的に、「ステップm>ステップn」、「n>1」として、ステップnからステップmまで画素距離に対応するサイズの明欠陥抽出画像、暗欠陥抽出画像を作成する式は、それぞれ以下の式(15)、式(16)で表すことができる。なお、以下の式における処理対象画像は、撮影画像である。
明欠陥抽出画像=(処理対象画像−ステップm欠陥成分除去画像)
−(処理対象画像−ステップ(n−1)欠陥成分除去画像)…(15)
暗欠陥抽出画像=(ステップm欠陥成分除去画像−処理対象画像)
−(ステップ(n−1)欠陥成分除去画像−処理対象画像)…(16)
上記式(15)、(16)において、上述したようにノイズを除去した抽出画像を得たい場合には、上記の処理対象画像(撮像画像)に替えて、ステップ1欠陥成分除去画像をノイズ除去画像として用いればよい。すなわち、以下の式(17)および式(18)により欠陥抽出を行う。
明欠陥抽出画像=(ノイズ除去画像−ステップm欠陥成分除去画像)
−(ノイズ除去画像−ステップ(n−1)欠陥成分除去画像)…(17)
暗欠陥抽出画像=(ステップm欠陥成分除去画像−ノイズ除去画像)
−(ステップ(n−1)欠陥成分除去画像−ノイズ除去画像)…(18)
これにより、ステップnからステップmまでの欠陥抽出画像から、これらのステップの間の画素距離対応するサイズの大きい欠陥を把握することができると共に、ステップnよりも前のステップまでに除去された欠陥成分の存在についても把握することができる。
FIGS. 31 and 32 are diagrams showing an example of the defect extraction image when the defect components from step 1 to step 12 are subtracted from the defect extraction image from step 13 to step 100. FIG. 31 shows the bright defect extraction image. FIG. 32 is a diagram illustrating an example of a dark defect extraction image.
In this way, when the defect component removal image of the smaller (front) step is the defect component removal image of the intermediate step (step 2 or more), the defect component corresponding to the previous step is filled in. In the case of removing without, generally, “step m> step n”, “n> 1”, a bright defect extraction image and a dark defect extraction image having a size corresponding to the pixel distance from step n to step m. Equations for creating can be expressed by the following equations (15) and (16), respectively. Note that the processing target image in the following expression is a captured image.
Bright defect extracted image = (processing target image−step m defect component removed image)
-(Processing target image-Step (n-1) Defect component removed image) (15)
Dark defect extracted image = (step m defect component removed image−processing target image)
-(Step (n-1) Defect Component Removal Image-Processing Target Image) (16)
In the above formulas (15) and (16), when it is desired to obtain an extracted image from which noise has been removed as described above, the defect-removed image in step 1 is subjected to noise removal instead of the processing target image (captured image). What is necessary is just to use as an image. That is, defect extraction is performed by the following formulas (17) and (18).
Bright defect extraction image = (noise removal image−step m defect component removal image)
-(Noise-removed image-Step (n-1) Defect component-removed image) (17)
Dark defect extraction image = (step m defect component removal image−noise removal image)
-(Step (n-1) Defect component removed image-Noise removed image) (18)
As a result, it is possible to grasp a defect having a large size corresponding to the pixel distance between these steps from the defect extraction image from step n to step m, and the defect removed by the step before step n. It is also possible to grasp the presence of ingredients.

なお、上記の実施形態においては、画素距離の最大値を、最大サイズの欠陥をカバーする値に設定する構成を例示したが、当該画素距離の最大値を、最大サイズの欠陥よりもさらに大きい値に設定してフィルター処理を行うことで、欠陥検出精度をさらに向上させることが可能となる。   In the above embodiment, the configuration in which the maximum value of the pixel distance is set to a value that covers the defect of the maximum size is exemplified. However, the maximum value of the pixel distance is a value that is larger than the defect of the maximum size. It is possible to further improve the defect detection accuracy by performing the filter processing with setting to.

図33は、第2の実施形態における処理対象画像としてのパターン画像を示す図である。図34は、ステップ1からステップ9までの明欠陥抽出画像の一例を示す図、図35は、ステップ1からステップ9までの暗欠陥抽出画像の一例を示す図である。図33に示されるパターン画像において、四角枠状のパターン、当該枠状のパターンの内側に縦方向に合計6本並ぶ横線のパターン、左下側の横長な長方形のパターン、下側の円形のパターンが、それぞれ欠陥(明欠陥)であるものとする。そして、図33に示されるパターン画像に対して、ステップ1からステップ9まで、画素距離を1ずつ広げて第2欠陥成分検出画像作成工程St4および第2欠陥成分除去画像作成工程St5を繰り返して欠陥成分除去画像を作成し、m=9、n=1として上記の式(9)により、図34に示されるように、ステップ1からステップ9までの明欠陥抽出画像が得られる。同様に、m=9、n=1として上記の式(10)により、図35に示されるように、ステップ1からステップ9までの暗欠陥抽出画像が得られる。   FIG. 33 is a diagram illustrating a pattern image as a processing target image in the second embodiment. FIG. 34 is a diagram illustrating an example of a bright defect extraction image from step 1 to step 9, and FIG. 35 is a diagram illustrating an example of a dark defect extraction image from step 1 to step 9. In the pattern image shown in FIG. 33, there are a square frame-shaped pattern, a horizontal line pattern arranged in total in the vertical direction inside the frame-shaped pattern, a horizontally long rectangular pattern on the lower left side, and a circular pattern on the lower side. Each of them is assumed to be a defect (bright defect). Then, in the pattern image shown in FIG. 33, from step 1 to step 9, the pixel distance is increased by 1 and the second defect component detection image creation step St4 and the second defect component removal image creation step St5 are repeated. A component-removed image is created, and m = 9, n = 1, and the bright defect extraction image from step 1 to step 9 is obtained as shown in FIG. Similarly, as shown in FIG. 35, the dark defect extraction image from step 1 to step 9 is obtained by the above equation (10) with m = 9 and n = 1.

図33に示されるパターン画像と、図34に示される明欠陥抽出画像とを比較すると、ステップ1からステップ9に対応する画素距離のフィルター処理では、枠や横線のパターンの欠陥サイズしかカバーしないので、これよりも大きいサイズの欠陥、すなわち、長方形パターンと円形のパターンについては明欠陥として検出されていない。また、横線のパターンについては、パターンが存在する部分が明欠陥として抽出されているが、明欠陥抽出画像のコントラストは、パターン画像に比べて低くなっている。さらに、図33に示されるパターン画像と、図35に示される暗欠陥抽出画像とを比較すると、6本の横線のパターンについて、各線の両端部の間の部分が、それぞれ暗欠陥として抽出されており、誤検出となっている。   When the pattern image shown in FIG. 33 is compared with the bright defect extraction image shown in FIG. 34, the pixel distance filter processing corresponding to step 1 to step 9 covers only the defect size of the frame or horizontal line pattern. A defect having a size larger than this, that is, a rectangular pattern and a circular pattern are not detected as bright defects. As for the horizontal line pattern, the portion where the pattern exists is extracted as a bright defect, but the contrast of the bright defect extracted image is lower than that of the pattern image. Further, when comparing the pattern image shown in FIG. 33 and the dark defect extraction image shown in FIG. 35, the portions between both ends of each line are extracted as dark defects for the six horizontal line patterns. This is a false detection.

図36は、ステップ1からステップ65までの明欠陥抽出画像の一例を示す図、図37は、ステップ1からステップ65までの暗欠陥抽出画像の一例を示す図である。画素距離を拡大するため、ステップ65まで後段ステップ画像処理工程が繰り返して行われた場合、当該サイズのフィルターでは、全てのサイズのパターンをカバーすることができる。このため、図36に示されるステップ1からステップ65までの明欠陥抽出画像では、ステップ9までは検出されなかった長方形のパターンと円形のパターンが検出されている。また、横線のパターンについては明欠陥として検出されており、明欠陥抽出画像のコントラストも問題ない。さらに、図37に示されるテップ1からステップ65までの暗欠陥抽出画像では、ステップ9までにおいて暗欠陥として誤検出されていた横線の両端部の間の誤検出もみられない。このように、画素距離を広げるほど、検出精度が向上することが分かる。   FIG. 36 is a diagram illustrating an example of a bright defect extraction image from step 1 to step 65, and FIG. 37 is a diagram illustrating an example of a dark defect extraction image from step 1 to step 65. When the subsequent step image processing process is repeated up to step 65 in order to increase the pixel distance, the filter of the size can cover patterns of all sizes. For this reason, in the bright defect extraction image from step 1 to step 65 shown in FIG. 36, a rectangular pattern and a circular pattern that were not detected until step 9 are detected. Further, the horizontal line pattern is detected as a bright defect, and there is no problem with the contrast of the bright defect extracted image. Further, in the dark defect extraction image from Step 1 to Step 65 shown in FIG. 37, no erroneous detection is observed between both ends of the horizontal line that was erroneously detected as a dark defect until Step 9. Thus, it can be seen that the detection accuracy improves as the pixel distance increases.

なお、処理対象画像が、例えば、明欠陥のみを含むものである場合、明欠陥成分、暗欠陥成分のそれぞれについて上記のように検出、除去を行うと、欠陥検出精度が落ちる場合がある。特に、欠陥同士の距離が短いと明欠陥であるにも拘わらず暗欠陥として検出されるなどの誤検出が発生しやすい。したがって、この場合、明欠陥成分のみについて検出、除去を行うことにより、このような不具合を抑制することが可能となる。同様に暗欠陥成分のみ存在している場合には、暗欠陥成分のみについて検出、除去を行って処理を行えば、欠陥検出精度が向上する。   Note that when the processing target image includes, for example, only a bright defect, if the bright defect component and the dark defect component are detected and removed as described above, the defect detection accuracy may decrease. In particular, if the distance between the defects is short, erroneous detection such as detection as a dark defect despite the fact that it is a bright defect is likely to occur. Therefore, in this case, such a problem can be suppressed by detecting and removing only the bright defect component. Similarly, when only dark defect components exist, defect detection accuracy can be improved by performing processing by detecting and removing only dark defect components.

また、上記実施形態においては、異なるステップで作成された画素距離が互いに異なる欠陥成分除去画像の差分を用いて任意のサイズの欠陥を抽出する例を示したが、欠陥成分除去画像を用いずに、欠陥成分検出画像(明欠陥成分検出画像、暗欠陥成分検出画像)を用いて欠陥の抽出を行うことも可能である。例えば、欠陥として抽出したい欠陥成分の大きさがステップ21からステップ33までの画素距離に対応するものであるとして、各ステップで得られた欠陥成分検出画像をそれぞれ足し合わせて二値化処理を経て、当該欠陥成分を抜き出した欠陥成分抽出画像を得ることができる。この場合、ステップ20の欠陥成分除去画像とステップ33の欠陥成分除去画像との差分により得られた結果と同じとなる。   In the above embodiment, an example in which a defect having an arbitrary size is extracted using a difference between defect component removal images created in different steps and having different pixel distances. However, the defect component removal image is not used. It is also possible to extract defects using a defect component detection image (bright defect component detection image, dark defect component detection image). For example, assuming that the size of a defect component to be extracted as a defect corresponds to the pixel distance from step 21 to step 33, the defect component detection images obtained in each step are added together and subjected to binarization processing. A defect component extraction image obtained by extracting the defect component can be obtained. In this case, the result obtained by the difference between the defect component removed image in step 20 and the defect component removed image in step 33 is the same.

また、上記実施形態では、異なるステップで作成された2つの欠陥成分除去画像の差分により欠陥抽出画像が作成される構成を例示したが、これには限られない。例えば、異なる複数のステップでそれぞれ作成された複数枚(3枚以上)の欠陥成分除去画像を用いて欠陥抽出画像を作成することもできる。   Moreover, although the said embodiment illustrated the structure which produces a defect extraction image by the difference of the two defect component removal images produced at a different step, it is not restricted to this. For example, a defect extraction image can be created using a plurality (three or more) of defect component removal images created in different steps.

さらに、任意の欠陥成分除去画像から、他の画像処理により欠陥を検出することも可能である。例えば、図24に示されるステップ100欠陥成分除去画像について、メディアンフィルターや平滑化処理を使用した画像処理によって欠陥を抽出することも可能である。すなわち、所定のステップの欠陥成分除去画像は、これよりも前のステップまでの画素距離に対応するサイズの欠陥成分が除去された画像であるため、この画像を用いてこれよりも大きいサイズの欠陥成分については他の画像処理を組み合わせて抽出等をすることもできる。   Furthermore, it is also possible to detect a defect from another defect component removed image by other image processing. For example, it is possible to extract defects by image processing using a median filter or a smoothing process for the step 100 defect component-removed image shown in FIG. That is, the defect component-removed image at a predetermined step is an image from which a defect component having a size corresponding to the pixel distance to the previous step has been removed. Components can be extracted by combining other image processing.

また、第1次欠陥成分検出画像作成工程(St2)における処理対象画像に関し、画像取得工程で得た撮像画像に限られず、例えば、一般的な平滑化処理、若しくはメディアンフィルター等が適用されてノイズ除去された画像、あるいは、エッジ検出処理等の他の種々の画像処理を適用した結果の画像等、撮影画像以外の画像を処理対象画像として用いても良い。
さらに、本技術を適用して得られたノイズ除去画像に替えて、他の種々の画像処理が適用された結果の画像を、処理対象画像として用いても良い。
The processing target image in the first defect component detection image creation step (St2) is not limited to the captured image obtained in the image acquisition step. For example, a general smoothing process or a median filter is applied to generate noise. An image other than the captured image, such as a removed image or an image obtained as a result of applying various other image processing such as edge detection processing, may be used as the processing target image.
Furthermore, instead of the noise-removed image obtained by applying the present technology, an image obtained as a result of applying various other image processing may be used as the processing target image.

そして、本発明は、被検査物としてのフレキシブル基板などにおける異物欠陥検出や、被検査物の表面の傷や汚れの検出や、被検査物としての各種表示装置の輝度シミ欠陥や色シミ欠陥の検出等に広く適用することができる。   The present invention also detects foreign matter defects in a flexible substrate as an inspection object, detection of scratches and dirt on the surface of the inspection object, and luminance spot defects and color spot defects of various display devices as the inspection object. It can be widely applied to detection and the like.

1…被検査物,2…XYステージ,3…撮影装置,6…コンピューター,7…表示装置,8…入力装置,10…欠陥検出装置,11…演算部,12…記憶部,13…画像入力手段,14…画像処理手段,15…欠陥抽出手段   DESCRIPTION OF SYMBOLS 1 ... Test object, 2 ... XY stage, 3 ... Imaging apparatus, 6 ... Computer, 7 ... Display apparatus, 8 ... Input device, 10 ... Defect detection apparatus, 11 ... Calculation part, 12 ... Memory | storage part, 13 ... Image input Means, 14 ... image processing means, 15 ... defect extraction means

Claims (8)

被検査物を撮像して得られた撮影画像について欠陥成分検出画像を作成する第1欠陥成分検出画像作成工程、および、前記撮影画像から欠陥成分を除去した欠陥成分除去画像を作成する第1欠陥成分除去画像作成工程を含む初段ステップ画像処理工程を実行する初段画像処理手段と、
欠陥成分除去画像について欠陥成分検出画像を作成する第2欠陥成分検出画像作成工程、および、欠陥成分除去画像から欠陥成分を除去して新たな欠陥成分除去画像を作成する第2欠陥成分除去画像作成工程を含む後段ステップ画像処理工程を実行する後段画像処理手段と、
前記撮影画像または各ステップで得られた欠陥成分除去画像のうちの任意の画像同士の輝度値の差により欠陥抽出画像を作成する欠陥抽出手段と、
を備え、
前記初段画像処理手段は、
前記第1欠陥成分検出画像作成工程において、
検査対象画素と、前記検査対象画素と比較する比較画素と、の間の画素数を示す画素距離を、第1の距離に設定することで、
前記撮影画像について、構成する画素毎に前記第1の距離に対応するサイズの欠陥成分を検出して欠陥成分検出画像を作成し、
前記第1欠陥成分除去画像作成工程において、
前記撮影画像と前記第1欠陥成分検出画像作成工程で作成した前記欠陥成分検出画像との輝度値の加減算により欠陥成分除去画像を作成し、
前記後段画像処理手段は、
前記第2欠陥成分検出画像作成工程において、
画素距離を前ステップにおける画素距離よりも長い第2の距離に設定することで、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について、構成する画素毎に前記第2の距離に対応する欠陥成分を検出して欠陥成分検出画像を作成し、
前記第2欠陥成分除去画像作成工程において、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像と、前記第2欠陥成分検出画像作成工程で作成した欠陥成分検出画像と、の輝度値の加減算により新たな欠陥成分除去画像を作成する、
ことを特徴とする画像処理装置。
A first defect component detection image creating step for creating a defect component detection image for a photographed image obtained by imaging the inspection object, and a first defect for creating a defect component removal image obtained by removing the defect component from the photographed image First-stage image processing means for performing a first-stage step image processing process including a component removal image creation process;
A second defect component detection image creation step for creating a defect component detection image for the defect component removal image, and a second defect component removal image creation for creating a new defect component removal image by removing the defect component from the defect component removal image A post-stage image processing means for executing a post-stage image processing process including the process;
Defect extraction means for creating a defect extraction image based on a difference in luminance value between arbitrary images of the captured image or the defect component removal image obtained in each step;
With
The first stage image processing means includes:
In the first defect component detection image creation step,
By setting the pixel distance indicating the number of pixels between the inspection target pixel and the comparison pixel to be compared with the inspection target pixel to the first distance,
For the captured image, a defect component detection image is created by detecting a defect component having a size corresponding to the first distance for each pixel constituting the image,
In the first defect component removal image creation step,
Create a defect component removal image by adding and subtracting a luminance value between the captured image and the defect component detection image created in the first defect component detection image creation step,
The latter stage image processing means includes:
In the second defect component detection image creation step,
By setting the pixel distance to a second distance that is longer than the pixel distance in the previous step,
For a defect component removal image having a pixel distance equal to or less than the pixel distance in the current step, a defect component corresponding to the second distance is detected for each pixel constituting the defect component detection image,
In the second defect component removal image creation step,
Creating a new defect component removal image by adding and subtracting luminance values of the defect component removal image whose pixel distance is equal to or less than the pixel distance in the current step and the defect component detection image created in the second defect component detection image creation step;
An image processing apparatus.
前記初段画像処理手段は、前記第1欠陥成分検出画像作成工程において、前記撮影画像について検査対象画素に対し前記第1の距離で比較画素を複数設定し、各比較画素の輝度値と当該検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成し、
前記後段画像処理手段は、前記第2欠陥成分検出画像作成工程において、画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について検査対象画素に対し前記第2の距離で比較画素を複数設定し、各比較画素の輝度値と前記検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成することを特徴とする請求項1に記載の画像処理装置。
In the first defect component detection image creation step, the first-stage image processing means sets a plurality of comparison pixels at the first distance with respect to the inspection target pixel for the photographed image, and the luminance value of each comparison pixel and the inspection target Create a defect component detection image based on the difference from the luminance value of the pixel,
In the second defect component detection image creating step, the subsequent image processing means sets a plurality of comparison pixels at the second distance with respect to the inspection target pixel for a defect component removal image whose pixel distance is equal to or smaller than the pixel distance in the current step. The image processing apparatus according to claim 1, wherein a defect component detection image is created based on a difference between a luminance value of each comparison pixel and a luminance value of the inspection target pixel.
前記初段画像処理手段および前記後段画像処理手段は、それぞれ前記第1欠陥成分検出画像作成工程および前記第2欠陥成分検出画像作成工程において、検出の対象とする欠陥のサイズに応じて前記画素距離を設定することを特徴とする請求項2に記載の画像処理装置。   In the first defect component detection image creation step and the second defect component detection image creation step, the first-stage image processing means and the subsequent-stage image processing means respectively set the pixel distance according to the size of a defect to be detected. The image processing apparatus according to claim 2, wherein the image processing apparatus is set. 前記後段画像処理手段は、画素距離をステップ毎に順次広げて前記後段ステップ画像処理工程を複数ステップ実行することを特徴とする請求項1から請求項3の何れか一項に記載の画像処理装置。   4. The image processing apparatus according to claim 1, wherein the post-stage image processing unit sequentially increases the pixel distance for each step and executes the post-stage image processing step a plurality of steps. 5. . 被検査物を撮像して得られた撮影画像について欠陥成分検出画像を作成する第1欠陥成分検出画像作成工程、および、前記撮影画像から欠陥成分を除去した欠陥成分除去画像を作成する第1欠陥成分除去画像作成工程を含む初段ステップ画像処理工程と、
欠陥成分除去画像について欠陥成分検出画像を作成する第2欠陥成分検出画像作成工程、および、欠陥成分除去画像から欠陥成分を除去して新たな欠陥成分除去画像を作成する第2欠陥成分除去画像作成工程を含む後段ステップ画像処理工程と、
前記撮影画像または各ステップで得られた欠陥成分除去画像のうちの任意の画像同士の輝度値の差により欠陥抽出画像を作成する欠陥抽出工程と、
を含み、
前記第1欠陥成分検出画像作成工程において、
検査対象画素と、前記検査対象画素と比較する比較画素と、の間の画素数を示す画素距離を、第1の距離に設定することで、
前記撮影画像について、構成する画素毎に前記第1の距離に対応するサイズの欠陥成分を検出して欠陥成分検出画像を作成し、
前記第1欠陥成分除去画像作成工程において、
前記撮影画像と前記第1欠陥成分検出画像作成工程で作成した前記欠陥成分検出画像との輝度値の加減算により欠陥成分除去画像を作成し、
前記第2欠陥成分検出画像作成工程において、
検査対象画素と、前記検査対象画素と比較する比較画素と、の間の画素数を示す画素距離を、前ステップにおける画素距離よりも長い第2の距離に設定することで、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について、構成する画素毎に前記第2の距離に対応する欠陥成分を検出して欠陥成分検出画像を作成し、
前記第2欠陥成分除去画像作成工程において、
画素距離が現ステップにおける画素距離以下の欠陥成分除去画像と、前記第2欠陥成分検出画像作成工程で作成した欠陥成分検出画像と、の加減算により新たな欠陥成分除去画像を作成する、
ことを特徴とする画像処理方法。
A first defect component detection image creating step for creating a defect component detection image for a photographed image obtained by imaging the inspection object, and a first defect for creating a defect component removal image obtained by removing the defect component from the photographed image A first step image processing step including a component removal image creation step;
A second defect component detection image creation step for creating a defect component detection image for the defect component removal image, and a second defect component removal image creation for creating a new defect component removal image by removing the defect component from the defect component removal image A post-step image processing process including a process;
A defect extraction step of creating a defect extraction image by a difference in luminance value between arbitrary images of the captured image or the defect component removal image obtained in each step;
Including
In the first defect component detection image creation step,
By setting the pixel distance indicating the number of pixels between the inspection target pixel and the comparison pixel to be compared with the inspection target pixel to the first distance,
For the captured image, a defect component detection image is created by detecting a defect component having a size corresponding to the first distance for each pixel constituting the image,
In the first defect component removal image creation step,
Create a defect component removal image by adding and subtracting a luminance value between the captured image and the defect component detection image created in the first defect component detection image creation step,
In the second defect component detection image creation step,
By setting the pixel distance indicating the number of pixels between the inspection target pixel and the comparison pixel to be compared with the inspection target pixel to a second distance longer than the pixel distance in the previous step,
For a defect component removal image having a pixel distance equal to or less than the pixel distance in the current step, a defect component corresponding to the second distance is detected for each pixel constituting the defect component detection image,
In the second defect component removal image creation step,
Creating a new defect component removal image by adding and subtracting the defect component removal image whose pixel distance is equal to or less than the pixel distance in the current step and the defect component detection image created in the second defect component detection image creation step;
An image processing method.
前記第1欠陥成分検出画像作成工程において、前記撮影画像について検査対象画素に対し前記第1の距離で比較画素を複数設定し、各比較画素の輝度値と当該検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成し、
前記第2欠陥成分検出画像作成工程において、画素距離が現ステップにおける画素距離以下の欠陥成分除去画像について検査対象画素に対し前記第2の距離で比較画素を複数設定し、各比較画素の輝度値と前記検査対象画素の輝度値との差に基づいて欠陥成分検出画像を作成することを特徴とする請求項5に記載の画像処理方法。
In the first defect component detection image creation step, a plurality of comparison pixels are set at the first distance with respect to the inspection target pixel in the captured image, and the difference between the luminance value of each comparison pixel and the luminance value of the inspection target pixel Create a defect component detection image based on
In the second defect component detection image creation step, a plurality of comparison pixels are set at the second distance with respect to a pixel to be inspected for a defect component removal image whose pixel distance is equal to or less than the pixel distance in the current step, and the luminance value of each comparison pixel The image processing method according to claim 5, wherein a defect component detection image is created based on a difference between a luminance value of the inspection target pixel and the luminance value of the inspection target pixel.
前記第1欠陥成分検出画像作成工程および前記第2欠陥成分検出画像作成工程において、検出の対象とする欠陥のサイズに応じて前記画素距離を設定することを特徴とする請求項6に記載の画像処理方法。   7. The image according to claim 6, wherein in the first defect component detection image creation step and the second defect component detection image creation step, the pixel distance is set according to the size of a defect to be detected. Processing method. 前記後段ステップ画像処理工程は、画素距離をステップ毎に順次広げて複数ステップ実行することを特徴とする請求項5から請求項7の何れか一項に記載の画像処理方法。   The image processing method according to any one of claims 5 to 7, wherein the subsequent step image processing step is executed in a plurality of steps by sequentially increasing the pixel distance for each step.
JP2016252740A 2016-12-27 2016-12-27 Image processing device and image processing method Pending JP2018106456A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016252740A JP2018106456A (en) 2016-12-27 2016-12-27 Image processing device and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016252740A JP2018106456A (en) 2016-12-27 2016-12-27 Image processing device and image processing method

Publications (1)

Publication Number Publication Date
JP2018106456A true JP2018106456A (en) 2018-07-05

Family

ID=62787307

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016252740A Pending JP2018106456A (en) 2016-12-27 2016-12-27 Image processing device and image processing method

Country Status (1)

Country Link
JP (1) JP2018106456A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021210875A1 (en) * 2020-04-17 2021-10-21 삼성전자 주식회사 Electronic device for detecting defect in image on basis of difference among sub-images acquired by multiple photodiode sensor, and operation method thereof

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021210875A1 (en) * 2020-04-17 2021-10-21 삼성전자 주식회사 Electronic device for detecting defect in image on basis of difference among sub-images acquired by multiple photodiode sensor, and operation method thereof

Similar Documents

Publication Publication Date Title
JP2007285754A (en) Flaw detection method and flaw detector
JP2009259036A (en) Image processing device, image processing method, image processing program, recording medium, and image processing system
JP5603798B2 (en) Defect detection apparatus, defect detection method, and computer program
JP2014197243A (en) Pattern processor, pattern processing method and pattern processing program
JP4915166B2 (en) Blur filter design method
JP5705711B2 (en) Crack detection method
JP5088165B2 (en) Defect detection method and defect detection apparatus
CN116071272A (en) Image correction method and device, electronic equipment and storage medium thereof
JP6045429B2 (en) Imaging apparatus, image processing apparatus, and image processing method
KR20190023374A (en) Method for testing display pannel
JP2005165387A (en) Method and device for detecting stripe defective of picture and display device
JP2011008482A (en) Defect detection method, defect detection device and defect detection program
JP2018106456A (en) Image processing device and image processing method
JP2005345290A (en) Streak-like flaw detecting method and streak-like flaw detector
JP4405407B2 (en) Defect inspection equipment
JP2009294027A (en) Pattern inspection device and method of inspecting pattern
JP2006226837A (en) Method and apparatus for inspecting stain
TW200842339A (en) Mura detection method and system
JP2019100937A (en) Defect inspection device and defect inspection method
JP6114559B2 (en) Automatic unevenness detector for flat panel display
JP5239275B2 (en) Defect detection method and defect detection apparatus
CN112270717B (en) Checkerboard angular point detection method and device
CN110796611B (en) Image correction method and image correction device for shadow and free-form surface
JP2006145228A (en) Unevenness defect detecting method and unevenness defect detector
JP2007104296A (en) Method, apparatus, and program for measuring resolution

Legal Events

Date Code Title Description
RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20180226