JP2654294B2 - Edge detection method - Google Patents

Edge detection method

Info

Publication number
JP2654294B2
JP2654294B2 JP3341356A JP34135691A JP2654294B2 JP 2654294 B2 JP2654294 B2 JP 2654294B2 JP 3341356 A JP3341356 A JP 3341356A JP 34135691 A JP34135691 A JP 34135691A JP 2654294 B2 JP2654294 B2 JP 2654294B2
Authority
JP
Japan
Prior art keywords
sum
differential
edge
pixel
search
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP3341356A
Other languages
Japanese (ja)
Other versions
JPH0581430A (en
Inventor
倫生 大塚
満 白澤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Electric Works Co Ltd
Original Assignee
Matsushita Electric Works Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Works Ltd filed Critical Matsushita Electric Works Ltd
Priority to JP3341356A priority Critical patent/JP2654294B2/en
Publication of JPH0581430A publication Critical patent/JPH0581430A/en
Application granted granted Critical
Publication of JP2654294B2 publication Critical patent/JP2654294B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、濃淡画像からエッジを
求めるエッジ検出方法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an edge detecting method for obtaining an edge from a gray image.

【0002】[0002]

【従来の技術】従来のエッジ検出方法の一例としては、
特開平2−171875号公報で提案されている多値画
像の輪郭検出方法がある。この多値画像の輪郭検出方法
では、メモリに記憶された画像の輪郭を求めるための基
準点を中心としてN行N列(Nは3以上の奇数)の画素
の輝度のうち最下行の輝度の和と最上行の輝度の和との
差Yd及び最右列の輝度の和と最左列の輝度の和との差
Xdを用い、Yd,Xdを要素とする方向ベクトルの大
きさ、つまりYd2 +Xd2 の平方根を求め、この方向
ベクトルの大きさがあるしきい値以上であれば、輪郭が
存在するとする。そして、上記輪郭の検出は、まず3×
3画素から始め、これにより求めた方向ベクトルの大き
さがしきい値を越えない場合には、Nの値を増加して方
向ベクトルの大きさを求め直すというものである。
2. Description of the Related Art An example of a conventional edge detection method is as follows.
There is a multi-value image contour detection method proposed in Japanese Patent Application Laid-Open No. 2-171875. In this method of detecting the contour of a multi-valued image, the luminance of the lowermost row among the luminances of N rows and N columns (N is an odd number of 3 or more) around a reference point for determining the contour of the image stored in the memory is determined. Using the difference Yd between the sum and the sum of the brightness of the top row and the difference Xd between the sum of the brightness of the rightmost column and the sum of the brightness of the leftmost column, the magnitude of the direction vector having Yd and Xd as elements, that is, Yd The square root of 2 + Xd 2 is obtained, and if the magnitude of this direction vector is equal to or greater than a certain threshold value, it is determined that a contour exists. Then, the above-mentioned contour detection is first performed by 3 ×
Starting with three pixels, if the magnitude of the direction vector obtained thereby does not exceed the threshold value, the value of N is increased to recalculate the magnitude of the direction vector.

【0003】[0003]

【発明が解決しようとする課題】ところが、上述のよう
なエッジ検出方法では、まずある領域の輝度より方向ベ
トルを求め、しきい値を越えない場合には、領域を拡大
して再び演算を行わなければならない。このため、処理
時間が長くなるという欠点がある。例えば、2つの交差
しているワークのエッジを求めるといったような場合に
は、上記演算をやり直す処理を何回も繰り返さなければ
ならないということが起こる可能性が高く、上記エッジ
検出方法は適当な方法であるとは言えない。
However, in the above-described edge detection method, the direction vector is first obtained from the luminance of a certain area, and if the threshold value is not exceeded, the area is enlarged and the calculation is performed again. There must be. For this reason, there is a disadvantage that the processing time becomes long. For example, in the case of finding the edge of two intersecting works, it is highly likely that the process of redoing the above operation must be repeated many times, and the edge detection method is an appropriate method. It cannot be said that.

【0004】本発明は上述の点に鑑みて為されたもので
あり、その目的とするところは、高速かつ安定してエッ
ジ検出が行えるエッジ検出方法を提供することにある。
[0004] The present invention has been made in view of the above points, and an object of the present invention is to provide an edge detection method capable of performing high-speed and stable edge detection.

【0005】[0005]

【課題を解決するための手段】本発明では、上記目的を
達成するために、2つの交差するワークを撮像してそれ
ぞれの濃淡画像を得るとともに、上記濃淡画像上のワー
クを横切り、且つその幅よりも大きい領域に複数のマス
クを設定し、その光量が最大のマスク内の画素を始点と
して少なくとも一方側へ検索し、微分値がしきい値以上
である画素を求め、これを交差する一方のワークのエッ
ジとし、このエッジから外側に複数の画素領域を含む大
きさの複数のマスクを設定し、上記エッジに沿って、画
素の微分方向値をコード化した所定の方向コードをもつ
画素が、エッジが存在すると判断するための所定のしき
い値を越える位置までマスクを移動させ、該しきい値を
越える画素の連なりを他方のワークのエッジとしてい
る。
According to the present invention, in order to achieve the above object, two intersecting workpieces are imaged and captured.
Each of the grayscale images is obtained , and a plurality of masks are set in an area that crosses the work on the grayscale image and is larger than the width, and a search is made to at least one side starting from a pixel in the mask having the maximum light amount. Then, a pixel having a differential value equal to or larger than a threshold value is obtained, and the obtained pixel is defined as an edge of one of the intersecting workpieces. Along the picture
A pixel having a predetermined direction code obtained by coding the elementary differential direction value moves the mask to a position exceeding a predetermined threshold value for determining that an edge exists , and setting the threshold value to
The series of pixels that exceed is defined as the edge of the other workpiece.

【0006】なお、ワークを撮像してそれぞれの濃淡画
像を得るとともに、該濃淡画像上の任意の画素を始点と
し、所定方向に複数画素分だけ検索し、画素の微分方向
値をコード化した微分方向コード値が所定範囲内の画素
の微分値の和を求める操作を、検索の開始画素をずらし
ながら繰り返し、今回の検索位置で求められた微分値の
和が前回の検索位置での微分値の和よりも大きい場合
は、上記操作を継続し、小さい場合には前回の検索位置
をエッジとする方法を、上記請求項1の発明における最
初に一方のワークのエッジを検出する方法の代わりに用
いてもよい。
[0006] It is to be noted that the work is imaged and each gray-scale image is formed.
An image is obtained, an arbitrary pixel on the grayscale image is set as a starting point, and a search is performed for a plurality of pixels in a predetermined direction.
The operation of obtaining the sum of the differential values of the pixels whose value is in the differential direction code value within a predetermined range is repeated while shifting the start pixel of the search, and the sum of the differential values obtained at the current search position is used for the previous search. If the difference is larger than the sum of the differential values at the position, the above operation is continued. If the difference is smaller, the edge of the previous search position is set as the edge. It may be used in place of the above method.

【0007】また、画像ノイズによるエッジの誤検出を
防止できるようにするために、上記ワークを撮像してそ
れぞれの濃淡画像を得るとともに、該濃淡画像上の任意
画素を始点とし、所定方向に複数画素分だけ検索し、
画素の微分方向値をコード化した微分方向コード値が所
定範囲内の画素の微分値の和を求める操作を、検索の開
画素をずらしながら繰り返し、今回の検索位置で求め
られた微分値の和と、予め設定された微分値の総和のし
きい値とを比較し、微分値の和が上記微分値の総和のし
きい値よりも大きいとき、今回の検索位置で求められた
微分値の和と前回の検索位置での微分値の和との比較を
行い、今回の検索位置で求められた微分値の和が前回の
検索位置での微分値の和よりも大きい場合は、上記操作
を継続し、小さい場合には前回の検索位置をエッジとす
る方法を、請求項2の発明の代わりに用いることが好ま
しい。
Further, in order to prevent erroneous detection of edges due to image noise, the above-mentioned work is imaged and
While obtaining each grayscale image, starting from an arbitrary pixel on the grayscale image and searching for a plurality of pixels in a predetermined direction,
The operation of obtaining the sum of the differential values of the pixels in which the differential direction value of the pixel is within a predetermined range is repeated while shifting the search start pixel, and the sum of the differential values obtained at the current search position is obtained. Is compared with a preset threshold value of the sum of the differential values. When the sum of the differential values is greater than the threshold value of the sum of the differential values, the sum of the differential values obtained at the current search position is obtained. Is compared with the sum of the differential values at the previous search position.If the sum of the differential values obtained at the current search position is larger than the sum of the differential values at the previous search position, continue the above operation. If it is smaller, it is preferable to use a method in which the previous search position is set as an edge instead of the second aspect of the present invention.

【0008】さらに、請求項2あるいは請求項3の方法
で、画像ノイズによるエッジの誤検出を防止できるよう
にすると共に、今回の検索位置で求められた微分値の和
と、予め設定された微分値の総和のしきい値とを比較し
た場合に、微分値の和が上記微分値の総和のしきい値よ
りも小さくなることがないときにも、確実にエッジを検
出することができるようにするために、請求項4に示す
ように、上記ワークを撮像してそれぞれの濃淡画像を得
るとともに、該濃淡画像上の任意の画素を始点とし、所
定方向に複数画素分だけ検索し、画素の微分方向値をコ
ード化した微分方向コード値が所定範囲内の画素の微分
値の和を求める操作を、検索の開始画素をずらしながら
繰り返し、今回の検索位置で求められた微分値の和と、
予め設定された微分値の総和のしきい値とを比較し、微
分値の和が上記微分値の総和のしきい値よりも大きいと
き、その検索位置をエッジとするようにしてもよい。
Further, according to the method of claim 2 or 3, it is possible to prevent erroneous detection of edges due to image noise, and to calculate the sum of differential values obtained at the current search position and a preset differential value. When comparing with the threshold value of the sum of the values, the edge can be reliably detected even when the sum of the differential values does not become smaller than the threshold value of the sum of the differential values. In order to achieve this, as described in claim 4, the work is imaged to obtain respective grayscale images.
At the same time, starting from an arbitrary pixel on the grayscale image and searching for a plurality of pixels in a predetermined direction, the differential direction value of the pixel is copied.
The operation of obtaining the sum of the differential values of the pixels in which the coded differential direction code values are within a predetermined range is repeated while shifting the start pixel of the search, and the sum of the differential values obtained at the current search position,
A comparison may be made with a preset threshold value of the sum of the differential values, and when the sum of the differential values is larger than the threshold value of the sum of the differential values, the search position may be set as an edge.

【0009】さらにまた、画像ノイズによるエッジの誤
検出を防止できるようにすると共に、今回の検索位置で
求められた微分値の和と、予め設定された微分値の総和
のしきい値とを比較し、微分値の和が上記微分値の総和
のしきい値よりも小さくなることがない場合にも、確実
にエッジを検出することができるようにする他の方法と
して、請求項5に示すように、上記ワークを撮像してそ
れぞれの濃淡画像を得るとともに、該濃淡画像上の任意
画素を始点とし、所定方向に複数画素分だけ検索し、
画素の微分方向値をコード化した微分方向コード値が所
定範囲内の画素の微分値の和を求める操作を、検索の開
画素をずらしながら繰り返し、この操作を予め設定さ
れた検索範囲内全体で行い、各検索画素毎の微分値の和
で最大のものを求め、その最大の微分値の和を持つ検索
画素をエッジとするようにしてもよい。
Furthermore, it is possible to prevent erroneous edge detection due to image noise, and compare the sum of the differential values obtained at the current search position with a preset threshold value of the sum of the differential values. Another method for reliably detecting an edge even when the sum of the differential values does not become smaller than the threshold value of the sum of the differential values is described in claim 5. Then, the above work is imaged and
While obtaining each grayscale image, starting from an arbitrary pixel on the grayscale image and searching for a plurality of pixels in a predetermined direction,
The operation of obtaining the sum of the differential values of the pixels whose differential direction code values obtained by encoding the differential direction values of the pixels are within a predetermined range is repeated while shifting the start pixel of the search, and this operation is performed over the entire preset search range. Search, find the largest sum of the differential values for each search pixel , and search with the largest sum of the differential values
Pixels may be edges.

【0010】[0010]

【作用】本発明は、上述のように構成することにより、
マスクを用い一方のワークのエッジを求め、さらにその
一方のワークのエッジに沿って方向コードによりマスク
を移動させるだけで、他方のワークのエッジを検出する
ことができ、高速にエッジ検出を行える。また、この方
法によればエッジ検出を濃淡画像処理によって求めるこ
とになるので、照明状況やワーク形状に左右されること
がなく、安定してエッジ検出が行える。
The present invention has the above-described structure,
The edge of one workpiece is determined using the mask, and the edge of the other workpiece can be detected simply by moving the mask with the direction code along the edge of the one workpiece, and the edge can be detected at high speed. In addition, according to this method, the edge detection is obtained by the grayscale image processing, so that the edge detection can be performed stably without being affected by the lighting condition and the shape of the work.

【0011】[0011]

【実施例】【Example】

(実施例1)図1乃至図7に本発明の一実施例を示す。
本実施例では、第2図に示すように、検査対象物をテレ
ビカメラ等の画像入力装置1により撮像し、各画素の濃
度をA/D変換部2においてデジタル信号に変換した
後、前処理部3において以下の前処理を行うことによ
り、A/D変換部2より得られる原画像のほかに、微分
画像、微分方向コード画像、エッジ画像を得る。
(Embodiment 1) FIGS. 1 to 7 show an embodiment of the present invention.
In this embodiment, as shown in FIG. 2, an inspection object is imaged by an image input device 1 such as a television camera, and the density of each pixel is converted into a digital signal by an A / D converter 2, and then the preprocessing is performed. By performing the following preprocessing in the unit 3, a differential image, a differential direction code image, and an edge image are obtained in addition to the original image obtained by the A / D conversion unit 2.

【0012】この前処理ではまず微分・稜線抽出処理を
行う。本アルゴリズムでは、画像処理の第1段階として
3×3画素の局所並列ウインドウを用いて空間微分処理
を行う。この処理の概念を図3に示す。注目する画像E
と、その画素Eの周囲の8画素A〜D,F〜Iからなる
3×3画素の局所並列ウインドウWを入力画像としての
原画像に設定する。ここで、A〜Iは各画素の8ビット
濃度値である。上記画素Eの縦方向・横方向の濃度変化
を夫々ΔV,ΔHとすると、 ΔV=(A+B+C)−(G+H+I) …(1) ΔH=(A+D+G)−(C+F+I) …(2) となる。この画素Eの微分絶対値|e|E は、 |e|E =(ΔV2 +ΔH2)1/2…(3) となる。また、画素Eの微分方向値∠eE は、 ∠eE =tan-1(ΔV/ΔH+π/2) …(4) となる。
In this preprocessing, first, a differential / edge extraction process is performed. In the present algorithm, spatial differentiation processing is performed using a local parallel window of 3 × 3 pixels as the first stage of image processing. FIG. 3 shows the concept of this processing. Attention image E
Then, a local parallel window W of 3 × 3 pixels including eight pixels A to D and F to I around the pixel E is set as an original image as an input image. Here, A to I are 8-bit density values of each pixel. Assuming that the vertical and horizontal density changes of the pixel E are ΔV and ΔH, respectively, ΔV = (A + B + C) − (G + H + I) (1) ΔH = (A + D + G) − (C + F + I) (2) The differential absolute value | e | E of this pixel E is | e | E = (ΔV 2 + ΔH 2 ) 1/2 (3) Further, the differential direction value ∠E E of the pixel E is, ∠e E = tan -1 (ΔV / ΔH + π / 2) ... a (4).

【0013】つまり、画素Eを中心とする周囲の8画素
のデータを同時に取り出し、上記演算を行い、その結果
を画素Eのデータとする。以上の計算を256×256
画素の全画面について行うことによって、画面内の物体
の輪郭や欠陥などの濃度変化の大きい部分と、その変化
の方向を抽出することができる。なお、(3)式の|e
E をすべての画素について濃度(明るさ)で表した画
像を微分画像と呼び、(4)式の∠eE をコード化して
表した画像を微分方向コード画像と呼ぶ。
That is, data of eight pixels around the pixel E are taken out at the same time, the above operation is performed, and the result is used as data of the pixel E. The above calculation is 256 × 256
By performing the process on the entire screen of the pixels, it is possible to extract a portion where the density change is large, such as an outline or a defect of the object in the screen, and the direction of the change. | E in equation (3)
An image in which | E is expressed in terms of density (brightness) for all pixels is called a differential image, and an image in which ∠e E in Expression (4) is coded is called a differential direction code image.

【0014】次に、この微分画像に対して稜線抽出処理
を行う。図4(a)が微分絶対値の画像の例である。こ
の画像における山の高い部分は原画像での濃度変化が大
きいことを示している。濃度変化が緩やかな部分では、
これらの山のすそ野が広がり輪郭線が太くなってしま
う。そこで、図4(b)に示すように、これらの山の稜
線のみを抽出する。この処理が稜線抽出処理である。
Next, an edge line extraction process is performed on the differential image. FIG. 4A is an example of an image of the differential absolute value. A high mountain portion in this image indicates that the density change in the original image is large. In areas where the change in concentration is gradual,
The foothills of these mountains widen and the outlines become thicker. Therefore, as shown in FIG. 4B, only the ridge lines of these mountains are extracted. This processing is the ridge line extraction processing.

【0015】なお、実際には各画素の微分絶対値に着目
し、周囲画素の微分絶対値よりも大きなものを稜線とす
る。ここまでの処理により、微分絶対値画像中の値の大
小にかかわらず、すべての稜線が抽出される。従って、
この稜線の中にはノイズなどによる不要な小さな山(図
4(b)中a,c)まで含まれているので、図4(b)
のように、予め定められたしきい値SLによりスライス
することにより、a,cを取り除く。従って、最終的に
はb,b’の太線のみが抽出される。
In practice, attention is paid to the absolute value of the differential of each pixel, and an edge that is larger than the absolute value of the differential of surrounding pixels is defined as a ridgeline. By the processing up to this point, all edges are extracted regardless of the magnitude of the value in the differential absolute value image. Therefore,
This ridge line includes unnecessary small mountains due to noise or the like (a and c in FIG. 4B).
As shown in the above, a and c are removed by slicing with a predetermined threshold value SL. Therefore, finally, only the thick lines b and b 'are extracted.

【0016】上記微分・稜線抽出処理により大きい山の
稜線(以下、エッジと呼ぶ)が抽出されるが、この稜線
は図4(b)に示すように不連続になりやすい。そこ
で、次にエッジ延長処理と呼ばれる処理を行い、A点か
らB点を図4(b)中の点線で示すように接続する。こ
の処理では次の評価関数f(ej )を算出する。 f(ej )=|ej |・cos(∠ej −∠e0 ) ・cos((j−1)π/4−∠e0 ) …(5) ここで、e0 :中心画素濃度(図3のE)の微分データ ej :隣接画素(図3のEを除くA〜I)の微分データ この評価関数の値が大きいほど、その方向のエッジを伸
ばしやすいことを意味している。
A ridge line of a larger mountain (hereinafter, referred to as an edge) is extracted in the above-described differential / ridge line extraction process, but the ridge line tends to be discontinuous as shown in FIG. 4B. Therefore, next, a process called an edge extension process is performed, and the points A to B are connected as shown by a dotted line in FIG. 4B. In this process, the following evaluation function f (e j ) is calculated. f (e j ) = | e j | · cos (∠e j −∠e 0 ) · cos ((j−1) π / 4−∠e 0 ) (5) where e 0 : central pixel density derivative data e j of (E in Figure 3): means that the larger the value of the differential data the evaluation function of the adjacent pixels (a to I except E in FIG. 3), likely to extend its edge direction .

【0017】このエッジ延長処理では、図4(b)のA
点を始点として隣接画像に対し、順次(5)式の評価関
数を算出し、その最大値を示す方向へ延長して行き、B
点でもともとのエッジと衝突したならば処理を止める。
このとき得られるエッジは、原画像上の明るさの変化点
を線画で表したものである。ここで、原画像から明るさ
の変化点を輪郭として抽出した線画像を、エッジ画像と
呼ぶ。
In this edge extension processing, A in FIG.
The evaluation function of Expression (5) is sequentially calculated with respect to the adjacent images starting from the point, and the evaluation function is extended in the direction indicating the maximum value.
If the point collides with the original edge, the processing is stopped.
The edge obtained at this time is a point at which the brightness change point on the original image is represented by a line drawing. Here, a line image obtained by extracting a brightness change point as an outline from the original image is called an edge image.

【0018】以上の処理により、夫々微分画像、微分方
向コード画像、エッジ画像が得られる。これらの画像の
構成を図5を用いて説明する。図5において、4枚の画
像上のアドレスは共通とし、任意の点P(x,y)と設
定する。原画像f1 は入力された濃淡画像で、通常8ビ
ット(256階調)の明るさのレベルで表される。点P
での明るさaは、 a=f1 (x,y) (0≦a≦255) とおく。
By the above processing, a differential image, a differential direction code image, and an edge image are obtained, respectively. The configuration of these images will be described with reference to FIG. In FIG. 5, the addresses on the four images are common, and are set to an arbitrary point P (x, y). The original image f 1 is an input gray-scale image, which is usually represented by a brightness level of 8 bits (256 gradations). Point P
Is a = f 1 (x, y) (0 ≦ a ≦ 255).

【0019】微分画像f2 における微分値の階調を例え
ば6ビットとすると、点Pでの微分値bは、 b=f2 (x,y) (0≦a≦63) と表される。微分方向コード画像f3 における微分方向
を例えば16方向でコード化すれば、点Pにおける微分
方向コードcは、 c=f3 (x,y) (0≦a≦15) と書ける。
Assuming that the gradation of the differential value in the differential image f 2 is, for example, 6 bits, the differential value b at the point P is expressed as b = f 2 (x, y) (0 ≦ a ≦ 63). If the differential direction in the differential direction code image f 3 is coded, for example, in 16 directions, the differential direction code c at the point P can be written as c = f 3 (x, y) (0 ≦ a ≦ 15).

【0020】エッジ画像f4 においては、原画像上の明
るさの変化点を線画として抽出した1ビットの画像であ
るので、線画の部分が "1”,背景が "0”となってい
る。そこで、 "1”である画素をエッジフラッグと呼
び、点Pがエッジフラッグであるとき、 f4 (x,y)=1 となり、背景であるとき、 f4 (x,y)=0 と表される。
Since the edge image f 4 is a 1-bit image in which the brightness change point on the original image is extracted as a line drawing, the line drawing portion is “1” and the background is “0”. Therefore, a pixel which is “1” is called an edge flag. When the point P is an edge flag, f 4 (x, y) = 1, and when the point P is a background, f 4 (x, y) = 0. Is done.

【0021】上述した画像処理により得た各画像を用い
てエッジ検出を行う方法について以下に説明する。な
お、本実施例の場合には、特に2つのワーク11が交差
する場合を例として以下に説明する。本実施例では、図
1に示すように、上記2つのワーク11の交差部を含む
画像上に、ワーク11を横切り、且つその幅よりも大き
い領域に複数のマスク12を設定する。なお、、図1の
場合には4つのマスク121 〜124 を設定している。
そして、夫々のマスク121 〜24 の平均光量を求め、
一番平均光量が高いマスク12の中心を第1のエッジ検
出の始点とする。つまり、これはワーク11の内部に第
1のエッジ検出のための始点を設定するための処理であ
り、ワーク11は光源からの光を正反射し、輝度が高く
なっているので、ワーク11内部に第1のエッジ検出の
始点を設定することができる。
A method for performing edge detection using each image obtained by the above-described image processing will be described below. In the case of the present embodiment, a case where two works 11 intersect with each other will be described below as an example. In the present embodiment, as shown in FIG. 1, a plurality of masks 12 are set on an image including the intersection of the two works 11 in a region that crosses the work 11 and is larger than the width thereof. Note the case of ,, Figure 1 is set to four masks 12 1 to 12 4.
Then, an average light amount of the mask 12 21 to 24 each,
The center of the mask 12 having the highest average light amount is set as the start point of the first edge detection. In other words, this is a process for setting a starting point for the first edge detection inside the work 11. Since the work 11 specularly reflects light from the light source and has a high luminance, the work 11 Can be set as the start point of the first edge detection.

【0022】次に、上記始点から両側に検索し、エッジ
フラグが図6に示すように同一yアドレス上に予め設定
しておいた画素以上存在する点を求め、この点を第1の
エッジとする。ここで、図6における1がエッジフラッ
グで、0が背景であり、この場合にはしきい値を3とし
てあり、yiがエッジのアドレスとなる。なお、上述の
場合には始点から両側に検索を行っているので、第1の
エッジは2つ得られる。但し、上記検索は一方側だけで
あってもよい。さらに、上述の場合にはエッジフラグが
同一yアドレス上に予め設定しておいた画素以上存在す
る点を第1のエッジとして、第1のエッジの検出確度を
高くしてあるが、設定するマスク12によっては微分値
がしきい値以上である点を第1のエッジとしてもよい。
Next, a search is made on both sides from the start point to find a point where an edge flag exists on the same y address as shown in FIG. 6 for more than a predetermined number of pixels. I do. Here, 1 in FIG. 6 is an edge flag and 0 is a background. In this case, the threshold is set to 3, and yi is an edge address. In the above case, since the search is performed on both sides from the start point, two first edges are obtained. However, the search may be performed on only one side. Further, in the above-described case, the detection accuracy of the first edge is set to be higher as the point where the edge flag exists in the same y address as the first edge or more at a pixel set in advance. Depending on 12, a point at which the differential value is equal to or larger than the threshold value may be set as the first edge.

【0023】さらに、それら第1のエッジより外側へn
×m画素の大きさのマスク13を設定し、このマスク1
3をエッジフラッグに沿って図中の矢印で示す第2のエ
ッジ検索方向へ移動させる。この際には、n×m画素領
域を1画素ずつラスタ走査を行って、所定範囲の微分方
向値がある画素を微分方向コード画像(図5におけるf
3 )上から読み出し、その画素の総数sumを求める。
そして、画素総数sumがしきい値SL1 よりも大きけ
れば(sum>SL1 )、エッジが存在するとし、n×
m画素領域の第2エッジ検索方向側のxアドレスをエッ
ジのアドレスとする。なお、図1の場合にはxiがエッ
ジのアドレスとなっている。上記エッジ検出方法をまと
めたフローチャートを図7に示す。
Furthermore, n outside these first edges
A mask 13 having a size of × m pixels is set.
3 is moved along the edge flag in the second edge search direction indicated by the arrow in the figure. In this case, the n × m pixel area is raster-scanned one pixel at a time, and pixels having a predetermined range of differential direction values are identified as differential direction code images (f in FIG. 5).
3 ) Read from the top and find the total number sum of the pixels.
Then, if the pixel total sum is larger than the threshold value SL 1 (sum> SL 1) , the edge is present, n ×
The x address on the second edge search direction side of the m pixel area is defined as an edge address. In the case of FIG. 1, xi is an edge address. FIG. 7 is a flowchart summarizing the edge detection method.

【0024】以上のようにしてエッジ検出を行えば、高
速且つ安定してエッジ検出を行える。つまり、上述のよ
うに2つの交差するワークのエッジを検出する場合に、
マスクを用い第1のエッジを求め、さらにこの第1のエ
ッジに沿って方向コードによりマスクを移動させるだけ
で、上記ワーク11と交差するワーク11のエッジを検
出することができるので、高速にエッジ検出を行える。
また、白黒の2値化画像の場合には、ワーク11への照
明が均一でないことやワーク11の形状が一定しないこ
となどから、照明状況やワーク形状により2値化処理し
てもエッジ検出精度が安定しない。しかし、本実施例の
場合にはエッジ検出を濃淡画像処理によって求めること
になるので、照明状況やワーク形状に左右されることが
なく、安定してエッジ検出が行える。
By performing edge detection as described above, edge detection can be performed at high speed and stably. That is, when detecting the edges of two intersecting workpieces as described above,
The edge of the work 11 intersecting with the work 11 can be detected simply by finding the first edge using the mask and moving the mask with the direction code along the first edge. Detection can be performed.
Further, in the case of a black-and-white binary image, the illumination of the work 11 is not uniform and the shape of the work 11 is not constant. Is not stable. However, in the case of the present embodiment, since edge detection is obtained by grayscale image processing, edge detection can be performed stably without being affected by the lighting conditions and the shape of the work.

【0025】(実施例2) 図8及び図9に本発明の他の実施例を示す。本実施例で
は、図8に示すように、ワーク11を撮像した画像上の
任意の点を始点Pとし、図中に下向き矢印で示す第1検
索方向に複数画素(aドット)検索し、微分方向コード
画像(f3 )から微分方向値を読み出し、この微分方向
値が予め定めた所定範囲内にある画素を求める。そし
て、その画素に関して微分画像(図5中のf2 )から微
分絶対値を読み出して加算する。この微分絶対値の総数
SUMとする。
(Embodiment 2) FIGS. 8 and 9 show another embodiment of the present invention. In this embodiment, as shown in FIG. 8, an arbitrary point on an image of the workpiece 11 is set as a starting point P, a plurality of pixels (a dots) are searched in a first search direction indicated by a downward arrow in the figure, and differentiation is performed. A differential direction value is read from the direction code image (f 3 ), and a pixel whose differential direction value is within a predetermined range is determined. Then, a differential absolute value is read from the differential image (f 2 in FIG. 5) for the pixel and added. It is assumed that the total number of differential absolute values is SUM.

【0026】次に、図中の左向き矢印で示す第2検索方
向に1画素分(1ドット)検索開始点を移動し、上述の
場合と同様の処理を行う。そして、この場合には、前回
の処理結果(SUMold )と今回の処理結果(SUM
new )とを比較する。この際に、前回の処理結果(SU
old )よりも今回の処理結果(SUMnew)の方が大
きい、つまりSUMnew >SUMold である場合、続け
て第2検索方向に1画素分(1ドット)検索開始点を移
動し、上記処理を繰り返す。
Next, the search start point for one pixel (one dot) is moved in the second search direction indicated by the left arrow in the figure, and the same processing as in the above case is performed. In this case, the previous processing result (SUM old ) and the current processing result (SUM old )
new ). At this time, the previous processing result (SU
If the current processing result (SUM new ) is larger than (M old ), that is, if SUM new > SUM old , the search start point is moved by one pixel (1 dot) in the second search direction. Repeat the process.

【0027】そして、前回の処理結果(SUMold )よ
りも今回の処理結果(SUMnew )の方が小さい、つま
りSUMnew ≦SUMold であるとき、前回の処理結果
(SUMold)の検索開始位置をエッジとする。上記処
理をまとめたフローチャートを図9に示す。本実施例は
実施例1における第1のエッジを検出する方法として用
いることができ、この第1のエッジの検出後は実施例1
で説明した方法を採用して、交差するワーク11のエッ
ジを検出することができる。
If the current processing result (SUM new ) is smaller than the previous processing result (SUM old ), that is, if SUM new ≦ SUM old , the search start position of the previous processing result (SUM old ) Is an edge. FIG. 9 is a flowchart summarizing the above processing. This embodiment can be used as a method for detecting the first edge in the first embodiment. After the detection of the first edge, the first embodiment is used.
By adopting the method described in the above, the edge of the intersecting work 11 can be detected.

【0028】(実施例3)図10及び図11に本発明の
さらに他の実施例を示す。上述の実施例2の場合には、
支点Pから常に前回の処理結果(SUMold )と今回の
処理結果(SUM new )とを比較する処理を行っていた
が、このようにすると、図11に示すように画像ノイズ
Nがある場合に、実際のエッジが図中のPE であるにも
かかわらず、画像ノイズNをエッジとして検出する恐れ
がある。
(Embodiment 3) FIGS. 10 and 11 show the present invention.
Another embodiment will be described. In the case of Embodiment 2 described above,
From the fulcrum P, the previous processing result (SUMold) And this time
Processing result (SUM new) Was compared with
However, in this case, as shown in FIG.
If there is N, the actual edge is PEBut also
Regardless, the image noise N may be detected as an edge.
There is.

【0029】そこで、本実施例では上記実施例2で微分
絶対値の総数SUMを求めた後に次の操作を行う。つま
り、微分絶対値の総数SUMを、予め設定された微分絶
対値の総和のしきい値THD(図11中の横線で示す)
と比較する。そして、微分絶対値の総数SUMが微分絶
対値の総和のしきい値THDよりも大きい、つまりはS
UM>THDである場合に、実施例2で説明した前回の
処理結果(SUMold )と今回の処理結果(SU
new )とを比較し、エッジを検出する処理を行う。な
お、本実施例の処理をまとめると、図10に示すフロー
チャートのようになる。
Therefore, in this embodiment, the following operation is performed after obtaining the total number SUM of the differential absolute values in the second embodiment. In other words, the total number of differential absolute values SUM is determined by a preset threshold value THD of the sum of differential absolute values (shown by a horizontal line in FIG. 11).
Compare with Then, the total number of differential absolute values SUM is larger than the threshold value THD of the sum of differential absolute values, that is, S
When UM> THD, the previous processing result (SUM old ) described in the second embodiment and the current processing result (SU
M new ) to perform edge detection processing. Note that the processing of this embodiment is summarized as a flowchart shown in FIG.

【0030】このようにすれば、微分絶対値の総数SU
Mの小さい場合にはエッジの判定処理が行われず、図1
1のような画像ノイズNの影響を無くすことができる。 (実施例4)図12及び図13に本発明のさらに他の実
施例を示す。上記実施例2及び実施例3においては、前
回の処理結果(SUMold )と今回の処理結果(SUM
new )とを比較した場合に、図13に示すように、前回
の処理結果(SUMold )よりも今回の処理結果(SU
new )の方が大きい状態が継続する場合、エッジの検
出を行えないということが起こる。
In this manner, the total number of differential absolute values SU
When M is small, the edge determination process is not performed, and FIG.
Thus, the influence of the image noise N such as 1 can be eliminated. (Embodiment 4) FIGS. 12 and 13 show still another embodiment of the present invention. In the second and third embodiments, the previous processing result (SUM old ) and the current processing result (SUM old )
when comparing new) and, as shown in FIG. 13, the previous processing result (SUM old) than even the current processing result (SU
If the state of M new ) is larger, the edge detection may not be performed.

【0031】そこで、本実施例では、図12に示すよう
に、実施例2で説明した微分絶対値の総数SUMを求め
た後に、微分絶対値の総数SUMを、予め設定された微
分絶対値の総和のしきい値THD(図13中の横線で示
す)と比較し、微分絶対値の総数SUMが微分絶対値の
総和のしきい値THDよりも大きい、つまりはSUM>
THDが成立した場合に、その検索位置をエッジとす
る。なお、この場合にSUM>THDが成立しない場合
には、図8中の第2検索方向に1画素分(1ドット)
索開始点を移動し、上記処理を繰り返す。
Therefore, in the present embodiment, as shown in FIG. 12, after calculating the total number of differential absolute values SUM described in the second embodiment, the total number of differential absolute values SUM is calculated based on a preset differential absolute value. Compared to the sum threshold THD (shown by the horizontal line in FIG. 13), the total number of differential absolute values SUM is larger than the threshold THD of the sum of differential absolute values, that is, SUM>
When THD is established, the search position is defined as an edge. In this case, if SUM> THD is not established, the search start point is moved by one pixel (one dot) in the second search direction in FIG. 8 and the above processing is repeated.

【0032】このようにすれば、実施例3と同様にして
画像ノイズによるエッジの誤検出を起こさず、かつ図1
3に示すように、前回の処理結果(SUMold )よりも
今回の処理結果(SUMnew )の方が大きい状態が継続
する場合にも、エッジの検出を行える。 (実施例5)図14に本発明のさらに別の実施例を示
す。本実施例は、画像ノイズによるエッジの誤検出を起
こさず、かつ図13に示すように、前回の処理結果(S
UMol d )よりも今回の処理結果(SUMnew)の方が
大きい状態が継続する場合にもエッジの検出を行えるよ
うにした他の実施例である。
In this way, no erroneous edge detection due to image noise occurs as in the third embodiment, and FIG.
As shown in FIG. 3, even when a state in which the current processing result (SUM new ) is larger than the previous processing result (SUM old ) continues, the edge can be detected. (Embodiment 5) FIG. 14 shows still another embodiment of the present invention. The present embodiment does not cause erroneous detection of edges due to image noise, and as shown in FIG.
This is another embodiment in which an edge can be detected even when a state in which the current processing result (SUM new ) is larger than UM ol d ) continues.

【0033】本実施例では、実施例2で説明した微分絶
対値の総数SUMを求める処理を、図8中の第2検索方
向に1画素分(1ドット)検索開始点を移動しながら繰
り返す。なお、この操作を予め設定された検索範囲内全
体で行う。そして、各検索位置における微分絶対値の総
数SUMが、各検索位置毎に、SUM1,SUM2,S
UM3,…SUMnであるとすると、微分絶対値の総数
SUMの内で最大のものSUM(MAX) を求め、このSU
(MAX) が得られた検索位置をエッジとする。
In the present embodiment, the process of obtaining the total number of differential absolute values SUM described in the second embodiment is repeated while moving the search start point for one pixel (one dot) in the second search direction in FIG. This operation is performed for the entire search range set in advance. Then, the total number SUM of differential absolute values at each search position is calculated as SUM1, SUM2, SUM for each search position.
UM3,... SUMn, the largest SUM (MAX) among the total number of differential absolute values SUM is obtained, and this SU
The search position at which M (MAX) is obtained is defined as an edge.

【0034】なお、本実施例の方法では、どのような画
像ノイズが存在しても、微分絶対値の総数SUMが、画
像ノイズの総和よりも大きいものとすれば、安定にエッ
ジを検出することができる。
In the method of this embodiment, no matter what image noise is present, if the total number of differential absolute values SUM is larger than the sum of image noise, it is possible to detect edges stably. Can be.

【0035】[0035]

【発明の効果】請求項1の発明は上述のように、2つの
交差するワークを撮像してそれぞれの濃淡画像を得ると
ともに、上記濃淡画像上のワークを横切り、且つその幅
よりも大きい領域に複数のマスクを設定し、その光量が
最大のマスク内の画素を始点として少なくとも一方側へ
検索し、微分値がしきい値以上である画素を求め、これ
を交差する一方のワークのエッジとし、このエッジから
外側に複数の画素領域を含む大きさの複数のマスクを設
定し、上記エッジに沿って、画素の微分方向値をコード
化した所定の方向コードをもつ画素が、エッジが存在す
ると判断するための所定のしきい値を越える位置までマ
スクを移動させ、該しきい値を越える画素の連なりを他
方のワークのエッジとしているので、マスクを用い一方
のワークのエッジを求め、さらにその一方のワークのエ
ッジに沿って方向コードによりマスクを移動させるだけ
で、他方のワークのエッジを検出することができ、高速
にエッジ検出を行える。また、この方法によればエッジ
検出を濃淡画像処理によって求めることになるので、照
明状況やワーク形状に左右されることがなく、安定して
エッジ検出が行える。
According to the first aspect of the present invention, as described above, when two intersecting works are imaged to obtain respective grayscale images.
In both cases, a plurality of masks are set in an area that traverses the workpiece on the grayscale image and is larger than the width, and a search is made to at least one side starting from a pixel in the mask having the largest light amount, and a differential value is determined. A pixel having a value equal to or larger than the value is obtained, and this is defined as an edge of one of the intersecting workpieces.A plurality of masks having a size including a plurality of pixel regions are set outside the edge, and along the edge, the differentiation direction of the pixel is determined. Code the value
Pixels having a predetermined direction code ized may be present edge
The mask is moved to a position exceeding a predetermined threshold value for judging that a series of pixels exceeding the threshold value is used as the edge of the other work, so that the edge of one work is obtained using the mask, Further, the edge of the other work can be detected simply by moving the mask by the direction code along the edge of the one work, and the edge can be detected at high speed. In addition, according to this method, the edge detection is obtained by the grayscale image processing, so that the edge detection can be performed stably without being affected by the lighting condition and the shape of the work.

【0036】また、請求項2に示すように、2つの交差
するワークを撮像してそれぞれの濃淡画像を得るととも
に、該濃淡画像上の任意の画素を始点とし、所定方向に
複数画素分だけ検索し、画素の微分方向値をコード化し
微分方向コード値が所定範囲内の画素の微分値の和を
求める操作を、検索の開始画素をずらしながら繰り返
し、今回の検索位置で求められた微分値の和が前回の検
索位置での微分値の和よりも大きい場合は、上記操作を
継続し、小さい場合には前回の検索位置をエッジとする
方法を用いて、上記請求項1の発明における最初に一方
のワークのエッジを検出することが可能である。
According to a second aspect of the present invention, two intersecting works are imaged to obtain respective grayscale images.
Starting from an arbitrary pixel on the grayscale image and searching for a plurality of pixels in a predetermined direction, the differential direction value of the pixel is coded.
The operation of obtaining the sum of the differential values of the pixels whose differential direction code values are within a predetermined range is repeated while shifting the start pixel of the search, and the sum of the differential values obtained at the current search position is used as the differential at the previous search position. If greater than the sum of the values will continue the operation, when it is smaller by using the method of the edge of the previous search position, it first detects the edge of one of the work in the invention of the claim 1 it is possible and this.

【0037】さらに、請求項3に示すように、ワークを
撮像してそれぞれの濃淡画像を得るとともに、該濃淡画
上の任意の画素を始点とし、所定方向に複数画素分だ
検索し、画素の微分方向値をコード化した微分方向コ
ード値が所定範囲内の画素の微分値の和を求める操作
を、検索の開始画素をずらしながら繰り返し、今回の検
索位置で求められた微分値の和と、予め設定された微分
値の総和のしきい値とを比較し、微分値の和が上記微分
値の総和のしきい値よりも大きいとき、今回の検索位置
で求められた微分値の和と前回の検索位置での微分値の
和との比較を行い、今回の検索位置で求められた微分値
の和が前回の検索位置での微分値の和よりも大きい場合
は、上記操作を継続し、小さい場合には前回の検索位置
をエッジとすれば、微分値の総和のしきい値よりも小さ
い微分値の和はエッジの検出のための対象から外すこと
ができ、このため微分値の総和のしきい値よりも小さい
画像ノイズによるエッジの誤検出を防止できる。
Further, as described in claim 3, the workpiece is
Imaging to obtain each grayscale image and the grayscale image
Starting from an arbitrary pixel on the image and extending multiple pixels in a predetermined direction
The operation of obtaining the sum of the differential values of the pixels whose differential direction code values obtained by encoding the differential direction values of the pixels are within a predetermined range is repeated while shifting the start pixel of the search, and is obtained at the current search position. The sum of the differential values is compared with a preset threshold value of the sum of the differential values, and when the sum of the differential values is larger than the threshold value of the sum of the differential values, the value obtained at the current search position is obtained. Compare the sum of the differential values with the sum of the differential values at the previous search position.If the sum of the differential values obtained at the current search position is larger than the sum of the differential values at the previous search position, If the above operation is continued and the previous search position is set to be an edge when the value is smaller, the sum of the differential values smaller than the threshold value of the sum of the differential values can be excluded from the object for edge detection. As a result, noise due to image noise smaller than the threshold value of the sum of differential values Erroneous detection of the di can be prevented.

【0038】さらにまた、請求項4に示すように、ワー
クを撮像してそれぞれの濃淡画像を得るとともに、該濃
淡画像上の任意の画素を始点とし、所定方向に複数画素
分だけ検索し、画素の微分方向値をコード化した微分方
向コード値が所定範囲内の画素の微分値の和を求める操
作を、検索の開始画素をずらしながら繰り返し、今回の
検索位置で求められた微分値の和と、予め設定された微
分値の総和のしきい値とを比較し、微分値の和が上記微
分値の総和のしきい値よりも大きいとき、その検索位置
をエッジとすれば、微分値の総和のしきい値よりも小さ
い微分値の和はエッジの検出のための対象から外すこと
ができ、このため微分値の総和のしきい値よりも小さい
画像ノイズによるエッジの誤検出を防止でき、また今回
の検索位置で求められた微分値の和と、予め設定された
微分値の総和のしきい値とを比較した場合に、微分値の
和が上記微分値の総和のしきい値よりも小さくなること
がないときにも、必ずエッジの検出が行える。
Further, as described in claim 4, the word
Images to obtain their respective grayscale images,
Starting from an arbitrary pixel on the light image , multiple pixels in a predetermined direction
The operation of searching for the difference and calculating the sum of the differential values of the pixels in which the differential direction code value of the pixel is within a predetermined range is repeated while shifting the start pixel of the search, and is obtained at the current search position. The sum of the differentiated values is compared with a preset threshold value of the sum of the differential values. When the sum of the differential values is larger than the threshold value of the sum of the differential values, the search position is regarded as an edge. For example, the sum of the differential values smaller than the threshold value of the sum of the differential values can be excluded from the object for edge detection, and therefore, the error of the edge due to image noise smaller than the threshold value of the sum of the differential values can be excluded. Detection can be prevented, and when the sum of the differential values obtained at the current search position is compared with a preset threshold value of the sum of the differential values, the sum of the differential values becomes Even when it does not fall below the threshold, Not perform the detection of the edge.

【0039】また、請求項5に示すように、ワークを撮
像してそれぞれの濃淡画像を得るとともに、該濃淡画像
上の任意の画素を始点とし、所定方向に複数画素分だけ
検索し、画素の微分方向値をコード化した微分方向コー
ド値が所定範囲内の画素の微分値の和を求める操作を、
検索の開始画素をずらしながら繰り返し、この操作を予
め設定された検索範囲内全体で行い、各検索画素毎の微
分値の和で最大のものを求め、その最大の微分値の和を
持つ検索画素をエッジとすれば、どのような画像ノイズ
が存在しても、微分絶対値の総数が、画像ノイズの総和
よりも大きいものであれば、画像ノイズによる誤検出が
起こらず、且つ確実にエッジを検出することができる。
Further, the work is photographed.
The image was obtained to obtain each grayscale image, and starting from an arbitrary pixel on the grayscale image , a plurality of pixels were searched in a predetermined direction, and the differential direction value of the pixel was coded. The operation of calculating the sum of the differential values of the pixels whose differential direction code values are within a predetermined range
This operation is repeated while shifting the start pixel of the search, and this operation is performed over the entire search range set in advance, the largest sum of the differential values for each search pixel is obtained, and the search pixel having the maximum sum of the differential values is obtained. Is an edge, no matter what image noise is present, if the total number of differential absolute values is larger than the total sum of image noise, erroneous detection due to image noise does not occur, and the edge is reliably detected. Can be detected.

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

【図1】本発明の一実施例のエッジ検出方法を示す説明
図である。
FIG. 1 is an explanatory diagram showing an edge detection method according to an embodiment of the present invention.

【図2】同上の方法を用いる画像処理装置の構成を示す
ブロック図である。
FIG. 2 is a block diagram showing a configuration of an image processing apparatus using the above method.

【図3】同上の装置における第1段階としての空間微分
処理の説明図である。
FIG. 3 is an explanatory diagram of a spatial differentiation process as a first stage in the above device.

【図4】同上の稜線抽出・エッジ延長処理の説明図であ
る。
FIG. 4 is an explanatory diagram of a ridge line extraction / edge extension process according to the first embodiment;

【図5】同上で取り扱う画像を示す説明図である。FIG. 5 is an explanatory diagram showing an image handled in the embodiment.

【図6】同上における第1のエッジの検出方法の説明図
である。
FIG. 6 is an explanatory diagram of a first edge detection method in Embodiment 1;

【図7】エッジ検出方法のための処理を示すフローチャ
ートである。
FIG. 7 is a flowchart showing a process for an edge detection method.

【図8】他のエッジ検出方法を示す説明図である。FIG. 8 is an explanatory diagram showing another edge detection method.

【図9】同上のエッジ検出方法のための処理を示すフロ
ーチャートである。
FIG. 9 is a flowchart showing a process for an edge detection method according to the embodiment.

【図10】さらに他のエッジ検出処理を示すフローチャ
ートである。
FIG. 10 is a flowchart showing still another edge detection process.

【図11】同上のエッジ検出方法の説明図である。FIG. 11 is an explanatory diagram of an edge detection method according to the embodiment.

【図12】さらに別のエッジ検出処理を示すフローチャ
ートである。
FIG. 12 is a flowchart showing still another edge detection process.

【図13】同上のエッジ検出方法の説明図である。FIG. 13 is an explanatory diagram of an edge detection method according to the embodiment.

【図14】さらに他のエッジ検出処理を示すフローチャ
ートである。
FIG. 14 is a flowchart illustrating still another edge detection process.

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

11 ワーク 12,13 マスク 11 Work 12, 13 Mask

Claims (5)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 2つの交差するワークのエッジを検出す
るエッジ検出方法であって、上記ワークを撮像してそれ
ぞれの濃淡画像を得るとともに、上記濃淡画像上のワー
クを横切り、且つその幅よりも大きい領域に複数のマス
クを設定し、その光量が最大のマスク内の画素を始点と
して少なくとも一方側へ検索し、微分値がしきい値以上
である画素を求め、これを交差する一方のワークのエッ
ジとし、このエッジから外側に複数の画素領域を含む大
きさの複数のマスクを設定し、上記エッジに沿って、画
素の微分方向値をコード化した所定の方向コードをもつ
画素が、エッジが存在すると判断するための所定のしき
い値を越える位置までマスクを移動させ、該しきい値を
越える画素の連なりを他方のワークのエッジとして成る
ことを特徴とするエッジ検出方法。
1. A edge detection method for detecting the two intersecting workpiece edge, which by imaging the workpiece
Each of the grayscale images is obtained , and a plurality of masks are set in an area that crosses the work on the grayscale image and is larger than the width, and a search is made to at least one side starting from a pixel in the mask having the maximum light amount. Then, a pixel having a differential value equal to or larger than a threshold value is obtained, and the obtained pixel is defined as an edge of one of the intersecting workpieces. Along the picture
A pixel having a predetermined direction code obtained by coding the elementary differential direction value moves the mask to a position exceeding a predetermined threshold value for determining that an edge exists , and setting the threshold value to
An edge detection method, wherein a series of pixels that exceed each other is formed as an edge of another workpiece.
【請求項2】 ワークのエッジを検出するエッジ検出方
法であって、上記ワークを撮像してそれぞれの濃淡画像
を得るとともに、該濃淡画像上の任意の画素を始点と
し、所定方向に複数画素分だけ検索し、画素の微分方向
値をコード化した微分方向コード値が所定範囲内の画素
の微分値の和を求める操作を、検索の開始画素をずらし
ながら繰り返し、今回の検索位置で求められた微分値の
和が前回の検索位置での微分値の和よりも大きい場合
は、上記操作を継続し、小さい場合には前回の検索位置
をエッジとして成ることを特徴とするエッジ検出方法。
2. An edge detection method for detecting an edge of a work , wherein said work is imaged and a gray image
With obtaining, by starting from any pixel on the concentration pale image, searching in a predetermined direction by a plurality of pixels, the differential direction of the pixel
The operation of obtaining the sum of the differential values of the pixels whose value is in the differential direction code value within a predetermined range is repeated while shifting the start pixel of the search, and the sum of the differential values obtained at the current search position is used for the previous search. An edge detection method characterized in that the above operation is continued when the difference is larger than the sum of the differential values at the position, and when the difference is smaller, the previous search position is set as the edge.
【請求項3】 ワークのエッジを検出するエッジ検出方
法であって、上記ワークを撮像してそれぞれの濃淡画像
を得るとともに、該濃淡画像上の任意の画素を始点と
し、所定方向に複数画素分だけ検索し、画素の微分方向
値をコード化した微分方向コード値が所定範囲内の画素
の微分値の和を求める操作を、検索の開始画素をずらし
ながら繰り返し、今回の検索位置で求められた微分値の
和と、予め設定された微分値の総和のしきい値とを比較
し、微分値の和が上記微分値の総和のしきい値よりも大
きいとき、今回の検索位置で求められた微分値の和と前
回の検索位置での微分値の和との比較を行い、今回の検
索位置で求められた微分値の和が前回の検索位置での微
分値の和よりも大きい場合は、上記操作を継続し、小さ
い場合には前回の検索位置をエッジとして成ることを特
徴とするエッジ検出方法。
3. An edge detection method for detecting an edge of a work , wherein the work is imaged and a gray image
With obtaining, by starting from any pixel on the concentration pale image, searching in a predetermined direction by a plurality of pixels, the differential direction of the pixel
The operation of obtaining the sum of the differential values of the pixels in which the differential direction code value whose value is coded is within a predetermined range is repeated while shifting the search start pixel , and the sum of the differential values obtained at the current search position is set in advance. The sum of the differential values obtained is compared with the threshold value of the sum of the differential values, and when the sum of the differential values is greater than the threshold value of the sum of the differential values, the sum of the differential values obtained at the current search position and the previous search value Compare with the sum of the differential values at the position, and if the sum of the differential values found at the current search position is larger than the sum of the differential values at the previous search position, continue the above operation. An edge detection method characterized in that the previous search position is used as an edge.
【請求項4】 ワークのエッジを検出するエッジ検出方
法であって、上記ワークを撮像してそれぞれの濃淡画像
を得るとともに、該濃淡画像上の任意の画素を始点と
し、所定方向に複数画素分だけ検索し、画素の微分方向
値をコード化した微分方向コード値が所定範囲内の画素
の微分値の和を求める操作を、検索の開始画素をずらし
ながら繰り返し、今回の検索位置で求められた微分値の
和と、予め設定された微分値の総和のしきい値とを比較
し、微分値の和が上記微分値の総和のしきい値よりも大
きいとき、その検索位置をエッジとして成ることを特徴
とするエッジ検出方法。
4. An edge detection method for detecting an edge of a work , wherein said work is imaged and a gray image
With obtaining, by starting from any pixel on the concentration pale image, searching in a predetermined direction by a plurality of pixels, the differential direction of the pixel
The operation of obtaining the sum of the differential values of the pixels in which the differential direction code value whose value is coded is within a predetermined range is repeated while shifting the search start pixel , and the sum of the differential values obtained at the current search position is set in advance. An edge detection method comprising: comparing a threshold value of a sum of differential values obtained with the threshold value; and when the sum of the differential values is larger than the threshold value of the sum of differential values, uses the search position as an edge.
【請求項5】 ワークのエッジを検出するエッジ検出方
法であって、上記ワークを撮像してそれぞれの濃淡画像
を得るとともに、該濃淡画像上の任意の画素を始点と
し、所定方向に複数画素分だけ検索し、画素の微分方向
値をコード化した微分方向コード値が所定範囲内の画素
の微分値の和を求める操作を、検索の開始画素をずらし
ながら繰り返し、この操作を予め設定された検索範囲内
全体で行い、各検索画素毎の微分値の和で最大のものを
求め、その最大の微分値の和を持つ検索画素をエッジと
して成ることを特徴とするエッジ検出方法。
5. An edge detection method for detecting an edge of a work , wherein the work is imaged and a gray image
With obtaining, by starting from any pixel on the concentration pale image, searching in a predetermined direction by a plurality of pixels, the differential direction of the pixel
The operation of obtaining the sum of the differential values of the pixels in which the differential direction code value whose value is coded is within a predetermined range is repeated while shifting the start pixel of the search, and this operation is performed over the entire preset search range, and each search is performed. edge detection method characterized by seeking the largest one in the sum of the differential value of each pixel, and the search pixel having the sum of the maximum differential value as an edge.
JP3341356A 1991-07-25 1991-12-24 Edge detection method Expired - Lifetime JP2654294B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3341356A JP2654294B2 (en) 1991-07-25 1991-12-24 Edge detection method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP18499691 1991-07-25
JP3-184996 1991-07-25
JP3341356A JP2654294B2 (en) 1991-07-25 1991-12-24 Edge detection method

Publications (2)

Publication Number Publication Date
JPH0581430A JPH0581430A (en) 1993-04-02
JP2654294B2 true JP2654294B2 (en) 1997-09-17

Family

ID=26502837

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3341356A Expired - Lifetime JP2654294B2 (en) 1991-07-25 1991-12-24 Edge detection method

Country Status (1)

Country Link
JP (1) JP2654294B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2766800B2 (en) * 1995-09-05 1998-06-18 中ノ瀬 一徳 Manufacturing method of synthetic resin body
JP2766801B2 (en) * 1995-09-05 1998-06-18 中ノ瀬 一徳 Manufacturing method of synthetic resin body
KR100467565B1 (en) * 1997-07-24 2005-04-06 삼성전자주식회사 Local binarization method of the imaging system.

Also Published As

Publication number Publication date
JPH0581430A (en) 1993-04-02

Similar Documents

Publication Publication Date Title
US5073953A (en) System and method for automatic document segmentation
US5048096A (en) Bi-tonal image non-text matter removal with run length and connected component analysis
JPH09510809A (en) Method and apparatus for determining a fine azimuth of a barcode symbol in a two-dimensional CDD image
JP4339925B2 (en) Document image processing method, document image processing apparatus, document image processing program, and storage medium
US20030031356A1 (en) Pattern inspection apparatus and method
EP0548571A1 (en) System and method for bidirectional adaptive thresholding
JPH07262374A (en) Image processor
JP2654294B2 (en) Edge detection method
JP3890844B2 (en) Appearance inspection method
JP2871601B2 (en) Character string detecting apparatus and method
JPH0718812B2 (en) Foreign object detection method
JP2006309402A (en) Character string recognition method, number plate recognition method and device
JP2874592B2 (en) Image processing device for distinguishing text / photo / dot area
JP3016687B2 (en) Image processing device
JP2710685B2 (en) Defect detection method by visual inspection
GB2273383A (en) Character recognition
JP2501150B2 (en) Laser welding method
JPH0332723B2 (en)
JPH0793476A (en) Character string detector
US5313529A (en) System for representing line drawings by polygonal lines
JP3109237B2 (en) Line segment constituent pixel extraction method and line segment judgment method in image
JP2021135647A (en) Template image update program, template image update method, and template image update apparatus
JP2753427B2 (en) Binary threshold setting device
JPS6140683A (en) Contour tracking device
JPH1031738A (en) Gray level image data storage/read method, gray level image data binarizing method and its image data processor

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19970506

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

Free format text: PAYMENT UNTIL: 20080523

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20090523

Year of fee payment: 12

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

Free format text: PAYMENT UNTIL: 20090523

Year of fee payment: 12

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

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

Free format text: PAYMENT UNTIL: 20090523

Year of fee payment: 12

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20100523

Year of fee payment: 13

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

Free format text: PAYMENT UNTIL: 20100523

Year of fee payment: 13

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

Free format text: PAYMENT UNTIL: 20110523

Year of fee payment: 14

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

Free format text: PAYMENT UNTIL: 20120523

Year of fee payment: 15

EXPY Cancellation because of completion of term
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120523

Year of fee payment: 15