JP2013044844A - Image processing device and image processing method - Google Patents

Image processing device and image processing method Download PDF

Info

Publication number
JP2013044844A
JP2013044844A JP2011181240A JP2011181240A JP2013044844A JP 2013044844 A JP2013044844 A JP 2013044844A JP 2011181240 A JP2011181240 A JP 2011181240A JP 2011181240 A JP2011181240 A JP 2011181240A JP 2013044844 A JP2013044844 A JP 2013044844A
Authority
JP
Japan
Prior art keywords
image
subject
processing apparatus
image processing
distance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2011181240A
Other languages
Japanese (ja)
Inventor
Hitoshi Yamada
整 山田
Yusuke Monobe
祐亮 物部
Takashi Fujii
隆志 藤井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Corp
Original Assignee
Panasonic Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Panasonic Corp filed Critical Panasonic Corp
Priority to JP2011181240A priority Critical patent/JP2013044844A/en
Publication of JP2013044844A publication Critical patent/JP2013044844A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Focusing (AREA)
  • Automatic Focus Adjustment (AREA)
  • Studio Devices (AREA)

Abstract

【課題】本発明は、複数のフォーカス状態で撮影される複数枚の画像と、複数のフォーカス状態の全てにおける合焦範囲を有する参照画像を用いて被写体距離を測定する場合に、被写体距離推定精度が低下することを課題とする。
【解決手段】上記の課題を解決するために、本発明では、n枚の画像のうちどの画像を被写体までの距離を計測するのに用いるかを選択する被写体距離計測画像選択部104を備える。被写体距離計測画像選択部104は参照画像と適切なペアとなるフォーカス状態の画像を選択し、被写体距離計測する。これにより、高精度に被写体距離を推定できる画像処理装置を提供する。
【選択図】図1
The present invention relates to subject distance estimation accuracy when measuring a subject distance using a plurality of images photographed in a plurality of focus states and a reference image having a focus range in all of the plurality of focus states. The problem is to lower.
In order to solve the above-described problem, the present invention includes a subject distance measurement image selection unit 104 that selects which of the n images is used to measure the distance to the subject. The subject distance measurement image selection unit 104 selects an image in a focus state that makes an appropriate pair with the reference image, and measures the subject distance. This provides an image processing apparatus capable of estimating the subject distance with high accuracy.
[Selection] Figure 1

Description

本発明は複数のフォーカス状態で撮影された複数の撮影画像から被写体距離を計測する画像処理装置および画像処理方法に関する。   The present invention relates to an image processing apparatus and an image processing method for measuring a subject distance from a plurality of photographed images photographed in a plurality of focus states.

カメラの撮影で画像と同時に、3次元シーンの奥行き、すなわち、被写体距離を計測できれば、画像表示・変換・認識等において様々な応用が可能となる。例えば、1枚の撮影画像と、この画像に対する被写体距離が得られれば、三角測距の原理で異なる視点から見た画像を擬似的に生成することができ、ステレオ、あるいは、多視点に対応する3次元画像の生成が可能になる。また、被写体距離に基づいて画像の領域分割を行えば、特定の距離に存在する被写体だけを切り出したり、画質調整したりすることも可能になる。   If the depth of the three-dimensional scene, that is, the subject distance can be measured simultaneously with the image taken by the camera, various applications in image display / conversion / recognition are possible. For example, if a single photographed image and the subject distance to this image are obtained, an image viewed from different viewpoints can be generated in a pseudo manner based on the principle of triangulation, and it corresponds to stereo or multiple viewpoints. A three-dimensional image can be generated. Further, if the image is divided based on the subject distance, it is possible to cut out only a subject existing at a specific distance or adjust the image quality.

被写体距離を非接触で計測する主な方式は、以下の能動的手法と受動的手法の2つに大別できる。1つ目の能動的手法は、赤外線や超音波、レーザーなどを照射し、反射波が戻ってくるまでの時間や反射波の角度などをもとに被写体距離を計測するものである。一般に、この手法を用いた場合には、被写体距離が近い時には高精度に計測できるものの、通常のカメラには必要のない能動的な照射/受光デバイスが必要になるという課題がある。また、被写体が遠方にあるときには、照射デバイスの出力レベルが低いと、被写体に届く照射光が弱くなり、被写体距離の計測精度が低下するという課題があり、一方、照射デバイスの出力レベルが高いと、消費電力が増大するという課題の他に、レーザーを用いる場合には安全性の問題もあるため、使用できる環境が制限されるという課題もある。一方、2つ目の手法は、カメラで撮影された画像だけを用いて被写体距離を計測するものである。   The main methods for measuring the subject distance in a non-contact manner can be broadly divided into the following two methods: an active method and a passive method. The first active method is to irradiate infrared rays, ultrasonic waves, lasers, etc., and measure the subject distance based on the time until the reflected wave returns and the angle of the reflected wave. In general, when this method is used, it is possible to measure with high accuracy when the subject distance is short, but there is a problem that an active irradiation / light receiving device that is not necessary for a normal camera is required. In addition, when the subject is far away, if the output level of the irradiation device is low, the irradiation light that reaches the subject becomes weak and the measurement accuracy of the subject distance decreases, while on the other hand, if the output level of the irradiation device is high In addition to the problem that the power consumption increases, there is also a problem that the environment in which the laser can be used is limited because there is a safety problem when using a laser. On the other hand, the second method is to measure the subject distance using only the image taken by the camera.

受動的手法にも多くの手法が存在するが、その一つに、撮影された画像に生じるぼけ量の相関値を利用するDepth from Defocus(以下、DFDと呼ぶ)と呼ばれる手法がある。一般に、撮影画像に生じるぼけ量は、撮影時のフォーカス状態と被写体距離の関係に応じてカメラ毎に一意に決まる。DFDではこの特性を利用し、あらかじめ既知の被写体距離にある被写体を複数のフォーカス状態で撮影することによって、被写体距離と撮影画像に生じるぼけ量の相関値の関係を計測しておく。これにより、実際の撮影において複数のフォーカス状態で撮影を行えば、画像間のぼけ量の相関値を算出することにより、被写体距離を計測することが可能となる(特許文献1参照)。   There are many passive methods, and one of them is a method called Depth from Defocus (hereinafter referred to as DFD) that uses a correlation value of the amount of blur generated in a captured image. In general, the amount of blur that occurs in a captured image is uniquely determined for each camera according to the relationship between the focus state at the time of shooting and the subject distance. In the DFD, the relationship between the subject distance and the correlation value of the blur amount generated in the photographed image is measured by photographing a subject at a known subject distance in a plurality of focus states in advance using this characteristic. Thus, if shooting is performed in a plurality of focus states in actual shooting, the subject distance can be measured by calculating the correlation value of the blur amount between images (see Patent Document 1).

特許文献1に開示されている手法では、異なるフォーカス状態で撮影された2枚の画像を用いる。この2枚の画像は、異なるフォーカス状態で撮影されているため、特定距離に存在する被写体のぼけ量が2枚の画像で異なるという性質があり、この性質を利用して被写体距離の計測を行う。例として、近距離に存在する被写体を、それぞれ近距離側と遠距離側のフォーカス状態で2枚撮影した場合を考えるとする。この場合、近距離側にフォーカスを合わせて撮影された1枚の画像ではその被写体は鮮明に写る一方で、遠距離側にフォーカスを合わせて撮影されたもう1枚の画像ではその被写体はぼけた状態で写る。この被写体の写り方の差とあらかじめ計測されている被写体距離と撮影画像に生じるぼけ量の相関値を利用する事で、被写体距離を計測する。   In the method disclosed in Patent Document 1, two images taken in different focus states are used. Since these two images are taken in different focus states, there is a property that the blur amount of the subject existing at a specific distance differs between the two images, and the subject distance is measured using this property. . As an example, let us consider a case where two subjects are photographed at a short distance and a long distance focus respectively. In this case, the subject is clearly visible in one image shot with the focus on the short distance side, while the subject is blurred in the other image shot with the focus on the long distance side. It is reflected in the state. The subject distance is measured by using a correlation value between the difference in how the subject is reflected, the subject distance measured in advance, and the blur amount generated in the captured image.

特表2009−505104号公報Special table 2009-505104

Flexible Depth of Field Photography,H.Nagahara,S.Kuthirummal,C.Zhou,S.K.Nayer,European Conference on Computer Vision(ECCV),Oct,2008Flexible Depth of Field Photography, H.C. Nagahara, S .; Kuthirmal, C.I. Zhou, S .; K. Nayer, European Conference on Computer Vision (ECCV), Oct, 2008

特許文献1に開示されている手法では、絞りを大きく絞らない限り撮影画像の被写界深度の幅が狭くなる。被写界深度の深さによって画像でぼけずに写る距離間隔が決まるため、被写界深度は、距離ごとのぼけ量の違いを利用するDFDで計測可能な距離を決める重要な要素である。そのため、DFDにおいて計測可能な被写体距離を長く得る、つまり被写界深度を広げるには多数の画像を撮影する必要がある。これは少数の画像で距離計測が可能であるというDFDのメリットを相殺する事となる。加えて絞りを大きく絞ることで少ない枚数の画像から参照画像を得ることが出来るが、入射光量が低下するためこれを補うためには撮像素子の感度を高くするか露光時間を長くするかのいずれかが必要になる。しかし前者は撮影画像のノイズの増大を、後者は被写体ぶれを招き、これらによって被写体のスペクトル成分が乱れ、結果として被写体距離の計測精度が低下してしまう。このため、2枚以上の画像から広範囲の被写体距離を計測する場合には、多数の画像を用いる必要があった。   In the method disclosed in Patent Document 1, the depth of field of the captured image is narrow unless the aperture is greatly reduced. Since the distance distance in which an image is not blurred is determined by the depth of field, the depth of field is an important factor that determines the distance that can be measured by the DFD that uses the difference in blur amount for each distance. Therefore, in order to obtain a long subject distance that can be measured by DFD, that is, to increase the depth of field, it is necessary to capture a large number of images. This offsets the advantage of DFD that distance measurement is possible with a small number of images. In addition, it is possible to obtain a reference image from a small number of images by greatly reducing the aperture, but since the amount of incident light decreases, to compensate for this, either increase the sensitivity of the image sensor or increase the exposure time. Is necessary. However, the former causes an increase in noise of the photographed image, and the latter causes blurring of the subject, which disturbs the spectral component of the subject, and as a result, the measurement accuracy of the subject distance decreases. For this reason, when measuring a wide range of subject distances from two or more images, it is necessary to use a large number of images.

しかしながら、従来法で複数枚の画像を用いて距離計測を行う場合、計測した距離においてぼけ量の異なる複数枚の画像を用いる必要があるが、事前には被写体の距離が不明あり、被写体の存在する最適な画像を選択できないため距離計測が困難であるという課題が存在した。   However, when distance measurement is performed using a plurality of images in the conventional method, it is necessary to use a plurality of images with different blur amounts at the measured distance, but the subject distance is unknown in advance and the subject exists. There is a problem that distance measurement is difficult because an optimal image to be selected cannot be selected.

本発明は上述の問題に鑑みてなされたものであり、異なるぼけを有する複数枚の撮影画像から安定に距離計測を可能にする画像処理装置および画像処理方法を提供することを目的とする。   SUMMARY An advantage of some aspects of the invention is that it provides an image processing apparatus and an image processing method capable of stably measuring a distance from a plurality of photographed images having different blurs.

上記課題を解決するために、本願発明は、複数のフォーカス状態で撮影された複数の撮影画像から被写体距離を計測する画像処理装置であって、複数のフォーカス状態で画像をn枚(ただし、n≧2)撮影する撮像部と、前記撮像部の合焦位置および被写界深度を変化させる合焦範囲制御部と、前記撮像部によって撮影される複数のフォーカス状態の全てにおける合焦範囲を有する第一の参照画像を生成する参照画像生成部と、前期n枚の画像のうち、被写体までの距離を計測するのに用いる距離計測用画像を選択する被写体距離計測画像選択部と、前記距離計測用画像および前記第一の参照画像のぼけの度合いから被写体までの距離を計測する距離計測部とを備える、ことを特徴とする。   In order to solve the above problems, the present invention is an image processing apparatus for measuring a subject distance from a plurality of captured images captured in a plurality of focus states, wherein n images (however, n ≧ 2) having an in-focus range in all of a plurality of focus states captured by the imaging unit, an in-focus range control unit that changes the in-focus position and depth of field of the imaging unit, and the imaging unit A reference image generation unit that generates a first reference image, a subject distance measurement image selection unit that selects a distance measurement image to be used for measuring a distance to a subject among n images in the previous period, and the distance measurement And a distance measuring unit that measures the distance to the subject from the degree of blur of the image for use and the first reference image.

本発明によれば、合焦範囲制御部によって絞りを絞ることなく通常より合焦範囲の広い画像を得ることが出来るため、3枚の画像から被写体距離の計測を行うことが可能となる。加えて、詳細な被写体距離を計測する前に、画像の画素ごとに被写体計測に適切な画像を選択し、その被写体計測に適切な画像と合焦範囲の広い画像の2枚を用いて被写体距離を計測可能となるため、フォーカス状態が異なる画像間であっても、被写体距離を高精度に計測する事が可能になる。   According to the present invention, it is possible to obtain an image with a wider focus range than usual without reducing the aperture by the focus range control unit, and thus it is possible to measure the subject distance from three images. In addition, before measuring the detailed subject distance, an image suitable for subject measurement is selected for each pixel of the image, and the subject distance is determined using two images: an image suitable for subject measurement and an image with a wide focus range. Therefore, it is possible to measure the subject distance with high accuracy even between images in different focus states.

本発明の実施の形態1の画像処理装置の構成を示すブロック図1 is a block diagram showing a configuration of an image processing apparatus according to a first embodiment of the present invention. フォーカスを変化させた際の集光の様子を示す模式図Schematic diagram showing the state of light collection when the focus is changed 本発明の実施の形態1の処理の流れを示すフロー図The flowchart which shows the flow of the process of Embodiment 1 of this invention. 近距離に存在する被写体の距離計測結果を示す図The figure which shows the distance measurement result of the object which exists in short distance 本発明の実施の形態2の画像処理装置の構成を示すブロック図FIG. 2 is a block diagram showing a configuration of an image processing apparatus according to a second embodiment of the present invention. 本発明の実施の形態2の処理の流れを示すフロー図The flowchart which shows the flow of a process of Embodiment 2 of this invention. ブロックマッチング法の処理を表す図Diagram showing processing of block matching method

以下、本発明の実施の形態について、図面を参照しながら説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

(実施の形態1)
図1は本発明の実施の形態1に係る画像処理装置の構成を示す図である。画像処理装置100は撮像部101、合焦範囲制御部102、参照画像生成部103、被写体距離計測画像選択部104、被写体距離計測部105を有する。
(Embodiment 1)
FIG. 1 is a diagram showing a configuration of an image processing apparatus according to Embodiment 1 of the present invention. The image processing apparatus 100 includes an imaging unit 101, a focusing range control unit 102, a reference image generation unit 103, a subject distance measurement image selection unit 104, and a subject distance measurement unit 105.

撮像部101は光線を集めるレンズが組み込まれたレンズユニットとCCDやCMOSなどの撮像素子を含んで構成され、被写体の像を撮像して画像を出力する機能を有する。   The imaging unit 101 includes a lens unit in which a lens for collecting light rays is incorporated and an imaging element such as a CCD or a CMOS, and has a function of capturing an image of a subject and outputting the image.

合焦範囲制御部102は撮像部101が有するレンズユニットを制御し、合焦位置および被写界深度を制御する機能を有する。具体的にはレンズユニットに組み込まれたオートフォーカス機構を特定のパターンで動作させる、あるいは特定の光学素子を切り替えるなどによって制御を行う。   The focusing range control unit 102 has a function of controlling the lens unit included in the imaging unit 101 and controlling the focusing position and the depth of field. Specifically, the control is performed by operating an autofocus mechanism incorporated in the lens unit with a specific pattern or switching a specific optical element.

参照画像生成部103は合焦範囲制御部102の作用によって異なる合焦位置および被写界深度を有する一または複数枚の画像から、レンズによるぼけがない状態を推定した参照画像を生成する。   The reference image generation unit 103 generates a reference image in which a state in which there is no blur due to the lens is estimated from one or a plurality of images having different in-focus positions and depths of field by the operation of the in-focus range control unit 102.

被写体距離計測画像選択部104は撮影された異なる合焦位置および被写界深度を有する複数枚の画像、および参照画像から画像の画素あるいは領域ごとの被写体距離計測に適した画像の組み合わせを選択する。   The subject distance measurement image selection unit 104 selects a plurality of images having different in-focus positions and depths of field, and combinations of images suitable for subject distance measurement for each pixel or area of the image from the reference image. .

被写体距離計測部105は被写体距離計測画像選択部104で選択された画像を用いて、DFDの手法に基づいて被写体距離の計測を行う。   The subject distance measurement unit 105 measures the subject distance based on the DFD technique using the image selected by the subject distance measurement image selection unit 104.

以下、実施形態1の構成を示す図1おける各ブロック間のデータフローについて説明する。   The data flow between the blocks in FIG. 1 showing the configuration of the first embodiment will be described below.

撮像部101では、第1画像、第3画像及び、合焦範囲制御部102から出力される合焦範囲制御情報を基に合焦位置を変化させた第2画像を撮像する。   The imaging unit 101 captures the first image, the third image, and the second image in which the focus position is changed based on the focus range control information output from the focus range control unit 102.

合焦範囲制御部102では、第2画像を撮影する際の合焦位置範囲の開始位置、及び終了位置等の合焦範囲制御情報を撮像部101に出力し、合焦範囲を制御する。   The focus range control unit 102 outputs focus range control information such as a start position and an end position of the focus position range when shooting the second image to the imaging unit 101 to control the focus range.

参照画像生成部103は、撮像部101にて撮像された第2画像から、レンズによるぼけがない状態を推定した参照画像を生成し、被写体距離計測画像選択部104に出力する。   The reference image generation unit 103 generates a reference image in which no lens blur is estimated from the second image captured by the imaging unit 101, and outputs the reference image to the subject distance measurement image selection unit 104.

被写体距離計測画像選択部104は、撮像部101で撮像された第1画像、第3画像と、参照画像生成部103で生成された参照画像のから、画像の画素あるいは領域ごとの被写体距離計測に適した画像の組み合わせを選択し、画像選択情報を生成する。そして、第1画像、画像、第3画像、参照画像に加え、生成された画像選択情報を、被写体距離計測部105に出力する。   The subject distance measurement image selection unit 104 performs subject distance measurement for each pixel or region of the image from the first and third images captured by the imaging unit 101 and the reference image generated by the reference image generation unit 103. A suitable image combination is selected to generate image selection information. Then, in addition to the first image, the image, the third image, and the reference image, the generated image selection information is output to the subject distance measurement unit 105.

被写体距離計測部105は被写体距離計測画像選択部104で生成された画像選択情報によって選択された画像を用いて、DFDの手法に基づいて被写体距離の計測を行う。   The subject distance measurement unit 105 measures the subject distance based on the DFD method using the image selected by the image selection information generated by the subject distance measurement image selection unit 104.

次に、撮影される画像の被写界深度を拡張する手法について説明する。一般的な被写界深度の幅は以下のように定義される。まず、過焦点距離(Hyperfocal Distance)について説明する。過焦点距離は、その距離にフォーカスを合わせた場合、その距離から後側に無限遠までが合焦していると判断される距離のことで、レンズの焦点距離をf、レンズのFナンバーをF、検知可能な最小のぼけを表す許容錯乱円の大きさをcとした時、過焦点距離hは以下の数1で近似される。   Next, a method for extending the depth of field of a captured image will be described. A general depth of field is defined as follows. First, the hyperfocal distance (Hyperfocal Distance) will be described. The hyperfocal distance is a distance that is determined to be in focus from the distance to infinity when the focus is adjusted to that distance. The focal length of the lens is f, and the F number of the lens is F, where c is the size of the permissible circle of confusion representing the smallest detectable blur, the hyperfocal distance h is approximated by the following equation (1).

Figure 2013044844
Figure 2013044844

距離sにフォーカスを合わせた際の被写界深度は、sより前側の被写界深度をDn、後側の被写界深度をDfとした時、以下の数2で表される。   The depth of field when focusing on the distance s is expressed by the following formula 2, where Dn is the depth of field ahead of s and Df is the depth of field behind.

Figure 2013044844
Figure 2013044844

以上の式より、焦点距離を固定した場合、被写界深度の幅は絞りによってのみ変更可能である。   From the above formula, when the focal length is fixed, the width of the depth of field can be changed only by the diaphragm.

これに対して、絞りを絞ることなく被写界深度の幅を広げる種々の手法が提案されており、被写界深度拡張(Extended Depth of Field、以下EDOFと表記)と称される。以下、EDOFの具体的な手法について説明する。   On the other hand, various methods for expanding the depth of field without reducing the aperture have been proposed, which is referred to as extended depth of field (hereinafter referred to as EDOF). Hereinafter, a specific method of EDOF will be described.

最も単純なEDOF手法は、合焦位置を少しずつずらしながら複数の画像を撮影し、それらの画像から合焦している部分を抜き出して合成する手法である。   The simplest EDOF method is a method of taking a plurality of images while gradually shifting the in-focus position, and extracting and synthesizing the in-focus portions from these images.

これに対して、露光中にフォーカスを変化させることで、多数の画像を合成するのと同様の効果を実現する手法が、非特許文献1に開示されている。   On the other hand, Non-Patent Document 1 discloses a technique for realizing the same effect as combining a large number of images by changing the focus during exposure.

図2はフォーカスを変化させた際の集光の様子を模式的に示す図である。図2のように、被写体距離a1に合焦する撮像素子の位置をb1、被写体位置a2に合焦する撮像素子の位置をb2とする。レンズの公式よりa1とa2の間の距離に対して合焦する撮像素子の位置は必ずb1とb2の間にある。従って、露光中に撮像素子がb1からb2まで移動すると、a1に対しては始め合焦していたところから段々とぼけが大きくなり、画像にはこれらのぼけが積分されて重なって写る。一方、a2に対しては逆にぼけが大きかったところから段々と合焦していき、やはり画像にはこれらのぼけが重なって写る。   FIG. 2 is a diagram schematically showing the state of light collection when the focus is changed. As shown in FIG. 2, the position of the image sensor that focuses on the subject distance a1 is b1, and the position of the image sensor that focuses on the subject position a2 is b2. According to the lens formula, the position of the image sensor that focuses on the distance between a1 and a2 is always between b1 and b2. Accordingly, when the image sensor moves from b1 to b2 during exposure, the blur gradually increases from the point where it first focused on a1, and these blurs are integrated and overlapped in the image. On the other hand, the focus is gradually increased from the point where the blur is large for a2, and these blurs are superimposed on the image.

このことを数式を用いてさらに詳しく説明する。光学系のぼけの状態を表す点広がり関数(Point Spread Function、以下PSFと表記)が、以下の数3で表す形状であるとする。   This will be described in more detail using mathematical expressions. It is assumed that a point spread function (Point Spread Function, hereinafter referred to as PSF) representing the blur state of the optical system has a shape represented by the following Equation 3.

Figure 2013044844
Figure 2013044844

ただし、fは光学系の焦点距離、aは光学系の開口部の直径、uは被写体距離、vはレンズの公式1/f=1/u+1/vで定まる像面位置、Δvはvからの像面の移動量、Rはぼけの中心からの距離、gは定数をそれぞれ表す。   Where f is the focal length of the optical system, a is the diameter of the aperture of the optical system, u is the subject distance, v is the image plane position determined by the lens formula 1 / f = 1 / u + 1 / v, and Δv is from v The amount of movement of the image plane, R is the distance from the blur center, and g is a constant.

数3は像面の移動量Δvの関数なので、Δvがある関数V(t)に従って時刻0からTにわたって変化する場合、最終的に得られるPSFは以下の数4のように定義できる。   Since Equation 3 is a function of the image plane movement amount Δv, when Δv changes from time 0 to T according to a certain function V (t), the finally obtained PSF can be defined as Equation 4 below.

Figure 2013044844
Figure 2013044844

ここで、V(t)が等速運動、即ちV(t)=v0+stで表されるとすると、数4は以下の数5のように解ける。   Here, if V (t) is expressed as constant velocity motion, that is, V (t) = v0 + st, Equation 4 can be solved as Equation 5 below.

Figure 2013044844
Figure 2013044844

ここで、erfc(x)は相補誤差関数(Complementary Error FUnction)である。u>>f、即ち被写体距離が光学系の焦点距離より十分大きいとすると、数5はuによらず一定の値であると考えることが出来る。つまり被写体距離によらず一定のぼけを有する画像が得られることを意味する。像面位置の始点v+V(0)、および終点v+V(T)を変化させることで、ぼけが一定となる被写体距離の範囲を変化させることが出来る。   Here, erfc (x) is a complementary error function. If u >> f, that is, the subject distance is sufficiently larger than the focal length of the optical system, Equation 5 can be considered to be a constant value regardless of u. That is, it means that an image having a constant blur can be obtained regardless of the subject distance. By changing the start point v + V (0) and the end point v + V (T) of the image plane position, the range of the subject distance where the blur is constant can be changed.

次に、参照画像を用いたDFDの手法について説明する。参照画像Rと撮影画像Iの間には、以下の数6で示す関係が成立する。   Next, a DFD method using a reference image will be described. Between the reference image R and the captured image I, the relationship shown by the following formula 6 is established.

Figure 2013044844
Figure 2013044844

ここで、hは位置(x、y)におけるPSFを、d(x、y)は位置(x、y)における被写体距離を表す。また、式中の*は畳み込み演算を表す。例えば数3のように、PSFは被写体距離によって異なるため、異なる複数の距離にある被写体が存在する場合、画像の位置ごとに異なるPSFが畳み込まれた画像が撮影画像として得られる。   Here, h represents the PSF at the position (x, y), and d (x, y) represents the subject distance at the position (x, y). Also, * in the formula represents a convolution operation. For example, as shown in Equation 3, since the PSF varies depending on the subject distance, when there are subjects at a plurality of different distances, an image in which a different PSF is convoluted for each image position is obtained as a captured image.

ここで、被写体距離d1、d2、…、dnに対応するPSFをh(x、y、d1)、h(x、y、d2)、…、h(x、y、dn)とする。例えば参照画像R(x、y)に存在する被写体が距離d1にある場合、撮影画像I(x、y)はR(x、y)にH(x、y、d1)を畳み込んだものに等しく、R(x、y)に他の被写体距離に対応するPSFを畳み込んだ場合には観測画像との差が生じる。よって、R(x、y)に各PSFを畳み込んだ画像と撮影画像の差を順に比較し、その差が最小となるPSFに対応する距離を調べれば、D(x、y)を求めることが出来る。具体的には以下の数7によって求められる。   Here, PSFs corresponding to the subject distances d1, d2,..., Dn are assumed to be h (x, y, d1), h (x, y, d2), ..., h (x, y, dn). For example, when the subject existing in the reference image R (x, y) is at the distance d1, the captured image I (x, y) is obtained by convolution of R (x, y) with H (x, y, d1). Equally, when a PSF corresponding to another object distance is convoluted with R (x, y), a difference from the observed image occurs. Therefore, D (x, y) is obtained by comparing the difference between the image obtained by convolving each PSF with R (x, y) and the photographed image in order, and examining the distance corresponding to the PSF that minimizes the difference. I can do it. Specifically, it is obtained by the following equation (7).

Figure 2013044844
Figure 2013044844

実際には撮影画像Iに含まれるノイズの影響を低減するため、画像をブロックに区切ってブロック内での誤差の総和を求め、誤差が最小となる距離をそのブロック全体の距離とするなどの処理を行うことで、より安定に距離計測を行うことが出来る。尚、数6および数7をフーリエ変換し、周波数領域上での比較を行うことで距離計測を行ってもよい。周波数領域では数6および数7における畳み込み演算が乗算に変換され、より高速に距離計測を行うことが出来る。   Actually, in order to reduce the influence of noise contained in the captured image I, the image is divided into blocks, the sum of errors in the block is obtained, and the distance that minimizes the error is set as the distance of the entire block. By performing this, it is possible to perform distance measurement more stably. Note that the distance measurement may be performed by performing Fourier transform on Equations 6 and 7 and performing comparison in the frequency domain. In the frequency domain, the convolution operations in Equations 6 and 7 are converted into multiplications, and distance measurement can be performed at higher speed.

本発明では、これらのEDOF及びDFDを応用して、被写体距離の計測を行う。本発明の実施の形態1に係る画像処理装置によって、被写界深度を拡張した参照画像と異なるフォーカス状態で撮影された2枚の画像、合計3枚の画像から被写体距離計測を行う処理の流れについて図3に基づいて説明する。なお、以下では被写界深度を拡張する手法として、露光時間中にフォーカスを変化させる方法を用いるものとして説明を行う。   In the present invention, the subject distance is measured by applying these EDOF and DFD. Flow of processing for measuring subject distance from a total of three images, two images shot in a different focus state from a reference image with an extended depth of field by the image processing apparatus according to the first embodiment of the present invention. Will be described with reference to FIG. In the following description, a method for changing the focus during the exposure time is used as a method for extending the depth of field.

まず、撮像部101によって、それぞれ異なる合焦範囲を有する第1画像および第3画像を撮影する(ステップS101およびS105)。説明のため、第1画像の合焦位置は、第3画像の合焦位置よりも手前とする。更に、第1画像および第3画像に加え、合焦位置制御部102によって合焦位置を変化させて撮像する第2画像を撮影する。第2画像は、合焦位置を変更開始後(ステップS102)から、合焦位置変更終了後(ステップS104)まで、合焦位置を変更させている間に撮影する(ステップS103)。具体的には第1画像の撮影後に、合焦範囲制御部2によってフォーカス位置を等速で移動させ、合焦位置を所定の間隔だけ移動させて第2画像を撮影する。図2上で各画像の撮影位置を説明すると、第1画像はa1の位置で撮影、第2画像はa1からa2へ合焦位置変更中に撮影、第3画像はa2の位置で撮影される。このようにして撮影された第2画像は合焦位置変更範囲内で均一なぼけを有する。被写体距離に対して均一なぼけは参照画像の生成に、被写体距離に応じたぼけはDFDによる距離計測にそれぞれ寄与する事になる。ここで第1、第3画像では合焦位置を変更しないと記述しているが、この場合に限らず、第1、第3画像の撮影中に合焦位置の変更を伴っても構わない。また、第2画像の露光中におけるフォーカスの移動速度は等速でなくともよい。   First, the imaging unit 101 captures a first image and a third image having different focus ranges (steps S101 and S105). For the sake of explanation, the in-focus position of the first image is assumed to be in front of the in-focus position of the third image. Furthermore, in addition to the first image and the third image, a second image that is captured by changing the in-focus position by the in-focus position control unit 102 is captured. The second image is taken while changing the in-focus position from the start of changing the in-focus position (step S102) to the end of the in-focus position change (step S104) (step S103). Specifically, after shooting the first image, the focus range control unit 2 moves the focus position at a constant speed, and moves the focus position by a predetermined interval to capture the second image. The shooting position of each image will be described on FIG. 2. The first image is shot at the position a1, the second image is shot while changing the focus position from a1 to a2, and the third image is shot at the position a2. . The second image photographed in this way has a uniform blur within the focus position change range. The blur that is uniform with respect to the subject distance contributes to the generation of the reference image, and the blur according to the subject distance contributes to the distance measurement by the DFD. Here, it is described that the focus position is not changed in the first and third images. However, the present invention is not limited to this case, and the focus position may be changed during shooting of the first and third images. Further, the moving speed of the focus during the exposure of the second image may not be constant.

次に、参照画像生成部103によって第2画像から参照画像を生成する(ステップS106)。参照画像は数6より撮影画像に対してPSFを逆畳み込みすることで求められる。本来参照画像を正しく求めるためには被写体距離D(x、y)が既知である必要があるが、第2画像は被写界深度が拡張されているため、拡張された範囲の被写体距離に対してPSFは一定である。第2画像に対して、均一なぼけに対応する1種類のPSFによる逆畳み込み演算を行うことにより、a1からa2の範囲全てに合焦した参照画像が得られる。尚、逆畳み込みのアルゴリズムはウィーナーフィルタ(Wiener Filter)のような既知の手法を用いることが出来る。   Next, a reference image is generated from the second image by the reference image generation unit 103 (step S106). The reference image is obtained by deconvolution of the PSF with respect to the photographed image from Equation 6. Originally, the subject distance D (x, y) needs to be known in order to correctly obtain the reference image. However, since the depth of field is extended in the second image, the subject distance in the extended range is determined. PSF is constant. By performing a deconvolution operation with one type of PSF corresponding to uniform blur on the second image, a reference image focused on the entire range from a1 to a2 is obtained. As a deconvolution algorithm, a known method such as a Wiener filter can be used.

このように、第1、第3画像の2枚に加え、広い被写界深度を有する参照画像を用いる事で広範囲の距離計測を行う事が可能となる。   As described above, it is possible to measure a wide range of distances by using a reference image having a wide depth of field in addition to the first and third images.

ここで、第1、第3画像及び参照画像の3枚の画像から被写体距離を計測する際には、数7を数8のように3枚用に拡張する。   Here, when the subject distance is measured from the three images of the first and third images and the reference image, Equation 7 is expanded to 3 as Equation 8.

Figure 2013044844
Figure 2013044844

これにより、3枚以上の画像を用いたDFDが可能となる。しかし、数8のように拡張してしまうと、それぞれ合焦位置の異なる位置で撮影された画像I1、I3の結果を足しこむ事となるため、正確な被写体距離を求める際の阻害要因となる。   Thereby, DFD using three or more images becomes possible. However, if the expansion is performed as shown in Equation 8, the results of the images I1 and I3 captured at different in-focus positions are added, which is an impediment to obtaining an accurate subject distance. .

そこで、本実施形態における被写体距離計測画像選択部104では、第2画像の参照画像を用いて被写体距離を計測する際に、第1画像、第3画像のどちらの画像を用いるのが適切かを選択する(ステップS107)。高精度な被写体距離を求めるため、各画素または領域ごとに、事前に第1画像、第3画像のうち、どちらの画像を用いるのが適切かを選択した上で被写体距離を求める。   Therefore, the subject distance measurement image selection unit 104 according to the present embodiment determines which of the first image and the third image is appropriate when measuring the subject distance using the reference image of the second image. Select (step S107). In order to obtain a highly accurate subject distance, the subject distance is obtained after selecting which one of the first image and the third image is appropriate for each pixel or region in advance.

被写体距離計測画像選択部104では、予め計測済の各フォーカス状態のボケパラメータを参照画像へ畳み込む事で各フォーカス状態における参照画像のボケを表す画像を生成する。そして、撮像部において撮影された複数枚の画像と、各フォーカス状態における参照画像のボケを表す画像との差分値を計算する。さらに、画素または特定領域ごとに差分値の最小値を求め、画素または特定領域ごとにその最小値を持つ1枚の画像を選択し、参照画像と選択された1枚の画像を用いて距離計測を行う。以下その具体例について説明する。   The subject distance measurement image selection unit 104 generates an image representing the blur of the reference image in each focus state by convolving the blur parameter of each focus state that has been measured in advance with the reference image. Then, a difference value between a plurality of images taken by the imaging unit and an image representing blurring of the reference image in each focus state is calculated. Further, the minimum value of the difference value is obtained for each pixel or specific area, one image having the minimum value is selected for each pixel or specific area, and distance measurement is performed using the reference image and the selected single image. I do. Specific examples will be described below.

まず、それぞれ参照画像と第1画像I1、参照画像と第3画像I3とで数7のように、参照画像R(x、y)に距離dごとのPSF:hを畳み込んだ画像と撮影画像I1、I3の差分値を順に計算する。その計算結果を数9のように、それぞれD1、D3に格納する。   First, the reference image and the first image I1, and the reference image and the third image I3, respectively, as shown in Equation 7, an image and a captured image obtained by convolving the reference image R (x, y) with PSF: h for each distance d The difference values of I1 and I3 are calculated in order. The calculation results are stored in D1 and D3, respectively, as shown in Equation 9.

Figure 2013044844
Figure 2013044844

図4は近距離に存在する被写体の座標x、y位置における、D1、D3それぞれの差分値の例を、横軸をdとして図示したものである。近距離に存在する被写体の場合は、参照画像Rに被写体距離と一致する距離のhを畳み込んだ画像と、撮影画像が一致する。このため、I1はI3よりも手前側で合焦しており、D1は図4(a)のように手前側で最小値を取り、かつ差分値の勾配変化は大きい。一方でI3はI1よりも奥側で合焦しており、近距離に存在する被写体は撮影された段階でぼけてしまっているため、D3は図4(b)のように特定の被写体距離で最小値を取るようなことがなく、差分値の勾配変化は小さくなる。この性質を計測する事で、各画素もしくは領域において被写体計測に好適な画像の選択が可能となる。尚、2枚の画像からの選択について述べたが、複数枚の画像から選択する場合にも同様に、上記の性質を計測し、最も適する画像を選べば良い。また、複数枚の画像の中で最も適する画像が上記の性質を示さない場合には数8のような拡張を行い、被写体距離を計測しても良い。   FIG. 4 illustrates an example of the difference values of D1 and D3 at the coordinates x and y positions of a subject existing at a short distance, with the horizontal axis being d. In the case of a subject existing at a short distance, an image obtained by convolving the reference image R with a distance h that matches the subject distance matches the captured image. For this reason, I1 is focused on the near side of I3, D1 takes the minimum value on the near side as shown in FIG. 4A, and the gradient change of the difference value is large. On the other hand, since I3 is in focus behind I1, and the subject existing at a short distance is blurred at the stage of shooting, D3 is a specific subject distance as shown in FIG. 4B. There is no such thing as a minimum value, and the gradient change of the difference value becomes small. By measuring this property, it is possible to select an image suitable for subject measurement in each pixel or region. Although the selection from two images has been described, the above properties may be measured and the most suitable image selected in the same manner when selecting from a plurality of images. Further, when the most suitable image among the plurality of images does not exhibit the above-described properties, the subject distance may be measured by performing expansion as shown in Equation 8.

最後に、被写体距離計測部105では、ステップS106で生成された参照画像と、第1、第3画像を用いステップS107で生成されたIm(x,y)から、数7に従って距離マップD(x、y)を算出する(ステップS108)。具体的には、ステップS107で画素単位、あるいは領域単位でどちらの画像を用いるかを、例えば0なら第1画像、1なら第3画像を指し示すような画像選択情報をIm(x、y)へ記録しておき、画素単位、あるいは領域単位でどちらの画像を用いるかを数10のように変えながら距離マップD(x、y)を算出する。これにより、より好適に被写体距離の計測を行う事が可能となる。   Finally, the subject distance measuring unit 105 uses the reference image generated in step S106 and Im (x, y) generated in step S107 using the first and third images, according to the equation 7, the distance map D (x , Y) is calculated (step S108). Specifically, in step S107, which image is to be used in units of pixels or in units of regions, for example, 0 is the first image, and if it is, the image selection information indicating the third image is Im (x, y). The distance map D (x, y) is calculated by changing which image is used for each pixel or each region as shown in Equation 10. As a result, the subject distance can be measured more suitably.

Figure 2013044844
Figure 2013044844

以上に示すように、本実施の形態では被写界深度を拡張した参照画像を用いることで、少数の画像から距離計測を高精度に行うことができる。さらに、詳細な被写体距離を計測する前に、画像の画素ごとに被写体計測に適切な画像を選択し、その被写体計測に適切な画像と合焦範囲の広い画像の2枚を用いて被写体距離を計測可能となるため、フォーカス状態が異なる画像間であっても、被写体距離を高精度に計測する事が可能になる。   As described above, in this embodiment, distance measurement can be performed with high accuracy from a small number of images by using a reference image with an extended depth of field. Furthermore, before measuring the detailed subject distance, an image suitable for subject measurement is selected for each pixel of the image, and the subject distance is determined using two images, an image suitable for subject measurement and an image with a wide focusing range. Since measurement is possible, the subject distance can be measured with high accuracy even between images in different focus states.

なお、露光中のフォーカスの変化は標準的なオートフォーカス機構を流用することで実現可能なため、特殊な機構を必要とすることもない。   Note that a change in focus during exposure can be realized by diverting a standard autofocus mechanism, so that no special mechanism is required.

なお、本実施の形態における撮像部は、光路長がそれぞれ異なるように配置されたn個の撮像素子と、光線をn個の撮像素子のそれぞれに分割するビームスプリッタを備えてもよい。また、本実施の形態における合焦範囲制御部は、露光中にフォーカス位置を略等速で変化させることで被写界深度を拡張してもよい。   Note that the imaging unit in the present embodiment may include n imaging elements arranged so as to have different optical path lengths and a beam splitter that divides a light beam into each of the n imaging elements. Further, the focus range control unit in the present embodiment may extend the depth of field by changing the focus position at a substantially constant speed during exposure.

なお、本実施の形態における撮像部は、n個の撮像素子と、光線の光軸方向を変化させる光軸変化手段と、光軸の向きを撮像素子のいずれか1つの方へ向けるための駆動手段を備えても良い。また、本実施の形態における合焦範囲制御部は、露光中にフォーカス位置を略等速で変化させるとともに、駆動手段を所定のパターンで動作させ、光軸方向を変化させてもよい。   Note that the imaging unit in the present embodiment includes n imaging elements, optical axis changing means for changing the optical axis direction of the light beam, and driving for directing the direction of the optical axis toward one of the imaging elements. Means may be provided. In addition, the focus range control unit in the present embodiment may change the focus position at a substantially constant speed during exposure, and operate the driving unit with a predetermined pattern to change the optical axis direction.

(実施の形態2)
以下本発明における実施の形態2について、実施の形態1と同様の内容は省略し説明する。
(Embodiment 2)
Hereinafter, the second embodiment of the present invention will be described by omitting the same contents as those of the first embodiment.

本実施の形態における画像処理装置及び画像処理方法について、図5を参照しながら説明する。以下、実施の形態1と同じ動作については説明を省略し、異なる動作についてのみ説明を行う。   The image processing apparatus and the image processing method in the present embodiment will be described with reference to FIG. Hereinafter, description of the same operation as that of the first embodiment will be omitted, and only different operation will be described.

本実施の形態における画像処理装置200は、撮像部201、合焦範囲制御部202、参照画像生成部203、被写体距離計測画像選択部204、被写体距離計測部205、動き量推定部206とを有する。なお、本実施の形態では実施の形態1の構成に、新たな構成として動き量推定部206が追加される。   The image processing apparatus 200 according to the present embodiment includes an imaging unit 201, a focusing range control unit 202, a reference image generation unit 203, a subject distance measurement image selection unit 204, a subject distance measurement unit 205, and a motion amount estimation unit 206. . In the present embodiment, a motion amount estimation unit 206 is added as a new configuration to the configuration of the first embodiment.

動き量推定部206では、撮像部201で撮影された第1画像と第3画像、参照画像生成部203で第2画像から生成された参照画像の3枚の画像間に生じる動き量の推定を行う。   The motion amount estimation unit 206 estimates the amount of motion that occurs between the three images of the first image and the third image captured by the imaging unit 201 and the reference image generated from the second image by the reference image generation unit 203. Do.

以下、実施形態2の構成を示す図5おける各ブロック間のデータフローについて、実施の形態1の構成との差分について説明する。   The difference between the data flow between the blocks in FIG. 5 showing the configuration of the second embodiment and the configuration of the first embodiment will be described below.

撮像部201は、第1画像及び第3画像を、動き推定部206及び被写体距離計測画像選択部204に出力する。   The imaging unit 201 outputs the first image and the third image to the motion estimation unit 206 and the subject distance measurement image selection unit 204.

参照画像生成部203は、撮像部201によって出力された第2画像から、参照画像を生成し、動き推定部206及び被写体距離計測画像選択部204に出力する。   The reference image generation unit 203 generates a reference image from the second image output by the imaging unit 201 and outputs the reference image to the motion estimation unit 206 and the subject distance measurement image selection unit 204.

動き量推定部206は、動き量の推定を行い動き量評価値情報として被写体距離計測画像選択部204へ出力する。   The motion amount estimation unit 206 estimates the motion amount and outputs it to the subject distance measurement image selection unit 204 as motion amount evaluation value information.

被写体距離計測画像選択部204は、撮像部201から出力された第1第3画像及び、参照画像生成部203から出力された参照画像及び、動き量推定部206から出力された動き量評価値情報とから、画像選択情報を生成する。そして、画像選択情報、動き量評価値情報、参照画像、第1、第3画像とを、被写体距離計測部205へ出力する。   The subject distance measurement image selection unit 204 includes the first third image output from the imaging unit 201, the reference image output from the reference image generation unit 203, and the motion amount evaluation value information output from the motion amount estimation unit 206. Then, image selection information is generated. Then, the image selection information, the motion amount evaluation value information, the reference image, and the first and third images are output to the subject distance measurement unit 205.

ここで、動き量推定部206の作用を説明する。画像処理装置200のように、フォーカス調整機構を制御して順に複数画像を撮影する手法では、画像の撮影タイミングが異なるため、複数画像を撮影している間に被写体が動く場合や、複数画像を撮影している間にカメラが動く場合は、画像間で被写体の位置にずれが生じる。DFDを用いた被写体距離の計測では、複数のフォーカス状態で撮影された複数の画像間で、同一画素に対するぼけ量の相関値を比較する必要があるが、被写体の位置ずれが生じると、この比較が正確に行えず、計測される被写体距離に誤りが生じる。このように、被写体距離の計測精度は被写体の位置ずれによって低下するため、各画像間で生じた被写体の位置ずれを補正する必要がある。この被写体の位置ずれを推定するのが、動き量推定部206である。   Here, the operation of the motion amount estimation unit 206 will be described. As in the image processing apparatus 200, in the method of taking a plurality of images in order by controlling the focus adjustment mechanism, the shooting timing of the images is different. If the camera moves during shooting, the position of the subject is shifted between images. In the measurement of the subject distance using the DFD, it is necessary to compare the correlation value of the blur amount with respect to the same pixel between a plurality of images taken in a plurality of focus states. Cannot be accurately performed, and an error occurs in the measured subject distance. As described above, since the measurement accuracy of the subject distance is lowered due to the displacement of the subject, it is necessary to correct the displacement of the subject that has occurred between the images. The motion amount estimation unit 206 estimates the subject position shift.

本発明の実施の形態2に係る画像処理装置によって、被写界深度を拡張した参照画像と異なるフォーカス状態で撮影された2枚の画像、合計3枚の画像から被写体距離計測を行う処理の流れについて図6に基づいて説明する。なお、被写界深度を拡張する手法として、露光時間中にフォーカスを変化させる方法を用いるものとして説明を行う。以下、図6のステップのうち、図2と同じステップについては同じ符号を用いて説明を省略し、異なるステップを含むステップS109、ステップS107について説明を行う。   Flow of processing for measuring subject distance from a total of three images, two images photographed in a different focus state from a reference image with an extended depth of field by the image processing apparatus according to the second embodiment of the present invention. Will be described with reference to FIG. Note that, as a method for extending the depth of field, a method of changing the focus during the exposure time will be described. Hereinafter, among the steps of FIG. 6, the same steps as those of FIG. 2 are denoted by the same reference numerals, and the description thereof will be omitted.

ステップS109では被写体の位置ずれを補正するために、動き量推定部206にて動き推定を行う。動き量の推定には、ブロックマッチング法を用いることができる。ここで、ブロックマッチング法の処理について図7を用いて説明する。   In step S109, the motion amount estimation unit 206 performs motion estimation in order to correct the positional deviation of the subject. A block matching method can be used to estimate the amount of motion. Here, processing of the block matching method will be described with reference to FIG.

ブロックマッチング法は、画像間の動き量を特定サイズのブロック領域毎に推定する手法であり、一方の画像(以下、探索元画像と呼ぶ)内に設定したブロック領域の画像と最も相関が高くなる領域を他方の画像(以下、探索先画像と呼ぶ)内から特定することで動き量を推定する。図7に示すように、まず、探索元画像内において複数の画素で構成される注目ブロック領域を設定する。このブロック領域のサイズとしては、8×8画素や16×16画素など任意に設定できる。次に、探索先画像内に探索エリアを設定する。この探索エリアは、探索元画像内の注目ブロック領域と最も相関が高くなる領域を探索する範囲を示すものであり、探索元画像内における注目ブロック領域の位置と近い位置に設定することが好ましい。次に、探索元画像内の注目ブロック領域と同じサイズのブロック領域を探索先画像の探索エリア内から切り出し、数11に基づいて画像の相関を表す評価値rx,yを算出する。   The block matching method is a method for estimating the amount of motion between images for each block region of a specific size, and has the highest correlation with the image of the block region set in one image (hereinafter referred to as a search source image). The amount of motion is estimated by specifying a region from the other image (hereinafter referred to as a search destination image). As shown in FIG. 7, first, an attention block area composed of a plurality of pixels is set in the search source image. The size of the block area can be arbitrarily set such as 8 × 8 pixels or 16 × 16 pixels. Next, a search area is set in the search destination image. This search area indicates a range in which an area having the highest correlation with the target block area in the search source image is searched, and is preferably set at a position close to the position of the target block area in the search source image. Next, a block area having the same size as the target block area in the search source image is cut out from the search area of the search destination image, and evaluation values rx, y representing the correlation of the images are calculated based on Equation 11.

Figure 2013044844
Figure 2013044844

ここで、x,yは探索先画像内からブロック領域を切り出した座標位置、(x,y)はブロック領域内の相対的な座標位置、f(x,y)は探索元画像内に設定した注目ブロック領域の画素値、gx,y(x,y)は探索先画像内から切り出したブロック領域の画素値をそれぞれ表す。探索先画像の探索エリア内からブロック領域を切り出す座標位置x,yをずらしながら、数11に基づく評価値rx,yを算出する。この評価値rx,yは、高ければ高いほど、座標位置x,yは正確な位置ずれ量から外れている事を意味する。ブロック領域内のx,yの中から評価値rx,yが最も小さくなる座標位置を求める。この座標位置と、探索元画像内における注目ブロック領域の座標位置との相対的な位置ずれが画像間の動き量を表す。この処理を探索元画像内の全てのブロック領域に対して行うことにより、画像全体で動き量を推定できる。第1画像と第2画像の参照画像間で推定された動き量をSx1(x,y)、Sy1(x,y)に格納し、数11に基づく評価値をr1x,yに格納する。第3画像と第2画像の参照画像間で推定された動き量をSx3(x,y)、Sy3(x,y)に格納し、数11に基づく評価値r3x,yに格納する。尚、動き量推定手法としてブロックマッチング法を用いた説明を行ったが、ブロックマッチング法に限定する必要はなく、オプティカルフロー推定などの他の手法を用いても良い。   Here, x and y are coordinate positions obtained by cutting out the block area from the search destination image, (x, y) is a relative coordinate position in the block area, and f (x, y) is set in the search source image. The pixel value of the target block area, gx, y (x, y) represents the pixel value of the block area cut out from the search destination image. Evaluation values rx and y based on Equation 11 are calculated while shifting the coordinate positions x and y for cutting out the block area from the search area of the search destination image. It means that the higher the evaluation value rx, y, the more the coordinate position x, y deviates from the accurate displacement amount. A coordinate position where the evaluation values rx, y are the smallest is obtained from x, y in the block area. The relative displacement between this coordinate position and the coordinate position of the block area of interest in the search source image represents the amount of motion between images. By performing this process on all the block areas in the search source image, the amount of motion can be estimated for the entire image. The amount of motion estimated between the reference images of the first image and the second image is stored in Sx1 (x, y) and Sy1 (x, y), and the evaluation value based on Equation 11 is stored in r1x and y. The motion amount estimated between the reference images of the third image and the second image is stored in Sx3 (x, y) and Sy3 (x, y), and stored in the evaluation value r3x, y based on Equation 11. Although the description has been made using the block matching method as the motion amount estimation method, the method is not limited to the block matching method, and other methods such as optical flow estimation may be used.

ステップS109では、推定された動き量Sx1(x,y)、Sy1(x,y)、Sx3(x,y)、Sy3(x,y)を用いて各画像間で生じた被写体の位置ずれの補正を行った後に、被写体距離計測を行う。数10はSx1(x,y)、Sy1(x,y)、Sx3(x,y)、Sy3(x,y)を用いて数12のように変更され、この数12を用いて被写体距離計測を行う。   In step S109, the position shift of the subject generated between the images using the estimated motion amounts Sx1 (x, y), Sy1 (x, y), Sx3 (x, y), and Sy3 (x, y) is detected. After correcting, subject distance measurement is performed. Equation 10 is changed to Equation 12 using Sx1 (x, y), Sy1 (x, y), Sx3 (x, y), and Sy3 (x, y), and subject distance measurement is performed using Equation 12. I do.

Figure 2013044844
Figure 2013044844

なお、ステップS107において求められるIm(x,y)は前述のように、数9を用いて計算してもよいし、ステップS109で算出される評価値r1x,y、r3x,yを用いて計算しても良い。   Note that Im (x, y) obtained in step S107 may be calculated using Equation 9 as described above, or calculated using the evaluation values r1x, y, r3x, y calculated in step S109. You may do it.

動き量推定部で算出される評価値r1x,y、r3x,yを用いて計算する場合は、第1画像と第3画像のぼけ方の違いを利用して、画像選択情報Im(x,y)を決定する。既に説明してある通り、第1画像の合焦位置は、第3画像の合焦位置よりも手前に設定しているため、第1画像では手前の距離に位置する被写体は、第3画像と比べ、くっきりと写る。また、手前の距離に位置する被写体は、第2画像から生成される参照画像上でも第1画像と同程度にくっきりと写る。その一方で、第3画像では手前の距離に位置する被写体はぼやけて写る。そのため、手前の距離に位置する被写体上の画素で、ステップS109のr1x,yとr3x,yを計算すると第2画像から生成される参照画像と、第3画像ではぼけ方が異なる分、評価値r3x,yはr1x,yよりも高い値となり、r1x,yとr3x,yの値の差を計測する事により、Im(x,y)は決定できる。同様に、遠方の距離に位置する被写体の画素では、r1x,yはr3x,yよりも高い値となるため、r1x,yとr3x,yの値の差を計測する事により、Im(x,y)は決定できる。   In the case of calculating using the evaluation values r1x, y, r3x, y calculated by the motion amount estimation unit, the image selection information Im (x, y) is used by utilizing the difference in blur between the first image and the third image. ). As already described, since the in-focus position of the first image is set in front of the in-focus position of the third image, the subject positioned at the near distance in the first image is the third image. Compared to this, it is clearly visible. In addition, the subject located at a near distance appears as clearly as the first image on the reference image generated from the second image. On the other hand, in the third image, the subject located at a near distance appears blurred. Therefore, when r1x, y and r3x, y in step S109 are calculated for the pixel on the subject located at the near distance, the reference image generated from the second image and the third image have different blurring evaluation values. r3x, y has a higher value than r1x, y, and Im (x, y) can be determined by measuring the difference between r1x, y and r3x, y. Similarly, since r1x, y has a higher value than r3x, y in a subject pixel located at a distant distance, Im (x, y) is obtained by measuring the difference between r1x, y and r3x, y. y) can be determined.

例えば、画像上のある位置x、yにおける評価値が、ある閾値shを設定した場合に、r3x,y―r1x,y>shの関係にある場合には、x、yに存在する被写体は手前側にあると考えられるため、Im(x,y)=0として第1画像を指し示す値を記録する。逆にr1x,y―r3x,y>shの関係にある場合には、x、yに存在する被写体は奥側にあると考えられるため、Im(x,y)=1として第3画像を指し示す値を記録する。r1x,yとr3x,yの差がsh未満の場合には、数8のような拡張を行い、被写体距離を計測しても良い。   For example, if the evaluation value at a certain position x, y on the image has a relationship r3x, y−r1x, y> sh when a certain threshold value sh is set, the subject existing at x, y is in front. Since Im (x, y) = 0, a value indicating the first image is recorded. On the other hand, if r1x, y−r3x, y> sh, the subject existing in x and y is considered to be on the back side, and therefore Im (x, y) = 1 is pointed to the third image. Record the value. When the difference between r1x, y and r3x, y is less than sh, the object distance may be measured by performing expansion as shown in Equation 8.

また、数9と、ステップS109で算出される評価値r1x,y、r3x,yの両方を用いて計算しても良い。両方用いる場合は、画像上のある位置x、yの被写体が手前側、もしくは、奥側に存在する事を数9と、ステップS109で算出される評価値r1x,y、r3x,yが共に指し示している場合にIm(x,y)=0もしくはIm(x,y)=1として記録すると良い。   Further, the calculation may be performed using both Equation 9 and the evaluation values r1x, y, r3x, y calculated in step S109. When both are used, the fact that the subject at a certain position x, y on the image is present on the front side or the back side is indicated by Equation 9 and the evaluation values r1x, y, r3x, y calculated in step S109 are both indicated. In this case, it may be recorded as Im (x, y) = 0 or Im (x, y) = 1.

このように、動き量推定部206を用いて各画像間で生じた被写体の位置ずれを推定する事で、複数のフォーカス状態で撮影された画像で被写体の位置ずれを抑え、被写体距離を計測する事が可能となる。   In this way, by using the motion amount estimation unit 206 to estimate the subject's positional deviation that occurred between the images, the subject's positional deviation is suppressed in images taken in a plurality of focus states, and the subject distance is measured. Things will be possible.

本発明に係る画像処理装置および画像処理方法は、被写体の動きや撮影方向の変化が生じる場合でも、複数のフォーカス状態で撮影された複数の撮影画像から被写体距離を高精度に計測することを可能にする。これらの構成は、例えば民生用もしくは業務用の撮像装置(デジタルスチルカメラ、ビデオカメラ)などの分野において有用である。   The image processing apparatus and the image processing method according to the present invention can measure the subject distance with high accuracy from a plurality of photographed images photographed in a plurality of focus states even when the movement of the subject or a change in the photographing direction occurs. To. These configurations are useful, for example, in fields such as consumer or commercial imaging devices (digital still cameras, video cameras).

101,201 撮像部
102,202 合焦範囲制御部
103,203 参照画像生成部
104,204 被写体距離計測画像選択部
105,205 被写体距離計測部
206 動き量推定部
101, 201 Imaging unit 102, 202 Focusing range control unit 103, 203 Reference image generation unit 104, 204 Subject distance measurement image selection unit 105, 205 Subject distance measurement unit 206 Motion amount estimation unit

Claims (9)

複数のフォーカス状態で撮影された複数の撮影画像から被写体距離を計測する画像処理装置であって、
複数のフォーカス状態で画像をn枚(ただし、n≧2)撮影する撮像部と、
前記撮像部の合焦位置および被写界深度を変化させる合焦範囲制御部と、
前記撮像部によって撮影される複数のフォーカス状態の全てにおける合焦範囲を有する第一の参照画像を生成する参照画像生成部と、
前期n枚の画像のうち、被写体までの距離を計測するのに用いる距離計測用画像を選択する被写体距離計測画像選択部と、
前記距離計測用画像および前記第一の参照画像のぼけの度合いから被写体までの距離を計測する距離計測部とを備える、
ことを特徴とする画像処理装置。
An image processing apparatus for measuring a subject distance from a plurality of captured images captured in a plurality of focus states,
An imaging unit that captures n images (where n ≧ 2) in a plurality of focus states;
A focusing range control unit for changing a focusing position and a depth of field of the imaging unit;
A reference image generation unit that generates a first reference image having a focusing range in all of a plurality of focus states photographed by the imaging unit;
A subject distance measurement image selection unit that selects a distance measurement image used to measure the distance to the subject among the n images in the previous period;
A distance measuring unit that measures the distance to the subject from the degree of blur of the distance measurement image and the first reference image;
An image processing apparatus.
前記画像処理装置は、
さらに前記距離計測用画像と前記第一の参照画像間の動き量を推定する動き量推定部を備える、
ことを特徴とする請求項1に記載の画像処理装置。
The image processing apparatus includes:
Furthermore, a motion amount estimation unit that estimates a motion amount between the distance measurement image and the first reference image is provided.
The image processing apparatus according to claim 1.
前記距離計測用画像と前記第一の参照画像間で生じた前記動き量を打ち消すように補正し、前記距離計測用画像と前記第一の参照画像での画素位置を合わせた状態で、前記距離計測用画像および前記第一の参照画像のぼけの度合いから被写体までの距離を計測する、
ことを特徴とする請求項2に記載の画像処理装置。
The distance is corrected in such a manner that the amount of motion generated between the distance measurement image and the first reference image is canceled out, and the pixel positions in the distance measurement image and the first reference image are matched. Measure the distance to the subject from the degree of blur of the measurement image and the first reference image,
The image processing apparatus according to claim 2.
前記被写体距離計測画像選択部は、
予め計測済の各フォーカス状態のボケパラメータを前記第一の参照画像へ畳み込む事で各フォーカス状態における前記第一の参照画像のボケを表す第二の参照画像を生成し、
前記撮像部において撮影されたn枚の画像と前記第二の参照画像との差分値を計算し、
画素または特定領域ごとに前記差分値の最小値を求め、
画素または特定領域ごとに前記最小値を持つ1枚の画像を選択し、
前記第一の参照画像と前記選択された1枚の画像を用いて距離計測を行う、
ことを特徴とする請求項1から請求項3のいずれかに記載の画像処理装置。
The subject distance measurement image selection unit
Generating a second reference image representing the blur of the first reference image in each focus state by convolving the blur parameter of each focus state measured in advance with the first reference image;
Calculating a difference value between the n images captured by the imaging unit and the second reference image;
Find the minimum difference value for each pixel or specific area,
Select one image with the minimum value for each pixel or specific area,
Distance measurement is performed using the first reference image and the selected one image.
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
前記被写体距離計測画像選択部は、
前記動き量を求める際の評価値を基準に、n枚のぼけ画像群から被写体計測用に用いる画像を選択する、
ことを特徴とする請求項2または請求項3に記載の画像処理装置。
The subject distance measurement image selection unit
Selecting an image to be used for subject measurement from a group of n blurred images based on an evaluation value when obtaining the amount of movement;
The image processing apparatus according to claim 2, wherein the image processing apparatus is an image processing apparatus.
前記被写体距離計測画像選択部は、
前記撮像部で撮影されたn枚の画像のうち、画像選択時に特定領域または画素単位で被写体距離を計測するための画像を選択する、
ことを特徴とする請求項4または請求項5に記載の画像処理装置。
The subject distance measurement image selection unit
Selecting an image for measuring a subject distance in a specific region or pixel unit at the time of image selection from n images captured by the imaging unit;
The image processing apparatus according to claim 4, wherein the image processing apparatus is an image processing apparatus.
前記撮像部は、光路長がそれぞれ異なるように配置されたn個の撮像素子と、光線を前記n個の撮像素子のそれぞれに分割するビームスプリッタを備え、
前記合焦範囲制御部は、露光中にフォーカス位置を略等速で変化させることで被写界深度を拡張する、
ことを特徴とする請求項1から請求項6のいずれかに記載の画像処理装置。
The imaging unit includes n imaging elements arranged to have different optical path lengths, and a beam splitter that divides a light beam into each of the n imaging elements,
The focus range control unit extends the depth of field by changing the focus position at a substantially constant speed during exposure.
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
前記撮像部は、n個の撮像素子と、光線の光軸方向を変化させる光軸変化手段と、前記光軸の向きを前記撮像素子のいずれか1つの方へ向けるための駆動手段を備え、
前記合焦範囲制御部は、露光中にフォーカス位置を略等速で変化させるとともに、前記駆動手段を所定のパターンで動作させ、光軸方向を変化させる、
ことを特徴とする請求項1から請求項6のいずれかに記載の画像処理装置。
The imaging unit includes n imaging elements, an optical axis changing unit that changes an optical axis direction of a light beam, and a driving unit that directs the direction of the optical axis toward one of the imaging elements.
The focusing range control unit changes a focus position at a substantially constant speed during exposure, operates the driving unit with a predetermined pattern, and changes an optical axis direction.
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
複数のフォーカス状態で撮影された複数の撮影画像から被写体距離を計測するステップと、
複数のフォーカス状態で画像をn枚(ただし、n≧2)撮影するステップと、
合焦位置および被写界深度を変化させるステップと、
複数のフォーカス状態の全てにおける合焦範囲を有する第一の参照画像を生成するステップと、
前期n枚の画像のうち、被写体までの距離を計測するのに用いる距離計測用画像を選択するステップと、
前記距離計測用画像および前記第一の参照画像のぼけの度合いから被写体までの距離を計測するステップとを有する、
画像処理方法。
Measuring subject distance from a plurality of captured images captured in a plurality of focus states;
Photographing n images (where n ≧ 2) in a plurality of focus states;
Changing the focus position and depth of field;
Generating a first reference image having a focus range in all of the plurality of focus states;
Selecting a distance measurement image to be used for measuring the distance to the subject from the n images in the previous period;
Measuring the distance to the subject from the degree of blur of the distance measurement image and the first reference image,
Image processing method.
JP2011181240A 2011-08-23 2011-08-23 Image processing device and image processing method Withdrawn JP2013044844A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011181240A JP2013044844A (en) 2011-08-23 2011-08-23 Image processing device and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011181240A JP2013044844A (en) 2011-08-23 2011-08-23 Image processing device and image processing method

Publications (1)

Publication Number Publication Date
JP2013044844A true JP2013044844A (en) 2013-03-04

Family

ID=48008818

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011181240A Withdrawn JP2013044844A (en) 2011-08-23 2011-08-23 Image processing device and image processing method

Country Status (1)

Country Link
JP (1) JP2013044844A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015121774A (en) * 2013-11-19 2015-07-02 パナソニックIpマネジメント株式会社 Imaging device
JP2015194686A (en) * 2014-03-19 2015-11-05 パナソニックIpマネジメント株式会社 Imaging apparatus
JP2015200907A (en) * 2013-11-19 2015-11-12 パナソニックIpマネジメント株式会社 imaging device
JP2016111609A (en) * 2014-12-09 2016-06-20 株式会社東芝 Image processing system, imaging apparatus, image processing method and program
JP2016122199A (en) * 2014-03-28 2016-07-07 パナソニックIpマネジメント株式会社 Imaging device
US9531938B2 (en) 2014-03-28 2016-12-27 Panasonic Intellectual Property Management Co., Ltd. Image-capturing apparatus
US9576370B2 (en) 2014-02-17 2017-02-21 Canon Kabushiki Kaisha Distance measurement apparatus, imaging apparatus, distance measurement method and program
JP2020005108A (en) * 2018-06-27 2020-01-09 エスゼット ディージェイアイ テクノロジー カンパニー リミテッドSz Dji Technology Co.,Ltd Control apparatus, imaging apparatus, mobile body, control method, and program
JP2021018376A (en) * 2019-07-23 2021-02-15 エスゼット ディージェイアイ テクノロジー カンパニー リミテッドSz Dji Technology Co.,Ltd Apparatus, imaging apparatus, moving body, method, and program
WO2021065065A1 (en) * 2019-10-03 2021-04-08 株式会社ザクティ Imaging device

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9571719B2 (en) 2013-11-19 2017-02-14 Panasonic Intellectual Property Management Co., Ltd. Image-capturing apparatus
US9832362B2 (en) 2013-11-19 2017-11-28 Panasonic Intellectual Property Management Co., Ltd. Image-capturing apparatus
JP2015200907A (en) * 2013-11-19 2015-11-12 パナソニックIpマネジメント株式会社 imaging device
JP2015200908A (en) * 2013-11-19 2015-11-12 パナソニックIpマネジメント株式会社 imaging device
JP2015207019A (en) * 2013-11-19 2015-11-19 パナソニックIpマネジメント株式会社 Imaging apparatus
JP2015121774A (en) * 2013-11-19 2015-07-02 パナソニックIpマネジメント株式会社 Imaging device
US9576370B2 (en) 2014-02-17 2017-02-21 Canon Kabushiki Kaisha Distance measurement apparatus, imaging apparatus, distance measurement method and program
JP2015194686A (en) * 2014-03-19 2015-11-05 パナソニックIpマネジメント株式会社 Imaging apparatus
US10250805B2 (en) 2014-03-19 2019-04-02 Panasonic Intellectual Property Management Co., Ltd. Imaging device for performing DFD processing at appropriate timing
US9531938B2 (en) 2014-03-28 2016-12-27 Panasonic Intellectual Property Management Co., Ltd. Image-capturing apparatus
JP2016122199A (en) * 2014-03-28 2016-07-07 パナソニックIpマネジメント株式会社 Imaging device
JP2016111609A (en) * 2014-12-09 2016-06-20 株式会社東芝 Image processing system, imaging apparatus, image processing method and program
JP2020005108A (en) * 2018-06-27 2020-01-09 エスゼット ディージェイアイ テクノロジー カンパニー リミテッドSz Dji Technology Co.,Ltd Control apparatus, imaging apparatus, mobile body, control method, and program
JP2021018376A (en) * 2019-07-23 2021-02-15 エスゼット ディージェイアイ テクノロジー カンパニー リミテッドSz Dji Technology Co.,Ltd Apparatus, imaging apparatus, moving body, method, and program
WO2021065065A1 (en) * 2019-10-03 2021-04-08 株式会社ザクティ Imaging device
JP2021060450A (en) * 2019-10-03 2021-04-15 株式会社ザクティ Imaging apparatus

Similar Documents

Publication Publication Date Title
JP5869883B2 (en) Image processing device
JP2013044844A (en) Image processing device and image processing method
US9208396B2 (en) Image processing method and device, and program
CN102713512B (en) Image pickup device and distance measuring method
JP6245885B2 (en) Imaging apparatus and control method thereof
US9530213B2 (en) Single-sensor system for extracting depth information from image blur
JP5173665B2 (en) Image capturing apparatus, distance calculation method thereof, and focused image acquisition method
EP3318054B1 (en) Systems and methods for autofocus trigger
US20070189750A1 (en) Method of and apparatus for simultaneously capturing and generating multiple blurred images
JP2019510234A (en) Depth information acquisition method and apparatus, and image acquisition device
JPWO2011158498A1 (en) Imaging apparatus and imaging method
US20200326609A1 (en) Image capturing apparatus, image processing apparatus, control method, and storage medium
KR101715553B1 (en) Focus position detection device, focus position detection method and a computer program for focus position detection
JP2014022806A (en) Image pickup device and image pickup device control method
JP2019168479A (en) Controller, imaging device, method for control, program, and, and storage medium
JP6486453B2 (en) Image processing apparatus, image processing method, and program
JP2020148628A (en) Three-dimensional surveying device, imaging apparatus, method for control, and program
WO2016194576A1 (en) Information processing device and method
JP2018074362A (en) Image processing apparatus, image processing method, and program
JP2004037732A (en) Digital camera
JP5355252B2 (en) Imaging apparatus and control method thereof
JP6900228B2 (en) Imaging device, imaging system, imaging device control method, and program
JP2017134322A (en) Lens device
JP2021015162A (en) Image processing device and control method therefor
JP2020126029A (en) Distance measurement camera

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20141104