JP2010004904A - Button front/back determination method - Google Patents

Button front/back determination method Download PDF

Info

Publication number
JP2010004904A
JP2010004904A JP2008163954A JP2008163954A JP2010004904A JP 2010004904 A JP2010004904 A JP 2010004904A JP 2008163954 A JP2008163954 A JP 2008163954A JP 2008163954 A JP2008163954 A JP 2008163954A JP 2010004904 A JP2010004904 A JP 2010004904A
Authority
JP
Japan
Prior art keywords
button
image
imaging
captured image
camera
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
JP2008163954A
Other languages
Japanese (ja)
Other versions
JP5084634B2 (en
Inventor
Chieko Wakabayashi
千恵子 若林
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.)
Juki Corp
Original Assignee
Juki 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 Juki Corp filed Critical Juki Corp
Priority to JP2008163954A priority Critical patent/JP5084634B2/en
Publication of JP2010004904A publication Critical patent/JP2010004904A/en
Application granted granted Critical
Publication of JP5084634B2 publication Critical patent/JP5084634B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Image Analysis (AREA)
  • Sewing Machines And Sewing (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a button front/back determination method for suitably determining the front and back of a button. <P>SOLUTION: The button front/back determination method for imaging buttons B1 and B2 with a camera 2 and determining the front and back of the button B2 from the captured image includes: a first imaging step of imaging the button B1 to be the reference of determining the surface of the button with the camera 2; a second imaging step of imaging the button B2 to be the object for determining the front and back; and a front/back determination step of determining the front and back of the button B2 projected in a second captured image from the captured image obtained in the first imaging step and the captured image obtained in the second imaging step. The first imaging step is performed simultaneously with the second imaging step. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、カメラでボタンを撮像し、その撮像画像からボタンの表裏を判定するボタンの表裏判定方法に関する。   The present invention relates to a button front / back determination method for imaging a button with a camera and determining the front / back of the button from the captured image.

衣類等の被縫製物にボタンを縫い付けるボタン付けミシンでは、ボタン保持部が被縫製物の近傍でボタンを保持して縫いを行う。このとき、ボタン保持部にはボタン供給装置によって逐次ボタンが供給されるが、ボタン保持部にボタンが供給されるときにボタンの表裏が正しい向きとなっている必要がある。このため、ボタンの表裏を判定する機構が必要とされているが、従来の機構としてはボタンの一方の面(例えば裏)が凸状となっているボタンの場合に、ボタンの搬送経路に設けられた選別板により凸面が上向きに搬送されているボタンのみを搬送経路からボタンを落下させることでボタンの表裏判定を行うボタン選別装置が知られている(例えば特許文献1)。
特開平10−194435号公報
In a button sewing machine that sews buttons to a sewing product such as clothing, a button holding unit holds the button in the vicinity of the sewing product and performs sewing. At this time, the buttons are sequentially supplied to the button holding unit by the button supply device. However, when the buttons are supplied to the button holding unit, the front and back of the buttons need to be in the correct orientation. For this reason, a mechanism for determining the front and back of the button is required. However, as a conventional mechanism, a button having a convex surface on one side (for example, the back) is provided in the button transport path. There is known a button selection device that performs front / back determination of a button by dropping only the button whose convex surface is conveyed upward by the selected sorting plate from the conveyance path (for example, Patent Document 1).
Japanese Patent Laid-Open No. 10-194435

しかしながら、従来のボタン選別装置では一方の面が凸面であるといったような顕著な物理的特徴による表裏判定を行えるボタンにのみ適用可能であり、表と裏の形状に大きな差がないボタンの表裏を判定することはできないといった問題点があった。また、適用可能なボタンであってもボタンの大きさや種類によって選別板の微調整を行う必要があり、煩雑な作業を伴うといった問題点があった。加えて、当該微調整には熟練を要し、誰でも行えるものではなかった。   However, in the conventional button selection device, it can be applied only to buttons that can perform front / back determination based on remarkable physical characteristics such as one side being convex, and the front and back of a button that does not have a large difference in shape between the front and back sides. There was a problem that it could not be judged. Further, even if the button is applicable, it is necessary to finely adjust the sorting plate depending on the size and type of the button, and there is a problem in that it involves complicated work. In addition, the fine adjustment required skill and could not be performed by anyone.

そこで、ボタンをカメラ等の撮像装置で撮像し、画像認識処理を用いてボタンの表裏を判定する方法が検討されている。画像認識処理によるボタンの表裏判定を行う場合、テンプレートマッチングによる方法が考えられる。テンプレートマッチングを用いてボタンの表裏を判定する場合、ボタンが所定の向き(例えば表面が上)となるよう配置された状態で所定の方向(例えば上方)から撮像した撮像画像である判定元画像をあらかじめ用意し、供給するボタンを所定の方向から撮像した画像と判定元画像とを比較してその近似の度合いによって供給するボタンの表裏を判定する。また、テンプレートマッチングは画像の近似の度合いによって是非の判定を行うので、同時にボタンの種類の同非も判定される。一定以上近似していれば供給するボタンの表面は同種種類であり、かつ、正しい向きと判定され、そうでなければエラー即ち当該ボタンは裏面が上、あるいは異なるボタンであると判定される。   In view of this, a method of taking an image of a button with an imaging device such as a camera and determining the front and back of the button using image recognition processing has been studied. A template matching method is conceivable when performing button front / back determination by image recognition processing. When determining the front and back of a button using template matching, a determination source image that is a captured image captured from a predetermined direction (for example, upward) in a state where the button is arranged in a predetermined direction (for example, the surface is upward) The prepared button is compared with an image obtained by imaging the button to be supplied from a predetermined direction and the determination source image, and the front and back of the button to be supplied is determined according to the degree of approximation. In addition, since template matching makes a determination based on the degree of approximation of an image, the type of button is also determined at the same time. If it is approximated by a certain level or more, the surface of the button to be supplied is of the same kind and is determined to be in the correct orientation. Otherwise, an error, that is, the button is determined to be on the back or on a different button.

しかしながら、判定元画像を撮像した後に時間が経過することで、判定元画像を撮像した際にボタンに照射されていた照明等の諸条件と、表裏を判定される対象となるボタンに対する照明等の諸条件とが変化すると、同種の種類のボタンであって、かつ、表裏が正しい向きのボタンであっても、画像の近似の度合いが一定以上とならずにエラーとなることがあるといった問題点があった。   However, as time elapses after the determination source image is captured, various conditions such as the illumination applied to the button when the determination source image is captured, and the illumination for the button for which the front and back are to be determined, etc. If the conditions change, even if the buttons are of the same type and the front and back are in the correct orientation, the degree of image approximation may not exceed a certain level and an error may occur. was there.

本発明は、上述の問題点に鑑み、より好適にボタンの表裏判定を行えるボタンの表裏判定方法を提供することを目的とする。   In view of the above-described problems, an object of the present invention is to provide a button front / back determination method that can perform button front / back determination more suitably.

請求項1記載の発明は、カメラでボタンを撮像し、その撮像画像からボタンの表裏を判定するボタンの表裏判定方法において、表又は裏の基準となるボタンを前記カメラで撮像する第1の撮像工程と、表裏を判定する対象となるボタンを撮像する第2の撮像工程と、前記第1の撮像工程で得られた撮像画像と前記第2の撮像工程で得られた撮像画像とから前記第2の撮像画像に写ったボタンの表裏を判定する判定工程と、を有し、前記第1の撮像工程は、前記第2の撮像工程と同時又は前記第2の撮像工程の直前に行うことを特徴とする。   According to the first aspect of the present invention, in the button front / back determination method for imaging a button with a camera and determining the front / back of the button from the captured image, the first imaging for imaging a button serving as a front / back reference with the camera. A second imaging step for imaging a button to be used for determining front and back, a captured image obtained in the first imaging step, and a captured image obtained in the second imaging step. A determination step of determining the front and back of the button shown in the two captured images, wherein the first imaging step is performed simultaneously with the second imaging step or immediately before the second imaging step. Features.

請求項2記載の発明は、請求項1に記載のボタンの表裏判定方法において、前記第1の撮像工程は、前記第2の撮像工程を行うのと同時又は前記第2の撮像工程を行う直前に毎回行うことを特徴とする。   According to a second aspect of the present invention, in the button front / back determination method according to the first aspect, the first imaging step is performed simultaneously with the second imaging step or immediately before the second imaging step. This is performed every time.

請求項3記載の発明は、請求項1又は2に記載のボタンの表裏判定方法において、表又は裏の基準となるボタンと表裏を判定する対象となるボタンとを並べて配置し、ひとつのカメラで当該表又は裏の基準となるボタンと表裏を判定する対象となるボタンを同時に撮像することを特徴とする。   According to a third aspect of the present invention, in the button front / back determination method according to the first or second aspect, a button serving as a front or back reference and a button serving as a target for front / back determination are arranged side by side, and a single camera is used. The button which becomes the reference | standard of the said front or back and the button used as the object which determines the front and back is imaged simultaneously.

請求項4記載の発明は、請求項1又は2に記載のボタンの表裏判定方法において、前記第1の撮像工程と前記第2の撮像工程は、異なるカメラによって行われることを特徴とする。   According to a fourth aspect of the present invention, in the button front / back determination method according to the first or second aspect, the first imaging step and the second imaging step are performed by different cameras.

請求項5記載の発明は、請求項1に記載のボタンの表裏判定方法において、前記第1の撮像工程で得られた撮像画像と前記第2の撮像工程で得られた撮像画像とが所定以上近似していた場合、当該第2の撮像工程で得られた撮像画像を次の第1の撮像工程の撮像画像とすることを特徴とする。   According to a fifth aspect of the present invention, in the button front / back determination method according to the first aspect, the captured image obtained in the first imaging step and the captured image obtained in the second imaging step are not less than a predetermined value. When approximated, the captured image obtained in the second imaging step is used as the captured image in the next first imaging step.

請求項6記載の発明は、請求項1から5のいずれか一項に記載のボタンの表裏判定方法において、前記第1の撮像工程及び前記第2の撮像工程は、前記ボタンを側方から撮像することを特徴とする。   According to a sixth aspect of the present invention, in the button front / back determination method according to any one of the first to fifth aspects, the first imaging step and the second imaging step capture the button from the side. It is characterized by doing.

請求項7記載の発明は、請求項1から6のいずれか一項に記載のボタンの表裏判定方法において、前記第1の撮像工程で得られた撮像画像の一部又は一部を加工した画像を用いてボタンの表裏の判定を行うことを特徴とする。
なお、「所定以上近似」とは、第1の撮像画像に写った表又は裏の基準となるボタンと、第2の撮像画像に写った表裏を判定するボタンとが共に同じ面(表又は裏)を撮像されていると判定工程で判定される程度に近似していることを指す。
The invention according to claim 7 is an image obtained by processing a part or part of the captured image obtained in the first imaging step in the button front / back determination method according to any one of claims 1 to 6. It is characterized by determining the front and back of the button using.
Note that “approximate more than a predetermined value” means that the front or back reference button shown in the first captured image and the button for determining the front and back shown in the second captured image are both the same side (front or back). ) Is approximated to the extent that it is determined in the determination step.

請求項1記載の発明によれば、第1の撮像工程は第2の撮像工程と同時又は第2の撮像工程の直前に行う。つまり、表裏を判定したいボタンがある場合、表裏を判定したいボタンの撮像と同時またはその直前に表又は裏の基準となるボタンの撮像を行える。よって、表裏を判定したいボタンの判定元画像があらかじめ用意されていなくてもよく、表裏を判定したいボタンの撮像と同様の要領で表又は裏の基準となるボタンの撮像を行えば事足りる。
また、第1の撮像工程は第2の撮像工程と同時又は第2の撮像工程の直前に行うので、第1の撮像工程と第2の撮像工程の照明等の条件を同様とすることで、第1の撮像工程で得られる撮像画像と第2の撮像工程で得られる撮像画像の照明等の条件を同様にすることが可能となる。つまり、表又は裏の基準となるボタンの撮像画像と、表裏を判定する対象となるボタンの撮像画像との間に照明等の条件による類似度の剥離を防止することが可能となる。従って、判定元画像を撮像した際にボタンに照射されていた照明等の諸条件が変化すると、同種かつ表裏が正しい向きのボタンであっても画像の近似の度合いが一定以上とならずにエラーとなることがあるといった従来の問題点を解消することができ、より好適にボタンの表裏判定を行える。
According to the first aspect of the present invention, the first imaging step is performed simultaneously with the second imaging step or immediately before the second imaging step. That is, when there is a button for which the front / back is to be determined, the button for the front / back reference can be imaged simultaneously with or just before the button for which the front / back is to be determined. Therefore, it is not necessary to prepare in advance a determination source image of a button whose front / back is to be determined, and it is sufficient if the front / back reference button is imaged in the same manner as that for the button whose front / back is to be determined.
In addition, since the first imaging step is performed simultaneously with the second imaging step or immediately before the second imaging step, by making the conditions such as illumination in the first imaging step and the second imaging step the same, Conditions such as illumination of the captured image obtained in the first imaging step and the captured image obtained in the second imaging step can be made the same. That is, it is possible to prevent separation of similarity due to conditions such as illumination between the captured image of the button serving as the front or back reference and the captured image of the button serving as a target for determining the front and back. Therefore, if the conditions such as the illumination that was applied to the button when the judgment source image was captured change, even if the button is the same type and the front and back are in the correct orientation, the degree of image approximation does not exceed a certain level and an error occurs. Therefore, it is possible to eliminate the conventional problem that sometimes occurs, and it is possible to more suitably determine the front and back of the button.

請求項2記載の発明によれば、第1の撮像工程は、第2の撮像工程を行うのと同時又は第2の撮像工程を行う直前に毎回行う。つまり、表裏を判定する対象となるボタンの撮像が行われるたびに、表又は裏の基準となるボタンの撮像をその都度行う。よって、第1の撮像工程と第2の撮像工程との間の時間経過は極めて短くなり、各ボタンの照明条件等がほぼ同一となる。従って、判定元画像を撮像した際にボタンに照射されていた照明等の諸条件が変化すると、同種かつ表裏が正しい向きのボタンであっても画像の近似の度合いが一定以上とならずにエラーとなることがあるといった従来の問題点を解消することができ、より好適にボタンの表裏判定を行える。   According to the second aspect of the present invention, the first imaging step is performed at the same time as the second imaging step or immediately before the second imaging step. That is, each time a button that is a target for determining front and back is imaged, a button that is a front or back reference is imaged each time. Therefore, the time lapse between the first imaging step and the second imaging step is extremely short, and the illumination conditions and the like of each button are almost the same. Therefore, if the conditions such as the illumination that was applied to the button when the judgment source image was captured change, even if the button is the same type and the front and back are in the correct orientation, the degree of image approximation does not exceed a certain level and an error occurs. Therefore, it is possible to eliminate the conventional problem that sometimes occurs, and it is possible to more suitably determine the front and back of the button.

請求項3記載の発明によれば、表又は裏の基準となるボタンと表裏を判定する対象となるボタンとを並べて配置して撮像する。よって、各ボタンの撮像時の照明等の条件をほぼ同一とすることが可能となる。従って、判定元画像を撮像した際にボタンに照射されていた照明等の諸条件が変化すると、同種かつ表裏が正しい向きのボタンであっても画像の近似の度合いが一定以上とならずにエラーとなることがあるといった従来の問題点を解消することができ、より好適にボタンの表裏判定を行える。
また、表又は裏の基準となるボタンと表裏を判定する対象となるボタンとを並べて配置して撮像するので、1台のカメラで基準となるボタンと表裏を判定する対象のボタンの両方をその撮像範囲に含めて同時に撮像することが容易となる。このとき、当該1台のカメラで得られた撮像画像のうち基準となるボタンが写った領域と表裏を判定する対象のボタンが写った領域との比較処理を行えばボタンの表裏判定が行える。従って、第1の撮像工程と第2の撮像工程とを個別に行う場合に比してその工程が短縮され、より円滑にボタンの表裏判定を行える。
According to the third aspect of the present invention, the front or back reference button and the button for determining the front and back are arranged side by side and imaged. Therefore, it is possible to make the conditions such as illumination at the time of imaging each button substantially the same. Therefore, if the conditions such as the illumination that was applied to the button when the judgment source image was captured change, even if the button is the same type and the front and back are in the correct orientation, the degree of image approximation does not exceed a certain level and an error occurs. Therefore, it is possible to eliminate the conventional problem that sometimes occurs, and it is possible to more suitably determine the front and back of the button.
In addition, since the front and back reference buttons and the front and back determination target buttons are arranged side by side and imaged, both the reference button and the front and back determination target buttons are displayed with one camera. It becomes easy to include images within the imaging range at the same time. At this time, the front / back determination of the button can be performed by performing a comparison process between a region in which the reference button is captured and a region in which the target button to be determined is captured in the captured image obtained by the one camera. Therefore, the process is shortened as compared with the case where the first imaging process and the second imaging process are performed separately, and the button front / back determination can be performed more smoothly.

請求項4記載の発明によれば、第1の撮像工程と第2の撮像工程は、異なるカメラによって行われる。これによって、表又は裏の基準となるボタンを撮像するカメラと、表裏を判定する対象となるボタンを撮像するカメラとが異なるものとなるので、同一のカメラで各ボタンを撮像する場合に比して、表又は裏の基準となるボタンと表裏を判定するボタンの配置関係の自由度が大幅に向上する。   According to the fourth aspect of the present invention, the first imaging step and the second imaging step are performed by different cameras. As a result, the camera that captures the front or back reference button is different from the camera that captures the button for which the front and back are to be determined. Thus, the degree of freedom of the arrangement relationship between the front / back reference button and the front / back determination button is greatly improved.

請求項5記載の発明によれば、第1の撮像工程で得られた撮像画像と第2の撮像工程で得られた撮像画像とが所定以上近似していた場合、当該第2の撮像工程で得られた撮像画像を次の第1の撮像工程の撮像画像とする。つまり、第1の撮像画像に写った表又は裏の基準となるボタンと、第2の撮像画像に写った表裏を判定するボタンとが共に同じ面(表又は裏)を撮像されていると判定工程で判定される程度に近似している場合、第2の撮像工程で得られた撮像画像を、その次に「表裏を判定する対象となるボタン」の撮像画像に対する「表又は裏の基準となるボタン」の撮像画像として扱う。これによって、表裏を判定するボタンが表又は裏の基準となるボタンと同じ面を向いている場合は、次に表裏を判定する対象となるボタンを撮像する第2の撮像工程の際に同時またはその直前に行う第1の撮像工程をその前に行った第2の撮像工程に置き換えることが可能となる。よって、第1の撮像工程を個別に行う回数を低減させることができ、より円滑にボタンの表裏判定を行える。   According to the fifth aspect of the present invention, when the captured image obtained in the first imaging step and the captured image obtained in the second imaging step are approximated by a predetermined value or more, the second imaging step Let the obtained captured image be a captured image in the next first imaging step. That is, it is determined that the front or back reference button shown in the first captured image and the button for determining the front and back shown in the second captured image are both picked up on the same surface (front or back). When approximate to the extent determined in the process, the captured image obtained in the second imaging process is the “front or back reference” for the captured image of the “button to be judged front and back” It is treated as a captured image of a button. As a result, when the button for judging the front and back faces the same surface as the front or back reference button, either simultaneously or during the second imaging step for imaging the button for which the front and back are judged. It becomes possible to replace the first imaging process performed immediately before with the second imaging process performed before that. Therefore, the number of times of performing the first imaging step can be reduced, and the button front / back determination can be performed more smoothly.

請求項6記載の発明によれば、第1の撮像工程及び第2の撮像工程は、ボタンを側方から撮像する。ところで、ボタンの表裏判定の際には、第1の撮像工程で得られた表又は裏の基準となるボタンの撮像画像と、第2の撮像工程で得られた表裏を判定する対象となるボタンの撮像画像との比較処理を行う。このとき、一般的にボタンは表又は裏面の面積よりもその側方の面積の方が小さい。従って、ボタンを側方から見た場合にその表裏を判定可能な視覚的特徴がある場合は、ボタンを側方から撮像することで、表又は裏面の一方を当該面に対向して撮像する場合に比して表裏判定のために必要な撮像画像の面積を小さくすることが可能となる。よって、第1の撮像工程の撮像画像と第2の撮像工程の撮像画像との比較処理に要する時間を短縮でき、より好適にボタンの表裏判定を行える。   According to invention of Claim 6, a 1st imaging process and a 2nd imaging process image a button from the side. By the way, when determining the front and back of a button, a button that is a target for determining a front and back image obtained in the first imaging process and a front and back image obtained in the second imaging process. Comparison processing with the captured image is performed. At this time, the button generally has a smaller area on the side than the area of the front or back surface. Therefore, when there is a visual feature that allows the front and back to be determined when the button is viewed from the side, the button is imaged from the side, and one of the front and back surfaces is imaged facing the surface. Compared to the above, it is possible to reduce the area of the captured image necessary for front / back determination. Therefore, the time required for the comparison process between the captured image of the first imaging process and the captured image of the second imaging process can be shortened, and the button front / back determination can be performed more preferably.

請求項7記載の発明によれば、第1の撮像工程で得られた撮像画像の一部又は一部を加工した画像を用いてボタンの表裏の判定を行う。例えば、ボタンの表又は裏を判定するのに十分な視覚的差異がボタンの一部に含まれている場合は、第1の撮像工程で撮像した画像から当該一部の撮像画像を得て、第2の撮像工程で得られた撮像画像に当該一部に対応する部分が含まれるかどうかを判別すればよい。従って、ボタン全体を撮像画像に含める場合に比して表裏判定のために必要な撮像画像の面積を小さくすることが可能となる。よって、第1の撮像工程の撮像画像と第2の撮像工程の撮像画像との比較処理に要する時間を短縮でき、より好適にボタンの表裏判定を行える。
また、ボタンは縫い付けのためのボタン穴を有する場合が多い。ボタン穴はボタンの向きによってその位置関係を変ずるので、ボタン穴の位置関係の差異が撮像画像に写ったボタンの差異となって現れる。よって、第1の撮像工程で得られたボタンの撮像画像と第2の撮像工程で得られたボタンの撮像画像との間でボタン穴の位置関係に差異があった場合、同種のボタンかつ当該ボタンの同じ面が撮像されていた場合であっても、表裏判定の比較処理においてボタン穴の位置関係の差異によって異なる面(あるいは異なるボタン)と判定されてしまう可能性がある。このとき、例えばボタン穴を塞ぐ加工を各撮像画像に施すことによって、ボタン穴の位置関係の差異による比較処理の誤判定を防止することが可能となる。よって、より好適にボタンの表裏判定を行える。また、画像の加工以外にも、ボタン穴を含まないボタンの一部の画像を用いてボタンの表裏判定を行うことによっても同様の効果が得られる。
According to the seventh aspect of the present invention, the front and back of the button is determined using an image obtained by processing a part or part of the captured image obtained in the first imaging step. For example, if a part of the button contains a visual difference sufficient to determine the front or back of the button, obtain the part of the captured image from the image captured in the first imaging step, What is necessary is just to discriminate | determine whether the part corresponding to the said part is contained in the captured image obtained at the 2nd imaging process. Therefore, it is possible to reduce the area of the captured image necessary for front / back determination as compared with the case where the entire button is included in the captured image. Therefore, the time required for the comparison process between the captured image of the first imaging process and the captured image of the second imaging process can be shortened, and the button front / back determination can be performed more preferably.
Further, the button often has a button hole for sewing. Since the positional relationship of the button hole changes depending on the direction of the button, the difference in the positional relationship between the button holes appears as the difference in the buttons shown in the captured image. Therefore, when there is a difference in the positional relationship of the button holes between the captured image of the button obtained in the first imaging process and the captured image of the button obtained in the second imaging process, Even when the same surface of the button is imaged, there is a possibility that it is determined as a different surface (or a different button) due to the difference in the positional relationship between the button holes in the comparison process of front and back determination. At this time, for example, by applying processing for closing the button hole to each captured image, it is possible to prevent erroneous determination of the comparison process due to the difference in the positional relationship between the button holes. Therefore, the front / back determination of the button can be performed more preferably. In addition to the processing of the image, the same effect can be obtained by determining the front and back of the button using a partial image of the button that does not include the button hole.

(発明の全体構成)
以下、図を参照して本発明の実施の形態を詳細に説明する。
本発明によるボタンの表裏判定方法は、ボタン付けミシンのボタン供給装置によって供給されるボタンの表裏を判定する方法である。ボタンの表裏判定は、ボタン供給装置がボタン付けミシンにおいて被縫製物の近傍でボタンを保持するボタン保持部にボタンを搬送するよりも前に行われる。これによって、ボタン保持部には所定の種類の、かつ、常に所定の向きのボタンが供給され、誤った種類のボタンや誤った向きのボタンが供給されることで縫い品質が低下することがなくなり、縫い品質が大幅に向上する。
図1は本発明によるボタンの表裏判定方法で用いるボタン画像認識装置1の主要構成を示すブロック図である。ボタン画像認識装置1は、表裏判定の基準となるボタンB1及び表裏判定を行う対象となるボタンB2を撮像するカメラ2と、ボタンB1、B2の撮像時に各ボタンを照らす照明3と、ボタン画像認識装置1の各種処理内容を表示するモニタ4と、ボタンB1、B2の画像からボタンB2の表裏を判定する画像処理装置10とを備える。なお、ボタンB1は「表又は裏の基準となるボタン」であり、ボタンB2は「表裏を判定する対象となるボタン」である。
(Overall structure of the invention)
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
The button front / back determination method according to the present invention is a method for determining the front / back of a button supplied by a button supply device of a button sewing machine. The front / back determination of the button is performed before the button supply device transports the button to the button holding unit that holds the button in the vicinity of the sewing product in the button sewing machine. As a result, buttons of a predetermined type and always in a predetermined direction are supplied to the button holding unit, and a wrong type of button or a button with an incorrect direction is supplied, so that the sewing quality does not deteriorate. , The sewing quality is greatly improved.
FIG. 1 is a block diagram showing a main configuration of a button image recognition apparatus 1 used in a button front / back determination method according to the present invention. The button image recognition apparatus 1 includes a button B1 that is a reference for front / back determination and a camera 2 that captures a button B2 that is a target for front / back determination, an illumination 3 that illuminates each button when the buttons B1 and B2 are captured, and button image recognition A monitor 4 that displays various processing contents of the apparatus 1 and an image processing apparatus 10 that determines the front and back of the button B2 from the images of the buttons B1 and B2 are provided. The button B1 is a “button serving as a reference for front or back”, and the button B2 is a “button for determining front / back”.

カメラ2は、ボタンB1,B2の上方からボタンB1,B2を含む範囲を1回の撮像で撮像可能となるよう設けられ、ボタンB1,B2を撮像してその撮像画像Gを画像処理装置10に入力する。なお、カメラ2によって入力される撮像画像Gはアナログ画像データであり、画像処理装置10に入力されるとA/Dコンバータ15(後述)によってデジタル画像データに変換される。
照明3は、ボタンB1の上方であってカメラ2によるボタンB1,B2の撮像範囲を遮らない位置に設けられ、少なくともカメラ2によるボタンB1,B2の撮像の際にボタンB1,B2に光を照射する。このとき、照明3はその照射光によるカメラ2の撮像画像Gの明暗がボタンB1,B2でほぼ同等となるよう設けられていることが望ましい。
モニタ4は、ボタン画像認識装置1の各種情報を表示する。その表示内容については後述する。
The camera 2 is provided so that the range including the buttons B1 and B2 from above the buttons B1 and B2 can be captured by one imaging, and the captured images G are captured in the image processing apparatus 10 by capturing the buttons B1 and B2. input. The captured image G input by the camera 2 is analog image data, and when it is input to the image processing apparatus 10, it is converted into digital image data by an A / D converter 15 (described later).
The illumination 3 is provided above the button B1 and at a position that does not block the imaging range of the buttons B1 and B2 by the camera 2, and at least when the buttons B1 and B2 are imaged by the camera 2, the buttons B1 and B2 are irradiated with light. To do. At this time, it is desirable that the illumination 3 is provided so that the brightness and darkness of the captured image G of the camera 2 by the irradiated light is substantially equal between the buttons B1 and B2.
The monitor 4 displays various information of the button image recognition device 1. The display contents will be described later.

画像処理装置10は、ボタン画像認識装置1の各部の制御に関する各種処理を行うCPU11と、CPU11によって呼び出される各種プログラム及びデータ等を書き換え不能に記憶するROM12と、CPU11の各種処理において一時的に生じる各種データの格納領域となるRAM13と、CPU11によって呼び出される各種プログラム及びデータ等を書き換え可能に記憶するEEPROM14と、カメラ2によって入力されたアナログ画像データをデジタル画像データに変換するA/Dコンバータ15と、を備えている。ROM12、RAM13,EEPROM14及びA/Dコンバータ15はバスを介してCPU11に接続されている。また、A/Dコンバータ15はカメラ2と接続されており、画像処理装置10に入力されたカメラ2の撮像画像GはまずA/Dコンバータ15に入力される。
CPU11は、ROM12又はEEPROM14から各種プログラム及びデータ等を呼び出して実行処理し、ボタン画像認識装置1の各部を制御する。特に、ROM12にはカメラ2によって撮像されたボタンB1,B2の撮像画像からボタンB2の表裏判定及び表裏判定に関る各種処理を行うための画像処理プログラム12aが記憶されている。なお、以降特に記載がない場合、ボタン画像認識装置1の各種動作制御はCPU11によるソフトウェア制御によって行われている。
A/Dコンバータ15は、カメラ2が撮像した撮像画像G(アナログ画像データ)をデジタル画像データに変換してCPU11に入力する。CPU11はデジタル画像データに変換された撮像画像GからボタンB2の表裏を判定する。なお、以後の記載においては特筆しない限り「撮像画像G」はカメラ2によって撮像された画像データ全般をいい、特にアナログ画像データとデジタル画像データの区別は行わない。
The image processing apparatus 10 is temporarily generated in the CPU 11 that performs various processes related to the control of each unit of the button image recognition apparatus 1, the ROM 12 that stores various programs and data called by the CPU 11 in an unrewritable manner, and the various processes of the CPU 11. A RAM 13 serving as a storage area for various data, an EEPROM 14 for storing various programs and data called by the CPU 11 in a rewritable manner, an A / D converter 15 for converting analog image data input by the camera 2 into digital image data, It is equipped with. The ROM 12, RAM 13, EEPROM 14, and A / D converter 15 are connected to the CPU 11 via a bus. The A / D converter 15 is connected to the camera 2, and the captured image G of the camera 2 input to the image processing apparatus 10 is first input to the A / D converter 15.
The CPU 11 calls and executes various programs and data from the ROM 12 or the EEPROM 14 and controls each part of the button image recognition apparatus 1. In particular, the ROM 12 stores an image processing program 12a for performing various processes related to front / back determination and front / back determination of the button B2 from the captured images of the buttons B1 and B2 captured by the camera 2. Note that, unless otherwise specified, various operation controls of the button image recognition device 1 are performed by software control by the CPU 11.
The A / D converter 15 converts a captured image G (analog image data) captured by the camera 2 into digital image data and inputs the digital image data to the CPU 11. The CPU 11 determines the front and back of the button B2 from the captured image G converted to digital image data. In the following description, unless otherwise specified, “captured image G” refers to all image data captured by the camera 2, and analog image data and digital image data are not particularly distinguished.

次に、ボタンB1、B2について詳説する。図2はボタンB1(B2)の表面及び裏面を示す説明図である。図2(a)はボタンB1(B2)の表面を、図2(b)はボタンB1(B2)の裏面を示す。
ボタンB1は、その一方の面(例えば表面)がカメラ2側つまり上方に、他方の面(例えば裏面)がボタンB1が配置される面側つまり下方となるよう配置される。ボタンB1はオペレータの手によってカメラ2の下方の所定位置となるよう配置され、配置後にその位置が変わることはない。
ボタンB2は、ボタン供給装置(図示略)が備える図示しないボタン搬送部(例えばボタンB2を図2の上下方向に沿って搬送するベルトコンベヤ等)によってカメラ2の下方を通るよう搬送されている。なお、ボタンB2はボタン供給装置によってボタン付けミシン(図示略)のボタン保持部(図示略)に逐次供給される縫いつけ用ボタンであり、ボタン搬送部はボタン保持部に供給される前の複数のボタンが蓄積されているボタン蓄積部(図示略)から一つずつボタンB2をカメラ2の下方を通るよう搬送する。つまり、ボタンB2は特定のひとつのボタンではなく逐次搬送される複数のボタンのうちの一つである。つまり、ボタン画像認識装置1はカメラ2の下方に据え置かれたボタンB1を基準としてボタン付けミシンに逐次供給されるボタンB2の表裏を判定する装置である。
Next, the buttons B1 and B2 will be described in detail. FIG. 2 is an explanatory diagram showing the front and back surfaces of the button B1 (B2). 2A shows the front surface of the button B1 (B2), and FIG. 2B shows the back surface of the button B1 (B2).
The button B1 is disposed such that one surface (for example, the front surface) is on the camera 2 side, that is, above, and the other surface (for example, the back surface) is on the surface side, that is, the bottom surface on which the button B1 is disposed. The button B1 is arranged at a predetermined position below the camera 2 by the operator's hand, and the position does not change after the arrangement.
The button B2 is conveyed so as to pass below the camera 2 by a button conveying unit (not shown) provided in a button supply device (not shown) (for example, a belt conveyor that conveys the button B2 along the vertical direction in FIG. 2). The button B2 is a sewing button that is sequentially supplied to a button holding unit (not shown) of a button sewing machine (not shown) by a button supply device, and the button transport unit has a plurality of buttons before being supplied to the button holding unit. The buttons B2 are conveyed one by one from the button accumulation unit (not shown) in which the buttons are accumulated so as to pass under the camera 2. That is, the button B2 is not one specific button but one of a plurality of buttons that are sequentially conveyed. That is, the button image recognition device 1 is a device that determines the front and back of the button B2 that is sequentially supplied to the button sewing machine with the button B1 placed below the camera 2 as a reference.

なお、ボタンB1とボタンB2とは同種のボタンである。従って、ボタンB1とボタンB2との表裏及び穴の位置関係が一致する場合、カメラ2に撮像されるボタンB1とボタンB2とはほぼ同種のボタンとして写る。また、図1に示すように、ボタンB1,B2はその側方から見た場合には表面が直線状となり、裏面はなだらかな楕円の半円状となる形状である。また、図2(a)に示すように、ボタンB1(B2)の表面には凹部Cが設けられており、カメラ2によって上方から撮像された場合、表面が上向きの場合には凹部の内外の段差によるコントラストC1が生じる。一方、図2(b)に示すように、裏面が上向きの場合には段差CがないのでコントラストC1は生じない。つまり、ボタンB1、B2は上方または側方からの撮像画像Gに写った当該ボタンの形状から表裏のいずれが上向き(あるいは下向き)であるかを認識可能となっている。
また、ボタン搬送部によって搬送されるボタンB2の向きは一定しない。例えば、図2に示すボタンB2はボタンB1と同様に一方の面(例えば表面)が上方となっているが、他方の面(例えば裏面)が上方となることもある。また、ボタン穴の位置関係も図2に示すボタンB2のようになるとは限らず、ボタンB1のボタン穴の配置に対して傾いていることもある。
Note that the button B1 and the button B2 are the same type of buttons. Therefore, when the front / back and hole positional relationship between the button B1 and the button B2 match, the button B1 and the button B2 captured by the camera 2 appear as substantially the same type of buttons. Further, as shown in FIG. 1, the buttons B1 and B2 have a shape in which the front surface is linear when viewed from the side, and the back surface is a gentle elliptical semicircle. Further, as shown in FIG. 2A, a recess C is provided on the surface of the button B1 (B2), and when the image is taken from above by the camera 2, the inside and outside of the recess are formed when the surface is upward. Contrast C1 due to the level difference occurs. On the other hand, as shown in FIG. 2 (b), when the back surface is upward, there is no step C and no contrast C1 occurs. That is, the buttons B1 and B2 can recognize which of the front and back faces is upward (or downward) from the shape of the button shown in the captured image G from above or from the side.
Further, the direction of the button B2 transported by the button transport unit is not constant. For example, the button B2 shown in FIG. 2 has one surface (for example, the front surface) upward like the button B1, but the other surface (for example, the back surface) may be upward. Further, the positional relationship of the button holes is not necessarily the same as that of the button B2 shown in FIG. 2, and may be inclined with respect to the arrangement of the button holes of the button B1.

(ボタン画像認識装置の動作)
次に、ボタン画像認識装置1の動作における各工程について詳説する。図3はボタン画像認識装置1の動作を示すフローチャートである。
図3に示すように、ボタン画像認識装置1は、カメラ2によってボタンB1,B2を撮像するボタン撮像工程(ステップS1)、ボタン撮像工程で得られた撮像画像Gの画質を改善するためノイズ除去などの各種処理を行う画質改善工程(ステップS2)、画質改善後の撮像画像GからボタンB2の表裏を判定する表裏判定工程(ステップS3)、ボタンB2の表裏判定の結果通知をモニタ4による表示等によって行う結果通知工程(ステップS4)を順次行う。以下、工程順に詳説する。なお、ステップS2〜S4の各工程はCPU11がROM12の画像処理プログラム12aを呼び出して実行処理することで行われる。
(Operation of button image recognition device)
Next, each step in the operation of the button image recognition apparatus 1 will be described in detail. FIG. 3 is a flowchart showing the operation of the button image recognition apparatus 1.
As shown in FIG. 3, the button image recognition apparatus 1 performs noise removal to improve the image quality of the captured image G obtained by the button imaging process (step S1) and the button imaging process in which the camera 2 captures the buttons B1 and B2. An image quality improvement process (step S2) for performing various processes such as, a front / back determination process for determining the front / back of the button B2 from the captured image G after the image quality improvement (step S3), and a notification of the result of the front / back determination of the button B2 are displayed on the monitor 4 The result notification process (step S4) performed by the above is sequentially performed. Hereinafter, it explains in full order of a process. In addition, each process of step S2-S4 is performed when CPU11 calls the image processing program 12a of ROM12 and performs an execution process.

(ボタン撮像工程)
まず、ステップS1のボタン撮像工程について詳説する。図4はカメラ2によるボタンB1、B2の撮像画像Gを示す説明図である。
ボタン搬送部によって搬送されるボタンB2のうちひとつがカメラ2の撮像範囲内に入り、かつ、図4に示す撮像画像Gの左右方向にボタンB2がボタンB1と並ぶよう位置したときにカメラ2によって撮像される。つまり、「表又は裏の基準となるボタン」であるボタンB1と、「表裏を判定する対象となるボタン」であるボタンB2とは同時に撮像されている。よって、表又は裏の基準となるボタンB1を撮像する「第1の撮像工程」と、表裏を判定する対象となるボタンB2を撮像する「第2の撮像工程」は同時に行われている。ボタンB2の位置は図示しないセンサー等によって検知され、CPU11は当該センサー等による入力に基づいてカメラ2を動作させることで撮像工程を行う。当該撮像工程によって得られた撮像画像Gは図4に示すようにボタンB1とボタンB2とがほぼ横並びに写る画像となる。また、このとき、横並びに並んだボタンB1とボタンB2のそれぞれの照明3に対する距離はほぼ同一となる。撮像画像Gは画像処理装置10に入力され、A/Dコンバータ15によってデジタル画像データに変換されてCPU11に入力される。なお、以後の工程においては当該デジタル画像データを「撮像画像G」と記載する。
なお、カメラ2の撮像範囲とボタンB1,B2との位置関係は、図4に示すように、ボタンB1とボタンB2との間に位置してカメラ2の撮像範囲を二分する中間線Pの位置がボタンB1とボタンB2とのほぼ中間位置となることが望ましい。また、ボタン撮像工程完了時にCPU11は入力された撮像画像Gをモニタ4に出力してもよい。
(Button imaging process)
First, the button imaging process in step S1 will be described in detail. FIG. 4 is an explanatory diagram showing captured images G of the buttons B 1 and B 2 by the camera 2.
When one of the buttons B2 conveyed by the button conveying unit is within the imaging range of the camera 2 and the button B2 is positioned so as to be aligned with the button B1 in the left-right direction of the captured image G shown in FIG. Imaged. That is, the button B1 which is a “button serving as a front or back reference” and the button B2 which is a “button which is a target for determining front and back” are simultaneously imaged. Therefore, the “first imaging process” for imaging the button B1 serving as the front or back reference and the “second imaging process” for imaging the button B2 that is the target for determining the front and back are performed simultaneously. The position of the button B2 is detected by a sensor (not shown) or the like, and the CPU 11 performs an imaging process by operating the camera 2 based on an input from the sensor or the like. The captured image G obtained by the imaging process is an image in which the button B1 and the button B2 are substantially side by side as shown in FIG. At this time, the distances of the buttons B1 and B2 arranged side by side with respect to the respective illuminations 3 are substantially the same. The captured image G is input to the image processing apparatus 10, converted into digital image data by the A / D converter 15, and input to the CPU 11. In the subsequent steps, the digital image data is referred to as “captured image G”.
As shown in FIG. 4, the positional relationship between the imaging range of the camera 2 and the buttons B1 and B2 is the position of the intermediate line P that is located between the button B1 and the button B2 and bisects the imaging range of the camera 2. It is desirable that the position is substantially in the middle between the button B1 and the button B2. Further, the CPU 11 may output the input captured image G to the monitor 4 when the button imaging process is completed.

(画質改善工程)
次に、ステップS2の画質改善工程について詳説する。画質改善工程では、CPU11はA/Dコンバータ15から入力された撮像画像Gに対してノイズ除去処理(例えばフィルタ処理等)を行う。当該ノイズ除去処理の詳細は周知のノイズ除去処理と同様であるのでその詳細は省略する。ノイズ除去処理後、CPU11は当該デジタル画像データをRAM13に格納する。
(Image quality improvement process)
Next, the image quality improving process in step S2 will be described in detail. In the image quality improvement process, the CPU 11 performs noise removal processing (for example, filter processing) on the captured image G input from the A / D converter 15. The details of the noise removal processing are the same as the known noise removal processing, and thus the details are omitted. After the noise removal process, the CPU 11 stores the digital image data in the RAM 13.

(表裏判定工程)
次に、ステップS3の表裏判定工程について詳説する。表裏判定工程は、撮像画像Gに写ったボタンB1を含む画像領域に基づくパターンマッチングをボタンB2が写った画像領域に対して行う。
図5はパターンマッチングの仕組みを示す説明図である。
パターンマッチングを行う場合、まずCPU11は撮像画像Gに対してボタンB1を含む画像領域P1とボタンB2を含む画像領域P2とに分割する処理(画像分割)を行う。画像分割は、上述の中間線Pを境に撮像画像Gを二分することで行われる。
次に、CPU11は画像領域P1に対して輪郭検出処理を行ってボタンB1が写っている画像領域を割り出し、ボタンB1とその周囲を含むテンプレート画像領域T1を設定し、テンプレート画像領域T1内の画素数及び画素の明暗あるいは色分布に関する情報を取得してRAM13に格納する処理(テンプレート画像領域取得)を行う。
次に、CPU11は画像領域P2に対して輪郭検出処理を行ってボタンB2が写っている画像領域を割り出し、ボタンB2とその周囲を含む判定画像領域T2を設定し、判定画像領域T2内の画素数及び画素の明暗あるいは色分布に関する情報を取得してRAM13に格納する処理(判定画像領域取得)を行う。このとき、判定画像領域T2の縦横の画素数は少なくともテンプレート画像領域T1以上となるように設定する。
(Front and back judgment process)
Next, the front / back determination process in step S3 will be described in detail. In the front / back determination step, pattern matching based on the image region including the button B1 captured in the captured image G is performed on the image region including the button B2.
FIG. 5 is an explanatory diagram showing the mechanism of pattern matching.
When performing pattern matching, first, the CPU 11 performs processing (image division) for dividing the captured image G into an image region P1 including the button B1 and an image region P2 including the button B2. The image division is performed by dividing the captured image G by the above-described intermediate line P as a boundary.
Next, the CPU 11 performs a contour detection process on the image area P1 to determine an image area in which the button B1 is shown, sets a button B1 and a template image area T1 including the periphery thereof, and sets pixels in the template image area T1. A process (template image area acquisition) of acquiring information on the number and brightness or color distribution of pixels and storing it in the RAM 13 is performed.
Next, the CPU 11 performs contour detection processing on the image area P2 to determine an image area in which the button B2 is reflected, sets a determination image area T2 including the button B2 and its surroundings, and pixels in the determination image area T2 A process of acquiring information related to the number and brightness or color distribution of the pixels and storing them in the RAM 13 (acquisition of determination image area) is performed. At this time, the determination image region T2 is set so that the number of vertical and horizontal pixels is at least equal to or greater than the template image region T1.

次に、CPU11はテンプレート画像領域T1と判定画像領域T2の画素の明暗あるいは色分布に関する情報から類似度の判定(パターンマッチング)を行う。この判定は、判定画像領域T2からテンプレート画像領域T1と同じ縦横の画素数の領域を逐次抜粋して判定する逐次処理により行う。
なお、「逐次処理」とは、まず判定対象となる画像領域(判定画像領域T2)の左上端から比較元となる画像領域(テンプレート画像領域T1)と同じ縦横の画素数となる画像領域の画素の明暗あるいは色分布に関する情報のみをテンプレート画像領域T1と比較判定して類似度を算出する。図5は、このようすをイメージで示しており、判定画像領域T2に破線で示すテンプレート画像領域T1を左上端が一致するように重ねた状態で、テンプレート画像領域T1と重なる位置の判定画像領域T2の画素の情報が各画素毎に全て比較される。次に、判定対象となる画像領域の右に1画素分ずれた位置から比較元となる画像領域と同じ縦横の画像領域について判定をし、その後さらに右に1画素分ずれた位置から…といったように、左上端から順に1画素づつずらして判定する。左右方向に比較元となる画像領域分の画素がなくなるほど右にずれた位置となった場合、次は下方向に1画素ずれた位置であってその左端の画素から比較元となる画像領域と同じ縦横の画像領域に対して行い、以後は右に1画素ずつずらしていく。つまり、判定対象となる画像領域内を比較元となる画像領域を順次ずらしながら重なる部分の類似度を算出する処理を行う。
上述のパターンマッチングにおいて、類似度が所定の閾値以上となった場合、ボタンB2はボタンB1と同種であると判定される。つまり、ボタンB2はボタンB1と同様に一方の面(例えば表面)が上向きとなっていると判定される。一方、類似度が所定の閾値未満となった場合、ボタンB2はボタンB1と異なると判定される。つまり、ボタンB2はボタンB1と異なり他方の面(例えば裏面)が上向きとなっていると判定される。あるいは、ボタン付けミシンのボタン保持部に逐次供給される複数のボタンの中にボタンB1と異なる種類のボタンが混入していた場合、当該異なる種類のボタンが撮像された場合にもやはり類似度が閾値未満となる可能性が高いので、ボタンB2はボタンB1と異なると判定される。なお、所定の閾値はEEPROM14に記憶されている。
Next, the CPU 11 performs similarity determination (pattern matching) based on information about the brightness or color distribution of the pixels in the template image region T1 and the determination image region T2. This determination is performed by sequential processing in which a region having the same number of vertical and horizontal pixels as the template image region T1 is sequentially extracted and determined from the determination image region T2.
Note that “sequential processing” refers to pixels in an image area having the same number of vertical and horizontal pixels as the comparison source image area (template image area T1) from the upper left end of the determination target image area (determination image area T2). Only the information relating to the light and dark or color distribution is compared with the template image region T1, and the similarity is calculated. FIG. 5 shows this in an image, and a determination image region T2 at a position overlapping with the template image region T1 in a state where the template image region T1 indicated by a broken line is overlapped with the determination image region T2 so that the upper left ends coincide with each other. All the pixel information is compared for each pixel. Next, a determination is made for an image area having the same height and width as the comparison source image area from a position shifted by one pixel to the right of the image area to be determined, and then from a position shifted by one pixel to the right. Next, the determination is made by shifting one pixel at a time from the upper left end. If the position is shifted to the right so that there are no more pixels in the image area to be compared in the left-right direction, the next position is a position shifted by one pixel in the downward direction and the image area to be compared from the leftmost pixel. This is performed on the same vertical and horizontal image areas, and thereafter, the pixels are shifted to the right by one pixel. That is, a process of calculating the similarity of overlapping portions while sequentially shifting the image area to be compared within the image area to be determined.
In the above-described pattern matching, when the similarity is equal to or greater than a predetermined threshold, the button B2 is determined to be the same type as the button B1. That is, it is determined that one surface (for example, the front surface) of the button B2 is facing upward, like the button B1. On the other hand, when the similarity is less than the predetermined threshold, it is determined that the button B2 is different from the button B1. That is, unlike the button B1, the button B2 is determined to have the other surface (for example, the back surface) facing upward. Alternatively, when a button of a different type from the button B1 is mixed in a plurality of buttons sequentially supplied to the button holding unit of the button-attached sewing machine, the similarity is also obtained when the different type of button is imaged. Since there is a high possibility of being less than the threshold value, it is determined that the button B2 is different from the button B1. The predetermined threshold value is stored in the EEPROM 14.

なお、パターンマッチングは、上述の逐次処理において類似度が所定の閾値以上となった時点でボタンB1とボタンB2とが同種であると判定してパターンマッチングを終了してもよいし、判定対象となる画像領域の左上端から右下端まで逐次処理を完了させて、その中で最大の類似度と所定の閾値とを比較してもよい。前者の場合、閾値が一定以上となった時点でパターンマッチングが終了するので比較的当該処理が早く終了できる。後者の場合、類似度と所定の閾値との比較処理が1回で済む。以下、図6及び図7を用いて上述の2通りの処理について詳説する。
まず、表裏判定工程において、パターンマッチングで類似度が所定の閾値以上となった時点で処理を終了する場合を示すフローチャートを図6に示す。まずCPU11は上述の画像分割(ステップS11)、テンプレート画像領域取得(ステップS12)、判定画像領域取得(ステップS13)を順次行い、その後判定対象となる画像領域T2の左上端の画素から順にテンプレート画像領域T1を重ねた状態で比較するパターンマッチングの逐次処理を行う(ステップS14)。なお、ステップS14における逐次処理は、逐次処理全体のうち判定画像領域T2内のある位置にテンプレート画像領域T1が重ねられた状態でのテンプレート画像領域T1の全画素分の比較処理1回の類似度算出処理を指す。次にCPU11はステップS14で得られた類似度が所定の閾値未満であるかどうか判定し(ステップS15)、類似度が閾値未満でない場合即ち類似度が閾値以上となった場合(ステップS15:NO)、ボタンB2はボタンB1と同種かつ同じ向きであると判定される(ステップS16)。一方、ステップS15で類似度が閾値未満だった場合(ステップS15:YES)、CPU11は判定画像領域T2の右下端まで逐次処理が終了したか判定する(ステップS17)。逐次処理が右下端まで終了した場合(ステップS17:YES)、ボタンB2はボタンB1と異なる面が上向きあるいはボタンB1とは異なるボタンであると判定する(ステップS18)。逐次処理が右下端まで終了していない場合(ステップS17:NO)、ステップS14に戻りテンプレート画像領域T1を次の位置にずらして逐次処理を実行する。
In the pattern matching, the pattern matching may be terminated by determining that the button B1 and the button B2 are of the same type when the similarity is equal to or higher than a predetermined threshold in the sequential processing described above. The processing may be completed sequentially from the upper left corner to the lower right corner of the image area, and the maximum similarity may be compared with a predetermined threshold value. In the former case, since the pattern matching ends when the threshold value becomes a certain level or more, the processing can be ended relatively quickly. In the latter case, the comparison process between the similarity and the predetermined threshold value is only required once. Hereinafter, the above-described two processes will be described in detail with reference to FIGS. 6 and 7.
First, FIG. 6 is a flowchart showing a case where the process is terminated when the similarity is equal to or higher than a predetermined threshold in the pattern matching in the front / back determination step. First, the CPU 11 sequentially performs the above-described image division (step S11), template image area acquisition (step S12), and determination image area acquisition (step S13), and then the template image in order from the upper left pixel of the image area T2 to be determined. Pattern matching sequential processing is performed for comparison in a state where the regions T1 are overlapped (step S14). Note that the sequential processing in step S14 is a degree of similarity of one comparison processing for all the pixels in the template image region T1 in a state where the template image region T1 is superimposed at a position in the determination image region T2 in the entire sequential processing. Refers to calculation processing. Next, the CPU 11 determines whether or not the similarity obtained in step S14 is less than a predetermined threshold (step S15), and if the similarity is not less than the threshold, that is, if the similarity is greater than or equal to the threshold (step S15: NO). ), It is determined that the button B2 is the same kind and the same direction as the button B1 (step S16). On the other hand, if the similarity is less than the threshold value in step S15 (step S15: YES), the CPU 11 determines whether the sequential processing has been completed up to the lower right end of the determination image region T2 (step S17). When the sequential processing is completed up to the lower right corner (step S17: YES), it is determined that the button B2 is a button whose face is different from the button B1 or is different from the button B1 (step S18). If the sequential processing has not been completed up to the lower right corner (step S17: NO), the process returns to step S14 and the sequential processing is executed by shifting the template image region T1 to the next position.

次に、最大の類似度と所定の閾値との比較を行う場合を示すフローチャートを図7に示す。なお、ステップS11〜S14は上述に示す処理と同様なので詳説を省略する。
ステップS14の処理の後、CPU11はステップS14で得られた類似度がそれまで現在の判定対称ボタンB2で得られた最大の類似度を越えるかどうか判定する(ステップS21)。超えた場合(ステップS21:YES)、ステップS14で得られた類似度を現在のボタンB2における当該パターンマッチングの最大類似度としてRAM13に格納し(ステップS22)、判定画像領域T2の右下端まで逐次処理が終了したか判定する(ステップS23)。一方、ステップS14で得られた類似度がそれまでの最大の類似度を超えていなかった場合(ステップS21:NO)、ステップS23へと移行する。
ステップS23において、逐次処理が右下端まで終了した場合(ステップS23:YES)、CPU11はRAM13に格納された当該パターンマッチングの最大類似度が所定の閾値未満かどうか判定する(ステップS24)。類似度が閾値未満でない場合即ち類似度が閾値以上となった場合(ステップS24:NO)、ボタンB2はボタンB1と同種かつ同じ向きであると判定される(ステップS25)。一方、ステップS15で類似度が閾値未満だった場合(ステップS24:YES)、ボタンB2はボタンB1と異なる面が上向きあるいはボタンB1とは異なるボタンであると判定する(ステップS26)。また、ステップS23において逐次処理が右下端まで終了していない場合(ステップS23:NO)、ステップS14に戻る。
Next, FIG. 7 shows a flowchart showing a case where the maximum similarity is compared with a predetermined threshold. Since steps S11 to S14 are the same as the above-described processes, detailed description thereof is omitted.
After the process in step S14, the CPU 11 determines whether the similarity obtained in step S14 exceeds the maximum similarity obtained with the current determination symmetry button B2 (step S21). If exceeded (step S21: YES), the similarity obtained in step S14 is stored in the RAM 13 as the maximum similarity of the pattern matching in the current button B2 (step S22), and sequentially to the lower right end of the determination image region T2. It is determined whether the process has been completed (step S23). On the other hand, when the similarity obtained in step S14 does not exceed the maximum similarity so far (step S21: NO), the process proceeds to step S23.
In step S23, when the sequential processing is completed to the lower right end (step S23: YES), the CPU 11 determines whether or not the maximum similarity of the pattern matching stored in the RAM 13 is less than a predetermined threshold (step S24). If the similarity is not less than the threshold, that is, if the similarity is greater than or equal to the threshold (step S24: NO), the button B2 is determined to be the same type and in the same direction as the button B1 (step S25). On the other hand, if the degree of similarity is less than the threshold value in step S15 (step S24: YES), it is determined that the button B2 is a button that faces upward from the button B1 or is different from the button B1 (step S26). If the sequential processing has not been completed to the lower right end in step S23 (step S23: NO), the process returns to step S14.

なお、パターンマッチングで類似度が所定の閾値以上となった時点で処理を終了するか、最大の類似度と所定の閾値とを比較するかの選択は、図示しない設定スイッチを操作することで選択可能となっている。
また、上述の判定画像領域取得(ステップS13)を省略して画像領域P2全体に対してテンプレート画像領域T1によるパターンマッチングを行ってもよい。その場合、上述の図6及び図7を用いた説明における「判定画像領域T2」は「画像領域P2」と読み替える。
The selection of whether to end the process when the similarity reaches or exceeds the predetermined threshold in pattern matching or to compare the maximum similarity with the predetermined threshold is made by operating a setting switch (not shown). It is possible.
Alternatively, the above-described determination image region acquisition (step S13) may be omitted, and pattern matching using the template image region T1 may be performed on the entire image region P2. In this case, “determination image region T2” in the description using FIGS. 6 and 7 described above is read as “image region P2”.

(結果通知工程)
次に、図3のステップS4に示す結果通知工程について詳説する。結果通知工程では、CPU11はボタンB2の表裏判定の結果をモニタ4に表示する。
なお、本実施の形態では結果通知をモニタ4による表示で行っているが、他の表示手段や報知手段によってもよい。例えば、ボタンB2がボタンB1と異なる面が上向きあるいはボタンB1とは異なるボタンであると判定された場合にはブザーを鳴らしてオペレータに知らせるようにしてもよい。
(Result notification process)
Next, the result notification process shown in step S4 of FIG. 3 will be described in detail. In the result notifying step, the CPU 11 displays the result of the front / back determination of the button B2 on the monitor 4.
In the present embodiment, the result notification is performed by display on the monitor 4, but other display means or notification means may be used. For example, when it is determined that the surface of the button B2 is different from the button B1 or is different from the button B1, a buzzer may be sounded to notify the operator.

なお、表裏判定工程においてボタンB2がボタンB1と異なる面が上向きあるいはボタンB1とは異なるボタンであると判定された場合、CPU11はボタン搬送部の動作を停止させて当該ボタンB2がボタン付けミシンのボタン保持部に供給されないようにするための判定信号を出力してもよい。また、ボタンB2がボタンB1と異なる面が上向きあるいはボタンB1とは異なるボタンであると判定された場合に当該ボタンB2を自動的にふるい落としてボタン保持部に搬送させない構成を設け、ボタン保持部に供給されるボタンがボタンB1と同種かつ同種の向きであるボタンB2のみとなるように判定結果に基づく判定信号を出力してもよい。   If it is determined in the front / back determination step that the button B2 is a button whose face is different from the button B1 or is different from the button B1, the CPU 11 stops the operation of the button transport unit and the button B2 is a button-attached sewing machine. A determination signal for preventing the button from being supplied to the button holding unit may be output. In addition, when it is determined that the surface of the button B2 is different from the button B1 or the button B1 is different from the button B1, the button B2 is automatically screened and not transferred to the button holding unit. A determination signal based on the determination result may be output so that the button to be supplied is only the button B2 having the same kind and the same direction as the button B1.

(ボタン画像認識装置の動作)
ボタン画像認識装置1は、ボタンB2が一つずつ搬送されてボタンB1とほぼ横並びに位置し、かつボタンB1、B2が共にカメラ2の撮像範囲内となる度に上述の図3に示すステップS1〜S4の処理を行う。つまり、ステップS1のボタン撮像工程におけるボタンB1、B2の撮像はボタンB2が入れ替わる度に毎回行われる。従って、表又は裏の基準となるボタンB1を撮像する「第1の撮像工程」は、表裏を判定する対象となるボタンB2を撮像する「第2の撮像工程」が行われるのと同時に毎回行われる。
また、ステップS3の表裏判定処理は、上述の図5又は図7に示すフローチャートに従って、設定スイッチによって設定された側の処理が行われる。
(Operation of button image recognition device)
Step S1 shown in FIG. 3 described above is performed each time the button image recognition device 1 is transported one by one, and is positioned side by side with the button B1, and the buttons B1 and B2 are both within the imaging range of the camera 2. Processes S4 to S4 are performed. That is, the imaging of the buttons B1 and B2 in the button imaging process in step S1 is performed every time the button B2 is replaced. Therefore, the “first imaging process” for imaging the front or back button B1 is performed every time the “second imaging process” for imaging the front / back button B2 is performed. Is called.
Further, the front / back determination processing in step S3 is performed on the side set by the setting switch according to the flowchart shown in FIG. 5 or FIG.

(作用効果)
上述の実施の形態によれば、ボタン撮像工程にてボタンB1を撮像する「第1の撮像工程」とボタンB2を撮像する「第2の撮像工程」とを同時に行う。よって、表裏を判定したいボタンB2の判定元画像となるテンプレート画像領域T1に相当する画像があらかじめボタン画像認識装置1のROM12又はEEPROM14に記憶されていなくてもよく、表裏を判定したいボタンB2の撮像と同様の要領でボタンB1の撮像を行えば事足りる。
また、第1の撮像工程は第2の撮像工程と同時に行うので、ボタンB1,B2に対する照明3の光の照射の具合をほぼ同様とすることで、テンプレート画像領域T1と判定画像領域T2又はボタンB2を含む画像領域P2の照明等の条件を同様にすることが可能となる。従って、判定元画像を撮像した際にボタンに照射されていた照明等の諸条件が変化すると、同種かつ表裏が正しい向きのボタンであっても画像の近似の度合いが一定以上とならずにエラーとなることがあるといった従来の問題点を解消することができ、より好適にボタンの表裏判定を行える。
(Function and effect)
According to the above-described embodiment, the “first imaging process” for imaging the button B1 and the “second imaging process” for imaging the button B2 are simultaneously performed in the button imaging process. Therefore, the image corresponding to the template image region T1 that is the determination source image of the button B2 for which the front and back are to be determined may not be stored in advance in the ROM 12 or the EEPROM 14 of the button image recognition apparatus 1, and the image of the button B2 for which the front and back are to be determined is captured. It is sufficient if the button B1 is imaged in the same manner as described above.
In addition, since the first imaging step is performed simultaneously with the second imaging step, the template image region T1 and the determination image region T2 or the button can be made by making the irradiation of the light of the illumination 3 to the buttons B1 and B2 substantially the same. It is possible to make the conditions such as illumination of the image region P2 including B2 the same. Therefore, if the conditions such as the illumination that was applied to the button when the judgment source image was captured change, even if the button is the same type and the front and back are in the correct orientation, the degree of image approximation does not exceed a certain level and an error occurs. Therefore, it is possible to eliminate the conventional problem that sometimes occurs, and it is possible to more suitably determine the front and back of the button.

さらに、カメラ2による撮像時にはボタンB1とボタンB2とが並んで配置される位置関係のときに撮像する。よって、各ボタンの撮像時の照明3の光の照射の具合をほぼ同一とすることが可能となる。従って、判定元画像を撮像した際にボタンに照射されていた照明等の諸条件が変化すると、同種かつ表裏が正しい向きのボタンであっても画像の近似の度合いが一定以上とならずにエラーとなることがあるといった従来の問題点を解消することができ、より好適にボタンの表裏判定を行える。
さらに、1台のカメラ2でボタンB1とボタンB2とを撮像するので、1台のカメラ2の動作制御によって第1の撮像工程と第2の撮像工程を同時に行える。従って、第1の撮像工程と第2の撮像工程とを個別に行う場合に比してその工程が短縮され、より円滑にボタンの表裏判定を行える。
Further, when the image is taken by the camera 2, the image is taken when the button B1 and the button B2 are arranged side by side. Therefore, it is possible to make the illumination state of the illumination 3 at the time of imaging each button substantially the same. Therefore, if the conditions such as the illumination that was applied to the button when the judgment source image was captured change, even if the button is the same type and the front and back are in the correct orientation, the degree of image approximation does not exceed a certain level and an error occurs. Therefore, it is possible to eliminate the conventional problem that sometimes occurs, and it is possible to more suitably determine the front and back of the button.
Furthermore, since the button B1 and the button B2 are imaged by one camera 2, the first imaging process and the second imaging process can be performed simultaneously by the operation control of one camera 2. Therefore, the process is shortened as compared with the case where the first imaging process and the second imaging process are performed separately, and the button front / back determination can be performed more smoothly.

さらに、ボタンB1の撮像は、ボタンB2が入れ替わる度に毎回行う。よって、各ボタンの照明条件等がほぼ同一となる。従って、判定元画像を撮像した際にボタンに照射されていた照明等の諸条件が変化すると、同種かつ表裏が正しい向きのボタンであっても画像の近似の度合いが一定以上とならずにエラーとなることがあるといった従来の問題点を解消することができ、より好適にボタンの表裏判定を行える。   Further, the imaging of the button B1 is performed every time the button B2 is replaced. Therefore, the illumination conditions and the like of each button are almost the same. Therefore, if the conditions such as the illumination that was applied to the button when the judgment source image was captured change, even if the button is the same type and the front and back are in the correct orientation, the degree of image approximation does not exceed a certain level and an error occurs. Therefore, it is possible to eliminate the conventional problem that sometimes occurs, and it is possible to more suitably determine the front and back of the button.

(その他)
なお、上述の実施の形態におけるボタン画像認識装置1では、カメラ2はボタンB1,B2の両方を含む1枚の撮像画像Gを撮像するよう設けられているが、他の形態を取ってもよい。以下、図8及び図9を用いて他の形態の例について詳説する。
例えば、カメラを2つ設けてもよい。図8は2つのカメラ2A,2Bを用いてボタンB1,B2を撮像する場合を示す説明図である。図8(a)はカメラ2A,2BとボタンB1,B2の配置の関係を、図8(b)はカメラ2Aによる撮像画像G1を、図8(c)はカメラ2Bによる撮像画像G2を示す。図8に示すように、2つのカメラ2A,2Bを用いてボタンB1,B2を撮像する場合、カメラ2Aでその撮像範囲にボタンB1を含む撮像画像G1を、カメラ2Bでその撮像範囲にボタンB2を含む撮像画像G2を撮像する。つまり、ボタンB1を撮像するカメラ2AとボタンB2を撮像するカメラ2Bとは異なるカメラとなる。この場合、ボタンB1とボタンB2を並べて配置しなくてもよくなり、ボタン画像認識装置の設計の自由度が高まる。なお、2つのカメラ2A,2Bを用いる場合、カメラ2Aの撮像画像G1の範囲からボタンB1を含むテンプレート画像領域T1を取得し、カメラ2Bの撮像画像G2の範囲又はカメラ2Bの撮像画像G2の範囲から取得されたボタンB2を含む判定画像領域T2に対してテンプレートマッチングを行う。この場合、上述の実施の形態の効果に加えて、一つのカメラ2で各ボタンを撮像する場合に比して、ボタンB1とボタンB2の配置関係の自由度が大幅に向上する。
(Other)
In the button image recognition apparatus 1 in the above-described embodiment, the camera 2 is provided so as to capture one captured image G including both the buttons B1 and B2, but may take other forms. . Hereinafter, another embodiment will be described in detail with reference to FIGS. 8 and 9.
For example, two cameras may be provided. FIG. 8 is an explanatory diagram showing a case where the buttons B1 and B2 are imaged using two cameras 2A and 2B. 8A shows the relationship between the arrangement of the cameras 2A and 2B and the buttons B1 and B2, FIG. 8B shows the captured image G1 by the camera 2A, and FIG. 8C shows the captured image G2 by the camera 2B. As shown in FIG. 8, when the buttons B1 and B2 are imaged using the two cameras 2A and 2B, the captured image G1 including the button B1 in the imaging range is displayed by the camera 2A, and the button B2 is displayed in the imaging range by the camera 2B. A captured image G2 including is captured. That is, the camera 2A that captures the button B1 and the camera 2B that captures the button B2 are different cameras. In this case, it is not necessary to arrange the button B1 and the button B2 side by side, and the degree of freedom in designing the button image recognition device is increased. When two cameras 2A and 2B are used, the template image region T1 including the button B1 is acquired from the range of the captured image G1 of the camera 2A, and the range of the captured image G2 of the camera 2B or the range of the captured image G2 of the camera 2B. Template matching is performed on the determination image region T2 including the button B2 acquired from the above. In this case, in addition to the effects of the above-described embodiment, the degree of freedom in the arrangement relationship between the button B1 and the button B2 is significantly improved as compared with the case where each button is imaged by one camera 2.

また、ボタンB1,B2の側方にカメラ2を設けて撮像してもよい。図9はボタンB1,B2の側方にカメラ2を設けた場合を示す説明図である。図9(a)はカメラ2とボタンB1,B2の配置の関係を、図9(b)はカメラ2による撮像画像G3を示す。図9(a)に示すように、ボタンB1,B2の側方にカメラを設けた場合、ボタンB1,B2は表又は裏面の面積よりもその側方の面積の方が小さいので、ボタンB1,B2を側方から撮像することで、上方から撮像する場合に比してテンプレート画像領域T1及び判定画像領域T2の画素数を小さくすることが可能となる。よって、テンプレートマッチングに要する時間を短縮でき、より好適にボタンの表裏判定を行える。
なお、2つのカメラ2A,2Bを用いてその一方がボタンB1を,他方がボタンB2を側方から撮像するようにしてもよい。この場合、さらに上述の異なるカメラを用いてボタンB1,B2を撮像する場合の効果も得られる。
Moreover, you may image by providing the camera 2 in the side of button B1, B2. FIG. 9 is an explanatory diagram showing a case where the camera 2 is provided on the side of the buttons B1 and B2. 9A shows the relationship between the arrangement of the camera 2 and the buttons B1 and B2, and FIG. 9B shows a captured image G3 taken by the camera 2. As shown in FIG. 9A, when the camera is provided on the side of the buttons B1 and B2, the area of the side of the buttons B1 and B2 is smaller than the area of the front or back surface. By capturing B2 from the side, it is possible to reduce the number of pixels in the template image region T1 and the determination image region T2 as compared to capturing from above. Therefore, the time required for template matching can be shortened, and button front / back determination can be performed more suitably.
Two cameras 2A and 2B may be used so that one of them captures the button B1 and the other captures the button B2 from the side. In this case, the effect obtained when the buttons B1 and B2 are captured using the different cameras described above can also be obtained.

また、カメラ2の撮像範囲にひとつのボタンが収まる配置としてもよい。この場合、逐次供給されるボタンB2がカメラ2によって撮像されることとなる。ただし、最初の1回目の画像撮像時にはボタン搬送部に手動でボタンB1を所定位置に置き、ボタンB1をカメラ2で撮像するようにする。このとき、ボタンB1は一方の面(例えば表面)を上向きにする。ボタンB1は逐次搬送されるボタンB2と同種であり、かつ、一方の面が上向きであるので、そのままボタン付けミシンのボタン保持部に供給してしまってもよいし、撮像後に取り除いてもよい。CPU11は、ボタンB1の撮像画像からボタンB1を含むテンプレート画像領域T1を取得し、RAM13に格納する。
その後、ボタンB2が逐次供給されるが、カメラ2はまずボタンB1の撮像後最初にボ撮像範囲に入ったボタンB2を撮像する。その後、CPU11は、RAM13に格納されたテンプレート画像領域T1によって、ボタンB2の撮像画像又はボタンB2の撮像画像の範囲から取得されたボタンB2を含む判定画像領域T2に対してテンプレートマッチングを行う。その結果、類似度が所定の閾値以上となってボタンB2がボタンB1と同種、かつ、ボタンB2の向きがボタンB1と同一であった場合には、CPU11は当該ボタンB2の判定画像領域T2をRAM13に格納して、その次に撮像されるボタンB2に対するテンプレート画像領域T1として用いる。つまり、ボタンB1を撮像した「第1の撮像工程」で得られた撮像画像からのテンプレート画像領域T1と、ボタンB2を撮像した「第2の撮像工程」で得られた撮像画像又はボタンB2の撮像画像の範囲から取得されたボタンB2を含む判定画像領域T2とが所定以上近似していた場合、当該第2の撮像工程で得られた撮像画像を次の第1の撮像工程の撮像画像とする。このとき、テンプレート画像領域T1とボタンB2の撮像領域全体とのパターンマッチングを行っていた場合は、ボタンB2の画像領域に対して輪郭検出処理等を行ってボタンB2の撮像領域からテンプレート画像領域T1として用いるための画像領域決定処理を行う必要がある。また、ボタンB2が所定以上近似していなかった場合は、その時の第1の撮像工程の撮像画像によるテンプレート画像領域T1を次のボタンB2の表裏判定に引き続き用いる。
Alternatively, an arrangement in which one button fits in the imaging range of the camera 2 may be adopted. In this case, the sequentially supplied button B2 is imaged by the camera 2. However, when the first image is captured, the button B1 is manually placed at a predetermined position on the button transport unit, and the button B1 is captured by the camera 2. At this time, the button B1 faces one side (for example, the front side) upward. Since the button B1 is the same type as the sequentially transported button B2 and one side faces upward, the button B1 may be supplied to the button holding unit of the buttoned sewing machine as it is or may be removed after imaging. The CPU 11 acquires a template image region T1 including the button B1 from the captured image of the button B1, and stores it in the RAM 13.
After that, the button B2 is sequentially supplied, but the camera 2 first images the button B2 that first enters the button imaging range after the button B1 is imaged. Thereafter, the CPU 11 performs template matching on the determination image region T2 including the button B2 acquired from the captured image of the button B2 or the range of the captured image of the button B2 by using the template image region T1 stored in the RAM 13. As a result, when the similarity is equal to or greater than a predetermined threshold value and the button B2 is the same type as the button B1 and the direction of the button B2 is the same as the button B1, the CPU 11 sets the determination image region T2 of the button B2 It is stored in the RAM 13 and used as the template image area T1 for the button B2 to be imaged next. That is, the template image region T1 from the captured image obtained in the “first imaging process” obtained by imaging the button B1, and the captured image obtained in the “second imaging process” obtained by imaging the button B2 or the button B2. When the determination image region T2 including the button B2 acquired from the range of the captured image is approximated by a predetermined value or more, the captured image obtained in the second imaging step is taken as the captured image of the next first imaging step. To do. At this time, if pattern matching between the template image area T1 and the entire imaging area of the button B2 is performed, contour detection processing or the like is performed on the image area of the button B2, and the template image area T1 is detected from the imaging area of the button B2. It is necessary to perform an image region determination process for use as an image. If the button B2 is not approximated by a predetermined value or more, the template image region T1 based on the captured image in the first imaging process at that time is continuously used for front / back determination of the next button B2.

この場合、一度ボタンB2の表裏判定が始まれば以降はボタンB2の撮像のみを行えばよい。従って、毎回ボタンB1の撮像も行う場合に比してカメラ2の撮像範囲が小さくてもよいので、テンプレートマッチングにおける各種画像処理の負荷が軽減される。よって、より円滑にボタンの表裏判定を行える。
加えて、ボタンB1を配置するためのスペースが必要なく、ボタン画像認識装置1をコンパクトにできる。
なお、カメラ2は、各ボタンの上方から撮像する配置でもよいし、側方から撮像する配置でもよい。
In this case, once the front / back determination of the button B2 is started, only the button B2 needs to be imaged thereafter. Therefore, since the imaging range of the camera 2 may be smaller than when imaging of the button B1 is performed every time, the load of various image processing in template matching is reduced. Therefore, the front / back determination of the button can be performed more smoothly.
In addition, there is no need for a space for arranging the button B1, and the button image recognition apparatus 1 can be made compact.
The camera 2 may be arranged to pick up images from above each button or may be arranged to pick up images from the side.

また、テンプレート画像領域T1はボタンB1の一部であってもよいし、テンプレート画像領域T1にあらかじめ加工を加えてもよい。図10はテンプレート画像領域T1の他の実施例を示す説明図である。図10(a)はボタン穴を除いた領域を用いる例、図10(b)はボタンB1の一部を用いる例、図10(c)はボタンB1のボタン穴を画像加工により塞いだ例を示す。
例えば、図10(a)に示すように、ボタンB2の回転によりボタンの位置関係が変化し、撮像画像に写るボタンの視覚的特徴が変わりうる画像領域T3を除いた範囲をテンプレート画像領域T1としてもよい。また、図10(b)に示すように、ボタンB1の一部をテンプレート画像領域T1としてもよい。また、図10(c)に示すように、テンプレート画像領域T1内の画像領域T3の画素を当該ボタン穴の周囲のボタンB1の画素の明暗あるいは色分布と同様の画素に置き換えることでボタン穴を塞いでしまってもよい。なお、ボタンB1の一部をテンプレート画像領域T1とする場合、当該テンプレート領域にボタンB1、B2の表裏が識別可能な視覚的特徴を有する部分(例えば凹部Cによる段差のコントラストC1)が含まれている必要がある。
これによって、例えば図10(a)、(b)に示す範囲をテンプレート画像領域T1とした場合は、ボタンB1全体をテンプレート画像領域T1に含める場合に比して画素数を小さくすることが可能となる。よって、テンプレートマッチングに要する負荷を軽減すると共にその処理時間を短縮でき、より好適にボタンの表裏判定を行える。
また、ボタンB1とボタンB2との間でボタン穴の位置関係に差異があった場合、表裏判定のテンプレートマッチングにおいてボタン穴の位置関係の差異によって類似度が所定の閾値以上とならずに異なる面(あるいは異なるボタン)と判定されてしまう可能性がある。そこで、図10(a)〜(c)に示すテンプレート画像領域T1を用いることで、ボタン穴の位置関係の差異によるテンプレートマッチングの類似度の低減を防止することが可能となる。よって、より好適にボタンの表裏判定を行える。
Further, the template image area T1 may be a part of the button B1, or the template image area T1 may be processed in advance. FIG. 10 is an explanatory view showing another embodiment of the template image region T1. 10A shows an example using an area excluding the button hole, FIG. 10B shows an example using a part of the button B1, and FIG. 10C shows an example where the button hole of the button B1 is closed by image processing. Show.
For example, as shown in FIG. 10A, a range excluding an image region T3 in which the positional relationship of the button changes due to the rotation of the button B2 and the visual characteristics of the button shown in the captured image can be changed is defined as a template image region T1. Also good. Further, as shown in FIG. 10B, a part of the button B1 may be a template image region T1. Further, as shown in FIG. 10C, the button hole is replaced by replacing the pixel in the image region T3 in the template image region T1 with a pixel similar to the brightness or color distribution of the pixel of the button B1 around the button hole. You may close it. When a part of the button B1 is used as the template image region T1, the template region includes a portion having a visual feature that allows the front and back of the buttons B1 and B2 to be identified (for example, a contrast C1 of a step due to the recess C). Need to be.
Accordingly, for example, when the range shown in FIGS. 10A and 10B is the template image region T1, the number of pixels can be reduced as compared with the case where the entire button B1 is included in the template image region T1. Become. Therefore, the load required for template matching can be reduced and the processing time can be shortened, and the button front / back determination can be performed more suitably.
In addition, when there is a difference in the positional relationship between the button holes between the button B1 and the button B2, the similarity is different because the difference in the positional relationship between the button holes in the front / back determination template matching does not exceed the predetermined threshold. (Or a different button) may be determined. Therefore, by using the template image region T1 shown in FIGS. 10A to 10C, it is possible to prevent the similarity of template matching from being reduced due to the difference in the positional relationship between the button holes. Therefore, the front / back determination of the button can be performed more preferably.

また、ボタンB1,B2は上述の実施の形態に示す形状に限らないことは言うまでもない。ただし、カメラによる撮像をボタンの一方の面に対して行う場合はボタンの表裏が視覚的に識別可能である必要がある。また、カメラによる撮像をボタンの側方から行う場合はボタンを側方から見た場合に表裏が識別可能である必要がある。
また、過去に撮像された撮像画像のテンプレート画像領域T1をEEPROM14に記憶しておき、その都度撮像されるテンプレート画像領域T1と平均化する処理を行ってその平均化後の画像と表裏を判定する対象となるボタンB2を含む判定画像領域T2とのパターンマッチングを行うようにしてもよい。また、平均化を行わずとも、その都度撮像されるボタンB1のテンプレート画像領域T1とボタンB2を含む判定画像領域T2とのパターンマッチングに加えて過去のテンプレート画像領域T1とボタンB2を含む判定画像領域T2とのパターンマッチングをさらに行うようにしてもよい。
また、本発明によるボタンの表裏判定方法を実施可能な構成であれば、当該方法を実施するための構成は上述の実施の形態に限定されないことは言うまでもない。例えば、カメラ2による各ボタンの撮像とA/Dコンバータ15による撮像画像のアナログ/デジタル変換はイメージセンサ(例えばCCDイメージセンサ、CMOSイメージセンサ等)によるデジタル画像イメージの取得に置き換えてもよい。
Needless to say, the buttons B1 and B2 are not limited to the shapes shown in the above embodiments. However, when imaging with the camera is performed on one side of the button, the front and back of the button must be visually identifiable. In addition, when imaging with the camera is performed from the side of the button, it is necessary to be able to identify the front and back when the button is viewed from the side.
Further, the template image region T1 of the captured image captured in the past is stored in the EEPROM 14, and the averaging process is performed with the template image region T1 captured each time to determine the averaged image and the front and back. Pattern matching with the determination image region T2 including the target button B2 may be performed. In addition to the pattern matching between the template image region T1 of the button B1 and the determination image region T2 including the button B2 that are captured each time without performing averaging, the determination image including the past template image region T1 and the button B2 Pattern matching with the region T2 may be further performed.
Further, it goes without saying that the configuration for carrying out the method is not limited to the above-described embodiment as long as the method for determining the front and back of the button according to the present invention can be implemented. For example, the imaging of each button by the camera 2 and the analog / digital conversion of the captured image by the A / D converter 15 may be replaced with acquisition of a digital image image by an image sensor (for example, a CCD image sensor, a CMOS image sensor, etc.).

本発明によるボタンの表裏判定方法で用いるボタン画像認識装置の主要構成を示すブロック図である。It is a block diagram which shows the main structures of the button image recognition apparatus used with the button front / back determination method by this invention. ボタンの表面及び裏面を示す説明図である。図2(a)はボタンB1の表面を、図2(b)はボタンの裏面を示す。It is explanatory drawing which shows the surface and back surface of a button. 2A shows the front surface of the button B1, and FIG. 2B shows the back surface of the button. ボタン画像認識装置の動作を示すフローチャートである。It is a flowchart which shows operation | movement of a button image recognition apparatus. カメラによるボタン、の撮像画像を示す説明図である。It is explanatory drawing which shows the picked-up image of the button by a camera. パターンマッチングの仕組みを示す説明図である。It is explanatory drawing which shows the mechanism of pattern matching. パターンマッチングで類似度が所定の閾値以上となった時点で処理を終了する場合を示すフローチャートである。It is a flowchart which shows the case where a process is complete | finished when a similarity becomes more than a predetermined threshold value by pattern matching. 最大の類似度と所定の閾値との比較を行う場合を示すフローチャートである。It is a flowchart which shows the case where the maximum similarity is compared with a predetermined threshold value. 2つのカメラを用いてボタンを撮像する場合を示す説明図である。図8(a)はカメラとボタンの配置の関係を、図8(b)はカメラ2Aによる撮像画像G1を、図8(c)はカメラ2Bによる撮像画像G2を示す。It is explanatory drawing which shows the case where a button is imaged using two cameras. 8A shows the relationship between the arrangement of the camera and the buttons, FIG. 8B shows a captured image G1 captured by the camera 2A, and FIG. 8C shows a captured image G2 captured by the camera 2B. ボタンの側方にカメラを設けた場合を示す説明図である。図9(a)はカメラとボタンの配置の関係を、図9(b)はカメラによる撮像画像を示す。It is explanatory drawing which shows the case where the camera is provided in the side of the button. FIG. 9A shows the relationship between the arrangement of the camera and buttons, and FIG. 9B shows the image captured by the camera. テンプレート画像領域の他の実施例を示す説明図である。図10(a)はボタン穴を除いた領域を用いる例、図10(b)はボタンの一部を用いる例、図10(c)はボタンのボタン穴を画像加工により塞いだ例を示す。It is explanatory drawing which shows the other Example of a template image area | region. FIG. 10A shows an example in which the area excluding the button hole is used, FIG. 10B shows an example in which a part of the button is used, and FIG. 10C shows an example in which the button hole of the button is closed by image processing.

符号の説明Explanation of symbols

2 カメラ
10 画像処理装置
11 CPU
14 EEPROM
B1,B2 ボタン
2 Camera 10 Image processing device 11 CPU
14 EEPROM
B1, B2 buttons

Claims (7)

カメラでボタンを撮像し、その撮像画像からボタンの表裏を判定するボタンの表裏判定方法において、
表又は裏の基準となるボタンを前記カメラで撮像する第1の撮像工程と、
表裏を判定する対象となるボタンを撮像する第2の撮像工程と、
前記第1の撮像工程で得られた撮像画像と前記第2の撮像工程で得られた撮像画像とから前記第2の撮像画像に写ったボタンの表裏を判定する判定工程と、を有し、
前記第1の撮像工程は、前記第2の撮像工程と同時又は前記第2の撮像工程の直前に行うことを特徴とするボタンの表裏判定方法。
In the button front / back determination method for imaging a button with a camera and determining the front / back of the button from the captured image,
A first imaging step of imaging the front or back reference button with the camera;
A second imaging step of imaging a button to be subject to front / back determination;
A determination step of determining the front and back of the button reflected in the second captured image from the captured image obtained in the first imaging step and the captured image obtained in the second imaging step;
The button front / back determination method, wherein the first imaging step is performed simultaneously with the second imaging step or immediately before the second imaging step.
前記第1の撮像工程は、前記第2の撮像工程を行うのと同時又は前記第2の撮像工程を行う直前に毎回行うことを特徴とする請求項1に記載のボタンの表裏判定方法。   2. The button front / back determination method according to claim 1, wherein the first imaging step is performed at the same time as the second imaging step or immediately before the second imaging step. 表又は裏の基準となるボタンと表裏を判定する対象となるボタンとを並べて配置し、ひとつのカメラで当該表又は裏の基準となるボタンと表裏を判定する対象となるボタンを同時に撮像することを特徴とする請求項1又は2に記載のボタンの表裏判定方法。   The front or back reference button and the front / back judgment target button are arranged side by side, and the front or back reference button and the front / back judgment target button are simultaneously imaged with one camera. The method for determining the front and back of a button according to claim 1 or 2. 前記第1の撮像工程と前記第2の撮像工程は、異なるカメラによって行われることを特徴とする請求項1又は2に記載のボタンの表裏判定方法。   3. The button front / back determination method according to claim 1, wherein the first imaging step and the second imaging step are performed by different cameras. 4. 前記第1の撮像工程で得られた撮像画像と前記第2の撮像工程で得られた撮像画像とが所定以上近似していた場合、当該第2の撮像工程で得られた撮像画像を次の第1の撮像工程の撮像画像とすることを特徴とする請求項1に記載のボタンの表裏判定方法。   If the captured image obtained in the first imaging step and the captured image obtained in the second imaging step are more than a predetermined approximation, the captured image obtained in the second imaging step is The button front / back determination method according to claim 1, wherein the image is a captured image of the first imaging step. 前記第1の撮像工程及び前記第2の撮像工程は、前記ボタンを側方から撮像することを特徴とする請求項1から5のいずれか一項に記載のボタンの表裏判定方法。   6. The button front / back determination method according to claim 1, wherein in the first imaging step and the second imaging step, the button is imaged from the side. 前記第1の撮像工程で得られた撮像画像の一部又は一部を加工した画像を用いてボタンの表裏の判定を行うことを特徴とする請求項1から6のいずれか一項に記載のボタンの表裏判定方法。   The button front / back determination is performed using an image obtained by processing a part or a part of the captured image obtained in the first imaging step. Button front / back determination method.
JP2008163954A 2008-06-24 2008-06-24 Button front / back judgment method Expired - Fee Related JP5084634B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008163954A JP5084634B2 (en) 2008-06-24 2008-06-24 Button front / back judgment method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008163954A JP5084634B2 (en) 2008-06-24 2008-06-24 Button front / back judgment method

Publications (2)

Publication Number Publication Date
JP2010004904A true JP2010004904A (en) 2010-01-14
JP5084634B2 JP5084634B2 (en) 2012-11-28

Family

ID=41586086

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008163954A Expired - Fee Related JP5084634B2 (en) 2008-06-24 2008-06-24 Button front / back judgment method

Country Status (1)

Country Link
JP (1) JP5084634B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014030496A (en) * 2012-08-01 2014-02-20 Juki Corp Method for detecting button direction, device for detecting button direction, and device for feeding button
JP2014057764A (en) * 2012-09-19 2014-04-03 Juki Corp Method for determining button front and reverse sides, apparatus for determining button front and reverse sides and apparatus for supplying button
WO2017056677A1 (en) * 2015-09-30 2017-04-06 ブラザー工業株式会社 Sewing machine and recording medium on which program is recorded

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6159245A (en) * 1984-08-30 1986-03-26 Miyuuchiyuaru:Kk Method for inspecting outer surface of solid preparation
JPS63212393A (en) * 1987-02-27 1988-09-05 ジューキ株式会社 Apparatus for stitch direction of button
JPH10194435A (en) * 1997-01-16 1998-07-28 Juki Corp Button selecting device
JP2002274641A (en) * 2001-03-16 2002-09-25 Mitsubishi Electric Engineering Co Ltd Small work delivery control device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6159245A (en) * 1984-08-30 1986-03-26 Miyuuchiyuaru:Kk Method for inspecting outer surface of solid preparation
JPS63212393A (en) * 1987-02-27 1988-09-05 ジューキ株式会社 Apparatus for stitch direction of button
JPH10194435A (en) * 1997-01-16 1998-07-28 Juki Corp Button selecting device
JP2002274641A (en) * 2001-03-16 2002-09-25 Mitsubishi Electric Engineering Co Ltd Small work delivery control device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014030496A (en) * 2012-08-01 2014-02-20 Juki Corp Method for detecting button direction, device for detecting button direction, and device for feeding button
JP2014057764A (en) * 2012-09-19 2014-04-03 Juki Corp Method for determining button front and reverse sides, apparatus for determining button front and reverse sides and apparatus for supplying button
WO2017056677A1 (en) * 2015-09-30 2017-04-06 ブラザー工業株式会社 Sewing machine and recording medium on which program is recorded
US10450682B2 (en) 2015-09-30 2019-10-22 Brother Kogyo Kabushiki Kaisha Sewing machine and non-transitory computer-readable medium

Also Published As

Publication number Publication date
JP5084634B2 (en) 2012-11-28

Similar Documents

Publication Publication Date Title
US11422356B2 (en) Information processing apparatus, imaging control method, program, digital microscope system, display control apparatus, display control method, and program including detection of a failure requiring reimaging
US7686457B2 (en) Projection image display apparatus and multi-projection system
US8036463B2 (en) Character extracting apparatus, method, and program
JP5564349B2 (en) Image processing apparatus and appearance inspection method
US20070172122A1 (en) Image processing apparatus, image processing method, and program
KR101762037B1 (en) Test system for conveyed objects and conveying apparatus
JP2007286846A5 (en)
JP5084634B2 (en) Button front / back judgment method
JP2005265661A (en) Image processing method and image processing device
US20080063271A1 (en) Character extracting apparatus, method, and program
WO2011024287A1 (en) Information processing apparatus, information processing system, information processing method, and computer program for executing information processing method
JP6825454B2 (en) Item number counting device
JP2010078562A (en) Device and method for recognizing buttons
JP6623545B2 (en) Inspection system, inspection method, program, and storage medium
JP2009116419A (en) Outline detection method and outline detection device
JP2010273319A (en) Imaging apparatus, microscope system, and white balance adjustment method
WO2009128223A1 (en) Imaging position determination method and imaging position determination device
JP2000266514A (en) Method and device for inspecting metallic sheet
JP2009250777A (en) Surface inspection device and surface inspection method
JP2001175866A (en) Device and method for image process inspection
JP2013101698A (en) Image pickup device and program
JP3415307B2 (en) Appearance inspection device
CN109870293A (en) The detection method and detection device of display panel
JP2009162524A (en) Inspection apparatus
JP2003323621A (en) Image processor and protrusion detecting method for the image processor and its program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110613

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120713

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120904

R150 Certificate of patent or registration of utility model

Ref document number: 5084634

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20150914

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees