JP2019057211A - Component counting device, component counting method, and program - Google Patents

Component counting device, component counting method, and program Download PDF

Info

Publication number
JP2019057211A
JP2019057211A JP2017182359A JP2017182359A JP2019057211A JP 2019057211 A JP2019057211 A JP 2019057211A JP 2017182359 A JP2017182359 A JP 2017182359A JP 2017182359 A JP2017182359 A JP 2017182359A JP 2019057211 A JP2019057211 A JP 2019057211A
Authority
JP
Japan
Prior art keywords
component
image
components
pixels
color
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2017182359A
Other languages
Japanese (ja)
Other versions
JP6894335B2 (en
Inventor
英彦 林部
Hidehiko Hayashibe
英彦 林部
智之 本吉
Tomoyuki Motoyoshi
智之 本吉
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.)
Iwatsu Electric Co Ltd
Iwatsu System and Software Co Ltd
Original Assignee
Iwatsu Electric Co Ltd
Iwatsu System and Software Co 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 Iwatsu Electric Co Ltd, Iwatsu System and Software Co Ltd filed Critical Iwatsu Electric Co Ltd
Priority to JP2017182359A priority Critical patent/JP6894335B2/en
Publication of JP2019057211A publication Critical patent/JP2019057211A/en
Application granted granted Critical
Publication of JP6894335B2 publication Critical patent/JP6894335B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

To eliminate the need for preparing a component shape or area in advance and enable the number of components to be efficiently and easily counted with high accuracy without being affected by a component position or attitude and area in an image, ensuring that there is no miscount even when components are placed one on top of another.SOLUTION: Binarization means 11 binarizes a captured image on a sheet S into a binarized image consisting of a background color portion and a component color portion. Labeling means 12 adds the same label to pixels interconnected by a component color, and takes a set of same-level pixels as an interconnected portion of each component color portion. Overlapping detection means 13 detects the overlapping of components utilizing the pixel-count histogram of the interconnected portion of each component color portion. Counting means 14 counts the number of components when component overlapping is not detected in the interconnected portions of all component color portions in an image. Processing means 15 generates, upon detection of component overlapping in the interconnected portion of any component color portion in the image, an image in which the interconnected portion of the detected portion is processed to be identifiable.SELECTED DRAWING: Figure 1

Description

本発明は、シート上に並べられた部品の個数を計数する部品計数装置、部品計数方法およびプログラムに関し、特に、部品が並べられたシート上を撮像して得られる画像を解析して該シート上に並べられた部品の個数を計数する部品計数装置、部品計数方法およびプログラムに関する。   The present invention relates to a component counting apparatus, a component counting method, and a program for counting the number of components arranged on a sheet, and in particular, by analyzing an image obtained by capturing an image on a sheet on which components are arranged. The present invention relates to a component counting apparatus, a component counting method, and a program for counting the number of components arranged in a row.

従来、部品の個数を計数するためには、一般的に、部品全体の重量を計測し、その重量値から部品の個数を計数するカウンティングスケールが用いられる。また、フィーダーを用いて部品を計数エリアに通過させ、計数エリアで部品の個数を計数するカウンティング専用機も存在する。さらに、背景上に並べられた部品を撮像し、それにより得られた画像を解析して部品の個数を計数するようにした技術も知られている。   Conventionally, in order to count the number of parts, a counting scale is generally used that measures the weight of the whole part and counts the number of parts from the weight value. There is also a counting-only machine that uses a feeder to pass parts through a counting area and counts the number of parts in the counting area. Furthermore, there is also known a technique in which the parts arranged on the background are imaged and the number of parts is counted by analyzing the obtained image.

例えば、特許文献1では、計数の対象とする部品(ボルト)を背景となるトレー上に並べ、そのトレー上を撮像して得られた画像を解析し、トレーの面積および/または部品の面積に基づいて、部品の個数を計数するようにした部品供給装置が提案されている。これによれば、部品をトレー上に並べるだけで部品の個数を計数することができ、処理速度を向上させることができ、サイクルタイムを短縮できるとされている。   For example, in Patent Document 1, components (bolts) to be counted are arranged on a tray serving as a background, an image obtained by imaging the tray is analyzed, and the tray area and / or component area is calculated. Based on this, there has been proposed a component supply apparatus that counts the number of components. According to this, the number of parts can be counted only by arranging the parts on the tray, the processing speed can be improved, and the cycle time can be shortened.

特開2010−275094号公報JP 2010-275094 A

しかしながら、従来のカウンティングスケールは、振動や風のない環境に設置して部品全体の重量を正確に計測する必要があり、また、例えば、0.1g程度の軽量の部品の場合には誤差が生じて部品の個数を正しく計数できないという課題がある。   However, the conventional counting scale must be installed in an environment free from vibration and wind to accurately measure the weight of the entire part. For example, an error occurs in the case of a lightweight part of about 0.1 g. Therefore, there is a problem that the number of parts cannot be counted correctly.

カウンティング専用機は、計数の対象とすることができる部品がフィーダーの大きさや形状などにより限定され、また、装置が大型であるので、それを設置する場所が限られるとともに、それを移動して異なる場所に設置し直して使用することが容易でないという課題がある。部品を取り扱う現場では、異なる部品を異なる場所で取り扱う場合が多々あり、それに対処するためには容易に移動できる装置であることが望ましい。   In the dedicated counting machine, the parts that can be counted are limited by the size and shape of the feeder, etc. Also, since the device is large, the place where it is installed is limited, and it can be moved differently There is a problem that it is not easy to re-install in a place. In the field where parts are handled, there are many cases where different parts are handled at different places, and in order to cope with this, it is desirable that the apparatus be easily movable.

また、特許文献1で提案されている部品供給装置では、部品の位置姿勢により画像にばらつきが生じる場合、それが画像上のトレーの面積および/または部品の面積に影響するので、部品の個数を正しく計数することができないという課題がある。そこで、背景となるトレー部分と部品部分の面積率から部品の個数を計数するようにするという手法が考えられるが、この手法では、部品の位置姿勢による画像のばらつきに対処するために、部品の多くの位置姿勢の各々に対して指標となる面積率を実験などにより事前に準備しておき、部品の位置姿勢に応じて指標となる面積率を選択して用いることが必要となる。また、部品の重なりがある場合、それが面積率や部品の個数に影響するが、その影響を排除することが困難である。   Further, in the component supply apparatus proposed in Patent Document 1, when the image varies depending on the position and orientation of the component, it affects the area of the tray and / or the area of the component on the image. There is a problem that it cannot be counted correctly. Therefore, a method of counting the number of parts based on the area ratio of the tray part and the part part as a background can be considered, but in this technique, in order to deal with image variations due to the position and orientation of parts, It is necessary to prepare an area ratio as an index in advance for each of many positions and orientations through experiments or the like, and to select and use the area ratio as an index according to the position and orientation of a component. Further, when there is an overlap of parts, it affects the area ratio and the number of parts, but it is difficult to eliminate the influence.

本発明の目的は、部品の個数を計数するに際して、部品の形状や画像上での部品の面積などを事前に準備しておく必要がなく、部品の位置姿勢や部品の画像上での面積に影響されることなく、部品の個数を効率的、簡便かつ正しく計数でき、部品が重なっていた場合でも、部品の個数を誤って計数する恐れがない部品計数装置、部品計数方法およびプログラムを提供することにある。   The object of the present invention is to eliminate the need to prepare the shape of the part, the area of the part on the image, etc. in advance when counting the number of parts, and to adjust the position and orientation of the part and the area of the part on the image. Provided are a component counting device, a component counting method, and a program that can count the number of components efficiently, simply, and correctly without being affected, and that do not have the risk of erroneously counting the number of components even when the components overlap. There is.

上記課題を解決し、上記目的を達成するため、本発明は、部品が並べられたシート上を撮像して得られる画像を解析して、該シート上に並べられた部品の個数を計数する部品計数装置であって、前記画像を背景色部分と部品色部分との2値化画像に2値化する2値化手段と、前記2値化画像において部品色で連結している画素に同じラベルを付与し、同じラベルが付与された画素の集合を各部品色部分の連結成分とするラベル付与手段と、前記各部品色部分の連結成分の画素数を計数し、各部品色部分の連結成分のうち、その画素数が予め設定された所定値に満たないものをノイズとして除去してから、前記画像内の部品色部分の連結成分の画素数のヒストグラムを求め、該ヒストグラムから部品の重なりを検出するための閾値を求め、各部品色部分の連結成分の画素数と該閾値とを比較して、各連結成分での部品の重なりを検出する重なり検出手段と、前記画像内の全ての部品色部分の連結成分において部品の重なりが検出されなかった場合、前記画像内での部品色部分の連結成分から部品の個数を計数する計数手段と、前記画像内の何れかの部品色部分の連結成分において部品の重なりが検出された場合、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成する加工手段を備えたことを特徴としている。   In order to solve the above problems and achieve the above object, the present invention analyzes a picture obtained by capturing an image on a sheet on which parts are arranged, and counts the number of parts arranged on the sheet. A counting device that binarizes the image into a binarized image of a background color portion and a component color portion; and a label that is the same as a pixel connected in a component color in the binarized image And a label providing means that uses a set of pixels with the same label as a connected component of each component color part, and counts the number of pixels of the connected component of each component color part, and the connected component of each component color part Among them, those whose number of pixels is less than a predetermined value set in advance are removed as noise, a histogram of the number of connected components of the component color part in the image is obtained, and the overlap of the components is determined from the histogram. Find the threshold to detect each part The overlap detection means for detecting the overlap of the components in each connected component by comparing the number of pixels of the connected components of the color portion and the threshold, and the overlap of the components in the connected components of all the component color portions in the image If not detected, the counting means for counting the number of parts from the connected component of the component color portion in the image, and the overlap of the component is detected in the connected component of any component color portion in the image The image processing apparatus includes a processing unit that generates an image processed so as to be able to identify a connected component of a component color portion in which an overlap of components is detected.

ここで、前記重なり検出手段が、前記画像内の部品色部分の連結成分における画素数のヒストグラムにおける最小値から最頻値までの距離だけ最頻値から隔たった点を最大値として求め、該最大値を前記閾値とすることが好ましい。   Here, the overlap detection means obtains a point separated from the mode value by the distance from the minimum value to the mode value in the histogram of the number of pixels in the connected component of the component color part in the image as the maximum value, The value is preferably set as the threshold value.

また、前記加工手段は、部品の重なりが検出された部品色部分の連結成分に対して色付け加工を施した画像を生成することも好ましい。   In addition, it is preferable that the processing unit generates an image obtained by performing a coloring process on a connected component of a component color portion where an overlap of components is detected.

さらに、シート上に並べられた部品の状態を、各部品色部分の連結成分の特徴から判別してグループ分けする判別手段を備え、前記重なり検出手段が、前記判別手段によりグループ分けされた部品の状態ごとに部品の重なり検出を行うことも好ましい。   Furthermore, it comprises a discriminating means for discriminating the state of the parts arranged on the sheet from the characteristics of the connected components of each part color part and grouping them, and the overlap detecting means is for the parts grouped by the discriminating means. It is also preferable to detect overlap of components for each state.

なお、本発明は、部品計数装置としてだけでなく、部品計数方法やコンピュータを部品計数装置として機能させるプログラムとしても実現できる。   The present invention can be realized not only as a component counting device but also as a component counting method or a program that causes a computer to function as a component counting device.

本発明では、部品が並べられたシート上を撮像して得られる画像を背景色部分と部品色部分との2値化画像に2値化し、この2値化画像において部品色で連結している画素に同じラベルを付与し、同じラベルが付された画素の集合を部品色部分の連結成分とし、各部品色部分の連結成分の画素数を計数し、各部品色部分の連結成分のうち、その画素数が予め設定された所定値に満たないものをノイズとして除去してから、画像内の部品色部分の連結成分の画素数のヒストグラムを利用して、各連結成分での部品の重なりを 検出し、画像内の全ての部品色部分の連結成分において部品の重なりが検出されなかった場合、部品の個数を計数するので、ノイズの部分を誤って部品と計数することなく、また、部品の位置姿勢や面積に影響されることなく部品の個数を正しく計数することができる。さらに、1つの部品と判別するための閾値を、部品の形状や画像上の部品の面積などから求めて予め用意しておく必要がなくなるので、部品の個数を効率的かつ簡便に計数できる。   In the present invention, an image obtained by capturing an image on a sheet on which components are arranged is binarized into a binarized image of a background color portion and a component color portion, and these binarized images are connected with component colors. Assign the same label to the pixels, set the set of pixels with the same label as the connected component of the component color part, count the number of pixels of the connected component of each component color part, and among the connected components of each component color part, If the number of pixels is less than the preset value, remove it as noise, and then use the histogram of the number of connected components in the component color part in the image to overlap the components in each connected component. If the overlap of components is not detected in the connected components of all the component color parts in the image, the number of parts is counted, so that the noise part is not counted as a part erroneously, Influenced by position and orientation The number of parts can be counted correctly. Furthermore, since it is not necessary to prepare a threshold value for discriminating one component from the shape of the component or the area of the component on the image in advance, the number of components can be counted efficiently and simply.

また、画像内の何れかの部品色部分の連結成分において部品の重なりが検出された場合には、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成するので、部品の重なりがある場合には、その部分を容易に視認できるように表示させることができ、ユーザが、その重なりを解消して再度計数処理を実行させれば、部品の個数を正しく計数させることができる。   In addition, when an overlapping part is detected in the connected component of any part color part in the image, an image is generated that is processed so that the connected component of the part color part in which the overlapping part is detected can be identified. If there is an overlap of parts, the part can be displayed so that it can be easily seen. If the user cancels the overlap and executes the counting process again, the number of parts is counted correctly. be able to.

さらに、シート上に並べられた部品の状態を各部品色部分の連結成分の特徴から判別してグループ分けし、ヒストグラムから重なりがあると判定された連結成分であっても、グループ分けにより特定状態の部品に対する連結成分と判定されたものは、それから除いて部品の重なり検出を行うことにより、部品の重なり検出の精度を高めることができる。   Furthermore, the state of the parts arranged on the sheet is discriminated from the characteristics of the connected components of each part color part and grouped. Even if the connected components are determined to have overlap from the histogram, the specific state is determined by the grouping. If the component determined to be a connected component to the other component is removed, the component overlap detection is performed, so that the accuracy of the component overlap detection can be improved.

本発明に係る部品計数装置の実施形態を示す機能ブロック図である。It is a functional block diagram which shows embodiment of the components counting device which concerns on this invention. 撮像装置により撮像された画像とその2値化画像の例を示し、(A),(B)は、シート上の部品に重なりがない場合、(C),(D)は、シート上の部品に重なりがある場合を示し、(E),(F)は、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像および2値化画像を示す図である。An example of an image picked up by an image pickup apparatus and its binarized image is shown. (A) and (B) are parts on the sheet, and (C) and (D) are parts on the sheet. (E) and (F) are diagrams showing an image and a binarized image that are processed so as to be able to identify a connected component of a component color part in which an overlap of components is detected. 本発明に係る部品計数装置の他の実施形態を示す機能ブロック図である。It is a functional block diagram which shows other embodiment of the components counting device which concerns on this invention. 図3のCPU上で動作する制御ソフトの構成要素を示す図である。It is a figure which shows the component of the control software which operate | moves on CPU of FIG. 図3のCPUにおける処理を示すフローチャートである。It is a flowchart which shows the process in CPU of FIG. 図3のCPUの「画像の解析」での具体的処理を示すフローチャートである。4 is a flowchart showing a specific process in “image analysis” of the CPU of FIG. 3. 画素に付与されたラベルの例、および重なり検出の具体的数値の例を示す図である。It is a figure which shows the example of the label provided to the pixel, and the example of the specific numerical value of overlap detection. ラベリングで求めた面積のヒストグラムの例、および各種係数の関係を示す図である。It is a figure which shows the example of the histogram of the area calculated | required by labeling, and the relationship of various coefficients. 向きによりグループ分けされる部品の例を示す図である。It is a figure which shows the example of the components grouped by direction. 図9のグループ分けの原理を示す説明図である。It is explanatory drawing which shows the principle of grouping of FIG. 図9の部品(ネジ)をグループ分けする処理を示すフローチャートである。It is a flowchart which shows the process which groups the components (screw) of FIG. グループ分けを行う場合の重なり検出の処理を示すフローチャートである。It is a flowchart which shows the process of the overlap detection in the case of grouping.

以下、図面を参照して本発明を説明する。   The present invention will be described below with reference to the drawings.

図1は、本発明に係る部品計数装置の実施形態を示す機能ブロック図である。なお、ここでは、部品計数装置に加えて、部品が並べられたシートS、このシート上を撮像する撮像装置Iおよび部品の計数結果などを表示する表示装置Dを示している。また、本発明の説明に不要な構成は図示を省略している。   FIG. 1 is a functional block diagram showing an embodiment of a component counting apparatus according to the present invention. Here, in addition to the component counting device, a sheet S on which components are arranged, an imaging device I that captures an image on the sheet, and a display device D that displays a component counting result and the like are shown. Also, illustrations of components unnecessary for the description of the present invention are omitted.

図1に示すように、本発明の部品計数装置(部品カウンタ)1は、2値化手段11、ラベリング手段12、重なり検出手段13、計数手段14および加工手段15を備える。   As shown in FIG. 1, a component counting device (component counter) 1 according to the present invention includes a binarizing unit 11, a labeling unit 12, an overlap detecting unit 13, a counting unit 14, and a processing unit 15.

2値化手段11は、撮像装置Iにより撮像された画像を入力とし、その画像を背景色部分と部品色部分との2値化画像に2値化する。撮像装置Iは、部品Pが並べられたシートS上を撮像し、シートSは、部品Pの背景となるので、2値化手段11では、シートSの色である背景色と部品Pの色である部品色に従って背景色部分と部品色部分との2値化画像に2値化する。   The binarizing means 11 receives an image picked up by the image pickup apparatus I and binarizes the image into a binarized image of a background color part and a component color part. Since the imaging device I captures an image on the sheet S on which the parts P are arranged, and the sheet S becomes the background of the parts P, the binarizing unit 11 uses the background color that is the color of the sheet S and the color of the parts P. Are binarized into a binarized image of a background color portion and a component color portion according to the component color.

図2(A),(B)は、シートS上の部品に重なりがない場合に撮像装置Iにより撮像された画像とその2値化画像の例を示す。2値化画像では、部品色部分が白となり、背景色部分が黒となる。部品色部分が黒で背景色部分が白の2値化画像が生成される場合には、その2値化画像を白黒反転させれば、部品色部分が白で背景色部分が黒の2値化画像とすることができる。図2(A)は、背景色を白として撮像された画像を示し、図2(B)は、白黒反転された2値化画像を示している。   2A and 2B show an example of an image captured by the imaging apparatus I when the components on the sheet S do not overlap and a binarized image thereof. In the binarized image, the component color portion is white and the background color portion is black. When a binarized image in which the component color portion is black and the background color portion is white is generated, if the binarized image is reversed in black and white, the component color portion is white and the background color portion is black. Image. FIG. 2A shows an image picked up with a white background color, and FIG. 2B shows a binarized image with black and white inverted.

図2(C),(D)は、シートS上の部品に重なりがある場合に撮像装置Iにより撮像された画像とその2値化画像の例を示す。ここでは、左上の2つの部品が重なっている。図2(C)は、背景色を白として撮像された画像を示し、図2(D)は、白黒反転された2値化画像を示している。   FIGS. 2C and 2D show an example of an image captured by the imaging apparatus I when there are overlapping parts on the sheet S and a binarized image thereof. Here, the upper left two parts overlap. FIG. 2C shows an image picked up with a white background color, and FIG. 2D shows a binarized image that is black and white inverted.

ラベリング手段12は、2値化手段11により2値化された2値化画像の部品色部分の画素に対してラベル付けする。このラベリングでは、2値化画像において部品色で連結している画素に同じラベルを付与し、同じラベルが付与された画素の集合を各部品色部分の連結成分とする。   The labeling unit 12 labels the pixels in the component color portion of the binarized image binarized by the binarizing unit 11. In this labeling, the same label is given to the pixels connected by the component color in the binarized image, and a set of pixels to which the same label is assigned is used as a connected component of each component color part.

重なり検出手段13は、各部品色部分の連結成分での部品の重なりを検出する。部品の重なりは、各部品色部分の連結成分の画素数を計数し、その画素数(面積)のヒストグラムを利用して検出できる。なお、重なり検出に際しては、画素数(面積)からノイズである可能性が大である連結成分を予め除去する。重なり検出の具体的手法については、後で説明する。   The overlap detection means 13 detects the overlap of components at the connected component of each component color part. The overlap of components can be detected by counting the number of connected component pixels in each component color portion and using a histogram of the number of pixels (area). When detecting overlap, connected components that are highly likely to be noise are removed in advance from the number of pixels (area). A specific method for detecting overlap will be described later.

計数手段14は、画像内の全ての部品色部分の連結成分において部品の重なりが検出されなかった場合に、画像内での部品色部分の連結成分から部品の個数を計数する。ここでは、画像内の連結成分の数を部品の個数とすればよい。   The counting means 14 counts the number of parts from the connected components of the component color portions in the image when no overlapping of the components is detected in the connected components of all the component color portions in the image. Here, the number of connected components in the image may be the number of parts.

加工手段15は、画像内の何れかの部品色部分の連結成分において部品の重なりが検出された場合に、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成する。   The processing unit 15 generates an image processed so that the connected component of the component color portion in which the overlap of the component is detected can be identified when the overlap of the component is detected in the connected component of any component color portion in the image. To do.

図2(E),(F)は、シートS上の部品に重なりが検出された場合に、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像の例を示す。ここでは、加工した画像の部分に網掛けを施している。なお、加工は、図2(E)に示されるように、2値化画像に施してもよいし、図2(F)に示されるように、撮像装置Iにより撮像された画像に施してもよい。   FIGS. 2E and 2F show examples of images processed so that the connected components of the component color portions where the overlap of the components is detected can be discriminated when the overlap of the components on the sheet S is detected. Here, the portion of the processed image is shaded. The processing may be performed on the binarized image as shown in FIG. 2 (E), or may be performed on the image captured by the imaging device I as shown in FIG. 2 (F). Good.

計数手段14による計数の結果および加工手段15により加工された画像は、表示装置Dに送出して表示させることができる。これにより、シートS上の部品に重なりがない場合には、その部品の個数を表示させることができる。また、シートS上のどこかの部品に重なりがある場合には、その重なっている部分を容易に視認できるように表示させることができる。ユーザが、画像上で重なりを視認し、それを解消して再度計数処理を実行させれば、部品の個数を正しく計数させることができる。   The counting result by the counting means 14 and the image processed by the processing means 15 can be sent to the display device D for display. Thereby, when there is no overlap on the parts on the sheet S, the number of the parts can be displayed. Further, when there is an overlap in some parts on the sheet S, the overlapping portion can be displayed so that it can be easily recognized. If the user visually recognizes the overlap on the image, eliminates the overlap, and executes the counting process again, the number of parts can be correctly counted.

図3は、本発明に係る部品計数装置の他の実施形態を示す機能ブロック図である。この実施形態は、CPU20を用いて部品計数装置を構成したものである。CPU20は、制御ソフトを含み、図1の部品計数装置1と同様に機能して、シートS上に並べられた部品の個数を計数して表示し、あるいは部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を表示させる。   FIG. 3 is a functional block diagram showing another embodiment of the component counting device according to the present invention. In this embodiment, a component counting device is configured using a CPU 20. The CPU 20 includes control software and functions in the same manner as the component counting apparatus 1 in FIG. 1 to count and display the number of components arranged on the sheet S, or a component color portion in which component overlap is detected. An image obtained by processing such connected components in a distinguishable manner is displayed.

なお、CPU20には、入力装置21、補助記憶装置22および表示装置23が付属しており、入力装置21は、ユーザにより操作されて処理開始などの各種指示を入力し、補助記憶装置22は、入力された画像やその解析結果などを適宜記憶する。また、表示装置23は、CPU20での画像の解析結果などを表示する。   The CPU 20 is provided with an input device 21, an auxiliary storage device 22, and a display device 23. The input device 21 is operated by a user to input various instructions such as processing start. The auxiliary storage device 22 The input image and its analysis result are stored appropriately. Further, the display device 23 displays the analysis result of the image in the CPU 20.

図4は、CPU20上で動作する制御ソフトの構成要素を示す。   FIG. 4 shows components of control software that operates on the CPU 20.

この制御ソフトの構成要素は、「ユーザインタフェース」、「撮像」、「画像の解析」および「表示」からなる。ユーザからの処理の開始などの依頼は、「ユーザインタフェース」を通して入力され、撮像装置Iは、ユーザからの依頼などに従って「撮像」により制御され、撮像装置Iにより撮像された画像は、「画像の解析」により解析される。   The components of this control software include “user interface”, “imaging”, “image analysis”, and “display”. A request from the user such as start of processing is input through a “user interface”, the imaging apparatus I is controlled by “imaging” in accordance with a request from the user, and the image captured by the imaging apparatus I is “image Analyzed by “analysis”.

この画像の解析結果に従って、シートS上に並べられた部品の個数を計数し、あるいは部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成する。また、「表示」により、「画像の解析」により計数された部品の個数を表示装置23に表示させることができ、あるいは部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を表示装置23に表示させることができる。   In accordance with the analysis result of the image, the number of parts arranged on the sheet S is counted, or an image is generated that is processed so that the connected components of the part color part in which the overlapping of the parts is detected can be identified. Further, by “display”, the number of components counted by “analysis of image” can be displayed on the display device 23, or the connected component of the component color portion where the overlap of the components is detected can be identified. An image can be displayed on the display device 23.

図5は、図3のCPU20における処理を示すフローチャートである。   FIG. 5 is a flowchart showing processing in the CPU 20 of FIG.

まず、ユーザは、計数の対象とする部品PをシートS上に並べ、入力装置21を操作して処理の開始を指示する。これによりシートS上を撮像装置Iで撮像する旨の指示がCPU20の「ユーザインタフェース」から撮像装置Iに伝えられ、撮像装置Iは、シートS上を撮像する(S51)。   First, the user arranges the parts P to be counted on the sheet S and operates the input device 21 to instruct the start of processing. Thus, an instruction to image the sheet S with the imaging device I is transmitted from the “user interface” of the CPU 20 to the imaging device I, and the imaging device I images the sheet S (S51).

撮像装置Iにより撮像された画像は、CPU20に伝送される。CPU20は、「画像の解析」により、伝送されてきた画像を解析し(S52)、その画像の解析結果により、部品の重なりを検出する(S53)。なお、「画像の解析」の具体的処理については、後で詳細に説明する。   An image captured by the imaging device I is transmitted to the CPU 20. The CPU 20 analyzes the transmitted image by “image analysis” (S52), and detects an overlap of components based on the analysis result of the image (S53). The specific process of “image analysis” will be described later in detail.

S53で、部品の重なりが検出されない場合には、部品の個数を計数し、CPU20の「表示」により、表示装置23にその計数の結果、すなわち計数した部品の個数を表示させる(S54)。また、S53で、部品の重なりが検出された場合には、そのままの計数では誤差が生じる。そこで、撮像装置Iにより撮像された画像において、部品の重なりが検出された部品色部分の連結成分を識別可能に、例えば、色付けなどで加工し、その画像を表示装置23に表示させる。あるいは2値化画像において、部品の重なりが検出された部品色部分の連結成分を識別可能に加工し、その2値化画像を表示させてもよい(S55)。   If no overlapping of components is detected in S53, the number of components is counted, and the result of the counting, that is, the counted number of components is displayed on the display device 23 by "display" of the CPU 20 (S54). In addition, when an overlap of parts is detected in S53, an error occurs in the count as it is. Therefore, in the image picked up by the image pickup device I, the connected component of the component color part in which the overlap of the components is detected is processed, for example, by coloring, and the image is displayed on the display device 23. Alternatively, in the binarized image, the connected component of the component color part where the overlap of the components is detected may be processed so as to be identifiable, and the binarized image may be displayed (S55).

ユーザは、表示された画像により、部品の重なりがある部品色部分の連結成分を容易に視認できるので、その重なりを解消する作業を行ってから再度計数処理を開始させれば、部品の個数を正しく計数させて表示させることができる(S56)。   The user can easily visually recognize the connected component of the component color portion where there is an overlap of the component based on the displayed image. Therefore, if the counting process is started again after performing the work to eliminate the overlap, the number of components can be determined. It is possible to correctly count and display (S56).

図6は、CPU20の「画像の解析」での具体的処理を示すフローチャートである。   FIG. 6 is a flowchart showing a specific process in the “image analysis” of the CPU 20.

撮像装置IでシートS上を撮像するに先立って、パラメータとして「部品最小サイズ」を設定する。「部品最小サイズ」は、画像上の部品部分をノイズから区別するために使用される。このパラメータは、部品の種類や画像上での部品部分のサイズ、ノイズの発生状況、それが部品の重なり検出の処理に及ぼす影響などを考慮して経験上で設定可能である。   Prior to imaging on the sheet S by the imaging apparatus I, “part minimum size” is set as a parameter. The “part minimum size” is used to distinguish a part part on an image from noise. This parameter can be set empirically in consideration of the type of part, the size of the part on the image, the occurrence of noise, and the effect of this on the part overlap detection process.

なお、「部品最小サイズ」は、例えば、撮像装置Iによる撮像時に撮像した画像から部品としたい部品色部分の連結成分をユーザが指定して装置に入力し、その連結成分の画素数を使用して再設定することもできる。   Note that the “minimum component size” is, for example, a user specifying a connected component of a component color part to be used as a component from an image captured at the time of imaging by the imaging device I and inputting it to the device, and using the number of pixels of the connected component Can be reset.

その後、まず、撮像装置Iにより撮像された画像を背景色部分と部品色部分との2値化画像に2値化する(S61)。この2値化には、部品Pと背景となるシートSの画像から部品PとシートSの光度差を利用して、まず、グレースケール化を行い、さらに光度の閾値を使用して2値化する手法、部品Pが並べられる前のシートS上の画像と部品Pが並べられた後のシートS上の画像のRGBの成分ごとに排他的論理和を取って得られる差分情報を2値化の結果とする手法などを利用することができるが、それに限られない。   Thereafter, first, the image picked up by the image pickup device I is binarized into a binarized image of a background color portion and a component color portion (S61). In this binarization, first, gray scale conversion is performed from the image of the component P and the sheet S as a background using the light intensity difference between the component P and the sheet S, and further binarization is performed using the light intensity threshold value. And binarizing the difference information obtained by taking an exclusive OR for each RGB component of the image on the sheet S before the parts P are arranged and the image on the sheet S after the parts P are arranged. However, it is not limited to this.

次に、ラベリングにより、2値化された画像の部品色部分の画素に対してラベルを付与する(S62)。このラベリングでは、部品色(白)で連結している画素に同じラベルを付与し、同じラベルが付与された画素の集合を各部品色部分の連結成分とする。   Next, a label is given to the pixel of the component color portion of the binarized image by labeling (S62). In this labeling, the same label is given to the pixels connected with the component color (white), and a set of pixels with the same label is used as a connected component of each component color part.

例えば、部品色部分の連結成分がN個ある場合、各部品色部分の連結成分の画素に対して付与されるラベルは、それぞれ1,2,3,・・・,Nとなる。部品色部分の連結成分の各画素に対するラベリングは、2値化された画像の左上画素を先頭画素としてx軸方向に走査し、さらに、y軸方向に1画素ずつずらしつつ同様に走査し、部品色部分の画素(白)に対して、それが先の部品色部分の画素(白)と連結していれば、先の部品色部分のラベルと同じラベルを付与することで実現できる。   For example, when there are N component color part connected components, the labels given to the connected component pixels of each component color part are 1, 2, 3,. The labeling for each pixel of the connected component of the component color part is performed by scanning in the x-axis direction with the upper left pixel of the binarized image as the first pixel, and further scanning in the same manner while shifting one pixel at a time in the y-axis direction. If the pixel of the color part (white) is connected to the pixel (white) of the previous component color part, it can be realized by giving the same label as the label of the previous component color part.

なお、画素の連結は、当該画素に対して上下左右の4方向でもよいし、さらに、斜め方向を加えた8方向でもよい。なお、ラベリングは、上記の手法に限らず、他の手法によってもよい。   Note that the pixels may be connected in four directions (up, down, left, and right) with respect to the pixel, or in eight directions including an oblique direction. Note that the labeling is not limited to the above method, and may be another method.

図7は、画像内の画素に付与されたラベルの例を示す。ここでは、10x10画素からなる画像の各画素に付与されたラベルの例を示しているが、画像はより多くの画素を含むのが普通である。なお、図7では、当該画素に対する8方向での連結を調べて各部品色部分の連結成分を生成している。図7には、重なり検出の具体的数値の例も示しているが、それについては後で説明する。   FIG. 7 shows an example of labels given to pixels in an image. Here, an example of a label attached to each pixel of an image composed of 10 × 10 pixels is shown, but it is normal that the image includes more pixels. In FIG. 7, the connection in the eight directions with respect to the pixel is examined to generate a connected component of each component color part. FIG. 7 also shows an example of specific numerical values for overlap detection, which will be described later.

次に、各部品色部分の連結成分の面積を計数する(S63)。各部品色部分の連結成分の面積は、同一ラベルが付与された画素数により求めることができる。   Next, the area of the connected component of each component color part is counted (S63). The area of the connected component of each component color part can be obtained from the number of pixels to which the same label is assigned.

次に、S63で計数された各部品色部分の連結成分の面積のうち、その面積が、先にパラメータとして設定された「部品最小サイズ」未満の部品色部分の連結成分はノイズとして除去し、それ以上の部品色部分の連結成分を部品部分とする(S64)。   Next, among the connected component areas of each component color portion counted in S63, the connected components of the component color portion whose area is less than the “component minimum size” set as a parameter previously are removed as noise, The connected component of the part color part beyond that is set as the part part (S64).

次に、ラベリングで求めた面積のヒストグラムを求め(S65)、このヒストグラムから各種係数を求める(S66)。ここで求める係数は、部品色部分の連結成分の面積の最小値(Min)と最頻値(Mode)、最小値(Min)から最頻値(Mode)までの距離(L)、最小値(Min)とは逆側に最頻値(Mode)から距離(L)だけ離れた最大値(Max)である。   Next, a histogram of the area obtained by labeling is obtained (S65), and various coefficients are obtained from this histogram (S66). The coefficients to be calculated here are the minimum (Min) and mode (Mode), the distance (L) from the minimum (Min) to the mode (Mode), and the minimum ( Min) is the maximum value (Max) that is separated from the mode value (Mode) by the distance (L) on the opposite side.

図8は、ラベリングで求めた面積のヒストグラムの例、および各種係数の関係を示す。ここで、横軸は面積であり、縦軸はその頻度である。部品の重なりがないことを前提とすると、ヒストグラムは、ここに示すように、正規分布の傾向を示すことが実証された。ここで、最小値(Min)および最頻値(Mode)は、ラベリングで求めた面積のヒストグラムにおける最小の値および最頻の値であり、距離(L)は、最小値(Min)から最頻値(Mode)までの距離であり、最大値(Max)は、最小値(Min)とは逆側に最頻値(Mode)から距離(L)だけ離れた点の値である。   FIG. 8 shows an example of an area histogram obtained by labeling and the relationship between various coefficients. Here, the horizontal axis is the area, and the vertical axis is the frequency. Assuming that there is no overlap of parts, the histogram has been demonstrated to show a normal distribution trend, as shown here. Here, the minimum value (Min) and the mode value (Mode) are the minimum value and the mode value in the histogram of the area obtained by labeling, and the distance (L) is the mode from the minimum value (Min) to the mode. It is the distance to the value (Mode), and the maximum value (Max) is the value at the point away from the mode (Mode) by the distance (L) on the opposite side of the minimum value (Min).

部品の重なりがないと判定する連結成分の面積は、最大値(Max)に対して以下の範囲とする。
部品の重なりがないと判定する連結成分の面積<=最大値(Max)
The area of the connected component that is determined to have no overlapping of parts is in the following range with respect to the maximum value (Max).
Area of connected components determined that there is no overlap of parts <= maximum value (Max)

S67では、ノイズとして除去された部品色部分の連結成分以外の各部品色部分の連結成分の面積が最大値(Max)以下であるかを判定して重なり検出を行い、S68では、重なり検出の結果を判定する。   In S67, it is determined whether or not the area of the connected component of each component color part other than the connected component of the component color part removed as noise is equal to or less than the maximum value (Max), and overlap detection is performed in S68. Determine the result.

S68で、画像内の全ての部品色部分の連結成分の面積が最大値(Max)以下であれば、部品の重なりがないと判定される。この場合には、部品の個数を計数し(S69)、それを表示装置23に表示させる(S70)。なお、部品の個数は、ノイズとして除去された部品色部分の連結成分以外の各部品色部分の連結成分の数から求めることができる。   In S68, if the area of the connected component of all the component color portions in the image is equal to or less than the maximum value (Max), it is determined that there is no overlapping of components. In this case, the number of parts is counted (S69) and displayed on the display device 23 (S70). Note that the number of components can be obtained from the number of connected components of each component color portion other than the connected components of the component color portion removed as noise.

一方、S68で、画像内の何れかの部品色部分の連結成分の面積が最大値(Max)より大であれば、部品の重なりがあると判定される。この場合には、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成し(S71)、その画像を表示装置23に表示させる(S72)。   On the other hand, if the area of the connected component of any part color part in the image is larger than the maximum value (Max) in S68, it is determined that there is an overlap of parts. In this case, an image obtained by processing the connected component of the component color portion where the overlap of the components is detected is generated (S71), and the image is displayed on the display device 23 (S72).

なお、識別可能な加工は、色付けなどでよい。また、表示装置23に表示させる画像は、撮像装置Iにより撮像された画像でもよいし、2値化された画像でもよく、その何れかの画像を見易さに応じて選択的に表示できるようにすることも好ましい。   The identifiable processing may be coloring. The image displayed on the display device 23 may be an image captured by the imaging device I or may be a binarized image so that any one of the images can be selectively displayed according to ease of viewing. It is also preferable to make it.

図7には、同図の画素のラベル付けの場合に、「部品最小サイズ」=3を設定した場合の、重なり検出処理での具体的数値も示している。   FIG. 7 also shows specific numerical values in the overlap detection process when “minimum component size” = 3 is set in the case of pixel labeling in FIG.

ここでは、ラベル4の部品色部分の連結部分は、「部品最小サイズ」3未満であるので、ノイズとして除去される(S64)。その後、ラベル1,2,3,5,6,7,8,9からヒストグラムを求める。   Here, since the connected portion of the component color portion of the label 4 is less than “component minimum size” 3, it is removed as noise (S64). Thereafter, a histogram is obtained from the labels 1, 2, 3, 5, 6, 7, 8, and 9.

図7の例では、ヒストグラムの最小値(Min)は3、最頻値(Mode)は5となり、最小値(Min)から最頻値(Mode)までの距離(L)は2であることから、最大値(Max)は7となる。そして、ラベル1,2,3,5,7,8および9の部品色部分の連結成分の面積(サイズ)は3から7の値であり、最大値(Max)以下あるので、部品の重なりがないと判定する。一方、ラベル6の部品色部分の連結成分の面積(サイズ)は9であり最大値(Max)7より大きいので、部品の重なりがあると判定する(S67,S68)。   In the example of FIG. 7, the minimum value (Min) of the histogram is 3, the mode value (Mode) is 5, and the distance (L) from the minimum value (Min) to the mode value (Mode) is 2. The maximum value (Max) is 7. The area (size) of the connected components of the component color portions of the labels 1, 2, 3, 5, 7, 8, and 9 is a value from 3 to 7, which is less than the maximum value (Max). Judge that there is no. On the other hand, since the area (size) of the connected component of the component color portion of the label 6 is 9 and larger than the maximum value (Max) 7, it is determined that there is an overlap of components (S67, S68).

以上により、この例では、ラベル6の部品色部分の連結成分が、色付けなどで識別可能に加工された画像が表示装置23で表示される。   As described above, in this example, the display device 23 displays an image obtained by processing the connected component of the component color portion of the label 6 so as to be identifiable by coloring or the like.

以上、本発明の実施形態について説明したが、本発明は、上記の実施形態に限定されず、種々に変形されたものを含む。   As mentioned above, although embodiment of this invention was described, this invention is not limited to said embodiment, What contains various deformation | transformation is included.

例えば、部品の向きなどの部品の状態により部品色部分の連結成分の面積が異なる場合があるが、このような場合には、部品の状態を部品色部分の連結成分の特徴から判別してグループ分けし、ヒストグラムから重なりがある連結成分と判定されたものであっても、それから頭を下にした部品の連結成分を除いた連結成分を対象として部品の重なりを検出することにより、その検出の精度を高めることができる。   For example, the area of the connected component of the part color part may differ depending on the state of the part such as the orientation of the part. In such a case, the state of the part is determined from the characteristics of the connected component of the part color part, and the group Even if it is determined that the connected component is overlapped from the histogram, the detection of the overlap is detected by detecting the overlapping of the connected component excluding the connected component of the component with the head down. Accuracy can be increased.

図9は、向きによりグループ分けされる部品の例を示す図であり、図10は、そのグループ分けの原理を説明する図である。   FIG. 9 is a diagram illustrating an example of components grouped according to orientation, and FIG. 10 is a diagram illustrating the principle of grouping.

図9に示すようなネジでは、頭を下にした状態と頭を横にした状態とで連結成分の面積が異なり、頭を下にした状態のネジの部分をネジの重なりと判定することがある。このようなネジを計数する場合には、頭を下にした状態のネジを判定し、それに対する連結成分をヒストグラムから重なりがあると判定された連結成分から除くことにより、部品の重なりの検出の精度を高めることができる。   In the screw as shown in FIG. 9, the area of the connected component is different between the head-down state and the head-side state, and it is possible to determine that the screw portion in the head-down state is a screw overlap. is there. When counting such screws, determine the screw with the head down, and remove the connected component from the connected component that is determined to have overlap from the histogram. Accuracy can be increased.

図9に示すように、ネジが頭を下にした状態では、図10に示すように、部品色部分の連結成分のx方向とy方向の画素数が等しく、また、部品色部分の連結成分の面積(画素数)は、π×((x方向の画素数+y方向の画素数)/4)となるので、それを利用して、ネジが頭を下にした状態であることを知ることができる。 As shown in FIG. 9, in the state where the screw is headed down, as shown in FIG. 10, the number of pixels in the x direction and the y direction of the connected component of the component color portion is equal, and the connected component of the component color portion. The area (number of pixels) is π × ((number of pixels in the x direction + number of pixels in the y direction) / 4) 2 , so that it is used to know that the screw is in a state where the head is down. be able to.

図11は、図9の部品(ネジ)をグループ分けする処理を示すフローチャートである。   FIG. 11 is a flowchart showing a process for grouping the components (screws) in FIG.

まず、ラベルが付与された部品色部分の連結成分のx方向とy方向の画素数をそれぞれ求め(S101)、2つの画素数を比較する(S102)。S102で、2つの画素数が異なると判定された場合は、ネジは頭を下にした状態でないので、通常の部品(ネジ)として扱う(S103)。   First, the number of pixels in the x direction and the y direction of the connected component of the component color part to which the label is given is obtained (S101), and the two pixel numbers are compared (S102). If it is determined in S102 that the number of pixels is different, the screw is not in a state of having its head down, and is treated as a normal component (screw) (S103).

一方、S102で、2つの画素数が等しいと判定された場合は、ネジは頭を下にした状態である可能性があるので、さらに、部品色部分の連結成分の面積(画素数)をπ×((x方向の画素数+y方向の画素数)/4)により計算し(S104)、それを部品色部分の連結成分の面積と比較する(S105)。 On the other hand, if it is determined in S102 that the number of two pixels is equal, the screw may be in a state of having its head down, and further, the area (number of pixels) of the connected component of the component color portion is set to π. X ((number of pixels in the x direction + number of pixels in the y direction) / 4) 2 (S104), and compares it with the area of the connected component of the component color portion (S105).

S105で、2つの面積が異なると判定された場合は、ネジは頭を下にした状態ではないので、通常の部品(ネジ)として扱う(S106)。一方、S105で、2つの面積が等しいと判定された場合は、頭を下にした状態の部品(ネジ)として扱う(S107)。   If it is determined in S105 that the two areas are different, the screw is not in a state of having its head down, and is treated as a normal part (screw) (S106). On the other hand, if it is determined in S105 that the two areas are equal, it is handled as a component (screw) with the head down (S107).

なお、x方向とy方向の画素数を比較して(S101)、両者が等しくない場合には、ヒストグラムから最頻値(Mode)と最大値(Max)の比率Rmax(=Max/Mode)を求め、さらに、その平方根RRmaxを求め、Rmaxを面積としての比率、RRmaxを線分としての比率とする。そして、この比率を用いて、(大きい方の画素数/RRmax)≦小さい方の画素数が成り立てば、等しいとして扱うことができる。   Note that the number of pixels in the x and y directions is compared (S101), and if the two are not equal, the ratio Rmax (= Max / Mode) of the mode (Mode) and the maximum value (Max) is determined from the histogram. Further, the square root RRmax is obtained, and Rmax is a ratio as an area and RRmax is a ratio as a line segment. Then, using this ratio, if (larger number of pixels / RRmax) ≦ smaller number of pixels holds, it can be treated as equal.

また、連結成分の面積を比較して(S105)、両者が等しくない場合には、ヒストグラムから求めた比率を用いて、(大きい方の面積/Rmax)≦小さい方の面積が成り立てば、等しい面積として扱うことができる。以上の扱いは、実証に基づくものである。   In addition, when the areas of the connected components are compared (S105) and they are not equal, the ratio obtained from the histogram is used to obtain an equal area if (larger area / Rmax) ≦ smaller area is established. Can be treated as The above treatment is based on demonstration.

図12は、グループ分けを行う場合の重なり検出の処理を示すフローチャートである。   FIG. 12 is a flowchart showing overlap detection processing when grouping is performed.

まず、S121では、連結成分の面積が部品の範囲内か判定し、ここで、範囲内と判定された場合には、重なりがない連結成分として扱う(S122)。   First, in S121, it is determined whether the area of the connected component is within the range of the part. If it is determined that the area is within the range, the connected component is handled as a connected component having no overlap (S122).

S121で、連結成分の面積が部品の範囲内でないと判定された場合には、例えば、図11のフローチャートに従ってグループ分けを行い(S123)、頭を下にしている部品と判定されたかどうかに従って(S124)、頭を下にしている部品と判定された場合には、重なりがない連結成分として扱い(S122)、頭を下にしている部品と判定されない場合には、重なりがある連結成分として扱う。   If it is determined in S121 that the area of the connected component is not within the range of the part, for example, grouping is performed according to the flowchart of FIG. 11 (S123), and according to whether it is determined that the part is headed down ( S124) If it is determined that the component is headed down, it is treated as a connected component without overlapping (S122), and if it is not determined that the component is headed down, it is treated as a connected component with overlap. .

以上の処理により、ラベリングした連結成分のうち、最大値以下の連結成分とグループ分けされた頭を下にしている部品と判定された連結成分を重なりがない連結成分として扱い、それ以外の連結成分を重なりがある連結成分として扱って、図6のフローチャートにより部品の重なりを検出する。なお、グループ分けの処理で既に求められている値はそれを用いればよく、改めて求める必要はない。   By the above processing, among the labeled connected components, the connected components determined to be parts with the head grouped down with the connected components below the maximum value are treated as non-overlapping connected components, and the other connected components Is detected as a connected component with overlap, and the overlap of parts is detected by the flowchart of FIG. Note that the value already obtained in the grouping process may be used, and does not need to be obtained again.

以上では、本発明を部品計数装置として実現した場合について説明したが、本発明は、部品計数装置の各手段により実行される処理を各ステップとした部品計数方法、あるいはコンピュータを部品計数装置の各手段として機能させるプログラムとしても実現することができる。   In the above, the case where the present invention is realized as a component counting device has been described. However, the present invention is a component counting method in which processing executed by each unit of the component counting device is performed in each step, or a computer is connected to each component counting device. It can also be realized as a program that functions as means.

1・・・部品計数装置(部品カウンタ)、11・・・2値化手段、12・・・ラベリング手段、13・・・重なり検出手段、14・・・計数手段、15・・・加工手段、20・・・CPU、21・・・入力装置、22・・・補助記憶装置、23,D・・・表示装置、I・・・撮像装置、S・・・シート   DESCRIPTION OF SYMBOLS 1 ... Component counting device (component counter), 11 ... Binary means, 12 ... Labeling means, 13 ... Overlap detection means, 14 ... Counting means, 15 ... Processing means, 20 ... CPU, 21 ... input device, 22 ... auxiliary storage device, 23, D ... display device, I ... imaging device, S ... sheet

Claims (6)

部品が並べられたシート上を撮像して得られた画像を解析して、該シート上に並べられた部品の個数を計数する部品計数装置であって、
前記画像を背景色部分と部品色部分との2値化画像に2値化する2値化手段と、
前記2値化画像において部品色で連結している画素に同じラベルを付与し、同じラベルが付与された画素の集合を各部品色部分の連結成分とするラベル付与手段と、
前記各部品色部分の連結成分の画素数を計数し、各部品色部分の連結成分のうち、その画素数が予め設定された所定値に満たないものをノイズとして除去してから、前記画像内の部品色部分の連結成分の画素数のヒストグラムを求め、該ヒストグラムから部品の重なりを検出するための閾値を求め、各部品色部分の連結成分の画素数と該閾値とを比較して、各連結成分での部品の重なりを検出する重なり検出手段と、
前記画像内の全ての部品色部分の連結成分において部品の重なりが検出されなかった場合、前記画像内での部品色部分の連結成分から部品の個数を計数する計数手段と、
前記画像内の何れかの部品色部分の連結成分において部品の重なりが検出された場合、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成する加工手段を備えたことを特徴とする部品計数装置。
A component counting device that analyzes an image obtained by imaging a sheet on which components are arranged and counts the number of components arranged on the sheet,
Binarization means for binarizing the image into a binarized image of a background color portion and a component color portion;
Label attaching means for assigning the same label to pixels connected in the component color in the binarized image, and using a set of pixels to which the same label is attached as a connected component of each component color part;
The number of connected component pixels of each component color portion is counted, and among the connected components of each component color portion, those whose number of pixels does not satisfy a predetermined value set as a noise are removed as noise, A histogram of the number of connected component pixels of the component color part is obtained, a threshold for detecting overlap of the parts is obtained from the histogram, the number of connected component pixels of each component color part is compared with the threshold, An overlap detection means for detecting an overlap of components in the connected component;
A counting means for counting the number of parts from the connected components of the component color part in the image when no overlapping of the components is detected in the connected components of all the component color parts in the image;
When an overlapping part is detected in a connected component of any part color part in the image, a processing unit is provided that generates an image processed so that the connected component of the part color part in which the overlapping part is detected can be identified. A component counting device characterized by that.
前記重なり検出手段は、前記画像内の部品色部分の連結成分における画素数のヒストグラムにおける最小値から最頻値までの距離だけ最頻値から隔たった点を最大値として求め、該最大値を前記閾値とすることを特徴とする請求項1に記載の部品計数装置。   The overlap detection means obtains, as a maximum value, a point separated from the mode value by the distance from the minimum value to the mode value in the histogram of the number of pixels in the connected component of the component color part in the image, and the maximum value is determined as the maximum value. The component counting apparatus according to claim 1, wherein a threshold value is set. 前記加工手段は、部品の重なりが検出された部品色部分の連結成分に対して色付け加工を施した画像を生成することを特徴とする請求項1または2に記載の部品計数装置。   3. The component counting apparatus according to claim 1, wherein the processing unit generates an image obtained by performing coloring processing on a connected component of a component color portion in which an overlap of components is detected. さらに、シート上に並べられた部品の状態を、各部品色部分の連結成分の特徴から判別してグループ分けする判別手段を備え、
前記重なり検出手段は、前記判別手段によりグループ分けされた部品の状態ごとに部品の重なり検出を行うことを特徴とする請求項1ないし3のいずれか1つに記載の部品計数装置。
Furthermore, it comprises a discrimination means for discriminating the state of the components arranged on the sheet from the characteristics of the connected component of each component color part and grouping them,
4. The component counting apparatus according to claim 1, wherein the overlap detection unit performs component overlap detection for each component state grouped by the determination unit. 5.
部品が並べられたシート上を撮像して得られた画像を解析して、該シート上に並べられた部品の個数を計数する部品計数方法であって、
前記画像を背景色部分と部品色部分との2値化画像に2値化する第1のステップと、
前記2値化画像において部品色で連結している画素に同じラベルを付与し、同じラベルが付与された画素の集合を各部品色部分の連結成分とする第2のステップと、
前記各部品色部分の連結成分の画素数を計数し、各部品色部分の連結成分のうち、その画素数が予め設定された所定値に満たないものをノイズとして除去してから、前記画像内の部品色部分の連結成分の画素数のヒストグラムを求め、該ヒストグラムにおける最小値と最頻値から部品の重なりを検出するための閾値を求め、各部品色部分の連結成分の画素数と該閾値とを比較して、各連結成分での部品の重なりを検出する第3のステップと、
前記画像内の全ての部品色部分の連結成分において部品の重なりが検出されなかった場合、前記画像内での部品色部分の連結成分から部品の個数を計数する第4のステップと、
前記画像内の何れかの部品色部分の連結成分において部品の重なりが検出された場合、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成する第5のステップを有することを特徴とする部品計数方法。
A component counting method for analyzing an image obtained by imaging a sheet on which components are arranged and counting the number of components arranged on the sheet,
A first step of binarizing the image into a binarized image of a background color portion and a component color portion;
A second step of assigning the same label to the pixels connected with the component color in the binarized image, and using a set of pixels with the same label as a connected component of each component color part;
The number of connected component pixels of each component color portion is counted, and among the connected components of each component color portion, those whose number of pixels does not satisfy a predetermined value set as a noise are removed as noise, A histogram of the number of connected component pixels in the component color part is obtained, a threshold for detecting an overlap of the parts is obtained from the minimum value and the mode value in the histogram, and the number of connected component pixels in each component color part and the threshold value are obtained. A third step of detecting an overlap of parts at each connected component;
A fourth step of counting the number of parts from the connected component of the part color part in the image when no overlapping of the parts is detected in the connected component of all the part color parts in the image;
A fifth step of generating an image obtained by processing the connected component of the component color part in which the overlap of the component is detected when the overlapping of the component is detected in the connected component of any component color part in the image. A component counting method characterized by comprising:
コンピュータを、
部品が並べられたシート上を撮像して得られた画像を背景色部分と部品色部分との2値化画像に2値化する2値化手段、
前記2値化画像において部品色で連結している画素に同じラベルを付与し、同じラベルが付与された画素の集合を各部品色部分の連結成分とするラベル付与手段、
前記各部品色部分の連結成分の画素数を計数し、各部品色部分の連結成分のうち、その画素数が予め設定された所定値に満たないものをノイズとして除去してから、前記画像内の部品色部分の連結成分の画素数のヒストグラムを求め、該ヒストグラムにおける最小値と最頻値から部品の重なりを検出するための閾値を求め、各部品色部分の連結成分の画素数と該閾値とを比較して、各連結成分での部品の重なりを検出する重なり検出手段、
前記画像内の全ての部品色部分の連結成分において部品の重なりが検出されなかった場合、前記画像内での部品色部分の連結成分から部品の個数を計数する計数手段、
前記画像内の何れかの部品色部分の連結成分において部品の重なりが検出された場合、部品の重なりが検出された部品色部分の連結成分を識別可能に加工した画像を生成する加工手段として機能させるプログラム。
Computer
Binarization means for binarizing an image obtained by imaging a sheet on which components are arranged into a binarized image of a background color portion and a component color portion;
Label giving means for giving the same label to the pixels connected in the component color in the binarized image, and using a set of pixels to which the same label is given as a connected component of each component color part,
The number of connected component pixels of each component color portion is counted, and among the connected components of each component color portion, those whose number of pixels does not satisfy a predetermined value set as a noise are removed as noise, A histogram of the number of connected component pixels in the component color part is obtained, a threshold for detecting an overlap of the parts is obtained from the minimum value and the mode value in the histogram, and the number of connected component pixels in each component color part and the threshold value are obtained. And an overlap detection means for detecting an overlap of parts at each connected component,
A counting means for counting the number of parts from the connected components of the component color parts in the image when no overlapping of the components is detected in the connected components of all the component color parts in the image;
Functions as processing means for generating an image obtained by processing the connected component of the component color part in which the overlap of the component is detected when the overlapping of the component is detected in the connected component of any of the component color parts in the image Program to make.
JP2017182359A 2017-09-22 2017-09-22 Parts counting device, parts counting method and program Active JP6894335B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017182359A JP6894335B2 (en) 2017-09-22 2017-09-22 Parts counting device, parts counting method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017182359A JP6894335B2 (en) 2017-09-22 2017-09-22 Parts counting device, parts counting method and program

Publications (2)

Publication Number Publication Date
JP2019057211A true JP2019057211A (en) 2019-04-11
JP6894335B2 JP6894335B2 (en) 2021-06-30

Family

ID=66107555

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017182359A Active JP6894335B2 (en) 2017-09-22 2017-09-22 Parts counting device, parts counting method and program

Country Status (1)

Country Link
JP (1) JP6894335B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597971A (en) * 2021-01-27 2021-04-02 昆山善思光电科技有限公司 Automatic recognition method for material disc state
CN113689404A (en) * 2021-08-24 2021-11-23 湖北三江航天红林探控有限公司 Part counting system and method based on image processing
WO2022230747A1 (en) * 2021-04-27 2022-11-03 株式会社日立製作所 Object recognition device and object recognition method
CN116306764A (en) * 2023-03-22 2023-06-23 北京京瀚禹电子工程技术有限公司 Electronic component counting system based on machine vision

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04120682A (en) * 1990-09-12 1992-04-21 Nippon Telegr & Teleph Corp <Ntt> Counter
JPH05266196A (en) * 1992-03-23 1993-10-15 Nippon Telegr & Teleph Corp <Ntt> Counting process method for moving body
JP2006234518A (en) * 2005-02-23 2006-09-07 Matsushita Electric Works Ltd Inspection method of particlate body and inspection device using it
JP2011039872A (en) * 2009-08-13 2011-02-24 Komatsu Denshi Kk Device and method for counting article

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04120682A (en) * 1990-09-12 1992-04-21 Nippon Telegr & Teleph Corp <Ntt> Counter
JPH05266196A (en) * 1992-03-23 1993-10-15 Nippon Telegr & Teleph Corp <Ntt> Counting process method for moving body
JP2006234518A (en) * 2005-02-23 2006-09-07 Matsushita Electric Works Ltd Inspection method of particlate body and inspection device using it
JP2011039872A (en) * 2009-08-13 2011-02-24 Komatsu Denshi Kk Device and method for counting article

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597971A (en) * 2021-01-27 2021-04-02 昆山善思光电科技有限公司 Automatic recognition method for material disc state
WO2022230747A1 (en) * 2021-04-27 2022-11-03 株式会社日立製作所 Object recognition device and object recognition method
CN113689404A (en) * 2021-08-24 2021-11-23 湖北三江航天红林探控有限公司 Part counting system and method based on image processing
CN116306764A (en) * 2023-03-22 2023-06-23 北京京瀚禹电子工程技术有限公司 Electronic component counting system based on machine vision
CN116306764B (en) * 2023-03-22 2023-11-14 北京京瀚禹电子工程技术有限公司 Electronic component counting system based on machine vision

Also Published As

Publication number Publication date
JP6894335B2 (en) 2021-06-30

Similar Documents

Publication Publication Date Title
JP6894335B2 (en) Parts counting device, parts counting method and program
JP4933771B2 (en) System and method for automatically recovering video tools in an imaging system
US20180211138A1 (en) Information processing device, information processing method, and storage medium
JP2017096750A (en) Positioning method, positioning apparatus, program and computer readable recording medium
JP2011163766A (en) Image processing method and image processing system
JP5956814B2 (en) Appearance inspection apparatus, appearance inspection method, and computer program
JP6355411B2 (en) Edge detection method
JP6727228B2 (en) Lead tip position image recognition method and lead tip position image recognition system
EP3812747A1 (en) Defect identifying method, defect identifying device, defect identifying program, and recording medium
US9286669B2 (en) Image processing apparatus, image processing method and program
CN110940670A (en) Flexible printing label printing head draft detection system based on machine vision and implementation method thereof
CN102401636B (en) Image measuring apparatus and image measuring method
JP2010133744A (en) Defect detection method, and visual inspection device using the same
JP2014085115A (en) Dimension measurement device, dimension measurement method, and program for dimension measurement device
JP5686012B2 (en) Surface defect inspection apparatus and method
WO2018173352A1 (en) Image processing method and image processing device
JP5960433B2 (en) Image processing apparatus and image processing method
JP6647903B2 (en) Image inspection device, image inspection program, computer-readable recording medium, and recorded device
CN106373158A (en) Automated image detection method
JP2020134424A (en) Spectroscopic inspection method, image processing device, and robot system
JP7380332B2 (en) Image processing device, control method and program for the image processing device
US20170336283A1 (en) Method for checking the position of characteristic points in light distributions
JP5921190B2 (en) Image processing apparatus and image processing method
JP2023060515A (en) Method for detecting defect, defect detection system, and defect detection program
JP7207948B2 (en) Appearance inspection method and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200514

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210310

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210324

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210511

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210602

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210603

R150 Certificate of patent or registration of utility model

Ref document number: 6894335

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150