JP2016018340A - Image processing apparatus - Google Patents
Image processing apparatus Download PDFInfo
- Publication number
- JP2016018340A JP2016018340A JP2014139965A JP2014139965A JP2016018340A JP 2016018340 A JP2016018340 A JP 2016018340A JP 2014139965 A JP2014139965 A JP 2014139965A JP 2014139965 A JP2014139965 A JP 2014139965A JP 2016018340 A JP2016018340 A JP 2016018340A
- Authority
- JP
- Japan
- Prior art keywords
- blur amount
- image
- distance
- axis direction
- edge
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Image Analysis (AREA)
- Image Processing (AREA)
- Closed-Circuit Television Systems (AREA)
Abstract
Description
本発明は、画像処理装置に関し、より詳細には、撮像された画像中の物体を認識する画像処理装置に関する。 The present invention relates to an image processing apparatus, and more particularly to an image processing apparatus that recognizes an object in a captured image.
近年、道路における車両の交通量の計測、また所定の敷地内に侵入した物体の特定等を目的として、ビデオカメラ等の撮像装置を用いた監視システムが知られている(特許文献1参照)。
このような監視システムにより撮像された画像において、複数の物体が同時に撮像されている場合、物体同士が重なっていると、各々の物体をひとつの物体として認識してしまい、別々の物体として認識することができず、監視対象に対して正確な情報を取得することができない場合がある。
In recent years, a monitoring system using an imaging device such as a video camera has been known for the purpose of measuring the traffic volume of a vehicle on a road and identifying an object that has entered a predetermined site (see Patent Document 1).
In an image captured by such a monitoring system, when a plurality of objects are captured at the same time, if the objects overlap each other, each object is recognized as one object and is recognized as a separate object. In some cases, accurate information cannot be acquired for the monitoring target.
但し、そのような場合であっても、撮像装置から物体までの距離を算出することができれば、撮像された物体を別々の物体として認識することができ、さらに撮像方向に対する、各々の物体の前後関係も認識することができる。
従来、撮像装置からの画像を処理して被写体までの距離を測定する方法としてステレオ法が広く知られている。これは測距対象となる被写体を複数の撮像装置で撮像し、撮像装置間の距離(基線長)と画像上での視差を用い、三角測距の原理で距離を測定するものである。
また、他の方法として、DFD(Depth from Defocus)法がある。これは画像のボケ量と被写体距離との相関情報から距離を測定するものであり、単眼カメラで実現できるため、システムの小型化に有利である。
However, even in such a case, if the distance from the imaging device to the object can be calculated, the captured object can be recognized as a separate object, and further, before and after each object in the imaging direction. Relationships can also be recognized.
Conventionally, a stereo method is widely known as a method for measuring a distance to a subject by processing an image from an imaging apparatus. In this method, a subject to be distance-measured is imaged by a plurality of imaging devices, and the distance is measured based on the principle of triangulation using the distance (baseline length) between the imaging devices and the parallax on the image.
Another method is a DFD (Depth from Defocus) method. This measures the distance from the correlation information between the blur amount of the image and the subject distance, and can be realized with a monocular camera, which is advantageous for downsizing of the system.
また、撮像装置から物体までの距離を算出する他の方法として、画像のボケ量から距離を算出する方法において、画像のボケ量を推定する手法として、画像の対数振幅スペクトル上に現れる暗い円環の半径から、ボケの特性を表現するPSF(Point Spread Function:点像分布関数)の推定を行う手法(非特許文献1)、画像の対数振幅スペクトル上の輝度こう配のベクトル分布を用いてボケの特性を表現し、PSFの推定を行う手法(非特許文献2)がある。 In addition, as another method for calculating the distance from the imaging device to the object, as a method for estimating the image blur amount in the method for calculating the distance from the image blur amount, a dark circle appearing on the logarithmic amplitude spectrum of the image is used. A method of estimating PSF (Point Spread Function) that expresses the characteristic of blur from the radius of the image (Non-Patent Document 1), and using the vector distribution of the luminance gradient on the logarithmic amplitude spectrum of the image, There is a technique (Non-patent Document 2) that expresses characteristics and estimates PSF.
しかしながら、これらの手法はボケ量を推定する上で画像の周波数解析を伴うため、物体同士が重なって撮像された画像から、各画素位置における撮像装置から物体までの距離を算出する上で(各々の物体を別々に認識する上で)、処理の負荷が重く、また処理に時間がかかるという問題がある。 However, since these methods involve frequency analysis of images in estimating the amount of blur, in calculating the distance from the imaging device to the object at each pixel position from images captured by overlapping objects (each In the case of recognizing objects separately, there is a problem that the processing load is heavy and the processing takes time.
本発明は、前記従来の問題に鑑みてなされたものであって、その目的は、画像処理装置において、従来の周波数解析などの重い処理負担を伴うことなく、撮像された画像中で重なった物体を個別に認識することである。 The present invention has been made in view of the above-described conventional problems, and an object of the present invention is to provide an object that is overlapped in captured images without a heavy processing burden such as conventional frequency analysis in an image processing apparatus. Is to recognize them individually.
本発明は、物体を撮像した撮像装置からの画像を取得する画像取得手段と、前記画像取得手段により取得した画像のエッジを抽出するエッジ抽出手段と、前記エッジ抽出手段により抽出されたエッジを含む所定領域内における画素の輝度差に基づいて、前記エッジのボケ量を算出するボケ量算出手段と、前記ボケ量算出手段により算出されたボケ量を前記画像の前記エッジの各画素位置に割り当てるボケ量割り当て手段と、前記ボケ量割り当て手段によりボケ量が割り当てられた前記エッジの画素に対して、所定の方向に走査し、走査方向にあるエッジとエッジの間に位置する各画素に、ボケ量の小さい方のエッジのボケ量を割り当てるボケ量走査手段と、前記ボケ量走査手段により割り当てられたボケ量と、前記撮像装置からの画像のボケ量と前記撮像装置から被写体までの距離との相関情報とに基づいて、各画素位置における、前記撮像装置から前記物体までの距離を算出する距離算出手段と、前記距離算出手段により算出された各画素位置における、前記撮像装置から前記物体までの距離に基づき、距離画像を生成する距離画像生成手段と、を有することを特徴とする画像処理装置に関する。 The present invention includes an image acquisition unit that acquires an image from an imaging device that images an object, an edge extraction unit that extracts an edge of an image acquired by the image acquisition unit, and an edge extracted by the edge extraction unit Based on a luminance difference between pixels in a predetermined area, a blur amount calculating unit that calculates the blur amount of the edge, and a blur that is allocated to each pixel position of the edge of the image by the blur amount calculated by the blur amount calculating unit. A quantity allocation unit and the edge pixel to which the blur amount is allocated by the blur amount allocation unit are scanned in a predetermined direction, and a blur amount is applied to each pixel located between the edges in the scanning direction. A blur amount scanning unit that allocates a blur amount of the smaller edge, a blur amount allocated by the blur amount scanning unit, and a blur of an image from the imaging device And distance calculation means for calculating the distance from the imaging device to the object at each pixel position based on correlation information between the imaging device and the distance from the imaging device, and each pixel calculated by the distance calculation means And a distance image generation unit configured to generate a distance image based on a distance from the imaging device to the object at a position.
本発明によれば、撮像された画像において、物体同士が重なっている場合であっても、画像処理の負荷を低減した上で、各々の物体を別々に認識することができる。 According to the present invention, each object can be recognized separately after reducing the load of image processing even if the objects are overlapped in the captured image.
以下、本発明の実施形態について、図面を参照して説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.
図1は、本発明の実施形態に係る画像処理装置を含む画像処理システムを示す図である。
この画像処理システムは、画像処理装置1と、それぞれが画像処理装置1に接続された撮像装置2、入力装置3、記録媒体4、及び出力装置5を備えている。
FIG. 1 is a diagram illustrating an image processing system including an image processing apparatus according to an embodiment of the present invention.
The image processing system includes an
画像処理装置1は、例えば、PC(Personal Computer)等であり、撮像装置2、又は記録媒体4から入力される画像データを処理する。画像処理装置1における画像処理の詳細は、図2から図15を用いて後述する。
The
撮像装置2は、例えば電子カメラ等であり、被写体(オブジェクト)を撮像するように配置される。本実施形態では、撮像装置2で撮像し、画像処理装置1に入力する画像として、カラー画像を例に採って説明するが、モノクロ画像を、撮像装置2で撮像し、画像処理装置1に入力することもできる。
The
入力装置3は、例えば、キーボード、マウス等であり、ユーザが画像処理装置1に対して種々の指示を与えるための装置である。
記録媒体4は、例えば、CD(Compact Disk)、SDメモリカード(SD Memory Card)、USBメモリ(Universal Serial Bus Memory)等であり、画像及び当該画像を撮像した撮像装置に関するデータを記録するための媒体である。
出力装置5は、例えば、モニタ等の表示装置であり、撮像装置2、又は記録媒体4から入力される画像、また画像処理装置1により画像処理された画像等を、必要に応じて出力する。
The
The
The
画像処理装置1は、制御部11と、それぞれが制御部11に接続された入力部12、撮像装置制御部13、ROM(Read Only Memory)14、RAM(Random Access Memory)15、ストレージ16、及び出力部17を備えている。
制御部11は、画像処理装置1のコントローラとして機能し、例えば、CPU(Central Processing Unit)等である。
また、詳細は後述するが、制御部11は、画像処理(例えば、後述のストレージ16に格納されるアプリケーションプログラム等)を実行するために、ボケ量推定手段21と、距離画像生成手段22を備えている。
The
The
Although details will be described later, the
入力部12は、撮像装置2及び記録媒体4から画像等を、また入力装置3から種々の指示(命令)を受けるためのインタフェースである。
撮像装置制御部13は、撮像装置2の焦点距離、絞り、シャッター速度等を制御する。
The
The imaging
ROM14は、制御部11が実行するプログラムや固定データを記憶するメモリであり、RAM15は、制御部11のワークエリアとなるメモリである。
ストレージ16は、例えば、ハードディスク等の大容量記憶装置であり、撮像装置2で撮像され、制御部11で画像処理が施された画像データ、制御部11で生成されたデータ、その他のアプリケーションプログラムを格納する。
出力部17は、出力装置5と通信を行うためのインタフェースであり、例えば、制御部11で画像処理が施された画像データ等を、出力装置5に表示させる。
The
The
The
次に、制御部11における画像処理について、説明する。
制御部11は、画像を処理する上で、ボケ量推定手段21と、距離画像生成手段22を備える。
ボケ量推定手段21は、撮像装置2により撮像された画像、また記録媒体4に保存された画像のボケ量を推定する。
距離画像生成手段22は、ボケ量推定手段21により推定されたボケ量と、ボケ量を推定した画像を撮像した撮像装置2の焦点位置から被写体までの距離との対応関係を示すデータに基づき、撮像装置2から被写体までの距離を画像として生成する。
なお、以後の制御部11における画像処理の説明では、入力部12に入力される画像として、撮像装置2により撮像された画像を例に採って説明する。
Next, image processing in the
The
The blur
The distance
In the following description of image processing in the
図2は、図1におけるボケ量推定手段21の機能構成を示すブロック図である。図2に示すように、ボケ量推定手段21は、画像取得手段211、モノクロ変換手段212、ノイズ除去手段213、エッジベクトル算出手段214、エッジ判定手段215、輝度差算出手段216、ボケ量算出手段217を備えている。
FIG. 2 is a block diagram showing a functional configuration of the blur amount estimation means 21 in FIG. As shown in FIG. 2, the blur
画像取得手段211は、入力部12を介して、撮像装置2により撮像された画像を取得する。このとき、撮像装置2の光学系は、撮像装置制御部13による焦点距離及び絞りの制御により、被写界深度の浅い状態(即ち、ピントの合う範囲の狭い状態)に設定される。
The image acquisition unit 211 acquires an image captured by the
モノクロ変換手段212は、画像取得手段211により取得されたカラー画像をモノクロ画像に変換する。なお、入力部12に入力された画像がモノクロ画像である場合には、モノクロ変換手段212による処理は不要となる。
ノイズ除去手段213は、例えば、メディアンフィルタ、ガウシアンフィルタ等を備え、モノクロ変換手段212によりモノクロ画像に変換された画像からピクセルノイズを除去する(即ち、ノイズを平滑化処理した画像を作成する)。
このように、ノイズ除去手段213によりピクセルノイズを予め除去しておくことで、エッジベクトル算出手段214及びエッジ判定手段215でエッジ部を精度よく抽出できる。
The
The
As described above, by removing the pixel noise in advance by the
エッジベクトル算出手段214は、例えば、Sobel(ソーベル)フィルタ、Canny(キャニー)フィルタを備え、ノイズ除去手段213によりノイズが除去されたモノクロ画像の各画素のエッジベクトルの強度(以下、エッジ強度)及びエッジベクトルの方向(以下、エッジ方向)を算出する。
The edge vector calculation unit 214 includes, for example, a Sobel filter and a Canny filter, and the intensity (hereinafter referred to as edge strength) of the edge vector of each pixel of the monochrome image from which noise has been removed by the
具体的には、エッジベクトル算出手段214は、画像の横軸方向(以下、x軸方向)のSobelフィルタ(エッジ検出フィルタ)Sxの出力をfx、画像の縦軸方向(以下、y軸方向)のSobelフィルタSyの出力をfyとして、下記の式(1)、及び式(2)により、エッジ強度及びエッジ方向を算出する。
エッジ強度=√(fx2+fy2) ・・・式(1)
エッジ方向=tan−1(fy/fx) ・・・式(2)
Specifically, the edge vector calculating means 214 outputs fx as the output of the Sobel filter (edge detection filter) Sx in the horizontal axis direction (hereinafter referred to as the x-axis direction) of the image, and the vertical axis direction of the image (hereinafter referred to as the y-axis direction). Assuming that the output of the Sobel filter Sy is fy, the edge strength and the edge direction are calculated by the following equations (1) and (2).
Edge strength = √ (fx 2 + fy 2 ) (1)
Edge direction = tan −1 (fy / fx) (2)
エッジ判定手段215は、エッジベクトル算出手段214によりエッジ強度が算出された各画素のうち、そのエッジ強度が算出された画素の両側の画素のエッジ強度と比べて、エッジ強度の差又は比が所定の閾値を超える画素(注目画素)を、エッジ部画素と判定することでエッジを抽出する。
このように、エッジベクトル算出手段214及びエッジ判定手段215は、エッジ抽出手段として機能する。
The edge determination unit 215 has a predetermined difference or ratio of edge strength compared to the edge strength of the pixels on both sides of the pixel for which the edge strength is calculated among the pixels for which the edge strength is calculated by the edge vector calculation unit 214. An edge is extracted by determining a pixel (a target pixel) that exceeds the threshold value as an edge portion pixel.
Thus, the edge vector calculation unit 214 and the edge determination unit 215 function as an edge extraction unit.
輝度差算出手段216は、エッジ判定手段215により判定されたエッジ部画素のエッジ方向の両側に位置する所定数の画素の画素値としての輝度の差を算出する。
ボケ量算出手段217は、エッジベクトル算出手段214により算出されたエッジ部画素のエッジ強度と、輝度差算出手段216により算出された輝度差とから、エッジ部画素のボケ量を算出する。
なお、輝度差算出手段216による輝度差の算出方法、及びボケ量算出手段217によるボケ量の算出方法は、図3を用いて説明する。
The luminance difference calculation unit 216 calculates a luminance difference as pixel values of a predetermined number of pixels located on both sides in the edge direction of the edge portion pixel determined by the edge determination unit 215.
The blur amount calculation unit 217 calculates the blur amount of the edge pixel from the edge strength of the edge pixel calculated by the edge vector calculation unit 214 and the luminance difference calculated by the luminance difference calculation unit 216.
The luminance difference calculation method by the luminance difference calculation unit 216 and the blur amount calculation method by the blur amount calculation unit 217 will be described with reference to FIG.
図3は、輝度対画素位置特性であり、輝度差算出手段216による輝度差の算出、及びボケ量算出手段217によるボケ量の算出について説明するための図である。なお、図3の横軸は画素の位置、縦軸は輝度を示している。
図3において、画素Peはエッジ部画素を示している。画素Pe+1、画素Pe−1は、画素Peのエッジベクトル方向の両隣(両側の直近)の一対の画素であり、その輝度差Aは、エッジベクトル算出手段214により、画素Peのエッジ強度として算出される。
また、画素Pe+2、画素Pe−2は、画素Pe+1、画素Pe−1の両隣の一対の画素であり、その輝度差Bは、輝度差算出手段216により算出される。
FIG. 3 is a diagram illustrating luminance vs. pixel position characteristics, illustrating the calculation of the luminance difference by the luminance difference calculation unit 216 and the calculation of the blur amount by the blur amount calculation unit 217. In FIG. 3, the horizontal axis indicates the pixel position, and the vertical axis indicates the luminance.
In FIG. 3, a pixel Pe indicates an edge pixel. The pixel Pe + 1 and the pixel Pe-1 are a pair of pixels adjacent to each other in the edge vector direction of the pixel Pe (nearest on both sides), and the luminance difference A is calculated as the edge strength of the pixel Pe by the edge vector calculation unit 214. The
The pixel Pe + 2 and the pixel Pe-2 are a pair of pixels adjacent to the pixel Pe + 1 and the pixel Pe-1, and the luminance difference B is calculated by the luminance difference calculating unit 216.
ボケ量算出手段217は、エッジベクトル算出手段214により輝度差A、また輝度差算出手段216により輝度差Bが算出されると、下記の式(3)により、輝度差Bと輝度差2Aとを比較することで、エッジのボケ量を算出する。
ボケ量=B÷2A ・・・式(3)
When the luminance difference A is calculated by the edge vector calculating unit 214 and the luminance difference B is calculated by the luminance difference calculating unit 216, the blur amount calculating unit 217 calculates the luminance difference B and the luminance difference 2A by the following equation (3). By comparing, the blur amount of the edge is calculated.
Bokeh amount = B ÷ 2A (3)
また、図3において、画素Pe+2と画素Pe+1との輝度差をB1、画素Pe−2と画素Pe−1との輝度差をB2とすると、下記の式(4)により、エッジのボケ量を算出することもできる。
ボケ量=(A+B1+B2)÷2A ・・・式(4)
Further, in FIG. 3, when the luminance difference between the pixel Pe + 2 and the pixel Pe + 1 is B1, and the luminance difference between the pixel Pe-2 and the pixel Pe-1 is B2, the blur amount of the edge is calculated by the following equation (4). You can also
Bokeh amount = (A + B1 + B2) ÷ 2A Expression (4)
図4は、ガウシアンフィルタの分散の大きさを変更した場合における、輝度対画素位置特性である。
なお、図4では、ガウシアンフィルタの分散の大きさ(正確には、ガウス分布における分散値の平方根)を、パラメータ(分散;「σ」)で示している。また、図3と同様に、図4の横軸は画素の位置、縦軸は輝度を示している。さらに、図4では、エッジ部の画素位置を、9番目の画素位置に設定している。
FIG. 4 shows luminance versus pixel position characteristics when the magnitude of variance of the Gaussian filter is changed.
In FIG. 4, the magnitude of the variance of the Gaussian filter (more precisely, the square root of the variance value in the Gaussian distribution) is indicated by a parameter (dispersion; “σ”). Similarly to FIG. 3, the horizontal axis of FIG. 4 indicates the pixel position, and the vertical axis indicates the luminance. Further, in FIG. 4, the pixel position of the edge portion is set to the ninth pixel position.
図4において、例えば、σ=0の場合(ガウシアンフィルタの分散の大きさが小さい場合)、図3における画素Peに対応する9番目の画素の輝度が128、画素Pe+1に対応する10番目の画素の輝度が256、画素Pe−1に対応する8番目の画素の輝度が0であることから、図3における輝度差Aは256となる。また、画素Pe+2に対応する11番目の画素の輝度は256、画素Pe−2に対応する7番目の画素の輝度は0であることから、図3における輝度差Bは256となる(図3における輝度差B1、B2は0となる)。輝度差A及び輝度差Bを、式(3)に代入して、σ=0の場合のボケ量を算出すると、ボケ量は0.50となる。なお、この値がボケ量の最小値となる。
In FIG. 4, for example, when σ = 0 (when the variance of the Gaussian filter is small), the ninth pixel corresponding to the pixel Pe in FIG. 3 has a luminance of 128 and the tenth pixel corresponding to the
次に、σ=2.4の場合のボケ量を算出する。σ=2.4の場合、図4に示すように、図3における画素Peに対応する9番目の画素の輝度が128、画素Pe+1に対応する10番目の画素の輝度が169、画素Pe−1に対応する8番目の画素の輝度が88であることから、図3における輝度差Aは81となる。また、画素Pe+2に対応する11番目の画素の輝度は204、画素Pe−2に対応する7番目の画素の輝度は53であることから、図3における輝度差Bは151となる(図3における輝度差B1、B2は35となる)。輝度差A及び輝度差Bは、式(3)に代入して、σ=2.4の場合のボケ量を算出すると、ボケ量は0.93となる。
また、σ=3.2の場合のボケ量は、同様に計算すると、0.99となる。
Next, the amount of blur when σ = 2.4 is calculated. When σ = 2.4, as shown in FIG. 4, the luminance of the ninth pixel corresponding to the pixel Pe in FIG. 3 is 128, the luminance of the tenth pixel corresponding to the pixel Pe + 1 is 169, and the pixel Pe−1. Since the luminance of the eighth pixel corresponding to is 88, the luminance difference A in FIG. Further, since the luminance of the eleventh pixel corresponding to the pixel Pe + 2 is 204 and the luminance of the seventh pixel corresponding to the pixel Pe-2 is 53, the luminance difference B in FIG. 3 is 151 (in FIG. 3). The luminance difference B1 and B2 is 35). When the luminance difference A and the luminance difference B are substituted into the equation (3) and the blur amount when σ = 2.4 is calculated, the blur amount is 0.93.
Further, the blur amount in the case of σ = 3.2 is calculated as 0.99.
このようにσの値が大きくなると、ボケ量の値も大きくなる。
このことは、図4から視覚的に理解することができ、σの値が大きくなると、特性曲線の傾きが緩やかになり、図3における輝度差Aの値が減少し、輝度差B1、B2の値が増加するため、ボケ量の値も大きくなる。なお、σの値を大きくすると、ボケ量の値は徐々に収束し、最大で1となる。
Thus, when the value of σ increases, the value of the blur amount also increases.
This can be visually understood from FIG. 4. As the value of σ increases, the slope of the characteristic curve becomes gentler, the value of the luminance difference A in FIG. 3 decreases, and the luminance differences B1 and B2 are reduced. Since the value increases, the blur amount value also increases. When the value of σ is increased, the blur amount value gradually converges and becomes 1 at the maximum.
前述のように、ガウシアンフィルタはピクセルノイズを除去するために用いられるが、図4に示すように、ボケ量はガウシアンフィルタの分散σの大きさにより変動する。
したがって、後述するボケ量推定画像を作成する上で、エッジ部の画素位置に、所定の値以上のボケ量が割り当てられるように、ガウシアンフィルタの分散σの大きさを設定する必要がある。
As described above, the Gaussian filter is used to remove pixel noise, but as shown in FIG. 4, the amount of blur varies depending on the magnitude of the variance σ of the Gaussian filter.
Accordingly, when creating a blur amount estimation image to be described later, it is necessary to set the magnitude of the variance σ of the Gaussian filter so that a blur amount greater than a predetermined value is assigned to the pixel position of the edge portion.
図5は、図2におけるボケ量推定手段21の処理手順を示すフロー図である。
即ち、ボケ量の推定に関する処理を開始するにあたり、ボケ量推定手段21は、被写界深度の浅い状態に設定されている撮像装置2からの画像を画像取得手段211により取得する(ステップS11)。
次に、ボケ量推定手段21は、モノクロ変換手段212によりカラー画像をモノクロ画像に変換し(ステップS12)、ノイズ除去手段213により変換されたモノクロ画像からノイズを除去する(ステップS13)。
FIG. 5 is a flowchart showing a processing procedure of the blur amount estimation means 21 in FIG.
That is, when starting the process related to the estimation of the blur amount, the blur
Next, the blur
ボケ量推定手段21は、次に、エッジベクトル算出手段214によりノイズが除去されたモノクロ画像の各画素のエッジベクトル(エッジ強度)を算出し(ステップS14)、さらにエッジ判定手段215によりエッジ強度からエッジを抽出する(ステップS15)。
なお、ステップS14の処理を実行する過程で、図3における輝度差Aがエッジ強度として算出される。
Next, the blur
In the course of executing the process of step S14, the luminance difference A in FIG. 3 is calculated as the edge strength.
次に、ボケ量推定手段21は、輝度差算出手段216により、抽出されたエッジを構成するエッジ部画素のエッジ方向の両側の所定数の画素(例えば、図3における、画素Pe+2、画素Pe−2)の輝度差(図3における輝度差B)を算出する(ステップS16)。
次に、ボケ量推定手段21は、ボケ量算出手段217により式(3)を用いてボケ量を算出する(ステップS17)。
Next, the blur
Next, the blur
なお、本実施形態において、ボケ量を算出するにあたり、3×3のSobelフィルタを使用しているが、5×5のSobelフィルタを使用することもできる。この場合、画素Pe+3と画素Pe−3の輝度差を実測値として、5×5のSobelフィルタによるエッジ勾配値から予測した値との比較値をボケ量推定に用いることになる。 In this embodiment, the 3 × 3 Sobel filter is used to calculate the blur amount. However, a 5 × 5 Sobel filter may be used. In this case, the luminance difference between the pixel Pe + 3 and the pixel Pe-3 is used as an actual measurement value, and a comparison value with a value predicted from an edge gradient value by a 5 × 5 Sobel filter is used for blur amount estimation.
図6は、図1における距離画像生成手段22の機能構成を示すブロック図である。図6に示すように、ボケ量推定画像生成手段221、x軸方向ボケ量走査手段222、x軸方向距離画像作成手段223、y軸方向ボケ量走査手段224、y軸方向距離画像作成手段225、距離平均値算出手段226、距離画像作成手段227を備えている。
FIG. 6 is a block diagram showing a functional configuration of the distance image generating means 22 in FIG. As illustrated in FIG. 6, the blur amount estimation
ボケ量推定画像作成手段221は、ボケ量推定手段21により推定されたボケ量(B/2A)を原画像の画素位置に割り当てる(対応させる)ことにより、ボケ量推定画像を作成する。
図7Aは、ボケ量推定画像作成手段221により作成されたボケ量推定画像を示す。
本実施形態においては、被写体として2つの物体を設定し、この2つの物体を、撮像装置2の撮像方向に対して前後に、且つ、撮像画像において、物体同士が重なるように配置している。ここで、撮像装置2の撮像方向に対して前方に位置する物体を物体P、後方に位置する物体を物体Qとする。
The blur amount estimation
FIG. 7A shows a blur amount estimation image created by the blur amount estimation image creation means 221.
In the present embodiment, two objects are set as subjects, and these two objects are arranged in front of and behind the imaging direction of the
また、前述のようにボケ量推定手段21により推定されるボケ量は、撮像された物体のエッジ部においてはそれ以外の部分より高い値を示すことから、ボケ量が周りのボケ量よりも高い値を示す画素位置を基にボケ推定画像を作成すると、ボケ量推定画像は、例えば、図7Aのように示される。
なお、ボケ量推定画像作成手段221による、ボケ量推定画像を作成する工程は、ボケ量を可視化して確認する工程であることから、原画像の各々の画素位置にボケ量が数値として割り当てられていることを前提に、省略することができる。
Further, as described above, the blur amount estimated by the blur
Note that the step of creating the blur amount estimated image by the blur amount estimated
x軸方向ボケ量走査手段222は、図7Bに示すように、ボケ量推定画像作成手段221により作成されたボケ量推定画像をx軸方向に走査して、x軸方向ボケ量走査データを生成する。
ここで、具体的なx軸方向ボケ量走査データの生成方法を、図8を用いて説明する。
なお、図8では、y軸方向の任意の位置y2において、x軸方向ボケ量走査手段222によりx軸方向に走査することで、x軸方向ボケ量走査データを生成している。また、本実施形態において、x軸方向ボケ量走査手段222は、xの値が小さい方から大きい方に(即ち、図の左から右方向に)走査する仕様としているが、必ずしもこれに限定されず、xの値が大きい方から小さい方に走査する仕様としてもよい。
As shown in FIG. 7B, the x-axis direction blur
Here, a specific method of generating x-axis direction blur amount scanning data will be described with reference to FIG.
In FIG. 8, x-axis direction blur amount scanning data is generated by scanning in the x-axis direction by the x-axis direction blur
x軸方向ボケ量走査手段222は、図7Aに示したボケ量推定画像に対して、先ず、x軸方向の走査の開始位置であるx0より、ボケ量が所定の値以上となる画素位置(即ち、物体Pのエッジ部x1)まで走査する(図8A)。
x軸方向ボケ量走査手段222は、x1まで走査すると、x0におけるボケ量とx1におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、x0からx1の間に位置する画素にボケ量をマッピングする(割り当てる)。
The x-axis direction blur
When the x-axis direction blur
ここで、被写体とする物体(ここでは、物体P及びQ)の全体がボケ量推定画像内に収まっていることを前提に、x軸方向ボケ量走査手段222によりx軸方向に走査する上で、画像の左右端部(即ち、図8においてx=x0、及びx=x5)におけるボケ量の値を「0」に設定する。そのため、x軸方向ボケ量走査手段222は、x0におけるボケ量とx1におけるボケ量のうち、ボケ量の値の小さいx0におけるボケ量「0」を選択し、x0からx1の間に位置する画素にボケ量「0」をマッピングする。
Here, on the assumption that the entire object (here, the objects P and Q) as a subject is within the blur amount estimation image, the x-axis direction blur
x軸方向ボケ量走査手段222は、x0からx1の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をx1に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図8B)。図8Bでは、物体Pのエッジ部x3において、ボケ量が所定の値以上となることから、x軸方向ボケ量走査手段222はx3まで走査する。
x軸方向ボケ量走査手段222は、x3まで走査すると、走査の開始位置であるx1におけるボケ量とx3におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、x1からx3の間に位置する画素にボケ量をマッピングする。
即ち、x軸方向ボケ量走査手段222は、x1におけるボケ量とx3におけるボケ量を比較し、例えば、x1におけるボケ量「X1」がx3におけるボケ量「X3」よりも小さい(即ち、X3>X1)と判定すると、x1におけるボケ量「X1」を選択し、x1からx3の間に位置する画素にボケ量「X1」をマッピングする。
When the x-axis direction blur
When the x-axis direction blur
That is, the x-axis direction blur
x軸方向ボケ量走査手段222は、x1からx3の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をx3に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図8C)。図8Cでは、物体Qのエッジ部x4において、ボケ量が所定の値以上となることから、x軸方向ボケ量走査手段222は、x4まで走査する。
x軸方向ボケ量走査手段222は、x4まで走査すると、走査の開始位置であるx3におけるボケ量とx4におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、x3からx4の間に位置する画素にボケ量をマッピングする。
即ち、x軸方向ボケ量走査手段222は、x3におけるボケ量とx4におけるボケ量を比較し、例えば、x4におけるボケ量「X4」がx3におけるボケ量「X3」よりも小さい(即ち、X3>X4)と判定すると、x4におけるボケ量「X4」を選択し、x3からx4の間に位置する画素にボケ量「X4」をマッピングする。
When the x-axis direction blur
When the x-axis direction blur
That is, the x-axis direction blur
x軸方向ボケ量走査手段222は、x3からx4の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をx4に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図8D)。
x4より走査を開始した場合、図8Dに示すように、画像の右端部であるx5までにボケ量が所定の値以上となる画素が存在しないため、x軸方向ボケ量走査手段222は、画像の右端部であるx5まで走査すると処理を終了する。
本実施形態では、前述のように画像の右端部x5におけるボケ量の値を「0」に設定することから、x軸方向ボケ量走査手段222は、x4におけるボケ量とx5におけるボケ量のうち、ボケ量の値の小さいx5におけるボケ量「0」を選択し、x4からx5の間に位置する画素にボケ量「0」をマッピングする。
When the x-axis direction blur
When scanning is started from x4, as shown in FIG. 8D, there is no pixel whose blur amount is equal to or greater than a predetermined value up to x5, which is the right end portion of the image. The process is terminated when scanning is performed up to x5, which is the right end of.
In this embodiment, since the value of the blur amount at the right end portion x5 of the image is set to “0” as described above, the x-axis direction blur
このように、x軸方向ボケ量走査手段222は、y軸方向の任意の位置y2において、x軸方向に画像の左端部であるx0から右端部であるx5まで走査し、x0からx5までの各画素位置にボケ量をマッピングすると、マッピングしたボケ量を、y軸方向をy2とするx軸方向ボケ量走査データとして、RAM15に保存する。
x軸方向ボケ量走査手段222は、この走査処理を、画像の下端部であるy0から上端部であるy5まで、所定の間隔で実行し、y軸方向の任意の位置におけるx軸方向ボケ量走査データを生成し、RAM15に保存する。
As described above, the x-axis direction blur
The x-axis direction blur
x軸方向距離画像作成手段223は、x軸方向ボケ量走査手段222により生成され、RAM15に保存されたx軸方向ボケ量走査データを読み込み、さらにボケ量/距離テーブルを参照することで、x軸方向に関する距離画像を撮像装置2のレンズから物体までの距離を画像として作成する。
The x-axis direction distance
図9は、ボケ量/距離テーブルの作成手順について説明するための図である。
ここで、図9Aは、直径50mmのレンズのピントをレンズから10mの距離に合わせた状態でのレンズからの距離と錯乱円(「点」の被写体を結像させた場合に形成される「円」)の大きさ(直径)との関係を示す図である。
また、図9Bは、ガウシアンフィルタのカーネル(例えば、カーネルサイズ3×3、5×5等の中心を注目輝度、その周辺を周辺輝度とする正方形のレート表)のカーネルサイズを変更させた場合において、そのガウシアンフィルタでぼかした画像から、式(3)により算出したボケ量の推定値を示した図である。図9Bの横軸は、ガウシアンフィルタのカーネルサイズ3〜11(nを整数として、2n+1)、また縦軸は、ボケ量推定値を示し、その値は式(3)による算出値の2倍から1を減算したもの(2(B/2A)−1)である。
FIG. 9 is a diagram for explaining a procedure for creating the blur amount / distance table.
Here, FIG. 9A shows a “circle” formed when a subject with a distance from the lens and a circle of confusion (“dot”) is focused in a state where the focus of the lens having a diameter of 50 mm is set to a distance of 10 m from the lens. It is a figure which shows the relationship with the magnitude | size (diameter) of ").
FIG. 9B shows a case in which the kernel size of the kernel of the Gaussian filter (for example, a square rate table with the center of the
レンズからの距離と錯乱円の大きさとは、図9Aに示すような対応関係がある。また、一般に、散乱円の大きさとボケ量にも対応関係があることから、ボケ量と散乱円との対応関係を示すデータを作成することで、ボケ量とレンズからの距離との対応関係を示すデータ、即ち、ボケ量/距離テーブルを作成することができる。 The distance from the lens and the size of the circle of confusion have a correspondence as shown in FIG. 9A. In general, since there is a correspondence between the size of the scattering circle and the amount of blurring, the correspondence between the amount of blurring and the distance from the lens can be determined by creating data indicating the correspondence between the amount of blurring and the scattering circle. Data to be shown, that is, a blur amount / distance table can be created.
そこで、任意のカメラで取得したボケのない画像をガウシアンフィルタで処理してボケ画像を生成し、そのボケ量を式(3)で算出することで、図9Bに示すデータを作成する。 Therefore, the image shown in FIG. 9B is created by processing a non-blurred image acquired by an arbitrary camera by using a Gaussian filter to generate a blurred image and calculating the amount of blur using Equation (3).
ここで、(2n+1)×(2n+1)のガウシアンフィルタは、ボケのない画像の1画素を、(2n+1)×(2n+1)画素にぼかす。そこで、(2n+1)×(2n+1)画素と図9Aにおける散乱円の大きさとの対応関係を示すデータを取得することで、図9Aの縦軸の値を画素数(ガウシアンフィルタにおけるカーネルサイズ)に変換したデータを作成することができる。さらに、図9Bに示すデータを用いることで、図9Aの縦軸を図9Bの縦軸に示すボケ量推定値としたデータ、即ちボケ量/距離テーブルを作成することができる。なお、(2n+1)画素と図9Aにおける錯乱円の大きさとの対応関係を示すデータは、撮像素子の画素数など、カメラの諸元から取得することができる。 Here, the (2n + 1) × (2n + 1) Gaussian filter blurs one pixel of an unblurred image to (2n + 1) × (2n + 1) pixels. Therefore, by obtaining data indicating the correspondence between (2n + 1) × (2n + 1) pixels and the size of the scattering circle in FIG. 9A, the value on the vertical axis in FIG. 9A is converted into the number of pixels (kernel size in the Gaussian filter). Data can be created. Further, by using the data shown in FIG. 9B, data in which the vertical axis in FIG. 9A is the blur amount estimated value shown in the vertical axis in FIG. 9B, that is, the blur amount / distance table can be created. Note that data indicating the correspondence between (2n + 1) pixels and the size of the circle of confusion in FIG. 9A can be acquired from the specifications of the camera, such as the number of pixels of the image sensor.
x軸方向距離画像作成手段223は、x軸方向ボケ量走査データを読み込み、上記のように作成されたボケ量/距離テーブルを参照することで、先ず、y軸方向の所定の位置における画像の左端部であるx0から右端部であるx5上に位置する各画素に関して、撮像装置2のレンズから物体までの距離を算出する。
x軸方向距離画像作成手段223は、次に、横軸をx軸(即ち、ボケ量推定画像の横方向)、また縦軸を撮像装置2のレンズから物体までの距離とする、x軸方向の距離画像を作成する。
The x-axis direction distance image creation means 223 reads the x-axis direction blur amount scanning data and refers to the blur amount / distance table created as described above, so that first, an image at a predetermined position in the y-axis direction is read. The distance from the lens of the
Next, the x-axis direction distance image creating means 223 uses the x-axis direction with the horizontal axis as the x-axis (that is, the horizontal direction of the blur amount estimation image) and the vertical axis as the distance from the lens of the
図10は、y軸方向の任意の位置y2におけるx軸方向ボケ量走査データを読み込み、ボケ量/距離テーブルを参照することで算出された、撮像装置2のレンズから物体までの距離を、x軸方向の距離画像として作成した図である。図10に示すように、x軸方向のx1からx3までは撮像装置2のレンズからの距離はDx1であり、またx3からx4までは撮像装置2のレンズからの距離はDx2である。
このように、x軸方向距離画像作成手段223は、RAM15に保存されたx軸方向ボケ量走査データより、x軸方向の距離画像を作成する。
なお、x軸方向距離画像作成手段223による、x軸方向の距離画像を作成する工程は、y軸方向の任意の位置における、x軸方向の距離を可視化して確認する工程であることから、x軸方向に関する距離が算出されていることを前提に、省略することができる。
FIG. 10 shows the distance from the lens of the
As described above, the x-axis direction distance image creating means 223 creates a distance image in the x-axis direction from the x-axis direction blur amount scanning data stored in the
The step of creating the distance image in the x-axis direction by the x-axis direction distance image creating means 223 is a step of visualizing and confirming the distance in the x-axis direction at an arbitrary position in the y-axis direction. It can be omitted on the assumption that the distance in the x-axis direction is calculated.
x軸方向ボケ量走査手段222によりx軸方向ボケ量走査データを生成し、さらにx軸方向距離画像作成手段223によりx軸方向に関する距離画像を作成すると、本実施形態では、次に、後述する距離画像作成手段227により作成する距離画像の精度を高めるために、y軸方向ボケ量走査データを生成する。
y軸方向ボケ量走査手段224は、図7Cに示すように、ボケ量推定画像作成手段221により作成されたボケ量推定画像を縦軸方向(以下、y軸方向)に走査して、y軸方向ボケ量走査データを生成する。
If x-axis direction blur amount scanning data is generated by the x-axis direction blur
As shown in FIG. 7C, the y-axis direction blur
具体的なy軸方向ボケ量走査データの生成方法を、図11を用いて説明する。
なお、図11では、x軸方向の任意の位置x2において、y軸方向ボケ量走査手段224によりy軸方向に走査することで、y軸方向ボケ量走査データを生成している。また、本実施形態において、y軸方向ボケ量走査手段224は、yの値が小さい方から大きい方に(即ち、図の下から上方向に)走査する仕様としているが、必ずしもこれに限定されず、yの値が大きい方から小さい方に走査する仕様としてもよい。
A specific method of generating y-axis direction blur amount scanning data will be described with reference to FIG.
In FIG. 11, the y-axis direction blur amount scanning data is generated by scanning in the y-axis direction by the y-axis direction blur
y軸方向ボケ量走査手段224は、図7Aに示したボケ量推定画像に対して、先ず、y軸方向の走査の開始位置であるy0より、ボケ量が所定の値以上となる画素位置(物体Pのエッジ部y1)まで走査する(図11A)。
y軸方向ボケ量走査手段224は、y1まで走査すると、y0におけるボケ量とy1におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、y0からy1の間に位置する画素にボケ量をマッピングする。
The y-axis direction blur
When the y-axis direction blur
ここで、被写体とする物体(ここでは、物体P及びQ)の全体がボケ量推定画像内に収まっていることを前提に、y軸方向ボケ量走査手段224によりy軸方向に走査する上で、画像の上下端部(即ち、図11においてy=y0、及びy=y5)におけるボケ量の値を「0」に設定する。そのため、y軸方向ボケ量走査手段224は、y0におけるボケ量とy1におけるボケ量のうち、ボケ量の値の小さいy0におけるボケ量「0」を選択し、y0からy1の間に位置する画素にボケ量「0」をマッピングする。
Here, on the assumption that the entire object (here, the objects P and Q) as the subject is within the blur amount estimation image, the y-axis direction blur
y軸方向ボケ量走査手段224は、y0からy1の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をy1に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図11B)。図11Bでは、物体Pのエッジ部y3において、ボケ量が所定の値以上となることから、y軸方向ボケ量走査手段224はy3まで走査する。
y軸方向ボケ量走査手段224は、y3まで走査すると、走査の開始位置であるy1におけるボケ量とy3におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、y1からy3の間に位置する画素にボケ量をマッピングする。
即ち、y軸方向ボケ量走査手段224は、y1におけるボケ量とy3におけるボケ量を比較し、例えば、y1におけるボケ量「Y1」がy3におけるボケ量「Y3」よりも小さい(即ち、Y3>Y1)と判定すると、y1におけるボケ量「Y1」を選択し、y1からy3の間に位置する画素にボケ量「Y1」をマッピングする。
When the y-axis direction blur
When the y-axis direction blur
That is, the y-axis direction blur
y軸方向ボケ量走査手段224は、y1からy3の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をy3に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図11C)。図11Cでは、物体Qのエッジ部y4において、ボケ量が所定の値以上となることから、y軸方向ボケ量走査手段224はy4まで走査する。
y軸方向ボケ量走査手段224は、y4まで走査すると、走査の開始位置であるy3におけるボケ量とy4におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、y3からy4の間に位置する画素にボケ量をマッピングする。
即ち、y軸方向ボケ量走査手段224は、y3におけるボケ量とy4におけるボケ量を比較し、例えば、y4におけるボケ量「Y4」がy3におけるボケ量「Y3」よりも小さい(即ち、Y3>Y4)と判定すると、y4におけるボケ量「Y4」を選択し、y3からy4の間に位置する画素にボケ量「Y4」をマッピングする。
When the y-axis direction blur
When the y-axis direction blur
That is, the y-axis direction blur
y軸方向ボケ量走査手段224は、y3からy4の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をy4に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図11D)。
y4より走査を開始した場合、図11Dに示すように、画像の上端部であるy5までにボケ量が所定の値以上となる画素が存在しないため、y軸方向ボケ量走査手段224は、画像の上端部であるy5まで走査すると処理を終了する。
本実施形態では、前述のように画像の上端部y5におけるボケ量の値を「0」に設定することから、y軸方向ボケ量走査手段224は、y4におけるボケ量とy5におけるボケ量のうち、ボケ量の値の小さいy5におけるボケ量「0」を選択し、y4からy5の間に位置する画素にボケ量「0」をマッピングする。
When the y-axis direction blur
When scanning starts from y4, as shown in FIG. 11D, there is no pixel whose blur amount is equal to or greater than a predetermined value by y5, which is the upper end portion of the image. Therefore, the y-axis direction blur
In this embodiment, since the blur amount value at the upper end portion y5 of the image is set to “0” as described above, the y-axis direction blur
このように、y軸方向ボケ量走査手段224は、x軸方向の任意の位置x2において、y軸方向に画像の下端部であるy0から上端部であるy5まで走査し、y0からy5までの各画素位置にボケ量をマッピングすると、マッピングしたボケ量を、x軸方向をx2とするy軸方向ボケ量走査データとして、RAM15に保存する。
y軸方向ボケ量走査手段224は、この走査処理を、画像の下端部であるy0から上端部であるy5まで、所定の間隔で実行し、x軸方向の任意の位置におけるy軸方向ボケ量走査データを作成し、RAM15に保存する。
In this way, the y-axis direction blur
The y-axis direction blur
y軸方向距離画像作成手段225は、y軸方向ボケ量走査手段224により生成され、RAM15に保存されたy軸方向ボケ量走査データを読み込み、さらにボケ量/距離テーブルを参照することで、y軸方向に関する距離画像を撮像装置2のレンズから物体までの距離を画像として作成する。
なお、ボケ量/距離テーブルは、図9の作成手順に従って作成されたボケ量/距離テーブルを用いることができる。
The y-axis direction distance
As the blur amount / distance table, the blur amount / distance table created according to the creation procedure of FIG. 9 can be used.
y軸方向距離画像作成手段225は、y軸方向ボケ量走査データを読み込み、図9の作成手順に従って作成されたボケ量/距離テーブルを参照することで、先ず、x軸方向の所定の位置における画像の下端部であるy0から上端部であるy5上に位置する各画素に関して、撮像装置2のレンズから物体までの距離を算出する。
y軸方向距離画像作成手段225は、次に、横軸をy軸(即ち、ボケ量推定画像の縦方向)、また縦軸を撮像装置2のレンズから物体までの距離とする、y軸方向の距離画像を作成する。
First, the y-axis direction distance image creation means 225 reads the y-axis direction blur amount scanning data and refers to the blur amount / distance table created according to the creation procedure of FIG. The distance from the lens of the
Next, the y-axis direction distance image creating means 225 sets the horizontal axis to the y-axis (that is, the vertical direction of the blur amount estimation image) and the vertical axis to the distance from the lens of the
図12は、x軸方向の任意の位置x2におけるy軸方向ボケ量走査データを読み込み、ボケ量/距離テーブルを参照することで算出された、撮像装置2のレンズから物体までの距離を、y軸方向の距離画像として作成した図である。図12に示すように、y軸方向のy1からy3までは撮像装置2のレンズからの距離はDy1であり、またy3からy4までは撮像装置2のレンズからの距離はDy2である。
このように、y軸方向距離画像作成手段225は、RAM15に保存されたy軸方向ボケ量走査データより、y軸方向の距離画像を作成する。
なお、y軸方向距離画像作成手段225による、y軸方向の距離画像を作成する工程は、x軸方向の任意の位置における、y軸方向の距離を可視化して確認する工程であることから、y軸方向に関する距離が算出されていることを前提に、省略することができる。
FIG. 12 shows the distance from the lens of the
As described above, the y-axis direction distance
The step of creating the distance image in the y-axis direction by the y-axis direction distance image creating means 225 is a step of visualizing and confirming the distance in the y-axis direction at an arbitrary position in the x-axis direction. It can be omitted on the assumption that the distance in the y-axis direction is calculated.
また、y軸方向のボケ量の走査処理からy軸方向に関する距離画像を作成する(即ち、y軸方向に関する距離を算出する)までの一連の工程は、後述する距離画像作成手段227により距離画像を作成する上で、その精度を高めるために実行するものであることから、処理時間を短くすること、処理負荷を軽減すること等を目的に当該工程について省略することができる。
逆に、距離画像作成手段227により作成される距離画像の精度をより向上させるために、縦軸及び横軸以外に新規に軸(例えば、斜め方向に軸)を設定し、その軸方向に関する距離画像を作成することも考慮することができる。
なお、この場合、軸(例えば、縦軸又は横軸の一方)を固定した上で、ボケ量推定画像を所定の角度ずつ回転させて、その都度、距離画像を作成してもよい。
In addition, a series of steps from scanning processing for the amount of blur in the y-axis direction to creating a distance image in the y-axis direction (that is, calculating a distance in the y-axis direction) is performed by the distance
Conversely, in order to further improve the accuracy of the distance image created by the distance image creating means 227, a new axis (for example, an axis in an oblique direction) is set in addition to the vertical axis and the horizontal axis, and the distance in the axial direction is set. Creating an image can also be considered.
In this case, after the axis (for example, one of the vertical axis or the horizontal axis) is fixed, the blur amount estimation image may be rotated by a predetermined angle, and a distance image may be created each time.
距離平均値算出手段226は、x軸方向距離画像作成手段223によるx軸方向の距離画像(x軸方向に関する距離)及びy軸方向距離画像作成手段225によるy軸方向の距離画像(y軸方向に関する距離)が作成されると、各画素位置における、撮像装置2のレンズからの距離の平均値を算出する。
なお、本実施形態においては、距離の平均値を算出することにより、撮像装置2のレンズから物体までの距離を特定しているが、距離を特定する方法としては必ずしも平均値に限定されない。中間値など周知の方法で特定(推定)してもよい。
The distance average value calculation means 226 is a distance image in the x-axis direction (distance related to the x-axis direction) by the x-axis direction distance image creation means 223 and a distance image in the y-axis direction (y-axis direction) by the y-axis direction distance image creation means 225. When the distance is generated, the average value of the distance from the lens of the
In this embodiment, the distance from the lens of the
距離平均値算出手段226による、各画素位置における、撮像装置2のレンズからの距離の平均値の算出に関して、図13を用いて説明する。
図13では、x軸方向距離画像作成手段223により算出された、(y軸方向の位置をy2とする)x軸方向に位置する画素位置における、撮像装置2のレンズからの距離、またy軸方向距離画像作成手段225により算出された、(x軸方向の位置をx2とする)y軸方向に位置する画素位置における、撮像装置2のレンズからの距離をプロットしている。
The calculation of the average value of the distance from the lens of the
In FIG. 13, the distance from the lens of the
この場合、図13に示すように、座標(x2、y2)には、x軸方向距離画像作成手段223により算出された撮像装置2のレンズからの距離と、y軸方向距離画像作成手段225により算出された撮像装置2のレンズからの距離がプロットされる。
そこで、距離平均値算出手段226は、x軸方向距離画像作成手段223により算出された撮像装置2のレンズからの距離とy軸方向距離画像作成手段225により算出された撮像装置2のレンズからの距離の平均値を算出し、その距離の平均値を、座標(x2、y2)にプロットする。
In this case, as shown in FIG. 13, the coordinates (x2, y2) include the distance from the lens of the
Therefore, the distance average
なお、図13の例では、(y軸方向の位置をy2とする)x軸方向に位置する画素位置における、撮像装置2のレンズからの距離と(x軸方向の位置をx2とする)y軸方向に位置する画素位置における、撮像装置2のレンズからの距離しか、プロットしていないが、実際には、y軸方向のy0からy5、またx軸方向のx0からx5まで所定の間隔で、撮像装置2のレンズからの距離をプロットすることから、全ての画素位置に関して、撮像装置2のレンズからの距離として、2つのデータがプロットされる。
距離平均値算出手段226は、その2つのデータがプロットされた、全ての画素位置に関して、2つの距離の平均値を算出し、その距離の平均値を、各々の画素位置にプロットする。
In the example of FIG. 13, the distance from the lens of the
The distance average value calculation means 226 calculates the average value of the two distances for all the pixel positions where the two data are plotted, and plots the average value of the distances at each pixel position.
距離平均値算出手段226による算出処理は、各画素位置において平均値を算出する処理であることから、各画素位置に、撮像装置2のレンズからの距離として、2つ以上のデータがプロットされていることを前提に実行される。したがって、各画素位置に、撮像装置2のレンズからの距離として、2つ以上のデータがプロットされていない場合には、距離平均値算出手段226による算出処理を省略することができる。
また、各画素位置にプロットされるデータ(即ち、撮像装置2のレンズからの距離)の数が多ければ、距離平均値算出手段226により算出される平均値は、撮像装置2のレンズからの距離として、より精度の高い値となる。
Since the calculation process by the distance average
Further, if the number of data plotted at each pixel position (that is, the distance from the lens of the imaging device 2) is large, the average value calculated by the distance average
距離画像作成手段227は、距離平均値算出手段226により算出され、各画素位置にプロットされた、撮像装置2のレンズからの距離の平均値に基づいて、距離画像を作成する。
図14に、距離画像作成手段227により作成された距離画像を示す。図14に示す距離画像では、撮像された物体に関して、撮像装置2のレンズからの距離に応じて濃度を調整して表示しており、撮像装置2のレンズからの距離が近くなるにつれて濃度を濃くして表示する。
The distance
FIG. 14 shows a distance image created by the distance
図14に示すように、撮像装置2の撮像方向に対して前側に位置する物体Pは濃く表示され、後側に位置する物体Qは物体Pに比べて薄く表示される。
このように、2つの物体(即ち、物体P及びQ)が撮像画像において重なっている場合であっても、それぞれの物体を別々に認識することができる。さらに、物体に塗り潰される色の濃淡により、2つの物体の前後関係も認識することができる。
As shown in FIG. 14, the object P positioned on the front side with respect to the imaging direction of the
As described above, even when two objects (that is, the objects P and Q) overlap in the captured image, each object can be recognized separately. Furthermore, the context of two objects can also be recognized based on the shades of colors painted on the objects.
図15は、図6における距離画像生成手段22の処理手順を示すフロー図である。
距離画像生成手段22は、ボケ量推定手段21により推定されたボケ量をRAM15より読み込むと、ボケ量推定画像作成手段221によりボケ量推定画像を作成する(ステップS21)。
FIG. 15 is a flowchart showing the processing procedure of the distance image generating means 22 in FIG.
When the distance
ボケ量推定画像作成手段221によりボケ量推定画像が作成されると(ステップS21)、距離画像生成手段22は、x軸方向ボケ量走査手段222によりボケ量推定画像をx軸方向に走査し、x軸方向のボケ量走査データを作成する(ステップS22)(図8)。
次に、x軸方向距離画像作成手段223は、ボケ量/距離テーブルを参照することでx軸方向の撮像装置2のレンズから物体までの距離を算出し(ステップS23)、x軸方向の距離画像を作成する(ステップS24)(図10)。
When the blur amount estimation image is generated by the blur amount estimation image generation unit 221 (step S21), the distance
Next, the x-axis direction distance image creation means 223 calculates the distance from the lens of the
距離画像生成手段22は、次に、y軸方向ボケ量走査手段224によりボケ量推定画像をy軸方向に走査し、y軸方向のボケ量走査データを作成する(ステップS25)(図11)。
距離画像生成手段22は、次に、y軸方向距離画像作成手段225により、ボケ量/距離テーブルを参照することでy軸方向の撮像装置2のレンズから物体までの距離を算出し(ステップS26)、y軸方向の距離画像を作成する(ステップS27)(図12)。
Next, the distance
Next, the distance image generation means 22 calculates the distance from the lens of the
x軸方向及びy軸方向の距離画像を作成すると(ステップS24、ステップ27)、距離画像生成手段22は、距離平均値算出手段226により、各々の画素位置における、撮像装置2のレンズから物体までの距離の平均値を算出する(ステップS28)。
距離画像生成手段22は、次に、距離画像作成手段227により、算出された距離の平均値から距離画像を作成する(ステップS29)。
When the distance images in the x-axis direction and the y-axis direction are created (steps S24 and step 27), the distance
Next, the distance image generation means 22 creates a distance image from the average value of the distances calculated by the distance image creation means 227 (step S29).
以上、説明したように、本発明の実施形態に係る画像形成装置によれば、撮像された画像において、物体同士が重なって撮像された場合であっても、画像処理の負荷を前記従来の方法よりも低減した上で、距離画像を生成して各々の物体を別々に認識することができ、さらに撮像方向に対する、各々の物体の前後関係も併せて認識することができる。
また、物体同士が接近して並んで撮像された場合であっても、各々の物体を別々に認識することができる。
As described above, according to the image forming apparatus according to the embodiment of the present invention, even in the case where the captured images are captured by overlapping each other, the load of the image processing is reduced. In addition, the distance image can be generated and each object can be recognized separately, and the front-rear relationship of each object with respect to the imaging direction can also be recognized.
Moreover, even when objects are imaged in close proximity to each other, each object can be recognized separately.
21…ボケ量推定手段、211…画像取得手段、212…モノクロ変換手段、213…ノイズ除去手段、214…エッジベクトル算出手段、215…エッジ判定手段、216…輝度差算出手段、217…ボケ量算出手段、22…距離画像生成手段、221…ボケ量推定画像作成手段、222…x軸方向ボケ量走査手段、223…x軸方向距離画像作成手段、224…y軸方向ボケ量走査手段、225…y軸方向距離画像作成手段、226…距離平均値算出手段、227…距離画像作成手段。 21: blur amount estimation means 211: image acquisition means 212: monochrome conversion means 213: noise removal means 214: edge vector calculation means 215: edge determination means 216: luminance difference calculation means 217: blur amount calculation Means 22 ... Distance image generating means 221 ... Blur amount estimated image creating means 222 ... X-axis direction blur amount scanning means 223 ... X-axis direction distance image creating means 224 ... Y-axis direction blur amount scanning means 225 ... y-axis direction distance image creating means, 226... distance average value calculating means, 227.
Claims (5)
前記画像取得手段により取得した画像のエッジを抽出するエッジ抽出手段と、
前記エッジ抽出手段により抽出されたエッジを含む所定領域内における画素の輝度差に基づいて、前記エッジのボケ量を算出するボケ量算出手段と、
前記ボケ量算出手段により算出されたボケ量を前記画像の前記エッジの各画素位置に割り当てるボケ量割り当て手段と、
前記ボケ量割り当て手段によりボケ量が割り当てられた前記エッジの画素に対して、所定の方向に走査し、走査方向にあるエッジとエッジの間に位置する各画素に、ボケ量の小さい方のエッジのボケ量を割り当てるボケ量走査手段と、
前記ボケ量走査手段により割り当てられたボケ量と、前記撮像装置からの画像のボケ量と前記撮像装置から被写体までの距離との相関情報とに基づいて、各画素位置における、前記撮像装置から前記物体までの距離を算出する距離算出手段と、
前記距離算出手段により算出された各画素位置における、前記撮像装置から前記物体までの距離に基づき、距離画像を生成する距離画像生成手段と、
を有することを特徴とする画像処理装置。 Image acquisition means for acquiring an image from an imaging device that images the object;
Edge extraction means for extracting an edge of the image acquired by the image acquisition means;
A blur amount calculating unit that calculates a blur amount of the edge based on a luminance difference of pixels in a predetermined region including the edge extracted by the edge extracting unit;
A blur amount assigning unit that assigns the blur amount calculated by the blur amount calculating unit to each pixel position of the edge of the image;
The edge pixel to which the blur amount is assigned by the blur amount assigning unit is scanned in a predetermined direction, and each pixel located between the edges in the scanning direction has an edge with the smaller blur amount. A blur amount scanning means for allocating a blur amount of
Based on the blur amount allocated by the blur amount scanning unit and the correlation information between the blur amount of the image from the imaging device and the distance from the imaging device to the subject, from the imaging device at each pixel position, Distance calculating means for calculating the distance to the object;
Distance image generation means for generating a distance image based on the distance from the imaging device to the object at each pixel position calculated by the distance calculation means;
An image processing apparatus comprising:
前記ボケ量算出手段は、前記エッジ抽出手段により抽出されたエッジを含む所定領域内における、前記エッジの画素を挟んでその両側に位置する画素の輝度差に基づいて、前記エッジのボケ量を算出することを特徴とする画像処理装置。 The image processing apparatus according to claim 1,
The blur amount calculating unit calculates the blur amount of the edge based on a luminance difference between pixels located on both sides of the edge pixel in a predetermined region including the edge extracted by the edge extracting unit. An image processing apparatus.
前記ボケ量走査手段が、互いに平行な複数の走査線により第1の走査方向で走査し、さらに前記第1の走査方向と所定の角度で交わる第2の走査方向の互いに平行な複数の走査線に沿って走査することを特徴とする画像処理装置。 In the image processing apparatus according to claim 1 or 2,
The blur amount scanning means scans in a first scanning direction by a plurality of scanning lines parallel to each other, and further a plurality of scanning lines parallel to each other in a second scanning direction intersecting the first scanning direction at a predetermined angle. And an image processing apparatus.
前記所定の角度が直角であることを特徴とする画像処理装置。 The image processing apparatus according to claim 3,
The image processing apparatus characterized in that the predetermined angle is a right angle.
前記距離算出手段により、走査方向の数に応じて算出された前記撮像装置から前記物体までの距離に基づき、前記距離を特定することを特徴とする画像処理装置。
The image processing apparatus according to claim 3,
An image processing apparatus characterized in that the distance is specified based on a distance from the imaging apparatus to the object calculated according to the number of scanning directions by the distance calculation means.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014139965A JP6327024B2 (en) | 2014-07-07 | 2014-07-07 | Image processing device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014139965A JP6327024B2 (en) | 2014-07-07 | 2014-07-07 | Image processing device |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2016018340A true JP2016018340A (en) | 2016-02-01 |
JP6327024B2 JP6327024B2 (en) | 2018-05-23 |
Family
ID=55233533
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014139965A Active JP6327024B2 (en) | 2014-07-07 | 2014-07-07 | Image processing device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6327024B2 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101825218B1 (en) * | 2016-04-08 | 2018-02-02 | 한국과학기술원 | Apparatus and method for generaing depth information |
KR101921608B1 (en) | 2018-01-29 | 2018-11-26 | 한국과학기술원 | Apparatus and method for generating depth information |
JP2021009978A (en) * | 2019-07-03 | 2021-01-28 | 株式会社Fuji | Assembling machine |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010249794A (en) * | 2009-03-26 | 2010-11-04 | Kyocera Corp | Object distance measuring device |
JP2012073703A (en) * | 2010-09-28 | 2012-04-12 | Nippon Hoso Kyokai <Nhk> | Image blur amount calculation device and program for the same |
JP2013157674A (en) * | 2012-01-26 | 2013-08-15 | Canon Inc | Imaging apparatus |
-
2014
- 2014-07-07 JP JP2014139965A patent/JP6327024B2/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010249794A (en) * | 2009-03-26 | 2010-11-04 | Kyocera Corp | Object distance measuring device |
JP2012073703A (en) * | 2010-09-28 | 2012-04-12 | Nippon Hoso Kyokai <Nhk> | Image blur amount calculation device and program for the same |
JP2013157674A (en) * | 2012-01-26 | 2013-08-15 | Canon Inc | Imaging apparatus |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101825218B1 (en) * | 2016-04-08 | 2018-02-02 | 한국과학기술원 | Apparatus and method for generaing depth information |
KR101921608B1 (en) | 2018-01-29 | 2018-11-26 | 한국과학기술원 | Apparatus and method for generating depth information |
JP2021009978A (en) * | 2019-07-03 | 2021-01-28 | 株式会社Fuji | Assembling machine |
JP7313211B2 (en) | 2019-07-03 | 2023-07-24 | 株式会社Fuji | Assembly machine |
Also Published As
Publication number | Publication date |
---|---|
JP6327024B2 (en) | 2018-05-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8405742B2 (en) | Processing images having different focus | |
KR20110106070A (en) | Apparatus and method for extracting light and texture, and rendering apparatus using light and texture | |
US10181202B2 (en) | Control apparatus, robot, and control method | |
JP5939962B2 (en) | Image processing apparatus, image processing method, and computer program | |
JP6327024B2 (en) | Image processing device | |
JP2010117593A (en) | Device for acquiring distance information, imaging apparatus, and program | |
EP2939586A1 (en) | Image processing device, program and image processing method | |
KR102255148B1 (en) | Image processing apparatus, image processing method, storage medium, and program | |
JP2014206388A (en) | Imaging device, image process device and image process method | |
US9270883B2 (en) | Image processing apparatus, image pickup apparatus, image pickup system, image processing method, and non-transitory computer-readable storage medium | |
JP6273921B2 (en) | Image processing device | |
JP2007322259A (en) | Edge detecting method, apparatus and program | |
JP6358084B2 (en) | Image processing device | |
JP5369729B2 (en) | Image processing apparatus, imaging apparatus, and program | |
JP2014182637A (en) | Image processor, image processing method and image processing program | |
JP2018018425A (en) | Image processing device and image processing method | |
JP2017084302A (en) | Iris position detection device, electronic apparatus, program, and iris position detection method | |
JP6340837B2 (en) | Image processing device | |
JP6867766B2 (en) | Information processing device and its control method, program | |
JP6369058B2 (en) | Image processing device | |
JP2018171516A (en) | Image processing method, diagnosis device, and program | |
KR101619776B1 (en) | RGB deblurring method using IR information at depth map system using 4 color sensor | |
JP6595858B2 (en) | Image processing apparatus and image processing method | |
JP2017117038A (en) | Road surface estimation device | |
JP2017017551A (en) | Image processing device and image processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20170419 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20180320 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180402 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6327024 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |