JP2004220371A - Image processing method, image processor, image processing program, and recording medium recorded with image processing program - Google Patents

Image processing method, image processor, image processing program, and recording medium recorded with image processing program Download PDF

Info

Publication number
JP2004220371A
JP2004220371A JP2003007531A JP2003007531A JP2004220371A JP 2004220371 A JP2004220371 A JP 2004220371A JP 2003007531 A JP2003007531 A JP 2003007531A JP 2003007531 A JP2003007531 A JP 2003007531A JP 2004220371 A JP2004220371 A JP 2004220371A
Authority
JP
Japan
Prior art keywords
image
image processing
distortion
marks
distance
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
JP2003007531A
Other languages
Japanese (ja)
Other versions
JP4248885B2 (en
Inventor
Munetoshi Imada
宗利 今田
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.)
Sharp Corp
Sharp Manufacturing Systems Corp
Original Assignee
Sharp Corp
Sharp Manufacturing Systems 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 Sharp Corp, Sharp Manufacturing Systems Corp filed Critical Sharp Corp
Priority to JP2003007531A priority Critical patent/JP4248885B2/en
Publication of JP2004220371A publication Critical patent/JP2004220371A/en
Application granted granted Critical
Publication of JP4248885B2 publication Critical patent/JP4248885B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To detect a strain in an image, and to precisely correct the strain. <P>SOLUTION: A calibration plate is imaged up in step A1, and the picked-up image is divided into a plurality of individual areas to calculate a transformation conversion coefficient of projection transformation in every of the individual areas. A moving amount of coordinates by the projection transformation is calculated the individual area by the individual area in step A2, based on the transformation coefficient found in step A1. The presence of the strain in the image is diagnosedly determined when the moving amount is larger than a prescribed value. Calibration for calculating a distance per one picture element is carried out based on the distance between two points of a picture element unit in the image and the distance between two points measured actually, in step A3. <P>COPYRIGHT: (C)2004,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、撮像装置などから入力された画像に対して図形処理を行う画像処理方法および画像処理装置に関し、特に画像の歪みを診断および補正する画像処理方法および画像処理装置ならびに画像処理プログラムおよび画像処理プログラムを記録した記録媒体に関する。
【0002】
【従来の技術】
CCDカメラなど撮像装置の普及に伴い、被写体を撮像した画像に基づいて様々な処理を行う画像処理が工場内や家庭内を問わず行われている。たとえば、工場内では、製品の組み立てや不良検査など、家庭内では、デジタルカメラやスキャナによる画像取り込み、防犯カメラによるセキュリティシステムなどで画像処理が行われている。
【0003】
これらの中でも特に、製品の組み立てにおける部品の位置合わせや、製品の不良箇所の検出では、高精度で物体の位置検出および寸法計測を実現する必要があり、画像処理に対しても高い精度の処理が要求される。
【0004】
画像処理の精度低下の主な原因として、撮像装置のあおりおよびレンズ歪み、被写体の撓みなどがある。
【0005】
このような画像の歪みは、射影変換を用いて補正することができる。射影変換による画像の歪み補正の代表的な技術として以下の3種類の技術がある。
【0006】
(1)撮像装置以外の各種センサを用いる(特許文献1参照)。
各種センサを使い、撮像装置と被写体との位置関係(距離や角度)を実測し、その実測値から変換関数を算出する。使用するセンサには加速度センサ、角速度センサ、磁気センサ、超音波センサ、赤外線センサなどがある。
【0007】
(2)マニュアルで設定する(特許文献2,3参照)。
変換関数の算出に必要な情報をマニュアルで設定する。必要な情報は4点の座標で、変換前の画像から適当な4点を選び、これらの点が変換後に移動すべき座標を指定する。変換前後の座標から変換関数を算出する。
【0008】
(3)被写体の特徴点を用いる(特許文献4参照)。
被写体から特徴点を捜し出し、その特徴点が所定位置に移動するように変換関数を算出する。被写体毎に変換関数が算出できるため、位置関係が変化する場合には有効である。
【0009】
【特許文献1】
特開2000−307947号公報
【特許文献2】
特開平7−44698号公報
【特許文献3】
特開平11−238123号公報
【特許文献4】
特開2001−177716号公報
【0010】
【発明が解決しようとする課題】
(1)のように撮像装置以外に各種センサを用いる場合は、別途センサを設ける必要があるため、装置の規模が大きくなり、コストも増大する。また、高精度で補正するには、撮像装置と、センサとの位置調整が複雑である。
【0011】
(2)のようにマニュアルで設定する場合は、作業者の負担が大きいという問題がある。また、作業者によって設定が変わるなど客観性に乏しく、必ずしも高精度とはならない。
【0012】
(3)のように被写体の特徴点を用いる場合は、被写体が適切な特徴点を備えていることが必要となる。
【0013】
また、上記のいずれの場合でも、全領域を1つの変換関数で変換するため、歪みの原因が、撮像装置のあおりだけであれば補正することは可能であるが、レンズ歪みや被写体の撓みが原因であれば、補正することはできない。
【0014】
本発明の目的は、画像の歪みを検出し、高精度で歪み補正を行う画像処理装置および画像処理方法ならびに画像処理プログラムおよび画像処理プログラムを記録した記録媒体を提供することである。
【0015】
【課題を解決するための手段】
本発明は、少なくとも隣接する2つのマークの距離が所定の誤差範囲内となるような複数のマークが配置された校正板を撮像する撮像ステップと、
撮像された画像のうち歪みが最も少ない領域のマークの配置に関するパラメータを抽出する抽出ステップと、
撮像された画像を複数の個別領域に分割する分割ステップと、
抽出されたパラメータに基づいて、前記個別領域ごとに、含まれるマークの配置の歪みを検出する検出ステップと、
検出されたマークの配置の歪みに基づいて、撮像された画像全体が歪んでいるか否かを診断する診断ステップとを有することを特徴とする画像処理方法である。
【0016】
本発明に従えば、撮像ステップでは、少なくとも隣接する2つのマークの距離が所定の誤差範囲内となるような複数のマークが配置された校正板を撮像する。
【0017】
抽出ステップでは、撮像された画像のうち歪みが最も少ない領域のマークの配置に関するパラメータを抽出する。校正板をCCDカメラなどを用いて撮像した場合、レンズの中央部で撮像した領域、すなわち画像の中央部領域のマークに関するパラメータを抽出すればよい。
【0018】
分割ステップでは、撮像された画像を複数の個別領域に分割する。分割することで、個別領域ごとに歪み検出ができる。
【0019】
検出ステップでは、抽出されたパラメータに基づいて、個別領域ごとに、含まれるマークの配置の歪みを検出する。
【0020】
診断ステップでは、検出されたマークの配置の歪みに基づいて、撮像された画像全体が歪んでいるか否かを診断する。
【0021】
このように、個別領域ごとに歪みを検出するので、撮像装置のあおり以外にもレンズの歪みや、被写体の撓みによる画像の歪みも診断することができる。
【0022】
また、画像の歪みを診断するためには校正板を用いるだけでよく、各種センサなどは必要が無いので、歪み診断機能が追加されても装置規模が拡大することも、複雑な装置の調整を行うこともなく、コストを抑えることができる。
【0023】
また本発明は、前記抽出ステップは、歪みが最も少ない領域内で、隣接するマーク間の距離を複数検出し、検出された距離の平均を基準距離として算出し、前記基準距離を用いて、撮像された全マークの座標を理想座標として抽出することを特徴とする。
【0024】
本発明に従えば、抽出ステップでは、まず歪みが最も少ない領域内で、隣接するマーク間の距離を複数検出する。検出された距離の平均を基準距離として算出し、この基準距離を用いて、撮像された全マークの座標を理想座標として抽出する。
【0025】
センサなどを別途用いずに、歪みを診断するための比較対象を容易に取得することができる。
【0026】
また本発明は、前記検出ステップは、前記個別領域ごとに、前記理想座標と撮像されたマークの座標とから射影変換係数を算出し、算出された射影変換係数に基づいて、射影変換による座標の移動量を検出することを特徴とする。
【0027】
本発明に従えば、検出ステップでは、個別領域ごとに、理想座標と撮像されたマークの座標とから射影変換係数を算出し、算出された射影変換係数に基づいて、射影変換による座標の移動量を検出する。
【0028】
このように、射影変換を用いるので、高精度かつ容易に歪みを検出することができる。
【0029】
また本発明は、前記診断ステップは、全領域の座標について、個別領域ごとに検出された前記移動量と所定の閾値とを比較し、移動量が閾値以上となる個別領域の数に基づいて診断することを特徴とする。
【0030】
本発明に従えば、診断ステップでは、個別領域ごとに検出された移動量と所定の閾値とを比較し、移動量が閾値以上となる個別領域の数に基づいて診断する。
【0031】
このように、閾値との比較および閾値の条件に該当する個別領域の個数によって画像全体の歪みを診断するので、閾値や個別領域の数を変更することで作業者および被写体に応じて診断精度を変更することができる。
【0032】
また本発明は、前記診断ステップで撮像された画像が歪んでいると診断されたときは、前記射影変換係数に基づいて射影変換を行うことで撮像された画像を補正する補正ステップをさらに有することを特徴とする。
【0033】
本発明に従えば、診断ステップで撮像された画像が歪んでいると診断されたときは、補正ステップで射影変換係数に基づいて射影変換を行うことで撮像された画像を補正する。
【0034】
個別領域ごとに算出された射影変換係数に基づいて補正を行うので、撮像装置のあおり以外にもレンズの歪みや、被写体の撓みによる画像の歪みも精度よく補正することができる。また、検出ステップで算出された射影変換係数を用いることで補正に必要な演算量を削減することができる。
【0035】
また本発明は、撮像された画像における画素数に基づくマーク間の距離と、前記校正板に配置されたマーク間の実測距離とから、1画素当たりの距離を算出する距離算出ステップさらに有することを特徴とする。
【0036】
本発明に従えば、距離算出ステップでは、撮像された画像における画素数に基づくマーク間の距離と、校正板に配置されたマーク間の実測距離とから、1画素当たりの距離を算出する。1画素当たりの距離は、いわゆるキャリブレーションファクタと呼ばれ、このキャリブレーションファクタを用いることで、撮像した画像から被写体の実際の寸法を計測することができる。
【0037】
また本発明は、上記の画像処理方法をコンピュータに実行させるための画像処理プログラムである。
【0038】
本発明に従えば、上記の画像処理方法をコンピュータに実行させるための画像処理プログラムとして提供することができる。
【0039】
また本発明は、上記の画像処理方法をコンピュータに実行させるための画像処理プログラムを記録したコンピュータ読み取り可能な記録媒体である。
【0040】
本発明に従えば、上記の画像処理方法をコンピュータに実行させるための画像処理プログラムを記録したコンピュータ読み取り可能な記録媒体として提供することができる。
【0041】
また本発明は、少なくとも隣接する2つのマークの距離が所定の誤差範囲内となるような複数のマークが配置された校正板を撮像する撮像手段と、
撮像された画像のうち歪みが最も少ない領域のマークの配置に関するパラメータを抽出する抽出手段と、
撮像された画像を複数の個別領域に分割する分割手段と、
抽出されたパラメータに基づいて、前記個別領域ごとに、含まれるマークの配置の歪みを検出する検出手段と、
検出されたマークの配置の歪みに基づいて、撮像された画像全体が歪んでいるか否かを診断する診断手段とを有することを特徴とする画像処理装置である。
【0042】
本発明に従えば、撮像手段が、少なくとも隣接する2つのマークの距離が所定の誤差範囲内となるような複数のマークが配置された校正板を撮像する。
【0043】
抽出手段は、撮像された画像のうち歪みが最も少ない領域のマークの配置に関するパラメータを抽出する。校正板をCCDカメラなどを用いて撮像した場合、レンズの中央部で撮像した領域、すなわち画像の中央部領域のマークに関するパラメータを抽出すればよい。
【0044】
分割手段は、撮像された画像を複数の個別領域に分割する。分割することで、個別領域ごとに歪み検出ができる。
【0045】
検出手段は、抽出されたパラメータに基づいて、個別領域ごとに、含まれるマークの配置の歪みを検出する。
【0046】
診断手段は、検出されたマークの配置の歪みに基づいて、撮像された画像全体が歪んでいるか否かを診断する。
【0047】
このように、個別領域ごとに歪みを検出するので、撮像装置のあおり以外にもレンズの歪みや、被写体の撓みによる画像の歪みも診断することができる。
【0048】
また、画像の歪みを診断するためには校正板を用いるだけでよく、各種センサなどは必要が無いので、歪み診断機能が追加されても装置規模が拡大することも、複雑な装置の調整を行うこともなく、コストを抑えることができる。
【0049】
【発明の実施の形態】
図1は、画像処理システム100の構成を示すブロック図である。画像処理システム100は、撮像装置1、画像処理装置2、表示装置3を有し、たとえば、部品の位置合わせシステムを構成する。
【0050】
撮像装置1は、CCD(電荷結合素子)カメラ11、A/D(アナログ/デジタル)変換器12、カメラコントローラ13、D/A変換器14およびフレームメモリ15からなる撮像手段である。CCDカメラ11が、被写体を撮像し、受光量をアナログ画像信号として出力する。A/D変換器12は、CCDカメラ11から出力されたアナログ画像信号をデジタルデータに変換し、デジタル画像データとして出力する。カメラコントローラ14は、デジタル画像データを1フレームごとにフレームメモリ15に格納するとともに、表示装置3に表示させるために、D/A変換器14に出力する。D/A変換器は、カメラコントローラ14から出力されたデジタル画像データを表示装置3に応じたアナログ画像信号に変換して表示装置3に出力する。表示装置3は、LCD(Liquid Crystal Display)やCRT(Cathode Ray Tube)ディスプレイなどで実現され、撮像装置1から出力されたアナログ画像信号を表示する。
【0051】
画像処理装置2は、CPU(中央演算処理装置)21、RAM(Random
Access Memory)22、ROM(Read Only Memory)23およびI/O(Input/Output)コントローラ24からなる。CPU21は、ROM23に記憶されている制御プログラムに基づいて画像処理装置2の動作を制御する。処理中の画像データや演算中のデータなどは一時的にRAM22に記憶される。I/Oコントローラ24は、キーボードやマウスなどの入力装置や部品の移動装置などが接続され、これらの入出力データの制御を行う。
【0052】
CPU21およびROM23は、抽出手段、分割手段、検出手段および診断手段を構成し、撮像装置2のカメラコントローラ14を介してフレームメモリ15から画像データを取得し、後述の画像処理を実行する。
【0053】
本発明は、CCD11が備えるレンズの歪み、撮像装置1の光軸が被写体に対して傾くあおり、被写体の撓みなどによる撮像画像の歪みを診断し、補正して歪みの無い補正画像を出力する。
【0054】
具体的には、基準となるマークを配列した校正板4を撮像装置1で撮像し、画像処理装置2で撮像画像に歪みがあるかどうかを診断し、歪みがあれば歪みを補正する。
【0055】
画像処理装置2が実行する画像処理方法は、撮像した画像の歪みを診断する「歪み診断モード」と、診断モードで補正が必要であると診断した場合に画像の歪みを補正する「歪み補正モード」との2つの画像処理方法からなる。
【0056】
さらに、「歪み診断モード」は、ティーチング、画像歪み診断(診断要なら変換係数変換テーブル作成)、補正確認およびキャリブレーションの3つの処理を行い、「歪み補正モード」では、診断時に作成した変換係数に基づく変換テーブル作成、変換テーブルに基づく歪み補正、歪み補正の確認の3つの処理を行う。
【0057】
まず、歪み診断モードについて説明する。図2は、歪み診断モードの処理を示すフローチャートである。歪み診断モードは、3つのステップからなり、まず、ステップA1で校正板を用いたティーチングを行い、ステップA2で画像に歪みがあるか否かを診断し、ステップA3でキャリブレーションを行う。
【0058】
以下では各ステップについて詳細を説明する。
図3は、ステップA1のティーチング処理を示すフローチャートである。
【0059】
ステップB1では、撮像装置1で基準マークを配列した校正板4を撮像する。図4および図5は、校正板4の例を示す図である。図4は、均一格子を用いた校正板4を示し、図5は複合格子を用いた校正板4を示している。校正板4には、円形の基準マークが設けられており、基準マークの大きさ、基準マーク間の距離(マーク中心間の距離)などが所定の誤差範囲となるように高精度に配置されている。
【0060】
図4に示す均一格子の場合は、基準マークの大きさおよび基準マーク間の距離が、配置されている全ての基準マークにおいて同じになっている。図5に示す複合格子の場合は、基準マークの大きさおよび基準マーク間の距離が、複数種類あり、たとえば、図のように校正板の中央領域は、基準マークが小さく、基準マーク間の距離も小さい領域となっており、周辺領域は、基準マークが大きく、基準マーク間の距離も大きい領域となっている。複合格子を用いれば、撮像装置や被写体などに応じて格子を切り替えることができるので、複数種類の校正板を用意する必要がなく、より精度を向上させることができる。
【0061】
ステップB2では、撮像された画像を表示装置3に表示し、表示されている画像から、ティーチングに使用する領域を歪み補正用ウインドウとして指定する。指定の方法は、図6に示すように、ユーザが表示装置3に表示された画像を見ながら、マウスやタブレットなどの入力装置を用いて歪み補正用ウインドウWを指定する。なお、校正板4として均一格子を用いた場合は、撮像された全ての領域をティーチングに用いてもよい。この場合は、ユーザによる操作は不要となる。
【0062】
ステップB3では、歪み補正用ウインドウW内全体の基準マーク配列パターンをユーザが設定する。設定は、縦および横に配列されている基準マークの個数を入力する。たとえば、図6のパターンは、縦6個、横6個の配列パターンである。
【0063】
ステップB4では、校正板が均一格子か複合格子か判断する。ユーザが予め使用する校正板の種類を選択しておき、その選択結果に基づいて判断する。均一格子であればステップB6に進み、複合格子であればステップB5に進む。
【0064】
複合格子の場合、複数種類の基準マークが配置されているので、撮像した画像のうち、使用する基準マークと使用しない基準マークとを区別する必要がある。ステップB5では、使用しない基準マークが配置されている領域をマスクウインドウMとして設定する。たとえば、図7に示すように、歪み補正用ウインドウW内の中央部に配置されている基準マークを使用しない場合は、歪み補正用ウインドウWと同様の方法でマスクウインドウMを設定する。
【0065】
マスクウインドウM内を除き、使用する基準マークを有効マーク配列として指定する。たとえば、図7では、上から3個、下から3個、右から3個、左から3個とそれぞれ指定する。
【0066】
ステップB6では、歪み補正用ウインドウW内の基準マークから、基準距離を算出するための中央マークを決定する。中央マークの決定は、各ウインドウの指定と同じように、ユーザが表示された画像を見ながら入力装置によって基準マークを指定する。
【0067】
ステップB7では、基準マークを検出するための2値化条件を設定する。2値化条件としては、2値化の閾値、対象の白黒指定、ノイズ除去用の面積フィルターなどがある。
【0068】
ステップB8ではティーチングを実行する。
ステップB7で設定された2値化条件で2値化処理を行い、撮像された画像内の基準マークをラベリングして各基準マークを代表する座標(X’,Y’)、たとえば本実施形態の基準マークのように円形であれば円中心の座標を検出する。
【0069】
全ての基準マークについて代表座標(X’,Y’)を検出したら、ステップB6で決定した中央マークの代表座標を不動座標として設定する。
【0070】
中央マークと、これに隣接する4つの基準マークとの距離を、不動座標と各基準マークの代表座標の距離としてそれぞれ算出し、平均値を基準距離とする。撮像された画像に歪みが無い場合には、全ての基準マーク間の距離が一定となる。全ての基準マーク間の距離が、算出された基準距離であるとし、不動座標を中心にこの基準距離を用いて、歪みが無い場合の理想的な基準マークの代表座標(理想座標)(X,Y)を算出する。
【0071】
次に、ステップA2の画像歪み診断処理について説明する。図8は、画像歪み診断処理を示すフローチャートである。
【0072】
ステップC1では、ティーチング処理のステップB7において実際に撮像した画像から検出した各基準マークの代表座標(X’,Y’)と、歪みの無い画像と想定して算出した各基準マークの理想座標(X,Y)とを用いて射影変換式の変換係数を求める。
【0073】
射影変換式は、式(1)で表される。
X=(A・X’+A・Y’+A)/(A・X’+A・Y’+A
Y=(A・X’+A・Y’+A)/(A・X’+A・Y’+A)…(1)
【0074】
ここで、(X,Y)は変換後の座標、(X’,Y’)は変換前の座標で、4点の座標を与えることで、変換係数A〜Aを算出することができる。したがって、変換係数は、用いた4つの基準マークごとに算出される。たとえば、図9に示すように、4つの基準マークK1〜K4を用いた場合は、破線で囲まれた個別領域110内の変換係数としてA〜Aが算出され、4つの基準マークK3〜K6を用いた場合は、破線で囲まれた個別領域111内の変換係数としてA’〜A’が算出される。このように用いる4つの基準マークを左から右へずらしながら各個別領域内の変換係数をそれぞれ求め、右端の個別領域の変換係数を算出すると、対象の個別領域を下にずらし、再度左から右へと算出して全ての個別領域の変換係数を算出する。
【0075】
ステップC2では、全領域の座標について移動量を算出する。移動量とは、変換前の座標と変換後の座標との距離であり、移動量が多いほど撮像された画像の歪みが大きいことを示している。
【0076】
具体的には、ステップC1で算出した変換係数を用いて変換後の座標を算出し、移動量を求める。
【0077】
ステップC3では、閾値として移動量の許容値をユーザが入力して設定する。移動量が多いほど歪みが大きいので、どの程度の歪みまでなら歪みは無いとみなすかを移動量で設定する。
【0078】
ステップC4では、歪みを補正する必要があるか否かを判断する。ステップC2で算出された全ての移動量と、ステップC3で設定された許容値とを比較し、1つの移動量だけでも許容値を越えていれば補正が必要であると判断してステップC5に進み、全ての移動量が許容値以下であれば補正は不要と判断してステップC6に進む。
【0079】
ステップC4の判断結果は、後述の補正処理に必要となるので、補正フラグとして記憶しておく。ステップC5では、補正フラグに“補正要”を記憶し、ステップC6では、補正フラグに“補正不要”を記憶する。
【0080】
図10は、キャリブレーション処理を示すフローチャートである。
ステップD1では、校正板の2つの基準マーク間の距離を画素数で計測する。これは、前述の処理で撮像している画像を用いて計測すればよい。また、別に校正されたサンプルを撮像し、その画像内の2点間の距離を測定してもよい。
【0081】
ステップD2では、上記の画像歪み診断処理で算出した変換係数を用いて、補正後の距離を算出し、補正前と補正後の距離の差分を算出する。この差分に基づいて補正の有効性を確認する。
【0082】
有効性の確認は、たとえば、差分値を表示し、ユーザが表示された差分値を見て確認する。
【0083】
ステップD3では、補正有効性の確認が終了したか否かを判断し、終了していれば、ステップD4に進み、終了していなければステップD1に戻る。
【0084】
なお、ステップC4で補正不要と判断された場合には、有効性確認のためのステップD2,D3の処理は実行しなくてもよい。
【0085】
ステップD4では、ステップD1で計測した距離の実測値を入力して設定する。校正板では、基準マーク間の距離は決まっているので、その値を入力すればよい。
【0086】
ステップD5では、ステップD4で設定した実測値と画素数からキャリブレーションファクタを算出する。キャリブレーションファクタとは、たとえば、1画素当たりXmのように単位画素当たりの長さである。
【0087】
以下では歪み補正モードについて説明する。
歪み補正モードでは、歪み診断モードで作成した変換係数に基づいて変換テーブルを作成する処理、変換テーブルに基づいて歪みを補正する処理、歪みの補正を確認する処理がある。
【0088】
1)変換テーブル作成処理
全ての領域について変換テーブルを記憶しておくには、膨大な記憶容量が必要となるので、たとえば、電源立ち上げ時やユーザが指定したときに、変換係数を算出し変換テーブルを作成する。なお、変換テーブルの作成は、画像歪み診断処理において、補正フラグに“補正要”と記憶されている場合のみ行う。
【0089】
変換テーブルは、具体的には、変換前の座標と変換後の座標とが記載されたテーブルである。
【0090】
このように、変換係数を記憶することで、記憶容量を削減することができ、変換テーブルを変換係数から作成することで演算量を削減することができる。
【0091】
2)画像歪み補正処理
変換テーブル作成処理で作成した変換テーブルを用いて、撮像装置1で撮像した画像の各画素を移動させて補正画像を作成する。
【0092】
3)補正確認処理
補正前の画像と、補正後の画像とを表示装置3に表示し、ユーザが補正処理の効果を確認する。
【0093】
図11は、補正前後の画像の表示例である。図11(a)は補正前の画像であり、特に四隅の歪みが大きい。図11(b)は補正後の画像であり、全ての基準マークが等間隔で配置される。
【0094】
以上のように、領域ごとに変換関数を算出するので、撮像装置1のあおりだけでなく、レンズの歪み、被写体の撓みに対しても画像の歪みを補正することができる。
【0095】
また、画像歪みの診断および補正を行うために別途センサを設ける必要が無いので、画像診断および補正機能が追加されても装置規模が拡大することも、複雑な装置の調整を行うこともなく、コスト抑えることができる。
【0096】
さらに、予め基準となるマークが配置された校正板を使用するので、基準点をマニュアル入力する必要が無いので、作業者の負担を軽減するとともに、補正精度を向上させることができる。
【0097】
また、本発明の実施の他の形態は、コンピュータを画像処理装置2として機能させるための画像処理プログラム、および画像処理プログラムを記録したコンピュータ読み取り可能な記録媒体である。これによって、画像処理プログラムおよび画像処理プログラムを記録した記録媒体を持ち運び自在に提供することができる。
【0098】
記録媒体は、プリンタやコンピュータシステムに備えられるプログラム読み取り装置により読み取られることで、画像処理プログラムが実行される。
【0099】
コンピュータシステムの入力手段としては、フラットベッドスキャナ・フィルムスキャナ・デジタルカメラなどを用いてもよい。コンピュータシステムは、これらの入力手段と、所定のプログラムがロードされることにより画像処理などを実行するコンピュータと、コンピュータの処理結果を表示するCRTディスプレイ・液晶ディスプレイなどの画像表示装置と、コンピュータの処理結果を紙などに出力するプリンタより構成される。さらには、ネットワークを介してサーバーなどに接続するための通信手段としてのモデムなどが備えられる。
【0100】
なお、記録媒体としては、プログラム読み取り装置によって読み取られるものには限らず、マイクロコンピュータのメモリ、たとえばROMであっても良い。記録されているプログラムはマイクロプロセッサがアクセスして実行しても良いし、あるいは、記録媒体から読み出したプログラムを、マイクロコンピュータのプログラム記憶エリアにダウンロードし、そのプログラムを実行してもよい。このダウンロード機能は予めマイクロコンピュータが備えているものとする。
【0101】
記録媒体の具体的な例としては、磁気テープやカセットテープなどのテープ系、フレキシブルディスクやハードディスクなどの磁気ディスクやCD−ROM(Compact Disc−Read Only Memory)/MO(Magneto Optical)ディスク/MD(Mini Disc)/DVD(Digital Versatile Disc)などの光ディスクのディスク系、IC(Integrated Circuit)カード(メモリカードを含む)/光カードなどのカード系、あるいはマスクROM、EPROM(Erasable Programmable ReadOnly Memory)、EEPROM(Electrically Erasable Programmable ReadOnly Memory)、フラッシュROMなどの半導体メモリを含めた固定的にプログラムを担持する媒体である。
【0102】
また、本実施形態においては、コンピュータはインターネットを含む通信ネットワークに接続可能なシステム構成とし、通信ネットワークを介して画像処理プログラムをダウンロードしても良い。なお、このように通信ネットワークからプログラムをダウンロードする場合には、そのダウンロード機能は予めコンピュータに備えておくか、あるいは別な記録媒体からインストールされるものであっても良い。また、ダウンロード用のプログラムはユーザーインターフェースを介して実行されるものであっても良いし、決められたURL(Uniform Resource
Locater)から定期的にプログラムをダウンロードするようなものであっても良い。
【0103】
【発明の効果】
以上のように本発明によれば、個別領域ごとに歪みを検出するので、撮像装置のあおり以外にもレンズの歪みや、被写体の撓みによる画像の歪みも診断することができる。また、画像の歪みを診断するためには校正板を用いるだけでよく、各種センサなどは必要が無いので、歪み診断機能が追加されても装置規模が拡大することも、複雑な装置の調整を行うこともなく、コストを抑えることができる。
【0104】
また本発明によれば、センサなどを別途用いずに、歪みを診断するための比較対象を容易に取得することができる。
【0105】
また本発明によれば、射影変換を用いるので、高精度かつ容易に歪みを検出することができる。
【0106】
また本発明によれば、閾値との比較および閾値の条件に該当する個別領域の個数によって画像全体の歪みを診断するので、閾値や個別領域の数を変更することで作業者および被写体に応じて診断精度を変更することができる。
【0107】
また本発明によれば、個別領域ごとに算出された射影変換係数に基づいて補正を行うので、撮像装置のあおり以外にもレンズの歪みや、被写体の撓みによる画像の歪みも精度よく補正することができる。また、検出ステップで算出された射影変換係数を用いることで補正に必要な演算量を削減することができる。
【0108】
また本発明によれば、いわゆるキャリブレーションファクタを用いることで、撮像した画像から被写体の実際の寸法を計測することができる。
【0109】
また本発明によれば、上記の画像処理方法をコンピュータに実行させるための画像処理プログラムおよび画像処理プログラムを記録したコンピュータ読み取り可能な記録媒体として提供することができる。
【図面の簡単な説明】
【図1】画像処理システム100の構成を示すブロック図である。
【図2】歪み診断モードの処理を示すフローチャートである。
【図3】ステップA1のティーチング処理を示すフローチャートである。
【図4】校正板4の例を示す図である。
【図5】校正板4の例を示す図である。
【図6】歪み補正用ウインドウWを指定する際の表示例を示す図である。
【図7】マスクウインドウMの指定および有効配列の指定を行う際の表示例を示す図である。
【図8】画像歪み診断処理を示すフローチャートである。
【図9】個別領域の例を示す図である。
【図10】キャリブレーション処理を示すフローチャートである。
【図11】補正前後の画像の表示例である。
【符号の説明】
1 撮像装置
2 画像処理装置
3 表示装置
11 CCDカメラ
12 A/D変換器
13 カメラコントローラ
14 D/A変換器
15 フレームメモリ
21 CPU
22 RAM
23 ROM
24 I/Oコントローラ
100 画像処理システム
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an image processing method and an image processing apparatus for performing graphic processing on an image input from an imaging device or the like, and in particular, an image processing method and an image processing apparatus for diagnosing and correcting image distortion, an image processing program, and an image The present invention relates to a recording medium on which a processing program is recorded.
[0002]
[Prior art]
2. Description of the Related Art With the spread of imaging devices such as CCD cameras, image processing for performing various processes based on images obtained by capturing a subject has been performed in factories and homes. For example, in factories, image processing is performed by a digital camera or a scanner, and image processing is performed by a security system using a security camera or the like.
[0003]
Among these, especially in the alignment of parts in the assembly of products and the detection of defective parts in products, it is necessary to realize the position detection and dimensional measurement of objects with high accuracy, and high-precision processing for image processing Is required.
[0004]
The main causes of the deterioration in the accuracy of the image processing include the tilt and lens distortion of the imaging device and the bending of the subject.
[0005]
Such image distortion can be corrected using projective transformation. There are the following three types of typical techniques for correcting image distortion by projective transformation.
[0006]
(1) Various sensors other than the imaging device are used (see Patent Document 1).
Using various sensors, the positional relationship (distance or angle) between the imaging device and the subject is actually measured, and a conversion function is calculated from the measured values. The sensors used include an acceleration sensor, an angular velocity sensor, a magnetic sensor, an ultrasonic sensor, and an infrared sensor.
[0007]
(2) Set manually (see Patent Documents 2 and 3).
Manually set the information required to calculate the conversion function. The necessary information is the coordinates of the four points. The user selects appropriate four points from the image before the conversion, and specifies the coordinates to be moved by these points after the conversion. A conversion function is calculated from the coordinates before and after the conversion.
[0008]
(3) The feature points of the subject are used (see Patent Document 4).
A feature point is searched for from a subject, and a conversion function is calculated so that the feature point moves to a predetermined position. Since the conversion function can be calculated for each subject, it is effective when the positional relationship changes.
[0009]
[Patent Document 1]
Japanese Patent Application Laid-Open No. 2000-307947 [Patent Document 2]
JP-A-7-44698 [Patent Document 3]
JP-A-11-238123 [Patent Document 4]
JP 2001-177716 A
[Problems to be solved by the invention]
In the case of using various sensors other than the imaging device as in (1), it is necessary to separately provide sensors, so that the scale of the device is increased and the cost is increased. In order to perform the correction with high accuracy, the position adjustment between the imaging device and the sensor is complicated.
[0011]
In the case of manual setting as in (2), there is a problem that the burden on the operator is large. In addition, objectivity is poor, for example, the setting changes depending on the operator, and the accuracy is not always high.
[0012]
When using the feature points of the subject as in (3), the subject needs to have appropriate feature points.
[0013]
In any of the above cases, since the entire area is converted by a single conversion function, it is possible to correct the distortion only if the imaging apparatus is tilted, but lens distortion and object deflection may occur. If it is the cause, it cannot be corrected.
[0014]
An object of the present invention is to provide an image processing apparatus and an image processing method that detect distortion of an image and perform distortion correction with high accuracy, an image processing program, and a recording medium that stores the image processing program.
[0015]
[Means for Solving the Problems]
An image capturing step of capturing an image of a calibration plate on which a plurality of marks are arranged such that a distance between at least two adjacent marks is within a predetermined error range,
An extraction step of extracting a parameter related to the arrangement of marks in a region having the least distortion in the captured image,
A dividing step of dividing the captured image into a plurality of individual regions;
Based on the extracted parameters, for each of the individual regions, a detection step of detecting the distortion of the arrangement of the included mark,
A diagnosis step of diagnosing whether or not the entire captured image is distorted based on the detected distortion of the arrangement of the marks.
[0016]
According to the invention, in the imaging step, an image of a calibration plate on which a plurality of marks are arranged such that a distance between at least two adjacent marks is within a predetermined error range is taken.
[0017]
In the extraction step, parameters relating to the arrangement of marks in an area having the least distortion in the captured image are extracted. When an image of the calibration plate is captured using a CCD camera or the like, a parameter relating to a mark captured in the central portion of the lens, that is, a mark in the central portion of the image may be extracted.
[0018]
In the dividing step, the captured image is divided into a plurality of individual regions. By dividing, distortion detection can be performed for each individual area.
[0019]
In the detection step, the distortion of the arrangement of the included marks is detected for each individual area based on the extracted parameters.
[0020]
In the diagnosis step, it is diagnosed based on the detected distortion of the arrangement of the marks whether or not the entire captured image is distorted.
[0021]
As described above, since the distortion is detected for each individual region, it is possible to diagnose not only the tilt of the imaging apparatus but also the distortion of the lens and the distortion of the image due to the bending of the subject.
[0022]
Also, in order to diagnose image distortion, it is only necessary to use a calibration plate, and various sensors are not required.Therefore, even if a distortion diagnosis function is added, the scale of the apparatus can be expanded, and adjustment of a complicated apparatus can be performed. Without doing so, costs can be reduced.
[0023]
Also, in the present invention, the extracting step detects a plurality of distances between adjacent marks in an area having the least distortion, calculates an average of the detected distances as a reference distance, and performs imaging using the reference distance. It is characterized in that the coordinates of all the marks obtained are extracted as ideal coordinates.
[0024]
According to the present invention, in the extraction step, first, a plurality of distances between adjacent marks are detected in an area having the least distortion. The average of the detected distances is calculated as a reference distance, and the coordinates of all the captured marks are extracted as ideal coordinates using the reference distance.
[0025]
A comparison target for diagnosing distortion can be easily acquired without using a sensor or the like separately.
[0026]
Further, in the present invention, the detecting step calculates, for each of the individual regions, a projective transformation coefficient from the ideal coordinates and the coordinates of the imaged mark, and, based on the calculated projective transformation coefficient, It is characterized in that a movement amount is detected.
[0027]
According to the invention, in the detection step, for each individual area, a projective transformation coefficient is calculated from the ideal coordinates and the coordinates of the imaged mark, and the amount of movement of the coordinates by the projective transformation is calculated based on the calculated projective transformation coefficient. Is detected.
[0028]
In this way, since the projective transformation is used, distortion can be detected with high accuracy and easily.
[0029]
Also, in the present invention, in the diagnosis step, the movement amount detected for each individual region is compared with a predetermined threshold for the coordinates of all the regions, and diagnosis is performed based on the number of individual regions where the movement amount is equal to or larger than the threshold. It is characterized by doing.
[0030]
According to the present invention, in the diagnosis step, the amount of movement detected for each individual area is compared with a predetermined threshold, and diagnosis is performed based on the number of individual areas where the amount of movement is equal to or greater than the threshold.
[0031]
As described above, since the distortion of the entire image is diagnosed based on the comparison with the threshold value and the number of individual regions corresponding to the threshold condition, by changing the threshold value and the number of individual regions, the diagnostic accuracy can be improved according to the operator and the subject. Can be changed.
[0032]
Further, the present invention further includes a correction step of correcting the captured image by performing projective transformation based on the projective transformation coefficient when the image photographed in the diagnosis step is diagnosed as being distorted. It is characterized by.
[0033]
According to the present invention, when the image captured in the diagnosis step is diagnosed as being distorted, the captured image is corrected by performing a projection conversion based on the projection conversion coefficient in the correction step.
[0034]
Since the correction is performed based on the projection conversion coefficient calculated for each individual region, it is possible to accurately correct not only the tilt of the imaging apparatus but also the lens distortion and the image distortion due to the bending of the subject. In addition, the amount of calculation required for correction can be reduced by using the projective transformation coefficient calculated in the detection step.
[0035]
The present invention further includes a distance calculating step of calculating a distance per pixel from a distance between marks based on the number of pixels in a captured image and an actually measured distance between marks arranged on the calibration plate. Features.
[0036]
According to the present invention, in the distance calculation step, a distance per pixel is calculated from a distance between marks based on the number of pixels in a captured image and an actually measured distance between marks arranged on the calibration plate. The distance per pixel is called a so-called calibration factor, and by using this calibration factor, the actual size of the subject can be measured from the captured image.
[0037]
Further, the present invention is an image processing program for causing a computer to execute the above image processing method.
[0038]
According to the present invention, it is possible to provide an image processing program for causing a computer to execute the above image processing method.
[0039]
The present invention is also a computer-readable recording medium on which an image processing program for causing a computer to execute the above-described image processing method is recorded.
[0040]
According to the present invention, it is possible to provide a computer-readable recording medium on which an image processing program for causing a computer to execute the above-described image processing method is recorded.
[0041]
Further, the present invention, imaging means for imaging a calibration plate on which a plurality of marks are arranged such that at least the distance between two adjacent marks is within a predetermined error range,
Extraction means for extracting a parameter related to the arrangement of marks in an area having the least distortion in a captured image,
Dividing means for dividing the captured image into a plurality of individual areas,
Based on the extracted parameters, for each of the individual areas, detecting means for detecting the distortion of the arrangement of the included mark,
Diagnostic means for diagnosing whether or not the entire captured image is distorted based on the detected distortion of the arrangement of the marks.
[0042]
According to the present invention, the imaging means images the calibration plate on which a plurality of marks are arranged such that the distance between at least two adjacent marks is within a predetermined error range.
[0043]
The extracting means extracts a parameter relating to the arrangement of marks in an area having the least distortion in the captured image. When an image of the calibration plate is captured using a CCD camera or the like, a parameter relating to a mark captured in the central portion of the lens, that is, a mark in the central portion of the image may be extracted.
[0044]
The dividing unit divides the captured image into a plurality of individual regions. By dividing, distortion detection can be performed for each individual area.
[0045]
The detecting means detects distortion of the arrangement of the included marks for each individual area based on the extracted parameters.
[0046]
The diagnosis unit diagnoses whether or not the entire captured image is distorted based on the detected distortion of the arrangement of the marks.
[0047]
As described above, since the distortion is detected for each individual region, it is possible to diagnose not only the tilt of the imaging apparatus but also the distortion of the lens and the distortion of the image due to the bending of the subject.
[0048]
Also, in order to diagnose image distortion, it is only necessary to use a calibration plate, and various sensors are not required.Therefore, even if a distortion diagnosis function is added, the scale of the apparatus can be expanded, and adjustment of a complicated apparatus can be performed. Without doing so, costs can be reduced.
[0049]
BEST MODE FOR CARRYING OUT THE INVENTION
FIG. 1 is a block diagram showing the configuration of the image processing system 100. The image processing system 100 includes an imaging device 1, an image processing device 2, and a display device 3, and constitutes, for example, a component positioning system.
[0050]
The imaging apparatus 1 is an imaging unit including a CCD (charge coupled device) camera 11, an A / D (analog / digital) converter 12, a camera controller 13, a D / A converter 14, and a frame memory 15. The CCD camera 11 captures an image of a subject and outputs the amount of received light as an analog image signal. The A / D converter 12 converts an analog image signal output from the CCD camera 11 into digital data and outputs it as digital image data. The camera controller 14 stores the digital image data in the frame memory 15 for each frame and outputs the digital image data to the D / A converter 14 for display on the display device 3. The D / A converter converts digital image data output from the camera controller 14 into an analog image signal corresponding to the display device 3 and outputs the analog image signal to the display device 3. The display device 3 is realized by an LCD (Liquid Crystal Display), a CRT (Cathode Ray Tube) display, or the like, and displays an analog image signal output from the imaging device 1.
[0051]
The image processing device 2 includes a CPU (Central Processing Unit) 21 and a RAM (Random).
An access memory (ROM) 22, a read only memory (ROM) 23, and an input / output (I / O) controller 24. The CPU 21 controls the operation of the image processing device 2 based on a control program stored in the ROM 23. Image data being processed, data being calculated, and the like are temporarily stored in the RAM 22. The I / O controller 24 is connected to input devices such as a keyboard and a mouse, and a device for moving components, and controls the input / output data.
[0052]
The CPU 21 and the ROM 23 constitute an extracting unit, a dividing unit, a detecting unit, and a diagnosing unit, acquire image data from the frame memory 15 via the camera controller 14 of the imaging device 2, and execute image processing described later.
[0053]
The present invention diagnoses the distortion of the lens provided in the CCD 11, the optical axis of the imaging device 1 is tilted with respect to the subject, and diagnoses the distortion of the captured image due to the bending of the subject and outputs the corrected image without distortion.
[0054]
Specifically, the calibration plate 4 on which the reference marks are arranged is imaged by the imaging device 1, and the image processing device 2 diagnoses whether or not the captured image is distorted, and corrects the distortion if any.
[0055]
The image processing method executed by the image processing apparatus 2 includes a “distortion diagnosis mode” for diagnosing distortion of a captured image and a “distortion correction mode” for correcting image distortion when it is determined that correction is necessary in the diagnosis mode. ".
[0056]
In the “distortion diagnosis mode”, three processes of teaching, image distortion diagnosis (creating a conversion coefficient conversion table if diagnosis is necessary), correction confirmation, and calibration are performed. In the “distortion correction mode”, the conversion coefficient created at the time of diagnosis is performed. , A conversion table based on the conversion table, distortion correction based on the conversion table, and confirmation of the distortion correction.
[0057]
First, the distortion diagnosis mode will be described. FIG. 2 is a flowchart showing the processing in the distortion diagnosis mode. The distortion diagnosis mode includes three steps. First, teaching using a calibration plate is performed in step A1, diagnosis is made in step A2 as to whether or not an image is distorted, and calibration is performed in step A3.
[0058]
Hereinafter, each step will be described in detail.
FIG. 3 is a flowchart showing the teaching processing in step A1.
[0059]
In step B1, the imaging device 1 images the calibration plate 4 on which the reference marks are arranged. 4 and 5 are diagrams illustrating examples of the calibration plate 4. FIG. FIG. 4 shows the calibration plate 4 using a uniform grating, and FIG. 5 shows the calibration plate 4 using a composite grating. The calibration plate 4 is provided with a circular reference mark, and is arranged with high precision so that the size of the reference mark, the distance between the reference marks (the distance between the mark centers), and the like fall within a predetermined error range. I have.
[0060]
In the case of the uniform grating shown in FIG. 4, the size of the reference marks and the distance between the reference marks are the same for all the arranged reference marks. In the case of the composite grating shown in FIG. 5, there are a plurality of types of reference marks and the distance between the reference marks. For example, as shown in FIG. Is also a small area, and the peripheral area has a large reference mark and a large distance between the reference marks. If a composite grating is used, the grating can be switched according to the imaging device, the subject, and the like, so that it is not necessary to prepare a plurality of types of calibration plates, and the accuracy can be further improved.
[0061]
In step B2, the captured image is displayed on the display device 3, and an area to be used for teaching is designated as a distortion correction window from the displayed image. As shown in FIG. 6, the user specifies the distortion correction window W using an input device such as a mouse or a tablet while viewing the image displayed on the display device 3, as shown in FIG. When a uniform grating is used as the calibration plate 4, all the imaged regions may be used for teaching. In this case, no operation by the user is required.
[0062]
In step B3, the user sets the reference mark array pattern of the entire distortion correction window W. For setting, the number of fiducial marks arranged vertically and horizontally is input. For example, the pattern shown in FIG. 6 is an arrangement pattern of six rows and six columns.
[0063]
In step B4, it is determined whether the calibration plate is a uniform grid or a composite grid. The user selects the type of the calibration plate to be used in advance, and makes a determination based on the selection result. If it is a uniform lattice, the process proceeds to step B6, and if it is a composite lattice, the process proceeds to step B5.
[0064]
In the case of a composite grating, since a plurality of types of reference marks are arranged, it is necessary to distinguish between a reference mark to be used and a reference mark not to be used in a captured image. In step B5, an area where the unused reference marks are arranged is set as a mask window M. For example, as shown in FIG. 7, when the reference mark arranged in the center of the distortion correction window W is not used, the mask window M is set in the same manner as the distortion correction window W.
[0065]
A reference mark to be used is specified as an effective mark array except in the mask window M. For example, in FIG. 7, three are specified from the top, three from the bottom, three from the right, and three from the left.
[0066]
In step B6, a center mark for calculating the reference distance is determined from the reference marks in the distortion correction window W. In the determination of the center mark, the user designates the reference mark with the input device while viewing the displayed image, similarly to the designation of each window.
[0067]
In step B7, a binarization condition for detecting a reference mark is set. The binarization conditions include a binarization threshold, a target black and white designation, an area filter for noise removal, and the like.
[0068]
In step B8, teaching is performed.
The binarization process is performed under the binarization condition set in step B7, and the reference marks in the captured image are labeled, and coordinates (X ′, Y ′) representing each of the reference marks, for example, in the present embodiment, If the reference mark is circular, the coordinates of the center of the circle are detected.
[0069]
When the representative coordinates (X ′, Y ′) are detected for all the reference marks, the representative coordinates of the center mark determined in step B6 are set as immovable coordinates.
[0070]
The distance between the center mark and four reference marks adjacent to the center mark is calculated as the distance between the fixed coordinates and the representative coordinates of each reference mark, and the average value is used as the reference distance. When there is no distortion in the captured image, the distance between all the reference marks is constant. It is assumed that the distance between all the reference marks is the calculated reference distance, and the representative coordinates (ideal coordinates) (X, Y) is calculated.
[0071]
Next, the image distortion diagnosis processing in step A2 will be described. FIG. 8 is a flowchart showing the image distortion diagnosis processing.
[0072]
In step C1, the representative coordinates (X ′, Y ′) of each reference mark detected from the image actually picked up in step B7 of the teaching process and the ideal coordinates (X ′, Y ′) of each reference mark calculated on the assumption that the image has no distortion. X, Y) to obtain the conversion coefficient of the projective conversion formula.
[0073]
The projective transformation equation is represented by equation (1).
X = (A 3 · X ' + A 4 · Y' + A 5) / (A 0 · X '+ A 1 · Y' + A 2)
Y = (A 6 · X ' + A 7 · Y' + A 8) / (A 0 · X '+ A 1 · Y' + A 2) ... (1)
[0074]
Here, (X, Y) is the coordinate after conversion, and (X ′, Y ′) is the coordinate before conversion, and the conversion coefficients A 0 to A 8 can be calculated by giving the coordinates of four points. . Therefore, the conversion coefficient is calculated for each of the four reference marks used. For example, as shown in FIG. 9, in the case of using the four reference marks K 1 to K 4, A 0 to A 8 are calculated as a conversion coefficient of discrete regions 110 surrounded by the broken line, four reference marks K3~ When K6 is used, A 0 ′ to A 8 ′ are calculated as the conversion coefficients in the individual region 111 surrounded by the broken line. When the four reference marks used in this manner are shifted from left to right, the transform coefficients in each individual area are obtained, and the transform coefficients of the rightmost individual area are calculated. Then, the target individual area is shifted downward, and then left to right again. To calculate the conversion coefficients of all the individual areas.
[0075]
In step C2, the movement amount is calculated for the coordinates of the entire area. The movement amount is a distance between the coordinates before the conversion and the coordinates after the conversion, and indicates that the larger the movement amount, the greater the distortion of the captured image.
[0076]
Specifically, the coordinates after the conversion are calculated using the conversion coefficients calculated in step C1, and the movement amount is obtained.
[0077]
In step C3, the user inputs and sets an allowable value of the movement amount as the threshold value. Since the greater the amount of movement, the greater the distortion, the amount of distortion up to which no distortion is considered is set by the amount of movement.
[0078]
In Step C4, it is determined whether the distortion needs to be corrected. All the movement amounts calculated in step C2 are compared with the allowable value set in step C3. If only one movement amount exceeds the allowable value, it is determined that correction is necessary, and the process proceeds to step C5. If all the movement amounts are equal to or less than the allowable value, it is determined that no correction is necessary, and the process proceeds to step C6.
[0079]
The result of the determination in step C4 is stored as a correction flag because it is necessary for a correction process described later. In step C5, "correction required" is stored in the correction flag, and in step C6, "correction unnecessary" is stored in the correction flag.
[0080]
FIG. 10 is a flowchart illustrating the calibration process.
In step D1, the distance between two reference marks on the calibration plate is measured by the number of pixels. This may be measured using the image captured in the above-described processing. Alternatively, a separately calibrated sample may be taken, and the distance between two points in the image may be measured.
[0081]
In step D2, the corrected distance is calculated using the conversion coefficient calculated in the image distortion diagnosis process, and the difference between the pre-corrected distance and the corrected distance is calculated. The effectiveness of the correction is confirmed based on this difference.
[0082]
The validity is confirmed, for example, by displaying a difference value, and the user confirms the displayed difference value.
[0083]
In Step D3, it is determined whether or not the confirmation of the correction validity has been completed. If it has been completed, the process proceeds to Step D4, and if not, the process returns to Step D1.
[0084]
When it is determined in step C4 that the correction is unnecessary, the processing of steps D2 and D3 for confirming the validity may not be performed.
[0085]
In step D4, the actual measured value of the distance measured in step D1 is input and set. In the calibration plate, since the distance between the reference marks is fixed, the value may be input.
[0086]
In step D5, a calibration factor is calculated from the measured value and the number of pixels set in step D4. The calibration factor is a length per unit pixel such as Xm per pixel.
[0087]
Hereinafter, the distortion correction mode will be described.
In the distortion correction mode, there are a process of creating a conversion table based on the conversion coefficients created in the distortion diagnosis mode, a process of correcting distortion based on the conversion table, and a process of confirming distortion correction.
[0088]
1) Conversion Table Creation Processing In order to store the conversion tables for all areas, a huge storage capacity is required. For example, when the power is turned on or when the user specifies, conversion coefficients are calculated and converted. Create a table. Note that the conversion table is created only in the image distortion diagnosis processing when “correction required” is stored in the correction flag.
[0089]
Specifically, the conversion table is a table in which coordinates before conversion and coordinates after conversion are described.
[0090]
As described above, by storing the conversion coefficients, the storage capacity can be reduced, and the amount of calculation can be reduced by creating the conversion table from the conversion coefficients.
[0091]
2) Image distortion correction processing Using the conversion table created in the conversion table creation processing, each pixel of the image captured by the imaging device 1 is moved to create a corrected image.
[0092]
3) Correction Check Processing The image before correction and the image after correction are displayed on the display device 3, and the user checks the effect of the correction processing.
[0093]
FIG. 11 is a display example of an image before and after correction. FIG. 11A shows an image before correction, in which the four corners are particularly distorted. FIG. 11B shows an image after correction, in which all reference marks are arranged at equal intervals.
[0094]
As described above, since the conversion function is calculated for each area, the image distortion can be corrected not only for the tilt of the imaging apparatus 1 but also for the lens distortion and the object bending.
[0095]
Further, since it is not necessary to provide a separate sensor for performing diagnosis and correction of image distortion, even if an image diagnosis and correction function is added, the apparatus scale is not enlarged, and adjustment of a complicated apparatus is not performed. Costs can be reduced.
[0096]
Further, since a calibration plate on which a reference mark is arranged in advance is used, there is no need to manually input a reference point, so that the burden on the operator can be reduced and the correction accuracy can be improved.
[0097]
Further, another embodiment of the present invention is an image processing program for causing a computer to function as the image processing device 2, and a computer-readable recording medium storing the image processing program. Thus, the image processing program and the recording medium storing the image processing program can be provided in a portable manner.
[0098]
The image processing program is executed by reading the recording medium by a program reading device provided in a printer or a computer system.
[0099]
As an input means of the computer system, a flatbed scanner, a film scanner, a digital camera, or the like may be used. The computer system includes these input means, a computer that executes image processing by loading a predetermined program, an image display device such as a CRT display or a liquid crystal display that displays the processing results of the computer, and a computer processing It consists of a printer that outputs the results on paper or the like. Further, a modem or the like is provided as communication means for connecting to a server or the like via a network.
[0100]
The recording medium is not limited to a medium that can be read by a program reading device, but may be a memory of a microcomputer, for example, a ROM. The recorded program may be accessed and executed by a microprocessor, or a program read from a recording medium may be downloaded to a program storage area of a microcomputer and executed. It is assumed that the microcomputer has this download function in advance.
[0101]
Specific examples of the recording medium include a tape system such as a magnetic tape and a cassette tape, a magnetic disk such as a flexible disk and a hard disk, and a CD-ROM (Compact Disc-Read Only Memory) / MO (Magneto Optical) disk / MD (MD). Mini Disc) / DVD (Digital Versatile Disc) and other optical disc disc systems, IC (Integrated Circuit) card (including memory card) / optical card and other card systems, or mask ROM, EPROM (Erasable Programmable Read Only Memory) (Electrically Erasable Programmable Read Only Memory ), It is a medium fixedly carrying the program, including semiconductor memories such as a flash ROM.
[0102]
In the present embodiment, the computer may have a system configuration connectable to a communication network including the Internet, and may download the image processing program via the communication network. When the program is downloaded from the communication network as described above, the download function may be provided in the computer in advance, or may be installed from another recording medium. The download program may be executed through a user interface, or may be a predetermined URL (Uniform Resource).
Locator).
[0103]
【The invention's effect】
As described above, according to the present invention, since distortion is detected for each individual region, it is possible to diagnose lens distortion and image distortion due to bending of a subject in addition to tilt of the imaging device. Also, in order to diagnose image distortion, it is only necessary to use a calibration plate, and various sensors are not required.Therefore, even if a distortion diagnosis function is added, the scale of the apparatus can be expanded, and adjustment of a complicated apparatus can be performed. Without doing so, costs can be reduced.
[0104]
Further, according to the present invention, a comparison target for diagnosing distortion can be easily obtained without separately using a sensor or the like.
[0105]
Further, according to the present invention, since projective transformation is used, distortion can be detected with high accuracy and easily.
[0106]
According to the present invention, since the distortion of the entire image is diagnosed based on the comparison with the threshold value and the number of the individual regions corresponding to the condition of the threshold value, the threshold value and the number of the individual regions are changed to change the threshold value and the number of the individual regions according to the worker and the subject. The diagnostic accuracy can be changed.
[0107]
Further, according to the present invention, since the correction is performed based on the projection conversion coefficient calculated for each individual area, it is possible to accurately correct lens distortion and image distortion due to bending of the subject in addition to tilt of the imaging device. Can be. In addition, the amount of calculation required for correction can be reduced by using the projective transformation coefficient calculated in the detection step.
[0108]
Further, according to the present invention, by using a so-called calibration factor, the actual dimensions of the subject can be measured from the captured image.
[0109]
Further, according to the present invention, it is possible to provide an image processing program for causing a computer to execute the above-described image processing method, and a computer-readable recording medium storing the image processing program.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of an image processing system 100.
FIG. 2 is a flowchart illustrating processing in a distortion diagnosis mode.
FIG. 3 is a flowchart showing a teaching process in step A1.
FIG. 4 is a view showing an example of a calibration plate 4;
FIG. 5 is a view showing an example of a calibration plate 4;
FIG. 6 is a diagram illustrating a display example when a distortion correction window W is designated.
FIG. 7 is a diagram showing a display example when specifying a mask window M and specifying an effective array.
FIG. 8 is a flowchart illustrating an image distortion diagnosis process.
FIG. 9 is a diagram illustrating an example of an individual area.
FIG. 10 is a flowchart illustrating a calibration process.
FIG. 11 is a display example of an image before and after correction.
[Explanation of symbols]
REFERENCE SIGNS LIST 1 imaging device 2 image processing device 3 display device 11 CCD camera 12 A / D converter 13 camera controller 14 D / A converter 15 frame memory 21 CPU
22 RAM
23 ROM
24 I / O Controller 100 Image Processing System

Claims (9)

少なくとも隣接する2つのマークの距離が所定の誤差範囲内となるような複数のマークが配置された校正板を撮像する撮像ステップと、
撮像された画像のうち歪みが最も少ない領域のマークの配置に関するパラメータを抽出する抽出ステップと、
撮像された画像を複数の個別領域に分割する分割ステップと、
抽出されたパラメータに基づいて、前記個別領域ごとに、含まれるマークの配置の歪みを検出する検出ステップと、
検出されたマークの配置の歪みに基づいて、撮像された画像全体が歪んでいるか否かを診断する診断ステップとを有することを特徴とする画像処理方法。
An imaging step of imaging a calibration plate on which a plurality of marks are arranged such that a distance between at least two adjacent marks is within a predetermined error range;
An extraction step of extracting a parameter related to the arrangement of marks in a region having the least distortion in the captured image,
A dividing step of dividing the captured image into a plurality of individual regions;
Based on the extracted parameters, for each of the individual regions, a detection step of detecting the distortion of the arrangement of the included mark,
A diagnostic step of diagnosing whether or not the entire captured image is distorted based on the detected distortion of the arrangement of the marks.
前記抽出ステップは、歪みが最も少ない領域内で、隣接するマーク間の距離を複数検出し、検出された距離の平均を基準距離として算出し、前記基準距離を用いて、撮像された全マークの座標を理想座標として抽出することを特徴とする請求項1記載の画像処理方法。The extraction step detects a plurality of distances between adjacent marks in an area having the least distortion, calculates an average of the detected distances as a reference distance, and uses the reference distance to calculate all of the captured marks. 2. The image processing method according to claim 1, wherein the coordinates are extracted as ideal coordinates. 前記検出ステップは、前記個別領域ごとに、前記理想座標と撮像されたマークの座標とから射影変換係数を算出し、算出された射影変換係数に基づいて、射影変換による座標の移動量を検出することを特徴とする請求項2記載の画像処理方法。The detecting step calculates, for each of the individual regions, a projective transformation coefficient from the ideal coordinates and the coordinates of the imaged mark, and detects a moving amount of the coordinate by the projective transformation based on the calculated projective transformation coefficient. 3. The image processing method according to claim 2, wherein: 前記診断ステップは、全領域の座標について、個別領域ごとに検出された前記移動量と所定の閾値とを比較し、移動量が閾値以上となる個別領域の数に基づいて診断することを特徴とする請求項3記載の画像処理方法。The diagnosing step is characterized in that, for the coordinates of all the regions, the movement amount detected for each individual region is compared with a predetermined threshold, and diagnosis is performed based on the number of individual regions in which the movement amount is equal to or larger than the threshold. The image processing method according to claim 3. 前記診断ステップで撮像された画像が歪んでいると診断されたときは、前記射影変換係数に基づいて射影変換を行うことで撮像された画像を補正する補正ステップをさらに有することを特徴とする請求項3または4記載の画像処理方法。When the image captured in the diagnosis step is diagnosed as being distorted, the image processing apparatus further includes a correction step of correcting the captured image by performing projective transformation based on the projective transformation coefficient. Item 5. The image processing method according to item 3 or 4. 撮像された画像における画素数に基づくマーク間の距離と、前記校正板に配置されたマーク間の実測距離とから、1画素当たりの距離を算出する距離算出ステップさらに有することを特徴とする請求項1〜5のいずれか1つに記載の画像処理方法。A distance calculating step for calculating a distance per pixel from a distance between marks based on the number of pixels in a captured image and an actually measured distance between marks arranged on the calibration plate. 6. The image processing method according to any one of 1 to 5. 請求項1〜6のいずれかに記載の画像処理方法をコンピュータに実行させるための画像処理プログラム。An image processing program for causing a computer to execute the image processing method according to claim 1. 請求項1〜6のいずれかに記載の画像処理方法をコンピュータに実行させるための画像処理プログラムを記録したコンピュータ読み取り可能な記録媒体。A computer-readable recording medium storing an image processing program for causing a computer to execute the image processing method according to claim 1. 少なくとも隣接する2つのマークの距離が所定の誤差範囲内となるような複数のマークが配置された校正板を撮像する撮像手段と、
撮像された画像のうち歪みが最も少ない領域のマークの配置に関するパラメータを抽出する抽出手段と、
撮像された画像を複数の個別領域に分割する分割手段と、
抽出されたパラメータに基づいて、前記個別領域ごとに、含まれるマークの配置の歪みを検出する検出手段と、
検出されたマークの配置の歪みに基づいて、撮像された画像全体が歪んでいるか否かを診断する診断手段とを有することを特徴とする画像処理装置。
Imaging means for imaging a calibration plate on which a plurality of marks are arranged such that a distance between at least two adjacent marks is within a predetermined error range;
Extraction means for extracting a parameter related to the arrangement of marks in an area having the least distortion in a captured image,
Dividing means for dividing the captured image into a plurality of individual areas,
Based on the extracted parameters, for each of the individual areas, detecting means for detecting the distortion of the arrangement of the included mark,
A diagnostic means for diagnosing whether or not the entire captured image is distorted based on the detected distortion of the arrangement of the marks.
JP2003007531A 2003-01-15 2003-01-15 Image processing method, image processing apparatus, image processing program, and recording medium on which image processing program is recorded Expired - Fee Related JP4248885B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003007531A JP4248885B2 (en) 2003-01-15 2003-01-15 Image processing method, image processing apparatus, image processing program, and recording medium on which image processing program is recorded

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003007531A JP4248885B2 (en) 2003-01-15 2003-01-15 Image processing method, image processing apparatus, image processing program, and recording medium on which image processing program is recorded

Publications (2)

Publication Number Publication Date
JP2004220371A true JP2004220371A (en) 2004-08-05
JP4248885B2 JP4248885B2 (en) 2009-04-02

Family

ID=32897601

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003007531A Expired - Fee Related JP4248885B2 (en) 2003-01-15 2003-01-15 Image processing method, image processing apparatus, image processing program, and recording medium on which image processing program is recorded

Country Status (1)

Country Link
JP (1) JP4248885B2 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008209189A (en) * 2007-02-26 2008-09-11 Hitachi Ltd Position determination system for underwater moving apparatus
JP2010183265A (en) * 2009-02-04 2010-08-19 Alpine Electronics Inc Image display device and method for calculating camera-mounting angle of the same
JP2011180084A (en) * 2010-03-03 2011-09-15 Fuji Mach Mfg Co Ltd Picked-up image processor of component mounting machine
JP2011185886A (en) * 2010-03-11 2011-09-22 Nec Corp System and method for calculating reference position
JPWO2015004717A1 (en) * 2013-07-08 2017-02-23 富士機械製造株式会社 Component holding state detection method and component mounting apparatus
JP2018536141A (en) * 2015-08-24 2018-12-06 エアロジェット ロケットダイン インコーポレイテッド Nondestructive inspection process using direct strain imaging
KR20190087179A (en) * 2018-01-16 2019-07-24 주식회사 지오멕스소프트 A measuring method for detecting cracks on the structure surface and the recording medium thereof

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008209189A (en) * 2007-02-26 2008-09-11 Hitachi Ltd Position determination system for underwater moving apparatus
JP2010183265A (en) * 2009-02-04 2010-08-19 Alpine Electronics Inc Image display device and method for calculating camera-mounting angle of the same
JP2011180084A (en) * 2010-03-03 2011-09-15 Fuji Mach Mfg Co Ltd Picked-up image processor of component mounting machine
JP2011185886A (en) * 2010-03-11 2011-09-22 Nec Corp System and method for calculating reference position
JPWO2015004717A1 (en) * 2013-07-08 2017-02-23 富士機械製造株式会社 Component holding state detection method and component mounting apparatus
JP2018536141A (en) * 2015-08-24 2018-12-06 エアロジェット ロケットダイン インコーポレイテッド Nondestructive inspection process using direct strain imaging
KR20190087179A (en) * 2018-01-16 2019-07-24 주식회사 지오멕스소프트 A measuring method for detecting cracks on the structure surface and the recording medium thereof
KR102075630B1 (en) * 2018-01-16 2020-03-17 주식회사 지오멕스소프트 A measuring method for detecting cracks on the structure surface and the recording medium thereof

Also Published As

Publication number Publication date
JP4248885B2 (en) 2009-04-02

Similar Documents

Publication Publication Date Title
JP2014131257A (en) Image correction system, image correction method, and program
JP2007034985A (en) Information processing method and device
JP3994217B2 (en) Abnormal point detection system by image processing
JP4270949B2 (en) Calibration chart image display device, calibration device, and calibration method
CN108489423B (en) Method and system for measuring horizontal inclination angle of product surface
US20060008268A1 (en) Three-dimensional image processing apparatus, optical axis adjusting method, and optical axis adjustment supporting method
CN112102387B (en) Test method and test system based on depth estimation performance of depth camera
CN111627073B (en) Calibration method, calibration device and storage medium based on man-machine interaction
JP2006276454A (en) Image correcting method and pattern defect inspecting method using same
TWI468658B (en) Lens test device and method
CN110136205B (en) Parallax calibration method, device and system of multi-view camera
JP2011155412A (en) Projection system and distortion correction method in the same
JP4248885B2 (en) Image processing method, image processing apparatus, image processing program, and recording medium on which image processing program is recorded
JP2000284363A (en) Image projecting device and method
JP2008281481A (en) Apparatus and method for measuring resolution
JP5178781B2 (en) Sensor output data correction device and sensor output data correction method
JP5446285B2 (en) Image processing apparatus and image processing method
CN115684012A (en) Visual inspection system, calibration method, device and readable storage medium
JP6030890B2 (en) Image processing unit, image processing method, and stand type scanner
JP4828728B2 (en) Resolution measuring apparatus and resolution measuring method
JP2003510568A (en) LCD inspection method and LCD inspection apparatus by pattern comparison
TWI397668B (en) System and method for correcting an image
JP2006349443A (en) Camera calibration device
JP2008014857A (en) Device, method, and program for acquiring coordinate for inspection of printed board
JP2004288148A (en) Image processing method, system and device, and computer program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050810

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20081002

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20081014

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20081215

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

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

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

Free format text: PAYMENT UNTIL: 20120123

Year of fee payment: 3

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

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees