JP3890844B2 - Appearance inspection method - Google Patents

Appearance inspection method Download PDF

Info

Publication number
JP3890844B2
JP3890844B2 JP2000016402A JP2000016402A JP3890844B2 JP 3890844 B2 JP3890844 B2 JP 3890844B2 JP 2000016402 A JP2000016402 A JP 2000016402A JP 2000016402 A JP2000016402 A JP 2000016402A JP 3890844 B2 JP3890844 B2 JP 3890844B2
Authority
JP
Japan
Prior art keywords
defect candidate
defect
density
pixel
pixels
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.)
Expired - Lifetime
Application number
JP2000016402A
Other languages
Japanese (ja)
Other versions
JP2001209794A (en
Inventor
満 白澤
剛 増田
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.)
Panasonic Electric Works Co Ltd
Original Assignee
Matsushita Electric Works Ltd
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 Matsushita Electric Works Ltd filed Critical Matsushita Electric Works Ltd
Priority to JP2000016402A priority Critical patent/JP3890844B2/en
Publication of JP2001209794A publication Critical patent/JP2001209794A/en
Application granted granted Critical
Publication of JP3890844B2 publication Critical patent/JP3890844B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、検査対象を撮像して得た画像に画像処理を施すことによって検査対象の外観上の欠陥の有無を検出する外観検査方法に関するものである。
【0002】
【従来の技術】
この種の外観検査方法として、光源からの光を検査対象に照射し、光源から検査対象への光の照射方向とは異なる方向の光軸を有した撮像装置によって検査対象の表面の陰影を撮像し、撮像された画像に画像処理を施すことによって、検査対象の外観上の欠陥(表面に生じたクラックなど)の有無を検出する技術が知られている。撮像された画像から検査対象の欠陥部分を抽出する画像処理技術としては、特開平4−31751号公報に記載されているように、CCDカメラのような撮像装置からの画像信号をA/D変換部によりデジタル化した後、濃淡画像である原画像に空間微分を施して微分絶対値および微分方向値を求め、欠陥候補の画素を微分絶対値および微分方向値を用いて追跡する技術が提案されている。
【0003】
【発明が解決しようとする課題】
しかしながら、上記公報に記載された画像処理技術では、欠陥候補画素の追跡において、微分絶対値が規定値以上の各画素について、その微分方向値が所定範囲内に収まるような連続性を有している画素群を欠陥候補画素として抽出しているため、検査対象がその表面に模様を有している場合に抽出した欠陥候補画素群が模様の部分と欠陥部分との何れであるかを判別することができず、誤検出の確率が高くなって欠陥部分を正しく検出できなくなる可能性を有している。
【0004】
本発明は上記事由に鑑みて為されたものであり、その目的は、欠陥の有無の判定精度を高めた外観検査方法を提供することにある。
【0005】
【課題を解決するための手段】
請求項1の発明は、上記目的を達成するために、被検査物を含む空間領域を撮像して得られた濃淡画像から被検査物の外観上の欠陥を検出する外観検査方法において、前記濃淡画像である原画像を演算処理して微分絶対値画像、微分方向値画像並びにエッジ画像を求め、前記エッジ画像内に検査領域を設定するとともに該検査領域内におけるエッジ画像の輪郭線上の画素に対して当該画素が持つ微分方向値の方向から時計回り又は反時計回りに略90°回転した方向に隣接する画素の原画像における濃度を求め、この濃度が所定の条件を満たす場合に当該画素を欠陥候補点とし、さらに、前記時計回り又は反時計回りに90°回転した何れか一方の方向に隣接する画素を含んだスティックマスクを設定して欠陥候補点を抽出するとともに、前記輪郭線上の画素の微分絶対値の総和を求め、欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定することを特徴とし、被検査物が表面に濃淡むら等の模様を有し、その模様に混じってクラックのように低コントラストな欠陥部分が存在している場合であっても、被検査物の模様と背景部分とでそれぞれに含まれる画素の濃度が異なり、且つ模様に含まれる画素の濃度が背景部分に含まれる画素の濃度よりも低く(又は高く)なっていれば、クラックのような低コントラストの欠陥部分に含まれる画素の濃度が背景部分に含まれる画素の濃度よりも高く(又は低く)なるから、背景部分に含まれる画素の濃度よりも高く(又は低く)なる画素を欠陥候補点として抽出することにより、模様と欠陥とを識別することができ、その結果、模様を欠陥と誤判定することを防ぐことができて欠陥の有無の判定精度を高めることができる。また、欠陥部分の濃度が背景部分の濃度よりも高いか、あるいは低いかが予め明確になっている場合、微分方向値が示す方向から時計回り又は反時計回りにそれぞれ90°回転した方向に隣接する2つの画素の何れか一方のみの濃度についてしきい値との比較を行うことによって、欠陥候補点を検出する処理が簡素化され、全体の処理時間が短縮でき、さらに、クラックなどの欠陥部分は背景部分との境界近傍に濃度が略等しい画素が連続して存在するから、スティックマスクを走査して濃度をしきい値と比較する画素数を増やすことによって欠陥候補点を数多く抽出することができ、良否判定がし易くなるとともに検査精度の向上が図れるとともに、前記輪郭線上の画素の微分絶対値の総和を求め、欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定することより、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れる。
【0006】
請求項2の発明は、請求項1の発明において、前記画素の濃度が前記被検査物の表面を表す背景部分よりも明るい又は暗いレベルに設定されたしきい値を超えていることを前記所定の条件とすることを特徴とし、請求項1の発明と同様の作用を奏する。
【0007】
請求項3の発明は、請求項1の発明において、前記画素の濃度が前記被検査物の表面を表す背景部分よりも明るい又は暗いレベルに設定された第1のしきい値と、欠陥部分の濃度のピーク値よりも明るい又は暗いレベルに設定された第2のしきい値との間に存在することを前記所定の条件とすることを特徴とし、濃度が第2のしきい値を超えるようなごみなどのノイズ要因を除去することが可能となり、検査精度の向上が図れる。
【0010】
請求項の発明は、請求項1又は2又は3の発明において、前記輪郭線上の画素のうちで所定の微分方向値を有する画素のみから欠陥候補点を抽出することを特徴とし、特定の条件を満たす画素のみを抽出して良否判定を行うことで、原画像から予めエッジ画像を求めて良否判定を行う場合に比較して検査時間の短縮が図れる。
【0012】
請求項の発明は、請求項1〜の何れかの発明において、前記欠陥候補点とした輪郭線上の画素の周辺で別の欠陥候補点を探索することを特徴とし、1つの欠陥候補点の周辺から欠陥候補点を追跡して数多くの欠陥候補点を抽出することによって、クラックのような低コントラストの欠陥を安定して検出することができる。
【0013】
請求項の発明は、請求項1〜の何れかの発明において、前記欠陥候補点の濃度の平均値を求め、該平均値が所定のしきい値よりも大きい又は小さい場合に欠陥と判定することを特徴とし、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れる。
【0014】
請求項の発明は、請求項1〜の何れかの発明において、前記エッジ画像を求める際に、不連続となる輪郭線の端点から始めて注目する画素とその周囲の画素とを比較し、所定の評価関数がもっとも大きくなる方向に線を延長し、他の線の端点に衝突するまでこれを続けることで輪郭線を連続線とするエッジ延長処理を行うことを特徴とし、エッジ延長処理によってエッジ画像を連続線として求めることができ、このような連続線のエッジ画像に対して欠陥候補点を抽出することによって検査精度を向上させることができる。
【0015】
請求項の発明は、請求項1〜の何れかの発明において、前記欠陥候補点とした画素で形成される輪郭線の周囲長を求め、該周囲長が規定値以上の場合に欠陥と判定することを特徴とし、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れる。
【0016】
請求項の発明は、請求項1〜の何れかの発明において、前記輪郭線で囲まれた欠陥候補点の集合からなる欠陥候補領域の射影幅を求め、該射影幅が所定の条件を満たす場合に欠陥と判定することを特徴とし、通常クラックは片方の幅寸法がもう片方の幅寸法よりも十分に小さい形状となるから、欠陥候補領域の射影幅によって当該欠陥候補領域が欠陥部分であるか、ごみなどの異物であるかを識別することができて、クラックのような低コントラスとの欠陥を安定して検出することができる。
【0017】
請求項10の発明は、請求項の発明において、前記輪郭線上の画素の個数を求め、該個数が規定数を超えるとともに欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定することを特徴とし、検出精度をさらに向上させることができる。
【0018】
請求項11の発明は、請求項1〜10の何れかの発明において、欠陥候補点の集合からなる欠陥候補領域が途切れている場合に当該欠陥候補領域を拡大した拡大領域を設定し、該拡大領域内に少なくとも一部が存在する別の欠陥候補領域を元の欠陥候補領域と同じ欠陥候補領域として取り扱って欠陥の判定を行うことを特徴とし、輪郭線の途切れた欠陥候補領域が抽出された場合でも欠陥候補領域の見逃しを防ぐことができ、検査精度の向上が図れる。
【0019】
【発明の実施の形態】
以下、本発明方法の実施形態を図面を参照して説明する。
【0020】
以下では、本発明の実施形態を説明する前に本発明の参考例について説明する。
参考例1)
図2及び図3は本発明方法を用いた外観検査装置の概略構成を示すもので、照明ランフLaにて斜め方向から照明された検査対象たる被検査物Oを撮像するCCDカメラ1と、CCDカメラ1から出力される画像信号をA/D変換するA/D変換器2と、A/D変換された画像データを前処理(特異データの除去等)する前処理回路3と、前処理された画像データを被検査物Oの原画像として記憶する原画像メモリ4と、原画像の各画素に対応して演算される微分絶対値を記憶する微分絶対値画像メモリ5と、演算された微分方向値を記憶する微分方向値画像メモリ6と、原画像の濃度(明るさ)の変化点を線画として抽出したエッジ画像を記憶するエッジ画像メモリ7と、原画像を演算処理して各メモリ5〜7に所定のデータを記憶させ、各メモリ4〜7に記憶されているデータに基づいて被検査物Oの輪郭を認識するとともに欠陥候補画素を追跡して被検査物Oの欠陥の有無をチェックするマイクロプロセッサ(あるいはマイクロコンピュータ)8とで構成されている。なお、この外観検査装置は、本参考例以外の後述する他の参考例並びに本発明の実施形態においても用いるものである。
【0021】
以下、上述の外観検査装置を用いて被検査物Oの外観上の欠陥を検出する方法について具体的に説明する。
【0022】
図4及び図5は動作説明図であり、まず、CCDカメラ1にて撮像された図4(a)に示すような被検査物Oの原画像f1を、マイクロプロセッサ8で演算処理し、図4(b)に示すようなエッジ画像f4に変換する画像処理が必要であり、この画像処理はマイクロプロセッサ8において以下のように行なわれる。
【0023】
ここで、マイクロプロセッサ8による上記画像処理については、当社の特公平7−97410号公報に詳しく開示されているが、その要点を改めて説明すると、以下の通りである。まず、被検査物Oを含む空間領域を撮像して得られた原画像f1は濃淡画像であって、図4(a)に示すように、被検査物O、欠陥部分K、異物Xを含む画像となっている。ここに、各画素は例えば濃度が8ビットで表わされて256階調に設定される。この濃淡画像から被検査物Oの輪郭線等のエッジを抽出する処理は、「エッジの部分は濃度変化が大きい部分に対応している」という考え方を基本にしている。したがって、濃度を微分することによってエッジの抽出を行なうのが一般的である。微分処理は、図5に示すように、濃淡画像を3×3画素の局所並列ウィンドウWに分割して行なう。つまり、注目する画素Eと、その画素Eの周囲の8画素(8近傍)A〜D、F〜Iとで局所並列ウィンドウを形成し、局所並列ウィンドウ内の画素A〜Iの濃度の縦方向の濃度変化ΔVと横方向の濃度変化ΔHとを次式によって求め、
ΔV=(A+B+C)−(G+H+I)
ΔH=(A+D+G)−(C+F+I)
さらに、微分絶対値|eE|と微分方向値∠eEとを次式によって求めるのである。
【0024】
|eE|=(ΔV2+ΔH21/2
∠eE=tan-1(ΔV/ΔH)+π/2
ただし、A〜Iは対応する画素の濃度を示している。上式から明らかなように、微分絶対値|e|は、原画像の着目する画素の近傍領域における濃度の変化率を表し、微分方向値∠eは、同近傍領域における濃度変化の方向に直交する方向を表している。
【0025】
以上の演算を原画像f1の全画素について行なうことにより、被検査物Oの輪郭や欠陥K、異物X等が存在しているような濃度変化が大きい部分と、その変化の方向とを抽出することができるのである。ここに、各画素の濃度を、微分絶対値|e|で表現した画像を微分絶対値画像、微分方向値∠eで表現した画像を微分方向値画像と呼ぶ。そして、微分絶対値画像f2(6ビット)、微分方向値画像f3(4ビット)としてそれぞれ微分絶対値画像メモリ5および微分方向値画像メモリ6に記憶される。
【0026】
次に細線化処理が行なわれる。細線化処理は、微分絶対値が大きいほど濃度変化が大きいことを表わしている点に着目して行なわれる。すなわち、各画素の微分絶対値を周囲の画素の微分絶対値と比較し、周囲の画素よりも大きくなるものを連結していくことにより、1画素の幅を有したエッジが抽出されるのである。つまり、図6に示すように、各画素の位置をX−Y座標で表わし、微分絶対値をZ軸に取った微分絶対値画像を考えれば、細線化処理は、この曲面における稜線を求めることに相当する。ここまでの処理により、微分絶対値の大小にかかわらず、すべての稜線が抽出される。この段階で得られている稜線には、ノイズ等による不要な小さな山も含まれているから、図7に示すように、適宜しきい値を設定し、このしきい値以上の値のみを採用してノイズ成分を除去する。
【0027】
ところで、上記細線化処理で得られたエッジ画像f4は、原画像f1のコントラストが不十分であるときや、ノイズが多いようなときには、不連続線になりやすい。一方、後述する模様Mやクラックのような欠陥部分Kでは、図10及び図11に示すように微分方向値(図10(b)及び図11(b)の丸数字)が一定範囲内の値を持つ画素が連続すると考えられるから、エッジが不連続になっている部分でも8近傍に微分方向値が上記一定範囲内の値である画素が存在すれば、エッジの一部であるとみなし、このように微分方向値が一定範囲内の値である画素を連結することでエッジ画像f4を連続線とすることができる。
【0028】
以上の画像処理により、図4(b)に示すように、被検査物O、欠陥部分K、異物X等の輪郭線l0〜l2が閉曲線のパターンとなった1ビット(“1”をエッジフラッグと称する)のエッジ画像f4が得られ、エッジ画像メモリ7に記憶される。以下の説明では、各画像の画素の位置をX−Y座標で表現するものとし、各画像における画素の濃度をそれぞれf1(x,y)、f2(x,y)、f3(x,y)、f4(x,y)とする。
【0029】
ここで、原画像は濃淡画像であって、濃度は通常8ビットで表されるから、各画素における濃度a(=f1(x,y))は、0≦a≦255となる。また、微分絶対値画像の濃度(すなわち、微分絶対値)b(=f2(x,y))は、例えば6ビットで表され、0≦b≦63となり、微分方向値画像の濃度(すなわち、微分方向値)c(=f3(x,y))は、例えば8方向で表され、1≦c≦8となる。エッジ画像については、線の有無のみであるから、線となる画素は“1”、それ以外の画素は“0”として表される。つまり、f4(x,y)の値域は{0,1}となる。なお、以下の説明においては、濃度という用語は白の濃度を表し、濃度値が大きいほど明るいものとする。
【0030】
次に、マイクロプロセッサ8では、エッジ画像について検査領域を適宜設定する。検査領域が設定されると、エッジ画像の検査領域内をラスター走査することにより、f4(x,y)=1となる画素を検出しフラグ点とする。このフラグ点を始点として、8近傍についてf4(x,y)=1となる画素を抽出しながら輪郭線の追跡を行う。こうして輪郭線を追跡することにより、輪郭線の上の全画素の座標がわかる。なお、従来例で説明した特開平4−31751号公報に記載されている外観検査方法では、フラグ点の8近傍にf4(x,y)=1となる画素が存在しない場合、フラグ点の微分方向値を含む一定範囲内の微分方向値を有する画素が存在するならば、そのような画素のうち微分絶対値が最大になる画素をエッジとして輪郭線の追跡を行っている。しかしながら、被検査物Oが表面に濃淡むら等の模様を有し、その模様に混じってクラックのように低コントラストな欠陥部分が存在している場合、模様以外の地の部分(以下、「背景部分」という)と模様の境界、及び背景部分と欠陥部分の境界が略同じ濃度変化であれば、何れの境界(エッジ)の微分絶対値もほぼ同じ値になってしまうため、上記従来の方法では輪郭線のみから模様であるのか、欠陥部分であるのかを判別することが非常に困難であった。
【0031】
そこで本発明の外観検査方法では、以下のようにして模様と欠陥部分とを判別するものである。例えば図9に示すように原画像f1において、被検査物Oの模様Mと背景部分BKとでそれぞれに含まれる画素の濃度aが異なっており、模様Mに含まれる画素の濃度が背景部分BKに含まれる画素の濃度よりも低くなっている場合には、クラックのような低コントラストの欠陥部分Kに含まれる画素の濃度は背景部分BKに含まれる画素の濃度よりも高くなるという特徴があり、本発明方法では上記特徴を利用して模様Mと欠陥部分Kとの判別を行う。
【0032】
すなわち、微分方向値c(=1〜8)は、図8に示すように微分方向値cの値に応じて8近傍のうちで着目画素Eを挟んで対向する2つの画素A〜D,F〜Iの濃度aの間に一定の関係、つまり微分方向値cが示す方向(図8において矢印で示す方向)から時計回りに90°回転した方向に隣接する画素の濃度が、反時計回りに90°回転した方向に隣接する画素の濃度よりも常に高くなる(明るくなる)という性質を有している。例えば、図8(a)に示すように着目画素Eの微分方向値cが1であれば、微分方向値cが示す方向から時計回りに90°回転した方向に隣接する画素Hの濃度aHが、反時計回りに90°回転した方向に隣接する画素Bの濃度aBよりも常に高くなる(aB<aH)。また、同図(b)に示すように着目画素Eの微分方向値cが2であれば、微分方向値cが示す方向から時計回りに90°回転した方向に隣接する画素Iの濃度aIが、反時計回りに90°回転した方向に隣接する画素Aの濃度aAよりも常に高くなる(aA<aI)。なお、同図(c)〜(h)に示すように微分方向値cが3〜8の場合も同様に着目画素Eを挟んで対向する2つの画素A〜D,F〜Iの濃度aA〜aD,aF〜aI間に上述のような大小関係が成立する。
【0033】
而して、マイクロプロセッサ8では、図12に矢印で示すようにエッジ画像の検査領域内をラスター走査することによってf4(x,y)=1となるエッジフラグ(画素Eとする)の座標を検出し、この画素Eの座標に基づいて当該画素Eの微分方向値cを微分方向値画像メモリ6から読み出すとともに、その微分方向値cが示す方向から時計回り及び反時計回りにそれぞれ90°回転した方向に隣接する画素A〜D,F〜Iの濃度aA〜aD,aF〜aI、例えば読み出した微分方向値cが4であれば画素C,Gの濃度aC,aGを微分絶対値画像メモリ5から読み出す。そして、図13に示すように背景部分BKよりも濃度aの高い欠陥部分Kを検出する場合であれば、読み出した画素C,Gの濃度aC,aGを、背景部分BKの濃度aBKよりも高い値に設定した所定のしきい値athと比較し、濃度aC,aGが上記しきい値athを超えていれば(明るければ)、当該画素C,Gを欠陥部分Kの候補点(以下、「欠陥候補点」という)としてカウントする。それに対して、両画素C,Gの濃度aC,aGが上記しきい値athを下回っていれば、当該画素C,Gが模様Mの輪郭線(背景部分BKと模様Mとの境界)内に存在していると判断できるから、この場合には当該画素C,Gを欠陥候補点にカウントしない。なお、上述の微分絶対値画像、微分方向値画像並びにエッジ画像を求める処理から欠陥部分Kを模様Mと識別して検出する処理をまとめて図1のフローチャートに示している。
【0034】
ここで、クラックなどの欠陥部分Kは、背景部分BKとの境界(エッジ)近傍に濃度が略等しい画素が連続して存在するために上記欠陥候補点の数が多くなるという特徴がある。よって、上述のような処理により欠陥候補点に該当する画素のカウント数が規定数以上になれば、マイクロプロセッサ8では上記輪郭線で囲まれた領域を欠陥部分Kと判定するのである。その結果、従来では被検査物Oの表面に模様Mがある場合に、クラックのような低コントラストの欠陥部分Kと上記模様Mとを識別することが困難であったのに対して、本参考例では欠陥部分Kと模様Mとを判別して欠陥部分Kのみを検出することができ、従来よりも低コントラストの欠陥部分を安定して精度良く検出することができる。なお、背景部分BKよりも濃度aの低い欠陥部分Kを検出する場合であれば、エッジフラグの画素の微分方向値cが示す方向から時計回り及び反時計回りにそれぞれ90°回転した方向に隣接する画素の濃度を、背景部分BKの濃度aBKよりも低い値に設定した所定のしきい値と比較し、その濃度が上記しきい値を下回っていれば(暗ければ)、当該画素を欠陥候補点としてカウントすればよい。
【0035】
ところで、欠陥部分Kの濃度が背景部分BKの濃度よりも高いか、あるいは低いかが予め明確になっている場合、上述の処理においてエッジフラグの画素の微分方向値cが示す方向から時計回り又は反時計回りにそれぞれ90°回転した方向に隣接する2つの画素の何れか一方のみの濃度についてしきい値との比較を行えばよい。つまり、欠陥部分Kの濃度が背景部分BKの濃度よりも高いことが判っている場合には、エッジフラグの画素の微分方向値cが示す方向から時計回りに90°回転した方向に隣接する方の画素の濃度のみをしきい値と比較し、欠陥部分Kの濃度が背景部分BKの濃度よりも低いことが判っている場合には、エッジフラグの画素の微分方向値cが示す方向から反時計回りに90°回転した方向に隣接する方の画素の濃度のみをしきい値と比較する。例えば、欠陥部分Kの濃度が背景部分BKの濃度よりも低い場合、図14に示すように、各エッジフラグの画素E1〜E5の微分方向値cが示す方向から反時計回りに90°回転した方向に隣接する方の画素D1〜D5の濃度のみを読み出してしきい値と比較する。このようにすれば、欠陥候補点を検出する処理が簡素化され、全体の処理時間が短縮できるという利点がある。
【0036】
また、エッジフラグに隣接する1画素だけの濃度を求めるのではなく、当該画素を含めて、微分方向値cが示す方向に直交する方向へ並ぶ複数の画素の列(スティックマスク)を走査するようにしても良い。例えば、欠陥部分Kの濃度が背景部分BKの濃度よりも低い場合、図15に示すように、各エッジフラグの画素E1〜E5の微分方向値cが示す方向から反時計回りに90°回転した方向に隣接する方の画素D1〜D5を含めた画素列D1a〜D1c,D2a〜D2c,…,D5a〜D5cからなるスティックマスクを走査してその濃度をしきい値と比較する処理を行う。すなわち、クラックなどの欠陥部分Kは、背景部分BKとの境界(エッジ)近傍に濃度が略等しい画素が連続して存在するという特徴があるから、上述のようにスティックマスクを走査して濃度をしきい値と比較する画素数を増やすことによって欠陥候補点を数多く抽出することができ、良否判定がし易くなるとともに検査精度の向上が図れるという利点がある。
【0037】
参考例2)
上述の参考例1においては、予め求めたエッジ画像f4に設定した検査領域をラスター走査しているが、本参考例は、微分方向値画像f3に設定した検査領域をラスター走査し、所定の微分方向値を有する画素を探索するとともに当該微分方向値を有する画素のうちで微分絶対値が所定のしきい値よりも高い値を示す画素を抽出し、さらに抽出した画素に対して参考例1と同様に、当該画素の微分方向値cが示す方向から反時計回り及び反時計回りに90°回転した方向に隣接する画素の濃度をしきい値と比較することで欠陥候補点を抽出する点に特徴がある。
【0038】
而して、本参考例では、上述のように特定の条件を満たす画素のみを抽出して良否判定を行うので、原画像f1から予めエッジ画像f4を求めて良否判定を行う参考例1に比較して検査時間の短縮が図れるという利点がある。
【0039】
(実施形態
上述の参考例1,2ではカウントした欠陥候補点の総数に基づいて良否判定を行っているが、本実施形態では、エッジフラグの画素の微分方向値cが示す方向から時計回り又は反時計回りに90°回転した方向に隣接する画素の濃度がしきい値を超えていて欠陥候補点にカウントされた場合、当該エッジフラグの画素の微分絶対値を求めるとともにこのようなエッジフラグの画素についてその微分絶対値の総和を算出し、欠陥候補点の個数が規定数を超え、且つ上記微分絶対値の総和がしきい値を超えれば欠陥有りと判定する点に特徴がある。
【0040】
例えば、欠陥部分Kの濃度が背景部分BKの濃度よりも低い場合、図16に示すように、各エッジフラグの画素E1〜E5の微分方向値cが示す方向から反時計回りに90°回転した方向に隣接する方の画素D1〜D5を含めたスティックマスクを走査してその濃度をしきい値と比較し、その画素D1〜D5の濃度がしきい値を超えていれば、欠陥候補点としてカウントするとともに、画素E1〜E5の微分絶対値(E1=30,E2=40,E3=50,E4=35,E5=30)を微分絶対値画像メモリ5から読み出して、その総和(=185)を求める処理を行う。そして、欠陥候補点のカウント数が規定数を超えるとともに、上記微分絶対値の総和がしきい値を超えた場合に欠陥があると判定するのである。
【0041】
上述のような処理を行うことによって、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れるという利点がある。なお、上記スティックマスクの何れかの画素の濃度がしきい値を超えている場合に当該エッジフラグの画素も欠陥候補点としてカウントするようにすれば、さらに検出精度の向上が図れるものである。
【0042】
(実施形態
ところで、上述の参考例1では、図13に示すように背景部分BKよりも濃度aの高い欠陥部分Kを検出する場合に、読み出した画素の濃度aを背景部分BKの濃度aBKよりも高い値に設定した所定のしきい値athと比較し、しきい値athを超えていれば欠陥候補点としてカウントしているが、濃度の高いごみなどの異物によるノイズで欠陥候補点を誤ってカウントしてしまう虞がある。
【0043】
そこで、本実施形態では、図17に示すように欠陥部分Kの濃度のピーク値を挟む大小2つのしきい値ath1,ath2を設定し、上記読み出した画素の濃度aが上記2つのしきい値ath1,ath2の間に入っている(ath1≦a≦ath2)場合に欠陥候補点Kとしてカウントするようにしている。したがって、大きい方のしきい値ath2よりも高い濃度を有するごみなどのノイズ要因を除去することが可能となり、検査精度の向上が図れるという利点がある。
【0044】
(実施形態
本実施形態は、参考例1に対して、求められた欠陥候補点Kの周辺を1画素ずつ追跡してしきい値athよりも高い(あるいは上記2つのしきい値ath1,ath2の間に入る)画素が存在するか否かを調べ、上記条件を満たす画素が存在する場合には当該画素を欠陥候補点Kとしてカウントする点に特徴がある。
【0045】
ここで、欠陥候補点Kの周辺の画素を追跡する方法としては、欠陥候補点Kを中心とする居所並列ウィンドウに分割して8近傍の濃度をしきい値athと順次比較し、欠陥候補点Kが見つかればその点(画素)の8近傍の濃度をしきい値athと比較する手順を繰り返せばよい。
【0046】
本実施形態の外観検査方法によれば、1つの欠陥候補点の周辺から欠陥候補点を追跡して数多くの欠陥候補点Kを抽出するようにしているので、クラックのような低コントラストの欠陥を安定して検出することができるという利点がある。
【0047】
(実施形態
本実施形態は、参考例1,2と実施形態1〜で説明した各方法により抽出された欠陥候補点Kの濃度の平均値AVKを算出して背景部分BKの濃度の平均値AVBKと比較し、両平均値AVK,AVBKの差が規定値を超えている場合に不良と判定する点に特徴がある。
【0048】
ここで、欠陥候補点Kの濃度平均値AVKは、抽出された欠陥候補点Kの濃度の総和をその個数で除算することによって求められる。また、同様にして背景部分BKの濃度平均値AVBKは、抽出された欠陥候補点Kを除く検査領域内の画素の濃度の総和をその個数で除算することによって求められる。
【0049】
上述のような処理を行うことによって、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れるという利点がある。
【0050】
(実施形態
ところで参考例1で説明した細線化処理で得られるエッジ画像f4は、原画像f1のコントラストが不十分であるときや、ノイズが多いようなときには、不連続線になりやすい。そして、参考例1においては、エッジが不連続になっている部分でも8近傍に微分方向値が一定範囲内の値である画素が存在すれば、エッジの一部であるとみなし、このように微分方向値が一定範囲内の値である画素を連結することでエッジ画像f4を連続線としている。
【0051】
それに対して本実施形態は、以下に説明するようなエッジ延長処理を行なうことでエッジ画像f4を連続線とすることを特徴としている。本実施形態のエッジ延長処理では、不連続線の端点から始めて、注目する画素とその周囲の画素とを比較し、次式で表わされる評価関数f(eJ)がもっとも大きくなる方向に線(エッジ)を延長し、他の線の端点に衝突するまでこれを続けるものである。
【0052】
f(eJ)=|eJ|cos(∠eJ−∠e0)cos{π(J−1)/4−∠e0
ここに、e0は中心画素の微分絶対値であり、eJは隣接画素(8近傍)の微分絶対値であって、J=1,2,……,8である。
【0053】
而して、上述のようなエッジ延長処理によってエッジ画像f4を連続線として求めることができ、このような連続線のエッジ画像f4に対して参考例1,2や実施形態1〜で説明したような方法で欠陥候補点Kを抽出することによって検査精度を向上させることができる。
【0054】
(実施形態
本実施形態は、エッジ画像について設定された検査領域内をラスター走査してf4(x,y)=1となる画素(エッジフラグ)を検出し、その濃度から当該エッジフラグが欠陥候補点Kに該当するか否かを判定するとともに、欠陥候補点Kに該当するエッジフラグを始点として8近傍について欠陥候補点Kに該当するエッジフラグを抽出しながら欠陥候補点Kを結ぶ輪郭線の追跡を行い、この輪郭線で囲まれた領域(以下、「欠陥候補領域」という)KRを求め、さらに上記輪郭線を形成する欠陥候補点Kの個数(画素数)をカウントすることで欠陥候補領域の周囲長を求め、求めた周囲長が規定値を超えている場合に不良と判定する点に特徴がある。
【0055】
而して、図18に示すようにエッジ画像f4における欠陥候補領域KRの周囲長を、実際の欠陥部分Kの大きさのパラメータに用いて良否判定を行うことにより、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れるという利点がある。
【0056】
(実施形態
本実施形態は、実施形態において欠陥候補領域KRを求めた際に、欠陥候補領域KRの輪郭線を形成する欠陥候補点KのXY座標に基づいて欠陥候補領域KRの射影幅を求め、この射影幅から当該欠陥領域KRがクラックのような欠陥部分Kであるか、あるいはごみなどの異物であるかを識別する点に特徴がある。
【0057】
欠陥候補領域KRのX方向及びY方向の射影幅XKR,YKRは、図19に示すようにその輪郭線を形成する欠陥候補点KのXY座標の最小値Xmin,Yminと最大値Xmax,Ymaxの差分として以下のように求められる。
【0058】
KR=Xmax−Xmin
KR=Ymax−Ymin
ここで、通常クラックは、図20に示すように片方の幅寸法がもう片方の幅寸法よりも十分に小さい形状となる特徴があるので、例えば上記射影幅XKR,YKRの比率(XKR/YKR)が規定の範囲外となる場合にクラックのような欠陥部分Kと判定し、上記比率が規定の範囲内となる場合にはごみなどの異物と判定することができる。
【0059】
上述のような本実施形態の外観検査方法によれば、欠陥候補領域KRの射影幅XKR,YKRによって当該欠陥候補領域KRが欠陥部分Kであるか、ごみなどの異物であるかを識別することができて、クラックのような低コントラスとの欠陥を安定して検出することができる。
【0060】
(実施形態
ところで、参考例1,2や実施形態1〜ではエッジ画像f4の輪郭線で囲まれた欠陥候補領域毎に欠陥か否かの良否判定を行っているため、輪郭線の途切れた欠陥候補領域が抽出された場合、この欠陥候補領域を見逃してしまう虞がある。
【0061】
そこで、本実施形態では、ある欠陥候補領域とその近傍に存在する別の欠陥候補領域とを同じ欠陥候補領域として取り扱い、各々の欠陥候補領域が有する欠陥候補点の個数、輪郭線を形成する画素の微分絶対値の総和、欠陥候補領域の周囲長並びに射影幅を求め、これらを集計した値に基づいて良否判定を行うようにした点に特徴がある。
【0062】
具体的には、図21に示すように抽出された欠陥候補領域KR1の周辺に所定の画素数だけ当該欠陥候補領域KR1の輪郭線を拡大した拡大領域KR1’を設定し、その拡大領域KR1’内に別の欠陥候補領域KR2の少なくとも一部が存在するか否かを探索し、存在する場合にその欠陥候補領域KR2を元の欠陥候補領域KR1と同じ欠陥領域として取り扱う。そして、各々の欠陥候補領域KR1,KR2が有する欠陥候補点の個数、輪郭線を形成する画素の微分絶対値の総和、欠陥候補領域KR1,KR2の周囲長並びに射影幅を求め、これらを集計した値に基づいて良否判定を行うことにより、輪郭線の途切れた欠陥候補領域が抽出された場合でも欠陥候補領域の見逃しを防ぐことができ、検査精度の向上が図れるという利点がある。
【0063】
【発明の効果】
請求項1の発明は、上記目的を達成するために、被検査物を含む空間領域を撮像して得られた濃淡画像から被検査物の外観上の欠陥を検出する外観検査方法において、前記濃淡画像である原画像を演算処理して微分絶対値画像、微分方向値画像並びにエッジ画像を求め、前記エッジ画像内に検査領域を設定するとともに該検査領域内におけるエッジ画像の輪郭線上の画素に対して当該画素が持つ微分方向値の方向から時計回り又は反時計回りに略90°回転した方向に隣接する画素の原画像における濃度を求め、この濃度が所定の条件を満たす場合に当該画素を欠陥候補点とし、さらに、前記時計回り又は反時計回りに90°回転した何れか一方の方向に隣接する画素を含んだスティックマスクを設定して欠陥候補点を抽出するとともに、前記輪郭線上の画素の微分絶対値の総和を求め、欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定するので、被検査物が表面に濃淡むら等の模様を有し、その模様に混じってクラックのように低コントラストな欠陥部分が存在している場合であっても、被検査物の模様と背景部分とでそれぞれに含まれる画素の濃度が異なり、且つ模様に含まれる画素の濃度が背景部分に含まれる画素の濃度よりも低く(又は高く)なっていれば、クラックのような低コントラストの欠陥部分に含まれる画素の濃度が背景部分に含まれる画素の濃度よりも高く(又は低く)なるから、背景部分に含まれる画素の濃度よりも高く(又は低く)なる画素を欠陥候補点として抽出することにより、模様と欠陥とを識別することができ、その結果、模様を欠陥と誤判定することを防ぐことができて欠陥の有無の判定精度を高めることができるという効果がある。また、欠陥部分の濃度が背景部分の濃度よりも高いか、あるいは低いかが予め明確になっている場合、微分方向値が示す方向から時計回り又は反時計回りにそれぞれ90°回転した方向に隣接する2つの画素の何れか一方のみの濃度についてしきい値との比較を行うことによって、欠陥候補点を検出する処理が簡素化され、全体の処理時間が短縮でき、さらに、クラックなどの欠陥部分は背景部分との境界近傍に濃度が略等しい画素が連続して存在するから、スティックマスクを走査して濃度をしきい値と比較する画素数を増やすことによって欠陥候補点を数多く抽出することができ、良否判定がし易くなるとともに検査精度の向上が図れるとともに、前記輪郭線上の画素の微分絶対値の総和を求め、欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定することより、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れるという効果がある。
【0064】
請求項2の発明は、請求項1の発明において、前記画素の濃度が前記被検査物の表面を表す背景部分よりも明るい又は暗いレベルに設定されたしきい値を超えていることを前記所定の条件とするので、請求項1の発明と同様の効果を奏する。
【0065】
請求項3の発明は、請求項1の発明において、前記画素の濃度が前記被検査物の表面を表す背景部分よりも明るい又は暗いレベルに設定された第1のしきい値と、欠陥部分の濃度のピーク値よりも明るい又は暗いレベルに設定された第2のしきい値との間に存在することを前記所定の条件とするので、濃度が第2のしきい値を超えるようなごみなどのノイズ要因を除去することが可能となり、検査精度の向上が図れるという効果がある。
【0068】
請求項の発明は、請求項1又は2又は3の発明において、前記輪郭線上の画素のうちで所定の微分方向値を有する画素のみから欠陥候補点を抽出するので、特定の条件を満たす画素のみを抽出して良否判定を行うことで、原画像から予めエッジ画像を求めて良否判定を行う場合に比較して検査時間の短縮が図れるという効果がある。
【0070】
請求項の発明は、請求項1〜の何れかの発明において、前記欠陥候補点とした輪郭線上の画素の周辺で別の欠陥候補点を探索するので、1つの欠陥候補点の周辺から欠陥候補点を追跡して数多くの欠陥候補点を抽出することによって、クラックのような低コントラストの欠陥を安定して検出することができるという効果がある。
【0071】
請求項の発明は、請求項1〜の何れかの発明において、前記欠陥候補点の濃度の平均値を求め、該平均値が所定のしきい値よりも大きい又は小さい場合に欠陥と判定するので、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れるという効果がある。
【0072】
請求項の発明は、請求項1〜の何れかの発明において、前記エッジ画像を求める際に、不連続となる輪郭線の端点から始めて注目する画素とその周囲の画素とを比較し、所定の評価関数がもっとも大きくなる方向に線を延長し、他の線の端点に衝突するまでこれを続けることで輪郭線を連続線とするエッジ延長処理を行うので、エッジ延長処理によってエッジ画像を連続線として求めることができ、このような連続線のエッジ画像に対して欠陥候補点を抽出することによって検査精度を向上させることができるという効果がある。
【0073】
請求項の発明は、請求項1〜の何れかの発明において、前記欠陥候補点とした画素で形成される輪郭線の周囲長を求め、該周囲長が規定値以上の場合に欠陥と判定するので、欠陥候補点の個数のみから良否判定を行う場合に比較して検出精度の向上が図れるという効果がある。
【0074】
請求項の発明は、請求項1〜の何れかの発明において、前記輪郭線で囲まれた欠陥候補点の集合からなる欠陥候補領域の射影幅を求め、該射影幅が所定の条件を満たす場合に欠陥と判定するので、通常クラックは片方の幅寸法がもう片方の幅寸法よりも十分に小さい形状となるから、欠陥候補領域の射影幅によって当該欠陥候補領域が欠陥部分であるか、ごみなどの異物であるかを識別することができて、クラックのような低コントラスとの欠陥を安定して検出することができるという効果がある。
【0075】
請求項10の発明は、請求項の発明において、前記輪郭線上の画素の個数を求め、該個数が規定数を超えるとともに欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定するので、検出精度をさらに向上させることができるという効果がある。
【0076】
請求項11の発明は、請求項1〜10の何れかの発明において、欠陥候補点の集合からなる欠陥候補領域が途切れている場合に当該欠陥候補領域を拡大した拡大領域を設定し、該拡大領域内に少なくとも一部が存在する別の欠陥候補領域を元の欠陥候補領域と同じ欠陥候補領域として取り扱って欠陥の判定を行うので、輪郭線の途切れた欠陥候補領域が抽出された場合でも欠陥候補領域の見逃しを防ぐことができ、検査精度の向上が図れるという効果がある。
【図面の簡単な説明】
【図1】 本発明の参考例1の外観検査方法を説明するフローチャートである。
【図2】 同上を用いた外観検査装置の概略構成図である。
【図3】 同上外観検査装置のブロック回路図である。
【図4】 (a)及び(b)は同上の説明図である。
【図5】 同上における局所並列ウィンドウを示す説明図である。
【図6】 同上の説明図である。
【図7】 同上の説明図である。
【図8】 (a)〜(h)は同上の動作説明図である。
【図9】 同上の説明図である。
【図10】 (a),(b)は同上における模様の説明図である。
【図11】 (a),(b)は同上における欠陥部分の説明図である。
【図12】 同上の説明図である。
【図13】 同上の説明図である。
【図14】 同上の説明図である。
【図15】 同上の説明図である。
【図16】 実施形態の説明図である。
【図17】 実施形態の説明図である。
【図18】 実施形態の説明図である。
【図19】 実施形態の説明図である。
【図20】 同上の説明図である。
【図21】 実施形態の説明図である。
【符号の説明】
1 CCDカメラ
2 A/D変換器
3 前処理回路
4 原画像メモリ
5 微分絶対値画像メモリ
6 微分方向値画像メモリ
7 エッジ画像メモリ
8 マイクロプロセッサ
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an appearance inspection method for detecting the presence or absence of defects on the appearance of an inspection object by performing image processing on an image obtained by imaging the inspection object.
[0002]
[Prior art]
As this type of visual inspection method, light from a light source is irradiated onto an inspection object, and a shadow on the surface of the inspection object is imaged by an imaging device having an optical axis in a direction different from the light irradiation direction from the light source to the inspection object. A technique for detecting the presence or absence of defects on the appearance of an inspection target (such as a crack on the surface) by performing image processing on a captured image is known. As described in JP-A-4-31751, as an image processing technique for extracting a defective portion to be inspected from a captured image, an A / D conversion is performed on an image signal from an imaging device such as a CCD camera. After the image is digitized, a technique has been proposed in which the original image, which is a grayscale image, is spatially differentiated to obtain the differential absolute value and differential direction value, and the defect candidate pixels are tracked using the differential absolute value and differential direction value. ing.
[0003]
[Problems to be solved by the invention]
However, the image processing technique described in the above publication has continuity so that the differential direction value falls within a predetermined range for each pixel having a differential absolute value equal to or greater than a specified value in tracking defect candidate pixels. Since a pixel group is extracted as a defect candidate pixel, when the inspection target has a pattern on its surface, it is determined whether the extracted defect candidate pixel group is a pattern portion or a defect portion In other words, the probability of erroneous detection increases and the defective portion cannot be detected correctly.
[0004]
The present invention has been made in view of the above reasons, and an object of the present invention is to provide an appearance inspection method with improved determination accuracy of the presence or absence of defects.
[0005]
[Means for Solving the Problems]
  In order to achieve the above object, the invention according to claim 1 is an appearance inspection method for detecting defects on the appearance of an inspection object from a gradation image obtained by imaging a spatial region including the inspection object. An original image, which is an image, is calculated to obtain a differential absolute value image, a differential direction value image, and an edge image, an inspection area is set in the edge image, and pixels on the contour line of the edge image in the inspection area are set. Then, the density in the original image of the adjacent pixel in the direction rotated approximately 90 ° clockwise or counterclockwise from the direction of the differential direction value of the pixel is obtained, and the pixel is defective when the density satisfies a predetermined condition. Candidate points, andIn either direction, rotated 90 ° clockwise or counterclockwiseA defect mask point is extracted by setting a stick mask including adjacent pixels, and the sum of differential absolute values of pixels on the contour line is obtained. The number of defect candidate points exceeds a specified number, and the sum is a specified value. The region surrounded by the contour line formed by the pixel is determined as a defect when exceeding the threshold, and the object to be inspected has a pattern such as uneven shading on the surface, and the crack is mixed with the pattern. Thus, even when there is a low-contrast defective part, the density of the pixels included in the pattern of the object to be inspected and the background part are different, and the density of the pixels included in the pattern is in the background part. If the density of the pixel included is lower (or higher), the density of the pixel included in the low-contrast defect portion such as a crack is higher (or lower) than the density of the pixel included in the background portion. , By extracting a pixel that is higher (or lower) than the density of the pixel included in the scene portion as a defect candidate point, the pattern and the defect can be identified, and as a result, the pattern is erroneously determined as a defect. This can be prevented and the accuracy of determining the presence or absence of defects can be increased. When the density of the defective portion is higher or lower than the density of the background portion in advance, it is adjacent to the direction rotated 90 ° clockwise or counterclockwise from the direction indicated by the differential direction value. By comparing the density of only one of the two pixels with a threshold value, the process of detecting defect candidate points can be simplified, the overall processing time can be shortened, and defect parts such as cracks can be reduced. Since pixels with almost the same density exist in the vicinity of the boundary with the background part, many defect candidate points can be extracted by increasing the number of pixels whose density is compared with the threshold by scanning the stick mask. In addition, it is easy to make a pass / fail judgment and improve the inspection accuracy, and the sum of the differential absolute values of the pixels on the contour line is obtained, and the number of defect candidate points exceeds the specified number and When the sum exceeds a specified value, the area surrounded by the contour line formed by the pixel is determined as a defect, so that the detection accuracy is improved compared to the case where the quality is determined only from the number of defect candidate points. Can be planned.
[0006]
According to a second aspect of the present invention, in the first aspect of the present invention, the predetermined value indicates that the density of the pixel exceeds a threshold set to a level brighter or darker than a background portion representing the surface of the inspection object. It is characterized by the above-mentioned conditions, and has the same effect as the invention of claim 1.
[0007]
According to a third aspect of the present invention, in the first aspect of the invention, the first threshold value in which the density of the pixel is set to a level brighter or darker than the background portion representing the surface of the inspection object, and the defect portion The predetermined condition is that it exists between a second threshold value set to a level brighter or darker than the peak value of the density, and the density exceeds the second threshold value. It is possible to remove noise factors such as nagomi and improve inspection accuracy.
[0010]
  Claim4The invention of claim 1Or 2 or 3In the invention, a defect candidate point is extracted only from a pixel having a predetermined differential direction value among pixels on the contour line, and only a pixel satisfying a specific condition is extracted to perform pass / fail judgment. The inspection time can be shortened as compared with the case where the edge image is obtained from the original image in advance and the quality is determined.
[0012]
  Claim5The invention of claim 1 to claim 14In any one of the inventions, another defect candidate point is searched around a pixel on the contour line as the defect candidate point, and a number of defect candidate points are traced from the periphery of one defect candidate point. By extracting defect candidate points, low-contrast defects such as cracks can be detected stably.
[0013]
  Claim6The invention of claim 1 to claim 15In any of the inventions, an average value of the density of the defect candidate points is obtained, and a defect is determined when the average value is larger or smaller than a predetermined threshold value, and only the number of defect candidate points is determined. Therefore, the detection accuracy can be improved as compared with the case where the pass / fail judgment is performed.
[0014]
  Claim7The invention of claim 1 to claim 16In any of the inventions, when obtaining the edge image, the pixel of interest is compared with the surrounding pixels, starting from the end points of the discontinuous contour line, and the line is drawn in the direction in which the predetermined evaluation function is the largest. Extending and continuing this until it collides with the end point of another line, it is characterized by edge extension processing that makes the contour line a continuous line, and edge image can be obtained as continuous line by edge extension processing, The inspection accuracy can be improved by extracting defect candidate points from such continuous line edge images.
[0015]
  Claim8The invention of claim 1 to claim 17In any one of the inventions, the perimeter of a contour formed by pixels as the defect candidate points is obtained, and a defect is determined when the perimeter is equal to or greater than a specified value. Thus, the detection accuracy can be improved as compared with the case where the pass / fail judgment is made only from the above.
[0016]
  Claim9The invention of claim 1 to claim 18In any of the inventions, characterized in that a projection width of a defect candidate area consisting of a set of defect candidate points surrounded by the contour line is obtained, and it is determined as a defect when the projection width satisfies a predetermined condition, Normally, a crack has a shape whose width dimension on one side is sufficiently smaller than the width dimension on the other side, so the projected width of the defect candidate area identifies whether the defect candidate area is a defective part or a foreign substance such as dust. Therefore, defects with low contrast such as cracks can be detected stably.
[0017]
  Claim10The invention of claim1In this invention, the number of pixels on the contour line is obtained, and when the number exceeds a prescribed number, the number of defect candidate points exceeds the prescribed number, and the sum exceeds the prescribed value, the contour formed by the pixels The region surrounded by the line is determined to be a defect, and the detection accuracy can be further improved.
[0018]
  Claim11The invention of claim 1 to claim 110In any of the inventions, when a defect candidate area consisting of a set of defect candidate points is interrupted, an enlarged area is set by enlarging the defect candidate area, and another defect having at least a part in the enlarged area The candidate area is treated as the same defect candidate area as the original defect candidate area, and the defect is judged, so that the defect candidate area can be prevented from being overlooked even when a defect candidate area with a broken outline is extracted. The inspection accuracy can be improved.
[0019]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the method of the present invention will be described below with reference to the drawings.
[0020]
  Below, before describing embodiment of this invention, the reference example of this invention is demonstrated.
  (Reference example1)
  2 and 3 show a schematic configuration of an appearance inspection apparatus using the method of the present invention. A CCD camera 1 for imaging an inspection object O to be inspected illuminated obliquely by an illumination lamp La, and a CCD An A / D converter 2 that performs A / D conversion on an image signal output from the camera 1, a preprocessing circuit 3 that performs preprocessing (such as removal of singular data) on the A / D converted image data, and preprocessing An original image memory 4 that stores the obtained image data as an original image of the inspection object O, a differential absolute value image memory 5 that stores a differential absolute value calculated corresponding to each pixel of the original image, and a calculated differential A differential direction value image memory 6 for storing the direction value, an edge image memory 7 for storing an edge image obtained by extracting the change point of the density (brightness) of the original image as a line drawing, an arithmetic processing of the original image, and each memory 5 To store predetermined data in ~ 7, A microprocessor (or microcomputer) 8 for recognizing the contour of the inspection object O based on the data stored in the memories 4 to 7 and tracking the defect candidate pixels to check the presence or absence of the defect of the inspection object O; It consists of This visual inspection device isReference exampleOther than that described belowReference examples and the present inventionIt is also used in the embodiment.
[0021]
Hereinafter, a method for detecting defects on the appearance of the inspection object O using the above-described appearance inspection apparatus will be specifically described.
[0022]
4 and 5 are diagrams for explaining the operation. First, an original image f1 of the inspection object O as shown in FIG. Image processing for conversion into an edge image f4 as shown in FIG. 4B is necessary, and this image processing is performed in the microprocessor 8 as follows.
[0023]
Here, the above-described image processing by the microprocessor 8 is disclosed in detail in Japanese Patent Publication No. 7-97410, but the gist thereof will be described again as follows. First, an original image f1 obtained by imaging a spatial region including the inspection object O is a grayscale image, and includes the inspection object O, a defective portion K, and a foreign object X as shown in FIG. It is an image. Here, for example, the density of each pixel is represented by 8 bits and is set to 256 gradations. The process of extracting an edge such as a contour line of the inspection object O from the grayscale image is based on the idea that “the edge portion corresponds to a portion having a large density change”. Therefore, edge extraction is generally performed by differentiating the density. The differentiation process is performed by dividing the grayscale image into 3 × 3 pixel local parallel windows W as shown in FIG. That is, a local parallel window is formed by the pixel E of interest and the eight pixels (near 8) A to D and F to I around the pixel E, and the vertical direction of the density of the pixels A to I in the local parallel window The density change ΔV and the horizontal density change ΔH are obtained by the following equation,
ΔV = (A + B + C) − (G + H + I)
ΔH = (A + D + G) − (C + F + I)
Further, differential absolute value | eE| And differential direction value ∠eEIs obtained by the following equation.
[0024]
| eE| = (ΔV2+ ΔH2)1/2
∠eE= Tan-1(ΔV / ΔH) + π / 2
Here, A to I indicate the densities of the corresponding pixels. As is clear from the above equation, the differential absolute value | e | represents the density change rate in the vicinity region of the pixel of interest in the original image, and the differential direction value ∠e is orthogonal to the direction of density change in the vicinity region. It represents the direction to do.
[0025]
By performing the above calculation for all the pixels of the original image f1, a portion having a large density change where the contour of the inspection object O, the defect K, the foreign matter X, and the like are present, and the direction of the change are extracted. It can be done. Here, an image in which the density of each pixel is expressed by a differential absolute value | e | is called a differential absolute value image, and an image expressed by a differential direction value ∠e is called a differential direction value image. The differential absolute value image f2 (6 bits) and the differential direction value image f3 (4 bits) are stored in the differential absolute value image memory 5 and the differential direction value image memory 6, respectively.
[0026]
Next, a thinning process is performed. The thinning process is performed by paying attention to the point that the greater the absolute value of differentiation, the greater the density change. That is, the differential absolute value of each pixel is compared with the differential absolute value of the surrounding pixels, and by connecting those that are larger than the surrounding pixels, an edge having a width of one pixel is extracted. . That is, as shown in FIG. 6, if a differential absolute value image in which the position of each pixel is expressed by XY coordinates and the differential absolute value is taken on the Z axis is considered, the thinning process obtains a ridgeline on this curved surface. It corresponds to. By the processing so far, all the ridge lines are extracted regardless of the magnitude of the differential absolute value. The ridgeline obtained at this stage includes unnecessary small peaks due to noise, etc., so as shown in Fig. 7, set the threshold appropriately and adopt only the value above this threshold To remove the noise component.
[0027]
By the way, the edge image f4 obtained by the thinning process is likely to be a discontinuous line when the contrast of the original image f1 is insufficient or when there is a lot of noise. On the other hand, in a defective portion K such as a pattern M or a crack to be described later, as shown in FIGS. 10 and 11, the differential direction values (circle numbers in FIGS. 10B and 11B) are values within a certain range. Therefore, if there is a pixel having a differential direction value in the vicinity of 8 even in a portion where the edge is discontinuous, it is regarded as a part of the edge. In this way, the edge image f4 can be made a continuous line by connecting pixels whose differential direction values are values within a certain range.
[0028]
As a result of the above image processing, as shown in FIG. 4B, 1 bit (“1” is set as the edge flag) in which the contour lines 10 to 12 of the inspection object O, the defective portion K, the foreign matter X, etc. become a closed curve pattern. Edge image f4) is obtained and stored in the edge image memory 7. In the following description, the pixel position of each image is expressed by XY coordinates, and the pixel density in each image is represented by f1 (x, y), f2 (x, y), and f3 (x, y), respectively. , F4 (x, y).
[0029]
Here, since the original image is a grayscale image and the density is usually represented by 8 bits, the density a (= f1 (x, y)) in each pixel is 0 ≦ a ≦ 255. Further, the density of the differential absolute value image (that is, the differential absolute value) b (= f2 (x, y)) is expressed by, for example, 6 bits, and 0 ≦ b ≦ 63. The differential direction value) c (= f3 (x, y)) is expressed in, for example, 8 directions, and 1 ≦ c ≦ 8. As for the edge image, since there is only the presence or absence of a line, the pixel to be a line is represented as “1” and the other pixels are represented as “0”. That is, the value range of f4 (x, y) is {0, 1}. In the following description, the term density represents white density, and the higher the density value, the brighter.
[0030]
Next, the microprocessor 8 appropriately sets an inspection area for the edge image. When the inspection area is set, a raster scanning is performed within the inspection area of the edge image, thereby detecting a pixel having f4 (x, y) = 1 and setting it as a flag point. Starting from this flag point, the contour line is traced while extracting pixels with f4 (x, y) = 1 in the vicinity of eight. By tracking the contour line in this way, the coordinates of all the pixels on the contour line can be obtained. In the appearance inspection method described in Japanese Patent Laid-Open No. 4-31751 described in the conventional example, if there is no pixel with f4 (x, y) = 1 in the vicinity of 8 of the flag point, the differentiation of the flag point is performed. If there is a pixel having a differential direction value within a certain range including the direction value, the contour line is traced with the pixel having the maximum differential absolute value as an edge among such pixels. However, when the inspection object O has a pattern such as shading unevenness on the surface, and a defect portion having a low contrast such as a crack exists in the pattern, a portion other than the pattern (hereinafter referred to as “background”). If the density change is substantially the same at the boundary between the pattern and the boundary between the pattern and the background and the defect, the differential absolute value of any boundary (edge) becomes almost the same value. However, it was very difficult to determine whether the pattern was a pattern or a defective part only from the outline.
[0031]
Therefore, in the appearance inspection method of the present invention, the pattern and the defective portion are discriminated as follows. For example, as shown in FIG. 9, in the original image f1, the density a of the pixels included in the pattern M and the background portion BK of the inspection object O are different from each other, and the density of the pixels included in the pattern M is the background portion BK. Is lower than the density of the pixels included in the background portion BK, the density of the pixels included in the low contrast defect portion K such as cracks is higher than the density of the pixels included in the background portion BK. In the method of the present invention, the pattern M and the defective portion K are discriminated using the above characteristics.
[0032]
That is, the differential direction value c (= 1 to 8) is, as shown in FIG. 8, two pixels A to D and F facing each other with the target pixel E sandwiched among the eight neighborhoods according to the value of the differential direction value c. The density of pixels adjacent to each other in a direction rotated 90 ° clockwise from the direction indicated by the differential direction value c (the direction indicated by the arrow in FIG. 8) is a constant relationship between the densities a of .about.I. It has the property that it is always higher (brighter) than the density of adjacent pixels in the direction rotated by 90 °. For example, as shown in FIG. 8A, if the differential direction value c of the pixel of interest E is 1, the density a of the pixel H adjacent in the direction rotated 90 ° clockwise from the direction indicated by the differential direction value c.HIs the density a of the adjacent pixel B in the direction rotated 90 ° counterclockwise.BAlways higher than (aB<AH). If the differential direction value c of the pixel of interest E is 2 as shown in FIG. 5B, the density a of the pixel I adjacent in the direction rotated 90 ° clockwise from the direction indicated by the differential direction value c.IIs the density a of the pixel A adjacent in the direction rotated 90 ° counterclockwise.AAlways higher than (aA<AI). It should be noted that, as shown in FIGS. 5C to 5H, when the differential direction value c is 3 to 8, the density a of the two pixels A to D and F to I facing each other with the pixel of interest E in the same manner.A~ AD, AF~ AIThe magnitude relationship as described above is established between them.
[0033]
Thus, in the microprocessor 8, as shown by the arrow in FIG. 12, the coordinates of the edge flag (referred to as the pixel E) at which f4 (x, y) = 1 is obtained by performing raster scanning in the inspection area of the edge image. Based on the coordinates of the pixel E, the differential direction value c of the pixel E is read from the differential direction value image memory 6 and rotated by 90 ° clockwise and counterclockwise from the direction indicated by the differential direction value c. Density a of pixels A to D and F to I adjacent to each otherA~ AD, AF~ AIFor example, if the read differential direction value c is 4, the density a of the pixels C and GC, AGIs read from the differential absolute value image memory 5. Then, as shown in FIG. 13, if a defective portion K having a density a higher than that of the background portion BK is detected, the density a of the read pixels C and G is determined.C, AGThe density a of the background portion BKBKCompared with a predetermined threshold value ath set to a higher value, the concentration aC, AGExceeds the threshold value ath (if it is bright), the pixels C and G are counted as defect point K candidate points (hereinafter referred to as “defect candidate points”). On the other hand, the density a of both pixels C and GC, AGIs lower than the threshold value ath, it can be determined that the pixels C and G are present within the outline of the pattern M (the boundary between the background portion BK and the pattern M). Pixels C and G are not counted as defect candidate points. The process of discriminating and detecting the defective portion K as the pattern M from the process of obtaining the differential absolute value image, the differential direction value image, and the edge image is collectively shown in the flowchart of FIG.
[0034]
  Here, the defect portion K such as a crack has a feature that the number of defect candidate points increases because pixels having substantially the same density continuously exist in the vicinity of the boundary (edge) with the background portion BK. Therefore, if the count number of pixels corresponding to the defect candidate points is equal to or greater than the prescribed number by the above-described processing, the microprocessor 8 determines that the region surrounded by the outline is the defective portion K. As a result, conventionally, when there is a pattern M on the surface of the inspection object O, it is difficult to distinguish the low contrast defect portion K such as a crack from the pattern M.Reference exampleThen, it is possible to detect only the defective portion K by discriminating the defective portion K and the pattern M, and it is possible to detect a defective portion having a lower contrast than that of the prior art in a stable and accurate manner. If a defective portion K having a density a lower than that of the background portion BK is detected, it is adjacent to the direction rotated 90 ° clockwise and counterclockwise from the direction indicated by the differential direction value c of the pixel of the edge flag. The density of the pixel to be processed is set to the density a of the background portion BKBKCompared with a predetermined threshold value set to a lower value, if the density is below the threshold value (if it is dark), the pixel may be counted as a defect candidate point.
[0035]
When the density of the defective portion K is higher or lower than the density of the background portion BK in advance, it is clockwise or counterclockwise from the direction indicated by the differential direction value c of the edge flag pixel in the above processing. It is only necessary to compare the density of only one of two adjacent pixels in the direction rotated 90 degrees clockwise with the threshold value. That is, when it is known that the density of the defective portion K is higher than the density of the background portion BK, the one adjacent to the direction rotated 90 ° clockwise from the direction indicated by the differential direction value c of the pixel of the edge flag. When the density of the defective portion K is found to be lower than the density of the background portion BK, only the density of the pixel of the edge flag is compared with the threshold value. Only the density of the pixel adjacent in the direction rotated 90 ° clockwise is compared with the threshold value. For example, when the density of the defect portion K is lower than the density of the background portion BK, as shown in FIG. 14, the edge flag is rotated 90 ° counterclockwise from the direction indicated by the differential direction value c of the pixels E1 to E5. Only the densities of the pixels D1 to D5 that are adjacent in the direction are read out and compared with a threshold value. By doing so, there is an advantage that the process of detecting defect candidate points is simplified and the entire processing time can be shortened.
[0036]
Further, instead of obtaining the density of only one pixel adjacent to the edge flag, a row (stick mask) of a plurality of pixels arranged in a direction orthogonal to the direction indicated by the differential direction value c including the pixel is scanned. Anyway. For example, when the density of the defective part K is lower than the density of the background part BK, as shown in FIG. 15, it is rotated 90 ° counterclockwise from the direction indicated by the differential direction value c of the pixels E1 to E5 of each edge flag. A process is performed in which a stick mask composed of pixel columns D1a to D1c, D2a to D2c,..., D5a to D5c including pixels D1 to D5 adjacent in the direction is scanned and the density is compared with a threshold value. That is, the defect portion K such as a crack is characterized in that pixels having substantially the same density are continuously present in the vicinity of the boundary (edge) with the background portion BK. Therefore, the density is determined by scanning the stick mask as described above. By increasing the number of pixels to be compared with the threshold value, a large number of defect candidate points can be extracted, so that it is easy to determine pass / fail and to improve inspection accuracy.
[0037]
  (Reference example2)
  AboveReference example1, raster scanning is performed on the inspection region set in the edge image f4 obtained in advance.Reference exampleRaster scans the inspection area set in the differential direction value image f3 to search for a pixel having a predetermined differential direction value, and among the pixels having the differential direction value, the differential absolute value is smaller than a predetermined threshold value. Extract a pixel that shows a high value, and for the extracted pixelReference exampleSimilarly to 1, the defect candidate point is extracted by comparing the density of a pixel adjacent in the direction rotated 90 ° counterclockwise and counterclockwise from the direction indicated by the differential direction value c of the pixel with a threshold value. There is a feature in the point.
[0038]
  Thus, the bookReference exampleThen, as described above, only the pixels satisfying the specific condition are extracted and the pass / fail determination is performed. Therefore, the edge image f4 is obtained in advance from the original image f1 to perform the pass / fail determination.Reference exampleCompared to 1, there is an advantage that the inspection time can be shortened.
[0039]
  (Embodiment1)
  AboveReference exampleIn 1 and 2, the pass / fail determination is performed based on the total number of defect candidate points counted. In this embodiment, the edge flag pixel is rotated 90 ° clockwise or counterclockwise from the direction indicated by the differential direction value c of the pixel. When the density of pixels adjacent in the selected direction exceeds the threshold value and is counted as a defect candidate point, the differential absolute value of the pixel of the edge flag is obtained and the differential absolute value of the pixel of the edge flag is calculated. It is characterized in that the sum is calculated, and it is determined that there is a defect if the number of defect candidate points exceeds a specified number and the sum of the differential absolute values exceeds a threshold value.
[0040]
For example, when the density of the defective part K is lower than the density of the background part BK, as shown in FIG. 16, the edge flag is rotated 90 ° counterclockwise from the direction indicated by the differential direction value c of the pixels E1 to E5. A stick mask including pixels D1 to D5 adjacent in the direction is scanned and the density thereof is compared with a threshold value. If the density of the pixels D1 to D5 exceeds the threshold value, a defect candidate point is obtained. At the same time, the differential absolute values (E1 = 30, E2 = 40, E3 = 50, E4 = 35, E5 = 30) of the pixels E1 to E5 are read from the differential absolute value image memory 5 and summed (= 185). The process which calculates | requires is performed. Then, it is determined that there is a defect when the count number of defect candidate points exceeds a prescribed number and the sum of the differential absolute values exceeds a threshold value.
[0041]
By performing the processing as described above, there is an advantage that the detection accuracy can be improved as compared with the case where the pass / fail determination is made only from the number of defect candidate points. If the density of any pixel of the stick mask exceeds the threshold value, the detection accuracy can be further improved by counting the pixels of the edge flag as defect candidate points.
[0042]
  (Embodiment2)
  By the way,Reference example1, when a defective portion K having a density a higher than the background portion BK is detected as shown in FIG. 13, the read-out pixel density a is set to the density a of the background portion BK.BKCompared with a predetermined threshold value ath set to a higher value than the threshold value ath, if it exceeds the threshold value ath, it is counted as a defect candidate point. There is a risk of erroneous counting.
[0043]
Therefore, in this embodiment, as shown in FIG. 17, two threshold values ath1 and ath2 sandwiching the peak value of the density of the defective portion K are set, and the read pixel density a is set to the two threshold values. When it is between ath1 and ath2 (ath1 ≦ a ≦ ath2), it is counted as a defect candidate point K. Therefore, it is possible to remove noise factors such as dust having a concentration higher than the larger threshold value ath2, and there is an advantage that the inspection accuracy can be improved.
[0044]
  (Embodiment3)
  This embodimentReference example1, whether or not there is a pixel higher than the threshold value ath (or between the two threshold values ath1 and ath2) by tracking the periphery of the obtained defect candidate point K pixel by pixel. If there is a pixel that satisfies the above conditions, the pixel is counted as a defect candidate point K.
[0045]
Here, as a method of tracking the pixels around the defect candidate point K, the defect candidate point K is divided into a location parallel window centered on the defect candidate point K, and the density near 8 is sequentially compared with the threshold value ath. If K is found, the procedure of comparing the density in the vicinity of 8 at that point (pixel) with the threshold value ath may be repeated.
[0046]
According to the appearance inspection method of this embodiment, defect candidate points are traced from the periphery of one defect candidate point and a large number of defect candidate points K are extracted. There is an advantage that it can be detected stably.
[0047]
  (Embodiment4)
  This embodimentReference examples 1 and 2Embodiment 13Average value AV of density of defect candidate point K extracted by each method explained in the aboveKThe average value AV of the background portion BK density is calculatedBKBoth average values AV compared toK, AVBKIt is characterized in that it is judged as defective when the difference between the values exceeds a specified value.
[0048]
Here, the density average value AV of the defect candidate point KKIs obtained by dividing the total density of the extracted defect candidate points K by the number of defects. Similarly, the average density AV of the background portion BKBKIs obtained by dividing the sum of the densities of the pixels in the inspection area excluding the extracted defect candidate point K by the number of pixels.
[0049]
By performing the processing as described above, there is an advantage that the detection accuracy can be improved as compared with the case where the pass / fail determination is made only from the number of defect candidate points.
[0050]
  (Embodiment5)
  by the wayReference exampleThe edge image f4 obtained by the thinning process described in 1 is likely to be a discontinuous line when the contrast of the original image f1 is insufficient or when there is a lot of noise. AndReference exampleIn 1, even if the edge is discontinuous, if there is a pixel whose differential direction value is within a certain range in the vicinity of 8, it is regarded as a part of the edge, and thus the differential direction value is The edge image f4 is formed as a continuous line by connecting pixels having values within a certain range.
[0051]
In contrast, the present embodiment is characterized in that the edge image f4 is made a continuous line by performing an edge extension process as described below. In the edge extension processing of this embodiment, starting from the end point of the discontinuous line, the pixel of interest is compared with surrounding pixels, and an evaluation function f (eJ) Extends the line (edge) in the direction where it becomes the largest, and continues until it collides with the end point of another line.
[0052]
f (eJ) = | EJ| cos (∠eJ-∠e0) Cos {π (J-1) / 4-∠e0}
Where e0Is the differential absolute value of the center pixel, eJIs the differential absolute value of adjacent pixels (near 8), and J = 1, 2,.
[0053]
  Thus, the edge image f4 can be obtained as a continuous line by the edge extension processing as described above, and the edge image f4 of such a continuous line is obtained.Reference examples 1 and 2Embodiment 14The inspection accuracy can be improved by extracting the defect candidate point K by the method described in the above.
[0054]
  (Embodiment6)
  In the present embodiment, a pixel (edge flag) where f4 (x, y) = 1 is detected by raster scanning in the inspection region set for the edge image, and the edge flag is set as a defect candidate point K from the density. In addition to determining whether or not it corresponds, the contour line connecting the defect candidate point K is traced while extracting the edge flag corresponding to the defect candidate point K in the vicinity of 8 starting from the edge flag corresponding to the defect candidate point K. Then, an area surrounded by the contour line (hereinafter referred to as “defect candidate area”) KR is obtained, and the number of defect candidate points K (number of pixels) forming the contour line is counted, thereby surrounding the defect candidate area. It is characterized in that the length is obtained and it is determined as defective when the obtained perimeter exceeds a specified value.
[0055]
Thus, as shown in FIG. 18, by using the circumference length of the defect candidate region KR in the edge image f4 as a parameter of the actual size of the defect portion K, the pass / fail judgment is performed, so that only the number of defect candidate points is obtained. There is an advantage that the detection accuracy can be improved as compared with the case where the quality determination is performed.
[0056]
  (Embodiment7)
  This embodiment is an embodiment6, The projection width of the defect candidate region KR is obtained based on the XY coordinates of the defect candidate points K that form the outline of the defect candidate region KR, and the defect region KR is determined from the projection width. It is characterized by identifying whether it is a defect portion K such as a crack or a foreign matter such as dust.
[0057]
Projection width X in the X direction and Y direction of the defect candidate region KRKR, YKRAs shown in FIG. 19, the difference between the minimum value Xmin, Ymin and the maximum value Xmax, Ymax of the XY coordinates of the defect candidate point K forming the outline is obtained as follows.
[0058]
XKR= Xmax-Xmin
YKR= Ymax-Ymin
Here, the normal crack has a feature that the width dimension of one side is sufficiently smaller than the width dimension of the other side as shown in FIG.KR, YKRRatio (XKR/ YKR) Is outside the specified range, it can be determined as a defective portion K such as a crack, and when the ratio is within the specified range, it can be determined as foreign matter such as dust.
[0059]
According to the appearance inspection method of the present embodiment as described above, the projection width X of the defect candidate region KR.KR, YKRThus, it is possible to identify whether the defect candidate region KR is a defect portion K or a foreign matter such as dust, and a defect with a low contrast such as a crack can be detected stably.
[0060]
  (Embodiment8)
  by the way,Reference examples 1 and 2Embodiment 17In this case, whether or not each defect candidate area surrounded by the contour line of the edge image f4 is defective is judged as good or bad. Therefore, when a defect candidate area where the contour line is interrupted is extracted, the defect candidate area is overlooked. There is a risk of it.
[0061]
Therefore, in the present embodiment, a certain defect candidate region and another defect candidate region existing in the vicinity thereof are treated as the same defect candidate region, and the number of defect candidate points included in each defect candidate region and pixels that form an outline are formed. This is characterized in that the sum of the differential absolute values, the perimeter of the defect candidate area, and the projection width are obtained, and the quality is determined based on the totalized values.
[0062]
Specifically, as shown in FIG. 21, an enlarged area KR1 ′ obtained by enlarging the outline of the defect candidate area KR1 by a predetermined number of pixels is set around the extracted defect candidate area KR1, and the enlarged area KR1 ′ is set. Whether or not at least a part of another defect candidate region KR2 exists is searched for, and if it exists, the defect candidate region KR2 is handled as the same defect region as the original defect candidate region KR1. Then, the number of defect candidate points included in each defect candidate region KR1, KR2, the sum of differential absolute values of the pixels forming the contour line, the perimeter of the defect candidate regions KR1, KR2, and the projection width are obtained and tabulated. By performing the pass / fail judgment based on the value, there is an advantage that the defect candidate area can be prevented from being overlooked even when a defect candidate area having a broken outline is extracted, and the inspection accuracy can be improved.
[0063]
【The invention's effect】
  In order to achieve the above object, the invention according to claim 1 is an appearance inspection method for detecting defects on the appearance of an inspection object from a gradation image obtained by imaging a spatial region including the inspection object. An original image, which is an image, is calculated to obtain a differential absolute value image, a differential direction value image, and an edge image, an inspection area is set in the edge image, and pixels on the contour line of the edge image in the inspection area are set. Then, the density in the original image of the adjacent pixel in the direction rotated approximately 90 ° clockwise or counterclockwise from the direction of the differential direction value of the pixel is obtained, and the pixel is defective when the density satisfies a predetermined condition. Candidate points, andIn either direction, rotated 90 ° clockwise or counterclockwiseA defect mask point is extracted by setting a stick mask including adjacent pixels, and the sum of differential absolute values of pixels on the contour line is obtained. The number of defect candidate points exceeds a specified number, and the sum is a specified value. Since the area surrounded by the contour line formed by the pixel is determined as a defect when the value exceeds the threshold, the object to be inspected has a pattern such as shading unevenness on the surface, and it is mixed with the pattern to reduce it like a crack. Even if there is a contrast defect part, the density of pixels included in the pattern and background part of the object to be inspected is different, and the density of the pixels included in the pattern is included in the background part. If the density is lower (or higher) than the density of the pixel, the density of the pixel included in the low-contrast defect part such as a crack is higher (or lower) than the density of the pixel included in the background part. In By extracting a pixel that is higher (or lower) than the density of the pixel to be captured as a defect candidate point, the pattern and the defect can be identified, and as a result, the pattern can be prevented from being erroneously determined as a defect. It is possible to improve the accuracy of determining the presence or absence of defects. When the density of the defective portion is higher or lower than the density of the background portion in advance, it is adjacent to the direction rotated 90 ° clockwise or counterclockwise from the direction indicated by the differential direction value. By comparing the density of only one of the two pixels with a threshold value, the process of detecting defect candidate points can be simplified, the overall processing time can be shortened, and defect parts such as cracks can be reduced. Since pixels with almost the same density exist in the vicinity of the boundary with the background part, many defect candidate points can be extracted by increasing the number of pixels whose density is compared with the threshold by scanning the stick mask. In addition, it is easy to make a pass / fail judgment and improve the inspection accuracy, and the sum of the differential absolute values of the pixels on the contour line is obtained, and the number of defect candidate points exceeds the specified number and When the sum exceeds a specified value, the area surrounded by the contour line formed by the pixel is determined as a defect, so that the detection accuracy is improved compared to the case where the quality is determined only from the number of defect candidate points. Is effective.
[0064]
According to a second aspect of the present invention, in the first aspect of the present invention, the predetermined value indicates that the density of the pixel exceeds a threshold set to a level brighter or darker than a background portion representing the surface of the inspection object. Thus, the same effect as that of the first aspect of the invention can be obtained.
[0065]
According to a third aspect of the present invention, in the first aspect of the invention, the first threshold value in which the density of the pixel is set to a level brighter or darker than the background portion representing the surface of the inspection object, and the defect portion Since the predetermined condition is that it exists between the second threshold value set to a level brighter or darker than the peak value of the density, such as dust whose density exceeds the second threshold value. The noise factor can be removed, and the inspection accuracy can be improved.
[0068]
  Claim4The invention of claim 1Or 2 or 3In this invention, since defect candidate points are extracted only from pixels having a predetermined differential direction value among the pixels on the contour line, by extracting only pixels satisfying a specific condition and performing pass / fail judgment, the original image is obtained. Therefore, there is an effect that the inspection time can be shortened as compared with the case where the edge image is obtained in advance and the quality is determined.
[0070]
  Claim5The invention of claim 1 to claim 14In any of the inventions, since another defect candidate point is searched around the pixel on the contour line as the defect candidate point, the defect candidate point is tracked from the periphery of one defect candidate point, and a large number of defect candidate points are detected. By extracting, there is an effect that low contrast defects such as cracks can be detected stably.
[0071]
  Claim6The invention of claim 1 to claim 15In any of the inventions, an average value of the density of the defect candidate points is obtained, and a defect is determined when the average value is larger or smaller than a predetermined threshold value. As a result, the detection accuracy can be improved as compared with the case of performing.
[0072]
  Claim7The invention of claim 1 to claim 16In any of the inventions, when obtaining the edge image, the pixel of interest is compared with the surrounding pixels, starting from the end points of the discontinuous contour line, and the line is drawn in the direction in which the predetermined evaluation function is the largest. Extending and continuing this until it collides with the end point of another line will perform edge extension processing with the contour as a continuous line, so the edge image can be obtained as a continuous line by edge extension processing, There is an effect that the inspection accuracy can be improved by extracting defect candidate points from the edge image of the line.
[0073]
  Claim8The invention of claim 1 to claim 17In any of the inventions, the perimeter of the contour line formed by the pixels as the defect candidate points is obtained, and a defect is determined when the perimeter is equal to or greater than a specified value. There is an effect that detection accuracy can be improved as compared with the case of performing the determination.
[0074]
  Claim9The invention of claim 1 to claim 18In any of the inventions, since the projection width of a defect candidate area consisting of a set of defect candidate points surrounded by the contour line is obtained, and when the projection width satisfies a predetermined condition, it is determined as a defect. Since the width dimension on one side is sufficiently smaller than the width dimension on the other side, it is possible to identify whether the defect candidate area is a defective part or a foreign substance such as dust by the projected width of the defect candidate area. It is possible to stably detect defects with low contrast such as cracks.
[0075]
  Claim10The invention of claim1In this invention, the number of pixels on the contour line is obtained, and when the number exceeds a prescribed number, the number of defect candidate points exceeds the prescribed number, and the sum exceeds the prescribed value, the contour formed by the pixels Since the area surrounded by the line is determined as a defect, there is an effect that detection accuracy can be further improved.
[0076]
  Claim11The invention of claim 1 to claim 110In any of the inventions, when a defect candidate area consisting of a set of defect candidate points is interrupted, an enlarged area is set by enlarging the defect candidate area, and another defect having at least a part in the enlarged area Since the defect is judged by treating the candidate area as the same defect candidate area as the original defect candidate area, it is possible to prevent the defect candidate area from being overlooked even when a defect candidate area with a broken outline is extracted. There is an effect that the improvement can be achieved.
[Brief description of the drawings]
[Figure 1]Reference example of the present inventionIt is a flowchart explaining the external appearance inspection method of 1. FIG.
FIG. 2 is a schematic configuration diagram of an appearance inspection apparatus using the same as above.
FIG. 3 is a block circuit diagram of the same appearance inspection apparatus.
4A and 4B are explanatory views of the above. FIG.
FIG. 5 is an explanatory diagram showing a local parallel window in the same as above.
FIG. 6 is an explanatory diagram of the above.
FIG. 7 is an explanatory view of the above.
FIGS. 8A to 8H are operation explanatory views of the same. FIG.
FIG. 9 is an explanatory diagram of the above.
FIGS. 10A and 10B are explanatory views of patterns in the same as above. FIGS.
FIGS. 11A and 11B are explanatory views of a defect portion in the same as above. FIGS.
FIG. 12 is an explanatory view of the above.
FIG. 13 is an explanatory diagram of the above.
FIG. 14 is an explanatory view of the above.
FIG. 15 is an explanatory diagram of the above.
FIG. 16 shows an embodiment.1It is explanatory drawing of.
FIG. 17 is an embodiment.2It is explanatory drawing of.
FIG. 18 shows an embodiment.6It is explanatory drawing of.
FIG. 19 shows an embodiment.7It is explanatory drawing of.
FIG. 20 is an explanatory diagram of the above.
FIG. 21 Embodiment8It is explanatory drawing of.
[Explanation of symbols]
  1 CCD camera
  2 A / D converter
  3 Pre-processing circuit
  4 Original image memory
  5 Differential absolute value image memory
  6 Differential direction value image memory
  7 Edge image memory
  8 Microprocessor

Claims (11)

被検査物を含む空間領域を撮像して得られた濃淡画像から被検査物の外観上の欠陥を検出する外観検査方法において、前記濃淡画像である原画像を演算処理して微分絶対値画像、微分方向値画像並びにエッジ画像を求め、前記エッジ画像内に検査領域を設定するとともに該検査領域内におけるエッジ画像の輪郭線上の画素に対して当該画素が持つ微分方向値の方向から時計回り又は反時計回りに略90°回転した方向に隣接する画素の原画像における濃度を求め、この濃度が所定の条件を満たす場合に当該画素を欠陥候補点とし、さらに、前記時計回り又は反時計回りに90°回転した何れか一方の方向に隣接する画素を含んだスティックマスクを設定して欠陥候補点を抽出するとともに、前記輪郭線上の画素の微分絶対値の総和を求め、欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定することを特徴とする外観検査方法。In an appearance inspection method for detecting defects on the appearance of an inspection object from a grayscale image obtained by imaging a spatial region including the inspection object, a differential absolute value image obtained by calculating an original image that is the grayscale image, A differential direction value image and an edge image are obtained, an inspection area is set in the edge image, and the pixels on the edge line of the edge image in the inspection area are clockwise or counterclockwise from the direction of the differential direction value of the pixel. The density in the original image of a pixel adjacent in a direction rotated by approximately 90 ° in the clockwise direction is obtained, and when this density satisfies a predetermined condition, the pixel is set as a defect candidate point, and further, the clockwise or counterclockwise 90 Defect candidate points are extracted by setting a stick mask that includes pixels that are adjacent in one of the rotated directions, and the sum of the differential absolute values of the pixels on the contour line is obtained to determine the defect An appearance inspection method characterized in that, when the number of candidate points exceeds a specified number and the sum exceeds a specified value, a region surrounded by a contour formed by the pixel is determined as a defect. 前記画素の濃度が前記被検査物の表面を表す背景部分よりも明るい又は暗いレベルに設定されたしきい値を超えていることを前記所定の条件とすることを特徴とする請求項1記載の外観検査方法。  2. The predetermined condition is that the density of the pixel exceeds a threshold set to a level brighter or darker than a background portion representing the surface of the object to be inspected. Appearance inspection method. 前記画素の濃度が前記被検査物の表面を表す背景部分よりも明るい又は暗いレベルに設定された第1のしきい値と、欠陥部分の濃度のピーク値よりも明るい又は暗いレベルに設定された第2のしきい値との間に存在することを前記所定の条件とすることを特徴とする請求項1記載の外観検査方法。  The density of the pixel is set to a level that is brighter or darker than the peak value of the density of the defective portion, and a first threshold value that is set to a level brighter or darker than the background portion representing the surface of the inspection object The appearance inspection method according to claim 1, wherein the predetermined condition is to exist between the second threshold value and the second threshold value. 前記輪郭線上の画素のうちで所定の微分方向値を有する画素のみから欠陥候補点を抽出することを特徴とする請求項1又は2又は3記載の外観検査方法。  4. The appearance inspection method according to claim 1, wherein defect candidate points are extracted only from pixels having a predetermined differential direction value among pixels on the contour line. 前記欠陥候補点とした輪郭線上の画素の周辺で別の欠陥候補点を探索することを特徴とする請求項1〜4の何れかに記載の外観検査方法。  5. The appearance inspection method according to claim 1, wherein another defect candidate point is searched around a pixel on a contour line as the defect candidate point. 前記欠陥候補点の濃度の平均値を求め、該平均値が所定のしきい値よりも大きい又は小さい場合に欠陥と判定することを特徴とする請求項1〜5の何れかに記載の外観検査方法。  6. The appearance inspection according to claim 1, wherein an average value of the density of the defect candidate points is obtained, and a defect is determined when the average value is larger or smaller than a predetermined threshold value. Method. 前記エッジ画像を求める際に、不連続となる輪郭線の端点から始めて注目する画素とその周囲の画素とを比較し、所定の評価関数がもっとも大きくなる方向に線を延長し、他の線の端点に衝突するまでこれを続けることで輪郭線を連続線とするエッジ延長処理を行うことを特徴とする請求項1〜6の何れかに記載の外観検査方法。  When obtaining the edge image, the pixel of interest is compared with the surrounding pixels starting from the end point of the discontinuous contour line, the line is extended in the direction in which the predetermined evaluation function is the largest, and the other lines The appearance inspection method according to claim 1, wherein an edge extension process using a contour line as a continuous line is performed by continuing this process until it collides with an end point. 前記欠陥候補点とした画素で形成される輪郭線の周囲長を求め、該周囲長が規定値以上の場合に欠陥と判定することを特徴とする請求項1〜7の何れかに記載の外観検査方法。  8. The appearance according to claim 1, wherein a peripheral length of a contour line formed by pixels as the defect candidate points is obtained, and a defect is determined when the peripheral length is equal to or greater than a specified value. Inspection method. 前記輪郭線で囲まれた欠陥候補点の集合からなる欠陥候補領域の射影幅を求め、該射影幅が所定の条件を満たす場合に欠陥と判定することを特徴とする請求項1〜8の何れかに記載の外観検査方法。  9. The projection width of a defect candidate area composed of a set of defect candidate points surrounded by the contour line is obtained, and a defect is determined when the projection width satisfies a predetermined condition. Appearance inspection method according to crab. 前記輪郭線上の画素の個数を求め、該個数が規定数を超えるとともに欠陥候補点の個数が規定数を超え且つ前記総和が規定値を超えた場合に当該画素で形成される輪郭線で囲まれた領域を欠陥と判定することを特徴とする請求項1記載の外観検査方法。  The number of pixels on the contour line is obtained, and when the number exceeds the prescribed number, the number of defect candidate points exceeds the prescribed number, and the sum exceeds the prescribed value, the contour line is formed by the pixels. 2. The appearance inspection method according to claim 1, wherein the region is determined as a defect. 欠陥候補点の集合からなる欠陥候補領域が途切れている場合に当該欠陥候補領域を拡大した拡大領域を設定し、該拡大領域内に少なくとも一部が存在する別の欠陥候補領域を元の欠陥候補領域と同じ欠陥候補領域として取り扱って欠陥の判定を行うことを特徴とする請求項1〜10の何れかに記載の外観検査方法。  When a defect candidate area consisting of a set of defect candidate points is interrupted, an enlarged area obtained by enlarging the defect candidate area is set, and another defect candidate area having at least a part in the enlarged area is set as the original defect candidate. The appearance inspection method according to claim 1, wherein the defect is determined by treating it as the same defect candidate area as the area.
JP2000016402A 2000-01-26 2000-01-26 Appearance inspection method Expired - Lifetime JP3890844B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000016402A JP3890844B2 (en) 2000-01-26 2000-01-26 Appearance inspection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000016402A JP3890844B2 (en) 2000-01-26 2000-01-26 Appearance inspection method

Publications (2)

Publication Number Publication Date
JP2001209794A JP2001209794A (en) 2001-08-03
JP3890844B2 true JP3890844B2 (en) 2007-03-07

Family

ID=18543539

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000016402A Expired - Lifetime JP3890844B2 (en) 2000-01-26 2000-01-26 Appearance inspection method

Country Status (1)

Country Link
JP (1) JP3890844B2 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003242482A (en) * 2002-02-14 2003-08-29 Hitachi High-Technologies Corp Inspection method and inspection device for circuit pattern
WO2005038445A1 (en) 2003-10-21 2005-04-28 Daihatsu Motor Co., Ltd. Surface defect inspecting method and device
JP4802614B2 (en) * 2005-08-25 2011-10-26 パナソニック電工株式会社 Fine circuit inspection method, fine circuit inspection apparatus, fine circuit inspection program
JP4742832B2 (en) * 2005-11-25 2011-08-10 パナソニック電工株式会社 Appearance inspection method, appearance inspection apparatus, program
JP5452035B2 (en) * 2009-02-24 2014-03-26 パナソニック株式会社 Defect inspection method and defect inspection apparatus
JP5067677B2 (en) * 2010-03-17 2012-11-07 コグネックス株式会社 Defect detection method, defect detection apparatus, and program
WO2017057363A1 (en) * 2015-10-01 2017-04-06 富士フイルム株式会社 Crack detection apparatus, crack detection method, and program
CN110223276A (en) * 2019-05-28 2019-09-10 武汉楚锐视觉检测科技有限公司 A kind of bottle cap detection method and device based on image procossing
JP7332465B2 (en) * 2019-12-26 2023-08-23 株式会社日立製作所 Motion recognition system, motion recognition device, and region setting method

Also Published As

Publication number Publication date
JP2001209794A (en) 2001-08-03

Similar Documents

Publication Publication Date Title
US4974261A (en) Optical surface inspection method
CN108629775B (en) Thermal state high-speed wire rod surface image processing method
CN111179243A (en) Small-size chip crack detection method and system based on computer vision
JP4232800B2 (en) Line noise elimination device, line noise elimination method, line noise elimination program
JP6811217B2 (en) Crack identification method, crack identification device, crack identification system and program on concrete surface
JP3890844B2 (en) Appearance inspection method
JP4293653B2 (en) Appearance inspection method
JP2000339462A (en) Defect inspection method and defect inspection device
JP4743231B2 (en) Appearance inspection method and appearance inspection apparatus
JP3508518B2 (en) Appearance inspection method
JP2005241304A (en) Appearance inspection method
JP3494006B2 (en) Appearance inspection method
JPH06103275B2 (en) Defect extraction method by visual inspection
JP4743230B2 (en) Appearance inspection method and appearance inspection apparatus
JP2005346222A (en) Sweat gland pore removing device, sweat gland pore removing method and sweat gland pore removing program
JPH0718811B2 (en) Defect inspection method
JP3260425B2 (en) Pattern edge line estimation method and pattern inspection device
JPH0718812B2 (en) Foreign object detection method
JP4178923B2 (en) Appearance inspection method and appearance inspection apparatus
JP2686053B2 (en) Defect inspection method by visual inspection
JPH09161056A (en) Inspecting method for inner surface of circular container
JPH08190633A (en) Defect judging method
JPH0319990B2 (en)
JPH0772909B2 (en) Welding condition judgment method by visual inspection
JPH08159712A (en) Pattern recognition method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060327

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060404

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060605

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20060801

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060831

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20061012

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20061114

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20061127

R151 Written notification of patent or utility model registration

Ref document number: 3890844

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091215

Year of fee payment: 3

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091215

Year of fee payment: 3

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091215

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101215

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111215

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121215

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121215

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131215

Year of fee payment: 7

EXPY Cancellation because of completion of term