JP3715683B2 - Image processing apparatus and image processing method therefor - Google Patents

Image processing apparatus and image processing method therefor Download PDF

Info

Publication number
JP3715683B2
JP3715683B2 JP16766295A JP16766295A JP3715683B2 JP 3715683 B2 JP3715683 B2 JP 3715683B2 JP 16766295 A JP16766295 A JP 16766295A JP 16766295 A JP16766295 A JP 16766295A JP 3715683 B2 JP3715683 B2 JP 3715683B2
Authority
JP
Japan
Prior art keywords
image data
value
image
angle
binarizing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP16766295A
Other languages
Japanese (ja)
Other versions
JPH08315153A (en
Inventor
良巳 山本
優 柴田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP16766295A priority Critical patent/JP3715683B2/en
Publication of JPH08315153A publication Critical patent/JPH08315153A/en
Application granted granted Critical
Publication of JP3715683B2 publication Critical patent/JP3715683B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)
  • Image Analysis (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、画像処理を用いて物体の位置および角度を自動で検出する物体位置検出装置及びその検出方法に関するものである。
【0002】
【従来の技術】
近年、画像処理技術の応用による物体の自動認識技術は、生産ラインにおける自動検査や自動組立等に広く応用されつつある。その場合、まず認識対象である物体と背景とを分離する方法として、撮像した多値画像データを明るさの違いにより、0と1のデータにする二値化の手法がある。ただしこの場合、分離の基準となる二値化レベルの値が問題となる。認識対象である物体の明るさが一定であれば二値化レベルの値はあらかじめ固定値とすれば良いが、実際にはロット及び周囲の環境により認識対象の明るさは変動する。こういった変動に対して、あらかじめ用意された複数の二値化レベル値を選択するようにした装置が、特公平2−30064等に開示されている。
【0003】
【発明が解決しようとする課題】
しかしながら、このような従来技術によれば、認識対象である物体自身に明るさのむらがある場合、また一部が汚れている場合には、正確な形での背景からの物体の分離、位置や角度の検出が困難であるという問題がある。
【0004】
そこで本発明は、物体の表面の一部が汚れていたり、光の反射の仕方にむらがあるような物体でも、その画像データから位置及び角度を安定して検出することができる装置およびその検出方法を提供することを目的とする。
【0005】
【課題を解決するための手段】
前述の課題を解決するための構成として、本発明に係る画像処理装置は、物体を撮像して得られる多値画像データを二値化する際に、二値画像データの中の像域の特徴値が、予め設定した所定の値となるよう二値化しきい値を設定して前記多値画像データを二値化する設定手段と、前記設定手段によって二値化される二値画像データから前記特徴値に対応する領域を抽出する抽出手段と、前記抽出手段において抽出される領域の重心と角度とを検出する検出手段と、新たに設定された二値化しきい値を変化させて前記多値画像データを二値化して抽出された特定パターンの画像に基づき、前記多値画像データを強調する強調手段と、を有し、前記強調手段によって強調された多値画像データを、前記設定手段によって二値化する処理を繰り返すことにより、前記抽出手段によって抽出される領域の重心と角度とを前記検出手段によって検出することを特徴とする。
【0006】
これにより、多値画像データを最適な二値化しきい値で二値化できるため、反射率の違う物体や汚れのある物体でも安定して、物体の位置・角度を検出できる。
【0033】
同課題の解決のための本発明の他の構成としての画像処理方法は、物体を撮像して得られる多値画像データを二値化する際に、二値画像データの中の像域の特徴値が、予め設定した所定の値となるよう二値化しきい値を設定して前記多値画像データを二値化する設定ステップと、前記設定ステップにおいて二値化される二値画像データから前記特徴値に対応する領域を抽出する抽出ステップと、前記抽出ステップにおいて抽出される領域の重心と角度とを検出する検出ステップと、新たに設定された二値化しきい値を変化させて前記多値画像データを二値化して抽出された特定パターンの画像に基づき、前記多値画像データを強調する強調ステップと、を有し、前記強調ステップにおいて強調された多値画像データを、前記設定ステップにおいて二値化する処理を繰り返すことにより、前記抽出ステップにおいて抽出される領域の重心と角度とを前記検出ステップにおいて検出することを特徴とする。
【0034】
これにより、多値画像データを最適な二値化しきい値で二値化できるため、反射率の違う物体や汚れのある物体でも安定して、物体の位置・角度を検出できる。
【0061】
【発明の実施の形態】
以下に本発明の一実施形態として、ワークである箱の取り置きを行うパレタイズロボットへの適用例を説明する。
【0062】
まず本発明を適用した装置のシステム構成を図1を参照して説明する。
【0063】
図1は、本発明を適用したパレタイズロボットのシステム概略図である。
【0064】
図中、撮像装置2はCCDエリアセンサ等の受光素子(光電変換素子)を有し、面光源である照明1で照明されたワーク(箱)3を撮像する。尚、ワーク3は、図1に示すようにパレット9の上に1段に4つを2段積みした構成とする。撮影された画像は、電気信号に変換されて画像処理装置4に送られる。また画像処理装置4は、ロボット制御装置5と通信手段を介して接続され、画像データ等の通信を行なう。ロボット制御装置5は、ロボットアーム7の先端にロボットハンド8を備えたロボット6を制御する。
尚、4つの撮像装置2は各ワーク3の像がそれぞれ撮像エリアの中心部に位置するように配置され、ロボット6の動きに連動して、次に移動させるワーク(箱)3の全体像を撮像できるように順次切り替える機構を有している。
【0065】
以上の構成により、図2〜図16を参照して動作の詳細に説明する。
【0066】
まず撮像装置2により撮像された撮像範囲の画像処理装置4での作像例を示す。但し図2は汚れ等がない理想的な状態である。
【0067】
図2は、本発明の一実施形態としての撮像範囲の理想的な撮像例である。
【0068】
図中、20は撮像装置の撮像範囲である。21はワーク3を載せているパレット9の画像である。22が位置、角度を求めるべきワーク3の蓋の画像である。蓋は外縁部に比べ内側の高さが低くなっており、外縁部と内側との境界部に照明光によって薄い影ができる。この薄い影の内側の領域を本発明の手法により抽出し、位置及び角度を検出する。
【0069】
4つ並んだワーク3のうちの一つを、それに対応する撮像装置2が撮像し、その撮像データを画像処理装置4に送る。画像処理装置4は本発明の方法によりワーク3の正確な位置と角度を撮像データから検出し、ロボット6に送る。ロボット制御装置5は画像処理装置4から送られたワーク3の位置、角度のデータによりロボット6の姿勢を制御し、ワーク3をロボットハンド8で把持し、別の位置にある他のパレット上に移動させる。またロボット制御装置5は、画像処理装置4に撮像装置2の切換タイミングを通信するので、この間に次に把持すべきワーク3をそれに対応する撮像装置2により撮像し、撮像データが画像処理装置4へと送られる。そして、ロボット6が別パレットに先のワーク3の移動を完了し、ロボットハンド8を初期位置に戻すまでに、画像処理装置4は次のワーク3の位置、角度データをロボット6に送る。ロボット制御装置5は、次のワーク3の位置、角度データを入手しているため、ロボットハンド8を戻した瞬間にすぐに次のワーク3の把持動作に入ることができる。これらの動作を繰り返すことで、連続して合計8つのワーク3を順次把持し、他のパレットに移動させることが可能となる。
【0070】
次に画像処理装置4が本発明の方法によりワーク3の位置、角度を求める処理手順を具体的に説明する。
【0071】
図3に処理手順の概要を示す。
【0072】
図3は、本発明の一実施形態としての処理手順の概要を示すフローチャートである。
【0073】
図中、ステップS1は、各パラメータのリセットや画像処理装置4の初期化を行う初期設定部である。ステップS2は、ワーク3の位置、角度を検出するのに最適な多値データの二値化のためのしきい値の設定を行う最適二値化設定部である。ステップS3は、ステップS2で設定した二値化しきい値で二値化した画像データから有効な部分だけ抽出する注目ラベル抽出部である。ステップS4は、ステップS3で抽出、作成された画像データにおいて汚れ等でデータの欠落した部分を補正し、位置を表す重心、角度を計算する重心・角度計算部である。更にステップS5の線強調処理部において、所定の条件に合う直線パターンだけを抽出して取り込み、画像に書き込む。そしてこの画像データを基に、再びステップS2〜S4の処理を行ない、重心と角度を求める。
【0074】
次に、上述の各ステップにおける処理について詳細に説明する。
【0075】
[初期設定部]
図4は、本発明の一実施形態としての初期設定部の処理を示すフローチャートである。
【0076】
図中、まずステップS100において、変数の初期値を設定する(変数counter とagein を0、変数histmenseki を100000)。画像処理装置4の初期化もここで行う。ステップS101において、各種パラメータに値を設定する。本実施形態では、ここでワーク3の蓋22の面積に近似した理想面積、その理想面積との許容差、所定の重心エリア座標、ソフトウェア処理の最大ループ回数、及び強調ループ回数lloop 、そしてフィレ(Fere)座標、すなわちラベル付けされた画像を水平方向、及び垂直方向に投影した場合の水平軸、及び垂直軸上のそれぞれの長さ(以下、水平幅、垂直幅)を設定する。次に、ステップS102において、撮像装置2から送られてくる映像信号を画像データとしてメモリに取り込み、この取り込み画像をPとする。この時の画像の一例を図11に示す。
【0077】
図11は、本発明の一実施形態としての撮像範囲の取り込み画像例である。
【0078】
次に、ステップS103において、メモリ中の画像Pのデータから二値化しきい値の初期値を求め、変数slvlにその値を代入する。本実施形態では、重心エリア内の画素の多値データの平均を取り、二値化しきい値の初期値としている。
【0079】
[最適二値化設定部]
図5A及び図5Bは、本発明の一実施形態としての最適二値化設定部の処理を示すフローチャートである。
【0080】
図中、ステップS200において、変数lvlに二値化のしきい値の初期値であるslvlを代入し、ステップS201〜ステップS225の二値化しきい値算出ルーチンを開始する。ステップS201において、ループカウンタ(counter )を+1する。ステップS202では、二値化しきい値をlvlとしてメモリ中の画像Pのデータの二値化を行なう。ここで得られた二値化画像は、隣接するワーク3の蓋22の境界がつながってしまう場合が多い。そこで境界を明確にするために、この二値化データに対し8近傍ANDフィルタを2回適用した画像データを求める。ステップS203では、ステップS202で求めた画像データにおいて白画素(本実施形態では値が1の画素)のみラベル付けし、更に各ラベルのモーメント量を求めるため、モーメント演算を実行する。この演算結果に基づき、ステップS204では、所定の設定値以上の面積を持つラベル(以下、有効ラベル)の面積および重心座標を求め、これを保存するとともに、有効ラベルの数をカウントし、変数Kに代入する。ステップS205ではKが0かどうか判別する。
【0081】
Kが0であればステップS206に処理が移行する。ステップS206では変数lvlの値を10減少させ、ステップS201へ処理を戻す。Kが0でなければステップS207に処理を移す。ステップS207では有効ラベルのうち、重心が重心エリア内にあり、かつその水平幅、垂直幅が設定値内のものがあるかを判別し、条件に合うラベルがあればこれを注目ラベルとする。実際にはこの注目ラベルが、ロボット6が次に移動させるべき目的の蓋22に対応する。ステップS208において、そのラベルの面積を変数maxに代入する。次のステップS209で、黒画素および白画素の両方についてラベル付けし直し、注目ラベルを面積により判別し、その番号を求める。そして各ラベルについてフィレ座標を求める。更に求めた水平幅、垂直幅より注目ラベルと注目ラベル以外の全てのラベルとの間の内包関係を調べる。例えば、Aというラベルのフィレ座標値が全てBというラベルのフィレ座標値より小さければ、AはBに含まれる。よって、任意のラベルが注目ラベルに含まれるかどうかをフィレ座標だけで判別できる。ステップS210では、注目ラベルに内包されるラベルの面積をmaxに加算する。ステップS211では注目ラベルのラベル番号を変数tmpmaxに代入し、そしてステップS215に処理を移す。
【0082】
ステップS207で条件に合うラベルがなければ、ステップS212に処理を移す。ステップS212では、ステップS202で求めた二値化画像の黒画素、白画素両方に再度ラベル付けし、モーメント演算を行う。そしてステップS213で、重心エリア内の各画素について、その所属するラベルの番号を求め、ステップS214で重心エリア中で最も大きな面積を持つ白画素のラベルを求め、この面積値をmax に代入し、ラベルの番号をtmpmaxに代入する。実際にはこの白画素が、ロボット6が次に移動させるべき目的の蓋22に対応する。そしてステップS215に処理を移す。
【0083】
ステップS215において、現在の二値化しきい値による面積maxと前回までの二値化しきい値による面積histmensekiの比較により理想面積との差が最小になる場合を求めるため、|理想面積−max |<|理想面積−histmenseki |が真か偽かを判定する。真であれば現在の二値化しきい値による面積maxのほうが理想面積との差が小さいので、maxの値をhistmensekiに代入する。更にこの時の2値画像をメモリに保存し、この時のlvl の値を変数bestlvl に代入する。偽であれば、前回までの二値化しきい値による面積histmensekiのままでステップS217に処理を移す。
【0084】
ステップS217〜ステップS224では、現在のしきい値lvlに基づき次の二値化しきい値の算出を行なう。ステップS217では、|理想面積−max |>許容差、が真か偽かを判別する。偽であれば、最適な二値化しきい値が求まったことになり、ステップS218に処理を移してagein に1をセットし、ステップS225に処理を移す。真なら、ステップS219に処理を移して変数dtmpに(max −理想面積)×0.0004を代入する。そして次のステップS220でdtmpの絶対値の値が3.0より大きいか否かを判定し、大きい場合はステップS222へ移行してlvl にdtmpの値を加え、ステップS225に処理を移す。一方、3.0以下の場合はステップS221に処理を移す。ステップS221ではdtmpが0.0より大きいか否かを判定し、大きければ、ステップS223でlvl を+1し、ステップS225へ処理を移す。ステップS221でdumpが0.0以下ならば、ステップS224でlvl を−1し、ステップS225に処理を移す。ステップS225ではagein が0でかつ、counter <最大ループ数、という条件が真であればステップS201に処理を移し、新しいしきい値lvlにより前述の処理を継続する。条件が偽であれば最適二値化設定を終了する。
【0085】
[注目ラベル抽出部]
図6は、本発明の一実施形態としての注目ラベル抽出部の処理を示すフローチャートである。
【0086】
図中、ステップS300でagein が0かどうか判別する。0でなければ、ステップS306に処理を移す。0であれば、次のステップS301に処理を移す。
【0087】
ステップS301ではmax にhistmenseki の値を代入する。そして、ステップS302において、最適二値化設定処理において最後にステップS216で保存された2値画像を処理メモリに戻し、ステップS303でこの画像データにおける白画素についてラベル付けを行ない、更にモーメント演算を行なう。ステップS304では、許容差の5倍の値を変数MTMPに代入し、tmpmaxに−1をセットする。ステップS305では重心が重心エリア内にあり、かつその面積とhistmenseki との差の絶対値がMTMPよリ小さいものの中で最小の値をとるラベルを求め、そのラベル番号をtmpmaxに入れる。ステップS306では、tmpmaxの値を判別し、tmpmaxが0より小さければ、エラーを表示して終了する。0以上なら次のステップS307へ処理を移す。ステップS307では、tmpmax番目のラベルのみを抽出しその画像を作成し、注目ラベル抽出処理を終了する。
【0088】
[重心・角度計算部]
図7は、本発明の一実施形態としての重心・角度計算部の処理を示すフローチャートである。
【0089】
図中、ステップS400において、ステップS307で作成した画像データに対し8近傍ORフィルタを各画素について4回適用することにより膨張処理を行ない、欠損部の補正を行なう。取り込み画像Pについてここまでの処理を行った画像を図12に示す。
【0090】
図12は、本発明の一実施形態としての中間処理画像例である。
【0091】
次のステップS401では、ステップS400で得られた二値化画像の白、黒両画素にラベル付けし、モーメント演算を行ない、更にステップS402において背景以外のラベルの面積と1次モーメントを加算する。ステップS403では、ステップS402で求めた値に基づいて重心計算を行なうことにより重心座標を求める。この座標が求めるワーク3の位置を表す。ステップS404では、改めて白画素のみにラベル付けとモーメント演算を行ない、各ラベルの面積及び2次モーメント量を求める。ステップS405では、ステップS404でラベル付けしたラベルの中で最大の面積を持つラベルについて、外接四角形を求める。更にその外接四角形の頂点座標から中心を求める。そして、ステップS404で求めた2次モーメント量から慣性主軸とそれに直交する副軸の比を求め、変数zikuhiに代入する。この中心座標とzikuhiは検出結果のNG判定に用いる。中心座標と先に求めた重心位置とは、この場合、抽出領域は長方形なので、抽出が正確になされていれば、二つの座標は一致するはずである。zikuhiの方は、予め汚れのないきれいな蓋22を用いて算出した場合の値を記録しておき、その値と比較することでNG判定を行なう。なお、この時求めた慣性主軸の傾きをワーク3の角度としても良いが、より正確な値を求めるため、次の処理を行なう。すなわちステップS406では、未だ蓋22の形を完全には再現していない図12のような画像データに8近傍エッジ抽出フィルタをかけて輪郭を求める。更に得られた輪郭線の水平部分を求めるために、水平2近傍ANDフィルタを2回、その上で8近傍ORフィルタを2回かける。こうしてできた画像に対し、ステップS407で再び、白画素についてラベル付けし、モーメント演算を行なう。そして次のステップS408において水平方向で長さの様々な各ラベルにおいて、一番長い物を基準に角度を求めるため、慣性主軸まわりの2次モーメントを副軸まわりの2次モーメントで割った値を求め、ステップS409においてステップS408で求めた値が最大である(水平方向で一番長い)ラベルの2次モーメントからその角度を求める。これがワーク3の角度を表す。
【0092】
更にワーク3の角度を安定、かつ確実に算出するため、以下の線強調処理を説明する。従って上述の処理だけでワーク3の角度が実用的に求まるならば線強調処理は行なわなくてもよい。
【0093】
[線強調処理]
図8は、本発明の一実施形態としての線強調処理部の全体の処理を示すフローチャートである。
【0094】
図中、ステップS500において、lloopの値を判定し、2ならばステップS501へ、2より小さければステップS508へ処理を移す。ステップS501でmlimitを100に、counter を0に、glvl にbestlvl +10の値をそれぞれ設定する。ステップS502で画像メモリの多値画像データを別のメモリ領域にコピーする。元の多値画像データの存在する領域をメモリ領域0、コピーした先の領域をメモリ領域1と呼ぶことにする。ステップS503〜ステップS506が、線抽出・書込みルーチンであり、ステップS503でcounter を+1し、ステップS504で線抽出・書込み処理を行なう。ステップS505でglvl の値を−2する。そして次のステップS506でcounter が20以下か否かを判定し、20以下の場合には、再びS503に処理を戻す。counter が20より大きければ、ステップS507に処理を進める。ステップS507では、slvlにbestlvlの値をセットする。ステップS508でlloop の値を−1する。そしてステップS509においてlloop の値が0より大きいか否かを判定し、大きければ、再び最適二値化設定処理へ移行し、ステップS2〜S4の処理を行ない、位置と角度を再計算する。11oop の値が0以下であれば処理を終了し、先の重心・角度計算処理で求めた位置と角度を物体の位置と角度とする。この時の画像の例を図16に示す。
【0095】
図16は、本発明の一実施形態としての線強調処理後の画像例である。
【0096】
前述のステップS2〜S4の処理結果である図12の場合と比較すると、汚れや明るさのムラによる欠損部がなくなり、目的とする蓋22の内部領域の輪郭にほぼ等しい画像が得られていることがわかる。
【0097】
次にステップS504の線抽出・書込み処理の詳細を説明する。
【0098】
図9は、本発明の一実施形態としての線抽出・書込み処理を示すフローチャートである。
【0099】
図中、ステップS600では、ステップS502においてメモリ領域1に保存しておいた多値画像データを、しきい値glvlで反転二値化し、これを8近傍エッジ抽出フィルタと反転フィルタを通し、更に水平ORフィルタを2回通す。こうして加工された二値化画像に対し、更にステップS601において水平ANDフィルタを4回通し、その結果を格納する。この時の画像の例を図13に示す。
【0100】
図13は、本発明の一実施形態としての水平方向の線抽出後の画像例である。
【0101】
図中、K番目の二値化レベルにより作られた画像をMKとする。ステップS602では、この二値化画像の黒画素についてラベル付け及びモーメント演算を行なう。ここで得られた水平方向の画像を、ステップS603においてメモリ領域0の多値画像に書き込む。次に、ステップS604において、ステップS502でメモリ領域1に保存しておいた多値画像データを再びしきい値glvlで反転二値化し、これをに8近傍エッジ抽出フィルタと反転フィルタを通し、更に垂直ORフィルタを2回通す。こうして加工された二値化画像に対し、ステップS605において垂直ANDフィルタを4回通し、その結果を格納する。この時の画像の例を図14に示す。
【0102】
図14は、本発明の一実施形態としての垂直方向の線抽出後の画像例である。
【0103】
図中、K番目の二値化レベルにより作られた画像をNKとする。ステップS606において、この2値画像の黒画素についてラベル付け及びモーメント演算を行なう。ここで得られた垂直方向の画像を、ステップS607においてメモリ領域0の水平方向の線書き込み済みの多値画像に書き込み、線抽出・書込み処理は終了する。
【0104】
ここで前述の線書込み処理の詳細を図10を参照して説明する。
【0105】
図10は、本発明の一実施形態としての線書込み処理を示すフローチャートであり、ステップS603の水平方向の線書込み処理とS607の垂直方向の線書込み処理である。
【0106】
図中、ステップS700において変数iに0を設定し初期化する。次のステップS701ではiの値を判別し、ラベルの総数以上であれば処理を終了し、ラベルの総数より少なければ次のステップS702へ処理を移す。ステップS702では、i番目のラベルの面積が定数mlimitより大きいか否かを判定し、小さいか等しければ、ステップS706に進み、iの値を+1し、再びステップS701へ処理を進める。もし、大きければ、ステップS703へ進む。ステップS703では、先に求めたモーメント量からラベルの慣性主軸と副軸の長さの比を求める。次のステップS704でこの比が定数lvalueより小さいか否かを判別する。小さくなければステップS706に進み、iの値を+1して、再びステップS701へ処理を進める。小さければ、ステップS705に処理を進める。ステップS705では、i番目のラベルの画像をメモリ領域0の多値画像に書込み、ステップS706に進む。
【0107】
次に、線抽出・書込み処理終了後の画像データの一例を図15に示す。
【0108】
図15は、本発明の一実施形態としての線抽出・書込み処理後の画像例である。
【0109】
最初の取込み時の画像をP、K番目の二値化レベルにより作られた水平・垂直方向の抽出線画像をそれぞれMK、NKとし、線書込み処理後の画像データをQとすると、Qは数1で表される。
【0110】
【数1】

Figure 0003715683
【0111】
尚、本実施形態では、後述する強調処理の対象として線パターンを使っているが、ワーク3の形状により、他のパターンを使用しても良い。
【0112】
尚、1段に配置されたワークの数に応じて撮像装置を配置すれば、本発明を適用できることは言うまでもない。
【0113】
更に本発明は、複数の機器から構成されるシステムに適用しても、1つの機器から成る装置に適用しても良い。また、本発明はシステム或は装置にプログラムを供給することによって達成される場合にも適用できることは言うまでもない。この場合、本発明に係るプログラムを格納した記憶媒体が、本発明を構成する事になる。そして、該記憶媒体からそのプログラムをシステムあるいは装置に読み出すことによって、そのシステムあるいは装置が、予め定められたし方で動作する。
<実施形態の効果>
(1)撮像装置2の数を、パレットに載せたワーク3の1段の数(4つ)にし、撮像装置2の撮像エリアを1つのワーク3とその近傍にしたため、画像処理のソフトウェアをシンプルに構築できた。
(2)最適二値化設定部において、まず8近傍ANDフィルタ(2回)により二値化画像を収縮したことにより、目的とするワーク3の蓋22と隣接するワーク3の蓋22の境界を明確にすることができた。
(3)最適二値化設定部において、有効ラベルの中から注目ラベルを選択できない(ステップS207)場合、すなわち目的とするワーク3の蓋22の明るさのムラや汚れが激しく、二値化画像の中から目的とするワーク3の蓋22にあたる有効ラベルを見つけられない場でも、そのラベルの中で一番大きい物を目的とするワーク3の蓋22と判断したことにより、二値化画像の状態がかなり悪い場合でも後段の補正処理を継続することができた。
(4)最適二値化設定部において、所定の理想面積と注目ラベル、または有効ラベルの中で一番大きいラベルの面積を比較し、その差を基に多値画像データの二値化しきい値を大きく、又は小さく変化させ、最小に絞り込むことにより、迅速に最適な二値化しきい値を求めることができた。
(5)重心・角度計算部において、8近傍ORフィルタ(4回)により膨張処理を行ったため、目的とするワーク3の蓋22にあたる二値化画像の小さな欠損部の補正をこの時点で完了することができた。
(6)重心・角度計算部において、8近傍エッジ抽出フィルタで輪郭を求め、水平2近傍ANDフィルタ(2回)、8近傍ORフィルタ(2回)を行なうことにより、得られた輪郭線の水平部分だけを求め、モーメント演算を行なうことにより抽出領域(長方形)の形状を有効に利用して、目的とするワーク3の蓋22角度を安定して算出することができた。
(7)線強調処理を行ない、多値画像に輪郭線を書き込むことにより、目的とするワーク3の蓋22の明るさのムラや汚れが激しく、二値化画像の状態がかなり悪い場合でも重心・角度計算を更に安定して行なうことができた。
(8)線強調処理部において、多値画像データを、しきい値glvlで反転二値化し、8近傍エッジ抽出フィルタ、反転フィルタ、水平(または垂直)ORフィルタ(2回)、更に水平(または垂直)ANDフィルタ(4回)、モーメント演算を行い最大の物を求めることにより、目的とするワーク3の蓋22の輪郭を確実に捉えることができた。
【0114】
【発明の効果】
以上説明したように、本発明によれば、物体の表面の一部が汚れていたり、光の反射の仕方にむらがあるような物体でも、その画像データから位置及び角度を安定して検出することができる装置およびその検出方法を提供することができる。また線強調処理を併せて行なうことにより更に安定して位置及び角度を検出することができる。
【0115】
【図面の簡単な説明】
【図1】本発明を適用したパレタイズロボットのシステム概略図である。
【図2】本発明の一実施形態としての撮像範囲の理想的な撮像例である。
【図3】本発明の一実施形態としての処理手順の概要を示すフローチャートである。
【図4】本発明の一実施形態としての初期設定部の処理を示すフローチャートである。
【図5A】本発明の一実施形態としての最適二値化設定部の処理を示すフローチャートである。
【図5B】本発明の一実施形態としての最適二値化設定部の処理を示すフローチャートである。
【図6】本発明の一実施形態としての注目ラベル抽出部の処理を示すフローチャートである。
【図7】本発明の一実施形態としての重心・角度計算部の処理を示すフローチャートである。
【図8】本発明の一実施形態としての線強調処理部の全体の処理を示すフローチャートである。
【図9】本発明の一実施形態としての線抽出・書込み処理を示すフローチャートである。
【図10】本発明の一実施形態としての線書込み処理を示すフローチャートである。
【図11】本発明の一実施形態としての撮像範囲の取り込み画像例である。
【図12】本発明の一実施形態としての中間処理画像例である。
【図13】本発明の一実施形態としての水平方向の線抽出後の画像例である。
【図14】本発明の一実施形態としての垂直方向の線抽出後の画像例である。
【図15】本発明の一実施形態としての線抽出・書込み処理後の画像例である。
【図16】本発明の一実施形態としての線強調処理後の画像例である。
【符号の説明】
1 拡散板つき照明
2 ワーク
3 撮像装置
4 画像処理装置
5 ロボット制御装置
6 ロボット
7 ロボットアーム
8 ロボットハンド
9 パレット
20 撮像エリア
21 パレットの画像
22 ワーク3の蓋の画像[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an object position detection apparatus that automatically detects the position and angle of an object using image processing, and a detection method thereof.
[0002]
[Prior art]
In recent years, automatic object recognition technology based on application of image processing technology has been widely applied to automatic inspection and automatic assembly in production lines. In that case, as a method for separating the object to be recognized from the background, there is a binarization method in which the captured multi-value image data is converted into 0 and 1 data depending on the brightness. However, in this case, the value of the binarization level that becomes a reference for separation becomes a problem. If the brightness of an object that is a recognition target is constant, the value of the binarization level may be a fixed value in advance, but actually the brightness of the recognition target varies depending on the lot and the surrounding environment. An apparatus that selects a plurality of binarization level values prepared in advance for such fluctuations is disclosed in Japanese Patent Publication No. 2-30064.
[0003]
[Problems to be solved by the invention]
However, according to such conventional technology, when the object to be recognized itself has uneven brightness, or when a part thereof is dirty, the separation, position, There is a problem that it is difficult to detect the angle.
[0004]
Therefore, the present invention provides an apparatus capable of stably detecting the position and angle from image data even for an object in which a part of the surface of the object is dirty or the light is unevenly reflected, and the detection thereof. It aims to provide a method.
[0005]
[Means for Solving the Problems]
As a configuration for solving the above-described problem, an image processing apparatus according to the present invention binarizes multi-valued image data obtained by imaging an object. When doing The feature value of the image area in the binary image data is set to a predetermined value. In Set binarization threshold To binarize the multi-value image data Setting means to Extraction means for extracting an area corresponding to the feature value from binary image data binarized by the setting means, and an area extracted by the extraction means Detecting means for detecting the center of gravity and angle of An emphasis unit for emphasizing the multi-valued image data based on an image of a specific pattern extracted by binarizing the multi-valued image data by changing a newly set binarization threshold value, By repeating the process of binarizing the multi-valued image data emphasized by the enhancement means by the setting means, the center of gravity and angle of the region extracted by the extraction means are detected by the detection means. It is characterized by that.
[0006]
As a result, the multi-valued image data can be binarized with the optimum binarization threshold value, so that the position / angle of the object can be detected stably even with an object having a different reflectance or a dirty object.
[0033]
An image processing method as another configuration of the present invention for solving the same problem is binarizing multi-valued image data obtained by imaging an object. When doing The feature value of the image area in the binary image data is set to a predetermined value. In Set the binarization threshold A setting step for binarizing the multi-valued image data, an extraction step for extracting a region corresponding to the feature value from the binary image data binarized in the setting step, and an extraction step for extracting the region. region Detect the center of gravity and angle of A detection step; an emphasis step for enhancing the multi-valued image data based on an image of a specific pattern extracted by binarizing the multi-valued image data by changing a newly set binarization threshold value; And detecting the centroid and angle of the region extracted in the extraction step by repeating the process of binarizing the multi-valued image data emphasized in the enhancement step in the setting step. Do It is characterized by that.
[0034]
As a result, the multi-valued image data can be binarized with the optimum binarization threshold value, so that the position / angle of the object can be detected stably even with an object having a different reflectance or a dirty object.
[0061]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, as an embodiment of the present invention, an application example to a palletizing robot that holds a box as a work will be described.
[0062]
First, a system configuration of an apparatus to which the present invention is applied will be described with reference to FIG.
[0063]
FIG. 1 is a system schematic diagram of a palletizing robot to which the present invention is applied.
[0064]
In the figure, an image pickup apparatus 2 has a light receiving element (photoelectric conversion element) such as a CCD area sensor, and picks up an image of a work (box) 3 illuminated by an illumination 1 that is a surface light source. In addition, the workpiece | work 3 is set as the structure which laminated | stacked four in one step on the pallet 9 as shown in FIG. The captured image is converted into an electric signal and sent to the image processing device 4. The image processing device 4 is connected to the robot control device 5 through communication means, and communicates image data and the like. The robot control device 5 controls a robot 6 having a robot hand 8 at the tip of a robot arm 7.
The four image pickup devices 2 are arranged so that the image of each work 3 is positioned at the center of the image pickup area, and the whole image of the work (box) 3 to be moved next is linked with the movement of the robot 6. It has a mechanism to switch sequentially so that it can image.
[0065]
With the above configuration, the operation will be described in detail with reference to FIGS.
[0066]
First, an example of image formation in the image processing device 4 in the imaging range imaged by the imaging device 2 is shown. However, FIG. 2 shows an ideal state where there is no dirt.
[0067]
FIG. 2 is an ideal imaging example of the imaging range as an embodiment of the present invention.
[0068]
In the figure, 20 is an imaging range of the imaging apparatus. 21 is an image of the pallet 9 on which the work 3 is placed. Reference numeral 22 denotes an image of the lid of the workpiece 3 whose position and angle are to be obtained. The inner height of the lid is lower than that of the outer edge, and a thin shadow is formed by illumination light at the boundary between the outer edge and the inner edge. The area inside this thin shadow is extracted by the method of the present invention, and the position and angle are detected.
[0069]
One of the four workpieces 3 arranged is imaged by the imaging device 2 corresponding thereto, and the imaging data is sent to the image processing device 4. The image processing apparatus 4 detects the exact position and angle of the workpiece 3 from the imaging data by the method of the present invention, and sends it to the robot 6. The robot control device 5 controls the posture of the robot 6 based on the position and angle data of the workpiece 3 sent from the image processing device 4, holds the workpiece 3 with the robot hand 8, and places it on another pallet at another position. Move. Since the robot controller 5 communicates the switching timing of the imaging device 2 to the image processing device 4, during this time, the workpiece 3 to be gripped next is imaged by the imaging device 2 corresponding thereto, and the imaging data is captured by the image processing device 4. Sent to. Then, until the robot 6 completes the movement of the previous work 3 to another pallet and returns the robot hand 8 to the initial position, the image processing apparatus 4 sends the position and angle data of the next work 3 to the robot 6. Since the robot control device 5 obtains the position and angle data of the next workpiece 3, the robot control device 5 can immediately start gripping the next workpiece 3 as soon as the robot hand 8 is returned. By repeating these operations, a total of eight workpieces 3 can be sequentially held and moved to another pallet.
[0070]
Next, a processing procedure in which the image processing apparatus 4 obtains the position and angle of the workpiece 3 by the method of the present invention will be specifically described.
[0071]
FIG. 3 shows an outline of the processing procedure.
[0072]
FIG. 3 is a flowchart showing an outline of a processing procedure as one embodiment of the present invention.
[0073]
In the figure, step S <b> 1 is an initial setting unit that resets parameters and initializes the image processing apparatus 4. Step S2 is an optimum binarization setting unit that sets a threshold value for binarization of multi-value data that is optimal for detecting the position and angle of the workpiece 3. Step S3 is a target label extraction unit that extracts only valid portions from the image data binarized with the binarization threshold set in step S2. Step S4 is a center-of-gravity / angle calculation unit that corrects the missing part of the image data extracted and created in step S3 due to dirt, etc., and calculates the center of gravity and angle representing the position. Further, in the line emphasis processing unit in step S5, only a linear pattern that meets a predetermined condition is extracted and captured, and written in the image. And based on this image data, the process of steps S2-S4 is performed again, and a gravity center and an angle are calculated | required.
[0074]
Next, processing in each of the above steps will be described in detail.
[0075]
[Initial setting section]
FIG. 4 is a flowchart showing processing of the initial setting unit as one embodiment of the present invention.
[0076]
In the figure, first, in step S100, initial values of variables are set (the variables counter and agein are 0, and the variable histmenseki is 100000). The initialization of the image processing apparatus 4 is also performed here. In step S101, values are set for various parameters. In the present embodiment, the ideal area approximated to the area of the lid 22 of the work 3, the tolerance with the ideal area, the predetermined center-of-gravity area coordinates, the maximum number of loops of software processing, the number of enhancement loops lloop, and the fillet ( Fere) coordinates, that is, the horizontal axis when the labeled image is projected in the horizontal direction and the vertical direction, and respective lengths on the vertical axis (hereinafter, horizontal width and vertical width) are set. Next, in step S102, the video signal sent from the imaging device 2 is captured as image data into the memory, and this captured image is set as P. An example of the image at this time is shown in FIG.
[0077]
FIG. 11 is a captured image example of the imaging range as one embodiment of the present invention.
[0078]
Next, in step S103, an initial value of the binarization threshold value is obtained from the data of the image P in the memory, and the value is substituted into the variable slvl. In this embodiment, the average of the multi-value data of the pixels in the center of gravity area is taken as the initial value of the binarization threshold.
[0079]
[Optimal binarization setting section]
5A and 5B are flowcharts showing processing of the optimum binarization setting unit as an embodiment of the present invention.
[0080]
In the figure, in step S200, the initial value of the binarization threshold value is substituted for the variable lvl, and the binarization threshold value calculation routine of step S201 to step S225 is started. In step S201, the loop counter (counter) is incremented by one. In step S202, the binarization threshold is set to lvl, and the data of the image P in the memory is binarized. In many cases, the binarized image obtained here is connected to the boundary of the lid 22 of the adjacent workpiece 3. Therefore, in order to clarify the boundary, image data obtained by applying the 8-neighbor AND filter twice to the binarized data is obtained. In step S203, only white pixels (pixels having a value of 1 in the present embodiment) are labeled in the image data obtained in step S202, and moment calculation is performed to obtain the moment amount of each label. Based on the calculation result, in step S204, the area and barycentric coordinates of a label having an area equal to or larger than a predetermined set value (hereinafter referred to as an effective label) are obtained and stored, and the number of effective labels is counted. Assign to. In step S205, it is determined whether K is zero.
[0081]
If K is 0, the process proceeds to step S206. In step S206, the value of variable lvl is decreased by 10, and the process returns to step S201. If K is not 0, the process proceeds to step S207. In step S207, it is determined whether there is a center of gravity within the center of gravity area and the horizontal width and vertical width are within the set values among the effective labels. Actually, this attention label corresponds to the target lid 22 to be moved next by the robot 6. In step S208, the area of the label is substituted for variable max. In the next step S209, both the black pixel and the white pixel are relabeled, the target label is discriminated based on the area, and its number is obtained. Then, fillet coordinates are obtained for each label. Further, the inclusion relation between the target label and all labels other than the target label is examined from the obtained horizontal width and vertical width. For example, if the fillet coordinate values of the label A are all smaller than the fillet coordinate values of the label B, A is included in B. Therefore, whether or not an arbitrary label is included in the attention label can be determined only by the fillet coordinates. In step S210, the area of the label included in the target label is added to max. In step S211, the label number of the target label is substituted for the variable tmpmax, and the process proceeds to step S215.
[0082]
If there is no label that meets the conditions in step S207, the process proceeds to step S212. In step S212, both the black pixels and white pixels of the binarized image obtained in step S202 are labeled again, and moment calculation is performed. In step S213, for each pixel in the center of gravity area, the number of the label to which it belongs is obtained. In step S214, the label of the white pixel having the largest area in the center of gravity area is obtained, and this area value is substituted for max. Assign the label number to tmpmax. Actually, the white pixel corresponds to the target lid 22 to be moved next by the robot 6. Then, the process proceeds to step S215.
[0083]
In step S215, in order to obtain the case where the difference between the ideal area is minimized by comparing the area max based on the current binarization threshold and the area histmenseki based on the previous binarization threshold, | ideal area−max | < Determine whether | ideal area-histmenseki | is true or false. If true, the area max according to the current binarization threshold is smaller in the difference from the ideal area, so the value of max is substituted into histmenseki. Further, the binary image at this time is stored in the memory, and the value of lvl at this time is substituted into the variable bestlvl. If false, the process proceeds to step S217 while keeping the area histmenseki based on the binarization threshold up to the previous time.
[0084]
In steps S217 to S224, the next binarization threshold value is calculated based on the current threshold value lvl. In step S217, it is determined whether | ideal area−max |> tolerance is true or false. If false, it means that the optimum binarization threshold value has been obtained, and the process moves to step S218, 1 is set in agein, and the process moves to step S225. If true, the process proceeds to step S219, and (max−ideal area) × 0.0004 is substituted for the variable dtmp. In the next step S220, it is determined whether or not the absolute value of dtmp is larger than 3.0. If it is larger, the process proceeds to step S222, the value of dtmp is added to lvl, and the process proceeds to step S225. On the other hand, if the value is 3.0 or less, the process proceeds to step S221. In step S221, it is determined whether dtmp is larger than 0.0. If it is larger, lvl is incremented by 1 in step S223, and the process proceeds to step S225. If dump is 0.0 or less in step S221, lvl is decremented by -1 in step S224, and the process proceeds to step S225. In step S225, if agein is 0 and the condition that counter <the maximum number of loops is true, the process proceeds to step S201, and the above-described process is continued with a new threshold value lvl. If the condition is false, the optimal binarization setting is terminated.
[0085]
[Attention label extraction section]
FIG. 6 is a flowchart showing the processing of the target label extraction unit as one embodiment of the present invention.
[0086]
In the figure, it is determined whether or not agein is 0 in step S300. If not 0, the process proceeds to step S306. If 0, the process proceeds to the next step S301.
[0087]
In step S301, the value of histmenseki is substituted for max. In step S302, the binary image stored last in step S216 in the optimum binarization setting process is returned to the processing memory. In step S303, white pixels in the image data are labeled, and further moment calculation is performed. . In step S304, a value five times the tolerance is substituted into the variable MTMP, and −1 is set in tmpmax. In step S305, a label having the minimum value is obtained from those having a center of gravity within the center of gravity area and the absolute value of the difference between the area and histmenseki being smaller than MTMP, and the label number is entered in tmpmax. In step S306, the value of tmpmax is determined. If tmpmax is smaller than 0, an error is displayed and the process ends. If it is greater than or equal to 0, the process proceeds to the next step S307. In step S307, only the tmpmax-th label is extracted to create an image, and the attention label extraction process is terminated.
[0088]
[Center of gravity / angle calculation unit]
FIG. 7 is a flowchart showing processing of the center of gravity / angle calculation unit as one embodiment of the present invention.
[0089]
In the figure, in step S400, an expansion process is performed by applying an 8-neighbor OR filter to each pixel four times for the image data created in step S307, thereby correcting missing portions. An image obtained by performing the processing so far on the captured image P is shown in FIG.
[0090]
FIG. 12 is an example of an intermediate processed image as one embodiment of the present invention.
[0091]
In the next step S401, the white and black pixels of the binarized image obtained in step S400 are labeled and moment calculation is performed, and in step S402, the area of the label other than the background and the first moment are added. In step S403, the center-of-gravity coordinates are obtained by calculating the center of gravity based on the value obtained in step S402. This coordinate represents the position of the workpiece 3 to be obtained. In step S404, labeling and moment calculation are performed again only on white pixels, and the area and secondary moment amount of each label are obtained. In step S405, a circumscribed rectangle is obtained for the label having the largest area among the labels labeled in step S404. Further, the center is obtained from the vertex coordinates of the circumscribed rectangle. Then, the ratio between the inertial main axis and the sub-axis orthogonal thereto is obtained from the secondary moment amount obtained in step S404, and is substituted into the variable zikuhi. The center coordinates and zikuhi are used for NG determination of the detection result. In this case, the center coordinates and the center-of-gravity position obtained previously are rectangular because the extraction region is a rectangle. If the extraction is performed accurately, the two coordinates should match. For zikuhi, a value calculated using a clean lid 22 without dirt is recorded in advance, and NG determination is performed by comparing with the value. In addition, although the inclination of the inertia main axis obtained at this time may be used as the angle of the work 3, the following processing is performed in order to obtain a more accurate value. That is, in step S406, the contour is obtained by applying an 8-neighbor edge extraction filter to the image data as shown in FIG. 12 that has not completely reproduced the shape of the lid 22 yet. Further, in order to obtain the horizontal portion of the obtained contour line, the horizontal 2-neighbor AND filter is applied twice, and then the 8-neighbor OR filter is applied twice. In step S407, white pixels are labeled again on the image thus formed, and moment calculation is performed. In the next step S408, the value obtained by dividing the secondary moment around the inertial spindle by the secondary moment around the secondary axis to obtain the angle based on the longest item in each of the various labels in the horizontal direction. In step S409, the angle is obtained from the second moment of the label having the maximum value (the longest in the horizontal direction) obtained in step S408. This represents the angle of the workpiece 3.
[0092]
Further, the following line emphasis processing will be described in order to calculate the angle of the workpiece 3 stably and reliably. Therefore, if the angle of the workpiece 3 can be obtained practically only by the above processing, the line emphasis processing may not be performed.
[0093]
[Line emphasis processing]
FIG. 8 is a flowchart showing the overall processing of the line emphasis processing unit as one embodiment of the present invention.
[0094]
In the figure, in step S500, the value of lloop is determined. If it is 2, the process proceeds to step S501. If it is less than 2, the process proceeds to step S508. In step S501, mlimit is set to 100, counter is set to 0, and the value of bestlvl + 10 is set to glvl. In step S502, the multivalued image data in the image memory is copied to another memory area. The area where the original multi-value image data exists is called a memory area 0, and the copied area is called a memory area 1. Steps S503 to S506 are a line extraction / write routine. In step S503, counter is incremented by 1, and line extraction / write processing is performed in step S504. In step S505, the value of glvl is decremented by 2. In the next step S506, it is determined whether or not counter is 20 or less. If it is 20 or less, the process returns to S503 again. If counter is greater than 20, the process proceeds to step S507. In step S507, the value of bestlvl is set in slvl. In step S508, the value of lloop is decremented by one. In step S509, it is determined whether or not the value of lloop is larger than 0. If it is larger, the process shifts again to the optimal binarization setting process, and the processes in steps S2 to S4 are performed to recalculate the position and angle. If the value of 11oop is 0 or less, the process is terminated, and the position and angle obtained in the previous centroid / angle calculation process are set as the position and angle of the object. An example of the image at this time is shown in FIG.
[0095]
FIG. 16 is an example of an image after line enhancement processing as one embodiment of the present invention.
[0096]
Compared with the case of FIG. 12 which is the processing result of steps S2 to S4 described above, there is no missing portion due to dirt or uneven brightness, and an image substantially equal to the contour of the inner region of the target lid 22 is obtained. I understand that.
[0097]
Next, details of the line extraction / writing process in step S504 will be described.
[0098]
FIG. 9 is a flowchart showing line extraction / writing processing as one embodiment of the present invention.
[0099]
In the figure, in step S600, the multi-valued image data stored in the memory area 1 in step S502 is inverted and binarized with a threshold value glvl, which is passed through an 8-neighbor edge extraction filter and an inversion filter, and further horizontal. Pass the OR filter twice. The binarized image processed in this way is further passed through a horizontal AND filter four times in step S601, and the result is stored. An example of the image at this time is shown in FIG.
[0100]
FIG. 13 is an example of an image after horizontal line extraction as one embodiment of the present invention.
[0101]
In the figure, an image created by the Kth binarization level is MK. In step S602, labeling and moment calculation are performed on the black pixels of the binarized image. The horizontal image obtained here is written into the multi-valued image in the memory area 0 in step S603. Next, in step S604, the multi-valued image data stored in the memory area 1 in step S502 is inverted and binarized again with the threshold value glvl, and this is passed through an 8-neighbor edge extraction filter and an inversion filter. Pass the vertical OR filter twice. The binarized image thus processed is passed through the vertical AND filter four times in step S605, and the result is stored. An example of the image at this time is shown in FIG.
[0102]
FIG. 14 is an example of an image after vertical line extraction as one embodiment of the present invention.
[0103]
In the figure, an image created by the Kth binarization level is denoted as NK. In step S606, labeling and moment calculation are performed on the black pixels of the binary image. In step S607, the obtained vertical image is written in the horizontal line-written multi-value image in the memory area 0, and the line extraction / writing process ends.
[0104]
Details of the above-described line writing process will be described with reference to FIG.
[0105]
FIG. 10 is a flowchart showing the line writing process as an embodiment of the present invention, which is the horizontal line writing process in step S603 and the vertical line writing process in step S607.
[0106]
In the figure, in step S700, a variable i is set to 0 and initialized. In the next step S701, the value of i is determined, and if it is equal to or greater than the total number of labels, the process is terminated, and if it is less than the total number of labels, the process proceeds to the next step S702. In step S702, it is determined whether or not the area of the i-th label is larger than a constant mlimit. If so, the process proceeds to step S703. In step S703, the ratio of the length of the inertia main axis and the sub axis of the label is determined from the amount of moment previously determined. In the next step S704, it is determined whether or not this ratio is smaller than a constant lvalue. If not smaller, the process proceeds to step S706, the value of i is incremented by 1, and the process proceeds again to step S701. If it is smaller, the process proceeds to step S705. In step S705, the image of the i-th label is written in the multivalued image in the memory area 0, and the process proceeds to step S706.
[0107]
Next, FIG. 15 shows an example of image data after completion of the line extraction / writing process.
[0108]
FIG. 15 is an example of an image after line extraction / writing processing as one embodiment of the present invention.
[0109]
If the image at the first capture is P, the horizontal and vertical extracted line images created by the Kth binarization level are MK and NK, respectively, and the image data after the line writing process is Q, Q is a number. It is represented by 1.
[0110]
[Expression 1]
Figure 0003715683
[0111]
In the present embodiment, a line pattern is used as an object of an emphasis process described later, but other patterns may be used depending on the shape of the work 3.
[0112]
Needless to say, the present invention can be applied if the imaging devices are arranged according to the number of works arranged in one stage.
[0113]
Furthermore, the present invention may be applied to a system composed of a plurality of devices or an apparatus composed of a single device. Needless to say, the present invention can also be applied to a case where the present invention is achieved by supplying a program to a system or apparatus. In this case, the storage medium storing the program according to the present invention constitutes the present invention. Then, by reading the program from the storage medium to the system or apparatus, the system or apparatus operates in a predetermined manner.
<Effect of embodiment>
(1) Since the number of imaging devices 2 is the number of one stage (four) of workpieces 3 placed on the pallet, and the imaging area of the imaging device 2 is one workpiece 3 and its vicinity, the image processing software is simple. I was able to build.
(2) In the optimum binarization setting unit, first, the binarized image is contracted by the 8-neighbor AND filter (twice), so that the boundary between the lid 22 of the target workpiece 3 and the lid 22 of the workpiece 3 adjacent to the target is separated. I was able to clarify.
(3) In the optimum binarization setting unit, when the attention label cannot be selected from the effective labels (step S207), that is, the brightness unevenness and dirt of the lid 22 of the target work 3 are intense, and the binarized image Even when the effective label corresponding to the lid 22 of the target work 3 cannot be found from among the labels, the largest item among the labels is determined as the lid 22 of the target work 3, Even if the condition was quite bad, the subsequent correction process could be continued.
(4) In the optimum binarization setting unit, the predetermined ideal area is compared with the area of the label of interest or the largest label among the effective labels, and the binarization threshold value of the multi-value image data based on the difference It was possible to quickly find the optimal binarization threshold by changing the value to a large or small value and narrowing it to the minimum.
(5) Since the center of gravity / angle calculation unit performs the expansion process using the 8-neighbor OR filter (four times), correction of the small missing portion of the binarized image corresponding to the lid 22 of the target work 3 is completed at this point. I was able to.
(6) In the center of gravity / angle calculation unit, the contour is obtained by the 8-neighbor edge extraction filter, and the horizontal of the obtained contour is obtained by performing the horizontal 2-neighbor AND filter (twice) and the 8-neighbor OR filter (twice). By obtaining only the portion and performing moment calculation, the shape of the extraction region (rectangle) can be used effectively, and the lid 22 angle of the target workpiece 3 can be stably calculated.
(7) By performing line emphasis processing and writing a contour line in the multi-valued image, the unevenness and dirt of the brightness of the lid 22 of the target work 3 are severe, and the center of gravity is obtained even when the state of the binarized image is quite bad・ An angle calculation could be performed more stably.
(8) In the line emphasis processing unit, the multivalued image data is inverted and binarized with a threshold value glvl, and an 8-neighbor edge extraction filter, an inversion filter, a horizontal (or vertical) OR filter (twice), and further horizontal (or The contour of the lid 22 of the target workpiece 3 could be reliably captured by calculating the maximum object by performing a vertical AND filter (four times) and calculating the moment.
[0114]
【The invention's effect】
As described above, according to the present invention, a position and an angle can be stably detected from image data even for an object where a part of the surface of the object is dirty or light is unevenly reflected. And an apparatus for detecting the same can be provided. Further, by performing the line emphasis processing together, the position and angle can be detected more stably.
[0115]
[Brief description of the drawings]
FIG. 1 is a system schematic diagram of a palletizing robot to which the present invention is applied.
FIG. 2 is an ideal imaging example of an imaging range as an embodiment of the present invention.
FIG. 3 is a flowchart showing an outline of a processing procedure according to an embodiment of the present invention.
FIG. 4 is a flowchart showing processing of an initial setting unit as one embodiment of the present invention.
FIG. 5A is a flowchart showing processing of an optimum binarization setting unit as one embodiment of the present invention.
FIG. 5B is a flowchart showing processing of an optimum binarization setting unit as one embodiment of the present invention.
FIG. 6 is a flowchart showing processing of a target label extraction unit as one embodiment of the present invention.
FIG. 7 is a flowchart showing processing of a center of gravity / angle calculation unit as one embodiment of the present invention.
FIG. 8 is a flowchart showing overall processing of a line emphasis processing unit as one embodiment of the present invention.
FIG. 9 is a flowchart showing line extraction / writing processing according to an embodiment of the present invention.
FIG. 10 is a flowchart showing a line writing process as one embodiment of the present invention.
FIG. 11 is a captured image example of an imaging range as an embodiment of the present invention.
FIG. 12 is an example of an intermediate processed image as an embodiment of the present invention.
FIG. 13 is an example of an image after horizontal line extraction as an embodiment of the present invention.
FIG. 14 is an example of an image after vertical line extraction as an embodiment of the present invention.
FIG. 15 is an example of an image after line extraction / writing processing according to an embodiment of the present invention;
FIG. 16 is an example of an image after line enhancement processing according to an embodiment of the present invention.
[Explanation of symbols]
1 Lighting with diffuser
2 Work
3 Imaging device
4 Image processing device
5 Robot controller
6 Robot
7 Robot arm
8 Robotic hand
9 Palette
20 Imaging area
21 Palette image
22 Image of work 3 lid

Claims (2)

物体を撮像して得られる多値画像データを二値化する際に、二値画像データの中の像域の特徴値が、予め設定した所定の値となるよう二値化しきい値を設定して前記多値画像データを二値化する設定手段と、
前記設定手段によって二値化される二値画像データから前記特徴値に対応する領域を抽出する抽出手段と、
前記抽出手段において抽出される領域の重心と角度とを検出する検出手段と、
新たに設定された二値化しきい値を変化させて前記多値画像データを二値化して抽出された特定パターンの画像に基づき、前記多値画像データを強調する強調手段と、を有し、
前記強調手段によって強調された多値画像データを、前記設定手段によって二値化する処理を繰り返すことにより、前記抽出手段によって抽出される領域の重心と角度とを前記検出手段によって検出することを特徴とする画像処理装置。
When binarizing multi-valued image data obtained by imaging an object , the binarization threshold is set so that the feature value of the image area in the binary image data becomes a predetermined value. Setting means for binarizing the multi-value image data ;
Extraction means for extracting a region corresponding to the feature value from binary image data binarized by the setting means;
Detecting means for detecting the center of gravity and angle of the region extracted by the extracting means ;
An emphasis unit for emphasizing the multi-valued image data based on an image of a specific pattern extracted by binarizing the multi-valued image data by changing a newly set binarization threshold value,
The detection means detects the center of gravity and the angle of the region extracted by the extraction means by repeating the process of binarizing the multi-value image data emphasized by the enhancement means by the setting means. An image processing apparatus.
物体を撮像して得られる多値画像データを二値化する際に、二値画像データの中の像域の特徴値が、予め設定した所定の値となるよう二値化しきい値を設定して前記多値画像データを二値化する設定ステップと、
前記設定ステップにおいて二値化される二値画像データから前記特徴値に対応する領域を抽出する抽出ステップと、
前記抽出ステップにおいて抽出される領域の重心と角度とを検出する検出ステップと、
新たに設定された二値化しきい値を変化させて前記多値画像データを二値化して抽出された特定パターンの画像に基づき、前記多値画像データを強調する強調ステップと、を有し、
前記強調ステップにおいて強調された多値画像データを、前記設定ステップにおいて二値化する処理を繰り返すことにより、前記抽出ステップにおいて抽出される領域の重心と角度とを前記検出ステップにおいて検出することを特徴とする画像処理方法。
When binarizing multi-valued image data obtained by imaging an object , the binarization threshold is set so that the feature value of the image area in the binary image data becomes a predetermined value. A setting step for binarizing the multi-value image data;
An extraction step of extracting a region corresponding to the feature value from the binary image data binarized in the setting step;
A detection step of detecting the center of gravity and angle of the region extracted in the extraction step ;
An emphasis step for emphasizing the multi-valued image data based on an image of a specific pattern extracted by binarizing the multi-valued image data by changing a newly set binarization threshold value,
The center of gravity and angle of the region extracted in the extraction step are detected in the detection step by repeating the process of binarizing the multi-value image data emphasized in the enhancement step in the setting step. An image processing method.
JP16766295A 1995-03-13 1995-07-03 Image processing apparatus and image processing method therefor Expired - Fee Related JP3715683B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16766295A JP3715683B2 (en) 1995-03-13 1995-07-03 Image processing apparatus and image processing method therefor

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP7929695 1995-03-13
JP7-79296 1995-03-13
JP16766295A JP3715683B2 (en) 1995-03-13 1995-07-03 Image processing apparatus and image processing method therefor

Publications (2)

Publication Number Publication Date
JPH08315153A JPH08315153A (en) 1996-11-29
JP3715683B2 true JP3715683B2 (en) 2005-11-09

Family

ID=26420326

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16766295A Expired - Fee Related JP3715683B2 (en) 1995-03-13 1995-07-03 Image processing apparatus and image processing method therefor

Country Status (1)

Country Link
JP (1) JP3715683B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6896307B1 (en) * 2020-07-28 2021-06-30 株式会社サイバーウェア Image judgment method and image judgment device

Also Published As

Publication number Publication date
JPH08315153A (en) 1996-11-29

Similar Documents

Publication Publication Date Title
EP2045772B1 (en) Apparatus for picking up objects
KR100823549B1 (en) Recognition method of welding line position in shipbuilding subassembly stage
JP2004050390A (en) Work taking out device
US6690819B1 (en) Method and apparatus for recognizing components
JP2019192022A (en) Image processing apparatus, image processing method, and program
CN112338898B (en) Image processing method and device of object sorting system and object sorting system
JP3715683B2 (en) Image processing apparatus and image processing method therefor
JPH08315152A (en) Image recognition device
Chan et al. Automating laser scanning of 3D surfaces for reverse engineering
JPH0953915A (en) Method for recognizing overlapping state
JPH10118975A (en) Handling position recognizing method and recognizing device
US5881167A (en) Method for position recognition
JP2000194861A (en) Method and device for recognizing image
JPH1196378A (en) Load position/attitude recognizing device
JPH10213420A (en) Formation of reference image used in pattern matching
JP2001291105A (en) Method and device for recognizing pattern
JP2710685B2 (en) Defect detection method by visual inspection
JP3375242B2 (en) Robot object recognition method and apparatus
JP3552419B2 (en) Object recognition method
JPH0676969B2 (en) Method and apparatus for inspecting articles having repetitive patterns
JP2745763B2 (en) Wiring pattern inspection equipment
JPH05113315A (en) Detecting method for center position of circular image data
JP2000294612A (en) Method and device for creating chip layout
JPH041282B2 (en)
JP2002230564A (en) Contour extraction device and method and contour extraction program

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050208

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050509

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050706

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050826

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20090902

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090902

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100902

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110902

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110902

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120902

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees