JP2016018340A - Image processing apparatus - Google Patents

Image processing apparatus Download PDF

Info

Publication number
JP2016018340A
JP2016018340A JP2014139965A JP2014139965A JP2016018340A JP 2016018340 A JP2016018340 A JP 2016018340A JP 2014139965 A JP2014139965 A JP 2014139965A JP 2014139965 A JP2014139965 A JP 2014139965A JP 2016018340 A JP2016018340 A JP 2016018340A
Authority
JP
Japan
Prior art keywords
blur amount
image
distance
axis direction
edge
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2014139965A
Other languages
Japanese (ja)
Other versions
JP6327024B2 (en
Inventor
睦 永見
Mutsumi Nagami
睦 永見
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.)
Saxa Inc
Original Assignee
Saxa Inc
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 Saxa Inc filed Critical Saxa Inc
Priority to JP2014139965A priority Critical patent/JP6327024B2/en
Publication of JP2016018340A publication Critical patent/JP2016018340A/en
Application granted granted Critical
Publication of JP6327024B2 publication Critical patent/JP6327024B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Image Processing (AREA)
  • Closed-Circuit Television Systems (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide an image processing apparatus configured to recognize each of objects, while reducing image processing load even when the objects are imaged in an overlapping manner.SOLUTION: When an edge is extracted from an acquired image, blur amount estimation means 21 estimates the amount of blur, on the basis of a difference in pixel value between a pair of pixels located closest to both sides of the edge, and a difference in pixel value between at least one pair of pixels located at both sides of the pair of pixels. Distance image generation means 22 scans an image with the blur amount estimated by the blur amount estimation means 21, the blur amount being allocated in each of pixel positions, in a predetermined direction, to map the blur amount of one edge to pixels located between the edges existing in a scanning direction. The distance image generation means 22 calculates a distance from an imaging apparatus to a subject, on the basis of the blur amount mapped in the pixel positions and correlation information between the blur amount of the image from the imaging apparatus and the distance from the imaging apparatus to the subject, to generate a distance image.SELECTED DRAWING: Figure 1

Description

本発明は、画像処理装置に関し、より詳細には、撮像された画像中の物体を認識する画像処理装置に関する。   The present invention relates to an image processing apparatus, and more particularly to an image processing apparatus that recognizes an object in a captured image.

近年、道路における車両の交通量の計測、また所定の敷地内に侵入した物体の特定等を目的として、ビデオカメラ等の撮像装置を用いた監視システムが知られている(特許文献1参照)。
このような監視システムにより撮像された画像において、複数の物体が同時に撮像されている場合、物体同士が重なっていると、各々の物体をひとつの物体として認識してしまい、別々の物体として認識することができず、監視対象に対して正確な情報を取得することができない場合がある。
In recent years, a monitoring system using an imaging device such as a video camera has been known for the purpose of measuring the traffic volume of a vehicle on a road and identifying an object that has entered a predetermined site (see Patent Document 1).
In an image captured by such a monitoring system, when a plurality of objects are captured at the same time, if the objects overlap each other, each object is recognized as one object and is recognized as a separate object. In some cases, accurate information cannot be acquired for the monitoring target.

但し、そのような場合であっても、撮像装置から物体までの距離を算出することができれば、撮像された物体を別々の物体として認識することができ、さらに撮像方向に対する、各々の物体の前後関係も認識することができる。
従来、撮像装置からの画像を処理して被写体までの距離を測定する方法としてステレオ法が広く知られている。これは測距対象となる被写体を複数の撮像装置で撮像し、撮像装置間の距離(基線長)と画像上での視差を用い、三角測距の原理で距離を測定するものである。
また、他の方法として、DFD(Depth from Defocus)法がある。これは画像のボケ量と被写体距離との相関情報から距離を測定するものであり、単眼カメラで実現できるため、システムの小型化に有利である。
However, even in such a case, if the distance from the imaging device to the object can be calculated, the captured object can be recognized as a separate object, and further, before and after each object in the imaging direction. Relationships can also be recognized.
Conventionally, a stereo method is widely known as a method for measuring a distance to a subject by processing an image from an imaging apparatus. In this method, a subject to be distance-measured is imaged by a plurality of imaging devices, and the distance is measured based on the principle of triangulation using the distance (baseline length) between the imaging devices and the parallax on the image.
Another method is a DFD (Depth from Defocus) method. This measures the distance from the correlation information between the blur amount of the image and the subject distance, and can be realized with a monocular camera, which is advantageous for downsizing of the system.

また、撮像装置から物体までの距離を算出する他の方法として、画像のボケ量から距離を算出する方法において、画像のボケ量を推定する手法として、画像の対数振幅スペクトル上に現れる暗い円環の半径から、ボケの特性を表現するPSF(Point Spread Function:点像分布関数)の推定を行う手法(非特許文献1)、画像の対数振幅スペクトル上の輝度こう配のベクトル分布を用いてボケの特性を表現し、PSFの推定を行う手法(非特許文献2)がある。   In addition, as another method for calculating the distance from the imaging device to the object, as a method for estimating the image blur amount in the method for calculating the distance from the image blur amount, a dark circle appearing on the logarithmic amplitude spectrum of the image is used. A method of estimating PSF (Point Spread Function) that expresses the characteristic of blur from the radius of the image (Non-Patent Document 1), and using the vector distribution of the luminance gradient on the logarithmic amplitude spectrum of the image, There is a technique (Non-patent Document 2) that expresses characteristics and estimates PSF.

しかしながら、これらの手法はボケ量を推定する上で画像の周波数解析を伴うため、物体同士が重なって撮像された画像から、各画素位置における撮像装置から物体までの距離を算出する上で(各々の物体を別々に認識する上で)、処理の負荷が重く、また処理に時間がかかるという問題がある。   However, since these methods involve frequency analysis of images in estimating the amount of blur, in calculating the distance from the imaging device to the object at each pixel position from images captured by overlapping objects (each In the case of recognizing objects separately, there is a problem that the processing load is heavy and the processing takes time.

特許公開2006−245697号公報Japanese Patent Publication No. 2006-245697

D.B.Gennery,“Determination of optical transfer function by inspection of frequency-domain plot,”Journal of the Optical Society of America,vol.63,pp.1571-1577,1973.D. B. Gennery, “Determination of optical transfer function by inspection of frequency-domain plot,” Journal of the Optical Society of America, vol. 63, pp. 1571-1577, 1973. 電子情報通信学会論文誌 D Vol. J90-D,No.10,pp.2848-2857「対数振幅スペクトル上の輝度こう配ベクトル分布を利用したノイズに頑健な焦点ずれPSF推定」,坂野盛彦、末竹規哲、内野英治IEICE Transactions D Vol. J90-D, No.10, pp.2848-2857 “Noise robust defocus PSF estimation using luminance gradient vector distribution on logarithmic amplitude spectrum”, Morihiko Sakano, Suetake Noriaki, Eiji Uchino

本発明は、前記従来の問題に鑑みてなされたものであって、その目的は、画像処理装置において、従来の周波数解析などの重い処理負担を伴うことなく、撮像された画像中で重なった物体を個別に認識することである。   The present invention has been made in view of the above-described conventional problems, and an object of the present invention is to provide an object that is overlapped in captured images without a heavy processing burden such as conventional frequency analysis in an image processing apparatus. Is to recognize them individually.

本発明は、物体を撮像した撮像装置からの画像を取得する画像取得手段と、前記画像取得手段により取得した画像のエッジを抽出するエッジ抽出手段と、前記エッジ抽出手段により抽出されたエッジを含む所定領域内における画素の輝度差に基づいて、前記エッジのボケ量を算出するボケ量算出手段と、前記ボケ量算出手段により算出されたボケ量を前記画像の前記エッジの各画素位置に割り当てるボケ量割り当て手段と、前記ボケ量割り当て手段によりボケ量が割り当てられた前記エッジの画素に対して、所定の方向に走査し、走査方向にあるエッジとエッジの間に位置する各画素に、ボケ量の小さい方のエッジのボケ量を割り当てるボケ量走査手段と、前記ボケ量走査手段により割り当てられたボケ量と、前記撮像装置からの画像のボケ量と前記撮像装置から被写体までの距離との相関情報とに基づいて、各画素位置における、前記撮像装置から前記物体までの距離を算出する距離算出手段と、前記距離算出手段により算出された各画素位置における、前記撮像装置から前記物体までの距離に基づき、距離画像を生成する距離画像生成手段と、を有することを特徴とする画像処理装置に関する。   The present invention includes an image acquisition unit that acquires an image from an imaging device that images an object, an edge extraction unit that extracts an edge of an image acquired by the image acquisition unit, and an edge extracted by the edge extraction unit Based on a luminance difference between pixels in a predetermined area, a blur amount calculating unit that calculates the blur amount of the edge, and a blur that is allocated to each pixel position of the edge of the image by the blur amount calculated by the blur amount calculating unit. A quantity allocation unit and the edge pixel to which the blur amount is allocated by the blur amount allocation unit are scanned in a predetermined direction, and a blur amount is applied to each pixel located between the edges in the scanning direction. A blur amount scanning unit that allocates a blur amount of the smaller edge, a blur amount allocated by the blur amount scanning unit, and a blur of an image from the imaging device And distance calculation means for calculating the distance from the imaging device to the object at each pixel position based on correlation information between the imaging device and the distance from the imaging device, and each pixel calculated by the distance calculation means And a distance image generation unit configured to generate a distance image based on a distance from the imaging device to the object at a position.

本発明によれば、撮像された画像において、物体同士が重なっている場合であっても、画像処理の負荷を低減した上で、各々の物体を別々に認識することができる。   According to the present invention, each object can be recognized separately after reducing the load of image processing even if the objects are overlapped in the captured image.

本発明の実施形態に係る画像処理装置を含む画像処理システムを示す図である。1 is a diagram illustrating an image processing system including an image processing apparatus according to an embodiment of the present invention. 図1におけるボケ量推定手段の機能構成を示すブロック図である。It is a block diagram which shows the function structure of the blur amount estimation means in FIG. 図1における輝度差算出手段による輝度差の算出、及びボケ量算出手段によるボケ量の算出について説明するための図である。It is a figure for demonstrating calculation of the luminance difference by the luminance difference calculation means in FIG. 1, and calculation of the blur amount by a blur amount calculation means. ガウシアンフィルタの分散の大きさを変更した場合における、輝度対画素位置特性を示す図である。It is a figure which shows the brightness | luminance versus pixel position characteristic when the magnitude | size of dispersion | distribution of a Gaussian filter is changed. 図2におけるボケ量推定手段の処理手順を示すフロー図である。It is a flowchart which shows the process sequence of the blur amount estimation means in FIG. 図1における距離画像生成手段の機能構成を示すブロック図である。It is a block diagram which shows the function structure of the distance image generation means in FIG. 図1におけるボケ量推定手段により推定されたボケ量に基づき、作成されたボケ量推定画像を示す図である。It is a figure which shows the blur amount estimation image produced based on the blur amount estimated by the blur amount estimation means in FIG. 図6におけるx軸方向ボケ量走査手段の処理手順を示す図である。It is a figure which shows the process sequence of the x-axis direction blurring amount scanning means in FIG. ボケ量/距離テーブルの作成手順について説明するための図である。It is a figure for demonstrating the preparation procedure of a blurring amount / distance table. y軸方向の任意の位置における、撮像装置のレンズから物体までの距離をx軸方向の距離画像として作成した図である。It is the figure which produced the distance from the lens of an imaging device to an object in the arbitrary positions of a y-axis direction as a distance image of a x-axis direction. 図6におけるy軸方向ボケ量走査手段の処理手順を示す図である。It is a figure which shows the process sequence of the y-axis direction blur amount scanning means in FIG. x軸方向の任意の位置における、撮像装置のレンズから物体までの距離をy軸方向の距離画像として作成した図である。It is the figure which created the distance from the lens of an imaging device to an object in the arbitrary positions of a x-axis direction as a distance image of a y-axis direction. 図6における距離平均値算出手段による、撮像装置のレンズからの距離の平均値の算出について説明するための図である。It is a figure for demonstrating calculation of the average value of the distance from the lens of an imaging device by the distance average value calculation means in FIG. 図6における距離画像作成手段により作成された距離画像を示す図である。It is a figure which shows the distance image produced by the distance image production means in FIG. 図6における距離画像生成手段の処理手順を示すフロー図である。It is a flowchart which shows the process sequence of the distance image generation means in FIG.

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

図1は、本発明の実施形態に係る画像処理装置を含む画像処理システムを示す図である。
この画像処理システムは、画像処理装置1と、それぞれが画像処理装置1に接続された撮像装置2、入力装置3、記録媒体4、及び出力装置5を備えている。
FIG. 1 is a diagram illustrating an image processing system including an image processing apparatus according to an embodiment of the present invention.
The image processing system includes an image processing device 1, an imaging device 2, an input device 3, a recording medium 4, and an output device 5 each connected to the image processing device 1.

画像処理装置1は、例えば、PC(Personal Computer)等であり、撮像装置2、又は記録媒体4から入力される画像データを処理する。画像処理装置1における画像処理の詳細は、図2から図15を用いて後述する。   The image processing apparatus 1 is, for example, a PC (Personal Computer) or the like, and processes image data input from the imaging apparatus 2 or the recording medium 4. Details of the image processing in the image processing apparatus 1 will be described later with reference to FIGS.

撮像装置2は、例えば電子カメラ等であり、被写体(オブジェクト)を撮像するように配置される。本実施形態では、撮像装置2で撮像し、画像処理装置1に入力する画像として、カラー画像を例に採って説明するが、モノクロ画像を、撮像装置2で撮像し、画像処理装置1に入力することもできる。   The imaging device 2 is an electronic camera or the like, for example, and is arranged so as to image a subject (object). In the present embodiment, a color image will be described as an example of an image captured by the imaging device 2 and input to the image processing device 1. However, a monochrome image is captured by the imaging device 2 and input to the image processing device 1. You can also

入力装置3は、例えば、キーボード、マウス等であり、ユーザが画像処理装置1に対して種々の指示を与えるための装置である。
記録媒体4は、例えば、CD(Compact Disk)、SDメモリカード(SD Memory Card)、USBメモリ(Universal Serial Bus Memory)等であり、画像及び当該画像を撮像した撮像装置に関するデータを記録するための媒体である。
出力装置5は、例えば、モニタ等の表示装置であり、撮像装置2、又は記録媒体4から入力される画像、また画像処理装置1により画像処理された画像等を、必要に応じて出力する。
The input device 3 is, for example, a keyboard, a mouse, or the like, and is a device for a user to give various instructions to the image processing device 1.
The recording medium 4 is, for example, a CD (Compact Disk), an SD memory card (SD Memory Card), a USB memory (Universal Serial Bus Memory), etc., for recording data relating to an image and an imaging device that has captured the image. It is a medium.
The output device 5 is, for example, a display device such as a monitor, and outputs an image input from the imaging device 2 or the recording medium 4, an image processed by the image processing device 1, or the like as necessary.

画像処理装置1は、制御部11と、それぞれが制御部11に接続された入力部12、撮像装置制御部13、ROM(Read Only Memory)14、RAM(Random Access Memory)15、ストレージ16、及び出力部17を備えている。
制御部11は、画像処理装置1のコントローラとして機能し、例えば、CPU(Central Processing Unit)等である。
また、詳細は後述するが、制御部11は、画像処理(例えば、後述のストレージ16に格納されるアプリケーションプログラム等)を実行するために、ボケ量推定手段21と、距離画像生成手段22を備えている。
The image processing apparatus 1 includes a control unit 11, an input unit 12 connected to the control unit 11, an imaging device control unit 13, a ROM (Read Only Memory) 14, a RAM (Random Access Memory) 15, a storage 16, and An output unit 17 is provided.
The control unit 11 functions as a controller of the image processing apparatus 1 and is, for example, a CPU (Central Processing Unit).
Although details will be described later, the control unit 11 includes a blur amount estimation unit 21 and a distance image generation unit 22 in order to execute image processing (for example, an application program stored in the storage 16 described later). ing.

入力部12は、撮像装置2及び記録媒体4から画像等を、また入力装置3から種々の指示(命令)を受けるためのインタフェースである。
撮像装置制御部13は、撮像装置2の焦点距離、絞り、シャッター速度等を制御する。
The input unit 12 is an interface for receiving images and the like from the imaging device 2 and the recording medium 4 and various instructions (commands) from the input device 3.
The imaging device control unit 13 controls the focal length, aperture, shutter speed, and the like of the imaging device 2.

ROM14は、制御部11が実行するプログラムや固定データを記憶するメモリであり、RAM15は、制御部11のワークエリアとなるメモリである。
ストレージ16は、例えば、ハードディスク等の大容量記憶装置であり、撮像装置2で撮像され、制御部11で画像処理が施された画像データ、制御部11で生成されたデータ、その他のアプリケーションプログラムを格納する。
出力部17は、出力装置5と通信を行うためのインタフェースであり、例えば、制御部11で画像処理が施された画像データ等を、出力装置5に表示させる。
The ROM 14 is a memory that stores programs executed by the control unit 11 and fixed data, and the RAM 15 is a memory that serves as a work area for the control unit 11.
The storage 16 is, for example, a large-capacity storage device such as a hard disk, and stores image data captured by the imaging device 2 and subjected to image processing by the control unit 11, data generated by the control unit 11, and other application programs. Store.
The output unit 17 is an interface for communicating with the output device 5, and causes the output device 5 to display image data subjected to image processing by the control unit 11, for example.

次に、制御部11における画像処理について、説明する。
制御部11は、画像を処理する上で、ボケ量推定手段21と、距離画像生成手段22を備える。
ボケ量推定手段21は、撮像装置2により撮像された画像、また記録媒体4に保存された画像のボケ量を推定する。
距離画像生成手段22は、ボケ量推定手段21により推定されたボケ量と、ボケ量を推定した画像を撮像した撮像装置2の焦点位置から被写体までの距離との対応関係を示すデータに基づき、撮像装置2から被写体までの距離を画像として生成する。
なお、以後の制御部11における画像処理の説明では、入力部12に入力される画像として、撮像装置2により撮像された画像を例に採って説明する。
Next, image processing in the control unit 11 will be described.
The control unit 11 includes a blur amount estimation unit 21 and a distance image generation unit 22 in processing an image.
The blur amount estimation unit 21 estimates a blur amount of an image captured by the imaging device 2 or an image stored in the recording medium 4.
The distance image generation unit 22 is based on data indicating the correspondence between the blur amount estimated by the blur amount estimation unit 21 and the distance from the focal position of the imaging apparatus 2 that captured the image with the estimated blur amount to the subject. The distance from the imaging device 2 to the subject is generated as an image.
In the following description of image processing in the control unit 11, an image captured by the imaging device 2 will be described as an example of an image input to the input unit 12.

図2は、図1におけるボケ量推定手段21の機能構成を示すブロック図である。図2に示すように、ボケ量推定手段21は、画像取得手段211、モノクロ変換手段212、ノイズ除去手段213、エッジベクトル算出手段214、エッジ判定手段215、輝度差算出手段216、ボケ量算出手段217を備えている。   FIG. 2 is a block diagram showing a functional configuration of the blur amount estimation means 21 in FIG. As shown in FIG. 2, the blur amount estimation unit 21 includes an image acquisition unit 211, a monochrome conversion unit 212, a noise removal unit 213, an edge vector calculation unit 214, an edge determination unit 215, a luminance difference calculation unit 216, and a blur amount calculation unit. 217.

画像取得手段211は、入力部12を介して、撮像装置2により撮像された画像を取得する。このとき、撮像装置2の光学系は、撮像装置制御部13による焦点距離及び絞りの制御により、被写界深度の浅い状態(即ち、ピントの合う範囲の狭い状態)に設定される。   The image acquisition unit 211 acquires an image captured by the imaging device 2 via the input unit 12. At this time, the optical system of the image pickup apparatus 2 is set to a state where the depth of field is shallow (that is, a state where the in-focus range is narrow) by the control of the focal length and the diaphragm by the image pickup apparatus control unit 13.

モノクロ変換手段212は、画像取得手段211により取得されたカラー画像をモノクロ画像に変換する。なお、入力部12に入力された画像がモノクロ画像である場合には、モノクロ変換手段212による処理は不要となる。
ノイズ除去手段213は、例えば、メディアンフィルタ、ガウシアンフィルタ等を備え、モノクロ変換手段212によりモノクロ画像に変換された画像からピクセルノイズを除去する(即ち、ノイズを平滑化処理した画像を作成する)。
このように、ノイズ除去手段213によりピクセルノイズを予め除去しておくことで、エッジベクトル算出手段214及びエッジ判定手段215でエッジ部を精度よく抽出できる。
The monochrome conversion unit 212 converts the color image acquired by the image acquisition unit 211 into a monochrome image. If the image input to the input unit 12 is a monochrome image, the processing by the monochrome conversion unit 212 is not necessary.
The noise removing unit 213 includes, for example, a median filter, a Gaussian filter, and the like, and removes pixel noise from the image converted into a monochrome image by the monochrome converting unit 212 (that is, creates an image in which noise is smoothed).
As described above, by removing the pixel noise in advance by the noise removing unit 213, the edge portion can be accurately extracted by the edge vector calculating unit 214 and the edge determining unit 215.

エッジベクトル算出手段214は、例えば、Sobel(ソーベル)フィルタ、Canny(キャニー)フィルタを備え、ノイズ除去手段213によりノイズが除去されたモノクロ画像の各画素のエッジベクトルの強度(以下、エッジ強度)及びエッジベクトルの方向(以下、エッジ方向)を算出する。   The edge vector calculation unit 214 includes, for example, a Sobel filter and a Canny filter, and the intensity (hereinafter referred to as edge strength) of the edge vector of each pixel of the monochrome image from which noise has been removed by the noise removal unit 213, and The direction of the edge vector (hereinafter referred to as the edge direction) is calculated.

具体的には、エッジベクトル算出手段214は、画像の横軸方向(以下、x軸方向)のSobelフィルタ(エッジ検出フィルタ)Sxの出力をfx、画像の縦軸方向(以下、y軸方向)のSobelフィルタSyの出力をfyとして、下記の式(1)、及び式(2)により、エッジ強度及びエッジ方向を算出する。
エッジ強度=√(fx+fy) ・・・式(1)
エッジ方向=tan−1(fy/fx) ・・・式(2)
Specifically, the edge vector calculating means 214 outputs fx as the output of the Sobel filter (edge detection filter) Sx in the horizontal axis direction (hereinafter referred to as the x-axis direction) of the image, and the vertical axis direction of the image (hereinafter referred to as the y-axis direction). Assuming that the output of the Sobel filter Sy is fy, the edge strength and the edge direction are calculated by the following equations (1) and (2).
Edge strength = √ (fx 2 + fy 2 ) (1)
Edge direction = tan −1 (fy / fx) (2)

エッジ判定手段215は、エッジベクトル算出手段214によりエッジ強度が算出された各画素のうち、そのエッジ強度が算出された画素の両側の画素のエッジ強度と比べて、エッジ強度の差又は比が所定の閾値を超える画素(注目画素)を、エッジ部画素と判定することでエッジを抽出する。
このように、エッジベクトル算出手段214及びエッジ判定手段215は、エッジ抽出手段として機能する。
The edge determination unit 215 has a predetermined difference or ratio of edge strength compared to the edge strength of the pixels on both sides of the pixel for which the edge strength is calculated among the pixels for which the edge strength is calculated by the edge vector calculation unit 214. An edge is extracted by determining a pixel (a target pixel) that exceeds the threshold value as an edge portion pixel.
Thus, the edge vector calculation unit 214 and the edge determination unit 215 function as an edge extraction unit.

輝度差算出手段216は、エッジ判定手段215により判定されたエッジ部画素のエッジ方向の両側に位置する所定数の画素の画素値としての輝度の差を算出する。
ボケ量算出手段217は、エッジベクトル算出手段214により算出されたエッジ部画素のエッジ強度と、輝度差算出手段216により算出された輝度差とから、エッジ部画素のボケ量を算出する。
なお、輝度差算出手段216による輝度差の算出方法、及びボケ量算出手段217によるボケ量の算出方法は、図3を用いて説明する。
The luminance difference calculation unit 216 calculates a luminance difference as pixel values of a predetermined number of pixels located on both sides in the edge direction of the edge portion pixel determined by the edge determination unit 215.
The blur amount calculation unit 217 calculates the blur amount of the edge pixel from the edge strength of the edge pixel calculated by the edge vector calculation unit 214 and the luminance difference calculated by the luminance difference calculation unit 216.
The luminance difference calculation method by the luminance difference calculation unit 216 and the blur amount calculation method by the blur amount calculation unit 217 will be described with reference to FIG.

図3は、輝度対画素位置特性であり、輝度差算出手段216による輝度差の算出、及びボケ量算出手段217によるボケ量の算出について説明するための図である。なお、図3の横軸は画素の位置、縦軸は輝度を示している。
図3において、画素Peはエッジ部画素を示している。画素Pe+1、画素Pe−1は、画素Peのエッジベクトル方向の両隣(両側の直近)の一対の画素であり、その輝度差Aは、エッジベクトル算出手段214により、画素Peのエッジ強度として算出される。
また、画素Pe+2、画素Pe−2は、画素Pe+1、画素Pe−1の両隣の一対の画素であり、その輝度差Bは、輝度差算出手段216により算出される。
FIG. 3 is a diagram illustrating luminance vs. pixel position characteristics, illustrating the calculation of the luminance difference by the luminance difference calculation unit 216 and the calculation of the blur amount by the blur amount calculation unit 217. In FIG. 3, the horizontal axis indicates the pixel position, and the vertical axis indicates the luminance.
In FIG. 3, a pixel Pe indicates an edge pixel. The pixel Pe + 1 and the pixel Pe-1 are a pair of pixels adjacent to each other in the edge vector direction of the pixel Pe (nearest on both sides), and the luminance difference A is calculated as the edge strength of the pixel Pe by the edge vector calculation unit 214. The
The pixel Pe + 2 and the pixel Pe-2 are a pair of pixels adjacent to the pixel Pe + 1 and the pixel Pe-1, and the luminance difference B is calculated by the luminance difference calculating unit 216.

ボケ量算出手段217は、エッジベクトル算出手段214により輝度差A、また輝度差算出手段216により輝度差Bが算出されると、下記の式(3)により、輝度差Bと輝度差2Aとを比較することで、エッジのボケ量を算出する。
ボケ量=B÷2A ・・・式(3)
When the luminance difference A is calculated by the edge vector calculating unit 214 and the luminance difference B is calculated by the luminance difference calculating unit 216, the blur amount calculating unit 217 calculates the luminance difference B and the luminance difference 2A by the following equation (3). By comparing, the blur amount of the edge is calculated.
Bokeh amount = B ÷ 2A (3)

また、図3において、画素Pe+2と画素Pe+1との輝度差をB1、画素Pe−2と画素Pe−1との輝度差をB2とすると、下記の式(4)により、エッジのボケ量を算出することもできる。
ボケ量=(A+B1+B2)÷2A ・・・式(4)
Further, in FIG. 3, when the luminance difference between the pixel Pe + 2 and the pixel Pe + 1 is B1, and the luminance difference between the pixel Pe-2 and the pixel Pe-1 is B2, the blur amount of the edge is calculated by the following equation (4). You can also
Bokeh amount = (A + B1 + B2) ÷ 2A Expression (4)

図4は、ガウシアンフィルタの分散の大きさを変更した場合における、輝度対画素位置特性である。
なお、図4では、ガウシアンフィルタの分散の大きさ(正確には、ガウス分布における分散値の平方根)を、パラメータ(分散;「σ」)で示している。また、図3と同様に、図4の横軸は画素の位置、縦軸は輝度を示している。さらに、図4では、エッジ部の画素位置を、9番目の画素位置に設定している。
FIG. 4 shows luminance versus pixel position characteristics when the magnitude of variance of the Gaussian filter is changed.
In FIG. 4, the magnitude of the variance of the Gaussian filter (more precisely, the square root of the variance value in the Gaussian distribution) is indicated by a parameter (dispersion; “σ”). Similarly to FIG. 3, the horizontal axis of FIG. 4 indicates the pixel position, and the vertical axis indicates the luminance. Further, in FIG. 4, the pixel position of the edge portion is set to the ninth pixel position.

図4において、例えば、σ=0の場合(ガウシアンフィルタの分散の大きさが小さい場合)、図3における画素Peに対応する9番目の画素の輝度が128、画素Pe+1に対応する10番目の画素の輝度が256、画素Pe−1に対応する8番目の画素の輝度が0であることから、図3における輝度差Aは256となる。また、画素Pe+2に対応する11番目の画素の輝度は256、画素Pe−2に対応する7番目の画素の輝度は0であることから、図3における輝度差Bは256となる(図3における輝度差B1、B2は0となる)。輝度差A及び輝度差Bを、式(3)に代入して、σ=0の場合のボケ量を算出すると、ボケ量は0.50となる。なお、この値がボケ量の最小値となる。   In FIG. 4, for example, when σ = 0 (when the variance of the Gaussian filter is small), the ninth pixel corresponding to the pixel Pe in FIG. 3 has a luminance of 128 and the tenth pixel corresponding to the pixel Pe + 1. 3 is 256, and the luminance of the eighth pixel corresponding to the pixel Pe-1 is 0, so that the luminance difference A in FIG. Further, since the luminance of the eleventh pixel corresponding to the pixel Pe + 2 is 256 and the luminance of the seventh pixel corresponding to the pixel Pe-2 is 0, the luminance difference B in FIG. 3 is 256 (in FIG. 3). The luminance differences B1 and B2 are 0). By substituting the luminance difference A and the luminance difference B into Equation (3) and calculating the blur amount when σ = 0, the blur amount is 0.50. This value is the minimum amount of blur.

次に、σ=2.4の場合のボケ量を算出する。σ=2.4の場合、図4に示すように、図3における画素Peに対応する9番目の画素の輝度が128、画素Pe+1に対応する10番目の画素の輝度が169、画素Pe−1に対応する8番目の画素の輝度が88であることから、図3における輝度差Aは81となる。また、画素Pe+2に対応する11番目の画素の輝度は204、画素Pe−2に対応する7番目の画素の輝度は53であることから、図3における輝度差Bは151となる(図3における輝度差B1、B2は35となる)。輝度差A及び輝度差Bは、式(3)に代入して、σ=2.4の場合のボケ量を算出すると、ボケ量は0.93となる。
また、σ=3.2の場合のボケ量は、同様に計算すると、0.99となる。
Next, the amount of blur when σ = 2.4 is calculated. When σ = 2.4, as shown in FIG. 4, the luminance of the ninth pixel corresponding to the pixel Pe in FIG. 3 is 128, the luminance of the tenth pixel corresponding to the pixel Pe + 1 is 169, and the pixel Pe−1. Since the luminance of the eighth pixel corresponding to is 88, the luminance difference A in FIG. Further, since the luminance of the eleventh pixel corresponding to the pixel Pe + 2 is 204 and the luminance of the seventh pixel corresponding to the pixel Pe-2 is 53, the luminance difference B in FIG. 3 is 151 (in FIG. 3). The luminance difference B1 and B2 is 35). When the luminance difference A and the luminance difference B are substituted into the equation (3) and the blur amount when σ = 2.4 is calculated, the blur amount is 0.93.
Further, the blur amount in the case of σ = 3.2 is calculated as 0.99.

このようにσの値が大きくなると、ボケ量の値も大きくなる。
このことは、図4から視覚的に理解することができ、σの値が大きくなると、特性曲線の傾きが緩やかになり、図3における輝度差Aの値が減少し、輝度差B1、B2の値が増加するため、ボケ量の値も大きくなる。なお、σの値を大きくすると、ボケ量の値は徐々に収束し、最大で1となる。
Thus, when the value of σ increases, the value of the blur amount also increases.
This can be visually understood from FIG. 4. As the value of σ increases, the slope of the characteristic curve becomes gentler, the value of the luminance difference A in FIG. 3 decreases, and the luminance differences B1 and B2 are reduced. Since the value increases, the blur amount value also increases. When the value of σ is increased, the blur amount value gradually converges and becomes 1 at the maximum.

前述のように、ガウシアンフィルタはピクセルノイズを除去するために用いられるが、図4に示すように、ボケ量はガウシアンフィルタの分散σの大きさにより変動する。
したがって、後述するボケ量推定画像を作成する上で、エッジ部の画素位置に、所定の値以上のボケ量が割り当てられるように、ガウシアンフィルタの分散σの大きさを設定する必要がある。
As described above, the Gaussian filter is used to remove pixel noise, but as shown in FIG. 4, the amount of blur varies depending on the magnitude of the variance σ of the Gaussian filter.
Accordingly, when creating a blur amount estimation image to be described later, it is necessary to set the magnitude of the variance σ of the Gaussian filter so that a blur amount greater than a predetermined value is assigned to the pixel position of the edge portion.

図5は、図2におけるボケ量推定手段21の処理手順を示すフロー図である。
即ち、ボケ量の推定に関する処理を開始するにあたり、ボケ量推定手段21は、被写界深度の浅い状態に設定されている撮像装置2からの画像を画像取得手段211により取得する(ステップS11)。
次に、ボケ量推定手段21は、モノクロ変換手段212によりカラー画像をモノクロ画像に変換し(ステップS12)、ノイズ除去手段213により変換されたモノクロ画像からノイズを除去する(ステップS13)。
FIG. 5 is a flowchart showing a processing procedure of the blur amount estimation means 21 in FIG.
That is, when starting the process related to the estimation of the blur amount, the blur amount estimation unit 21 acquires an image from the imaging device 2 set to a shallow depth of field by the image acquisition unit 211 (step S11). .
Next, the blur amount estimation unit 21 converts the color image into a monochrome image by the monochrome conversion unit 212 (step S12), and removes noise from the monochrome image converted by the noise removal unit 213 (step S13).

ボケ量推定手段21は、次に、エッジベクトル算出手段214によりノイズが除去されたモノクロ画像の各画素のエッジベクトル(エッジ強度)を算出し(ステップS14)、さらにエッジ判定手段215によりエッジ強度からエッジを抽出する(ステップS15)。
なお、ステップS14の処理を実行する過程で、図3における輝度差Aがエッジ強度として算出される。
Next, the blur amount estimation unit 21 calculates an edge vector (edge strength) of each pixel of the monochrome image from which noise has been removed by the edge vector calculation unit 214 (step S14), and further, the edge determination unit 215 calculates the edge strength from the edge strength. Edges are extracted (step S15).
In the course of executing the process of step S14, the luminance difference A in FIG. 3 is calculated as the edge strength.

次に、ボケ量推定手段21は、輝度差算出手段216により、抽出されたエッジを構成するエッジ部画素のエッジ方向の両側の所定数の画素(例えば、図3における、画素Pe+2、画素Pe−2)の輝度差(図3における輝度差B)を算出する(ステップS16)。
次に、ボケ量推定手段21は、ボケ量算出手段217により式(3)を用いてボケ量を算出する(ステップS17)。
Next, the blur amount estimation unit 21 uses the luminance difference calculation unit 216 to determine a predetermined number of pixels on both sides in the edge direction of the edge portion pixels constituting the extracted edge (for example, the pixel Pe + 2 and the pixel Pe− in FIG. 3). 2) (luminance difference B in FIG. 3) is calculated (step S16).
Next, the blur amount estimation unit 21 calculates the blur amount using the formula (3) by the blur amount calculation unit 217 (step S17).

なお、本実施形態において、ボケ量を算出するにあたり、3×3のSobelフィルタを使用しているが、5×5のSobelフィルタを使用することもできる。この場合、画素Pe+3と画素Pe−3の輝度差を実測値として、5×5のSobelフィルタによるエッジ勾配値から予測した値との比較値をボケ量推定に用いることになる。   In this embodiment, the 3 × 3 Sobel filter is used to calculate the blur amount. However, a 5 × 5 Sobel filter may be used. In this case, the luminance difference between the pixel Pe + 3 and the pixel Pe-3 is used as an actual measurement value, and a comparison value with a value predicted from an edge gradient value by a 5 × 5 Sobel filter is used for blur amount estimation.

図6は、図1における距離画像生成手段22の機能構成を示すブロック図である。図6に示すように、ボケ量推定画像生成手段221、x軸方向ボケ量走査手段222、x軸方向距離画像作成手段223、y軸方向ボケ量走査手段224、y軸方向距離画像作成手段225、距離平均値算出手段226、距離画像作成手段227を備えている。   FIG. 6 is a block diagram showing a functional configuration of the distance image generating means 22 in FIG. As illustrated in FIG. 6, the blur amount estimation image generation unit 221, the x-axis direction blur amount scanning unit 222, the x-axis direction distance image creation unit 223, the y-axis direction blur amount scanning unit 224, and the y-axis direction distance image creation unit 225. , A distance average value calculating means 226 and a distance image creating means 227 are provided.

ボケ量推定画像作成手段221は、ボケ量推定手段21により推定されたボケ量(B/2A)を原画像の画素位置に割り当てる(対応させる)ことにより、ボケ量推定画像を作成する。
図7Aは、ボケ量推定画像作成手段221により作成されたボケ量推定画像を示す。
本実施形態においては、被写体として2つの物体を設定し、この2つの物体を、撮像装置2の撮像方向に対して前後に、且つ、撮像画像において、物体同士が重なるように配置している。ここで、撮像装置2の撮像方向に対して前方に位置する物体を物体P、後方に位置する物体を物体Qとする。
The blur amount estimation image creating unit 221 creates a blur amount estimation image by assigning (corresponding to) the blur amount (B / 2A) estimated by the blur amount estimation unit 21 to the pixel position of the original image.
FIG. 7A shows a blur amount estimation image created by the blur amount estimation image creation means 221.
In the present embodiment, two objects are set as subjects, and these two objects are arranged in front of and behind the imaging direction of the imaging apparatus 2 and so that the objects overlap each other in the captured image. Here, an object positioned in front of the imaging direction of the imaging apparatus 2 is defined as an object P, and an object positioned in the rear is defined as an object Q.

また、前述のようにボケ量推定手段21により推定されるボケ量は、撮像された物体のエッジ部においてはそれ以外の部分より高い値を示すことから、ボケ量が周りのボケ量よりも高い値を示す画素位置を基にボケ推定画像を作成すると、ボケ量推定画像は、例えば、図7Aのように示される。
なお、ボケ量推定画像作成手段221による、ボケ量推定画像を作成する工程は、ボケ量を可視化して確認する工程であることから、原画像の各々の画素位置にボケ量が数値として割り当てられていることを前提に、省略することができる。
Further, as described above, the blur amount estimated by the blur amount estimation unit 21 shows a higher value in the edge portion of the imaged object than in other portions, and thus the blur amount is higher than the surrounding blur amount. When a blur estimation image is created based on a pixel position indicating a value, the blur amount estimation image is shown as in FIG. 7A, for example.
Note that the step of creating the blur amount estimated image by the blur amount estimated image creating unit 221 is a step of visualizing and confirming the blur amount, so that the blur amount is assigned as a numerical value to each pixel position of the original image. It can be omitted on the assumption that

x軸方向ボケ量走査手段222は、図7Bに示すように、ボケ量推定画像作成手段221により作成されたボケ量推定画像をx軸方向に走査して、x軸方向ボケ量走査データを生成する。
ここで、具体的なx軸方向ボケ量走査データの生成方法を、図8を用いて説明する。
なお、図8では、y軸方向の任意の位置y2において、x軸方向ボケ量走査手段222によりx軸方向に走査することで、x軸方向ボケ量走査データを生成している。また、本実施形態において、x軸方向ボケ量走査手段222は、xの値が小さい方から大きい方に(即ち、図の左から右方向に)走査する仕様としているが、必ずしもこれに限定されず、xの値が大きい方から小さい方に走査する仕様としてもよい。
As shown in FIG. 7B, the x-axis direction blur amount scanning unit 222 scans the blur amount estimation image created by the blur amount estimation image creation unit 221 in the x-axis direction to generate x-axis direction blur amount scanning data. To do.
Here, a specific method of generating x-axis direction blur amount scanning data will be described with reference to FIG.
In FIG. 8, x-axis direction blur amount scanning data is generated by scanning in the x-axis direction by the x-axis direction blur amount scanning unit 222 at an arbitrary position y2 in the y-axis direction. In the present embodiment, the x-axis direction blur amount scanning unit 222 is configured to scan from the smaller x value to the larger value (that is, from the left to the right in the drawing), but is not necessarily limited thereto. Alternatively, the specification may be such that the value of x is scanned from the larger value to the smaller value.

x軸方向ボケ量走査手段222は、図7Aに示したボケ量推定画像に対して、先ず、x軸方向の走査の開始位置であるx0より、ボケ量が所定の値以上となる画素位置(即ち、物体Pのエッジ部x1)まで走査する(図8A)。
x軸方向ボケ量走査手段222は、x1まで走査すると、x0におけるボケ量とx1におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、x0からx1の間に位置する画素にボケ量をマッピングする(割り当てる)。
The x-axis direction blur amount scanning unit 222 first determines, with respect to the blur amount estimation image shown in FIG. 7A, a pixel position where the blur amount is equal to or greater than a predetermined value from x0, which is the scan start position in the x-axis direction. That is, scanning is performed up to the edge portion x1) of the object P (FIG. 8A).
When the x-axis direction blur amount scanning unit 222 scans up to x1, the blur amount at x0 is compared with the blur amount at x1, and among the compared blur amounts, a blur amount having a smaller blur amount is selected, and x0 to x1 The amount of blur is mapped (assigned) to the pixels located between.

ここで、被写体とする物体(ここでは、物体P及びQ)の全体がボケ量推定画像内に収まっていることを前提に、x軸方向ボケ量走査手段222によりx軸方向に走査する上で、画像の左右端部(即ち、図8においてx=x0、及びx=x5)におけるボケ量の値を「0」に設定する。そのため、x軸方向ボケ量走査手段222は、x0におけるボケ量とx1におけるボケ量のうち、ボケ量の値の小さいx0におけるボケ量「0」を選択し、x0からx1の間に位置する画素にボケ量「0」をマッピングする。   Here, on the assumption that the entire object (here, the objects P and Q) as a subject is within the blur amount estimation image, the x-axis direction blur amount scanning unit 222 performs scanning in the x-axis direction. Then, the value of the blur amount at the left and right ends of the image (that is, x = x0 and x = x5 in FIG. 8) is set to “0”. Therefore, the x-axis direction blur amount scanning unit 222 selects a blur amount “0” at x0 having a small blur amount value among the blur amount at x0 and the blur amount at x1, and the pixels located between x0 and x1 The blur amount “0” is mapped to.

x軸方向ボケ量走査手段222は、x0からx1の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をx1に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図8B)。図8Bでは、物体Pのエッジ部x3において、ボケ量が所定の値以上となることから、x軸方向ボケ量走査手段222はx3まで走査する。
x軸方向ボケ量走査手段222は、x3まで走査すると、走査の開始位置であるx1におけるボケ量とx3におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、x1からx3の間に位置する画素にボケ量をマッピングする。
即ち、x軸方向ボケ量走査手段222は、x1におけるボケ量とx3におけるボケ量を比較し、例えば、x1におけるボケ量「X1」がx3におけるボケ量「X3」よりも小さい(即ち、X3>X1)と判定すると、x1におけるボケ量「X1」を選択し、x1からx3の間に位置する画素にボケ量「X1」をマッピングする。
When the x-axis direction blur amount scanning unit 222 maps the blur amount to a pixel located between x0 and x1, next, the scan start position is set to x1, and the pixel position where the blur amount becomes a predetermined value or more. (FIG. 8B). In FIG. 8B, since the blur amount is equal to or greater than a predetermined value at the edge portion x3 of the object P, the x-axis direction blur amount scanning unit 222 scans up to x3.
When the x-axis direction blur amount scanning unit 222 scans up to x3, the blur amount at x1 that is the start position of the scan is compared with the blur amount at x3, and among the compared blur amounts, a blur amount with a smaller blur amount value is selected. Select and map the amount of blur to pixels located between x1 and x3.
That is, the x-axis direction blur amount scanning unit 222 compares the blur amount at x1 with the blur amount at x3. For example, the blur amount “X1” at x1 is smaller than the blur amount “X3” at x3 (that is, X3> If the determination is X1), the blur amount “X1” at x1 is selected, and the blur amount “X1” is mapped to a pixel located between x1 and x3.

x軸方向ボケ量走査手段222は、x1からx3の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をx3に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図8C)。図8Cでは、物体Qのエッジ部x4において、ボケ量が所定の値以上となることから、x軸方向ボケ量走査手段222は、x4まで走査する。
x軸方向ボケ量走査手段222は、x4まで走査すると、走査の開始位置であるx3におけるボケ量とx4におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、x3からx4の間に位置する画素にボケ量をマッピングする。
即ち、x軸方向ボケ量走査手段222は、x3におけるボケ量とx4におけるボケ量を比較し、例えば、x4におけるボケ量「X4」がx3におけるボケ量「X3」よりも小さい(即ち、X3>X4)と判定すると、x4におけるボケ量「X4」を選択し、x3からx4の間に位置する画素にボケ量「X4」をマッピングする。
When the x-axis direction blur amount scanning unit 222 maps the blur amount to a pixel located between x1 and x3, the scan start position is then set to x3, and the pixel position where the blur amount becomes a predetermined value or more. (FIG. 8C). In FIG. 8C, since the blur amount is equal to or greater than a predetermined value at the edge portion x4 of the object Q, the x-axis direction blur amount scanning unit 222 scans up to x4.
When the x-axis direction blur amount scanning unit 222 scans up to x4, the blur amount at x3, which is the start position of the scan, is compared with the blur amount at x4, and among the compared blur amounts, a blur amount with a smaller blur amount value is selected. Select and map the amount of blur to pixels located between x3 and x4.
That is, the x-axis direction blur amount scanning unit 222 compares the blur amount at x3 with the blur amount at x4. For example, the blur amount “X4” at x4 is smaller than the blur amount “X3” at x3 (that is, X3> If it is determined as X4), the blur amount “X4” at x4 is selected, and the blur amount “X4” is mapped to pixels located between x3 and x4.

x軸方向ボケ量走査手段222は、x3からx4の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をx4に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図8D)。
x4より走査を開始した場合、図8Dに示すように、画像の右端部であるx5までにボケ量が所定の値以上となる画素が存在しないため、x軸方向ボケ量走査手段222は、画像の右端部であるx5まで走査すると処理を終了する。
本実施形態では、前述のように画像の右端部x5におけるボケ量の値を「0」に設定することから、x軸方向ボケ量走査手段222は、x4におけるボケ量とx5におけるボケ量のうち、ボケ量の値の小さいx5におけるボケ量「0」を選択し、x4からx5の間に位置する画素にボケ量「0」をマッピングする。
When the x-axis direction blur amount scanning unit 222 maps the blur amount to a pixel located between x3 and x4, next, the scan start position is set to x4, and the pixel position where the blur amount becomes a predetermined value or more. (FIG. 8D).
When scanning is started from x4, as shown in FIG. 8D, there is no pixel whose blur amount is equal to or greater than a predetermined value up to x5, which is the right end portion of the image. The process is terminated when scanning is performed up to x5, which is the right end of.
In this embodiment, since the value of the blur amount at the right end portion x5 of the image is set to “0” as described above, the x-axis direction blur amount scanning unit 222 includes the blur amount at x4 and the blur amount at x5. The blur amount “0” at x5 having a small blur amount value is selected, and the blur amount “0” is mapped to pixels located between x4 and x5.

このように、x軸方向ボケ量走査手段222は、y軸方向の任意の位置y2において、x軸方向に画像の左端部であるx0から右端部であるx5まで走査し、x0からx5までの各画素位置にボケ量をマッピングすると、マッピングしたボケ量を、y軸方向をy2とするx軸方向ボケ量走査データとして、RAM15に保存する。
x軸方向ボケ量走査手段222は、この走査処理を、画像の下端部であるy0から上端部であるy5まで、所定の間隔で実行し、y軸方向の任意の位置におけるx軸方向ボケ量走査データを生成し、RAM15に保存する。
As described above, the x-axis direction blur amount scanning unit 222 scans from the left end portion x0 of the image to the right end portion x5 in the x axis direction at an arbitrary position y2 in the y axis direction, and from x0 to x5. When the blur amount is mapped to each pixel position, the mapped blur amount is stored in the RAM 15 as x-axis direction blur amount scan data in which the y-axis direction is y2.
The x-axis direction blur amount scanning unit 222 executes this scanning process at predetermined intervals from y0 that is the lower end portion of the image to y5 that is the upper end portion, and the x-axis direction blur amount at an arbitrary position in the y-axis direction. Scan data is generated and stored in the RAM 15.

x軸方向距離画像作成手段223は、x軸方向ボケ量走査手段222により生成され、RAM15に保存されたx軸方向ボケ量走査データを読み込み、さらにボケ量/距離テーブルを参照することで、x軸方向に関する距離画像を撮像装置2のレンズから物体までの距離を画像として作成する。   The x-axis direction distance image creating unit 223 reads the x-axis direction blur amount scanning data generated by the x-axis direction blur amount scanning unit 222 and stored in the RAM 15, and further refers to the blur amount / distance table. A distance image in the axial direction is created as an image of the distance from the lens of the imaging apparatus 2 to the object.

図9は、ボケ量/距離テーブルの作成手順について説明するための図である。
ここで、図9Aは、直径50mmのレンズのピントをレンズから10mの距離に合わせた状態でのレンズからの距離と錯乱円(「点」の被写体を結像させた場合に形成される「円」)の大きさ(直径)との関係を示す図である。
また、図9Bは、ガウシアンフィルタのカーネル(例えば、カーネルサイズ3×3、5×5等の中心を注目輝度、その周辺を周辺輝度とする正方形のレート表)のカーネルサイズを変更させた場合において、そのガウシアンフィルタでぼかした画像から、式(3)により算出したボケ量の推定値を示した図である。図9Bの横軸は、ガウシアンフィルタのカーネルサイズ3〜11(nを整数として、2n+1)、また縦軸は、ボケ量推定値を示し、その値は式(3)による算出値の2倍から1を減算したもの(2(B/2A)−1)である。
FIG. 9 is a diagram for explaining a procedure for creating the blur amount / distance table.
Here, FIG. 9A shows a “circle” formed when a subject with a distance from the lens and a circle of confusion (“dot”) is focused in a state where the focus of the lens having a diameter of 50 mm is set to a distance of 10 m from the lens. It is a figure which shows the relationship with the magnitude | size (diameter) of ").
FIG. 9B shows a case in which the kernel size of the kernel of the Gaussian filter (for example, a square rate table with the center of the kernel size 3 × 3, 5 × 5, etc. as the target luminance and the periphery as the peripheral luminance) is changed. FIG. 10 is a diagram showing an estimated value of a blur amount calculated by Expression (3) from an image blurred by the Gaussian filter. The horizontal axis of FIG. 9B represents the kernel size 3 to 11 of the Gaussian filter (n is an integer, 2n + 1), and the vertical axis represents the estimated amount of blur, and the value is from twice the value calculated by the equation (3). This is a value obtained by subtracting 1 (2 (B / 2A) -1).

レンズからの距離と錯乱円の大きさとは、図9Aに示すような対応関係がある。また、一般に、散乱円の大きさとボケ量にも対応関係があることから、ボケ量と散乱円との対応関係を示すデータを作成することで、ボケ量とレンズからの距離との対応関係を示すデータ、即ち、ボケ量/距離テーブルを作成することができる。   The distance from the lens and the size of the circle of confusion have a correspondence as shown in FIG. 9A. In general, since there is a correspondence between the size of the scattering circle and the amount of blurring, the correspondence between the amount of blurring and the distance from the lens can be determined by creating data indicating the correspondence between the amount of blurring and the scattering circle. Data to be shown, that is, a blur amount / distance table can be created.

そこで、任意のカメラで取得したボケのない画像をガウシアンフィルタで処理してボケ画像を生成し、そのボケ量を式(3)で算出することで、図9Bに示すデータを作成する。   Therefore, the image shown in FIG. 9B is created by processing a non-blurred image acquired by an arbitrary camera by using a Gaussian filter to generate a blurred image and calculating the amount of blur using Equation (3).

ここで、(2n+1)×(2n+1)のガウシアンフィルタは、ボケのない画像の1画素を、(2n+1)×(2n+1)画素にぼかす。そこで、(2n+1)×(2n+1)画素と図9Aにおける散乱円の大きさとの対応関係を示すデータを取得することで、図9Aの縦軸の値を画素数(ガウシアンフィルタにおけるカーネルサイズ)に変換したデータを作成することができる。さらに、図9Bに示すデータを用いることで、図9Aの縦軸を図9Bの縦軸に示すボケ量推定値としたデータ、即ちボケ量/距離テーブルを作成することができる。なお、(2n+1)画素と図9Aにおける錯乱円の大きさとの対応関係を示すデータは、撮像素子の画素数など、カメラの諸元から取得することができる。   Here, the (2n + 1) × (2n + 1) Gaussian filter blurs one pixel of an unblurred image to (2n + 1) × (2n + 1) pixels. Therefore, by obtaining data indicating the correspondence between (2n + 1) × (2n + 1) pixels and the size of the scattering circle in FIG. 9A, the value on the vertical axis in FIG. 9A is converted into the number of pixels (kernel size in the Gaussian filter). Data can be created. Further, by using the data shown in FIG. 9B, data in which the vertical axis in FIG. 9A is the blur amount estimated value shown in the vertical axis in FIG. 9B, that is, the blur amount / distance table can be created. Note that data indicating the correspondence between (2n + 1) pixels and the size of the circle of confusion in FIG. 9A can be acquired from the specifications of the camera, such as the number of pixels of the image sensor.

x軸方向距離画像作成手段223は、x軸方向ボケ量走査データを読み込み、上記のように作成されたボケ量/距離テーブルを参照することで、先ず、y軸方向の所定の位置における画像の左端部であるx0から右端部であるx5上に位置する各画素に関して、撮像装置2のレンズから物体までの距離を算出する。
x軸方向距離画像作成手段223は、次に、横軸をx軸(即ち、ボケ量推定画像の横方向)、また縦軸を撮像装置2のレンズから物体までの距離とする、x軸方向の距離画像を作成する。
The x-axis direction distance image creation means 223 reads the x-axis direction blur amount scanning data and refers to the blur amount / distance table created as described above, so that first, an image at a predetermined position in the y-axis direction is read. The distance from the lens of the imaging device 2 to the object is calculated for each pixel located on the left end portion x0 to the right end portion x5.
Next, the x-axis direction distance image creating means 223 uses the x-axis direction with the horizontal axis as the x-axis (that is, the horizontal direction of the blur amount estimation image) and the vertical axis as the distance from the lens of the imaging device 2 to the object. Create a distance image.

図10は、y軸方向の任意の位置y2におけるx軸方向ボケ量走査データを読み込み、ボケ量/距離テーブルを参照することで算出された、撮像装置2のレンズから物体までの距離を、x軸方向の距離画像として作成した図である。図10に示すように、x軸方向のx1からx3までは撮像装置2のレンズからの距離はDx1であり、またx3からx4までは撮像装置2のレンズからの距離はDx2である。
このように、x軸方向距離画像作成手段223は、RAM15に保存されたx軸方向ボケ量走査データより、x軸方向の距離画像を作成する。
なお、x軸方向距離画像作成手段223による、x軸方向の距離画像を作成する工程は、y軸方向の任意の位置における、x軸方向の距離を可視化して確認する工程であることから、x軸方向に関する距離が算出されていることを前提に、省略することができる。
FIG. 10 shows the distance from the lens of the imaging apparatus 2 to the object, which is calculated by reading x-axis direction blur amount scanning data at an arbitrary position y2 in the y-axis direction and referring to the blur amount / distance table. It is the figure created as a distance image of an axial direction. As shown in FIG. 10, the distance from the lens of the imaging device 2 is Dx1 from x1 to x3 in the x-axis direction, and the distance from the lens of the imaging device 2 is Dx2 from x3 to x4.
As described above, the x-axis direction distance image creating means 223 creates a distance image in the x-axis direction from the x-axis direction blur amount scanning data stored in the RAM 15.
The step of creating the distance image in the x-axis direction by the x-axis direction distance image creating means 223 is a step of visualizing and confirming the distance in the x-axis direction at an arbitrary position in the y-axis direction. It can be omitted on the assumption that the distance in the x-axis direction is calculated.

x軸方向ボケ量走査手段222によりx軸方向ボケ量走査データを生成し、さらにx軸方向距離画像作成手段223によりx軸方向に関する距離画像を作成すると、本実施形態では、次に、後述する距離画像作成手段227により作成する距離画像の精度を高めるために、y軸方向ボケ量走査データを生成する。
y軸方向ボケ量走査手段224は、図7Cに示すように、ボケ量推定画像作成手段221により作成されたボケ量推定画像を縦軸方向(以下、y軸方向)に走査して、y軸方向ボケ量走査データを生成する。
If x-axis direction blur amount scanning data is generated by the x-axis direction blur amount scanning unit 222 and further a distance image in the x-axis direction is generated by the x-axis direction distance image generation unit 223, in the present embodiment, a description will be given later. In order to improve the accuracy of the distance image created by the distance image creating means 227, y-axis direction blur amount scanning data is generated.
As shown in FIG. 7C, the y-axis direction blur amount scanning unit 224 scans the blur amount estimation image created by the blur amount estimation image creation unit 221 in the vertical axis direction (hereinafter referred to as the y-axis direction). Direction blur amount scanning data is generated.

具体的なy軸方向ボケ量走査データの生成方法を、図11を用いて説明する。
なお、図11では、x軸方向の任意の位置x2において、y軸方向ボケ量走査手段224によりy軸方向に走査することで、y軸方向ボケ量走査データを生成している。また、本実施形態において、y軸方向ボケ量走査手段224は、yの値が小さい方から大きい方に(即ち、図の下から上方向に)走査する仕様としているが、必ずしもこれに限定されず、yの値が大きい方から小さい方に走査する仕様としてもよい。
A specific method of generating y-axis direction blur amount scanning data will be described with reference to FIG.
In FIG. 11, the y-axis direction blur amount scanning data is generated by scanning in the y-axis direction by the y-axis direction blur amount scanning unit 224 at an arbitrary position x2 in the x-axis direction. In this embodiment, the y-axis direction blur amount scanning unit 224 is configured to scan from the smaller y value to the larger y value (that is, from the bottom to the top in the figure), but is not necessarily limited thereto. Alternatively, the specification may be such that the y value is scanned from the larger value to the smaller value.

y軸方向ボケ量走査手段224は、図7Aに示したボケ量推定画像に対して、先ず、y軸方向の走査の開始位置であるy0より、ボケ量が所定の値以上となる画素位置(物体Pのエッジ部y1)まで走査する(図11A)。
y軸方向ボケ量走査手段224は、y1まで走査すると、y0におけるボケ量とy1におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、y0からy1の間に位置する画素にボケ量をマッピングする。
The y-axis direction blur amount scanning unit 224 first performs pixel position (from the y0 which is the start position of scanning in the y-axis direction) on the blur amount estimation image shown in FIG. Scan to the edge portion y1) of the object P (FIG. 11A).
When the y-axis direction blur amount scanning unit 224 scans up to y1, the blur amount at y0 is compared with the blur amount at y1, and among the compared blur amounts, a blur amount having a smaller blur amount is selected, and y0 to y1 The amount of blur is mapped to pixels located between.

ここで、被写体とする物体(ここでは、物体P及びQ)の全体がボケ量推定画像内に収まっていることを前提に、y軸方向ボケ量走査手段224によりy軸方向に走査する上で、画像の上下端部(即ち、図11においてy=y0、及びy=y5)におけるボケ量の値を「0」に設定する。そのため、y軸方向ボケ量走査手段224は、y0におけるボケ量とy1におけるボケ量のうち、ボケ量の値の小さいy0におけるボケ量「0」を選択し、y0からy1の間に位置する画素にボケ量「0」をマッピングする。   Here, on the assumption that the entire object (here, the objects P and Q) as the subject is within the blur amount estimation image, the y-axis direction blur amount scanning unit 224 performs scanning in the y-axis direction. Then, the value of the blur amount at the upper and lower ends of the image (that is, y = y0 and y = y5 in FIG. 11) is set to “0”. Therefore, the y-axis direction blur amount scanning unit 224 selects a blur amount “0” at y0 having a smaller blur amount from among the blur amount at y0 and the blur amount at y1, and a pixel located between y0 and y1. The blur amount “0” is mapped to.

y軸方向ボケ量走査手段224は、y0からy1の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をy1に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図11B)。図11Bでは、物体Pのエッジ部y3において、ボケ量が所定の値以上となることから、y軸方向ボケ量走査手段224はy3まで走査する。
y軸方向ボケ量走査手段224は、y3まで走査すると、走査の開始位置であるy1におけるボケ量とy3におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、y1からy3の間に位置する画素にボケ量をマッピングする。
即ち、y軸方向ボケ量走査手段224は、y1におけるボケ量とy3におけるボケ量を比較し、例えば、y1におけるボケ量「Y1」がy3におけるボケ量「Y3」よりも小さい(即ち、Y3>Y1)と判定すると、y1におけるボケ量「Y1」を選択し、y1からy3の間に位置する画素にボケ量「Y1」をマッピングする。
When the y-axis direction blur amount scanning unit 224 maps the blur amount to the pixel located between y0 and y1, the scan start position is then set to y1, and the pixel position where the blur amount is equal to or greater than a predetermined value. (FIG. 11B). In FIG. 11B, since the blur amount is equal to or greater than a predetermined value at the edge portion y3 of the object P, the y-axis direction blur amount scanning unit 224 scans up to y3.
When the y-axis direction blur amount scanning unit 224 scans up to y3, the blur amount at y1 which is the start position of the scan is compared with the blur amount at y3, and among the compared blur amounts, the blur amount with a smaller blur amount value is compared. Select and map the amount of blur to pixels located between y1 and y3.
That is, the y-axis direction blur amount scanning unit 224 compares the blur amount at y1 with the blur amount at y3. For example, the blur amount “Y1” at y1 is smaller than the blur amount “Y3” at y3 (ie, Y3> If it is determined as Y1), the blur amount “Y1” at y1 is selected, and the blur amount “Y1” is mapped to the pixels located between y1 and y3.

y軸方向ボケ量走査手段224は、y1からy3の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をy3に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図11C)。図11Cでは、物体Qのエッジ部y4において、ボケ量が所定の値以上となることから、y軸方向ボケ量走査手段224はy4まで走査する。
y軸方向ボケ量走査手段224は、y4まで走査すると、走査の開始位置であるy3におけるボケ量とy4におけるボケ量を比較し、比較したボケ量のうち、ボケ量の値が小さいボケ量を選択し、y3からy4の間に位置する画素にボケ量をマッピングする。
即ち、y軸方向ボケ量走査手段224は、y3におけるボケ量とy4におけるボケ量を比較し、例えば、y4におけるボケ量「Y4」がy3におけるボケ量「Y3」よりも小さい(即ち、Y3>Y4)と判定すると、y4におけるボケ量「Y4」を選択し、y3からy4の間に位置する画素にボケ量「Y4」をマッピングする。
When the y-axis direction blur amount scanning unit 224 maps the blur amount to the pixel located between y1 and y3, next, the scan start position is set to y3, and the pixel position at which the blur amount becomes a predetermined value or more. (FIG. 11C). In FIG. 11C, since the blur amount is equal to or greater than a predetermined value at the edge portion y4 of the object Q, the y-axis direction blur amount scanning unit 224 scans up to y4.
When the y-axis direction blur amount scanning unit 224 scans up to y4, it compares the blur amount at y3, which is the start position of scanning, with the blur amount at y4, and among the compared blur amounts, the blur amount with the smaller blur amount value is compared. Select and map the amount of blur to pixels located between y3 and y4.
That is, the y-axis direction blur amount scanning unit 224 compares the blur amount at y3 with the blur amount at y4. For example, the blur amount “Y4” at y4 is smaller than the blur amount “Y3” at y3 (ie, Y3> If it is determined as Y4), the blur amount “Y4” at y4 is selected, and the blur amount “Y4” is mapped to pixels located between y3 and y4.

y軸方向ボケ量走査手段224は、y3からy4の間に位置する画素にボケ量をマッピングすると、次に、走査の開始位置をy4に設定し、ボケ量が所定の値以上となる画素位置まで走査する(図11D)。
y4より走査を開始した場合、図11Dに示すように、画像の上端部であるy5までにボケ量が所定の値以上となる画素が存在しないため、y軸方向ボケ量走査手段224は、画像の上端部であるy5まで走査すると処理を終了する。
本実施形態では、前述のように画像の上端部y5におけるボケ量の値を「0」に設定することから、y軸方向ボケ量走査手段224は、y4におけるボケ量とy5におけるボケ量のうち、ボケ量の値の小さいy5におけるボケ量「0」を選択し、y4からy5の間に位置する画素にボケ量「0」をマッピングする。
When the y-axis direction blur amount scanning unit 224 maps the blur amount to the pixel located between y3 and y4, next, the scan start position is set to y4, and the pixel position where the blur amount becomes a predetermined value or more. (FIG. 11D).
When scanning starts from y4, as shown in FIG. 11D, there is no pixel whose blur amount is equal to or greater than a predetermined value by y5, which is the upper end portion of the image. Therefore, the y-axis direction blur amount scanning unit 224 The process ends when scanning is performed up to y5, which is the upper end of.
In this embodiment, since the blur amount value at the upper end portion y5 of the image is set to “0” as described above, the y-axis direction blur amount scanning unit 224 determines the blur amount at y4 and the blur amount at y5. The blur amount “0” at y5 having a small blur amount value is selected, and the blur amount “0” is mapped to pixels located between y4 and y5.

このように、y軸方向ボケ量走査手段224は、x軸方向の任意の位置x2において、y軸方向に画像の下端部であるy0から上端部であるy5まで走査し、y0からy5までの各画素位置にボケ量をマッピングすると、マッピングしたボケ量を、x軸方向をx2とするy軸方向ボケ量走査データとして、RAM15に保存する。
y軸方向ボケ量走査手段224は、この走査処理を、画像の下端部であるy0から上端部であるy5まで、所定の間隔で実行し、x軸方向の任意の位置におけるy軸方向ボケ量走査データを作成し、RAM15に保存する。
In this way, the y-axis direction blur amount scanning unit 224 scans from the lower end portion y0 to the upper end portion y5 in the y-axis direction at an arbitrary position x2 in the x-axis direction, and from y0 to y5. When the blur amount is mapped to each pixel position, the mapped blur amount is stored in the RAM 15 as the y-axis direction blur amount scan data in which the x-axis direction is x2.
The y-axis direction blur amount scanning unit 224 executes this scanning process from the lower end portion y0 to the upper end portion y5 at predetermined intervals, and the y-axis direction blur amount at an arbitrary position in the x-axis direction. Scan data is created and stored in the RAM 15.

y軸方向距離画像作成手段225は、y軸方向ボケ量走査手段224により生成され、RAM15に保存されたy軸方向ボケ量走査データを読み込み、さらにボケ量/距離テーブルを参照することで、y軸方向に関する距離画像を撮像装置2のレンズから物体までの距離を画像として作成する。
なお、ボケ量/距離テーブルは、図9の作成手順に従って作成されたボケ量/距離テーブルを用いることができる。
The y-axis direction distance image creating unit 225 reads the y-axis direction blur amount scanning data generated by the y-axis direction blur amount scanning unit 224 and stored in the RAM 15, and further refers to the blur amount / distance table. A distance image in the axial direction is created as an image of the distance from the lens of the imaging apparatus 2 to the object.
As the blur amount / distance table, the blur amount / distance table created according to the creation procedure of FIG. 9 can be used.

y軸方向距離画像作成手段225は、y軸方向ボケ量走査データを読み込み、図9の作成手順に従って作成されたボケ量/距離テーブルを参照することで、先ず、x軸方向の所定の位置における画像の下端部であるy0から上端部であるy5上に位置する各画素に関して、撮像装置2のレンズから物体までの距離を算出する。
y軸方向距離画像作成手段225は、次に、横軸をy軸(即ち、ボケ量推定画像の縦方向)、また縦軸を撮像装置2のレンズから物体までの距離とする、y軸方向の距離画像を作成する。
First, the y-axis direction distance image creation means 225 reads the y-axis direction blur amount scanning data and refers to the blur amount / distance table created according to the creation procedure of FIG. The distance from the lens of the imaging device 2 to the object is calculated for each pixel located on the upper end y5 from the lower end y0 of the image.
Next, the y-axis direction distance image creating means 225 sets the horizontal axis to the y-axis (that is, the vertical direction of the blur amount estimation image) and the vertical axis to the distance from the lens of the imaging device 2 to the object. Create a distance image.

図12は、x軸方向の任意の位置x2におけるy軸方向ボケ量走査データを読み込み、ボケ量/距離テーブルを参照することで算出された、撮像装置2のレンズから物体までの距離を、y軸方向の距離画像として作成した図である。図12に示すように、y軸方向のy1からy3までは撮像装置2のレンズからの距離はDy1であり、またy3からy4までは撮像装置2のレンズからの距離はDy2である。
このように、y軸方向距離画像作成手段225は、RAM15に保存されたy軸方向ボケ量走査データより、y軸方向の距離画像を作成する。
なお、y軸方向距離画像作成手段225による、y軸方向の距離画像を作成する工程は、x軸方向の任意の位置における、y軸方向の距離を可視化して確認する工程であることから、y軸方向に関する距離が算出されていることを前提に、省略することができる。
FIG. 12 shows the distance from the lens of the imaging apparatus 2 to the object calculated by reading the y-axis direction blur amount scanning data at an arbitrary position x2 in the x-axis direction and referring to the blur amount / distance table. It is the figure created as a distance image of an axial direction. As shown in FIG. 12, the distance from the lens of the imaging device 2 is Dy1 from y1 to y3 in the y-axis direction, and the distance from the lens of the imaging device 2 is Dy2 from y3 to y4.
As described above, the y-axis direction distance image creating unit 225 creates a distance image in the y-axis direction from the y-axis direction blur amount scanning data stored in the RAM 15.
The step of creating the distance image in the y-axis direction by the y-axis direction distance image creating means 225 is a step of visualizing and confirming the distance in the y-axis direction at an arbitrary position in the x-axis direction. It can be omitted on the assumption that the distance in the y-axis direction is calculated.

また、y軸方向のボケ量の走査処理からy軸方向に関する距離画像を作成する(即ち、y軸方向に関する距離を算出する)までの一連の工程は、後述する距離画像作成手段227により距離画像を作成する上で、その精度を高めるために実行するものであることから、処理時間を短くすること、処理負荷を軽減すること等を目的に当該工程について省略することができる。
逆に、距離画像作成手段227により作成される距離画像の精度をより向上させるために、縦軸及び横軸以外に新規に軸(例えば、斜め方向に軸)を設定し、その軸方向に関する距離画像を作成することも考慮することができる。
なお、この場合、軸(例えば、縦軸又は横軸の一方)を固定した上で、ボケ量推定画像を所定の角度ずつ回転させて、その都度、距離画像を作成してもよい。
In addition, a series of steps from scanning processing for the amount of blur in the y-axis direction to creating a distance image in the y-axis direction (that is, calculating a distance in the y-axis direction) is performed by the distance image creating unit 227 described later. Since the process is executed to increase the accuracy of the process, the process can be omitted for the purpose of shortening the processing time, reducing the processing load, and the like.
Conversely, in order to further improve the accuracy of the distance image created by the distance image creating means 227, a new axis (for example, an axis in an oblique direction) is set in addition to the vertical axis and the horizontal axis, and the distance in the axial direction is set. Creating an image can also be considered.
In this case, after the axis (for example, one of the vertical axis or the horizontal axis) is fixed, the blur amount estimation image may be rotated by a predetermined angle, and a distance image may be created each time.

距離平均値算出手段226は、x軸方向距離画像作成手段223によるx軸方向の距離画像(x軸方向に関する距離)及びy軸方向距離画像作成手段225によるy軸方向の距離画像(y軸方向に関する距離)が作成されると、各画素位置における、撮像装置2のレンズからの距離の平均値を算出する。
なお、本実施形態においては、距離の平均値を算出することにより、撮像装置2のレンズから物体までの距離を特定しているが、距離を特定する方法としては必ずしも平均値に限定されない。中間値など周知の方法で特定(推定)してもよい。
The distance average value calculation means 226 is a distance image in the x-axis direction (distance related to the x-axis direction) by the x-axis direction distance image creation means 223 and a distance image in the y-axis direction (y-axis direction) by the y-axis direction distance image creation means 225. When the distance is generated, the average value of the distance from the lens of the imaging device 2 at each pixel position is calculated.
In this embodiment, the distance from the lens of the imaging device 2 to the object is specified by calculating the average value of the distance, but the method for specifying the distance is not necessarily limited to the average value. It may be specified (estimated) by a known method such as an intermediate value.

距離平均値算出手段226による、各画素位置における、撮像装置2のレンズからの距離の平均値の算出に関して、図13を用いて説明する。
図13では、x軸方向距離画像作成手段223により算出された、(y軸方向の位置をy2とする)x軸方向に位置する画素位置における、撮像装置2のレンズからの距離、またy軸方向距離画像作成手段225により算出された、(x軸方向の位置をx2とする)y軸方向に位置する画素位置における、撮像装置2のレンズからの距離をプロットしている。
The calculation of the average value of the distance from the lens of the imaging device 2 at each pixel position by the distance average value calculation means 226 will be described with reference to FIG.
In FIG. 13, the distance from the lens of the imaging device 2 at the pixel position located in the x-axis direction (assuming the position in the y-axis direction is y2) calculated by the x-axis direction distance image creating means 223, or the y-axis The distance from the lens of the imaging device 2 is plotted at the pixel position located in the y-axis direction (where the position in the x-axis direction is x2) calculated by the directional distance image creating means 225.

この場合、図13に示すように、座標(x2、y2)には、x軸方向距離画像作成手段223により算出された撮像装置2のレンズからの距離と、y軸方向距離画像作成手段225により算出された撮像装置2のレンズからの距離がプロットされる。
そこで、距離平均値算出手段226は、x軸方向距離画像作成手段223により算出された撮像装置2のレンズからの距離とy軸方向距離画像作成手段225により算出された撮像装置2のレンズからの距離の平均値を算出し、その距離の平均値を、座標(x2、y2)にプロットする。
In this case, as shown in FIG. 13, the coordinates (x2, y2) include the distance from the lens of the imaging device 2 calculated by the x-axis direction distance image creation unit 223 and the y-axis direction distance image creation unit 225. The calculated distance from the lens of the imaging device 2 is plotted.
Therefore, the distance average value calculation unit 226 calculates the distance from the lens of the imaging device 2 calculated by the x-axis direction distance image creation unit 223 and the distance from the lens of the imaging device 2 calculated by the y-axis direction distance image creation unit 225. The average value of the distance is calculated, and the average value of the distance is plotted on the coordinates (x2, y2).

なお、図13の例では、(y軸方向の位置をy2とする)x軸方向に位置する画素位置における、撮像装置2のレンズからの距離と(x軸方向の位置をx2とする)y軸方向に位置する画素位置における、撮像装置2のレンズからの距離しか、プロットしていないが、実際には、y軸方向のy0からy5、またx軸方向のx0からx5まで所定の間隔で、撮像装置2のレンズからの距離をプロットすることから、全ての画素位置に関して、撮像装置2のレンズからの距離として、2つのデータがプロットされる。
距離平均値算出手段226は、その2つのデータがプロットされた、全ての画素位置に関して、2つの距離の平均値を算出し、その距離の平均値を、各々の画素位置にプロットする。
In the example of FIG. 13, the distance from the lens of the imaging device 2 at the pixel position located in the x-axis direction (the position in the y-axis direction is y2) and y (the position in the x-axis direction is x2) Only the distance from the lens of the imaging device 2 at the pixel position located in the axial direction is plotted, but actually, y0 to y5 in the y-axis direction and x0 to x5 in the x-axis direction at predetermined intervals. Since the distance from the lens of the imaging device 2 is plotted, two data are plotted as the distance from the lens of the imaging device 2 for all pixel positions.
The distance average value calculation means 226 calculates the average value of the two distances for all the pixel positions where the two data are plotted, and plots the average value of the distances at each pixel position.

距離平均値算出手段226による算出処理は、各画素位置において平均値を算出する処理であることから、各画素位置に、撮像装置2のレンズからの距離として、2つ以上のデータがプロットされていることを前提に実行される。したがって、各画素位置に、撮像装置2のレンズからの距離として、2つ以上のデータがプロットされていない場合には、距離平均値算出手段226による算出処理を省略することができる。
また、各画素位置にプロットされるデータ(即ち、撮像装置2のレンズからの距離)の数が多ければ、距離平均値算出手段226により算出される平均値は、撮像装置2のレンズからの距離として、より精度の高い値となる。
Since the calculation process by the distance average value calculation unit 226 is a process of calculating an average value at each pixel position, two or more data are plotted as the distance from the lens of the imaging device 2 at each pixel position. It is executed on the assumption that Therefore, when two or more data are not plotted as the distance from the lens of the imaging device 2 at each pixel position, the calculation process by the distance average value calculation unit 226 can be omitted.
Further, if the number of data plotted at each pixel position (that is, the distance from the lens of the imaging device 2) is large, the average value calculated by the distance average value calculating unit 226 is the distance from the lens of the imaging device 2. As a result, the value becomes more accurate.

距離画像作成手段227は、距離平均値算出手段226により算出され、各画素位置にプロットされた、撮像装置2のレンズからの距離の平均値に基づいて、距離画像を作成する。
図14に、距離画像作成手段227により作成された距離画像を示す。図14に示す距離画像では、撮像された物体に関して、撮像装置2のレンズからの距離に応じて濃度を調整して表示しており、撮像装置2のレンズからの距離が近くなるにつれて濃度を濃くして表示する。
The distance image creating unit 227 creates a distance image based on the average value of the distance from the lens of the imaging device 2 calculated by the distance average value calculating unit 226 and plotted at each pixel position.
FIG. 14 shows a distance image created by the distance image creating means 227. In the distance image shown in FIG. 14, the density of the imaged object is displayed in accordance with the distance from the lens of the imaging device 2, and the density increases as the distance from the lens of the imaging device 2 decreases. And display.

図14に示すように、撮像装置2の撮像方向に対して前側に位置する物体Pは濃く表示され、後側に位置する物体Qは物体Pに比べて薄く表示される。
このように、2つの物体(即ち、物体P及びQ)が撮像画像において重なっている場合であっても、それぞれの物体を別々に認識することができる。さらに、物体に塗り潰される色の濃淡により、2つの物体の前後関係も認識することができる。
As shown in FIG. 14, the object P positioned on the front side with respect to the imaging direction of the imaging apparatus 2 is displayed darker, and the object Q positioned on the rear side is displayed lighter than the object P.
As described above, even when two objects (that is, the objects P and Q) overlap in the captured image, each object can be recognized separately. Furthermore, the context of two objects can also be recognized based on the shades of colors painted on the objects.

図15は、図6における距離画像生成手段22の処理手順を示すフロー図である。
距離画像生成手段22は、ボケ量推定手段21により推定されたボケ量をRAM15より読み込むと、ボケ量推定画像作成手段221によりボケ量推定画像を作成する(ステップS21)。
FIG. 15 is a flowchart showing the processing procedure of the distance image generating means 22 in FIG.
When the distance image generation unit 22 reads the blur amount estimated by the blur amount estimation unit 21 from the RAM 15, the blur amount estimation image generation unit 221 generates a blur amount estimation image (step S21).

ボケ量推定画像作成手段221によりボケ量推定画像が作成されると(ステップS21)、距離画像生成手段22は、x軸方向ボケ量走査手段222によりボケ量推定画像をx軸方向に走査し、x軸方向のボケ量走査データを作成する(ステップS22)(図8)。
次に、x軸方向距離画像作成手段223は、ボケ量/距離テーブルを参照することでx軸方向の撮像装置2のレンズから物体までの距離を算出し(ステップS23)、x軸方向の距離画像を作成する(ステップS24)(図10)。
When the blur amount estimation image is generated by the blur amount estimation image generation unit 221 (step S21), the distance image generation unit 22 scans the blur amount estimation image in the x axis direction by the x axis direction blur amount scanning unit 222. The blur amount scan data in the x-axis direction is created (step S22) (FIG. 8).
Next, the x-axis direction distance image creation means 223 calculates the distance from the lens of the imaging device 2 in the x-axis direction to the object by referring to the blur amount / distance table (step S23), and the distance in the x-axis direction. An image is created (step S24) (FIG. 10).

距離画像生成手段22は、次に、y軸方向ボケ量走査手段224によりボケ量推定画像をy軸方向に走査し、y軸方向のボケ量走査データを作成する(ステップS25)(図11)。
距離画像生成手段22は、次に、y軸方向距離画像作成手段225により、ボケ量/距離テーブルを参照することでy軸方向の撮像装置2のレンズから物体までの距離を算出し(ステップS26)、y軸方向の距離画像を作成する(ステップS27)(図12)。
Next, the distance image generation unit 22 scans the blur amount estimation image in the y-axis direction by the y-axis direction blur amount scanning unit 224 to generate blur amount scan data in the y-axis direction (step S25) (FIG. 11). .
Next, the distance image generation means 22 calculates the distance from the lens of the imaging device 2 in the y-axis direction to the object by referring to the blur amount / distance table by the y-axis direction distance image creation means 225 (step S26). ), A distance image in the y-axis direction is created (step S27) (FIG. 12).

x軸方向及びy軸方向の距離画像を作成すると(ステップS24、ステップ27)、距離画像生成手段22は、距離平均値算出手段226により、各々の画素位置における、撮像装置2のレンズから物体までの距離の平均値を算出する(ステップS28)。
距離画像生成手段22は、次に、距離画像作成手段227により、算出された距離の平均値から距離画像を作成する(ステップS29)。
When the distance images in the x-axis direction and the y-axis direction are created (steps S24 and step 27), the distance image generation unit 22 causes the distance average value calculation unit 226 to move from the lens of the imaging device 2 to the object at each pixel position. The average value of the distances is calculated (step S28).
Next, the distance image generation means 22 creates a distance image from the average value of the distances calculated by the distance image creation means 227 (step S29).

以上、説明したように、本発明の実施形態に係る画像形成装置によれば、撮像された画像において、物体同士が重なって撮像された場合であっても、画像処理の負荷を前記従来の方法よりも低減した上で、距離画像を生成して各々の物体を別々に認識することができ、さらに撮像方向に対する、各々の物体の前後関係も併せて認識することができる。
また、物体同士が接近して並んで撮像された場合であっても、各々の物体を別々に認識することができる。
As described above, according to the image forming apparatus according to the embodiment of the present invention, even in the case where the captured images are captured by overlapping each other, the load of the image processing is reduced. In addition, the distance image can be generated and each object can be recognized separately, and the front-rear relationship of each object with respect to the imaging direction can also be recognized.
Moreover, even when objects are imaged in close proximity to each other, each object can be recognized separately.

21…ボケ量推定手段、211…画像取得手段、212…モノクロ変換手段、213…ノイズ除去手段、214…エッジベクトル算出手段、215…エッジ判定手段、216…輝度差算出手段、217…ボケ量算出手段、22…距離画像生成手段、221…ボケ量推定画像作成手段、222…x軸方向ボケ量走査手段、223…x軸方向距離画像作成手段、224…y軸方向ボケ量走査手段、225…y軸方向距離画像作成手段、226…距離平均値算出手段、227…距離画像作成手段。   21: blur amount estimation means 211: image acquisition means 212: monochrome conversion means 213: noise removal means 214: edge vector calculation means 215: edge determination means 216: luminance difference calculation means 217: blur amount calculation Means 22 ... Distance image generating means 221 ... Blur amount estimated image creating means 222 ... X-axis direction blur amount scanning means 223 ... X-axis direction distance image creating means 224 ... Y-axis direction blur amount scanning means 225 ... y-axis direction distance image creating means, 226... distance average value calculating means, 227.

Claims (5)

物体を撮像した撮像装置からの画像を取得する画像取得手段と、
前記画像取得手段により取得した画像のエッジを抽出するエッジ抽出手段と、
前記エッジ抽出手段により抽出されたエッジを含む所定領域内における画素の輝度差に基づいて、前記エッジのボケ量を算出するボケ量算出手段と、
前記ボケ量算出手段により算出されたボケ量を前記画像の前記エッジの各画素位置に割り当てるボケ量割り当て手段と、
前記ボケ量割り当て手段によりボケ量が割り当てられた前記エッジの画素に対して、所定の方向に走査し、走査方向にあるエッジとエッジの間に位置する各画素に、ボケ量の小さい方のエッジのボケ量を割り当てるボケ量走査手段と、
前記ボケ量走査手段により割り当てられたボケ量と、前記撮像装置からの画像のボケ量と前記撮像装置から被写体までの距離との相関情報とに基づいて、各画素位置における、前記撮像装置から前記物体までの距離を算出する距離算出手段と、
前記距離算出手段により算出された各画素位置における、前記撮像装置から前記物体までの距離に基づき、距離画像を生成する距離画像生成手段と、
を有することを特徴とする画像処理装置。
Image acquisition means for acquiring an image from an imaging device that images the object;
Edge extraction means for extracting an edge of the image acquired by the image acquisition means;
A blur amount calculating unit that calculates a blur amount of the edge based on a luminance difference of pixels in a predetermined region including the edge extracted by the edge extracting unit;
A blur amount assigning unit that assigns the blur amount calculated by the blur amount calculating unit to each pixel position of the edge of the image;
The edge pixel to which the blur amount is assigned by the blur amount assigning unit is scanned in a predetermined direction, and each pixel located between the edges in the scanning direction has an edge with the smaller blur amount. A blur amount scanning means for allocating a blur amount of
Based on the blur amount allocated by the blur amount scanning unit and the correlation information between the blur amount of the image from the imaging device and the distance from the imaging device to the subject, from the imaging device at each pixel position, Distance calculating means for calculating the distance to the object;
Distance image generation means for generating a distance image based on the distance from the imaging device to the object at each pixel position calculated by the distance calculation means;
An image processing apparatus comprising:
請求項1に記載された画像処理装置において、
前記ボケ量算出手段は、前記エッジ抽出手段により抽出されたエッジを含む所定領域内における、前記エッジの画素を挟んでその両側に位置する画素の輝度差に基づいて、前記エッジのボケ量を算出することを特徴とする画像処理装置。
The image processing apparatus according to claim 1,
The blur amount calculating unit calculates the blur amount of the edge based on a luminance difference between pixels located on both sides of the edge pixel in a predetermined region including the edge extracted by the edge extracting unit. An image processing apparatus.
請求項1又は2に記載された画像処理装置において、
前記ボケ量走査手段が、互いに平行な複数の走査線により第1の走査方向で走査し、さらに前記第1の走査方向と所定の角度で交わる第2の走査方向の互いに平行な複数の走査線に沿って走査することを特徴とする画像処理装置。
In the image processing apparatus according to claim 1 or 2,
The blur amount scanning means scans in a first scanning direction by a plurality of scanning lines parallel to each other, and further a plurality of scanning lines parallel to each other in a second scanning direction intersecting the first scanning direction at a predetermined angle. And an image processing apparatus.
請求項3に記載された画像処理装置において、
前記所定の角度が直角であることを特徴とする画像処理装置。
The image processing apparatus according to claim 3,
The image processing apparatus characterized in that the predetermined angle is a right angle.
請求項3に記載された画像処理装置において、
前記距離算出手段により、走査方向の数に応じて算出された前記撮像装置から前記物体までの距離に基づき、前記距離を特定することを特徴とする画像処理装置。
The image processing apparatus according to claim 3,
An image processing apparatus characterized in that the distance is specified based on a distance from the imaging apparatus to the object calculated according to the number of scanning directions by the distance calculation means.
JP2014139965A 2014-07-07 2014-07-07 Image processing device Active JP6327024B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014139965A JP6327024B2 (en) 2014-07-07 2014-07-07 Image processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014139965A JP6327024B2 (en) 2014-07-07 2014-07-07 Image processing device

Publications (2)

Publication Number Publication Date
JP2016018340A true JP2016018340A (en) 2016-02-01
JP6327024B2 JP6327024B2 (en) 2018-05-23

Family

ID=55233533

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014139965A Active JP6327024B2 (en) 2014-07-07 2014-07-07 Image processing device

Country Status (1)

Country Link
JP (1) JP6327024B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101825218B1 (en) * 2016-04-08 2018-02-02 한국과학기술원 Apparatus and method for generaing depth information
KR101921608B1 (en) 2018-01-29 2018-11-26 한국과학기술원 Apparatus and method for generating depth information
JP2021009978A (en) * 2019-07-03 2021-01-28 株式会社Fuji Assembling machine

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010249794A (en) * 2009-03-26 2010-11-04 Kyocera Corp Object distance measuring device
JP2012073703A (en) * 2010-09-28 2012-04-12 Nippon Hoso Kyokai <Nhk> Image blur amount calculation device and program for the same
JP2013157674A (en) * 2012-01-26 2013-08-15 Canon Inc Imaging apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010249794A (en) * 2009-03-26 2010-11-04 Kyocera Corp Object distance measuring device
JP2012073703A (en) * 2010-09-28 2012-04-12 Nippon Hoso Kyokai <Nhk> Image blur amount calculation device and program for the same
JP2013157674A (en) * 2012-01-26 2013-08-15 Canon Inc Imaging apparatus

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101825218B1 (en) * 2016-04-08 2018-02-02 한국과학기술원 Apparatus and method for generaing depth information
KR101921608B1 (en) 2018-01-29 2018-11-26 한국과학기술원 Apparatus and method for generating depth information
JP2021009978A (en) * 2019-07-03 2021-01-28 株式会社Fuji Assembling machine
JP7313211B2 (en) 2019-07-03 2023-07-24 株式会社Fuji Assembly machine

Also Published As

Publication number Publication date
JP6327024B2 (en) 2018-05-23

Similar Documents

Publication Publication Date Title
US8405742B2 (en) Processing images having different focus
KR20110106070A (en) Apparatus and method for extracting light and texture, and rendering apparatus using light and texture
US10181202B2 (en) Control apparatus, robot, and control method
JP5939962B2 (en) Image processing apparatus, image processing method, and computer program
JP6327024B2 (en) Image processing device
JP2010117593A (en) Device for acquiring distance information, imaging apparatus, and program
EP2939586A1 (en) Image processing device, program and image processing method
KR102255148B1 (en) Image processing apparatus, image processing method, storage medium, and program
JP2014206388A (en) Imaging device, image process device and image process method
US9270883B2 (en) Image processing apparatus, image pickup apparatus, image pickup system, image processing method, and non-transitory computer-readable storage medium
JP6273921B2 (en) Image processing device
JP2007322259A (en) Edge detecting method, apparatus and program
JP6358084B2 (en) Image processing device
JP5369729B2 (en) Image processing apparatus, imaging apparatus, and program
JP2014182637A (en) Image processor, image processing method and image processing program
JP2018018425A (en) Image processing device and image processing method
JP2017084302A (en) Iris position detection device, electronic apparatus, program, and iris position detection method
JP6340837B2 (en) Image processing device
JP6867766B2 (en) Information processing device and its control method, program
JP6369058B2 (en) Image processing device
JP2018171516A (en) Image processing method, diagnosis device, and program
KR101619776B1 (en) RGB deblurring method using IR information at depth map system using 4 color sensor
JP6595858B2 (en) Image processing apparatus and image processing method
JP2017117038A (en) Road surface estimation device
JP2017017551A (en) Image processing device and image processing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170419

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20180320

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20180402

R150 Certificate of patent or registration of utility model

Ref document number: 6327024

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150