JP4467690B2 - Template setting method - Google Patents
Template setting method Download PDFInfo
- Publication number
- JP4467690B2 JP4467690B2 JP36011499A JP36011499A JP4467690B2 JP 4467690 B2 JP4467690 B2 JP 4467690B2 JP 36011499 A JP36011499 A JP 36011499A JP 36011499 A JP36011499 A JP 36011499A JP 4467690 B2 JP4467690 B2 JP 4467690B2
- Authority
- JP
- Japan
- Prior art keywords
- template
- region
- edge
- image
- vertical
- 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 - Fee Related
Links
Images
Landscapes
- Image Processing (AREA)
- Image Analysis (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、テンプレートマッチング(template matching)におけるテンプレートを設定する技術分野に属する。特に、印刷物の検査装置において、基準画像と検査対象画像との間の位置ずれ量を検出するためのテンプレートを設定するテンプレート設定方法に関する。
【0002】
【従来技術】
検査基準となる印刷物の撮像画像である基準画像と、検査対象の撮像画像である検査対象画像とを比較して印刷物の良否を検査する印刷物の検査装置が知られている。この方式の検査装置においては、基準画像と検査対象画像の間に位置ずれがある場合に、そのまま両者を比較すると、良品の印刷物であっても不良品として判定する誤動作が起きることとなる。この誤動作を避けるためには、検査水準(検査レベル)を相応に低くしなければならない。したがって、この検査装置において検査性能を高めるためには、基準画像と検査対象画像の間の位置ずれを補正して両者を比較することが行われる。
【0003】
この位置ずれを補正するためには位置ずれ量を取得することが必要であり、そのためにテンプレートマッチング(パターン照合)の演算が行われる。たとえば、基準画像と検査対象画像について相対位置を変化させて一致度を演算し、最も一致度の高い相対位置に基づいて位置ずれ量を取得することが行われる。
【0004】
【発明が解決しようとする課題】
ところが、画像のほぼ全領域をテンプレートと考えて一致度の演算を行うと、演算量が膨大となる。しかも、通常は高速稼動する印刷機、等においてインラインで検査を行うため、時間的な制約から検査装置の実現が困難となる。そこで、検査対象物品が印刷物のように、伸縮、等の歪みのないものであると見做すことができれば、位置ずれ量は場所によらず一定である。したがって、画像の一部をテンプレートと考えて演算しても、全体の位置ずれ量と一致する結果を得ることができる。
【0005】
このように、画像の一部をテンプレートとして演算すれば、演算量が縮小され高速に一致度の演算を行うことができる。しかし、画像のほぼ全領域をテンプレートとした場合と同等の高精度と安定性を得るためには、テンプレートの設定場所の選定が決定的に重要である。テンプレートが絵柄のベタ部分や、絵柄の一方向のエッジ成分しか含まない場合には、間違いなく誤補正することとなる。
【0006】
本発明は上記の問題を解決するためになされたものである。その目的は、位置ずれ量を演算するためのテンプレートとして、高精度と安定性を得ることができる適切なテンプレートを設定することにある。
【0007】
【課題を解決するための手段】
上記の課題は下記の本発明によって解決される。すなわち、本発明の請求項1に係るテンプレート設定方法は、検査基準となる印刷物を撮像して得た基準画像においてエッジを抽出するエッジ抽出過程と、少なくとも2つの所定方向のエッジに対し、所定の位置でのテンプレートサイズの領域におけるエッジ画素数を計数し、それぞれのエッジ方向においてエッジ画素数が多い順番にテンプレートサイズの領域の位置を並び替えた位置列を作り、それぞれのエッジ方向の位置列において、いずれかの方向のエッジ画素数が多い順番にテンプレートサイズの領域の位置を比較し、最初に現れる共通のテンプレートサイズの領域の位置の前記基準画像の領域をテンプレートとして選択する領域選択過程とを有するようにしたものである。本発明によれば、エッジ抽出過程において検査基準となる印刷物を撮像して得た基準画像においてエッジが抽出され、領域選択過程において、テンプレートサイズの領域におけるすくなくとも2つの所定方向のエッジ画素数の多い順番にテンプレートの位置を比較し、最初に現れる共通の位置の前記基準画像の領域がテンプレートとして選択される。すなわち、この選択したテンプレートは2つの所定方向のエッジを多く含む領域であるから、2次元的な相対位置の変化に対して一致度が大きく変化する。したがって、位置ずれ量を演算するためのテンプレートとして、高精度と安定性を得ることができる適切なテンプレートが設定される。
【0008】
また、本発明の請求項2に係るテンプレート設定方法は、請求項1に係るテンプレート設定方法において、前記領域選択過程は、前記所定方向のエッジが連結している領域をテンプレートとして選択する過程であるようにしたものである。本発明によれば、選択したテンプレートは所定方向のエッジが連結している領域である。すなわち、所定方向のエッジが密接して存在するから領域のサイズは小さくて済む。したがって、一致度の演算において演算量が縮小されるため検査速度を高速化することができる。
【0009】
また、本発明の請求項3に係るテンプレート設定方法は、請求項1または2に係るテンプレート設定方法において、前記領域選択過程は、前記所定方向以外のエッジを除去した後、前記所定方向のエッジを多く含む前記基準画像の領域をテンプレートとして選択する過程であるようにしたものである。本発明によれば、選択したテンプレートにおいては所定方向以外のエッジが除去されている。したがって、特に顕著な高精度と安定性を得ることができる適切なテンプレートが設定される。
【0010】
また、本発明の請求項4に係るテンプレート設定方法は、請求項1〜3のいずれかに係るテンプレート設定方法において、前記領域選択過程は、位置ずれ補正領域内に類似絵柄がない領域をテンプレートとして選択する過程であるようにしたものである。位置ずれ補正領域内は、テンプレートと画像の相対位置を変化させ一致度を演算する範囲である。すなわち、位置ずれ補正領域内に類似絵柄が存在すると、その類似絵柄の近辺で一致度が極大となり本物絵柄と取り違えて位置ずれ量を演算する恐れがある。したがって、本発明によれば、類似絵柄と本物絵柄とを取り違えて位置ずれ量を演算する誤りを回避することができる。
【0011】
【発明の実施の形態】
次に、本発明について実施の形態を説明する。本発明のテンプレート設定方法におけるデータ処理の過程を図1に示す。図1において、基準画像は検査の基準となる物品(たとえば印刷物)を撮像して得た画像である。この基準画像を、本発明のテンプレート設定方法を適用するデータ処理システムの記憶装置に、あらかじめ記憶しておく。
【0012】
まず、図1のステップS1において、基準画像に対して水平微分処理を行う。この水平微分処理は、基準画像において水平方向(行方向)に画素を辿るとき(関連付けるとき)、画素値を画素の位置の関数値と見做して微分係数を演算する処理である。実際は、ディジタル画像であるから、差分を演算することである。また、ここでは差分の符号の正負を区別する意味がないから差分の絶対値が演算される。この水平微分処理を基準画像の全体に対して行うと水平差分画像が得られる。
【0013】
この水平微分処理により得られる水平差分画像は、基準画像において水平方向の画素値の変化が大きい部分は差分の絶対値が大きく、その画素値の変化が小さい部分は差分の絶対値が小さくなる。すなわち、水平差分画像は基準画像における垂直方向(列方向)のエッジが強調された画像である。図1の▲1▼に模式的に示すように、完全な垂直方向のエッジでなくても、斜めのエッジでその成分を含んでいる場合には、それなりに差分の絶対値が得られるためエッジが強調される。
【0014】
次に、ステップS2において、水平差分画像を2値化し水平2値化差分画像を得る。この2値化を行う場合の閾値(境界値)の決定方法によって本発明は限定されない。たとえば、多変量解析における判別分析を閾値決定に適用した判別分析法、画像の画素値ヒストグラムにおける谷に対応する画素値を閾値とするモード法、等を適用することができる。この水平2値化差分画像は、画素値において画像を2つの部分に区分することができる。すなわち、絵柄の部分(たとえば画素値を”1”とする)と背景の部分(たとえば画素値を”0”とする)の2つの部分である。
【0015】
次に、ステップS3において、水平2値化差分画像に対し垂直縮小処理を行い垂直エッジ画像を得る。この垂直縮小処理は、水平2値化差分画像において垂直方向(列方向)に画素を辿るとき(関連付けるとき)、絵柄の部分(たとえば画素値を”1”とする)の画素が所定の画素数を超えて連続していない場合には、そこを背景の部分(画素値を”0”とする)に置き換える処理である。すなわち、所定の画素数と比較して、画素値”1”の画素が垂直方向に連続する数がそれ以下の場合には、その画素は消去され、画素値”0”となる。この所定の画素数としては、垂直縮小処理において、斜めのエッジを消去し垂直エッジを残す大きさの画素数を適用する。
【0016】
次に、ステップS4において、垂直エッジ画像に対し所定のテンプレートサイズの領域を所定の位置で(または所定の間隔を置いて)走査し、その位置(アドレス)における垂直エッジ画素数を計数し、その垂直エッジ画素数を保存する。
次に、ステップS5において、垂直エッジ画素数が多い順番に前述の位置を並べ替えて(ソートし)、その位置列を垂直位置列として保存する。
【0017】
以上、図1において、基準画像に対する水平微分処理(S1)から始まる処理過程について説明した。次に、それ同様であるが、基準画像に対する垂直微分処理(S6)から始まる処理過程について説明する。
まず、図1のステップS6において、基準画像に対して垂直微分処理を行う。この垂直微分処理は、基準画像において垂直方向(列方向)に画素を辿るとき(関連付けるとき)、画素値を画素の位置の関数値と見做して微分係数を演算する処理である。実際は、ディジタル画像であるから、差分を演算することである。また、ここでは差分の符号の正負を区別する意味がないから差分の絶対値が演算される。この垂直微分処理を基準画像の全体に対して行うと垂直差分画像が得られる。
【0018】
この垂直微分処理により得られる垂直差分画像は、基準画像において垂直方向の画素値の変化が大きい部分は差分の絶対値が大きく、その画素値の変化が小さい部分は差分の絶対値が小さくなる。すなわち、垂直差分画像は基準画像における水平方向(行方向)のエッジが強調された画像である。図1の▲6▼に模式的に示すように、完全な水平方向のエッジでなくても、斜めのエッジでその成分を含んでいる場合には、それなりに差分の絶対値が得られるためエッジが強調される。
【0019】
次に、ステップS7において、垂直差分画像を2値化し垂直2値化差分画像を得る。この2値化を行う場合の閾値(境界値)の決定方法によって本発明は限定されない。たとえば、多変量解析における判別分析を閾値決定に適用した判別分析法、画像の画素値ヒストグラムにおける谷に対応する画素値を閾値とするモード法、等を適用することができる。この垂直2値化差分画像は、画素値において画像を2つの部分に区分することができる。すなわち、絵柄の部分(たとえば画素値を”1”とする)と背景の部分(たとえば画素値を”0”とする)の2つの部分である。
【0020】
次に、ステップS8において、垂直2値化差分画像に対し水平縮小処理を行い水平エッジ画像を得る。この水平縮小処理は、垂直2値化差分画像において水平方向(行方向)に画素を辿るとき(関連付けるとき)、絵柄の部分(たとえば画素値を”1”とする)の画素が所定の画素数を超えて連続していない場合には、そこを背景の部分(画素値を”0”とする)に置き換える処理である。すなわち、所定の画素数と比較して、画素値”1”の画素が垂直方向に連続する数がそれ以下の場合には、その画素は消去され、画素値”0”となる。この所定の画素数としては、水平縮小処理において、斜めのエッジを消去し水平エッジを残す大きさの画素数を適用する。
【0021】
次に、ステップS9において、水平エッジ画像に対し所定のテンプレートサイズの領域を所定の位置で(または所定の間隔を置いて)走査し、その位置(アドレス)における水平エッジ画素数を計数し、その水平エッジ画素数を保存する。
次に、ステップS10において、水平エッジ画素数が多い順番に前述の位置を並べ替えて(ソートし)、その位置列を水平位置列として保存する。
【0022】
以上、図1において、基準画像に対する垂直微分処理(S6)から始まる処理過程について説明した。次に、実際に用いるべきテンプレートの位置(アドレス)を決定する処理(ステップS11)について説明する。
ステップS11において、垂直エッジ画素数が多い順番の垂直位置列と、水平エッジ画素数が多い順番の水平位置列とにおいて、垂直エッジ画素数または水平エッジ画素数のいずれかが多い順番にテンプレートの位置を比較する。そして、最初に現れる共通の位置をテンプレートの位置として選択する。
【0023】
より具体的に説明すると、垂直位置列と水平位置列における第1列(先頭列)の位置を比較する。同じ位置であれば、その位置をテンプレートの位置として選択する。同じ位置でなければ、垂直位置列と水平位置列における第1列(先頭列)と第2列の位置を比較する。その第1列(先頭列)と第2列に共通の位置が含まれていれば、その位置をテンプレートの位置として選択する。共通の位置が含まれていなければ、垂直位置列と水平位置列における第1列(先頭列)から第3列の位置を比較する。その第1列(先頭列)から第3列に共通の位置が含まれていれば、その位置をテンプレートの位置として選択する。共通の位置が含まれていなければ、垂直位置列と水平位置列における第1列(先頭列)から第4列の位置を比較する。その第1列(先頭列)から第4列に共通の位置が含まれていれば、その位置をテンプレートの位置として選択する。というように、共通の位置が含まれているところまで比較を続ける。
【0024】
以上、テンプレート設定方法の実施の形態について一例を挙げて説明した。上述において、水平微分処理(S1)、垂直微分処理(S6)、2値化(S2,S7)は、エッジ抽出過程(請求項)の一例である。また、垂直縮小処理(S3)、水平縮小処理(S8)、エッジ画素数保存(S4,S9)、アドレス列作成(S5,S10)、テンプレートアドレス設定(S11)は、領域選択過程(請求項)の一例である。
【0025】
次に、上述の実施の形態について変形例(その1)を説明する。上述のテンプレートアドレス設定(S11)において選択されたテンプレートの位置において、位置ずれ補正領域内に類似絵柄が存在する場合には、その類似絵柄の近辺で一致度が極大となり本物絵柄と取り違えて位置ずれ量を演算する恐れがある。そこで、テンプレートアドレス設定(S11)において、位置ずれ補正領域内に類似絵柄がない領域をテンプレートとして選択するようにする。
【0026】
そのため、類似絵柄の有無をチェックする処理を行う。上述のテンプレートアドレス設定(S11)において選択されたテンプレートを適用し、位置ずれ補正領域内において、そのテンプレートと基準画像との位置を相対的に変化しテンプレートマッチングを行う。位置ずれ補正領域内に類似絵柄が存在しない場合には、一個所においてだけ一致度が極大となる。たとえば、一致度の評価値を相関係数とすると、そのままのテンプレートの位置(基準位置;本物絵柄の位置)において相関係数は極大値かつ最大値であり、当然、”1”となる。
【0027】
位置ずれ補正領域内に類似絵柄が存在する場合には、複数個所において一致度が極大となる。たとえば、一致度の評価値を相関係数とすると、類似絵柄の位置において、”1”よりも小さい極大値となる。そこで、所定の閾値を設定し、複数箇所において一致度が極大となった場合に、その所定の閾値よりも一致度が高い場合には、そのテンプレートは不適当として、実際に用いるべきテンプレートから除外する処理を行う。たとえば、相関係数が”0.7”以上の極大値が2つ以上存在する場合には、そのテンプレートを除外する。この閾値は、検査対象物が正規のもの(良品)であるときの相関係数の下限よりも小さな値となるように設定する。
【0028】
上述のテンプレートアドレス設定(S11)において選択されたテンプレートの領域に対して、類似絵柄の有無をチェックする前述の処理を行う。そして、類似絵柄が存在する場合には、そのテンプレートを除外し、上述のテンプレートアドレス設定(S11)をさらに継続する。そして、選択されたテンプレートの領域に類似絵柄が存在しない場合に、そのテンプレートを実際に用いるべきテンプレートとする。
【0029】
次に、上述の実施の形態について変形例(その2)を説明する。上述のテンプレートアドレス設定(S11)において選択されたテンプレートの位置において、テンプレートのサイズを小さくすることができると、一致度の演算において演算量が縮小されるため検査速度を高速化することができる。すなわち、所定方向のエッジが密接して存在する領域を選択するとテンプレートのサイズは小さくて済む。そこで、テンプレートアドレス設定(S11)において、前述の所定方向のエッジが連結している領域をテンプレートとして選択するようにする。
【0030】
そのため、所定方向のエッジが連結している領域であるか否かをチェックする処理を行う。上述のテンプレートアドレス設定(S11)において選択されたテンプレートを適用し、そのテンプレート領域の垂直エッジ画像と水平エッジ画像について、共通する画素が存在するか否かを判定する。たとえば、絵柄(エッジ)の部分の画素値を”1”とし、背景の部分の画素値を”0”とする。そのとき、垂直エッジ画像と水平エッジ画像について、対応する画素ごとに、論理演算の”AND”を実施すると。共通する画素の画像としてエッジ共通部分画像を得ることができる。
【0031】
このエッジ共通部分画像において、エッジの共通部分を示す画素値が”1”の部分が存在する場合には、垂直エッジ画像と水平エッジ画像とは連結していることになる。なお、連結しているか否かの判定は上述の方法に限らない。たとえば、2値画像処理における連結数(connectivity number)を演算して判定してもよい。
【0032】
上述のテンプレートアドレス設定(S11)において選択されたテンプレートの領域に対して、連結しているか否かをチェックする前述の処理を行う。そして、連結していない場合には、そのテンプレートを除外し、上述のテンプレートアドレス設定(S11)をさらに継続する。そして、選択されたテンプレートの領域において垂直エッジ画像と水平エッジ画像とが連結している場合に、そのテンプレートを実際に用いるべきテンプレートの原型とする。
【0033】
そして、その実際に用いるべきテンプレートの原型について領域を縮小する処理を行う。たとえば、エッジ共通部分画像において、エッジの共通部分を示す画素値が”1”の部分を包み込む所定の大きさの領域としてテンプレートの領域を縮小する。その縮小したテンプレートを実際に用いるべきテンプレートとする。
【0034】
【発明の効果】
以上のとおりであるから、本発明の請求項1に係るテンプレート設定方法によれば、位置ずれ量を演算するためのテンプレートとして、高精度と安定性を得ることができる適切なテンプレートが設定される。
また、本発明の請求項2に係るテンプレート設定方法によれば、一致度の演算において演算量が縮小されるため検査速度を高速化することができる。
また、本発明の請求項3に係るテンプレート設定方法によれば、特に顕著な高精度と安定性を得ることができる適切なテンプレートが設定される。
また、本発明の請求項4に係るテンプレート設定方法によれば、類似絵柄と本物絵柄とを取り違えて位置ずれ量を演算する誤りを回避することができる。
【図面の簡単な説明】
【図1】本発明のテンプレート設定方法におけるデータ処理の過程を示す図である。[0001]
BACKGROUND OF THE INVENTION
The present invention belongs to the technical field of setting a template in template matching. In particular, the present invention relates to a template setting method for setting a template for detecting a positional deviation amount between a reference image and an inspection target image in a printed matter inspection apparatus.
[0002]
[Prior art]
2. Description of the Related Art There has been known a printed matter inspection apparatus that compares a reference image that is a captured image of a printed matter that is an inspection reference and an inspection target image that is a captured image that is an inspection target to inspect the quality of the printed matter. In this type of inspection apparatus, when there is a positional deviation between the reference image and the inspection target image, if the two are compared as they are, a malfunction may occur in which a non-defective printed matter is determined as a defective product. In order to avoid this malfunction, the inspection level (inspection level) must be lowered accordingly. Therefore, in order to improve the inspection performance in this inspection apparatus, the positional deviation between the reference image and the inspection target image is corrected and compared.
[0003]
In order to correct this misregistration, it is necessary to acquire the misregistration amount. For this purpose, template matching (pattern matching) is calculated. For example, the degree of coincidence is calculated by changing the relative positions of the reference image and the inspection target image, and the positional deviation amount is acquired based on the relative position having the highest degree of coincidence.
[0004]
[Problems to be solved by the invention]
However, if the degree of coincidence is calculated by considering almost the entire area of the image as a template, the amount of calculation becomes enormous. In addition, since inspection is normally performed in-line on a printing machine or the like that operates at high speed, it is difficult to realize an inspection device due to time constraints. Therefore, if it can be assumed that the inspection target article has no distortion such as expansion and contraction like a printed matter, the amount of positional deviation is constant regardless of the location. Therefore, even if a part of the image is considered as a template and calculated, it is possible to obtain a result that matches the total amount of displacement.
[0005]
Thus, if a part of the image is calculated as a template, the amount of calculation is reduced, and the degree of coincidence can be calculated at high speed. However, in order to obtain high accuracy and stability equivalent to the case where almost the entire area of the image is used as a template, the selection of the template setting location is crucial. If the template contains only a solid part of the pattern or an edge component in one direction of the pattern, the correction is definitely made.
[0006]
The present invention has been made to solve the above problems. The purpose is to set an appropriate template capable of obtaining high accuracy and stability as a template for calculating the positional deviation amount.
[0007]
[Means for Solving the Problems]
The above problems are solved by the present invention described below. In other words, the template setting method according to the first aspect of the present invention provides an edge extraction process for extracting an edge in a reference image obtained by imaging a printed matter serving as an inspection reference, and predetermined edges for at least two edges in a predetermined direction. Count the number of edge pixels in the template size area at the position, create a position sequence in which the position of the template size area is rearranged in the order of the number of edge pixels in each edge direction, in each edge direction position sequence Comparing the position of the template size region in the order of the number of edge pixels in either direction, and selecting the region of the reference image at the position of the common template size region that appears first as a template. It is what you have. According to the present invention, edges are extracted from a reference image obtained by imaging a printed matter that is an inspection reference in the edge extraction process, and the number of edge pixels in at least two predetermined directions in the template size area is large in the area selection process. The positions of the templates are compared in order, and the region of the reference image that appears first at the common position is selected as the template. That is, since the selected template is an area including many edges in two predetermined directions, the degree of coincidence changes greatly with respect to a two-dimensional change in relative position. Therefore, an appropriate template capable of obtaining high accuracy and stability is set as a template for calculating the positional deviation amount.
[0008]
The template setting method according to claim 2 of the present invention is the template setting method according to claim 1, wherein the region selection step is a step of selecting, as a template, a region where edges in the predetermined direction are connected. It is what I did. According to the present invention, the selected template is an area where edges in a predetermined direction are connected. That is, since the edges in the predetermined direction are closely present, the area size can be small. Therefore, since the amount of calculation is reduced in the calculation of the degree of coincidence, the inspection speed can be increased.
[0009]
The template setting method according to a third aspect of the present invention is the template setting method according to the first or second aspect, wherein the region selection step removes an edge other than the predetermined direction, and then removes the edge in the predetermined direction. This is a process of selecting a region of the reference image including many as a template. According to the present invention, edges other than the predetermined direction are removed from the selected template. Therefore, an appropriate template that can obtain particularly high precision and stability is set.
[0010]
A template setting method according to a fourth aspect of the present invention is the template setting method according to any one of the first to third aspects, wherein the region selection step uses a region having no similar pattern in the misalignment correction region as a template. It is a process of selecting. The misregistration correction area is a range in which the degree of coincidence is calculated by changing the relative position between the template and the image. In other words, if a similar pattern exists in the misregistration correction area, the degree of coincidence is maximized in the vicinity of the similar pattern, and there is a possibility that the misregistration is calculated as a real pattern. Therefore, according to the present invention, it is possible to avoid an error in calculating a misregistration amount by mistaking a similar design and a real design.
[0011]
DETAILED DESCRIPTION OF THE INVENTION
Next, embodiments of the present invention will be described. The process of data processing in the template setting method of the present invention is shown in FIG. In FIG. 1, a reference image is an image obtained by imaging an article (for example, a printed matter) that is a reference for inspection. This reference image is stored in advance in a storage device of a data processing system to which the template setting method of the present invention is applied.
[0012]
First, in step S1 of FIG. 1, a horizontal differentiation process is performed on the reference image. This horizontal differentiation process is a process of calculating a differential coefficient by considering a pixel value as a function value of a pixel position when tracing a pixel in the horizontal direction (row direction) in the reference image (when associating). Since it is actually a digital image, the difference is calculated. Here, since there is no significance in distinguishing the sign of the difference, the absolute value of the difference is calculated. When this horizontal differentiation process is performed on the entire reference image, a horizontal difference image is obtained.
[0013]
In the horizontal difference image obtained by the horizontal differentiation process, the absolute value of the difference is large in the portion where the change in the pixel value in the horizontal direction is large in the reference image, and the absolute value of the difference is small in the portion where the change in the pixel value is small. That is, the horizontal difference image is an image in which the edge in the vertical direction (column direction) in the reference image is emphasized. As schematically shown in (1) in FIG. 1, even if the edge is not a complete vertical edge, if the component is included in an oblique edge, the absolute value of the difference is obtained as it is. Is emphasized.
[0014]
Next, in step S2, the horizontal difference image is binarized to obtain a horizontal binarized difference image. The present invention is not limited by the method of determining the threshold value (boundary value) when performing binarization. For example, a discriminant analysis method in which discriminant analysis in multivariate analysis is applied to threshold determination, a mode method in which pixel values corresponding to valleys in a pixel value histogram of an image are used as threshold values, and the like can be applied. This horizontal binarized difference image can divide the image into two parts based on pixel values. That is, there are two parts: a picture part (for example, pixel value “1”) and a background part (for example, pixel value “0”).
[0015]
Next, in step S3, vertical reduction processing is performed on the horizontal binarized differential image to obtain a vertical edge image. In this vertical reduction process, when pixels are traced in the vertical direction (column direction) in the horizontal binarized difference image (when they are associated), the number of pixels in the pattern portion (for example, the pixel value is “1”) is a predetermined number of pixels. Is not continuous, it is a process of replacing it with a background portion (pixel value is set to “0”). That is, when the number of pixels having a pixel value “1” continuous in the vertical direction is less than the predetermined number of pixels, the pixel is erased and has a pixel value “0”. As the predetermined number of pixels, in the vertical reduction process, the number of pixels having a size that eliminates the oblique edges and leaves the vertical edges is applied.
[0016]
Next, in step S4, the vertical edge image is scanned with a predetermined template size area at a predetermined position (or at a predetermined interval), and the number of vertical edge pixels at that position (address) is counted. Save the number of vertical edge pixels.
Next, in step S5, the aforementioned positions are rearranged (sorted) in the order of the number of vertical edge pixels, and the position string is stored as a vertical position string.
[0017]
The processing process starting from the horizontal differentiation process (S1) for the reference image has been described above with reference to FIG. Next, although it is the same, the process starting from the vertical differentiation process (S6) for the reference image will be described.
First, in step S6 in FIG. 1, vertical differentiation processing is performed on the reference image. This vertical differentiation process is a process of calculating a differential coefficient by considering a pixel value as a function value of a pixel position when tracing (associating) a pixel in the vertical direction (column direction) in the reference image. Since it is actually a digital image, the difference is calculated. Here, since there is no significance in distinguishing the sign of the difference, the absolute value of the difference is calculated. When this vertical differentiation process is performed on the entire reference image, a vertical difference image is obtained.
[0018]
In the vertical difference image obtained by this vertical differentiation process, the absolute value of the difference is large in the portion where the change in the pixel value in the vertical direction is large in the reference image, and the absolute value of the difference is small in the portion where the change in the pixel value is small. That is, the vertical difference image is an image in which the edge in the horizontal direction (row direction) in the reference image is emphasized. As schematically shown in (6) of FIG. 1, even if the edge is not a complete horizontal edge, if the component is included in an oblique edge, the absolute value of the difference is obtained as it is, so that the edge is obtained. Is emphasized.
[0019]
Next, in step S7, the vertical difference image is binarized to obtain a vertical binarized difference image. The present invention is not limited by the method of determining the threshold value (boundary value) when performing binarization. For example, a discriminant analysis method in which discriminant analysis in multivariate analysis is applied to threshold determination, a mode method in which pixel values corresponding to valleys in a pixel value histogram of an image are used as threshold values, and the like can be applied. This vertical binarized difference image can divide the image into two parts based on pixel values. That is, there are two parts: a picture part (for example, pixel value “1”) and a background part (for example, pixel value “0”).
[0020]
Next, in step S8, horizontal reduction processing is performed on the vertical binary difference image to obtain a horizontal edge image. In this horizontal reduction process, when pixels are traced in the horizontal direction (row direction) in the vertical binarized difference image (when they are associated), the picture portion (for example, the pixel value is set to “1”) has a predetermined number of pixels. Is not continuous, it is a process of replacing it with a background portion (pixel value is set to “0”). That is, when the number of pixels having a pixel value “1” continuous in the vertical direction is less than the predetermined number of pixels, the pixel is erased and has a pixel value “0”. As the predetermined number of pixels, in the horizontal reduction process, the number of pixels having a size that eliminates the oblique edges and leaves the horizontal edges is applied.
[0021]
Next, in step S9, a region having a predetermined template size is scanned at a predetermined position (or at a predetermined interval) on the horizontal edge image, and the number of horizontal edge pixels at the position (address) is counted. Save the number of horizontal edge pixels.
Next, in step S10, the above-mentioned positions are rearranged (sorted) in the order of the number of horizontal edge pixels, and the position string is stored as a horizontal position string.
[0022]
The processing process starting from the vertical differentiation process (S6) for the reference image has been described above with reference to FIG. Next, the process (step S11) for determining the position (address) of the template to be actually used will be described.
In step S11, in the vertical position sequence in the order of the number of vertical edge pixels and the horizontal position sequence in the order of the number of horizontal edge pixels, the position of the template in the order of which the number of vertical edge pixels or the number of horizontal edge pixels is larger. Compare Then, the common position that appears first is selected as the template position.
[0023]
More specifically, the positions of the first column (first column) in the vertical position column and the horizontal position column are compared. If it is the same position, that position is selected as the template position. If not the same position, the positions of the first column (first column) and the second column in the vertical position column and the horizontal position column are compared. If a common position is included in the first column (first column) and the second column, that position is selected as the template position. If the common position is not included, the positions of the first column (first column) to the third column in the vertical position column and the horizontal position column are compared. If a common position is included in the first column (first column) to the third column, that position is selected as the template position. If the common position is not included, the positions of the first column (first column) to the fourth column in the vertical position column and the horizontal position column are compared. If a common position is included in the first column (first column) to the fourth column, that position is selected as the template position. Thus, the comparison is continued until a common position is included.
[0024]
The embodiment of the template setting method has been described above with an example. In the above description, the horizontal differentiation process (S1), the vertical differentiation process (S6), and the binarization (S2, S7) are examples of the edge extraction process (claims). The vertical reduction process (S3), horizontal reduction process (S8), edge pixel number storage (S4, S9), address string creation (S5, S10), template address setting (S11) are the region selection process (claims). It is an example.
[0025]
Next, a modification example (1) of the above-described embodiment will be described. In the position of the template selected in the template address setting (S11) described above, when a similar pattern exists in the misalignment correction area, the degree of coincidence becomes maximum in the vicinity of the similar pattern and misplaces the real pattern. There is a risk of calculating the quantity. Therefore, in the template address setting (S11), an area having no similar pattern in the misalignment correction area is selected as a template.
[0026]
Therefore, a process for checking the presence or absence of a similar pattern is performed. The template selected in the template address setting (S11) described above is applied, and the template matching is performed by relatively changing the positions of the template and the reference image within the misalignment correction region. When a similar pattern does not exist in the misalignment correction area, the degree of coincidence becomes maximum only at one place. For example, if the evaluation value of the degree of coincidence is a correlation coefficient, the correlation coefficient is a maximum value and a maximum value at the template position (reference position; real picture position) as it is, and is naturally “1”.
[0027]
When similar patterns exist in the misalignment correction area, the degree of coincidence becomes maximum at a plurality of locations. For example, when the evaluation value of the degree of coincidence is a correlation coefficient, the maximum value is smaller than “1” at the position of the similar pattern. Therefore, when a predetermined threshold is set and the degree of coincidence is maximal at a plurality of locations, and the degree of coincidence is higher than the predetermined threshold, the template is inappropriate and excluded from the template to be actually used. Perform the process. For example, if there are two or more maximum values having a correlation coefficient of “0.7” or more, the template is excluded. This threshold value is set to be a value smaller than the lower limit of the correlation coefficient when the inspection object is a regular one (non-defective product).
[0028]
For the template area selected in the template address setting (S11) described above, the above-described processing for checking the presence or absence of a similar pattern is performed. If a similar pattern exists, the template is excluded, and the above-described template address setting (S11) is further continued. When a similar pattern does not exist in the selected template area, the template is set as a template to be actually used.
[0029]
Next, a modified example (No. 2) of the above-described embodiment will be described. If the template size can be reduced at the template position selected in the template address setting (S11) described above, the amount of calculation is reduced in the calculation of the degree of coincidence, so that the inspection speed can be increased. That is, if an area where edges in a predetermined direction are closely present is selected, the template size can be reduced. Therefore, in the template address setting (S11), the region where the edges in the predetermined direction are connected is selected as a template.
[0030]
Therefore, a process for checking whether or not the edge in the predetermined direction is a connected region is performed. The template selected in the template address setting (S11) described above is applied, and it is determined whether or not there is a common pixel for the vertical edge image and the horizontal edge image in the template area. For example, the pixel value of the pattern (edge) portion is “1”, and the pixel value of the background portion is “0”. At that time, if the logical operation “AND” is performed for each corresponding pixel in the vertical edge image and the horizontal edge image. An edge common partial image can be obtained as an image of common pixels.
[0031]
In the edge common portion image, when there is a portion having a pixel value “1” indicating the common portion of the edge, the vertical edge image and the horizontal edge image are connected. Note that the determination of whether or not they are connected is not limited to the method described above. For example, the determination may be made by calculating the connectivity number in binary image processing.
[0032]
The above-described processing for checking whether or not the template area selected in the template address setting (S11) is linked is performed. If not connected, the template is excluded, and the above-described template address setting (S11) is further continued. Then, when the vertical edge image and the horizontal edge image are connected in the selected template region, the template is used as a template prototype to be actually used.
[0033]
Then, a process for reducing the area of the original template to be actually used is performed. For example, in the edge common portion image, the template region is reduced as a region having a predetermined size that wraps around a portion having a pixel value “1” indicating the common portion of the edge. The reduced template is set as a template to be actually used.
[0034]
【The invention's effect】
As described above, according to the template setting method according to claim 1 of the present invention, an appropriate template capable of obtaining high accuracy and stability is set as a template for calculating the positional deviation amount. .
Further, according to the template setting method of the second aspect of the present invention, the calculation amount is reduced in the calculation of the degree of coincidence, so that the inspection speed can be increased.
Further, according to the template setting method of the third aspect of the present invention, an appropriate template that can obtain particularly high precision and stability is set.
Further, according to the template setting method according to claim 4 of the present invention, it is possible to avoid an error in miscalculating a misalignment between a similar pattern and a real pattern.
[Brief description of the drawings]
FIG. 1 is a diagram showing a data processing process in a template setting method of the present invention.
Claims (4)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP36011499A JP4467690B2 (en) | 1999-12-20 | 1999-12-20 | Template setting method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP36011499A JP4467690B2 (en) | 1999-12-20 | 1999-12-20 | Template setting method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2001175861A JP2001175861A (en) | 2001-06-29 |
| JP4467690B2 true JP4467690B2 (en) | 2010-05-26 |
Family
ID=18467969
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP36011499A Expired - Fee Related JP4467690B2 (en) | 1999-12-20 | 1999-12-20 | Template setting method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP4467690B2 (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5709255B2 (en) * | 2011-04-05 | 2015-04-30 | 株式会社日立国際電気 | Image processing method and monitoring apparatus |
| JP6859944B2 (en) * | 2017-12-25 | 2021-04-14 | 株式会社島津製作所 | Scanning electron microscope and control program |
-
1999
- 1999-12-20 JP JP36011499A patent/JP4467690B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2001175861A (en) | 2001-06-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111474184B (en) | AOI character defect detection method and device based on industrial machine vision | |
| US6778703B1 (en) | Form recognition using reference areas | |
| CN107633192B (en) | A method of barcode segmentation and reading in complex background based on machine vision | |
| JP2021180309A (en) | Real-time automatic detection method of 2D PCB appearance defects based on deep learning | |
| CN110047063B (en) | Material drop detection method, device, equipment and storage medium | |
| US20010028732A1 (en) | Method and system for detecting defects on a printed circuit board | |
| US6493079B1 (en) | System and method for machine vision analysis of an object using a reduced number of cameras | |
| CN111354026A (en) | Improved train image accurate registration method and system based on SURF (speeded up robust features) | |
| CN115375629B (en) | Line defect detection and defect information extraction method for LCD screen | |
| CN114972575A (en) | A Line Fitting Algorithm Based on Contour Edge | |
| CN116433666A (en) | Method, system, electronic device and storage medium for online defect identification of board circuit | |
| CN115631128B (en) | Round medicine quantity detection method based on round power theorem | |
| CN119477929A (en) | A method and system for identifying surface defects of wood composite board furniture | |
| CN116416268A (en) | Method and device for detecting edge position of lithium battery pole piece based on recursion dichotomy | |
| CN114187363A (en) | A method, device and mobile terminal for obtaining radial distortion parameter value | |
| CN110288040B (en) | Image similarity judging method and device based on topology verification | |
| CN114847982B (en) | A method for fusion processing of multiple follow-up images of COVID-19 patients | |
| JP4467690B2 (en) | Template setting method | |
| CN119359538B (en) | Image stitching method, computer readable storage medium and computer program product | |
| CN112270323B (en) | Intelligent medical re-examination control methods, systems, media, computer equipment and applications | |
| CN112923852B (en) | SD card pose detection method based on dynamic corner positioning | |
| CN120087390A (en) | Slide scanning barcode recognition optimization method, device and readable storage medium thereof | |
| CN119741716A (en) | Wafer image detection method and device, electronic equipment and storage medium | |
| CN117805142A (en) | Defect detection method, defect detection apparatus, and computer-readable storage medium | |
| JP2005250786A (en) | Image recognition method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20061027 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20090828 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090908 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20091105 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20091201 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20100122 |
|
| 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: 20100216 |
|
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20100224 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 4467690 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130305 Year of fee payment: 3 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130305 Year of fee payment: 3 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140305 Year of fee payment: 4 |
|
| LAPS | Cancellation because of no payment of annual fees |