JP6336148B2 - Image processing apparatus, image processing method, image processing program, and imaging apparatus - Google Patents
Image processing apparatus, image processing method, image processing program, and imaging apparatus Download PDFInfo
- Publication number
- JP6336148B2 JP6336148B2 JP2017011692A JP2017011692A JP6336148B2 JP 6336148 B2 JP6336148 B2 JP 6336148B2 JP 2017011692 A JP2017011692 A JP 2017011692A JP 2017011692 A JP2017011692 A JP 2017011692A JP 6336148 B2 JP6336148 B2 JP 6336148B2
- Authority
- JP
- Japan
- Prior art keywords
- image
- reliability
- distance
- map
- image processing
- 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.)
- Active
Links
- 238000012545 processing Methods 0.000 title claims description 38
- 238000003384 imaging method Methods 0.000 title claims description 21
- 238000003672 processing method Methods 0.000 title claims description 9
- 238000000034 method Methods 0.000 claims description 60
- 230000008569 process Effects 0.000 claims description 27
- 238000001514 detection method Methods 0.000 claims description 7
- 238000006073 displacement reaction Methods 0.000 claims description 7
- 239000013598 vector Substances 0.000 description 15
- 238000004364 calculation method Methods 0.000 description 14
- 238000012937 correction Methods 0.000 description 12
- 230000008859 change Effects 0.000 description 6
- 238000011156 evaluation Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000003860 storage Methods 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 3
- 238000009826 distribution Methods 0.000 description 3
- 238000005259 measurement Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000009467 reduction Effects 0.000 description 3
- 230000015556 catabolic process Effects 0.000 description 2
- 238000006731 degradation reaction Methods 0.000 description 2
- 230000006866 deterioration Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 230000012447 hatching Effects 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000001678 irradiating effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 229920013655 poly(bisphenol-A sulfone) Polymers 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Landscapes
- Measurement Of Optical Distance (AREA)
- Image Processing (AREA)
- Studio Devices (AREA)
- Image Analysis (AREA)
Description
本発明は、複数の撮影画像から被写体距離を推定する画像処理技術に関する。 The present invention relates to an image processing technique for estimating a subject distance from a plurality of captured images.
画像処理によって、被写界深度が深い画像から被写界深度が浅い画像を生成する技術が知られている(例えば、特許文献1,2などを参照)。被写界深度が浅い画像の生成は、被写体の距離分布を表す距離マップを作成し、作成した距離マップに基づいて主被写体と背景とを分離し、背景画像のみをぼかすことで実現することができる。 A technique for generating an image with a shallow depth of field from an image with a deep depth of field by image processing is known (see, for example, Patent Documents 1 and 2). Generation of an image with a shallow depth of field can be realized by creating a distance map that represents the distance distribution of the subject, separating the main subject and the background based on the created distance map, and blurring only the background image. it can.
距離マップの作成は、撮影した複数の画像を解析することで行う方法が一般的である。具体的には、フォーカス位置の異なる複数の画像のぼけ方の違いから距離を推定するDFD法(Depth from Defocus法)や、画像間の画素の対応関係から三角測量の原理に基づいて距離を推定するステレオ法などがある。撮影時に被写体に超音波や赤外線などを照射して距離を取得するアクティブ方式に対して、これらの方法はパッシブ方式と呼ばれ、特殊な装置を必要としないため多く利用されている。 In general, the distance map is created by analyzing a plurality of captured images. Specifically, the distance is estimated based on the DFD method (Depth from Defocus method) that estimates the distance from the difference in the blur of multiple images with different focus positions and the principle of triangulation from the correspondence of pixels between images. There is a stereo method. In contrast to the active method of acquiring the distance by irradiating the subject with ultrasonic waves or infrared rays at the time of photographing, these methods are called passive methods and are often used because they do not require a special device.
しかし、これらのパッシブ方式は、撮影した画像を解析するものであるため、撮影シーンによっては正しく被写体の距離を推定できない場合がある。前述のDFD法は、ステレオ法のように画素間の対応関係を探索する必要がないという特長があるが、画像中のぼけを距離算出の手掛かりとして使用するため、手掛かりに乏しい領域が画像中にあった場合は、誤った距離マップを生成してしまうという問題がある。
誤った距離マップを利用して被写界深度が浅い画像を生成しようすると、正しく距離マップが求められていない領域において正しいぼけ効果が得られなくなる。すなわち、ぼけてほしくない主被写体領域がぼけたり、ぼかしたい背景領域がぼけていなかったりといった、視覚的に著しい画質劣化が発生するという問題があった。
However, since these passive methods analyze a captured image, the subject distance may not be estimated correctly depending on the shooting scene. The DFD method described above has a feature that there is no need to search for correspondence between pixels as in the stereo method, but since the blur in the image is used as a clue for calculating the distance, an area lacking in the clue is included in the image. If there is, there is a problem that an incorrect distance map is generated.
If an incorrect distance map is used to generate an image with a shallow depth of field, a correct blur effect cannot be obtained in an area where the distance map is not correctly obtained. That is, there is a problem in that the image quality is significantly deteriorated visually, such as a main subject area that is not desired to be blurred or a background area that is not blurred.
本発明は、上記課題を解決するために、推定した被写体距離の誤差を低減させることで、ぼけ付加処理における画質劣化を低減することが可能な画像処理装置、画像処理方法、画像処理プログラム、および撮像装置を提供することを目的とする。 In order to solve the above-described problem, the present invention reduces an error in an estimated subject distance, thereby reducing image quality deterioration in blur addition processing, an image processing method, an image processing program, and An object is to provide an imaging device.
上記課題を解決するための、本発明に係る画像処理装置は、ぼけ方の異なる複数の画像を処理する画像処理装置であって、前記複数の画像間の位置ずれ方向を検出する位置ずれ検出手段と、前記複数の画像から被写体の距離情報を求めて距離マップを生成する距離マップ生成手段と、前記位置ずれ方向に基づいて前記距離マップの各距離情報に対する信頼度を表す信頼度情報を求め、前記距離マップに対応する信頼度マップを生成する信頼度マップ生成手段と、を有することを特徴とする。 In order to solve the above problems, an image processing apparatus according to the present invention is an image processing apparatus for processing a plurality of images having different blurring methods, and a displacement detection means for detecting a displacement direction between the plurality of images. And distance map generating means for determining distance information of the subject from the plurality of images and generating a distance map, and determining reliability information indicating reliability for each distance information of the distance map based on the displacement direction, And a reliability map generating means for generating a reliability map corresponding to the distance map .
また、本発明に係る画像処理方法は、ぼけ方の異なる複数の画像を処理する画像処理方法であって、前記複数の画像間の位置ずれ方向を検出する検出ステップと、前記複数の画像から被写体の距離情報を求めて距離マップを生成する距離マップ生成ステップと、前記位置ずれ方向に基づいて前記距離マップの各距離情報に対する信頼度を表す信頼度情報を求め、前記距離マップに対応する信頼度マップを生成する信頼度マップ生成ステップと、を有することを特徴とする。 The image processing method according to the present invention is an image processing method for processing a plurality of images with different blurring methods, a detection step for detecting a displacement direction between the plurality of images, and a subject from the plurality of images. A distance map generating step for generating a distance map by determining distance information of the distance, and determining reliability information representing reliability for each distance information of the distance map based on the positional deviation direction, and reliability corresponding to the distance map And a reliability map generation step of generating a map.
本発明によれば、推定した被写体距離の誤差を低減させることで、ぼけ付加処理における画質劣化を低減することが可能な画像処理装置、画像処理方法、画像処理プログラム、および撮像装置を提供することができる。 According to the present invention, it is possible to provide an image processing device, an image processing method, an image processing program, and an imaging device that can reduce image quality degradation in the blur addition processing by reducing an error in the estimated subject distance. Can do.
以下、本発明の好ましい実施形態について図面を参照しながら説明する。ただし、発明の範囲は実施形態の説明で図示した例に限定されるものではない。
本実施形態に係る撮像装置は、フォーカス位置の異なる複数の画像を撮影する機能と、撮影した複数の画像を処理することによって、被写界深度を浅くした画像を生成する機能を有する。
Hereinafter, preferred embodiments of the present invention will be described with reference to the drawings. However, the scope of the invention is not limited to the examples illustrated in the description of the embodiments.
The imaging apparatus according to the present embodiment has a function of capturing a plurality of images with different focus positions and a function of generating an image with a shallow depth of field by processing the captured images.
<システム構成>
図1aは、本実施形態に係る撮像装置のシステム構成である。撮像装置1は、本発明に係る画像処理装置を含むデジタルスチルカメラ、デジタルビデオカメラ等である。
<System configuration>
FIG. 1A is a system configuration of the imaging apparatus according to the present embodiment. The imaging device 1 is a digital still camera, a digital video camera, or the like that includes the image processing device according to the present invention.
符号100は撮影レンズであり、撮像素子102に被写体光を導く。また、符号101は絞りやシャッタ等を含む露光制御部材である。撮影レンズ100を介して入射された被写体光は、露光制御部材101を介して撮像素子102に入射される。
撮像素子102は被写体光を電気信号に変換して出力する撮像素子であり、典型的にはCCDやCMOS等のイメージセンサで構成される。
画像形成回路103は、撮像素子102から出力されたアナログ信号をデジタル化して画像化するための画像形成回路である。画像形成回路103は、不図示のアナログ/デジタル変換回路、オートゲイン制御回路、オートホワイトバランス回路、画素補間処理回路、色変換処理回路などによって構成される。また、形成した画像の被写界深度を変更するための被写界深度制御回路を含んでいる。当該被写界深度制御回路が、本発明における画像処理装置に相当する。
The
The
露光制御部104は、露光制御部材101を制御する手段である。また、測距制御部105は撮影レンズ100のフォーカシングを制御する手段である。露光制御部104および測距制御部105は、例えば、TTL方式(Through the Lens,撮影用のレンズを実際に通った光を測定することで露出やフォーカスを制御する方式)を用いて制御される。
システム制御回路106は、撮像装置1全体の動作を司る制御回路である。撮影のための光学系の制御と、撮影した画像をデジタル処理するための制御を行う。
メモリ107は、システム制御回路106で用いる動作制御用のデータ、および処理プログラムなどを記録するフラッシュROM等を用いたメモリである。また、不揮発性メモリ108は各種調整値などの情報を記憶する、電気的に消去および記録可能なEEPROM等の不揮発性メモリである。
フレームメモリ109は、画像形成回路103で生成された画像を数フレーム分記憶するフレームメモリである。また、メモリ制御回路110は、フレームメモリ109に入出力される画像信号を制御するメモリ制御回路である。画像出力部111は、画像形成回路103で生成された画像を不図示の画像出力装置に表示するための画像出力部である。
The
The
The
The
次に、画像形成回路103に含まれる被写界深度制御回路の構成を、図1bを参照しながら説明する。
なお、本発明に係る画像処理装置、すなわち本実施形態における被写界深度制御回路は、専用の回路を用いて実現されてもよいし、コンピュータによって実現されてもよい。コンピュータによって実現される場合、補助記憶装置に記憶されたプログラムが主記憶装置にロードされ、CPUによって実行されることによって図1bに図示した各手段が機能する。(CPU、補助記憶装置、主記憶装置はいずれも不図示)
Next, the configuration of the depth of field control circuit included in the
Note that the image processing apparatus according to the present invention, that is, the depth-of-field control circuit in the present embodiment, may be realized using a dedicated circuit or may be realized by a computer. When implemented by a computer, each unit illustrated in FIG. 1B functions by loading a program stored in the auxiliary storage device into the main storage device and executing it by the CPU. (The CPU, auxiliary storage device, and main storage device are not shown)
位置合わせ部201は、撮影した複数の画像の位置合わせを行う手段であり、本発明における位置ずれ検出手段を含んでいる。本実施形態では距離の推定にDFD法を用いるため、フォーカス画像とデフォーカス画像の二枚の画像を用いて処理を行う。この二枚の画像は、連続して撮影された画像であるため、被写体の位置が完全には一致していない場合がある。この画像間のずれ幅及び/又はずれ方向を領域ごとに取得し、位置ずれを検出し、位置を合わせるための手段が位置合わせ部201である。なお、以降の説明において、フォーカス画像とは被写体に合焦した画像を指し、デフォーカス画像とは当該フォーカス画像と被写体のぼけ方が異なる画像のことを指す。
The
距離マップ推定部202は、二枚の画像にDFD法を適用して、被写体距離を領域ごとに推定し、当該距離の画像上での分布を表す距離マップを作成する手段である。DFD法の詳細については後述する。
信頼度マップ算出部203は、距離マップ推定部202が作成した距離マップがどの程度信頼できるかを表す信頼度を領域ごとに決定し、当該信頼度の画像上での分布を表す信頼度マップを作成する手段である。信頼度の算出方法の詳細については後述する。信頼度マップ算出部203が、本発明における信頼度情報算出手段である。
The distance
The reliability
距離マップ補正部204は、信頼度マップ算出部203が作成した信頼度マップを元に、距離マップを補正し、補正距離マップを作成する手段である。距離マップの補正方法については後述する。距離マップ推定部202、および距離マップ補正部204が、本発明における距離情報算出手段である。
被写界深度制御部205は、距離マップ補正部204が作成した補正距離マップを元に、撮影画像に対してぼけの付加を行う手段である。被写界深度制御部205が、本発明における被写界深度制御手段である。
The distance
The depth-of-
<処理フローチャート>
次に、撮像装置1の動作について、処理フローチャートを用いて詳細に説明する。
図2(a)は、撮像装置1が被写体を撮影してから、撮影画像に対して所定のぼけを付加、すなわち被写界深度が浅い画像を生成し、表示するまでの処理を示すフローチャートである。
<Process flowchart>
Next, the operation of the imaging apparatus 1 will be described in detail using a processing flowchart.
FIG. 2A is a flowchart illustrating processing from when the imaging device 1 captures a subject to adding predetermined blur to the captured image, that is, processing for generating and displaying an image with a shallow depth of field. is there.
不図示の撮影開始ボタンが押下されると、ステップS201が開始される。
ステップS201ではまず、露光制御部104や測距制御部105によって、露出制御や焦点制御などが行われ、撮影条件が決定される。その後、撮像素子102が光学系100を介して結像された被写体像を光電変換し、被写体輝度に応じたアナログ信号を生成する。その後、撮像素子102で生成されたアナログ画像信号が画像形成回路103を介してデジタル画像化され、フレームメモリ109に記録される。ステップS201で得られる画像はフォーカス画像である。
When a shooting start button (not shown) is pressed, step S201 is started.
In step S201, first, exposure control, focus control, and the like are performed by the
ステップS202では、ステップS201で撮影した画像に対して被写体のぼけ方が変わるように、フォーカス位置、開口絞り、焦点距離などの撮影条件を変更して同様に撮影を行う。撮影条件は、同一の被写体に対して異なるぼけの程度を得ることができれば、どのように変更されてもよい。撮影された画像は、同様にフレームメモリ109に記録される。ステップS202で得られる画像はデフォーカス画像である。なお、ステップS201での撮影と、ステップS202での撮影は、被写体の位置にずれが生じないよう短時間のうちに連続して行われることが好ましい。
In step S202, shooting is performed in the same manner by changing shooting conditions such as a focus position, an aperture stop, and a focal length so that the subject blurs with respect to the image shot in step S201. The shooting conditions may be changed in any way as long as different degrees of blur can be obtained for the same subject. The captured image is similarly recorded in the
ステップS203では、画像形成回路103が、フレームメモリ109に記録された画像に対して画像処理を行う。画像処理とは、例えばホワイトバランス、画素補間、色変換処理、ノイズ低減処理などの処理である。
また、ステップS203では、画像形成回路103に含まれる被写界深度制御回路が、フレームメモリ109に記録された画像に対して距離マップを推定する処理と、推定した距離マップに基づいて画像の被写界深度を変更する処理を行う。以降、この二つの処理を被写界深度制御処理と称する。被写界深度制御処理と、その他の画像処理の実行順序は、得られる画像が最適となるように設定すればよく、特に限定されるものではない。その他の画像処理におけるパラメータについても同様である。
In step S <b> 203, the
In step S203, the depth-of-field control circuit included in the
図2(b)は、ステップS203で行われる被写界深度制御処理の詳細を示したフローチャートである。
まず、ステップS211では、信頼度マップ算出部203がフォーカス画像を解析して信頼度マップを作成する。信頼度マップとは、ステップS213で作成する距離マップの信頼度を表すマップであり、DFD法によって推定した被写体との距離が、どの程度正確であるかを表すマップである。この信頼度マップは、撮影画像が有する画素ごとに分割されたマップであってもよく、矩形領域など特定の小ブロックに分割されたマップであってもよい。その分割サイズまたは形状に制限は無い。本実施形態では、撮影画像を矩形領域に分割する。
FIG. 2B is a flowchart showing details of the depth-of-field control process performed in step S203.
First, in step S211, the reliability
具体例を、図3(a)および図3(b)を用いて説明する。図3(a)は、ステップS201で撮影されたフォーカス画像を表し、図3(b)はステップS202で撮影されたデフォーカス画像を表している。 A specific example will be described with reference to FIGS. 3 (a) and 3 (b). FIG. 3A shows the focus image taken in step S201, and FIG. 3B shows the defocus image taken in step S202.
信頼度マップは、図3(a)のフォーカス画像を基に生成する。具体的には、分割した矩形領域ごとに信頼度を決定し、信頼度マップに割り当てていく。信頼度とは、具体的には、デフォーカスの影響が当該領域にどの程度出やすいかを表す値である。デフォーカスの影響が出にくい領域であるということは、DFD法で距離を算出するための手がかりに乏しい領域であることを意味するため、信頼度が低い領域は、算出した距離が正確ではな
い領域であることを意味する。
例えば、図3(a)の例の場合、太陽などの輝度が高い部分(符号302)や、空などの輝度変化の無い部分(符号303)は、デフォーカスの影響が出にくいためにぼけの違いを検出しにくい部分であるため、距離が正確に推定できない、すなわち信頼度が低い部分であると考えられる。
The reliability map is generated based on the focus image shown in FIG. Specifically, the reliability is determined for each divided rectangular area and assigned to the reliability map. Specifically, the reliability is a value indicating how easily the influence of defocusing appears in the area. The fact that it is an area where the influence of defocusing is difficult to occur means that it is an area that lacks clues for calculating the distance by the DFD method, so an area with low reliability is an area where the calculated distance is not accurate. It means that.
For example, in the case of the example in FIG. 3A, a portion with high luminance (reference numeral 302) such as the sun and a portion with no luminance change such as sky (reference numeral 303) are not easily affected by defocusing. Since it is a part where it is difficult to detect the difference, it is considered that the distance cannot be accurately estimated, that is, a part with low reliability.
領域に対応する信頼度、すなわちぼけの違いの検出しやすさは、当該領域に存在する画素の輝度値や彩度値、色相、領域の周波数特性などに基づいて判断することができる。具体的には、以下のような領域が、信頼度が低い領域であると判断することができる。
例1)領域内の画素が持つ輝度値の平均が、所定の範囲から外れている場合
例2)領域内の画素が持つ輝度値の変化が乏しい場合
例3)領域内の空間周波数が所定の値より低い場合
このように、信頼度を決定するための評価基準には複数のものを用いることができる。また、例示したもの以外の評価基準を用いてもよい。
The reliability corresponding to the area, that is, the ease of detecting the difference in blur can be determined based on the luminance value, saturation value, hue, frequency characteristic of the area, and the like. Specifically, the following areas can be determined to be areas with low reliability.
Example 1) The case where the average of the luminance values of the pixels in the region is out of the predetermined range. Example 2) The case where the luminance value of the pixels in the region is not sufficiently changed. Example 3) The spatial frequency in the region is predetermined. When lower than the value As described above, a plurality of evaluation criteria can be used for determining the reliability. Moreover, you may use evaluation criteria other than what was illustrated.
図3(a)のフォーカス画像に対して、複数の評価基準を適用して領域毎に信頼度を決定し、信頼度マップを生成する例を、図4を参照しながら説明する。なお、ここでは説明のため、信頼度マップを4×4の16領域に分割したものとする。
「平均輝度が閾値よりも高い領域に対して低い信頼度を与える」という評価基準によって生成された信頼度マップが図4(a)である。また、「輝度の変化幅が閾値よりも低い領域に対して低い信頼度を与える」という評価基準によって生成された信頼度マップが図4(b)である。割り当てる信頼度の値は、任意の数値で表してもよいし、最大値〜最小値を正規化して0〜1の数値で表すなどしてもよい。その表現方法に特に規定はない。
本実施形態では、ステップS211で、図4(a)に示した信頼度マップと、図4(b)に示した信頼度マップの二つを生成する。本実施形態では、異なる評価基準によって二つの信頼度マップを生成するが、生成される信頼度マップはいくつであってもよいし、一つに統合されて出力されてもよい。
An example in which a plurality of evaluation criteria are applied to the focus image in FIG. 3A to determine reliability for each region and a reliability map is generated will be described with reference to FIG. Here, for the sake of explanation, it is assumed that the reliability map is divided into 4 × 4 16 regions.
FIG. 4A shows a reliability map generated based on the evaluation criterion “giving low reliability to a region where the average luminance is higher than the threshold”. In addition, FIG. 4B shows a reliability map generated based on the evaluation criterion “giving low reliability to a region where the luminance change width is lower than the threshold”. The reliability value to be assigned may be expressed by an arbitrary numerical value, or may be expressed by a numerical value of 0 to 1 by normalizing the maximum value to the minimum value. There is no particular rule on the expression method.
In the present embodiment, in step S211, the reliability map shown in FIG. 4A and the reliability map shown in FIG. 4B are generated. In the present embodiment, two reliability maps are generated based on different evaluation criteria. However, the number of generated reliability maps may be any number or may be integrated and output.
次に、ステップS212で、位置合わせ部201がフォーカス画像とデフォーカス画像の位置ずれを検出し、信頼度マップ算出部203が、当該検出結果に基づいてさらに信頼度マップを生成する。
位置合わせは、撮影条件の変更による像倍率の変化やカメラの移動による影響を最小限にするための処理である。また、位置合わせを行う際の位置ずれ量(移動量)及び/又は位置ずれ方向(移動方向)、すなわちフォーカス画像およびデフォーカス画像の位置ずれを用いて、ステップS212で生成した信頼度マップとは別の信頼度マップを生成する。位置ずれから信頼度マップを生成するのは、フォーカス画像とデフォーカス画像の対応する領域が大きく離れている場合、当該領域はDFD法によって推定した距離が不正確であることが予想されるためである。
位置合わせ処理は、画像を複数の領域に分割して、領域毎に動きベクトルを算出することで行う。図5は、位置合わせ処理の概要を表した図である。
Next, in step S212, the
The alignment is a process for minimizing the influence of a change in image magnification due to a change in shooting conditions and a movement of the camera. In addition, the reliability map generated in step S212 using the positional deviation amount (movement amount) and / or the positional deviation direction (movement direction) at the time of alignment, that is, the positional deviation between the focus image and the defocused image. Generate another confidence map. The reason why the reliability map is generated from the misalignment is that when the corresponding areas of the focus image and the defocus image are greatly separated, the distance estimated by the DFD method is expected to be inaccurate in the area. is there.
The alignment process is performed by dividing an image into a plurality of regions and calculating a motion vector for each region. FIG. 5 is a diagram showing an outline of the alignment process.
図5(a)は、画像を不図示の微小領域に分割して行ったブロックマッチングの結果である。符号501で示した各矢印が、当該微小領域に対して算出された動きベクトルを表す。そして、これらの動きベクトルを、符号502で示した4×4の大きな領域毎にまとめ、当該領域に対する動きベクトルである代表動きベクトル503を算出する。図5(b)が、領域ごとの代表動きベクトルを表す図である。代表動きベクトルは、平均値やメディアン値などを用いて算出することができる。この算出方法は特定の方式に限定されるものではない。
FIG. 5A shows the result of block matching performed by dividing an image into small regions (not shown). Each arrow indicated by
ここで、フォーカス画像とデフォーカス画像との間で、図3における主被写体301の
頭部のみが右に動いていた場合を考える。すると、頭部が属する領域のみ、代表動きベクトル504の方向が周囲と異なる結果となる。したがって、当該頭部が属する領域はフォーカス画像とデフォーカス画像の対応が十分にとれていない領域であり、推定した距離の信頼度が低い領域であると判定できる。
ステップS212では、ある領域の代表動きベクトルの方向や大きさが、周辺の代表動きベクトルと異なるほど、当該領域に割り当てる信頼度を小さくする。例えば、対象領域の周辺にある複数領域の代表動きベクトルの平均値を算出し、当該平均値との差異が大きいほど、信頼度を小さくするようにしてもよい。
図4(c)が、位置合わせ処理によって生成した信頼度マップである。前述した通り、代表動きベクトルが周囲と異なる領域403の部分が低信頼度となる。
なお、本実施形態では代表動きベクトルを算出してから信頼度を算出するようにしたが、必ずしもそのように算出する必要はなく、微小領域の動きベクトルから直接信頼度を算出してもよい。また、フォーカス画像とデフォーカス画像の差分を取得することで被写体の動きを検出し、周囲と比較して動きが大きい領域の信頼度を低くするようにしてもよい。
Here, consider a case where only the head of the
In step S212, as the direction and magnitude of the representative motion vector in a certain area differ from the surrounding representative motion vectors, the reliability assigned to the area is reduced. For example, an average value of representative motion vectors of a plurality of regions around the target region may be calculated, and the reliability may be reduced as the difference from the average value increases.
FIG. 4C is a reliability map generated by the alignment process. As described above, the portion of the
In the present embodiment, the reliability is calculated after calculating the representative motion vector. However, the reliability is not necessarily calculated as such, and the reliability may be directly calculated from the motion vector of the minute region. In addition, the movement of the subject may be detected by obtaining the difference between the focus image and the defocus image, and the reliability of the region where the movement is large compared to the surroundings may be lowered.
次に、ステップS213で、距離マップ推定部202が距離マップを作成する。
本実施形態では、距離マップの推定にDFD法を用いる。ここで、図7を用いてDFD法の原理を簡単に説明する。図7において、対象物体Pまでの距離uは、対象物体Pが合焦する位置vが既知であれば、レンズの焦点距離fから、数式1を用いて算出することができる。
In the present embodiment, the DFD method is used for estimating the distance map. Here, the principle of the DFD method will be briefly described with reference to FIG. In FIG. 7, the distance u to the target object P can be calculated using Formula 1 from the focal length f of the lens if the position v at which the target object P is in focus is known.
DFD法においては、撮像面位置と対象物体Pの合焦位置とが異なることを前提として、撮像面上に投影された像のぼけの程度から合焦位置vを求め、これを数式1に代入することで対象物体Pまでの距離を算出する。撮像面がs1にある場合、距離uの物体表面上の点は撮像面上において錯乱円と呼ばれる円形に拡散し、数式2で表される像i1を形成する。
ここで、*は畳み込み演算を示し、i0は合焦している位置での像を表す。また、h1はPSF(Point Spread Function,点拡がり関数)であり、撮像面と合焦位置との距離
v−s1に比例する錯乱円の直径d1に依存する。そこで、錯乱円直径をパラメータとするPSFモデルを仮定し、像i1から錯乱円直径d1を推定する。
ただし、数式2からもわかるように、観測画像i1は対象物体の像i0に依存しているため、このままでは錯乱円直径d1は求めることができない。そこで、異なる撮像面位置s2における観測画像i2を撮像し、画像の周波数領域における観測画像i1と観測画像i2との比を取ることにより、数式3のように観測画像とPSFの関係を導出できる。
However, as can be seen from Equation 2, since the observed image i 1 depends on the image i 0 of the target object, the confusion circle diameter d 1 cannot be obtained as it is. Therefore, the observed image i 2 at a different imaging plane position s 2 is imaged, and the ratio between the observed image i 1 and the observed image i 2 in the frequency domain of the image is taken, so that the relationship between the observed image and the PSF is given by Equation 3. Can be derived.
ここで、I1、I2、I0、H1、H2はそれぞれ観測画像i1、i2、合焦画像i0、PSFであるh1、h2のフーリエ変換結果を表す。この、PSFをフーリエ変換した
ものの比を、光学系パラメータから事前に算出して表を作成しておき、実際に算出したものから距離値を算出することができる。
本実施形態においては、画像を4×4の領域に分割し、画像中のそれぞれの領域に対して、算出した被写体との距離値を与えた距離マップを作成する。
Here, I 1 , I 2 , I 0 , H 1 , and H 2 represent the Fourier transform results of the observed images i 1 , i 2 , the focused image i 0 , and the PSFs h 1 and h 2 , respectively. A ratio of the Fourier transform of PSF is calculated in advance from the optical system parameters to create a table, and the distance value can be calculated from what is actually calculated.
In the present embodiment, the image is divided into 4 × 4 regions, and a distance map is created in which the calculated distance value to the subject is assigned to each region in the image.
処理フローチャートの説明を続ける。ステップS214では、算出した複数の信頼度マップを統合し、統合信頼度マップを作成する。
図4を用いて、統合信頼度マップの作成処理を説明する。図4(a)および図4(b)は、ステップS211でフォーカス画像を元に求めた信頼度マップである。また、図4(c)は、ステップS212で行った位置合わせ処理により算出した信頼度マップである。これらの信頼度マップを図4(d)のように統合する。
具体的には、各信頼度を所定の値域に正規化した後、領域毎に乗算することで算出する。統合のさせ方は、特定の方法に限定されるものではない。たとえば、撮影モード(動きが多いシーンや静止物を撮影するシーンなど)の違いによって信頼度に重み付けを行ってもよい。本実施形態では、説明を簡単にするため、ハッチングされた部分を「低信頼度」、その他の部分を「高信頼度」として二値化した統合信頼度マップを生成する。
The description of the process flowchart will be continued. In step S214, the calculated plurality of reliability maps are integrated to create an integrated reliability map.
The integrated reliability map creation process will be described with reference to FIG. 4A and 4B are reliability maps obtained based on the focus image in step S211. FIG. 4C is a reliability map calculated by the alignment process performed in step S212. These reliability maps are integrated as shown in FIG.
Specifically, each reliability is normalized to a predetermined value range and then calculated by multiplying each region. The method of integration is not limited to a specific method. For example, the reliability may be weighted according to a difference in shooting modes (such as a scene with a lot of movement or a scene where a still object is shot). In this embodiment, in order to simplify the description, an integrated reliability map is generated by binarizing the hatched portion as “low reliability” and the other portions as “high reliability”.
ステップS215では、距離マップ補正部204が、ステップS214で作成された統合信頼度マップを用いて、ステップS213で作成された距離マップを補正する。
この処理の概要を、図6を用いて簡単に説明する。まず、ステップS201で取得されたフォーカス画像(図3(a))に対して、画像の輝度や色相が所定の範囲内となる複数の領域を設定する処理を行う。本例では、図6(a)に示したように、画像を4×4のブロックに分割し、それぞれ異なるハッチングで示した領域601〜604の4つの領域を設定するものとする。設定された4つのそれぞれの領域を補正領域と称する。ここでは説明を簡単にするため、本ステップで分割するブロックのサイズと、信頼度マップおよび距離マップが有する領域のサイズは同一とするが、互いのサイズは異なっていてもよい。
In step S215, the distance
The outline of this process will be briefly described with reference to FIG. First, a process of setting a plurality of regions in which the brightness and hue of the image are within a predetermined range is performed on the focus image (FIG. 3A) acquired in step S201. In this example, as shown in FIG. 6A, the image is divided into 4 × 4 blocks, and four
次に、ステップS214で生成した統合信頼度マップを用いて、ステップS213で算出した距離マップを補正する。ここでは、信頼度マップ中における信頼度が低い領域について、設定されている距離値を削除し、周囲にある信頼度が高い領域が持っている距離値を代入する処理を行う。
図6(b)は、作成した距離マップから、信頼度が低い領域の距離値を削除した状態を表す図である。×印が付与された領域は、信頼度が低い領域であるため、距離値が削除されていることを意味する。そして、距離値を持たない領域の近傍に距離値を持つ領域がある場合、当該距離値を代入する。このとき、同じ補正領域に属する領域を優先する。
Next, the distance map calculated in step S213 is corrected using the integrated reliability map generated in step S214. Here, a process is performed in which a set distance value is deleted for a region with low reliability in the reliability map, and a distance value possessed by a region with high reliability in the surrounding area is substituted.
FIG. 6B is a diagram illustrating a state in which the distance value of the region with low reliability is deleted from the created distance map. Since the region to which the x mark is given is a region with low reliability, it means that the distance value has been deleted. When there is a region having a distance value in the vicinity of a region having no distance value, the distance value is substituted. At this time, priority is given to areas belonging to the same correction area.
例えば、距離値が削除された領域607と同じ補正領域602に属する領域606は、距離が算出されている領域であるため、当該距離値を領域607に与える。同様に、領域608には、同一の補正領域603に属する領域605の距離値を与える。領域609は同じ補正領域に属する領域が存在しないため、周辺領域(例えば領域606や、距離値を与えた後の領域607)の距離値を与える。
以上の処理により、図6(c)のように補正された距離マップを得ることができる。そして、前景および背景に分離するため、距離マップに閾値処理を行い、図6(d)に示した二値の距離マップを得る。このようにして得られた距離マップが、本発明における補正距離マップである。なお、本例では距離値の取得において、同じ補正領域に属する領域を優先したが、距離が近い領域から優先的に得てもよいし、周辺にある複数の領域に対応する距離値を取得し、その平均を使用するなどしてもよい。
For example, since the
Through the above processing, a corrected distance map as shown in FIG. 6C can be obtained. Then, in order to separate the foreground and the background, threshold processing is performed on the distance map to obtain the binary distance map shown in FIG. The distance map obtained in this way is the correction distance map in the present invention. In this example, priority is given to areas belonging to the same correction area in the distance value acquisition. However, the distance values corresponding to a plurality of surrounding areas may be acquired preferentially from areas close to each other. The average may be used.
ステップS216では、被写界深度制御部205が、ステップS215で補正された距離マップを用いて、被写界深度を変更する処理を行う。
具体的には、図3(a)のフォーカス画像の、図6(d)の背景領域609に対応する領域に所定の二次元フィルタを適用し、積和演算をすることで、被写界深度を浅くした画像を得る。このフィルタは、ガウス関数など利用してもよいし、特定のレンズを模したフィルタを適用してもよい。また、演算方式は、積和演算に限るものではなく、FFTなど周波数空間を利用したものであってもよい。その演算方式に限定は無い。また、ここで、図6(d)の前景領域610と背景領域609との間に適切な遷移領域を加え、急激な変化を避けるようにしてもよい。
In step S216, the depth-of-
Specifically, the depth of field is obtained by applying a predetermined two-dimensional filter to a region corresponding to the
次に、処理はステップS204に移り、システム制御回路106が、ステップS203で作成された被写界深度の浅い画像を、画像出力部111を介して不図示の画像表示装置へ出力する。
Next, the process proceeds to step S204, and the
以上、説明したように、本実施形態に係る撮像装置は、フォーカスした画像とデフォーカスした画像から距離マップを算出し、信頼度を考慮して距離マップを補正し、補正した距離マップを用いてぼけ付加画像を生成する。このように構成することで、推定した距離の誤差を低減させることができ、ぼけの付加処理における画像劣化を回避することが可能となる。 As described above, the imaging apparatus according to the present embodiment calculates a distance map from a focused image and a defocused image, corrects the distance map in consideration of reliability, and uses the corrected distance map. Generate a blur added image. With this configuration, it is possible to reduce an error in the estimated distance, and to avoid image deterioration in the blur addition process.
なお、実施形態の説明は本発明を説明する上での例示であり、本発明は、発明の趣旨を逸脱しない範囲で適宜変更または組み合わせて実施することができる。例えば、実施形態の説明では、本発明に係る画像処理装置を撮像装置に組み込んだ形態について述べたが、フォーカス画像とデフォーカス画像の二つの画像を取得することができれば、本発明は他の装置に適用することもできる。例えば、映像再生装置や画像表示装置にも適用することもできるし、画像や動画にぼけを付加する画像処理ソフトウェアや、動画編集ソフトウェアなどとして実施することもできる。 It should be noted that the description of the embodiment is an example for explaining the present invention, and the present invention can be implemented with appropriate modifications or combinations without departing from the spirit of the invention. For example, in the description of the embodiment, the mode in which the image processing apparatus according to the present invention is incorporated in the imaging apparatus has been described. However, if two images of the focus image and the defocus image can be acquired, the present invention is not limited to the other apparatus. It can also be applied to. For example, the present invention can be applied to a video reproduction device or an image display device, or can be implemented as image processing software for adding blur to an image or a moving image, moving image editing software, or the like.
また、実施形態の説明では、信頼度が低い領域の距離値を削除し、周囲の領域から距離値を補完したが、距離値を直接補正してもよい。
この他にも、信頼度によって被写界深度制御用の強度パラメータを変更してもよい。例えば、信頼度が低い領域については、ぼけの付加量にゲインをかけ、ぼかしを弱く調整することで視覚的な画像劣化を緩和する処理を行ってもよい。
また、実施形態の説明では、動きベクトルから信頼度マップを生成した。しかし、ぼけ方の異なる複数の画像間の位置ずれが拡大縮小及び/又は回転を含む場合には、検出した位置ずれ量及び位置ずれ方向から複数の画像間の拡大縮小及び/又は回転を位置ずれとして算出し、その算出結果に基づいて信頼度情報を作成しても良い。
In the description of the embodiment, the distance value of the area with low reliability is deleted and the distance value is complemented from the surrounding area, but the distance value may be directly corrected.
In addition, the intensity parameter for controlling the depth of field may be changed depending on the reliability. For example, for an area with low reliability, a process for reducing visual image degradation may be performed by applying a gain to the amount of blur added and adjusting the blur to be weak.
In the description of the embodiment, the reliability map is generated from the motion vector. However, when the misalignment between a plurality of images with different blurs includes enlargement / reduction and / or rotation, the enlargement / reduction and / or rotation between the images is misaligned from the detected misalignment amount and misalignment direction. And reliability information may be created based on the calculation result.
また、実施形態の説明では、画像を解析することによって信頼度マップを生成する処理(ステップS211)と、位置合わせの結果によって信頼度マップを生成する処理(ステップS212)を行う形態について述べたが、後者の処理のみを行ってもよい。フォーカス画像に対する画像解析を行わなくても、本発明の目的は達成することができる。 In the description of the embodiment, a mode is described in which a process for generating a reliability map by analyzing an image (step S211) and a process for generating a reliability map by a result of alignment (step S212) are performed. Only the latter processing may be performed. The object of the present invention can be achieved without performing image analysis on the focus image.
また、本発明は、上記処理の少なくとも一部を含む画像処理方法として実施することもできるし、これらの方法をコンピュータに実行させる画像処理プログラムとして実施することもできる。上記処理や手段は、技術的な矛盾が生じない限りにおいて、自由に組み合わせて実施することができる。 In addition, the present invention can be implemented as an image processing method including at least a part of the above processing, or can be implemented as an image processing program that causes a computer to execute these methods. The above processes and means can be freely combined and implemented as long as no technical contradiction occurs.
201 位置合わせ部、202 距離マップ推定部、203 信頼度マップ算出部、204 距離マップ補正部、205 被写界深度制御部
DESCRIPTION OF
Claims (5)
前記複数の画像間の位置ずれ方向を検出する位置ずれ検出手段と、
前記複数の画像から被写体の距離情報を求めて距離マップを生成する距離マップ生成手段と、
前記位置ずれ方向に基づいて前記距離マップの各距離情報に対する信頼度を表す信頼度情報を求め、前記距離マップに対応する信頼度マップを生成する信頼度マップ生成手段と、を有する
ことを特徴とする画像処理装置。 An image processing apparatus that processes a plurality of images with different blurring methods,
A displacement detection means for detecting a displacement direction between the plurality of images;
Distance map generating means for determining distance information of a subject from the plurality of images and generating a distance map;
Reliability map generation means for obtaining reliability information representing reliability for each distance information of the distance map based on the positional deviation direction, and generating a reliability map corresponding to the distance map. An image processing apparatus.
前記信頼度マップ生成手段は、前記位置ずれ量および前記位置ずれ方向に基づいて、前記信頼度マップを生成する
ことを特徴とする、請求項1に記載の画像処理装置。 The positional deviation detection means further detects the positional deviation amount between the plurality of images,
The image processing apparatus according to claim 1, wherein the reliability map generation unit generates the reliability map based on the positional deviation amount and the positional deviation direction.
ことを特徴とする撮像装置。 An imaging apparatus comprising: an imaging unit; and the image processing apparatus according to claim 1.
前記複数の画像間の位置ずれ方向を検出する検出ステップと、
前記複数の画像から被写体の距離情報を求めて距離マップを生成する距離マップ生成ステップと、
前記位置ずれ方向に基づいて前記距離マップの各距離情報に対する信頼度を表す信頼度情報を求め、前記距離マップに対応する信頼度マップを生成する信頼度マップ生成ステップと、を有する
ことを特徴とする画像処理方法。 An image processing method for processing a plurality of images with different blurring methods,
A detection step of detecting a displacement direction between the plurality of images;
A distance map generating step for determining distance information of a subject from the plurality of images and generating a distance map;
A reliability map generation step of determining reliability information representing reliability for each distance information of the distance map based on the positional deviation direction, and generating a reliability map corresponding to the distance map. Image processing method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017011692A JP6336148B2 (en) | 2017-01-25 | 2017-01-25 | Image processing apparatus, image processing method, image processing program, and imaging apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2017011692A JP6336148B2 (en) | 2017-01-25 | 2017-01-25 | Image processing apparatus, image processing method, image processing program, and imaging apparatus |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012113472A Division JP6140935B2 (en) | 2012-05-17 | 2012-05-17 | Image processing apparatus, image processing method, image processing program, and imaging apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2017092983A JP2017092983A (en) | 2017-05-25 |
JP6336148B2 true JP6336148B2 (en) | 2018-06-06 |
Family
ID=58769269
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2017011692A Active JP6336148B2 (en) | 2017-01-25 | 2017-01-25 | Image processing apparatus, image processing method, image processing program, and imaging apparatus |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6336148B2 (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP7242822B2 (en) * | 2017-06-29 | 2023-03-20 | 株式会社東芝 | Estimation system and car |
JP2019011971A (en) * | 2017-06-29 | 2019-01-24 | 株式会社東芝 | Estimation system and automobile |
JP7204326B2 (en) * | 2018-01-15 | 2023-01-16 | キヤノン株式会社 | Information processing device, its control method and program, and vehicle driving support system |
JP7117914B2 (en) * | 2018-06-29 | 2022-08-15 | キヤノン株式会社 | Image processing device, image processing method, and program |
JP7240115B2 (en) * | 2018-08-31 | 2023-03-15 | キヤノン株式会社 | Information processing device, its method, and computer program |
JP7467368B2 (en) | 2021-02-25 | 2024-04-15 | 株式会社東芝 | Image processing device, distance measuring device, method and program |
WO2022244311A1 (en) * | 2021-05-20 | 2022-11-24 | ソニーグループ株式会社 | Imaging device, image processing method, and program |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000261828A (en) * | 1999-03-04 | 2000-09-22 | Toshiba Corp | Stereoscopic video image generating method |
KR101483660B1 (en) * | 2007-07-26 | 2015-01-16 | 코닌클리케 필립스 엔.브이. | Method and apparatus for depth-related information propagation |
JP5181913B2 (en) * | 2008-08-07 | 2013-04-10 | 株式会社リコー | Image processing apparatus, imaging apparatus, image processing method, and program |
-
2017
- 2017-01-25 JP JP2017011692A patent/JP6336148B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2017092983A (en) | 2017-05-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6140935B2 (en) | Image processing apparatus, image processing method, image processing program, and imaging apparatus | |
JP6336148B2 (en) | Image processing apparatus, image processing method, image processing program, and imaging apparatus | |
KR101233013B1 (en) | Image photographing device, distance computing method for the device, and focused image acquiring method | |
JP6271990B2 (en) | Image processing apparatus and image processing method | |
US9361680B2 (en) | Image processing apparatus, image processing method, and imaging apparatus | |
US9092875B2 (en) | Motion estimation apparatus, depth estimation apparatus, and motion estimation method | |
US9992478B2 (en) | Image processing apparatus, image pickup apparatus, image processing method, and non-transitory computer-readable storage medium for synthesizing images | |
JP5374119B2 (en) | Distance information acquisition device, imaging device, and program | |
US9619886B2 (en) | Image processing apparatus, imaging apparatus, image processing method and program | |
US20120307009A1 (en) | Method and apparatus for generating image with shallow depth of field | |
KR20090028255A (en) | Method and device for automatic focusing of image acquisition device | |
JP2009080113A (en) | Distance estimation method, distance estimation device, imaging device, and computer-readable medium | |
KR20140118031A (en) | Image processing apparatus and method thereof | |
JP2015207090A (en) | Image processor, and control method thereof | |
JP2010154306A (en) | Device, program and method for imaging control | |
JP4145308B2 (en) | Image stabilizer | |
JP6486453B2 (en) | Image processing apparatus, image processing method, and program | |
JP6381206B2 (en) | Image processing apparatus, control method thereof, and program | |
JP2012085205A (en) | Image processing apparatus, imaging device, image processing method, and image processing program | |
JP2021164059A (en) | Image processing apparatus, image processing method, and program | |
JP7020387B2 (en) | Imaging control device, imaging device and imaging control program | |
JP6900228B2 (en) | Imaging device, imaging system, imaging device control method, and program | |
JP2016126232A (en) | Imaging apparatus, method for controlling the same, and control program | |
JP2016103683A (en) | Imaging apparatus | |
JP2018200722A (en) | Image processing apparatus and control method therefor, program, and recording medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20170223 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20171113 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20171121 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20180122 |
|
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: 20180403 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180501 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 6336148 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |