JPH1027246A - Picture processing method - Google Patents

Picture processing method

Info

Publication number
JPH1027246A
JPH1027246A JP8180998A JP18099896A JPH1027246A JP H1027246 A JPH1027246 A JP H1027246A JP 8180998 A JP8180998 A JP 8180998A JP 18099896 A JP18099896 A JP 18099896A JP H1027246 A JPH1027246 A JP H1027246A
Authority
JP
Japan
Prior art keywords
image
target
target image
template
inspection
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.)
Granted
Application number
JP8180998A
Other languages
Japanese (ja)
Other versions
JP3823379B2 (en
Inventor
Kazutaka Ikeda
和隆 池田
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 JP18099896A priority Critical patent/JP3823379B2/en
Publication of JPH1027246A publication Critical patent/JPH1027246A/en
Application granted granted Critical
Publication of JP3823379B2 publication Critical patent/JP3823379B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/146Aligning or centring of the image pick-up or image-field
    • G06V30/1475Inclination or skew detection or correction of characters or of image to be recognised
    • G06V30/1478Inclination or skew detection or correction of characters or of image to be recognised of characters or characters lines

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

PROBLEM TO BE SOLVED: To accurately align positions at the time of aligning an objective picture and a template picture. SOLUTION: Continuous areas d1 to d4 , D1 to D4 for an objective picture (s) and a template picture T are respectively found out and the positions of centers of gravity g1 to g4 , G1 to G4 in respective continuous areas d1 to d4 , D1 to D4 are found out. A regression straight line(RSL) is found out from the array of the centers of gravity g1 to g4 and an angle θ between the found RSL and an RSL obtained from the array of centers of gravity G1 to G4 . The RSL of the template picture T is rotated around the intersection (c) of both the RSLs only by the angle θ so as to be superposed to the RSL of the objective picture (s). Then the representative point (middle point) M of the picture T is moved in parallel so as to be superposed to the the representative point (middle point) m of the picture (s). The angle θ and the moving distances of the representative points become a relative position between the objective picture (s) and the template picture T.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、画像内に設定した
検査領域に画像処理技術を適用することによって特定情
報を得るようにした画像処理方法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image processing method for obtaining specific information by applying an image processing technique to an inspection area set in an image.

【0002】[0002]

【従来の技術】従来より、検査対象を含む対象画像とテ
ンプレート画像とを照合して類似度を検査することによ
って、検査対象を類別したり検査対象の良否を判定した
りすることが考えられている。ところで、対象画像はT
Vカメラなどの画像入力装置を用いて対象物を撮像する
ことにより得ることが多く、テンプレート画像に対して
傾き(回転変位)や縦横方向へのずれ(平行変位)を伴
うのが普通であって、そのままの状態では対象画像とテ
ンプレート画像とを照合することはできない。つまり、
対象画像とテンプレート画像との回転変位や平行変位を
補正するような処理が必要になる。
2. Description of the Related Art Conventionally, it has been considered that a target image including an inspection target is collated with a template image and a similarity is inspected to classify the inspection target or to judge the quality of the inspection target. I have. By the way, the target image is T
It is often obtained by imaging an object using an image input device such as a V-camera, and is usually accompanied by inclination (rotational displacement) and vertical and horizontal displacement (parallel displacement) with respect to the template image. On the other hand, the target image and the template image cannot be compared as they are. That is,
Processing for correcting the rotational displacement and the parallel displacement between the target image and the template image is required.

【0003】この種の処理としては、たとえば図9に示
すように、対象画像sの特徴部分(ここでは枠の角部)
を含む特定の1〜2箇所のマッチング領域DMを設定
し、マッチング領域DMについてパターンマッチングを
行なうことによって、対象画像sの位置をテンプレート
画像に合わせることが考えられている。ところで、上述
のように対象画像sとテンプレート画像とを照合する際
には、対象画像sの一部分に設定した検査領域daにつ
いてテンプレート画像との照合を行なうことが多い。い
ま、検査領域daが製造年月日を検査対象として含むも
のであって、製造年月日の間違いや他の製造年月日の混
入などを検査するためにテンプレート画像を用いるもの
とすれば、検査しようとする製造年月日ごとにテンプレ
ート画像を作成し、かつマッチング領域DMに関する情
報を手入力することが必要になる。したがって、テンプ
レート画像の種類が多くなるとテンプレート画像の作成
が非常に面倒になる。また、製造年月日はつねに同じ位
置に捺印されるとは限らず、マッチング領域DMに対し
て検査対象の位置がずれ、検査対象が実際にはテンプレ
ート画像の内容に一致するものであってもテンプレート
画像との位置がずれて不一致と判断されることがある。
しかも、テンプレート画像との位置を合わせるために対
象画像は特徴部分を有する形状に限定されることにな
り、製造年月日などを検査対象にするためには文字を囲
む枠取りが必要になったりする。
As this type of processing, for example, as shown in FIG. 9, a characteristic portion of a target image s (here, a corner of a frame)
It is conceived that the position of the target image s is matched with the template image by setting one or two specific matching regions DM including the following, and performing pattern matching on the matching region DM. By the way, when the target image s and the template image are collated as described above, the collation with the template image is often performed for the inspection area da set in a part of the target image s. Now, if the inspection area da includes the date of manufacture as an inspection target, and a template image is used to inspect a mistake in the date of manufacture or mixing of another date of manufacture, etc., It is necessary to create a template image for each manufacturing date to be inspected and manually input information on the matching area DM. Therefore, when the types of template images increase, the creation of template images becomes very troublesome. Further, the date of manufacture is not always stamped at the same position, and even if the position of the inspection target is shifted with respect to the matching area DM and the inspection target actually matches the contents of the template image. In some cases, the position of the template image is deviated from the position of the template image, and thus it is determined that they do not match.
In addition, the target image is limited to a shape having a characteristic portion in order to match the position with the template image, and a frame surrounding the character is required to make the manufacturing date and the like an inspection target. I do.

【0004】一方、特開平1−220075号公報に記
載された方法のように、検査対象のおおよその重心の位
置を求めるとともに全体の傾きを求め、検査対象の全体
の重心の位置および全体の傾きに基づいて検査対象の位
置を補正する方法が提案されている。この方法を採用す
れば、テンプレート画像にマッチング領域DMの情報を
含める必要がなくテンプレート画像の作成は容易にな
る。
On the other hand, as in the method described in Japanese Patent Application Laid-Open No. 1220075/1990, the position of the approximate center of gravity of the inspection object is determined and the overall inclination is determined. There has been proposed a method of correcting the position of the inspection target based on the above. By employing this method, it is not necessary to include the information of the matching area DM in the template image, and the creation of the template image is facilitated.

【0005】[0005]

【発明が解決しようとする課題】しかしながら、上記公
報に記載された方法は、検査対象の全体の重心を一度の
処理で求めるものであるから、検査対象以外のノイズ成
分を除去するために検査領域を適正に設定しておくこと
が必要であり、検査領域内にノイズ成分が含まれている
と除去する手立てがなく、求めた重心位置の信頼性が低
いという問題がある。同様に、検査対象の傾きについて
もノイズ成分の影響を受けやすいという問題がある。
However, since the method described in the above publication determines the center of gravity of the entire inspection target in one process, the inspection area is used to remove noise components other than the inspection target. Needs to be set appropriately, and there is no way to remove noise components in the inspection area, and there is a problem that the reliability of the calculated center of gravity is low. Similarly, there is a problem that the inclination of the inspection target is easily affected by the noise component.

【0006】本発明は上記事由に鑑みて為されたもので
あり、その目的は、対象画像とテンプレート画像との位
置合わせに際してノイズ成分の影響を受けにくく、精度
よく位置を合わせることができるようにした画像処理方
法を提供することにある。
The present invention has been made in view of the above circumstances, and an object of the present invention is to make it possible to align a target image and a template image with each other without being affected by a noise component and to adjust the position with high accuracy. To provide an improved image processing method.

【0007】[0007]

【課題を解決するための手段】請求項1の発明は、上記
目的を達成するために、画像入力装置より入力された対
象画像とあらかじめ登録されているテンプレート画像と
を照合することにより対象画像とテンプレート画像との
類似度を検査する画像処理方法において、対象画像は一
集まりの画素群として扱うことができる連続領域を複数
個含むとともに各連続領域の重心がほぼ一直線上に並ぶ
画像であって、各連続領域の重心位置とこれらの重心の
並びより求められる回帰直線とを求め、テンプレート画
像の各連続領域の重心より求められる回帰直線と対象画
像から求めた回帰直線との間の角度に基づいて回転変位
を補正するとともに、テンプレート画像の各連続領域の
重心位置と対象画像から求めた各連続領域の重心との位
置関係に基づいて平行変位を補正し、テンプレート画像
において連続領域の重心位置を基準として設定してある
検査領域を対象画像に設定するのである。
According to a first aspect of the present invention, in order to achieve the above object, a target image input from an image input device is collated with a pre-registered template image to match the target image. In the image processing method for inspecting the similarity with the template image, the target image is an image including a plurality of continuous regions that can be treated as a group of pixels and the center of gravity of each continuous region is substantially aligned, The regression line obtained from the position of the center of gravity of each continuous region and the arrangement of these centers of gravity is obtained, and the regression line obtained from the center of gravity of each continuous region of the template image and the angle between the regression line obtained from the target image are obtained. While correcting the rotational displacement, based on the positional relationship between the center of gravity of each continuous region of the template image and the center of gravity of each continuous region obtained from the target image Correcting the line displacement, and sets the inspection area is set as a reference position of the center of gravity of the contiguous range in the template image in the target image.

【0008】この方法によれば、複数の連続領域を含む
対象画像について各連続領域の重心を求めるから、検査
領域をあらかじめ設定することなく対象画像内から連続
領域を見つけることで、対象画像内の所望の検査対象を
見つけることができる。この場合、ノイズ成分が含まれ
ていたとしても連続領域の大きさや個数などに基づいて
容易に除去することができる。また、対象画像の方向を
代表する直線を重心の並びにより決まる回帰直線として
いるから、対象画像の方向を再現性よく求めることがで
きる。このように、ノイズ成分を除去して対象画像の方
向を再現性よく求めることができるから、テンプレート
画像との位置合わせの精度が高くなるのである。しか
も、テンプレート画像において連続領域の重心位置を基
準として検査領域を設定しているから、対象画像におけ
る検査領域を自動的に設定することができるのである。
なお、テンプレート画像の各連続領域の重心や回帰直線
や検査領域はテンプレート画像を設定する際に同時に求
めることができるから、あらかじめテンプレート画像の
属性として登録しておくことができ、対象画像の入力時
にあらためて求める必要はない。また、検査領域につい
ては連続領域の重心位置を基準にして大きさを定めてお
けばよいのであり、製造年月日のように検査対象の内容
が変化しても検査領域の大きさが変化しないような対象
画像であれば、すべての検査対象について、同じ大きさ
の検査領域を自動的に設定することが可能になる。
According to this method, since the center of gravity of each continuous region is obtained for a target image including a plurality of continuous regions, the continuous region is found from within the target image without setting an inspection region in advance, whereby A desired test object can be found. In this case, even if a noise component is included, the noise component can be easily removed based on the size and number of continuous regions. In addition, since the straight line representing the direction of the target image is a regression line determined by the arrangement of the centers of gravity, the direction of the target image can be obtained with good reproducibility. As described above, since the direction of the target image can be obtained with good reproducibility by removing the noise component, the accuracy of the alignment with the template image is improved. Moreover, since the inspection area is set based on the position of the center of gravity of the continuous area in the template image, the inspection area in the target image can be automatically set.
Since the center of gravity, regression line, and inspection area of each continuous area of the template image can be obtained at the same time when the template image is set, it can be registered in advance as an attribute of the template image, and can be registered at the time of inputting the target image. There is no need to ask again. In addition, the size of the inspection area may be determined based on the center of gravity of the continuous area, and the size of the inspection area does not change even if the content of the inspection target changes as in the date of manufacture. With such a target image, an inspection area of the same size can be automatically set for all inspection targets.

【0009】請求項2の発明は、請求項1の発明におい
て、対象画像およびテンプレート画像を2値画像として
いる。この方法は望ましい実施態様であり、2値画像に
ついて連続領域や重心を求める処理は簡単であるから、
高速な処理が可能になる。請求項3の発明は、画像入力
装置より入力された対象画像を2値化した2値画像を生
成し、画素値の変化点を抽出する特徴抽出処理によって
2値画像から検査対象の外形線を抽出した後、検査対象
の外側に上記外形線から所定画素幅だけ離れた境界線を
設定し、上記境界線内を検査領域とするのである。
According to a second aspect of the present invention, in the first aspect, the target image and the template image are binary images. This method is a desirable embodiment, and the process of obtaining a continuous area and a center of gravity for a binary image is simple.
High-speed processing becomes possible. According to a third aspect of the present invention, the outline of the inspection target is extracted from the binary image by a feature extraction process of generating a binary image by binarizing the target image input from the image input device and extracting a change point of the pixel value. After the extraction, a boundary line separated from the outline by a predetermined pixel width is set outside the inspection target, and the inside of the boundary line is set as an inspection region.

【0010】この方法は、検査領域の望ましい設定方法
であって、検査対象の外形線に沿って検査領域の境界線
を設定し、境界線内を検査領域とするから、検査対象以
外の背景はほとんど含まれず、ノイズ成分をほとんど含
まない検査が可能になる。また、検査領域は検査対象に
応じて自動的に設定されることになるから、使用者が手
作業で検査領域を設定する必要がない。
This method is a desirable method for setting the inspection area. In this method, the boundary of the inspection area is set along the outline of the inspection object, and the inside of the boundary is used as the inspection area. It is possible to perform an inspection that is hardly included and hardly includes a noise component. In addition, since the inspection area is automatically set according to the inspection target, the user does not need to manually set the inspection area.

【0011】請求項4の発明は、画像入力装置より入力
された対象画像を微分し、微分絶対値の変化が所定値以
上になるエッジを追跡することにより対象画像から検査
対象の外形線を抽出した後、検査対象の外側に上記外形
線から所定画素幅だけ離れた境界線を設定し、上記境界
線内を検査領域とするのである。この方法は、請求項3
の発明と同様に、検査領域の望ましい設定方法であっ
て、検査対象の外形線に沿って検査領域の境界線を設定
し、境界線内を検査領域とするから、検査対象以外の背
景はほとんど含まれず、ノイズ成分をほとんど含まない
検査が可能になる。また、検査領域は検査対象に応じて
自動的に設定されることになるから、使用者が手作業で
検査領域を設定する必要がない。
According to a fourth aspect of the present invention, an outline of an inspection target is extracted from the target image by differentiating the target image input from the image input device and tracing an edge at which a change in the absolute value of the differential exceeds a predetermined value. After that, a boundary line separated from the outline by a predetermined pixel width is set outside the inspection object, and the inside of the boundary line is set as the inspection region. The method comprises:
Similarly to the invention of the above, the method for setting the inspection area is preferable, in which the boundary of the inspection area is set along the outline of the inspection object, and the inside of the boundary is the inspection area. An inspection that is not included and hardly includes a noise component becomes possible. In addition, since the inspection area is automatically set according to the inspection target, the user does not need to manually set the inspection area.

【0012】請求項5の発明は、画像入力装置より入力
された対象画像とあらかじめ登録されているテンプレー
ト画像とを照合することにより対象画像とテンプレート
画像との類似度を検査する画像処理方法において、検査
対象を含む濃淡画像の中で検査対象を囲むように設定し
た所定の検査領域内の濃度分布を求め、上記検査領域と
同じ大きさの検査領域内でテンプレート画像について求
めた濃度分布の平均値と対象画像から求めた濃度分布の
平均値との差をオフセット値とし、対象画像とテンプレ
ート画像との各画素の濃度差を画素値とする差画像の画
素値に対してあらかじめ設定してある判定範囲をオフセ
ット値分だけシフトさせ、上記差画像の各画素の画素値
がシフトさせた判定範囲を逸脱するときに対象画像とテ
ンプレート画像の不一致部分として抽出するのである。
According to a fifth aspect of the present invention, there is provided an image processing method for checking a similarity between a target image and a template image by comparing the target image input from an image input device with a template image registered in advance. A density distribution in a predetermined inspection area set so as to surround the inspection object in the grayscale image including the inspection object, and an average value of the density distribution obtained for the template image in the inspection area having the same size as the inspection area The difference between the average value of the density distribution obtained from the target image and the target image is set as an offset value, and the pixel value of the difference image in which the density difference of each pixel between the target image and the template image is set as a pixel value is determined in advance. The range is shifted by the offset value, and when the pixel value of each pixel of the difference image deviates from the shifted determination range, the target image and the template image are shifted. Than is extracted as the matching portion.

【0013】この方法は、濃度情報を含んだ状態で対象
画像とテンプレート画像との差画像を検査する際に有効
な方法であって、対象画像とテンプレート画像とをそれ
ぞれ代表する濃度値を求め、両濃度値の差をオフセット
値に用いて濃度判定のための判定範囲を補正するから、
対象画像とテンプレート画像との濃度差を補正して精度
のよい判定が可能になる。
This method is an effective method for inspecting a difference image between a target image and a template image in a state including density information, and obtains density values representing the target image and the template image, respectively. Since the difference between the two density values is used as an offset value to correct the determination range for the density determination,
Correction of the density difference between the target image and the template image enables accurate determination.

【0014】請求項6の発明は、請求項5の発明におい
て、対象画像とテンプレート画像との濃度分布を、各画
像の検査領域内から1画素単位で求めた濃度により生成
しているのである。この方法は、対象画像とテンプレー
ト画像との濃度分布を求める望ましい実施態様であっ
て、検査領域内の画素濃度を1画素単位で求めるから、
濃度分布を精度よく求めることができる。
According to a sixth aspect of the present invention, in the fifth aspect of the present invention, the density distribution of the target image and the template image is generated based on the density obtained for each pixel from the inspection area of each image. This method is a desirable embodiment for obtaining the density distribution between the target image and the template image. Since the pixel density in the inspection area is obtained on a pixel-by-pixel basis,
The concentration distribution can be obtained with high accuracy.

【0015】[0015]

【発明の実施の形態】BEST MODE FOR CARRYING OUT THE INVENTION

(実施形態1)本実施形態では、対象画像とテンプレー
ト画像との回転変位および平行変位を補正する方法につ
いて説明する。対象画像およびテンプレート画像は2値
画像であって、同じ画素値の画素が隣接して一集まりの
画素群として扱うことができる連続領域を複数個持ち、
かつ各連続領域の重心位置がほぼ一直線上に並んでいる
ものとする。対象画像における検査対象sは、実際には
図2に示すような文字列などであって、各文字内の画素
が同じ画素値を持つのであれば各文字が連続領域dにな
る。各連続領域dの重心gの並びを代表する直線は重心
gの並びに基づいて求められる回帰直線jを採用する。
(Embodiment 1) In this embodiment, a method for correcting a rotational displacement and a parallel displacement between a target image and a template image will be described. The target image and the template image are binary images and have a plurality of continuous regions in which pixels having the same pixel value can be treated as a group of adjacent pixels.
In addition, it is assumed that the positions of the centers of gravity of the respective continuous regions are substantially aligned. The inspection target s in the target image is actually a character string or the like as shown in FIG. 2, and if the pixels in each character have the same pixel value, each character becomes a continuous area d. A straight line representing the arrangement of the centers of gravity g of the continuous regions d employs a regression line j obtained based on the arrangement of the centers of gravity g.

【0016】本実施形態は、図3に示すように、基本的
には画像入力装置1としてのTVカメラによって対象物
を撮像した対象画像とテンプレート画像とを照合するも
のであり、画像入力装置1により撮像された画像は、2
値化部2において各画素の濃度が適宜の閾値で2値化さ
れ2値画像としてフレームメモリ3に格納される。ここ
で、連続領域抽出部4では、フレームメモリ3に格納さ
れた2値画像から一方の画素値の集合体を連続領域とし
て抽出する。つまり、背景側とは異なる画素値を持つ画
素を検出し、その周囲(8近傍)の画素に同じ画素値を
持つ画素があればその画素を同じ連続領域に属する画素
とみなし、さらに、新たに見つけた画素について同様の
処理を行なうことによって連続領域を確定するのであ
る。また、一つの連続領域内の画素については同じ属性
値(ラベル)を与えることで、いわゆるラベリング処理
を行なう。このようにして、2値画像内に異なる属性値
を持つ島状の連続領域を複数個得ることができる。ここ
で、連続領域の大きさや個数を検査することによって検
査対象以外のノイズ成分を除去する。
In the present embodiment, as shown in FIG. 3, basically, a target image obtained by capturing an object by a TV camera as the image input device 1 is compared with a template image. The image captured by
The binarization unit 2 binarizes the density of each pixel with an appropriate threshold and stores the binarized image in the frame memory 3. Here, the continuous area extraction unit 4 extracts an aggregate of one pixel value from the binary image stored in the frame memory 3 as a continuous area. In other words, a pixel having a pixel value different from that of the background is detected, and if there is a pixel having the same pixel value in surrounding pixels (near 8), the pixel is regarded as belonging to the same continuous area, and a pixel is newly added. The same process is performed on the found pixel to determine a continuous area. A so-called labeling process is performed by giving the same attribute value (label) to pixels in one continuous region. In this way, a plurality of island-shaped continuous regions having different attribute values can be obtained in the binary image. Here, noise components other than the inspection target are removed by inspecting the size and the number of the continuous regions.

【0017】次に補正部5では、テンプレート格納部6
に格納されたテンプレート画像をフレームメモリ3に格
納されている対象画像に重ね合わせるように位置補正す
る。この処理の具体的な手順については後述する。位置
の補正されたテンプレート画像は、対象画像とともに照
合部7に入力されて両者の差画像が求められ類似度が検
査される。類似度は次のようにして検査される。つま
り、所定の検査領域内で対象画像とテンプレート画像と
の画素値が異なっている画素数を求め、求めた画素数を
類似度の評価値に用いるのである。この場合、画素値の
異なっている画素数が少ないほど類似度が高いことにな
る。
Next, in the correction unit 5, the template storage unit 6
Is corrected so that the template image stored in the frame memory 3 is superimposed on the target image stored in the frame memory 3. The specific procedure of this processing will be described later. The template image whose position has been corrected is input to the matching unit 7 together with the target image, and a difference image between the two is obtained, and the similarity is inspected. The similarity is checked as follows. That is, the number of pixels having different pixel values between the target image and the template image in the predetermined inspection area is obtained, and the obtained number of pixels is used as the evaluation value of the similarity. In this case, the smaller the number of pixels having different pixel values, the higher the similarity.

【0018】以下に、補正部5の処理手順について説明
する。いま、対象画像sには、図1に示すように、4個
の連続領域d1 ,d2 ,d3 ,d4 が存在するものとす
る。ここで、各連続領域d1 〜d4 の重心g1 〜g4
ほぼ一直線上に並んではいるが、必ずしも完全に一致し
ている必要はない。テンプレート画像Tも対象画像sと
同様に4個の連続領域D1 〜D4 を有し、各連続領域D
1 〜D4 の重心G1 〜G4 はほぼ一直線上に並ぶ。ここ
で、対象画像sとテンプレート画像Tとを重ね合わせる
ために、対象画像sとテンプレート画像Tとの相対位置
を求める必要がある。対象画像sは、テンプレート画像
Tを2次元平面内で回転移動および平行移動させたもの
とみなすことができるから、対象画像sのテンプレート
画像Tに対する傾きを求め、次に対象画像sとテンプレ
ート画像Tとの距離を求める。
Hereinafter, a processing procedure of the correction unit 5 will be described. Now, assume that the target image s has four continuous areas d 1 , d 2 , d 3 , and d 4 as shown in FIG. Here, it enters alongside the centroid g 1 to g 4 are substantially on a straight line in each successive region d 1 to d 4, does not necessarily have to be completely identical. The template image T also has four continuous areas D 1 to D 4 like the target image s.
1 to D centroid G 1 ~G 4 of 4 almost aligned on. Here, in order to superimpose the target image s and the template image T, it is necessary to obtain a relative position between the target image s and the template image T. Since the target image s can be regarded as being obtained by rotating and translating the template image T in a two-dimensional plane, the inclination of the target image s with respect to the template image T is obtained, and then the target image s and the template image T And the distance to it.

【0019】テンプレート画像Tは、あらかじめ標準の
対象物を画像入力装置1を用いて撮像して得た濃淡画像
より作成されテンプレート格納部6に格納されているも
のであって、本実施形態では、テンプレート画像Tの属
性値として、連続領域D1 〜D4 の重心G1 〜G4 の位
置と、連続領域D1 〜D4 の重心G1 〜G4 の並びによ
り決まる回帰直線(y=A・x+B)と、回帰直線の延
長方向において両端となる連続領域D1 ,D4 の重心か
ら回帰直線に下ろした垂線の足V1 ,V2 と、両垂線の
足V1 ,V2 の中点M(Mx,My)とをテンプレート
格納部6に格納してある。さらに、Mx±X0 の2直線
とMy±Y0 の2直線とにより囲まれる領域という形で
検査領域DAをテンプレート格納部6に格納してある。
ただし、A,B,X0 ,Y0 は定数である。ここに、垂
線の足V1 ,V2 については、必ずしもテンプレート画
像Tの属性値としてテンプレート格納部6に格納してお
く必要はない。
The template image T is created from a gray-scale image obtained by capturing a standard object in advance using the image input device 1 and stored in the template storage unit 6. as an attribute value of the template image T, the continuous region D 1 and the position of the center of gravity G 1 ~G 4 of to D 4, continuous region D 1 to D determined by the arrangement of the center of gravity G 1 ~G 4 of 4 regression line (y = a · x + B) and, from the center of gravity of the two ends contiguous region D 1, D 4 foot V 1, V 2 of the perpendicular dropped to the regression line in the extending direction of the regression line, in the both perpendicular foot V 1, V 2 The point M (Mx, My) is stored in the template storage unit 6. Further, the inspection area DA is stored in the template storage unit 6 as an area surrounded by two straight lines Mx ± X 0 and two straight lines My ± Y 0 .
Here, A, B, X 0 and Y 0 are constants. Here, the perpendicular feet V 1 and V 2 do not necessarily need to be stored in the template storage unit 6 as attribute values of the template image T.

【0020】次に、対象画像sについてテンプレート画
像Tとの差画像を求める際には、まず対象画像sから連
続領域d1 〜d4 を抽出するとともに、連続領域d1
4の重心g1 〜g4 をそれぞれ求める。また、連続領
域d1 〜d4 の重心g1 〜g 4 の並びにより決まる回帰
直線(y=a・x+b)と、回帰直線の長手方向におけ
る両端の連続領域d1 ,d4 の重心から回帰直線に下ろ
した垂線の足v1 ,v 2 と、垂線の足v1 ,v2 の中点
m(mx,my)とを求める。ここに、a,bは定数で
ある。
Next, a template image is created for the target image s.
When obtaining a difference image with the image T, first,
Connection area d1~ DFourAnd the continuous area d1~
dFourCenter of gravity g1~ GFourRespectively. Also, continuous territory
Area d1~ DFourCenter of gravity g1~ G FourRegression determined by sequence
In the longitudinal direction of the straight line (y = a x + b) and the regression line
Continuous area d at both ends1, DFourFrom the center of gravity to the regression line
Vertical line v1, V TwoAnd the perpendicular foot v1, VTwoMidpoint of
m (mx, my). Where a and b are constants
is there.

【0021】上述のようにして求めた回帰直線は、対象
画像sとテンプレート画像Tとについてそれぞれ同条件
で決定したものであるから、各回帰直線はテンプレート
Tと対象画像sとをそれぞれ代表する直線を示すことに
なる。定数a,Aは回帰直線の傾きを表すから、これら
の定数a,Aに基づいて対象画像sとテンプレート画像
との相対的な傾き角度θを次式で求めることができる。 θ= tan-1a− tan-1A また、両回帰直線を連立方程式と見なせば、x,yを求
めることによって、両回帰直線の交点c(cx,cy)
を求めることができる。
Since the regression line obtained as described above is determined under the same conditions for the target image s and the template image T, each regression line is a straight line representing the template T and the target image s, respectively. Will be shown. Since the constants a and A represent the inclination of the regression line, the relative inclination angle θ between the target image s and the template image can be obtained from the following equation based on these constants a and A. θ = tan −1 a− tan −1 A Further, if both regression lines are regarded as simultaneous equations, the intersection c (cx, cy) of the two regression lines can be obtained by obtaining x and y.
Can be requested.

【0022】上述のようにして角度θおよび交点cが決
まると、交点cを回転中心として両回帰直線が重なり合
うように中点M(Mx,My)を角度θだけ回転させる
ことができる。つまり、次式の演算を行なうことでテン
プレート画像Tから求めた中点M(Mx,My)を回転
移動させることができる。 Mx′=(Mx−cx)cosθ−(My−cy)sinθ+cx My′=(Mx−cx)sinθ+(My−cy)cosθ+cy このようにして求めた点M′(Mx′,My′)は回帰
直線y=a・x+bの上の点であるから、点M′と中点
mとのずれ(dx,dy)は、次のようにして求めるこ
とができる。 dx=mx−Mx′ dy=my−My′ ただし、dx,dyはそれぞれx方向、y方向の距離で
ある。
When the angle θ and the intersection point c are determined as described above, the middle point M (Mx, My) can be rotated by the angle θ so that the two regression lines overlap with the intersection point c as the center of rotation. That is, the midpoint M (Mx, My) obtained from the template image T can be rotated and moved by performing the following equation. Mx ′ = (Mx−cx) cosθ− (My−cy) sinθ + cx My ′ = (Mx−cx) sinθ + (My−cy) cosθ + cy The point M ′ (Mx ′, My ′) thus obtained is a regression line. Since it is a point above y = a × x + b, the deviation (dx, dy) between the point M ′ and the middle point m can be obtained as follows. dx = mx−Mx ′ dy = my−My ′ where dx and dy are distances in the x and y directions, respectively.

【0023】以上の手順で回帰直線の角度θと、テンプ
レート画像Tから求めた点M′と対象画像sから求めた
中点mとのずれ(dx,dy)とを用いると、テンプレ
ート画像Tの各連続領域D1 〜D4 を対象画像sの各連
続領域d1 〜d4 に重ね合わせることができ、またテン
プレート画像Tの属性値としてテンプレート格納部6に
格納されている検査領域DAに相当する検査領域daを
対象画像sについて設定することができる。以後は、検
査領域daと検査領域DAとの差画像を求め、画素値が
異なる画素の個数を類似度の評価値に用いる。
Using the angle θ of the regression line and the deviation (dx, dy) between the point M ′ obtained from the template image T and the middle point m obtained from the target image s in the above procedure, each successive regions D 1 to D 4 can be superimposed on each successive region d 1 to d 4 of the target image s and also corresponds to the inspection region DA which is stored in the template storage section 6 as the attribute value of the template image T The inspection area da to be set can be set for the target image s. Thereafter, a difference image between the inspection area da and the inspection area DA is obtained, and the number of pixels having different pixel values is used as the similarity evaluation value.

【0024】(実施形態2)本実施形態は、請求項3に
対応する方法であって、対象画像sは図4(a)に示す
ように何らかの部材に印刷された文字であるものとす
る。本実施形態では、図5に示すように、TVカメラよ
りなる画像入力装置1で撮像した濃淡画像を適宜閾値を
用いて2値化部2で2値化した後にフレームメモリ3に
格納した画像を用いる。フレームメモリ3に格納された
2値画像である対象画像sは、特徴抽出処理部8aにお
いて画素値の変化点が抽出される。この処理はたとえば
画像内に設定した大まかな検査領域をラスタ走査し、画
素値の変化点の座標を抽出する処理になる。このように
して図4(b)のように対象画像sの外形線uを抽出す
ることができる。ただし、画像入力装置1による撮像の
際の照明条件などによっては、画像内での対象画像sの
外形線uよりも外側に実際の対象物の外形線が存在する
こともあるから、領域設定部8aでは上述のようにして
求めた外形線uに膨張処理を施す。膨張処理は、外形線
uに対して対象画像sの外側に所定の画素幅だけ離れた
境界線wを設定することであって、図4(c)のような
境界線wを設定することができる。
(Embodiment 2) This embodiment is a method corresponding to claim 3, wherein the target image s is a character printed on some member as shown in FIG. 4 (a). In the present embodiment, as shown in FIG. 5, an image stored in the frame memory 3 after binarizing the grayscale image captured by the image input device 1 composed of a TV camera by the binarizing unit 2 using an appropriate threshold value. Used. In the target image s, which is a binary image stored in the frame memory 3, a change point of the pixel value is extracted by the feature extraction processing unit 8a. This process is, for example, a process of raster-scanning a rough inspection area set in an image and extracting coordinates of a pixel value change point. In this manner, the outline u of the target image s can be extracted as shown in FIG. However, depending on the lighting conditions and the like at the time of imaging by the image input device 1, the outline of the actual object may exist outside the outline u of the target image s in the image. In step 8a, the outer shape line u obtained as described above is subjected to expansion processing. The expansion process is to set a boundary w that is separated from the outline u by a predetermined pixel width outside the target image s, and it is possible to set the boundary w as shown in FIG. it can.

【0025】上述のような手順によって、比較的複雑な
形状の対象画像sであっても外形線uに沿った境界線w
を設定することができるのであって、境界線wの内部を
検査領域として対象画像sの画像から特定の情報を抽出
するようにすれば、背景からの情報の影響をほとんど受
けることなく対象画像sに関する情報を抽出することが
できるのである。とくに、実施形態1のように対象画像
sの連続領域d1 〜d 4 の重心を求める処理や、テンプ
レート画像Tとの差画像を求めるような処理に、本実施
形態の処理を適用することで、背景の影響を除去して精
度の高い検査が可能になるのである。
With the above-described procedure, a relatively complicated
Even if the target image s has a shape, the boundary w along the outline u
Can be set, and the inside of the boundary line w
Extract specific information from the image of the target image s as the inspection area
That is largely unaffected by background information.
Information about the target image s without extracting
You can. In particular, as in the first embodiment, the target image
continuous area d of s1~ D FourProcessing to find the center of gravity of the
This processing is performed to obtain a difference image from the rate image T.
By applying morphological processing, the effects of the background can be removed and refined.
A high degree of inspection becomes possible.

【0026】(実施形態3)本実施形態は、基本的には
実施形態2と同様の方法であるが、対象画像sの外形線
uを抽出するに際して2値画像を用いるのではなく、微
分画像を用いる点が異なる。つまり、図6に示すよう
に、TVカメラのような画像入力装置1で撮像すること
により得た濃淡画像をフレームメモリ3に格納し、微分
処理部8bにおいて濃度に関する空間微分を行なう。空
間微分の方法は周知であるが、ソーベルオペレータを用
いることによって比較的簡単かつ高速な処理が期待でき
る。微分処理部8bでは、対象画像sを囲むように大ま
かに設定した検査領域内で空間微分を行なうことによっ
て、微分絶対値(つまり、濃度の変化率)を求める。こ
のようにして求めた微分絶対値を3次元空間にマッピン
グすれば山谷を有する3次元図形が得られるから、山の
尾根部分を抽出するエッジ抽出処理(つまり、微分絶対
値の極大値を追跡する処理)を行なうことで、図4
(b)のように対象画像sの外形線uを求めることがで
きる。
(Embodiment 3) This embodiment is basically the same as the embodiment 2, except that a binary image is not used when extracting the outline u of the target image s. Is different. That is, as shown in FIG. 6, a grayscale image obtained by capturing an image with the image input device 1 such as a TV camera is stored in the frame memory 3, and the differentiation unit 8b performs spatial differentiation on the density. Although the method of spatial differentiation is well known, relatively simple and high-speed processing can be expected by using a Sobel operator. The differential processing unit 8b obtains a differential absolute value (that is, a rate of change in density) by performing spatial differentiation within an inspection region roughly set so as to surround the target image s. By mapping the differential absolute value obtained in this way to a three-dimensional space, a three-dimensional figure having peaks and valleys can be obtained. Therefore, edge extraction processing for extracting a ridge portion of a mountain (that is, tracking the maximum value of the differential absolute value) 4), the processing shown in FIG.
As shown in (b), the outline u of the target image s can be obtained.

【0027】このようにして対象画像sの外形線uを求
めた後の処理は実施形態2と同様であり、領域設定部9
において外形線uに膨張処理を施し、図4(c)のよう
に外形線uに対して対象画像sの外側に所定幅だけ離れ
た境界線wを設定し、境界線wの内側を検査領域とする
のである。 (実施形態4)本実施形態は、実施形態1のように対象
画像sとテンプレート画像Tとの検査領域ad,ADを
一致させた後の差画像から類似度を判定する際の処理に
特徴を有するものである。ただし、対象画像sとテンプ
レート画像Tとは画素値として濃度値を有しており、差
画像の各画素の画素値は濃度差になる。したがって、検
査領域ad,ADを一致させた状態で、対象画像sとテ
ンプレート画像Tとが完全に一致していれば、両者の濃
淡画像から求めた差画像に含まれる各画素の画素値はす
べてが0になる。要するに、差画像とは各検査領域a
d,ADの中での相対位置の一致する画素同士の濃度の
差を各画素の画素値としたものであるから、濃度差がな
ければ差画像の画素の画素値は0になるのである。しか
しながら、実際には、画像入力装置1で撮像する際の照
明条件や撮像される対象物の状態(たとえば、印刷され
た文字を対象物とする場合であればインクの濃い場合や
薄い場合が生じる)によって対象画像sとテンプレート
画像Tとの濃度は一致しないものである。
The processing after obtaining the outline u of the target image s in this manner is the same as in the second embodiment.
In FIG. 4, a dilation process is performed on the outline u, and a boundary w that is separated from the outline u by a predetermined width is set outside the target image s as shown in FIG. That is. (Embodiment 4) This embodiment is characterized by a process of determining the similarity from the difference image after matching the inspection areas ad and AD between the target image s and the template image T as in Embodiment 1. Have However, the target image s and the template image T have density values as pixel values, and the pixel value of each pixel of the difference image is a density difference. Therefore, if the target image s and the template image T completely match with the inspection areas ad and AD matched, all the pixel values of the pixels included in the difference image obtained from the grayscale images of both are all Becomes 0. In short, the difference image means each inspection area a
Since the difference in density between pixels having the same relative position in d and AD is used as the pixel value of each pixel, if there is no density difference, the pixel value of the pixel of the difference image is 0. However, in practice, the lighting conditions when capturing an image with the image input device 1 and the state of the target to be imaged (for example, when printed characters are used as the target, dark or light ink may occur). ), The densities of the target image s and the template image T do not match.

【0028】そこで、差画像の各画素の画素値に対する
判定範囲を設定しておき、画素値が判定範囲を逸脱する
ときには不一致とみなすようにして多少の条件の変動は
無視できるようにしているのが現状である。しかしなが
ら、このような判定範囲を広く設定すると、実際には対
象画像sとテンプレート画像Tとがほぼ一致しているに
もかかわらず不一致と誤判断される場合が生じる。
Therefore, a judgment range for each pixel value of each pixel of the difference image is set, and when the pixel value deviates from the judgment range, it is regarded as inconsistent, so that a slight change in the condition can be ignored. Is the current situation. However, if such a determination range is set wide, there may be a case where the target image s and the template image T are erroneously determined to be mismatched even though they substantially match.

【0029】この種の誤判断を避けるために、本実施形
態ではテンプレート画像Tの検査領域ADの中での各画
素の濃度分布を求めるとともに、濃度分布の中で得られ
る極大値(ピーク値)の平均値を求め、この平均値を用
いて濃度差を補正する。つまり、文字列のようにほぼ一
定の濃度を有する検査対象であれば、図7に示すよう
に、検査対象の濃度と背景の濃度とにそれぞれ度数の極
大値p1 ,p2 が現れるはずである。図7において、p
1 は検査対象の濃度の極大値、p2 は背景の濃度の極大
値である。そこで、2つの極大値p1 ,p2 の平均値を
求めることで、濃淡画像の検査領域ad,ADの中の全
体の明るさのレベルを知ることができる。この種の検査
対象としては、紙、合成樹脂、半導体、セラミックスな
どの各種材料に印刷された文字やマークなどが考えられ
るが、もちろん他の検査対象でもよい。
In order to avoid this kind of misjudgment, in the present embodiment, the density distribution of each pixel in the inspection area AD of the template image T is determined, and the maximum value (peak value) obtained in the density distribution is obtained. Is obtained, and the density difference is corrected using this average value. That is, if the inspection target has a substantially constant density such as a character string, the maximum values p 1 and p 2 of the frequencies should appear in the density of the inspection target and the density of the background, respectively, as shown in FIG. is there. In FIG. 7, p
1 the maximum value of the concentration of the test object, p 2 is the maximum value of the density of the background. Thus, by calculating the average value of the two local maximum values p 1 and p 2 , it is possible to know the overall brightness level in the inspection areas ad and AD of the grayscale image. Examples of this type of inspection target include characters and marks printed on various materials such as paper, synthetic resin, semiconductor, and ceramics, but of course, other inspection targets may be used.

【0030】実際に差画像を求めて類似度を判断する際
には、テンプレート画像Tについて設定した検査領域A
Dの中の濃度分布から求めた平均値をテンプレート画像
Tの属性値としてテンプレート格納部6にあらかじめ格
納しておき、対象画像sについて設定した検査領域ad
の中の濃度分布から求めた平均値とテンプレート画像T
から求めた平均値との差を求める(図8の一点鎖線はテ
ンプレート画像Tの濃度分布、実線は対象画像sの濃度
分布を示す)。この差がオフセット値になる。いま、テ
ンプレート画像Tに比較すると対象画像sの画像が暗い
ものとする(図8とは逆の関係である)。濃度値は明る
いほど高くなるものとすると、上記条件でのオフセット
値は負になる(オフセット値=対象画像sに関する平均
値−テンプレート画像Tに関する平均値)。
When the similarity is determined by actually obtaining the difference image, the inspection area A set for the template image T is used.
The average value obtained from the density distribution in D is stored in advance in the template storage unit 6 as the attribute value of the template image T, and the inspection area ad set for the target image s
And the template image T obtained from the density distribution in
(A dashed line in FIG. 8 indicates the density distribution of the template image T, and a solid line indicates the density distribution of the target image s). This difference becomes the offset value. Now, it is assumed that the image of the target image s is darker than the template image T (the relationship is opposite to that of FIG. 8). Assuming that the higher the density value, the higher the brightness, the offset value under the above condition becomes negative (offset value = average value of the target image s−average value of the template image T).

【0031】ところで、差画像の各画素の画素値に対し
て上述のように適宜の判定範囲が設定してあり、画素値
が判定範囲内であるときには、その画素に対応する対象
画像sとテンプレート画像Tとの部分はほぼ一致してい
るとみなされる。ただし、この判定範囲は対象画像sと
テンプレート画像Tとからそれぞれ求めた平均値が一致
する場合と基準として設定してある。そこで、上述のよ
うにしてオフセット値が求められると、差画像の画素値
の判定範囲をオフセット値分だけシフトさせる。つま
り、上述のようにオフセット値が負になるのであれば、
判定範囲を負側にシフトさせるのである。このようにシ
フトさせた判定範囲を用いて差画像の画素値を判定すれ
ば、テンプレート画像Tと対象画像sとの入力時の照明
条件などの差を除去することができ、テンプレート画像
Tと対象画像sとを同条件で入力したものとみなして両
者の差を抽出することができる。また、対象画像sとテ
ンプレート画像Tとに局所的な差があれば、シフト後の
上記判定範囲を逸脱するはずであるから、その部分を対
象画像sとテンプレート画像Tとが一致しない部分とし
て抽出することができる。このようにして、不一致部分
として抽出された部位の面積により類似度が判断される
のであり、その面積が大きいほど類似度は低いとみなさ
れる。なお、上述のように判定範囲をオフセット値分だ
けシフトさせるから、従来に比較すると判定範囲の余裕
度を小さくすることができ、結果的に判定範囲を狭く設
定して差画像に基づく類似度を精度よく求めることがで
きる。
By the way, an appropriate judgment range is set for the pixel value of each pixel of the difference image as described above, and when the pixel value is within the judgment range, the target image s corresponding to that pixel and the template The part with the image T is regarded as almost coincident. However, this determination range is set as a reference when the average values obtained from the target image s and the template image T match each other. Therefore, when the offset value is obtained as described above, the determination range of the pixel value of the difference image is shifted by the offset value. That is, if the offset value is negative as described above,
The judgment range is shifted to the negative side. If the pixel values of the difference image are determined using the determination range shifted in this way, it is possible to remove a difference such as an illumination condition at the time of input between the template image T and the target image s. Assuming that the image s and the image s are input under the same condition, the difference between the two can be extracted. Also, if there is a local difference between the target image s and the template image T, it should deviate from the above-described determination range after the shift, and that part is extracted as a part where the target image s and the template image T do not match. can do. In this way, the similarity is determined based on the area of the part extracted as the mismatched part, and the larger the area, the lower the similarity. Since the determination range is shifted by the offset value as described above, the margin of the determination range can be reduced as compared with the related art, and as a result, the similarity based on the difference image is set by narrowing the determination range. It can be obtained with high accuracy.

【0032】[0032]

【発明の効果】請求項1の発明は、画像入力装置より入
力された対象画像とあらかじめ登録されているテンプレ
ート画像とを照合することにより対象画像とテンプレー
ト画像との類似度を検査する画像処理方法において、対
象画像は一集まりの画素群として扱うことができる連続
領域を複数個含むとともに各連続領域の重心がほぼ一直
線上に並ぶ画像であって、各連続領域の重心位置とこれ
らの重心の並びより求められる回帰直線とを求め、テン
プレート画像の各連続領域の重心より求められる回帰直
線と対象画像から求めた回帰直線との間の角度に基づい
て回転変位を補正するとともに、テンプレート画像の各
連続領域の重心位置と対象画像から求めた各連続領域の
重心との位置関係に基づいて平行変位を補正し、テンプ
レート画像において連続領域の重心位置を基準として設
定してある検査領域を対象画像に設定するのであり、複
数の連続領域を含む対象画像について各連続領域の重心
を求めるから、検査領域をあらかじめ設定することなく
対象画像内から連続領域を見つけることで、対象画像内
の所望の検査対象を見つけることができるという利点が
ある。また、対象画像の方向を代表する直線を重心の並
びにより決まる回帰直線としているから、対象画像の方
向を再現性よく求めることができるという利点があり、
結果的に、テンプレート画像との位置合わせの精度が高
くなるのである。しかも、テンプレート画像において連
続領域の重心位置を基準として検査領域を設定している
から、対象画像における検査領域を自動的に設定するこ
とができるという利点がある。
According to the first aspect of the present invention, there is provided an image processing method for checking the similarity between a target image and a template image by comparing the target image input from the image input device with a template image registered in advance. , The target image is an image that includes a plurality of continuous regions that can be treated as a group of pixels, and the center of gravity of each continuous region is substantially aligned, and the position of the center of gravity of each continuous region and the arrangement of these centers of gravity The rotational displacement is corrected based on the angle between the regression line obtained from the center of gravity of each continuous region of the template image and the regression line obtained from the target image. The parallel displacement is corrected based on the positional relationship between the position of the center of gravity of the region and the center of gravity of each continuous region obtained from the target image. Inspection areas set based on the center of gravity of the continuous area are set as the target image.The center of gravity of each continuous area is determined for the target image including a plurality of continuous areas, so that the target area can be set without setting the inspection area in advance. Finding a continuous area from within an image has the advantage that a desired inspection target within the target image can be found. Further, since the straight line representing the direction of the target image is a regression line determined by the arrangement of the centers of gravity, there is an advantage that the direction of the target image can be obtained with good reproducibility.
As a result, the accuracy of alignment with the template image is increased. Moreover, since the inspection area is set based on the position of the center of gravity of the continuous area in the template image, there is an advantage that the inspection area in the target image can be automatically set.

【0033】請求項2の発明のように、対象画像および
テンプレート画像を2値画像とすれば、2値画像につい
て連続領域や重心を求める処理は簡単であるから、高速
な処理が可能になるという利点がある。請求項3の発明
は、画像入力装置より入力された対象画像を2値化した
2値画像を生成し、画素値の変化点を抽出する特徴抽出
処理によって2値画像から検査対象の外形線を抽出した
後、検査対象の外側に上記外形線から所定画素幅だけ離
れた境界線を設定し、上記境界線内を検査領域とするの
であり、請求項4の発明は、画像入力装置より入力され
た対象画像を微分し、微分絶対値の変化が所定値以上に
なるエッジを追跡することにより対象画像から検査対象
の外形線を抽出した後、検査対象の外側に上記外形線か
ら所定画素幅だけ離れた境界線を設定し、上記境界線内
を検査領域とするのであって、いずれの請求項の発明
も、検査対象の外形線に沿って検査領域の境界線を設定
するから、検査対象以外の背景はほとんど含まれず、ノ
イズ成分をほとんど含まない検査が可能になるという利
点がある。また、検査領域は検査対象に応じて自動的に
設定されることになるから、使用者が手作業で検査領域
を設定する必要がないという利点がある。
If the target image and the template image are binary images as in the second aspect of the present invention, the processing for obtaining the continuous area and the center of gravity of the binary image is simple, so that high-speed processing is possible. There are advantages. According to a third aspect of the present invention, the outline of the inspection target is extracted from the binary image by a feature extraction process of generating a binary image by binarizing the target image input from the image input device and extracting a change point of the pixel value. After the extraction, a boundary line separated by a predetermined pixel width from the outline is set outside the inspection object, and the inside of the boundary line is set as an inspection region. After extracting the outline of the inspection target from the target image by differentiating the target image and tracing an edge where the change in the differential absolute value is equal to or more than a predetermined value, the predetermined pixel width from the outline is outside the inspection target. Since the separated boundary line is set and the inside of the boundary line is set as the inspection region, the invention of any claim sets the boundary line of the inspection region along the outline of the inspection target. Almost no background, no noise There is an advantage that the amount does not include most of the inspection is possible. In addition, since the inspection area is automatically set according to the inspection target, there is an advantage that the user does not need to manually set the inspection area.

【0034】請求項5の発明は、画像入力装置より入力
された対象画像とあらかじめ登録されているテンプレー
ト画像とを照合することにより対象画像とテンプレート
画像との類似度を検査する画像処理方法において、検査
対象を含む濃淡画像の中で検査対象を囲むように設定し
た所定の検査領域内の濃度分布を求め、上記検査領域と
同じ大きさの検査領域内でテンプレート画像について求
めた濃度分布の平均値と対象画像から求めた濃度分布の
平均値との差をオフセット値とし、対象画像とテンプレ
ート画像との各画素の濃度差を画素値とする差画像の画
素値に対してあらかじめ設定してある判定範囲をオフセ
ット値分だけシフトさせ、上記差画像の各画素の画素値
がシフトさせた判定範囲を逸脱するときに対象画像とテ
ンプレート画像の不一致部分として抽出するのであり、
濃度情報を含んだ状態で対象画像とテンプレート画像と
の差画像を検査する際に有効な方法であって、対象画像
とテンプレート画像とをそれぞれ代表する濃度値を求
め、両濃度値の差をオフセット値に用いて濃度判定のた
めの判定範囲を補正するから、対象画像とテンプレート
画像との濃度差を補正して精度のよい判定が可能になる
という利点がある。
According to a fifth aspect of the present invention, there is provided an image processing method for checking a similarity between a target image and a template image by comparing the target image input from an image input device with a template image registered in advance. A density distribution in a predetermined inspection area set so as to surround the inspection object in the grayscale image including the inspection object, and an average value of the density distribution obtained for the template image in the inspection area having the same size as the inspection area And a difference between the average value of the density distribution obtained from the target image and the average value of the density distribution as an offset value. The range is shifted by the offset value, and when the pixel value of each pixel of the difference image deviates from the shifted determination range, the target image and the template image are shifted. And of being extracted as the matching portion,
This is an effective method for inspecting the difference image between the target image and the template image while including the density information, in which the density values representing the target image and the template image are obtained, and the difference between the two density values is offset. Since the determination range for the density determination is corrected by using the value, there is an advantage that the density difference between the target image and the template image is corrected and the determination can be performed with high accuracy.

【0035】請求項6の発明のように、対象画像とテン
プレート画像との濃度分布を、各画像の検査領域内から
1画素単位で求めた濃度により生成すれば、濃度分布を
精度よく求めることができる。
If the density distribution of the target image and the template image is generated based on the density obtained for each pixel from the inspection area of each image, the density distribution can be obtained with high accuracy. it can.

【図面の簡単な説明】[Brief description of the drawings]

【図1】実施形態1の概念を説明する図である。FIG. 1 is a diagram illustrating the concept of a first embodiment.

【図2】実施形態1の概念を説明する図である。FIG. 2 is a diagram illustrating the concept of the first embodiment.

【図3】実施形態1に対応する装置のブロック図であ
る。
FIG. 3 is a block diagram of an apparatus corresponding to the first embodiment.

【図4】実施形態2、3の概念を説明する図である。FIG. 4 is a diagram for explaining the concept of Embodiments 2 and 3;

【図5】実施形態2に対応する装置のブロック図であ
る。
FIG. 5 is a block diagram of an apparatus corresponding to a second embodiment.

【図6】実施形態3に対応する装置のブロック図であ
る。
FIG. 6 is a block diagram of an apparatus corresponding to a third embodiment.

【図7】実施形態4の度数分布の概念を説明する図であ
る。
FIG. 7 is a diagram illustrating the concept of a frequency distribution according to a fourth embodiment.

【図8】実施形態4の度数分布の概念を説明する図であ
る。
FIG. 8 is a diagram illustrating the concept of a frequency distribution according to the fourth embodiment.

【図9】従来方法の説明図である。FIG. 9 is an explanatory diagram of a conventional method.

【符号の説明】[Explanation of symbols]

1 画像入力装置 2 2値化部 4 連続領域抽出部 5 補正部 6 テンプレート格納部 8a 特徴抽出処理部 8b 微分処理部 c 交点 d1 〜d4 連続領域 D1 〜D4 連続領域 da 検査領域 DA 検査領域 g1 〜g4 重心 G1 〜G4 重心 j 回帰直線 p1 極大値 p2 極大値 s 対象画像 T テンプレート画像 u 外形線 w 境界線1 The image input device 2 binarization unit 4 contiguous region extraction unit 5 corrector 6 template storage unit 8a feature extraction processing unit 8b differential processing unit c intersection d 1 to d 4 contiguous regions D 1 to D 4 contiguous region da inspection area DA inspection area g 1 to g 4 centroid G 1 ~G 4 centroid j regression line p 1 maximum value p 2 maxima s target image T template image u outline w border

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 画像入力装置より入力された対象画像と
あらかじめ登録されているテンプレート画像とを照合す
ることにより対象画像とテンプレート画像との類似度を
検査する画像処理方法において、対象画像は一集まりの
画素群として扱うことができる連続領域を複数個含むと
ともに各連続領域の重心がほぼ一直線上に並ぶ画像であ
って、各連続領域の重心位置とこれらの重心の並びより
求められる回帰直線とを求め、テンプレート画像の各連
続領域の重心より求められる回帰直線と対象画像から求
めた回帰直線との間の角度に基づいて回転変位を補正す
るとともに、テンプレート画像の各連続領域の重心位置
と対象画像から求めた各連続領域の重心との位置関係に
基づいて平行変位を補正し、テンプレート画像において
連続領域の重心位置を基準として設定してある検査領域
を対象画像に設定することを特徴とする画像処理方法。
1. An image processing method for checking the similarity between a target image and a template image by comparing a target image input from an image input device with a pre-registered template image. It is an image that includes a plurality of continuous regions that can be treated as a pixel group, and the center of gravity of each continuous region is substantially aligned, and the regression line obtained from the position of the center of gravity of each continuous region and the arrangement of these centers of gravity is The rotational displacement is corrected based on the angle between the regression line obtained from the center of gravity of each continuous region of the template image and the regression line obtained from the target image, and the position of the center of gravity of each continuous region of the template image and the target image are corrected. The parallel displacement is corrected based on the positional relationship with the center of gravity of each continuous region obtained from An image processing method comprising: setting an inspection region set on the basis of a target image as a target image.
【請求項2】 対象画像およびテンプレート画像は2値
画像であることを特徴とする請求項1記載の画像処理方
法。
2. The image processing method according to claim 1, wherein the target image and the template image are binary images.
【請求項3】 画像入力装置より入力された対象画像を
2値化した2値画像を生成し、画素値の変化点を抽出す
る特徴抽出処理によって2値画像から検査対象の外形線
を抽出した後、検査対象の外側に上記外形線から所定画
素幅だけ離れた境界線を設定し、上記境界線内を検査領
域としたことを特徴とする画像処理方法。
3. A binary image is generated by binarizing a target image input from an image input device, and an outline of an inspection target is extracted from the binary image by a feature extraction process of extracting a change point of a pixel value. An image processing method, wherein a boundary line separated from the outline by a predetermined pixel width is set outside the inspection object, and the inside of the boundary line is set as an inspection region.
【請求項4】 画像入力装置より入力された対象画像を
微分し、微分絶対値の変化が所定値以上になるエッジを
追跡することにより対象画像から検査対象の外形線を抽
出した後、検査対象の外側に上記外形線から所定画素幅
だけ離れた境界線を設定し、上記境界線内を検査領域と
したことを特徴とする画像処理方法。
4. An object to be inspected after differentiating an object image inputted from the image input device and extracting an outline of the object to be inspected from the object image by tracing an edge at which a change in a differential absolute value exceeds a predetermined value. An image processing method, wherein a boundary line separated by a predetermined pixel width from the outline is set outside the outline, and the inside of the boundary line is set as an inspection area.
【請求項5】 画像入力装置より入力された対象画像と
あらかじめ登録されているテンプレート画像とを照合す
ることにより対象画像とテンプレート画像との類似度を
検査する画像処理方法において、検査対象を含む濃淡画
像の中で検査対象を囲むように設定した所定の検査領域
内の濃度分布を求め、上記検査領域と同じ大きさの検査
領域内でテンプレート画像について求めた濃度分布の平
均値と対象画像から求めた濃度分布の平均値との差をオ
フセット値とし、対象画像とテンプレート画像との各画
素の濃度差を画素値とする差画像の画素値に対してあら
かじめ設定してある判定範囲をオフセット値分だけシフ
トさせ、上記差画像の各画素の画素値がシフトさせた判
定範囲を逸脱するときに対象画像とテンプレート画像の
不一致部分として抽出することを特徴とする画像処理方
法。
5. An image processing method for checking the similarity between a target image and a template image by comparing a target image input from an image input device with a pre-registered template image. A density distribution in a predetermined inspection area set so as to surround the inspection target in the image is obtained, and the density distribution is obtained from an average value of the density distribution obtained for the template image in the inspection area having the same size as the inspection area and the target image. The difference between the average value of the density distribution and the average value of the density distribution is set as the offset value, and the determination range preset for the pixel value of the difference image in which the density difference between each pixel of the target image and the template image is set as the pixel value is the offset value And when the pixel value of each pixel of the difference image deviates from the shifted determination range, it is extracted as a mismatched portion between the target image and the template image. An image processing method characterized by outputting.
【請求項6】 対象画像とテンプレート画像との濃度分
布は、各画像の検査領域内から1画素単位で求めた濃度
により生成されることを特徴とする請求項5記載の画像
処理方法。
6. The image processing method according to claim 5, wherein the density distribution between the target image and the template image is generated based on the density obtained for each pixel from the inspection area of each image.
JP18099896A 1996-07-10 1996-07-10 Image processing method Expired - Fee Related JP3823379B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP18099896A JP3823379B2 (en) 1996-07-10 1996-07-10 Image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP18099896A JP3823379B2 (en) 1996-07-10 1996-07-10 Image processing method

Publications (2)

Publication Number Publication Date
JPH1027246A true JPH1027246A (en) 1998-01-27
JP3823379B2 JP3823379B2 (en) 2006-09-20

Family

ID=16092953

Family Applications (1)

Application Number Title Priority Date Filing Date
JP18099896A Expired - Fee Related JP3823379B2 (en) 1996-07-10 1996-07-10 Image processing method

Country Status (1)

Country Link
JP (1) JP3823379B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005284509A (en) * 2004-03-29 2005-10-13 Matsushita Electric Ind Co Ltd Image processor
FR2977964A1 (en) * 2011-07-13 2013-01-18 Commissariat Energie Atomique METHOD FOR ACQUIRING A ROTATION ANGLE AND COORDINATES OF A ROTATION CENTER
US10690490B2 (en) 2016-09-21 2020-06-23 SCREEN Holdings Co., Ltd. Method of detecting positional displacement of sample container, image capturing method employing same, and sample container positional displacement detecting device

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01220075A (en) * 1988-02-29 1989-09-01 Nippon Taisanbin Kogyo Kk Displaying part reading method
JPH02230381A (en) * 1989-03-02 1990-09-12 Toyota Motor Corp Work inspecting device
JPH0362284A (en) * 1989-07-31 1991-03-18 Nec Corp Character line extracting device
JPH0465785A (en) * 1990-07-05 1992-03-02 Hitachi Eng Co Ltd Device for recognizing character
JPH0546744A (en) * 1991-08-12 1993-02-26 Omron Corp Image processor
JPH06282684A (en) * 1993-03-25 1994-10-07 Nec Corp Character recognizing device
JPH07190739A (en) * 1993-12-27 1995-07-28 Sharp Corp Appearance inspection method for semi-conductor chip and its device
JPH08101893A (en) * 1994-09-30 1996-04-16 Omron Corp Model image data registering device for image processor
JPH08180139A (en) * 1994-09-27 1996-07-12 Ind Technol Res Inst Method and apparatus for on-line recognition of unrestrainedhandwritten alphanumeric character

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01220075A (en) * 1988-02-29 1989-09-01 Nippon Taisanbin Kogyo Kk Displaying part reading method
JPH02230381A (en) * 1989-03-02 1990-09-12 Toyota Motor Corp Work inspecting device
JPH0362284A (en) * 1989-07-31 1991-03-18 Nec Corp Character line extracting device
JPH0465785A (en) * 1990-07-05 1992-03-02 Hitachi Eng Co Ltd Device for recognizing character
JPH0546744A (en) * 1991-08-12 1993-02-26 Omron Corp Image processor
JPH06282684A (en) * 1993-03-25 1994-10-07 Nec Corp Character recognizing device
JPH07190739A (en) * 1993-12-27 1995-07-28 Sharp Corp Appearance inspection method for semi-conductor chip and its device
JPH08180139A (en) * 1994-09-27 1996-07-12 Ind Technol Res Inst Method and apparatus for on-line recognition of unrestrainedhandwritten alphanumeric character
JPH08101893A (en) * 1994-09-30 1996-04-16 Omron Corp Model image data registering device for image processor

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005284509A (en) * 2004-03-29 2005-10-13 Matsushita Electric Ind Co Ltd Image processor
JP4525130B2 (en) * 2004-03-29 2010-08-18 パナソニック株式会社 Image processing device
FR2977964A1 (en) * 2011-07-13 2013-01-18 Commissariat Energie Atomique METHOD FOR ACQUIRING A ROTATION ANGLE AND COORDINATES OF A ROTATION CENTER
EP2557526A1 (en) 2011-07-13 2013-02-13 Commissariat à l'Énergie Atomique et aux Énergies Alternatives Method for acquiring an angle of rotation and coordinates of a centre of rotation
US10690490B2 (en) 2016-09-21 2020-06-23 SCREEN Holdings Co., Ltd. Method of detecting positional displacement of sample container, image capturing method employing same, and sample container positional displacement detecting device

Also Published As

Publication number Publication date
JP3823379B2 (en) 2006-09-20

Similar Documents

Publication Publication Date Title
JP6598162B2 (en) Visual identification method of multi-type BGA chip based on linear clustering
CN111474184A (en) AOI character defect detection method and device based on industrial machine vision
US5774574A (en) Pattern defect detection apparatus
CN108985305B (en) Laser etching industrial detonator coded image positioning and correcting method
CN105066892A (en) BGA element detecting and positioning method based on linear clustering analysis
CN106446894A (en) Method for recognizing position of spherical object based on contour
CN111354047A (en) Camera module positioning method and system based on computer vision
Said et al. Automated detection and classification of non-wet solder joints
JP2002228423A (en) Tire detecting method and device
CN110415296A (en) A kind of localization method having rectangular-shaped electrical part under shade illumination
CN114863492A (en) Method and device for repairing low-quality fingerprint image
JP3814353B2 (en) Image segmentation method and image segmentation apparatus
CN114359322A (en) Image correction and splicing method, and related device, equipment, system and storage medium
JPH1027246A (en) Picture processing method
JP3456096B2 (en) Shape inspection method
US6526165B1 (en) Methods and apparatuses for refining a geometric description of an object having a plurality of extensions
CN111553885B (en) SOT type chip pin parameter detection method based on rollback tree
JP2000132684A (en) External appearance inspecting method
JP3700214B2 (en) Dimension measuring device
JP2964594B2 (en) Mark inspection method
JP2000357287A (en) Method and device for number plate recognition
JP3919207B2 (en) Appearance inspection device
JPH1115975A (en) Appearance inspecting method
JP2001357401A (en) Picture processing method
JPH0760459B2 (en) Corner detector

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050715

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050726

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050926

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20051227

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060126

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

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20060320

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: 20060606

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060619

LAPS Cancellation because of no payment of annual fees