JP4296617B2 - Image processing apparatus, image processing method, and recording medium - Google Patents

Image processing apparatus, image processing method, and recording medium Download PDF

Info

Publication number
JP4296617B2
JP4296617B2 JP29321298A JP29321298A JP4296617B2 JP 4296617 B2 JP4296617 B2 JP 4296617B2 JP 29321298 A JP29321298 A JP 29321298A JP 29321298 A JP29321298 A JP 29321298A JP 4296617 B2 JP4296617 B2 JP 4296617B2
Authority
JP
Japan
Prior art keywords
pixel
distance
image
pixels
correction target
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
JP29321298A
Other languages
Japanese (ja)
Other versions
JP2000121319A5 (en
JP2000121319A (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.)
Sony Corp
Original Assignee
Sony 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 Sony Corp filed Critical Sony Corp
Priority to JP29321298A priority Critical patent/JP4296617B2/en
Publication of JP2000121319A publication Critical patent/JP2000121319A/en
Publication of JP2000121319A5 publication Critical patent/JP2000121319A5/en
Application granted granted Critical
Publication of JP4296617B2 publication Critical patent/JP4296617B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、画像処理装置および画像処理方法、並びに記録媒体に関し、特に、例えば、所定の対象物を、複数のカメラで撮影して得られる複数の画像の画素それぞれを相互に対応付け、対象物に対する視差や、対象物までの距離などを、画素ごとに求める、いわゆるステレオ画像処理を行う画像処理装置および画像処理方法、並びに記録媒体に関する。
【0002】
【従来の技術】
例えば、文献「解説,ビデオレート・ステレオマシン(A Video-rate Stereomachine;金出(Kanade),木村 著、日本ロボット学会誌("Journal of the Robotics Society of Japan (JRSJ)")vol.13 No.3, pp.322〜pp.326, 1995)」などには、2箇所以上から同一の対象物を撮影することにより、あるいは、2台以上のカメラで撮影することにより得た複数の画像の間で、互いに対応する画素の間の視差情報(視差)を得て、対象物上の各点の距離を求め、さらには、対象物の形状を計測する、いわゆるステレオ画像処理が開示されている。
【0003】
【発明が解決しようとする課題】
しかしながら、従来のステレオ画像処理では、背景と対象物との位置関係によっては、対象物の輪郭の近傍において、複数の画像間での画素の対応付けが不正確になり、画素間の視差情報や、対象物までの距離、あるいはその形状を正しく計測できないことがある。
【0004】
本発明は、このような状況に鑑みてなされたものであり、複数の画像間での画素の対応付けを正確に行うことができなかった場合であっても、比較的正確な視差情報や距離等を得ることができるようにするものである。
【0005】
【課題を解決するための手段】
請求項1に記載の画像処理装置は、第1の画像の画素と対応する、第2の画像の対応画素を検出する検出手段と、検出手段により検出された対応画素に基づき、第1の画像の画素について、距離関係情報を求める処理手段と、処理手段により求められた距離関係情報を画素値とする距離関係情報画像の画素のうち、検出手段により対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、距離関係情報の補正を行う対象とする補正対象画素として選択する選択手段と、距離関係画像のうち、選択手段により選択された補正対象画素を含む所定の領域を検索ブロックとして、検索ブロック内の複数の画素の中から、確実性が所定の条件を満たす画素を検索し、補正対象画素についての距離関係情報を、検索された画素についての距離関係情報に置換することにより、補正対象画素についての距離関係情報を補正する補正手段とを備え
【0006】
請求項9に記載の画像処理方法は、第1の画像の画素と対応する、第2の画像の対応画素を検出する検出ステップと、検出ステップの処理により検出された対応画素に基づき、第1の画像の画素について、距離関係情報を求める処理ステップと、処理ステップの処理により求められた距離関係情報を画素値とする距離関係情報画像の画素のうち、検出ステップの処理により対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、距離関係情報の補正を行う対象とする補正対象画素として選択する選択ステップと、距離関係画像のうち、選択ステップの処理により選択された補正対象画素を含む所定の領域を検索ブロックとして、検索ブロック内の複数の画素の中から、確実性が所定の条件を満たす画素を検索し、補正対象画素についての距離関係情報を、検索された画素についての距離関係情報に置換することにより、補正対象画素についての距離関係情報を補正する補正ステップとを含む
【0007】
請求項10に記載の記録媒体は、第1の画像の画素と対応する、第2の画像の対応画素を検出する検出ステップと、検出ステップの処理により検出された対応画素に基づき、第1の画像の画素について、距離関係情報を求める処理ステップと、処理ステップの処理により求められた距離関係情報を画素値とする距離関係情報画像の画素のうち、検出ステップの処理により対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、距離関係情報の補正を行う対象とする補正対象画素として選択する選択ステップと、距離関係画像のうち、選択ステップの処理により選択された補正対象画素を含む所定の領域を検索ブロックとして、検索ブロック内の複数の画素の中から、確実性が所定の条件を満たす画素を検索し、補正対象画素についての距離関係情報を、検索された画素についての距離関係情報に置換することにより、補正対象画素についての距離関係情報を補正する補正ステップとを含むプログラムが記録されている。
【0009】
請求項1に記載の画像処理装置においては、検出手段は、第1の画像の画素と対応する、第2の画像の対応画素を検出し、処理手段は、検出手段により検出された対応画素に基づき、第1の画像の画素について、距離関係情報を求めるようになされている。選択手段は、処理手段により求められた距離関係情報を画素値とする距離関係情報画像の画素のうち、検出手段により対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、距離関係情報の補正を行う対象とする補正対象画素として選択し、補正手段は、距離関係画像のうち、選択手段により選択された補正対象画素を含む所定の領域を検索ブロックとして、検索ブロック内の複数の画素の中から、確実性が所定の条件を満たす画素を検索し、補正対象画素についての距離関係情報を、検索された画素についての距離関係情報に置換することにより、補正対象画素についての距離関係情報を補正するようになされている。
【0010】
請求項9に記載の画像処理方法においては、第1の画像の画素と対応する、第2の画像の対応画素を検出し、検出された対応画素に基づき、第1の画像の画素について、距離関係情報を求めるようになされている。求められた距離関係情報を画素値とする距離関係情報画像の画素のうち、対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、距離関係情報の補正を行う対象とする補正対象画素として選択し、距離関係画像のうち、選択された補正対象画素を含む所定の領域を検索ブロックとして、検索ブロック内の複数の画素の中から、確実性が所定の条件を満たす画素を検索し、補正対象画素についての距離関係情報を、検索された画素についての距離関係情報に置換することにより、補正対象画素についての距離関係情報を補正するようになされている。
【0011】
請求項10に記載の記録媒体に記録されるプログラムにおいては、第1の画像の画素と対応する、第2の画像の対応画素を検出し、検出された対応画素に基づき、第1の画像の画素について、距離関係情報を求めるようになされている。求められた距離関係情報を画素値とする距離関係情報画像の画素のうち、対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、距離関係情報の補正を行う対象とする補正対象画素として選択し、距離関係画像のうち、選択された補正対象画素を含む所定の領域を検索ブロックとして、検索ブロック内の複数の画素の中から、確実性が所定の条件を満たす画素を検索し、補正対象画素についての距離関係情報を、検索された画素についての距離関係情報に置換することにより、補正対象画素についての距離関係情報を補正するようになされている。
【0013】
【発明の実施の形態】
図1は、本発明を適用した距離測定装置の一実施の形態の構成例を示している。
【0014】
カメラ1および2(撮像手段)は、異なる位置に固定された、例えばCCD(Charge Coupled Device)ビデオカメラで、その異なる位置(異なる視線方向)から対象物3を撮影し、その結果得られる画像を、カメラインターフェイス4に出力するようになされている。ここで、カメラ1または2は、それぞれ、いわゆる基準カメラまたは検出カメラとして機能する。そこで、以下、適宜、カメラ1または2を、それぞれ基準カメラ1または検出カメラ2というとともに、それぞれが出力する画像を、基準カメラ画像(第1の画像)または検出カメラ画像(第2の画像)という。
【0015】
カメラインターフェイス4は、基準カメラ1または検出カメラ2それぞれからの基準カメラ画像または検出カメラ画像を受信し、フレームメモリ5に供給するようになされている。フレームメモリ5は、カメラインターフェイス4からの基準カメラ画像および検出カメラ画像を、例えば、フレーム単位などで記憶するようになされている。
【0016】
演算処理回路6は、フレームメモリ5に記憶された基準カメラ画像および検出カメラ画像に基づいて、基準カメラ1または検出カメラ2のうちの、例えば、基準カメラ1から対象物3までの距離に関係する距離関係情報を求め、その距離関係情報に対応する画素値を有する画像を生成するようになされている。
【0017】
即ち、演算処理回路6は、基準カメラ画像の画素と、検出カメラ画像の画素のとの間の対応をとり、基準カメラ画像の画素それぞれについて、対象物3までの距離を求めて、その距離に対応する画素値を有する画像(例えば、距離が大きいほど輝度値が大きい画像)(以下、適宜、距離画像という)を生成するようになされている。あるいは、演算処理回路6は、対応をとった画素間の視差ζを測定し、その視差ζに対応する画素値を有する画像(以下、適宜、視差画像という)を生成するようになされている。なお、演算処理回路6においては、視差ζから、距離画像を求めたり、さらに、距離画像から、対象物3の3次元形状の解析を行うようにすること等も可能である。
【0018】
具体的には、演算処理回路6は、制御用のCPU(Central Processing Unit)6A,ROM(Read Only Memory)6B,RAM(Random Access Memory)6C、および画像処理用のDSP(Digital Signal Processor)6Dなどから構成されている。そして、CPU6Aは、記憶装置7に記憶されたアプリケーションプログラムを実行することで、距離測定装置を構成する各ブロックを制御するとともに、後述するようなステレオ処理や、補正処理等を行うことにより、距離画像等を生成するようになされている。
【0019】
なお、ROM6Bは、例えば、IPL(Initial Program Loading)用のプログラムその他の必要なデータを記憶している。RAM6Cは、CPU6Aが実行するプログラムや、CPU6Aの処理上必要なデータなどを一時記憶するようになされている。DSP6Dは、CPU6Aの制御の下、必要な積和演算その他を行うようになされている。
【0020】
記憶装置7は、例えば、HD(Hard Disk)や、CD−ROM(Compact Disc Read Only Memory)などで構成され、演算処理回路6が実行するOS(Operating System)のプログラムや、上述したような処理を行うためのアプリケーションプログラムなどを記憶している。また、記憶装置7は、演算処理回路6が出力する距離画像等を記憶するようにもなされている。出力装置8は、例えば、CRT(Cathode Ray Tube)や液晶パネルなどで構成され、演算処理回路6が出力する距離画像等を表示するようになされている。
【0021】
以上のように構成される距離測定装置では、基準カメラ1および検出カメラ2によって対象物3が撮影される。さらに、その結果得られる基準カメラ画像および検出カメラ画像が、カメラインターフェイス4を介してフレームメモリ5に供給されて記憶される。そして、その基準カメラ画像および検出カメラ画像を用いて、演算処理回路6において、ステレオ処理が行われる。
【0022】
ここで、ステレオ処理は、上述のように、2つ以上の方向(異なる視線方向)からカメラで同一対象物を撮影して得られる複数の画像間の画素同士を対応付けることで、対応する画素間の視差情報や、カメラから対象物までの距離、対象物の形状を求めるものである。
【0023】
即ち、例えば、図2に示すように、2台の基準カメラ1および検出カメラ2で対象物3を撮影すると、基準カメラ1からは対象物3の投影像を含む基準カメラ画像が得られ、検出カメラ2からも対象物3の投影像を含む検出カメラ画像が得られる。いま、図2における対象物3上のある点Pが、基準カメラ画像および検出カメラ画像の両方に表示されているとすると、その点Pが表示されている基準カメラ画像上の位置と、検出カメラ画像上の位置、つまり対応点(対応画素)とから、視差情報を求めることができ、さらに、三角測量の原理を用いて、点Pの3次元空間における位置(3次元位置)を求めることができる。
【0024】
従って、ステレオ処理では、まず、対応点を検出することが必要となるが、その検出方法としては、例えば、エピポーラライン(Epipolar Line)を用いたエリアベースマッチング法などがある。
【0025】
即ち、図3に示すように、基準カメラ1においては、対象物3上の点Pは、その点Pと基準カメラ1の光学中心(レンズ中心)O1とを結ぶ直線L上の、基準カメラ1の撮像面S1との交点naに投影される。
【0026】
また、検出カメラ2においては、対象物3の点Pは、その点Pと検出カメラ2の光学中心(レンズ中心)O2とを結ぶ直線上の、検出カメラ2の撮像面S2との交点nbに投影される。
【0027】
この場合、直線Lは、光学中心O1およびO2、並びに点na(または点P)の3点を通る平面と、検出カメラ画像が形成される撮像面S2との交線L2として、撮像面S2上に投影される。点Pは、直線L上の点であり、従って、撮像面S2において、点Pを投影した点nbは、直線Lを投影した直線L2上に存在し、この直線L2はエピポーララインと呼ばれる。即ち、点naの対応点nbが存在する可能性のあるのは、エピポーララインL2上であり、従って、対応点nbの探索は、エピポーララインL2上を対象に行えば良い。
【0028】
ここで、エピポーララインは、例えば、撮像面S1に形成される基準カメラ画像を構成する画素ごとに考えることができるが、基準カメラ1と検出カメラ2の位置関係が既知であれば、その画素ごとに存在するエピポーララインは求めることができる。
【0029】
エピポーララインL2上の点からの対応点nbの検出は、例えば、次のようなエリアベースマッチングによって行うことができる。
【0030】
即ち、エリアベースマッチングでは、図4(A)に示すように、基準カメラ画像上の点naを中心(例えば、対角線の交点)とする、例えば長方形状の小ブロック(以下、適宜、基準ブロックという)(第1のブロック)が、基準カメラ画像から抜き出されるとともに、図4(B)に示すように、検出カメラ画像に投影されたエピポーララインL2上の、ある点を中心とする、基準ブロックと同一の大きさの小ブロック(以下、適宜、検出ブロックという)(第2のブロック)が、検出カメラ画像から抜き出される。
【0031】
ここで、図4(B)の実施の形態においては、エピポーララインL2上に、検出ブロックの中心とする点として、点nb1乃至nb6の6点が設けられている。この6点nb1乃至nb6は、図3に示した3次元空間における直線Lを、所定の一定距離ごとに区分する点、即ち、基準カメラ1からの距離が、例えば、1m,2m,3m,4m,5m,6mの点それぞれを、検出カメラ2の撮像面S2に投影した点で、従って、基準カメラ1からの距離が1m,2m,3m,4m,5m,6mの点にそれぞれ対応している。
【0032】
エリアベースマッチングでは、検出カメラ画像から、エピポーララインL2上に設けられている点nb1乃至nb6それぞれを中心とする検出ブロックが抜き出され、各検出ブロックと、基準ブロックとの相関が、所定の評価関数を用いて演算される。そして、点naを中心とする基準ブロックとの相関が最も高い検出ブロックの中心の点nbが、点naの対応点として求められる。
【0033】
即ち、例えば、いま、評価関数として、相関が高いほど小さな値をとる関数を用いた場合に、エピポーララインL2上の点nb1乃至nb6それぞれについて、例えば、図5に示すような評価値(評価関数の値)が得られたとする。この場合、評価値が最も小さい(相関が最も高い)点nb3が、点naの対応点として検出される。なお、図5において、点nb1乃至nb6それぞれについて求められた評価値(図5において●印で示す)のうちの最小値付近のものを用いて補間を行い、評価値がより小さくなる点(図5において×印で示す)を求めて、その点を、最終的な対応点として検出することも可能である。
【0034】
図4の実施の形態では、上述したように、3次元空間における直線Lを所定の等距離ごとに区分する点を、検出カメラ2の撮像面S2に投影した点が設定されているが、この設定は、例えば、基準カメラ1および検出カメラ2のキャリブレーション時に行うことができる。そして、このような設定を、基準カメラ1の撮像面S1を構成する画素ごとに存在するエピポーララインごとに行い、図6(A)に示すように、エピポーラライン上に設定された点(以下、適宜、設定点という)と、基準カメラ1からの距離とを対応付ける設定点/距離テーブルをあらかじめ作成しておけば、対応点となる設定点を検出し、設定点/距離テーブルを参照することで、即座に、基準カメラ1からの距離(対象物3までの距離)を求めることができる。即ち、いわば、対応点から、直接、距離を求めることができる。
【0035】
一方、基準カメラ画像上の点naについて、検出カメラ画像上の対応点nbを検出すれば、その2点naおよびnbの間の視差(視差情報)を求めることができる。さらに、基準カメラ1と検出カメラ2の位置関係が既知であれば、2点naおよびnbの間の視差から、三角測量の原理によって、対象物3までの距離を求めることができる。視差から距離の算出は、所定の演算を行うことによって行うことができるが、あらかじめその演算を行っておき、図6(B)に示すように、視差ζと距離との対応付ける視差/距離テーブルをあらかじめ作成しておけば、対応点を検出し、視差を求め、視差/距離テーブルを参照することで、やはり、即座に、基準カメラ1からの距離を求めることができる。
【0036】
ここで、視差と、対象物3までの距離とは一対一に対応するものであり、従って、視差を求めることとと、対象物3までの距離を求めることとは、いわば等価である。
【0037】
また、対応点の検出に、基準ブロックおよび検出ブロックといった複数画素でなるブロックを用いるのは、ノイズの影響を軽減し、基準カメラ画像上の画素(点)naの周囲の画素のパターンの特徴と、検出カメラ画像上の対応点(画素)nbの周囲の画素のパターンの特徴との相関性を明確化して判断することにより、対応点の検出の確実を期すためであり、特に、変化の少ない基準カメラ画像および検出カメラ画像に対しては、画像の相関性により、ブロックの大きさが大きければ大きいほど対応点の検出の確実性が増す。
【0038】
次に、エリアベースマッチングにおいて、例えば、基準ブロックと検出ブロックとの相関性を評価する評価関数としては、基準ブロックを構成する画素と、それぞれの画素に対応する、検出ブロックを構成する画素の画素値の差分の絶対値の総和や、その差分の自乗和、正規化された相互相関(normalized cross correlation)などを用いることができる。
【0039】
基準ブロックを構成する画素と、それぞれの画素に対応する、検出ブロックを構成する画素の画素値の差分の絶対値の総和を評価関数として用いる場合、その評価値(評価関数の値)は、例えば、次式で計算することができる。
【0040】
【数1】

Figure 0004296617
・・・(1)
なお、式(1)において、xは、対応点を求めようとして注目している基準画像上の画素(注目画素)を表し、従って、基準ブロックを構成する中心の画素を表す。また、yは、検出ブロックを構成する中心の画素を表し、S(x,y)は、基準カメラ画像上の画素xを中心とする基準ブロックと、検出カメラ画像上の画素yを中心とする検出ブロックとの相関性を示す評価値を表す。さらに、WAまたはWBは、基準ブロックまたは検出ブロックをそれぞれ表し、j WA,WBであるから、x+jは、基準ブロックWAを構成する画素を表し、y+jは、画素x+jに対応する、検出ブロックWBを構成する画素を、それぞれ表す。また、YA(x+j)またはYB(y+j)は、それぞれ、画素x+jまたはy+jの画素値を表す。
【0041】
式(1)を用いる場合においては、例えば、画素yを、エピポーラライン上に設定された設定点に順次ずらしながら、評価値S(x,y)を計算し、その評価値S(x,y)を最も小さくする検出カメラ画像の画素y(=ymin)が、基準カメラ画像の画素xの対応点として検出される。なお、視差は、画素xとyminとの位置から計算される。
【0042】
また、例えば、基準ブロックを構成する画素と、それぞれの画素に対応する、検出ブロックを構成する画素の画素値の差分の自乗和を評価関数として用いる場合、その評価値は、例えば、次式で計算することができる。
【0043】
【数2】
Figure 0004296617
・・・(2)
なお、式(2)において、x,yは、画素のx座標、y座標をそれぞれ表し、η,ξは、x方向の視差、y方向の視差をそれぞれ表す。そして、SSD(x,y,η,ξ)は、視差が(η,ξ)であると仮定した場合の評価値、即ち、基準カメラ画像上の座標(x,y)に位置する画素を中心とする基準ブロックと、検出カメラ画像上の座標(x−η,y−ξ)に位置する画素を中心とする検出ブロックとの相関性を示す評価値を表す。また、WAまたはWBは、基準ブロックまたは検出ブロックをそれぞれ表し、i,j WA,WBであるから、(x+i,y+j)または(x+i−η,y+j−ξ)は、基準カメラ画像または検出カメラ画像上の座標をそれぞれ表す。そして、YA(x+i,y+j)は、基準カメラ画像上の座標(x+i,y+j)に位置する画素の画素値を表し、YB(x+i−η,y+j−ξ)は、検出カメラ画像上の座標(x+i−η,y+j−ξ)に位置する画素の画素値を表す。
【0044】
式(2)を用いる場合には、視差(η,ξ)を変化させならが、評価値SSD(x,y,η,ξ)を計算し、その評価値SSD(x,y,η,ξ)を最も小さくする検出カメラ画像の画素(x−η,y−ξ)が、基準カメラ画像の画素(x,y)の対応点として検出される。なお、評価値SSD(x,y,η,ξ)を最も小さくするときの視差(η,ξ)を、(ηmin,ξmin)と表すと、基準カメラの画素と、その対応点との距離としての視差ζは、次式で求められる。
【0045】
【数3】
Figure 0004296617
・・・(3)
【0046】
ここで、式(1)および(2)に示した評価値は、基準ブロックを構成する画素と、それぞれの画素に対応する、検出ブロックの画素との画素値の差が少ないほど小さくなる。従って、基準カメラ画像の画素naについての評価値を最も小さくする検出カメラ画像の画素nbについては、その評価値が小さいほど、画素naの対応点であることの確実性が大きく、逆に、その評価値が大きいほど、画素naの対応点であることの確実性が低くなることになる。
【0047】
次に、例えば、図7(A)に示すように、背景となる壁の前方(基準カメラ1および検出カメラ2から見て手前)に置かれた対象物3を、基準カメラ1および検出カメラ2で撮影し、エピポーララインを用いてエリアベースマッチングを行うことにより、対応点の検出を行う場合を考える。
【0048】
ここで、上述したように、視差を求めることとと、対象物3までの距離を求めることとは等価であり、以下では、対応点から、例えば、図6(A)に示したような設定点/距離対応テーブルを参照して、距離を求めるものとして、説明を行う。さらに、以下では、例えば、式(1)の評価値を用いることとする。
【0049】
図7(A)に示した場合においては、基準カメラ1または検出カメラ2それぞれから、例えば、図7(B)に示すような基準カメラ画像または検出カメラ画像が得られる。
【0050】
そして、いま、図7(B)に示した基準カメラ画像において、図8(A)に示すように、対象物3の投影像である前景に接する背景の画素k(図8(A)において、■印で示す)の対応点k’を検出することを考える。
【0051】
この場合、例えば、画素kと対応点k’との間の視差ζが大きいと、図8(B)に示すように、基準カメラ画像において前景に接する背景の画素kの、検出カメラ画像上の真の対応点k’が、対象物3の投影像である前景から離れた位置に観察されることがある。
【0052】
このような場合においては、基準カメラ画像の画素kを中心画素とする基準ブロックは、図8(C)に示すように、一部に前景の画素を含み、残りに背景の画素を含むものとなる。なお、図8(C)の実施の形態では、画素kを中心とする5×5画素(横×縦)が、基準ブロックとして構成されており、左側の2列が前景の画素で、右側の3列が背景の画素で、それぞれ構成されている。
【0053】
図8(C)に示した場合において、基準ブロックの左側の2列と、右側の3列にそれぞれ対応する検出カメラ画像の画素は、図8(D)に示すように、2カ所に分かれる。即ち、基準ブロックの、前景の画素でなる左側の2列は、検出カメラ画像における前景の画素群Aに対応する。一方、基準ブロックの、背景の画素でなる右側の3列は、検出カメラ画像における真の対応点k’の部分の背景の画素群Bに対応する。
【0054】
そして、このように、基準ブロックを構成する画素に対応する検出カメラ画像の画素が分かれる場合においては、基準ブロックについて計算される評価値が、画素群Bを含む検出ブロックを対象としたときよりも、画素群Aを含む検出ブロックを対象としたときの方が小さくなることがある。即ち、図8(E)に示すように、検出カメラ画像において、前景に接する背景の画素k’’を中心として構成される検出ブロックが、基準ブロックとの間の評価値を最も小さくすることがある。この場合、真の対応点k’ではない点k’’が、画素kの対応点として検出され、従って、対応点を誤検出することになり、その誤検出に起因して、画素kに対応する3次元空間上の点までの距離も、誤った値が求められることになる。即ち、上述のような対応点の誤検出があると、画素kに対応する3次元空間上の点までの距離は、前景を構成する対象物3までの距離に近い値となって求められる。そして、その結果、そのような距離を画素値とする距離画像は、対象物3の横幅が広がったようなものとなる。
【0055】
ここで、以上のような対応点の誤検出は、前景と背景の絵柄が異なっている場合に比較的生じやすく、さらに、その絵柄が大きく異なっている場合には、特に生じやすい。
【0056】
上述のような対応点の誤検出は、基準ブロック(従って、検出ブロックも)を小さくする(基準ブロックを構成する画素数を少なくする)ことにより低減することができるが、これでは、エリアベースマッチングによる対応点の検出の確実性が低下する。
【0057】
そこで、図1の距離測定装置の演算処理回路6では、次のような距離の補正処理を行うことで、エリアベースマッチングによる対応点の検出の確実性を保ちつつ、上述のような前景と背景の境界部分、即ち、エッジ部分で生じる対応点の誤検出に起因する距離への影響を低減するようになされている。
【0058】
即ち、演算処理回路6では、まず最初に、上述したようなステレオ処理により、基準カメラ画像の各画素について、検出カメラ画像の各画素が、式(1)に示した評価関数による評価値を用いてエリアベースマッチング法により対応付けられ(対応点が検出され)、基準カメラ画像の各画素に対応する3次元空間上の点までの距離が求められる。これにより、その距離を画素値とする距離画像が生成される。
【0059】
次に、図9(A)に示すように、基準カメラ画像の画素kを中心とする、その画素kの距離を補正するのに最適な画素(以下、適宜、最尤画素という)を検索する領域(範囲)としての小ブロック(以下、適宜、検索ブロックという)(図9(A)において点線で囲んで示す)(第3のブロック)が構成される。なお、図9(A)では、検索ブロックは、画素kについて構成される基準ブロックと同一とされている。
【0060】
さらに、検索ブロックを構成する画素のうち、評価値の最小値が最も小さいものが、最尤画素として選択(検出)される。即ち、基準カメラ画像の画素kを中心とする検索ブロックに含まれる画素それぞれを中心とする基準ブロックそれぞれと、その検索ブロックに含まれる画素それぞれについて検出された検出カメラ画像上の対応点それぞれを中心とする検出ブロックそれぞれとの間の評価値の中で、最も小さい値が得られている検索ブロック内の画素が、対応点との対応付けが最も確からしく行われているものであるとして、その画素が、最尤画素として検出される。なお、図9(A)では、画素kを中心とする検索ブロックの最も右上の画素k2が、最尤画素として検出されている。
【0061】
そして、距離画像の画素kの画素値としての距離を、その画素kについて検出された最尤画素の画素値となっている距離で、例えば置換することで、画素kの画素値としての距離が補正される。即ち、図9(A)では、画素kについての距離(画素値)は、その検索ブロックの最も右上の画素k2を最尤画素として、その最尤画素k2についての距離(画素値)に置き換えられる。
【0062】
従って、この補正処理では、基準カメラ画像における前景と背景との境界(エッジ)部分の画素kについて誤検出された、検出カメラ画像の対応点k’’(図8)を無視する一方、例えば、図9(B)に示すように、対応点の誤検出が生じやすいエッジ部分を避けて、背景の画素と前景の画素とが混在しない基準ブロックを用いてエリアベースマッチングを行うことにより検出された対応点から求められた距離が、画素kの真の対応点k’から求められる距離にほぼ等しいと推定し、そのような、いわば、より確からしい距離で、対応点が誤検出された画素についての距離が置き換えられる。
【0063】
即ち、図9において、画素kについては、前景の画素と背景の画素とを含む基準ブロックが構成されるが(図9(A))、その近くにある画素k2については、背景の画素だけで基準ブロックが構成される(図9(B))。このため、画素kの対応点が誤検出される可能性は高い一方で、画素k2の対応点が誤検出される可能性は低いため、画素kについての距離は、より正確である可能性が高い画素k2についての距離に置き換えられる。
【0064】
なお、検索ブロックの大きさは特に限定されるものではないが、あまり大きいと、画素kからの距離が遠い位置にある画素についての距離による置き換えが行われる場合がある。そして、そのような遠い位置にある画素についての距離が、画素kについての真の距離にほぼ等しいとは推定し難いため、検索ブロックの大きさはあまり大きくしない方が望ましい。一方、検索ブロックの大きさが小さすぎると、基準カメラ画像において、背景の画素と前景の画素とが混在しない基準ブロック(対応点の誤検出が生じやすいエッジ部分を避けた基準ブロック)が構成される画素が、画素kの検索ブロックに含まれなくなる。即ち、検索ブロックに、対応点の誤検出の可能性の低い画素が含まれなくなり、その結果、誤った対応点から求められた誤った距離による置き換えが行われる場合が生じる。従って、検索ブロックの大きさは、あまり小さくしない方が望ましい。即ち、検索ブロックは、以上のような不都合が生じないように、適切な大きさとするのが望ましい。
【0065】
また、距離画像を構成する画素の画素値としての距離の補正は、その距離画像を構成する画素すべてを、順次、補正の対象として行うことも可能であるが、補正の対象とする画素(以下、適宜、補正対象画素という)を選択して行うことも可能である。この点については、後述する。
【0066】
次に、図10は、上述のようなステレオ処理および補正処理を行う図1の演算処理回路6の機能的構成例を示している。なお、この機能的構成は、例えば、演算処理回路6が、記憶装置7に記憶されたアプリケーションプログラムを実行することで実現される。
【0067】
ステレオ処理部11(検出手段)(処理手段)は、フレームメモリ5に記憶された基準カメラ画像および検出カメラ画像を読み出し、ステレオ処理を行うことで、距離画像等を求めるようになされている。即ち、ステレオ処理部11は、エピポーララインを用いてエリアベースマッチングを行うことにより、基準カメラ画像の画素それぞれと対応する、検出カメラ画像の対応点を検出し、その対応点に基づき、基準カメラ画像の各画素について、その画素に投影された3次元空間上の点までの距離を求める。そして、ステレオ処理部11は、その距離を画素値とする距離画像や、対応点を検出するときに得られた評価値を、距離画像記憶部12に供給する。
【0068】
距離画像記憶部12は、ステレオ処理部11から供給される距離画像および評価値を記憶するようになされている。
【0069】
補正対象画素選択部13(選択手段)は、距離画像記憶部12に記憶された距離画像を構成する画素から、その画素値となっている距離の補正を行う対象(補正処理の対象)とする補正対象画素を選択し、補正部14に指示するようになさている。補正部14(補正手段)は、距離画像記憶部12に記憶された距離画像を構成する画素のうち、補正対象画素選択部13から補正対象画素として指示のあったものを対象に、その画素値としての距離を補正するようになされている。
【0070】
距離画像記憶部15は、距離画像記憶部12に記憶された距離画像の、補正部14による補正後のものを記憶するようになされている。
【0071】
次に、図11のフローチャートを参照して、図10の演算処理回路6が行うステレオ処理について説明する。なお、ステレオ処理は、上述のように、ステレオ処理部11で行われる。
【0072】
上述のように、基準カメラ1または検出カメラ2それぞれでは、対象物3が撮影され、その結果得られる、例えば1フレームの基準カメラ画像または検出カメラ画像がフレームメモリ5に供給されて記憶される。
【0073】
フレームメモリ5に、基準カメラ画像および検出カメラ画像が記憶されると、ステップS1において、基準カメラ画像(および距離画像)を構成する画素を表す変数iが、例えば、1に初期化され(i=1は、例えば、基準カメラ画像の最も左上の画素を表す)、ステップS2に進む。ステップS2では、基準カメラ画像の画素iについてのエピポーラライン(3次元空間の対象物上の点と、基準カメラ1の光学中心O1とを結ぶ直線を、検出カメラ画像(撮像面S2)上に投影したもの)上にあらかじめ設定された設定点に対応する距離番号jが、例えば、1に初期化され、ステップS3に進む。
【0074】
ここで、基準カメラ画像の各画素についての、検出カメラ画像上におけるエピポーララインの検出や設定点の設定は、例えば、基準カメラ1および検出カメラ2のキャリブレーション時に行われているものとする。なお、3次元空間におけるエピポーラライン上の、距離番号jとj+1に対応する設定点どうし(隣接する設定点どうし)の距離は、例えば、図1の距離測定装置に対して要求される距離分解能にしたがって決定される。
【0075】
ステップS3では、基準カメラ画像の画素iについてのエピポーラライン上の距離番号jに対応する設定点の画素n(i,j)が、検出カメラ画像から検出される。なお、画素n(i,j)は、サブピクセルの精度とすることもできる。また、距離番号jと、それに対応する設定点n(i,j)との関係は、例えば、キャリブレーション時に求めておき、テーブル(ルックアップテーブル)にしておくことで、距離番号jに対応する設定点の画素n(i,j)は即座に求めることができる。
【0076】
そして、ステップS4に進み、基準カメラ画像の画素iを中心とする基準ブロックWA(i)が、基準カメラ画像から抽出される(切り出される)とともに、検出カメラ画像の画素n(i,j)を中心とする検出ブロックWB(i,j)が、検出カメラ画像から抽出され、ステップS5に進む。
【0077】
ステップS5では、基準ブロックWA(i)を構成する画素と、検出ブロックWB(i,j)を構成する画素とを用い、例えば、式(1)で定義される評価値S(i,n(i,j))が計算され、ステップS6に進む。ここで、以下、適宜、評価値S(i,n(i,j))を、S(j)と表す。なお、式(1)では、画素の輝度値を用いて、評価値S(j)が計算されるから、評価値S(j)は、基準ブロックWA(i)を構成する画素と、検出ブロックWB(i,j)を構成する画素との間の輝度値に関する類似性を表すということができる。また、このように、評価値S(j)を、輝度値を用いて計算する場合には、基準カメラ画像および検出カメラ画像は、輝度成分を有すれば良いから、基準カメラ1および検出カメラ2としては、輝度信号のみでなる濃淡画像を出力する(色信号を出力しない)、いわゆる白黒カメラを用いることができる。但し、式(1)による評価値の計算には、輝度信号だけでなく、色差信号も用いるようにすることが可能である。
【0078】
ステップS6では、距離番号jが、その最大値Jに等しいかどうかが判定され、等しくないと判定された場合、ステップS7に進み、距離番号jが1だけインクリメントされる。そして、ステップS3に戻り、以下、ステップS3乃至S7の処理が繰り返される。即ち、これにより、画素iについてのエピポーラライン上に設定されたすべての設定点について、画素iとの相関(ここでは、式(1)で表される評価値)が計算される。
【0079】
一方、ステップS6において、距離番号jが最大値Jに等しいと判定された場合、即ち、画素iについてのエピポーラライン上に設定されたすべての設定点について、画素iとの評価値S(j)が計算された場合、ステップS8に進み、評価値S(j)を最小にする(相関を最大にする)距離番号jが求められる。ここで、この評価値S(j)を最小にする(相関を最大にする)距離番号jを、以下、適宜、最小距離番号jmaxと表す。
【0080】
なお、最小距離番号jmaxに対応する設定点n(i,jmax)が、画素iの対応点であり、従って、最小距離番号jmaxを求めることは、対応点n(i,jmax)を検出することと等価である。
【0081】
また、距離番号jは、ここでは、整数の値をとるが、図5で説明したような補間を行うことで、小数の値をとる最小距離番号jmaxを求めるようにすることも可能である。
【0082】
その後、ステップS9に進み、最小距離番号jmaxから特定される距離が、距離画像を構成する画素iについての画素値として、ステレオ処理部11から距離画像記憶部12に供給されて記憶される。さらに、ステップS10に進み、評価値S(jmax)が、距離画像記憶部12に供給され、画素iの最終的な評価値S(i)として、その画素iについての距離と対応付けられて記憶され、ステップS11に進む。
【0083】
ステップS11では、画素iが、基準カメラ画像を構成する最後の画素(例えば、基準カメラ画像の最も右下の画素)Iに等しいかどうかが判定され、等しくないと判定された場合、ステップS12に進み、変数iが1だけインクリメントされ、ステップS2に戻る。そして、次に処理すべき画素(例えば、いま処理対象とされていた画素の、ラインスキャン順で次の画素)iを対象に、以下、同様の処理が繰り返される。
【0084】
また、ステップS11において、画素iが、基準カメラ画像を構成する最後の画素Iに等しいと判定された場合、即ち、基準カメラ画像を構成する画素すべてについて距離と評価値(最終的な評価値)S(jmax)が求められた場合、ステレオ処理を終了する。
【0085】
なお、図11では、基準カメラ画像を構成するすべての画素について、ステレオ処理を行うようにしたが、ステレオ処理は、基準カメラ画像を構成する一部の画素のみを対象に行うようにすることも可能である。
【0086】
次に、図12のフローチャートを参照して、図10の演算処理回路6が行う補正処理について説明する。なお、補正処理は、ステレオ処理が行われた後、補正対象画素選択部13および補正部14において行われる。
【0087】
補正処理では、まず最初に、ステップS21において、距離画像(および基準カメラ画像)を構成する画素を表す変数iが、例えば、1に初期化され、ステップS22に進む。ステップS22では、補正対象画素選択部13において、距離画像記憶部12に記憶されている、画素iの評価値S(i)(図11のステップS10で記憶された最終的な評価値S(i))が読み出され、その評価値S(i)が、所定の閾値εよりも小さいかどうかが判定される。
【0088】
ステップS22において、画素iの評価値S(i)が閾値εより小さいと判定された場合、即ち、基準カメラ画像の画素iについて、対応点を検出した際の評価値の最小値S(i)(図11で説明したS(jmax)に等しい)が、所定の閾値εより小さく、従って、検出した対応点が、真の対応点である確実性が高い場合、ステップS31に進む。ステップS31では、補正部14は、画素iの距離Z(i)を距離画像記憶部12から読み出して、距離画像記憶部15に供給して記憶させ、ステップS29に進む。従って、この場合、ステレオ処理で求められた、画素iについての距離Z(i)の補正は行われない。
【0089】
一方、ステップS22において、画素iの評価値S(i)が閾値εより小さくないと判定された場合、即ち、基準カメラ画像の画素iについて、対応点を検出した際の評価値の最小値S(i)が、所定の閾値ε以上であり、従って、検出した対応点が、真の対応点である確実性が低い場合、ステップS23に進み、以下、ステレオ処理で求められた、画素iについての距離の補正が、図9で説明したようにして行われる。
【0090】
即ち、補正対象画素選択部13では、画素iが補正対象画素として選択され、補正部14に知らされる。補正部14は、補正対象画素選択部13から、画素iが補正対象画素であるとの知らせを受けると、ステップS23において、画素iを中心とする検索ブロックW内の画素を表す変数jが、例えば、その検索ブロックW内の最も左上の画素を表す値j0に初期化される。さらに、ステップS23では、補正部14において、距離画像記憶部12を参照することで、検索ブロックW内の画素の最小の評価値を保持する変数Sminが、例えば、画素j0の評価値S(j0)に初期化されるとともに、距離を保持する変数Zが、例えば、画素j0についての距離Z(j0)に初期化される。
【0091】
そして、ステップS24に進み、補正部14は、画素jについての評価値S(j)を、距離画像記憶部12から読み出し、変数Sminが、評価値S(j)より小さいかどうかを判定する。ステップS24において、変数Sminが、評価値S(j)より小さくないと判定された場合、即ち、評価値S(j)が、変数Smin以下である場合、ステップS25に進み、補正部14は、変数Sminに、評価値S(j)を新たにセットするとともに、変数Zに、画素jについての距離Z(j)を新たにセットし、ステップS26に進む。
【0092】
また、ステップS24において、変数Sminが、評価値S(j)より小さいと判定された場合、ステップS25をスキップして、ステップS26に進み、画素jが、検索ブロックW内の最後の画素(例えば、検索ブロックWの最も右下の画素)であるかどうかが判定される。ステップS26において、画素jが、検索ブロックW内の最後の画素でないと判定された場合、ステップS27に進み、変数jに、検索ブロックW内の画素の中で、まだ、評価値が、変数Sminと比較されていないものを表す値がセットされ(例えば、検索ブロックWの画素のうち、いま処理の対象となっている画素の、ラインスキャン順で次の画素を表す値がセットされ)、ステップS24に戻る。そして、ステップS26において、画素jが、検索ブロックW内の最後の画素であると判定されるまで、ステップS24乃至S27の処理が繰り返される。即ち、これにより、変数Sminには、検索ブロックW内の画素の評価値のうちの最小値、つまり最尤画素の評価値がセットされ、変数Zには、その最尤画素についての距離がセットされる。
【0093】
そして、ステップS26において、画素jが、検索ブロックW内の最後の画素であると判定されると、ステップS28に進み、補正部14は、距離画像記憶部12に記憶された画素iについての距離Z(i)を、最尤画素の距離Zに置き換えることで補正し、ステップS29に進む。即ち、補正部14は、距離画像記憶部15に、画素iの距離として、最尤画素の距離Zを書き込み、ステップS29に進む。
【0094】
ステップS29では、図11のステップS11における場合と同様に、画素iが、距離画像を構成する最後の画素Iに等しいかどうかが判定され、等しくないと判定された場合、ステップS30に進み、変数iが1だけインクリメントされ、ステップS22に戻る。従って、この場合、次に処理すべき画素iを対象に、以下、同様の処理が繰り返される。
【0095】
また、ステップS29において、画素iが、距離画像を構成する最後の画素Iに等しいと判定された場合、補正処理を終了する。
【0096】
以上のように、評価値が所定の閾値εをより小さくない画素を補正対象画素として選択し、その補正対象画素の距離を、検索ブロック内で評価値が最小の画素の距離に置き換えることで補正するようにした場合には、検出された対応点が真の対応点である確実性が低い画素の距離が、その画素の近傍の画素であって、検出された対応点が真の対応点である確実性が最も高いものの距離に置き換えられるので、エリアベースマッチングによる対応点の検出の確実性を保ちつつ、図8で説明したような前景と背景の境界部分、即ち、エッジ部分で生じる対応点の誤検出に起因する距離への影響を低減し、比較的正確な距離を得ることができる。
【0097】
なお、距離画像を構成する画素を、補正対象画素とするか否かの判定に用いる評価値の閾値εは、例えば、実験等により最適な値に設定する。あるいは、また、閾値εは、フレームメモリ5に記憶された基準カメラ画像および検出カメラ画像の画素値から、適応的に設定するようにすることも可能である。
【0098】
次に、上述のように、評価値が所定の閾値εより小さくない画素を補正対象画素として選択し、その補正対象画素の距離を、検索ブロック内で評価値が最小の画素(最尤画素)の距離に置き換える場合には、評価値にそれほど大きな差がないのに、その最尤画素を含んで構成される検索ブロックの中心に位置する画素の距離が、その最尤画素の距離に置き換えられることがある。従って、例えば、あるひとかたまりの画素それぞれの評価値が、いずれも、閾値εより幾分大きく、かつ、そのひとかたまりの画素の周辺に、評価値が閾値εより幾分小さい画素が存在すると、そのひとかたまりの画素それぞれの距離が、その周辺にある評価値の小さな画素の距離に置き換えられる。この場合、そのひとかたまりの画素それぞれの距離が、同一の距離とされるため、距離画像に、ブロック状の歪みが生じる。
【0099】
即ち、図13に示すように、例えば、円柱などの、距離(奥行き)が連続して変化する対象物3について得られた距離画像に対して、図12で説明した補正処理を施した場合には、円柱の側面のある点を投影した点が補正対象画素とされ、その補正対象画素とされた画素の距離と最尤画素の距離とが連続して変化していても(その2つの距離の間に大きな差はないが、幾分かの差がある)、その補正対象画素の距離が、それを中心とする検索ブロック内の最尤画素の距離に置換されることがある。この場合、補正対象画素とされた画素の距離と、最尤画素の距離とが同一となるため、円柱の側面における距離の滑らかな変化(距離の連続性)が失われる。
【0100】
そこで、補正処理は、ある画素の距離と、その画素を中心とする検索ブロック内の最尤画素との距離との差が、ある程度大きい場合に、その画素を補正対象画素として行うようにすることができる。この場合、ある画素の距離と、その画素を中心とする検索ブロック内の最尤画素との距離との差が小さいときには、その画素は補正対象画素とされなくなり、その結果、例えば、上述したような円柱の側面などにおける距離の連続性が失われることを防止し、エッジ部分で生じる対応点の誤検出に起因する距離への影響のみを低減することが可能となる。
【0101】
即ち、図14は、図10の演算処理回路6に、そのような補正処理を行わせる場合のフローチャートを示している。
【0102】
この場合、まず最初に、ステップS41において、距離画像(および基準カメラ画像)を構成する画素を表す変数iが、例えば、1に初期化され、ステップS43に進む。ステップS43では、図12のステップS23における場合と同様に、画素iを中心とする検索ブロックW内の画素を表す変数jが、例えば、その検索ブロックW内の最も左上の画素を表す値j0に初期化され、検索ブロックW内の画素の最小の評価値を保持する変数Sminが、例えば、画素j0の評価値S(j0)に初期化されるとともに、距離を保持する変数Zが、例えば、画素j0についての距離Z(j0)に初期化される。
【0103】
そして、ステップS44に進み、以下、ステップS44乃至47において、図12のステップS24乃至S27それぞれにおける場合と同様の処理が行われることで、変数Sminには、検索ブロックW内の画素の評価値のうちの最小値、即ち、最尤画素の評価値がセットされ、変数Zには、その最尤画素についての距離がセットされる。
【0104】
変数Sminに、最尤画素の評価値がセットされるとともに、変数Zに、その最尤画素についての距離がセットされると、ステップS46からステップS48に進み、補正対象画素選択部13において、距離画像記憶部12から、画素iの距離Z(i)が読み出され、その距離Z(i)と変数Zとの差の絶対値(=|Z(i)−Z|)が、所定の閾値Thより小さいかどうかが判定される。
【0105】
ステップS48において、画素iの距離Z(i)と変数Zとの差の絶対値が、閾値Thより小さくないと判定された場合、即ち、画素iの距離Z(i)と、その画素iを中心とする検索ブロックW内の最尤画素との距離Zとの差が、ある程度大きい場合、補正対象画素選択部13は、画素iを補正対象画素として選択し、その旨を、補正部14に知らせる。補正部14は、補正対象画素選択部13から、画素iが補正対象画素であるとの知らせを受けると、ステップS49に進み、距離画像記憶部12に記憶された画素iについての距離Z(i)を、最尤画素の距離Zに置き換えることで補正し、即ち、距離画像記憶部15に、画素iの距離として、最尤画素の距離Zを書き込み、ステップS50に進む。
【0106】
また、ステップS48において、画素iの距離Z(i)と変数Zとの差の絶対値が、閾値Thより小さいと判定された場合、補正対象画素選択部13は、画素iを補正対象画素として選択しないで、ステップS52に進む。ステップS52では、補正部14は、画素iの距離Z(i)を距離画像記憶部12から読み出して、距離画像記憶部15に供給して記憶させ、ステップS50に進む。従って、この場合、ステレオ処理で求められた、画素iについての距離Z(i)の補正は行われない。
【0107】
ステップS50では、図12のステップS29における場合と同様に、画素iが、距離画像を構成する最後の画素Iに等しいかどうかが判定され、等しくないと判定された場合、ステップS51に進み、変数iが1だけインクリメントされ、ステップS43に戻る。そして、次に処理すべき画素iを対象に、以下、同様の処理が繰り返される。
【0108】
また、ステップS50において、画素iが、距離画像を構成する最後の画素Iに等しいと判定された場合、補正処理を終了する。
【0109】
なお、距離画像を構成する画素を、補正対象画素とするか否かの判定に用いる距離の閾値Thは、例えば、実験等により最適な値に設定し、あるいは、距離画像記憶部5に記憶された距離画像の画素の画素値としての距離から、適応的に設定することが可能である。
【0110】
また、図14の実施の形態では、ある画素iの距離Z(i)と、その画素iを中心とする検索ブロックW内の最尤画素との距離との差が、閾値Th以上の場合にのみ、その画素iを補正対象画素として選択するようにしたが、ある画素iの距離Z(i)と、その画素iを中心とする検索ブロックW内の最尤画素との距離との差が、閾値Th以上であり、かつ画素iの評価値S(i)が閾値ε以上の場合に、その画素iを補正対象画素として選択することも可能である。この場合の補正処理は、図15のフローチャートに示すようになる。即ち、そのような補正対象画素の選択は、図14のステップS41の処理後に、図12のステップS22と同様に、画素iの評価値S(i)が、閾値εよりも小さいかどうかを判定するステップS42を設け、画素iの評価値S(i)が、閾値εよりも小さくない場合には、ステップS43に進み、小さい場合には、ステップS52に進むようにすれば良い。
【0111】
次に、図14の実施の形態では、ある画素iを中心とする検索ブロックWを構成する画素の評価値どうしを比較し、検索ブロックWの中で、最小の評価値を有する画素(最尤画素)を見つけてから(ステップS44乃至S47)、距離の差を考慮して、画素iを、補正対象画素として選択するかどうかを判定するようにしたが(ステップS48)、その他、例えば、距離の差を考慮して、検索ブロックの中で、最尤画素となり得る画素を、あらかじめ選択し、その選択された画素についてだけ、評価値どうしの比較を行うようにすることが可能である。
【0112】
さらに、図14の実施の形態では、画素iの距離Z(i)と、その画素iを中心とする検索ブロックWの中の最尤画素の距離Zとの差(の絶対値)に基づいて、画素iを、補正対象画素として選択するかどうかを判定するようにしたが(ステップS48)、その他、例えば、画素iの、基準カメラ画像における輝度や色情報(例えば、彩度や色相など)などの画素値にも基づいて、画素iを、補正対象画素として選択するかどうかを判定するようにすることが可能である。
【0113】
即ち、図16は、図10の演算処理回路6に、そのような補正処理を行わせる場合のフローチャートを示している。
【0114】
この場合、まず最初に、ステップS61において、距離画像(および基準カメラ画像)を構成する画素を表す変数iが、例えば、1に初期化され、ステップS62に進む。ステップS62では、補正対象画素選択部13において、画素iの基準カメラ画像上の画素値としての、例えば、輝度Y(i)が、フレームメモリ5から、図10において点線で示すように読み出される。さらに、補正対象画素選択部13は、ステップS52において、距離画像記憶部12から、画素iの距離Z(i)を読み出し、ステップS63に進む。
【0115】
ステップS63では、補正対象画素選択部13において、図12のステップS23における場合と同様に、画素iを中心とする検索ブロックW内の画素を表す変数jが、例えば、その検索ブロックW内の最も左上の画素を表す値j0に初期化される。さらに、補正対象画素選択部13は、ステップS63において、変数SminまたはZを、評価値または距離としてそれぞれ取り得ない値である、例えば、−1に初期化し、ステップS64に進む。
【0116】
ステップS64では、補正対象画素選択部13において、画素jの、基準カメラ画像上の輝度Y(j)が、フレームメモリ5から読み出されるとともに、その距離Z(j)が、距離画像記憶部12から読み出される。さらに、ステップS64では、補正対象画素記憶部13において、画素iの輝度Y(i)と、画素jの輝度Y(j)との差の絶対値(=|Y(i)−Y(j)|)が、所定の閾値ThYより小さく、かつ画素iの距離Z(i)と、画素jの距離Z(j)との差の絶対値(=|Z(i)−Z|)が、所定の閾値ThZより大きいかどうかが判定される。
【0117】
ここで、閾値ThYは、例えば、実験等により最適な値に設定し、あるいは、フレームメモリ5に記憶された基準カメラ画像および検出カメラ画像の画素値から、適応的に設定することが可能である。また、閾値ThZは、図14で説明した閾値Thと同様に設定することが可能である。
【0118】
ステップS64において、画素iの輝度Y(i)と、画素jの輝度Y(j)との差の絶対値が、所定の閾値ThYより小さくないか、または画素iの距離Z(i)と、画素jの距離Z(j)との差の絶対値が、所定の閾値ThZより大きいくないと判定された場合、ステップS65乃至S68をスキップして、ステップS69に進む。
【0119】
また、ステップS64において、画素iの輝度Y(i)と、画素jの輝度Y(j)との差の絶対値が、所定の閾値ThYより小さく、かつ画素iの距離Z(i)と、画素jの距離Z(j)との差の絶対値が、所定の閾値ThZより大きいと判定された場合、ステップS65に進み、補正対象画素選択部13において、変数Smin(またはZ)が、初期値である−1に等しいかどうかが判定される。
【0120】
ステップS65において、変数Sminが−1に等しいと判定された場合、ステップS66に進み、補正対象画素選択部13は、画素jについての評価値S(j)を、距離画像記憶部12から読み出し、変数Sminにセットするとともに、画素jの距離Z(j)を、変数Zにセットし、ステップS69に進む。
【0121】
また、ステップS65において、変数Sminが−1に等しくないと判定された場合、ステップS67に進み、補正対象画素選択部13において、変数Sminが、画素jについての評価値S(j)より小さいかどうかが判定される。ステップS67において、変数Sminが、評価値S(j)より小さいと判定された場合、ステップS68に進み、補正対象画素選択部13は、変数Sminに、画素jについての評価値S(j)をセットするとともに、変数Zに、画素jの距離Z(j)をセットし、ステップS69に進む。
【0122】
また、ステップS67において、変数Sminが、評価値S(j)より小さくないと判定された場合、ステップS68をスキップして、ステップS69に進み、図12のステップS26における場合と同様に、画素jが、検索ブロックW内の最後の画素であるかどうかが判定される。ステップS69において、画素jが、検索ブロックW内の最後の画素でないと判定された場合、ステップS70に進み、図12のステップS27における場合と同様に、変数jに、検索ブロックW内の画素の中で、まだ、評価値が、変数Sminと比較されていないものを表す値がセットされ、ステップS64に戻る。そして、ステップS69において、画素jが、検索ブロックW内の最後の画素であると判定されるまで、ステップS64乃至S70の処理が繰り返される。
【0123】
即ち、これにより、検索ブロックW内に、その中心に位置する画素iの輝度Y(i)との差が、閾値ThY未満の輝度を有し、かつ画素iの距離Z(i)との差が、閾値ThZより大きい画素jが存在すれば、その画素jが、画素iの距離Z(i)の補正に用いるのに適切な画素(以下、適宜、適切画素という)として選択される。そして、検索ブロックWの中の適切画素のうち、評価値が最も小さいものが、最尤画素として選択され、その最尤画素の評価値または距離が、変数SminまたはZに、それぞれセットされる。
【0124】
そして、ステップS69において、画素jが、検索ブロックW内の最後の画素であると判定されると、ステップS71に進み、補正対象画素選択部13は、変数Smin(またはZ)が、初期値である−1に等しいかどうかを判定する。ステップS71において、変数Sminが−1に等しくないと判定された場合、即ち、変数minに、検索ブロックW内のいずれかの画素(最尤画素)についての評価値がセットされている場合、補正対象画素選択部13は、画素iを、補正対象画素として選択し、補正部14に知らせ、ステップS72に進む。
【0125】
補正部14は、補正対象画素選択部13から、画素iが補正対象画素であるとの知らせを受けると、ステップS72において、距離画像記憶部12に記憶された画素iについての距離Z(i)を、最尤画素の距離(変数)Zに置き換えることで補正し、即ち、距離画像記憶部15に、画素iの距離として、最尤画素の距離Zを書き込み、ステップS73に進む。
【0126】
また、ステップS71において、変数Sminが−1に等しいと判定された場合、即ち、検索ブロックW内に、その中心に位置する画素iの輝度Y(i)との差が、閾値ThY未満の輝度を有し、かつ画素iの距離Z(i)との差が、閾値ThZより大きい画素jが存在しない場合、つまり、適切画素が存在しない場合、ステップS75に進み、補正部14は、画素iの距離Z(i)を距離画像記憶部12から読み出して、距離画像記憶部15に供給して記憶させ、ステップS73に進む。従って、この場合、画素iは補正対象画素として選択されず、その結果、その距離Z(i)は補正されない。
【0127】
ステップS73では、図11のステップS11における場合と同様に、画素iが、距離画像を構成する最後の画素Iに等しいかどうかが判定され、等しくないと判定された場合、ステップS74に進み、変数iが1だけインクリメントされ、ステップS62に戻る。そして、次に処理すべき画素iを対象に、以下、同様の処理が繰り返される。
【0128】
また、ステップS73において、画素iが、距離画像を構成する最後の画素Iに等しいと判定された場合、補正処理を終了する。
【0129】
従って、図16の実施の形態によれば、検索ブロックW内に、その中心に位置する画素iの輝度Y(i)との差が、閾値ThY未満の輝度を有し、かつ画素iの距離Z(i)との差が、閾値ThZより大きい適切画素が存在すれば、画素iが補正対象画素として選択される。そして、適切画素の中で、評価値が最も小さい画素が最尤画素として選択され、その最尤画素の距離への置換が行われることで、補正対象画素iの距離Z(i)が補正される。
【0130】
次に、図17は、補正処理の他の実施の形態を示すフローチャートであり、この補正処理によっても、図16のフローチャートに示した場合と同様の補正処理を行うことができる。
【0131】
即ち、この場合、まず最初に、ステップS81において、距離画像(および基準カメラ画像)を構成する画素を表す変数iが、例えば、1に初期化され、ステップS82に進む。ステップS82では、補正対象画素選択部13において、画素iの基準カメラ画像上の画素値としての、例えば、輝度Y(i)が、フレームメモリ5から、図10において点線で示すように読み出される。さらに、補正対象画素選択部13は、ステップS82において、距離画像記憶部12から、画素iの距離Z(i)を読み出し、ステップS83に進む。
【0132】
ステップS83では、補正対象画素選択部13において、図12のステップS23における場合と同様に、画素iを中心とする検索ブロックW内の画素を表す変数jが、例えば、その検索ブロックW内の最も左上の画素を表す値j0に初期化される。さらに、補正対象画素選択部13は、ステップS83において、変数SminまたはZを、画素iの評価値S(i)または距離Z(i)にそれぞれ初期化し、ステップS84に進む。
【0133】
ステップS84では、補正対象画素選択部13において、画素jの、基準カメラ画像上の輝度Y(j)が、フレームメモリ5から読み出されるとともに、その距離Z(j)が、距離画像記憶部12から読み出される。さらに、ステップS84では、補正対象画素記憶部13において、画素iの輝度Y(i)と、画素jの輝度Y(j)との差の絶対値(=|Y(i)−Y(j)|)が、所定の閾値ThYより小さく、かつ画素iの距離Z(i)と、画素jの距離Z(j)との差の絶対値(=|Z(i)−Z|)が、所定の閾値ThZより大きいかどうかが判定される。
【0134】
ステップS84において、画素iの輝度Y(i)と、画素jの輝度Y(j)との差の絶対値が、所定の閾値ThYより小さくないか、または画素iの距離Z(i)と、画素jの距離Z(j)との差の絶対値が、所定の閾値ThZより大きいくないと判定された場合、ステップS85および86をスキップして、ステップS87に進む。
【0135】
また、ステップS84において、画素iの輝度Y(i)と、画素jの輝度Y(j)との差の絶対値が、所定の閾値ThYより小さく、かつ画素iの距離Z(i)と、画素jの距離Z(j)との差の絶対値が、所定の閾値ThZより大きいと判定された場合、ステップS85に進み、補正対象画素選択部13において、変数Sminが、画素jについての評価値S(j)より小さいかどうかが判定される。ステップS85において、変数Sminが、評価値S(j)より小さいと判定された場合、ステップS86に進み、補正対象画素選択部13は、変数Sminに、画素jについての評価値S(j)をセットするとともに、変数Zに、画素jの距離Z(j)をセットし、ステップS87に進む。
【0136】
また、ステップS85において、変数Sminが、評価値S(j)より小さくないと判定された場合、ステップS86をスキップして、ステップS87に進み、図12のステップS26における場合と同様に、画素jが、検索ブロックW内の最後の画素であるかどうかが判定される。ステップS87において、画素jが、検索ブロックW内の最後の画素でないと判定された場合、ステップS88に進み、図12のステップS27における場合と同様に、変数jに、検索ブロックW内の画素の中で、まだ、評価値が、変数Sminと比較されていないものを表す値がセットされ、ステップS84に戻る。そして、ステップS87において、画素jが、検索ブロックW内の最後の画素であると判定されるまで、ステップS84乃至S88の処理が繰り返される。
【0137】
即ち、これにより、検索ブロックWの中から適切画素が選択され、その適切画素のうち、評価値が最も小さいものが、最尤画素として選択され、その最尤画素の評価値または距離が、変数SminまたはZに、それぞれセットされる。なお、検索ブロックWの中に適切画素が存在しない場合には、変数SminまたはZそれぞれは、ステップS83でセットされた画素iの評価値S(i)または距離Z(i)がセットされたままの状態になっている。
【0138】
そして、ステップS87において、画素jが、検索ブロックW内の最後の画素であると判定されると、ステップS89に進み、補正部14は、距離画像記憶部12に記憶された画素iについての距離Z(i)を、変数Zに置き換えることで補正し、即ち、変数Zを、画素iの距離として、距離画像記憶部15に供給して記憶させ、ステップS90に進む。
【0139】
ここで、上述したように、検索ブロックWの中に適切画素が存在する場合には、そのうちの評価値が最小のものが最尤画素として選択され、その距離が変数Zにセットされるから、その場合の検索ブロックWの中心にある画素iの距離Z(i)が、変数Zに置き換えられるということは、実質的に、画素iが補正対象画素として選択され、その距離Z(i)の補正が行われたことになる。一方、検索ブロックWの中に適切画素が存在しない場合には、変数Zには、画素iの距離Z(i)がセットされた状態となっているから、その場合の検索ブロックWの中心にある画素iの距離Z(i)が、変数Zに置き換えられるということは、実質的に、何らの補正も行われていないのと等価であり、従って、画素iは、補正対象画素として選択されていないことになる。
【0140】
ステップS90では、図11のステップS11における場合と同様に、画素iが、距離画像を構成する最後の画素Iに等しいかどうかが判定され、等しくないと判定された場合、ステップS91に進み、変数iが1だけインクリメントされ、ステップS82に戻る。そして、次に処理すべき画素iを対象に、以下、同様の処理が繰り返される。
【0141】
また、ステップS90において、画素iが、距離画像を構成する最後の画素Iに等しいと判定された場合、補正処理を終了する。
【0142】
以上のように、画素iの距離Z(i)との差だけでなく、その基準カメラ画像上の画素値との差に基づいて、画素iを補正対象画素とするかどうかの選択を行い、さらに、画素値の差が小さい画素である適切画素から、最尤画素を選択し、画素iの距離を、最終画素の距離で補正することにより、画素iについて、誤った補正が行われるのを防止することが可能となる。
【0143】
即ち、基準カメラ画像および検出カメラ画像として、例えば、前景の輝度が低く、かつ背景の輝度が高い画像(前景が暗く、背景が明るい画像)が得られた場合においても、上述したように、エッジ部分では、背景を構成するある画素iについて、対応点が誤検出され、これにより、その距離として、前景の距離が誤って求められることがある。
【0144】
画素iを中心とする検索ブロックを構成する画素の中では、一般に、背景の画素のみで基準ブロックが構成されるものについての評価値の方が、前景および背景の両方の画素で基準ブロックが構成されるものについての評価値より小さくなるので、図12で説明したように、そのような小さい評価値が得られる背景の画素の距離で、画素iの距離を置換することにより、画素iの距離は、誤った前景の距離から、正しい背景の距離に補正されることになる。
【0145】
しかしながら、前景の輝度が低く、かつ背景の輝度が高い場合には、上述の場合とは逆に、前景および背景の両方の画素で基準ブロックが構成される画素についての評価値の方が、背景の画素のみで基準ブロックが構成される画素についての評価値より小さくなることがある。従って、そのような小さな評価値が得られる画素が、前景の画素である場合には、図12で説明したように、小さい評価値が得られる前景の画素の距離で、画素iの距離を置換すると、画素iの距離は、誤った前景の距離から、やはり、誤った前景の距離に補正されることになる。
【0146】
そこで、図16や図17で説明したように、検索ブロック内に、その中心に位置する画素iの輝度との差が、閾値ThY未満の輝度を有する画素である適切画素が存在する場合には、画素iを補正対象画素として選択するとともに、その適切画素のうちの評価値が最小のものの距離で、補正対象画素iの距離を置換することで、前景の輝度が低く、かつ背景の輝度が高いときであっても、画素iについて、誤って求められた前景の距離を、正しい背景の距離に置換することができる。
【0147】
即ち、適切画素は、画素iとの輝度が近いものであり、従って、検索ブロックの中で、適切画素は、画素iと同一の背景を構成している可能性が高く、それ以外の画素は、前景を構成している可能性が高い。従って、前景を構成している可能性が高い画素を無視し、背景を構成している可能性が高い適切画素だけを対象に、その中から、評価値の最も小さいものを最尤画素として選択し、その最尤画素の距離で、補正対象画素iの距離を置換することで、画素iについては、誤って求められた前景の距離が、正しい背景の距離に補正されることになり、これにより、誤った補正が行われるのを防止することが可能となる。
【0148】
なお、補正処理は、ステレオ処理によって求められた距離画像に対して、ノイズ除去または穴埋め等を行った後に行うのが望ましい。これは、基準カメラ画像や検出カメラ画像が、輝度の変化が少ないものである場合には、ステレオ処理において、対応点の誤検出が生じやすくなる一方で、各画素について求められる最終的な評価値は小さくなることが多いため、そのようなステレオ処理の結果得られる距離画像をそのまま用いて補正処理を行うと、ノイズが広がるような悪影響を生じることがあるからである。
【0149】
ここで、距離画像に対して、ノイズ除去または穴埋めを施す方法としては、例えば、距離の値が近い隣接する画素の集合を、1単位として、その1単位の面積が小さい部分をノイズと判定し、そのノイズと判定された画素の集合のうち、ノイズでない画素に隣接している画素にメディアンフィルタをかけて補正し、ノイズの部分を徐々に狭くして、最終的にはなくすようなものがある。なお、この方法の詳細については、例えば、本件出願人が先に出願した特願平9−288479号に記載されている。
【0150】
以上、本発明を、距離を測定する距離測定装置に適用した場合について説明したが、本発明は、上述したように、視差を測定する場合、その視差から、さらに距離を求める場合、対象物の3次元形状を解析する場合等にも適用可能である。ここで、視差から距離を求める場合には、視差に対して補正処理を施した後に距離を求めても、また、視差から距離を求め、その距離に対して補正処理を施しても、同様の効果を得ることができる。
【0151】
なお、本実施の形態では、ステレオ処理の終了後に、補正処理を行うようにしたが、補正処理が可能となるまでステレオ処理を行い、その後は、ステレオ処理と補正処理とを並列に行うようにすることが可能である。
【0152】
また、本実施の形態では、検索ブロックからの最尤画素の検出を、その検索ブロックを構成するすべての画素を対象に行うようにしたが、最尤画素の検出は、その他、例えば、検索ブロックの外周に位置する画素のみを対象としたり、検索ブロックを構成する画素のうちの1つおきの画素のみを対象とすることなどが可能である。この場合、最尤画素の検出を、高速に行うことが可能となる。
【0153】
さらに、本実施の形態では、演算処理回路6に、コンピュータプログラムを実行させることにより、ステレオ処理および補正処理を行わせるようにしたが、ステレオ処理および補正処理は、それ専用のハードウェアによって行うことも可能である。
【0154】
また、本実施の形態では、ステレオ処理および補正処理を行うためのアプリケーションプログラムを、記憶装置7に記憶させて提供するようにしたが、このようなアプリケーションプログラムは、例えば、インターネットその他の伝送媒体を介して伝送して提供することも可能である。
【0155】
さらに、本実施の形態では、基準ブロック、検出ブロック、および検索ブロックとして、長方形状のブロックを構成するようにしたが、基準ブロック、検出ブロック、および検索ブロックは、長方形状のブロックに限定されるものではなく、例えば、ある画素から一定距離内にある画素でなる円形状のブロックを、基準ブロックや、検出ブロック、検索ブロックとして採用することも可能である。また、基準ブロック、検出ブロック、および検索ブロックは、隣接している画素で構成する必要はなく、例えば、1画素おきの画素の集合などで構成することも可能である。
【0156】
さらに、本実施の形態では、基準カメラとして機能する1台のカメラ1と、検出カメラとして機能する1台のカメラ2を用いるようにしたが、検出カメラは、複数台用いるようにすることが可能である。また、カメラは1台だけ用意し、それを移動させることにより、その1台のカメラを、基準カメラおよび検出カメラの両方として使用することも可能である。
【0157】
また、本実施の形態では、ステレオ処理および補正処理により得られた距離画像を、出力装置8に表示し、あるいは、記憶装置7に記憶させるようにしたが、その他、距離画像は、例えば、インターネット等の伝送媒体を介して伝送して他の装置等に提供するようにすることが可能である。
【0158】
さらに、本実施の形態では、補正対象画素の距離を、1の最尤画素の距離に置換することによって補正を行うようにしたが、補正対象画素の距離は、その他、例えば、評価値の小さい順に、複数の最尤画素を選択し、その複数の最尤画素の距離の平均値などに基づいて補正したり、また、その複数の最尤画素の距離を用いて補間を行うことにより補正することなどが可能である。
【0159】
また、本実施の形態では、補正後の距離画像を、距離画像記憶部12とは別の距離画像記憶部15に記憶させるようにしたが、補正後の距離画像は、補正前の距離画像が記憶されている距離画像記憶部12に、いわば上書きする形で記憶させるようにすることも可能である。
【0160】
さらに、本実施の形態では、ステレオ処理後の距離画像に対して、1度だけ補正処理を施すようにしたが、補正処理は、補正処理を施した距離画像に対して、さらに施すようにすることも可能である。
【0161】
【発明の効果】
請求項1に記載の画像処理装置および請求項9に記載の画像処理方法、並びに請求項10に記載の記録媒体によれば、第1の画像の画素と対応する、第2の画像の対応画素が検出され、その対応画素に基づき、第1の画像の画素について、距離関係情報が求められる。さらに、求められた距離関係情報を画素値とする距離関係情報画像の画素のうち、対応画素として検出された画素が真の対応点である確実性が一定以下の画素が、距離関係情報の補正を行う対象とする補正対象画素として選択され、距離関係画像のうち、選択された補正対象画素を含む所定の領域を検索ブロックとして、検索ブロック内の複数の画素の中から、確実性が所定の条件を満たす画素が検索され、補正対象画素についての距離関係情報を、検索された画素についての距離関係情報に置換することにより、補正対象画素についての距離関係情報が補正される。従って、第1および第2の画像どうしでの画素の対応付けを正確に行うことができなかった場合であっても、精度の高い距離関係情報を得ることが可能となる。
【図面の簡単な説明】
【図1】本発明を適用した距離測定装置の一実施の形態の構成例を示すブロック図である。
【図2】基準カメラ1および検出カメラ1で、対象物3を撮影している状態を示す図である。
【図3】エピポーララインを説明するための図である。
【図4】基準カメラ画像および検出カメラ画像を示す図である。
【図5】評価値の推移を示す図である。
【図6】設定点/距離テーブルおよび視差/距離テーブルを示す図である。
【図7】壁の手前に配置された対象物3を撮影している状態を示す図である。
【図8】エッジ部分で生じる対応点の誤検出を説明するための図である。
【図9】対応点の誤検出に起因する距離の誤りの補正方法を説明するための図である。
【図10】図1の演算処理回路6の機能的構成例を示すブロック図である。
【図11】ステレオ処理を説明するためのフローチャートである。
【図12】補正処理の第1の実施の形態を説明するためのフローチャートである。
【図13】距離の連続性が失われる場合を説明するための図である。
【図14】補正処理の第2の実施の形態を説明するためのフローチャートである。
【図15】補正処理の第3の実施の形態を説明するためのフローチャートである。
【図16】補正処理の第4の実施の形態を説明するためのフローチャートである。
【図17】補正処理の第5の実施の形態を説明するためのフローチャートである。
【符号の説明】
1 基準カメラ(撮像手段), 2 検出カメラ(撮像手段), 3 対象物, 4 カメラインターフェイス, 5 フレームメモリ, 6 演算処理回路, 6A CPU, 6B ROM, 6C RAM, 6D DSP, 7 記憶装置, 8 出力装置, 11 ステレオ処理部(検出手段)(処理手段), 12 距離画像記憶部, 13 補正対象画素選択部(選択手段), 14補正部(補正手段), 15 距離画像記憶部[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image processing apparatus and an image processing method, and recoding media In particular, for example, pixels of a plurality of images obtained by photographing a predetermined object with a plurality of cameras are associated with each other, and the parallax with respect to the object, the distance to the object, and the like are set for each pixel. What is called image processing apparatus and image processing method for performing so-called stereo image processing, and recoding media About.
[0002]
[Prior art]
For example, the document “A Video-rate Stereomachine (A Video-rate Stereomachine; Kanade), Kimura,“ Journal of the Robotics Society of Japan (JRSJ) ”vol.13 No. 3, pp. 322 to 326, 1995), etc., between two or more images obtained by photographing the same object from two or more locations or by photographing with two or more cameras. Thus, so-called stereo image processing is disclosed in which parallax information (parallax) between pixels corresponding to each other is obtained, the distance between each point on the object is obtained, and further, the shape of the object is measured.
[0003]
[Problems to be solved by the invention]
However, in the conventional stereo image processing, depending on the positional relationship between the background and the object, pixel correspondence between a plurality of images is inaccurate in the vicinity of the contour of the object. The distance to the object or its shape may not be measured correctly.
[0004]
The present invention has been made in view of such a situation, and even when it is not possible to accurately associate pixels between a plurality of images, relatively accurate parallax information and distances can be obtained. Etc. can be obtained.
[0005]
[Means for Solving the Problems]
The image processing apparatus according to claim 1, detecting means for detecting a corresponding pixel of the second image corresponding to the pixel of the first image; Detected by detection means Processing means for obtaining distance relationship information for the pixels of the first image based on the corresponding pixels; Determined by the processing means Pixel of distance relation information image having distance relation information as pixel value Among these, a pixel having a certainty or less certainity that a pixel detected as a corresponding pixel by the detecting means is a true corresponding point, Correction target pixel for correcting distance-related information As A selection means to select; Among the distance-related images, a predetermined area including the correction target pixel selected by the selection unit is used as a search block, and a pixel whose certainty satisfies a predetermined condition is searched from a plurality of pixels in the search block. The distance relationship information about the correction target pixel By substituting the distance relation information about the searched pixel, the distance relation information about the correction target pixel is changed. Correction means for correcting Ru .
[0006]
Claim 9 The image processing method described in the step of detecting a corresponding pixel of the second image corresponding to the pixel of the first image; Detected by the detection step process A processing step for obtaining distance relationship information for the pixels of the first image based on the corresponding pixels; Determined by processing step Pixel of distance relation information image having distance relation information as pixel value Among the pixels, the certainty of the certainty that the pixel detected as the corresponding pixel by the processing of the detection step is a true corresponding point is less than a certain value, Correction target pixel for correcting distance-related information As A selection step to select; Among the distance-related images, a predetermined area including the correction target pixel selected by the processing of the selection step is used as a search block, and a pixel satisfying a predetermined condition is searched from a plurality of pixels in the search block. , The distance relationship information about the correction target pixel By substituting the distance relation information about the searched pixel, the distance relation information about the correction target pixel is changed. Correction steps to correct including .
[0007]
Claim 10 The recording medium according to claim 1, wherein a detection step of detecting a corresponding pixel of the second image corresponding to a pixel of the first image; Detected by the detection step process A processing step for obtaining distance relationship information for the pixels of the first image based on the corresponding pixels; Determined by processing step Pixel of distance relation information image having distance relation information as pixel value Among the pixels, the certainty of the certainty that the pixel detected as the corresponding pixel by the processing of the detection step is a true corresponding point is less than a certain value, Correction target pixel for correcting distance-related information As A selection step to select; Among the distance-related images, a predetermined area including the correction target pixel selected by the processing of the selection step is used as a search block, and a pixel satisfying a predetermined condition is searched from a plurality of pixels in the search block. , The distance relationship information about the correction target pixel By substituting the distance relation information about the searched pixel, the distance relation information about the correction target pixel is changed. Correction steps to correct Including The program is recorded.
[0009]
In the image processing apparatus according to claim 1, the detection unit detects a corresponding pixel of the second image corresponding to the pixel of the first image, and the processing unit includes: Detected by detection means Based on the corresponding pixels, distance relationship information is obtained for the pixels of the first image. The selection means is Determined by the processing means Pixel of distance relation information image having distance relation information as pixel value Among these, a pixel having a certainty or less certainity that a pixel detected as a corresponding pixel by the detecting means is a true corresponding point, Correction target pixel for correcting distance-related information As Select and corrector means Among the distance-related images, a predetermined area including the correction target pixel selected by the selection unit is used as a search block, and a pixel whose certainty satisfies a predetermined condition is searched from a plurality of pixels in the search block. The distance relationship information about the correction target pixel By substituting the distance relation information about the searched pixel, the distance relation information about the correction target pixel is changed. It is made to correct.
[0010]
Claim 9 In the image processing method described in the above, a corresponding pixel of the second image corresponding to the pixel of the first image is detected, was detected Based on the corresponding pixels, distance relationship information is obtained for the pixels of the first image. I was asked Pixel of distance relation information image having distance relation information as pixel value Among these, pixels whose certainty is less than a certain degree that the pixels detected as corresponding pixels are true corresponding points, Correction target pixel for correcting distance-related information As Selected, Among the distance-related images, a predetermined area including the selected correction target pixel is used as a search block, and a plurality of pixels in the search block are searched for pixels that satisfy certain conditions, The distance relationship information about the correction target pixel By substituting the distance relation information about the searched pixel, the distance relation information about the correction target pixel is changed. It is made to correct.
[0011]
Claim 10 In the program recorded on the recording medium described in the above, the corresponding pixel of the second image corresponding to the pixel of the first image is detected, was detected Based on the corresponding pixels, distance relationship information is obtained for the pixels of the first image. I was asked Pixel of distance relation information image having distance relation information as pixel value Among these, pixels whose certainty is less than a certain degree that the pixels detected as corresponding pixels are true corresponding points, Correction target pixel for correcting distance-related information As Selected, Among the distance-related images, a predetermined area including the selected correction target pixel is used as a search block, and a plurality of pixels in the search block are searched for pixels that satisfy certain conditions, The distance relationship information about the correction target pixel By substituting the distance relation information about the searched pixel, the distance relation information about the correction target pixel is changed. It is made to correct.
[0013]
DETAILED DESCRIPTION OF THE INVENTION
FIG. 1 shows a configuration example of an embodiment of a distance measuring device to which the present invention is applied.
[0014]
Cameras 1 and 2 (imaging means) are, for example, CCD (Charge Coupled Device) video cameras fixed at different positions, photograph the object 3 from the different positions (different line-of-sight directions), and obtain the resulting images. And output to the camera interface 4. Here, the camera 1 or 2 functions as a so-called reference camera or detection camera, respectively. Therefore, hereinafter, the camera 1 or 2 will be referred to as the reference camera 1 or the detection camera 2, respectively, and the image output from each will be referred to as the reference camera image (first image) or the detection camera image (second image). .
[0015]
The camera interface 4 receives a reference camera image or a detected camera image from the reference camera 1 or the detection camera 2 and supplies it to the frame memory 5. The frame memory 5 stores the reference camera image and the detected camera image from the camera interface 4 in units of frames, for example.
[0016]
The arithmetic processing circuit 6 relates to, for example, the distance from the reference camera 1 to the object 3 of the reference camera 1 or the detection camera 2 based on the reference camera image and the detection camera image stored in the frame memory 5. The distance relation information is obtained, and an image having a pixel value corresponding to the distance relation information is generated.
[0017]
That is, the arithmetic processing circuit 6 takes the correspondence between the pixel of the reference camera image and the pixel of the detected camera image, obtains the distance to the object 3 for each pixel of the reference camera image, and sets the distance to the distance. An image having a corresponding pixel value (for example, an image having a luminance value that increases as the distance increases) (hereinafter, referred to as a distance image as appropriate) is generated. Alternatively, the arithmetic processing circuit 6 measures the parallax ζ between the corresponding pixels, and generates an image having a pixel value corresponding to the parallax ζ (hereinafter, referred to as a parallax image as appropriate). In the arithmetic processing circuit 6, it is possible to obtain a distance image from the parallax ζ, or to analyze the three-dimensional shape of the object 3 from the distance image.
[0018]
Specifically, the arithmetic processing circuit 6 includes a control CPU (Central Processing Unit) 6A, a ROM (Read Only Memory) 6B, a RAM (Random Access Memory) 6C, and a DSP (Digital Signal Processor) 6D for image processing. Etc. Then, the CPU 6A executes the application program stored in the storage device 7 to control each block constituting the distance measuring device, and performs stereo processing, correction processing, and the like, which will be described later, thereby performing distance processing. An image or the like is generated.
[0019]
The ROM 6B stores, for example, an IPL (Initial Program Loading) program and other necessary data. The RAM 6C temporarily stores programs executed by the CPU 6A, data necessary for the processing of the CPU 6A, and the like. The DSP 6D performs necessary product-sum operations and the like under the control of the CPU 6A.
[0020]
The storage device 7 includes, for example, an HD (Hard Disk), a CD-ROM (Compact Disc Read Only Memory), and the like, and an OS (Operating System) program executed by the arithmetic processing circuit 6 or the processing described above. An application program for performing the process is stored. The storage device 7 is also configured to store a distance image output from the arithmetic processing circuit 6. The output device 8 is composed of, for example, a CRT (Cathode Ray Tube) or a liquid crystal panel, and displays a distance image or the like output from the arithmetic processing circuit 6.
[0021]
In the distance measuring apparatus configured as described above, the object 3 is photographed by the reference camera 1 and the detection camera 2. Further, the reference camera image and the detected camera image obtained as a result are supplied to the frame memory 5 via the camera interface 4 and stored. The arithmetic processing circuit 6 performs stereo processing using the reference camera image and the detected camera image.
[0022]
Here, as described above, the stereo processing is performed by associating pixels between a plurality of images obtained by photographing the same object with two or more directions (different line-of-sight directions). Parallax information, the distance from the camera to the object, and the shape of the object.
[0023]
That is, for example, as shown in FIG. 2, when the object 3 is photographed by the two reference cameras 1 and the detection camera 2, a reference camera image including a projection image of the object 3 is obtained from the reference camera 1 and detected. A detection camera image including a projection image of the object 3 is also obtained from the camera 2. Now, if a certain point P on the object 3 in FIG. 2 is displayed in both the reference camera image and the detection camera image, the position on the reference camera image where the point P is displayed, and the detection camera The disparity information can be obtained from the position on the image, that is, the corresponding point (corresponding pixel), and further, the position of the point P in the three-dimensional space (three-dimensional position) can be obtained using the principle of triangulation. it can.
[0024]
Therefore, in stereo processing, it is first necessary to detect corresponding points. As a detection method, for example, there is an area-based matching method using an epipolar line.
[0025]
That is, as shown in FIG. 3, in the reference camera 1, the point P on the object 3 is the point P and the optical center (lens center) O of the reference camera 1. 1 The imaging surface S of the reference camera 1 on the straight line L connecting 1 Intersection n with a Projected on.
[0026]
Further, in the detection camera 2, the point P of the object 3 is the point P and the optical center (lens center) O of the detection camera 2. 2 The imaging surface S of the detection camera 2 on the straight line connecting 2 Intersection n with b Projected on.
[0027]
In this case, the straight line L is the optical center O. 1 And O 2 And point n a A plane passing through three points (or point P) and an imaging surface S on which a detection camera image is formed 2 Line of intersection L 2 As an imaging surface S 2 Projected on top. The point P is a point on the straight line L. Therefore, the imaging surface S 2 , The point n projected from the point P b Is a straight line L projected from the straight line L 2 This straight line L 2 Is called an epipolar line. That is, point n a Corresponding point n b May be present on the epipolar line L 2 And therefore corresponding point n b Search for epipolar line L 2 You can do the above.
[0028]
Here, the epipolar line is, for example, the imaging surface S. 1 However, if the positional relationship between the reference camera 1 and the detection camera 2 is known, an epipolar line existing for each pixel can be obtained.
[0029]
Epipolar line L 2 Corresponding point n from above b The detection can be performed by, for example, area-based matching as follows.
[0030]
That is, in area-based matching, as shown in FIG. a For example, a rectangular small block (hereinafter referred to as a reference block as appropriate) (first block) (first block) having the center at (for example, the intersection of diagonal lines) is extracted from the reference camera image and shown in FIG. As shown, the epipolar line L projected on the detected camera image 2 A small block having the same size as the reference block (hereinafter referred to as a detection block as appropriate) (second block) centered on a certain point is extracted from the detection camera image.
[0031]
Here, in the embodiment of FIG. 4B, the epipolar line L 2 Above, point n as the center of the detection block b1 Thru n b6 6 points are provided. These 6 points n b1 Thru n b6 Is a point at which the straight line L in the three-dimensional space shown in FIG. 3 is segmented at predetermined constant distances, that is, the distance from the reference camera 1 is 1 m, 2 m, 3 m, 4 m, 5 m, 6 m, for example. Respectively, the imaging surface S of the detection camera 2 2 Therefore, the distances from the reference camera 1 correspond to points of 1 m, 2 m, 3 m, 4 m, 5 m, and 6 m, respectively.
[0032]
In area-based matching, epipolar line L is detected from the detected camera image. 2 Point n provided above b1 Thru n b6 Detection blocks centered on each are extracted, and the correlation between each detection block and the reference block is calculated using a predetermined evaluation function. And point n a The center point n of the detection block having the highest correlation with the reference block centered on b Is the point n a It is calculated as a corresponding point.
[0033]
That is, for example, when a function having a smaller value as the correlation is higher is used as the evaluation function, the epipolar line L 2 Top point n b1 Thru n b6 For example, assume that an evaluation value (value of an evaluation function) as shown in FIG. 5 is obtained. In this case, the point n having the smallest evaluation value (highest correlation) b3 Is the point n a Are detected as corresponding points. In FIG. 5, the point n b1 Thru n b6 Interpolation is performed using a value near the minimum value among the evaluation values (indicated by ● in FIG. 5) obtained for each to obtain a point (indicated by x in FIG. 5) where the evaluation value becomes smaller. It is also possible to detect that point as the final corresponding point.
[0034]
In the embodiment of FIG. 4, as described above, the point on which the straight line L in the three-dimensional space is segmented at predetermined equal distances is defined as the imaging surface S of the detection camera 2. 2 The projected point is set, but this setting can be performed, for example, when the reference camera 1 and the detection camera 2 are calibrated. Then, such a setting is made with the imaging surface S of the reference camera 1. 1 For each epipolar line that exists for each pixel that constitutes, and as shown in FIG. 6A, a point set on the epipolar line (hereinafter referred to as a set point as appropriate), a distance from the reference camera 1, and If a set point / distance table for associating with each other is created in advance, the set point that becomes the corresponding point is detected, and the distance from the reference camera 1 (to the object 3) can be immediately detected by referring to the set point / distance table. Distance). In other words, the distance can be obtained directly from the corresponding points.
[0035]
On the other hand, the point n on the reference camera image a Corresponding point n on the detected camera image b If two points n are detected, a And n b Can be obtained. Further, if the positional relationship between the reference camera 1 and the detection camera 2 is known, two points n a And n b From the parallax between the two, the distance to the object 3 can be obtained by the principle of triangulation. The calculation of the distance from the parallax can be performed by performing a predetermined calculation. However, as shown in FIG. 6B, a parallax / distance table for associating the parallax ζ with the distance can be calculated. If prepared in advance, the distance from the reference camera 1 can be immediately obtained by detecting the corresponding point, obtaining the parallax, and referring to the parallax / distance table.
[0036]
Here, the parallax and the distance to the object 3 have a one-to-one correspondence. Therefore, obtaining the parallax and obtaining the distance to the object 3 are equivalent to each other.
[0037]
In addition, the use of a block composed of a plurality of pixels such as a reference block and a detection block for detection of corresponding points reduces the influence of noise, and pixels (points) n on the reference camera image a And the corresponding point (pixel) n on the detected camera image b This is for the purpose of ensuring the detection of corresponding points by clarifying and determining the correlation with the pattern characteristics of the surrounding pixels. Especially for the reference camera image and the detection camera image with little change, Due to the correlation of images, the larger the block size, the greater the certainty of detection of corresponding points.
[0038]
Next, in area-based matching, for example, as an evaluation function for evaluating the correlation between the reference block and the detection block, the pixels constituting the reference block and the pixels constituting the detection block corresponding to each pixel The sum of absolute values of the difference of values, the square sum of the differences, normalized cross correlation, etc. can be used.
[0039]
When the sum of absolute values of differences between the pixels constituting the reference block and the pixels constituting the detection block corresponding to each pixel is used as the evaluation function, the evaluation value (value of the evaluation function) is, for example, Can be calculated by the following equation.
[0040]
[Expression 1]
Figure 0004296617
... (1)
In Expression (1), x represents a pixel (a target pixel) on the reference image that is focused on to obtain a corresponding point, and thus represents a central pixel constituting the reference block. Further, y represents a central pixel constituting the detection block, and S (x, y) is a reference block centered on the pixel x on the reference camera image and a pixel y on the detection camera image. An evaluation value indicating the correlation with the detection block is represented. In addition, W A Or W B Represents a reference block or a detection block, respectively, and j W A , W B Therefore, x + j is the reference block W A Y + j represents a detection block W corresponding to the pixel x + j B Each of the pixels constituting the is represented. Y A (X + j) or Y B (Y + j) represents the pixel value of the pixel x + j or y + j, respectively.
[0041]
In the case of using Expression (1), for example, the evaluation value S (x, y) is calculated while sequentially shifting the pixel y to the set point set on the epipolar line, and the evaluation value S (x, y ) Of the detected camera image that minimizes the pixel y (= y min ) Is detected as a corresponding point of the pixel x of the reference camera image. Note that the parallax is the pixel x and y. min And calculated from the position.
[0042]
Further, for example, when the sum of squares of the difference between the pixel values of the pixels constituting the reference block and the pixels constituting the detection block corresponding to each pixel is used as the evaluation function, the evaluation value is expressed by the following equation, for example: Can be calculated.
[0043]
[Expression 2]
Figure 0004296617
... (2)
In Equation (2), x and y represent the x coordinate and y coordinate of the pixel, respectively, and η and ξ represent the parallax in the x direction and the parallax in the y direction, respectively. The SSD (x, y, η, ξ) is an evaluation value when the parallax is assumed to be (η, ξ), that is, the pixel located at the coordinates (x, y) on the reference camera image is centered. Represents an evaluation value indicating the correlation between the reference block and the detection block centered on the pixel located at the coordinates (x−η, y−ξ) on the detection camera image. W A Or W B Represents a reference block or a detection block, respectively, i, j W A , W B Therefore, (x + i, y + j) or (x + i−η, y + j−ξ) represents coordinates on the reference camera image or the detected camera image, respectively. And Y A (X + i, y + j) represents a pixel value of a pixel located at coordinates (x + i, y + j) on the reference camera image, and Y B (X + i−η, y + j−ξ) represents the pixel value of the pixel located at the coordinates (x + i−η, y + j−ξ) on the detected camera image.
[0044]
When using equation (2), if the parallax (η, ξ) is changed, the evaluation value SSD (x, y, η, ξ) is calculated, and the evaluation value SSD (x, y, η, ξ) is calculated. ) Is detected as the corresponding point of the pixel (x, y) of the reference camera image. Note that the parallax (η, ξ) when the evaluation value SSD (x, y, η, ξ) is minimized is represented by (η min , Ξ min ), The parallax ζ as the distance between the pixel of the reference camera and the corresponding point is obtained by the following equation.
[0045]
[Equation 3]
Figure 0004296617
... (3)
[0046]
Here, the evaluation values shown in the equations (1) and (2) become smaller as the difference between the pixel values of the pixels constituting the reference block and the pixels of the detection block corresponding to the respective pixels is smaller. Therefore, pixel n of the reference camera image a Pixel n of the detected camera image that minimizes the evaluation value for b For pixel n, the smaller the evaluation value, a The higher the evaluation value is, the greater the certainty of being the corresponding point of the pixel n. a Therefore, the certainty of being a corresponding point becomes lower.
[0047]
Next, for example, as shown in FIG. 7A, an object 3 placed in front of a background wall (in front of the reference camera 1 and the detection camera 2) is replaced with the reference camera 1 and the detection camera 2. Let us consider a case in which corresponding points are detected by performing image-based imaging and performing area-based matching using epipolar lines.
[0048]
Here, as described above, obtaining the parallax and obtaining the distance to the object 3 are equivalent, and in the following, from the corresponding points, for example, a setting as illustrated in FIG. Description will be made assuming that the distance is obtained with reference to the point / distance correspondence table. Furthermore, in the following, for example, the evaluation value of Expression (1) is used.
[0049]
In the case shown in FIG. 7A, for example, a reference camera image or a detection camera image as shown in FIG. 7B is obtained from the reference camera 1 or the detection camera 2, respectively.
[0050]
Now, in the reference camera image shown in FIG. 7B, as shown in FIG. 8A, in the background pixel k (FIG. 8A) in contact with the foreground, which is a projection image of the object 3. Consider the detection of a corresponding point k ′ (indicated by (2)).
[0051]
In this case, for example, if the parallax ζ between the pixel k and the corresponding point k ′ is large, as shown in FIG. 8B, the background pixel k in contact with the foreground in the reference camera image on the detected camera image. The true corresponding point k ′ may be observed at a position away from the foreground, which is a projection image of the object 3.
[0052]
In such a case, the reference block having the pixel k of the reference camera image as the central pixel includes a foreground pixel in part and a background pixel as shown in FIG. 8C. Become. In the embodiment of FIG. 8C, 5 × 5 pixels (horizontal × vertical) centering on the pixel k are configured as reference blocks, the left two columns are foreground pixels, and the right side Three columns are each composed of background pixels.
[0053]
In the case shown in FIG. 8C, the pixels of the detected camera image respectively corresponding to the left two columns and the right three columns of the reference block are divided into two locations as shown in FIG. 8D. That is, the left two columns of foreground pixels in the reference block correspond to the foreground pixel group A in the detected camera image. On the other hand, the right three columns of background pixels of the reference block correspond to the background pixel group B at the true corresponding point k ′ in the detected camera image.
[0054]
In this way, when the pixels of the detected camera image corresponding to the pixels constituting the reference block are separated, the evaluation value calculated for the reference block is more than when the detection block including the pixel group B is targeted. In some cases, the detection block including the pixel group A is smaller. That is, as shown in FIG. 8E, in the detected camera image, the detection block configured with the background pixel k ″ in contact with the foreground as the center may have the smallest evaluation value with the reference block. is there. In this case, the point k ″ that is not the true corresponding point k ′ is detected as the corresponding point of the pixel k, and accordingly, the corresponding point is erroneously detected, and it corresponds to the pixel k due to the erroneous detection. An incorrect value is also obtained for the distance to the point on the three-dimensional space. That is, when there is an erroneous detection of the corresponding point as described above, the distance to the point on the three-dimensional space corresponding to the pixel k is obtained as a value close to the distance to the object 3 constituting the foreground. As a result, the distance image having such a distance as the pixel value is such that the horizontal width of the object 3 is expanded.
[0055]
Here, the erroneous detection of corresponding points as described above is relatively likely to occur when the foreground and background patterns are different, and is particularly likely to occur when the patterns are greatly different.
[0056]
The erroneous detection of corresponding points as described above can be reduced by making the reference block (and hence also the detection block) small (decreasing the number of pixels constituting the reference block). The certainty of detection of corresponding points due to is reduced.
[0057]
Therefore, the arithmetic processing circuit 6 of the distance measuring apparatus in FIG. 1 performs the following distance correction processing, thereby maintaining the certainty of detection of corresponding points by area-based matching, and foreground and background as described above. The influence on the distance due to the erroneous detection of the corresponding points occurring at the boundary portion, that is, the edge portion is reduced.
[0058]
That is, in the arithmetic processing circuit 6, first, for each pixel of the reference camera image, each pixel of the detected camera image uses the evaluation value based on the evaluation function shown in Expression (1) by the stereo processing as described above. Then, they are associated by the area-based matching method (corresponding points are detected), and a distance to a point on the three-dimensional space corresponding to each pixel of the reference camera image is obtained. Thereby, a distance image having the pixel value as the distance is generated.
[0059]
Next, as shown in FIG. 9A, the optimum pixel for correcting the distance of the pixel k centered on the pixel k of the reference camera image (hereinafter referred to as the maximum likelihood pixel as appropriate) is searched. A small block (hereinafter appropriately referred to as a search block) (indicated by a dotted line in FIG. 9A) (third block) as a region (range) is configured. In FIG. 9A, the search block is the same as the reference block configured for the pixel k.
[0060]
Further, among the pixels constituting the search block, the pixel having the smallest evaluation value is selected (detected) as the maximum likelihood pixel. That is, each reference block centered on each pixel included in the search block centered on pixel k of the reference camera image and each corresponding point on the detected camera image detected for each pixel included in the search block are centered. Among the evaluation values between each of the detected blocks, the pixel in the search block where the smallest value is obtained is assumed to be most accurately associated with the corresponding point. The pixel is detected as the maximum likelihood pixel. In FIG. 9A, the uppermost pixel k in the search block centered on the pixel k. 2 Are detected as the maximum likelihood pixels.
[0061]
Then, by replacing the distance as the pixel value of the pixel k of the distance image with the distance that is the pixel value of the maximum likelihood pixel detected for the pixel k, for example, the distance as the pixel value of the pixel k is changed. It is corrected. That is, in FIG. 9A, the distance (pixel value) for the pixel k is the upper right pixel k of the search block. 2 Is the maximum likelihood pixel, and the maximum likelihood pixel k 2 Is replaced with the distance (pixel value).
[0062]
Therefore, in this correction process, the corresponding point k ″ (FIG. 8) of the detected camera image erroneously detected for the pixel k at the boundary (edge) portion between the foreground and the background in the reference camera image is ignored. As shown in FIG. 9B, the detection is performed by performing area-based matching using a reference block in which background pixels and foreground pixels are not mixed, avoiding edge portions where erroneous detection of corresponding points is likely to occur. It is estimated that the distance obtained from the corresponding point is substantially equal to the distance obtained from the true corresponding point k ′ of the pixel k, and in other words, the pixel in which the corresponding point is erroneously detected at a more probable distance. The distance of is replaced.
[0063]
That is, in FIG. 9, a reference block including a foreground pixel and a background pixel is configured for the pixel k (FIG. 9A), but the pixel k in the vicinity thereof is formed. 2 With respect to, a reference block is composed of only background pixels (FIG. 9B). For this reason, while the corresponding point of the pixel k is highly likely to be erroneously detected, the pixel k 2 Is less likely to be falsely detected, so the distance for pixel k is likely to be more accurate. 2 Replaced with the distance about.
[0064]
Note that the size of the search block is not particularly limited. However, if the search block is too large, the pixel may be replaced by a distance at a position far from the pixel k. Since it is difficult to estimate that the distance for such a distant pixel is substantially equal to the true distance for pixel k, it is desirable that the size of the search block is not so large. On the other hand, if the size of the search block is too small, a reference block in which no background pixels and no foreground pixels are mixed in the reference camera image (a reference block that avoids an edge portion where erroneous detection of corresponding points is likely to occur) is formed. Are not included in the search block for pixel k. That is, the search block does not include a pixel with a low possibility of erroneous detection of the corresponding point, and as a result, there is a case where replacement with an incorrect distance obtained from the incorrect corresponding point is performed. Therefore, it is desirable not to make the size of the search block too small. That is, it is desirable that the search block has an appropriate size so that the above inconvenience does not occur.
[0065]
In addition, the correction of the distance as the pixel value of the pixels constituting the distance image can be performed sequentially for all the pixels constituting the distance image as a correction target. It is also possible to select the correction target pixel as appropriate. This point will be described later.
[0066]
Next, FIG. 10 shows a functional configuration example of the arithmetic processing circuit 6 of FIG. 1 that performs the stereo processing and correction processing as described above. This functional configuration is realized, for example, when the arithmetic processing circuit 6 executes an application program stored in the storage device 7.
[0067]
The stereo processing unit 11 (detection means) (processing means) reads the reference camera image and the detection camera image stored in the frame memory 5 and performs stereo processing to obtain a distance image and the like. That is, the stereo processing unit 11 performs area-based matching using epipolar lines to detect corresponding points of the detected camera image corresponding to each pixel of the reference camera image, and based on the corresponding points, the reference camera image For each pixel, a distance to a point on the three-dimensional space projected onto the pixel is obtained. Then, the stereo processing unit 11 supplies the distance image having the distance as a pixel value and the evaluation value obtained when detecting the corresponding point to the distance image storage unit 12.
[0068]
The distance image storage unit 12 is configured to store a distance image and an evaluation value supplied from the stereo processing unit 11.
[0069]
The correction target pixel selection unit 13 (selection unit) is a target (correction processing target) for correcting the distance corresponding to the pixel value from the pixels constituting the distance image stored in the distance image storage unit 12. A correction target pixel is selected and an instruction is given to the correction unit 14. The correction unit 14 (correction means) is a pixel value for a pixel instructed as a correction target pixel from the correction target pixel selection unit 13 among the pixels constituting the distance image stored in the distance image storage unit 12. As the distance is corrected.
[0070]
The distance image storage unit 15 stores the distance image stored in the distance image storage unit 12 after being corrected by the correction unit 14.
[0071]
Next, stereo processing performed by the arithmetic processing circuit 6 of FIG. 10 will be described with reference to the flowchart of FIG. Note that the stereo processing is performed by the stereo processing unit 11 as described above.
[0072]
As described above, in each of the reference camera 1 and the detection camera 2, the object 3 is photographed, and, for example, one frame of the reference camera image or detection camera image obtained as a result is supplied to the frame memory 5 and stored.
[0073]
When the reference camera image and the detected camera image are stored in the frame memory 5, in step S1, a variable i representing a pixel constituting the reference camera image (and distance image) is initialized to 1, for example (i = 1 represents, for example, the upper left pixel of the reference camera image), and the process proceeds to step S2. In step S2, an epipolar line (a point on the object in the three-dimensional space and the optical center O of the reference camera 1) about the pixel i of the reference camera image. 1 The detection camera image (imaging surface S 2 ) Projected above) The distance number j corresponding to the preset point set above is initialized to 1, for example, and the process proceeds to step S3.
[0074]
Here, for each pixel of the reference camera image, the detection of the epipolar line and the setting of the set point on the detection camera image are performed at the time of calibration of the reference camera 1 and the detection camera 2, for example. The distance between the set points corresponding to the distance numbers j and j + 1 on the epipolar line in the three-dimensional space (adjacent set points) is, for example, the distance resolution required for the distance measuring apparatus of FIG. Therefore, it is determined.
[0075]
In step S3, a set point pixel n (i, j) corresponding to the distance number j on the epipolar line for the pixel i of the reference camera image is detected from the detected camera image. Note that the pixel n (i, j) may have subpixel accuracy. Further, the relationship between the distance number j and the corresponding set point n (i, j) is obtained, for example, at the time of calibration, and corresponds to the distance number j by making a table (lookup table). The set point pixel n (i, j) can be determined immediately.
[0076]
In step S4, the reference block WA (i) centered on the pixel i of the reference camera image is extracted (cut out) from the reference camera image, and the pixel n (i, j) of the detected camera image is selected. The detection block WB (i, j) as the center is extracted from the detected camera image, and the process proceeds to step S5.
[0077]
In step S5, using the pixels constituting the reference block WA (i) and the pixels constituting the detection block WB (i, j), for example, the evaluation value S (i, n ( i, j)) is calculated and the process proceeds to step S6. Here, hereinafter, the evaluation value S (i, n (i, j)) will be represented as S (j) as appropriate. In Expression (1), since the evaluation value S (j) is calculated using the luminance value of the pixel, the evaluation value S (j) includes the pixels constituting the reference block WA (i) and the detection block. It can be said that the similarity regarding the luminance value between the pixels constituting WB (i, j) is expressed. Further, when the evaluation value S (j) is calculated using the luminance value in this way, the reference camera image and the detection camera 2 need only have a luminance component. For example, it is possible to use a so-called monochrome camera that outputs a grayscale image consisting only of a luminance signal (no color signal is output). However, it is possible to use not only the luminance signal but also the color difference signal for the calculation of the evaluation value by the equation (1).
[0078]
In step S6, it is determined whether or not the distance number j is equal to the maximum value J. If it is determined that the distance number j is not equal, the process proceeds to step S7, where the distance number j is incremented by one. And it returns to step S3 and the process of step S3 thru | or S7 is repeated hereafter. That is, as a result, for all set points set on the epipolar line for the pixel i, the correlation with the pixel i (here, the evaluation value represented by the expression (1)) is calculated.
[0079]
On the other hand, if it is determined in step S6 that the distance number j is equal to the maximum value J, that is, the evaluation value S (j) with the pixel i for all set points set on the epipolar line for the pixel i. Is calculated, the process proceeds to step S8, and the distance number j that minimizes the evaluation value S (j) (maximizes the correlation) is obtained. Here, the distance number j that minimizes the evaluation value S (j) (maximizes the correlation) is hereinafter referred to as the minimum distance number j. max It expresses.
[0080]
The minimum distance number j max Set point n (i, j max ) Is the corresponding point of pixel i, and therefore the minimum distance number j max Is the corresponding point n (i, j max ) Is equivalent to detecting.
[0081]
The distance number j takes an integer value here, but the minimum distance number j that takes a decimal value by performing the interpolation as described in FIG. max It is also possible to ask for.
[0082]
Thereafter, the process proceeds to step S9, where the minimum distance number j max Is supplied from the stereo processing unit 11 to the distance image storage unit 12 and stored as a pixel value for the pixel i constituting the distance image. Furthermore, it progresses to step S10 and evaluation value S (j max ) Is supplied to the distance image storage unit 12 and stored as the final evaluation value S (i) of the pixel i in association with the distance for the pixel i, and the process proceeds to step S11.
[0083]
In step S11, it is determined whether or not the pixel i is equal to the last pixel (for example, the lowermost right pixel of the reference camera image) I constituting the reference camera image. If it is determined that the pixel i is not equal, the process proceeds to step S12. Then, the variable i is incremented by 1, and the process returns to step S2. Then, the same processing is repeated for the pixel to be processed next (for example, the next pixel in the line scan order of the pixel that has been processed).
[0084]
If it is determined in step S11 that the pixel i is equal to the last pixel I constituting the reference camera image, that is, the distance and the evaluation value (final evaluation value) for all the pixels constituting the reference camera image. S (j max ) Is obtained, the stereo processing is terminated.
[0085]
In FIG. 11, stereo processing is performed on all the pixels constituting the reference camera image. However, the stereo processing may be performed on only some pixels constituting the reference camera image. Is possible.
[0086]
Next, correction processing performed by the arithmetic processing circuit 6 in FIG. 10 will be described with reference to the flowchart in FIG. The correction processing is performed in the correction target pixel selection unit 13 and the correction unit 14 after the stereo processing is performed.
[0087]
In the correction process, first, in step S21, a variable i representing a pixel constituting the distance image (and the reference camera image) is initialized to 1, for example, and the process proceeds to step S22. In step S22, the correction target pixel selection unit 13 stores the evaluation value S (i) of the pixel i stored in the distance image storage unit 12 (the final evaluation value S (i stored in step S10 of FIG. 11). )) Is read out, and it is determined whether or not the evaluation value S (i) is smaller than a predetermined threshold value ε.
[0088]
If it is determined in step S22 that the evaluation value S (i) of the pixel i is smaller than the threshold ε, that is, the minimum value S (i) of the evaluation value when the corresponding point is detected for the pixel i of the reference camera image. (S (j described in FIG. 11 max ) Is smaller than the predetermined threshold value ε, and therefore, if the detected corresponding point is highly certain to be a true corresponding point, the process proceeds to step S31. In step S31, the correction unit 14 reads the distance Z (i) of the pixel i from the distance image storage unit 12, supplies it to the distance image storage unit 15, stores it, and proceeds to step S29. Accordingly, in this case, the correction of the distance Z (i) for the pixel i obtained by the stereo processing is not performed.
[0089]
On the other hand, when it is determined in step S22 that the evaluation value S (i) of the pixel i is not smaller than the threshold ε, that is, the minimum value S of the evaluation value when the corresponding point is detected for the pixel i of the reference camera image. If (i) is equal to or greater than the predetermined threshold value ε, and therefore the certainty of the detected corresponding point being a true corresponding point is low, the process proceeds to step S23, and hereinafter, for pixel i obtained by stereo processing. The distance is corrected as described with reference to FIG.
[0090]
That is, the correction target pixel selection unit 13 selects the pixel i as the correction target pixel and notifies the correction unit 14 of it. When the correction unit 14 receives notification from the correction target pixel selection unit 13 that the pixel i is the correction target pixel, in step S23, the variable j representing the pixel in the search block W centered on the pixel i is For example, a value j representing the upper leftmost pixel in the search block W 0 It is initialized to. Further, in step S23, the correction unit 14 refers to the distance image storage unit 12, thereby holding the variable S that holds the minimum evaluation value of the pixels in the search block W. min For example, pixel j 0 Evaluation value S (j 0 ) And a variable Z that holds the distance is, for example, pixel j 0 The distance Z (j 0 ).
[0091]
In step S24, the correction unit 14 reads the evaluation value S (j) for the pixel j from the distance image storage unit 12, and the variable S min Is smaller than the evaluation value S (j). In step S24, the variable S min Is not smaller than the evaluation value S (j), that is, the evaluation value S (j) is the variable S min In the case of the following, the process proceeds to step S25, and the correction unit 14 sets the variable S min In addition, the evaluation value S (j) is newly set, the distance Z (j) for the pixel j is newly set in the variable Z, and the process proceeds to step S26.
[0092]
In step S24, the variable S min Is determined to be smaller than the evaluation value S (j), the process skips step S25 and proceeds to step S26, where the pixel j is the last pixel in the search block W (for example, the lowermost right of the search block W). It is determined whether or not it is a pixel. If it is determined in step S26 that the pixel j is not the last pixel in the search block W, the process proceeds to step S27, and the evaluation value is still set to the variable j in the pixel in the search block W. min Is set to a value that represents a pixel that has not been compared with (for example, a value that represents the next pixel in the line scan order of the pixel currently being processed among the pixels of the search block W), and step Return to S24. In step S26, the processes in steps S24 to S27 are repeated until it is determined that the pixel j is the last pixel in the search block W. That is, the variable S min Is set to the minimum value of the evaluation values of the pixels in the search block W, that is, the evaluation value of the maximum likelihood pixel, and the variable Z is set to the distance for the maximum likelihood pixel.
[0093]
When it is determined in step S26 that the pixel j is the last pixel in the search block W, the process proceeds to step S28, and the correction unit 14 determines the distance for the pixel i stored in the distance image storage unit 12. The correction is performed by replacing Z (i) with the distance Z of the maximum likelihood pixel, and the process proceeds to step S29. That is, the correction unit 14 writes the distance Z of the maximum likelihood pixel in the distance image storage unit 15 as the distance of the pixel i, and proceeds to step S29.
[0094]
In step S29, as in the case of step S11 in FIG. 11, it is determined whether or not the pixel i is equal to the last pixel I constituting the distance image. If it is determined that the pixel i is not equal, the process proceeds to step S30. i is incremented by 1, and the process returns to step S22. Accordingly, in this case, the same processing is repeated for the pixel i to be processed next.
[0095]
If it is determined in step S29 that the pixel i is equal to the last pixel I constituting the distance image, the correction process is terminated.
[0096]
As described above, a pixel whose evaluation value is not smaller than the predetermined threshold ε is selected as a correction target pixel, and the distance of the correction target pixel is replaced with the distance of the pixel having the smallest evaluation value in the search block. In this case, the distance of the pixel with low certainty that the detected corresponding point is a true corresponding point is a pixel in the vicinity of the pixel, and the detected corresponding point is a true corresponding point. Since it is replaced by the distance with the highest certainty, corresponding points generated at the boundary between the foreground and the background as described in FIG. It is possible to reduce the influence on the distance due to the false detection of and to obtain a relatively accurate distance.
[0097]
Note that the threshold value ε of the evaluation value used for determining whether or not the pixels constituting the distance image are the correction target pixels is set to an optimum value by an experiment or the like, for example. Alternatively, the threshold value ε can be set adaptively from the pixel values of the reference camera image and the detected camera image stored in the frame memory 5.
[0098]
Next, as described above, a pixel whose evaluation value is not smaller than the predetermined threshold ε is selected as a correction target pixel, and the distance of the correction target pixel is determined as a pixel having the smallest evaluation value in the search block (maximum likelihood pixel). In the case of replacing with the distance, the distance of the pixel located at the center of the search block including the maximum likelihood pixel is replaced with the distance of the maximum likelihood pixel even though the evaluation value is not so large. Sometimes. Therefore, for example, if the evaluation value of each of a group of pixels is somewhat larger than the threshold value ε and there is a pixel whose evaluation value is slightly smaller than the threshold value ε around the pixel, the group The distances of the respective pixels are replaced with the distances of pixels having a small evaluation value in the vicinity thereof. In this case, since the distance of each group of pixels is the same distance, block-like distortion occurs in the distance image.
[0099]
That is, as shown in FIG. 13, for example, when the correction process described in FIG. 12 is performed on the distance image obtained for the object 3 whose distance (depth) continuously changes, such as a cylinder. Is a point that is a projection of a point on the side of a cylinder as a correction target pixel, and even if the distance of the pixel that is the correction target pixel and the distance of the maximum likelihood pixel continuously change (the two distances) However, there is a case where the distance of the pixel to be corrected is replaced with the distance of the maximum likelihood pixel in the search block centering on the distance. In this case, since the distance between the pixels to be corrected and the distance of the maximum likelihood pixel are the same, a smooth change in distance (distance continuity) on the side surface of the cylinder is lost.
[0100]
Therefore, in the correction process, when the difference between the distance of a certain pixel and the distance between the maximum likelihood pixel in the search block centering on the pixel is large to some extent, the pixel is performed as the correction target pixel. Can do. In this case, when the difference between the distance of a certain pixel and the distance between the maximum likelihood pixel in the search block centered on the pixel is small, the pixel is not set as a correction target pixel. As a result, for example, as described above It is possible to prevent the distance continuity from being lost on the side surface of a simple cylinder and to reduce only the influence on the distance due to erroneous detection of corresponding points occurring at the edge portion.
[0101]
That is, FIG. 14 shows a flowchart when the arithmetic processing circuit 6 in FIG. 10 performs such correction processing.
[0102]
In this case, first, in step S41, the variable i representing the pixels constituting the distance image (and the reference camera image) is initialized to 1, for example, and the process proceeds to step S43. In step S43, as in the case of step S23 in FIG. 12, a variable j representing a pixel in the search block W centered on the pixel i is, for example, a value j representing the upper leftmost pixel in the search block W. 0 And a variable S that holds the minimum evaluation value of the pixels in the search block W. min For example, pixel j 0 Evaluation value S (j 0 ) And a variable Z that holds the distance is, for example, pixel j 0 The distance Z (j 0 ).
[0103]
Then, the process proceeds to step S44. Thereafter, in steps S44 to 47, the same processing as in steps S24 to S27 of FIG. min Is set to the minimum value of the evaluation values of the pixels in the search block W, that is, the evaluation value of the maximum likelihood pixel, and the variable Z is set to the distance for the maximum likelihood pixel.
[0104]
Variable S min When the evaluation value of the maximum likelihood pixel is set and the distance for the maximum likelihood pixel is set in the variable Z, the process proceeds from step S46 to step S48, and the correction target pixel selection unit 13 stores the distance image. The distance Z (i) of the pixel i is read from the unit 12, and the absolute value (= | Z (i) −Z |) of the difference between the distance Z (i) and the variable Z is determined from the predetermined threshold Th. It is determined whether it is small.
[0105]
If it is determined in step S48 that the absolute value of the difference between the distance Z (i) of the pixel i and the variable Z is not smaller than the threshold Th, that is, the distance Z (i) of the pixel i and the pixel i are When the difference from the distance Z to the maximum likelihood pixel in the search block W as the center is large to some extent, the correction target pixel selection unit 13 selects the pixel i as the correction target pixel, and notifies the correction unit 14 to that effect. Inform. When the correction unit 14 receives a notification from the correction target pixel selection unit 13 that the pixel i is the correction target pixel, the correction unit 14 proceeds to step S49 and proceeds to the distance Z (i for the pixel i stored in the distance image storage unit 12. ) Is replaced by the distance Z of the maximum likelihood pixel, that is, the distance Z of the maximum likelihood pixel is written in the distance image storage unit 15 as the distance of the pixel i, and the process proceeds to step S50.
[0106]
In Step S48, when it is determined that the absolute value of the difference between the distance Z (i) of the pixel i and the variable Z is smaller than the threshold Th, the correction target pixel selection unit 13 sets the pixel i as the correction target pixel. Without selection, the process proceeds to step S52. In step S52, the correction unit 14 reads the distance Z (i) of the pixel i from the distance image storage unit 12, supplies it to the distance image storage unit 15, stores it, and proceeds to step S50. Accordingly, in this case, the correction of the distance Z (i) for the pixel i obtained by the stereo processing is not performed.
[0107]
In step S50, as in step S29 in FIG. 12, it is determined whether or not the pixel i is equal to the last pixel I constituting the distance image. If it is determined that the pixel i is not equal, the process proceeds to step S51. i is incremented by 1, and the process returns to step S43. Then, the same processing is repeated for the pixel i to be processed next.
[0108]
In Step S50, when it is determined that the pixel i is equal to the last pixel I constituting the distance image, the correction process is terminated.
[0109]
The distance threshold Th used for determining whether or not the pixels constituting the distance image are the correction target pixels is set to an optimum value by experiment or the like, or stored in the distance image storage unit 5. It is possible to set adaptively from the distance as the pixel value of the pixels of the distance image.
[0110]
In the embodiment of FIG. 14, when the difference between the distance Z (i) of a certain pixel i and the maximum likelihood pixel in the search block W centering on the pixel i is equal to or greater than the threshold Th. However, the pixel i is selected as the correction target pixel, but the difference between the distance Z (i) of a certain pixel i and the maximum likelihood pixel in the search block W centered on the pixel i is If the evaluation value S (i) of the pixel i is equal to or greater than the threshold ε, the pixel i can be selected as a correction target pixel. The correction process in this case is as shown in the flowchart of FIG. That is, such a correction target pixel is selected after the process in step S41 in FIG. 14, as in step S22 in FIG. 12, whether or not the evaluation value S (i) of the pixel i is smaller than the threshold ε. Step S42 is provided, and if the evaluation value S (i) of the pixel i is not smaller than the threshold value ε, the process proceeds to Step S43, and if it is smaller, the process proceeds to Step S52.
[0111]
Next, in the embodiment of FIG. 14, the evaluation values of the pixels constituting the search block W centered on a certain pixel i are compared, and the pixel having the smallest evaluation value (maximum likelihood) in the search block W is compared. After finding (pixel) (steps S44 to S47), it is determined whether or not the pixel i is selected as the correction target pixel in consideration of the difference in distance (step S48). In consideration of this difference, it is possible to select in advance a pixel that can be the most likely pixel in the search block, and to compare the evaluation values only for the selected pixel.
[0112]
Furthermore, in the embodiment of FIG. 14, based on the difference (absolute value) between the distance Z (i) of the pixel i and the distance Z of the maximum likelihood pixel in the search block W centered on the pixel i. Whether or not the pixel i is selected as the pixel to be corrected is determined (step S48). In addition, for example, the luminance and color information (for example, saturation and hue) of the pixel i in the reference camera image. It is possible to determine whether or not the pixel i is selected as the correction target pixel based on the pixel value such as.
[0113]
That is, FIG. 16 shows a flowchart when the arithmetic processing circuit 6 of FIG. 10 performs such correction processing.
[0114]
In this case, first, in step S61, the variable i representing the pixels constituting the distance image (and the reference camera image) is initialized to 1, for example, and the process proceeds to step S62. In step S62, the correction target pixel selection unit 13 reads, for example, the luminance Y (i) as the pixel value of the pixel i on the reference camera image from the frame memory 5 as indicated by a dotted line in FIG. Further, in step S52, the correction target pixel selection unit 13 reads the distance Z (i) of the pixel i from the distance image storage unit 12, and proceeds to step S63.
[0115]
In step S63, the variable j representing the pixel in the search block W centered on the pixel i is, for example, the highest in the search block W in the correction target pixel selection unit 13 as in step S23 of FIG. Value j representing the upper left pixel 0 It is initialized to. Further, the correction target pixel selection unit 13 determines in step S63 that the variable S min Alternatively, Z is a value that cannot be taken as an evaluation value or a distance, for example, is initialized to −1, and the process proceeds to step S64.
[0116]
In step S64, the correction target pixel selection unit 13 reads the luminance Y (j) of the pixel j on the reference camera image from the frame memory 5, and the distance Z (j) is read from the distance image storage unit 12. Read out. Further, in step S64, the absolute value of the difference between the luminance Y (i) of the pixel i and the luminance Y (j) of the pixel j in the correction target pixel storage unit 13 (= | Y (i) −Y (j) |) Is a predetermined threshold Th Y The absolute value (= | Z (i) −Z |) of the difference between the distance Z (i) of the pixel i and the distance Z (j) of the pixel j is smaller than the predetermined threshold Th. Z It is determined whether it is greater.
[0117]
Here, the threshold Th Y Can be set to an optimal value by experiment or the like, or can be set adaptively from the pixel values of the reference camera image and the detected camera image stored in the frame memory 5. Also, the threshold Th Z Can be set in the same manner as the threshold Th described in FIG.
[0118]
In step S64, the absolute value of the difference between the luminance Y (i) of the pixel i and the luminance Y (j) of the pixel j is a predetermined threshold Th. Y Or the absolute value of the difference between the distance Z (i) of the pixel i and the distance Z (j) of the pixel j is a predetermined threshold Th Z If it is determined that it is not larger, steps S65 to S68 are skipped and the process proceeds to step S69.
[0119]
In step S64, the absolute value of the difference between the luminance Y (i) of the pixel i and the luminance Y (j) of the pixel j is a predetermined threshold Th. Y The absolute value of the difference between the distance Z (i) of the pixel i and the distance Z (j) of the pixel j is smaller than the predetermined threshold Th. Z If it is determined that the value is larger, the process proceeds to step S65, where the correction target pixel selection unit 13 uses the variable S. min It is determined whether (or Z) is equal to the initial value -1.
[0120]
In step S65, the variable S min When it is determined that is equal to −1, the process proceeds to step S66, and the correction target pixel selection unit 13 reads the evaluation value S (j) for the pixel j from the distance image storage unit 12, and the variable S min And the distance Z (j) of the pixel j is set to the variable Z, and the process proceeds to step S69.
[0121]
In step S65, the variable S min Is determined not to be equal to −1, the process proceeds to step S67 and the correction target pixel selection unit 13 determines that the variable S min Is smaller than the evaluation value S (j) for the pixel j. In step S67, the variable S min Is determined to be smaller than the evaluation value S (j), the process proceeds to step S68, and the correction target pixel selection unit 13 sets the variable S min In addition, the evaluation value S (j) for the pixel j is set, the distance Z (j) of the pixel j is set in the variable Z, and the process proceeds to step S69.
[0122]
In step S67, the variable S min Is determined not to be smaller than the evaluation value S (j), step S68 is skipped and the process proceeds to step S69, and the pixel j is the last in the search block W as in step S26 of FIG. It is determined whether or not it is a pixel. If it is determined in step S69 that the pixel j is not the last pixel in the search block W, the process proceeds to step S70, and the variable j is set to the variable j in the same manner as in step S27 of FIG. The evaluation value is still the variable S min A value representing a value not compared with is set, and the process returns to step S64. In step S69, the processes in steps S64 to S70 are repeated until it is determined that the pixel j is the last pixel in the search block W.
[0123]
That is, as a result, in the search block W, the difference from the luminance Y (i) of the pixel i located at the center is the threshold Th. Y And the difference from the distance Z (i) of the pixel i is the threshold Th Z If there is a larger pixel j, the pixel j is selected as an appropriate pixel to be used for correcting the distance Z (i) of the pixel i (hereinafter, appropriately referred to as an appropriate pixel). Then, among the appropriate pixels in the search block W, the pixel with the smallest evaluation value is selected as the maximum likelihood pixel, and the evaluation value or distance of the maximum likelihood pixel is the variable S. min Or set to Z, respectively.
[0124]
When it is determined in step S69 that the pixel j is the last pixel in the search block W, the process proceeds to step S71, and the correction target pixel selection unit 13 sets the variable S. min It is determined whether (or Z) is equal to the initial value -1. In step S71, the variable S min Is not equal to -1, that is, the variable min If the evaluation value for any pixel (maximum likelihood pixel) in the search block W is set, the correction target pixel selection unit 13 selects the pixel i as the correction target pixel, and the correction unit 14 The process proceeds to step S72.
[0125]
When the correction unit 14 receives notification from the correction target pixel selection unit 13 that the pixel i is a correction target pixel, in step S72, the correction unit 14 stores the distance Z (i) for the pixel i stored in the distance image storage unit 12. Is replaced with the distance (variable) Z of the maximum likelihood pixel, that is, the distance Z of the maximum likelihood pixel is written in the distance image storage unit 15 as the distance of the pixel i, and the process proceeds to step S73.
[0126]
In step S71, the variable S min Is determined to be equal to −1, that is, in the search block W, the difference from the luminance Y (i) of the pixel i located at the center thereof is the threshold Th. Y And the difference from the distance Z (i) of the pixel i is the threshold Th Z When there is no larger pixel j, that is, when there is no appropriate pixel, the process proceeds to step S75, and the correction unit 14 reads the distance Z (i) of the pixel i from the distance image storage unit 12, and the distance image storage unit 15 to be stored, and the process proceeds to step S73. Accordingly, in this case, the pixel i is not selected as a correction target pixel, and as a result, the distance Z (i) is not corrected.
[0127]
In step S73, as in step S11 of FIG. 11, it is determined whether the pixel i is equal to the last pixel I constituting the distance image. If it is determined that the pixel i is not equal, the process proceeds to step S74. i is incremented by 1, and the process returns to step S62. Then, the same processing is repeated for the pixel i to be processed next.
[0128]
If it is determined in step S73 that the pixel i is equal to the last pixel I constituting the distance image, the correction process is terminated.
[0129]
Therefore, according to the embodiment of FIG. 16, in the search block W, the difference from the luminance Y (i) of the pixel i located at the center is the threshold Th. Y And the difference from the distance Z (i) of the pixel i is the threshold Th Z If there is a larger appropriate pixel, the pixel i is selected as the correction target pixel. Then, among the appropriate pixels, the pixel with the smallest evaluation value is selected as the maximum likelihood pixel, and the distance Z (i) of the correction target pixel i is corrected by performing replacement with the distance of the maximum likelihood pixel. The
[0130]
Next, FIG. 17 is a flowchart showing another embodiment of the correction process. By this correction process, the same correction process as that shown in the flowchart of FIG. 16 can be performed.
[0131]
That is, in this case, first, in step S81, the variable i representing the pixels constituting the distance image (and the reference camera image) is initialized to 1, for example, and the process proceeds to step S82. In step S82, the correction target pixel selection unit 13 reads, for example, the luminance Y (i) as the pixel value of the pixel i on the reference camera image from the frame memory 5 as indicated by a dotted line in FIG. Further, in step S82, the correction target pixel selection unit 13 reads the distance Z (i) of the pixel i from the distance image storage unit 12, and proceeds to step S83.
[0132]
In step S83, the variable j representing the pixel in the search block W centered on the pixel i is, for example, the highest in the search block W in the correction target pixel selection unit 13 as in step S23 of FIG. Value j representing the upper left pixel 0 It is initialized to. Further, the correction target pixel selection unit 13 determines that the variable S in step S83. min Alternatively, Z is initialized to the evaluation value S (i) or the distance Z (i) of the pixel i, respectively, and the process proceeds to step S84.
[0133]
In step S <b> 84, the correction target pixel selection unit 13 reads the luminance Y (j) of the pixel j on the reference camera image from the frame memory 5, and the distance Z (j) is read from the distance image storage unit 12. Read out. Further, in step S84, the absolute value of the difference between the luminance Y (i) of the pixel i and the luminance Y (j) of the pixel j (= | Y (i) −Y (j) in the correction target pixel storage unit 13. |) Is a predetermined threshold Th Y The absolute value (= | Z (i) −Z |) of the difference between the distance Z (i) of the pixel i and the distance Z (j) of the pixel j is smaller than the predetermined threshold Th. Z It is determined whether it is greater.
[0134]
In step S84, the absolute value of the difference between the luminance Y (i) of the pixel i and the luminance Y (j) of the pixel j is a predetermined threshold Th. Y Or the absolute value of the difference between the distance Z (i) of the pixel i and the distance Z (j) of the pixel j is a predetermined threshold Th Z If it is determined that it is not larger, steps S85 and 86 are skipped and the process proceeds to step S87.
[0135]
In step S84, the absolute value of the difference between the luminance Y (i) of the pixel i and the luminance Y (j) of the pixel j is a predetermined threshold Th. Y The absolute value of the difference between the distance Z (i) of the pixel i and the distance Z (j) of the pixel j is smaller than the predetermined threshold Th. Z If it is determined that the value is larger, the process proceeds to step S85, and the correction target pixel selection unit 13 uses the variable S. min Is smaller than the evaluation value S (j) for the pixel j. In step S85, the variable S min Is determined to be smaller than the evaluation value S (j), the process proceeds to step S86, and the correction target pixel selection unit 13 sets the variable S min In addition, the evaluation value S (j) for the pixel j is set, the distance Z (j) of the pixel j is set in the variable Z, and the process proceeds to step S87.
[0136]
In step S85, the variable S min Is determined not to be smaller than the evaluation value S (j), step S86 is skipped and the process proceeds to step S87. As in step S26 in FIG. 12, the pixel j is the last in the search block W. It is determined whether or not it is a pixel. If it is determined in step S87 that the pixel j is not the last pixel in the search block W, the process proceeds to step S88, and as in step S27 in FIG. The evaluation value is still the variable S min A value representing that not compared with is set, and the process returns to step S84. In step S87, the processes in steps S84 to S88 are repeated until it is determined that the pixel j is the last pixel in the search block W.
[0137]
That is, as a result, an appropriate pixel is selected from the search block W, and the appropriate pixel having the smallest evaluation value is selected as the maximum likelihood pixel, and the evaluation value or distance of the maximum likelihood pixel is a variable. S min Or set to Z, respectively. Note that if there is no suitable pixel in the search block W, the variable S min Alternatively, each Z is in a state where the evaluation value S (i) or the distance Z (i) of the pixel i set in step S83 is still set.
[0138]
When it is determined in step S87 that the pixel j is the last pixel in the search block W, the process proceeds to step S89, and the correction unit 14 determines the distance for the pixel i stored in the distance image storage unit 12. Z (i) is corrected by replacing it with the variable Z, that is, the variable Z is supplied to and stored in the distance image storage unit 15 as the distance of the pixel i, and the process proceeds to step S90.
[0139]
Here, as described above, when there is an appropriate pixel in the search block W, the one with the smallest evaluation value is selected as the maximum likelihood pixel, and the distance is set in the variable Z. In this case, the distance Z (i) of the pixel i at the center of the search block W is replaced with the variable Z. In effect, the pixel i is selected as the correction target pixel, and the distance Z (i) The correction has been made. On the other hand, when there is no appropriate pixel in the search block W, the variable Z is in a state where the distance Z (i) of the pixel i is set. The fact that the distance Z (i) of a certain pixel i is replaced with the variable Z is substantially equivalent to no correction being performed, and therefore the pixel i is selected as the correction target pixel. Will not be.
[0140]
In step S90, as in step S11 of FIG. 11, it is determined whether or not the pixel i is equal to the last pixel I constituting the distance image. If it is determined that the pixel i is not equal, the process proceeds to step S91. i is incremented by 1, and the process returns to step S82. Then, the same processing is repeated for the pixel i to be processed next.
[0141]
If it is determined in step S90 that the pixel i is equal to the last pixel I constituting the distance image, the correction process is terminated.
[0142]
As described above, based on the difference from the pixel value on the reference camera image as well as the difference from the distance Z (i) of the pixel i, the pixel i is selected as a correction target pixel. Furthermore, by selecting the most likely pixel from the appropriate pixels that are small in pixel value difference and correcting the distance of the pixel i by the distance of the final pixel, an incorrect correction is performed on the pixel i. It becomes possible to prevent.
[0143]
That is, as described above, even when an image with a low foreground brightness and a high background brightness (an image with a dark foreground and a bright background) is obtained as the reference camera image and the detection camera image, as described above, In the portion, the corresponding point is erroneously detected for a certain pixel i constituting the background, and thus the distance of the foreground may be erroneously obtained as the distance.
[0144]
Among the pixels constituting the search block centered on the pixel i, in general, the evaluation value for the reference block that is composed of only the background pixels is composed of both the foreground and background pixels. Therefore, the distance of the pixel i is replaced by the distance of the background pixel from which such a small evaluation value is obtained as described in FIG. Will be corrected from the wrong foreground distance to the correct background distance.
[0145]
However, when the foreground luminance is low and the background luminance is high, the evaluation value for the pixel in which the reference block is composed of both the foreground and background pixels is opposite to the above case. In some cases, the evaluation value is smaller than the evaluation value for the pixel in which the reference block is composed of only the pixels. Therefore, when the pixel from which such a small evaluation value is obtained is a foreground pixel, the distance of the pixel i is replaced with the distance of the foreground pixel from which a small evaluation value is obtained as described in FIG. Then, the distance of the pixel i is corrected from the wrong foreground distance to the wrong foreground distance.
[0146]
Therefore, as described with reference to FIGS. 16 and 17, the difference from the luminance of the pixel i located at the center in the search block is the threshold Th. Y If there is an appropriate pixel that is a pixel having a luminance less than that, the pixel i is selected as the correction target pixel, and the distance of the correction target pixel i is set to the distance of the smallest evaluation value of the appropriate pixels. By substituting, even when the foreground luminance is low and the background luminance is high, the foreground distance obtained by mistake for pixel i can be replaced with the correct background distance.
[0147]
That is, the appropriate pixel has a luminance close to that of the pixel i. Therefore, in the search block, it is highly likely that the appropriate pixel constitutes the same background as the pixel i. , Likely to constitute the foreground. Therefore, ignore the pixels that are most likely to constitute the foreground and select only the appropriate pixels that are likely to constitute the background, and select the one with the smallest evaluation value as the most likely pixel. Then, by replacing the distance of the correction target pixel i with the distance of the maximum likelihood pixel, the foreground distance obtained by mistake for the pixel i is corrected to the correct background distance. Thus, it is possible to prevent erroneous correction.
[0148]
The correction processing is preferably performed after noise removal or hole filling is performed on the distance image obtained by the stereo processing. This is because when the reference camera image or the detected camera image has a small change in luminance, it is easy to cause erroneous detection of corresponding points in stereo processing, while the final evaluation value obtained for each pixel. This is because if the correction processing is performed using the distance image obtained as a result of such stereo processing as it is, an adverse effect such as spreading of noise may occur.
[0149]
Here, as a method of performing noise removal or hole filling on the distance image, for example, a set of adjacent pixels having a close distance value is defined as one unit, and a portion having a small area of one unit is determined as noise. Of the set of pixels determined to be noise, a pixel adjacent to a non-noise pixel is corrected by applying a median filter, and the noise portion is gradually narrowed and finally eliminated. is there. The details of this method are described in, for example, Japanese Patent Application No. 9-288479 filed earlier by the present applicant.
[0150]
As described above, the present invention has been described with respect to the case where the present invention is applied to a distance measuring device. However, as described above, in the case where parallax is measured, when the parallax is further obtained from the parallax, The present invention can also be applied when analyzing a three-dimensional shape. Here, when the distance is obtained from the parallax, even if the distance is obtained after performing the correction process on the parallax, or the distance is obtained from the parallax and the correction process is performed on the distance, the same An effect can be obtained.
[0151]
In this embodiment, the correction process is performed after the stereo process is completed. However, the stereo process is performed until the correction process is possible, and thereafter, the stereo process and the correction process are performed in parallel. Is possible.
[0152]
Further, in the present embodiment, the detection of the maximum likelihood pixel from the search block is performed for all the pixels constituting the search block. It is possible to target only the pixels located on the outer periphery of the pixel, or target only every other pixel of the pixels constituting the search block. In this case, the maximum likelihood pixel can be detected at high speed.
[0153]
Furthermore, in the present embodiment, the arithmetic processing circuit 6 is caused to perform stereo processing and correction processing by executing a computer program. However, the stereo processing and correction processing are performed by dedicated hardware. Is also possible.
[0154]
In this embodiment, the application program for performing the stereo processing and the correction processing is provided by being stored in the storage device 7, but such an application program is, for example, the Internet or other transmission media. It is also possible to provide it via transmission.
[0155]
Furthermore, in the present embodiment, rectangular blocks are configured as the reference block, detection block, and search block, but the reference block, detection block, and search block are limited to rectangular blocks. For example, a circular block composed of pixels within a certain distance from a certain pixel can be adopted as a reference block, a detection block, or a search block. In addition, the reference block, the detection block, and the search block do not need to be configured by adjacent pixels, and can be configured by, for example, a set of pixels every other pixel.
[0156]
Furthermore, in the present embodiment, one camera 1 that functions as a reference camera and one camera 2 that functions as a detection camera are used. However, a plurality of detection cameras can be used. It is. In addition, by preparing only one camera and moving it, the one camera can be used as both a reference camera and a detection camera.
[0157]
In the present embodiment, the distance image obtained by the stereo process and the correction process is displayed on the output device 8 or stored in the storage device 7. It is possible to transmit the data via a transmission medium such as the above and provide it to other devices.
[0158]
Furthermore, in the present embodiment, the correction is performed by replacing the distance of the correction target pixel with the distance of one maximum likelihood pixel, but the distance of the correction target pixel is, for example, a small evaluation value. Sequentially, a plurality of maximum likelihood pixels are selected and corrected based on an average value of the distances of the plurality of maximum likelihood pixels, or corrected by performing interpolation using the distances of the plurality of maximum likelihood pixels. It is possible.
[0159]
Further, in the present embodiment, the corrected distance image is stored in the distance image storage unit 15 different from the distance image storage unit 12, but the corrected distance image is the uncorrected distance image. It is also possible to store the stored distance image storage unit 12 so as to overwrite it.
[0160]
Furthermore, in the present embodiment, the correction process is performed only once on the distance image after the stereo process, but the correction process is further performed on the distance image that has been subjected to the correction process. It is also possible.
[0161]
【The invention's effect】
The image processing apparatus according to claim 1 and Claim 9 Image processing method according to claim 1, and Claim 10 According to the recording medium described in the above, the corresponding pixel of the second image corresponding to the pixel of the first image is detected, and the distance relation information is obtained for the pixel of the first image based on the corresponding pixel. . further, I was asked Pixel of distance relation information image having distance relation information as pixel value Among these, pixels whose certainty is less than or equal to certain that the pixel detected as the corresponding pixel is a true corresponding point, Correction target pixel for correcting distance-related information As Selected Among the distance-related images, a predetermined area including the selected correction target pixel is used as a search block, and a plurality of pixels in the search block are searched for pixels that satisfy certain conditions. The distance relationship information about the correction target pixel By substituting the distance relation information about the searched pixel, the distance relation information about the correction target pixel is obtained. It is corrected. Therefore, even when the pixel correspondence between the first and second images cannot be accurately performed, it is possible to obtain highly accurate distance relationship information.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration example of an embodiment of a distance measuring device to which the present invention is applied.
FIG. 2 is a diagram illustrating a state in which an object 3 is being photographed by a reference camera 1 and a detection camera 1;
FIG. 3 is a diagram for explaining epipolar lines.
FIG. 4 is a diagram illustrating a reference camera image and a detection camera image.
FIG. 5 is a diagram showing transition of evaluation values.
FIG. 6 is a diagram illustrating a set point / distance table and a parallax / distance table.
FIG. 7 is a diagram illustrating a state in which an object 3 placed in front of a wall is being photographed.
FIG. 8 is a diagram for explaining erroneous detection of corresponding points occurring in an edge portion.
FIG. 9 is a diagram for explaining a method of correcting an error in distance caused by erroneous detection of corresponding points.
10 is a block diagram illustrating a functional configuration example of an arithmetic processing circuit 6 in FIG. 1;
FIG. 11 is a flowchart for explaining stereo processing;
FIG. 12 is a flowchart for explaining a first embodiment of correction processing;
FIG. 13 is a diagram for explaining a case where continuity of distance is lost.
FIG. 14 is a flowchart for explaining a second embodiment of correction processing;
FIG. 15 is a flowchart for explaining a third embodiment of a correction process;
FIG. 16 is a flowchart for explaining a fourth embodiment of correction processing;
FIG. 17 is a flowchart for explaining a fifth embodiment of a correction process;
[Explanation of symbols]
DESCRIPTION OF SYMBOLS 1 Reference camera (imaging means), 2 Detection camera (imaging means), 3 Object, 4 Camera interface, 5 Frame memory, 6 Arithmetic processing circuit, 6A CPU, 6B ROM, 6C RAM, 6D DSP, 7 Storage device, 8 Output device 11 Stereo processing unit (detection unit) (processing unit) 12 Distance image storage unit 13 Correction target pixel selection unit (selection unit) 14 Correction unit (correction unit) 15 Distance image storage unit

Claims (10)

所定の対象物を撮影した第1および第2の画像に基づいて、前記対象物までの距離に関係する距離関係情報を求める画像処理装置であって、
前記第1の画像の画素と対応する、前記第2の画像の対応画素を検出する検出手段と、
前記検出手段により検出された前記対応画素に基づき、前記第1の画像の画素について、前記距離関係情報を求める処理手段と、
前記処理手段により求められた前記距離関係情報を画素値とする距離関係情報画像の画素のうち、前記検出手段により対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、前記距離関係情報の補正を行う対象とする補正対象画素として選択する選択手段と、
前記距離関係画像のうち、前記選択手段により選択された前記補正対象画素を含む所定の領域を検索ブロックとして、前記検索ブロック内の複数の画素の中から、前記確実性が所定の条件を満たす画素を検索し、前記補正対象画素についての前記距離関係情報を、検索された前記画素についての前記距離関係情報に置換することにより、前記補正対象画素についての前記距離関係情報を補正する補正手段と
を備える画像処理装置。
An image processing apparatus that obtains distance relationship information related to a distance to the object based on first and second images obtained by photographing a predetermined object,
Detecting means for detecting corresponding pixels of the second image corresponding to the pixels of the first image;
Processing means for obtaining the distance relation information for the pixels of the first image based on the corresponding pixels detected by the detection means ;
Among the pixels of the distance relation information image having the distance relation information obtained by the processing means as a pixel value, pixels whose certainty that the pixels detected as the corresponding pixels by the detection means are true corresponding points are below a certain level a selecting means for selecting as the correction target pixel to be subjected to the correction of the distance-related information,
Among the plurality of pixels in the search block, the certainty condition satisfying a predetermined condition among the plurality of pixels in the search block, with a predetermined area including the correction target pixel selected by the selection unit as the search block. And correcting the distance relationship information for the correction target pixel by replacing the distance relationship information for the correction target pixel with the distance relationship information for the searched pixel. comprising Ru images processing device.
前記処理手段は、前記第1の画像の画素とその対応画素との間の視差を、前記距離関係情報として求める
求項1に記載の画像処理装置。
The processing means obtains a parallax between a pixel of the first image and its corresponding pixel as the distance relation information.
The image processing apparatus according to Motomeko 1.
前記検出手段は、前記第1および第2の画像の画素の画素値を用いて、所定の評価関数を演算し、その演算結果に基づいて、前記対応画素を検出し、
前記選択手段は、前記所定の評価関数の演算結果に基づいて、前記確実性を評価する
求項1に記載の画像処理装置。
The detection means calculates a predetermined evaluation function using pixel values of the pixels of the first and second images, detects the corresponding pixel based on the calculation result ,
The selection means evaluates the certainty based on a calculation result of the predetermined evaluation function.
The image processing apparatus according to Motomeko 1.
前記選択手段は、前記第1の画像の画素の画素値に基づいて、前記補正対象画素を選択する
求項1に記載の画像処理装置。
The selection unit selects the correction target pixel based on a pixel value of a pixel of the first image.
The image processing apparatus according to Motomeko 1.
前記補正手段は、前記検索ブロック内の画素のうち、最外周に位置する画素を検索の対象とする
請求項1に記載の画像処理装置。
Said correction means, among the pixels of the search block, the target of the search pixels located at the outermost periphery
The image processing apparatus according to claim 1 .
前記検出手段は、前記第1の画像の画素の画素値と、その画素に対応する可能性のある前記第2の画像の画素群それぞれの画素値とについて、所定の評価関数をそれぞれ演算し、その演算結果に基づき、前記第2の画像の画素群の中から、前記対応画素を検出する
請求項1に記載の画像処理装置。
It said detecting means includes a pixel value of the pixel of the first image, for a respective pixel groups of pixel values of the second image that might correspond to the pixel, and calculating respective predetermined evaluation function, based on the calculation result, from among the pixel groups of the second image to detect the corresponding pixel
The image processing apparatus according to claim 1 .
前記検出手段は、前記第1の画像の画素を含む第1の画素ブロックと、その画素に対応する可能性のある前記第2の画像の画素群それぞれの画素を含む第2の画素ブロックとを用いて、所定の評価関数をそれぞれ演算し、その演算結果に基づいて、前記第2の画像の画素群の中から、前記対応画素を検出し、
前記補正手段により利用される前記所定の条件として、前記検索ブロックの中で前記確実性が最も高いという条件が採用されている
請求項1に記載の画像処理装置。
The detection means includes a first pixel block including a pixel of the first image and a second pixel block including a pixel of each pixel group of the second image that may correspond to the pixel. using calculates respective predetermined evaluation function, based on the calculation result, from among the pixel groups of the second image, and detecting the corresponding pixels,
As the predetermined condition used by the correction means, a condition that the certainty is the highest in the search block is adopted.
The image processing apparatus according to claim 1 .
前記所定の対象物を撮影し、前記第1および第2の画像を出力する撮像手段をさらに備える
求項1に記載の画像処理装置。
The image processing apparatus further includes imaging means for photographing the predetermined object and outputting the first and second images.
The image processing apparatus according to Motomeko 1.
所定の対象物を撮影した第1および第2の画像に基づいて、前記対象物までの距離に関係する距離関係情報を求める画像処理方法であって、
前記第1の画像の画素と対応する、前記第2の画像の対応画素を検出する検出ステップと、
前記検出ステップの処理により検出された前記対応画素に基づき、前記第1の画像の画素について、前記距離関係情報を求める処理ステップと、
前記処理ステップの処理により求められた前記距離関係情報を画素値とする距離関係情報画像の画素のうち、前記検出ステップの処理により対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、前記距離関係情報の補正を行う対象とする補正対象画素として選択する選択ステップと、
前記距離関係画像のうち、前記選択ステップの処理により選択された前記補正対象画素を含む所定の領域を検索ブロックとして、前記検索ブロック内の複数の画素の中から、前記確実性が所定の条件を満たす画素を検索し、前記補正対象画素についての前記距離関係情報を、検索された前記画素についての前記距離関係情報に置換することにより、前記補正対象画素についての前記距離関係情報を補正する補正ステップと
を含む画像処理方法。
An image processing method for obtaining distance relation information related to a distance to the object based on first and second images obtained by photographing a predetermined object,
Detecting a corresponding pixel of the second image corresponding to a pixel of the first image;
A process step of obtaining the distance relationship information for the pixels of the first image based on the corresponding pixels detected by the process of the detection step;
Among the pixels of the distance relationship information image having the distance relationship information obtained by the processing step as a pixel value, there is a certainty that the pixel detected as the corresponding pixel by the processing of the detection step is a true corresponding point. A selection step of selecting a certain pixel or less as a correction target pixel to be subjected to correction of the distance relation information;
Among the distance-related images, a predetermined region including the correction target pixel selected by the processing of the selection step is used as a search block, and the certainty is determined from a plurality of pixels in the search block. A correction step of searching for a pixel that satisfies, and correcting the distance relationship information for the correction target pixel by replacing the distance relationship information for the correction target pixel with the distance relationship information for the searched pixel. When
Images processing method comprising.
所定の対象物を撮影した第1および第2の画像に基づいて、前記対象物までの距離に関係する距離関係情報を求める処理を、コンピュータに行わせるためのプログラムが記録されているコンピュータ読み取り可能な記録媒体であって、
前記第1の画像の画素と対応する、前記第2の画像の対応画素を検出する検出ステップと、
前記検出ステップの処理により検出された前記対応画素に基づき、前記第1の画像の画素について、前記距離関係情報を求める処理ステップと、
前記処理ステップの処理により求められた前記距離関係情報を画素値とする距離関係情報画像の画素のうち、前記検出ステップの処理により対応画素として検出された画素が真の対応点である確実性が一定以下の画素を、前記距離関係情報の補正を行う対象とする補正対象画素として選択する選択ステップと、
前記距離関係画像のうち、前記選択ステップの処理により選択された前記補正対象画素を含む所定の領域を検索ブロックとして、前記検索ブロック内の複数の画素の中から、前記確実性が所定の条件を満たす画素を検索し、前記補正対象画素についての前記距離関係情報を、検索された前記画素についての前記距離関係情報に置換することにより、前記補正対象画素についての前記距離関係情報を補正する補正ステップと
を含むプログラムが記録されている
コンピュータ読み取り可能な記録媒体。
A computer-readable recording medium storing a program for causing a computer to perform processing for obtaining distance relation information related to the distance to the object based on the first and second images obtained by photographing a predetermined object. Recording medium,
Detecting a corresponding pixel of the second image corresponding to a pixel of the first image;
A process step of obtaining the distance relationship information for the pixels of the first image based on the corresponding pixels detected by the process of the detection step;
Among the pixels of the distance relationship information image having the distance relationship information obtained by the processing step as a pixel value, there is a certainty that the pixel detected as the corresponding pixel by the processing of the detection step is a true corresponding point. A selection step of selecting a certain pixel or less as a correction target pixel to be subjected to correction of the distance relation information;
Among the distance-related images, a predetermined region including the correction target pixel selected by the processing of the selection step is used as a search block, and the certainty is determined from a plurality of pixels in the search block. A correction step of searching for a pixel that satisfies, and correcting the distance relationship information for the correction target pixel by replacing the distance relationship information for the correction target pixel with the distance relationship information for the searched pixel. When
A computer-readable recording medium in which programs are recorded, including a.
JP29321298A 1998-10-15 1998-10-15 Image processing apparatus, image processing method, and recording medium Expired - Fee Related JP4296617B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP29321298A JP4296617B2 (en) 1998-10-15 1998-10-15 Image processing apparatus, image processing method, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP29321298A JP4296617B2 (en) 1998-10-15 1998-10-15 Image processing apparatus, image processing method, and recording medium

Publications (3)

Publication Number Publication Date
JP2000121319A JP2000121319A (en) 2000-04-28
JP2000121319A5 JP2000121319A5 (en) 2005-12-02
JP4296617B2 true JP4296617B2 (en) 2009-07-15

Family

ID=17791884

Family Applications (1)

Application Number Title Priority Date Filing Date
JP29321298A Expired - Fee Related JP4296617B2 (en) 1998-10-15 1998-10-15 Image processing apparatus, image processing method, and recording medium

Country Status (1)

Country Link
JP (1) JP4296617B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2539804C2 (en) * 2010-09-14 2015-01-27 Рикох Компани, Лтд. Stereo camera device, correction method and programme

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2008053649A1 (en) * 2006-11-02 2010-02-25 コニカミノルタホールディングス株式会社 Wide-angle image acquisition method and wide-angle stereo camera device
JP4752918B2 (en) * 2009-01-16 2011-08-17 カシオ計算機株式会社 Image processing apparatus, image collation method, and program
JP5252642B2 (en) * 2009-04-13 2013-07-31 独立行政法人情報通信研究機構 Depth estimation apparatus, depth estimation method, and depth estimation program
JP5533529B2 (en) * 2010-10-06 2014-06-25 コニカミノルタ株式会社 Image processing apparatus and image processing system
JP5713350B2 (en) * 2011-10-25 2015-05-07 日本電信電話株式会社 Image processing apparatus, method, and program
JP5747797B2 (en) * 2011-11-29 2015-07-15 コニカミノルタ株式会社 Image processing apparatus, image processing method, and image processing program
JP5818773B2 (en) * 2012-11-22 2015-11-18 キヤノン株式会社 Image processing apparatus, image processing method, and program
JP6175878B2 (en) * 2013-04-25 2017-08-09 富士通株式会社 Image processing circuit, image processing apparatus, and image processing method
JP5980294B2 (en) * 2014-10-27 2016-08-31 キヤノン株式会社 Data processing apparatus, imaging apparatus, and data processing method
WO2017145945A1 (en) * 2016-02-25 2017-08-31 京セラ株式会社 Stereo camera device, vehicle and disparity calculation method
EP3358844A1 (en) * 2017-02-07 2018-08-08 Koninklijke Philips N.V. Method and apparatus for processing an image property map
JP7042185B2 (en) * 2018-07-27 2022-03-25 日立Astemo株式会社 Distance calculation device
JP7269130B2 (en) * 2019-08-14 2023-05-08 日立Astemo株式会社 Image processing device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2539804C2 (en) * 2010-09-14 2015-01-27 Рикох Компани, Лтд. Stereo camera device, correction method and programme

Also Published As

Publication number Publication date
JP2000121319A (en) 2000-04-28

Similar Documents

Publication Publication Date Title
US9070042B2 (en) Image processing apparatus, image processing method, and program thereof
US6671399B1 (en) Fast epipolar line adjustment of stereo pairs
US6865289B1 (en) Detection and removal of image occlusion errors
US20210232845A1 (en) Information processing apparatus, information processing method, and storage medium
JP4296617B2 (en) Image processing apparatus, image processing method, and recording medium
US10659762B2 (en) Stereo camera
CN102714697A (en) Image processing device, image processing method, and program for image processing
JP2010041419A (en) Image processor, image processing program, image processing method, and electronic apparatus
WO2007052191A2 (en) Filling in depth results
US11928805B2 (en) Information processing apparatus, information processing method, and storage medium for defect inspection and detection
US6519358B1 (en) Parallax calculating apparatus, distance calculating apparatus, methods of the same, and information providing media
JP4394487B2 (en) Stereo image processing device
KR20120138642A (en) Image processing method and image processing apparatus
CN110120012A (en) The video-splicing method that sync key frame based on binocular camera extracts
JPH10240934A (en) Object extractor
CN113793266A (en) Multi-view machine vision image splicing method, system and storage medium
JP6395429B2 (en) Image processing apparatus, control method thereof, and storage medium
CN110717910B (en) CT image target detection method based on convolutional neural network and CT scanner
JPH07103734A (en) Apparatus for searching stereocorrespondence
US9380285B2 (en) Stereo image processing method, stereo image processing device and display device
CN114283081B (en) Depth recovery method based on pyramid acceleration, electronic device and storage medium
JP2981382B2 (en) Pattern matching method
JP4018950B2 (en) Stereo camera misalignment inspection apparatus and misalignment inspection method
JP4468019B2 (en) Image processing device
CN113313707A (en) Original image processing method, device, equipment and readable storage medium

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051012

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20051012

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20081216

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090204

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

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

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

Free format text: PAYMENT UNTIL: 20120424

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees