JP2004062266A - Method of detecting edge position of imaged body - Google Patents

Method of detecting edge position of imaged body Download PDF

Info

Publication number
JP2004062266A
JP2004062266A JP2002216015A JP2002216015A JP2004062266A JP 2004062266 A JP2004062266 A JP 2004062266A JP 2002216015 A JP2002216015 A JP 2002216015A JP 2002216015 A JP2002216015 A JP 2002216015A JP 2004062266 A JP2004062266 A JP 2004062266A
Authority
JP
Japan
Prior art keywords
image data
edge position
pixels
white
created
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.)
Withdrawn
Application number
JP2002216015A
Other languages
Japanese (ja)
Inventor
Shinichi Azuma
東 真一
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.)
Nachi Fujikoshi Corp
Original Assignee
Nachi Fujikoshi Corp
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 Nachi Fujikoshi Corp filed Critical Nachi Fujikoshi Corp
Priority to JP2002216015A priority Critical patent/JP2004062266A/en
Publication of JP2004062266A publication Critical patent/JP2004062266A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a method of detecting an edge position of an imaged body, in which an edge position is detected only when the edge part is detected, without erroneously detecting parts which are not actually an edge as an edge part. <P>SOLUTION: Gradation image data are obtained by a CCD camera 1 and the data are binarized to generate binary image data, which are shrunk to generate shrunk image data from which noise mixed therein is removed. respective rates of white pixels and black pixels in the shrunk image data are calculated and only when the calculated rates of the white pixels and black pixels are larger than preset specified values respectively, the detecting process for an edge position is carried out. Consequently, only when an edge part is detected, the edge position is detected to shorten the process time. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は,画像処理技術を適用した被撮像物のエッジ位置の検出方法に関し、特に、入力された濃淡画像にエッジ部が含まれている場合にのみエッジ位置の検出を行うことを可能にしたエッジ位置検出方法に関する。
【0002】
【従来の技術】
CCDカメラなどで撮像された被撮像物に関して、その濃淡画像中に含まれるエッジ位置の検出を行う場合、濃淡画像を微分することにより微分画像データを作成し、この微分画像データに対して2値化処理を行うことにより2値画像データを作成し、この2値画像データ中の白画素群を抽出(パーツ化)し、この抽出された白画素群のうち最大の白画素群(最大パーツ)をエッジ部として検出し、このエッジ部内(最大パーツ内)の微分画像データからエッジ位置を検出するようにしている。この方法では、2値画像データ中の最大パーツをエッジ部として検出するようにしているため、2値化時の閾値の設定が重要となる。この閾値の設定においては、画像のコントラストに左右されることなく最大パーツ(エッジ部)を検出する必要があるため、微分画像データ中の濃度最大値に対して予め設定された割合(濃度最大値の30〜50%)を乗算した値を閾値とするようにしている。そして、微分画像データにおいて閾値以上の画素が白画素となり閾値以下の画素が黒画素となるように、2値画像データが作成されることになる。
【0003】
しかし、この方法の場合、濃淡画像中にエッジ部が存在しない場合で、しかも濃度値が小さい画像(暗い画像)の場合、微分画像データ中に含まれる雑音成分の影響により、実際にはエッジではないパーツをエッジ部として誤検出するという問題があった。この問題を解決するための方法としては、2値化の閾値を雑音に左右されない固定の値に設定する方法や、パターンマッチングにより濃淡画像中にエッジ部が存在するか否かを判定する方法があった。
【0004】
【発明が解決しようとする課題】
しかし、前者の方法すなわち2値化の閾値を雑音に左右されない固定の値に設定する方法では、雑音に左右されない2値化の閾値としては一般に高い値を設定することになるため、濃淡画像のコントラストが低い場合などは、濃淡画像中にエッジ部が存在していたとしても、エッジ位置を検出できないという問題がある。また、後者の方法すなわちパターンマッチングにより濃淡画像中にエッジ部が存在するか否かを判定する方法では、被撮像物のエッジ形状が常に同じ状態や条件で撮像される場合には有効であるが、エッジ部形状が都度変化するような場合にはエッジ部を検出できないという問題がある。
【0005】
本発明は、係る従来技術の問題点を解決するためになされたものであり、実際にはエッジではないパーツをエッジ部として誤検出することなく、さらにはエッジ部を検出した場合にのみエッジ位置を検出する処理を行うようにする被撮像物のエッジ位置検出方法を提供することを目的とする。
【0006】
【課題を解決するための手段】
前述の目的を達成するために、請求項1に係る発明では、CCDカメラにより濃淡画像データを取得し、この濃淡画像データに対して2値化処理を行うことにより2値画像データを作成し、この2値画像データに対して収縮処理を行うことにより収縮画像データを作成し、この収縮画像データ中の白画素及び黒画素のそれぞれの割合を算出し、算出された白画素及び黒画素のそれぞれの割合がいずれも予め設定された規定値以上の場合にのみエッジ位置の検出処理を行うようにしたことを特徴とする被撮像物のエッジ位置検出方法を提供した。
【0007】
濃淡画像データにノイズ(雑音)が混入していた場合、2値画像データにおいて、本来は黒画素となる領域が部分的(1画素単位で)に白画素となることがある。そこで、請求項1に係る構成では、2値画像データに対して収縮処理を行うことにより、濃淡画像データに混入したノイズ(雑音)を排除するようにしている。ここで言う収縮処理とは、2値化された画面において、白画素について、その画素の周囲8方向がすべて白画素でない場合、その画素を黒画素に変換する処理をいう。ノイズ(雑音)の混入により白画素となった画素については、その画素の周囲8方向の画素がすべて白画素ということはまず無いので、収縮処理を行うことによりノイズ(雑音)の混入により白画素となった画素が本来の黒画素に変換されることになる。したがって、2値画像データに対して収縮処理を行うことにより、濃淡画像データに混入したノイズ(雑音)が排除されることになる。
【0008】
一般に、エッジ位置の検出を行う際は、ウィンドウ領域を設定したうえで、このウィンドウ領域内でエッジ位置の検出処理を行うようにし、これをCCDカメラにより取得した濃淡画像データのすべての領域において行うようにしている。しかし、明らかにエッジ位置が存在しないと判断されるウィンドウ領域内においてもエッジ位置の検出処理を行うことは、全体の処理時間の増加を招くことになる。そこで、請求項1に係る発明では、濃淡画像データに対して2値化処理を行うことにより2値画像データを作成したときに、ウィンドウ領域内に明らかにエッジ位置が存在しない場合は、そのウィンドウ領域内は全体が白画素あるいは黒画素のいずれかになることに着目することにした。すなわち、2値画像データに対して収縮処理を行うことにより混入したノイズ(雑音)を排除した収縮処理データについて、ウィンドウ領域内の白画素及び黒画素のそれぞれの割合を算出し、白画素の割合と黒画素の割合のいずれもが予め設定された規定値以上の場合にのみ、そのウィンドウ領域内にエッジ位置が存在するものと判断し、そのウィンドウ領域内におけるエッジ位置の検出処理を行うようにした。これにより、明らかにエッジ位置が存在しないウィンドウ領域内においてはエッジ位置の検出処理が行われなくなるので、全体の処理時間の短縮を図ることができる。
【0009】
請求項2に係る発明では、請求項1に係る発明において、算出された白画素及び黒画素のそれぞれの割合がいずれも予め設定された規定値以上の場合は、濃淡画像データを微分することにより微分画像データを作成し、この微分画像データに対して2値化処理を行うことにより第2の2値画像データを作成し、この第2の2値画像データ中の白画素群を抽出し、この抽出された白画素群のうち最大の白画素群中の前記微分画像データに対してエッジ位置の検出を行うようにした。係る構成としたことにより、エッジ位置が存在するものと判断したウィンドウ領域内についてのみエッジ位置の検出処理、すなわち微分処理、2値化処理、白画素群(パーツ)の抽出処理が行われることになる。
【0010】
【発明の実施の形態】
以下、本発明の一実施形態について、図面を参照して説明する。なお、本実施形態では、検査台は透明で、検査台の下部には照明が設けられ、検査台の上部に設けられたCCDカメラ1により被撮像物を撮影するものとする。図2は、本発明におけるエッジ位置検出方法が適用される画像処理システムの一例を示すブロック図である。図2において、1はCCDカメラ、2はコンピュータ本体、3はマウス、4はキーボード、5はCRT画面を示す。CCDカメラ1は、図示しない検査台上に載置された被撮像物を撮影する。CCDカメラ1により撮像された濃淡画像データは、インタフェース(以下「I/F」と記す)6を介して濃淡画像メモリ9に格納される。濃淡画像メモリ9に格納された濃淡画像データは、表示制御部10を介してCRT画面5に表示される。また、データ入力機器としてのマウス3及びキーボード4から入力される位置情報は、それぞれI/F7、I/F8を介してCPU31に入力される。
【0011】
CPU31は、プログラムメモリ32に格納されたプログラムに従って、マウス3やキーボード4で指定された矩形領域をウィンドウとして表示するためのデータを作成し、このウィンドウ内部の濃淡画像データを濃淡画像メモリ9から抽出し、後述する2値画像の作成、収縮画像の作成、白画素及び黒画素のそれぞれの面積比の算出といった、ウィンドウ内に含まれるエッジ位置の検出に関する一連の処理を遂次実行する。なお、ワークメモリ33は、CPU31での各種処理のための作業領域用のメモリである。
【0012】
次に、図1に示すフローチャートを参照して、本発明の一実施形態に係るエッジ位置検出方法の処理の流れについて説明する。画像処理を行うウィンドウがマウス3あるいはキーボード4により指定されると、CPU31はウィンドウ領域内の濃淡画像データを濃淡画像メモリ9より取得する(ステップ11)。前述したように、本実施形態では、検査台は透明で、検査台の下部には照明が設けられ、検査台の上部に設けられたCCDカメラ1により被撮像物を撮影するものとしているので、ステップ11で取得する濃淡画像データとしては、被撮像物が存在する箇所は黒あるいはこれに近いデータとなり、その一方被撮像物が存在しない箇所は白あるいはこれに近いデータとなる。
【0013】
次に、ステップ11において取得した濃淡画像データの各画素について、予め設定された閾値に基づいて2値化処理を行うことにより、第1の2値画像データを作成する(ステップ12)。前述したように、本実施形態では、濃淡画像データとしては、被撮像物が存在する箇所は黒あるいはこれに近いデータとなり、その一方被撮像物が存在しない箇所は白あるいはこれに近いデータとなっているので、ステップ12で作成される第1の2値画像データとしては、被撮像物が存在する箇所は概ね黒画素となり、その一方被撮像物が存在しない箇所は白画素となっている。
【0014】
ところで、本実施形態に係る画像処理システムにおいてもランダムに発生するノイズ(雑音)の混入は避けられない。そして、このノイズ(雑音)の影響により、ステップ12で作成した第1の2値画像データにおいて、本来は黒画素となる領域が部分的(1画素単位で)に白画素となることがある。そこで、ステップ12において作成した第1の2値画像データについて、収縮処理により黒画素の近傍画素をすべて黒にすることにより、ノイズ(雑音)の影響を排除した収縮画像データを作成することにする(ステップ13)。なお、ここで言う収縮処理とは、2値化された画面において、白画素について、その画素の周囲8方向がすべて白画素でない場合、その画素を黒画素に変換する処理をいう。このステップ13における処理により、例えば、ランダムに発生する雑音等によって本来は黒画素となる画素が白画素となっていたとしても、この白画素が本来の黒画素に変換されることになるので、ランダムに発生する雑音等の影響を排除することができるようになる。
【0015】
続いて、ステップ13において作成した収縮画像データについて、ウィンドウ領域内の白画素及び黒画素のそれぞれの数をカウントし、これによりウィンドウ領域内の白画素領域及び黒画素領域のそれぞれの面積を算出する(ステップ14)。次いで、ウィンドウ領域全体の面積に対する、ステップ14において算出した白画素領域及び黒画素領域のそれぞれの面積の比を算出する(ステップ15)。
【0016】
このステップ15において算出した2つの面積比、すなわちウィンドウ領域全体の面積に対する白画素領域の面積比とウィンドウ領域全体の面積に対する黒画素領域の面積比の双方が予め設定された比率以上か否かにより、被撮像物のエッジとして有効なものか否かを判定することにする(ステップ16)。すなわち、ステップ15において算出した2つの面積比のうち、いずれか一方でも予め設定された比率に満たない場合は、ウィンドウ領域内にはエッジ部が存在しないものと判定し(ステップ16N)、このウィンドウ領域内における処理を終了する。一方、ステップ15において算出した2つの面積比の双方とも予め設定された比率以上であった場合には、ウィンドウ領域内にエッジ部が存在するものと判定し(ステップ16Y)、以下のステップ17以降の処理を行う。なお、前述した予め設定する比率については、エッジ位置の検出を行う際に、被撮像物のエッジ部として有効な面積で、正確かつ安定してエッジ位置の検出を行うことができる比率を設定するようにする。
【0017】
すなわち、ステップ11において取得した濃淡画像データの各画素を微分することにより、微分画像データを作成する(ステップ17)。次に、ステップ17において作成した微分画像データについて、微分画像データの濃度最大値を基準にして閾値を設定し、この閾値に基づいて微分画像データに対して2値化処理を行い、これにより第2の2値画像データを作成する(ステップ18)。なお、このステップ18における閾値の設定方法としては、被撮像物のエッジ部の撮像状態に応じて、エッジ部を誤検出することなく、正確かつ安定してエッジ位置の検出を行うことができる閾値(濃度値)を設定するようにする。具体的には、被撮像物の形状や測定条件等にもよるが、微分画像データの濃度最大値の30〜50%の範囲内で設定することが好ましい。
【0018】
ステップ18において作成した第2の2値画像データについて、白画素群を抽出し、抽出した各白画素群それぞれを一つのパーツとするパーツ化を行う(ステップ19)。次いで、ステップ19においてパーツ化されたウィンドウ領域内にあるすべてのパーツの中から最大パーツを検出する(ステップ20)。最後に、ステップ20において検出した最大パーツにおいて、そのパーツ内のステップ17において作成した微分画像データに対してエッジ位置を検出する(ステップ21)。
【0019】
以上、本発明の一実施形態について説明した。本実施形態では、前述したように、検査台は透明で、検査台の下部には照明が設けられ、検査台の上部に設けられたCCDカメラにより被撮像物を撮影するものとしていたが、本発明はこの形態に限定されるものではない。例えば、検査台はその表面が鏡面となっており、検査台の上部に照明が設けられ、検査台の上部に設けられたCCDカメラにより被撮像物を撮影する形態のものであってもよい。係る形態においては、前述した本実施形態と同様に、濃淡画像データとしては、被撮像物が存在する箇所は黒あるいはこれに近いデータとなり、その一方被撮像物が存在しない箇所は白あるいはこれに近いデータとなる。また、別の形態として、表面が鏡面状態の被撮像物であった場合は、検査台の表面を光の反射の少ないものとし、検査台の上部に照明が設けられ、検査台の上部に設けられたCCDカメラにより被撮像物を撮影するものとすればよい。係る形態においては、前述した本実施形態とは異なり、被撮像物が存在する箇所は白あるいはこれに近いデータとなり、その一方被撮像物が存在しない箇所は黒あるいはこれに近いデータとなるが、エッジ位置の検出における処理の流れは前述した本実施形態と同様である。
【0020】
【発明の効果】
本発明によれば、CCDカメラにより濃淡画像データを取得し、この濃淡画像データに対して2値化処理を行うことにより2値画像データを作成し、この2値画像データに対して収縮処理を行うことにより混入したノイズ(雑音)を排除した収縮画像データを作成し、この収縮画像データ中の白画素及び黒画素のそれぞれの割合を算出し、算出された白画素及び黒画素のそれぞれの割合がいずれも予め設定された規定値以上の場合にのみエッジ位置の検出処理を行うようにしたので、ノイズ(雑音)により実際にはエッジではないパーツがエッジ部として誤検出されることはなくなり、さらにはエッジ部を検出した場合にのみエッジ位置を検出する処理が行われ、処理時間の短縮が図られるものとなった。
【図面の簡単な説明】
【図1】本発明におけるエッジ位置検出方法の処理の流れを示すフローチャートである。
【図2】本発明におけるエッジ位置検出方法が適用される画像処理システムの一例を示すブロック図である。
【符号の説明】
1 CCDカメラ
2 コンピュータ本体
3 マウス
4 キーボード
5 CRT画面
6、7、8 I/F
9 濃淡画像メモリ
10 表示制御部
31 CPU
32 プログラムメモリ
33 ワークメモリ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a method for detecting an edge position of an object to be imaged to which an image processing technique is applied, and in particular, it is possible to detect an edge position only when an input grayscale image includes an edge portion. The present invention relates to an edge position detection method.
[0002]
[Prior art]
When detecting an edge position included in a grayscale image of an object imaged by a CCD camera or the like, differential image data is created by differentiating the grayscale image, and a binary image is generated for the differential image data. The binary image data is created by performing the binarization process, and a white pixel group in the binary image data is extracted (parted), and the largest white pixel group (maximum part) among the extracted white pixel groups Is detected as an edge portion, and an edge position is detected from differential image data in the edge portion (in the largest part). In this method, since the largest part in the binary image data is detected as an edge portion, it is important to set a threshold value for binarization. In setting this threshold value, it is necessary to detect the maximum part (edge portion) without being affected by the contrast of the image. Therefore, a preset ratio (density maximum value) with respect to the density maximum value in the differential image data (30 to 50% of the threshold). Then, in the differential image data, the binary image data is created such that the pixels above the threshold become white pixels and the pixels below the threshold become black pixels.
[0003]
However, in the case of this method, when there is no edge portion in the grayscale image, and in the case of an image having a small density value (dark image), the edge is actually not affected by the noise component included in the differential image data. There is a problem that a missing part is erroneously detected as an edge part. As a method for solving this problem, there are a method of setting a threshold value for binarization to a fixed value that is not affected by noise, and a method of determining whether an edge portion exists in a grayscale image by pattern matching. there were.
[0004]
[Problems to be solved by the invention]
However, in the former method, that is, in the method of setting the threshold value of binarization to a fixed value not influenced by noise, generally a high value is set as the threshold value of binarization not influenced by noise. For example, when the contrast is low, there is a problem that the edge position cannot be detected even if the edge portion exists in the grayscale image. The latter method, that is, the method of determining whether or not an edge portion exists in a grayscale image by pattern matching, is effective when the edge shape of the object is always imaged in the same state or condition. However, there is a problem that the edge cannot be detected when the shape of the edge changes every time.
[0005]
The present invention has been made in order to solve the problems of the related art, and does not erroneously detect a part that is not actually an edge as an edge part, and furthermore, detects an edge position only when an edge part is detected. It is an object of the present invention to provide a method for detecting an edge position of an object to be imaged, which performs a process of detecting an image.
[0006]
[Means for Solving the Problems]
In order to achieve the above object, in the invention according to the first aspect, binary image data is created by acquiring grayscale image data with a CCD camera and performing binarization processing on the grayscale image data. By performing contraction processing on the binary image data, contracted image data is created, the respective proportions of white pixels and black pixels in the contracted image data are calculated, and each of the calculated white pixels and black pixels is calculated. The edge position detection method is characterized in that the edge position detection process is performed only when the ratio of each is equal to or greater than a preset specified value.
[0007]
When noise (noise) is mixed in the grayscale image data, a region that is originally a black pixel in the binary image data may be partially (in units of one pixel) a white pixel. Therefore, in the configuration according to claim 1, noise (noise) mixed in the grayscale image data is eliminated by performing the contraction process on the binary image data. The shrinking process referred to here is a process of converting a white pixel into a black pixel in a binarized screen when the eight directions around the pixel are not all white pixels. With regard to a pixel that has become a white pixel due to the incorporation of noise (noise), it is unlikely that all of the pixels in the eight directions around the pixel are white pixels. Will be converted to the original black pixels. Therefore, by performing the contraction processing on the binary image data, noise (noise) mixed in the grayscale image data is eliminated.
[0008]
Generally, when detecting an edge position, a window area is set, and then an edge position detection process is performed in the window area. This is performed in all areas of the grayscale image data acquired by the CCD camera. Like that. However, performing the edge position detection processing even in a window region where it is apparently determined that no edge position is present increases the overall processing time. Therefore, according to the first aspect of the present invention, when binary image data is created by performing binarization processing on grayscale image data, if there is no apparent edge position in the window area, the window Attention was paid to the fact that the whole area is either a white pixel or a black pixel. That is, with respect to the contraction processing data from which noise (noise) mixed by performing the contraction processing on the binary image data is calculated, the respective ratios of the white pixels and the black pixels in the window area are calculated, and the ratio of the white pixels is calculated. Only when both the ratio of the black pixel and the ratio of the black pixels are equal to or greater than a predetermined value, it is determined that an edge position exists in the window region, and the detection process of the edge position in the window region is performed. did. As a result, the processing for detecting the edge position is not performed in the window region where the edge position does not clearly exist, so that the overall processing time can be reduced.
[0009]
In the invention according to claim 2, in the invention according to claim 1, when each of the calculated ratios of the white pixels and the black pixels is equal to or more than a predetermined value, the grayscale image data is differentiated. Differential image data is created, and a binary process is performed on the differential image data to create second binary image data, and a white pixel group in the second binary image data is extracted. An edge position is detected for the differential image data in the largest white pixel group among the extracted white pixel groups. With this configuration, the edge position detection process, that is, the differentiation process, the binarization process, and the white pixel group (parts) extraction process are performed only in the window area determined to have the edge position. Become.
[0010]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, an embodiment of the present invention will be described with reference to the drawings. In the present embodiment, the inspection table is transparent, illumination is provided below the inspection table, and the object to be imaged is photographed by the CCD camera 1 provided above the inspection table. FIG. 2 is a block diagram illustrating an example of an image processing system to which the edge position detection method according to the present invention is applied. In FIG. 2, 1 is a CCD camera, 2 is a computer main body, 3 is a mouse, 4 is a keyboard, and 5 is a CRT screen. The CCD camera 1 captures an image of an object placed on an inspection table (not shown). The grayscale image data captured by the CCD camera 1 is stored in a grayscale image memory 9 via an interface (hereinafter, referred to as “I / F”) 6. The grayscale image data stored in the grayscale image memory 9 is displayed on the CRT screen 5 via the display control unit 10. Position information input from the mouse 3 and the keyboard 4 as data input devices is input to the CPU 31 via the I / F 7 and the I / F 8 respectively.
[0011]
The CPU 31 creates data for displaying a rectangular area specified by the mouse 3 or the keyboard 4 as a window in accordance with the program stored in the program memory 32, and extracts grayscale image data inside the window from the grayscale image memory 9. Then, a series of processes relating to detection of an edge position included in the window, such as creation of a binary image, creation of a contracted image, and calculation of the area ratio of each of white pixels and black pixels, which will be described later, are sequentially executed. The work memory 33 is a memory for a work area for various processes in the CPU 31.
[0012]
Next, the flow of processing of the edge position detection method according to an embodiment of the present invention will be described with reference to the flowchart shown in FIG. When the window for performing the image processing is designated by the mouse 3 or the keyboard 4, the CPU 31 acquires the gray image data in the window area from the gray image memory 9 (step 11). As described above, in the present embodiment, the inspection table is transparent, illumination is provided below the inspection table, and the object to be imaged is photographed by the CCD camera 1 provided above the inspection table. As the grayscale image data acquired in step 11, the portion where the object is present is black or data close thereto, while the portion where the image is not present is white or data close thereto.
[0013]
Next, the first binary image data is created by performing a binarization process on each pixel of the grayscale image data acquired in Step 11 based on a preset threshold value (Step 12). As described above, in the present embodiment, as the grayscale image data, a portion where the object is present is black or data close to black, while a portion where the object is not present is white or data close thereto. Therefore, as the first binary image data created in step 12, the portion where the object is present is generally a black pixel, while the portion where the object is not present is a white pixel.
[0014]
By the way, in the image processing system according to the present embodiment, it is inevitable that noise (noise) generated at random is mixed. Then, due to the influence of the noise (noise), in the first binary image data created in step 12, an area that is originally a black pixel may partially (in units of one pixel) become a white pixel. Therefore, with respect to the first binary image data created in step 12, all pixels near black pixels are blackened by shrinkage processing, so that shrinkage image data excluding the influence of noise (noise) is created. (Step 13). Note that the shrinking process referred to here is a process of converting a white pixel into a black pixel when all eight directions around the pixel are not white pixels in the binarized screen. By the processing in step 13, even if a pixel that originally becomes a black pixel due to noise or the like generated at random is a white pixel, the white pixel is converted to an original black pixel. It is possible to eliminate the influence of noise or the like generated at random.
[0015]
Subsequently, for the contracted image data created in step 13, the respective numbers of white pixels and black pixels in the window area are counted, and thereby the respective areas of the white pixel area and the black pixel area in the window area are calculated. (Step 14). Next, the ratio of the area of each of the white pixel region and the black pixel region calculated in step 14 to the area of the entire window region is calculated (step 15).
[0016]
The two area ratios calculated in step 15, that is, whether both the area ratio of the white pixel area to the entire area of the window area and the area ratio of the black pixel area to the entire area of the window area are equal to or greater than a predetermined ratio are determined. Then, it is determined whether or not the edge of the object is valid (step 16). That is, if any one of the two area ratios calculated in step 15 is less than the preset ratio, it is determined that there is no edge portion in the window area (step 16N), and the window area is determined. The processing in the area ends. On the other hand, if both of the two area ratios calculated in step 15 are equal to or larger than the preset ratio, it is determined that an edge portion exists in the window area (step 16Y), and the following steps 17 and subsequent steps are performed. Is performed. Note that, for the above-described preset ratio, a ratio that can accurately and stably detect an edge position with an effective area as an edge portion of the object to be imaged when the edge position is detected is set. To do.
[0017]
That is, differentiated image data is created by differentiating each pixel of the grayscale image data acquired in step 11 (step 17). Next, a threshold value is set for the differential image data created in step 17 based on the maximum density value of the differential image data, and binarization processing is performed on the differential image data based on the threshold value. 2, binary image data is created (step 18). In addition, as a method of setting the threshold value in step 18, a threshold value that can accurately and stably detect an edge position without erroneously detecting an edge portion according to an imaging state of an edge portion of an object to be imaged. (Density value). More specifically, although it depends on the shape of the object to be imaged, the measurement conditions, and the like, it is preferable to set the density within a range of 30 to 50% of the maximum density value of the differential image data.
[0018]
A white pixel group is extracted from the second binary image data created in step 18, and each extracted white pixel group is converted into one part (step 19). Next, the largest part is detected from all the parts in the window area that has been made into parts in step 19 (step 20). Finally, in the maximum part detected in step 20, an edge position is detected with respect to the differential image data created in step 17 in the part (step 21).
[0019]
Hereinabove, one embodiment of the present invention has been described. In the present embodiment, as described above, the inspection table is transparent, illumination is provided below the inspection table, and the object to be imaged is photographed by the CCD camera provided above the inspection table. The invention is not limited to this embodiment. For example, the inspection table may have a mirror surface, an illumination provided above the inspection table, and an image of an object to be imaged taken by a CCD camera provided above the inspection table. In such an embodiment, as in the above-described embodiment, as the grayscale image data, a portion where the object is present is black or data close thereto, while a portion where the object is not present is white or white. It becomes close data. Further, as another form, when the surface is an object to be imaged in a mirror surface state, the surface of the inspection table is assumed to have less reflection of light, and illumination is provided on the inspection table, and provided on the inspection table. The object to be imaged may be photographed by the CCD camera. In such an embodiment, unlike the above-described embodiment, the location where the object is present is white or data close thereto, while the location where the image is not present is black or data close thereto, The flow of the process in detecting the edge position is the same as in the above-described embodiment.
[0020]
【The invention's effect】
According to the present invention, gray-scale image data is obtained by a CCD camera, and binary image processing is performed on the gray-scale image data to generate binary image data. By doing so, contracted image data from which noise (noise) mixed in is removed is created, the respective ratios of white pixels and black pixels in the contracted image data are calculated, and the calculated ratios of white pixels and black pixels are calculated. , The edge position detection processing is performed only when the value is equal to or greater than a predetermined value, so that a part that is not actually an edge due to noise (noise) is not erroneously detected as an edge part. Further, the processing for detecting the edge position is performed only when the edge portion is detected, thereby shortening the processing time.
[Brief description of the drawings]
FIG. 1 is a flowchart showing a processing flow of an edge position detection method according to the present invention.
FIG. 2 is a block diagram illustrating an example of an image processing system to which an edge position detection method according to the present invention is applied.
[Explanation of symbols]
1 CCD camera 2 Computer body 3 Mouse 4 Keyboard 5 CRT screen 6, 7, 8 I / F
9 Contrast image memory 10 Display control unit 31 CPU
32 Program memory 33 Work memory

Claims (2)

CCDカメラにより濃淡画像データを取得し、
該濃淡画像データに対して2値化処理を行うことにより2値画像データを作成し、
該2値画像データに対して収縮処理を行うことにより収縮画像データを作成し、
該収縮画像データ中の白画素及び黒画素のそれぞれの割合を算出し、
該算出された白画素及び黒画素のそれぞれの割合がいずれも予め設定された規定値以上の場合にのみエッジ位置の検出処理を行うようにしたことを特徴とする被撮像物のエッジ位置検出方法。
Obtain grayscale image data with a CCD camera,
By performing binarization processing on the grayscale image data, binary image data is created,
Shrinking image data is created by performing shrinking processing on the binary image data,
Calculate each ratio of white pixels and black pixels in the contracted image data,
An edge position detection method for an image pickup object, wherein the edge position detection process is performed only when the calculated ratio of each of the white pixels and the black pixels is equal to or greater than a predetermined value. .
CCDカメラにより濃淡画像データを取得し、
該濃淡画像データに対して2値化処理を行うことにより第1の2値画像データを作成し、
該第1の2値画像データに対して収縮処理を行うことにより収縮画像データを作成し、
該収縮画像データ中の白画素及び黒画素のそれぞれの割合を算出し、
該算出された白画素及び黒画素のそれぞれの割合がいずれも予め設定された規定値以上の場合は、
前記濃淡画像データを微分することにより微分画像データを作成し、
該微分画像データに対して2値化処理を行うことにより第2の2値画像データを作成し、
該第2の2値画像データ中の白画素群を抽出し、
該抽出された白画素群のうち最大の白画素群中の前記微分画像データに対してエッジ位置の検出処理を行うようにしたことを特徴とする被撮像物のエッジ位置検出方法。
Obtain grayscale image data with a CCD camera,
By performing binarization processing on the grayscale image data, first binary image data is created,
Shrinking image data is created by performing shrinking processing on the first binary image data,
Calculate each ratio of white pixels and black pixels in the contracted image data,
If each of the calculated ratios of the white pixels and the black pixels is equal to or greater than a preset specified value,
Create differential image data by differentiating the gray image data,
By performing binarization processing on the differential image data, second binary image data is created,
Extracting a white pixel group in the second binary image data;
An edge position detection method for an object to be imaged, wherein an edge position detection process is performed on the differential image data in the largest white pixel group among the extracted white pixel groups.
JP2002216015A 2002-07-25 2002-07-25 Method of detecting edge position of imaged body Withdrawn JP2004062266A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002216015A JP2004062266A (en) 2002-07-25 2002-07-25 Method of detecting edge position of imaged body

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002216015A JP2004062266A (en) 2002-07-25 2002-07-25 Method of detecting edge position of imaged body

Publications (1)

Publication Number Publication Date
JP2004062266A true JP2004062266A (en) 2004-02-26

Family

ID=31937887

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002216015A Withdrawn JP2004062266A (en) 2002-07-25 2002-07-25 Method of detecting edge position of imaged body

Country Status (1)

Country Link
JP (1) JP2004062266A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014067426A (en) * 2013-10-30 2014-04-17 Toshiba Corp Tablet packaging inspection apparatus, and tablet packaging inspection method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014067426A (en) * 2013-10-30 2014-04-17 Toshiba Corp Tablet packaging inspection apparatus, and tablet packaging inspection method

Similar Documents

Publication Publication Date Title
JP4160258B2 (en) A new perceptual threshold determination for gradient-based local contour detection
CN109997351B (en) Method and apparatus for generating high dynamic range images
JP5975598B2 (en) Image processing apparatus, image processing method, and program
KR20090066212A (en) Defect detection method and defect detection apparatus
JP5301694B2 (en) Image processing apparatus, image processing method, program, and recording medium therefor
JP2006066478A (en) Pattern matching device and scanning electron microscope employing it
KR101792564B1 (en) Image processing System and Image processing Method
JP2005165387A (en) Method and device for detecting stripe defective of picture and display device
JP2004239733A (en) Defect detection method and apparatus of screen
CN113935927A (en) Detection method, device and storage medium
JP2005283197A (en) Detecting method and system for streak defect of screen
JP6643301B2 (en) Defect inspection device and defect inspection method
JP2004062266A (en) Method of detecting edge position of imaged body
JP2005184787A (en) Image processing method and device
KR20040078538A (en) Image processing device for recognizing outline of moving target and method therefor
JP3772845B2 (en) Image processing program, image processing apparatus, and photographing apparatus
JPH0624014B2 (en) Gray image processing method
JP4253265B2 (en) Shadow detection apparatus, shadow detection method and shadow detection program, image processing apparatus using shadow detection apparatus, image processing method using shadow detection method, and image processing program using shadow detection program
JP2003346165A (en) Detection method of work boundary
JPH09288037A (en) Inspection method for lcd panel
JP2004219072A (en) Method and apparatus for detecting streak defect of screen
JP3941403B2 (en) Image density unevenness detection method and inspection apparatus
JP2002140695A (en) Inspection method and its device
CN110796611B (en) Image correction method and image correction device for shadow and free-form surface
KR101034189B1 (en) Adult image detection method using object analysis and multi resizing scan

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20051004