JPH0724066B2 - Binary level automatic correction method - Google Patents
Binary level automatic correction methodInfo
- Publication number
- JPH0724066B2 JPH0724066B2 JP61247845A JP24784586A JPH0724066B2 JP H0724066 B2 JPH0724066 B2 JP H0724066B2 JP 61247845 A JP61247845 A JP 61247845A JP 24784586 A JP24784586 A JP 24784586A JP H0724066 B2 JPH0724066 B2 JP H0724066B2
- Authority
- JP
- Japan
- Prior art keywords
- level
- binarization
- histogram
- brightness
- 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.)
- Expired - Lifetime
Links
Landscapes
- Image Input (AREA)
Description
【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、画像処理装置における2値化レベルの再設定
方法に関する。The present invention relates to a method of resetting a binarization level in an image processing apparatus.
たとえば、自動車部品の検査ライン等においては、2値
画像処理装置を用いたラインの自動化が図られている。
この場合、2値画像処理装置の2値化レベルを固定して
おくと、照明装置の劣化或いは電源変動による照明装置
の照度変化等により、安定な画像取り込みができなくな
ることがある。For example, in automobile parts inspection lines and the like, lines are automated using a binary image processing device.
In this case, if the binarization level of the binary image processing device is fixed, stable image acquisition may not be possible due to deterioration of the illumination device or change in illuminance of the illumination device due to power supply fluctuation.
第3図は、対象が金属の場合の濃淡画像(第3図
(a))とそのヒストグラム(第3図(b))を示した
例である。対象の表面が一様であるため、その対象に対
するヒストグラムの明度レベルの分布幅が非常に狭くな
る。FIG. 3 is an example showing a grayscale image (FIG. 3 (a)) and its histogram (FIG. 3 (b)) when the object is a metal. Since the surface of the object is uniform, the distribution range of the brightness level of the histogram for the object becomes very narrow.
このような対象に対して2値化レベルの再設定を行う場
合、判別及び最小二乗基準に基づく自動閾値選定法(例
えば、大津氏の提案による方式)を用いれば、良好な結
果を得ることが判っている。しかしながらこの方法は統
計的手法であり、処理時間が長いため、部品検査等のラ
インには適用できない。したがって、処理の簡単なP−
tile法の適用が考えられる。When the binarization level is reset for such an object, good results can be obtained by using an automatic threshold selection method based on discrimination and the least squares criterion (for example, the method proposed by Otsu). I know. However, this method is a statistical method, and since the processing time is long, it cannot be applied to parts inspection lines. Therefore, P-
The tile method may be applied.
しかしながら、このP−tile法の場合、以下のような問
題点がある。However, this P-tile method has the following problems.
ヒストグラムの最高明度レベルから画素数を加算し
てゆき、その合計画素数が基準面積の100%になる明度
レベルを求めて、そのレベルを2値化レベルに設定する
と仮定する。そうすると、第4図(a)に示すように、
対象のヒストグラムの明度レベルの分布幅のバラツキが
小さいために、2値化レベルが対象のヒストグラムに接
近する。照明装置が商用蛍光灯の場合は、そのチラツキ
により、或いは電源変動による照度変化の影響等で、第
4図(b)に示すように新画像入力時の検出明度レベル
が低下することがある。この場合には、対象の画像は例
えば面積が60%しか残らないことになり、部品判定ミス
を起こすことになる。It is assumed that the number of pixels is added from the highest brightness level of the histogram, the brightness level at which the total number of pixels becomes 100% of the reference area is obtained, and the level is set to the binarization level. Then, as shown in FIG. 4 (a),
Since the variation in the distribution width of the brightness level of the target histogram is small, the binarization level approaches the target histogram. When the illuminating device is a commercial fluorescent lamp, the detected brightness level at the time of inputting a new image may be lowered as shown in FIG. 4 (b) due to the flicker or the influence of illuminance change due to power supply fluctuation. In this case, the target image will have an area of only 60%, for example, and a component determination error will occur.
また、対象物個々においては、同一種の部品であっ
ても、各々製作バラツキがある。従って、基準面積より
少し小さい対象の場合、画素数100%になる明度レベル
を求めると第5図(a)に示すように背景側のレベルに
入り込むことがある。このレベルで2値化すると、と
同様の検出レベル変動で検出レベルが上がったとき、第
5図(b)に示すように、背景が大幅に対象に入り込
み、面積が増え、部品判定ミスを起こすことになる。In addition, even in the case of the same type of parts, there are variations in the manufacture of individual objects. Therefore, in the case of an object slightly smaller than the reference area, when the lightness level at which the number of pixels is 100% is obtained, it may enter the level on the background side as shown in FIG. 5 (a). When binarization is performed at this level, when the detection level rises due to the same detection level fluctuation as above, as shown in FIG. 5 (b), the background significantly enters the target, the area increases, and a component determination error occurs. It will be.
このような理由により、2値化レベルの再設定は困難で
あり、照明装置の劣化には定期的に2値化レベルを手動
で再設定するか、又は電源変動による照明レベルの変化
に対しては、AVRの設定等で対処していた。For this reason, it is difficult to reset the binarization level, and for the deterioration of the lighting device, the binarization level should be manually reset periodically, or the lighting level may be changed due to power fluctuation. Was dealing with the AVR settings etc.
本発明は、このような従来の問題点に鑑みてなされたも
のであり、被検査対象が金属等の場合に、照明装置の劣
化、電源変動による照明変化等に対応して、最適の2値
化レベルを求める簡単な方法を提供することを目的とす
る。The present invention has been made in view of such conventional problems, and when the inspection target is a metal or the like, an optimum binary value is provided in response to deterioration of the illumination device, illumination change due to power supply fluctuation, and the like. The aim is to provide an easy way to determine the level of activation.
この目的を達成するため、本発明の2値化レベル自動補
正方法は、画像のヒストグラムの明度レベルが対象と背
景の2レベルに分かれ、且つ対象と背景各々に対応する
ヒストグラムの明度のバラツキが小さい金属のような被
検査対象を2値画像処理するに際し、前回求めた2値化
レベルを用いて画像を取り込んで解析した結果、対象が
目的の対象物であることが確認されたとき、その画像の
ヒストグラムの明度の最高レベル又は最低レベル、すな
わち対象に相当する側から順に各レベルの画素数を取り
出して加算してゆき、その合計値が対象の基準画素数の
所定の比率になる明度レベルを求め、そのレベルから一
定レベルだけ、明度の低いレベル又は高いレベル方向、
すなわち背景に相当する側に移動させたレベルを次回の
2値化レベルとすることを特徴とする。In order to achieve this object, according to the binarization level automatic correction method of the present invention, the brightness level of the histogram of the image is divided into two levels, that is, the target and the background, and the variation in the brightness of the histogram corresponding to each target and the background is small. When a binary image is processed on an object to be inspected such as metal, the image is captured and analyzed using the previously obtained binarization level, and when it is confirmed that the object is the target object, the image The maximum or minimum level of brightness of the histogram of, that is, the number of pixels of each level is taken out in order from the side corresponding to the target and added, and the brightness level at which the total value becomes a predetermined ratio of the target number of reference pixels is set. Obtained from that level, only a certain level, low brightness level or high brightness direction,
That is, the feature is that the level moved to the side corresponding to the background is set as the next binarization level.
本発明においては、第1図に示すようにP−tile法で画
素の合計が対象基準面積の例えば70%になる明度レベル
LEVを求め、これら一定の値Δ1だけ、対象の面積が増
える方向に移動させたレベルを次回2値化レベルとす
る。In the present invention, as shown in FIG. 1, the brightness level at which the total number of pixels is 70% of the target reference area by the P-tile method.
The LEV is obtained, and the level moved by the constant value Δ1 in the direction in which the target area increases is set as the next binarization level.
このようにして求めたLEVは、対象物の面積のバラツキ
が例えば±20%程度であっても、対象のヒストグラム内
にあって、問題点で示したように、背景側レベルに入
り込むことはない。The LEV obtained in this way is within the target histogram even if the area variation of the target object is, for example, about ± 20%, and as shown in the problem point, does not enter the background side level. .
またそのLEVからΔ1離れたレベル(第1図の今回THR)
を2値化レベルにすることで、問題点で示したように
照明のチラツキによる照明の瞬間変動による影響も解決
することができる。The level that is Δ1 away from the LEV (this time THR in Fig. 1)
By setting the binarization level to, it is possible to solve the influence of the instantaneous fluctuation of the illumination due to the flicker of the illumination as shown in the problem.
以下、本発明を図面に示す実施例に基づいて具体的に説
明する。第2図は、本発明を組立ラインに適用した場合
における台車上の部品の配置を示す。台車上に、〜
に示すように、決まった部品がセットされたものがコン
ベアで運ばれてくる。そこで、2値画像処理装置で、部
品が置かれているかどうか、及び部品の種類をチェック
する。Hereinafter, the present invention will be specifically described based on the embodiments shown in the drawings. FIG. 2 shows the arrangement of parts on a truck when the present invention is applied to an assembly line. On the dolly,
As shown in, a set of fixed parts is carried on a conveyor. Therefore, the binary image processing device checks whether or not the component is placed and the type of the component.
この部品は、歯車等表面が一様な金属であるため、その
ヒストグラムは第1図のようになる。Since this component is a metal such as a gear whose surface is uniform, its histogram is as shown in FIG.
また、材質(色)が部品で異なっていること、台車がか
なり大きいこと等のため、明度の検出レベルが異なって
いる。そのため、個々の部品に対してウインドウを設定
し、各々2値化レベルを持たせている。Further, the lightness detection levels are different because the materials (colors) are different for each part and the truck is considerably large. Therefore, a window is set for each component and each component has a binarization level.
この例では、画像を取り込み、部品判定を行い、正しく
部品が置かれていることを確認した後、画像を撮り直し
て本発明により次回画像処理のための2値化レベルを求
める。このときの処理はヒストグラムデータを読み出し
て加算し、準備値との比較を行う処理の繰り返しで済
み、処理時間も速い。In this example, after capturing an image, determining a component, and confirming that the component is correctly placed, the image is retaken and the binarization level for the next image processing is obtained by the present invention. At this time, the processing is repeated by reading out the histogram data, adding it, and comparing it with the preparation value, and the processing time is short.
なお、上記ヒストグラムの取り込み時に影等が入り込む
と、2値化レベルが予期せぬ値となる。したがって、第
1図に示すように、今回求めた2値化レベルと前回の2
値化レベル(前回THR)とを比較して、その明度差が一
定値(±Δ2)以内であればその値を次回画像処理用2
値化レベルとする。It should be noted that if a shadow or the like enters at the time of capturing the histogram, the binarization level becomes an unexpected value. Therefore, as shown in FIG. 1, the binarization level obtained this time and the previous two
Compared with the digitization level (previous THR), if the brightness difference is within a certain value (± Δ2), the value is used for the next image processing.
The value level is used.
このようにすることにより、前に述べた悪影響を無くす
ことができる。By doing so, the above-mentioned adverse effects can be eliminated.
また、2値化レベルの下限LEV−L(第1図参照)を設
定しておき、今回求めた2値化レベルがこのLEV−L以
下となったとき、アラームを出すようにすることによ
り、照明装置の劣化等によるメンテナンス必要時期を知
ることができる。Further, by setting the lower limit LEV-L (see FIG. 1) of the binarization level and issuing an alarm when the binarization level obtained this time becomes equal to or lower than this LEV-L, It is possible to know when maintenance is required due to deterioration of the lighting device.
以上の方法で、2値化レベルを再設定することにより、
上記設備は照度変化レベルに対して安定な2値画像の取
り込みを行うことができる。By resetting the binarization level by the above method,
The above equipment can capture a binary image that is stable with respect to the illuminance change level.
以上に説明したように、本発明においては、画素の合計
が対象の画素数の予め設定した割合になるレベルを求
め、そのレベルから一定レベル移動したレベルを次回の
2値化レベルとするようにしている。したがって、被検
査対象が金属等の場合でも、2値化レベルを最適に再設
定することができ、照明装置の経年変化、或いは電源変
動による照度変化等に対処でき、ラインの自動化、照明
設備の簡素化ができる。As described above, in the present invention, the level at which the total number of pixels becomes a preset ratio of the number of target pixels is obtained, and the level obtained by moving a certain level from that level is set as the next binarization level. ing. Therefore, even if the object to be inspected is a metal or the like, the binarization level can be optimally reset, and it is possible to cope with the secular change of the lighting device or the illuminance change due to the power supply fluctuation. Can be simplified.
第1図は本発明の2値化レベルの求め方を示す説明図、
第2図は本発明の実施例の説明図、第3図は本発明の実
施例の説明図、第4図は金属対象物のヒストグラム例,
第5図は従来の方式で2値化レベルを設定したときの問
題を示す説明図である。FIG. 1 is an explanatory view showing how to obtain a binarization level according to the present invention,
2 is an explanatory view of an embodiment of the present invention, FIG. 3 is an explanatory view of an embodiment of the present invention, FIG. 4 is an example of a histogram of a metal object,
FIG. 5 is an explanatory diagram showing a problem when the binarization level is set by the conventional method.
Claims (1)
背景の2レベルに分かれ、且つ対象と背景各々に対応す
るヒストグラムの明度のバラツキが小さい金属のような
被検査対象を2値画像処理するに際し、前回求めた2値
化レベルを用いて画像を取り込んで解析した結果、対象
が目的の対象物であることが確認されたとき、その画像
のヒストグラムの明度の最高レベル又は最低レベルから
順に各レベルの画素数を取り出して加算してゆき、その
合計値が対象の基準画素数の所定の比率になる明度レベ
ルを求め、そのレベルから一定レベルだけ、明度の低い
レベル又は高いレベル方向に移動させたレベルを次回の
2値化レベルとすることを特徴とする2値化レベル自動
補正方法。1. When performing binary image processing on an object to be inspected, such as a metal, in which the brightness level of the histogram of the image is divided into two levels, that is, the object and the background, and the brightness of the histogram corresponding to each of the object and the background is small. , As a result of capturing and analyzing the image using the binarization level obtained last time, when it is confirmed that the target object is the target object, each level in order from the highest level or the lowest level of the brightness of the histogram of the image. The number of pixels of is taken out and added, the lightness level at which the total value becomes a predetermined ratio of the target reference number of pixels is obtained, and a certain level is moved from that level toward the low or high lightness level direction. A binarization level automatic correction method, characterized in that the level is set to the next binarization level.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP61247845A JPH0724066B2 (en) | 1986-10-17 | 1986-10-17 | Binary level automatic correction method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP61247845A JPH0724066B2 (en) | 1986-10-17 | 1986-10-17 | Binary level automatic correction method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS63101974A JPS63101974A (en) | 1988-05-06 |
| JPH0724066B2 true JPH0724066B2 (en) | 1995-03-15 |
Family
ID=17169520
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP61247845A Expired - Lifetime JPH0724066B2 (en) | 1986-10-17 | 1986-10-17 | Binary level automatic correction method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0724066B2 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9188177B2 (en) | 2011-02-18 | 2015-11-17 | Sunstar Engineering Inc. | Brake disc |
| CN117730249A (en) * | 2021-07-27 | 2024-03-19 | 柯尼卡美能达株式会社 | Display body, data processing device, data processing method and program |
-
1986
- 1986-10-17 JP JP61247845A patent/JPH0724066B2/en not_active Expired - Lifetime
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9188177B2 (en) | 2011-02-18 | 2015-11-17 | Sunstar Engineering Inc. | Brake disc |
| CN117730249A (en) * | 2021-07-27 | 2024-03-19 | 柯尼卡美能达株式会社 | Display body, data processing device, data processing method and program |
Also Published As
| Publication number | Publication date |
|---|---|
| JPS63101974A (en) | 1988-05-06 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| TW200301817A (en) | A surface conduction examination method and a subtrate examination device | |
| JPH03257304A (en) | location recognition device | |
| JPH0886634A (en) | Surface defect inspection device | |
| US20220358639A1 (en) | Image processing system, setting method, and program | |
| KR20160087197A (en) | Defect detecting apparatus and method for thereof | |
| JP2002290994A (en) | Foreign object inspection method for small camera module and foreign object inspection device | |
| JP2008292398A (en) | Inspection method of floating defect of component electrode and board inspection device | |
| TWI793035B (en) | Image noise identification method and image analysis device | |
| JPH0724066B2 (en) | Binary level automatic correction method | |
| JP2002310917A (en) | Defect detection method and device | |
| US4259662A (en) | Threshold setting circuit | |
| JPH09153133A (en) | Threshold calculation method | |
| CN117522866B (en) | Method for judging silk thread anchor points in fluorescent microfilament test image based on mask | |
| KR960014193B1 (en) | Evolutionary Method | |
| JPH06229929A (en) | Inspection of indentation defect | |
| JPH0627713B2 (en) | Method and device for inspecting circuit board | |
| JPH1010053A (en) | Surface defect inspection equipment | |
| JP7712235B2 (en) | Particle size measuring device, method and program | |
| JP2006050356A (en) | Image processing method and inspection apparatus | |
| JPH0943162A (en) | External appearance inspection method | |
| JPH08159712A (en) | Pattern recognition method | |
| JP2945057B2 (en) | Image preprocessing method for component placement inspection machine | |
| JPS63220375A (en) | Binarization processing method for image | |
| JP3190173B2 (en) | Semiconductor device appearance inspection method and appearance inspection device | |
| JPH0781962B2 (en) | Foreign object detection method |