JP2009238076A - Image processor, image processing method, and program - Google Patents

Image processor, image processing method, and program Download PDF

Info

Publication number
JP2009238076A
JP2009238076A JP2008085448A JP2008085448A JP2009238076A JP 2009238076 A JP2009238076 A JP 2009238076A JP 2008085448 A JP2008085448 A JP 2008085448A JP 2008085448 A JP2008085448 A JP 2008085448A JP 2009238076 A JP2009238076 A JP 2009238076A
Authority
JP
Japan
Prior art keywords
image
distance
image data
gray
processing apparatus
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.)
Withdrawn
Application number
JP2008085448A
Other languages
Japanese (ja)
Inventor
Tomonori Masuda
智紀 増田
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.)
Fujifilm Corp
Original Assignee
Fujifilm 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 Fujifilm Corp filed Critical Fujifilm Corp
Priority to JP2008085448A priority Critical patent/JP2009238076A/en
Publication of JP2009238076A publication Critical patent/JP2009238076A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Measurement Of Optical Distance (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To acquire highly precise distance data from a color image in an image processor. <P>SOLUTION: In this image processor for generating stereo image data by calculating a distance from a pair of image data obtained by photographing an object from two points of view, each of which is configured of grey level images with a plurality of colors, to an object, a pair of image data are input, and distance calculation is carried out about a plurality of pixels with a plurality of colors of the input pair of image data, and the grey level image with one color which is the most suitable for distance calculation is selected from among the grey level images with a plurality of colors configuring the image data in at least one image data of the input pair of image data, and distance data calculated in the grey level image with the selected color are recorded. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、被写体を2つの視点から撮像して得た一対の画像データから立体画像データを生成する画像処理装置に関し、特に一対の画像データがカラー画像であるときの画像処理方法に関するものである。   The present invention relates to an image processing apparatus that generates stereoscopic image data from a pair of image data obtained by imaging a subject from two viewpoints, and more particularly to an image processing method when the pair of image data is a color image. .

近年、被写体を2つの視点から撮像して得た一対の画像データから立体画像データを生成する画像処理装置が提案されており、立体画像データの生成方法としては、取得された一対の画像データにおいて共通して写っている点、いわゆる対応点を特定し、三角測量の原理に従って対応点までの距離を算出することにより、被写体の三次元形状を推測するステレオマッチング法を用いる方法が知られている。   In recent years, there has been proposed an image processing apparatus that generates stereoscopic image data from a pair of image data obtained by imaging a subject from two viewpoints. As a method of generating stereoscopic image data, A method is known that uses a stereo matching method that estimates a three-dimensional shape of a subject by identifying points that are commonly captured, so-called corresponding points, and calculating the distance to the corresponding point according to the principle of triangulation. .

このようなステレオマッチング法を用いた画像処理装置では、一対の画像データとしてそれぞれ複数の色の濃淡画像で構成されたカラー画像を使用し、同色の濃淡画像においてそれぞれ上記ステレオマッチングを行うことにより各々の色での視差を算出して、画像領域毎に対象物の色に基づいた積和演算によって融合処理を行い、統一視差を算出することにより信頼性の高い立体画像データを算出するようにしたものがある(特許文献1)。
特開2003−150936号公報
In such an image processing apparatus using a stereo matching method, a color image composed of a plurality of gray images is used as a pair of image data, and the above stereo matching is performed on each of the same color gray images, respectively. The parallax with the color of the image is calculated, the fusion process is performed by the product-sum operation based on the color of the object for each image area, and the stereoscopic image data with high reliability is calculated by calculating the unified parallax. There is a thing (patent document 1).
JP 2003-150936 A

通常、濃淡画像において特徴的なパターンが少ない場合等には、対応点を誤検出してしまう虞があり、誤った距離が算出されてしまう場合がある。この場合、特許文献1に記載の画像処理装置においては、誤って算出されたデータも融合処理に使用されてしまうため、精度が低減してしまう虞がある。   Usually, when there are few characteristic patterns in a grayscale image, there is a possibility that corresponding points may be erroneously detected, and an incorrect distance may be calculated. In this case, in the image processing apparatus described in Patent Document 1, erroneously calculated data is also used for the fusion process, and thus the accuracy may be reduced.

本発明はかかる事情に鑑みてなされたものであり、カラー画像から精度の高い距離データを取得することができる画像処理装置及び画像処理方法並びにプログラムを提供することを目的とするものである。   The present invention has been made in view of such circumstances, and an object of the present invention is to provide an image processing apparatus, an image processing method, and a program capable of acquiring highly accurate distance data from a color image.

本発明の画像処理装置は、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理装置において、
前記一対の画像データを入力する画像入力手段と、
入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出する距離算出手段と、
入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちから最も前記距離算出に適する1つの色の濃淡画像を選択する選択手段と、
該選択手段により選択された色の濃淡画像において前記距離算出手段が算出した前記距離のデータを記録する記録手段とを備えてなることを特徴とするものである。
The image processing apparatus according to the present invention calculates the distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each composed of a plurality of gray images, and obtains stereoscopic image data. In the image processing device to be generated,
Image input means for inputting the pair of image data;
Distance calculating means for calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
Selecting means for selecting, in at least one of the input image data of the pair of image data, a gray image of one color most suitable for the distance calculation from the gray images of the plurality of colors constituting the image data; ,
And a recording unit that records data of the distance calculated by the distance calculating unit in the grayscale image of the color selected by the selecting unit.

本発明の画像処理装置は、前記選択手段が、前記複数の色の濃淡画像においてそれぞれ最大輝度値と最小輝度値との輝度差の値を算出し、該算出された前記輝度差の値が最も大きい濃淡画像を選択することができる。   In the image processing apparatus of the present invention, the selection unit calculates a value of a luminance difference between a maximum luminance value and a minimum luminance value in each of the grayscale images of the plurality of colors, and the calculated luminance difference value is the largest. A large gray image can be selected.

本発明の画像処理装置は、前記選択手段が、前記複数の色の濃淡画像においてそれぞれ予め所定間隔で定められた輝度値を有する画素の数を算出し、該算出された前記画素の数が最も多い濃淡画像を選択することができる。   In the image processing apparatus of the present invention, the selection unit calculates the number of pixels each having a predetermined luminance value at a predetermined interval in the grayscale images of the plurality of colors, and the calculated number of pixels is the largest. Many gray images can be selected.

本発明の画像処理装置は、前記選択手段が、前記複数の色の濃淡画像においてそれぞれエッジを抽出し、エッジが抽出された画素の数を算出して、該算出された前記画素の数が最も多い濃淡画像を選択することができる。   In the image processing apparatus of the present invention, the selection unit extracts edges in the grayscale images of the plurality of colors, calculates the number of pixels from which the edges are extracted, and the calculated number of pixels is the largest. Many gray images can be selected.

なお本発明の画像処理装置は、前記選択手段が、所定間隔毎の画素列において前記画素の数を算出するものであってもよい。   In the image processing apparatus of the present invention, the selection unit may calculate the number of pixels in a pixel row at every predetermined interval.

本発明の画像処理装置は、前記選択手段が、前記複数の色の濃淡画像においてそれぞれエッジを抽出し、所定間隔毎の画素列と前記エッジとが交差する回数を算出し、算出された前記回数が最も多い濃淡画像を選択することができる。   In the image processing apparatus of the present invention, the selection unit extracts edges in the grayscale images of the plurality of colors, calculates the number of times that the edge intersects the pixel column at predetermined intervals, and the calculated number of times The grayscale image with the largest number can be selected.

本発明の画像処理装置は、前記画像入力手段が、2つのカメラからなるものであってもよい。   In the image processing apparatus of the present invention, the image input means may be composed of two cameras.

本発明の画像処理装置は、前記画像入力手段が、2つの光学系を備えた複眼カメラであってもよい。   In the image processing apparatus of the present invention, the image input means may be a compound eye camera including two optical systems.

この場合、前記複眼カメラが、多板構成からなる撮像系を備えたものであることが好ましい。なおここで「多板構成」とは複数の光学系を持ち、その各々の光軸に対応した複数の撮像素子を配置しそれらの出力信号を用いて信号処理を行い、最終的に1つの撮像出力信号を得る構成を意味する。   In this case, it is preferable that the compound-eye camera is provided with an imaging system having a multi-plate configuration. Here, “multi-plate configuration” has a plurality of optical systems, a plurality of imaging elements corresponding to the respective optical axes are arranged, signal processing is performed using those output signals, and finally one imaging This means a configuration for obtaining an output signal.

本発明の画像処理方法は、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理方法において、
前記一対の画像データを入力し、
該入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出し、
前記入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちから最も前記距離算出に適する1つの色の濃淡画像を選択し、
該選択された色の濃淡画像において算出された前記距離のデータを記録することを特徴とするものである。
According to the image processing method of the present invention, stereoscopic image data is obtained by calculating the distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each composed of a plurality of gray images. In the image processing method to be generated,
Input the pair of image data,
Calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
In at least one image data of the pair of input image data, a gray image of one color most suitable for the distance calculation is selected from the gray images of the plurality of colors constituting the image data,
The distance data calculated in the grayscale image of the selected color is recorded.

本発明の画像処理プログラムは、コンピュータに、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成することを実行させるための画像処理プログラムにおいて、
前記一対の画像データを入力し、
該入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出し、
前記入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちから最も前記距離算出に適する1つの色の濃淡画像を選択し、
該選択された色の濃淡画像において算出された前記距離のデータを記録することを実行させるためのものである。
The image processing program according to the present invention calculates a distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each of which is composed of a plurality of gray-scale images. In an image processing program for executing generation of image data,
Input the pair of image data,
Calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
In at least one image data of the pair of input image data, a gray image of one color most suitable for the distance calculation is selected from the gray images of the plurality of colors constituting the image data,
This is for causing the data of the distance calculated in the gray image of the selected color to be recorded.

本発明の画像処理装置及び画像処理方法並びにプログラムによれば、一対の画像データを入力し、入力された一対の画像データの複数の色の複数の画素について距離を算出し、入力された一対の画像データの少なくとも一方の画像データにおいて、画像データを構成する複数の色の濃淡画像のうちから最も距離の算出に適する1つの色の濃淡画像を選択し、選択された色の濃淡画像において算出された距離のデータを記録するので、最も距離の算出に適する1つの色の画像データから算出された距離データが記録されることにより精度の高い距離データを取得することができる。   According to the image processing apparatus, the image processing method, and the program of the present invention, a pair of image data is input, distances are calculated for a plurality of pixels of a plurality of colors in the pair of input image data, In at least one of the image data, a gray image of one color that is most suitable for calculating the distance is selected from a plurality of gray images constituting the image data, and is calculated in the gray image of the selected color. Since the distance data is recorded, the distance data calculated from the image data of one color most suitable for the distance calculation is recorded, so that the distance data with high accuracy can be acquired.

以下、本発明の実施形態について図面を参照して詳細に説明する。図1は第一の実施形態である画像処理装置1の機能構成を示すブロック図である。本実施形態の画像処理装置1は、図1に示す如く、画像入力部(画像入力手段)10、操作部11、表示制御部12、モニタ13、読込部14、画像選択部(選択手段)15、距離算出部(距離算出手段)16、データ圧縮部17、メディア制御部18、記録メディア(記録手段)19、内部メモリ20等を備えており、これらはデータバス21を介して、各種信号、データの送受信を行う。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. FIG. 1 is a block diagram illustrating a functional configuration of an image processing apparatus 1 according to the first embodiment. As shown in FIG. 1, the image processing apparatus 1 according to the present embodiment includes an image input unit (image input unit) 10, an operation unit 11, a display control unit 12, a monitor 13, a reading unit 14, and an image selection unit (selection unit) 15. , A distance calculation unit (distance calculation unit) 16, a data compression unit 17, a media control unit 18, a recording medium (recording unit) 19, an internal memory 20, and the like. Send and receive data.

画像入力部10は、画像を入力するものであり、被写体を異なる2つの視点から撮像して得た、各々がR、G、Bの色の濃淡画像で構成されたカラー画像の基準画像Aと参照画像Bからなる一対の画像データが入力される。なお一対の画像データにおいては、どちらの画像データを基準画像Aとしてもよい。また本実施形態では入力される画像データを2つとしたが、異なる視点から撮像された、いわゆる視差画像のデータであれば3つや4つ等の複数の画像データを入力してもよい。この場合、複数の画像データのうち、一つの画像データを基準画像Aとし、その他の画像データを参照画像Bとする。   The image input unit 10 inputs an image, and is obtained by imaging a subject from two different viewpoints, each of which is a reference image A of a color image composed of grayscale images of R, G, and B colors. A pair of image data consisting of the reference image B is input. In the pair of image data, either image data may be used as the reference image A. In the present embodiment, two pieces of image data are input, but a plurality of pieces of image data such as three or four pieces may be input as long as the data is so-called parallax images captured from different viewpoints. In this case, of the plurality of image data, one image data is set as the standard image A, and the other image data is set as the reference image B.

操作部11は、動作モードスイッチ、メニュー/OKボタン、上下レバー、左右ボタン、Back(戻り)ボタン、表示切替ボタン、レリーズボタン、電源スイッチ等で構成されるものであり、ユーザがこれらを操作することにより各種設定を行う。   The operation unit 11 includes an operation mode switch, a menu / OK button, an up / down lever, a left / right button, a back button, a display switching button, a release button, a power switch, and the like. Make various settings.

表示制御部12は、画像入力部10により入力された画像をモニタ13に表示させる他に、後述の距離算出部16により算出された被写体各部までの距離データつまり奥行きデータに基づいて生成された被写体の立体画像をモニタ13に表示することができる。また表示制御部12は、後述の記録メディア19に記録され、メディア制御部18によって読み出された立体画像データに基づく立体画像をモニタ13に表示させる。   The display control unit 12 displays the image input by the image input unit 10 on the monitor 13, and also generates a subject generated based on distance data to each part calculated by the distance calculation unit 16 described later, that is, depth data. 3D images can be displayed on the monitor 13. Further, the display control unit 12 causes the monitor 13 to display a stereoscopic image based on the stereoscopic image data recorded on a recording medium 19 described later and read out by the media control unit 18.

モニタ13は、表示制御部12を介して平面画像又は立体画像を表示するものであり、操作部11によって設定操作される各種設定メニュー等も表示する。   The monitor 13 displays a planar image or a stereoscopic image via the display control unit 12, and also displays various setting menus that are set and operated by the operation unit 11.

読込部14は、画像入力部10により入力された画像データを構成するR、G、Bの3つの色の濃淡画像を読み込み、全ての画素の画素値を読み出す。そして読み出された画素値に基づいて公知の変換処理を行うことにより全ての画素について輝度値等の情報を取得する。なお本実施形態では輝度値は、読み出された画素値から算出するものとしたが、本発明はこれに限られるものではなく、画素値をそのまま輝度値として使用することもできる。   The reading unit 14 reads the grayscale images of the three colors R, G, and B constituting the image data input by the image input unit 10 and reads the pixel values of all the pixels. Information such as luminance values is acquired for all pixels by performing a known conversion process based on the read pixel values. In the present embodiment, the luminance value is calculated from the read pixel value. However, the present invention is not limited to this, and the pixel value can be used as the luminance value as it is.

画像選択部15は、読込部14によって読み込まれた一対の画像データの基準画像Aにおいて、基準画像Aを構成するR、G、Bの3つの色の濃淡画像Ar、Ag、Abのうちから後述の距離算出部16による距離の算出に最も適する1つの色の濃淡画像を選択するものである。なおこの画像選択部15による濃淡画像の選択方法については後で詳細に説明する。   In the reference image A of the pair of image data read by the reading unit 14, the image selection unit 15 will be described later from among the three gray-scale images Ar, Ag, and Ab of R, G, and B constituting the reference image A. The gray image of one color most suitable for the calculation of the distance by the distance calculation unit 16 is selected. Note that the method of selecting a grayscale image by the image selection unit 15 will be described in detail later.

距離算出部16は、画像選択部15により選択された色の濃淡画像と、この濃淡画像に対応する色の参照画像の濃淡画像とから、すなわち選択された色の一対の濃淡画像から被写体各部までの距離を算出するものであり、公知のステレオマッチング法を使用することができて、一対の濃淡画像においてエッジやセグメント等、共通して写っている点、いわゆる対応点を相関演算によって特定し、この対応点の位置情報から視差を求め、この視差に基づいて三角測量の原理に従って対応点までの距離すなわち被写体各部までの距離を算出する。   The distance calculation unit 16 includes a grayscale image of the color selected by the image selection unit 15 and a grayscale image of a reference image of a color corresponding to the grayscale image, that is, from a pair of grayscale images of the selected color to each part of the subject. The known stereo matching method can be used, and a point that is commonly captured, such as an edge or a segment in a pair of gray images, so-called corresponding points are specified by correlation calculation, The parallax is obtained from the position information of the corresponding point, and the distance to the corresponding point, that is, the distance to each part of the subject is calculated based on the parallax based on the principle of triangulation.

このとき対応点の検出は、基準画像Aから複数の画素で構成された画素ブロックWaを算出し、算出された画素ブロックWaを参照画像B中で走査して濃淡等の形状パターンの一致度評価値(相関度)を計算して、参照画像Bにおいて画素ブロックWaと対応するブロックWbを検出する、いわゆる領域ベースマッチング(area-based matching)といわれる方法や、先に基準画像A及び参照画像Bからエッジやセグメント等の特徴点を見つけ出し、基準画像Aと参照画像Bにおけるこの特徴点の相関度から対応点を検出する、いわゆる特徴ベースマッチング(feature-based matching)といわれる方法等を使用することができる。一致度評価値(相関度)の計算は、例えば各画素の差の絶対値を合計する、または各画素の差を2乗したものを合計するなど、公知の技術を使用することができる。   At this time, the corresponding points are detected by calculating a pixel block Wa composed of a plurality of pixels from the standard image A, scanning the calculated pixel block Wa in the reference image B, and evaluating the degree of coincidence of shape patterns such as shading. A value (correlation degree) is calculated to detect a block Wb corresponding to the pixel block Wa in the reference image B, so-called area-based matching, or the reference image A and the reference image B first. A feature point such as a feature-based matching is used, in which feature points such as edges and segments are found from the image, and corresponding points are detected from the degree of correlation between the feature points in the base image A and the reference image B. Can do. For calculating the coincidence degree evaluation value (correlation degree), for example, a known technique such as summing absolute values of differences of pixels or summing squares of differences of pixels can be used.

このように距離算出部16は、選択された1つの色の一対の濃淡画像についてのみ距離の算出を行うので、距離の算出に要する時間を低減することができる。   As described above, the distance calculation unit 16 calculates the distance only for the pair of gray images of one selected color, so that the time required for calculating the distance can be reduced.

データ圧縮部17は、算出された距離データを圧縮処理するものであり、圧縮された距離データはメディア制御部18を介して記録メディア19に記録される。   The data compression unit 17 compresses the calculated distance data, and the compressed distance data is recorded on the recording medium 19 via the media control unit 18.

メディア制御部18は、記録メディア19に記憶された距離データ等の読み出し、又は距離データ等の書き込みを行う。   The media control unit 18 reads the distance data stored in the recording medium 19 or writes the distance data.

記録メディア(記録手段)19は、距離データ等の各種データを記憶可能な記録媒体であり、磁気的又は光学的記録媒体、半導体メモリ等によって構成されている。   The recording medium (recording means) 19 is a recording medium capable of storing various data such as distance data, and is configured by a magnetic or optical recording medium, a semiconductor memory, or the like.

内部メモリ20は、画像処理装置1において設定される各種定数やプログラム等を格納するものであって、画像入力部10により入力された画像データや距離算出部16により算出された距離データ等を記憶するバッファメモリとしても機能する。   The internal memory 20 stores various constants and programs set in the image processing apparatus 1, and stores image data input by the image input unit 10, distance data calculated by the distance calculation unit 16, and the like. It also functions as a buffer memory.

本実施形態の画像処理装置1は上記のように構成されている。次に画像処理装置1による画像処理について説明する。図2は画像処理装置1による一連の画像処理のフローチャート、図3は画像選択部15による画像選択処理のフローチャートである。   The image processing apparatus 1 according to the present embodiment is configured as described above. Next, image processing by the image processing apparatus 1 will be described. FIG. 2 is a flowchart of a series of image processing performed by the image processing apparatus 1, and FIG. 3 is a flowchart of image selection processing performed by the image selection unit 15.

本実施形態の画像処理装置1は、図2に示す如く、画像入力部10が一対の画像データすなわち基準画像Aと参照画像Bを入力し(ステップS1)、読込部14が基準画像Aを構成するRの濃淡画像Ar、Gの濃淡画像Ag、Bの濃淡画像Ab及び画像データBを構成するRの濃淡画像Br、Gの濃淡画像Bg、Bの濃淡画像Bbをそれぞれ読み込んで、輝度値等の画素値を読み出す(ステップS2)。   In the image processing apparatus 1 of the present embodiment, as shown in FIG. 2, the image input unit 10 inputs a pair of image data, that is, the standard image A and the reference image B (step S1), and the reading unit 14 configures the standard image A. R gradation image Ar, G gradation image Ag, B gradation image Ab, R gradation image Br, G gradation image Bg, and B gradation image Bb constituting image data B are read respectively, and brightness values, etc. Are read out (step S2).

次に画像選択部15が、読込部14によって読み込まれた基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abのうちから距離算出部16による距離の算出に最も適する1つの色の濃淡画像を選択する画像選択処理を行う(ステップS3)。   Next, the image selection unit 15 is one of the most suitable for the calculation of the distance by the distance calculation unit 16 from among the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A read by the reading unit 14. An image selection process for selecting a color shading image is performed (step S3).

画像選択部15による画像選択処理1は、図3に示す如く、基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれについて最小輝度値と最大輝度値を算出し(ステップS11)、最小輝度値と最大輝度値との輝度差の値Dr、Dg、Dbをそれぞれ算出する(ステップS12)。   In the image selection processing 1 by the image selection unit 15, as shown in FIG. 3, the minimum luminance value and the maximum luminance value are calculated for each of the R, G, and B gray images Ar, Ag, and Ab constituting the reference image A (step S11), values of brightness differences Dr, Dg, and Db between the minimum brightness value and the maximum brightness value are calculated (step S12).

次に画像選択部15は、算出された輝度差の値が最も大きい値のものを判別する(ステップS13)。そして画像選択部15は、最も大きい値が輝度差Drである場合(ステップS13;Dr)にはRの濃淡画像Arを選択し(ステップS14)、最も大きい値が輝度差Dgである場合(ステップS13;Dg)にはGの濃淡画像Agを選択し(ステップS15)、最も大きい値が輝度差Dbである場合(ステップS13;Db)にはBの濃淡画像Abを選択する(ステップS16)。このようにして画像選択部15は画像選択処理1を行う。   Next, the image selection unit 15 determines the one having the largest calculated luminance difference value (step S13). Then, when the largest value is the luminance difference Dr (step S13; Dr), the image selection unit 15 selects the R grayscale image Ar (step S14), and when the largest value is the luminance difference Dg (step S13). In S13; Dg), the G gray image Ag is selected (step S15). If the largest value is the luminance difference Db (step S13; Db), the B gray image Ab is selected (step S16). In this way, the image selection unit 15 performs the image selection process 1.

一般的に輝度差の値が大きい濃淡画像は、輝度差の値が小さい濃淡画像に比べて、距離の算出に必要な特徴がある可能性が高い。つまり距離の算出に使用する、例えばエッジ等の対応点は、輝度が急激に変化する点すなわち輝度差の大きい点なので、輝度差の値が大きい濃淡画像の方が検出可能な対応点の多い輝度分布を備えている可能性が高い。従って上記のように輝度差の値の大きい濃淡画像を選択することにより、対応点の検出精度すなわち被写体精度を向上させることができるので、精度の高い距離データを取得することが可能となる。   In general, a gray image with a large luminance difference value is more likely to have features necessary for calculating the distance than a gray image with a small luminance difference value. In other words, the corresponding points, such as edges, used for calculating the distance are points where the luminance changes abruptly, that is, points with a large luminance difference. Therefore, a gray image with a large luminance difference value has more corresponding points that can be detected. There is a high probability that it has a distribution. Therefore, by selecting a grayscale image having a large luminance difference value as described above, the detection accuracy of corresponding points, that is, the subject accuracy can be improved, so that highly accurate distance data can be acquired.

なお画像選択部15による画像の選択は別の方法であってもよい。次に画像選択部15による第二の実施形態の画像選択処理2ついて説明する。図4Aは画像選択部15による第二の画像選択処理2のフローチャート、図4Bはカウント処理のフローチャート、図5は濃淡画像の輝度分布及び画素のカウント方法の一例、図6は濃淡画像の輝度分布及び画素のカウント方法の別の一例である。   Note that the image selection unit 15 may select an image using another method. Next, the image selection process 2 of the second embodiment by the image selection unit 15 will be described. 4A is a flowchart of second image selection processing 2 by the image selection unit 15, FIG. 4B is a flowchart of counting processing, FIG. 5 is an example of luminance distribution of a grayscale image and a pixel counting method, and FIG. It is another example of the pixel counting method.

画像選択部15は、図4Aに示す如く、基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれについて予め例えば10毎等の所定間隔で定められた所定の輝度値C(例えばL10、L20、L30・・・)を有する画素を検出する(ステップS20)。この画素の検出は、例えば図5に示す如く、濃淡画像Ar、Ag、Abのそれぞれについて、全ての画素の輝度値Lにおいて所定の輝度値Cであるか否かを判別し、図中色付で示す所定の輝度値Cを有する画素を検出する。 As shown in FIG. 4A, the image selection unit 15 predetermines a predetermined luminance value C determined in advance at predetermined intervals such as every 10 for each of the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A. Pixels having (for example, L 10 , L 20 , L 30 ...) Are detected (step S20). For example, as shown in FIG. 5, this pixel detection is performed by determining whether or not the luminance values L of all the pixels have a predetermined luminance value C for each of the gray images Ar, Ag, and Ab, A pixel having a predetermined luminance value C indicated by is detected.

次に画像選択部15は、基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、AbそれぞれについてステップS20にて検出された画素の数Fr、Fg、Fbをカウントするカウント処理を行う(ステップS21)。   Next, the image selection unit 15 performs a counting process of counting the number of pixels Fr, Fg, and Fb detected in step S20 for each of the R, G, and B gray images Ar, Ag, and Ab that form the reference image A. This is performed (step S21).

カウント処理は、図4Bに示す如く、濃淡画像Arについて行うときには、先ずFrに0を代入して初期化し(ステップS120)、続いてaに0を代入して初期化する(ステップS121)。そして濃淡画像Arに所定の輝度値Cがあるか否かを判別し(ステップS122)、所定の輝度値Cがある場合(ステップS122;YES)には、a=cであるか否かを判別する(ステップS123)。そしてa=cでない場合(ステップS123;NO)には、Frをカウントアップして(ステップS124)、aにcを代入し(ステップS125)、ステップS126へ処理を移行する。   As shown in FIG. 4B, when the count processing is performed for the grayscale image Ar, first, 0 is substituted for Fr and initialized (step S120), and then 0 is substituted for a and initialized (step S121). Then, it is determined whether or not the grayscale image Ar has a predetermined luminance value C (step S122). If the predetermined luminance value C is present (step S122; YES), it is determined whether or not a = c. (Step S123). If a = c is not satisfied (step S123; NO), Fr is counted up (step S124), c is substituted for a (step S125), and the process proceeds to step S126.

一方、ステップS122にて所定の輝度値Cがない場合(ステップS122;NO)及びステップS123にてa=cである場合(ステップS123;YES)にも、ステップS126へ処理を移行して、その画素が水平方向の端の画素であるか否かを判別する(ステップS126)。   On the other hand, also when there is no predetermined brightness value C at step S122 (step S122; NO) and when a = c at step S123 (step S123; YES), the process proceeds to step S126, It is determined whether or not the pixel is a pixel at the end in the horizontal direction (step S126).

そして水平方向の端の画素ではない場合(ステップS126;NO)には、水平方向に1画素移動して(ステップS127)、処理をステップS122へ移行して以降の処理を繰り返し、端の画素である場合(ステップS126;YES)には、その画素が垂直方向の端の画素であるか否かを判別する(ステップS128)。   If the pixel is not the pixel at the end in the horizontal direction (step S126; NO), the pixel is moved in the horizontal direction (step S127), the process proceeds to step S122, and the subsequent processing is repeated. If there is (step S126; YES), it is determined whether or not the pixel is a pixel at the end in the vertical direction (step S128).

そして垂直方向の端の画素ではない場合(ステップS128;NO)には垂直方向に1画素移動して(ステップS129)、処理をステップS121へ移行して以降の処理を繰り返し、端の画素である場合(ステップS128;YES)には、カウント処理を終了する。そして同様のカウント処理を濃淡画像Ag、Abについても行う。   If the pixel is not the end pixel in the vertical direction (step S128; NO), the pixel is moved in the vertical direction (step S129), the process proceeds to step S121, and the subsequent processing is repeated to determine the end pixel. In the case (step S128; YES), the counting process is terminated. The same counting process is performed for the gray images Ag and Ab.

上記カウント処理を行うと、例えば図5の濃淡画像においては、画素数のカウントは、一列目の画素列では「2」、2列目の画素列では「1」、3列目、4列目の画素列では「1」、5列目の画素列では「1」となるのでこれらを合計して画素数は「6」となる。このようにして基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれについて上記のように画素数Fr、Fg、Fbをカウントする。   When the count process is performed, for example, in the grayscale image in FIG. 5, the pixel count is “2” for the first pixel row, “1” for the second pixel row, the third row, the fourth row. In this pixel row, “1” is obtained, and in the fifth pixel row, “1” is obtained, and these are added up to obtain “6”. Thus, the number of pixels Fr, Fg, and Fb is counted as described above for each of the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A.

なお本実施形態では、画素数のカウントを上記のように画素列毎に行ったが、濃淡画像Ar、Ag、Abをそれぞれ構成する全ての画素について前記カウントを行えば、どのようにカウントしてもよく、適宜変更することができる。   In the present embodiment, the number of pixels is counted for each pixel column as described above. However, if the above-described counting is performed for all the pixels constituting the grayscale images Ar, Ag, and Ab, It can be changed as appropriate.

そして次に画像選択部15は、カウントされた画素数が最も多い画素数を判別する(ステップS22)。そして画像選択部15は、最も多い画素数が画素数Frである場合(ステップS22;Fr)にはRの濃淡画像Arを選択し(ステップS23)、最も多い画素数が画素数Fgである場合(ステップS22;Fg)にはGの濃淡画像Agを選択し(ステップS24)、最も多い画素数が画素数Fbである場合(ステップS22;Fb)にはBの濃淡画像Abを選択する(ステップS25)。このようにして画像選択部15は画像選択処理2を行う。   Then, the image selection unit 15 determines the number of pixels with the largest counted number of pixels (step S22). When the largest number of pixels is the number of pixels Fr (step S22; Fr), the image selection unit 15 selects the R gray image Ar (step S23), and when the largest number of pixels is the number of pixels Fg. In step S22; Fg, the G gray image Ag is selected (step S24). In the case where the largest number of pixels is the number of pixels Fb (step S22; Fb), the B gray image Ab is selected (step S22; Fg). S25). In this way, the image selection unit 15 performs the image selection process 2.

一般的に、輝度値の起伏が頻繁な濃淡画像は、輝度値の起伏が乏しい濃淡画像に比べて、距離の算出に必要な特徴がある可能性が高い。つまり距離の算出に使用する、例えばエッジや大きな輝度の勾配を持つ領域等の対応点は、輝度値の起伏がある点なので、輝度値の起伏が頻繁な濃淡画像の方が検出可能な対応点の多い輝度分布を備えている可能性が高い。従って上記のように輝度値の起伏の頻繁な濃淡画像を選択することにより、対応点の検出精度すなわち被写体精度を向上させることができるので、精度の高い距離データを取得することが可能となる。   In general, a gray image with frequent undulations in luminance values is more likely to have features necessary for calculating the distance than a gray image with few undulations in luminance values. In other words, the corresponding points used for calculating the distance, such as edges and areas with large gradients of brightness, are points that have undulations in the luminance values, so the corresponding points that can be detected by grayscale images with more frequent undulations in the luminance values There is a high possibility of having a large luminance distribution. Therefore, by selecting a gray image with frequent undulations of luminance values as described above, the detection accuracy of corresponding points, that is, the subject accuracy can be improved, so that it is possible to acquire distance data with high accuracy.

なお本実施形態では、上記のように基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれにおいて、全ての画素について所定の輝度値Cを有する画素の検出と、検出された画素の数Fr、Fg、Fbのカウントを行ったが、図6に示す如く、例えば1つおきの画素列等、所定間隔毎の画素列において上記画素の検出を行って、検出された画素の数Fr、Fg、Fbのカウントを行うようにしてもよい。この場合、画素数のカウントは、図6に示す如く、一列目の画素列では「2」、3列目の画素列では「1」、5列目の画素列では「1」となるのでこれらを合計して画素数は「4」となる。   In the present embodiment, detection of pixels having a predetermined luminance value C for all pixels is detected in each of the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A as described above. The number of detected pixels Fr, Fg, and Fb was counted. As shown in FIG. 6, for example, every other pixel column, such as every other pixel column, the pixels were detected and the detected pixels The number Fr, Fg, and Fb may be counted. In this case, as shown in FIG. 6, the count of the number of pixels is “2” in the first pixel column, “1” in the third pixel column, and “1” in the fifth pixel column. The total number of pixels is “4”.

このように所定間隔毎の画素列において画素の数Fr、Fg、Fbをカウントすることにより基準画像Aと参照画像Bとにおける相関演算が画素列毎に行われる場合には、対応点となり得る画素の頻度を反映した濃淡画像を選択することができると共に、画像選択処理の速度を速くすることができる。   In this way, when the correlation calculation between the standard image A and the reference image B is performed for each pixel column by counting the number of pixels Fr, Fg, and Fb in the pixel column at every predetermined interval, pixels that can become corresponding points. Can be selected, and the speed of the image selection process can be increased.

次に画像選択部15による第三の実施形態の画像選択処理3ついて説明する。図7は画像選択部15による第三の画像選択処理3のフローチャート、図8はカラー画像の一例である。   Next, the image selection process 3 of the third embodiment by the image selection unit 15 will be described. FIG. 7 is a flowchart of the third image selection processing 3 by the image selection unit 15, and FIG. 8 is an example of a color image.

画像選択部15は、図7に示す如く、基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれについてエッジ(輪郭)を抽出する(ステップS30)。なおエッジの抽出は一般的に使用されている公知の技術を使用することができる。   As shown in FIG. 7, the image selection unit 15 extracts edges (contours) for the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A (step S30). In addition, the well-known technique generally used can be used for extraction of an edge.

次に画像選択部15は、基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、AbそれぞれについてステップS30にてエッジが抽出された画素の数つまりエッジに相当する画素数Er、Eg、Ebをカウントする(ステップS31)。   Next, the image selection unit 15 counts the number of pixels from which edges are extracted in step S30 for each of the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A, that is, the number of pixels Er corresponding to the edges, Eg and Eb are counted (step S31).

次に画像選択部15は、カウントされた画素数が最も多い画素数を判別する(ステップS32)。そして画像選択部15は、最も多い画素数が画素数Erである場合(ステップS32;Er)にはRの濃淡画像Arを選択し(ステップS33)、最も多い画素数が画素数Egである場合(ステップS32;Eg)にはGの濃淡画像Agを選択し(ステップS34)、最も多い画素数が画素数Ebである場合(ステップS32;Eb)にはBの濃淡画像Abを選択する(ステップS35)。このようにして画像選択部15は画像選択処理3を行う。   Next, the image selection unit 15 determines the number of pixels having the largest counted number of pixels (step S32). When the largest number of pixels is the pixel number Er (step S32; Er), the image selection unit 15 selects the R gray image Ar (step S33), and when the largest number of pixels is the pixel number Eg. A G gray image Ag is selected (Step S32; Eg) (Step S34), and if the largest number of pixels is the number of pixels Eb (Step S32; Eb), a B gray image Ab is selected (Step S32). S35). In this way, the image selection unit 15 performs the image selection process 3.

例えば図8に示す如く、赤い色の対象物Pr、緑色の対象物Pg、青色の対象物Pbの順に大きさの大きい対象物が撮像されたカラー画像Pにおいては、R、G、Bの濃淡画像Pr、Pg、Pbのそれぞれについてエッジに相当する画素数Er、Eg、Ebをカウントすると、Rの濃淡画像Prでの画素数Erが最も多い画素数となる。つまり画素数が多いほど、多くのエッジが抽出されていることとなり、基準画像Aと参照画像Bとにおいて多くの画素で相関が取れる、つまり対応点が検出し易くなる。従って上記のように、エッジに相当する画素数が最も多い濃淡画像を選択することにより、対応点の検出精度すなわち被写体精度を向上させることができて、精度の高い距離データを取得することが可能となる。   For example, as shown in FIG. 8, in a color image P in which a large object is picked up in the order of a red object Pr, a green object Pg, and a blue object Pb, the density of R, G, and B is varied. When the number of pixels Er, Eg, and Eb corresponding to the edge is counted for each of the images Pr, Pg, and Pb, the number of pixels Er in the R grayscale image Pr is the largest. In other words, the larger the number of pixels, the more edges are extracted, so that more pixels can be correlated in the base image A and the reference image B, that is, the corresponding points are easily detected. Therefore, as described above, by selecting the grayscale image having the largest number of pixels corresponding to the edge, the detection accuracy of corresponding points, that is, the subject accuracy can be improved, and highly accurate distance data can be acquired. It becomes.

なお本実施形態では、上記のように基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれにおいて、全ての画素についてエッジに相当する画素数Er、Eg、Ebのカウントを行ったが、上記実施形態と略同様に図6に示す如く、例えば1画素列毎、所定間隔毎の画素列においてエッジに相当する画素数Er、Eg、Ebのカウントを行うようにしてもよい。このように所定間隔毎の画素列において画素数Er、Eg、Ebをカウントすることにより基準画像Aと参照画像Bとにおける相関演算が画素列毎に行われる場合には、対応点となり得るエッジの頻度を反映した濃淡画像を選択することができると共に、画像選択処理の速度を速くすることができる。   In the present embodiment, as described above, in the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A, the counts of the number of pixels Er, Eg, and Eb corresponding to the edges are calculated for all the pixels. Although it was performed, as shown in FIG. 6 in substantially the same manner as in the above-described embodiment, for example, the number of pixels Er, Eg, and Eb corresponding to the edges may be counted in a pixel column at every predetermined pixel interval. . As described above, when the correlation calculation between the standard image A and the reference image B is performed for each pixel column by counting the number of pixels Er, Eg, and Eb in the pixel column at every predetermined interval, A gray image reflecting the frequency can be selected, and the speed of the image selection process can be increased.

次に画像選択部15による第四の実施形態の画像選択処理4ついて説明する。図9は画像選択部15による第四の画像選択処理4のフローチャート、図10はエッジが抽出された濃淡画像においてエッジの交差回数のカウントの一例である。   Next, the image selection process 4 of the fourth embodiment by the image selection unit 15 will be described. FIG. 9 is a flowchart of the fourth image selection process 4 by the image selection unit 15, and FIG. 10 is an example of counting the number of times of intersection of edges in a grayscale image from which edges are extracted.

画像選択部15は、図9に示す如く、基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれについてエッジ(輪郭)を抽出する(ステップS40)。なおエッジの抽出は一般的に使用されている公知の技術を使用することができる。   As shown in FIG. 9, the image selection unit 15 extracts edges (contours) for the R, G, and B grayscale images Ar, Ag, and Ab constituting the reference image A (step S40). In addition, the well-known technique generally used can be used for extraction of an edge.

次に画像選択部15は、基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abそれぞれについてエッジの交差回数Nr、Ng、Nbをカウントする(ステップS41)。エッジの交差回数Nr、Ng、Nbのカウントは、基準画像Aと参照画像Bとにおいて相関演算を行う方向と同じ方向で一定間隔のライン毎に、このラインとエッジとが交差しているか否かを画素毎に判断して、交差している回数を交差回数Nr、Ng、Nbとしてカウントする。   Next, the image selection unit 15 counts the number of edge intersections Nr, Ng, and Nb for each of the R, G, and B gray images Ar, Ag, and Ab that form the reference image A (step S41). The count of the number of edge crossings Nr, Ng, and Nb is based on whether or not the line and the edge intersect for each line at a constant interval in the same direction as the correlation calculation direction in the base image A and the reference image B. Is counted for each pixel, and the number of intersections is counted as the number of intersections Nr, Ng, and Nb.

例えばエッジが、図10に示すように抽出されている場合には、図10中所定の画素列毎に左から右に向かってエッジが交差しているか否かを判別する。このときエッジの交差の判別は、例えば抽出されたエッジが黒になるように公知の方法により濃淡画像を二値化し、白から黒及び黒から白に変化したときをエッジが交差したとして交差回数を1とカウントする。すると図10では一番上の画素列で交差回数4をカウントし、続いて下方の画素列になるにしたがって、交差回数7、10、11をカウントするので、図10の濃淡画像ではエッジの交差回数は11となる。このようにして交差回数Nr、Ng、Nbをカウントする。   For example, when the edge is extracted as shown in FIG. 10, it is determined whether or not the edge intersects from the left to the right for every predetermined pixel column in FIG. At this time, the determination of the intersection of the edges is performed, for example, by binarizing the grayscale image by a known method so that the extracted edges become black, and the number of intersections when the edges are crossed when changing from white to black and from black to white Is counted as 1. Then, in FIG. 10, the number of intersections 4 is counted in the uppermost pixel row, and then the number of intersections 7, 10, and 11 is counted as the lower pixel row is reached. The number of times is 11. In this way, the number of crossings Nr, Ng, Nb is counted.

そして図9に示す如く、交差回数Nr、Ng、Nbをカウントすると(ステップS41)、次に画像選択部15は、カウントされた交差回数Nr、Ng、Nbが最も多い交差回数を判別する(ステップS42)。そして画像選択部15は、最も多い交差回数が交差回数Nrである場合(ステップS42;Nr)にはRの濃淡画像Arを選択し(ステップS43)、最も多い交差回数が交差回数Ngである場合(ステップS42;Ng)にはGの濃淡画像Agを選択し(ステップS44)、最も多い交差回数が交差回数Nbである場合(ステップS42;Nb)にはBの濃淡画像Abを選択する(ステップS45)。このようにして画像選択部15は画像選択処理4を行う。   As shown in FIG. 9, when the number of intersections Nr, Ng, and Nb is counted (step S41), the image selection unit 15 determines the number of intersections with the largest number of intersections Nr, Ng, and Nb counted (step S41). S42). Then, the image selection unit 15 selects the R gray image Ar (step S43) when the largest number of intersections is the number of intersections Nr (step S42; Nr), and the largest number of intersections is the number of intersections Ng. In step S42; Ng, the gray image Ag of G is selected (step S44). In the case where the largest number of intersections is the number Nb of intersections (step S42; Nb), the gray image Ab of B is selected (step S42). S45). In this way, the image selection unit 15 performs the image selection process 4.

一般的に抽出されたエッジの数が多い場合には、ステレオマッチング処理を行うときに、基準画像Aと参照画像Bとの間で対応点となる得る画素が多数存在している可能性が高く相関演算がし易い。従って上記のように交差回数Nr、Ng、Nbの多い濃淡画像を選択すれば、交差回数が多いということは、つまり対応点となる得るエッジの数が多いということになるので、対応点の検出精度すなわち被写体精度を向上させることができて、精度の高い距離データを取得することができると共に、対応点となり得るエッジの頻度を反映した濃淡画像を選択することができる。   In general, when the number of extracted edges is large, there is a high possibility that there are many pixels that can be corresponding points between the base image A and the reference image B when performing stereo matching processing. Easy correlation calculation. Therefore, if a grayscale image with a large number of intersections Nr, Ng, and Nb is selected as described above, a large number of intersections means that the number of edges that can be corresponding points is large. Accuracy, that is, subject accuracy can be improved, high-precision distance data can be acquired, and a grayscale image reflecting the frequency of edges that can be corresponding points can be selected.

次に上記のようにして、図2に示す如く、画像選択部15が1つの色の濃淡画像を選択すると(ステップS3)、距離算出部16は画像選択部15により選択された色の基準画像Aの濃淡画像と対応する色の参照画像Bの濃淡画像とから上述のようにして被写体各部までの距離を算出する(ステップS4)。   Next, as shown in FIG. 2, when the image selection unit 15 selects one color gradation image as described above (step S <b> 3), the distance calculation unit 16 selects the reference image of the color selected by the image selection unit 15. The distances from the grayscale image of A and the grayscale image of the reference image B of the corresponding color are calculated as described above (step S4).

そして距離算出部16が距離を算出して距離データを取得すると(ステップS4)、次にデータ圧縮部17が算出した距離データを圧縮し、メディア制御部18が圧縮された距離データを記録メディア19に記録して(ステップS5)、画像処理装置1による画像処理を終了する。   When the distance calculation unit 16 calculates the distance and obtains the distance data (step S4), the distance data calculated by the data compression unit 17 is then compressed, and the media control unit 18 converts the compressed distance data into the recording medium 19. (Step S5), and the image processing by the image processing apparatus 1 is terminated.

以上により、本実施形態の画像処理装置1によれば、入力された一対の画像データの基準画像Aにおいて、画像データを構成するRGBの色の濃淡画像Ar、Ag、Abのうちから最も距離の算出に適する1つ色の濃淡画像を選択し、選択された色の濃淡画像とこの濃淡画像に対応する色の参照画像Bの濃淡画像とから前記距離を算出するので、最も距離の算出に適する1つの色の濃淡画像でのみ距離の算出を行うことにより精度の高い距離データを算出することができると共に距離の算出に要する時間を低減することができる。このとき距離の算出に要する時間を低減するためのみであれば、必ずしも距離の算出に最適な色の濃淡画像を選択する必要はない。   As described above, according to the image processing apparatus 1 of the present embodiment, in the reference image A of the pair of input image data, the RGB color grayscale images Ar, Ag, and Ab constituting the image data are the most distant. Since the gray image of one color suitable for the calculation is selected and the distance is calculated from the gray image of the selected color and the gray image of the reference image B of the color corresponding to the gray image, the distance is most suitable for calculating the distance. By calculating the distance only with a gray image of one color, it is possible to calculate distance data with high accuracy and reduce the time required for calculating the distance. At this time, if it is only to reduce the time required to calculate the distance, it is not always necessary to select a grayscale image having the optimum color for calculating the distance.

なお本実施形態では、画像選択部15が基準画像Aについてのみ輝度差の値Dr、Dg、Db又は所定の輝度値を有する画素の数Fr、Fg、Fb、エッジに相当する画素数Er、Eg、Eb、エッジの交差回数Nr、Ng、Nbの算出を行ったが本発明はこれに限られるものではなく、参照画像Bについて前記算出を行ってもよいし、基準画像Aと参照画像Bの両方について前記算出を行ってもよい。   In the present embodiment, the image selection unit 15 has the luminance difference values Dr, Dg, Db or the number of pixels having a predetermined luminance value Fr, Fg, Fb, and the pixel numbers Er, Eg corresponding to edges only for the reference image A. , Eb, and the number of edge intersections Nr, Ng, and Nb are calculated, but the present invention is not limited to this, and the calculation may be performed for the reference image B, or the reference image A and the reference image B You may perform the said calculation about both.

また本実施形態ではカラー画像としてR、G、Bの3つの色の濃淡画像で構成された画像を使用したが、本発明はこれに限られるものではなく、例えば4つの色等、複数の色の濃淡画像で構成されたカラー画像にも適用することができる。   In the present embodiment, an image composed of three color images of R, G, and B is used as a color image. However, the present invention is not limited to this, and a plurality of colors such as four colors are used. The present invention can also be applied to a color image composed of grayscale images.

また本発明の画像処理装置は、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理装置において、
前記一対の画像データを入力する画像入力手段と、
入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちからその一部である少なくとも1つの色の濃淡画像を選択する選択手段と、
該選択手段により選択された色の濃淡画像と該濃淡画像に対応する色の他方の画像データの濃淡画像とから前記距離を算出する距離算出手段とを備えてなることができる。
In addition, the image processing apparatus of the present invention calculates the distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each composed of a plurality of gray images, and obtains stereoscopic image data. In the image processing apparatus for generating
Image input means for inputting the pair of image data;
Selection means for selecting at least one gray image of a plurality of color images constituting the image data from at least one of the pair of input image data; ,
Distance calculation means for calculating the distance from the grayscale image of the color selected by the selection means and the grayscale image of the other image data of the color corresponding to the grayscale image can be provided.

次に第二の実施形態の画像処理装置1−2について、以下図面を参照して詳細に説明する。図11は第二の実施形態の画像処理装置1−2の機能構成を示すブロック図、図12は画像処理装置1−2による一連の画像処理のフローチャート、図13は領域分割部22及び画像選択部15−2による領域分割及び画像選択処理のフローチャートである。なお図11は便宜上、上記実施形態の画像処理装置1の機能構成を示すブロック図である図1と同様の箇所は同符号で示して説明を省略し、異なる箇所のみ詳細に説明する。   Next, the image processing apparatus 1-2 according to the second embodiment will be described in detail with reference to the drawings. FIG. 11 is a block diagram showing a functional configuration of the image processing apparatus 1-2 according to the second embodiment, FIG. 12 is a flowchart of a series of image processing by the image processing apparatus 1-2, and FIG. 13 is an area dividing unit 22 and image selection. 10 is a flowchart of region division and image selection processing by a unit 15-2. For convenience, FIG. 11 is a block diagram showing the functional configuration of the image processing apparatus 1 of the above embodiment, and the same parts as those in FIG.

本実施形態の画像処理装置1−2は、図11に示す如く、画像分割部(画像分割手段)22を備えている点が上記実施形態の画像処理装置1とは異なっている。画像分割部22は、基準画像Aを構成するR、G、Bの色の濃淡画像Ar、Ag、Abを複数の所定領域に分割するものである。   The image processing apparatus 1-2 according to the present embodiment is different from the image processing apparatus 1 according to the above-described embodiment in that an image dividing unit (image dividing unit) 22 is provided as shown in FIG. The image dividing unit 22 divides the grayscale images Ar, Ag, and Ab of the R, G, and B colors constituting the reference image A into a plurality of predetermined areas.

また本実施形態の画像選択部15−2は、領域分割部22により分割された所定領域毎に、R、G、Bの色の濃淡画像Ar、Ag、Abから最も距離算出に適する1つの色の濃淡画像を選択するものである。   In addition, the image selection unit 15-2 according to the present embodiment has one color that is most suitable for calculating the distance from the grayscale images Ar, Ag, and Ab of R, G, and B colors for each predetermined region divided by the region dividing unit 22. The gray image is selected.

本実施形態の画像処理装置1−2は上記のように構成されている。次に画像処理装置1−2による画像処理について説明する。図12は画像処理装置1−2による一連の画像処理のフローチャート、図13は領域分割部22及び画像選択部15−2による画像分割及び画像選択処理のフローチャート、図14は領域分割部22及び画像選択部15−2による画像分割及び画像選択方法の一例である。   The image processing apparatus 1-2 of the present embodiment is configured as described above. Next, image processing by the image processing apparatus 1-2 will be described. 12 is a flowchart of a series of image processing by the image processing device 1-2, FIG. 13 is a flowchart of image division and image selection processing by the region dividing unit 22 and the image selecting unit 15-2, and FIG. 14 is a flowchart of the region dividing unit 22 and the image. It is an example of the image division by the selection part 15-2, and an image selection method.

本実施形態の画像処理装置1−2は、図12に示す如く、画像入力部10が一対の画像データすなわち基準画像Aと参照画像Bを入力し(ステップS51)、読込部14が基準画像Aを構成するRの濃淡画像Ar、Gの濃淡画像Ag、Bの濃淡画像Ab及び画像データBを構成するRの濃淡画像Br、Gの濃淡画像Bg、Bの濃淡画像Bbをそれぞれ読み込んで、輝度値等の画素値を読み出す(ステップS52)。   In the image processing apparatus 1-2 of this embodiment, as shown in FIG. 12, the image input unit 10 inputs a pair of image data, that is, the standard image A and the reference image B (step S51), and the reading unit 14 receives the standard image A. R gray image Ar, G gray image Ag, B gray image Ab and R gray image Br, G gray image Bg, B gray image Bb constituting image data B are read respectively. Pixel values such as values are read (step S52).

次に領域分割部22が、エッジを有する画素を含む領域毎に所定領域の分割処理を行い、画像選択部15−2が各々の所定領域内でエッジが抽出された色の濃淡画像を選択する画像選択処理を行う(ステップS53)。   Next, the region dividing unit 22 performs a predetermined region dividing process for each region including pixels having an edge, and the image selecting unit 15-2 selects a grayscale image in which the edge is extracted in each predetermined region. Image selection processing is performed (step S53).

領域分割及び画像選択処理1は、図13Aに示す如く、まず基準画像Aを構成するR、G、Bの色の濃淡画像Ar、Ag、Abの各々においてエッジの抽出を行い(ステップS60)、fとmに0を代入して初期化を行う(ステップS61)。そして画像分割部22が、例えば濃淡画像Ar、Ag、Abの順に各画素列について水平方向に1画素ずつ、エッジがあるか否かの判別を行う。すなわち図13Aに示す如く、まずR濃淡画像Arにエッジがあるか否かに判別を行い(ステップS62)、エッジがある場合(ステップS62;YES)には、その画素の番号nを記憶する(ステップS63)。   In the area division and image selection processing 1, as shown in FIG. 13A, first, edges are extracted from the grayscale images Ar, Ag, Ab of the colors R, G, B constituting the reference image A (step S60). Initialization is performed by substituting 0 for f and m (step S61). Then, the image dividing unit 22 determines whether or not there is an edge in the horizontal direction for each pixel row in the order of grayscale images Ar, Ag, and Ab, for example. That is, as shown in FIG. 13A, it is first determined whether or not there is an edge in the R gray image Ar (step S62). If there is an edge (step S62; YES), the pixel number n is stored ( Step S63).

そしてmが0であるか否かを判別し(ステップS64)、0である場合(ステップS64;YES)には、画像選択部15−2が1からn画素番号までの領域についてR濃淡画像Arを選択して(ステップS65)、fにrを代入し(ステップS66)、mにnを代入する(ステップS67)。   Then, it is determined whether or not m is 0 (step S64). If m is 0 (step S64; YES), the image selection unit 15-2 selects the R grayscale image Ar for the region from 1 to n pixel numbers. Is selected (step S65), r is substituted for f (step S66), and n is substituted for m (step S67).

次にn画素番号の画素が水平方向において端の画素であるか否かを判別し(ステップS68)、端の画素でない場合(ステップS68;NO)には、水平方向に1画素移動して(ステップS69)、ステップS62へ処理を移行する。一方、ステップS68にて端の画素である場合(ステップS68;YES)には、図13Dに示す如く、ステップS98へ処理を移行して以降の処理を行う。   Next, it is determined whether or not the pixel with the n pixel number is an end pixel in the horizontal direction (step S68). If it is not the end pixel (step S68; NO), the pixel is moved by one pixel in the horizontal direction (step S68; NO) The process proceeds to step S69) and step S62. On the other hand, if the pixel is an end pixel in step S68 (step S68; YES), the process proceeds to step S98 as shown in FIG.

またステップS64にてmが0でない場合(ステップS64;NO)には、fを判別し(ステップS70),fがrである場合(ステップS70;r)には、画像選択部15−2が(n−m)/2の画素番号までの領域についてR濃淡画像Arを選択し(ステップS71)、fがgである場合(ステップS70;g)には、画像選択部15−2が(n−m)/2の画素番号までの領域についてG濃淡画像Agを選択し(ステップS72)、fがbである場合(ステップS70;b)には、画像選択部15−2が(n−m)/2の画素番号までの領域についてB濃淡画像Abを選択して(ステップS73)、ステップS66へ処理を移行する。このとき(n−m)/2の少数点以下の数は繰り上げるか、または繰り下げることによって整数の値とする。   If m is not 0 in step S64 (step S64; NO), f is discriminated (step S70), and if f is r (step S70; r), the image selection unit 15-2 determines. The R grayscale image Ar is selected for the region up to the pixel number of (nm) / 2 (step S71), and when f is g (step S70; g), the image selection unit 15-2 (n -M) A G gray image Ag is selected for a region up to a pixel number of 2 (step S72), and when f is b (step S70; b), the image selection unit 15-2 selects (nm). ) / 2 is selected for the region up to the pixel number of / 2 (step S73), and the process proceeds to step S66. At this time, the number below the decimal point of (nm) / 2 is raised or lowered to an integer value.

一方、ステップS62にて、R濃淡画像Arにエッジがない場合(ステップS62;NO)には、図13Bに示す如く、G濃淡画像Agにエッジがあるか否かの判別を行う(ステップS74)。そしてエッジがある場合(ステップS74;YES)には、その画素の番号nを記憶する(ステップS75)。   On the other hand, if there is no edge in the R gray image Ar in step S62 (step S62; NO), it is determined whether or not there is an edge in the G gray image Ag as shown in FIG. 13B (step S74). . If there is an edge (step S74; YES), the pixel number n is stored (step S75).

そしてmが0であるか否かを判別し(ステップS76)、0である場合(ステップS76;YES)には、画像選択部15−2が1からn画素番号までの領域についてG濃淡画像Agを選択し(ステップS77)、fにgを代入する(ステップS78)。なお図13
BのステップS79〜ステップS81の処理は、図13AのステップS67〜ステップS69の処理と、図13BのステップS82〜ステップS85の処理は、図13AのステップS70〜ステップS73と、それぞれ同様であるため説明は省略する。
Then, it is determined whether or not m is 0 (step S76). If m is 0 (step S76; YES), the image selection unit 15-2 applies the G gray image Ag for the region from 1 to n pixel numbers. Is selected (step S77), and g is substituted for f (step S78). Note that FIG.
The processing from step S79 to step S81 in B is the same as the processing from step S67 to step S69 in FIG. 13A, and the processing from step S82 to step S85 in FIG. 13B is the same as step S70 to step S73 in FIG. Description is omitted.

そして画像選択部15−2が図13BのステップS83〜ステップS85にて濃淡画像を選択すると、ステップS78へ処理を移行する。   When the image selection unit 15-2 selects a grayscale image in steps S83 to S85 in FIG. 13B, the process proceeds to step S78.

一方、ステップS74にて、G濃淡画像Agにエッジがない場合(ステップS74;NO)には、図13Cに示す如く、B濃淡画像Abにエッジがあるか否かの判別を行う(ステップS86)。そしてエッジがある場合(ステップS86;YES)には、その画素の番号nを記憶する(ステップS87)。   On the other hand, if there is no edge in the G gray image Ag in step S74 (step S74; NO), it is determined whether or not there is an edge in the B gray image Ab as shown in FIG. 13C (step S86). . If there is an edge (step S86; YES), the pixel number n is stored (step S87).

そしてmが0であるか否かを判別し(ステップS88)、0である場合(ステップS88;YES)には、画像選択部15−2が1からn画素番号までの領域についてB濃淡画像Abを選択し(ステップS89)、fにbを代入する(ステップS90)。なお図13
CのステップS91〜とステップS93の処理は、図13AのステップS67〜ステップS69の処理と、図13CのステップS94〜ステップS97の処理は、図13AのステップS70〜ステップS73と、それぞれ同様であるため説明は省略する。
Then, it is determined whether or not m is 0 (step S88). If it is 0 (step S88; YES), the image selection unit 15-2 selects the B grayscale image Ab for the region from 1 to n pixel numbers. Is selected (step S89), and b is substituted for f (step S90). Note that FIG.
Steps S91 to S93 in C are the same as steps S67 to S69 in FIG. 13A, and steps S94 to S97 in FIG. 13C are the same as steps S70 to S73 in FIG. 13A, respectively. Therefore, explanation is omitted.

そして画像選択部15−2が図13CのステップS95〜ステップS97にて濃淡画像を選択すると、ステップS90へ処理を移行する。   When the image selection unit 15-2 selects a grayscale image in steps S95 to S97 in FIG. 13C, the process proceeds to step S90.

次にステップS68、ステップS80、ステップS92にて、水平方向に端の画素であると判別した場合(ステップS68、ステップS80、ステップS92;YES)には、図13Dに示す如く、ステップS98へ処理を移行して、fを判別し(ステップS98),fがrである場合(ステップS98;r)には、画像選択部15−2がn画素番号までの領域についてR濃淡画像Arを選択し(ステップS99)、fがgである場合(ステップS98;g)には、画像選択部15−2がn画素番号までの領域についてG濃淡画像Agを選択し(ステップS100)、fがbである場合(ステップS98;b)には、画像選択部15−2がn画素番号までの領域についてB濃淡画像Abを選択して(ステップS101)、ステップS102へ処理を移行する。このとき(n−m)/2の少数点以下の数は繰り上げるか、または繰り下げることによって整数の値とする。   Next, in step S68, step S80, and step S92, when it is determined that the pixel is the edge pixel in the horizontal direction (step S68, step S80, step S92; YES), the process proceeds to step S98 as shown in FIG. 13D. And f is discriminated (step S98). If f is r (step S98; r), the image selection unit 15-2 selects the R grayscale image Ar for the area up to the n pixel number. (Step S99) When f is g (Step S98; g), the image selection unit 15-2 selects the G gray image Ag for the region up to the n pixel number (Step S100), and f is b. If there is (step S98; b), the image selection unit 15-2 selects the B grayscale image Ab for the region up to the n pixel number (step S101), and goes to step S102. To migrate the management. At this time, the number below the decimal point of (nm) / 2 is raised or lowered to an integer value.

そしてステップS102にて、垂直方向の端の画素であるか否かを判別し(ステップS102)、端の画素でない場合(ステップS102;NO)には、垂直方向に1画素移動して(ステップS103)、図13AのステップS61へ処理を移行して以降の処理を繰り返す。一方、端の画素である場合(ステップS102;YES)、領域分割及び画像選択処理1を終了して、図12のステップS54へ処理を移行する。   In step S102, it is determined whether or not the pixel is an end pixel in the vertical direction (step S102). If the pixel is not an end pixel (step S102; NO), one pixel is moved in the vertical direction (step S103). ), The process proceeds to step S61 in FIG. 13A and the subsequent processes are repeated. On the other hand, if the pixel is an end pixel (step S102; YES), the region division and image selection process 1 is terminated, and the process proceeds to step S54 in FIG.

つまり図14に示す如く、例えば濃淡画像中、一点鎖線で示す画素列を例にすると、水平方向に一画素ずつ各濃淡画像Ar、Ag、Abでエッジがあるか否かを判別したときに、まずR濃淡画像ArのA画素番号にてエッジが検出されるので、1画素番号〜A画素番号の領域は濃淡画像Arが選択される。次にG濃淡画像AgのB画素番号にてエッジが検出されるので、B画素番号と、B画素番号のひとつ前に検出されたエッジすなわちA画素番号との中間点である(B−A)/2画素番号の左側又は右側が領域の境界となり、この境界までの領域は濃淡画像Arが選択される。   That is, as shown in FIG. 14, for example, in the case of a pixel row indicated by an alternate long and short dash line in a grayscale image, when it is determined whether or not there is an edge in each grayscale image Ar, Ag, Ab in the horizontal direction, First, since an edge is detected by the A pixel number of the R grayscale image Ar, the grayscale image Ar is selected in the region of the 1 pixel number to the A pixel number. Next, since the edge is detected by the B pixel number of the G gray image Ag, it is an intermediate point between the B pixel number and the edge detected immediately before the B pixel number, that is, the A pixel number (B−A). The left or right side of the / 2 pixel number is the boundary of the region, and the gray image Ar is selected for the region up to this boundary.

次に同様にして(D−C)/2画素番号の左側又は右側の境界までの領域で濃淡画像Agが選択され、水平方向の端の画素になったときには、残りの領域で濃淡画像Abが選択される。そして、上記の処理をすべての画素列において行う。   Next, in the same manner, when the gray image Ag is selected in the region up to the left or right boundary of (DC) / 2 pixel number and becomes the pixel at the end in the horizontal direction, the gray image Ab is displayed in the remaining region. Selected. Then, the above process is performed on all the pixel columns.

一般的にエッジの付近は、対応点が検出し易く、対応点の検出精度すなわち被写体精度を向上できる可能性が高い。従って上記のように抽出されたエッジを有する画素を含む領域毎に、エッジが抽出された色の濃淡画像を選択することにより、撮像された被写体に応じて分割された領域毎に選択する色の濃淡画像を変えることができるので、選択精度の高い距離データを取得することが可能となる。   In general, corresponding points are easily detected in the vicinity of the edge, and there is a high possibility that the detection accuracy of the corresponding points, that is, the subject accuracy can be improved. Therefore, by selecting the grayscale image of the color from which the edge is extracted for each region including the pixel having the edge extracted as described above, the color to be selected for each region divided according to the imaged subject is selected. Since the grayscale image can be changed, distance data with high selection accuracy can be acquired.

次に領域分割部22及び画像選択部15−2による第二の領域分割及び画像選択処理2について説明する。図15は第二の領域分割及び画像選択処理2のフローチャートである。なお図15は、便宜上、図13のフローチャートと同様の処理は同じステップ番号で示して説明を省略し、異なる箇所についてのみ詳細に説明する。   Next, the second region division and image selection processing 2 by the region division unit 22 and the image selection unit 15-2 will be described. FIG. 15 is a flowchart of the second area division and image selection process 2. In FIG. 15, for the sake of convenience, the same processes as those in the flowchart of FIG.

領域分割部22及び画像選択部15−2は、上記実施形態の領域分割及び画像選択処理1とは異なり、図15Aに示す如く、まず基準画像Aを構成するR、G、Bの色の濃淡画像Ar、Ag、Abの各々において予め例えば10毎等の所定間隔で定められた所定の輝度値C(例えばL10、L20、L30・・・)を有する画素を検出し(ステップS60’)、次にf、m、a、p、eにそれぞれ0を代入して初期化を行って(ステップS61’)、画像分割部22が、例えば濃淡画像Ar、Ag、Abの順に各画素列について水平方向に1画素ずつ、所定の輝度値Cがあるか否かの判別を行う。すなわち図15Aに示す如く、まずR濃淡画像Arに所定の輝度値Cがあるか否かに判別を行う(ステップS62’)。 Unlike the region division and image selection processing 1 of the above embodiment, the region division unit 22 and the image selection unit 15-2 firstly change the shades of R, G, and B colors that constitute the reference image A as shown in FIG. 15A. In each of the images Ar, Ag, and Ab, pixels having a predetermined luminance value C (for example, L 10 , L 20 , L 30 ...) Determined in advance at predetermined intervals such as every 10 are detected (step S60 ′). Then, initialization is performed by substituting 0 for each of f, m, a, p, and e (step S61 ′), and the image dividing unit 22 performs pixel array processing in the order of grayscale images Ar, Ag, Ab, for example. It is determined whether or not there is a predetermined luminance value C for each pixel in the horizontal direction. That is, as shown in FIG. 15A, first, it is determined whether or not the R grayscale image Ar has a predetermined luminance value C (step S62 ′).

そして所定の輝度値Cがある場合(ステップS62’;YES)には、a=cであるか否かの判別を行い(ステップS163)、a=cではない場合(ステップS163;NO)には、ステップS63へ処理を移行して図13Aと同様にステップS63〜ステップS67の処理を行った後でaにcを代入し(ステップS168)、ステップS68へ処理を移行する。   If there is a predetermined luminance value C (step S62 ′; YES), it is determined whether or not a = c (step S163), and if a = c is not satisfied (step S163; NO). Then, the process proceeds to step S63, and after steps S63 to S67 are performed as in FIG. 13A, c is substituted for a (step S168), and the process proceeds to step S68.

一方、ステップS163にてa=cである場合(ステップS163;YES)及びステップS62’にて所定の輝度値Cがない場合(ステップS62’;NO)には、図15Bに示す如く、G濃淡画像Agに所定の輝度値Cがあるか否かの判別を行う(ステップS74’)。   On the other hand, when a = c in Step S163 (Step S163; YES) and when there is no predetermined luminance value C in Step S62 ′ (Step S62 ′; NO), as shown in FIG. It is determined whether or not the image Ag has a predetermined luminance value C (step S74 ′).

そして所定の輝度値Cがある場合(ステップS74’;YES)には、p=cであるか否かの判別を行い(ステップS175)、p=cではない場合(ステップS175;NO)には、ステップS75へ処理を移行して図13Bと同様にステップS75〜ステップS79の処理を行った後でpにcを代入し(ステップS180)、ステップS80へ処理を移行する。   If there is a predetermined luminance value C (step S74 ′; YES), it is determined whether or not p = c (step S175), and if p = c is not satisfied (step S175; NO). Then, the process proceeds to step S75, and after steps S75 to S79 are performed as in FIG. 13B, c is substituted for p (step S180), and the process proceeds to step S80.

一方、ステップS175にてp=cである場合(ステップS175;YES)及びステップS74’にて所定の輝度値Cがない場合(ステップS74’;NO)には、図15Cに示す如く、B濃淡画像Abに所定の輝度値Cがあるか否かの判別を行う(ステップS86’)。   On the other hand, when p = c in step S175 (step S175; YES) and when there is no predetermined luminance value C in step S74 ′ (step S74 ′; NO), as shown in FIG. It is determined whether or not the image Ab has a predetermined luminance value C (step S86 ′).

そして所定の輝度値Cがある場合(ステップS86’;YES)には、e=cであるか否かの判別を行い(ステップS187)、e=cではない場合(ステップS187;NO)には、ステップS87へ処理を移行して図13Cと同様にステップS87〜ステップS91の処理を行った後でeにcを代入し(ステップS192)、ステップS92へ処理を移行する。   If there is a predetermined luminance value C (step S86 ′; YES), it is determined whether or not e = c (step S187). If e = c is not satisfied (step S187; NO), Then, the process proceeds to step S87, and after steps S87 to S91 are performed as in FIG. 13C, c is substituted for e (step S192), and the process proceeds to step S92.

一方、ステップS187にてe=cである場合(ステップS187;YES)及びステップS86’にて所定の輝度値Cがない場合(ステップS86’;NO)には、図15Cに示す如く、ステップS92へ処理を移行する。   On the other hand, when e = c in step S187 (step S187; YES) and when there is no predetermined luminance value C in step S86 ′ (step S86 ′; NO), as shown in FIG. Transfer processing to.

そして次にステップS68、ステップS80、ステップS92にて、水平方向に端の画素であると判別した場合(ステップS68、ステップS80、ステップS92;YES)には、mが0であるか否かを判別し(ステップS198)、mが0である場合(ステップS198;YES)には水平方向の全画素でG濃淡画像Agを選択して(ステップS199)、ステップS102へ処理を移行する。このとき水平方向の全画素でR濃淡画像Arを選択しても良いし、B濃淡画像Abを選択しても良い。   Then, when it is determined in step S68, step S80, or step S92 that the pixel is an edge pixel in the horizontal direction (step S68, step S80, step S92; YES), whether m is 0 or not is determined. If it is determined (step S198) and m is 0 (step S198; YES), the G gray image Ag is selected for all the pixels in the horizontal direction (step S199), and the process proceeds to step S102. At this time, the R gray image Ar may be selected for all the pixels in the horizontal direction, or the B gray image Ab may be selected.

またステップS198にてmが0でない場合(ステップS198;NO)には、ステップS98へ処理を移行して、図13Dと同様にステップS98〜ステップS103の処理を行う。第二の領域分割及び画像選択処理2は上記のようにして行う。   If m is not 0 in step S198 (step S198; NO), the process proceeds to step S98, and the processes in steps S98 to S103 are performed as in FIG. 13D. The second area division and image selection process 2 is performed as described above.

一般的に、輝度値の起伏が頻繁な濃淡画像は、輝度値の起伏が乏しい濃淡画像に比べて、距離の算出に必要な特徴がある可能性が高い。つまり距離の算出に使用する、例えばエッジや大きな輝度の勾配を持つ領域等の対応点は、輝度値の起伏がある点なので、輝度値の起伏が頻繁な濃淡画像の方が検出可能な対応点の多い輝度分布を備えている可能性が高い。従って上記のように輝度値の起伏の頻繁な濃淡画像を領域毎に選択することにより、対応点の検出精度すなわち被写体精度を向上させることができるので、精度の高い距離データを取得することが可能となる。   In general, a gray image with frequent undulations in luminance values is more likely to have features necessary for calculating the distance than a gray image with few undulations in luminance values. In other words, the corresponding points used for calculating the distance, such as edges and areas with large gradients of brightness, are points that have undulations in the luminance values, so the corresponding points that can be detected by grayscale images with more frequent undulations in the luminance values There is a high possibility of having a large luminance distribution. Therefore, by selecting a gray image with frequent undulations for each region as described above for each region, the detection accuracy of corresponding points, that is, the subject accuracy can be improved, so that it is possible to acquire highly accurate distance data. It becomes.

次に上述のようにして、図12に示す如く、領域分割部22が分割した所定領域毎に画像選択部15−2が1つの色の濃淡画像を選択すると(ステップS53)、距離算出部16は所定領域毎に画像選択部15により選択された色の基準画像Aの濃淡画像と対応する色の参照画像Bの濃淡画像とから上述のようにして被写体各部までの距離を算出する(ステップS54)。   Next, as described above, when the image selection unit 15-2 selects a gray image of one color for each predetermined region divided by the region division unit 22 as shown in FIG. 12 (step S53), the distance calculation unit 16 Calculates the distance to each part of the subject as described above from the grayscale image of the base image A of the color selected by the image selection unit 15 and the grayscale image of the reference image B of the corresponding color for each predetermined area (step S54). ).

そして距離算出部16が距離を算出して距離データを取得すると(ステップS54)、次にデータ圧縮部17が算出した距離データを圧縮し、メディア制御部18が圧縮された距離データを記録メディア19に記録して(ステップS55)、画像処理装置1−2による画像処理を終了する。   When the distance calculation unit 16 calculates the distance and acquires the distance data (step S54), the distance data calculated by the data compression unit 17 is then compressed, and the media control unit 18 converts the compressed distance data into the recording medium 19. (Step S55), and the image processing by the image processing apparatus 1-2 is terminated.

以上により、本実施形態の画像処理装置1−2によれば、入力された一対の画像データの基準画像Aにおいて、画像データを構成するRGBの色の濃淡画像Ar、Ag、Abを複数の所定領域に分割し、分割された所定領域毎に、RGBの色のうちから最も距離の算出に適する1つ色の濃淡画像を選択し、選択された色の濃淡画像とこの濃淡画像に対応する色の参照画像Bの濃淡画像とから前記距離を算出するので、所定領域毎に最も距離の算出に適する1つの色の濃淡画像でのみ距離の算出を行うことにより精度の高い距離データを算出することができると共に距離の算出に要する時間を低減することができる。このとき距離の算出に要する時間を低減するためのみであれば、必ずしも距離の算出に最適な色の濃淡画像を選択する必要はない。   As described above, according to the image processing apparatus 1-2 of the present embodiment, in the reference image A of the pair of input image data, the RGB gray images Ar, Ag, and Ab that constitute the image data are converted into a plurality of predetermined values. The image is divided into regions, and for each divided region, a gray image of one color most suitable for calculating the distance is selected from among the RGB colors, and the gray image of the selected color and the color corresponding to this gray image Since the distance is calculated from the grayscale image of the reference image B, the distance data is calculated with high accuracy by calculating the distance only with the grayscale image of one color most suitable for calculating the distance for each predetermined region. And the time required to calculate the distance can be reduced. At this time, if it is only to reduce the time required to calculate the distance, it is not always necessary to select a grayscale image having the optimum color for calculating the distance.

なお本実施形態では、領域分割部22が基準画像Aについてのみ領域の分割を行い、画像選択部15−2が分割された領域毎に濃淡画像の選択を行ったが本発明はこれに限られるものではなく、参照画像Bについて前記分割及び前記選択を行ってもよいし、基準画像Aと参照画像Bの両方について前記分割及び前記選択を行ってもよい。   In this embodiment, the region dividing unit 22 divides the region only for the reference image A, and the image selection unit 15-2 selects a grayscale image for each divided region. However, the present invention is not limited to this. Instead, the division and the selection may be performed on the reference image B, or the division and the selection may be performed on both the standard image A and the reference image B.

また本実施形態ではカラー画像としてR、G、Bの3つの色の濃淡画像で構成された画像を使用したが、本発明はこれに限られるものではなく、例えば4つの色等、複数の色の濃淡画像で構成されたカラー画像にも適用することができる。   In the present embodiment, an image composed of three color images of R, G, and B is used as a color image. However, the present invention is not limited to this, and a plurality of colors such as four colors are used. The present invention can also be applied to a color image composed of grayscale images.

また本発明の画像処理装置は、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理装置において、
前記一対の画像データを入力する画像入力手段と、
入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像を複数の所定領域に分割する領域分割手段と、
該領域分割手段により分割された前記所定領域毎に、前記複数の色の濃淡画像のうちからその一部である少なくとも1つの色の濃淡画像を選択する選択手段と、
前記選択手段により選択された色の濃淡画像と該濃淡画像に対応する色の他方の画像データの濃淡画像とから前記距離を算出する距離算出手段とを備えてなることができる。
In addition, the image processing apparatus of the present invention calculates the distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each composed of a plurality of gray images, and obtains stereoscopic image data. In the image processing apparatus for generating
Image input means for inputting the pair of image data;
Area dividing means for dividing the gray images of the plurality of colors constituting the image data into a plurality of predetermined areas in at least one of the pair of input image data;
Selection means for selecting, for each of the predetermined areas divided by the area dividing means, a gray image of at least one color that is a part of the gray images of the plurality of colors;
Distance calculation means for calculating the distance from the grayscale image of the color selected by the selection means and the grayscale image of the other image data of the color corresponding to the grayscale image can be provided.

次に第三の実施形態の画像処理装置1−3について、以下図面を参照して詳細に説明する。図16は第三の実施形態の画像処理装置1−3の機能構成を示すブロック図、図17は画像処理装置1−3による一連の画像処理のフローチャートである。なお図16は便宜上、第一の実施形態の画像処理装置1の機能構成を示すブロック図である図1と同様の箇所は同符号で示して説明を省略し、異なる箇所のみ詳細に説明する。   Next, an image processing apparatus 1-3 according to the third embodiment will be described in detail with reference to the drawings. FIG. 16 is a block diagram illustrating a functional configuration of the image processing apparatus 1-3 according to the third embodiment, and FIG. 17 is a flowchart of a series of image processing performed by the image processing apparatus 1-3. For convenience, FIG. 16 is a block diagram illustrating the functional configuration of the image processing apparatus 1 according to the first embodiment, and the same parts as those in FIG. 1 are denoted by the same reference numerals and description thereof is omitted. Only different parts will be described in detail.

本実施形態の画像処理装置1−3は、図16に示す如く、距離算出部16−3が第一の実施形態とは異なるものであり、距離算出部16−3は読込部14によって読み込まれた基準画像Aと参照画像BとにおいてR、G、Bの3つの色の濃淡画像の全ての画素について被写体各部までの距離を算出するものである。なお本実施形態の距離算出部16−3は全ての画素について前記距離を算出するものとしたが、画素間引きや、部分的な領域についてのみ前記距離を算出するものであってもよい。本実施形態の画像処理装置1−3は上記のように構成されている。次に画像処理装置1−3による画像処理について説明する。図17は画像処理装置1−3による一連の画像処理のフローチャートである。   As shown in FIG. 16, the image processing apparatus 1-3 of the present embodiment is different from the first embodiment in the distance calculation unit 16-3, and the distance calculation unit 16-3 is read by the reading unit 14. Further, the distance to each part of the subject is calculated for all the pixels of the three-color image of R, G, and B in the reference image A and the reference image B. Although the distance calculation unit 16-3 of the present embodiment calculates the distance for all pixels, the distance calculation unit 16-3 may calculate the distance only for pixel thinning or a partial region. The image processing apparatus 1-3 according to the present embodiment is configured as described above. Next, image processing by the image processing apparatus 1-3 will be described. FIG. 17 is a flowchart of a series of image processing by the image processing apparatus 1-3.

本実施形態の画像処理装置1−3は、図17に示す如く、画像入力部10が一対の画像データすなわち基準画像Aと参照画像Bを入力し(ステップS110)、読込部14が基準画像Aを構成するRの濃淡画像Ar、Gの濃淡画像Ag、Bの濃淡画像Ab及び画像データBを構成するRの濃淡画像Br、Gの濃淡画像Bg、Bの濃淡画像Bbをそれぞれ読み込んで、輝度値等の画素値を読み出す(ステップS111)。   In the image processing apparatus 1-3 of the present embodiment, as shown in FIG. 17, the image input unit 10 inputs a pair of image data, that is, the standard image A and the reference image B (step S110), and the reading unit 14 receives the standard image A. R gray image Ar, G gray image Ag, B gray image Ab and R gray image Br, G gray image Bg, B gray image Bb constituting image data B are read respectively. A pixel value such as a value is read (step S111).

そして距離算出部16−3が、入力された基準画像Aと参照画像Bとをそれぞれ構成する一対のRの濃淡画像Ar、Br、Gの濃淡画像Ag、Bg、Bの濃淡画像Ab、Bbとから全ての画素について被写体各部までの距離を算出する(ステップS112)。   Then, the distance calculation unit 16-3 includes a pair of R grayscale images Ar, Br, and G grayscale images Ag, Bg, and B grayscale images Ab and Bb that constitute the input standard image A and reference image B, respectively. To all the pixels, the distance to each part of the subject is calculated (step S112).

次に画像選択部15が、読込部14によって読み込まれた基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abのうちから距離算出部16−3による距離の算出に最も適する1つの色の濃淡画像を選択する画像選択処理を行う(ステップS113)。なお画像選択部15による画像選択処理は、上述した第一の実施形態の画像処理装置1と同様の画像選択処理1、画像選択処理2、画像選択処理3、画像選択処理4を使用することができるため、説明は省略する。   Next, the image selection unit 15 is most suitable for the distance calculation by the distance calculation unit 16-3 from among the R, G, and B grayscale images Ar, Ag, and Ab that constitute the reference image A read by the reading unit 14. Image selection processing for selecting a gray image of one color is performed (step S113). Note that the image selection processing by the image selection unit 15 uses the same image selection processing 1, image selection processing 2, image selection processing 3, and image selection processing 4 as those of the image processing apparatus 1 of the first embodiment described above. Since it can do, description is abbreviate | omitted.

そして画像選択部15により基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abのうちから1つの色の濃淡画像が選択されると(ステップS113)、選択された色の基準画像A及び参照画像Bの濃淡画像から算出された距離のデータを、データ圧縮部17が圧縮し、メディア制御部18が圧縮された距離データを記録メディア19に記録する(ステップS114)。このようにして画像処理装置1−3による画像処理は終了する。   When the image selection unit 15 selects a gray image of one color from the gray images Ar, Ag, and Ab of the R, G, and B constituting the reference image A (step S113), the reference of the selected color is selected. The data compression unit 17 compresses the distance data calculated from the grayscale images of the image A and the reference image B, and the media control unit 18 records the compressed distance data on the recording medium 19 (step S114). In this way, the image processing by the image processing apparatus 1-3 ends.

以上により本実施形態の画像処理装置1−3によれば、基準画像Aと参照画像Bとを入力し、入力された基準画像Aと参照画像Bの全ての画素について距離を算出し、入力された基準画像Aにおいて、基準画像Aを構成するR、G、Bの色の濃淡画像Ar、Ag、Abのうちから最も距離の算出に適する1つの色の濃淡画像を選択し、選択された色の濃淡画像において算出された距離のデータを記録するので、最も距離の算出に適する1つの色の濃淡画像から算出された距離データが記録されることにより精度の高い距離データを取得することができる。   As described above, according to the image processing apparatus 1-3 of the present embodiment, the base image A and the reference image B are input, the distances are calculated for all the pixels of the input base image A and the reference image B, and are input. In the reference image A, a gray image of one color most suitable for calculating the distance is selected from the gray images Ar, Ag, Ab of the colors R, G, B constituting the reference image A, and the selected color is selected. Since the distance data calculated in the grayscale image is recorded, the distance data calculated from the grayscale image of one color most suitable for the distance calculation is recorded, whereby highly accurate distance data can be acquired. .

なお本実施形態では、画像選択部15が基準画像Aについてのみ濃淡画像の選択を行ったが本発明はこれに限られるものではなく、参照画像Bについて前記選択を行ってもよいし、基準画像Aと参照画像Bの両方について前記選択を行ってもよい。   In the present embodiment, the image selection unit 15 selects the grayscale image only for the standard image A, but the present invention is not limited to this, and the selection may be performed for the reference image B, or the standard image The selection may be performed for both A and the reference image B.

また本実施形態ではカラー画像としてR、G、Bの3つの色の濃淡画像で構成された画像を使用したが、本発明はこれに限られるものではなく、例えば4つの色等、複数の色の濃淡画像で構成されたカラー画像にも適用することができる。   In the present embodiment, an image composed of three color images of R, G, and B is used as a color image. However, the present invention is not limited to this, and a plurality of colors such as four colors are used. The present invention can also be applied to a color image composed of grayscale images.

また本発明の画像処理装置は、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理装置において、
前記一対の画像データを入力する画像入力手段と、
入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出する距離算出手段と、
入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちからその一部である少なくとも1つの色の濃淡画像を選択する選択手段と、
該選択手段により選択された色の濃淡画像において前記距離算出手段が算出した前記距離のデータを記録する記録手段とを備えてなることができる。
In addition, the image processing apparatus of the present invention calculates the distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each composed of a plurality of gray images, and obtains stereoscopic image data. In the image processing apparatus for generating
Image input means for inputting the pair of image data;
Distance calculating means for calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
Selection means for selecting at least one gray image of a plurality of color images constituting the image data from at least one of the pair of input image data; ,
Recording means for recording the distance data calculated by the distance calculation means in the grayscale image of the color selected by the selection means.

次に第四の実施形態の画像処理装置1−4について、以下図面を参照して詳細に説明する。図18は第四の実施形態の画像処理装置1−4の機能構成を示すブロック図、図19は画像処理装置1−4による一連の画像処理のフローチャートである。なお図18は便宜上、第二の実施形態の画像処理装置1−2の機能構成を示すブロック図である図18と同様の箇所は同符号で示して説明を省略し、異なる箇所のみ詳細に説明する。   Next, an image processing apparatus 1-4 according to a fourth embodiment will be described in detail with reference to the drawings. FIG. 18 is a block diagram illustrating a functional configuration of the image processing apparatus 1-4 according to the fourth embodiment, and FIG. 19 is a flowchart of a series of image processing performed by the image processing apparatus 1-4. 18 is a block diagram showing the functional configuration of the image processing apparatus 1-2 according to the second embodiment for the sake of convenience, the same parts as those in FIG. 18 are denoted by the same reference numerals, and the description thereof will be omitted. Only different parts will be described in detail. To do.

本実施形態の画像処理装置1−4は、図18に示す如く、距離算出部16−4が第二の実施形態とは異なるものであり、距離算出部16−4は読込部14によって読み込まれた基準画像Aと参照画像BとにおいてR、G、Bの3つの色の濃淡画像の全ての画素について被写体各部までの距離を算出するものである。なお本実施形態の距離算出部16−4は全ての画素について前記距離を算出するものとしたが、画素間引きや、部分的な領域についてのみ前記距離を算出するものであってもよい。本実施形態の画像処理装置1−4は上記のように構成されている。次に画像処理装置1−4による画像処理について説明する。図17は画像処理装置1−3による一連の画像処理のフローチャートである。   As shown in FIG. 18, the image processing apparatus 1-4 according to the present embodiment is different from the second embodiment in the distance calculation unit 16-4, and the distance calculation unit 16-4 is read by the reading unit 14. Further, the distance to each part of the subject is calculated for all the pixels of the three-color image of R, G, and B in the reference image A and the reference image B. In addition, although the distance calculation part 16-4 of this embodiment shall calculate the said distance about all the pixels, you may calculate the said distance only about pixel thinning | decimation or a partial area | region. The image processing apparatus 1-4 according to the present embodiment is configured as described above. Next, image processing by the image processing apparatus 1-4 will be described. FIG. 17 is a flowchart of a series of image processing by the image processing apparatus 1-3.

本実施形態の画像処理装置1−4は、図19に示す如く、画像入力部10が一対の画像データすなわち基準画像Aと参照画像Bを入力し(ステップS120)、読込部14が基準画像Aを構成するRの濃淡画像Ar、Gの濃淡画像Ag、Bの濃淡画像Ab及び画像データBを構成するRの濃淡画像Br、Gの濃淡画像Bg、Bの濃淡画像Bbをそれぞれ読み込んで、輝度値等の画素値を読み出す(ステップS121)。   In the image processing apparatus 1-4 according to the present embodiment, as shown in FIG. 19, the image input unit 10 inputs a pair of image data, that is, the standard image A and the reference image B (step S120), and the reading unit 14 receives the standard image A. R gray image Ar, G gray image Ag, B gray image Ab and R gray image Br, G gray image Bg, B gray image Bb constituting image data B are read respectively. Pixel values such as values are read (step S121).

そして距離算出部16−4が、入力された基準画像Aと参照画像Bとをそれぞれ構成する一対のRの濃淡画像Ar、Br、Gの濃淡画像Ag、Bg、Bの濃淡画像Ab、Bbとから全ての画素について被写体各部までの距離を算出する(ステップS122)。   Then, the distance calculation unit 16-4 includes a pair of R grayscale images Ar, Br, and G grayscale images Ag, Bg, and B grayscale images Ab and Bb that constitute the input standard image A and reference image B, respectively. To all the pixels, the distance to each part of the subject is calculated (step S122).

次に領域分割部22が、読込部14によって読み込まれた基準画像Aを構成するR、G、Bの色の濃淡画像Ar、Ag、Abを複数の所定領域に分割し、画像選択部15−2が、分割された所定領域毎に、R、G、Bの色の濃淡画像Ar、Ag、Abのうちから最も距離の算出に適する色の濃淡画像を選択する、領域分割及び画像選択処理を行う(ステップS123)。なお領域分割部22と画像選択部15−2による領域分割及び画像選択処理は、上述した第二の実施形態の画像処理装置1−2と同様の領域分割及び画像選択処理1又は領域分割及び画像選択処理2を使用することができるため、説明は省略する。 Next, the area dividing unit 22 divides the grayscale images Ar, Ag, and Ab of R, G, and B constituting the reference image A read by the reading unit 14 into a plurality of predetermined areas, and the image selecting unit 15- 2 performs region division and image selection processing for selecting a grayscale image having a color most suitable for calculating the distance from the grayscale images Ar, Ag, and Ab of R, G, and B colors for each divided predetermined area. This is performed (step S123). Note that the region division and image selection processing by the region division unit 22 and the image selection unit 15-2 are the same as those in the image processing apparatus 1-2 of the second embodiment described above or the region division and image selection. Since the selection process 2 can be used, description thereof is omitted.

そして画像選択部15−2により所定領域毎に基準画像Aを構成するR、G、Bの濃淡画像Ar、Ag、Abのうちから1つの色の濃淡画像が選択されると(ステップS123)、選択された色の基準画像A及び参照画像Bの濃淡画像から算出された距離のデータを、データ圧縮部17が圧縮し、メディア制御部18が圧縮された距離データを記録メディア19に記録する(ステップS124)。このようにして画像処理装置1−4による画像処理は終了する。   Then, when the image selection unit 15-2 selects one color gray image from the R, G, B gray images Ar, Ag, Ab constituting the reference image A for each predetermined region (step S123). The data compression unit 17 compresses the distance data calculated from the grayscale image of the selected standard image A and reference image B, and the media control unit 18 records the compressed distance data on the recording medium 19 ( Step S124). In this way, the image processing by the image processing apparatus 1-4 ends.

以上により本実施形態の画像処理装置1−4によれば、基準画像Aと参照画像Bとを入力し、入力された基準画像Aと参照画像Bの全ての画素について距離を算出し、入力された基準画像Aにおいて、基準画像Aを構成するR、G、Bの色の濃淡画像Ar、Ag、Abを複数の所定領域に分割し、分割された所定領域毎に、R、G、Bの色の濃淡画像Ar、Ag、Abのうちから最も距離の算出に適する1つの色の濃淡画像を選択し、選択された色の濃淡画像において算出された距離のデータを記録するので、所定領域毎に最も距離の算出に適する1つの色の画像データから算出された距離データが記録されることにより精度の高い距離データを取得することができる。   As described above, according to the image processing apparatus 1-4 of the present embodiment, the base image A and the reference image B are input, the distance is calculated for all the pixels of the input base image A and the reference image B, and the input is performed. In the reference image A, the grayscale images Ar, Ag, Ab of the colors R, G, B constituting the reference image A are divided into a plurality of predetermined areas, and R, G, B of each of the divided predetermined areas are divided. Since the gray image of one color most suitable for the calculation of the distance is selected from the gray images of colors Ar, Ag, and Ab, and the data of the distance calculated in the gray image of the selected color is recorded. The distance data calculated from the image data of one color most suitable for calculating the distance is recorded, so that highly accurate distance data can be acquired.

なお本実施形態では、画像選択部15−2が基準画像Aについてのみ濃淡画像の選択を行ったが本発明はこれに限られるものではなく、参照画像Bについて前記選択を行ってもよいし、基準画像Aと参照画像Bの両方について前記選択を行ってもよい。   In the present embodiment, the image selection unit 15-2 selects the grayscale image only for the standard image A. However, the present invention is not limited to this, and the selection may be performed for the reference image B. The selection may be performed for both the reference image A and the reference image B.

また本実施形態ではカラー画像としてR、G、Bの3つの色の濃淡画像で構成された画像を使用したが、本発明はこれに限られるものではなく、例えば4つの色等、複数の色の濃淡画像で構成されたカラー画像にも適用することができる。   In the present embodiment, an image composed of three color images of R, G, and B is used as a color image. However, the present invention is not limited to this, and a plurality of colors such as four colors are used. The present invention can also be applied to a color image composed of grayscale images.

また本発明の画像処理装置は、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理装置において、
前記一対の画像データを入力する画像入力手段と、
入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出する距離算出手段と、
入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像を複数の所定領域に分割する領域分割手段と、
該領域分割手段により分割された前記所定領域毎に、前記複数の色の濃淡画像のうちからその一部である少なくとも1つの色の濃淡画像を選択する選択手段と、
該選択手段により選択された色の濃淡画像において前記距離算出手段が算出した前記距離のデータを記録する記録手段とを備えてなることができる。
In addition, the image processing apparatus of the present invention calculates the distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each composed of a plurality of gray images, and obtains stereoscopic image data. In the image processing apparatus for generating
Image input means for inputting the pair of image data;
Distance calculating means for calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
Area dividing means for dividing the gray images of the plurality of colors constituting the image data into a plurality of predetermined areas in at least one of the pair of input image data;
Selection means for selecting, for each of the predetermined areas divided by the area dividing means, a gray image of at least one color that is a part of the gray images of the plurality of colors;
Recording means for recording the distance data calculated by the distance calculation means in the grayscale image of the color selected by the selection means.

次に、図20及び図21に上述した実施形態の画像入力部10の構成を示すブロック図の一例をそれぞれ示す。上述した実施形態の画像入力部10は、異なる視点から撮像された視差画像として少なくとも2つの画像データを入力するものであり、例えば1つのカメラが、順次視点を変えて撮像して得られた画像データを入力してもよい。   Next, an example of a block diagram showing the configuration of the image input unit 10 of the embodiment described above is shown in FIGS. The image input unit 10 according to the above-described embodiment inputs at least two image data as parallax images captured from different viewpoints. For example, an image obtained by one camera sequentially capturing images with different viewpoints. Data may be entered.

また画像入力部10として、図20に示す如く、撮影レンズ等で構成される2つの光学系10a−1、10a−2と、CCD等の撮像素子すなわちR用撮像素子10b−1r、10b−2rと、G用撮像素子10b−1g、10b−2gと、B用撮像素子10b−1b、10b−2bと、R用A/D変換部10c−1r、10c−2rと、G用A/D変換部10c−1g、10c−2gと、B用A/D変換部10c−1b、10c−2bとを有し、異なる視点に位置する少なくとも2つの撮像系つまり2眼を備えた複眼カメラ10を使用してもよい。この場合、撮像系は、2つの光学系を持ち、その各々の光軸に対応した複数の撮像素子を配置しそれらの出力信号を用いて信号処理を行い、最終的に1つの撮像出力信号を得る多板構成とする。このような複眼カメラでは略同時に撮像された視差画像を得ることができる。   Further, as the image input unit 10, as shown in FIG. 20, two optical systems 10a-1, 10a-2 constituted by photographing lenses and the like, and image sensors such as CCDs, that is, R image sensors 10b-1r, 10b-2r. G image sensors 10b-1g, 10b-2g, B image sensors 10b-1b, 10b-2b, R A / D converters 10c-1r, 10c-2r, and G A / D converters Using a compound eye camera 10 having at least two imaging systems, that is, two eyes located at different viewpoints, having units 10c-1g, 10c-2g and B A / D converters 10c-1b, 10c-2b May be. In this case, the imaging system has two optical systems, a plurality of imaging elements corresponding to the respective optical axes are arranged, signal processing is performed using those output signals, and finally one imaging output signal is obtained. A multi-plate configuration is obtained. With such a compound-eye camera, parallax images captured at substantially the same time can be obtained.

また画像入力部10は、図21に示す如く、上記と同様の光学系10a−1と、R用撮像素子10b−1rと、G用撮像素子10b−1gと、B用撮像素子10b−1bと、R用A/D変換部10c−1rと、G用A/D変換部10c−1gと、B用A/D変換部10c−1bとを備えてなるカメラ10A及び上記と同様の光学系10a−2と、R用撮像素子10b−2rと、G用撮像素子10b−2gと、B用撮像素子10b−2bと、R用A/D変換部10c−2rと、G用A/D変換部10c−2gと、B用A/D変換部10c−2bとを備えてなるカメラ10Bの2つのカメラから構成されるものであってもよい。この場合カメラ10Aとカメラ10Bは異なる視点から撮像可能な位置に配設される。なお2つ以上のカメラから構成されるものであってもよい。   Further, as shown in FIG. 21, the image input unit 10 includes the same optical system 10a-1, the R image sensor 10b-1r, the G image sensor 10b-1g, and the B image sensor 10b-1b. A camera 10A comprising an R A / D converter 10c-1r, a G A / D converter 10c-1g, and a B A / D converter 10c-1b, and an optical system 10a similar to the above. -2, R image sensor 10b-2r, G image sensor 10b-2g, B image sensor 10b-2b, R A / D converter 10c-2r, and G A / D converter 10c-2g and A / D conversion unit 10c-2b for B may be configured by two cameras 10B. In this case, the camera 10A and the camera 10B are arranged at positions where imaging can be performed from different viewpoints. It may be composed of two or more cameras.

そして上記図20及び図21の画像入力部10は、該画像処理入力部10により得られた視差画像の画像データを、図2のステップS1又は図12のステップS51、図17のステップS110、図19のステップS120にて入力する。   The image input unit 10 in FIGS. 20 and 21 uses the image data of the parallax image obtained by the image processing input unit 10 as step S1 in FIG. 2 or step S51 in FIG. 12, step S110 in FIG. Input in step S120.

なお本発明の画像処理装置は、上述した実施形態の画像処理装置に限られるものではなく、本発明の趣旨を逸脱しない範囲において適宜設計変更可能である。   The image processing apparatus of the present invention is not limited to the image processing apparatus of the above-described embodiment, and can be appropriately changed in design without departing from the spirit of the present invention.

第一の実施形態の画像処理装置の機能構成を示すブロック図The block diagram which shows the function structure of the image processing apparatus of 1st embodiment. 図1の画像処理装置による一連の画像処理のフローチャートFlowchart of a series of image processing by the image processing apparatus of FIG. 画像選択部による第一の画像選択処理のフローチャートFlowchart of first image selection processing by image selection unit 画像選択部による第二の画像選択処理のフローチャートFlowchart of second image selection processing by image selection unit カウント処理のフローチャートCount processing flowchart 濃淡画像の輝度分布及び画素のカウント方法の一例Example of brightness distribution of grayscale image and pixel counting method 濃淡画像の輝度分布及び画素のカウント方法の別の一例Another example of brightness distribution of grayscale image and pixel counting method 画像選択部による第三の画像選択処理のフローチャートFlowchart of third image selection process by image selection unit カラー画像の一例Example of color image 画像選択部による第四の画像選択処理のフローチャートFlowchart of fourth image selection process by image selection unit エッジが抽出された濃淡画像においてエッジの交差回数のカウントの一例An example of counting the number of intersections of edges in a grayscale image from which edges are extracted 第二の実施形態の画像処理装置の機能構成を示すブロック図The block diagram which shows the function structure of the image processing apparatus of 2nd embodiment. 図11の画像処理装置による一連の画像処理のフローチャートFlowchart of a series of image processing by the image processing apparatus of FIG. 第一の画像分割及び画像選択処理のフローチャート(その1)Flow chart of first image division and image selection processing (part 1) 第一の画像分割及び画像選択処理のフローチャート(その2)Flow chart of first image division and image selection processing (part 2) 第一の画像分割及び画像選択処理のフローチャート(その3)Flow chart of first image division and image selection processing (part 3) 第一の画像分割及び画像選択処理のフローチャート(その4)Flowchart of first image division and image selection processing (part 4) 領域分割部及び画像選択部による画像分割及び画像選択方法の一例Example of image segmentation and image selection method by region segmentation unit and image selection unit 第二の画像分割及び画像選択処理のフローチャート(その1)Flowchart of second image division and image selection process (part 1) 第二の画像分割及び画像選択処理のフローチャート(その2)Flowchart of second image division and image selection process (part 2) 第二の画像分割及び画像選択処理のフローチャート(その3)Flow chart of second image division and image selection processing (part 3) 第二の画像分割及び画像選択処理のフローチャート(その4)Flowchart of second image division and image selection processing (part 4) 第三の実施形態の画像処理装置の機能構成を示すブロック図The block diagram which shows the function structure of the image processing apparatus of 3rd embodiment. 図16の画像処理装置による一連の画像処理のフローチャートFlowchart of a series of image processing by the image processing apparatus of FIG. 第四の実施形態の画像処理装置の機能構成を示すブロック図The block diagram which shows the function structure of the image processing apparatus of 4th embodiment. 図18の画像処理装置による一連の画像処理のフローチャートFlowchart of a series of image processing by the image processing apparatus of FIG. 画像入力部の構成を示すブロック図の一例Example of block diagram showing configuration of image input unit 画像入力部の構成を示すブロック図の別の一例Another example of block diagram showing configuration of image input unit

符号の説明Explanation of symbols

1、1−2、1−3、1−4 画像処理装置
10 画像入力部(画像入力手段)
10A、10B カメラ
10a−1、10a−2 光学系
15、15−2 画像選択部(画像選択手段)
16、16−3、16−4 距離算出部(距離算出手段)
19 記録メディア(記録手段)
22 領域分割部(領域分割手段)
DESCRIPTION OF SYMBOLS 1, 1-2, 1-3, 1-4 Image processing apparatus 10 Image input part (image input means)
10A, 10B Camera 10a-1, 10a-2 Optical system 15, 15-2 Image selection unit (image selection means)
16, 16-3, 16-4 Distance calculation part (distance calculation means)
19 Recording media (recording means)
22 Region dividing unit (region dividing means)

Claims (11)

被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理装置において、
前記一対の画像データを入力する画像入力手段と、
入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出する距離算出手段と、
入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちから最も前記距離算出に適する1つの色の濃淡画像を選択する選択手段と、
該選択手段により選択された色の濃淡画像において前記距離算出手段が算出した前記距離のデータを記録する記録手段とを備えてなることを特徴とする画像処理装置。
In an image processing apparatus that generates stereoscopic image data by calculating a distance to a subject from a pair of image data, each of which is obtained by imaging a subject from two viewpoints, each composed of a plurality of gray images,
Image input means for inputting the pair of image data;
Distance calculating means for calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
Selecting means for selecting, in at least one of the input image data of the pair of image data, a gray image of one color most suitable for the distance calculation from the gray images of the plurality of colors constituting the image data; ,
An image processing apparatus comprising: a recording unit that records data of the distance calculated by the distance calculation unit in a grayscale image of a color selected by the selection unit.
前記選択手段が、前記複数の色の濃淡画像においてそれぞれ最大輝度値と最小輝度値との輝度差の値を算出し、該算出された前記輝度差の値が最も大きい濃淡画像を選択することを特徴とする請求項1に記載の画像処理装置。   The selection means calculates a value of a luminance difference between a maximum luminance value and a minimum luminance value in each of the plurality of color gray images, and selects the gray image having the largest value of the calculated luminance difference. The image processing apparatus according to claim 1, wherein: 前記選択手段が、前記複数の色の濃淡画像においてそれぞれ予め所定間隔で定められた輝度値を有する画素の数を算出し、該算出された前記画素の数が最も多い濃淡画像を選択することを特徴とする請求項1に記載の画像処理装置。   The selection means calculates the number of pixels each having a predetermined brightness value in the grayscale images of the plurality of colors and selects the grayscale image having the largest number of the calculated pixels. The image processing apparatus according to claim 1, wherein: 前記選択手段が、前記複数の色の濃淡画像においてそれぞれエッジを抽出し、エッジが抽出された画素の数を算出して、該算出された前記画素の数が最も多い濃淡画像を選択することを特徴とする請求項1に記載の画像処理装置。   The selection means extracts edges in the grayscale images of the plurality of colors, calculates the number of pixels from which edges are extracted, and selects the grayscale image having the largest number of the calculated pixels. The image processing apparatus according to claim 1, wherein: 前記選択手段が、所定間隔毎の画素列において前記画素の数を算出することを特徴とする請求項3又は4に記載の画像処理装置。   5. The image processing apparatus according to claim 3, wherein the selection unit calculates the number of pixels in a pixel row at predetermined intervals. 前記選択手段が、前記複数の色の濃淡画像においてそれぞれエッジを抽出し、所定間隔毎の画素列と前記エッジとが交差する回数を算出し、算出された前記回数が最も多い濃淡画像を選択することを特徴とする請求項1に記載の画像処理装置。   The selection unit extracts edges in the grayscale images of the plurality of colors, calculates the number of times that the edge intersects the pixel column at predetermined intervals, and selects the grayscale image with the largest number of calculated times. The image processing apparatus according to claim 1. 前記画像入力手段が、2つのカメラからなるものであることを特徴とする請求項1〜6いずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the image input unit includes two cameras. 前記画像入力手段が、2つの光学系を備えた複眼カメラであることを特徴とする請求項1〜6いずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the image input unit is a compound-eye camera including two optical systems. 前記複眼カメラが、多板構成からなる撮像系を備えたものであることを特徴とする請求項8に記載の画像処理装置。   The image processing apparatus according to claim 8, wherein the compound eye camera includes an imaging system having a multi-plate configuration. 被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成する画像処理方法において、
前記一対の画像データを入力し、
該入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出し、
前記入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちから最も前記距離算出に適する1つの色の濃淡画像を選択し、
該選択された色の濃淡画像において算出された前記距離のデータを記録することを特徴とする画像処理方法。
In an image processing method for generating stereoscopic image data by calculating a distance to a subject from a pair of image data, each of which is obtained by imaging a subject from two viewpoints, each composed of a plurality of gray images,
Input the pair of image data,
Calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
In at least one image data of the pair of input image data, a gray image of one color most suitable for the distance calculation is selected from the gray images of the plurality of colors constituting the image data,
An image processing method comprising: recording the distance data calculated in the grayscale image of the selected color.
コンピュータに、被写体を2つの視点から撮像して得た、各々が複数の色の濃淡画像で構成された一対の画像データから前記被写体までの距離を算出して立体画像データを生成することを実行させるための画像処理プログラムにおいて、
前記一対の画像データを入力し、
該入力された前記一対の画像データの複数の色の複数の画素について前記距離を算出し、
前記入力された前記一対の画像データの少なくとも一方の画像データにおいて、該画像データを構成する前記複数の色の濃淡画像のうちから最も前記距離算出に適する1つの色の濃淡画像を選択し、
該選択された色の濃淡画像において算出された前記距離のデータを記録することを実行させるための画像処理プログラム。
Executes the computer to generate stereoscopic image data by calculating the distance to the subject from a pair of image data obtained by imaging the subject from two viewpoints, each composed of a gray image of a plurality of colors. In an image processing program for
Input the pair of image data,
Calculating the distance for a plurality of pixels of a plurality of colors of the pair of input image data;
In at least one image data of the pair of input image data, a gray image of one color most suitable for the distance calculation is selected from the gray images of the plurality of colors constituting the image data,
An image processing program for executing recording of the data of the distance calculated in the grayscale image of the selected color.
JP2008085448A 2008-03-28 2008-03-28 Image processor, image processing method, and program Withdrawn JP2009238076A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008085448A JP2009238076A (en) 2008-03-28 2008-03-28 Image processor, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008085448A JP2009238076A (en) 2008-03-28 2008-03-28 Image processor, image processing method, and program

Publications (1)

Publication Number Publication Date
JP2009238076A true JP2009238076A (en) 2009-10-15

Family

ID=41251907

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008085448A Withdrawn JP2009238076A (en) 2008-03-28 2008-03-28 Image processor, image processing method, and program

Country Status (1)

Country Link
JP (1) JP2009238076A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013174510A (en) * 2012-02-24 2013-09-05 Resonant Systems Inc Stereo camera unit and automobile monitor system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013174510A (en) * 2012-02-24 2013-09-05 Resonant Systems Inc Stereo camera unit and automobile monitor system

Similar Documents

Publication Publication Date Title
TWI729995B (en) Generating a merged, fused three-dimensional point cloud based on captured images of a scene
US8401274B2 (en) Image processing apparatus and method
JP2001194114A (en) Image processing apparatus and method and program providing medium
JP5633058B1 (en) 3D measuring apparatus and 3D measuring method
JP7223079B2 (en) IMAGE PROCESSING APPARATUS, CONTROL METHOD THEREOF, AND IMAGING APPARATUS
CN103262530B (en) Video monitoring devices
CN103828345A (en) Apparatus, method, and program for image processing, storage medium, and image pickup apparatus
WO2018147059A1 (en) Image processing device, image processing method, and program
JPWO2011125461A1 (en) Image generating apparatus and method, and printer
JP2009236811A (en) Image processing device, image processing method, and program
US11182918B2 (en) Distance measurement device based on phase difference
JP2011237296A (en) Three dimensional shape measuring method, three dimensional shape measuring device, and program
JP4296617B2 (en) Image processing apparatus, image processing method, and recording medium
JP2002056379A (en) Three-dimensional data generating device
JP2016217944A (en) Measurement device and measurement method
JP4337203B2 (en) Distance image generating apparatus, distance image generating method, and program providing medium
CN112585423B (en) Distance measuring camera
JP2001338280A (en) Three-dimensional space information input device
JP2015148498A (en) Distance measurement device and distance measurement method
JP2009238076A (en) Image processor, image processing method, and program
JP2009238077A (en) Image processor, image processing method, and program
JP2009238075A (en) Image processor, image processing method, and program
JP5642561B2 (en) House change interpretation support device, house change interpretation support method, and house change interpretation support program
JP2003050110A (en) Three-dimensional shape data producing system and method, program and recording medium
WO2016056202A1 (en) Image processing apparatus, image processing method, and program

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20110607