JP2005332382A - Image processing method, device and program - Google Patents

Image processing method, device and program Download PDF

Info

Publication number
JP2005332382A
JP2005332382A JP2005124221A JP2005124221A JP2005332382A JP 2005332382 A JP2005332382 A JP 2005332382A JP 2005124221 A JP2005124221 A JP 2005124221A JP 2005124221 A JP2005124221 A JP 2005124221A JP 2005332382 A JP2005332382 A JP 2005332382A
Authority
JP
Japan
Prior art keywords
image
blur
unit
edge
information
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
JP2005124221A
Other languages
Japanese (ja)
Inventor
Yoshiro Kitamura
嘉郎 北村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujifilm Holdings Corp
Original Assignee
Fuji Photo Film Co Ltd
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 Fuji Photo Film Co Ltd filed Critical Fuji Photo Film Co Ltd
Priority to JP2005124221A priority Critical patent/JP2005332382A/en
Publication of JP2005332382A publication Critical patent/JP2005332382A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To enable blur information in an image to be properly acquired. <P>SOLUTION: A blur analysis means 200 calculates a direction and a degree of blurring using a pupil image D5 of an image D0 captured by a pupil detection means 100, and determines whether the image D0 is a blurred image or a normal image. To the image D0 which has been determined as a blurred image, the analysis means calculates the degree of blurring and the blurring width from the pupil image D5, and outputs the degree of blurring, the blurring width, the blurring direction, and the degree of blurring determined from the pupil image D5 to the blur correction means 230 as blur information Q of the image D0. The blur correction means 230 executes correction to the blurred image D0 from the blur information Q, and obtains a corrected image D'. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明はデジタル写真画像のボケ情報を取得する画像処理方法および装置並びにそのためのプログラムに関するものである。   The present invention relates to an image processing method and apparatus for acquiring blur information of a digital photographic image, and a program therefor.

ネガフィルムやリバーサルフィルムなどの写真フィルムに記録された写真画像をスキャナーなどの読取装置で光電的に読み取って得たデジタル写真画像や、デジタルスチルカメラ(DSC)で撮像して得たデジタル写真画像などに対して、種々の画像処理を施してプリントすることが行われている。これらの画像処理の一つとして、ボケた画像(ボケ画像)からボケを取り除くボケ画像修復処理が挙げられる。   Digital photographic images obtained by photoelectrically reading photographic images recorded on photographic films such as negative films and reversal films with a reading device such as a scanner, and digital photographic images obtained by taking images with a digital still camera (DSC), etc. On the other hand, printing is performed by performing various image processing. As one of these image processes, there is a blurred image restoration process that removes a blur from a blurred image (blurred image).

被写体を撮像して得た写真画像がぼけてしまう理由としては、焦点距離が合わないことに起因するピンボケと、撮像者の手のぶれに起因するぶれボケ(以下略してぶれという)が挙げられる。ピンボケの場合には、点像が2次元的に広がり、すなわち写真画像上における広がりが無方向性を呈することに対して、ぶれの場合には、点像がある軌跡を描き画像上に1次元的に広がり、すなわち写真画像上における広がりがある方向性を呈する。   Reasons for blurring a photographic image obtained by capturing an image of a subject include out-of-focus due to the focal length being out of focus, and out-of-focus blur due to camera shake (hereinafter referred to as blurring). . In the case of out-of-focus, the point image spreads two-dimensionally, that is, the spread on the photographic image exhibits non-directionality, whereas in the case of blur, a locus with a point image is drawn on the image one-dimensionally. Spreads, that is, has a direction with a spread on a photographic image.

デジタル写真画像の分野において、従来、ボケ画像を修復するために、様々な方法が提案されている。写真画像の撮像時にぶれの方向やぶれ幅などの情報が分かれば、Wienerフィルタや逆フィルタなどの復元フィルタを写真画像に適用することにより修復ができることから、撮像時にぶれの方向やぶれ幅などの情報を取得することができる装置(例えば加速度センサー)を撮像装置に設け、撮像と共にぶれの方向やぶれ幅などの情報を取得し、取得された情報に基づいて修復を図る方法が広く知られている(例えば、特許文献1参照)。   In the field of digital photographic images, various methods have been conventionally proposed for restoring blurred images. If you know information such as blur direction and blur width when capturing a photographic image, you can restore it by applying a restoration filter such as a Wiener filter or inverse filter to the photographic image. There is widely known a method of providing an apparatus (for example, an acceleration sensor) that can be acquired in an imaging apparatus, acquiring information such as a blur direction and a blur width together with imaging, and performing repair based on the acquired information (for example, , See Patent Document 1).

また、ボケ画像(ボケがある画像)に対して劣化関数を設定し、設定された劣化関数に対応する復元フィルタでボケ画像を修復し、修復後の画像を評価し、評価の結果に基づいて劣化関数を再設定するようにして、所望の画質になるまで、修復、評価、劣化関数の再設定を繰り返すことによって修復を図る方法も知られている。この方法は、劣化関数の設定、修復、評価、劣化関数の再設定・・・の処理を繰り返す必要があるため、処理時間がかかるという問題がある。特許文献2には、ユーザにボケ画像中の縁部を含む小さな領域を指定させ、ボケ画像全体の代わりに、指定されたこの小さな領域に対して、前述の劣化関数の設定、修復、評価、劣化関数の再設定・・・の処理を繰り返して最適な劣化関数を求め、この劣化関数に対応した復元フィルタをボケ画像全体に適用し、劣化関数を求めるのに使用する画像を前述の小領域の画像にすることによって演算量を減らし、効率向上を図る方法が提案されている。   Also, a degradation function is set for the blurred image (image with blur), the blurred image is repaired with a restoration filter corresponding to the set degradation function, the restored image is evaluated, and the evaluation result is evaluated. A method is also known in which the deterioration function is reset, and repair is performed by repeating the repair, evaluation, and resetting of the deterioration function until a desired image quality is obtained. This method has a problem that it takes processing time because it is necessary to repeat the process of setting, repairing, evaluating the deterioration function, resetting the deterioration function, and so on. In Patent Document 2, the user specifies a small area including an edge in a blurred image, and instead of the entire blurred image, the above-described degradation function is set, repaired, evaluated, and the specified small area. Repeat the process of resetting the degradation function to find the optimal degradation function, apply the restoration filter corresponding to this degradation function to the entire blurred image, and use the above-mentioned small area for the image used to obtain the degradation function A method has been proposed in which the amount of calculation is reduced and the efficiency is improved by using this image.

一方、携帯電話の急激な普及に伴って、携帯電話機の機能が向上し、その中でも携帯電話付属のデジタルカメラ(以下略した携帯カメラという)の機能の向上が注目を浴びている。近年、携帯カメラの画素数が100万の桁に上がり、携帯カメラが通常のデジタルカメラと同様な使い方がされている。友達同士で旅行に行く時の記念写真などは勿論、好きなタレント、スポーツ選手を携帯カメラで撮像する光景が日常的になっている。このような背景において、携帯カメラにより撮像して得た写真画像は、携帯電話機のモニタで鑑賞することに留まらず、例えば、通常のデジタルカメラにより取得した写真画像と同じようにプリントすることも多くなっている。   On the other hand, with the rapid spread of mobile phones, the functions of mobile phones have improved, and among them, the improvement of the functions of digital cameras attached to mobile phones (hereinafter referred to as mobile cameras) has been attracting attention. In recent years, the number of pixels of a portable camera has increased to one million, and the portable camera is used in the same way as a normal digital camera. Of course, commemorative photos when traveling with friends, as well as scenes of picking up favorite talents and athletes with a portable camera, are becoming commonplace. In such a background, a photographic image obtained by capturing with a mobile camera is not limited to being viewed on a monitor of a mobile phone, and for example, is often printed in the same manner as a photographic image acquired with a normal digital camera. It has become.

他方、携帯カメラは、人間工学的に、本体(携帯電話機)が撮像専用に製造されていないため、撮像時のホールド性が悪いという問題がある。また、携帯カメラは、フラッシュがないため、通常のデジタルカメラよりシャッタースピードが遅い。このような理由から携帯カメラにより被写体を撮像するときに、通常のカメラより手ぶれが起きやすい。極端な手ぶれは、携帯カメラのモニタで確認することができるが、小さな手ぶれは、モニタで確認することができず、プリントして初めて画像のぶれに気付くことが多いため、携帯カメラにより撮像して得た写真画像に対してぶれの補正を施す必要性が高い。   On the other hand, since the main body (mobile phone) is not manufactured exclusively for imaging, the portable camera has a problem of poor holdability during imaging. Moreover, since a portable camera does not have a flash, the shutter speed is slower than that of a normal digital camera. For these reasons, camera shake is more likely to occur when shooting a subject with a portable camera than with a normal camera. Extreme camera shake can be confirmed on the monitor of the portable camera, but small camera shake cannot be confirmed on the monitor, and often you will notice image blur for the first time after printing. There is a high need to perform blur correction on the obtained photographic image.

また、前述したように、ボケは画像中の点像の広がりを引き起こすため、ボケ画像には、点像の広がりに応じたエッジの広がりが生じる。すなわち、画像中におけるエッジの広がりの態様は画像中におけるボケと直接関係するものである。この点に着目して、画像データを用いて、画像中におけるエッジの態様を解析することによって画像中のボケに関する情報、例えばボケ方向、ボケ幅などを得る方法が考えられる。
特開2002−112099号公報 特開平7−121703号公報
Further, as described above, the blur causes the spread of the point image in the image, and therefore, the blur image has an edge spread corresponding to the spread of the point image. That is, the manner of edge spreading in the image is directly related to the blur in the image. By paying attention to this point, a method of obtaining information relating to blur in the image, for example, blur direction, blur width, etc., by analyzing the aspect of the edge in the image using image data can be considered.
Japanese Patent Laid-Open No. 2002-112099 JP-A-7-121703

しかしながら、携帯電話機の小型化は、その性能、コストに並び、各携帯電話機メーカの競争の焦点の1つであり、携帯電話機付属のカメラに、ぶれの方向やぶれ幅を取得する装置を設けることが現実的ではないため、特許文献1に提案されたような方法は、携帯カメラに適用することができない。   However, downsizing of mobile phones is one of the focus of competition among mobile phone manufacturers, along with their performance and cost, and a camera attached to a mobile phone is provided with a device that acquires the direction and width of blur. Since it is not realistic, the method proposed in Patent Document 1 cannot be applied to a portable camera.

また、特許文献2に提案された方法は、また、特許文献2に提案されたような方法は、劣化関数の設定、修復、評価、劣化関数の再設定・・・の処理を繰り返す必要があるため、処理時間がかかり、効率が良くないという問題がある。   In addition, the method proposed in Patent Document 2 and the method proposed in Patent Document 2 need to repeat the process of setting, repairing, evaluating, and resetting the deterioration function. Therefore, there is a problem that processing time is required and efficiency is not good.

また、画像中におけるエッジの態様を解析することによって画像中のボケに関する情報を得る方法は、画像の一部にグラデーションがかかったような不鮮明なエッジが存在する場合、正しい解析結果が得られないという虞がある。   In addition, the method for obtaining information about blur in an image by analyzing the state of the edge in the image cannot obtain a correct analysis result when there is a blurred edge such as a gradation in a part of the image. There is a fear.

本発明は、上記事情に鑑み、特別な装置を撮像装置に設けることを必要としないと共に、グラデーションがかかった部分があるデジタル写真画像に対してもボケの正しい情報を得るができ、ひいては良い補正効果を得ることを可能とする画像処理方法および装置並びにそのためのプログラムを提供することを目的とするものである。   In view of the above circumstances, the present invention does not require a special device to be provided in the image pickup device, and can obtain correct blur information even with respect to a digital photographic image having a gradation portion. An object of the present invention is to provide an image processing method and apparatus capable of obtaining an effect, and a program therefor.

本発明の画像処理方法は、デジタル写真画像におけるボケの態様を示すボケ情報を得る画像処理方法において、
前記デジタル写真画像から、点状部を検出し、
該点状部の画像のデータを用いて前記デジタル写真画像の前記ボケ情報を求めることを特徴とするものである。
The image processing method of the present invention is an image processing method for obtaining blur information indicating a blur mode in a digital photographic image.
From the digital photographic image, a point-like portion is detected,
The blur information of the digital photographic image is obtained using data of the image of the dot-like portion.

ここで、点状部の画像のデータを用いて前記ボケ情報を求めることは、例えば前記点状部の画像のデータを用いて該点状部の画像におけるエッジの態様を解析することとすることができる。   Here, obtaining the blur information using the image data of the point-like portion is, for example, analyzing the state of the edge in the image of the point-like portion using the data of the image of the point-like portion. Can do.

また、前記点状部としては、前記デジタル写真画像が人物の写真画像である場合、前記人物の瞳を用いることが好ましい。また、瞳でなくても、はっきりした顔輪郭を点状部とすることもできる。顔輪郭は点ではないが、本明細書では点状部の一種とみなすこととする。   Further, as the point-like portion, it is preferable to use a pupil of the person when the digital photograph image is a photograph image of a person. Moreover, even if it is not a pupil, a clear face outline can also be made into a dotted | punctate part. Although the face outline is not a point, it is considered as a kind of point-like part in this specification.

また、「ボケ情報」は、デジタル写真画像におけるボケの態様を表すことができる情報を意味し、例えばボケの方向に関するボケ方向情報とボケ幅とすることができる。「ボケ」は、無方向性のボケすなわちピンボケと、有方向性のボケすなわちぶれがあり、ぶれの場合は、ボケ方向がぶれ方向に相当し、ピンボケの場合において、その「ボケ方向」は「無方向」とすることができる。また、「ボケ幅」とは、ボケ方向におけるボケの幅を意味し、例えば、ボケ方向におけるエッジのエッジ幅の平均値とすることができる。また、ボケが無方向性のピンボケの場合において、任意の1つの方向におけるエッジのエッジ幅をボケ幅としてもよいが、画像全体におけるエッジのエッジ幅の平均値としてもよい。   The “blurring information” means information that can represent a blur mode in a digital photographic image, and can be, for example, blur direction information and a blur width regarding a blur direction. “Bokeh” includes non-directional blur, that is, out-of-focus blur and directional blur, ie, blur. In the case of blur, the blur direction corresponds to the blur direction. In the case of blur, the “blurring direction” is “ It can be “no direction”. The “blurring width” means a blur width in the blur direction, and can be, for example, an average value of the edge widths of the edges in the blur direction. Further, in the case where the blur is non-directional out-of-focus, the edge width of the edge in any one direction may be the blur width, or may be the average value of the edge width of the edge in the entire image.

さらに、本発明におけるデジタル写真画像は、ボケ画像に限らず、ピンボケもぶれもない通常画像もあり、このような通常画像は、無ボケ、例えば「所定の閾値以下の」ボケ幅とからなるボケ情報を有することとすることができる。   Furthermore, the digital photographic image in the present invention is not limited to a blurred image, and may be a normal image that is not out of focus or blurred. Such a normal image has no blur, for example, a blur having a blur width that is “a predetermined threshold value or less”. It can have information.

本発明の画像処理方法は、検出された点状部の画像のデータを用いてボケ情報の全ての要素を求めるようにしてもよいが、前記デジタル写真画像におけるボケがぶれである場合(この場合、前記ボケ方向情報としては、前記ボケが無方向性のピンボケと有方向性のぶれのうちのぶれであることと、該ぶれの方向とを示すぶれ方向情報となる)、前記点状部の画像のデータを用いて前記ぶれ方向情報を取得する一方、ぶれ方向情報以外の他のボケ情報(例えばボケ幅)については、前記ぶれ方向情報に基づいて、前記デジタル写真画像全体のデータを用いて求めることが好ましい。   In the image processing method of the present invention, all elements of the blur information may be obtained using the detected image data of the dot-like portion, but the blur in the digital photograph image is in this case (in this case) The blur direction information includes blur direction information indicating that the blur is a blur of a non-directional blur and a directional blur, and the blur direction). While the blur direction information is acquired using image data, blur information other than the blur direction information (for example, blur width) is obtained using data of the entire digital photographic image based on the blur direction information. It is preferable to obtain.

前記点状部の画像に対して、複数の異なる方向毎にエッジを検出し、
各前記方向における前記エッジの特徴量を取得し、
該各方向における前記特徴量に基づいて前記ボケ方向情報を取得することができる。
Detecting an edge for each of a plurality of different directions with respect to the image of the dotted portion;
Obtaining feature values of the edge in each of the directions;
The blur direction information can be acquired based on the feature amount in each direction.

ここで、「エッジの特徴量」は、画像におけるエッジの広がりの態様と関係する特徴量を意味し、例えば、エッジの鮮鋭度、前記エッジの鮮鋭度の分布を含むものとすることができる。   Here, the “edge feature amount” means a feature amount related to an aspect of the edge spread in the image, and may include, for example, the edge sharpness and the edge sharpness distribution.

「エッジの鮮鋭度」は、エッジの鮮鋭さを現すことができるものであれば如何なるパラメータを用いてもよく、例えば、図22のエッジプロファイルにより示されるエッジの場合、エッジ幅が大きいほどエッジの鮮鋭度が低いように、エッジ幅をエッジの鮮鋭度として用いることは勿論、エッジの明度変化の鋭さ(図22におけるプロファイル曲線の勾配)が高いほどエッジの鮮鋭度が高いように、エッジのプロファイル曲線の勾配をエッジの鮮鋭度として用いるようにしてもよい。   As the “edge sharpness”, any parameter can be used as long as it can express the sharpness of the edge. For example, in the case of the edge shown by the edge profile in FIG. The edge profile is used so that the sharpness of the edge becomes higher as the sharpness of the brightness change of the edge (the gradient of the profile curve in FIG. 22) is higher, as well as the edge width is used as the sharpness of the edge so that the sharpness is low. The slope of the curve may be used as the edge sharpness.

また、前記「複数の異なる方向」とは、対象画像におけるボケの方向を特定するための方向を意味し、ボケの方向に近い方向を含むことが必要であるため、その数が多ければ多いほど特定の精度が高いが、処理速度との兼ね合いに応じた適宜な個数、例えば、図21に示すような8方向を用いることが好ましい。   Further, the “plurality of different directions” means directions for specifying the direction of the blur in the target image, and it is necessary to include directions close to the direction of the blur. Although the specific accuracy is high, it is preferable to use an appropriate number according to the balance with the processing speed, for example, eight directions as shown in FIG.

本発明の画像処理装置は、デジタル写真画像におけるボケの態様を示すボケ情報を得る画像処理装置において、
前記デジタル写真画像から、点状部を検出する点状部検出手段と、
該点状部の画像のデータを用いて前記デジタル写真画像の前記ボケ情報を求める解析手段とを有することを特徴とするものである。
An image processing apparatus of the present invention is an image processing apparatus that obtains blur information indicating a blur mode in a digital photographic image.
From the digital photographic image, point-like part detection means for detecting a point-like part,
And analyzing means for obtaining the blur information of the digital photographic image using data of the image of the dot-like portion.

また、人物の写真画像である前記デジタル写真画像に対して、前記点状部検出手段は、前記点状部として前記人物の瞳または顔輪郭を検出するものであることが好ましい。そのような検出を行う方法としては、後述の顔検出の技法を用いるほかに、乳がん検出などに利用されているもフォロジフィルタを適用することもできる。   Moreover, it is preferable that the said dotted | punctate part detection means detects the pupil or face outline of the said person as the said dotted | punctate part with respect to the said digital photograph image which is a person's photograph image. As a method for performing such detection, in addition to the face detection technique described later, a morphological filter that is used for breast cancer detection or the like can be applied.

また、前記ボケ情報は、前記ボケが無方向性のピンボケと有方向性のぶれとのいずれであると、ぶれの場合の該ぶれの方向とを示すぶれ方向情報を含むものであり、前記解析手段は、前記点状部の画像のデータを用いて前記ボケ方向情報を取得し、ぶれであることを示す前記ボケ方向情報に基づいて、前記デジタル写真画像全体のデータを用いて該ぶれ方向情報を除いた前記ボケ情報を求めるものであることが好ましい。   The blur information includes blur direction information indicating the blur direction in the case of blur when the blur is non-directional out-of-focus blur or directional blur, and the analysis The means acquires the blur direction information using the image data of the dot-like portion, and uses the data of the entire digital photographic image based on the blur direction information indicating blurring, the blur direction information It is preferable to obtain the blur information excluding.

前記解析手段は、前記点状部の画像に対して、複数の異なる方向毎にエッジを検出し、
各前記方向における前記エッジの特徴量を取得し、
該各方向における前記特徴量に基づいて前記ボケ方向情報を取得するものであることが好ましい。
The analysis means detects an edge for each of a plurality of different directions with respect to the image of the dotted portion,
Obtaining feature values of the edge in each of the directions;
The blur direction information is preferably acquired based on the feature amount in each direction.

また、本発明の画像処理装置は前記解析手段により前記ボケ情報を求めた後、前記デジタル画像を補正する補正手段をさらに備えたものとすることができる。そして、その補正手段は、補正する度合いを前記点状部が大きいほど大きくするものとすることができる。補正する度合いを前記点状部が大きいほど大きくするとは、必ず点状部の大きさすなわちボケすなわちぶれの大きさに応じて補正の度合いを変えることには限定されず、ぶれ幅が所定以上の大きさの場合にのみ補正するということも含むものである。具体的には、例えば顔幅等のサイズに対して10分の1以上のぶれ幅あるいは瞳のサイズ以上のぶれがぶれ解析によって検出されたときにのみ、補正を施すようにしてもよい。   The image processing apparatus according to the present invention may further include a correcting unit that corrects the digital image after obtaining the blur information by the analyzing unit. And the correction | amendment means shall enlarge the degree to correct | amend, so that the said point-like part is large. Increasing the degree of correction as the point-like portion is larger is not limited to changing the degree of correction according to the size of the point-like portion, i.e., blur or blur, and the blur width is not less than a predetermined value. It also includes correction only for the size. Specifically, for example, the correction may be performed only when a blur width of 1/10 or more of the size such as the face width or a blur of the pupil size or more is detected by the blur analysis.

本発明の画像処理方法による画像処理をコンピュータに実行させるプログラムとして提供するようにしてもよい。   You may make it provide as a program which makes a computer perform the image processing by the image processing method of this invention.

本発明の画像処理方法および装置並びにプログラムによれば、デジタル写真画像から点状部を検出し、検出された点状部の画像のデータを用いてデジタル写真画像のボケ情報を得るようにしているので、撮像装置に特別な装置を装着することを必要とせずにボケ情報を得ることができるようにすると共に、デジタル写真画像の一部にグラデーションがかかったとしても、正しいボケ情報を得ることができる。   According to the image processing method, apparatus, and program of the present invention, a point-like portion is detected from a digital photograph image, and blur information of the digital photograph image is obtained using data of the detected point-like portion image. Therefore, it is possible to obtain blur information without the necessity of attaching a special device to the imaging device, and to obtain correct blur information even if a gradation is applied to a part of a digital photo image. it can.

また、デジタル写真画像におけるボケがぶれである場合に対しては、点状部の画像のデータを用いてぶれ方向情報を求める一方、ぶれ方向情報以外のボケ情報、例えばボケ幅(ここではぶれ幅となる)については、例えば、デジタル写真画像全体に亘り、ぶれ方向情報により示されるぶれ方向におけるエッジの平均幅をぶれ幅とするように、点状部の画像データを用いて求められたぶれ方向情報に基づいてデジタル写真画像全体のデータから求めるようにすれば、正しいぶれ方向情報を得ることができると共に、ボケ幅など他のボケ情報を求める際のデータ量が多いため、他のボケ情報をより正確に求めることができる。   Also, in the case of blurring in a digital photographic image, the blur direction information is obtained using the image data of the dotted portion, while blur information other than the blur direction information, for example, blur width (here, blur width) is obtained. For example, for the entire digital photo image, the blur direction obtained using the image data of the dotted portions so that the average width of the edges in the blur direction indicated by the blur direction information is the blur width. If it is obtained from the data of the entire digital photographic image based on the information, correct blur direction information can be obtained, and the amount of data when obtaining other blur information such as a blur width is large. It can be obtained more accurately.

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

図1は、本発明の画像処理方法および装置並びにそのためのプログラムの第1の実施形態となる画像処理システムAの構成を示すブロック図である。本実施形態の画像処理システムAは、入力されたデジタル写真画像(以下略して画像という)に対してボケ補正処理を行ってプリントするものであり、そのボケ補正処理は、補助記憶装置に読み込まれたボケ補正処理プログラムをコンピュータ(たとえばパーソナルコンピュータ等)上で実行することにより実現される。また、このボケ補正処理プログラムは、CD−ROM等の情報記憶媒体に記憶され、もしくはインターネット等のネットワークを介して配布され、コンピュータにインストールされることになる。   FIG. 1 is a block diagram showing a configuration of an image processing system A which is a first embodiment of an image processing method and apparatus and a program therefor according to the present invention. The image processing system A according to the present embodiment prints an input digital photographic image (hereinafter referred to as an abbreviated image) by performing blur correction processing, and the blur correction processing is read into an auxiliary storage device. The blur correction processing program is executed on a computer (for example, a personal computer). The blur correction processing program is stored in an information storage medium such as a CD-ROM or distributed via a network such as the Internet and installed in a computer.

また、画像データは画像を表すものであるため、以下、特に画像と画像データの区別をせずに説明を行う。   Further, since the image data represents an image, the following description will be given without particularly distinguishing the image from the image data.

図1に示すように、本実施形態の画像処理システムAは、画像D0から瞳を検出して、瞳部分の画像(以下瞳画像という)D5を得る瞳検出手段100と、瞳画像D5または画像D0を用いて画像D0におけるボケの解析を行って、画像D0がボケ画像であるか否かの判別を行うと共に、ボケ画像ではない画像D0に対しては、ボケ画像ではないことを示す情報Pを後述する出力手段270に送信する一方、ボケ画像となる画像D0に対してはそのボケ情報Qを後述するボケ補正手段230に送信するボケ解析手段200と、ボケ解析手段200により得られたボケ情報Qに基づいてボケ画像である画像D0に対してボケ補正を行って補正済画像D’を得るボケ補正手段230と、ボケ補正手段230により得られた補正済画像D’またはボケ画像ではない画像D0をプリントアウトしてプリントを得る出力手段270とを有してなる。以下、画像処理システムAの各手段について説明する。   As shown in FIG. 1, the image processing system A according to the present embodiment detects a pupil from an image D0 and obtains an image (hereinafter referred to as “pupil image”) D5 of a pupil portion, and a pupil image D5 or image. D0 is used to analyze the blur in the image D0 to determine whether the image D0 is a blurred image, and for the image D0 that is not a blurred image, information P indicating that it is not a blurred image. Is output to the output unit 270 described later, and the blur analysis unit 200 that transmits the blur information Q to the blur correction unit 230 described below for the image D0 that is a blurred image, and the blur obtained by the blur analysis unit 200 A blur correction unit 230 that obtains a corrected image D ′ by performing blur correction on the image D0 that is a blur image based on the information Q, and a corrected image D ′ or a blur image obtained by the blur correction unit 230 Print out the image D0 not image becomes an output unit 270 to obtain a print. Hereinafter, each unit of the image processing system A will be described.

図2は、図1に示す画像処理システムAにおける瞳検出手段100の構成を示すブロック図である。図示のように、瞳検出手段100は、画像D0に顔部分が含まれているか否かを識別すると共に、顔部分が含まれていない場合には写真画像D0をそのまま後述する出力部50に出力する一方、顔部分が含まれている場合にはさらに左目と右目を検出し、両目の位置および両目間の距離dを含む情報Sを後述するトリミング部10および照合部40に出力する検出部1と、検出部1からの情報Sに基づいて、写真画像D0をトリミングして左目と右目とを夫々含むトリミング画像D1a、D1b(以下、区別して説明する必要がない場合には、両方を指す意味でD1という)を得るトリミング部10と、トリミング画像D1に対してグレー変換を行い、トリミング画像D1のグレースケール画像D2(D2a,D2b)を得るグレー変換部12と、グレースケール画像D2に対して前処理を行って前処理済み画像D3(D3a,D3b)を得る前処理部14と、前処理済み画像D3を2値化するための閾値Tを算出する2値化閾値算出部18を有し、該2値化閾値算出部18により得られた閾値Tを用いて前処理済み画像D3を2値化処理して2値画像D4(D4a,D4b)を得る2値化部20と、2値画像D4の各画素の座標を円環のハフ空間に投票し、投票された各投票位置の投票値を得ると共に、同じ円心座標を有する投票位置の統合投票値W(Wa,Wb)を算出する投票部35と、投票部35により得られた各統合投票値のうちの最も大きい統合投票値が対応する円心座標を中心位置候補G(Ga,Gb)とすると共に、後述する照合部40から次の中心位置候補を探すように指示されたとき、次の中心位置候補を求める中心位置候補取得部35と、中心位置候補取得部35により取得した中心位置候補は照合基準に満たしているか否かを判別し、照合基準に満たしていればこの中心位置候補を瞳の中心位置として後述する微調整部45に出力する一方、照合基準に満たしていなければ中心位置候補取得部35に中心位置候補を取得し直すことをさせると共に、中心位置候補取得部35により取得された中心位置候補が照合基準を満たすようになるまで中心位置候補取得部35に中心位置候補の取得し直しを繰り返させる照合部40と、照合部40から出力されてきた瞳の中心位置G(Ga,Gb)に対して微調整を行い、最終中心位置G’(G’a,G’b)を出力部50に出力する微調整部45と、最終中心位置G’に基づいて、中心位置G’aを囲む所定の範囲と、G’bを囲む所定の範囲を夫々切り出して瞳画像D5(D5a,D5b)を得、この瞳画像D5をボケ解析手段200に出力する出力部50とを有してなる。なお、画像D0が、顔部分が含まれない画像である場合には、出力部50は、画像D0をそのままボケ解析手段200に出力する。   FIG. 2 is a block diagram showing the configuration of the pupil detection means 100 in the image processing system A shown in FIG. As shown in the figure, the pupil detection means 100 identifies whether or not a face portion is included in the image D0, and outputs the photographic image D0 as it is to the output unit 50 described later when the face portion is not included. On the other hand, when the face portion is included, the left eye and the right eye are further detected, and the detection unit 1 that outputs information S including the positions of both eyes and the distance d between both eyes to the trimming unit 10 and the collation unit 40 described later. And trimmed images D1a and D1b that include the left eye and the right eye by trimming the photographic image D0 based on the information S from the detection unit 1 (hereinafter, meaning to indicate both when there is no need to distinguish between them) And a gray converting unit 1 that performs gray conversion on the trimmed image D1 to obtain a grayscale image D2 (D2a, D2b) of the trimmed image D1. A pre-processing unit 14 that performs pre-processing on the grayscale image D2 to obtain a pre-processed image D3 (D3a, D3b), and calculates a threshold T for binarizing the pre-processed image D3 2 A binarization threshold calculation unit 18 is provided, and the preprocessed image D3 is binarized using the threshold T obtained by the binarization threshold calculation unit 18 to obtain a binary image D4 (D4a, D4b). The binarization unit 20 and the coordinates of each pixel of the binary image D4 are voted to the Hough space of the ring to obtain the vote value of each voted position, and the integrated vote of the vote positions having the same circle center coordinates A voting unit 35 that calculates a value W (Wa, Wb), and a center position candidate G (Ga, Gb) corresponding to the center coordinates corresponding to the largest integrated voting value among the integrated voting values obtained by the voting unit 35 And searching for the next center position candidate from the collation unit 40 described later. The center position candidate acquisition unit 35 for obtaining the next center position candidate, and whether or not the center position candidate acquired by the center position candidate acquisition unit 35 satisfies the verification criterion. If the condition is satisfied, the center position candidate is output to the fine adjustment unit 45 described later as the center position of the pupil. On the other hand, if the matching reference is not satisfied, the center position candidate acquisition unit 35 is made to acquire the center position candidate again. The collation unit 40 that causes the center position candidate acquisition unit 35 to repeat acquisition of the center position candidate until the center position candidate acquired by the center position candidate acquisition unit 35 satisfies the collation criteria, and the output from the collation unit 40 Fine adjustment unit 45 that performs fine adjustment on the center position G (Ga, Gb) of the pupil and outputs the final center position G ′ (G′a, G′b) to the output unit 50; Based on the heart position G ′, a predetermined range surrounding the central position G′a and a predetermined range surrounding G′b are cut out to obtain a pupil image D5 (D5a, D5b), and this pupil image D5 is subjected to blur analysis. And an output unit 50 for outputting to the means 200. When the image D0 is an image that does not include a face portion, the output unit 50 outputs the image D0 to the blur analysis unit 200 as it is.

図3は、図2に示す瞳検出手段100における検出部1の詳細構成を示すブロック図である。図示のように、検出部1は、写真画像D0から特徴量C0を算出する特徴量算出部2と、後述する第1および第2の参照データE1,E2が格納されている記憶部4と、特徴量算出部2が算出した特徴量C0と記憶部4内の第1の参照データE1とに基づいて、写真画像D0に人物の顔が含まれているか否かを識別する第1の識別部5と、第1の識別部5により写真画像D0に顔が含まれていると識別された場合に、特徴量算出部2が算出した顔の画像内の特徴量C0と記憶部4内の第2の参照データE2とに基づいて、その顔に含まれる目の位置を識別する第2の識別部6と、並びに第1の出力部7とを備えてなる。   FIG. 3 is a block diagram showing a detailed configuration of the detection unit 1 in the pupil detection unit 100 shown in FIG. As illustrated, the detection unit 1 includes a feature amount calculation unit 2 that calculates a feature amount C0 from a photographic image D0, a storage unit 4 that stores first and second reference data E1 and E2 described later, A first identification unit for identifying whether or not a photographic image D0 includes a human face based on the feature amount C0 calculated by the feature amount calculation unit 2 and the first reference data E1 in the storage unit 4. 5 and when the first identification unit 5 identifies that the face is included in the photographic image D0, the feature amount C0 in the face image calculated by the feature amount calculation unit 2 and the first in the storage unit 4 On the basis of the second reference data E2, a second identification unit 6 for identifying the position of an eye included in the face and a first output unit 7 are provided.

なお、検出部1により識別される目の位置とは、顔における目尻から目頭の間の中心位置(図4中×で示す)であり、図4(a)に示すように真正面を向いた目の場合においては瞳の中心位置と同様であるが、図4(b)に示すように右を向いた目の場合は瞳の中心位置ではなく、瞳の中心から外れた位置または白目部分に位置する。   The eye position identified by the detection unit 1 is the center position (indicated by x in FIG. 4) between the corner of the face and the eye of the face, and the eye facing directly in front as shown in FIG. 4 is the same as the center position of the pupil. However, as shown in FIG. 4B, in the case of the eye facing right, it is not the center position of the pupil, but the position away from the center of the pupil or the white eye portion. To do.

特徴量算出部2は、顔の識別に用いる特徴量C0を写真画像D0から算出する。また、写真画像D0に顔が含まれると識別された場合には、後述するように抽出された顔の画像から同様の特徴量C0を算出する。具体的には、勾配ベクトル(すなわち写真画像D0上および顔画像上の各画素における濃度が変化する方向および変化の大きさ)を特徴量C0として算出する。以下、勾配ベクトルの算出について説明する。まず、特徴量算出部2は、写真画像D0に対して図5(a)に示す水平方向のエッジ検出フィルタによるフィルタリング処理を施して写真画像D0における水平方向のエッジを検出する。また、特徴量算出部2は、写真画像D0に対して図5(b)に示す垂直方向のエッジ検出フィルタによるフィルタリング処理を施して写真画像D0における垂直方向のエッジを検出する。そして、写真画像D0上の各画素における水平方向のエッジの大きさHおよび垂直方向のエッジの大きさVとから、図6に示すように、各画素における勾配ベクトルKを算出する。また、顔画像についても同様に勾配ベクトルKを算出する。なお、特徴量算出部2は、後述するように写真画像D0および顔画像の変形の各段階において特徴量C0を算出する。   The feature amount calculation unit 2 calculates a feature amount C0 used for face identification from the photograph image D0. When it is identified that the photograph image D0 includes a face, a similar feature amount C0 is calculated from the extracted face image as described later. Specifically, the gradient vector (that is, the direction in which the density of each pixel on the photographic image D0 and the face image changes and the magnitude of the change) is calculated as the feature amount C0. Hereinafter, calculation of the gradient vector will be described. First, the feature amount calculation unit 2 performs filtering processing on the photographic image D0 by the horizontal edge detection filter shown in FIG. 5A to detect horizontal edges in the photographic image D0. Further, the feature amount calculation unit 2 performs filtering processing by the vertical edge detection filter shown in FIG. 5B on the photographic image D0 to detect the vertical edge in the photographic image D0. Then, a gradient vector K at each pixel is calculated from the horizontal edge size H and the vertical edge size V at each pixel on the photographic image D0, as shown in FIG. Similarly, the gradient vector K is calculated for the face image. Note that the feature amount calculation unit 2 calculates a feature amount C0 at each stage of deformation of the photographic image D0 and the face image, as will be described later.

なお、このようにして算出された勾配ベクトルKは、図7(a)に示すような人物の顔の場合、図7(b)に示すように、目および口のように暗い部分においては目および口の中央を向き、鼻のように明るい部分においては鼻の位置から外側を向くものとなる。また、口よりも目の方が濃度の変化が大きいため、勾配ベクトルKは口よりも目の方が大きくなる。   It should be noted that the gradient vector K calculated in this way is an eye in a dark part such as the eyes and mouth as shown in FIG. 7B in the case of a human face as shown in FIG. It faces the center of the mouth and faces outward from the position of the nose in a bright part like the nose. Further, since the change in density is larger in the eyes than in the mouth, the gradient vector K is larger in the eyes than in the mouth.

そして、この勾配ベクトルKの方向および大きさを特徴量C0とする。なお、勾配ベクトルKの方向は、勾配ベクトルKの所定方向(例えば図6におけるx方向)を基準とした0から359度の値となる。   The direction and magnitude of the gradient vector K are defined as a feature amount C0. The direction of the gradient vector K is a value from 0 to 359 degrees with reference to a predetermined direction of the gradient vector K (for example, the x direction in FIG. 6).

ここで、勾配ベクトルKの大きさは正規化される。この正規化は、写真画像D0の全画素における勾配ベクトルKの大きさのヒストグラムを求め、その大きさの分布が写真画像D0の各画素が取り得る値(8ビットであれば0〜255)に均一に分布されるようにヒストグラムを平滑化して勾配ベクトルKの大きさを修正することにより行う。例えば、勾配ベクトルKの大きさが小さく、図8(a)に示すように勾配ベクトルKの大きさが小さい側に偏ってヒストグラムが分布している場合には、大きさが0〜255の全領域に亘るものとなるように勾配ベクトルKの大きさを正規化して図8(b)に示すようにヒストグラムが分布するようにする。なお、演算量を低減するために、図8(c)に示すように、勾配ベクトルKのヒストグラムにおける分布範囲を例えば5分割し、5分割された頻度分布が図8(d)に示すように0〜255の値を5分割した範囲に亘るものとなるように正規化することが好ましい。   Here, the magnitude of the gradient vector K is normalized. This normalization obtains a histogram of the magnitude of the gradient vector K in all pixels of the photographic image D0, and the distribution of the magnitudes is a value that each pixel of the photographic image D0 can take (0 to 255 if it is 8 bits). The histogram is smoothed so as to be uniformly distributed, and the magnitude of the gradient vector K is corrected. For example, when the gradient vector K is small and the histogram is distributed with the gradient vector K biased toward the small side as shown in FIG. The magnitude of the gradient vector K is normalized so that it extends over the region so that the histogram is distributed as shown in FIG. In order to reduce the calculation amount, as shown in FIG. 8C, the distribution range in the histogram of the gradient vector K is divided into, for example, five, and the frequency distribution divided into five is shown in FIG. 8D. It is preferable to normalize so that the value of 0 to 255 is in a range divided into five.

記憶部4内に格納されている第1および第2の参照データE1,E2は、後述するサンプル画像から選択された複数画素の組み合わせからなる複数種類の画素群のそれぞれについて、各画素群を構成する各画素における特徴量C0の組み合わせに対する識別条件を規定したものである。   The first and second reference data E1 and E2 stored in the storage unit 4 constitute each pixel group for each of a plurality of types of pixel groups composed of a combination of a plurality of pixels selected from a sample image to be described later. The identification condition for the combination of the feature amount C0 in each pixel is defined.

第1および第2の参照データE1,E2中の、各画素群を構成する各画素における特徴量C0の組み合わせおよび識別条件は、顔であることが分かっている複数のサンプル画像と顔でないことが分かっている複数のサンプル画像とからなるサンプル画像群の学習により、あらかじめ決められたものである。   In the first and second reference data E1 and E2, the combination and identification condition of the feature amount C0 in each pixel constituting each pixel group may not be a plurality of sample images and faces that are known to be faces. This is determined in advance by learning a sample image group including a plurality of known sample images.

なお、本実施形態においては、第1の参照データE1を生成する際には、顔であることが分かっているサンプル画像として、30×30画素サイズを有し、図9に示すように、1つの顔の画像について両目の中心間の距離が10画素、9画素および11画素であり、両目の中心間距離において垂直に立った顔を平面上±15度の範囲において3度単位で段階的に回転させた(すなわち、回転角度が−15度,−12度,−9度,−6度,−3度,0度,3度,6度,9度,12度,15度)サンプル画像を用いるものとする。したがって、1つの顔の画像につきサンプル画像は3×11=33通り用意される。なお、図9においては−15度、0度および+15度に回転させたサンプル画像のみを示す。また、回転の中心はサンプル画像の対角線の交点である。ここで、両目の中心間の距離が10画素のサンプル画像であれば、目の中心位置はすべて同一となっている。この目の中心位置をサンプル画像の左上隅を原点とする座標上において(x1,y1)、(x2,y2)とする。また、図面上上下方向における目の位置(すなわちy1,y2)はすべてのサンプル画像において同一である。   In the present embodiment, when generating the first reference data E1, the sample image known to be a face has a 30 × 30 pixel size, and as shown in FIG. The distance between the centers of both eyes in the image of one face is 10 pixels, 9 pixels, and 11 pixels, and a face standing vertically at the distance between the centers of both eyes is stepped in units of 3 degrees within a range of ± 15 degrees on the plane. Sample images that have been rotated (that is, the rotation angles are −15 degrees, −12 degrees, −9 degrees, −6 degrees, −3 degrees, 0 degrees, 3 degrees, 6 degrees, 9 degrees, 12 degrees, and 15 degrees). Shall be used. Therefore, 3 × 11 = 33 sample images are prepared for one face image. In FIG. 9, only sample images rotated at −15 degrees, 0 degrees, and +15 degrees are shown. The center of rotation is the intersection of the diagonal lines of the sample image. Here, if the distance between the centers of both eyes is a 10-pixel sample image, the center positions of the eyes are all the same. The center position of this eye is set to (x1, y1) and (x2, y2) on the coordinates with the upper left corner of the sample image as the origin. In addition, the eye positions in the vertical direction in the drawing (ie, y1, y2) are the same in all sample images.

また、第2の参照データE2を生成する際には、顔であることが分かっているサンプル画像として、30×30画素サイズを有し、図10に示すように、1つの顔の画像について両目の中心間の距離が10画素、9.7画素および10.3画素であり、各両目の中心間距離において垂直に立った顔を平面上±3度の範囲において1度単位で段階的に回転させた(すなわち、回転角度が−3度,−2度,−1度,0度,1度,2度,3度)サンプル画像を用いるものとする。したがって、1つの顔の画像につきサンプル画像は3×7=21通り用意される。なお、図10においては−3度、0度および+3度に回転させたサンプル画像のみを示す。また、回転の中心はサンプル画像の対角線の交点である。ここで、図面上上下方向における目の位置はすべてのサンプル画像において同一である。なお、両目の中心間の距離を9.7画素および10.3画素とするためには、両目の中心間の距離が10画素のサンプル画像を9.7倍あるいは10.3倍に拡大縮小して、拡大縮小後のサンプル画像のサイズを30×30画素とすればよい。   Further, when the second reference data E2 is generated, the sample image known to be a face has a 30 × 30 pixel size, and as shown in FIG. The distance between the centers is 10 pixels, 9.7 pixels, and 10.3 pixels, and the face standing vertically at the distance between the centers of each eye is rotated step by step in a range of ± 3 degrees on the plane. It is assumed that the sample image (that is, the rotation angle is −3 degrees, −2 degrees, −1 degrees, 0 degrees, 1 degree, 2 degrees, 3 degrees) is used. Therefore, 3 × 7 = 21 sample images are prepared for one face image. Note that FIG. 10 shows only sample images rotated to −3 degrees, 0 degrees, and +3 degrees. The center of rotation is the intersection of the diagonal lines of the sample image. Here, the positions of the eyes in the vertical direction in the drawing are the same in all the sample images. In order to set the distance between the centers of both eyes to 9.7 pixels and 10.3 pixels, the sample image whose distance between the centers of both eyes is 10 pixels is enlarged or reduced to 9.7 times or 10.3 times. Thus, the size of the sample image after enlargement / reduction may be set to 30 × 30 pixels.

そして、第2の参照データE2の学習に用いられるサンプル画像における目の中心位置を、本実施形態において識別する目の位置とする。   Then, the center position of the eye in the sample image used for learning the second reference data E2 is set as the eye position to be identified in the present embodiment.

また、顔でないことが分かっているサンプル画像としては、30×30画素サイズを有する任意の画像を用いるものとする。   As a sample image that is known not to be a face, an arbitrary image having a 30 × 30 pixel size is used.

ここで、顔であることが分かっているサンプル画像として、両目の中心間距離が10画素であり、平面上の回転角度が0度(すなわち顔が垂直な状態)のもののみを用いて学習を行った場合、第1および第2の参照データE1,E2を参照して顔または目の位置であると識別されるのは、両目の中心間距離が10画素で全く回転していない顔のみである。写真画像D0に含まれる可能性がある顔のサイズは一定ではないため、顔が含まれるか否かあるいは目の位置を識別する際には、後述するように写真画像D0を拡大縮小して、サンプル画像のサイズに適合するサイズの顔および目の位置を識別できるようにしている。しかしながら、両目の中心間距離を正確に10画素とするためには、写真画像D0のサイズを拡大率として例えば1.1単位で段階的に拡大縮小しつつ識別を行う必要があるため、演算量が膨大なものとなる。   Here, as a sample image that is known to be a face, learning is performed using only a center image whose distance between the centers of both eyes is 10 pixels and the rotation angle on the plane is 0 degree (that is, the face is vertical). When performed, the face or eye position is identified with reference to the first and second reference data E1 and E2 only for a face that is not rotated at all with a center-to-center distance of both eyes of 10 pixels. is there. Since the size of the face that may be included in the photographic image D0 is not constant, when identifying whether or not the face is included or the position of the eyes, the photographic image D0 is enlarged or reduced as described later. The position of the face and eyes that match the size of the sample image can be identified. However, in order to accurately set the distance between the centers of both eyes to 10 pixels, the size of the photographic image D0 needs to be identified while being enlarged or reduced in steps of, for example, 1.1 units as an enlargement ratio. Will be enormous.

また、写真画像D0に含まれる可能性がある顔は、図11(a)に示すように平面上の回転角度が0度のみではなく、図11(b)、(c)に示すように回転している場合もある。しかしながら、両目の中心間距離が10画素であり、顔の回転角度が0度のサンプル画像のみを使用して学習を行った場合、顔であるにも拘わらず、図11(b)、(c)に示すように回転した顔については識別を行うことができなくなってしまう。   Further, the face that may be included in the photographic image D0 is not only rotated at 0 degree on the plane as shown in FIG. 11A, but also rotated as shown in FIGS. 11B and 11C. Sometimes it is. However, when learning is performed using only a sample image in which the distance between the centers of both eyes is 10 pixels and the rotation angle of the face is 0 degrees, FIGS. As shown in (), the rotated face cannot be identified.

このため、本実施形態においては、顔であることが分かっているサンプル画像として、図9に示すように両目の中心間距離が9,10,11画素であり、各距離において平面上±15度の範囲にて3度単位で段階的に顔を回転させたサンプル画像を用いて、第1の参照データE1の学習に許容度を持たせるようにしたものである。これにより、後述する第1の識別部5において識別を行う際には、写真画像D0を拡大率として11/9単位で段階的に拡大縮小すればよいため、写真画像D0のサイズを例えば拡大率として例えば1.1単位で段階的に拡大縮小する場合と比較して、演算時間を低減できる。また、図11(b)、(c)に示すように回転している顔も識別することができる。   Therefore, in this embodiment, as a sample image known to be a face, the distance between the centers of both eyes is 9, 10, 11 pixels as shown in FIG. 9, and ± 15 degrees on the plane at each distance. In this range, a sample image obtained by rotating the face step by step in increments of 3 degrees is used to allow the learning of the first reference data E1. As a result, when the identification is performed in the first identification unit 5 to be described later, the photographic image D0 can be enlarged or reduced stepwise in increments of 11/9 with the photographic image D0 as the enlargement rate. For example, the calculation time can be reduced as compared with a case where the enlargement / reduction is performed in units of 1.1. In addition, as shown in FIGS. 11B and 11C, a rotating face can be identified.

一方、第2の参照データE2の学習には、図10に示すように両目の中心間距離が9.7,10,10.3画素であり、各距離において平面上±3度の範囲にて1度単位で段階的に顔を回転させたサンプル画像を用いているため、第1の参照データE1と比較して学習の許容度は小さい。また、後述する第2の識別部6において識別を行う際には、写真画像D0を拡大率として10.3/9.7単位で拡大縮小する必要があるため、第1の識別部5において行われる識別よりも演算に長時間を要する。しかしながら、第2の識別部6において識別を行うのは第1の識別部5が識別した顔内の画像のみであるため、写真画像D0の全体を用いる場合と比較して目の位置の識別を行うための演算量を低減することができる。   On the other hand, in learning of the second reference data E2, the distance between the centers of both eyes is 9.7, 10, 10.3 pixels as shown in FIG. 10, and each distance is within a range of ± 3 degrees on the plane. Since the sample image obtained by rotating the face step by step in units of 1 degree is used, the learning tolerance is smaller than that of the first reference data E1. Further, when the identification is performed by the second identification unit 6 to be described later, the photographic image D0 needs to be enlarged / reduced in units of 10.3 / 9.7 as an enlargement ratio. It takes a longer time to calculate than the identification. However, since only the image in the face identified by the first identification unit 5 is identified by the second identification unit 6, the eye position is identified as compared with the case where the entire photographic image D0 is used. The amount of calculation for performing can be reduced.

以下、図12のフローチャートを参照しながらサンプル画像群の学習手法の一例を説明する。なお、ここでは第1の参照データE1の学習について説明する。   Hereinafter, an example of a learning method for the sample image group will be described with reference to the flowchart of FIG. Here, learning of the first reference data E1 will be described.

学習の対象となるサンプル画像群は、顔であることが分かっている複数のサンプル画像と、顔でないことが分かっている複数のサンプル画像とからなる。なお、顔であることが分かっているサンプル画像は、上述したように1つのサンプル画像につき両目の中心位置が9,10,11画素であり、各距離において平面上±15度の範囲にて3度単位で段階的に顔を回転させたものを用いる。各サンプル画像には、重みすなわち重要度が割り当てられる。まず、すべてのサンプル画像の重みの初期値が等しく1に設定される(S1)。   The group of sample images to be learned includes a plurality of sample images that are known to be faces and a plurality of sample images that are known not to be faces. As described above, the sample image that is known to be a face has 9, 10, 11 pixels in the center position of both eyes for one sample image, and is 3 in a range of ± 15 degrees on the plane at each distance. Use a face rotated stepwise in degrees. Each sample image is assigned a weight or importance. First, the initial value of the weight of all sample images is set equal to 1 (S1).

次に、サンプル画像における複数種類の画素群のそれぞれについて識別器が作成される(S2)。ここで、それぞれの識別器とは、1つの画素群を構成する各画素における特徴量C0の組み合わせを用いて、顔の画像と顔でない画像とを識別する基準を提供するものである。本実施形態においては、1つの画素群を構成する各画素における特徴量C0の組み合わせについてのヒストグラムを識別器として使用する。   Next, a discriminator is created for each of a plurality of types of pixel groups in the sample image (S2). Here, each discriminator provides a reference for discriminating between a face image and a non-face image by using a combination of feature amounts C0 in each pixel constituting one pixel group. In the present embodiment, a histogram for a combination of feature amounts C0 in each pixel constituting one pixel group is used as a discriminator.

図13を参照しながらある識別器の作成について説明する。図13の左側のサンプル画像に示すように、この識別器を作成するための画素群を構成する各画素は、顔であることが分かっている複数のサンプル画像上における、右目の中心にある画素P1、右側の頬の部分にある画素P2、額の部分にある画素P3および左側の頬の部分にある画素P4である。そして顔であることが分かっているすべてのサンプル画像について全画素P1〜P4における特徴量C0の組み合わせが求められ、そのヒストグラムが作成される。ここで、特徴量C0は勾配ベクトルKの方向および大きさを表すが、勾配ベクトルKの方向は0〜359の360通り、勾配ベクトルKの大きさは0〜255の256通りあるため、これをそのまま用いたのでは、組み合わせの数は1画素につき360×256通りの4画素分、すなわち(360×256)4通りとなってしまい、学習および検出のために多大なサンプルの数、時間およびメモリを要することとなる。このため、本実施形態においては、勾配ベクトルの方向を0〜359を0〜44と315〜359(右方向、値:0),45〜134(上方向値:1),135〜224(左方向、値:2),225〜314(下方向、値3)に4値化し、勾配ベクトルの大きさを3値化(値:0〜2)する。そして、以下の式を用いて組み合わせの値を算出する。 The creation of a classifier will be described with reference to FIG. As shown in the sample image on the left side of FIG. 13, each pixel constituting the pixel group for creating the discriminator is a pixel at the center of the right eye on a plurality of sample images that are known to be faces. P1, a pixel P2 on the right cheek, a pixel P3 on the forehead, and a pixel P4 on the left cheek. Then, combinations of feature amounts C0 in all the pixels P1 to P4 are obtained for all sample images that are known to be faces, and a histogram thereof is created. Here, the feature amount C0 represents the direction and magnitude of the gradient vector K. Since the gradient vector K has 360 directions from 0 to 359 and the gradient vector K has 256 sizes from 0 to 255, If used as they are, the number of combinations is 360 × 256 four pixels per pixel, that is, (360 × 256) four , and the number of samples, time and memory for learning and detection are large. Will be required. For this reason, in this embodiment, the gradient vector directions are 0 to 359, 0 to 44, 315 to 359 (right direction, value: 0), 45 to 134 (upward value: 1), and 135 to 224 (left). Direction, value: 2), 225-314 (downward, value 3), and quaternarization, and the gradient vector magnitude is ternarized (value: 0-2). And the value of a combination is computed using the following formula | equation.

組み合わせの値=0(勾配ベクトルの大きさ=0の場合)
組み合わせの値=((勾配ベクトルの方向+1)×勾配ベクトルの大きさ(勾配ベクトルの大きさ>0の場合)
これにより、組み合わせ数が94通りとなるため、特徴量C0のデータ数を低減できる。
Combination value = 0 (when gradient vector size = 0)
Combination value = ((gradient vector direction + 1) × gradient vector magnitude (gradient vector magnitude> 0)
Thus, since the number of combinations is nine patterns 4, can reduce the number of data of the characteristic amounts C0.

同様に、顔でないことが分かっている複数のサンプル画像についても、ヒストグラムが作成される。なお、顔でないことが分かっているサンプル画像については、顔であることが分かっているサンプル画像上における上記画素P1〜P4の位置に対応する画素が用いられる。これらの2つのヒストグラムが示す頻度値の比の対数値を取ってヒストグラムで表したものが、図13の一番右側に示す、識別器として用いられるヒストグラムである。この識別器のヒストグラムが示す各縦軸の値を、以下、識別ポイントと称する。この識別器によれば、正の識別ポイントに対応する特徴量C0の分布を示す画像は顔である可能性が高く、識別ポイントの絶対値が大きいほどその可能性は高まると言える。逆に、負の識別ポイントに対応する特徴量C0の分布を示す画像は顔でない可能性が高く、やはり識別ポイントの絶対値が大きいほどその可能性は高まる。ステップS2では、識別に使用され得る複数種類の画素群を構成する各画素における特徴量C0の組み合わせについて、上記のヒストグラム形式の複数の識別器が作成される。   Similarly, histograms are created for a plurality of sample images that are known not to be faces. For the sample image that is known not to be a face, pixels corresponding to the positions of the pixels P1 to P4 on the sample image that is known to be a face are used. A histogram used as a discriminator shown on the right side of FIG. 13 is a histogram obtained by taking logarithmic values of ratios of frequency values indicated by these two histograms. The value of each vertical axis indicated by the histogram of the discriminator is hereinafter referred to as an identification point. According to this classifier, an image showing the distribution of the feature quantity C0 corresponding to the positive identification point is highly likely to be a face, and it can be said that the possibility increases as the absolute value of the identification point increases. Conversely, an image showing the distribution of the feature quantity C0 corresponding to the negative identification point is highly likely not to be a face, and the possibility increases as the absolute value of the identification point increases. In step S <b> 2, a plurality of classifiers in the above-described histogram format are created for combinations of feature amounts C <b> 0 in the respective pixels constituting a plurality of types of pixel groups that can be used for identification.

続いて、ステップS2で作成した複数の識別器のうち、画像が顔であるか否かを識別するのに最も有効な識別器が選択される。最も有効な識別器の選択は、各サンプル画像の重みを考慮して行われる。この例では、各識別器の重み付き正答率が比較され、最も高い重み付き正答率を示す識別器が選択される(S3)。すなわち、最初のステップS3では、各サンプル画像の重みは等しく1であるので、単純にその識別器によって画像が顔であるか否かが正しく識別されるサンプル画像の数が最も多いものが、最も有効な識別器として選択される。一方、後述するステップS5において各サンプル画像の重みが更新された後の2回目のステップS3では、重みが1のサンプル画像、重みが1よりも大きいサンプル画像、および重みが1よりも小さいサンプル画像が混在しており、重みが1よりも大きいサンプル画像は、正答率の評価において、重みが1のサンプル画像よりも重みが大きい分多くカウントされる。これにより、2回目以降のステップS3では、重みが小さいサンプル画像よりも、重みが大きいサンプル画像が正しく識別されることに、より重点が置かれる。   Subsequently, the most effective classifier for identifying whether or not the image is a face is selected from the plurality of classifiers created in step S2. The most effective classifier is selected in consideration of the weight of each sample image. In this example, the weighted correct answer rate of each classifier is compared, and the classifier showing the highest weighted correct answer rate is selected (S3). That is, in the first step S3, since the weight of each sample image is equal to 1, the number of sample images in which the image is correctly identified by the classifier is simply the largest. Selected as a valid discriminator. On the other hand, in the second step S3 after the weight of each sample image is updated in step S5, which will be described later, a sample image with a weight of 1, a sample image with a weight greater than 1, and a sample image with a weight less than 1 The sample images having a weight greater than 1 are counted more in the evaluation of the correct answer rate because the weight is larger than the sample images having a weight of 1. Thereby, in step S3 after the second time, more emphasis is placed on correctly identifying a sample image having a large weight than a sample image having a small weight.

次に、それまでに選択した識別器の組み合わせの正答率、すなわち、それまでに選択した識別器を組み合わせて使用して各サンプル画像が顔の画像であるか否かを識別した結果が、実際に顔の画像であるか否かの答えと一致する率が、所定の閾値を超えたか否かが確かめられる(S4)。ここで、組み合わせの正答率の評価に用いられるのは、現在の重みが付けられたサンプル画像群でも、重みが等しくされたサンプル画像群でもよい。所定の閾値を超えた場合は、それまでに選択した識別器を用いれば画像が顔であるか否かを十分に高い確率で識別できるため、学習は終了する。所定の閾値以下である場合は、それまでに選択した識別器と組み合わせて用いるための追加の識別器を選択するために、ステップS6へと進む。   Next, the correct answer rate of the classifiers selected so far, that is, the result of identifying whether each sample image is a face image using a combination of the classifiers selected so far, is actually It is ascertained whether or not the rate that matches the answer indicating whether the image is a face image exceeds a predetermined threshold (S4). Here, the sample image group to which the current weight is applied or the sample image group to which the weight is equal may be used for evaluating the correct answer rate of the combination. When the predetermined threshold value is exceeded, learning can be completed because it is possible to identify whether the image is a face with a sufficiently high probability by using the classifier selected so far. If it is equal to or less than the predetermined threshold value, the process proceeds to step S6 in order to select an additional classifier to be used in combination with the classifier selected so far.

ステップS6では、直近のステップS3で選択された識別器が再び選択されないようにするため、その識別器が除外される。   In step S6, the discriminator selected in the most recent step S3 is excluded so as not to be selected again.

次に、直近のステップS3で選択された識別器では顔であるか否かを正しく識別できなかったサンプル画像の重みが大きくされ、画像が顔であるか否かを正しく識別できたサンプル画像の重みが小さくされる(S5)。このように重みを大小させる理由は、次の識別器の選択において、既に選択された識別器では正しく識別できなかった画像を重要視し、それらの画像が顔であるか否かを正しく識別できる識別器が選択されるようにして、識別器の組み合わせの効果を高めるためである。   Next, the weight of the sample image that could not be correctly identified as a face by the classifier selected in the most recent step S3 is increased, and the sample image that can be correctly identified as whether or not the image is a face is increased. The weight is reduced (S5). The reason for increasing or decreasing the weight in this way is that in selecting the next discriminator, an image that cannot be discriminated correctly by the already selected discriminator is regarded as important, and whether or not those images are faces can be discriminated correctly. This is to increase the effect of the combination of the discriminators by selecting the discriminators.

続いて、ステップS3へと戻り、上記したように重み付き正答率を基準にして次に有効な識別器が選択される。   Subsequently, the process returns to step S3, and the next valid classifier is selected based on the weighted correct answer rate as described above.

以上のステップS3からS6を繰り返して、顔が含まれるか否かを識別するのに適した識別器として、特定の画素群を構成する各画素における特徴量C0の組み合わせに対応する識別器が選択されたところで、ステップS4で確認される正答率が閾値を超えたとすると、顔が含まれるか否かの識別に用いる識別器の種類と識別条件とが確定され(S7)、これにより第1の参照データE1の学習を終了する。   By repeating the above steps S3 to S6, the classifier corresponding to the combination of the feature amount C0 in each pixel constituting the specific pixel group is selected as a classifier suitable for identifying whether or not a face is included. If the correct answer rate confirmed in step S4 exceeds the threshold value, the type of the discriminator used for discriminating whether or not a face is included and the discriminating condition are determined (S7). The learning of the reference data E1 is finished.

そして、上記と同様に識別器の種類と識別条件とを求めることにより第2の参照データE2の学習がなされる。   Then, the second reference data E2 is learned by obtaining the classifier type and identification conditions in the same manner as described above.

なお、上記の学習手法を採用する場合において、識別器は、特定の画素群を構成する各画素における特徴量C0の組み合わせを用いて顔の画像と顔でない画像とを識別する基準を提供するものであれば、上記のヒストグラムの形式のものに限られずいかなるものであってもよく、例えば2値データ、閾値または関数等であってもよい。また、同じヒストグラムの形式であっても、図13の中央に示した2つのヒストグラムの差分値の分布を示すヒストグラム等を用いてもよい。   In the case of adopting the above learning method, the discriminator provides a reference for discriminating between a face image and a non-face image using a combination of feature amounts C0 in each pixel constituting a specific pixel group. As long as it is not limited to the above histogram format, it may be anything, for example, binary data, a threshold value, a function, or the like. Further, even with the same histogram format, a histogram or the like indicating the distribution of difference values between the two histograms shown in the center of FIG. 13 may be used.

また、学習の方法としては上記手法に限定されるものではなく、ニューラルネットワーク等他のマシンラーニングの手法を用いることができる。   Further, the learning method is not limited to the above method, and other machine learning methods such as a neural network can be used.

第1の識別部5は、複数種類の画素群を構成する各画素における特徴量C0の組み合わせのすべてについて第1の参照データE1が学習した識別条件を参照して、各々の画素群を構成する各画素における特徴量C0の組み合わせについての識別ポイントを求め、すべての識別ポイントを総合して写真画像D0に顔が含まれるか否かを識別する。この際、特徴量C0である勾配ベクトルKの方向は4値化され大きさは5値化される。本実施形態では、すべての識別ポイントを加算して、その加算値の正負によって識別を行うものとする。例えば、識別ポイントの総和が正の値である場合には写真画像D0には顔が含まれると判断し、負の値である場合には顔は含まれないと判断する。なお、第1の識別部5が行う写真画像D0に顔が含まれるか否かの識別を第1の識別と称する。   The first identification unit 5 configures each pixel group with reference to the identification conditions learned by the first reference data E1 for all combinations of the feature amounts C0 in the respective pixels constituting the plurality of types of pixel groups. An identification point for the combination of the feature amount C0 in each pixel is obtained, and all the identification points are combined to identify whether or not a face is included in the photographic image D0. At this time, the direction of the gradient vector K, which is the feature amount C0, is quaternized and the magnitude is quinary. In the present embodiment, all the identification points are added, and identification is performed based on the positive / negative of the added value. For example, when the sum of the identification points is a positive value, it is determined that the photograph image D0 includes a face, and when the sum is negative, it is determined that no face is included. The identification performed by the first identification unit 5 as to whether or not a face is included in the photographic image D0 is referred to as a first identification.

ここで、写真画像D0のサイズは30×30画素のサンプル画像とは異なり、各種サイズを有するものとなっている。また、顔が含まれる場合、平面上における顔の回転角度が0度であるとは限らない。このため、第1の識別部5は、図14に示すように、写真画像D0を縦または横のサイズが30画素となるまで段階的に拡大縮小するとともに平面上で段階的に360度回転させつつ(図14においては縮小する状態を示す)、各段階において拡大縮小された写真画像D0上に30×30画素サイズのマスクMを設定し、マスクMを拡大縮小された写真画像D0上において1画素ずつ移動させながら、マスク内の画像が顔の画像であるか否かの識別を行うことにより、写真画像D0に顔が含まれるか否かを識別する。   Here, the size of the photographic image D0 is different from the sample image of 30 × 30 pixels, and has various sizes. When a face is included, the rotation angle of the face on the plane is not always 0 degrees. Therefore, as shown in FIG. 14, the first identification unit 5 scales the photographic image D0 stepwise until the vertical or horizontal size becomes 30 pixels and rotates it 360 degrees stepwise on the plane. However, a mask M having a size of 30 × 30 pixels is set on the photographic image D0 enlarged / reduced at each stage, and the mask M is set to 1 on the enlarged photographic image D0. While moving pixel by pixel, it is identified whether or not the image in the mask is a face image, thereby identifying whether or not a face is included in the photographic image D0.

なお、第1参照データE1の生成時に学習したサンプル画像として両目の中心位置の画素数が9,10,11画素のものを使用しているため、写真画像D0の拡大縮小時の拡大率は11/9とすればよい。また、第1および第2の参照データE1,E2の生成時に学習したサンプル画像として、顔が平面上で±15度の範囲において回転させたものを使用しているため、写真画像D0は30度単位で360度回転させればよい。   Note that since the sample image learned at the time of generating the first reference data E1 has 9, 10, and 11 pixels at the center position of both eyes, the enlargement ratio at the time of enlargement / reduction of the photographic image D0 is 11 / 9. Since the sample image learned at the time of generating the first and second reference data E1 and E2 is a sample image whose face is rotated in a range of ± 15 degrees on a plane, the photographic image D0 is 30 degrees. What is necessary is just to rotate 360 degree | times per unit.

なお、特徴量算出部2は、写真画像D0の拡大縮小および回転という変形の各段階において特徴量C0を算出する。   Note that the feature amount calculation unit 2 calculates the feature amount C0 at each stage of deformation such as enlargement / reduction and rotation of the photographic image D0.

そして、写真画像D0に顔が含まれるか否かの識別を拡大縮小および回転の全段階の写真画像D0について行い、一度でも顔が含まれると識別された場合には、写真画像D0には顔が含まれると識別し、顔が含まれると識別された段階におけるサイズおよび回転角度の写真画像D0から、識別されたマスクMの位置に対応する30×30画素の領域を顔の画像として抽出する。   Then, whether or not a face is included in the photographic image D0 is identified for the photographic image D0 at all stages of enlargement / reduction and rotation. And a 30 × 30 pixel region corresponding to the position of the identified mask M is extracted as a face image from the photographic image D0 of the size and rotation angle at the stage where it is identified that the face is included. .

第2の識別部6は、第1の識別部5が抽出した顔の画像上において、複数種類の画素群を構成する各画素における特徴量C0の組み合わせのすべてについて第2の参照データE2が学習した識別条件を参照して、各々の画素群を構成する各画素における特徴量C0の組み合わせについての識別ポイントを求め、すべての識別ポイントを総合して顔に含まれる目の位置を識別する。この際、特徴量C0である勾配ベクトルKの方向は4値化され大きさは5値化される。   The second identification unit 6 learns the second reference data E2 for all the combinations of the feature amounts C0 in the respective pixels constituting the plurality of types of pixel groups on the face image extracted by the first identification unit 5. With reference to the identification conditions, the identification points for the combination of the feature amounts C0 in the respective pixels constituting each pixel group are obtained, and the positions of the eyes included in the face are identified by combining all the identification points. At this time, the direction of the gradient vector K, which is the feature amount C0, is quaternized and the magnitude is quinary.

ここで、第2の識別部6は、第1の識別部5が抽出した顔画像のサイズを段階的に拡大縮小するとともに平面上で段階的に360度回転させつつ、各段階において拡大縮小された顔画像上に30×30画素サイズのマスクMを設定し、マスクMを拡大縮小された顔上において1画素ずつ移動させながら、マスク内の画像における目の位置の識別を行う。   Here, the second discriminating unit 6 enlarges / reduces the size of the face image extracted by the first discriminating unit 5 stepwise and is enlarged / reduced at each step while rotating stepwise 360 degrees on the plane. A mask M having a 30 × 30 pixel size is set on the face image, and the eye position in the image in the mask is identified while moving the mask M pixel by pixel on the enlarged / reduced face.

なお、第2参照データE2の生成時に学習したサンプル画像として両目の中心位置の画素数が9.07,10,10.3画素のものを使用しているため、顔画像の拡大縮小時の拡大率は10.3/9.7とすればよい。また、第2の参照データE2の生成時に学習したサンプル画像として、顔が平面上で±3度の範囲において回転させたものを使用しているため、顔画像は6度単位で360度回転させればよい。   Since the sample image learned at the time of generating the second reference data E2 has the number of pixels at the center position of both eyes of 9.07, 10, and 10.3 pixels, enlargement when the face image is enlarged or reduced The rate may be 10.3 / 9.7. Further, as the sample image learned at the time of generating the second reference data E2, a face image rotated in a range of ± 3 degrees on the plane is used, so the face image is rotated 360 degrees in units of 6 degrees. Just do it.

なお、特徴量算出部2は、顔画像の拡大縮小および回転という変形の各段階において特徴量C0を算出する。   Note that the feature amount calculation unit 2 calculates the feature amount C0 at each stage of deformation such as enlargement / reduction and rotation of the face image.

そして、本実施形態では、抽出された顔画像の変形の全段階においてすべての識別ポイントを加算し、加算値が最も大きい変形の段階における30×30画素のマスクM内の顔画像において、左上隅を原点とする座標を設定し、サンプル画像における目の位置の座標(x1,y1)、(x2,y2)に対応する位置を求め、変形前の写真画像D0におけるこの位置に対応する位置を目の位置と識別する。   In this embodiment, all the identification points are added at all stages of deformation of the extracted face image, and the upper left corner of the face image in the mask M of 30 × 30 pixels at the stage of deformation having the largest added value is obtained. The coordinates corresponding to the coordinates (x1, y1) and (x2, y2) of the eye position in the sample image are obtained, and the position corresponding to this position in the photographic image D0 before deformation is set as the coordinate. Identify the location.

第1の出力部7は、第1の識別部5が写真画像D0に顔が含まれないと識別した場合には、写真画像D0をそのまま出力部50に出力する一方、第1の識別部5が写真画像D0に顔が含まれると認識した場合には、第2の識別部6が識別した両目の位置から両目間の距離dを求め、両目の位置および両目間の距離dを情報Sとしてトリミング部10および照合部40に出力する。   When the first identification unit 5 identifies that the face is not included in the photographic image D0, the first output unit 7 outputs the photographic image D0 as it is to the output unit 50, while the first identification unit 5 Recognizes that a face is included in the photographic image D0, the distance d between both eyes is obtained from the position of both eyes identified by the second identification unit 6, and the position d of both eyes and the distance d between both eyes is used as information S. The data is output to the trimming unit 10 and the collation unit 40.

図15は瞳検出手段100における検出部1の動作を示すフローチャートである。写真画像D0に対して、まず、特徴量算出部2が写真画像D0の拡大縮小および回転の各段階において、写真画像D0の勾配ベクトルKの方向および大きさを特徴量C0として算出する(S12)。そして、第1の識別部5が記憶部4から第1の参照データE1を読み出し(S13)、写真画像D0に顔が含まれるか否かの第1の識別を行う(S14)。   FIG. 15 is a flowchart showing the operation of the detection unit 1 in the pupil detection unit 100. For the photographic image D0, first, the feature amount calculation unit 2 calculates the direction and size of the gradient vector K of the photographic image D0 as the feature amount C0 at each stage of enlargement / reduction and rotation of the photographic image D0 (S12). . Then, the first identification unit 5 reads the first reference data E1 from the storage unit 4 (S13), and performs first identification as to whether or not a face is included in the photographic image D0 (S14).

第1の識別部5は、写真画像D0に顔が含まれると判別する(S14:Yes)と、写真画像D0から顔を抽出する(S15)。ここでは、1つの顔に限らず複数の顔を抽出してもよい。次いで、特徴量算出部2が顔画像の拡大縮小および回転の各段階において、顔画像の勾配ベクトルKの方向および大きさを特徴量C0として算出する(S16)。そして、第2の識別部6が記憶部4から第2の参照データE2を読み出し(S17)、顔に含まれる目の位置を識別する第2の識別を行う(S18)。   When determining that the face is included in the photographic image D0 (S14: Yes), the first identification unit 5 extracts the face from the photographic image D0 (S15). Here, not only one face but a plurality of faces may be extracted. Next, the feature amount calculation unit 2 calculates the direction and size of the gradient vector K of the face image as the feature amount C0 at each stage of enlargement / reduction and rotation of the face image (S16). Then, the second identification unit 6 reads the second reference data E2 from the storage unit 4 (S17), and performs second identification for identifying the position of the eyes included in the face (S18).

続いて、第1の出力部7が写真画像D0から識別された目の位置および、この目の位置に基づいて求められた両目間の距離dを情報Sとしてトリミング部10および照合部40に出力する(S19)。   Subsequently, the first output unit 7 outputs the eye position identified from the photographic image D0 and the distance d between both eyes obtained based on the eye position as information S to the trimming unit 10 and the collation unit 40. (S19).

一方、ステップS14において、写真画像D0に顔が含まれていないと判別される(S14:No)と、第1の出力部7は、写真画像D0をそのまま出力部50に出力する(S19)。   On the other hand, if it is determined in step S14 that no face is included in the photographic image D0 (S14: No), the first output unit 7 outputs the photographic image D0 as it is to the output unit 50 (S19).

トリミング部10は、検出部1から出力されてきた情報Sに基づいて、左目のみと右目のみとを夫々含む所定の範囲を切り出してトリミング画像D1aとD1bを得るものである。ここで、トリミングする際の所定の範囲とは、夫々の目の近傍を外枠にした範囲であり、例えば、図16に示す斜線範囲のように、検出部1より識別した目の位置(目の中心点)を中心とした、図示X方向とY方向の長さが夫々dと0.5dである長方形の範囲とすることができる。なお、図示斜線範囲は、図中の左目のトリミングの範囲であるが、右目についても同様である。   The trimming unit 10 cuts out a predetermined range including only the left eye and only the right eye based on the information S output from the detection unit 1 to obtain trimmed images D1a and D1b. Here, the predetermined range at the time of trimming is a range in which the vicinity of each eye is an outer frame. For example, as shown in the hatched range in FIG. Centered around the center point) of the figure, the lengths in the X direction and Y direction in the figure are d and 0.5d, respectively. The hatched area shown in the figure is the trimming range of the left eye in the figure, but the same applies to the right eye.

グレー変換部12は、トリミング部10により得られたトリミング画像D1に対して下記の式(1)に従ってグレー変換処理を行ってグレースケール画像D2を得る。   The gray conversion unit 12 performs a gray conversion process on the trimmed image D1 obtained by the trimming unit 10 according to the following equation (1) to obtain a grayscale image D2.


Y=0.299×R+0.587×G+0.114×B (1)
但し、Y:輝度値
R,G,B:R、G、B値

前処理部14は、グレースケール画像D2に対して前処理を行うものであり、ここでは、前処理として、平滑化処理と穴埋め処理が行われる。また、平滑化処理は、例えばカウシアンフィルタを適用することによって行われ、穴埋め処理は、補間処理とすることができる。

Y = 0.299 × R + 0.587 × G + 0.114 × B (1)
Y: Luminance value
R, G, B: R, G, B values

The preprocessing unit 14 performs preprocessing on the grayscale image D2, and here, smoothing processing and hole filling processing are performed as preprocessing. The smoothing process is performed by applying, for example, a Kaussian filter, and the hole filling process can be an interpolation process.

図4に示すように、写真画像における瞳の部分において、中心より上が部分的に明るくなる傾向があるため、穴埋め処理を行ってこの部分のデータを補間することにより瞳の中心位置の検出精度を向上させることができる。   As shown in FIG. 4, in the pupil portion of the photographic image, there is a tendency that the portion above the center is partially brightened. Therefore, the detection accuracy of the center position of the pupil is obtained by performing hole filling processing and interpolating the data of this portion. Can be improved.

2値化部20は、2値化閾値算出部18を有し、該2値化閾値算出部18により算出した閾値Tを用いて、前処理部14により得られた前処理済み画像D3を2値化して2値画像D4を得るものである。2値化閾値算出部18は、具体的には前処理済み画像D3に対して、図17に示す輝度のヒストグラムを作成し、前処理済み画像D3の全画素数の数分の1(図示では1/5となる20%)に相当する出現頻度に対応する輝度値を2値化用の閾値Tとして求める。2値化部20は、この閾値Tを用いて前処理済み画像D3を2値化して2値画像D4を得る。   The binarization unit 20 includes a binarization threshold value calculation unit 18, and uses the threshold value T calculated by the binarization threshold value calculation unit 18 to store the preprocessed image D <b> 3 obtained by the preprocessing unit 14. The binary image D4 is obtained by digitization. Specifically, the binarization threshold value calculation unit 18 creates a luminance histogram shown in FIG. 17 for the preprocessed image D3, and is a fraction of the total number of pixels of the preprocessed image D3 (in the drawing, The luminance value corresponding to the appearance frequency corresponding to 1/5 (20%) is obtained as the threshold T for binarization. The binarization unit 20 binarizes the preprocessed image D3 using the threshold T to obtain a binary image D4.

投票部30は、まず、2値化画像D4における各画素(画素値が1となる画素)の座標を円環のハフ空間(円中心点X座標,円中心点Y座標,半径r)に投票して、各投票位置の投票値を算出する。通常、1つの投票位置がある画素により投票されると、1回投票されたとして投票値に1が加算されるようにして各投票位置の投票値を求めるようにしているが、ここでは、1つの投票位置がある画素に投票されると、投票値に1を加算するのではなく、投票した画素の輝度値を参照して、輝度値が小さいほど、大きい重みを付けて加算するようにして各投票位置の投票値を求める。図18は、図2に示す瞳検出手段100における投票部30に使用された重付け係数のテーブルを示している。なお、図中Tは、2値化閾値算出部18により算出された2値化用の閾値Tである。   The voting unit 30 first votes the coordinates of each pixel (pixel having a pixel value of 1) in the binarized image D4 to the annular Hough space (circle center point X coordinate, circle center point Y coordinate, radius r). Then, the voting value at each voting position is calculated. Normally, when one vote position is voted by a pixel, the vote value at each vote position is obtained by adding 1 to the vote value as if it was voted once. When one vote is voted for a certain pixel, instead of adding 1 to the vote value, the brightness value of the voted pixel is referred to, and the smaller the brightness value, the higher the weight is added. The voting value at each voting position is obtained. FIG. 18 shows a table of weighting coefficients used in the voting unit 30 in the pupil detection means 100 shown in FIG. Note that T in the figure is a binarization threshold T calculated by the binarization threshold calculation unit 18.

投票部30は、このようにして各投票位置の投票値を求めた後、これらの投票位置のうち、円環中心点座標値、即ち円環ハフ空間(X,Y,r)における(X,Y)座標値が同じである投票位置同士の投票値を加算して各々の(X,Y)座標値に対応する統合投票値Wを得て、相対応する(X,Y)座標値と対応付けて中心位置候補取得部35に出力する。   After the voting unit 30 obtains the voting value of each voting position in this way, among these voting positions, the coordinate value of the center point of the ring, that is, (X, Y, r) in the ring Hough space (X, Y, r). Y) The vote values of the vote positions having the same coordinate value are added to obtain an integrated vote value W corresponding to each (X, Y) coordinate value, and corresponding to the corresponding (X, Y) coordinate value Then, the data is output to the center position candidate acquisition unit 35.

中心位置候補取得部35は、まず、投票部30からの各々の統合投票値から、最も大きい統合投票値に対応する(X,Y)座標値を、瞳の中心位置候補Gとして取得して、照合部40に出力する。ここで、中心位置候補取得部35により取得された中心位置候補Gは、左瞳の中心位置Gaと右瞳の中心位置Gbとの2つであり、照合部40は、検出部1により出力された両目間の距離dに基づいて、2つの中心位置Ga、Gbの照合を行う。   The center position candidate acquisition unit 35 first acquires (X, Y) coordinate values corresponding to the largest integrated vote value as the center position candidate G of the pupil from each integrated vote value from the voting unit 30. Output to the verification unit 40. Here, the center position candidate G acquired by the center position candidate acquisition unit 35 is two, that is, the center position Ga of the left pupil and the center position Gb of the right pupil, and the collation unit 40 is output by the detection unit 1. Based on the distance d between the eyes, the two center positions Ga and Gb are collated.

具体的には、照合部40は、次の2つの照合基準に基づいて照合を行う。   Specifically, the collation unit 40 performs collation based on the following two collation criteria.

1. 左瞳の中心位置と右瞳の中心位置とのY座標値の差が(d/50)以下。 1. The difference in Y coordinate value between the center position of the left pupil and the center position of the right pupil is (d / 50) or less.

2. 左瞳の中心位置と右瞳の中心位置とのX座標値の差が(0.8×d〜1.2×d)の範囲内。 2. The X coordinate value difference between the center position of the left pupil and the center position of the right pupil is within the range of (0.8 × d to 1.2 × d).


照合部40は、中心位置候補取得部35からの2つの瞳の中心位置候補Ga、Gbが上記2つの照合基準を満たしているか否かを判別し、2つの基準とも満たしていれば(以下照合基準を満たしているという)、瞳の中心位置候補Ga、Gbを瞳の中心位置として微調整部45に出力する。一方、2つの基準または2つの基準のうちの1つを満たしていなければ(以下照合基準を満たしていないという)、中心位置候補取得部35に次の中心位置候補を取得するように指示すると共に、中心位置候補取得部35により取得された次の中心位置候補に対して上述した照合、照合基準を満たしている場合の中心位置出力、照合基準を満たしていない場合の中心位置候補を再取得する指示などの処理を、照合基準を満たすようになるまで繰り返す。

The collation unit 40 determines whether or not the two pupil center position candidates Ga and Gb from the center position candidate acquisition unit 35 satisfy the above two collation criteria. The pupil center position candidates Ga and Gb are output to the fine adjustment unit 45 as the pupil center position. On the other hand, if one of the two criteria or one of the two criteria is not satisfied (hereinafter referred to as not satisfying the collation criteria), the center position candidate acquisition unit 35 is instructed to acquire the next center position candidate. , For the next center position candidate acquired by the center position candidate acquisition unit 35, the above-described collation, the center position output when the collation criteria are satisfied, and the center position candidate when the collation criteria are not met are reacquired. Processing such as instructions is repeated until the verification criteria are satisfied.

片方、中心位置候補取得部35は、照合部40から次の中心位置候補の取得が指示されると、まず、片方(ここでは、左瞳)の中心位置を固定して、もう片方(ここでは右瞳)の各々の統合投票値Wbから、下記の3つの条件に合う投票位置の(X,Y)座標値を次の中心位置候補として取得する。   When the acquisition of the next center position candidate is instructed from the collation unit 40, one of the center position candidate acquisition units 35 first fixes the center position of one side (here, the left pupil) and the other side (here, the left center position). The (X, Y) coordinate value of the voting position satisfying the following three conditions is acquired as the next center position candidate from each integrated voting value Wb of (right pupil).


1.最後に照合部40に出力した中心位置候補の(X、Y)座標値により示される位置とd/30以上(D:両目間の距離)離れている。

1. Finally, it is separated from the position indicated by the (X, Y) coordinate value of the center position candidate output to the collation unit 40 by d / 30 or more (D: distance between both eyes).

2.相対応する統合投票値が、条件1を満たす(X,Y)座標値に対応する統合投票値のうち、最後に照合部40に出力した中心位置候補の(X,Y)座標値に対応する統合投票値の次に大きい。 2. The corresponding integrated voting value corresponds to the (X, Y) coordinate value of the center position candidate that is finally output to the collation unit 40 among the integrated voting values corresponding to the (X, Y) coordinate value satisfying the condition 1. Next to the integrated vote value.

3.相対応する統合投票値が、1回目に照合部40に出力した中心位置候補の(X,Y)座標値に対応する統合投票値(最も大きい統合投票値)の10パーセント以上である。 3. The corresponding integrated voting value is 10% or more of the integrated voting value (the largest integrated voting value) corresponding to the (X, Y) coordinate value of the center position candidate output to the collation unit 40 for the first time.


中心位置候補取得部35は、まず、左瞳の中心位置を固定して、右瞳に対して求められた統合投票値Wbに基づいて上記3つの条件を満たす右瞳の中心位置候補を探すが、上記3つの条件を満たす候補を見つからない場合には、右瞳の中心位置を固定して、左瞳に対して求められた統合投票値Waに基づいて上記の3つの条件を満たす左瞳の中心位置を探す。

The center position candidate acquisition unit 35 first fixes the center position of the left pupil and searches for a center position candidate of the right pupil that satisfies the above three conditions based on the integrated vote value Wb obtained for the right pupil. If no candidate satisfying the above three conditions is found, the center position of the right pupil is fixed, and the left pupil satisfying the above three conditions is determined based on the integrated vote value Wa obtained for the left pupil. Find the center position.

微調整部45は、照合部40から出力してきた瞳の中心位置G(照合基準を満たしている中心位置候補)に対して微調整を行うものである。まず、左瞳の中心位置の微調整を説明する。微調整部45は、2値化部20により得られた左目のトリミング画像D1aの2値画像D4aに対して、サイズが9×9で、オール1のマスクを用いてマスク演算を3回繰り返し、このマスク演算の結果により得られた最大結果値を有する画素の位置(Gmとする)に基づいて、照合部40から出力してきた左瞳の中心位置Gaに対して微調整を行う。具体的には、例えば、位置Gmと中心位置Gaとの平均を取って得た平均位置を瞳の最終中心位置G’aとするようにしてもよいし、中心位置Gaの方に重みを付けて平均演算して得た平均位置を瞳の最終中心位置G’aとするようにしてもよい。ここでは、中心位置Gaの方に重みを付けて平均演算することにする。   The fine adjustment unit 45 performs fine adjustment on the pupil center position G output from the collation unit 40 (center position candidate satisfying the collation criteria). First, fine adjustment of the center position of the left pupil will be described. The fine adjustment unit 45 repeats the mask operation three times using the all-one mask having a size of 9 × 9 on the binary image D4a of the left-eye trimmed image D1a obtained by the binarization unit 20, Based on the position (Gm) of the pixel having the maximum result value obtained as a result of this mask calculation, fine adjustment is performed on the center position Ga of the left pupil output from the matching unit 40. Specifically, for example, the average position obtained by taking the average of the position Gm and the center position Ga may be set as the final center position G′a of the pupil, or the center position Ga is weighted. The average position obtained by the average calculation may be used as the final center position G′a of the pupil. Here, an average calculation is performed with weights applied to the center position Ga.

また、右瞳の中心位置の微調整は、右目のトリミング画像D1bの2値画像D4bを用いて上記と同じように行われる。   Further, the fine adjustment of the center position of the right pupil is performed in the same manner as described above using the binary image D4b of the trimmed image D1b of the right eye.

微調整部45は、このようにして、照合部40から出力してきた瞳の中心位置Ga、Gbに対して微調整を行って得た最終中心位置G’a、G’bを出力部50に出力する。   In this way, the fine adjustment unit 45 provides the output unit 50 with final center positions G′a and G′b obtained by performing fine adjustment on the pupil center positions Ga and Gb output from the collation unit 40. Output.

出力部50は、顔が含まれていない画像D0をそのままボケ解析手段200に出力するが、顔が含まれた画像D0に対しては、最終中心位置G’に基づいて、中心位置G’aを囲む所定の範囲と、G’bを囲む所定の範囲を夫々切り出して瞳画像D5(D5a,D5b)を得、この瞳画像D5をボケ解析手段200に出力する。   The output unit 50 outputs the image D0 that does not include the face as it is to the blur analysis unit 200, but for the image D0 that includes the face, the center position G′a is based on the final center position G ′. And a predetermined range surrounding G′b is cut out to obtain a pupil image D5 (D5a, D5b), and this pupil image D5 is output to the blur analysis means 200.

図19は、図2に示す瞳検出手段100の処理を示すフローチャートである。図示のように、写真画像D0は、まず検出部1において顔が含まれているか否かの判別がされる(S110)。判別の結果、写真画像D0に顔が含まれていなければ(S115:No)、写真画像D0は検出部1から出力部50に出力される一方、写真画像D0に顔が含まれていれば(S115:Yes)、さらに、検出部1において写真画像D0における目の位置が検出され、両目の位置および両目間の距離dが情報Sとしてトリミング部10に出力される(S120)。トリミング部10において、写真画像D0がトリミングされ、左目のみを含むトリミング画像D1aと右目のみを含むトリミング画像D1bが得られる(S125)。トリミング画像D1は、グレー変換部12によりグレー変換されてグレースケール画像D2となる(S130)。グレースケール画像D2は、前処理部14により平滑化処理と穴埋め処理を施され、さらに2値化部20により2値化処理されて2値画像D4となる(S135、S140)。投票部30において、2値画像D4の各画素の座標は円環のハフ空間に投票され、その結果、各々の円中心点を示す(X,Y)座標値に対応する統合投票値Wが得られる(S145)。中心位置候補取得部35は、まず、最も大きい統合投票値に対応する(X,Y)座標値を瞳の中心位置候補Gとして照合部40に出力する(S150)。照合部40は、前述した照合基準に基づいて中心位置候補取得部35からの2つの中心位置候補Ga、Gbに対して照合を行い(S115)、2つの中心位置候補Ga、Gbが照合基準を満たしていれば(S160:Yes)、この2つの中心位置候補Ga、Gbを中心位置として微調整部45に出力する一方、2つの中心位置候補Ga、Gbが照合基準を満たしていなければ(S160:No)、中心位置候補取得部35に次の中心位置候補を探すように指示する(S150)。ステップS150からステップS160までの処理が、照合部40により、中心位置候補取得部35からの中心位置候補Gが照合基準を満たすと判別されるまで繰り返される。   FIG. 19 is a flowchart showing the processing of the pupil detection means 100 shown in FIG. As shown in the figure, the photographic image D0 is first discriminated whether or not a face is included in the detection unit 1 (S110). As a result of the determination, if the face is not included in the photographic image D0 (S115: No), the photographic image D0 is output from the detection unit 1 to the output unit 50, while if the photographic image D0 includes a face ( Further, the position of the eyes in the photographic image D0 is detected by the detection unit 1, and the position of both eyes and the distance d between the eyes are output as information S to the trimming unit 10 (S120). In the trimming unit 10, the photographic image D0 is trimmed to obtain a trimmed image D1a including only the left eye and a trimmed image D1b including only the right eye (S125). The trimmed image D1 is gray-converted by the gray converter 12 to become a grayscale image D2 (S130). The grayscale image D2 is subjected to smoothing processing and hole filling processing by the preprocessing unit 14, and is further binarized by the binarizing unit 20 to become a binary image D4 (S135, S140). In the voting unit 30, the coordinates of each pixel of the binary image D4 are voted to the annular Hough space, and as a result, an integrated vote value W corresponding to the (X, Y) coordinate value indicating each circle center point is obtained. (S145). The center position candidate acquisition unit 35 first outputs the (X, Y) coordinate value corresponding to the largest integrated vote value to the collation unit 40 as the pupil center position candidate G (S150). The collation unit 40 collates the two center position candidates Ga and Gb from the center position candidate acquisition unit 35 based on the collation reference described above (S115), and the two center position candidates Ga and Gb use the collation reference. If the two are satisfied (S160: Yes), the two center position candidates Ga and Gb are output to the fine adjustment unit 45 as the center position, while the two center position candidates Ga and Gb do not satisfy the collation criteria (S160). : No), the center position candidate acquisition unit 35 is instructed to search for the next center position candidate (S150). The processing from step S150 to step S160 is repeated until the collation unit 40 determines that the center position candidate G from the center position candidate acquisition unit 35 satisfies the collation criteria.

微調整部45は、照合部40から出力された中心位置Gに対して微調整を行い、最終中心位置G’を得て出力部50に出力する(S165)。   The fine adjustment unit 45 performs fine adjustment on the center position G output from the collation unit 40, obtains the final center position G ', and outputs it to the output unit 50 (S165).

出力部50は、顔が含まれていない画像D0(S115:No)をそのままボケ解析手段200に出力するが、顔が含まれた画像D0に対しては、最終中心位置G’に基づいて、中心位置G’aを囲む所定の範囲と、G’bを囲む所定の範囲を夫々切り出して瞳画像D5(D5a,D5b)を得、この瞳画像D5をボケ解析手段200に出力する(S170)。   The output unit 50 outputs the image D0 (S115: No) that does not include the face to the blur analysis unit 200 as it is, but for the image D0 that includes the face, based on the final center position G ′, A predetermined range surrounding the center position G′a and a predetermined range surrounding G′b are cut out to obtain a pupil image D5 (D5a, D5b), and this pupil image D5 is output to the blur analysis means 200 (S170). .

このように、図1に示す画像処理システムAのボケ解析手段200には、顔が含まれてない画像D0、または顔が含まれている画像D0の瞳画像D5が入力される。   As described above, the blur analysis unit 200 of the image processing system A illustrated in FIG. 1 receives the image D0 that does not include the face or the pupil image D5 of the image D0 that includes the face.

図20は、ボケ解析手段200の構成を示すブロック図である。図示のように、ボケ解析手段200は、エッジ検出手段212と、エッジプロファイル作成手段213と、エッジ絞込手段214と、エッジ特徴量取得手段216と、解析実行手段220と、記憶手段225とを有してなるものである。   FIG. 20 is a block diagram illustrating a configuration of the blur analysis unit 200. As illustrated, the blur analysis unit 200 includes an edge detection unit 212, an edge profile creation unit 213, an edge narrowing unit 214, an edge feature amount acquisition unit 216, an analysis execution unit 220, and a storage unit 225. It has.

エッジ検出手段212は、画像D0または瞳画像D5(以下対象画像という)を用いて、図21に示すような8方向毎に、所定の強度以上のエッジを検出し、これらのエッジの座標位置を得てエッジプロファイル作成手段213に出力する。エッジプロファイル作成手段213は、エッジ検出手段212により検出された各方向毎の各々のエッジの座標位置に基づいて、対応する対象画像を用いてこれらのエッジに対して、図22に示すようなエッジプロファイルを作成してエッジ絞込手段214に出力する。   The edge detection unit 212 uses the image D0 or the pupil image D5 (hereinafter referred to as a target image) to detect edges having a predetermined intensity or more in every eight directions as shown in FIG. Obtained and output to the edge profile creation means 213. Based on the coordinate position of each edge in each direction detected by the edge detection unit 212, the edge profile creation unit 213 uses the corresponding target image to perform an edge as shown in FIG. A profile is created and output to the edge narrowing means 214.

エッジ絞込手段214は、エッジプロファイル作成手段213から出力されてきたエッジのプロファイルに基づいて、複雑なプロファイル形状を有するエッジや、光源を含むエッジ(具体的には例えば一定の明度以上のエッジ)などの無効なエッジを除去し、残りのエッジのプロファイルをエッジ特徴量取得手段216に出力する。   The edge narrowing means 214 is based on the edge profile output from the edge profile creating means 213, and has an edge having a complex profile shape or an edge including a light source (specifically, an edge having a certain lightness or higher, for example). And the like, and the remaining edge profile is output to the edge feature quantity acquisition means 216.

エッジ特徴量取得手段216は、エッジ絞込手段214から出力されてきたエッジのプロファイルに基づいて、図22に示すようなエッジ幅を各エッジに対して求め、図23に示すようなエッジ幅のヒストグラムを図21に示された8つの方向毎に作成してエッジ幅と共にエッジ特徴量Sとして解析実行手段220に出力する。   The edge feature quantity acquisition unit 216 obtains an edge width as shown in FIG. 22 for each edge based on the edge profile output from the edge narrowing unit 214, and obtains the edge width as shown in FIG. A histogram is created for each of the eight directions shown in FIG. 21, and is output to the analysis execution means 220 as an edge feature amount S together with the edge width.

解析実行手段220は、主として下記の2つの処理を行う。   The analysis execution unit 220 mainly performs the following two processes.

1. 対象画像におけるボケ方向、ボケ度Nを求めて、対象画像がボケ画像か通常画像かを判別する。   1. The blur direction and the blur degree N in the target image are obtained to determine whether the target image is a blur image or a normal image.

2. 対象画像がボケ画像と判別された場合、ボケ幅L、ぶれ度Kを算出する。   2. When it is determined that the target image is a blurred image, a blur width L and a blur degree K are calculated.

ここで、1つ目の処理から説明する。   Here, the first process will be described.

解析実行手段220は、対象画像におけるボケ方向を求めるために、まず、図21に示す8つの方向のエッジ幅のヒストグラム(以下略してヒストグラムという)に対して、互いに直交する2つの方向を1方向組として各方向組(1−5、2−6、3−7、4−8)のヒストグラムの相関値を求める。なお、相関値は求め方によって様々な種類があり、相関値が大きければ相関が小さい種類と、相関値の大小と相関の大小とが一致する、すなわち相関値が小さければ相関が小さい種類との2種類に大きく分けることができる。本実施形態において、例として、相関値の大小と相関の大小とが一致する種類の相関値を用いる。図24に示すように、画像中にぶれがある場合には、ぶれ方向のヒストグラムと、ぶれ方向と直交する方向のヒストグラムとの相関が小さい(図24(a)参照)のに対して、ぶれと関係ない直交する方向組または画像中にぶれがない(ボケがないまたはピンボケ)場合の直交する方向組では、そのヒストグラムの相関が大きい(図24(b)参照)。本実施形態の画像処理システムAにおける解析実行手段220は、このような傾向に着目し、4つの方向組に対して、各組のヒストグラムの相関値を求め、相関が最も小さい方向組の2つの方向を見つけ出す。画像Dにぶれがあれば、この2つの方向のうちの1つは、図21に示す8つの方向のうち、最もぶれ方向に近い方向として考えることができる。   In order to obtain the blur direction in the target image, the analysis execution unit 220 first sets two directions orthogonal to each other to a histogram of edge widths in eight directions shown in FIG. As a set, the correlation value of the histogram of each direction set (1-5, 2-6, 3-7, 4-8) is obtained. Note that there are various types of correlation values, depending on how they are obtained.If the correlation value is large, the correlation type is small, and if the correlation value is the same as the correlation level, that is, if the correlation value is small, the correlation type is small. It can be roughly divided into two types. In this embodiment, as an example, a correlation value of a type in which the magnitude of the correlation value matches the magnitude of the correlation is used. As shown in FIG. 24, when there is blur in the image, the correlation between the blur direction histogram and the histogram in the direction orthogonal to the blur direction is small (see FIG. 24A). In the orthogonal direction set that is not related to or in the case where there is no blur in the image (no blur or out of focus), the correlation of the histogram is large (see FIG. 24B). The analysis execution means 220 in the image processing system A of the present embodiment pays attention to such a tendency, obtains the correlation value of the histogram of each group for the four direction groups, and obtains the two direction groups having the smallest correlation. Find directions. If there is a blur in the image D, one of these two directions can be considered as a direction closest to the blur direction among the eight directions shown in FIG.

図24(c)は、ぶれ、ピンボケ、ボケ(ピンボケおよびぶれ)なしの撮像条件で同じ被写体を撮像して得た夫々の画像に対して求められた、このぶれの方向におけるエッジ幅のヒストグラムを示している。図24(c)から分かるように、ボケのない通常画像は、最も小さい平均エッジ幅を有し、すなわち、上記において見付け出された2つの方向のうち、平均エッジ幅が大きい方は、最もぶれに近い方向のはずである。   FIG. 24 (c) shows a histogram of edge widths in the direction of blurring obtained for each image obtained by imaging the same subject under imaging conditions without blurring, blurring and blurring (blurring and blurring). Show. As can be seen from FIG. 24 (c), the normal image without blur has the smallest average edge width, that is, of the two directions found above, the one with the largest average edge width is the most blurred. The direction should be close to.

解析実行手段220は、こうして、相関が最も小さい方向組を見付け、この方向組の2つの方向のうち、平均エッジ幅の大きい方をボケ方向とする。   In this way, the analysis execution unit 220 finds the direction set having the smallest correlation, and sets the direction with the larger average edge width of the two directions of the direction set as the blur direction.

次に、解析実行手段220は、対象画像のボケ度Nを求める。画像のボケ度は、画像中のボケの程度の大小を示すものであり、例えば、画像中に最もぼけている方向(ここでは上記において求められたボケ方向)の平均エッジ幅を用いてもよいが、ここでは、ボケ方向における各々のエッジのエッジ幅を用いて図25に基づいたデータベースを利用してより精度良く求める。図25は、学習用の通常画像データベースとボケ(ピンボケおよびぶれ)画像データベースを元に、画像中の最もぼけている方向(通常画像の場合には、この方向に対応する方向が望ましいが、任意の方向であってもよい)のエッジ幅分布のヒストグラムを作成し、ボケ画像における頻度と通常画像における頻度(図示縦軸)の比率を評価値(図示スコア)としてエッジ幅毎に求めて得たものである。図25に基づいて、エッジ幅とスコアとを対応付けてなるデータベース(以下スコアデータベースという)が作成され、記憶手段225に記憶されている。   Next, the analysis execution unit 220 calculates the degree of blur N of the target image. The degree of blur of the image indicates the magnitude of the degree of blur in the image. For example, the average edge width in the direction most blurred in the image (here, the blur direction obtained above) may be used. However, in this case, the edge width of each edge in the blur direction is used to obtain more accurately using the database based on FIG. FIG. 25 is based on a normal image database for learning and a blurred (blurred and blurred) image database, and the direction in which the image is most blurred (in the case of a normal image, a direction corresponding to this direction is desirable, but arbitrary The edge width distribution histogram (which may be the direction of the image) is created, and the ratio between the frequency in the blurred image and the frequency in the normal image (the vertical axis in the drawing) is obtained for each edge width as an evaluation value (the score in the drawing). Is. Based on FIG. 25, a database (hereinafter referred to as a score database) in which the edge width and the score are associated with each other is created and stored in the storage unit 225.

解析実行手段220は、図25に基づいて作成され、記憶手段225に記憶されたスコアデータベースを参照し、対象画像のボケ方向の各エッジに対して、そのエッジ幅からスコアを取得し、ボケ方向の全てのエッジのスコアの平均値を対象画像のボケ度Nとして求める。求められた対象画像のボケ度Nが所定の閾値(T1とする)より小さければ、解析実行手段220は、対象画像が画像D0である場合には画像D0を、対象画像が瞳画像D5である場合にはこの瞳画像D5が対応する画像D0を通常画像として判別すると共に、画像D0が通常画像であることを示す情報Pを出力手段60に出力することをもって、処理を終了する。   The analysis execution unit 220 refers to the score database created based on FIG. 25 and stored in the storage unit 225, acquires a score from the edge width of each edge in the blur direction of the target image, and blur direction Is obtained as the degree of blur N of the target image. If the obtained blur degree N of the target image is smaller than a predetermined threshold (T1), the analysis execution unit 220 displays the image D0 when the target image is the image D0, and the target image is the pupil image D5. In this case, the image D0 corresponding to the pupil image D5 is determined as a normal image, and information P indicating that the image D0 is a normal image is output to the output means 60, and the processing is terminated.

一方、対象画像のボケ度Nが閾値T1以上であれば、解析実行手段220は、対象画像がボケ画像であると判別し、2つ目の処理に入る。   On the other hand, if the degree of blur N of the target image is greater than or equal to the threshold T1, the analysis execution unit 220 determines that the target image is a blur image and enters the second process.

解析実行手段220は、2つ目の処理として、まず、対象画像のぶれ度Kを求める。   As the second process, the analysis execution unit 220 first obtains the degree of blur K of the target image.

ボケ画像のボケにおけるぶれの程度の大小を示すぶれ度Kは、下記のような要素に基づいて求めることができる。   The degree of blur K indicating the degree of blur in the blur image can be obtained based on the following factors.

1.相関が最も小さい方向組(以下相関最小組)の相関値:この相関値が小さいほどぶれの程度が大きい
解析実行手段220は、この点に着目して、図26(a)に示す曲線に基づいて第1のぶれ度K1を求める。なお、図26(a)に示す曲線に応じて作成されたLUT(ルックアップテーブル)は、記憶手段225に記憶されており、解析実行手段220は、相関最小組の相関値に対応する第1のぶれ度K1を、記憶手段225から読み出すようにして第1のぶれ度K1を求める。
1. Correlation value of the direction group with the smallest correlation (hereinafter referred to as the minimum correlation group): The smaller the correlation value, the greater the degree of blurring. The analysis execution means 220 pays attention to this point and is based on the curve shown in FIG. To obtain the first degree of blur K1. Note that an LUT (look-up table) created according to the curve shown in FIG. 26A is stored in the storage unit 225, and the analysis execution unit 220 sets the first correlation value corresponding to the correlation value of the minimum correlation set. The first blur degree K1 is obtained by reading the blur degree K1 from the storage means 225.

2.相関最小組の2つの方向のうち、平均エッジ幅が大きい方向の平均エッジ幅:この平均エッジ幅が大きいほどぶれの程度が大きい
解析実行手段220は、この点に着目して、図26(b)に示す曲線に基づいて第2のぶれ度K2を求める。なお、図26(b)に示す曲線に応じて作成されたLUT(ルックアップテーブル)は、記憶手段225に記憶されており、解析実行手段220は、相関最小組の平均エッジ幅が大きい方向の平均エッジ幅に対応する第2のぶれ度K2を、記憶手段225から読み出すようにして第2のぶれ度K2を求める。
2. Of the two directions of the minimum correlation set, the average edge width in the direction where the average edge width is large: The larger the average edge width, the greater the degree of blurring. The analysis execution means 220 pays attention to this point, and FIG. ) To determine the second degree of blur K2. Note that an LUT (look-up table) created according to the curve shown in FIG. 26B is stored in the storage unit 225, and the analysis executing unit 220 has a direction in which the average edge width of the minimum correlation set is large. The second blurring degree K2 corresponding to the average edge width is read from the storage means 225 to obtain the second blurring degree K2.

3.相関最小組の2つの方向における夫々の平均エッジ幅の差:この差が大きいほどぶれの程度が大きい
解析実行手段220は、この点に着目して、図26(c)に示す曲線に基づいて第3のぶれ度K3を求める。なお、図26(c)に示す曲線に応じて作成されたLUT(ルックアップテーブル)は、記憶手段225に記憶されており、解析実行手段220は、相関最小組の2つの方向における夫々の平均エッジ幅の差に対応する第3のぶれ度K3を、記憶手段225から読み出すようにして第3のぶれ度K3を求める。
3. Difference in average edge width between the two directions of the minimum correlation pair: The greater this difference, the greater the degree of blurring. The analysis execution means 220 pays attention to this point and based on the curve shown in FIG. A third blurring degree K3 is obtained. Note that an LUT (look-up table) created according to the curve shown in FIG. 26C is stored in the storage unit 225, and the analysis execution unit 220 calculates the average of each of the two directions of the minimum correlation set. The third blur degree K3 corresponding to the edge width difference is read from the storage means 225 to obtain the third blur degree K3.

解析実行手段220は、このようにして第1のぶれ度K1、第2のぶれ度K2、第3のぶれ度K3を求めると共に、下記の式(2)に従って、K1、K2、K3を用いてボケ画像となる対象画像のぶれ度Kを求める。   The analysis execution means 220 obtains the first blur degree K1, the second blur degree K2, and the third blur degree K3 in this way, and uses K1, K2, and K3 according to the following equation (2). The degree of blur K of the target image that becomes a blurred image is obtained.


K=K1×K2×K3 (2)
但し、K:ぶれ度
K1:第1のぶれ度
K2:第2のぶれ度
K3:第3のぶれ度

次に、解析実行手段220は、対象画像のボケ幅Lを求める。ここで、ぶれ度Kに関係なく、ボケ幅Lとしてボケ方向におけるエッジの平均幅を求めるようにしてもよいし、図21に示す8つの方向のすべてにおけるエッジの平均エッジ幅を求めてボケ幅Lとするようにしてもよい。

K = K1 × K2 × K3 (2)
Where K: degree of blurring K1: first degree of blurring K2: second degree of blurring K3: third degree of blurring

Next, the analysis execution unit 220 obtains the blur width L of the target image. Here, regardless of the blurring degree K, the average width of edges in the blur direction may be obtained as the blur width L, or the average edge width of edges in all eight directions shown in FIG. L may be used.

解析実行手段220は、対象画像が画像D0である場合に、求められたぶれ度K、ボケ幅Lをボケ度Nおよびボケ方向と共に画像D0のボケ情報Qとしてボケ補正手段230に出力すると共に、対象画像が瞳画像D5である場合においても、瞳画像D5から求められたぶれ度K、ボケ幅Lをボケ度Nおよびボケ方向と共に瞳画像D5が対応する画像D0のボケ情報Qとしてボケ補正手段230に出力する。   When the target image is the image D0, the analysis execution unit 220 outputs the obtained blur degree K and blur width L to the blur correction unit 230 as blur information Q of the image D0 together with the blur degree N and the blur direction. Even when the target image is the pupil image D5, the blur correction means uses the blur degree K and the blur width L obtained from the pupil image D5 as blur information Q of the image D0 corresponding to the pupil image D5 together with the blur degree N and the blur direction. 230.

図27は、20に示すボケ解析手段200の処理を示すフローチャートである。図示のように、ボケ解析手段200は、顔が含まれない画像D0の場合は画像D0であり、顔が含まれる画像D0の場合は画像D0の瞳画像D5である対象画像に対して、まず、エッジ検出手段212により図21に示す8つの異なる方向毎に所定の強度以上のエッジを検出して各々のエッジの座標位置を得、エッジプロファイル作成手段213により、これらの座標位置に基づき、対象画像を用いて各々のエッジに対して図22に示すようなエッジプロファイルを作成してエッジ絞込手段214に出力する(S212)。エッジ絞込手段214は、エッジプロファイル作成手段213から送信されてきたエッジプロファイルに基づいて、無効なエッジを除去し、残りのエッジのプロファイルをエッジ特徴量取得手段216に出力する(S214)。エッジ特徴量取得手段216は、エッジ絞込手段214から送信された各々のエッジのプロファイルに基づいて各エッジの幅を求めると共に、図21に示す方向毎にエッジ幅のヒストグラムを作成して、各エッジの幅および各方向のエッジ幅のヒストグラムを対象画像のエッジ特徴量Sとして解析実行手段220に出力する(S216)。解析実行手段220は、エッジ特徴量Sを用いて、まず対象画像のボケ方向およびボケ度Nを算出し、画像D0がボケ画像であるか通常画像であるかを判別する(S220、S225)。画像D0が通常画像であれば(S225:Yes)、解析実行手段220は、画像D0が通常画像であることを示す情報Pを出力手段270に出力する(S230)。一方、画像D0がボケ画像に判別されると(S225:No)、解析実行手段220は、対象画像に対してさらにぶれ度K、ボケ幅Lを算出し、ステップS220において求められたボケ度Nおよびボケ方向と共に画像D0のボケ情報Qとしてボケ補正手段230に出力する(S240、S245)。   FIG. 27 is a flowchart showing the processing of the blur analysis unit 200 shown in 20. As illustrated, the blur analysis unit 200 first applies an image D0 in the case of an image D0 that does not include a face to the target image that is the pupil image D5 of the image D0 in the case of an image D0 that includes a face. The edge detection means 212 detects edges having a predetermined intensity or more in each of the eight different directions shown in FIG. 21 to obtain the coordinate position of each edge, and the edge profile creation means 213 determines the object based on these coordinate positions. An edge profile as shown in FIG. 22 is created for each edge using the image and output to the edge narrowing means 214 (S212). The edge narrowing unit 214 removes invalid edges based on the edge profile transmitted from the edge profile creating unit 213, and outputs the remaining edge profile to the edge feature quantity acquisition unit 216 (S214). The edge feature quantity acquisition means 216 obtains the width of each edge based on the profile of each edge transmitted from the edge narrowing means 214 and creates a histogram of edge width for each direction shown in FIG. The histogram of the edge width and the edge width in each direction is output to the analysis execution unit 220 as the edge feature amount S of the target image (S216). The analysis execution unit 220 first calculates the blur direction and the blur degree N of the target image using the edge feature amount S, and determines whether the image D0 is a blur image or a normal image (S220, S225). If the image D0 is a normal image (S225: Yes), the analysis execution unit 220 outputs information P indicating that the image D0 is a normal image to the output unit 270 (S230). On the other hand, when the image D0 is determined to be a blurred image (S225: No), the analysis execution unit 220 further calculates the degree of blur K and the blur width L with respect to the target image, and the degree of blur N obtained in step S220. Then, together with the blur direction, the blur information Q of the image D0 is output to the blur correction unit 230 (S240, S245).

なお、本実施形態におけるボケ解析手段200は、2つの瞳画像(D5a,D5b)を用いて解析を行っているが、いずれか1つのみの瞳画像を用いるようにしてもよい。   Note that the blur analysis unit 200 in this embodiment performs analysis using two pupil images (D5a, D5b), but only one pupil image may be used.

ボケ補正手段230は、ボケ画像であると判別された画像D0に対して、ボケ解析手段200により得られた画像D0のボケ情報Qに基づいてボケ補正を行うものであり、図28は、その構成を示すブロック図である。   The blur correction unit 230 performs blur correction on the image D0 determined to be a blur image based on the blur information Q of the image D0 obtained by the blur analysis unit 200. FIG. It is a block diagram which shows a structure.

図28に示すように、ボケ補正手段230は、ボケ情報Qに基づいて画像D0を補正するためのパラメータEを設定するためのパラメータ設定手段235と、パラメータ設定手段235のための種々のデータベースを記憶した記憶手段240と、画像D0から高周波数成分Dhを抽出する高周波数成分抽出手段245と、パラメータEおよび高周波数成分Dhを用いて画像D0に対するボケ補正を実行する補正実行手段250とを有してなる。   As shown in FIG. 28, the blur correction unit 230 includes a parameter setting unit 235 for setting a parameter E for correcting the image D0 based on the blur information Q, and various databases for the parameter setting unit 235. The stored storage means 240, the high frequency component extraction means 245 for extracting the high frequency component Dh from the image D0, and the correction execution means 250 for executing the blur correction for the image D0 using the parameter E and the high frequency component Dh are provided. Do it.

本実施形態の画像処理システムAにおけるボケ補正手段230は、アン・シャープネス・マスキング(USM)補正方法でボケ画像となる画像D0に対して補正を施すものであり、パラメータ設定手段235は、ボケ情報Qに含まれるボケ幅Lとボケ方向に応じて、ボケ幅Lが大きいほど補正マスクのサイズが大きくなるように、ボケ方向に作用する方向性補正用の1次元補正マスクM1を設定すると共に、ボケ幅Lに応じて、ボケ幅Lが大きいほど補正マスクのサイズが大きくなるように等方性補正用の2次元補正マスクM2を設定する。なお、各ボケ幅に対応する2次元補正マスク、および各ボケ幅とボケ方向に対応する1次元補正マスクはデータベース(マスクデータベースという)として記憶手段240に記憶されており、パラメータ設定手段235は、記憶手段240に記憶されたマスクデータベースから、ボケ幅Lとボケ方向に基づいて1次元補正マスクM1を、ボケ幅Lに基づいて2次元補正マスクM2を取得する。   The blur correction unit 230 in the image processing system A of the present embodiment corrects the image D0 that becomes a blurred image by an unsharpness masking (USM) correction method, and the parameter setting unit 235 includes blur information. In accordance with the blur width L and the blur direction included in Q, a one-dimensional correction mask M1 for directivity correction that acts in the blur direction is set so that the larger the blur width L, the larger the correction mask size. In accordance with the blur width L, the two-dimensional correction mask M2 for isotropic correction is set so that the larger the blur width L, the larger the correction mask size. The two-dimensional correction mask corresponding to each blur width and the one-dimensional correction mask corresponding to each blur width and blur direction are stored in the storage unit 240 as a database (referred to as a mask database), and the parameter setting unit 235 includes: From the mask database stored in the storage unit 240, a one-dimensional correction mask M1 is acquired based on the blur width L and the blur direction, and a two-dimensional correction mask M2 is acquired based on the blur width L.

次に、パラメータ設定手段235は、下記の式(3)に従って、方向性補正用の1次元補正パラメータW1および等方性補正用の2次元補正パラメータW2を設定する。   Next, the parameter setting means 235 sets the one-dimensional correction parameter W1 for directionality correction and the two-dimensional correction parameter W2 for isotropic correction according to the following equation (3).


W1=N×K×M1
W2=N×(1−K)×M2 (3)
但し、W1:1次元補正パラメータ
W2:2次元補正パラメータ
N:ボケ度
K:ぶれ度
M1:1次元補正マスク
M2:2次元補正マスク

即ち、パラメータ設定手段235は、ボケ度Nが大きいほど等方性補正の強度と方向性補正の強度が強く、ぶれ度Kが大きいほど方向性補正の重みが大きくなるように補正パラメータW1とW2(合わせてパラメータEとする)を設定する。

W1 = N × K × M1
W2 = N * (1-K) * M2 (3)
However, W1: One-dimensional correction parameter
W2: Two-dimensional correction parameter
N: Defocus degree
K: Degree of blur
M1: One-dimensional correction mask
M2: Two-dimensional correction mask

That is, the parameter setting means 235 increases the correction parameters W1 and W2 so that the greater the degree of blur N, the stronger the isotropic correction and the higher the directionality correction, and the greater the blur degree K, the greater the weight for the directionality correction. (Also referred to as parameter E) is set.

補正実行手段250は、パラメータ設定手段235により設定されたパラメータEを用いて、高周波数成分抽出手段245により得られた高周波数成分Dhを強調することによって画像D0のボケ補正を実行し、具体的には下記の式(4)に従ってボケ補正を行う。   The correction execution unit 250 executes blur correction of the image D0 by emphasizing the high frequency component Dh obtained by the high frequency component extraction unit 245 using the parameter E set by the parameter setting unit 235, The blur correction is performed according to the following equation (4).


D’=D0+E×Dh (4)
但し、D’:補正済み画像
D0:補正前の画像
E:補正パラメータ
Dh:高周波数成分

出力手段270は、ボケ解析手段200から画像D0が通常画像であることを示す情報Pを受信した場合には画像D0を出力する一方、ボケ補正手段230から補正済み画像D’を受信した場合には補正済み画像D’を出力するものである。本実施形態の画像処理システムAにおいて、出力手段270による「出力」は印刷であり、出力手段270は、通常画像の画像D0、およびボケ画像の画像D0を補正して得た補正済み画像D’を印刷してプリントを得るものであるが、記録媒体に記憶したり、ネットワーク上における画像保管サーバや、画像の補正を依頼した依頼者により指定されたネットワーク上のアドレスなどに送信したりするなどのものであってもよい。

D ′ = D0 + E × Dh (4)
Where D ': corrected image
D0: Image before correction
E: Correction parameter
Dh: High frequency component

The output unit 270 outputs the image D0 when receiving the information P indicating that the image D0 is a normal image from the blur analysis unit 200, while receiving the corrected image D ′ from the blur correction unit 230. Outputs a corrected image D ′. In the image processing system A of the present embodiment, “output” by the output unit 270 is printing, and the output unit 270 corrects the image D ′ that has been obtained by correcting the image D0 of the normal image and the image D0 of the blurred image. Is printed to obtain a print, but it is stored in a recording medium, sent to an image storage server on the network, an address on the network specified by the client who requested the image correction, etc. It may be.

図29は、図1に示す実施形態の画像処理システムAの動作を示すフローチャートである。図示のように、画像D0に対して、まず、瞳検出手段100により顔の検出が行われる(S250)。顔が検出されなければ(S255:No)、ボケ解析手段200は、画像D0全体のデータを用いてボケの解析を行う(S260)。一方、顔が検出されれば(S255:Yes)、瞳検出手段100は、さらに瞳の検出を行って、瞳画像D5を得(S270)、ボケ解析手段200は、瞳画像のデータを用いてボケの解析を行う(S275)。   FIG. 29 is a flowchart showing the operation of the image processing system A according to the embodiment shown in FIG. As shown in the figure, the face detection is first performed on the image D0 by the pupil detection unit 100 (S250). If no face is detected (S255: No), the blur analysis unit 200 analyzes blur using the data of the entire image D0 (S260). On the other hand, if a face is detected (S255: Yes), the pupil detection unit 100 further detects the pupil to obtain a pupil image D5 (S270), and the blur analysis unit 200 uses the pupil image data. The blur is analyzed (S275).

ボケ解析手段200は、画像D0、または瞳画像D5を解析した結果、画像D0が通常画像であると判別した場合には、画像D0が通常画像であることを示す情報Pを出力手段270に出力し、出力手段270により画像D0をプリントアウトする(S280:Yes、S290)一方、画像D0がボケ画像であると判別した場合には、画像D0に対して求めたボケ情報Qをボケ補正手段230に出力し、ボケ補正手段230により、ボケ情報Qに基づいて画像D0のボケ補正を行う(S280:No、S285)。なお、ボケ補正手段230により得られた補正済み画像D’も、出力手段270によりプリントアウトされる(S290)。   When the blur analysis unit 200 determines that the image D0 is a normal image as a result of analyzing the image D0 or the pupil image D5, the blur analysis unit 200 outputs information P indicating that the image D0 is a normal image to the output unit 270. Then, the output unit 270 prints out the image D0 (S280: Yes, S290). On the other hand, if it is determined that the image D0 is a blurred image, the blur correction unit 230 uses the blur information Q obtained for the image D0. Then, the blur correction unit 230 performs blur correction on the image D0 based on the blur information Q (S280: No, S285). The corrected image D ′ obtained by the blur correction unit 230 is also printed out by the output unit 270 (S290).

図30は、本発明の第2の実施形態となる画像処理システムBの構成を示すブロック図である。図示のように、本実施形態の画像処理システムBは、瞳検出手段100と、ボケ解析手段300と、ボケ補正手段350と、出力手段270とを有してなるものである。なお、本実施形態の画像処理システムBの各手段のうち、ボケ解析手段300およびボケ補正手段350が、図1に示す実施形態の画像処理システムAの相対応する手段と部分的に異なるが、他の手段は、図1に示す実施形態の画像処理システムAの相対応する手段と同じであるため、ここでボケ解析手段300およびボケ補正手段350以外の他の手段について、図1に示す実施形態の画像処理システムAの相対応する手段と同じ符号を付与すると共に、それらの詳細な説明については省略する。   FIG. 30 is a block diagram showing a configuration of an image processing system B according to the second embodiment of the present invention. As shown in the figure, the image processing system B of this embodiment includes a pupil detection unit 100, a blur analysis unit 300, a blur correction unit 350, and an output unit 270. Among the units of the image processing system B of the present embodiment, the blur analysis unit 300 and the blur correction unit 350 are partially different from the corresponding units of the image processing system A of the embodiment shown in FIG. The other means are the same as the corresponding means of the image processing system A of the embodiment shown in FIG. 1, and therefore, other means other than the blur analysis means 300 and the blur correction means 350 will be described in the implementation shown in FIG. The same reference numerals are assigned to the corresponding means of the image processing system A of the embodiment, and detailed descriptions thereof are omitted.

図31は、図30に示す画像処理システムBにおけるボケ解析手段300の構成を示すブロック図である。図示のように、ボケ解析手段300は、エッジ検出手段312と、エッジプロファイル作成手段313と、エッジ絞込手段314と、エッジ特徴量取得手段316と、解析手段320と、解析手段320のための種々のデータベースを記憶する記憶手段330と、上記各手段の制御を行う制御手段305とを有してなる。なお、解析手段320は、第1の解析手段322と、第2の解析手段324と、第3の解析手段326を備えてなる。   FIG. 31 is a block diagram showing a configuration of the blur analysis means 300 in the image processing system B shown in FIG. As illustrated, the blur analysis unit 300 includes an edge detection unit 312, an edge profile creation unit 313, an edge narrowing unit 314, an edge feature quantity acquisition unit 316, an analysis unit 320, and an analysis unit 320. It has a storage means 330 for storing various databases and a control means 305 for controlling each of the above means. The analysis unit 320 includes a first analysis unit 322, a second analysis unit 324, and a third analysis unit 326.

ボケ解析手段300の制御手段305は、瞳検出手段100により顔が検出されたか否かに基づいて制御を行うものである。瞳検出手段100により、画像D0から顔が検出されなかった場合、制御手段305は、エッジ検出手段312に画像D0に対するエッジ検出を行わせる。なお、エッジ検出手段312と、エッジプロファイル作成手段313と、エッジ絞込手段314と、エッジ特徴量取得手段316との具体的の動作は、図1に示す画像処理システムAにおけるボケ解析手段200の相対応する手段の動作と夫々同じであるため、ここで詳細な説明を省略する。エッジ検出手段312により検出されたエッジに対して、エッジプロファイル作成手段313と、エッジ絞込手段314と、エッジ特徴量取得手段316との夫々の処理が行われ、画像D0におけるエッジの特徴量Szが取得される。なお、ここのエッジの特徴量Szおよび後述する特徴量Seは、図1に示す実施形態の画像処理システムAにおける特徴量Sと同じように、各方向におけるエッジの幅およびエッジ幅のヒストグラムとからなる。   The control unit 305 of the blur analysis unit 300 performs control based on whether or not a face is detected by the pupil detection unit 100. When the face is not detected from the image D0 by the pupil detection unit 100, the control unit 305 causes the edge detection unit 312 to perform edge detection on the image D0. The specific operations of the edge detection unit 312, the edge profile creation unit 313, the edge narrowing unit 314, and the edge feature amount acquisition unit 316 are the same as those of the blur analysis unit 200 in the image processing system A shown in FIG. Since the operations of the corresponding means are the same, detailed description is omitted here. With respect to the edges detected by the edge detection means 312, the edge profile creation means 313, the edge narrowing means 314, and the edge feature quantity acquisition means 316 are respectively processed, and the edge feature quantity Sz in the image D0. Is acquired. Note that the feature value Sz of the edge and the feature value Se described later are obtained from the edge width and edge width histogram in each direction in the same manner as the feature value S in the image processing system A of the embodiment shown in FIG. Become.

制御手段305は、第1の解析手段322にエッジの特徴量Szに対する解析を行わせる。第1の解析手段322は、エッジの特徴量Szに基づいて、画像D0がボケ画像であるか否かの判別を行うと共に、通常画像である場合には情報Pを出力手段270に送信すると共に、ボケ画像である場合にはボケ情報Qをボケ補正手段350に送信する。なお、第1の解析手段322の具体的な処理は、図1に示す実施形態の画像処理システムAにおけるボケ解析手段200の解析実行手段220の処理と同じである。   The control unit 305 causes the first analysis unit 322 to analyze the edge feature quantity Sz. The first analysis unit 322 determines whether or not the image D0 is a blurred image based on the edge feature amount Sz, and transmits information P to the output unit 270 when the image D0 is a normal image. If it is a blurred image, the blur information Q is transmitted to the blur correction unit 350. The specific processing of the first analysis unit 322 is the same as the processing of the analysis execution unit 220 of the blur analysis unit 200 in the image processing system A of the embodiment shown in FIG.

一方、瞳検出手段100により顔乃至瞳が検出され、瞳画像D5が得られた場合には、制御手段305は、エッジ検出手段312に瞳画像D5に対するエッジ検出を行わせる。また、エッジ検出手段312により検出されたエッジに対して、エッジプロファイル作成手段313、エッジ絞込手段314と、エッジ特徴量取得手段316との夫々の処理が行われ、瞳画像D5におけるエッジの特徴量Seが取得される。   On the other hand, when a face or a pupil is detected by the pupil detection unit 100 and a pupil image D5 is obtained, the control unit 305 causes the edge detection unit 312 to perform edge detection on the pupil image D5. Further, the edge profile generation unit 313, the edge narrowing unit 314, and the edge feature amount acquisition unit 316 are subjected to the processing of the edge detected by the edge detection unit 312 and the feature of the edge in the pupil image D5. A quantity Se is obtained.

ここで、制御手段305は、まず、第2の解析手段324に、瞳画像D5がボケ画像か否か、ボケ画像である場合にはさらにピンボケかぶれかの解析を行わせる。第2の解析手段324は、まず、図1に示す実施形態の画像処理システムAにおけるボケ解析手段200の解析手段220と同じように、瞳画像D5の特徴量Seに基づいて、ボケ方向(ここでhとする)、ボケ度Nを求める。求められたボケ度Nが閾値T1以下である場合には、瞳画像D0が対応する画像D0を通常画像として判別すると共に、画像D0が通常画像であることを示す情報Pを出力手段270に送信する。一方、求められたボケ度Nが閾値T1より大きい場合には、瞳画像D0が対応する画像D0をボケ画像として判別すると共に、さらにそのぶれ度Kを求める。なお、第2の解析手段324によるぶれ度Kの算出方法も、図1に示す実施形態の画像処理システムAにおけるボケ解析手段200の解析手段220の算出方法と同じである。求められたぶれ度Kに基づいて、第2の解析手段324は、瞳画像D0の対応する画像D0がピンボケ画像かぶれ画像かの判別を行う。具体的には、ぶれ度Kが所定の閾値T2以下であれば、画像D0をピンボケ画像として判別し、ぶれ度Kが閾値T2より大きければ、画像D0をぶれ画像として判別する。   Here, the control unit 305 first causes the second analysis unit 324 to analyze whether or not the pupil image D5 is a blurred image, and if the pupil image D5 is a blurred image, further analyze whether the blur is out of focus. First, the second analysis unit 324, based on the feature amount Se of the pupil image D5, similarly to the analysis unit 220 of the blur analysis unit 200 in the image processing system A of the embodiment shown in FIG. H), and the degree of blur N is obtained. When the obtained blur degree N is equal to or less than the threshold value T1, the image D0 corresponding to the pupil image D0 is determined as a normal image, and information P indicating that the image D0 is a normal image is transmitted to the output unit 270. To do. On the other hand, when the obtained blur degree N is larger than the threshold value T1, the image D0 corresponding to the pupil image D0 is determined as a blur image, and the blur degree K is further obtained. The method of calculating the degree of blur K by the second analysis unit 324 is the same as the calculation method of the analysis unit 220 of the blur analysis unit 200 in the image processing system A of the embodiment shown in FIG. Based on the obtained degree of blur K, the second analysis unit 324 determines whether the image D0 corresponding to the pupil image D0 is an out-of-focus image or a blurred image. Specifically, if the degree of blur K is equal to or less than a predetermined threshold T2, the image D0 is determined as a blurred image, and if the degree of blur K is greater than the threshold T2, the image D0 is determined as a blurred image.

ピンボケ画像として判別された画像D0に対して、第2の解析手段324は、その瞳画像D5のエッジ特徴量Seからさらにボケ幅Lを求めて、画像D0がピンボケ画像であることを示す情報と、ボケ幅Lとをボケ情報Qとしてボケ補正手段350に送信して処理を終了する。   For the image D0 determined as the out-of-focus image, the second analysis unit 324 further obtains the blur width L from the edge feature amount Se of the pupil image D5, and information indicating that the image D0 is a out-of-focus image. Then, the blur width L is transmitted to the blur correction unit 350 as blur information Q, and the process ends.

一方、ぶれ画像として判別された画像D0に対して、第2の解析手段324は、そのボケ方向、すなわちぶれ方向hを第3の解析手段326に送信して処理を終了する。また、画像D0がぶれ画像であると判別された場合、制御手段305は、画像D0全体に対して、エッジ検出手段312に、画像D0のぶれ方向hにおけるエッジを検出させる。ぶれ方向hにおいて検出されたエッジに対して、エッジプロファイル作成手段313と、エッジ絞込手段314との夫々の処理が行われ、画像D0において、ぶれ方向hにおける各々のエッジのプロファイルが特徴量Sz1として取得される。   On the other hand, the second analysis unit 324 transmits the blur direction, that is, the blur direction h to the third analysis unit 326 with respect to the image D0 determined as the blur image, and ends the process. If it is determined that the image D0 is a blurred image, the control unit 305 causes the edge detection unit 312 to detect an edge in the blur direction h of the image D0 for the entire image D0. The edge profile creation means 313 and the edge narrowing means 314 are respectively processed for the edge detected in the blur direction h, and the profile of each edge in the blur direction h is the feature quantity Sz1 in the image D0. Get as.

第3の解析手段326は、特徴量Sz1の各エッジのプロファイルから、ぶれ方向hにおけるエッジの平均幅をぶれ幅として算出し、画像D0がぶれ画像であることを示す情報と、このぶれ幅およびぶれ方向hとをボケ情報Q1としてボケ補正手段350に送信する。   The third analysis means 326 calculates the average width of the edges in the blur direction h as the blur width from the profile of each edge of the feature amount Sz1, information indicating that the image D0 is a blur image, the blur width and The blur direction h is transmitted to the blur correction unit 350 as blur information Q1.

図32は、図31に示すボケ解析手段300の処理を示すフローチャートである。図示のように、ボケ解析手段300の制御手段305は、瞳検出手段100により顔が検出されなかった画像D0に対して、エッジ検出手段312に画像D0全体から図21に示す8方向毎にエッジを検出させる。検出されたエッジに対して、エッジプロファイル作成手段313、エッジ絞込手段314、エッジ特徴量取得手段316の夫々の処理が行われ、画像D0のエッジの特徴量Szが得られる。そして、第1の解析手段322は、特徴量Szを用いて、画像D0におけるボケ方向、ボケ度Nを求めて画像D0が通常画像であるか否かの判別を行うと共に、通常画像として判別された画像D0に対してはボケ画像ではないことを示す情報Pを出力手段270に出力する一方、ボケ画像として判別された画像D0に対してはさらにボケ幅L、ぶれ度Kを求めてボケ方向、ボケ度Nと共にボケ情報Qとしてボケ補正手段350に送信する(S300:No、S305、S310)。   FIG. 32 is a flowchart showing processing of the blur analysis unit 300 shown in FIG. As shown in the figure, the control means 305 of the blur analysis means 300 performs an edge detection from the entire image D0 to the edge detection means 312 for every eight directions shown in FIG. 21 with respect to the image D0 whose face is not detected by the pupil detection means 100. Is detected. The detected edge is processed by the edge profile creation means 313, the edge narrowing means 314, and the edge feature quantity acquisition means 316, and the edge feature quantity Sz of the image D0 is obtained. Then, the first analysis unit 322 uses the feature amount Sz to determine the blur direction and the blur degree N in the image D0 to determine whether the image D0 is a normal image, and is also determined as a normal image. Information P indicating that the image D0 is not a blurred image is output to the output unit 270. On the other hand, for the image D0 determined as a blurred image, a blur width L and a blur degree K are further obtained to determine the blur direction. Then, it transmits to the blur correction means 350 together with the blur degree N as blur information Q (S300: No, S305, S310).

一方、瞳検出手段100により顔乃至瞳が検出された(S300:Yes)画像D0に対して、制御手段305は、エッジ検出手段312に画像D0の瞳画像D5から図21に示す8方向毎にエッジを検出させる。出されたエッジに対して、エッジプロファイル作成手段313、エッジ絞込手段314、エッジ特徴量取得手段316の夫々の処理が行われ、瞳画像D5におけるエッジの特徴量Seが得られる。第2の解析手段324は、特徴量Seを用いて、瞳画像D5におけるボケ方向、ボケ度Nを求めて瞳画像D5の対応する画像D0が通常画像かボケ画像かの判別を行うと共に、通常画像として判別された画像D0に対してボケ画像ではないことを示す情報Pを出力手段270に出力する(S320、S325:Yes、S330)。ステップS325においてボケ画像として判別された(S320、S325:No)画像D0に対しては、第2の解析手段324は、さらにピンボケ画像かぶれ画像かの判別を行い、ピンボケ画像の場合においては、画像D0の瞳画像D5の特徴量Seからボケ幅を求めて画像D0のボケ幅とし、画像D0がピンボケ画像であることを示す情報と共にピンボケ画像D0のボケ情報Qとしてボケ補正手段350に送信する(S340:Yes、S345)一方、ぶれ画像の場合においては、ぶれ方向hとなるボケ方向を第3の解析手段326に送信する(S340:No、S350)。第3の解析手段326は、エッジ検出手段312、エッジプロファイル作成手段313、エッジ絞込手段314、エッジ特徴量取得手段316により、瞳画像D5が対応する画像D0全体から求められた、ぶれ方向hにおけるエッジの特徴量Sz1を用いて、ぶれ方向hにおけるエッジの平均幅を算出してぶれ幅とし、このぶれ幅、ぶれ方向h、および画像D0がぶれ画像であることを示す情報をぶれ画像D0のボケ情報Q1としてボケ補正手段350に送信する(S355、S360)。   On the other hand, for the image D0 in which a face or pupil is detected by the pupil detection unit 100 (S300: Yes), the control unit 305 causes the edge detection unit 312 to detect the pupil image D5 of the image D0 every eight directions shown in FIG. Let the edge be detected. The edge profile creation unit 313, the edge narrowing unit 314, and the edge feature quantity acquisition unit 316 are each processed on the extracted edge, and the edge feature quantity Se in the pupil image D5 is obtained. The second analyzing means 324 uses the feature amount Se to determine the blur direction and the blur degree N in the pupil image D5 and determine whether the corresponding image D0 of the pupil image D5 is a normal image or a blur image. Information P indicating that the image D0 determined as an image is not a blurred image is output to the output means 270 (S320, S325: Yes, S330). For the image D0 determined as a blurred image in step S325 (S320, S325: No), the second analysis unit 324 further determines whether the image is a blurred image or a blurred image. The blur width is obtained from the feature amount Se of the pupil image D5 of D0 to obtain the blur width of the image D0, and is transmitted to the blur correction unit 350 as blur information Q of the blur image D0 together with information indicating that the image D0 is a blur image. S340: Yes, S345) On the other hand, in the case of a blurred image, the blur direction that is the blur direction h is transmitted to the third analysis unit 326 (S340: No, S350). The third analysis unit 326 is the blur direction h obtained from the entire image D0 corresponding to the pupil image D5 by the edge detection unit 312, the edge profile creation unit 313, the edge narrowing unit 314, and the edge feature amount acquisition unit 316. Using the edge feature quantity Sz1 at, the average edge width in the blur direction h is calculated as the blur width, and the blur width, the blur direction h, and information indicating that the image D0 is the blurred image is the blurred image D0. The blur information Q1 is transmitted to the blur correction unit 350 (S355, S360).

このように、ボケ補正手段350には、3種類のボケ情報Qが送信される。1つ目は、顔が検出されなかった画像D0全体の画像を用いて、第1の解析手段322により得られた画像D0におけるボケ度N、ボケ幅L、ボケ方向、ぶれ度Kとからなるボケ情報であり、2つ目は、顔乃至瞳が検出された画像D0の瞳画像D5を用いて、第2の解析手段324により得られた、画像D0がピンボケ画像であることを示す情報およびピンボケの幅とからなるボケ情報であり、3つ目は、第2の解析手段324により、画像D0の瞳画像D5を用いて得られた画像D0のぶれ方向h、および画像D0全体を用いて第3の解析手段326により得られたぶれ方向hにおけるぶれ幅、および画像D0がぶれ画像であることを示す情報からなるボケ情報Q1である。   As described above, three types of blur information Q are transmitted to the blur correction unit 350. The first is composed of the blur degree N, the blur width L, the blur direction, and the blur degree K in the image D0 obtained by the first analysis unit 322 using the entire image D0 in which no face is detected. The second is blur information, and the second is information indicating that the image D0 is a defocused image obtained by the second analysis unit 324 using the pupil image D5 of the image D0 from which the face or pupil is detected. The third is blur information including the width of the blur, and the third is the blur direction h of the image D0 obtained by the second analysis unit 324 using the pupil image D5 of the image D0 and the entire image D0. The blur information Q1 includes the blur width in the blur direction h obtained by the third analysis unit 326 and information indicating that the image D0 is a blur image.

図33は、ボケ補正手段350の構成を示すブロック図である。図示のように、ボケ補正手段350は、ボケ解析手段300からのボケ情報に基づいて補正パラメータEを設定するパラメータ設定手段352と、パラメータ設定手段352のための種々のデータベースを記憶した記憶手段354と、画像D0から高周波成分を抽出する高周波数成分抽出手段356と、パラメータEを用いて高周波数成分Dhを強調して画像D0に加算することによって画像D0のボケを補正するボケ実行手段360とを有してなる。   FIG. 33 is a block diagram showing a configuration of the blur correction unit 350. As illustrated, the blur correction unit 350 includes a parameter setting unit 352 that sets a correction parameter E based on blur information from the blur analysis unit 300, and a storage unit 354 that stores various databases for the parameter setting unit 352. A high frequency component extraction unit 356 that extracts a high frequency component from the image D0, and a blur execution unit 360 that corrects the blur of the image D0 by emphasizing the high frequency component Dh using the parameter E and adding it to the image D0. It has.

パラメータ設定手段352は、上記1つ目のボケ情報Qを受信すると、図1に示す実施形態の画像処理システムAにおけるボケ補正手段230のパラメータ設定手段235と同じように、ボケ情報Qに含まれるボケ幅Lとボケ方向に応じて、ボケ幅Lが大きいほど補正マスクのサイズが大きくなるように、ボケ方向に作用する方向性補正用の1次元補正マスクM1を設定すると共に、ボケ幅Lに応じて、ボケ幅Lが大きいほど補正マスクのサイズが大きくなるように等方性補正用の2次元補正マスクM2を設定する。なお、各ボケ幅に対応する2次元補正マスク、および各ボケ幅とボケ方向に対応する1次元補正マスクはデータベース(マスクデータベースという)として記憶手段354に記憶されており、パラメータ設定手段352は、記憶手段354に記憶されたマスクデータベースから、ボケ幅Lとボケ方向に基づいて1次元補正マスクM1を、ボケ幅Lに基づいて2次元補正マスクM2を取得する。   When the parameter setting unit 352 receives the first blur information Q, it is included in the blur information Q in the same manner as the parameter setting unit 235 of the blur correction unit 230 in the image processing system A of the embodiment shown in FIG. In accordance with the blur width L and the blur direction, a one-dimensional correction mask M1 for directivity correction acting in the blur direction is set so that the larger the blur width L, the larger the correction mask size. Accordingly, the two-dimensional correction mask M2 for isotropic correction is set so that the size of the correction mask increases as the blur width L increases. The two-dimensional correction mask corresponding to each blur width and the one-dimensional correction mask corresponding to each blur width and blur direction are stored in the storage unit 354 as a database (referred to as a mask database), and the parameter setting unit 352 includes: From the mask database stored in the storage unit 354, the one-dimensional correction mask M1 is acquired based on the blur width L and the blur direction, and the two-dimensional correction mask M2 is acquired based on the blur width L.

次に、パラメータ設定手段352は、下記の式(3)に従って、方向性補正用の1次元補正パラメータW1および等方性補正用の2次元補正パラメータW2を設定する。   Next, the parameter setting unit 352 sets the one-dimensional correction parameter W1 for directionality correction and the two-dimensional correction parameter W2 for isotropic correction according to the following equation (3).


W1=N×K×M1
W2=N×(1−K)×M2 (3)
但し、W1:1次元補正パラメータ
W2:2次元補正パラメータ
N:ボケ度
K:ぶれ度
M1:1次元補正マスク
M2:2次元補正マスク

即ち、パラメータ設定手段352は、ボケ度Nが大きいほど等方性補正の強度と方向性補正の強度が強く、ぶれ度Kが大きいほど方向性補正の重みが大きくなるように補正パラメータW1とW2(合わせてパラメータEとする)を設定する。

W1 = N × K × M1
W2 = N * (1-K) * M2 (3)
However, W1: One-dimensional correction parameter
W2: Two-dimensional correction parameter
N: Defocus degree
K: Degree of blur
M1: One-dimensional correction mask
M2: Two-dimensional correction mask

That is, the parameter setting means 352 has the correction parameters W1 and W2 such that the greater the degree of blur N, the stronger the isotropic correction strength and the directionality correction strength, and the greater the blur degree K, the greater the weight of the directionality correction. (Also referred to as parameter E) is set.

一方、パラメータ設定手段352は、上記2つ目のボケ情報Qを受信すると、このボケ情報Qに含まれるボケ幅に応じた等方性の、ピンボケを補正するための2次元補正マスクM2を記憶手段354から読み出してピンボケ画像D0の補正パラメータEとして設定する。   On the other hand, when the parameter setting unit 352 receives the second blur information Q, the parameter setting unit 352 stores a two-dimensional correction mask M2 for correcting the blurring that is isotropic according to the blur width included in the blur information Q. It is read from the means 354 and set as the correction parameter E of the out-of-focus image D0.

また、パラメータ設定手段352は、上記3つ目のボケ情報Q1を受信すると、このボケ情報Qに含まれるぶれ幅およびぶれ方向hに応じた方向性の、ぶれを補正するための1次元補正マスクM1を記憶部354から読み出してぶれ画像D0の補正パラメータEとする。   Further, when the parameter setting means 352 receives the third blur information Q1, the one-dimensional correction mask for correcting the blur in the direction corresponding to the blur width and the blur direction h included in the blur information Q. M1 is read from the storage unit 354 and used as the correction parameter E of the blurred image D0.

補正実行手段360は、図1に示す実施形態の画像処理システムAにおけるボケ補正手段230の補正実行手段250と同じように、パラメータEを用いて、高周波数成分Dhを強調することによって画像D0のボケ補正を実行し、具体的には下記の式(4)に従ってボケ補正を行う。   Similar to the correction execution unit 250 of the blur correction unit 230 in the image processing system A of the embodiment shown in FIG. 1, the correction execution unit 360 emphasizes the high frequency component Dh using the parameter E, thereby correcting the image D0. The blur correction is executed. Specifically, the blur correction is performed according to the following equation (4).


D’=D0+E×Dh (4)
但し、D’:補正済み画像
D0:補正前の画像
E:補正パラメータ
Dh:高周波数成分

なお、ボケ補正手段350により得られた補正済み画像D’および通常画像である画像D0が、出力手段270によりプリントアウトすることによって出力される。

D ′ = D0 + E × Dh (4)
Where D ': corrected image
D0: Image before correction
E: Correction parameter
Dh: High frequency component

The corrected image D ′ obtained by the blur correction unit 350 and the image D0 that is a normal image are output by being printed out by the output unit 270.

本発明の第1の実施形態となる画像処理システムAの構成を示すブロック図1 is a block diagram showing a configuration of an image processing system A according to a first embodiment of the present invention. 図1に示す画像処理システムAにおける瞳検出手段100の構成を示すブロック図1 is a block diagram showing the configuration of the pupil detection means 100 in the image processing system A shown in FIG. 瞳検出手段100の検出手段1の構成を示すブロック図The block diagram which shows the structure of the detection means 1 of the pupil detection means 100 目の位置を示す図Illustration showing eye position (a)は水平方向のエッジ検出フィルタを示す図、(b)は垂直方向のエッジ検出フィルタを示す図(A) is a diagram showing a horizontal edge detection filter, (b) is a diagram showing a vertical edge detection filter 勾配ベクトルの算出を説明するための図Diagram for explaining calculation of gradient vector (a)は人物の顔を示す図、(b)は(a)に示す人物の顔の目および口付近の勾配ベクトルを示す図(A) is a figure which shows a person's face, (b) is a figure which shows the gradient vector of eyes and mouth vicinity of the person's face shown to (a). (a)は正規化前の勾配ベクトルの大きさのヒストグラムを示す図、(b)は正規化後の勾配ベクトルの大きさのヒストグラムを示す図、(c)は5値化した勾配ベクトルの大きさのヒストグラムを示す図、(d)は正規化後の5値化した勾配ベクトルの大きさのヒストグラムを示す図(A) is a diagram showing a histogram of the magnitude of a gradient vector before normalization, (b) is a diagram showing a histogram of the magnitude of a gradient vector after normalization, and (c) is a magnitude of a gradient vector obtained by quinarization. The figure which shows the histogram of the length, (d) is a figure which shows the histogram of the magnitude | size of the quinary gradient vector after normalization 参照データの学習に用いられる顔であることが分かっているサンプル画像の例を示す図The figure which shows the example of the sample image known to be the face used for learning of reference data 参照データの学習に用いられる顔であることが分かっているサンプル画像の例を示す図The figure which shows the example of the sample image known to be the face used for learning of reference data 顔の回転を説明するための図Illustration for explaining face rotation 参照データの学習手法を示すフローチャートFlow chart showing learning method of reference data 識別器の導出方法を示す図Diagram showing how to derive a classifier 識別対象画像の段階的な変形を説明するための図The figure for demonstrating the stepwise deformation | transformation of an identification object image 図3に示す検出手段1の処理を示すフローチャートThe flowchart which shows the process of the detection means 1 shown in FIG. 瞳検出手段100を説明するための図The figure for demonstrating the pupil detection means 100 輝度ヒストグラムLuminance histogram 瞳検出手段100における投票部30に使用された重付け係数のテーブルの例Example of table of weighting coefficients used in voting unit 30 in pupil detecting means 100 瞳検出手段100の処理を示すフローチャートThe flowchart which shows the process of the pupil detection means 100 図1に示す画像処理システムAにおけるボケ解析手段200の構成を示すブロック図1 is a block diagram showing a configuration of a blur analysis unit 200 in the image processing system A shown in FIG. エッジを検出する際に用いられる方向の例を示す図The figure which shows the example of the direction used when detecting an edge エッジプロファイルを示す図Diagram showing edge profile エッジ幅のヒストグラムを示す図Diagram showing edge width histogram 解析実行手段220の動作を説明するための図The figure for demonstrating operation | movement of the analysis execution means 220 ボケ度の算出を説明するための図Diagram for explaining the calculation of the degree of blur ぶれ度の算出を説明するための図Diagram for explaining the calculation of blurring degree 図20に示すボケ解析手段200の処理を示すフローチャート20 is a flowchart showing processing of the blur analysis unit 200 shown in FIG. ボケ補正手段230の構成を示すブロック図The block diagram which shows the structure of the blur correction | amendment means 230 図1に示す画像処理システムAの処理を示すフローチャート1 is a flowchart showing processing of the image processing system A shown in FIG. 本発明の第2の実施形態となる画像処理システムBの構成を示すブロック図The block diagram which shows the structure of the image processing system B used as the 2nd Embodiment of this invention. 画像処理システムBにおけるボケ解析手段300の構成を示すブロック図The block diagram which shows the structure of the blur analysis means 300 in the image processing system B ボケ解析手段300の処理を示すフローチャートThe flowchart which shows the process of the blur analysis means 300 画像処理システムBにおけるボケ補正手段350の構成を示すブロック図The block diagram which shows the structure of the blur correction | amendment means 350 in the image processing system B

符号の説明Explanation of symbols

100 瞳検出手段
200,300 ボケ解析手段
230,350 ボケ補正手段
270 出力手段
C0 顔を識別するための特徴量
D0 デジタル写真画像
D’ 補正済み画像
H0 参照データ
E 補正パラメータ
K ぶれ度
L ボケ幅
M1 1次元補正マスク
M2 2次元補正マスク
N ボケ度
Q,Q1 ボケ情報
S エッジ特徴量
100 pupil detection means 200,300 blur analysis means 230,350 blur correction means 270 output means C0 feature quantity D0 digital photograph image D ′ corrected image H0 reference data E correction parameter K blurring degree L blur width M1 One-dimensional correction mask M2 Two-dimensional correction mask N Degree of blur Q, Q1 Blur information S Edge feature

Claims (18)

デジタル写真画像におけるボケの態様を示すボケ情報を得る画像処理方法において、
前記デジタル写真画像から、点状部を検出し、
該点状部の画像のデータを用いて前記デジタル写真画像の前記ボケ情報を求めることを特徴とする画像処理方法。
In an image processing method for obtaining blur information indicating a blur mode in a digital photographic image,
From the digital photographic image, a point-like portion is detected,
An image processing method characterized in that the blur information of the digital photographic image is obtained using image data of the dot-like portion.
前記デジタル写真画像が、人物の写真画像であり、
前記点状部が、前記人物の瞳であることを特徴とする請求項1記載の画像処理方法。
The digital photographic image is a photographic image of a person;
The image processing method according to claim 1, wherein the dotted portion is a pupil of the person.
前記デジタル写真画像が、人物の写真画像であり、
前記点状部が、前記人物の顔輪郭部分であることを特徴とする請求項1記載の画像処理方法。
The digital photographic image is a photographic image of a person;
The image processing method according to claim 1, wherein the dotted portion is a face outline portion of the person.
前記ボケ情報が、前記ボケが無方向性のピンボケと有方向性のぶれとのいずれであるかと、ぶれの場合の該ぶれの方向とを示すボケ方向情報を含むものであり、
前記点状部の画像のデータを用いて前記ボケ方向情報を取得し、
ぶれであることを示す前記ボケ方向情報に基づいて、前記デジタル写真画像全体のデータを用いて該ボケ方向情報を除いた前記ボケ情報を求めることを特徴とする請求項1、2または3記載の画像処理方法。
The blur information includes blur direction information indicating whether the blur is non-directional out-of-focus blur or directional blur, and the direction of blur in the case of blur,
The blur direction information is obtained using image data of the dot-like part,
The blur information excluding the blur direction information is obtained using data of the entire digital photographic image based on the blur direction information indicating blurring. Image processing method.
前記点状部の画像に対して、複数の異なる方向毎にエッジを検出し、
各前記方向における前記エッジの特徴量を取得し、
該各方向における前記特徴量に基づいて前記ボケ方向情報を取得することを特徴とする請求項4記載の画像処理方法。
Detecting an edge for each of a plurality of different directions with respect to the image of the dotted portion;
Obtaining feature values of the edge in each of the directions;
The image processing method according to claim 4, wherein the blur direction information is acquired based on the feature amount in each direction.
前記点状部の画像に対して、複数の異なる方向毎にエッジを検出し、
各前記方向における前記エッジの特徴量を取得し、
該各方向における前記特徴量に基づいて前記ボケ方向情報を取得することを特徴とする請求項4記載の画像処理方法。
Detecting an edge for each of a plurality of different directions with respect to the image of the dotted portion;
Obtaining feature values of the edge in each of the directions;
The image processing method according to claim 4, wherein the blur direction information is acquired based on the feature amount in each direction.
前記ボケ情報を求めたのち、該ボケをなくすように前記デジタル写真画像を補正することを特徴とする請求項1記載の画像処理方法。   The image processing method according to claim 1, wherein after obtaining the blur information, the digital photographic image is corrected so as to eliminate the blur. デジタル写真画像におけるボケの態様を示すボケ情報を得る画像処理装置において、
前記デジタル写真画像から、点状部を検出する点状部検出手段と、
該点状部の画像のデータを用いて前記デジタル写真画像の前記ボケ情報を求める解析手段とを有することを特徴とする画像処理装置。
In an image processing apparatus for obtaining blur information indicating a blur mode in a digital photographic image,
From the digital photographic image, point-like part detection means for detecting a point-like part,
An image processing apparatus comprising: analysis means for obtaining the blur information of the digital photographic image using data of the image of the dot-like portion.
前記デジタル写真画像が、人物の写真画像であり、
前記点状部検出手段が、前記点状部として前記人物の瞳または顔輪郭を検出するものであることを特徴とする請求項8記載の画像処理装置。
The digital photographic image is a photographic image of a person;
The image processing apparatus according to claim 8, wherein the point-like portion detection unit detects a pupil or a face outline of the person as the point-like portion.
前記ボケ情報が、前記ボケが無方向性のピンボケと有方向性のぶれとのいずれであるかと、ぶれの場合の該ぶれの方向とを示すボケ方向情報を含むものであり、
前記解析手段が、前記点状部の画像のデータを用いて前記ボケ方向情報を取得し、ぶれであることを示す前記ボケ方向情報に基づいて、前記デジタル写真画像全体のデータを用いて該ボケ方向情報を除いた前記ボケ情報を求めるものであることを特徴とする請求項8または9記載の画像処理装置。
The blur information includes blur direction information indicating whether the blur is non-directional out-of-focus blur or directional blur, and the direction of blur in the case of blur,
The analysis means acquires the blur direction information using the image data of the dot-like portion, and uses the data of the entire digital photographic image based on the blur direction information indicating blurring. The image processing apparatus according to claim 8, wherein the blur information is obtained by removing direction information.
前記解析手段が、前記点状部の画像に対して、複数の異なる方向毎にエッジを検出し、
各前記方向における前記エッジの特徴量を取得し、
該各方向における前記特徴量に基づいて前記ボケ方向情報を取得するものであることを特徴とする請求項10記載の画像処理装置。
The analysis means detects an edge for each of a plurality of different directions with respect to the image of the dotted portion,
Obtaining feature values of the edge in each of the directions;
The image processing apparatus according to claim 10, wherein the blur direction information is acquired based on the feature amount in each direction.
前記解析手段により前記ボケ情報を求めた後、前記デジタル画像を補正する補正手段をさらに備えたことを特徴とする請求項8から11いずれか記載の画像処理装置。   The image processing apparatus according to claim 8, further comprising a correcting unit that corrects the digital image after obtaining the blur information by the analyzing unit. 前記補正手段が、補正する度合いを前記点状部が大きいほど大きくするものであることを特徴とする請求項12記載の画像処理装置。   The image processing apparatus according to claim 12, wherein the correction unit increases the degree of correction as the point-like portion increases. デジタル写真画像におけるボケの態様を示すボケ情報を得る処理をコンピュータに実行させるプログラムであって、
前記処理が、前記デジタル写真画像から、点状部を検出する点状部検出処理と、
該点状部の画像のデータを用いて前記デジタル写真画像の前記ボケ情報を求める解析処理とからなることを特徴とするプログラム。
A program for causing a computer to execute processing for obtaining blur information indicating a blur mode in a digital photographic image,
The processing is a punctiform part detection process for detecting a punctiform part from the digital photographic image;
A program comprising: analysis processing for obtaining the blur information of the digital photographic image using data of the image of the dot-like portion.
前記デジタル写真画像が、人物の写真画像であり、
前記点状部検出処理が、前記点状部として前記人物の瞳を検出する処理であることを特徴とする請求項14記載のプログラム。
The digital photographic image is a photographic image of a person;
15. The program according to claim 14, wherein the point-like portion detection processing is processing for detecting the human pupil as the point-like portion.
前記ボケ情報が、前記ボケが無方向性のピンボケと有方向性のぶれとのいずれであるかと、ぶれの場合の該ぶれの方向とを示すボケ方向情報を含むものであり、
前記解析処理が、前記点状部の画像のデータを用いて前記ボケ方向情報を取得し、ぶれであることを示す前記ボケ方向情報に基づいて、前記デジタル写真画像全体のデータを用いて該ボケ方向情報を除いた前記ボケ情報を求める処理であることを特徴とする請求項9または15記載のプログラム。
The blur information includes blur direction information indicating whether the blur is non-directional out-of-focus blur or directional blur, and the direction of blur in the case of blur,
The analysis processing acquires the blur direction information using data of the image of the dotted portion, and uses the data of the entire digital photographic image based on the blur direction information indicating blurring. 16. The program according to claim 9 or 15, which is a process for obtaining the blur information excluding direction information.
前記解析処理が、前記点状部の画像に対して、複数の異なる方向毎にエッジを検出し、
各前記方向における前記エッジの特徴量を取得し、
該各方向における前記特徴量に基づいて前記ボケ方向情報を取得する処理であることを特徴とする請求項16記載のプログラム。
The analysis process detects an edge for each of a plurality of different directions with respect to the image of the dotted portion,
Obtaining feature values of the edge in each of the directions;
The program according to claim 16, wherein the blur direction information is obtained based on the feature amount in each direction.
前記解析処理が、前記点状部の画像に対して、複数の異なる方向毎にエッジを検出し、
各前記方向における前記エッジの特徴量を取得し、
該各方向における前記特徴量に基づいて前記ボケ方向情報を取得する処理であることを特徴とする請求項15記載のプログラム。
The analysis process detects an edge for each of a plurality of different directions with respect to the image of the dotted portion,
Obtaining feature values of the edge in each of the directions;
The program according to claim 15, wherein the blur direction information is obtained based on the feature amount in each direction.
JP2005124221A 2004-04-22 2005-04-21 Image processing method, device and program Withdrawn JP2005332382A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005124221A JP2005332382A (en) 2004-04-22 2005-04-21 Image processing method, device and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2004126835 2004-04-22
JP2005124221A JP2005332382A (en) 2004-04-22 2005-04-21 Image processing method, device and program

Publications (1)

Publication Number Publication Date
JP2005332382A true JP2005332382A (en) 2005-12-02

Family

ID=35486971

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005124221A Withdrawn JP2005332382A (en) 2004-04-22 2005-04-21 Image processing method, device and program

Country Status (1)

Country Link
JP (1) JP2005332382A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010015243A (en) * 2008-07-01 2010-01-21 Nikon Corp Image restoration method, program, and image restoration device
JP2010079446A (en) * 2008-09-24 2010-04-08 Sony Corp Electronic apparatus, blurring image selection method and program
JP2011523125A (en) * 2008-05-19 2011-08-04 ミツビシ・エレクトリック・アールアンドディー・センター・ヨーロッパ・ビーヴィ Image processing to improve image sharpness
US8068687B2 (en) 2007-10-31 2011-11-29 Kabushiki Kaisha Toshiba Object recognizing apparatus and method
US8861883B2 (en) 2011-08-22 2014-10-14 Fujitsu Limited Image processing apparatus, image processing method, and storage medium storing image processing program

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8068687B2 (en) 2007-10-31 2011-11-29 Kabushiki Kaisha Toshiba Object recognizing apparatus and method
JP2011523125A (en) * 2008-05-19 2011-08-04 ミツビシ・エレクトリック・アールアンドディー・センター・ヨーロッパ・ビーヴィ Image processing to improve image sharpness
JP2010015243A (en) * 2008-07-01 2010-01-21 Nikon Corp Image restoration method, program, and image restoration device
JP2010079446A (en) * 2008-09-24 2010-04-08 Sony Corp Electronic apparatus, blurring image selection method and program
US8300972B2 (en) 2008-09-24 2012-10-30 Sony Corporation Electronic apparatus, blur image sorting method, and program
US8861883B2 (en) 2011-08-22 2014-10-14 Fujitsu Limited Image processing apparatus, image processing method, and storage medium storing image processing program

Similar Documents

Publication Publication Date Title
US20050249429A1 (en) Method, apparatus, and program for image processing
AU2017261537B2 (en) Automated selection of keeper images from a burst photo captured set
US7720302B2 (en) Method, apparatus and program for image processing
JP4708909B2 (en) Method, apparatus and program for detecting object of digital image
JP4772839B2 (en) Image identification method and imaging apparatus
JP4611069B2 (en) Device for selecting an image of a specific scene, program, and recording medium recording the program
US8577099B2 (en) Method, apparatus, and program for detecting facial characteristic points
JP4515208B2 (en) Image processing method, apparatus, and program
US9106838B2 (en) Automatic photographing method and system thereof
JP4624947B2 (en) Image trimming method, apparatus and program
JP2005309560A (en) Image processing method, device and program
JP5241606B2 (en) Object identification device and object identification method
JP2005196678A (en) Template matching method, and objective image area extracting device
JP4647289B2 (en) Image processing method, apparatus, and program
JP2005250556A (en) Trimming processing method, device, and program
JP2004005384A (en) Image processing method, image processing device, program, recording medium, automatic trimming device and picture-taking arrangement
JP2005332382A (en) Image processing method, device and program
JP4619762B2 (en) Image processing method, apparatus, and program
JP4493416B2 (en) Image processing method, apparatus, and program
JP2005122688A (en) Image processing method, device, and program
JP4510556B2 (en) Object identification device and method, and program
JP4510562B2 (en) Circle center position detection method, apparatus, and program
JP2006053854A (en) Image processing method, device and program
CN109727193B (en) Image blurring method and device and electronic equipment
JP4685966B2 (en) Image processing method, apparatus, and program

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20061211

A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20080701