JP2002230562A - Image processing method and device therefor - Google Patents

Image processing method and device therefor

Info

Publication number
JP2002230562A
JP2002230562A JP2001360985A JP2001360985A JP2002230562A JP 2002230562 A JP2002230562 A JP 2002230562A JP 2001360985 A JP2001360985 A JP 2001360985A JP 2001360985 A JP2001360985 A JP 2001360985A JP 2002230562 A JP2002230562 A JP 2002230562A
Authority
JP
Japan
Prior art keywords
line segment
line
line segments
label
image
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
JP2001360985A
Other languages
Japanese (ja)
Other versions
JP3661635B2 (en
Inventor
Shiro Fujieda
紫朗 藤枝
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.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
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 Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to JP2001360985A priority Critical patent/JP3661635B2/en
Publication of JP2002230562A publication Critical patent/JP2002230562A/en
Application granted granted Critical
Publication of JP3661635B2 publication Critical patent/JP3661635B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To precisely extract rectilinear portions of the contour of a subject and make measurements of the position and direction of the subject and the process of extracting defects in the contour based on the rectilinear portions extracted. SOLUTION: A control part 8 extracts edge pixels on a gray image of the subject of processing and forms a histogram showing the degree of edge pixels on the image for each edge direction. The control part 8 then extracts peaks on the histogram, and after a respective label is set for an angle corresponding to each peak, labels set for the corresponding angles are allocated to the edge pixels having the directions corresponding to the angles. Further, the control part 8 allocates a respective label to each assembly of consecutive edge pixels for the same label on a labeled image so that the assembly of edge pixels constituting a line on the image is divided into sub-assemblies. Thereafter, the control part extracts a line matching extraction requirements, using the characteristic quantities of the sub-assemblies.

Description

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

【0001】[0001]

【発明の属する技術分野】この発明は、コンピュータに
より濃淡画像データを処理する分野に属するもので、特
に、輪郭に直線部分を含む物体を観測対象として、その
物体の輪郭の直線部分を抽出したり、それを利用して物
体の位置や向きなどを計測したり、輪郭形状に欠陥が生
じていないかを検査するなどの処理を行う方法および装
置に関連する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to the field of processing gray-scale image data by a computer, and more particularly, to an object having a straight line portion in its contour as an observation target and extracting a straight line portion of the contour of the object. The present invention relates to a method and an apparatus for performing processing such as measuring the position and orientation of an object using the information, and inspecting whether a defect has occurred in a contour shape.

【0002】[0002]

【従来の技術】濃淡画像上で対象物の位置や向きを観測
したり、輪郭上の欠陥を検査する上で、対象物の輪郭の
直線部分を抽出したい場合がある。従来より、対象物の
輪郭を抽出するときには、2値化処理による方法、濃度
勾配の大きさに基づく方法、膨張画像および収縮画像を
利用する方法などが用いられる。
2. Description of the Related Art In observing the position and orientation of an object on a grayscale image and inspecting a defect on the outline, it is sometimes necessary to extract a straight line portion of the outline of the object. Conventionally, when extracting the contour of an object, a method based on a binarization process, a method based on the magnitude of a density gradient, a method using an expanded image and a contracted image, and the like are used.

【0003】2値化処理による方法では、濃淡画像を所
定のしきい値によって白画素領域と黒画素領域に2値化
し、これらの領域の境界に位置する画素によって輪郭線
を構成する。濃度勾配の大きさに基づく方法では、濃淡
画像を構成する各画素における濃度勾配の大きさが所定
のしきい値を超える場合にその画素を輪郭線を構成する
画素とする。膨張画像および収縮画像を利用する方法で
は、原画像の明るい領域を拡張させた膨張画像と原画像
の明るい領域を収縮させた収縮画像とを作成し、膨張画
像と収縮画像との差分画像を作成することにより輪郭線
を抽出する。
In the binarization method, a grayscale image is binarized into a white pixel region and a black pixel region by a predetermined threshold value, and an outline is formed by pixels located at the boundary between these regions. In the method based on the magnitude of the density gradient, when the magnitude of the density gradient at each pixel forming the grayscale image exceeds a predetermined threshold value, the pixel is set as a pixel forming the contour line. In the method using the dilated image and the contracted image, a dilated image in which a bright region of the original image is expanded and a contracted image in which the bright region of the original image is contracted are created, and a difference image between the dilated image and the contracted image is created. To extract a contour line.

【0004】[0004]

【発明が解決しようとする課題】これらいずれの方法に
よっても、抽出されるのは輪郭線の全体であって、輪郭
線の直線部分のみを抽出することはできない。輪郭線の
直線部分を抽出するためには、別途輪郭線を構成する画
素の連結パターンを評価して直線とみなせる部分を特定
することが考えられる。例えば、輪郭線を構成する画素
に順に着目していき、これらの連結方向が一定である範
囲を直線とみなすような方法である。しかし、連結方向
の分解能を高めようとすると、数画素にわたる範囲での
連結方向の平均をとる必要があるので、直線を中断する
微小な欠陥があっても無視される傾向がある。また、輪
郭線に複数画素分の線幅があるときには、直線抽出の適
切なアルゴリズムを設定すること自体が困難である。
In any of these methods, the whole contour is extracted, and it is not possible to extract only the straight portion of the contour. In order to extract a straight line portion of the contour, it is conceivable to separately evaluate a connection pattern of pixels constituting the contour and specify a portion that can be regarded as a straight line. For example, there is a method in which attention is paid to pixels constituting the contour in order, and a range in which the connection direction is constant is regarded as a straight line. However, in order to increase the resolution in the connection direction, it is necessary to average the connection direction over a range of several pixels, so that even a minute defect that interrupts the straight line tends to be ignored. In addition, when the contour has a line width of a plurality of pixels, it is difficult to set an appropriate algorithm for straight line extraction.

【0005】さらに、2値化による方法、濃度勾配の大
きさに基づく方法、膨張画像および収縮画像を利用する
方法のいずれによっても、画像の状態(例えば画像の背
景部分と対象物部分との濃度差、照明の均一さなど)の
相違により輪郭線の状態(輪郭線の線幅、位置、微小な
凹凸の大きさなど)が変動するのであるが、このような
変動にかかわらず安定して輪郭線の直線部分を抽出する
ことは、画素の連結パターンの評価に基づく方法では困
難である。
[0005] Furthermore, the state of the image (for example, the density of the background portion and the object portion of the image) can be determined by any of a binarization method, a method based on the magnitude of a density gradient, and a method using an expanded image and a contracted image. The state of the outline (line width, position, size of minute unevenness, etc.) of the outline fluctuates due to differences in the difference, uniformity of illumination, etc. It is difficult to extract a straight line portion of a line by a method based on evaluation of a pixel connection pattern.

【0006】この発明は上記問題点に着目してなされた
もので、濃淡画像において対象物の輪郭の直線部分を的
確に抽出することを目的とする。この発明の他の目的
は、濃淡画像の状態にかかわらず、特に背景部分と対象
物部分との濃度差が小さい場合や照明が均一でない場合
でも、対象物の輪郭の直線部分を的確に抽出することで
ある。さらにこの発明の他の目的は、抽出した対象物の
輪郭の直線部分に基づいて、対象物の位置や向きを計測
したり、対象物の輪郭上の欠陥を抽出する処理を行うこ
とである。
SUMMARY OF THE INVENTION The present invention has been made in view of the above problems, and has as its object to accurately extract a straight line portion of a contour of an object in a grayscale image. Another object of the present invention is to accurately extract a straight line portion of a contour of an object regardless of the state of a grayscale image, particularly when the density difference between the background portion and the object portion is small or when illumination is not uniform. That is. Still another object of the present invention is to perform processing for measuring the position and orientation of an object based on a straight line portion of the extracted outline of the object and extracting defects on the outline of the object.

【0007】[0007]

【課題を解決するための手段】この発明による濃淡画像
を処理する方法は、濃淡画像に表される対象物像の輪郭
に直線部分が含まれるときに、その直線の方向毎に個別
のラベルを設定するラベル設定ステップと、濃淡画像に
含まれるエッジ画素であってそのエッジ画素の方向が前
記直線の方向のいずれかと一致するようなエッジ画素に
対して、その一致した方向に対応するラベルを割り当て
る画素ラベル付けステップと、同一のラベルが割り当て
られており、かつ、濃淡画像上で連続しているとみなし
得るエッジ画素の集合を線分として抽出する線分抽出ス
テップとを順に実行するものである。
According to the method of processing a grayscale image according to the present invention, when the outline of an object image represented by the grayscale image includes a straight line portion, an individual label is provided for each direction of the straight line. A label setting step to be set, and assigning a label corresponding to the coincident direction to an edge pixel included in the grayscale image, the edge pixel direction of which coincides with one of the directions of the straight line. A pixel labeling step and a line segment extracting step of extracting a set of edge pixels to which the same label is assigned and which can be regarded as being continuous on the grayscale image as a line segment are sequentially executed. .

【0008】エッジ画素とは、濃淡画像において対象物
の輪郭線を構成する画素である。なお、輪郭線の線幅は
1画素に限らず、複数画素分の線幅であってよい。エッ
ジ画素を抽出するための好ましい具体的処理として、濃
度勾配の大きさが所定の値より大きい画素をエッジ画素
とする処理を採用することができる。また、この処理に
よって抽出された画素のすべてをエッジ画素とすること
に限らず、この処理に続けて細線化処理のような対象画
素を絞り込む処理を実行した後に残った画素をエッジ画
素とすることもできる。一方、具体的な処理過程におい
て濃度勾配の大きさに着目しないことも可能であり、例
えば2値化した画像の輪郭線に対応する画素をエッジ画
素とすることができる。しかしいずれの処理によって
も、結果的には濃度勾配の大きさが相対的に大きな画素
が抽出される。
An edge pixel is a pixel that forms the contour of an object in a grayscale image. The line width of the outline is not limited to one pixel, but may be a line width of a plurality of pixels. As a preferred specific process for extracting an edge pixel, a process in which a pixel whose density gradient is larger than a predetermined value is set as an edge pixel can be employed. In addition, all pixels extracted by this processing are not limited to edge pixels, and pixels remaining after executing processing for narrowing down target pixels, such as thinning processing, following this processing are assumed to be edge pixels. Can also. On the other hand, it is also possible not to pay attention to the magnitude of the density gradient in a specific processing step. For example, a pixel corresponding to a contour line of a binarized image can be an edge pixel. However, in any case, a pixel having a relatively large density gradient is extracted as a result.

【0009】エッジ画素の方向とは、通常の定義によれ
ば、エッジ画素における濃度勾配の方向に直交する方向
である。エッジ画素の方向をこのように定義するのは、
あるエッジ画素が対象物像の輪郭の直線部分に含まれて
いる場合にそのエッジ画素の方向とその直線の方向とが
同じ方向として示されるようにする必要があるからであ
る。したがって実際の処理においては、例えば直線の方
向を通常の意味とは相違して直線の法線方向によって定
義し、かつ、エッジ画素の方向をエッジ画素における濃
度勾配の方向によって定義する場合のように、直線の方
向およびエッジ画素の方向の間の関係が上記通常の定義
による場合と等価になるような直線の方向およびエッジ
画素の方向の定義を採用して本発明を実施することもで
きる。エッジ画素の方向と直線の方向との一致は、厳密
に一致する場合に限らず、方向の差が画像処理の目的に
応じて設定された所定の範囲内である場合を含む。
According to a general definition, the direction of the edge pixel is a direction orthogonal to the direction of the density gradient at the edge pixel. The definition of the edge pixel direction in this way is
This is because, when a certain edge pixel is included in the straight line portion of the contour of the target object image, it is necessary to indicate the direction of the edge pixel and the direction of the straight line as the same direction. Therefore, in the actual processing, for example, the direction of the straight line is defined by the normal direction of the straight line unlike the ordinary meaning, and the direction of the edge pixel is defined by the direction of the density gradient at the edge pixel. The present invention can also be implemented by adopting the definition of the direction of the straight line and the direction of the edge pixel such that the relationship between the direction of the straight line and the direction of the edge pixel becomes equivalent to the case according to the usual definition. The coincidence between the direction of the edge pixel and the direction of the straight line is not limited to the case of strict coincidence, but also includes the case where the direction difference is within a predetermined range set according to the purpose of image processing.

【0010】2つのエッジ画素が連続しているとみなす
ことができるのは、必ずしもそれらの画素の間に他の画
素が介在していない場合に限らず、そこで採用している
連続判定方法において連続しているとする判定基準を各
画素が満たす状態にあればよい。着目画素に対して上下
左右の4近傍やこれに斜め方向を加えた8近傍において
判定対象の画素があれば画素が連続していると判定する
方法が用いられることが多いが、近傍の範囲をさらに大
きく設定することもできる。
The fact that two edge pixels can be regarded as being continuous is not necessarily limited to the case where no other pixel is interposed between the pixels, but the continuous judgment method adopted therefor is not limited thereto. It suffices if each pixel satisfies the criterion for judging that it has been performed. If there is a pixel to be determined in the vicinity of the pixel of interest in the four neighboring areas (upper, lower, left, and right, or in the eight neighboring areas obtained by adding the oblique direction), a method of determining that the pixels are continuous is often used. It can be set larger.

【0011】この発明によれば、輪郭線を構成するエッ
ジ画素においては濃度勾配の大きさが相対的に大きいた
めにエッジ画素の方向を誤差小さく求めることができる
ことに着目し、エッジ画素の方向に対応してエッジ画素
に割り当てられたラベルが共通することおよびエッジ画
素が連続していることを条件として抽出したエッジ画素
の集合によって線分を表すようにしたので、対象物の輪
郭の直線部分を的確に抽出することができる。また、濃
淡画像の状態にかかわらず、特に背景部分と対象物部分
との濃度差が小さい場合や照明が均一でない場合でも、
エッジ画素の方向は安定して求めることができるので、
このような場合でも対象物の輪郭の直線部分を的確に抽
出することができる。
According to the present invention, attention is paid to the fact that the direction of the edge pixel can be obtained with a small error because the density gradient is relatively large in the edge pixel forming the contour line. Since the line segment is represented by a set of edge pixels extracted on the condition that the labels assigned to the edge pixels are common and that the edge pixels are continuous, the straight line portion of the outline of the object is It can be accurately extracted. Also, regardless of the state of the grayscale image, especially when the density difference between the background portion and the object portion is small or when the illumination is not uniform,
Since the direction of the edge pixel can be obtained stably,
Even in such a case, the straight line portion of the contour of the object can be accurately extracted.

【0012】この発明の各ステップは、濃淡画像の全体
を対象として実行してもよいし、濃淡画像の一部に計測
領域を設定して、計測領域についてのみ実行してもよ
い。
Each step of the present invention may be executed for the entire gray image, or a measurement area may be set in a part of the gray image and executed only for the measurement area.

【0013】この発明による画像処理方法の一実施態様
によれば、前記ラベル設定ステップは、エッジ画素の方
向毎にエッジ画素の数の度合を示すヒストグラムを作成
するヒストグラム作成ステップと、そのヒストグラム上
の極大値を抽出して、極大値に対応するエッジ画素の方
向毎に個別のラベルを設定するピークラベル設定ステッ
プとを実行することにより、対象物像の輪郭に含まれる
直線の方向毎に個別のラベルを設定するものとすること
ができる。さらに、前記画素ラベル付けステップは、ピ
ークラベル設定ステップにより設定されたラベルを各ラ
ベルに対応するエッジ画素の方向を有するエッジ画素に
割り当てることにより、前記ラベルの割当を行うものと
することができる。
According to one embodiment of the image processing method according to the present invention, the label setting step includes a histogram creation step of creating a histogram indicating the degree of the number of edge pixels for each direction of the edge pixels, and a histogram creation step. A peak label setting step of extracting a local maximum value and setting an individual label for each direction of an edge pixel corresponding to the local maximum value, thereby obtaining a separate label for each direction of a straight line included in the contour of the target object image. A label can be set. Further, in the pixel labeling step, the label can be assigned by assigning the label set in the peak label setting step to an edge pixel having a direction of an edge pixel corresponding to each label.

【0014】エッジ画素の方向毎のエッジ画素の数の度
合としては、エッジ画素の方向毎のエッジ画素の数その
もの(いわゆる度数)を採用することができ、また、エ
ッジ画素の数そのものに代えて、各エッジ画素における
濃度勾配の大きさで重み付けした(例えば濃度勾配の大
きさを乗じた)エッジ画素の数を採用することもでき
る。
As the degree of the number of edge pixels in each direction of the edge pixels, the number of edge pixels in each direction of the edge pixel itself (so-called frequency) can be adopted. Alternatively, the number of edge pixels weighted by the magnitude of the density gradient at each edge pixel (for example, multiplied by the magnitude of the density gradient) may be employed.

【0015】極大値に対応するエッジ画素の方向として
は、その極大値が属するヒストグラムの区分に該当する
エッジ画素の方向を採用することができ、さらに極大値
が属する区分に隣接する区分も含めた複数の区分に該当
するエッジ画素の方向を採用することもできる。
As the direction of the edge pixel corresponding to the maximum value, the direction of the edge pixel corresponding to the section of the histogram to which the maximum value belongs can be adopted, and the section adjacent to the section to which the maximum value belongs is also included. Edge pixel directions corresponding to a plurality of sections may be employed.

【0016】この実施態様によれば、対象物の輪郭線の
直線部分の方向がいずれの方向であっても、またその方
向があらかじめわかっていなくても、輪郭線の直線部分
を抽出することができる。
According to this embodiment, it is possible to extract the straight line portion of the contour line regardless of the direction of the straight line portion of the contour line of the object, even if the direction is not known in advance. it can.

【0017】なお、この実施態様においては、ヒストグ
ラムの極大値を抽出する際に、その抽出のための条件を
設定してもよい。たとえば大きいほうから所定の数まで
の極大値、所定の値よりも大きい極大値などの条件を設
定することができる。
In this embodiment, when extracting the maximum value of the histogram, conditions for the extraction may be set. For example, conditions such as a maximum value from a larger value to a predetermined number, a maximum value larger than a predetermined value, and the like can be set.

【0018】さらに前記線分抽出ステップにおいて抽出
された線分の中に線分間の方向ずれ量が所定範囲内であ
り、かつ、線分間の位置ずれ量が所定範囲内である線分
の組があるとき、これらの線分を1本の線分に統合する
線分統合ステップをさらに実行するようにしてもよい。
このようにすれば、対象物の輪郭に欠けや突出などの欠
陥があるために線分が分断されている場合でも、分断さ
れた線分を統合することができるので、欠陥がある対象
物についても、位置や向きを精度よく計測することが可
能となる。
Further, among the line segments extracted in the line segment extracting step, a set of line segments whose direction shift amount within the line segment is within a predetermined range and position shift amount within the line segment within a predetermined range is included. At some point, a line segment integration step of integrating these line segments into one line segment may be further executed.
In this way, even if the line segment is divided due to a defect such as a chip or a protrusion in the outline of the object, the divided line segment can be integrated. Also, it is possible to accurately measure the position and orientation.

【0019】また前記線分抽出ステップにおいて抽出さ
れた線分または前記線分統合ステップにおいて統合され
た線分の中から所定の条件を満たす線分を選択する線分
選択ステップをさらに実行するようにしてもよい。この
ようにすれば、その画像処理の具体的目的に適合する線
分を選択することができる。線分を抽出する条件として
は、線分の長さの範囲、基準方向に対する角度の範囲、
位置の範囲、また、2つの線分の端点間の距離の範囲、
2つの線分がなす角度の範囲、線分の長さの順位などを
採用することができる。
Further, a line segment selecting step of selecting a line segment satisfying a predetermined condition from the line segments extracted in the line segment extracting step or the line segments integrated in the line segment integrating step is further executed. You may. In this way, it is possible to select a line segment suitable for the specific purpose of the image processing. Conditions for extracting a line segment include a range of the length of the line segment, a range of an angle with respect to the reference direction,
The range of positions, the range of distance between the endpoints of the two line segments,
An angle range formed by two line segments, a rank order of the line segments, and the like can be adopted.

【0020】また前記線分選択ステップにおいて選択さ
れた線分の位置または選択された複数の線分の延長線上
の交点の位置を前記濃淡画像上で識別可能に表示する表
示ステップをさらに実行するようにしてもよい。このよ
うにすれば、線分の抽出および選択の状況をユーザーに
提示することができる。ユーザーはこの表示を見て、対
象物の角などの意図したとおりの箇所が正しく計測対象
となっているかどうかの確認をすることができる。
Further, a display step of displaying the position of the line segment selected in the line segment selecting step or the position of the intersection on the extension line of the plurality of selected line segments so as to be identifiable on the grayscale image may be further executed. It may be. In this way, the status of line segment extraction and selection can be presented to the user. By viewing this display, the user can confirm whether the intended portion such as the corner of the object is correctly measured.

【0021】この発明による画像処理方法の他の実施態
様によれば、前記線分抽出ステップにおける線分の抽出
状態を用いて対象物の輪郭の直線部分における欠陥の有
無を判別する欠陥判別ステップをさらに実行することが
できる。この実施態様によれば、エッジ画素の方向が同
一とみなせるようなエッジ画素の連続性に基づいて線分
を抽出しているところ、輪郭の欠陥が数画素程度の大き
さの微小なものであってもエッジ画素の方向は大きく変
動するため、このような微小な欠陥も高い確度で検出さ
れる。
According to another embodiment of the image processing method according to the present invention, there is provided a defect determining step for determining the presence or absence of a defect in a straight line portion of the outline of the object using the extracted state of the line segment in the line segment extracting step. More can be done. According to this embodiment, the line segment is extracted based on the continuity of the edge pixels such that the directions of the edge pixels can be considered to be the same. However, the defect of the outline is as small as several pixels. However, since the direction of the edge pixel greatly changes, such a minute defect is detected with high accuracy.

【0022】具体的には、前記欠陥判別ステップは、前
記線分抽出ステップで抽出された線分の中に線分間の方
向ずれ量が所定範囲内であり、かつ、線分間の位置ずれ
量が所定範囲内である線分の組があるとき、これら線分
の間に欠陥が存在すると判別するものとすることができ
る。また、前記欠陥判別ステップは、前記線分抽出ステ
ップで抽出された線分の数を所定の基準値と比較し、両
者の値が異なるときに対象物の輪郭の直線部分に欠陥が
存在すると判別するものとしてもよい。
Specifically, in the defect determining step, in the line segment extracted in the line segment extracting step, the direction deviation amount between the line segments is within a predetermined range, and the positional deviation amount between the line segments is within a predetermined range. When there is a set of line segments within the predetermined range, it can be determined that a defect exists between these line segments. In the defect determining step, the number of line segments extracted in the line segment extracting step is compared with a predetermined reference value, and when the two values are different, it is determined that a defect exists in a straight line portion of the contour of the object. You may do it.

【0023】つぎに、この発明による画像処理方法の他
の実施態様によれば、前記ラベル設定ステップは、対象
物の輪郭における直線部分の方向として想定される方向
毎に個別のラベルを設定するものとし、前記画素ラベル
付けステップは、そのエッジ画素の方向がそのような想
定される方向のいずれかと一致するようなエッジ画素に
対して、その一致した方向に対応する前記ラベルを割り
当てるものとすることができる。
According to another embodiment of the image processing method according to the present invention, the label setting step sets an individual label for each direction assumed as a direction of a straight line portion in the outline of the object. Wherein the pixel labeling step assigns the label corresponding to the coincident direction to an edge pixel whose direction of the edge pixel coincides with any of such assumed directions. Can be.

【0024】対象物の向きが決まっているなど、あらか
じめ輪郭の直線部分の方向が想定できるときは、そのよ
うな方向毎に個別のラベルを設定することにより、処理
の対象とする濃淡画像毎に前述のヒストグラムを作成し
なくてすむので、処理を高速化することが可能となる。
また、この実施態様の方法を対象物の合格判定や分類判
定のために利用することもできる。すなわち、対象物の
輪郭に想定される方向の直線部分があるかどうかで対象
物の合格不合格や種類を判定するのである。なお、先に
説明した線分統合ステップ、線分選択ステップおよび欠
陥判別ステップは、この実施態様においても採用するこ
とができる。
When the direction of the straight line portion of the contour can be assumed in advance, such as when the direction of the object is determined, an individual label is set for each of such directions, so that each gray-scale image to be processed is set. Since it is not necessary to create the above-mentioned histogram, the processing can be sped up.
Further, the method of this embodiment can also be used for pass judgment and classification judgment of the object. That is, the pass / fail or the type of the object is determined based on whether or not the outline of the object has a straight line portion in the assumed direction. The above-described line segment integration step, line segment selection step, and defect determination step can be employed in this embodiment.

【0025】この発明による濃淡画像を処理する装置
は、濃淡画像を入力する手段と、前記濃淡画像に含まれ
るエッジ画素を抽出する手段と、前記各エッジ画素にお
けるエッジ画素の方向を求める手段と、前記濃淡画像に
表される対象物像の輪郭の直線部分の方向を設定する方
向設定手段と、前記直線の方向毎に個別のラベルを設定
するラベル設定手段と、そのエッジ画素の方向が前記直
線の方向のいずれかと一致するようなエッジ画素に対し
て、その一致した方向に対応する前記ラベルを割り当て
る画素ラベル付け手段と、同一の前記ラベルが割り当て
られており、かつ、前記濃淡画像上で連続するとみなし
得るエッジ画素の集合を線分として抽出する線分抽出手
段とを具備して成るものである。
According to the present invention, there is provided an apparatus for processing a grayscale image, comprising: means for inputting a grayscale image; means for extracting edge pixels included in the grayscale image; means for determining a direction of an edge pixel in each of the edge pixels; Direction setting means for setting the direction of a straight line portion of the outline of the object image represented in the grayscale image; label setting means for setting an individual label for each direction of the straight line; Pixel labeling means for assigning the label corresponding to the coincident direction to an edge pixel that coincides with any one of the directions, and the same label is assigned, and Line segment extracting means for extracting a set of edge pixels which can be regarded as such as a line segment.

【0026】この発明による画像処理装置によれば、入
力した濃淡画像を対象としてエッジ画素が抽出されると
ともにエッジ画素の方向が求められ、一方で濃淡画像に
表される対象物像の輪郭の直線部分の方向毎に個別のラ
ベルが設定され、エッジ画素の方向が直線の方向のいず
れかと一致するようなエッジ画素に対して、一致した方
向に対応するラベルが割り当てられる。さらに同一のラ
ベルが割り当てられており、かつ、濃淡画像上で連続し
ているとみなし得るエッジ画素の集合が線分として抽出
される。このようにして、対象物の輪郭の抽出部分を的
確に抽出することができる。
According to the image processing apparatus of the present invention, an edge pixel is extracted and a direction of the edge pixel is determined for the input grayscale image, while a straight line of the contour of the object image represented in the grayscale image is obtained. An individual label is set for each direction of the portion, and a label corresponding to the matching direction is assigned to an edge pixel whose edge pixel direction matches one of the straight line directions. Further, a set of edge pixels to which the same label is assigned and which can be regarded as being continuous on the grayscale image is extracted as a line segment. In this manner, the extracted portion of the outline of the object can be accurately extracted.

【0027】濃淡画像を入力する手段は、例えば、カメ
ラやスキャナなどの画像生成手段に接続され、これらの
手段より生成された濃淡画像を取り込む手段であって、
インターフェイス回路、A/D変換回路などにより構成
される。ただし画像を入力するための構成は、これに限
らず、通信により伝送された画像を受け付ける回路、所
定の記録媒体に保存された画像を読み出す読取り装置な
どによって構成することも可能である。
The means for inputting the grayscale image is, for example, a means connected to image generating means such as a camera or a scanner, and for taking in the grayscale image generated by these means.
It is composed of an interface circuit, an A / D conversion circuit and the like. However, the configuration for inputting an image is not limited to this, and may be configured by a circuit that receives an image transmitted by communication, a reading device that reads an image stored in a predetermined recording medium, or the like.

【0028】エッジ画素を抽出する手段から線分抽出手
段にいたる各手段および後述の付加的またはより具体化
された各手段は、コンピュータのハードウェアとそこで
動作するソフトウェアとして実現することができるし、
それぞれのまたはいくつかの手段をASIC(Applicati
on Specific Integrated Circuit)などの回路ブロック
で実現し、各回路ブロックの連携動作をコンピュータで
制御することにより実現することもできる。
Each means from the means for extracting edge pixels to the means for extracting line segments and each additional or more specific means to be described later can be realized as computer hardware and software operating thereon.
ASIC (Applicati
on Specific Integrated Circuit), and cooperative operation of each circuit block is controlled by a computer.

【0029】エッジ画素を抽出する手段およびエッジ画
素の方向を求める手段としては、ソーベルフィルタなど
のエッジ抽出フィルタを使用することができる。エッジ
画素を抽出する手段としては、これに限らず、コンピュ
ータの画像メモリ上で先に説明した種々の輪郭抽出方法
を実行してもよい。
As means for extracting the edge pixels and means for determining the direction of the edge pixels, an edge extraction filter such as a Sobel filter can be used. The means for extracting edge pixels is not limited to this, and the various contour extraction methods described above may be executed on an image memory of a computer.

【0030】この発明による画像処理装置の一実施態様
によれば、前記方向設定手段は、エッジ画素の方向毎に
エッジ画素の数の度合を示すヒストグラムを作成するヒ
ストグラム作成手段と、そのヒストグラム上の極大値を
抽出して、極大値に対応するエッジ画素の方向を直線の
方向として設定するピーク方向設定手段とを含むものと
することができる。また前記ラベル設定手段は、ピーク
方向設定手段により設定された方向毎に個別のラベルを
設定するものとし、前記画素ラベル付け手段は、前記ラ
ベル設定手段により設定されたラベルを各ラベルに対応
するエッジ画素の方向を有するエッジ画素に割り当てる
ものとすることができる。
According to one embodiment of the image processing apparatus according to the present invention, the direction setting means includes a histogram creating means for creating a histogram indicating the degree of the number of edge pixels for each direction of the edge pixels, Peak direction setting means for extracting the maximum value and setting the direction of the edge pixel corresponding to the maximum value as the direction of a straight line. The label setting means sets an individual label for each direction set by the peak direction setting means. The pixel labeling means sets the label set by the label setting means to an edge corresponding to each label. It may be assigned to an edge pixel having a pixel direction.

【0031】この実施態様において、前記線分抽出手段
によって抽出された線分の中に線分間の方向ずれ量が所
定範囲内であり、かつ、線分間の位置ずれ量が所定範囲
内である線分の組があるとき、これらの線分を1本の線
分に統合する線分統合手段をさらに具備してもよい。
In this embodiment, in the line segments extracted by the line segment extracting means, the direction shift amount between the line segments is within a predetermined range, and the position shift amount between the line segments is within a predetermined range. When there is a set of minutes, a line segment integrating means for integrating these line segments into one line segment may be further provided.

【0032】また、前記線分抽出手段によって抽出され
た線分または前記線分統合手段によって統合された線分
の中から所定の条件を満たす線分を選択する線分選択手
段とをさらに具備してもよい。この線分を選択するため
の所定の条件は、これを入力するための入力手段をさら
に設けて外部から入力してもよいし、これを予め記憶し
ておくための記憶手段をさらに設けてこの記憶手段から
与えてもよい。また、前記線分選択手段によって選択さ
れた線分の位置または選択された複数の線分の延長線上
の交点の位置を前記濃淡画像上で識別可能に表示するた
めの表示制御手段をさらに具備してもよい。
Further, the apparatus further comprises a line segment selecting unit for selecting a line segment satisfying a predetermined condition from the line segments extracted by the line segment extracting unit or the line segments integrated by the line unit integrating unit. You may. The predetermined condition for selecting the line segment may be input from outside by further providing an input means for inputting the line segment, or further provided by a storage means for storing this in advance. It may be provided from storage means. Further, the image processing apparatus further includes display control means for displaying the position of the line segment selected by the line segment selection means or the position of the intersection on the extension line of the plurality of selected line segments so as to be identifiable on the grayscale image. You may.

【0033】この発明による画像処理装置の他の実施態
様によれば、前記線分抽出手段によって抽出された線分
の抽出状態を用いて対象物の輪郭の直線部分における欠
陥の有無を判別する欠陥判別手段をさらに具備するもの
とすることができる。具体的には、前記欠陥判別手段
は、前記線分抽出手段によって抽出された線分の中に線
分間の方向ずれ量が所定範囲内であり、かつ、線分間の
位置ずれ量が所定範囲内である線分の組があるとき、こ
れら線分の間に欠陥が存在すると判別するものとするこ
とができる。また、前記欠陥判別手段は、前記線分抽出
手段によって抽出された線分の数を所定の基準値と比較
し、両者の値が異なるときに対象物の輪郭の直線部分に
欠陥が存在すると判別するものとすることができる。
According to another embodiment of the image processing apparatus according to the present invention, the presence / absence of a defect in the straight line portion of the contour of the object is determined using the extraction state of the line segment extracted by the line segment extraction means. The apparatus may further include a determination unit. Specifically, the defect discriminating means is such that, among the line segments extracted by the line segment extracting means, the direction deviation amount between the line segments is within a predetermined range, and the positional deviation amount between the line segments is within a predetermined range. When there is a set of line segments, it can be determined that a defect exists between these line segments. The defect determining means compares the number of line segments extracted by the line segment extracting means with a predetermined reference value, and determines that a defect exists in a straight line portion of the contour of the object when the two values are different. You can do it.

【0034】この発明による画像処理装置の他の実施態
様によれば、前記方向設定手段は、対象物の輪郭におけ
る直線部分の想定される方向を入力するものとし、前記
ラベル設定手段は、方向設定手段によって入力された方
向毎に個別のラベルを設定するものとし、前記画素ラベ
ル付け手段は、そのエッジ画素の方向が方向設定手段に
よって入力された方向のいずれかと一致するようなエッ
ジ画素に対して、その一致した方向に対応するラベルを
割り当てるものとすることができる。さらに、先に説明
した線分統合手段、線分選択手段および欠陥判別手段
は、この実施態様においても採用することができる。
According to another embodiment of the image processing apparatus according to the present invention, the direction setting means inputs an assumed direction of a straight line portion in the contour of the object, and the label setting means sets the direction setting. Means for setting an individual label for each direction input by the means, and the pixel labeling means sets an edge pixel whose edge pixel direction matches one of the directions input by the direction setting means. , A label corresponding to the matched direction can be assigned. Furthermore, the line segment integrating means, the line segment selecting means, and the defect determining means described above can be employed in this embodiment.

【0035】[0035]

【発明の実施の形態】図1は、この発明の一実施例にか
かる画像処理装置の構成を示す。この画像装置1は、デ
ィジタル濃淡画像上において、対象物の輪郭の直線部分
やその直線部分が複数あるときのそれらの延長上の交点
を抽出するためのもので、画像入力部2,画像メモリ
3,画像出力部4,タイミング制御部5,キャラクタ・
グラフィックメモリ6,文字メモリ7,制御部8,モニ
タ9,I/Oポート10などにより構成される。
FIG. 1 shows the configuration of an image processing apparatus according to an embodiment of the present invention. This image device 1 is for extracting a linear part of a contour of an object and an intersection of the extensions of the linear part when there are a plurality of linear parts on a digital grayscale image. , Image output unit 4, timing control unit 5, character
It comprises a graphic memory 6, a character memory 7, a control unit 8, a monitor 9, an I / O port 10, and the like.

【0036】画像入力部2は、図示しないアナログカメ
ラからの濃淡画像信号を取り込むためのインターフェイ
ス回路,前記濃淡画像信号をディジタル変換するための
A/D変換回路,ノイズカット用のフィルタ回路などに
より構成される。なお前記カメラはアナログカメラに限
らず、ディジタルカメラを用いてもよい。
The image input unit 2 includes an interface circuit for receiving a grayscale image signal from an analog camera (not shown), an A / D converter for digitally converting the grayscale image signal, a filter circuit for noise cut, and the like. You. The camera is not limited to an analog camera, but may be a digital camera.

【0037】前記画像メモリ3は、画像入力部2により
取り込まれ、A/D変換されたディジタル量の濃淡画像
データ(以下単に、「画像」という。)を取り込んで保
存する。キャラクタ・グラフィックメモリ6には、後記
するエッジコードヒストグラム、処理結果画像、線分の
抽出条件の設定画面などを表示するのに必要な画像デー
タが格納される。文字メモリ7には、検査結果などの文
字情報を表示するためのテキストデータやその表示位置
などが格納される。これらメモリ3,6,7は、それぞ
れアドレス/データバス11を介して制御部8に接続さ
れ、制御部8からの指示に応じたデータを、タイミング
制御部5からのタイミング信号に応じて画像出力部4ま
たはアドレス/データバス11に出力する。
The image memory 3 takes in and stores digital image grayscale image data (hereinafter simply referred to as "image") which has been taken in by the image input section 2 and A / D converted. The character / graphic memory 6 stores image data necessary for displaying an edge code histogram, a processing result image, and a screen for setting line segment extraction conditions, which will be described later. The character memory 7 stores text data for displaying character information such as an inspection result and a display position thereof. These memories 3, 6, and 7 are connected to a control unit 8 via an address / data bus 11, and output data according to an instruction from the control unit 8 according to a timing signal from the timing control unit 5. Output to the unit 4 or the address / data bus 11.

【0038】前記制御部8は、CPU12,ROM1
3,RAM14を主体とし、このほかに検査のための処
理手順を示す制御プログラムがインストールされたハー
ドディスク15を具備する。CPU12は、ハードディ
スク15内の制御プログラムに基づき、アドレス/デー
タバス11を介して各メモリに対する情報の読書きを行
いつつ目的とする計測処理を実行する。
The control unit 8 includes a CPU 12, a ROM 1
3, a hard disk 15 having a RAM 14 as a main body and a control program indicating a processing procedure for inspection installed therein. The CPU 12 executes a target measurement process while reading and writing information from and to each memory via the address / data bus 11 based on a control program in the hard disk 15.

【0039】前記画像出力部4は、モニタ9に対し、計
測対象の物体の画像のほか、前記ヒストグラム,処理結
果画像,ならびに検査結果を示す文字情報などを単独ま
たは合成した状態で与え、画面上に表示させる。I/O
ポート10は、キーボード,マウスなどの入力部や、外
部記憶装置,伝送部のような出力部に接続され、入力部
からの各種設定データを入力したり、検査結果を外部に
出力する際に用いられる。
The image output unit 4 gives the monitor 9 the image of the object to be measured, the histogram, the processing result image, and the character information indicating the inspection result in a single or combined state. To be displayed. I / O
The port 10 is connected to an input unit such as a keyboard and a mouse, and to an output unit such as an external storage device and a transmission unit, and is used for inputting various setting data from the input unit and outputting test results to the outside. Can be

【0040】この実施例の画像処理装置1では、入力さ
れた画像上に計測対象の物体を含むような計測領域を設
定するとともに、計測対象の物体の輪郭を構成する線分
を抽出するための条件として、前記線分の特徴を示すデ
ータの入力をI/Oポート10から受け付けるようにし
ている。なお、計測領域は、あらかじめ設定された条件
に基づいて設定されるが、これに限らず、画像を入力す
る都度、ユーザーの設定操作に応じて任意の位置に任意
の大きさの計測領域を設けてもよい。また入力画像全体
を計測領域としてもよい。
In the image processing apparatus 1 of this embodiment, a measurement area including an object to be measured is set on an input image, and a line segment forming a contour of the object to be measured is extracted. As a condition, input of data indicating the characteristics of the line segment is received from the I / O port 10. The measurement area is set based on preset conditions, but is not limited to this. Each time an image is input, a measurement area of an arbitrary size is provided at an arbitrary position according to a user's setting operation. You may. Alternatively, the entire input image may be used as the measurement area.

【0041】図2は、画像処理装置1における一連の計
測処理の流れ(ST1〜10)を示す。以下、図3〜1
4を順に参照しながら、図2の流れに沿って、計測処理
の詳細を説明する。
FIG. 2 shows a flow of a series of measurement processing in the image processing apparatus 1 (ST1 to ST10). Hereinafter, FIGS.
4 will be described in detail along the flow of FIG. 2 with reference to FIG.

【0042】まずST1では、前記計測領域内のエッジ
画素を抽出する。このエッジ画素の抽出処理では、画像
上に図3に示すような3×3マスクを走査しつつ、走査
位置毎に、マスク内の各画素の濃度値Iをつぎの(1)
〜(3)式にあてはめることにより、中央の画素g(座
標位置(x,y)にある画素)について、x,yの各軸
方向毎の濃度勾配Ex(x,y),Ey(x、y)、お
よびその濃度勾配の大きさ(以下「エッジ強度」とい
う。)Ei(x,y)を算出する。このエッジ強度Ei
(x,y)が所定値を越えるとき、着目画素gはエッジ
画素として認定される。
First, in ST1, edge pixels in the measurement area are extracted. In this edge pixel extraction processing, while scanning a 3 × 3 mask as shown in FIG. 3 on an image, the density value I of each pixel in the mask is determined for each scanning position by the following (1).
By applying Equations (3) to (3), the density gradient Ex (x, y), Ey (x, x, y) of each of the central pixel g (pixel at the coordinate position (x, y)) in each of the x and y axial directions is obtained. y) and the magnitude of the density gradient (hereinafter referred to as “edge strength”) Ei (x, y) are calculated. This edge strength Ei
When (x, y) exceeds a predetermined value, the target pixel g is recognized as an edge pixel.

【0043】[0043]

【数1】 (Equation 1)

【0044】[0044]

【数2】 (Equation 2)

【0045】[0045]

【数3】 (Equation 3)

【0046】また、高速演算に適した簡易な方式とする
ときは、(3)式は次の(4)式によって代用すること
ができる。 Ei(x,y)=Ex(x,y)+Ey(x,y) ・・・(4)
For a simple system suitable for high-speed operation, the expression (3) can be substituted by the following expression (4). Ei (x, y) = Ex (x, y) + Ey (x, y) (4)

【0047】なおこの実施例では、後記するように、ソ
フトウェア処理によりマスクを走査してエッジ画素の抽
出処理を行っているが、これに限らず、専用の微分回路
により画像メモリ3への画像入力と並行させてエッジ画
素の抽出処理を行い、その結果を用いて以下の処理を行
うようにしてもよい。
In this embodiment, as will be described later, the mask is scanned by software processing to extract the edge pixels. However, the present invention is not limited to this. The image input to the image memory 3 is performed by a dedicated differentiating circuit. The edge pixel extraction processing may be performed in parallel with the above, and the following processing may be performed using the result.

【0048】前記濃度勾配Ex(x,y),Ey(x,
y)は、着目画素gにおける濃度の変化量をx,yの各
軸方向毎に示したものである。エッジ強度Ei(x,
y)は、これら濃度勾配Ex(x,y),Ey(x,
y)の示すベクトルの合成ベクトルの長さに相当するも
ので、前述のようにこのエッジ強度Ei(x,y)が所
定値を越えるとき、着目画素gはエッジ画素として認定
される。またこの合成ベクトルの示す方向によって、着
目画素gにおいて濃度が変化する方向(すなわち濃度勾
配の方向)が示されることになる。
The concentration gradients Ex (x, y) and Ey (x,
y) shows the amount of change in density at the target pixel g for each of the x and y axis directions. Edge strength Ei (x,
y) are these concentration gradients Ex (x, y), Ey (x,
This corresponds to the length of the composite vector of the vector indicated by y). When the edge strength Ei (x, y) exceeds a predetermined value as described above, the target pixel g is recognized as an edge pixel. The direction indicated by the composite vector indicates the direction in which the density changes in the target pixel g (that is, the direction of the density gradient).

【0049】つぎのST2では、ST1で抽出された各
エッジ画素につき、順に、エッジ画素の方向を表す角度
(以下、この角度を示す数値データを「エッジコード」
という。)を求めるとともに、計測領域内のエッジ画素
の数をエッジコードの値毎に計数したヒストグラム(以
下、このヒストグラムを「エッジコードヒストグラム」
という。)を作成する。
In the next ST2, for each edge pixel extracted in ST1, an angle indicating the direction of the edge pixel (hereinafter, numerical data indicating this angle is referred to as "edge code").
That. ) And a histogram in which the number of edge pixels in the measurement area is counted for each edge code value (hereinafter, this histogram is referred to as an “edge code histogram”).
That. ) To create.

【0050】図4は、対象物の輪郭部分の一部を拡大し
てエッジコードの表し方を示したものである。図中、E
は、前記(1)〜(3)式により抽出されたエッジ画素
である。この実施例では、濃度の高い方から低い方へと
向かうベクトルFをエッジ画素Eにおける濃度勾配の方
向とし、このベクトルFに直交するベクトルCを、エッ
ジコードによって表される方向としている。なお、図示
例は、対象物の濃度が背景よりも小さい場合(すなわち
対象物が背景よりも暗い場合)の例であり、対象物と背
景との濃度の関係が逆になる場合は、ベクトルF,Cの
向きは反転する。
FIG. 4 shows how to express an edge code by enlarging a part of the outline of the object. In the figure, E
Are edge pixels extracted by the above equations (1) to (3). In this embodiment, a vector F from a higher density to a lower density is defined as a direction of a density gradient in the edge pixel E, and a vector C orthogonal to the vector F is defined as a direction represented by an edge code. The illustrated example is an example in which the density of the object is lower than the background (that is, the object is darker than the background). When the density relationship between the object and the background is reversed, the vector F , C are reversed.

【0051】この実施例では、エッジ画素Eからx軸の
正方向に向かうベクトルBを基準として、ベクトルCを
ベクトルBから反時計回り方向に見たときの角度Ec
(x,y)を、前記エッジコードとしている。
In this embodiment, an angle Ec when the vector C is viewed in the counterclockwise direction from the vector B with reference to the vector B from the edge pixel E in the positive direction of the x-axis.
(X, y) is the edge code.

【0052】前記ベクトルFは、前記(1)(2)式に
より得た濃度勾配Ex(x,y),Ey(x,y)の合
成ベクトルであり、ベクトルCはベクトルFに直交する
ベクトルであるから、エッジコードEc(x,y)は、
濃度勾配Ex(x,y),Ey(x,y)の値に応じて
下記〜のいずれかの式によって求められる。
The vector F is a composite vector of the density gradients Ex (x, y) and Ey (x, y) obtained by the above equations (1) and (2), and the vector C is a vector orthogonal to the vector F. Therefore, the edge code Ec (x, y) is
It is determined by one of the following equations according to the values of the density gradients Ex (x, y) and Ey (x, y).

【0053】 Ex(x,y)>0 および Ey
(x,y)≧0のとき、 Ec(x,y)=atan(Ey(x,y)/Ex
(x,y)) Ex(x,y)>0 および Ey(x,y)<0
のとき、 Ec(x,y)=360+atan(Ey(x,y)/
Ex(x,y)) Ex(x,y)<0のとき、 Ec(x,y)=180+atan(Ey(x,y)/
Ex(x,y)) Ex(x,y)=0 および Ey(x,y)>0
のとき、 Ec(x,y)=0 Ex(x,y)=0 および Ey(x,y)<0
のとき、 Ec(x,y)=180
Ex (x, y)> 0 and Ey
When (x, y) ≧ 0, Ec (x, y) = atan (Ey (x, y) / Ex
(X, y)) Ex (x, y)> 0 and Ey (x, y) <0
, Ec (x, y) = 360 + atan (Ey (x, y) /
Ex (x, y)) When Ex (x, y) <0, Ec (x, y) = 180 + atan (Ey (x, y) /
Ex (x, y)) Ex (x, y) = 0 and Ey (x, y)> 0
Where Ec (x, y) = 0 Ex (x, y) = 0 and Ey (x, y) <0
, Ec (x, y) = 180

【0054】前記エッジコードヒストグラムを作成する
には、計測領域内の各エッジ画素につき、前記〜を
用いてエッジコードEc(x,y)を算出しつつ、算出
されたエッジコードEc(x,y)の値に対応する度数
を1ずつ加算するか、または着目中のエッジ画素のエッ
ジ強度Ei(x,y)による重みを付けた度数を加算す
る。なお、この実施例では、前記エッジコードヒストグ
ラム上の角度を1度単位で設定するようにしている。さ
らにすべてのエッジ画素についてのエッジコードの算出
と度数加算処理とが終了した時点で、ノイズ除去のため
にヒストグラムの平滑化処理を実施している。
In order to create the edge code histogram, the edge code Ec (x, y) is calculated for each edge pixel in the measurement area by using the above-mentioned to calculate the edge code Ec (x, y). ) Are added one by one, or a frequency weighted by the edge strength Ei (x, y) of the edge pixel of interest is added. In this embodiment, the angle on the edge code histogram is set in units of one degree. Further, when the calculation of the edge code and the frequency addition process for all the edge pixels are completed, the histogram smoothing process is performed to remove noise.

【0055】またこの実施例では、計測領域内のエッジ
画素を抽出し終えてからエッジコードヒストグラムの作
成を行っているが、これに限らず、計測領域内を順にサ
ーチして、エッジ画素を抽出する毎に、エッジコードの
算出および度数加算処理を続けて行うようにしてもよ
い。
In this embodiment, the edge code histogram is created after the edge pixels in the measurement area are completely extracted. However, the present invention is not limited to this. Each time the calculation is performed, the edge code calculation and the frequency addition processing may be performed continuously.

【0056】画像上において、線分を構成する各エッジ
画素のエッジコードは、すべて前記線分の傾きに相当す
る値をとるはずである。したがって計測領域内に線分が
存在する場合には、前記エッジコードヒストグラムで
は、線分の傾きに対応する角度付近にピークが出現す
る。また計測領域内に傾きの異なる複数の線分が存在す
る場合には、エッジコードヒストグラム上の各線分の傾
きに対応する角度位置に、それぞれピークが現れる。
On the image, the edge code of each edge pixel forming the line segment should all take a value corresponding to the inclination of the line segment. Therefore, when a line segment exists in the measurement area, a peak appears near the angle corresponding to the inclination of the line segment in the edge code histogram. When a plurality of line segments having different inclinations exist in the measurement area, peaks appear at angular positions corresponding to the inclinations of the line segments on the edge code histogram.

【0057】図5(1)は、処理対象の濃淡画像を示
す。同図において、16は対象物の画像であり、背景よ
りも濃度が低く、直交する4方向に分類可能な線分を組
み合わせた十字型の輪郭形状を具備している。図5
(2)は、前記図5(1)の対象物について作成された
エッジコードヒストグラムを示すもので、前記輪郭形状
の4方向に相当する4つのピークP1〜P4が現れてい
る。
FIG. 5A shows a gray-scale image to be processed. In the figure, reference numeral 16 denotes an image of a target object, which has a density lower than that of the background and has a cross-shaped contour shape combining line segments that can be classified in four orthogonal directions. FIG.
(2) shows an edge code histogram created for the object of FIG. 5 (1), in which four peaks P1 to P4 corresponding to four directions of the contour shape appear.

【0058】ST3では、このヒストグラム上で前記ピ
ークに対応する角度を抽出する。ピークを抽出するに
は、たとえば前記エッジコードヒストグラムの角度毎の
度数を、角度の小さい方から順に比較して(ただしエッ
ジコードが359度のときの度数は0度のときの度数と
比較する。)、所定大きさ以上の山状の度数変化を抽出
し、このピークに対応する角度を決定する。
In ST3, an angle corresponding to the peak is extracted on the histogram. In order to extract the peak, for example, the frequencies for each angle in the edge code histogram are compared in ascending order of angle (however, the frequency when the edge code is 359 degrees is compared with the frequency when the edge code is 0 degrees). ), A mountain-like frequency change of a predetermined size or more is extracted, and an angle corresponding to this peak is determined.

【0059】こうしてピークに対応する角度が求められ
ると、つぎのST4では、これらピークに対応する角度
(以下、「ピーク角度」という。)にそれぞれ個別のラ
ベルを設定する。さらに続くST5では、前記計測領域
において、各ピーク角度に対応するエッジコードを有す
るエッジ画素に、それぞれ対応するピーク角度に設定さ
れたラベルを割り当てる。なお、いずれかのピーク角度
に対応するラベルが割り当てられなかったエッジ画素や
エッジ画素ではない画素には、処理対象のデータではな
いことを示すラベル(たとえば"null")が割り当てられ
る。
When the angles corresponding to the peaks are obtained in this way, in the next ST4, individual labels are set for the angles corresponding to these peaks (hereinafter, referred to as "peak angles"). In the subsequent ST5, labels set at the corresponding peak angles are assigned to edge pixels having edge codes corresponding to the respective peak angles in the measurement area. It should be noted that a label (for example, “null”) indicating that it is not data to be processed is assigned to an edge pixel to which a label corresponding to any one of the peak angles has not been assigned or a pixel that is not an edge pixel.

【0060】またST5では、ピーク角度だけでなく、
ピーク角度を中心として、前記山状の度数分布の範囲に
相当する角度範囲内(例えば、ヒストグラムの高さが所
定の値を超える部分に対応する角度範囲内やピーク角度
を中心としてその前後所定の角度範囲内など)に対応す
るエッジコードを有するエッジ画素に、前記ピーク角度
に設定されたラベルを割り当てるのが好ましい。図5
(2)では、前記各ピークP1〜P4について、それぞ
れピークP1〜P4を中心とする比較的高い度数が得ら
れる角度範囲を抽出し、これら角度範囲に含まれる各角
度に、ラベルθ1〜θ4を対応づけている。
In ST5, not only the peak angle, but also
Within a range of angles corresponding to the range of the mountain-like frequency distribution around the peak angle (for example, within a range of angles corresponding to a portion where the height of the histogram exceeds a predetermined value, or at a predetermined position before and after the peak angle). It is preferable to assign a label set to the peak angle to an edge pixel having an edge code corresponding to an angle range (for example, within an angle range). FIG.
In (2), for each of the peaks P1 to P4, an angle range around the peaks P1 to P4 at which a relatively high frequency is obtained is extracted, and labels θ1 to θ4 are added to the angles included in these angle ranges. Corresponding.

【0061】図6(1)は、前記図5(1)の画像のエ
ッジ画素抽出結果に前記ラベルθ1〜θ4を割り当てた
例を示す。図示例によれば、線分を構成するエッジ画素
のエッジコードは、エッジコードヒストグラムの前記ピ
ークP1〜P4のいずれかに対応するから、各線分に
は、θ1〜θ4のいずれかのラベルが対応づけられるこ
とになる。
FIG. 6A shows an example in which the labels θ1 to θ4 are assigned to the edge pixel extraction result of the image of FIG. 5A. According to the illustrated example, since the edge code of the edge pixel forming the line segment corresponds to any one of the peaks P1 to P4 of the edge code histogram, each label corresponds to any label of θ1 to θ4. Will be attached.

【0062】図6(1)の状態では、画像上に同一のエ
ッジコードに対応する線分が複数存在すると、これらの
線分には同じラベルが割り当てられる。すなわちST5
のラベリング処理のみでは、画像上の各線分を完全に切
り分けることはできない。そこでつぎのST6では、独
立した線分毎に個別のラベルが付与されるように、ラベ
ルの付け直しを行う。(以下、ST5の処理を「仮ラベ
リング処理」と呼び、ST6の処理を「本ラベリング処
理」と呼ぶ。)
In the state shown in FIG. 6A, if there are a plurality of line segments corresponding to the same edge code on the image, the same label is assigned to these line segments. That is, ST5
It is not possible to completely separate each line segment on an image only by the labeling processing of. Therefore, in the next ST6, relabeling is performed so that an individual label is provided for each independent line segment. (Hereinafter, the processing in ST5 is referred to as “temporary labeling processing”, and the processing in ST6 is referred to as “real labeling processing”.)

【0063】本ラベリング処理では、ST5の仮ラベリ
ング処理により割り当てられた同じラベルを有し、か
つ、連続するエッジ画素の集合を抽出し、こうして抽出
したエッジ画素の集合毎に個別のラベルを割り当て直
す。
In the present labeling process, a set of continuous edge pixels having the same label assigned by the provisional labeling process in ST5 is extracted, and individual labels are reassigned for each set of edge pixels thus extracted. .

【0064】図6(2)は、前記図6(1)の仮ラベリ
ング処理の結果に本ラベリング処理を行った結果を示す
もので、前記ラベルθ1が割り当てられた3つの線分
は、それぞれθ11,θ12,θ13の各ラベルにより切り分
けられている。同様に、前記ラベルθ2が割り当てられ
た3つの線分には、θ21,θ22,θ23の各ラベルが、前
記ラベルθ3が割り当てられた3つの線分には、θ31
θ32,θ33の各ラベルが、前記ラベルθ4が割り当てら
れた3つの線分には、θ41,θ42,θ43の各ラベルが、
それぞれ割り当てられて、各線分が切り分けられてい
る。
FIG. 6 (2) shows the result of performing the main labeling process on the result of the temporary labeling process of FIG. 6 (1). The three line segments to which the label θ1 is assigned are represented by θ, respectively. 11 , θ 12 , and θ 13 are separated. Similarly, the three line segments to which the label θ2 is assigned include the labels θ 21 , θ 22 , and θ 23 , and the three line segments to which the label θ3 is assigned include θ 31 ,
The labels of θ 32 and θ 33 are assigned to the three line segments to which the label θ 4 is assigned, and the labels of θ 41 , θ 42 and θ 43 are assigned to the three line segments.
Each line segment is divided and assigned.

【0065】このような2段階のラベリング処理によ
り、各線分をラベル毎に切り分けて認識することが可能
となる。ST7では、この状態下において、ラベル毎
に、それぞれそのラベルが付与されたエッジ画素の集合
(以下これを「ラベル集合」という。)を用いて、つぎ
のA〜Fに示す演算を実行することにより、各線分の特
徴量を算出する。なお、A,BにおけるΣ演算は、いず
れも1つのラベル集合に含まれる各エッジ画素について
の算出結果の総和を求めることを意味するもので、また
(xn,yn)はラベル集合内の1つのエッジ画素の座標
を示し、Ei(xn,yn)、Ec(xn,yn)はそれぞ
れ座標(xn,yn)に位置するエッジ画素についてのエ
ッジ強度、エッジコードを示す。
By such a two-stage labeling process, each line segment can be recognized for each label. In ST7, in this state, the following operations A to F are executed for each label using a set of edge pixels to which the label is assigned (hereinafter, this is referred to as a “label set”). , The feature amount of each line segment is calculated. Incidentally, A, sigma operations in B is intended to mean that obtaining the sum of the calculation results for each edge pixel which both are included in one set of labels, also (x n, y n) is in the label set shows shows one coordinate edge pixels, Ei (x n, y n), Ec (x n, y n) each coordinates (x n, y n) edge intensity of the edge pixels located in the edge code .

【0066】A. 濃淡重心:GX,GY ラベル集合の示す線分の重心位置の座標を算出するもの
で、ラベル集合内の各エッジ画素のエッジ強度Ei(x
n,yn)を重みとしたつぎの(a)−1,(a)−2の
各式により求められる。 GX=Σ{Ei(xn,yn)・xn}/{Ei(xn,yn)} ・・・(a)−1 GY=Σ{Ei(xn,yn)・yn}/{Ei(xn,yn)} ・・・(a)−2
A. Gradient center of gravity: GX, GY Calculates the coordinates of the barycentric position of the line segment indicated by the label set, and the edge intensity Ei (x
n , y n ) are obtained by the following equations (a) -1 and (a) -2 using weights. GX = Σ {Ei (x n , y n) · x n} / {Ei (x n, y n)} ··· (a) -1 GY = Σ {Ei (x n, y n) · y n } / {Ei (x n, y n)} ··· (a) -2

【0067】B. 方向和:SCX,SCY ラベル集合に属する各エッジのエッジコードをx軸,y
軸の各軸方向の成分に分解した値の総和であって、つぎ
の(b)−1,(b)−2の各式により求められる。 SCX=Σcos{Ec(xn,yn)} ・・・(b)−1 SCY=Σsin{Ec(xn,yn)} ・・・(b)−2
B. Direction sum: SCX, SCY The edge code of each edge belonging to the label set is x axis, y
This is the sum of the values decomposed into the components in the respective axial directions of the axis, and is obtained by the following equations (b) -1 and (b) -2. SCX = Σcos {Ec (x n , y n)} ··· (b) -1 SCY = Σsin {Ec (x n, y n)} ··· (b) -2

【0068】C. 方向平均:EC ラベル集合の示す線分の傾きに相当する特徴量であっ
て、前記方向和SCX,SCYの大小関係に基づき、つ
ぎの(c)−1〜(c)−5式のいずれかにより求めら
れる。 SCX>0 かつ SCY≧0のとき EC=atan(SCY/SCX) ・・・(c)−1 SCX>0 かつ SCY<0のとき EC=360+atan(SCY/SCX) ・・・(c)−2 SCX<0のとき EC=180+atan(SCY/SCX) ・・・(c)−3 SCX=0 かつ SCY>0のとき EC=0 ・・・(c)−4 SCX=0 かつ SCY<0のとき EC=180 ・・・(c)−5
C. Direction average: a feature amount corresponding to the gradient of the line segment indicated by the EC label set, and based on the magnitude relationship between the direction sums SCX and SCY, one of the following equations (c) -1 to (c) -5: Required by When SCX> 0 and SCY ≧ 0, EC = atan (SCY / SCX) (c) -1 When SCX> 0 and SCY <0, EC = 360 + atan (SCY / SCX) (c) -2 When SCX <0 EC = 180 + atan (SCY / SCX) ... (c) -3 When SCX = 0 and SCY> 0 EC = 0 ... (c) -4 When SCX = 0 and SCY <0 EC = 180 (c) -5

【0069】D. 直線の方程式 ラベル集合の示す線分を通る直線P(図7に示す。)を
示すもので、前記方向和SCX,SCY,および濃淡重
心GX,GYを用いて、つぎの(d)式により表され
る。 SCY・x+SCX・y−(SCY・GX+SCX・GY)=0・・・(d)
D. Straight line equation This shows a straight line P (shown in FIG. 7) passing through the line segment indicated by the label set, and is expressed by the following equation (d) using the direction sums SCX and SCY and the density centroids GX and GY. Is done. SCY.x + SCX.y- (SCY.GX + SCX.GY) = 0 (d)

【0070】E. 端点座標:(x1,y1)(x2,
y2) 前記線分の各端点の座標であるが、この実施例では、計
測処理のばらつきを考慮して前記直線P上に位置する端
点の座標を求めるために、つぎのような演算を実行して
いる。まず処理対象のエッジ集合のx座標、y座標の中
から、それぞれ最大値xmax,ymax,および最小値x
min,yminを抽出し、これらの座標により線分の仮端点
の座標(x1´,y1´)(x2´,y2´)を設定す
る。なお、各仮端点のx座標は、 x1´=xmin
x2´=xmaxとなり、y座標は、SCY・SCX≧0
のときは y1´=ymin y2´=ymax SCY・SCX<0のときは y1´=ymax y2´=yminとなる。
E. End point coordinates: (x1, y1) (x2,
y2) The coordinates of each end point of the line segment are calculated. In this embodiment, the following calculation is executed in order to obtain the coordinates of the end point located on the straight line P in consideration of the dispersion of the measurement processing. ing. First, the maximum value x max , y max , and the minimum value x are respectively selected from the x coordinate and the y coordinate of the edge set to be processed.
min and y min are extracted, and the coordinates (x1 ′, y1 ′) (x2 ′, y2 ′) of the temporary end point of the line segment are set based on these coordinates. Incidentally, x-coordinate of each temporary end point, x1' = x min,
x2' = x max next, y coordinates, SCY · SCX ≧ 0
The y1' = y max y2' = y min when the y1' = y min y2' = y max SCY · SCX <0 is when.

【0071】このようにして仮端点(x1´,y1
´),(x2´,y2´)を求めると、これらの座標と
前記(d)の直線の方程式とを用いて、各仮端点から直
線に下ろした垂線の足の座標を求め、その座標を端点の
座標(x1,y1)(x2,y2)とする。
In this way, the provisional end points (x1 ', y1
′) And (x2 ′, y2 ′), the coordinates of the perpendicular leg drawn down from each temporary end point to a straight line are obtained using these coordinates and the equation of the straight line in (d) above, and the coordinates are obtained. The coordinates of the end point are (x1, y1) (x2, y2).

【0072】F. 線分の長さL 前記線分の端点間の距離に相当するもので、各端点の座
標を距離の算出式にあてはめることにより求められる。
F. The length L of the line segment is equivalent to the distance between the end points of the line segment, and is obtained by applying the coordinates of each end point to the formula for calculating the distance.

【0073】図7は、上記A〜Fの処理により求められ
る特徴量のうち、前記濃淡重心(GX,GY),線分を
通る直線P,線分の長さL,線分の端点(x1,y1)
(x2,y2)を示す。つぎのST8,9では、これら
の特徴量や直線の式を用いた演算処理を実行する。
FIG. 7 shows, among the characteristic quantities obtained by the above-described processings A to F, the density center of gravity (GX, GY), the straight line P passing through the line segment, the length L of the line segment, and the end point (x1 , Y1)
(X2, y2). In the next ST8 and ST9, arithmetic processing using these characteristic amounts and linear equations is executed.

【0074】ST8では、前記線分毎の特徴量を用い
て、1本の線分として統合可能な線分の組があるか否か
を判別する。そして統合が可能な線分の組が見つかる
と、これら線分を構成するエッジ画素をひとまとめにし
た新たなラベル集合を形成し、その集合に新しいラベル
を設定する。さらにこの新しいラベル集合についても、
前記A〜Fに示した各特徴量や直線の式が求められる。
なお、統合前の各ラベル集合およびその特徴量も、消去
されずに維持される。
In ST8, it is determined whether or not there is a set of line segments that can be integrated as one line segment, using the feature amount of each line segment. When a set of line segments that can be integrated is found, a new label set in which edge pixels constituting these line segments are put together is formed, and a new label is set for the set. And for this new set of labels,
The feature amounts and straight line equations shown in the above A to F are obtained.
Each label set before integration and its feature amount are also maintained without being deleted.

【0075】図8は、前記線分の統合が可能か否かを判
別するための具体的な手順を示し、図9は、この判別処
理に用いられるパラメータの概念を示す。なお、図9
中、A,Bは着目中の線分、P1,P2は、これら線分
A,Bを通る直線、Cは線分A,Bを統合した場合の統
合後の線分である。この図示例では、パラメータをわか
りやすく示すために、各線分A,Bの傾きの差や線分間
の位置ずれ量を大きく示している。
FIG. 8 shows a specific procedure for determining whether or not the line segments can be integrated, and FIG. 9 shows the concept of parameters used in this determination processing. Note that FIG.
Among them, A and B are line segments of interest, P1 and P2 are straight lines passing through these line segments A and B, and C is a line segment after line segments A and B are integrated. In this illustrated example, in order to clearly show the parameters, the difference between the inclinations of the line segments A and B and the amount of positional deviation between the line segments are shown large.

【0076】図8の手順は、計測領域内のすべての線分
の組合せ(ここでは、2本の線分による組合せをい
う。)に対して実行される。まずST8−1では、着目
中の線分A,Bについて、傾き(前記した方向平均E
C)の差δを求め、このδが所定のしきい値以下である
か否かを判定する。
The procedure shown in FIG. 8 is executed for all combinations of line segments in the measurement area (here, a combination of two line segments). First, in ST8-1, gradients (the above-described direction average E
The difference δ in C) is obtained, and it is determined whether or not this δ is equal to or less than a predetermined threshold.

【0077】つぎのST8−2では、各線分A,Bの向
かい合う端点(図9の点a2,b1)間の距離dを算出
し、これが所定のしきい値以下であるか否かを判定す
る。
In the next ST8-2, the distance d between the end points (points a2 and b1 in FIG. 9) of the line segments A and B is calculated, and it is determined whether or not this distance is equal to or smaller than a predetermined threshold value. .

【0078】ST8−3では、統合後の線分Cの長さL
3を求め、この長さが各線分A,Bの長さの和(L1+
L2)以上であるか否かを判定する。なお統合後の線分
の長さL3は、各線分A,Bの向かい合わない端点(図
9の端点a1とb2)間の距離として算出される。
In ST8-3, the length L of the segment C after integration
3 and this length is the sum of the lengths of the line segments A and B (L1 +
L2) It is determined whether it is not less than or equal to. Note that the length L3 of the line segments after integration is calculated as the distance between the end points of the line segments A and B that do not face each other (end points a1 and b2 in FIG. 9).

【0079】ST8−4では、線分間の位置ずれ量を求
め、この位置ずれ量が所定のしきい値以下であるか否か
を判定する。なおこの位置ずれ量は、前記向かい合う端
点間のずれ量として表されるもので、この実施例では、
一方の線分(図示例では線分B)を通る直線(図示例で
はP2)に対し、他方の線分(図示例では線分A)の線
分B側の端点a1から下した垂線の長さhと定義してい
る。
In ST8-4, the amount of positional deviation between the line segments is obtained, and it is determined whether or not the amount of positional deviation is equal to or less than a predetermined threshold value. Note that this positional deviation amount is represented as a deviation amount between the facing end points, and in this embodiment,
The length of a perpendicular line drawn from an end point a1 of the other line segment (in the illustrated example, line A) on the line segment B side with respect to a straight line (in the illustrated example, P2) passing through one of the line segments (in the illustrated example, line segment B). H.

【0080】上記ST8−1〜8−4の判定処理が順に
行われて、いずれの判定結果も「YES」となると、S
T8−5に進み、前記線分A,Bの統合が可能であると
判定する。他方、ST8−1〜8−4のいずれかの判定
処理で「NO」の判定がなされた場合は、ST8−6に
進み、前記A、Bの統合は不可能であると判定する。
The determination processes in ST8-1 to ST8-4 are sequentially performed. If all the determination results are "YES", the process proceeds to S8.
Proceeding to T8-5, it is determined that the line segments A and B can be integrated. On the other hand, if "NO" is determined in any of the determination processes in ST8-1 to 8-4, the process proceeds to ST8-6, and it is determined that the integration of A and B is impossible.

【0081】なお各判定処理に用いるしきい値のうち、
端点間の距離dに対するしきい値は、比較的大きな値に
設定してよいが、方向平均の差δならびに線分間の位置
ずれ量hに対するしきい値は、極力小さな値にするのが
望ましい。方向平均の差δおよび線分間の位置ずれ量h
に対するしきい値を小さな値にすべきであるのは、対象
物の輪郭の一つの直線部分が分断されて複数の線分が生
じた場合には、これらの線分間の傾きの差や線分間の位
置ずれ量は小さくなるはずであるからである。これに対
し、対象物の輪郭の一つの直線部分が大きな欠陥により
分断されることにより複数の線分が抽出されると、各線
分の向かい合う端点間の距離dの値は大きくなることが
あるから、端点間の距離dに対する許容値はある程度大
きくすることができる。
Note that among the threshold values used in each determination process,
The threshold value for the distance d between the end points may be set to a relatively large value, but it is desirable that the threshold value for the difference δ in the direction average and the displacement amount h between the line segments be as small as possible. Difference δ in direction average and displacement amount h between line segments
The threshold value should be set to a small value because, when one straight line portion of the outline of the object is divided and a plurality of line segments are generated, the difference in slope between these line segments and the line segment This is because the amount of positional deviation of should be small. On the other hand, when a plurality of line segments are extracted by dividing one straight line portion of the contour of the target object by a large defect, the value of the distance d between the opposite end points of each line segment may increase. The tolerance for the distance d between the end points can be increased to some extent.

【0082】図10は、前記線分が統合されるケースと
統合されないケースとの違いを例示したもので、図中の
(1)(2)では、いずれも傾きに差のない2つの線分
A,Bを示している。図10(1)では、各線分A,B
の向かい合う端点a,b間の距離dは大きいが、線分
A,B間の位置ずれ量hは線分の幅範囲内であるから、
各線分A,Bは統合可能と判断される。これに対し、図
10(2)の例では、端点a,b間の距離dは図10
(1)よりも小さいが、位置ずれ量hは線分の幅範囲を
越えており、各線分A,Bの統合は不可能と判断され
る。
FIG. 10 illustrates the difference between the case where the line segments are integrated and the case where the line segments are not integrated. In (1) and (2) in the figure, two line segments having no difference in inclination are shown. A and B are shown. In FIG. 10A, each line segment A, B
Is large, but the displacement h between the line segments A and B is within the width range of the line segments.
It is determined that the line segments A and B can be integrated. On the other hand, in the example of FIG. 10B, the distance d between the end points a and b is
Although smaller than (1), the displacement amount h exceeds the width range of the line segment, and it is determined that the line segments A and B cannot be integrated.

【0083】前記した直線の統合処理によれば、図11
に示すように、統合可能な線分の組が複数組ある場合
(図示例では直線AとB,直線BとDとの2組)には、
各組毎に統合処理を行って新たな線分C,Eを設定した
後、さらにこれらの線分C,Eを統合して、各線分を1
本の線分Fに統合することも可能となる。なお統合され
た線分C,E,Fには、それぞれ個別のラベルが設定さ
れ、統合前の各線分A,B,Dのラベルもそのまま維持
するのが望ましい。
According to the straight line integration processing described above, FIG.
As shown in (2), when there are a plurality of sets of line segments that can be integrated (two sets of straight lines A and B and straight lines B and D in the illustrated example),
After the integration process is performed for each set to set new line segments C and E, these line segments C and E are further integrated to make each line segment 1
It is also possible to integrate into a line segment F. It is preferable that individual labels are set for the integrated line segments C, E, and F, and the labels of the line segments A, B, and D before the integration are also maintained as they are.

【0084】図2に戻って、上記のようにして計測領域
内に存在する各線分を個別に抽出し、統合可能な線分を
統合する処理が完了すると、ST9では、これら線分の
中から抽出条件を満たす線分を抽出する。前記抽出条件
は、線分の長さ、傾きなど、1本の線分を抽出するため
の条件としてもよいが、対象物の位置や方向を計測する
ためには、複数本の線分を抽出するための条件を設定す
るのが望ましい。
Returning to FIG. 2, each line segment present in the measurement area is individually extracted as described above, and the process of integrating the segments that can be integrated is completed. A line segment satisfying the extraction condition is extracted. The extraction condition may be a condition for extracting one line segment, such as the length and inclination of the line segment. However, in order to measure the position and direction of the object, a plurality of line segments are extracted. It is desirable to set the conditions for doing so.

【0085】図12は、前記直線の抽出条件として、対
象物の輪郭の隣り合う2辺を構成する線分を抽出するよ
うに設定されている場合の抽出方法を示す。この場合も
前記統合処理と同様に、計測領域内の線分の組を順に検
索し、各組毎に、処理対象の線分A,Bの長さL1,L
2が対象物の大きさに応じた長さであるかどうかを判定
する。また抽出条件として、各線分のなす角度が指定さ
れている場合は、各線分A,Bを通る直線P1,P2の
方程式から、各直線のなす角αを求め、このαを抽出条
件と比較する。
FIG. 12 shows an extraction method in a case where the straight line extraction condition is set so as to extract a line segment forming two adjacent sides of the outline of the object. In this case as well, similarly to the integration process, a set of line segments in the measurement area is sequentially searched, and the lengths L1, L of the line segments A, B to be processed are determined for each set.
It is determined whether or not 2 is a length corresponding to the size of the object. When the angle formed by each line segment is designated as the extraction condition, the angle α formed by each line is obtained from the equation of the straight lines P1 and P2 passing through each line segment A and B, and this α is compared with the extraction condition. .

【0086】図13は、前記抽出条件として、平行な線
分の組を抽出することが設定された場合の線分の抽出方
法を示す。この場合の具体的な抽出処理では、計測領域
内の各線分の組合せ毎に線分間の傾きの差をとり、この
差がゼロに近い値をとる組合せを抽出する。さらに線分
間の距離も抽出条件に含まれている場合は、平行と認定
された線分A,Bを通る直線P1,P2の方程式から線
分間の距離を求め、これを条件と比較する。また図12
の例と同様に、各線分の長さを抽出条件とすることもで
きる。なおこの図13の方法において、抽出すべき線分
間の距離をきわめて小さく設定すれば、パッケージ上に
生じた直線キズのような微小な幅の対象物を抽出するこ
とができる。
FIG. 13 shows a line segment extraction method when the extraction condition is set to extract a set of parallel line segments. In a specific extraction process in this case, a difference in inclination between line segments is obtained for each combination of line segments in the measurement region, and a combination in which the difference takes a value close to zero is extracted. Further, when the distance between the line segments is also included in the extraction condition, the distance between the line segments is obtained from the equation of the straight lines P1 and P2 passing through the line segments A and B recognized as parallel, and is compared with the condition. FIG.
Similarly to the example, the length of each line segment can be used as the extraction condition. In the method of FIG. 13, if the distance between the line segments to be extracted is set to be extremely small, an object having a minute width such as a straight line flaw generated on the package can be extracted.

【0087】図14は、前記抽出条件として、所定大き
さの長方形を構成する線分を抽出することが設定された
場合の線分の抽出方法を示す。この場合は、まず図14
(1)に示すように、長方形の向かい合う辺に相当する
2組の平行な線分(図示例では線分AとB、線分Cと
D)を抽出する。なお、各線分の組の抽出は、前記図1
3と同様の方法により行われるもので、図中のE,F,
Gは、平行な線分としての条件にあてはまらなかった線
分である。さらに抽出された各組間での線分の傾き(方
向平均)の差が90度に近似していることを確認した上
で、図14(2)に示すように、各線分の重心g1〜g
4(前記濃淡重心の座標(GX,GY)を用いる。)を
結ぶ領域rおよび平行な線分の組毎の重心を結ぶ直線m
1,m2を設定する。このとき各直線m1,m2の交点
Mが領域r内にあれば、各線分θ1〜θ4が長方形を構
成する線分であると判定する。
FIG. 14 shows a line segment extraction method when the extraction condition is set to extract a line segment constituting a rectangle of a predetermined size. In this case, first, FIG.
As shown in (1), two sets of parallel line segments (line segments A and B, line segments C and D in the illustrated example) corresponding to opposing sides of the rectangle are extracted. Note that the extraction of each line segment set is as shown in FIG.
3 is performed by the same method as in FIG.
G is a line segment that did not satisfy the condition as a parallel line segment. Further, after confirming that the difference in the inclination (direction average) of the line segment between the extracted sets is close to 90 degrees, as shown in FIG. g
4 (using the coordinates (GX, GY) of the density center of gravity) and a straight line m connecting the centers of gravity of each set of parallel line segments.
1 and m2 are set. At this time, if the intersection point M of each of the straight lines m1 and m2 is within the region r, it is determined that each of the line segments θ1 to θ4 is a line constituting a rectangle.

【0088】このようにして抽出条件に適合する線分が
見つかると、ST10では、抽出された線分をたとえば
所定の色彩または輝度で識別する処理結果画像を生成す
る。生成された処理結果画像は、前記モニタ9に与えら
れて表示される。なお前記図12に示すように、抽出さ
れた各線分を通る直線の方程式から、線分または直線の
交点(cx,cy)を求めると、この交点位置を所定の
マークで示すような処理結果画像を生成して表示するこ
ともできる。
When a line segment matching the extraction condition is found in this way, in ST10, a processing result image for identifying the extracted line segment by, for example, a predetermined color or luminance is generated. The generated processing result image is provided to the monitor 9 and displayed. As shown in FIG. 12, when an intersection (cx, cy) of a line segment or a straight line is obtained from an equation of a straight line passing through each extracted line segment, a processing result image in which the position of the intersection is indicated by a predetermined mark is obtained. Can also be generated and displayed.

【0089】上記実施例によれば、濃淡画像上のエッジ
画素を用いた計測を行うので、照明の変動などにより画
像の明るさが変化しても、計測結果に狂いが生じにく
く、安定した計測を行うことができる。また対象物の大
きさや方向が変化する可能性がある場合は、線分の長さ
や傾きについての抽出条件を緩やかに設定したり、他の
抽出条件を設定することにより、目的とする線分を抽出
できるので、精度が高い計測処理を簡単かつ高速に行う
ことができる。
According to the above-described embodiment, since the measurement is performed using the edge pixels on the grayscale image, even if the brightness of the image changes due to the fluctuation of the illumination or the like, the measurement result is hardly disturbed and the stable measurement is performed. It can be performed. If the size or direction of the target object may change, the extraction conditions for the length and inclination of the line segment may be set gently, or other extraction conditions may be set to change the target line segment. Since extraction can be performed, highly accurate measurement processing can be performed easily and at high speed.

【0090】なお、この実施例では、計測領域から対象
物の輪郭線を構成する線分を抽出して、その抽出結果を
表示するにとどめているが、これに限らず、抽出結果を
用いて対象物の位置や向きを計測するようにしてもよ
い。たとえば、前記図14のような長方形状の輪郭を具
備する対象物を計測対象とする場合、抽出された各線分
A〜Dを通る直線の方程式を用いて対象物に対応する画
像領域を特定した後にその領域内の重心位置を求め、そ
の値を対象物の位置として特定することができる。また
対象物の向きは、いずれか一方の線分の組(例えば長い
方の線分A,B)の傾きによって表すことができる。
In this embodiment, the line segments constituting the outline of the object are extracted from the measurement area, and the extracted result is displayed. However, the present invention is not limited to this. The position and orientation of the object may be measured. For example, when an object having a rectangular outline as shown in FIG. 14 is to be measured, an image area corresponding to the object is specified using an equation of a straight line passing through the extracted line segments A to D. Later, the position of the center of gravity in the area is obtained, and the value can be specified as the position of the object. The direction of the object can be represented by the inclination of one of the line segments (for example, the longer line segment A, B).

【0091】さらに前記図8,9に示した線分の統合判
定処理によれば、欠陥により分断された輪郭線を統合の
対象として抽出できるから、前記統合判定処理を輪郭上
に生じた欠陥を抽出する用途に適用することも可能であ
る。また単に欠陥の有無を判別するだけでよい場合は、
あらかじめ良品モデルによる計測を行って、計測領域内
での線分の適正な抽出数を求めておき、検査対象の画像
により得られた線分の抽出数が前記適正な抽出数になる
か否かをチェックすればよい。
Further, according to the line segment integration judgment processing shown in FIGS. 8 and 9, a contour line divided by a defect can be extracted as an object to be integrated. It is also possible to apply to the purpose of extraction. If you just need to determine the presence or absence of a defect,
The proper number of extracted line segments in the measurement area is obtained in advance by performing measurement using a good product model, and whether the number of extracted line segments obtained from the image to be inspected is the proper number of extracted lines is determined. Check it out.

【0092】なお、上記の実施例では、対象物が回転ず
れする場合を想定してエッジコードヒストグラムを作成
し、線分に相当するピークを抽出しているが、対象物を
位置ずれのない安定した状態下で撮像できるのであれ
ば、あらかじめ濃淡画像上における対象物の輪郭の向き
をI/Oポート10から入力しておくことにより、対象
物の輪郭の向きに対応する方向をエッジコードとするエ
ッジ画素にラベル付を行って、前記輪郭の向きに対応す
る線分を抽出することができる。またエッジコードヒス
トグラムを作成した上での計測処理と、エッジコードヒ
ストグラムの作成を行わない計測処理とを適宜切り替え
られるように構成しても良い。
In the above-described embodiment, the edge code histogram is created on the assumption that the object is rotationally displaced, and the peak corresponding to the line segment is extracted. If the image can be picked up in a state in which the image is captured, the direction of the contour of the object on the grayscale image is input from the I / O port 10 in advance, and the direction corresponding to the direction of the outline of the object is used as the edge code. By labeling the edge pixels, a line segment corresponding to the direction of the contour can be extracted. Further, the configuration may be such that measurement processing after creating an edge code histogram and measurement processing without creating an edge code histogram can be switched as appropriate.

【0093】[0093]

【発明の効果】この発明によれば、輪郭線を構成するエ
ッジ画素においては濃度勾配の大きさが相対的に大きい
ためにエッジ画素の方向を誤差小さく求めることができ
ることに着目し、エッジ画素の方向に対応してエッジ画
素に割り当てられたラベルが共通することおよびエッジ
画素が連続していることを条件として抽出したエッジ画
素の集合によって線分を表すようにしたので、対象物の
輪郭の直線部分を的確に抽出することができる。また、
濃淡画像の状態にかかわらず、特に背景部分と対象物部
分との濃度差が小さい場合や照明が均一でない場合で
も、エッジ画素の方向は安定して求めることができるの
で、このような場合でも対象物の輪郭の直線部分を的確
に抽出することができる。
According to the present invention, attention is paid to the fact that the direction of the edge pixels can be obtained with a small error because the magnitude of the density gradient is relatively large in the edge pixels constituting the contour line. A line segment is represented by a set of edge pixels extracted on the condition that the labels assigned to the edge pixels corresponding to the direction are common and that the edge pixels are continuous, so the straight line of the contour of the object The part can be accurately extracted. Also,
Irrespective of the state of the grayscale image, the direction of the edge pixels can be obtained stably even when the density difference between the background part and the object part is small or when the illumination is not uniform. The straight line portion of the outline of the object can be accurately extracted.

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

【図1】この発明の一実施例にかかる画像処理装置の構
成を示すブロック図である。
FIG. 1 is a block diagram illustrating a configuration of an image processing apparatus according to an embodiment of the present invention.

【図2】画像処理の手順を示すフローチャートである。FIG. 2 is a flowchart illustrating a procedure of image processing.

【図3】エッジ抽出処理に用いるマスクを示す説明図で
ある。
FIG. 3 is an explanatory diagram showing a mask used for edge extraction processing.

【図4】エッジコードの表し方を示す説明図である。FIG. 4 is an explanatory diagram showing how to represent an edge code.

【図5】対象物の濃淡画像およびこの画像のエッジ抽出
結果を処理して得たエッジコードヒストグラムを示す説
明図である。
FIG. 5 is an explanatory diagram showing a grayscale image of an object and an edge code histogram obtained by processing an edge extraction result of the image;

【図6】図5の画像についての仮ラベリング処理および
本ラベリング処理の結果を示す説明図である。
FIG. 6 is an explanatory diagram showing the results of a temporary labeling process and a main labeling process for the image of FIG. 5;

【図7】線分の特徴量の概念を示す説明図である。FIG. 7 is an explanatory diagram illustrating a concept of a feature amount of a line segment.

【図8】線分の統合判定に関する処理手順を示すフロー
チャートである。
FIG. 8 is a flowchart illustrating a processing procedure regarding line segment integration determination;

【図9】線分の統合判定に用いるパラメータを説明する
図である。
FIG. 9 is a diagram illustrating parameters used for line segment integration determination.

【図10】線分の統合が可能と判定された例および不可
能と判定された例を示す説明図である。
FIG. 10 is an explanatory diagram illustrating an example in which it is determined that integration of line segments is possible and an example in which it is determined that integration is not possible.

【図11】複数の線分を統合した例を示す説明図であ
る。
FIG. 11 is an explanatory diagram showing an example in which a plurality of line segments are integrated.

【図12】線分の抽出処理の具体例を示す説明図であ
る。
FIG. 12 is an explanatory diagram showing a specific example of a line segment extraction process.

【図13】線分の抽出処理の具体例を示す説明図であ
る。
FIG. 13 is an explanatory diagram showing a specific example of a line segment extraction process.

【図14】線分の抽出処理の具体例を示す説明図であ
る。
FIG. 14 is an explanatory diagram showing a specific example of a line segment extraction process.

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

1 画像処理装置 2 画像入力部 4 画像出力部 7 制御部 9 モニタ 11 CPU DESCRIPTION OF SYMBOLS 1 Image processing apparatus 2 Image input part 4 Image output part 7 Control part 9 Monitor 11 CPU

Claims (24)

【特許請求の範囲】[Claims] 【請求項1】 濃淡画像を処理する方法であって、 前記濃淡画像に表される対象物像の輪郭に直線部分が含
まれるときに、その直線の方向毎に個別のラベルを設定
するラベル設定ステップと、 前記濃淡画像に含まれるエッジ画素であってそのエッジ
画素の方向が前記直線の方向のいずれかと一致するよう
なエッジ画素に対して、その一致した方向に対応する前
記ラベルを割り当てる画素ラベル付けステップと、 同一の前記ラベルが割り当てられており、かつ、前記濃
淡画像上で連続しているとみなし得るエッジ画素の集合
を線分として抽出する線分抽出ステップとを順に実行す
る画像処理方法。
1. A method for processing a grayscale image, comprising: when an outline of an object image represented in the grayscale image includes a straight line portion, a label setting for setting an individual label for each direction of the straight line. And a pixel label that assigns the label corresponding to the coincident direction to an edge pixel included in the grayscale image and whose edge pixel direction coincides with one of the straight line directions. And a line segment extracting step of sequentially extracting, as a line segment, a set of edge pixels to which the same label is assigned and which can be regarded as being continuous on the grayscale image. .
【請求項2】 前記ラベル設定ステップは、 エッジ画素の方向毎にエッジ画素の数の度合を示すヒス
トグラムを作成するヒストグラム作成ステップと、 前記ヒストグラム上の極大値を抽出して、極大値に対応
するエッジ画素の方向毎に個別のラベルを設定するピー
クラベル設定ステップとを実行することにより、対象物
像の輪郭に含まれる直線の方向毎に個別のラベルを設定
するものであり、 前記画素ラベル付けステップは、前記ピークラベル設定
ステップにより設定されたラベルを各ラベルに対応する
エッジ画素の方向を有するエッジ画素に割り当てること
により、前記ラベルの割当を行うものである請求項1に
記載された画像処理方法。
2. The label setting step includes: a histogram creation step of creating a histogram indicating a degree of the number of edge pixels for each edge pixel direction; and extracting a maximum value on the histogram to correspond to the maximum value. And performing a peak label setting step of setting an individual label for each direction of an edge pixel, thereby setting an individual label for each direction of a straight line included in the contour of the target object image. 2. The image processing according to claim 1, wherein the assigning the label is performed by assigning the label set in the peak label setting step to an edge pixel having a direction of an edge pixel corresponding to each label. Method.
【請求項3】 前記線分抽出ステップにおいて抽出され
た線分の中に線分間の方向ずれ量が所定範囲内であり、
かつ、線分間の位置ずれ量が所定範囲内となる線分の組
があるとき、これらの線分を1本の線分に統合する線分
統合ステップをさらに実行する請求項2に記載された画
像処理方法。
3. The method according to claim 1, wherein a direction shift amount of the line segment in the line segment extracted in the line segment extracting step is within a predetermined range,
3. The method according to claim 2, further comprising, when there is a set of line segments in which the positional deviation amount between the line segments is within a predetermined range, a line segment integrating step of integrating these line segments into one line segment. Image processing method.
【請求項4】 前記線分抽出ステップにおいて抽出され
た線分または前記線分統合ステップにおいて統合された
線分の中から所定の条件を満たす線分を選択する線分選
択ステップをさらに実行する請求項2または3に記載さ
れた画像処理方法。
4. A line segment selecting step for selecting a line segment satisfying a predetermined condition from the line segments extracted in the line segment extracting step or the line segments integrated in the line segment integrating step. Item 4. The image processing method according to item 2 or 3.
【請求項5】 前記線分選択ステップにおいて選択され
た線分の位置または選択された複数の線分の延長線上の
交点の位置を前記濃淡画像上で識別可能に表示する表示
ステップをさらに実行する請求項4に記載された画像処
理方法。
5. A display step of displaying a position of a line segment selected in the line segment selection step or a position of an intersection on an extension line of a plurality of selected line segments so as to be identifiable on the grayscale image. The image processing method according to claim 4.
【請求項6】 前記線分抽出ステップにおける線分の抽
出状態を用いて対象物の輪郭の直線部分における欠陥の
有無を判別する欠陥判別ステップをさらに実行する請求
項2に記載された画像処理方法。
6. The image processing method according to claim 2, further comprising the step of: determining a presence or absence of a defect in a straight line portion of the outline of the target object by using a line segment extraction state in said line segment extraction step. .
【請求項7】 前記欠陥判別ステップは、前記線分抽出
ステップで抽出された線分の中に線分間の方向ずれ量が
所定範囲内であり、かつ、線分間の位置ずれ量が所定範
囲内である線分の組があるとき、これら線分の間に欠陥
が存在すると判別するものである請求項6に記載された
画像処理方法。
7. The method according to claim 1, wherein, in the defect extracting step, a direction shift amount between the line segments in the line segments extracted in the line segment extracting step is within a predetermined range, and a positional deviation amount between the line segments is within a predetermined range. 7. The image processing method according to claim 6, wherein when there is a set of line segments, it is determined that a defect exists between these line segments.
【請求項8】 前記欠陥判別ステップは、前記線分抽出
ステップで抽出された線分の数を所定の基準値と比較
し、両者の値が異なるときに対象物の輪郭の直線部分に
欠陥が存在すると判別するものである請求項6に記載さ
れた画像処理方法。
8. The defect judging step compares the number of line segments extracted in the line segment extracting step with a predetermined reference value, and when the two values are different, a defect is found in a linear portion of the outline of the object. 7. The image processing method according to claim 6, wherein it is determined that the image data exists.
【請求項9】 前記ラベル設定ステップは、対象物の輪
郭における直線部分の方向として想定される方向毎に個
別のラベルを設定するものであり、 前記画素ラベル付けステップは、そのエッジ画素の方向
が前記想定される方向のいずれかと一致するようなエッ
ジ画素に対して、その一致した方向に対応する前記ラベ
ルを割り当てるものである、請求項1に記載された画像
処理方法。
9. The label setting step is to set an individual label for each direction assumed as a direction of a straight line portion in the outline of the object. 2. The image processing method according to claim 1, wherein the label corresponding to the coincident direction is assigned to an edge pixel that coincides with any of the assumed directions.
【請求項10】 前記線分抽出ステップにおいて抽出さ
れた線分の中に線分間の方向ずれ量が所定範囲内であ
り、かつ、線分間の位置ずれ量が所定範囲内である線分
の組があるとき、これらの線分を1本の線分に統合する
線分統合ステップをさらに実行する請求項9に記載され
た画像処理方法。
10. A set of line segments in which the direction shift amount between the line segments is within a predetermined range and the position shift amount between the line segments is within a predetermined range among the line segments extracted in the line segment extraction step. The image processing method according to claim 9, further comprising, when there is a line segment, further executing a line segment integrating step of integrating these line segments into one line segment.
【請求項11】 前記線分抽出ステップにおいて抽出さ
れた線分または前記線分統合ステップにおいて統合され
た線分の中から所定の条件を満たす線分を選択する線分
選択ステップをさらに実行する請求項9または10に記
載された画像処理方法。
11. A line segment selecting step of selecting a line segment satisfying a predetermined condition from the line segments extracted in the line segment extracting step or the line segments integrated in the line segment integrating step. Item 10. The image processing method according to Item 9 or 10.
【請求項12】 前記線分抽出ステップにおける線分の
抽出状態を用いて対象物の輪郭の直線部分における欠陥
の有無を判別する欠陥判別ステップをさらに実行する請
求項9に記載された画像処理方法。
12. The image processing method according to claim 9, further comprising the step of: determining a presence or absence of a defect in a straight line portion of the outline of the object by using a line segment extraction state in the line segment extraction step. .
【請求項13】 濃淡画像を入力する手段と、 前記濃淡画像に含まれるエッジ画素を抽出する手段と、 前記各エッジ画素におけるエッジ画素の方向を求める手
段と、 前記濃淡画像に表される対象物像の輪郭の直線部分の方
向を設定する方向設定手段と、 前記直線の方向毎に個別のラベルを設定するラベル設定
手段と、 そのエッジ画素の方向が前記直線の方向のいずれかと一
致するようなエッジ画素に対して、その一致した方向に
対応する前記ラベルを割り当てる画素ラベル付け手段
と、 同一の前記ラベルが割り当てられており、かつ、前記濃
淡画像上で連続しているとみなし得るエッジ画素の集合
を線分として抽出する線分抽出手段とを具備して成る画
像処理装置。
13. A means for inputting a grayscale image, a means for extracting edge pixels included in the grayscale image, a means for determining a direction of an edge pixel in each of the edge pixels, and an object represented in the grayscale image Direction setting means for setting the direction of a straight line portion of the contour of the image; label setting means for setting an individual label for each direction of the straight line; such that the direction of the edge pixel matches one of the directions of the straight line Pixel labeling means for assigning the label corresponding to the coincident direction to the edge pixel; and the same label is assigned to the edge pixel, and the edge pixel which can be regarded as being continuous on the grayscale image. An image processing apparatus comprising: a line segment extracting unit that extracts a set as a line segment.
【請求項14】 前記方向設定手段は、 エッジ画素の方向毎にエッジ画素の数の度合を示すヒス
トグラムを作成するヒストグラム作成手段と、 前記ヒストグラム上の極大値を抽出して、極大値に対応
するエッジ画素の方向を直線の方向として設定するピー
ク方向設定手段とを含み、 前記ラベル設定手段は、前記ピーク方向設定手段により
設定された方向毎に個別のラベルを設定するものであ
り、 前記画素ラベル付け手段は、前記ラベル設定手段により
設定されたラベルを各ラベルに対応するエッジ画素の方
向を有するエッジ画素に割り当てるものである請求項1
3に記載された画像処理装置。
14. The direction setting means, comprising: a histogram creating means for creating a histogram indicating the degree of the number of edge pixels for each edge pixel direction; and extracting a maximum value on the histogram to correspond to the maximum value. Peak direction setting means for setting the direction of an edge pixel as a straight line direction, wherein the label setting means sets an individual label for each direction set by the peak direction setting means, The labeling means allocates the label set by the label setting means to an edge pixel having a direction of an edge pixel corresponding to each label.
3. The image processing device according to 3.
【請求項15】 前記線分抽出手段によって抽出された
線分の中に線分間の方向ずれ量が所定範囲内であり、か
つ、線分間の位置ずれ量が所定範囲内である線分の組が
あるとき、これらの線分を1本の線分に統合する線分統
合手段をさらに具備して成る請求項14に記載された画
像処理装置。
15. A set of line segments extracted by the line segment extraction means, wherein the direction shift amount between the line segments is within a predetermined range, and the position shift amount between the line segments is within a predetermined range. 15. The image processing apparatus according to claim 14, further comprising a line segment integrating unit that integrates these line segments into one line segment when there is.
【請求項16】 前記線分抽出手段によって抽出された
線分または前記線分統合手段によって統合された線分の
中から所定の条件を満たす線分を選択する線分選択手段
とをさらに具備して成る請求項14または15に記載さ
れた画像処理装置。
16. A line selection means for selecting a line segment satisfying a predetermined condition from the line segments extracted by the line segment extraction unit or the line segments integrated by the line segment integration unit. The image processing device according to claim 14, wherein the image processing device comprises:
【請求項17】 前記線分選択手段によって選択された
線分の位置または選択された複数の線分の延長線上の交
点の位置を前記濃淡画像上で識別可能に表示するための
表示制御手段をさらに具備して成る請求項16に記載さ
れた画像処理装置。
17. A display control unit for displaying a position of a line segment selected by the line segment selection unit or a position of an intersection on an extended line of a plurality of selected line segments in an identifiable manner on the grayscale image. 17. The image processing apparatus according to claim 16, further comprising:
【請求項18】 前記線分抽出手段によって抽出された
線分の抽出状態を用いて対象物の輪郭の直線部分におけ
る欠陥の有無を判別する欠陥判別手段をさらに具備して
成る請求項13に記載された画像処理装置。
18. The apparatus according to claim 13, further comprising a defect discriminating means for discriminating the presence or absence of a defect in a straight line portion of the contour of the object using the extracted state of the line segment extracted by said line segment extracting means. Image processing device.
【請求項19】 前記欠陥判別手段は、前記線分抽出手
段によって抽出された線分の中に線分間の方向ずれ量が
所定範囲内であり、かつ、線分間の位置ずれ量が所定範
囲内である線分の組があるとき、これら線分の間に欠陥
が存在すると判別するものである請求項18に記載され
た画像処理装置。
19. The defect discriminating means, wherein, among the line segments extracted by the line segment extracting means, a direction deviation amount between the line segments is within a predetermined range, and a positional deviation amount between the line segments is within a predetermined range. 19. The image processing apparatus according to claim 18, wherein when there is a set of line segments, it is determined that a defect exists between these line segments.
【請求項20】 前記欠陥判別手段は、前記線分抽出手
段によって抽出された線分の数を所定の基準値と比較
し、両者の値が異なるときに対象物の輪郭の直線部分に
欠陥が存在すると判別するものである請求項18に記載
された画像処理装置。
20. The defect discriminating means compares the number of line segments extracted by the line segment extracting means with a predetermined reference value, and when the two values are different, a defect is found in a straight line portion of the outline of the object. 19. The image processing apparatus according to claim 18, wherein the image processing apparatus determines that the image is present.
【請求項21】 前記方向設定手段は、対象物の輪郭に
おける直線部分の想定される方向を入力するものであ
り、 前記ラベル設定手段は、前記方向設定手段によって入力
された方向毎に個別のラベルを設定するものであり、 前記画素ラベル付け手段は、そのエッジ画素の方向が前
記方向設定手段によって入力された方向のいずれかと一
致するようなエッジ画素に対して、その一致した方向に
対応する前記ラベルを割り当てるものである、請求項1
3に記載された画像処理装置。
21. The direction setting means is for inputting an assumed direction of a straight line portion in the contour of the object, and the label setting means is an individual label for each direction input by the direction setting means. The pixel labeling means, for an edge pixel whose edge pixel direction matches one of the directions input by the direction setting means, the pixel labeling means corresponding to the matching direction 2. A method for assigning a label.
3. The image processing device according to 3.
【請求項22】 前記線分抽出手段によって抽出された
線分の中に線分間の方向ずれ量が所定範囲内であり、か
つ、線分間の位置ずれ量が所定範囲内である線分の組が
あるとき、これらの線分を1本の線分に統合する線分統
合手段をさらに具備して成る請求項21に記載された画
像処理装置。
22. A set of line segments in which the direction shift amount between the line segments is within a predetermined range and the position shift amount between the line segments is within a predetermined range among the line segments extracted by the line segment extracting means. 22. The image processing apparatus according to claim 21, further comprising a line segment integrating means for integrating these line segments into one line segment when there is a line segment.
【請求項23】 前記線分抽出手段によって抽出された
線分または前記線分統合手段によって統合された線分の
中から所定の条件を満たす線分を選択する線分選択手段
をさらに具備して成る請求項21または22に記載され
た画像処理装置。
23. The apparatus according to claim 23, further comprising a line segment selecting unit that selects a line segment satisfying a predetermined condition from the line segments extracted by the line segment extracting unit or the line segments integrated by the line segment integrating unit. 23. The image processing apparatus according to claim 21, wherein
【請求項24】 前記線分抽出手段によって抽出された
線分の抽出状態を用いて対象物の輪郭の直線部分におけ
る欠陥の有無を判別する欠陥判別手段をさらに具備して
成る請求項21に記載された画像処理装置。
24. The apparatus according to claim 21, further comprising a defect discriminating means for discriminating the presence or absence of a defect in a straight line portion of the contour of the object using the extracted state of the line segment extracted by said line segment extracting means. Image processing device.
JP2001360985A 2000-11-29 2001-11-27 Image processing method and apparatus Expired - Lifetime JP3661635B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001360985A JP3661635B2 (en) 2000-11-29 2001-11-27 Image processing method and apparatus

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2000-362159 2000-11-29
JP2000362159 2000-11-29
JP2001360985A JP3661635B2 (en) 2000-11-29 2001-11-27 Image processing method and apparatus

Publications (2)

Publication Number Publication Date
JP2002230562A true JP2002230562A (en) 2002-08-16
JP3661635B2 JP3661635B2 (en) 2005-06-15

Family

ID=26604767

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001360985A Expired - Lifetime JP3661635B2 (en) 2000-11-29 2001-11-27 Image processing method and apparatus

Country Status (1)

Country Link
JP (1) JP3661635B2 (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7212672B2 (en) 2002-10-11 2007-05-01 Omron Corporation Image processing apparatus and image processing method
JP2007192752A (en) * 2006-01-20 2007-08-02 Horon:Kk Method and apparatus for edge detection
JP2010164318A (en) * 2009-01-13 2010-07-29 Nippon Steel Corp Method and device for inspecting flaw
JP2012502555A (en) * 2008-09-04 2012-01-26 シリコン イメージ,インコーポレイテッド System, method and apparatus for smoothing edges in an image to remove irregularities
US8422759B2 (en) 2010-03-12 2013-04-16 Omron Corporation Image processing method and image processing device
JP2013171302A (en) * 2012-02-17 2013-09-02 Olympus Corp Edge direction determination device, edge direction determination method, and edge direction determination program
KR101517004B1 (en) * 2008-04-14 2015-05-06 삼성전자주식회사 Image Processing
EP2348485A4 (en) * 2008-11-11 2018-01-17 Panasonic Intellectual Property Management Co., Ltd. Feature value extracting device, object identification device, and feature value extracting method
CN109671052A (en) * 2018-11-16 2019-04-23 华南理工大学 A kind of mistake hole inspection method and hole inspection of the flexible IC package substrate extracted based on circular contour
JP2020107039A (en) * 2018-12-27 2020-07-09 ブラザー工業株式会社 Image processing system, reading device and computer program
CN112164060A (en) * 2020-10-22 2021-01-01 江苏科技大学 Diamond sawing wire fracture prediction method based on image processing
CN113588654A (en) * 2021-06-24 2021-11-02 宁波大学 Three-dimensional visual detection method for engine heat exchanger interface

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7212672B2 (en) 2002-10-11 2007-05-01 Omron Corporation Image processing apparatus and image processing method
DE10346690B4 (en) * 2002-10-11 2007-11-29 Omron Corp. Method and device for detecting a linear object
JP2007192752A (en) * 2006-01-20 2007-08-02 Horon:Kk Method and apparatus for edge detection
KR101517004B1 (en) * 2008-04-14 2015-05-06 삼성전자주식회사 Image Processing
JP2012502555A (en) * 2008-09-04 2012-01-26 シリコン イメージ,インコーポレイテッド System, method and apparatus for smoothing edges in an image to remove irregularities
US8559746B2 (en) 2008-09-04 2013-10-15 Silicon Image, Inc. System, method, and apparatus for smoothing of edges in images to remove irregularities
US9305337B2 (en) 2008-09-04 2016-04-05 Lattice Semiconductor Corporation System, method, and apparatus for smoothing of edges in images to remove irregularities
EP2348485A4 (en) * 2008-11-11 2018-01-17 Panasonic Intellectual Property Management Co., Ltd. Feature value extracting device, object identification device, and feature value extracting method
JP2010164318A (en) * 2009-01-13 2010-07-29 Nippon Steel Corp Method and device for inspecting flaw
US8422759B2 (en) 2010-03-12 2013-04-16 Omron Corporation Image processing method and image processing device
JP2013171302A (en) * 2012-02-17 2013-09-02 Olympus Corp Edge direction determination device, edge direction determination method, and edge direction determination program
CN109671052A (en) * 2018-11-16 2019-04-23 华南理工大学 A kind of mistake hole inspection method and hole inspection of the flexible IC package substrate extracted based on circular contour
CN109671052B (en) * 2018-11-16 2023-03-24 华南理工大学 Through hole detection method of flexible IC packaging substrate based on circular contour extraction
JP2020107039A (en) * 2018-12-27 2020-07-09 ブラザー工業株式会社 Image processing system, reading device and computer program
JP7311832B2 (en) 2018-12-27 2023-07-20 ブラザー工業株式会社 Image processing device, reading device and computer program
CN112164060A (en) * 2020-10-22 2021-01-01 江苏科技大学 Diamond sawing wire fracture prediction method based on image processing
CN112164060B (en) * 2020-10-22 2024-02-06 江苏科技大学 Diamond saw wire fracture prediction method based on image processing
CN113588654A (en) * 2021-06-24 2021-11-02 宁波大学 Three-dimensional visual detection method for engine heat exchanger interface
CN113588654B (en) * 2021-06-24 2024-02-02 宁波大学 Three-dimensional visual detection method for engine heat exchanger interface

Also Published As

Publication number Publication date
JP3661635B2 (en) 2005-06-15

Similar Documents

Publication Publication Date Title
US6954550B2 (en) Image processing method and apparatus
CN111539908B (en) Method and system for detecting defects of sample
US9858659B2 (en) Pattern inspecting and measuring device and program
US8115169B2 (en) Method and apparatus of pattern inspection and semiconductor inspection system using the same
US8041104B2 (en) Pattern matching apparatus and scanning electron microscope using the same
US20020041705A1 (en) Locating regions in a target image using color matching, luminance pattern matching and hue plane pattern matching
JP3548748B2 (en) Image processing apparatus and method, medium storing image processing program, and inspection apparatus
WO2013136591A1 (en) Image inspection method and inspection region setting method
JP4702953B2 (en) Unevenness inspection method, unevenness inspection apparatus, and program
KR101932214B1 (en) Apparatus for measuring crack using image processing technology and method thereof
JP2016115331A (en) Identifier generator, identifier generation method, quality determination apparatus, quality determination method and program
WO2012057198A1 (en) Image processing apparatus and computer program
JP3661635B2 (en) Image processing method and apparatus
CN110879131B (en) Imaging quality testing method and imaging quality testing device for visual optical system, and electronic apparatus
JP2001188906A (en) Method and device for automatic image calssification
JP4279833B2 (en) Appearance inspection method and appearance inspection apparatus
JP2002140713A (en) Image processing method and image processor
JP4801697B2 (en) Image forming method, image forming apparatus, and computer program
JP2005309914A (en) Method for processing color image and image processor
JP6114559B2 (en) Automatic unevenness detector for flat panel display
JP4670995B2 (en) Color image processing method and image processing apparatus
CN116703912B (en) Mini-host network port integrity visual detection method
JP7475901B2 (en) Method and system for detecting defects on a test piece
WO2024034374A1 (en) Object classification device, object classification method, and object classification system
US20240037768A1 (en) Optical Inspection Based on Repetitive Feature Comparison

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041122

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041130

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050128

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050314

R150 Certificate of patent or registration of utility model

Ref document number: 3661635

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

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100401

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110401

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20130401

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130401

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20140401

Year of fee payment: 9

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

EXPY Cancellation because of completion of term