JP2010244579A - Image processing method, apparatus and program - Google Patents

Image processing method, apparatus and program Download PDF

Info

Publication number
JP2010244579A
JP2010244579A JP2010162746A JP2010162746A JP2010244579A JP 2010244579 A JP2010244579 A JP 2010244579A JP 2010162746 A JP2010162746 A JP 2010162746A JP 2010162746 A JP2010162746 A JP 2010162746A JP 2010244579 A JP2010244579 A JP 2010244579A
Authority
JP
Japan
Prior art keywords
image
blur
parameter
main subject
edge
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2010162746A
Other languages
Japanese (ja)
Other versions
JP4685966B2 (en
Inventor
Tatsuya Aoyama
達也 青山
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 Corp
Original Assignee
Fujifilm Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujifilm Corp filed Critical Fujifilm Corp
Priority to JP2010162746A priority Critical patent/JP4685966B2/en
Publication of JP2010244579A publication Critical patent/JP2010244579A/en
Application granted granted Critical
Publication of JP4685966B2 publication Critical patent/JP4685966B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime 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 efficiently apply blurring correction with respect to an image having shallow depth of field. <P>SOLUTION: A face extraction means 100 extracts a facial image d0 from a reduced image d acquired by reducing an image D. An analysis means 20 calculates a blurring direction and a blurring level of the image D, by using the face image d0 and an image of a part corresponding to a part of the face image d0 in the image D, and distinguishes whether the image D is a defocused image or a normal image. With respect to the image D being distinguished as being a blurred image, the level of blurring and the width of blurring are further calculated. A parameter-setting means 30 sets a one-dimensional correction mask and a two-dimensional correction mask, according to the blurring width and furthermore sets correction intensity, according to the level of defocusing and adjusts the ratio between the one-dimensional correction mask and the two-dimensional correction mask, according to the level of blurring. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明はデジタル写真画像に対してボケを補正する画像処理方法および装置並びにそのためのプログラムに関するものである。   The present invention relates to an image processing method and apparatus for correcting blur on 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 color reversal films with a reading device such as a scanner, and digital photographic images obtained by taking images with a digital still camera (DSC) For example, printing with various image processing is performed. 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 taking 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.

また、近年、画像認識技術が進み、写真画像から顔などの主要被写体を精度良く認識して抽出することができるようになっている。   In recent years, image recognition technology has advanced, and it has become possible to accurately recognize and extract main subjects such as faces from photographic images.

特開2002−112099号公報Japanese Patent Laid-Open No. 2002-112099 特開平7−121703号公報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に提案された方法は、ユーザにより小領域の指定を必要とするため、面倒である。さらに、写真画像には、顔などの主要被写体をアップにして撮像した被写界深度の浅い画像があり、このような被写界深度の浅い画像の場合、ボケていなくても、主要被写体以外の他の部分がボケている。ユーザにより指定された小領域が主要被写体以外の部分に位置すると、適切な劣化関数を求めることができず、補正した画像の画質は返って劣化してしまうという問題がある。   Further, the method proposed in Patent Document 2 is troublesome because it requires a user to specify a small area. Furthermore, photographic images include images with a shallow depth of field that are captured with the main subject such as the face up. In the case of images with such a shallow depth of field, even if there is no blur, The other part is blurred. If the small area specified by the user is located in a portion other than the main subject, an appropriate deterioration function cannot be obtained, and the image quality of the corrected image is deteriorated.

本発明は、上記事情に鑑み、特別な装置を撮像装置に設けることを必要とせずにデジタル写真画像におけるボケの補正を効率良く行うことを可能にすると共に、被写界深度の浅い画像に対しても適切な補正を行うことができる画像処理方法および装置並びにそのためのプログラムを提供することを目的とするものである。   In view of the above circumstances, the present invention makes it possible to efficiently perform blur correction in a digital photographic image without requiring a special device to be provided in the imaging device, and for an image with a shallow depth of field. It is an object of the present invention to provide an image processing method and apparatus capable of performing appropriate correction, and a program therefor.

本発明の第1の画像処理方法は、デジタル写真画像におけるボケを補正する画像処理方法において、
前記デジタル写真画像から主要被写体領域を抽出し、
該主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定し、
設定された前記パラメータを用いて前記デジタル写真画像に対して補正を行うことを特徴とするものである。
A first image processing method of the present invention is an image processing method for correcting blur in a digital photographic image.
Extracting the main subject area from the digital photographic image,
Set parameters for correcting the blur using the image of the main subject area,
The digital photographic image is corrected using the set parameter.

本発明の第2の画像処理方法は、デジタル写真画像におけるボケを補正する画像処理方法において、
前記デジタル写真画像が被写界深度の浅い画像か否かを判別し、
被写界深度の浅い画像に判別された前記デジタル写真画像に対して、該デジタル写真画像から主要被写体領域を抽出し、該主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定する一方、被写界深度の浅い画像に判別された画像以外の前記デジタル写真画像に対して、該デジタル写真画像全体を用いて前記ボケを補正するためのパラメータを設定し、
設定された前記パラメータを用いて前記デジタル写真画像に対して補正を行うことを特徴とするものである。
A second image processing method of the present invention is an image processing method for correcting blur in a digital photographic image.
Determining whether the digital photographic image is a shallow depth of field image;
For the digital photographic image determined to be an image with a shallow depth of field, a main subject area is extracted from the digital photographic image, and parameters for correcting the blur using the image of the main subject area are set. On the other hand, for the digital photographic image other than the image determined to be an image having a shallow depth of field, a parameter for correcting the blur using the entire digital photographic image is set,
The digital photographic image is corrected using the set parameter.

本発明の第3の画像処理方法は、デジタル写真画像におけるボケを補正する画像処理方法において、
前記デジタル写真画像から主要被写体領域を抽出し、
該主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定して第1のパラメータとすると共に、前記デジタル写真画像全体または前記主要被写体領域以外の領域の画像を用いて前記ボケを補正するためのパラメータを設定して第2のパラメータとし、
前記デジタル写真画像が被写界深度の浅い画像である確信度を求め、
前記確信度が高いほど前記第1のパラメータの重みが大きくなるように前記第1のパラメータと前記第2のパラメータとを重付合算して前記ボケを補正するためのパラメータを取得し、
該パラメータを用いて前記デジタル写真画像に対して補正を行うことを特徴とするものである。
A third image processing method of the present invention is an image processing method for correcting blur in a digital photographic image.
Extracting the main subject area from the digital photographic image,
A parameter for correcting the blur using the image of the main subject area is set as a first parameter, and the blur is reduced using the entire digital photograph image or an image of an area other than the main subject area. Set the parameter for correction as the second parameter,
Determining the certainty that the digital photographic image is an image with a shallow depth of field;
Obtaining a parameter for correcting the blur by weighting and adding the first parameter and the second parameter so that the weight of the first parameter increases as the certainty factor increases.
The digital photographic image is corrected using the parameters.

前記デジタル写真画像に、該デジタル写真画像を撮像した撮像装置のレンズのF値を含む付属情報が付属されている場合、本発明の画像処理方法は、前記付属情報を読み取って前記F値を取得し、該F値に基づいて前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことができる。   When the digital photographic image is attached with attached information including the F value of the lens of the imaging device that captured the digital photographic image, the image processing method of the present invention reads the attached information and acquires the F value. Then, based on the F value, it is possible to determine whether or not the digital photographic image is an image having a shallow depth of field or to obtain the certainty factor.

ここで、前記F値に基づいて前記デジタル写真画像が被写界深度の浅い画像か否かの判断を行う際に、例えば、前記デジタル写真画像の付属情報に含まれたF値が所定の閾値(例えば5.6)以下であれば、該デジタル写真画像が被写界深度の浅い画像であると判別することができ、前記F値が前記所定の閾値より大きければ、該デジタル写真画像が被写界深度の浅い画像ではないと判別することができる。   Here, when determining whether the digital photograph image is an image with a shallow depth of field based on the F value, for example, the F value included in the attached information of the digital photograph image is a predetermined threshold value. (For example, 5.6) or less, it can be determined that the digital photographic image is an image having a shallow depth of field, and if the F value is larger than the predetermined threshold, the digital photographic image is not covered. It can be determined that the image is not a shallow depth of field.

また、前記F値に基づいて前記デジタル写真画像が被写界深度の浅い画像である確信度を求める際に、例えば、最大確信度と最小確信度とを夫々100%と0%にして、所定の閾値(例えば2.8)以下のF値のデジタル写真画像の前記確信度を100%、この所定の閾値より大きい所定の閾値(例えば11)以上のF値のデジタル写真画像の前記確信度を0%、この2つの閾値の間の範囲(例えば2.8と11を除く2.8〜11の範囲)内のF値のデジタル写真画像の前記確信度を100%と0%を除いた100%から0%の間にあり、かつF値が大きいほど大きくなる値とするようにすればよい。   Further, when determining the certainty that the digital photo image is an image having a shallow depth of field based on the F value, for example, the maximum certainty factor and the minimum certainty factor are set to 100% and 0%, respectively. The certainty factor of a digital photographic image having an F value equal to or smaller than a threshold value (for example, 2.8) is 100%, and the certainty factor of a digital photographic image having an F value equal to or larger than a predetermined threshold value (for example, 11) greater than the predetermined threshold value 100% excluding 100% and 0% of the certainty of the digital photograph image of F value within the range between 0% and the two thresholds (for example, the range of 2.8 to 11 excluding 2.8 and 11) The value may be between 0% and 0% and increase as the F value increases.

また、本発明の画像処理方法は、前記デジタル写真画像から抽出した主要被写体領域の画像および前記主要被写体領域以外の領域の画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を夫々施して夫々の前記ボケ情報を得、前記主要被写体領域の画像から取得された前記ボケ情報および前記主要被写体領域以外の領域の画像から取得された前記ボケ情報とを比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことができる。   In the image processing method of the present invention, an edge is detected in each of a plurality of different directions with respect to an image of a main subject area extracted from the digital photographic image and an image of an area other than the main subject area, and each of the directions The blur feature acquisition processing is performed to acquire the blur information acquisition processing for acquiring the blur feature acquisition process for acquiring the blur feature information based on the edge feature amount, and acquiring the blur information acquisition processing based on the edge feature amount. A process of determining whether the digital photo image is an image with a shallow depth of field or determining the certainty factor by comparing the information and the blur information acquired from an image of an area other than the main subject area. It can be carried out.

ボケは画像中の点像の広がりを引き起こすため、ボケがある画像(以下ボケ画像という)には、点像の広がりに応じたエッジの広がりが生じる。すなわち、画像中におけるエッジの広がりの態様は画像中におけるボケと直接関係するものである。本発明におけるボケ情報取得処理は、この点に着目して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量に基づいて前記ボケ情報を求めるものである。   Since the blur causes the spread of the point image in the image, the spread of the edge corresponding to the spread of the point image occurs in the blurred image (hereinafter referred to as the blurred image). That is, the manner of edge spreading in the image is directly related to the blur in the image. The blur information acquisition process in the present invention focuses on this point, detects an edge for each of a plurality of different directions, and obtains the blur information based on the feature amount of the edge in each of the directions.

ここで、「エッジ特徴量」が、対象となる画像(以下略して対象画像という。ここではデジタル写真画像における主要被写体領域の画像または主要被写体領域以外の領域の画像となる)におけるエッジの広がりの態様と関係する特徴量を意味し、例えば、エッジの鮮鋭度、前記エッジの鮮鋭度の分布を含むものとすることができる。   Here, the “edge feature amount” is the spread of the edge in the target image (hereinafter referred to as “target image”, here, the image of the main subject region or the image of the region other than the main subject region in the digital photographic image). It means a feature quantity related to an aspect, and may include, for example, edge sharpness and the distribution of the edge sharpness.

「エッジの鮮鋭度」は、エッジの鮮鋭さを現すことができるものであれば如何なるパラメータを用いてもよく、例えば、図5のエッジプロファイルにより示されるエッジの場合、エッジ幅が大きいほどエッジの鮮鋭度が低いように、エッジ幅をエッジの鮮鋭度として用いることは勿論、エッジの明度変化の鋭さ(図5におけるプロファイル曲線の勾配)が高いほどエッジの鮮鋭度が高いように、エッジのプロファイル曲線の勾配をエッジの鮮鋭度として用いるようにしてもよい。   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 is higher as the sharpness of the brightness change of the edge (the gradient of the profile curve in FIG. 5) 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.

また、「ボケ情報」は、対象画像におけるボケの態様を表すことができる情報を意味し、ボケの方向に関するボケ方向情報とボケ幅とすることができる。「ボケ」は、無方向性のボケすなわちピンボケと、有方向性のボケすなわちぶれがあり、ぶれの場合は、ボケ方向がぶれ方向に相当し、ピンボケの場合において、その「ボケ方向」は「無方向」となる。また、「ボケ幅」とは、ボケ方向におけるボケの幅を意味し、例えば、ボケ方向におけるエッジのエッジ幅の平均値とすることができる。また、ボケが無方向性のピンボケの場合において、任意の1つの方向におけるエッジのエッジ幅をボケ幅としてもよいが、前記複数の異なる方向に含まれる全ての方向におけるエッジのエッジ幅の平均値とすることが好ましい。   The “blurring information” means information that can represent a blur mode in the target image, and can be blur direction information and a blur width regarding the 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 “ "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, but the average value of the edge widths of the edges in all the directions included in the plurality of different directions It is preferable that

さらに、本発明における対象画像は、ボケ画像に限らず、ピンボケもぶれもない通常画像(ピンボケもぶれもない被写界深度の浅いデジタル写真画像における主要被写体領域の画像が通常画像となり、主要被写体領域以外の領域の画像はピンボケ画像となる)もあり、このような通常画像は、無ボケ、すなわち「無方向」のボケ方向情報と「所定の閾値以下の」ボケ幅とからなるボケ情報を有することとする。   Furthermore, the target image in the present invention is not limited to a blurred image, but is a normal image with no blur or blur (the image of the main subject area in a digital photo image with a shallow depth of field without blur or blur is a normal image, and the main subject An image of an area other than the area is a blurred image), and such a normal image has no blur, that is, blur information including blur direction information of “no direction” and a blur width of “below a predetermined threshold”. I will have it.

また、前記「複数の異なる方向」とは、対象画像におけるボケの方向を特定するための方向を意味し、ボケの方向に近い方向を含むことが必要であるため、その数が多ければ多いほど特定の精度が高いが、処理速度との兼ね合いに応じた適宜な個数、例えば、図4に示すような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.

本発明の画像処理方法において、前記主要被写体領域の画像のボケ情報と前記主要被写体領域以外の領域の画像のボケ情報とを比較することによって前記デジタル写真画像が被写界深度の浅い画像か否かの判断を行う際に、例えば、主要被写体領域の画像のボケ情報が「無方向」と「所定の第1の閾値以下のボケ幅」であり、主要被写体領域以外の領域のボケ情報が「無方向」と「所定の第1の閾値以上のボケ幅」であれば、このデジタル写真画像を被写界深度の浅い画像であると判別することができる。なお、この場合、このデジタル写真画像はピンボケもぶれもない写真画像とすることができるが、ピンボケのある被写界深度の浅いデジタル写真画像の場合、主要被写体領域の画像のボケ情報が「無方向」と「所定の第1の閾値以上のボケ幅」となり、主要被写体領域以外の領域の画像のボケ情報が「無方向」と「主要被写体領域の画像におけるボケ幅より大きいボケ幅」となる。ぶれのある被写界深度の浅いデジタル写真画像の場合、主要被写体領域の画像と主要被写体領域以外の領域の画像のボケ方向情報として「有方向」となるが、ボケ幅にはやはり差が出る。逆に、被写界深度の浅い画像ではないデジタル写真画像の場合、主要被写体領域の画像のボケ情報と主要被写体領域以外の領域の画像のボケ情報とはそれほど差がないはずである。本発明の画像処理方法は、このような傾向に着目して、デジタル写真画像における主要被写体領域の画像のボケ情報と主要被写体領域以外の画像のボケ情報とを比較することによって、このデジタル写真画像が被写界深度の浅い画像か否かを判別することができる。   In the image processing method of the present invention, whether the digital photographic image is an image with a shallow depth of field by comparing the blur information of the image of the main subject region with the blur information of the image of the region other than the main subject region. For example, the blur information of the image of the main subject area is “no direction” and “the blur width equal to or less than a predetermined first threshold”, and the blur information of the area other than the main subject area is “ If it is “no direction” and “a blur width equal to or greater than a predetermined first threshold value”, it is possible to determine that this digital photograph image is an image with a shallow depth of field. In this case, the digital photographic image can be a photographic image with no blur or blur. However, in the case of a digital photographic image with a small depth of field that is out of focus, the blur information of the image of the main subject region is “None”. Direction "and" blur width greater than or equal to a predetermined first threshold value ", and blur information of an image in a region other than the main subject region is" no direction "and" a blur width larger than the blur width in the image of the main subject region ". . In the case of digital photographic images with blurring and shallow depth of field, the blur direction information of the image of the main subject area and the image of the area other than the main subject area will be “directional”, but there will still be a difference in the blur width . Conversely, in the case of a digital photographic image that is not an image with a shallow depth of field, the blur information of the image in the main subject area and the blur information of the image in the area other than the main subject area should not be so different. The image processing method of the present invention pays attention to such a tendency, and compares the blur information of the image of the main subject area in the digital photographic image with the blur information of the image other than the main subject area, thereby comparing the digital photographic image. Can be discriminated whether or not the image has a shallow depth of field.

また、本発明の画像処理方法において、デジタル写真画像における主要被写体領域の画像のボケ情報と主要被写体領域以外の領域の画像のボケ情報とを比較することによって該デジタル写真画像が被写界深度の浅い画像である確信度の算出については、2つの領域のボケ情報の差異によって被写界深度の浅い画像か否かの2つのみの判別ではなく、この差異が大きいデジタル写真画像ほど被写界深度の浅い画像である確信度が大きいように前記確信度を算出すればよい。   In the image processing method of the present invention, the digital photographic image has a depth of field by comparing the blur information of the image of the main subject area in the digital photographic image with the blur information of the image of the area other than the main subject area. The calculation of the certainty level of a shallow image is not just a determination of whether the image has a shallow depth of field due to the difference in blur information between the two regions, but the greater the difference in the digital photographic image The certainty factor may be calculated so that the certainty factor is a shallow image.

さらに、本発明の画像処理方法は、前記デジタル写真画像を複数のブロックに分け、
各前記ブロックの画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を夫々施して夫々の前記ボケ情報を得、
各々の前記ブロックの画像から取得された前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことができる。
Furthermore, the image processing method of the present invention divides the digital photographic image into a plurality of blocks,
A blur information acquisition process for detecting an edge in each of a plurality of different directions for each image of the block, acquiring a feature amount of the edge in each of the directions, and acquiring blur information based on the edge feature amount. Apply each to get the blur information of each,
By comparing the blur information acquired from the images of the respective blocks, it is possible to determine whether or not the digital photo image is an image with a shallow depth of field or to obtain the certainty factor.

被写界深度の浅い画像であれば、或いは被写界深度の浅い画像である確信度が高ければ、各々の前記ブロックを、グループ間のボケ情報の差異が所定の閾値以上で、夫々のグループ内の各ブロックのボケ情報の差異が少ない特徴を有する2つ以上のグループに分けることができる。これらのグループは、前記主要被写体領域の画像と主要被写体領域以外の画像に相当すると考えることができ、本発明の画像処理方法はこの点に着目して各ブロックの画像のボケ情報を比較することによって前記判別または前記確信度の算出を行うようにしてもよい。   If the image has a shallow depth of field, or if the certainty that the image is a shallow depth of field is high, each block has a difference in blur information between the groups that is equal to or greater than a predetermined threshold value. It can be divided into two or more groups having features with little difference in blur information of each block. These groups can be considered to correspond to the image of the main subject region and the image other than the main subject region, and the image processing method of the present invention compares the blur information of the images of the respective blocks by paying attention to this point. The determination or the certainty factor may be calculated as follows.

本発明の画像処理方法において、前記ボケを補正するためのパラメータを設定する方法としては、前記パラメータを設定することに使用される画像(第1の画像処理方法においては主要被写体領域の画像、第2の画像処理方法においては主要被写体領域の画像とデジタル写真画像全体、第3の画像処理方法においては主要被写体領域の画像、およびデジタル写真画像全体または主要被写体領域以外の領域の画像)を用いて前記パラメータを設定することができれば如何なる方法(例えば、特許文献2記載の方法)でもよいが、本発明の画像処理方法は、前記パラメータを設定することに使用される画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を施し、前記ボケ情報に基づいて前記パラメータを設定することが好ましい。   In the image processing method of the present invention, as a method of setting a parameter for correcting the blur, an image used for setting the parameter (in the first image processing method, an image of a main subject region, In the second image processing method, the image of the main subject area and the entire digital photographic image are used, and in the third image processing method, the image of the main subject area and the entire digital photographic image or an image of an area other than the main subject area are used. Any method can be used as long as the parameter can be set (for example, the method described in Patent Document 2). However, the image processing method of the present invention is different from the image used for setting the parameter. An edge is detected for each direction, the feature amount of the edge in each direction is acquired, and blur information is obtained based on the edge feature amount. Subjected to blur information acquisition process Tokusuru, it is preferable to set the parameters on the basis of the blur information.

前述したように、「ボケ」は、無方向性のボケすなわちピンボケと、有方向性のボケすなわちぶれがあり、ぶれの場合は、ボケ方向がぶれ方向に相当し、ピンボケの場合において、その「ボケ方向」は「無方向」となる。本発明の画像処理方法は、前記ボケ方向情報として、前記ボケが無方向性のピンボケ(ボケが無方向)か有方向性のぶれ(ボケが有方向)かを示す情報、およびぶれの場合の該ぶれの方向を示す情報を取得し、前記パラメータを設定する際に、ピンボケの場合には等方性補正用の等方性補正パラメータを、ぶれの場合には方向性補正用の方向性補正パラメータを設定するようにすることができる。   As described above, “blur” includes non-directional blur, that is, out-of-focus blur, and directional blur, that is, blur. In the case of blur, the blur direction corresponds to the blur direction. “Bokeh direction” is “no direction”. In the image processing method of the present invention, the blur direction information includes information indicating whether the blur is non-directional defocus (blur is non-directional) or directional blur (blur is directional), and blur When acquiring information indicating the direction of blur and setting the parameters, an isotropic correction parameter for isotropic correction in the case of defocusing, and a directionality correction for directionality correction in the case of blur A parameter can be set.

ここで、「等方性補正」とは、各方向に対して同等に作用する補正を意味し、「方向性補正」とは、所定の方向にのみ作用する補正あるいは方向により作用が異なる補正を意味する。一方、ボケが、エッジの広がりとして画像に現れるため、ボケを補正する方法としては、従来公知の、画像の鮮鋭度を向上させるための補正方法、例えば、USM(アン・シャープネス・マスキング)などを用いることができる。前記補正のパラメータを設定する際に、所用の補正方法に応じてパラメータを設定する。例えば、補正の方法としてUSMを用いる場合に、等方性補正パラメータとして等方性補正マスクを設定し、方向性補正のパラメータとしては前記ぶれ方向に作用する方向性補正マスクを設定するようにすればよい。さらに、ボケ情報に含まれるボケ幅に応じて補正マスクのサイズを設定してもよい。   Here, “isotropic correction” means correction that works equally in each direction, and “directional correction” means correction that works only in a predetermined direction or correction that works differently depending on the direction. means. On the other hand, since blur appears in the image as the spread of the edge, a conventionally known correction method for improving the sharpness of the image, for example, USM (Unsharpness Masking) is used as a method for correcting the blur. Can be used. When setting the correction parameters, the parameters are set according to the required correction method. For example, when USM is used as a correction method, an isotropic correction mask is set as an isotropic correction parameter, and a directionality correction mask that operates in the blur direction is set as a directionality correction parameter. That's fine. Furthermore, the size of the correction mask may be set according to the blur width included in the blur information.

また、前記ボケ情報によりボケをピンボケとぶれとに明確に分けることができない場合があり、ボケ画像には、ピンボケとぶれとの両方が存在する場合もある。このような場合に備え、本発明の画像処理方法は、ボケをピンボケかぶれかに決め付けず、ボケ方向におけるボケのぶれの程度の大小を示すぶれ度も前記ボケ情報として取得し、前記ぶれ度が高いほど、方向性補正の重みが高くなるように、等方性補正用の等方性補正パラメータと方向性補正用の方向性補正パラメータとを重み付け合算して前記パラメータを設定することが好ましい。   In addition, blur may not be clearly divided into out-of-focus and blur due to the blur information, and there may be both out-of-focus and blur in a blur image. In order to prepare for such a case, the image processing method of the present invention does not determine whether the blur is out of focus or blur, and also acquires the blur degree indicating the degree of blur blur in the blur direction as the blur information. It is preferable to set the parameter by weighting and summing the isotropic correction parameter for isotropic correction and the directionality correction parameter for directionality correction so that the weight of the directionality correction becomes higher as the value becomes higher. .

さらに、本発明の画像処理方法は、前記ボケの程度の大小を示すボケ度も前記ボケ情報として取得し、前記ボケ度が高いほど補正強度が大きくなるように前記パラメータを設定するようにしてもよい。   Further, the image processing method of the present invention may acquire a degree of blur indicating the degree of blur as the blur information, and set the parameter so that the correction intensity increases as the blur degree increases. Good.

ここで、ボケ度が所定の閾値より小さい画像をボケがない通常画像とすることができるため、このような画像に対して「補正しない」ようなパラメータを設定して補正するようにしてもよいが(その結果、補正済み画像と元の画像とが同じである)、処理の効率性を高めるために、ボケ度が所定の閾値以上の前記デジタル写真画像に対してのみ、前記パラメータの設定および前記補正を行い、前記閾値よりボケ度の小さい画像に対しては前記パラメータの設定も、勿論補正もしないようにすることが好ましい。   Here, an image whose degree of blur is smaller than a predetermined threshold value can be set as a normal image without blur. Therefore, such an image may be corrected by setting a parameter that “does not correct”. (As a result, the corrected image and the original image are the same), in order to increase the efficiency of processing, the parameter setting and only for the digital photographic image whose degree of blur is equal to or greater than a predetermined threshold It is preferable that the correction is performed and the parameter is not set and of course not corrected for an image having a degree of blur smaller than the threshold.

また、デジタル写真画像を縮小して得た縮小画像は、原画像よりもエッジを検出しやすく、エッジの検出にかかる演算量が少ないので、本発明において、対象画像に対して縮小処理を施して得た縮小画像から前記エッジを検出することが好ましい。   In addition, the reduced image obtained by reducing the digital photograph image is easier to detect the edge than the original image, and the amount of calculation required for edge detection is small. Therefore, in the present invention, the target image is reduced. It is preferable to detect the edge from the obtained reduced image.

さらに、強度の低いエッジは、ノイズである可能性が高く、また人間は強度の高いエッジの状態によりボケを認識するので、本発明において、対象画像に対して所定の閾値以上の強度を有するエッジのみを検出することが好ましい。   Furthermore, an edge having low strength is highly likely to be noise, and humans recognize blur by the state of the edge having high strength. Therefore, in the present invention, an edge having a strength equal to or higher than a predetermined threshold with respect to the target image. It is preferable to detect only.

さらに、対象画像から検出された前記エッジのうち、無効なエッジを除去することが好ましい。なお、「無効なエッジ」とは、ボケ情報の取得に関連性が低いエッジや、ボケ情報の取得を困難にしたり、間違ったボケ情報を取得させたりする可能性のあるエッジを意味し、形状が複雑なエッジや、光源を含むエッジなどを挙げることができる。   Furthermore, it is preferable to remove invalid edges from the edges detected from the target image. Note that `` invalid edge '' means an edge that is not related to acquisition of blur information, an edge that makes it difficult to acquire blur information, or that may cause incorrect blur information to be acquired. Can include complex edges and edges containing light sources.

本発明の第1の画像処理装置は、デジタル写真画像におけるボケを補正する画像処理装置であって、
前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出手段と、
該主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定するパラメータ設定手段と、
該パラメータ設定手段により設定された前記パラメータを用いて前記デジタル写真画像に対して補正を行う補正手段とを有することを特徴とするものである。
A first image processing apparatus of the present invention is an image processing apparatus for correcting blur in a digital photographic image,
Main subject extraction means for extracting a main subject region from the digital photographic image;
Parameter setting means for setting parameters for correcting the blur using the image of the main subject area;
And correction means for correcting the digital photographic image using the parameter set by the parameter setting means.

本発明の第2の画像処理装置は、デジタル写真画像におけるボケを補正する画像処理装置であって、
前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出手段と、
前記デジタル写真画像が被写界深度の浅い画像か否かを判別する判別手段と、
前記判別手段により被写界深度の浅い画像に判別された前記デジタル写真画像に対して、前記主要被写体抽出手段により抽出された該デジタル写真画像の前記主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定する一方、被写界深度の浅い画像に判別された画像以外の前記デジタル写真画像に対して、該デジタル写真画像全体を用いて前記ボケを補正するためのパラメータを設定するパラメータ設定手段と、
該パラメータ設定手段により設定された前記パラメータを用いて前記デジタル写真画像に対して補正を行う補正手段とを有することを特徴とするものである。
A second image processing apparatus of the present invention is an image processing apparatus for correcting blur in a digital photographic image,
Main subject extraction means for extracting a main subject region from the digital photographic image;
Discriminating means for discriminating whether the digital photographic image is an image having a shallow depth of field;
The blur is corrected using the image of the main subject area of the digital photographic image extracted by the main subject extracting unit with respect to the digital photographic image determined as an image having a shallow depth of field by the determining unit. On the other hand, for the digital photographic image other than the image determined to be an image with a shallow depth of field, a parameter for correcting the blur using the entire digital photographic image is set. Parameter setting means;
And correction means for correcting the digital photographic image using the parameter set by the parameter setting means.

本発明の第3の画像処理装置は、デジタル写真画像におけるボケを補正する画像処理装置であって、
前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出手段と、
前記デジタル写真画像が被写界深度の浅い画像である確信度を求める確信度算出手段と、
前記主要被写体抽出手段により抽出された前記主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定する第1のパラメータ設定手段と、
前記デジタル写真画像全体または前記主要被写体領域以外の領域の画像を用いて前記ボケを補正するためのパラメータを設定する第2のパラメータ設定手段と、
前記確信度算出手段により得られた前記確信度が高いほど前記第1のパラメータ設定手段により設定された前記パラメータの重みが大きくなるように前記第1のパラメータにより設定されたパラメータと前記第2のパラメータ設定手段により設定されたパラメータとを重付合算して統合パラメータを取得する統合パラメータ取得手段と、
該統合パラメータ取得手段により取得された前記統合パラメータを用いて前記デジタル写真画像に対して補正を行う補正手段とを有してなることを特徴とするものである。
A third image processing apparatus of the present invention is an image processing apparatus for correcting blur in a digital photographic image,
Main subject extraction means for extracting a main subject region from the digital photographic image;
A certainty factor calculating means for determining a certainty factor that the digital photographic image is an image having a shallow depth of field;
First parameter setting means for setting a parameter for correcting the blur using the image of the main subject area extracted by the main subject extracting means;
Second parameter setting means for setting a parameter for correcting the blur using the entire digital photographic image or an image of an area other than the main subject area;
The parameter set by the first parameter and the second parameter are set such that the higher the certainty factor obtained by the certainty factor calculating unit, the greater the weight of the parameter set by the first parameter setting unit. Integrated parameter acquisition means for acquiring an integrated parameter by adding together the parameters set by the parameter setting means;
And a correction unit configured to correct the digital photographic image using the integrated parameter acquired by the integrated parameter acquisition unit.

本発明の画像処理装置は、前記デジタル写真画像を撮像した撮像装置のレンズのF値を含む付属情報が付属された前記デジタル写真画像の前記付属情報を読み取って前記F値を取得する付属情報読取手段を備え、
前記判別手段または前記確信度算出手段が、前記F値に基づいて前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うものとすることができる。
The image processing apparatus of the present invention reads the attached information of the digital photographic image to which the attached information including the attached F information including the F value of the lens of the imaging device that picked up the digital photograph image is acquired, and acquires the F value. With means,
The determination unit or the certainty factor calculation unit may perform determination of whether or not the digital photographic image is an image having a shallow depth of field based on the F value, or processing for obtaining the certainty factor.

本発明の画像処理装置は、対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得手段を備え、
前記判別手段または前記確信度算出手段が、前記ボケ情報取得手段により前記主要被写体領域の画像および前記主要被写体領域以外の領域の画像を夫々前記対象画像にして取得された夫々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うものとすることができる。
The image processing apparatus of the present invention detects edges in a plurality of different directions with respect to the target image, acquires feature amounts of the edges in the respective directions, and acquires blur information based on the edge feature amounts. Bokeh information acquisition means,
The determination unit or the certainty factor calculation unit compares the blur information acquired by the blur information acquisition unit using the image of the main subject region and the image of the region other than the main subject region, respectively, as the target image. By doing so, it is possible to determine whether or not the digital photographic image is an image with a shallow depth of field or to obtain the certainty factor.

本発明の画像処理装置は、前記デジタル写真画像を複数のブロックに分けるブロック分け手段と、
対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得手段とを備え、
前記判別手段または前記確信度算出手段が、前記ボケ情報取得手段により各前記ブロックの画像を夫々前記対象画像にして取得された各々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うものとすることができる。
The image processing apparatus of the present invention comprises a block dividing means for dividing the digital photographic image into a plurality of blocks,
A blur information acquisition unit that detects an edge for each of a plurality of different directions with respect to the target image, acquires a feature amount of the edge in each of the directions, and acquires blur information based on the edge feature amount;
The determination unit or the certainty factor calculation unit compares the blur information acquired by using the image of each block as the target image by the blur information acquisition unit, so that the digital photographic image is captured. It is possible to determine whether or not the image has a shallow depth of field or to obtain the certainty factor.

本発明の画像処理装置における前記パラメータ設定手段は、前記ボケを補正するためのパラメータを設定するために用いられる画像に対して、該画像における複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得手段を備え、取得された前記ボケ情報に基づいて前記パラメータを設定するものであることが好ましい。   The parameter setting means in the image processing apparatus of the present invention detects an edge for each of a plurality of different directions in the image with respect to the image used for setting the parameter for correcting the blur, and each of the directions It is preferable that the image processing apparatus includes a blur information acquisition unit that acquires the feature amount of the edge in the image, acquires blur information based on the edge feature amount, and sets the parameter based on the acquired blur information.

また、デジタル写真画像においては、主要被写体が2つ以上ある場合がある。例えば、複数の人間が写った1つの画像には、顔が重ならない限り人数分の顔部分が存在する。このようなデジタル写真画像の場合、主要被写体が複数抽出される。主要被写体領域の画像を用いてパラメータを設定するパラメータ設定手段(第1の画像処理装置のパラメータ設定手段、第2の画像処理装置のパラメータ設定手段、第3の画像処理装置の第1のパラメータ設定手段)は、抽出された全ての主要被写体領域の画像を用いてパラメータ(第3の画像処理装置の場合においては第1のパラメータ)を設定するようにしてもよいが、本発明の画像処理装置は、抽出された複数の主要被写体から1つの主要被写体を選択して、該選択された主要被写体を用いてパラメータを設定することが望ましい。すなわち、本発明の画像処理装置における前記主要被写体抽出手段は、前記デジタル写真画像から主要被写体領域の候補を抽出する主要被写体候補抽出手段と、該主要被写体候補抽出手段により抽出された複数の前記主要被写体候補から前記主要被写体の領域を選択する主要被写体選択手段とからなることが望ましい。   In addition, there may be two or more main subjects in a digital photographic image. For example, in one image showing a plurality of humans, there are face portions for the number of persons as long as the faces do not overlap. In the case of such a digital photographic image, a plurality of main subjects are extracted. Parameter setting means for setting parameters using the image of the main subject area (parameter setting means of the first image processing apparatus, parameter setting means of the second image processing apparatus, and first parameter setting of the third image processing apparatus) The means) may set the parameters (first parameter in the case of the third image processing apparatus) using the extracted images of all the main subject areas, but the image processing apparatus of the present invention It is desirable to select one main subject from the plurality of extracted main subjects and set parameters using the selected main subject. That is, the main subject extraction unit in the image processing apparatus of the present invention includes a main subject candidate extraction unit that extracts a main subject region candidate from the digital photographic image, and a plurality of the main subject candidates extracted by the main subject candidate extraction unit. It is preferable that the main subject selection unit selects a region of the main subject from the subject candidates.

ここで、主要被写体選択手段は、具体的には、ボケ情報の解析など補正用のパラメータを設定する上で最も重要と思われる主要被写体候補、または撮像者が最も重要視すると思われる主要被写体候補を主要被写体として選択すればよい。例えば、複数の前記主要被写体候補から、サイズが最も大きい主要被写体候補を前記主要被写体として選択するようにしてもよいし、デジタル写真画像の最も中央部分に近い主要被写体候補を主要被写体として選択するようにしてもよい。   Here, the main subject selection means, specifically, the main subject candidate that seems to be the most important in setting correction parameters such as analysis of blur information, or the main subject candidate that the photographer thinks is most important May be selected as the main subject. For example, the main subject candidate having the largest size may be selected as the main subject from the plurality of main subject candidates, or the main subject candidate closest to the central portion of the digital photo image may be selected as the main subject. It may be.

さらに、例えば、複数の前記主要被写体候補のうち、ユーザにより指示された主要被写体候補を主要被写体として選択するようにしてもよい。   Further, for example, a main subject candidate instructed by a user among a plurality of main subject candidates may be selected as a main subject.

また、パラメータ設定手段に用いられる画像(デジタル写真画像そのもの、主要被写体領域の画像、主要被写体領域以外の領域の画像)のサイズは様々である。これらの画像をそのままのサイズで用いてパラメータを設定するのでは、処理時間がかかり効率が良くないため、縮小処理を施してから用いることが望ましい。しかし、サイズの大きい画像とサイズの小さい画像に対して同じ縮小率で縮小するのでは、例えばパラメータを設定するためにエッジを抽出する処理において、抽出されるエッジ数が多いため、後にパラメータを設定するための解析などの時間も長くなり、効率が良くない。一方、処理時間を短縮するために、大きいサイズの画像に対して適切な縮小率で小さいサイズの画像を縮小するのでは、縮小されたが小さすぎて適切な解析ができず、ひいては適切なパラメータを設定することができないという問題がある。本発明の画像処理装置は、前記パラメータ設定手段により用いられる画像に対して縮小処理を施して縮小画像を得る縮小手段を備え、前記パラメータ設定手段が、前記縮小画像を用いて前記パラメータを設定するものであり、前記縮小手段が、前記パラメータ設定手段により用いられる前記主要被写体領域の画像のサイズに応じて、該サイズが大きいほど該画像に対する縮小強度を強めるように(逆にサイズが小さいほど該画像に対する縮小強度を弱める(縮小強度がゼロ、すなわち縮小しないことを含む)ように)前記縮小処理を施すものであることが好ましい。   Also, the sizes of images used for the parameter setting means (digital photographic images themselves, images of main subject regions, images of regions other than the main subject regions) vary. Setting parameters using these images as they are takes time and is not efficient, so it is desirable to use them after performing reduction processing. However, if the image is reduced at the same reduction ratio for a large image and a small image, for example, in the process of extracting edges to set parameters, the number of edges to be extracted is large, so parameters are set later. It takes a long time for analysis, etc., and is not efficient. On the other hand, in order to shorten the processing time, if a small size image is reduced with an appropriate reduction ratio with respect to a large size image, the image has been reduced but is too small to be able to be analyzed properly. There is a problem that cannot be set. The image processing apparatus of the present invention includes a reduction unit that performs a reduction process on an image used by the parameter setting unit to obtain a reduced image, and the parameter setting unit sets the parameter using the reduced image. In accordance with the size of the image of the main subject area used by the parameter setting unit, the reduction means increases the reduction strength for the image as the size increases (conversely, the smaller the size, the more It is preferable that the reduction processing is performed so that the reduction strength of the image is weakened (including that the reduction strength is zero, that is, the image is not reduced).

また、ここでは、デジタル写真画像から抽出される主要被写体の領域の画像のサイズのばらつきが大きいことに着目し、縮小手段は主要被写体領域の画像に対して縮小処理を施す際に、そのサイズに応じて縮小強度を調整して縮小を行うようにしているが、パラメータ設定手段に用いられる他の画像(デジタル写真画像全体、主要被写体領域以外の領域の画像)に対して同じ調整を行って縮小を行っても勿論よい。   Also, here, focusing on the fact that the size of the image of the main subject region extracted from the digital photographic image varies greatly, the reduction means adjusts the size of the image of the main subject region when performing reduction processing. Although the reduction intensity is adjusted accordingly, the reduction is performed, but the same adjustment is performed on the other images used in the parameter setting means (the entire digital photographic image, the image of the region other than the main subject region) to reduce the image. Of course, you may do.

また、画像のサイズは、例えば画像を表す画像データの画素数とすることができる。   The size of the image can be, for example, the number of pixels of image data representing the image.

本発明の第1のプログラムは、デジタル写真画像におけるボケを補正する画像処理をコンピュータに実行させるプログラムであって、
前記画像処理が、前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出処理と、
該主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定するパラメータ設定処理と、
該パラメータ設定処理により設定された前記パラメータを用いて前記デジタル写真画像に対して補正を行う補正処理とを有することを特徴とするものである。
A first program of the present invention is a program for causing a computer to execute image processing for correcting blur in a digital photographic image,
The image processing is a main subject extraction process for extracting a main subject region from the digital photographic image;
A parameter setting process for setting parameters for correcting the blur using the image of the main subject area;
And correction processing for correcting the digital photographic image using the parameters set by the parameter setting processing.

本発明の第2のプログラムは、デジタル写真画像におけるボケを補正する画像処理をコンピュータに実行させるプログラムであって、
前記画像処理が、前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出処理と、
前記デジタル写真画像が被写界深度の浅い画像か否かを判別する判別処理と、
前記判別処理により被写界深度の浅い画像に判別された前記デジタル写真画像に対して、前記主要被写体抽出処理により抽出された該デジタル写真画像の前記主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定する一方、被写界深度の浅い画像に判別された画像以外の前記デジタル写真画像に対して、該デジタル写真画像全体を用いて前記ボケを補正するためのパラメータを設定するパラメータ設定処理と、
該パラメータ設定処理により設定された前記パラメータを用いて前記デジタル写真画像に対して補正を行う補正処理とを有することを特徴とするものである。
A second program of the present invention is a program for causing a computer to execute image processing for correcting blur in a digital photographic image,
The image processing is a main subject extraction process for extracting a main subject region from the digital photographic image;
A determination process for determining whether the digital photographic image is an image with a shallow depth of field;
The blur is corrected by using the image of the main subject area of the digital photographic image extracted by the main subject extraction process for the digital photographic image determined as an image having a shallow depth of field by the discrimination process. On the other hand, for the digital photographic image other than the image determined to be an image with a shallow depth of field, a parameter for correcting the blur using the entire digital photographic image is set. Parameter setting process,
And correction processing for correcting the digital photographic image using the parameters set by the parameter setting processing.

本発明の第3のプログラムは、デジタル写真画像におけるボケを補正する画像処理をコンピュータに実行させるプログラムであって、
前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出処理と、
前記デジタル写真画像が被写界深度の浅い画像である確信度を求める確信度算出処理と、
前記主要被写体抽出処理により抽出された前記主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定する第1のパラメータ設定処理と、
前記デジタル写真画像全体または前記主要被写体領域以外の領域の画像を用いて前記ボケを補正するためのパラメータを設定する第2のパラメータ設定処理と、
前記確信度算出処理により得られた前記確信度が高いほど前記第1のパラメータ設定処理により設定された前記パラメータの重みが大きくなるように前記第1のパラメータにより設定されたパラメータと前記第2のパラメータ設定処理により設定されたパラメータとを重付合算して統合パラメータを取得する統合パラメータ取得処理と、
該統合パラメータ取得処理により取得された前記統合パラメータを用いて前記デジタル写真画像に対して補正を行う補正処理とを有することを特徴とするものである。
A third program of the present invention is a program for causing a computer to execute image processing for correcting blur in a digital photographic image,
A main subject extraction process for extracting a main subject region from the digital photographic image;
A certainty factor calculation process for determining the certainty factor that the digital photo image is an image having a shallow depth of field;
A first parameter setting process for setting a parameter for correcting the blur using an image of the main subject area extracted by the main subject extraction process;
A second parameter setting process for setting a parameter for correcting the blur using the entire digital photograph image or an image of an area other than the main subject area;
The parameter set by the first parameter and the second parameter are set such that the higher the certainty factor obtained by the certainty factor calculation process, the greater the weight of the parameter set by the first parameter setting process. An integrated parameter acquisition process for acquiring an integrated parameter by adding together the parameters set by the parameter setting process;
And a correction process for correcting the digital photographic image using the integrated parameter acquired by the integrated parameter acquisition process.

前記画像処理は、前記デジタル写真画像を撮像した撮像装置のレンズのF値を含む付属情報が付属された前記デジタル写真画像の前記付属情報を読み取って前記F値を取得する付属情報読取処理を有し、前記判別処理または前記確信度算出処理が、前記F値に基づいて前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求めるようにすればよい。   The image processing includes attached information reading processing for obtaining the F value by reading the attached information of the digital photographic image to which attached information including an F value of a lens of an imaging apparatus that has captured the digital photograph image is attached. Then, the determination process or the certainty factor calculation process may determine whether the digital photograph image is an image with a shallow depth of field or obtain the certainty factor based on the F value.

前記画像処理は、対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を有し、前記判別処理または前記確信度算出処理が、前記ボケ情報取得処理により前記主要被写体領域の画像および前記主要被写体領域以外の領域の画像を夫々前記対象画像にして取得された夫々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うようにすればよい。   The image processing detects an edge for each of a plurality of different directions with respect to the target image, acquires a feature amount of the edge in each of the directions, and acquires blur information based on the edge feature amount And each of the determination processing or the certainty factor calculation processing acquired by the blur information acquisition processing using the image of the main subject region and the image of the region other than the main subject region as the target images, respectively. By comparing the blur information, it may be determined whether or not the digital photographic image is an image with a shallow depth of field or the process of obtaining the certainty factor.

前記画像処理は、前記デジタル写真画像を複数のブロックに分けるブロック分け処理と、対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理とを有し、前記判別処理または前記確信度算出処理が、前記ボケ情報取得処理により各前記ブロックの画像を夫々前記対象画像にして取得された各々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うようにすればよい。   The image processing includes a block dividing process for dividing the digital photographic image into a plurality of blocks, an edge is detected for each of a plurality of different directions with respect to the target image, and a feature amount of the edge in each of the directions is acquired, A blur information acquisition process for acquiring blur information based on the edge feature amount, and the determination process or the certainty factor calculation process sets the image of each block as the target image by the blur information acquisition process. By comparing each of the acquired blur information, it may be determined whether or not the digital photographic image is an image with a shallow depth of field or the process of obtaining the certainty factor.

前記パラメータ設定処理は、前記ボケを補正するためのパラメータを設定するために用いられる画像に対して、該画像における複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を有し、取得された前記ボケ情報基づいて前記パラメータを設定することが好ましい。   The parameter setting process detects an edge for each of a plurality of different directions in the image with respect to an image used for setting a parameter for correcting the blur, and calculates a feature amount of the edge in each of the directions. It is preferable to have a blur information acquisition process that acquires and acquires blur information based on the edge feature amount, and sets the parameter based on the acquired blur information.

本発明の第1の画像処理方法および装置並びにプログラムによれば、デジタル写真画像から主要被写体領域を抽出し、主要被写体領域の画像を用いてボケを補正するためのパラメータを設定してデジタル写真画像に対して補正を行うようにしているので、パラメータを設定するための領域の指定をユーザにさせる必要がない。特に、被写界深度の浅いデジタル写真画像の場合において、最も補正を必要とする主要被写体の領域の画像のみを用いて補正用のパラメータを設定することによって、補正の精度を高めることができる。また、主要被写体領域の画像を用いて補正用のパラメータを設定することによって、撮像時にぶれに関する情報を取得するための装置を設ける必要がないため、撮像装置を大型化することを避けることができ、特に小型化を必須条件とする携帯電話機付属のデジタルカメラの場合には、メリットが大きい。   According to the first image processing method, apparatus, and program of the present invention, a digital photographic image is extracted by extracting a main subject region from a digital photographic image and setting parameters for correcting blur using the image of the main photographic subject region. Therefore, it is not necessary for the user to specify an area for setting parameters. In particular, in the case of a digital photographic image with a shallow depth of field, the correction accuracy can be improved by setting the correction parameters using only the image of the main subject area that requires the most correction. In addition, by setting correction parameters using the image of the main subject area, it is not necessary to provide a device for acquiring information regarding blurring during imaging, and thus it is possible to avoid increasing the size of the imaging device. In particular, in the case of a digital camera attached to a mobile phone, which requires miniaturization as a prerequisite, there are significant advantages.

本発明の第2の画像処理方法および装置並びにプログラムによれば、デジタル写真画像が被写界深度の浅い画像か否かを判別し、被写界深度の浅い画像に対して、主要被写体領域の画像を用いて補正用のパラメータを設定して補正するようにしているので、本発明の第1の画像処理方法および装置並びにプログラムと同様の効果を得ることができると共に、被写界深度の浅い画像ではないデジタル写真画像に対しては、デジタル写真画像全体を用いて補正用のパラメータを設定して補正を行うようにしているので、被写界深度の浅い画像ではないデジタル写真画像の補正精度を高めることができる。   According to the second image processing method, apparatus, and program of the present invention, it is determined whether or not the digital photographic image is an image having a shallow depth of field, and the main subject region is detected with respect to the image having a shallow depth of field. Since correction is performed by setting a correction parameter using an image, the same effect as the first image processing method, apparatus and program of the present invention can be obtained, and the depth of field is shallow. For digital photographic images that are not images, the entire digital photographic image is used for correction by setting correction parameters, so the correction accuracy for digital photographic images that are not images with a shallow depth of field is correct. Can be increased.

本発明の第3の画像処理方法および装置並びにプログラムによれば、デジタル写真画像が被写界深度の浅い画像である確信度を算出し、この確信度が高いほど、主要被写体領域の画像を用いて設定したパラメータ(第1のパラメータ)の重みが高くなるように、第1のパラメータと、デジタル写真画像全体または主要被写体領域以外の領域の画像を用いて設定したパラメータ(第2のパラメータ)とを重み付け合算して得たパラメータを用いてデジタル写真画像を補正するようにしているので、第2の画像処理方法および装置並びにプログラムと同様の効果を得ることができると共に、被写界深度に対する判別に多少のずれがあっても、良い補正効果を得ることができる。   According to the third image processing method, apparatus and program of the present invention, the certainty factor that the digital photographic image is an image with a shallow depth of field is calculated, and the higher the certainty factor, the more the image of the main subject region is used. The first parameter and the parameter (second parameter) set using the entire digital photographic image or an image of an area other than the main subject area so that the weight of the parameter (first parameter) set in the Since the digital photographic image is corrected using the parameters obtained by weighting and summing the values, it is possible to obtain the same effect as the second image processing method, apparatus and program, and to determine the depth of field. Even if there is a slight deviation, there can be obtained a good correction effect.

本発明の画像処理方法および装置並びにプログラムは、対象画像に対して、異なる方向毎に検出したエッジの特徴量に基づいてボケ情報を取得し、このボケ情報に基づいてパラメータを設定して補正を行うようにすると、ボケ情報なしに補正、評価処理を繰り返す方法に比べ、演算量が少ないため、処理が早く、効率が良い。   The image processing method, apparatus, and program according to the present invention acquire blur information based on edge feature values detected in different directions for a target image, set parameters based on the blur information, and perform correction. If this is done, the amount of calculation is smaller than in the method of repeating the correction and evaluation processing without blur information, so the processing is fast and efficient.

本発明の第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におけるエッジ検出手段12の構成を示すブロック図1 is a block diagram showing the configuration of edge detection means 12 in the image processing system A shown in FIG. 図2に示すエッジ検出手段12における第2の縮小手段13の構成を示すブロック図FIG. 2 is a block diagram showing the configuration of the second reduction means 13 in the edge detection means 12 shown in FIG. エッジを検出する際に用いられる方向を示す図Diagram showing the direction used when detecting edges エッジプロファイルを示す図Diagram showing edge profile エッジ幅のヒストグラムを示す図Diagram showing edge width histogram 解析手段20の動作を説明するための図The figure for demonstrating operation | movement of the analysis means 20 ボケ度の算出を説明するための図Diagram for explaining the calculation of the degree of blur ぶれ度の算出を説明するための図Diagram for explaining the calculation of blurring degree 顔抽出手段100の構成を示すブロック図The block diagram which shows the structure of the face extraction means 100 (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 顔の回転を説明するための図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 図1に示す実施形態の画像処理システムAの動作を示すフローチャートThe flowchart which shows operation | movement of the image processing system A of embodiment 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. 図21に示す画像処理システムBの動作を示すフローチャート(その1)21 is a flowchart showing the operation of the image processing system B shown in FIG. 図21に示す画像処理システムBの動作を示すフローチャート(その2)21 is a flowchart showing the operation of the image processing system B shown in FIG. 本発明の第3の実施形態となる画像処理システムCの構成を示すブロック図The block diagram which shows the structure of the image processing system C used as the 3rd Embodiment of this invention. 図24に示す画像処理システムCの動作を示すフローチャート(その1)Flowchart showing the operation of the image processing system C shown in FIG. 図24に示す画像処理システムCの動作を示すフローチャート(その2)Flowchart showing the operation of the image processing system C shown in FIG. 本発明の第4の実施形態となる画像処理システムDの構成を示すブロック図The block diagram which shows the structure of the image processing system D used as the 4th Embodiment of this invention.

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

図1は、本発明の画像処理方法および装置並びにそのためのプログラムの第1の実施形態となる画像処理システムAの構成を示すブロック図である。図1に示す画像処理システムAは、携帯電話機付属のデジタルカメラ(以下携帯カメラという)により取得した写真画像(以下略して単に画像という)を記録した記録媒体1から画像を読み出して画像処理を行うものであり、記録媒体1には多数の画像からなる画像群が記録されているが、ここでは、この画像群のうちの1つの画像Dを例にして説明を行う。   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. An image processing system A shown in FIG. 1 performs image processing by reading an image from a recording medium 1 on which a photographic image (hereinafter simply referred to as an image) acquired by a digital camera attached to a mobile phone (hereinafter referred to as a portable camera) is recorded. However, an image group consisting of a large number of images is recorded on the recording medium 1. Here, description will be given by taking one image D of the image group as an example.

図示のように、本実施形態の画像処理システムAは、記録媒体1から読み出された画像Dに対して例えば1/8の縮小率で縮小処理を行って画像Dの縮小画像dを得る縮小手段10aと、縮小画像dに対して主要被写体(ここでは例として顔)の検出を行うと共に、顔が検出されれば顔部分の画像(ここでは、顔部分の画像の縮小画像であるが、以下において顔部分の画像と顔部分の画像の縮小画像を符号により区別し、両方とも顔画像という)d0を抽出して後述するエッジ検出手段12に出力する一方、顔が検出されなければ縮小画像dをエッジ検出手段12に出力する顔抽出手段100と、顔抽出手段100からの顔画像d0および画像Dにおいて顔画像d0に対応する部分の画像D0、または縮小画像dおよび画像Dを用いて、図4に示す8つの異なる方向毎にエッジを検出するエッジ検出手段12と、エッジ検出手段12により検出されたエッジのうちの、無効なエッジを除去するエッジ絞込手段14と、エッジ絞込手段14により得られたエッジの特徴量Sを取得するエッジ特徴量取得手段16と、エッジ特徴量Sを用いて、ボケ方向およびボケ度Nを算出して画像Dがボケ画像か通常画像かを判別し、通常画像の場合には、後述する出力手段60に画像Dが通常画像であることを示す情報Pを送信して処理を終了する一方、ボケ画像の場合には、さらにぶれ度K、ボケ幅Lを算出して、ボケ度Nおよびボケ方向と共にボケ情報Qとして後述するパラメータ設定手段30に送信する解析手段20と、解析手段20からのボケ情報Qに基づいてボケ画像となる画像Dを補正するためのパラメータEを複数(E0、E1、E2、・・・)設定するパラメータ設定手段30と、パラメータE0、E1、E2、・・・を用いて画像Dに対して補正を行って、各パラメータに対応する補正済み画像D’0、D’1、D’2、・・・を得る補正手段40と、各々の補正済み画像D’0、D’1、D’2、・・・から目的画像D’を決定して出力手段60に出力する決定手段45と、解析手段20およびパラメータ設定手段30のための種々のデータベースを記憶した記憶手段50と、解析手段20から画像Dが通常画像であることを示す情報Pを受信した場合には画像Dを出力する一方、決定手段45から目的画像D’を受信した場合には目的画像D’を出力する出力手段60とを有してなる。   As shown in the figure, the image processing system A according to the present embodiment performs reduction processing on an image D read from the recording medium 1 at a reduction ratio of, for example, 1/8 to obtain a reduced image d of the image D. The main object (here, a face as an example) is detected from the means 10a and the reduced image d. If a face is detected, an image of the face portion (here, a reduced image of the face portion image, In the following description, the face image and the reduced image of the face image are distinguished by a code, and both are referred to as face images) and extracted d0 and output to the edge detection means 12 described later. On the other hand, if no face is detected, the reduced image Using the face extraction unit 100 that outputs d to the edge detection unit 12, and the face image d0 and the image D from the face extraction unit 100, the portion of the image D0 corresponding to the face image d0, or the reduced image d and the image D, FIG. The edge detection means 12 for detecting edges in each of the eight different directions shown, the edge narrowing means 14 for removing invalid edges among the edges detected by the edge detection means 12, and the edge narrowing means 14 The edge feature amount acquisition means 16 for acquiring the feature value S of the edge and the edge feature amount S are used to calculate the blur direction and the blur degree N to determine whether the image D is a blur image or a normal image. In the case of an image, information P indicating that the image D is a normal image is transmitted to the output means 60 to be described later, and the processing is terminated. On the other hand, in the case of a blurred image, the blur degree K and the blur width L are further set. The calculation unit 20 calculates and transmits to the parameter setting unit 30 (to be described later) as the blur information Q together with the blur degree N and the blur direction, and the image D that becomes a blur image is compensated based on the blur information Q from the analysis unit 20. The parameter D is corrected using the parameter setting means 30 for setting a plurality of parameters E (E0, E1, E2,...) And the parameters E0, E1, E2,. From the correction means 40 for obtaining corrected images D′ 0, D′ 1, D′ 2,... Corresponding to the parameters, and the corrected images D′ 0, D′ 1, D′ 2,. A determination unit 45 that determines the target image D ′ and outputs it to the output unit 60, a storage unit 50 that stores various databases for the analysis unit 20 and the parameter setting unit 30, and an image D from the analysis unit 20 is a normal image. When receiving the information P indicating that, the output unit 60 outputs the image D, and outputs the target image D ′ when receiving the target image D ′ from the determining unit 45. .

以下、図1に示す画像処理システムAの各構成について説明する。   Hereinafter, each configuration of the image processing system A illustrated in FIG. 1 will be described.

まず、顔抽出手段100について説明する。   First, the face extraction unit 100 will be described.

図10は、顔抽出手段100の詳細構成を示すブロック図である。図示のように、顔抽出手段100は、画像dから特徴量C0を算出する特徴量算出手段110と、後述する参照データH0により構成されるデータベース115と、特徴量算出手段110が算出した特徴量C0とデータベース115内の参照データH0とに基づいて、画像Dに人物の顔が含まれているか否かを識別すると共に、顔か含まれていれば顔画像d0を切り出してエッジ検出手段12に出力する一方、顔が含まれていなければ縮小画像dをエッジ検出手段に出力する顔検出手段120とを備えてなる。   FIG. 10 is a block diagram showing a detailed configuration of the face extraction unit 100. As illustrated, the face extraction unit 100 includes a feature amount calculation unit 110 that calculates a feature amount C0 from an image d, a database 115 that includes reference data H0 described later, and a feature amount that is calculated by the feature amount calculation unit 110. Based on C0 and the reference data H0 in the database 115, it is identified whether or not a face of a person is included in the image D. If a face is included, the face image d0 is cut out to the edge detection means 12. On the other hand, if the face is not included, the face detecting means 120 for outputting the reduced image d to the edge detecting means is provided.

顔抽出手段100の特徴量算出手段110は、顔の識別に用いる特徴量C0を縮小画像dから算出する。具体的には、勾配ベクトル(すなわち縮小画像d上の各画素における濃度が変化する方向および変化の大きさ)を特徴量C0として算出する。以下、勾配ベクトルの算出について説明する。まず、特徴量算出手段110は、縮小画像dに対して図11(a)に示す水平方向のエッジ検出フィルタによるフィルタリング処理を施して縮小画像dにおける水平方向のエッジを検出する。また、特徴量算出手段110は、縮小画像dに対して図11(b)に示す垂直方向のエッジ検出フィルタによるフィルタリング処理を施して縮小画像dにおける垂直方向のエッジを検出する。そして、縮小画像d上の各画素における水平方向のエッジの大きさHおよび垂直方向のエッジの大きさVとから、図12に示すように、各画素における勾配ベクトルKを算出する。   The feature amount calculation unit 110 of the face extraction unit 100 calculates a feature amount C0 used for face identification from the reduced image d. Specifically, the gradient vector (that is, the direction in which the density of each pixel on the reduced image d 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 quantity calculating unit 110 performs filtering processing by the horizontal edge detection filter shown in FIG. 11A on the reduced image d to detect horizontal edges in the reduced image d. Further, the feature amount calculating unit 110 performs a filtering process on the reduced image d by a vertical edge detection filter shown in FIG. 11B to detect vertical edges in the reduced image d. Then, a gradient vector K for each pixel is calculated from the horizontal edge size H and the vertical edge size V of each pixel on the reduced image d, as shown in FIG.

なお、このようにして算出された勾配ベクトルKは、図13(a)に示すような人物の顔の場合、図13(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. 13B 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の所定方向(例えば図12における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. 12).

ここで、勾配ベクトルKの大きさは正規化される。この正規化は、縮小画像dの全画素における勾配ベクトルKの大きさのヒストグラムを求め、その大きさの分布が縮小画像dの各画素が取り得る値(8ビットであれば0〜255)に均一に分布されるようにヒストグラムを平滑化して勾配ベクトルKの大きさを修正することにより行う。例えば、勾配ベクトルKの大きさが小さく、図14(a)に示すように勾配ベクトルKの大きさが小さい側に偏ってヒストグラムが分布している場合には、大きさが0〜255の全領域に亘るものとなるように勾配ベクトルKの大きさを正規化して図14(b)に示すようにヒストグラムが分布するようにする。なお、演算量を低減するために、図14(c)に示すように、勾配ベクトルKのヒストグラムにおける分布範囲を例えば5分割し、5分割された頻度分布が図14(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 the pixels of the reduced image d, and the distribution of the magnitudes is a value that each pixel of the reduced image d can take (0 to 255 if 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. 14C, 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. 14D. It is preferable to normalize so that the value of 0 to 255 is in a range divided into five.

データベース115内を構成する参照データH0は、後述するサンプル画像から選択された複数画素の組み合わせからなる複数種類の画素群の夫々について、各画素群を構成する各画素における特徴量C0の組み合わせに対する識別条件を規定したものである。   The reference data H0 constituting the database 115 is an identification for the combination of the feature amount C0 in each pixel constituting each pixel group, for each of a plurality of types of pixel groups composed of combinations of a plurality of pixels selected from a sample image to be described later. The conditions are specified.

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

なお、本実施形態においては、参照データH0を生成する際には、顔であることが分かっているサンプル画像として、30×30画素サイズを有し、図15に示すように、1つの顔の画像について両目の中心間の距離が10画素、9画素および11画素であり、両目の中心間距離において垂直に立った顔を平面上±15度の範囲において3度単位で段階的に回転させた(すなわち、回転角度が−15度,−12度,−9度,−6度,−3度,0度,3度,6度,9度,12度,15度)サンプル画像を用いるものとする。したがって、1つの顔の画像につきサンプル画像は3×11=33通り用意される。なお、図15においては−15度、0度および+15度に回転させたサンプル画像のみを示す。また、回転の中心はサンプル画像の対角線の交点である。ここで、両目の中心間の距離が10画素のサンプル画像であれば、目の中心位置はすべて同一となっている。この目の中心位置をサンプル画像の左上隅を原点とする座標上において(x1,y1)、(x2,y2)とする。また、図面上上下方向における目の位置(すなわちy1,y2)はすべてのサンプル画像において同一である。   In the present embodiment, when generating the reference data H0, the sample image that is known to be a face has a 30 × 30 pixel size, and as shown in FIG. The distance between the centers of both eyes of the image is 10 pixels, 9 pixels, and 11 pixels, and the face standing vertically at the distance between the centers of both eyes is rotated stepwise by 3 degrees within a range of ± 15 degrees on the plane. (That is, the rotation angle is -15 degrees, -12 degrees, -9 degrees, -6 degrees, -3 degrees, 0 degrees, 3 degrees, 6 degrees, 9 degrees, 12 degrees, 15 degrees) To do. Therefore, 3 × 11 = 33 sample images are prepared for one face image. In FIG. 15, 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.

また、顔でないことが分かっているサンプル画像としては、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度(すなわち顔が垂直な状態)のもののみを用いて学習を行った場合、参照データH0を参照して顔であると識別されるのは、両目の中心間距離が10画素で全く回転していない顔のみである。縮小画像dに含まれる可能性がある顔のサイズは一定ではないため、顔が含まれるか否かを識別する際には、後述するように縮小画像dを拡大縮小して、サンプル画像のサイズに適合するサイズの顔の位置を識別できるようにしている。しかしながら、両目の中心間距離を正確に10画素とするためには、縮小画像dのサイズを拡大率として例えば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, only the face that is identified as a face with reference to the reference data H0 is not rotated at all because the distance between the centers of both eyes is 10 pixels. Since the size of a face that may be included in the reduced image d is not constant, when identifying whether or not a face is included, the size of the sample image is reduced by enlarging and reducing the reduced image d as described later. It is possible to identify the position of a face of a size that fits. However, in order to accurately set the distance between the centers of both eyes to 10 pixels, the size of the reduced image d needs to be identified while being enlarged or reduced in steps of, for example, 1.1 units as an enlargement ratio. Will be enormous.

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

このため、本実施形態においては、顔であることが分かっているサンプル画像として、図15に示すように両目の中心間距離が9,10,11画素であり、各距離において平面上±15度の範囲にて3度単位で段階的に顔を回転させたサンプル画像を用いて、参照データH0の学習に許容度を持たせるようにしたものである。これにより、後述する顔検出手段120において識別を行う際には、縮小画像dを拡大率として11/9単位で段階的に拡大縮小すればよいため、縮小画像dのサイズを例えば拡大率として例えば1.1単位で段階的に拡大縮小する場合と比較して、演算時間を低減できる。また、図16(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, and 11 pixels as shown in FIG. 15, and ± 15 degrees on the plane at each distance. In this range, a sample image obtained by rotating the face stepwise in units of 3 degrees is allowed to learn the reference data H0. As a result, when the face detection unit 120, which will be described later, performs identification, the reduced image d may be enlarged or reduced in steps of 11/9 as an enlargement rate. The calculation time can be reduced as compared with the case of enlarging / reducing in steps of 1.1 units. In addition, as shown in FIGS. 16B and 16C, a rotating face can also be identified.

以下、図17のフローチャートを参照しながらサンプル画像群の学習手法の一例を説明する。   Hereinafter, an example of a learning method for the sample image group will be described with reference to the flowchart of FIG.

学習の対象となるサンプル画像群は、顔であることが分かっている複数のサンプル画像と、顔でないことが分かっている複数のサンプル画像とからなる。なお、顔であることが分かっているサンプル画像は、上述したように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.

図18を参照しながらある識別器の作成について説明する。図18の左側のサンプル画像に示すように、この識別器を作成するための画素群を構成する各画素は、顔であることが分かっている複数のサンプル画像上における、右目の中心にある画素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. 18, 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, it can reduce the number of data of the characteristic amounts C0.


同様に、顔でないことが分かっている複数のサンプル画像についても、ヒストグラムが作成される。なお、顔でないことが分かっているサンプル画像については、顔であることが分かっているサンプル画像上における上記画素P1〜P4の位置に対応する画素が用いられる。これらの2つのヒストグラムが示す頻度値の比の対数値を取ってヒストグラムで表したものが、図18の一番右側に示す、識別器として用いられるヒストグラムである。この識別器のヒストグラムが示す各縦軸の値を、以下、識別ポイントと称する。この識別器によれば、正の識別ポイントに対応する特徴量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. The histogram used as a discriminator shown on the right side of FIG. 18 is a histogram obtained by taking logarithmic values of the ratios of the 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 less than or equal to the predetermined threshold, the process advances to step S6 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)、これにより参照データH0の学習を終了する。   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 the face is included and the discriminating condition are determined (S7), thereby the reference data H0. Finish learning.

なお、上記の学習手法を採用する場合において、識別器は、特定の画素群を構成する各画素における特徴量C0の組み合わせを用いて顔の画像と顔でない画像とを識別する基準を提供するものであれば、上記のヒストグラムの形式のものに限られずいかなるものであってもよく、例えば2値データ、閾値または関数等であってもよい。また、同じヒストグラムの形式であっても、図18の中央に示した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. Moreover, even in 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. 18 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.

顔検出手段120は、複数種類の画素群を構成する各画素における特徴量C0の組み合わせのすべてについて参照データH0が学習した識別条件を参照して、各々の画素群を構成する各画素における特徴量C0の組み合わせについての識別ポイントを求め、すべての識別ポイントを総合して縮小画像dに顔が含まれるか否かを識別する。この際、特徴量C0である勾配ベクトルKの方向は4値化され大きさは3値化される。本実施形態では、すべての識別ポイントを加算して、その加算値の正負によって識別を行うものとする。例えば、識別ポイントの総和が正の値である場合には縮小画像dには顔が含まれると判断し、負の値である場合には顔が含まれないと判断する。   The face detection unit 120 refers to the identification conditions learned by the reference data H0 for all the combinations of the feature amounts C0 in the respective pixels constituting a plurality of types of pixel groups, and the feature amounts in the respective pixels constituting each pixel group. An identification point for the combination of C0 is obtained, and all the identification points are combined to identify whether or not a face is included in the reduced image d. At this time, the direction of the gradient vector K that is the feature amount C0 is quaternized and the magnitude is ternary. 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 reduced image d includes a face, and when it is a negative value, it is determined that no face is included.

ここで、縮小画像dのサイズは30×30画素のサンプル画像とは異なり、各種サイズを有するものとなっている可能性がある。また、顔が含まれる場合、平面上における顔の回転角度が0度であるとは限らない。このため、顔検出手段120は、図19に示すように、縮小画像dを縦または横のサイズが30画素となるまで段階的に拡大縮小するとともに平面上で段階的に360度回転させつつ(図19においては縮小する状態を示す)、各段階において拡大縮小された縮小画像d上に30×30画素サイズのマスクMを設定し、マスクMを拡大縮小された縮小画像d上において1画素ずつ移動させながら、マスク内の画像が顔の画像であるか否かの識別を行うことにより、縮小画像dに顔が含まれるか否かを識別する。そして、縮小画像dに顔が含まれるか否かの識別を拡大縮小および回転の全段階の縮小画像dについて行い、一度でも顔が含まれると識別された場合には、縮小画像dには顔が含まれると識別し、顔が含まれると識別された段階におけるサイズおよび回転角度の縮小画像dから、識別されたマスクMの位置に対応する30×30画素の領域を顔の画像d0として抽出してエッジ検出手段12に出力する一方、一度でも顔が含まれると識別されない場合には、縮小画像dには顔が含まれていないと識別し、縮小画像dをそのままエッジ検出手段12に出力する。   Here, the size of the reduced image d is different from the sample image of 30 × 30 pixels, and may have various sizes. When a face is included, the rotation angle of the face on the plane is not always 0 degrees. For this reason, as shown in FIG. 19, the face detection unit 120 enlarges and reduces the reduced image d stepwise until the vertical or horizontal size becomes 30 pixels and rotates it 360 degrees stepwise on the plane ( FIG. 19 shows a state of reduction), a mask M having a size of 30 × 30 pixels is set on the reduced image d enlarged / reduced at each stage, and the mask M is set on the reduced image d enlarged / reduced one pixel at a time. It is identified whether or not the reduced image d includes a face by identifying whether or not the image in the mask is a face image while moving. Whether or not a face is included in the reduced image d is determined with respect to the reduced image d at all stages of enlargement / reduction and rotation. Is extracted, and a 30 × 30 pixel area corresponding to the position of the identified mask M is extracted as a face image d0 from the reduced image d of the size and rotation angle at the stage where it is identified that the face is included. If the face is not identified as being included even once, the reduced image d is identified as not containing a face, and the reduced image d is output to the edge detecting means 12 as it is. To do.

なお、参照データH0の生成時に学習したサンプル画像として両目の中心位置の画素数が9,10,11画素のものを使用しているため、縮小画像dを拡大縮小する時の拡大率は11/9とすればよい。また、参照データH0の生成時に学習したサンプル画像として、顔が平面上で±15度の範囲において回転させたものを使用しているため、縮小画像dは30度単位で360度回転させればよい。   Note that since the sample image learned at the time of generating the reference data H0 has 9, 10, and 11 pixels at the center position of both eyes, the enlargement ratio when the reduced image d is enlarged / reduced is 11 / 9 is enough. Further, as the sample image learned at the time of generating the reference data H0, a sample image whose face is rotated in a range of ± 15 degrees on the plane is used. Therefore, if the reduced image d is rotated 360 degrees in units of 30 degrees. Good.

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

顔抽出手段100は、このようにして縮小画像dに顔が含まれているか否か(すなわち画像Dに顔が含まれているか否か)を識別して、顔が含まれている場合には、抽出された顔画像d0をエッジ検出手段12に出力する一方、顔が含まれていない場合には縮小画像dをそのままエッジ検出手段12に出力する。   In this way, the face extraction unit 100 identifies whether or not a face is included in the reduced image d (that is, whether or not a face is included in the image D). The extracted face image d0 is output to the edge detection unit 12, while if the face is not included, the reduced image d is output to the edge detection unit 12 as it is.

なお、顔画像d0が複数抽出された場合においては、顔抽出手段100は、抽出された全ての顔画像d0をエッジ検出手段12に出力する。   When a plurality of face images d0 are extracted, the face extraction unit 100 outputs all the extracted face images d0 to the edge detection unit 12.

図2は、エッジ検出手段12の構成を示すブロック図である。図示のように、エッジ検出手段12は、選択手段11aと、第2の縮小手段13と、検出実行手段11bとを備えてなる。   FIG. 2 is a block diagram showing the configuration of the edge detection means 12. As illustrated, the edge detection unit 12 includes a selection unit 11a, a second reduction unit 13, and a detection execution unit 11b.

選択手段11aは、顔抽出手段100から出力されてきた画像が1つ(1つのみの顔画像d0または縮小画像d)である場合には、この1つの画像をそのまま第2の縮小手段13に出力する一方、顔抽出手段100から複数の画像(顔画像d0)が出力されてきた場合には、複数の顔画像d0からエッジを抽出するのに用いる顔画像を選択して第2の縮小手段13に出力するものである。本実施形態において、エッジ検出手段12の選択手段11aは、複数の顔画像d0の夫々の画素数を確認し、画素数が最も多い顔画像d0を選択するものである。なお、選択手段11aから第2の縮小手段13に出力された画像は、以下画像d2という。   When there is one image (only one face image d0 or reduced image d) output from the face extracting unit 100, the selecting unit 11a sends this one image to the second reducing unit 13 as it is. On the other hand, when a plurality of images (face images d0) are output from the face extraction means 100, the face image used for extracting an edge from the plurality of face images d0 is selected and the second reduction means is selected. 13 is output. In the present embodiment, the selection unit 11a of the edge detection unit 12 confirms the number of pixels of each of the plurality of face images d0 and selects the face image d0 having the largest number of pixels. The image output from the selection unit 11a to the second reduction unit 13 is hereinafter referred to as an image d2.

図3は、エッジ検出手段12における第2の縮小手段13の構成を示すブロック図である。図示のように、第2の縮小手段13は、縮小率βを決定する縮小率決定手段13aと、縮小率βを用いて縮小処理を実行する縮小実行手段13bとを備えてなる。   FIG. 3 is a block diagram showing the configuration of the second reduction means 13 in the edge detection means 12. As illustrated, the second reduction unit 13 includes a reduction rate determination unit 13a that determines a reduction rate β, and a reduction execution unit 13b that executes a reduction process using the reduction rate β.

第2の縮小手段13に出力されてきた画像d2は3種類あり、夫々、顔抽出手段100から出力されてきた縮小画像d、顔抽出手段100から出力されてきた1つのみの顔画像d0、選択手段11aにより複数の顔画像d0から選択された顔画像d0である。縮小率決定手段13aは、この画像d2に対応する、縮小されていない画像(縮小画像dの場合には画像D、顔画像d0の場合には、画像Dにおける、顔画像d0に対応する領域の画像)の画素数に応じて下記のように縮小率βを決定する。   There are three types of images d2 output to the second reduction unit 13, each of which is a reduced image d output from the face extraction unit 100, and only one face image d0 output from the face extraction unit 100. The face image d0 is selected from the plurality of face images d0 by the selection unit 11a. The reduction rate determining means 13a corresponds to the image d2 and is an unreduced image (the image D in the case of the reduced image d and the area corresponding to the face image d0 in the image D in the case of the face image d0). The reduction ratio β is determined as follows according to the number of pixels of the image.

1.画素数が100万画素以下である場合、縮小率βを1に、すなわち縮小しないように決定する。 1. When the number of pixels is 1 million pixels or less, the reduction ratio β is determined to be 1, that is, not reduced.

2.画素数が100万画素より大きく、200万画素以下である場合、縮小率βを1/2に決定する。 2. When the number of pixels is larger than 1 million pixels and 2 million pixels or less, the reduction ratio β is determined to be ½.

3.画素数が200万画素より大きく、300万画素以下である場合、縮小率βを1/4に決定する。 3. When the number of pixels is larger than 2 million pixels and 3 million pixels or less, the reduction ratio β is determined to be ¼.

4.画素数が300万画素より大きく、400万画素以下である場合、縮小率βを1/8に決定する。 4). When the number of pixels is larger than 3 million pixels and 4 million pixels or less, the reduction ratio β is determined to be 1/8.

5.画素数が400万画素より大きく、600万画素以下である場合、縮小率βを1/16に決定する。 5. When the number of pixels is larger than 4 million pixels and 6 million pixels or less, the reduction ratio β is determined to be 1/16.

6.画素数が600万画素より大きい場合、縮小率βを1/32に決定する。 6). When the number of pixels is larger than 6 million pixels, the reduction ratio β is determined to be 1/32.


縮小率決定手段13aは、このように決定した縮小率βを縮小実行手段13bに出力する。

The reduction rate determination unit 13a outputs the reduction rate β thus determined to the reduction execution unit 13b.

縮小実行手段13bは、縮小率決定手段13aにより決定された縮小率βを用いて、該当する画像d2の縮小されていない画像(前述のように、縮小画像dの場合には画像D、顔画像d0の場合には、画像Dにおける、顔画像d0に対応する領域の画像)を縮小して、エッジを検出するための縮小画像d3を得て検出実行手段11bに出力する。   The reduction execution unit 13b uses the reduction rate β determined by the reduction rate determination unit 13a to use an unreduced image of the corresponding image d2 (as described above, in the case of the reduced image d, the image D and the face image). In the case of d0, the image D in the region corresponding to the face image d0) is reduced to obtain a reduced image d3 for detecting an edge and output to the detection execution unit 11b.

検出実行手段11bは、まず、縮小画像d3を用いて、図4に示すような8方向毎に、所定の強度以上のエッジを検出し、これらのエッジの座標位置を得る。次に検出実行手段11bは、検出された各方向毎の各々のエッジの座標位置に基づいて、縮小画像d3の対応する、縮小されていない画像(以下概して対象画像という)を用いてこれらのエッジに対して、図5に示すようなエッジプロファイルを作成してエッジ絞込手段14に出力する。   First, the detection execution unit 11b uses the reduced image d3 to detect edges having a predetermined intensity or more in every eight directions as shown in FIG. 4 and obtain the coordinate positions of these edges. Next, based on the detected coordinate position of each edge in each direction, the detection execution unit 11b uses the corresponding non-reduced image (hereinafter generally referred to as a target image) of the reduced image d3 to detect these edges. In contrast, an edge profile as shown in FIG. 5 is created and output to the edge narrowing means 14.

エッジ絞込手段14は、エッジ検出手段12(具体的には、検出実行手段11b)から出力されてきたエッジのプロファイルに基づいて、複雑なプロファイル形状を有するエッジや、光源を含むエッジ(具体的には例えば一定の明度以上のエッジ)などの無効なエッジを除去し、残りのエッジのプロファイルをエッジ特徴量取得手段16に出力する。   The edge narrowing means 14 is based on the edge profile output from the edge detection means 12 (specifically, the detection execution means 11b), or an edge having a complex profile shape or an edge (specifically, a light source). For example, an invalid edge such as an edge having a certain brightness or higher is removed, and the profile of the remaining edge is output to the edge feature quantity acquisition unit 16.

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

解析手段20は、主として下記の2つの処理を行う。   The analysis means 20 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.

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

図7(c)は、ぶれ、ピンボケ、ボケ(ピンボケおよびぶれ)なしの撮像条件で同じ被写体を撮像して得た夫々の画像に対して求められた、このぶれの方向におけるエッジ幅のヒストグラムを示している。図7(c)から分かるように、ボケのない通常画像は、最も小さい平均エッジ幅を有し、すなわち、上記において見付け出された2つの方向のうち、平均エッジ幅が大きい方は、最もぶれに近い方向のはずである。   FIG. 7C shows a histogram of edge widths in the blur direction obtained for each image obtained by imaging the same subject under imaging conditions without blur, defocus, and blur (out of focus and blur). Show. As can be seen from FIG. 7 (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.

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

次に、解析手段20は、対象画像のボケ度Nを求める。画像のボケ度は、画像中のボケの程度の大小を示すものであり、例えば、画像中に最もぼけている方向(ここでは上記において求められたボケ方向)の平均エッジ幅を用いてもよいが、ここでは、ボケ方向における各々のエッジのエッジ幅を用いて図8に基づいたデータベースを利用してより精度良く求める。図8は、学習用の通常画像データベースとボケ(ピンボケおよびぶれ)画像データベースを元に、画像中の最もぼけている方向(通常画像の場合には、この方向に対応する方向が望ましいが、任意の方向であってもよい)のエッジ幅分布のヒストグラムを作成し、ボケ画像における頻度と通常画像における頻度(図示縦軸)の比率を評価値(図示スコア)としてエッジ幅毎に求めて得たものである。図8に基づいて、エッジ幅とスコアとを対応付けてなるデータベース(以下スコアデータベースという)が作成され、記憶手段50に記憶されている。   Next, the analysis unit 20 obtains 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, here, the edge width of each edge in the blur direction is used to obtain more accurately using the database based on FIG. FIG. 8 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. 8, 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 50.

解析手段20は、図8に基づいて作成され、記憶手段50に記憶されたスコアデータベースを参照し、対象画像のボケ方向の各エッジに対して、そのエッジ幅からスコアを取得し、ボケ方向の全てのエッジのスコアの平均値を対象画像のボケ度Nとして求める。求められた対象画像のボケ度Nが所定の閾値Tより小さければ、解析手段20は、対象画像を通常画像として判別すると共に、該対象画像のオリジナル画像である画像Dが通常画像であることを示す情報Pを出力手段60に出力することをもって、処理を終了する。   The analysis unit 20 refers to the score database created based on FIG. 8 and stored in the storage unit 50, acquires a score from the edge width of each edge in the blur direction of the target image, The average value of the scores of all edges 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 value T, the analysis unit 20 determines that the target image is a normal image and that the image D that is the original image of the target image is a normal image. When the information P indicated is output to the output means 60, the processing is terminated.

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

解析手段20は、2つ目の処理として、まず、対象画像のぶれ度Kを求める。   As the second process, the analysis unit 20 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.相関が最も小さい方向組(以下相関最小組)の相関値:この相関値が小さいほどぶれの程度が大きい
解析手段20は、この点に着目して、図9(a)に示す曲線に基づいて第1のぶれ度K1を求める。なお、図9(a)に示す曲線に応じて作成されたLUT(ルックアップテーブル)は、記憶手段50に記憶されており、解析手段20は、相関最小組の相関値に対応する第1のぶれ度K1を、記憶手段50から読み出すようにして第1のぶれ度K1を求める。
1. Correlation value of the direction set with the smallest correlation (hereinafter referred to as the minimum correlation set): The smaller the correlation value, the greater the degree of blurring. The analysis means 20 pays attention to this point and based on the curve shown in FIG. First blur degree K1 is obtained. Note that the LUT (look-up table) created according to the curve shown in FIG. 9A is stored in the storage unit 50, and the analysis unit 20 uses 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 50.

2.相関最小組の2つの方向のうち、平均エッジ幅が大きい方向の平均エッジ幅:この平均エッジ幅が大きいほどぶれの程度が大きい
解析手段20は、この点に着目して、図9(b)に示す曲線に基づいて第2のぶれ度K2を求める。なお、図9(b)に示す曲線に応じて作成されたLUT(ルックアップテーブル)は、記憶手段50に記憶されており、解析手段20は、相関最小組の平均エッジ幅が大きい方向の平均エッジ幅に対応する第2のぶれ度K2を、記憶手段50から読み出すようにして第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 means 20 pays attention to this point, and FIG. A second blurring degree K2 is obtained based on the curve shown in FIG. Note that the LUT (look-up table) created according to the curve shown in FIG. 9B is stored in the storage unit 50, and the analysis unit 20 calculates the average in the direction where the average edge width of the smallest correlation set is large. The second blur degree K2 corresponding to the edge width is read from the storage means 50 to obtain the second blur degree K2.

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

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


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

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

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

Next, the analysis unit 20 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.

解析手段20は、ボケ画像である対象画像に対して求められたぶれ度K、ボケ幅Lをボケ度Nおよびボケ方向と共にボケ情報Qとしてパラメータ設定手段30に出力する。   The analysis unit 20 outputs the blur degree K and the blur width L obtained for the target image, which is a blur image, to the parameter setting unit 30 as blur information Q together with the blur degree N and the blur direction.

本実施形態の画像処理システムAは、アン・シャープネス・マスキング(USM)補正方法で画像Dに対する補正を施すものであり、パラメータ設定手段30は、ボケ幅Lとボケ方向に応じて、ボケ幅Lが大きいほど補正マスクのサイズが大きくなるように、ボケ方向に作用する方向性補正用の1次元補正マスクM1を設定すると共に、ボケ幅Lに応じて、ボケ幅Lが大きいほど補正マスクのサイズが大きくなるように等方性補正用の2次元補正マスクM2を設定する。なお、各ボケ幅に対応する2次元補正マスク、および各ボケ幅とボケ方向に対応する1次元補正マスクはデータベース(マスクデータベースという)として記憶手段50に記憶されており、パラメータ設定手段30は、記憶手段50に記憶されたマスクデータベースから、ボケ幅Lとボケ方向に基づいて1次元補正マスクM1を、ボケ幅Lに基づいて2次元補正マスクM2を取得する。   The image processing system A according to the present embodiment performs correction on the image D by an unsharpness masking (USM) correction method, and the parameter setting unit 30 performs the blur width L according to the blur width L and the blur direction. A one-dimensional correction mask M1 for directivity correction that acts in the blur direction is set such that the larger the blur width L is, the larger the blur width L is. Is set so as to increase the isotropic correction mask M2. 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 means 50 as a database (referred to as a mask database). From the mask database stored in the storage unit 50, 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.

次に、パラメータ設定手段30は、下記の式(2)に従って、方向性補正用の1次元補正パラメータW1および等方性補正用の2次元補正パラメータW2を設定する。   Next, the parameter setting unit 30 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 (2).


W1=N×K×M1
W2=N×(1−K)×M2 (2)
但し、W1:1次元補正パラメータ
W2:2次元補正パラメータ
N:ボケ度
K:ぶれ度
M1:1次元補正マスク
M2:2次元補正マスク
即ち、パラメータ設定手段30は、ボケ度Nが大きいほど等方性補正の強度と方向性補正の強度が強く、ぶれ度Kが大きいほど方向性補正の重みが大きくなるように補正パラメータW1とW2(合わせてパラメータE0とする)を設定する。

W1 = N × K × M1
W2 = N * (1-K) * M2 (2)
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 In other words, the parameter setting means 30 increases the isotropic correction strength and the directionality correction strength as the degree of blur N increases, and the directionality correction weight increases as the blur degree K increases. Are set correction parameters W1 and W2 (collectively, parameter E0).

ここで、パラメータ設定手段30は、設定されたパラメータE0に対して、さらにボケ度N、ぶれ度Kおよび補正マスクM1、M2を夫々調整して、調整されたボケ度N、ぶれ度K、補正マスクM1、M2を用いて式(2)に従って補正パラメータE0と異なる複数の補正パラメータE1、E2、・・・を求める。   Here, the parameter setting means 30 further adjusts the degree of blur N, the degree of blur K, and the correction masks M1, M2 with respect to the set parameter E0, and adjusts the degree of blur N, the degree of blur K, and the correction. A plurality of correction parameters E1, E2,... Different from the correction parameter E0 are obtained according to the equation (2) using the masks M1, M2.

パラメータ設定手段30は、こうして求められた補正パラメータE(E0、E1、E2、・・・)を補正手段40に出力する。   The parameter setting means 30 outputs the correction parameter E (E0, E1, E2,...) Thus obtained to the correction means 40.

補正手段40は、パラメータE0、E1、E2、・・・を画像Dに夫々適用して補正を施し、各補正パラメータに夫々対応する補正済み画像D’0、D’1、D’2、・・・を得る。   The correction means 40 performs correction by applying the parameters E0, E1, E2,... To the image D, respectively, and corrected images D′ 0, D′ 1, D′ 2,.・ ・ Get.

決定手段45は、補正手段40により得られた各々の補正済み画像を表示する図示しない表示手段と、表示された各々の補正済み画像からユーザ所望の補正済み画像を選択させるための図示しない入力手段とを備え、補正済み画像D’0、D’1、D’2、・・・からユーザにより選択された画像を目的画像D’として決定して出力手段60に出力する。   The determination unit 45 includes a display unit (not shown) that displays each corrected image obtained by the correction unit 40, and an input unit (not shown) that allows the user to select a corrected image desired by the user from the displayed corrected images. The image selected by the user from the corrected images D′ 0, D′ 1, D′ 2,... Is determined as the target image D ′ and output to the output means 60.

出力手段60は、解析手段20から画像Dが通常画像であることを示す情報Pを受信した場合には画像Dを出力する一方、決定手段45から目的画像D’を受信した場合には目的画像D’を出力するものである。本実施形態の画像処理システムAにおいて、出力手段60による「出力」は印刷であり、出力手段60は、通常画像の画像Dおよびボケ画像の画像Dを補正して得た目的画像D’を印刷してプリントを得るものであるが、記録媒体に記憶したり、ネットワーク上における画像保管サーバや、画像の補正を依頼した依頼者により指定されたネットワーク上のアドレスなどに送信したりするなどのものであってもよい。   The output unit 60 outputs the image D when the information P indicating that the image D is a normal image is received from the analysis unit 20, while the target image when the target image D ′ is received from the determination unit 45. D 'is output. In the image processing system A of the present embodiment, “output” by the output unit 60 is printing, and the output unit 60 prints a target image D ′ obtained by correcting the image D of the normal image and the image D of the blurred image. To obtain a print, but store it in a recording medium, send it 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.

図20は、本実施形態の画像処理システムAの動作を示すフローチャートである。図示のように、記録媒体1から読み出された画像Dは、まず、縮小手段10aにより1/8の縮小率で縮小されて縮小画像dとなる(S10)。顔抽出手段100は、縮小画像dに顔があるか否かを識別し(S11)、顔がある場合(S11:Yes)、縮小画像dから顔画像d0(複数ある場合は複数個)を抽出してエッジ検出手段12に出力する(S12)一方、顔がない場合(S11:No)には、縮小画像dをそのままエッジ検出手段12に出力する。エッジ検出手段12は、エッジの検出を行うのに当たり、まず、エッジを検出するための画像d2(顔抽出手段100から出力されてきた画像が1つである場合にはこの1つの画像、顔抽出手段100から複数の顔画像d0が出力されてきた場合には、複数の顔画像d0のうちの、画素数が最も多い顔画像d0)を選択すると共に、対象画像(画像d2が対応する、縮小されていない画像)の画素数に応じた縮小率で対象画像を縮小して縮小画像d3を得る。そして、エッジ検出手段12は、縮小画像d3を用いて、図4に示すような8方向毎に、所定の強度以上のエッジを検出し、これらのエッジの座標位置を得る。次にエッジ検出手段12は、検出された各方向毎の各々のエッジの座標位置に基づいて、縮小画像d3に対応する対象画像(縮小されていない画像)を用いてこれらのエッジに対して、図5に示すようなエッジプロファイルを作成してエッジ絞込手段14に出力する(S13)。エッジ絞込手段14は、エッジ検出手段12から送信されてきたエッジプロファイルに基づいて、無効なエッジを除去し、残りのエッジのプロファイルをエッジ特徴量取得手段16に出力する(S14)。エッジ特徴量取得手段16は、エッジ絞込手段14から送信された各々のエッジのプロファイルに基づいて各エッジの幅を求めると共に、図4に示す方向毎にエッジ幅のヒストグラムを作成して、各エッジの幅および各方向のエッジ幅のヒストグラムをエッジ特徴量Sとして解析手段20に出力する(S16)。解析手段20は、エッジ特徴量Sを用いて、まずボケ方向およびボケ度Nを算出すると共に、対象画像がボケ画像であるか通常画像であるかを判別する(S20、S25)。対象画像が通常画像であれば(S25:Yes)、解析手段20は、対象画像のオリジナル画像となる画像Dが通常画像であることを示す情報Pを出力手段60に出力し(S30)、出力手段60は、情報Pを受信すると、画像Dを印刷してプリントを得る(S35)。   FIG. 20 is a flowchart showing the operation of the image processing system A of the present embodiment. As shown in the figure, the image D read from the recording medium 1 is first reduced by the reduction means 10a at a reduction ratio of 1/8 to become a reduced image d (S10). The face extraction unit 100 identifies whether or not there is a face in the reduced image d (S11), and if there is a face (S11: Yes), extracts the face image d0 (a plurality if there are a plurality) from the reduced image d. On the other hand, when there is no face (S11: No), the reduced image d is output to the edge detection unit 12 as it is. When performing edge detection, the edge detection means 12 first detects an image d2 for detecting an edge (if there is one image output from the face extraction means 100, this one image, face extraction). When a plurality of face images d0 are output from the means 100, a face image d0 having the largest number of pixels among the plurality of face images d0 is selected and a reduction corresponding to the target image (image d2) is selected. The reduced image d3 is obtained by reducing the target image at a reduction rate corresponding to the number of pixels). Then, the edge detection unit 12 detects edges having a predetermined intensity or more in every eight directions as shown in FIG. 4 using the reduced image d3, and obtains coordinate positions of these edges. Next, the edge detection means 12 uses the target image (non-reduced image) corresponding to the reduced image d3 based on the detected coordinate position of each edge in each direction, An edge profile as shown in FIG. 5 is created and output to the edge narrowing means 14 (S13). The edge narrowing means 14 removes invalid edges based on the edge profile transmitted from the edge detection means 12 and outputs the remaining edge profiles to the edge feature quantity acquisition means 16 (S14). The edge feature quantity acquisition means 16 obtains the width of each edge based on the profile of each edge transmitted from the edge narrowing means 14 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 analyzing means 20 as the edge feature amount S (S16). The analysis unit 20 first calculates the blur direction and the blur degree N using the edge feature amount S, and determines whether the target image is a blur image or a normal image (S20, S25). If the target image is a normal image (S25: Yes), the analysis unit 20 outputs information P indicating that the image D that is the original image of the target image is a normal image to the output unit 60 (S30). Upon receiving the information P, the means 60 prints the image D to obtain a print (S35).

一方、ステップS25において、対象画像がボケ画像に判別されると(S25:No)、解析手段20は、対象画像に対してさらにぶれ度K、ボケ幅Lを算出し、ステップS20において求められたボケ度Nおよびボケ方向と共にボケ情報Qとしてパラメータ設定手段30に出力する(S40、S45)。パラメータ設定手段30は、解析手段20からのボケ情報Qに基づいて、1次元補正パラメータW1と2次元補正パラメータW2を求める。求められた1対の補正パラメータW1、W2を補正パラメータE0とし、ボケ度N、ぶれ度K、補正マスクM1、M2のマスクサイズなどを調整してさらに複数の補正パラメータE1、E2、・・・を取得して、補正手段40に出力する(S50)。   On the other hand, when the target image is determined to be a blurred image in step S25 (S25: No), the analysis unit 20 further calculates a blur degree K and a blur width L with respect to the target image, and is obtained in step S20. It outputs to the parameter setting means 30 as blur information Q with blur degree N and a blur direction (S40, S45). The parameter setting unit 30 obtains the one-dimensional correction parameter W1 and the two-dimensional correction parameter W2 based on the blur information Q from the analysis unit 20. The obtained pair of correction parameters W1 and W2 is set as a correction parameter E0, and a plurality of correction parameters E1, E2,... Are further adjusted by adjusting the degree of blur N, the blurring degree K, the mask size of the correction masks M1, M2, etc. Is output to the correction means 40 (S50).

補正手段40は、補正パラメータE0、E1、E2、・・・を画像Dに夫々適用して補正を施し、各補正パラメータに夫々対応する補正済み画像D’0、D’1、D’2、・・・を得る(S55)。   The correction means 40 applies correction parameters E0, E1, E2,... To the image D to perform correction, and corrects images D′ 0, D′ 1, D′ 2, respectively corresponding to the respective correction parameters. Is obtained (S55).

決定手段45は、補正手段40により得られた各々の補正済み画像を図示しない表示手段に表示させ、図示しない入力手段を介して、ユーザが選択された補正済み画像を目的画像D’として決定して出力手段60に出力する(S60)。   The determining unit 45 displays each corrected image obtained by the correcting unit 40 on a display unit (not shown), and determines the corrected image selected by the user as the target image D ′ via the input unit (not shown). To the output means 60 (S60).

出力手段60は、決定手段45からの目的画像D’を印刷してプリントを得る(S70)。   The output unit 60 obtains a print by printing the target image D ′ from the determination unit 45 (S70).

このように、本実施形態の画像処理システムAによれば、デジタル写真画像からボケ情報を取得してボケを補正するようにしているので、撮影時に特別な装置を必要とせずに画像のボケを補正することができる。   As described above, according to the image processing system A of the present embodiment, blur information is acquired from a digital photographic image and the blur is corrected. Therefore, it is possible to reduce the blur of an image without requiring a special device at the time of shooting. It can be corrected.

また、取得したボケ情報に基づいて補正用のパラメータを設定して補正しているので、パラメータの設定、補正、評価、再設定、・・・の試行錯誤を繰り返す必要がなく、効率が良い。   Further, since correction parameters are set and corrected based on the obtained blur information, it is not necessary to repeat trial and error of parameter setting, correction, evaluation, resetting,.

また、デジタル写真画像における主要被写体(ここでは例として顔)領域の画像のみを用いてボケ情報取得するようにしているので、ボケ情報を取得するための領域の指定をユーザに指定させることを必要としないため、便利である。   In addition, since the blur information is acquired using only the image of the main subject (here, the face) in the digital photograph image, it is necessary to allow the user to specify the area for acquiring the blur information. It is convenient because it does not.

さらに、主要被写体領域の画像を用いてボケ情報を取得してパラメータを設定するようにしているので、被写界深度の浅い画像の場合においても精度の良い補正を行うことができる。   Furthermore, since blur information is acquired using the image of the main subject area and parameters are set, accurate correction can be performed even in the case of an image with a shallow depth of field.

図21は、本発明の第2の実施形態となる画像処理システムBの構成を示すブロック図である。なお、本実施形態の画像処理システムBは、図1に示す実施形態の画像処理システムAと比べ、縮小手段10bと10aが異なる点および判別手段200が追加された点を除けば、他の構成が同様であるため、ここでは、縮小手段10bおよび追加された判別手段200についてのみ説明すると共に、図中において、図1に示す画像処理システムAと同様な構成については同じ符号を付与する。   FIG. 21 is a block diagram showing a configuration of an image processing system B according to the second embodiment of the present invention. The image processing system B according to the present embodiment is different from the image processing system A according to the embodiment shown in FIG. 1 except that the reduction means 10b and 10a are different and a determination means 200 is added. Therefore, only the reduction unit 10b and the added determination unit 200 will be described here, and the same reference numerals are given to the same configuration as the image processing system A shown in FIG.

図21に示す実施形態の画像処理システムにおける判別手段200は、画像Dの付属情報を読み取り、該付属情報に基づいて画像Dが被写界深度の浅い画像であるか否かの判断を行うものである。具体的には、判別手段200は、備えられた読取手段210により画像Dの付属情報を読み取って画像Dを撮像したカメラのレンズのF値を取得し、このF値が所定の閾値(ここで例として5.6)以下であれば、画像Dが被写界深度の浅い画像であると判別する一方、F値が前述の所定の閾値より大きければ、画像Dが被写界深度の浅い画像ではないと判別すると共に、判別の結果を示す情報を縮小手段10bに出力する。なお、画像Dに付属情報がない、または画像Dの付属情報にF値が含まれていない場合においては、判別手段200は、F値がないことを示す判別の結果を縮小手段10bに出力する。   The discriminating means 200 in the image processing system of the embodiment shown in FIG. 21 reads the attached information of the image D and determines whether the image D is an image with a shallow depth of field based on the attached information. It is. Specifically, the discriminating means 200 reads the attached information of the image D by the provided reading means 210 to acquire the F value of the lens of the camera that has captured the image D, and this F value is a predetermined threshold value (here. As an example, if 5.6) or less, it is determined that the image D is an image with a shallow depth of field, while if the F value is larger than the predetermined threshold, the image D is an image with a shallow depth of field. And information indicating the result of the determination is output to the reduction means 10b. If the image D has no attached information or the attached information of the image D does not include an F value, the determining unit 200 outputs a determination result indicating that there is no F value to the reducing unit 10b. .

縮小手段10bは、画像Dに対して例えば1/8の縮小率で縮小処理を行って縮小画像dを得ると共に、判別手段200の判別の結果に応じて縮小画像dを顔抽出手段100またはエッジ検出手段12に出力する。具体的には、判別手段200からの判別の結果が、画像Dが被写界深度の浅い画像であることを示す情報または画像DのF値がないことを示す情報であれば、該画像Dの縮小画像dを顔抽出手段100に出力する一方、判別の結果が、画像Dが被写界深度の浅い画像ではないことを示す情報であれば、該画像Dの縮小画像dをエッジ検出手段12に出力する。   The reduction unit 10b performs a reduction process on the image D at a reduction ratio of, for example, 1/8 to obtain a reduced image d, and the reduced image d is converted into the face extraction unit 100 or the edge according to the determination result of the determination unit 200. Output to the detection means 12. Specifically, if the determination result from the determination unit 200 is information indicating that the image D is an image having a shallow depth of field or information indicating that there is no F value of the image D, the image D If the result of determination is information indicating that the image D is not an image with a shallow depth of field, the reduced image d of the image D is detected as an edge detection unit. 12 is output.

図22と図23は、図21に示す実施形態の画像処理システムBの動作を示すフローチャートである。図22に示すように、記録媒体1から読み出された画像Dは、まず、判別手段200により被写界深度の浅い画像であるか否かの判別がされる(S100〜S115)。具体的には、判別手段200における読取手段210は、画像Dに付属情報が付属されているか否かを調べ、付属情報がある場合には更に画像Dを撮像したカメラのレンズのF値があるか否かを調べる(S102)。画像Dに付属情報が付属されてない、または画像Dの付属情報にF値が含まれていない場合(S102:No)には、判別手段200は、「F値なし」の判別結果を縮小手段10bに出力する(S115)。一方、ステップS102において、画像Dに付属情報が付属されており、この付属情報にF値が含まれている場合(S102:Yes)には、判別手段200は、読取手段210により得られたF値を前述の閾値と比較し(S104)、F値がこの閾値以下であれば(S104:No)、画像Dが被写界深度の浅い画像であると判別する(S106)一方、F値がこの閾値より大きければ(S104:Yes)、画像Dが被写界深度の浅い画像ではないと判別する(S108)と共に、判別の結果を示す情報を縮小手段10bに出力する(S115)。   22 and 23 are flowcharts showing the operation of the image processing system B of the embodiment shown in FIG. As shown in FIG. 22, the image D read from the recording medium 1 is first determined by the determination unit 200 as to whether the image has a shallow depth of field (S100 to S115). Specifically, the reading unit 210 in the determination unit 200 checks whether or not attached information is attached to the image D, and if there is attached information, there is an F value of the lens of the camera that captured the image D. Whether or not (S102). When the attached information is not attached to the image D, or when the F information is not included in the attached information of the image D (S102: No), the determination unit 200 reduces the determination result of “no F value”. 10b (S115). On the other hand, when the attached information is attached to the image D in step S102 and the attached information includes the F value (S102: Yes), the determining unit 200 uses the F obtained by the reading unit 210. The value is compared with the aforementioned threshold value (S104), and if the F value is less than or equal to this threshold value (S104: No), it is determined that the image D is an image with a shallow depth of field (S106), while the F value is If it is larger than this threshold (S104: Yes), it is determined that the image D is not an image with a shallow depth of field (S108), and information indicating the result of the determination is output to the reduction means 10b (S115).

縮小手段10bは、画像Dに対して縮小処理を行って縮小画像dを得ると共に、判別手段200による判別の結果に基づいて、画像Dが被写界深度の浅い画像である、または画像DのF値がない(S122:Yes)場合には、該画像Dの縮小画像dを顔抽出手段100に出力する一方、画像Dが被写界深度の浅い画像ではない(S122:No)場合には、該画像Dの縮小画像dをそのままエッジ検出手段12に出力する。顔抽出手段100は、縮小手段10bからの縮小画像dに対して、顔があるか否かを識別し(S124)、顔がある場合(S124:Yes)には、縮小画像dから顔画像d0(複数がある場合には複数とも)を抽出してエッジ検出手段12に出力する(S126)一方、顔がない場合(S124:No)には、縮小画像dをそのままエッジ検出手段12に出力する。ステップS126以後の処理は処理Aとして図23のフローチャートに示している。   The reduction unit 10b performs a reduction process on the image D to obtain a reduced image d, and the image D is an image with a shallow depth of field or the image D based on the determination result by the determination unit 200. When there is no F value (S122: Yes), the reduced image d of the image D is output to the face extraction means 100, while when the image D is not an image with a shallow depth of field (S122: No). The reduced image d of the image D is output to the edge detecting means 12 as it is. The face extraction unit 100 identifies whether or not there is a face with respect to the reduced image d from the reduction unit 10b (S124), and when there is a face (S124: Yes), the face image d0 from the reduced image d. (If there are a plurality of images), they are extracted and output to the edge detection means 12 (S126). On the other hand, if there is no face (S124: No), the reduced image d is output to the edge detection means 12 as it is. . The processing after step S126 is shown as processing A in the flowchart of FIG.

図23に示すように、エッジ検出手段12は、エッジの検出を行うのに当たり、まず、エッジを検出するための画像d2(顔抽出手段100から出力されてきた画像が1つである場合にはこの1つの画像、顔抽出手段100から複数の顔画像d0が出力されてきた場合には、複数の顔画像d0のうちの、画素数が最も多い顔画像d0)を選択すると共に、対象画像(画像d2が対応する、縮小されていない画像)の画素数に応じた縮小率で対象画像を縮小して縮小画像d3を得る。そして、エッジ検出手段12は、縮小画像d3を用いて、図4に示すような8方向毎に、所定の強度以上のエッジを検出し、これらのエッジの座標位置を得る。次にエッジ検出手段12は、検出された各方向毎の各々のエッジの座標位置に基づいて、縮小画像d3に対応する対象画像(縮小されていない画像)を用いてこれらのエッジに対して、図5に示すようなエッジプロファイルを作成してエッジ絞込手段14に出力する(S130)。エッジ絞込手段14は、エッジ検出手段12から送信されてきたエッジプロファイルに基づいて、無効なエッジを除去し、残りのエッジのプロファイルをエッジ特徴量取得手段16に出力する(S134)。エッジ特徴量取得手段16は、エッジ絞込手段14から送信された各々のエッジのプロファイルに基づいて各エッジの幅を求めると共に、図4に示す方向毎にエッジ幅のヒストグラムを作成して、各エッジの幅および各方向のエッジ幅のヒストグラムをエッジ特徴量Sとして解析手段20に出力する(S136)。解析手段20は、エッジ特徴量Sを用いて、まずボケ方向およびボケ度Nを算出すると共に、対象画像がボケ画像であるか通常画像であるかを判別する(S138、S140)。対象画像が通常画像であれば(S140:Yes)、解析手段20は、対象画像のオリジナル画像となる画像Dが通常画像であることを示す情報Pを出力手段60に出力し(S142)、出力手段60は、情報Pを受信すると、画像Dを印刷してプリントを得る(S146)。   As shown in FIG. 23, when performing edge detection, the edge detection unit 12 first detects an image d2 for detecting an edge (when there is only one image output from the face extraction unit 100). When a plurality of face images d0 are output from this one image / face extraction means 100, a face image d0 having the largest number of pixels among the plurality of face images d0) is selected and the target image ( The target image is reduced at a reduction rate corresponding to the number of pixels of the image d2 corresponding to the non-reduced image) to obtain a reduced image d3. Then, the edge detection unit 12 detects edges having a predetermined intensity or more in every eight directions as shown in FIG. 4 using the reduced image d3, and obtains coordinate positions of these edges. Next, the edge detection means 12 uses the target image (non-reduced image) corresponding to the reduced image d3 based on the detected coordinate position of each edge in each direction, An edge profile as shown in FIG. 5 is created and output to the edge narrowing means 14 (S130). The edge narrowing means 14 removes invalid edges based on the edge profile transmitted from the edge detection means 12, and outputs the remaining edge profiles to the edge feature quantity acquisition means 16 (S134). The edge feature quantity acquisition means 16 obtains the width of each edge based on the profile of each edge transmitted from the edge narrowing means 14 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 analyzing means 20 as the edge feature amount S (S136). The analysis unit 20 first calculates the blur direction and the blur degree N using the edge feature amount S, and determines whether the target image is a blur image or a normal image (S138, S140). If the target image is a normal image (S140: Yes), the analysis unit 20 outputs information P indicating that the image D that is the original image of the target image is a normal image to the output unit 60 (S142). Upon receipt of the information P, the means 60 prints the image D to obtain a print (S146).

一方、ステップS140において、対象画像がボケ画像に判別されると(S140:No)、解析手段20は、対象画像に対してさらにぶれ度K、ボケ幅Lを算出し、ステップS138において求められたボケ度Nおよびボケ方向と共にボケ情報Qとしてパラメータ設定手段30に出力する(S150、S155)。パラメータ設定手段30は、解析手段20からのボケ情報Qに基づいて、1次元補正パラメータW1と2次元補正パラメータW2を求める。求められた1対の補正パラメータW1、W2を補正パラメータE0とし、ボケ度N、ぶれ度K、補正マスクM1、M2のマスクサイズなどを調整してさらに複数の補正パラメータE1、E2、・・・を取得して、補正手段40に出力する(S160)。   On the other hand, when the target image is determined to be a blurred image in step S140 (S140: No), the analysis unit 20 further calculates a blur degree K and a blur width L with respect to the target image, and is obtained in step S138. It outputs to the parameter setting means 30 with the blur degree N and the blur direction as blur information Q (S150, S155). The parameter setting unit 30 obtains the one-dimensional correction parameter W1 and the two-dimensional correction parameter W2 based on the blur information Q from the analysis unit 20. The obtained pair of correction parameters W1 and W2 is set as a correction parameter E0, and a plurality of correction parameters E1, E2,... Are further adjusted by adjusting the degree of blur N, the blurring degree K, the mask size of the correction masks M1, M2, etc. Is output to the correction means 40 (S160).

補正手段40は、補正パラメータE0、E1、E2、・・・を画像Dに夫々適用して補正を施し、各補正パラメータに夫々対応する補正済み画像D’0、D’1、D’2、・・・を得る(S170)。   The correction means 40 applies correction parameters E0, E1, E2,... To the image D to perform correction, and corrects images D′ 0, D′ 1, D′ 2, respectively corresponding to the respective correction parameters. Are obtained (S170).

決定手段45は、補正手段40により得られた各々の補正済み画像を図示しない表示手段に表示させ、図示しない入力手段を介して、ユーザが選択された補正済み画像を目的画像D’として決定して出力手段60に出力する(S175)。   The determining unit 45 displays each corrected image obtained by the correcting unit 40 on a display unit (not shown), and determines the corrected image selected by the user as the target image D ′ via the input unit (not shown). To the output means 60 (S175).

出力手段60は、決定手段45からの目的画像D’を印刷してプリントを得る(S180)。   The output unit 60 obtains a print by printing the target image D ′ from the determination unit 45 (S180).

このように、本実施形態の画像処理システムBによれば、図1に示す実施形態の画像処理システムAと同様の効果を得ることができると共に、デジタル写真画像が被写界深度の浅い画像か否かを判別し、被写界深度の浅い画像ではないと判別されたデジタル写真画像に対してのみデジタル写真画像全体を用いて補正用のパラメータを設定して補正を行うようにし、それ以外のデジタル写真画像に対しては主要被写体領域の画像を用いて補正用のパラメータを設定して補正するようにしているので、被写界深度の浅い画像ではないデジタル写真画像の補正精度を高めることができる。   As described above, according to the image processing system B of the present embodiment, the same effect as the image processing system A of the embodiment shown in FIG. 1 can be obtained, and whether the digital photographic image has a shallow depth of field. If the image is not a shallow depth-of-field image, only the digital photo image is determined using the entire digital photo image to set the correction parameters and perform correction. Since digital photographic images are corrected by setting correction parameters using images of the main subject area, it is possible to improve the correction accuracy of digital photographic images that are not images with a shallow depth of field. it can.

図24は、本発明の第3の実施形態となる画像処理システムCの構成を示すブロック図である。図示のように、本実施形態の画像処理システムCは、記録媒体1から読み出された画像Dに対して縮小処理を行って画像Dの縮小画像dを得る縮小手段10cと、縮小画像dに対して主要被写体(ここでは例として顔)の検出を行うと共に、顔が検出されれば顔部分の画像(以下略して顔画像という)d0および顔部分以外の画像d1を夫々抽出して後述するエッジ検出手段12cに出力する一方、顔が検出されなければ縮小画像dをエッジ検出手段12cに出力する顔抽出手段100cと、顔抽出手段100cからの画像に基づいて得られた、エッジを検出するための縮小画像(その詳細については後述する)と、この縮小画像が対応する、縮小されていない画像(以下対象画像という)を用いて、エッジの検出を行うエッジ検出手段12cと、エッジ検出手段12cにより検出されたエッジのうちの、無効なエッジを除去するエッジ絞込手段14cと、エッジ絞込手段14cにより得られたエッジの特徴量(S0、S1、S’の3種類あるが、以下概して対象画像のエッジ特徴量Sという)を取得するエッジ特徴量取得手段16cと、エッジ特徴量Sを用いて、対象画像のボケ方向およびボケ度Nを算出して画像Dがボケ画像か通常画像かを判別し、通常画像の場合には、後述する出力手段60に画像Dが通常画像であることを示す情報Pを送信して処理を終了する一方、画像Dがボケ画像である場合には、さらに対象画像に対してぶれ度K、ボケ幅Lを算出して、ボケ度Nおよびボケ方向と共にボケ情報として後述するパラメータ設定手段30cおよび確信度算出手段250に送信する解析手段20cと、解析手段20cからのボケ情報に基づいてボケ画像となる画像Dを補正するためのパラメータを設定して後述するパラメータ統合手段260または補正手段40cに出力するパラメータ設定手段30cと、解析手段20cからのボケ情報に基づいて画像Dが被写界深度の浅い画像である確信度αを算出する確信度算出手段250と、パラメータ設定手段30cから出力されて来たパラメータを、確信度算出手段250により算出した確信度αに基づいて統合して統合パラメータを得て補正手段40cに出力するパラメータ統合手段260と、パラメータ設定手段30Cから出力して来たパラメータまたはパラメータ統合手段260から出力して来たパラメータを用いて画像Dに対して補正を行って補正済画像を得、該補正済み画像を目的画像D’として出力手段60に出力する補正手段40cと、解析手段20c、パラメータ設定手段30c、および確信度算出手段250のための種々のデータベースを記憶した記憶手段50cと、解析手段20cから画像Dが通常画像であることを示す情報Pを受信した場合には画像Dを出力する一方、補正手段40cから目的画像D’を受信した場合には目的画像D’を出力する出力手段60とを有してなる。   FIG. 24 is a block diagram showing a configuration of an image processing system C according to the third embodiment of the present invention. As shown in the figure, the image processing system C of this embodiment performs a reduction process on the image D read from the recording medium 1 to obtain a reduced image d of the image D, and a reduced image d. On the other hand, a main subject (here, a face as an example) is detected, and if a face is detected, an image d0 of a face part (hereinafter referred to as a face image) d0 and an image d1 other than the face part are extracted and described later. While outputting to the edge detection means 12c, if the face is not detected, the face extraction means 100c that outputs the reduced image d to the edge detection means 12c, and the edge obtained based on the image from the face extraction means 100c are detected. Edge detecting means 12 for detecting an edge using a reduced image (details will be described later) for this purpose and an unreduced image (hereinafter referred to as a target image) corresponding to the reduced image. Among the edges detected by the edge detection means 12c, the edge narrowing means 14c for removing invalid edges, and the edge feature values (S0, S1, S ′ 3) obtained by the edge narrowing means 14c. The image feature D is obtained by calculating the blur direction and the blur degree N of the target image using the edge feature value acquisition unit 16c that acquires the edge feature value S of the target image. It is determined whether the image is a blurred image or a normal image. If the image is a normal image, information P indicating that the image D is a normal image is transmitted to the output unit 60 described later, and the process ends. In this case, the blur degree K and the blur width L are further calculated with respect to the target image, and the parameter setting unit 30c and the certainty factor calculation unit 250 described later as blur information together with the blur degree N and the blur direction. An analyzing unit 20c for transmitting, and a parameter setting unit 30c for setting a parameter for correcting the image D to be a blurred image based on the blur information from the analyzing unit 20c and outputting the parameter to the parameter integrating unit 260 or the correcting unit 40c described later. And a certainty factor calculating unit 250 that calculates a certainty factor α based on the blur information from the analyzing unit 20c and an image D having a shallow depth of field, and a parameter output from the parameter setting unit 30c. Based on the certainty factor α calculated by the certainty factor calculation unit 250, the parameter integration unit 260 that obtains an integrated parameter and outputs it to the correction unit 40c, and the parameter output from the parameter setting unit 30C or the parameter integration unit 260 The image D is corrected using the parameters output from the above to obtain a corrected image A correction unit 40c that outputs the corrected image as the target image D ′ to the output unit 60; a storage unit 50c that stores various databases for the analysis unit 20c, the parameter setting unit 30c, and the certainty factor calculation unit 250; When the information P indicating that the image D is a normal image is received from the analyzing unit 20c, the image D is output. On the other hand, when the target image D ′ is received from the correcting unit 40c, the target image D ′ is output. Output means 60.

縮小手段10cは、図1に示す実施形態の画像処理システムAにおける縮小手段10aと同様のものであり、画像Dに対して例えば1/8の縮小率で縮小処理を行って縮小画像dを得るものである。   The reduction unit 10c is the same as the reduction unit 10a in the image processing system A of the embodiment shown in FIG. 1, and performs a reduction process on the image D at a reduction rate of, for example, 1/8 to obtain a reduced image d. Is.

顔抽出手段100cは、縮小画像dに顔があるか否かを識別し、顔がある場合には顔画像d0(複数ある場合には、複数とも)を抽出してエッジ検出手段12cに出力する一方、顔がない場合には縮小画像dをエッジ検出手段12cに出力することにおいては、図1に示す実施形態の画像処理システムAにおける顔抽出手段100と同様であるが、顔がある場合には、顔画像d0のみならず、顔以外の部分の画像d1も抽出してエッジ検出手段12cに出力する。なお、縮小画像dに顔があるか否かの識別およびある場合の顔画像の抽出については、画像処理システムAの顔抽出手段100と同様であるので、ここで説明を省略する。   The face extraction unit 100c identifies whether or not there is a face in the reduced image d. If there is a face, the face extraction unit 100c extracts the face image d0 (if there are a plurality of them) and outputs it to the edge detection unit 12c. On the other hand, when there is no face, outputting the reduced image d to the edge detection unit 12c is the same as the face extraction unit 100 in the image processing system A of the embodiment shown in FIG. Extracts not only the face image d0 but also the image d1 of the part other than the face and outputs it to the edge detecting means 12c. The identification of whether or not there is a face in the reduced image d and the extraction of the face image when there is a face are the same as those of the face extraction unit 100 of the image processing system A, and thus the description thereof is omitted here.

すなわち、エッジ検出手段12cに出力されてきた画像は、縮小画像dに顔が検出された場合には顔画像d0(1つのみの場合と複数の場合がある)および顔画像d0以外の縮小画像d1であり、縮小画像dに顔が検出されなかった場合には縮小画像dである。エッジ検出手段12cは、顔抽出手段100cから複数の顔画像d0が出力されてきた場合には(この場合、縮小画像d1も出力されている)この複数の顔画像d0のうち、画素数が最も多い顔画像d0を選択すると共に、選択されなかった他の顔画像d0を前述の縮小画像d1と合成して新たな縮小画像(以下説明上の便宜のため同じ符号d1を用いる)を得る。顔画像d0および縮小画像d1の両方(顔画像d0が1つのみの場合にはこの1つの顔画像d0と縮小画像d1、顔画像d0が複数ある場合には選択した顔画像d0と新たな縮小画像d1)、または縮小画像dに基づいて、それらに対応する、縮小されていない画像(顔画像D0および顔以外の画像D1、または画像D。以下対象画像という)の画素数に応じた縮小率で対象画像を縮小してエッジを検出するための縮小画像を得る。なお、縮小率の決定方法は、画像処理システムAにおけるエッジ検出手段12の縮小率決定手段13aと同じ方法を用いるので、ここで説明を省略する。エッジ検出手段12は、こうして得られた縮小画像を用いてエッジを抽出する処理、対象画像を用いてプロファイルを作成する処理を行うが、縮小画像dに顔が検出された場合において、エッジを検出するための画像が2つ(顔画像d0(D0)と顔以外の画像d1(D1))ある点を除けば、画像処理システムAにおけるエッジ検出手段12と同様に動作するので、ここで具体的な動作の説明を省略する。   That is, the image output to the edge detection unit 12c is a face image d0 (there may be only one or a plurality of cases) and a reduced image other than the face image d0 when a face is detected in the reduced image d. If the face is not detected in the reduced image d, it is the reduced image d. When a plurality of face images d0 are output from the face extraction unit 100c (in this case, the reduced image d1 is also output), the edge detection unit 12c has the largest number of pixels among the plurality of face images d0. A large number of face images d0 are selected, and another face image d0 that has not been selected is combined with the above-described reduced image d1 to obtain a new reduced image (hereinafter, the same reference numeral d1 is used for convenience of explanation). Both face image d0 and reduced image d1 (if there is only one face image d0, this one face image d0 and reduced image d1, and if there are a plurality of face images d0, the selected face image d0 and a new reduced image Based on the image d1) or the reduced image d, the reduction ratio corresponding to the number of pixels of the corresponding unreduced image (the face image D0 and the image D1 other than the face or the image D; hereinafter referred to as the target image) The target image is reduced to obtain a reduced image for detecting an edge. Note that since the reduction rate determination method uses the same method as the reduction rate determination unit 13a of the edge detection unit 12 in the image processing system A, description thereof is omitted here. The edge detection means 12 performs processing for extracting an edge using the reduced image thus obtained and processing for creating a profile using the target image. If a face is detected in the reduced image d, the edge detection unit 12 detects the edge. Except for the fact that there are two images (a face image d0 (D0) and a non-face image d1 (D1)) for the image processing system A. Description of the operation is omitted.

エッジ絞込手段14c、エッジ特徴量取得手段16c、解析手段20cについても同様である。   The same applies to the edge narrowing means 14c, the edge feature quantity acquisition means 16c, and the analysis means 20c.

こうして、縮小画像dに顔が検出された場合には顔画像D0と顔以外の部分の画像D1の夫々のエッジ特徴量S0、S1が取得されて解析手段20cに出力され、縮小画像dに顔が検出されなかった場合には、画像Dのエッジ特徴量S’が取得されて解析手段20cに出力される。   In this way, when a face is detected in the reduced image d, the edge feature amounts S0 and S1 of the face image D0 and the image D1 of the portion other than the face are acquired and output to the analysis unit 20c, and the face is added to the reduced image d. Is not detected, the edge feature amount S ′ of the image D is acquired and output to the analyzing means 20c.

解析手段20cは、エッジ特徴量S0とS1をエッジ特徴量取得手段16cから出力されると、まず、エッジ特徴量S0に基づいて、エッジ特徴量S0と対応する顔画像D0におけるボケ方向、ボケ度Nを算出する。求められた顔画像D0のボケ度Nが所定の閾値Tより小さければ、解析手段20cは、顔画像D0が対応する画像Dを通常画像として判別すると共に、画像Dが通常画像であることを示す情報Pを出力手段60に出力することをもって、処理を終了する。一方、顔画像D0のボケ度Nが閾値T以上であれば、解析手段20cは、顔画像D0が対応する画像Dがボケ画像であると判別し、顔画像D0に対してさらにぶれ度K、ボケ幅Lを算出して顔画像D0のボケ情報Q0とすると共に、顔以外の部分の画像D1のエッジ特徴量S1を用いて画像D1におけるボケ方向、ボケ度N、ぶれ度K、ボケ幅Lを算出して顔以外の部分の画像D1のボケ情報Q1とする。   When the edge feature amounts S0 and S1 are output from the edge feature amount acquisition unit 16c, the analysis unit 20c firstly, based on the edge feature amount S0, the blur direction and the degree of blur in the face image D0 corresponding to the edge feature amount S0. N is calculated. If the obtained blur degree N of the face image D0 is smaller than the predetermined threshold T, the analysis unit 20c determines that the image D corresponding to the face image D0 is a normal image and indicates that the image D is a normal image. By outputting the information P to the output means 60, the process is terminated. On the other hand, if the degree of blur N of the face image D0 is equal to or greater than the threshold T, the analysis unit 20c determines that the image D corresponding to the face image D0 is a blur image, and further increases the degree of blur K, The blur width L is calculated and used as blur information Q0 of the face image D0, and the blur direction, blur degree N, blur degree K, and blur width L in the image D1 using the edge feature amount S1 of the image D1 other than the face. Is calculated as blur information Q1 of the image D1 of the portion other than the face.

他方、解析手段20cは、エッジ特徴量S’が特徴量取得手段16cから出力されると、まず、エッジ特徴量S’に基づいて、画像Dにおけるボケ方向、ボケ度Nを算出する。求められた画像Dのボケ度Nが所定の閾値Tより小さければ、解析手段20cは、画像Dを通常画像として判別すると共に、画像Dが通常画像であることを示す情報Pを出力手段60に出力することをもって、処理を終了する。また、画像Dのボケ度Nが閾値T以上であれば、解析手段20cは、画像Dがボケ画像であると判別し、画像Dに対してさらにぶれ度K、ボケ幅Lを算出して画像Dのボケ情報Q’とする
解析手段20cは、このようにして顔画像D0のエッジ特徴量S0から算出したボケ情報Q0および顔以外の部分の画像D1のエッジ特徴量S1から算出したボケ情報Q1を確信度算出手段250とパラメータ設定手段30cに出力する一方、画像Dを用いて算出したボケ情報Q’をパラメータ設定手段30cにのみ出力する。
On the other hand, when the edge feature amount S ′ is output from the feature amount acquisition unit 16c, the analysis unit 20c first calculates a blur direction and a blur degree N in the image D based on the edge feature amount S ′. If the obtained blur degree N of the image D is smaller than the predetermined threshold T, the analysis unit 20c determines that the image D is a normal image, and also outputs information P indicating that the image D is a normal image to the output unit 60. The process is terminated with the output. If the degree of blur N of the image D is greater than or equal to the threshold T, the analysis unit 20c determines that the image D is a blur image, and further calculates a blur degree K and a blur width L with respect to the image D. The analysis means 20c, which uses the blur information Q ′ of D, the blur information Q1 calculated from the blur information Q0 calculated from the edge feature value S0 of the face image D0 and the edge feature value S1 of the image D1 of the portion other than the face in this way. Is output to the certainty calculation means 250 and the parameter setting means 30c, while the blur information Q ′ calculated using the image D is output only to the parameter setting means 30c.

本実施形態の画像処理システムCは、前述の画像処理システムAおよび画像処理システムBと同じように、アン・シャープネス・マスキング(USM)補正方法で画像Dに対する補正を施すものであり、パラメータ設定手段30cは、解析手段20cからのボケ情報(Q0およびQ1、またはQ’)に基づいて、画像処理システムAと画像処理システムBにおけるパラメータ設定手段30と同じように、記憶手段50cを参照して画像Dを補正するためのパラメータを設定する。なお、パラメータ設定手段30cは、解析手段20cからボケ情報Q0とQ1が出力されてきた場合には、2つのボケ情報Q0とQ1とを夫々用いてパラメータEc0とEc1とを夫々設定してパラメータ統合手段260に出力する一方、ボケ情報Q’のみが出力されてきた場合には、ボケ情報Q’を用いてパラメータEcを設定して直接補正手段40cに出力する。   The image processing system C according to the present embodiment corrects the image D by an unsharpness masking (USM) correction method, like the above-described image processing system A and image processing system B, and includes parameter setting means. 30c refers to the storage means 50c based on the blur information (Q0 and Q1, or Q ′) from the analysis means 20c, as with the parameter setting means 30 in the image processing system A and the image processing system B. A parameter for correcting D is set. When the blur information Q0 and Q1 is output from the analysis unit 20c, the parameter setting unit 30c sets the parameters Ec0 and Ec1 using the two blur information Q0 and Q1, respectively, and integrates the parameters. On the other hand, when only the blur information Q ′ has been output, the parameter Ec is set using the blur information Q ′ and directly output to the correction unit 40 c.

確信度算出手段250は、ボケ情報Q0とボケ情報Q1に基づいて、画像Dが被写界深度の浅い画像である確信度αを求める。なお、確信度算出手段250は、ボケ情報に含まれた全ての情報を用いて確信度αを算出するようにしてもよいが、ボケ情報の一部のみを用いて確信度αを算出するようにしてもよい。ここでは、例として、ボケ情報に含まれるボケ度Nのみを用いて確信度αを算出するようにする。具体的には、ボケ情報Q0に含まれるボケ度Nがボケ情報Q1に含まれるボケ度N以上である場合、およびボケ情報Q0に含まれるボケ度Nがボケ情報Q1に含まれるボケ度Nより小さいかつ2つのボケ度Nの差(すなわちボケ情報Q0に含まれるボケ度Nがボケ情報Q1に含まれるボケ度Nより小さい分、以下同じ)が所定の第1の閾値より小さい場合には確信度αを0%とし、2つのボケ度Nの差がこの第1の閾値より大きい所定の第2の閾値以上である場合には確信度αを100%とし、2つのボケ度Nの差が第1の閾値と第2の閾値との間にある場合には、この差が大きいほど確信度αが0%から100%の間で大きくなるように確信度αを算出する。なお、ボケ度の差と確信度αとの対応関係を示すテーブルは記憶手段50cに記憶されており、確信度算出手段250は、このテーブルを参照して確信度αを算出する。   The certainty factor calculation means 250 obtains a certainty factor α that the image D is an image with a shallow depth of field based on the blur information Q0 and the blur information Q1. The certainty factor calculating unit 250 may calculate the certainty factor α using all the information included in the blur information, but may calculate the certainty factor α using only a part of the blur information. It may be. Here, as an example, the certainty factor α is calculated using only the blur degree N included in the blur information. Specifically, the blur degree N included in the blur information Q0 is equal to or greater than the blur degree N included in the blur information Q1, and the blur degree N included in the blur information Q0 is greater than the blur degree N included in the blur information Q1. Certainly, if the difference between the two blur degrees N (that is, the blur degree N included in the blur information Q0 is smaller than the blur degree N included in the blur information Q1, and so on) is smaller than the predetermined first threshold value. When the degree α is 0% and the difference between the two blur degrees N is equal to or greater than a predetermined second threshold value that is greater than the first threshold value, the certainty factor α is 100% and the difference between the two blur degrees N is When it is between the first threshold value and the second threshold value, the certainty factor α is calculated such that the greater the difference, the greater the certainty factor α is between 0% and 100%. Note that a table indicating the correspondence between the difference in blur degree and the certainty factor α is stored in the storage unit 50c, and the certainty factor calculating unit 250 calculates the certainty factor α with reference to this table.

パラメータ統合手段260は、パラメータ設定手段30cにより設定されたパラメータEc0とEc1、および確信度算出手段250により算出した確信度αを用いて下記の式(3)に従って統合パラメータE’cを算出して補正手段40cに出力する。   The parameter integration unit 260 calculates the integrated parameter E′c according to the following equation (3) using the parameters Ec0 and Ec1 set by the parameter setting unit 30c and the certainty factor α calculated by the certainty factor calculation unit 250. It outputs to the correction means 40c.


E’c=α×Ec0+(1−α)×Ec1 (3)
但し、E’c: 統合パラメータ
Ec0: 顔部分の画像d0を用いて設定したパラメータ
Ec1: 顔以外の部分の画像d1を用いて設定したパラメータ
α: 画像Dが被写界深度の浅い画像である確信度

式(3)から分かるように、パラメータ統合手段260は、画像Dが被写界深度の浅い画像である確信度αが高いほど、顔部分の画像D0を用いて設定したパラメータEc0の重みが大きくなるようにパラメータEc0とパラメータEc1とを重付合算して統合パラメータE’cを取得するものである。

E′c = α × Ec0 + (1−α) × Ec1 (3)
E'c: Integration parameter
Ec0: parameter set using the face image d0
Ec1: Parameters set using the image d1 of the part other than the face
α: Certainty that image D is an image with a shallow depth of field

As can be seen from Equation (3), the parameter integration unit 260 increases the weight of the parameter Ec0 set using the face portion image D0 as the certainty factor α in which the image D is an image with a shallow depth of field is higher. In this way, the parameter Ec0 and the parameter Ec1 are weighted and added to obtain the integrated parameter E′c.

補正手段40cは、パラメータ設定手段30cから出力されてきた、画像D全体を用いて設定したパラメータEc、またはパラメータ統合手段260から出力されてきた統合パラメータE’cを用いて画像Dに適用して補正を施し、補正済み画像D’を得る。   The correcting unit 40c applies the parameter Ec output from the parameter setting unit 30c using the entire image D or the integrated parameter E′c output from the parameter integrating unit 260 to be applied to the image D. Correction is performed to obtain a corrected image D ′.

出力手段60は、画像システムAおよび画像システムBにおける出力手段60と同じであるので、ここでその説明を省略する。   Since the output unit 60 is the same as the output unit 60 in the image system A and the image system B, description thereof is omitted here.

図25と図26は、図24に示す画像処理システムCの動作を示すフローチャートである。図25に示すように、本実施形態の画像処理システムCにおいて、記録媒体1から読み出された画像Dは、まず、縮小手段10cにより縮小処理が施されて縮小画像dとなる(S200)。顔抽出手段100cは、縮小手段10cにより得られた縮小画像dに対して、顔があるか否かを識別し(S202)、顔がある場合(S202:Yes)には、縮小画像dから顔画像d0を抽出すると共に顔以外の部分の画像d1も抽出してエッジ検出手段12cに出力する一方、顔がない場合には(S202:No)、縮小画像dをそのままエッジ検出手段12cに出力する。   25 and 26 are flowcharts showing the operation of the image processing system C shown in FIG. As shown in FIG. 25, in the image processing system C of the present embodiment, the image D read from the recording medium 1 is first subjected to reduction processing by the reduction means 10c to become a reduced image d (S200). The face extraction unit 100c identifies whether or not there is a face with respect to the reduced image d obtained by the reduction unit 10c (S202), and when there is a face (S202: Yes), While extracting the image d0 and extracting the image d1 of the part other than the face and outputting it to the edge detecting means 12c, if there is no face (S202: No), the reduced image d is outputted as it is to the edge detecting means 12c. .

図26に示す処理Bは、エッジ検出手段12c、エッジ絞込手段14c、エッジ特徴量取得手段16cによる処理(S210〜S214)および解析手段20cの一部の処理(S216)からなる。図26に示すように、処理Bは、エッジ検出手段12cによるエッジの検出から始まり、エッジ検出手段12cは、まず、顔抽出手段100cから出力されてきた縮小画像に基づいて作成した新たな縮小画像を用いて、図4に示すような8方向毎に、所定の強度以上のエッジを検出し、これらのエッジの座標位置を得る。次にエッジ検出手段12cは、検出された各方向毎の各々のエッジの座標位置に基づいて、前述した新たな縮小画像に対応する対象画像(縮小されていない画像)を用いてこれらのエッジに対して、図5に示すようなエッジプロファイルを作成してエッジ絞込手段14cに出力する(S210)。エッジ絞込手段14cは、エッジ検出手段12cから送信されてきたエッジプロファイルに基づいて、無効なエッジを除去し、残りのエッジのプロファイルをエッジ特徴量取得手段16cに出力する(S212)。エッジ特徴量取得手段16cは、エッジ絞込手段14cから送信された各々のエッジのプロファイルに基づいて各エッジの幅を求めると共に、図4に示す方向毎にエッジ幅のヒストグラムを作成して、各エッジの幅および各方向のエッジ幅のヒストグラムをエッジ特徴量として解析手段20cに出力する(S214)。解析手段20cは、エッジ特徴量を用いて、まず、対象画像のボケ方向およびボケ度Nを算出する(S216)。   Processing B shown in FIG. 26 includes processing by the edge detection unit 12c, edge narrowing unit 14c, edge feature amount acquisition unit 16c (S210 to S214) and partial processing of the analysis unit 20c (S216). As shown in FIG. 26, the process B starts from edge detection by the edge detection unit 12c, and the edge detection unit 12c first creates a new reduced image created based on the reduced image output from the face extraction unit 100c. Are used to detect edges having a predetermined intensity or more in every eight directions as shown in FIG. 4 and obtain the coordinate positions of these edges. Next, the edge detection unit 12c uses the target image (unreduced image) corresponding to the above-described new reduced image based on the detected coordinate position of each edge in each direction to detect these edges. On the other hand, an edge profile as shown in FIG. 5 is created and output to the edge narrowing means 14c (S210). The edge narrowing means 14c removes invalid edges based on the edge profile transmitted from the edge detection means 12c, and outputs the remaining edge profiles to the edge feature quantity acquisition means 16c (S212). The edge feature quantity acquisition means 16c obtains the width of each edge based on the profile of each edge transmitted from the edge narrowing means 14c, and creates an edge width histogram for each direction shown in FIG. The histogram of the edge width and the edge width in each direction is output to the analyzing means 20c as an edge feature amount (S214). The analysis unit 20c first calculates the blur direction and the blur degree N of the target image using the edge feature amount (S216).

ここで、顔抽出手段100cから顔画像d0および顔以外の部分の画像d1が出力された場合には(図25のフローチャートにおけるS202:Yes、S204)、処理Bの対象画像が顔画像D0と顔以外の部分の画像D1の2つであり、エッジ特徴量取得手段16cにより夫々のエッジ特徴量S0、S1が算出され、解析手段20cにより夫々のボケ方向、ボケ度Nが算出される。また、顔抽出手段100cから縮小画像dが出力された場合には(図25のフローチャートにおけるS202:No)、処理Bの対象画像が画像Dのみであり、エッジ特徴量取得手段16cにより画像Dのエッジ特徴量S’が算出され、解析手段20cにより画像Dのボケ方向、ボケ度Nが算出される。   Here, when the face image d0 and the image d1 of the part other than the face are output from the face extraction unit 100c (S202: Yes, S204 in the flowchart of FIG. 25), the target image of the process B is the face image D0 and the face The edge feature amount acquisition unit 16c calculates the respective edge feature amounts S0 and S1, and the analysis unit 20c calculates the respective blur direction and blur degree N. When the reduced image d is output from the face extraction unit 100c (S202: No in the flowchart of FIG. 25), the target image of the process B is only the image D, and the edge feature amount acquisition unit 16c The edge feature amount S ′ is calculated, and the blur direction and the blur degree N of the image D are calculated by the analysis unit 20c.

図25のフローチャートに戻り、解析手段20cは、処理BのステップS216において顔画像D0および顔以外の画像D1の夫々のボケ方向、ボケ度Nを算出すると、顔画像D0のボケ度Nに基づいて画像Dがボケ画像か通常画像かの判別を行い(S220)、
通常画像として判別した場合(S220:Yes)には、画像Dが通常画像であることを示す情報Pを出力手段60に出力する(S222)ことをもって処理を終了する一方、ボケ画像として判別した場合には(S220:No)、さらに顔画像D0および顔以外の部分の画像D1に対してぶれ度K、ボケ幅Lを算出して(S230)、夫々のボケ方向、ボケ度N、ぶれ度K、ボケ幅Lを合わせて得た夫々のボケ情報Q0、Q1を確信度算出手段250とパラメータ設定手段30cに出力する(S232)。パラメータ設定手段30cは、2つのボケ情報Q0、Q1を用いて夫々に対応するパラメータEc0、Ec1を設定してパラメータ統合手段260に出力し(S234)、これに並行して、確信度算出手段250は、ボケ情報Q0とQ1を用いて画像Dが被写界深度の浅い画像である確信度αを算出してパラメータ統合手段260に出力する(S236)。パラメータ統合手段260は、確信度αを用いてパラメータEc0とEc1を統合し、統合パラメータE’cを補正手段40cに出力する(S238)。
Returning to the flowchart of FIG. 25, when the analysis unit 20c calculates the blur direction and the blur degree N of the face image D0 and the non-face image D1 in step S216 of the process B, based on the blur degree N of the face image D0. It is determined whether the image D is a blurred image or a normal image (S220),
When it is determined as a normal image (S220: Yes), the process is terminated by outputting information P indicating that the image D is a normal image to the output means 60 (S222), while it is determined as a blurred image. (S220: No), the degree of blur K and the blur width L are further calculated for the face image D0 and the image D1 of the part other than the face (S230), and each blur direction, blur degree N, blur degree K is calculated. The blur information Q0, Q1 obtained by combining the blur width L is output to the certainty factor calculation means 250 and the parameter setting means 30c (S232). The parameter setting means 30c sets the corresponding parameters Ec0 and Ec1 using the two blur information Q0 and Q1, respectively, and outputs them to the parameter integration means 260 (S234). In parallel with this, the certainty factor calculation means 250 is set. Uses the blur information Q0 and Q1 to calculate the certainty factor α that the image D is an image with a shallow depth of field, and outputs it to the parameter integration unit 260 (S236). The parameter integration unit 260 integrates the parameters Ec0 and Ec1 using the certainty factor α, and outputs the integrated parameter E′c to the correction unit 40c (S238).

一方、解析手段20cは、処理BのステップS216において画像D(この場合、顔抽出手段100cにおいて顔が検出されていない)のボケ方向、ボケ度Nを算出すると、画像Dのボケ度Nに基づいて画像Dがボケ画像か通常画像かの判別を行い(S240)、通常画像として判別した場合(S240:Yes)には、画像Dが通常画像であることを示す情報Pを出力手段60に出力する(S222)ことをもって処理を終了する一方、ボケ画像として判別した場合には(S240:No)、さらに画像Dに対してぶれ度K、ボケ幅Lを算出して(S242)、ボケ方向、ボケ度Nと合わせてボケ情報Q’としてパラメータ設定手段30cに出力する(S244)。パラメータ設定手段30cは、画像Dのボケ情報Q’を用いてパラメータEcを設定して補正手段40cに出力する(S246)。   On the other hand, when the analysis unit 20c calculates the blur direction and the blur degree N of the image D (in this case, no face is detected by the face extraction unit 100c) in step S216 of the process B, the analysis unit 20c is based on the blur degree N of the image D. Whether the image D is a blurred image or a normal image is determined (S240), and when it is determined as a normal image (S240: Yes), information P indicating that the image D is a normal image is output to the output means 60. In step S222, the process ends. On the other hand, if it is determined as a blurred image (S240: No), a blur degree K and a blur width L are calculated for the image D (S242), and the blur direction, Together with the degree of blur N, it is output to the parameter setting means 30c as blur information Q '(S244). The parameter setting means 30c sets the parameter Ec using the blur information Q 'of the image D and outputs it to the correction means 40c (S246).

補正手段40cは、パラメータ統合手段260から出力されて来た統合パラメータE’c、またはパラメータ設定手段30cから出力されて来たパラメータE’cを画像Dに適用して補正を行い、補正済み画像を目的画像D’として出力手段60に出力する(S250)。   The correction unit 40c performs correction by applying the integrated parameter E′c output from the parameter integration unit 260 or the parameter E′c output from the parameter setting unit 30c to the image D, thereby correcting the corrected image. Is output to the output means 60 as the target image D ′ (S250).

出力手段60は、解析手段20cから情報Pを受信する(S222)と、画像Dを印刷してプリントを得る(S224)と共に、補正手段40cから目的画像D’を受信すると、目的画像D’を印刷してプリントを得る(S260)。   When receiving the information P from the analyzing unit 20c (S222), the output unit 60 prints the image D to obtain a print (S224), and receives the target image D ′ from the correcting unit 40c. Printing is performed to obtain a print (S260).

このように、本実施形態の画像処理システムCによれば、画像Dが被写界深度の浅い画像である確信度αを算出し、この確信度αが高いほど、主要被写体領域の画像(ここでは顔画像d0)を用いて設定したパラメータEc0の重みが高くなるように、パラメータEc0と、顔以外の領域の画像D1を用いて設定したパラメータEc1とを重み付け合算して得たパラメータを用いて補正を行うようにしているので、前述した実施形態の画像処理システムAおよび画像処理システムBと同様の効果を得ることができると共に、被写界深度に対する判別に多少のずれがあっても、良い補正効果を得ることができる。   As described above, according to the image processing system C of the present embodiment, the certainty factor α is calculated in which the image D is an image with a shallow depth of field, and the higher the certainty factor α, the more the image of the main subject region (here Then, the parameter Ec0 and the parameter Ec1 set using the image D1 of the region other than the face are weighted and added so that the weight of the parameter Ec0 set using the face image d0) is increased. Since correction is performed, the same effects as those of the image processing system A and the image processing system B according to the above-described embodiment can be obtained, and the determination with respect to the depth of field may be slightly different. A correction effect can be obtained.

なお、本実施形態の画像処理システムCにおいては、主要被写体領域の画像を用いて設定したパラメータを、主要被写体領域以外の領域の画像を用いて設定したパラメータと重み付け合算するようにしているが、主要被写体領域以外の領域の画像の代わりにデジタル写真画像全体(画像処理システムCにおいては縮小画像d全体)を用いて設定したパラメータと重み付け合算するようにしてもよい。   In the image processing system C of the present embodiment, the parameter set using the image of the main subject area is weighted and summed with the parameter set using the image of the area other than the main subject area. Instead of the image of the area other than the main subject area, the entire digital photograph image (the entire reduced image d in the image processing system C) may be weighted and added.

なお、画像処理システムBにおいて、画像Dの付属情報に基づいて画像Dが被写界深度の浅い画像である否かの判別を行っているが、主要被写体領域の画像のボケ情報と、主要被写体領域以外の領域の画像のボケ情報とを比較することによってこの判別を行うようにしてもよい。同様に、画像処理システムCにおいて、画像Dの付属情報に基づいて画像Dが被写界深度の浅い画像である確信度を算出するようにしてもよい。   In the image processing system B, whether or not the image D is an image with a shallow depth of field is determined based on the auxiliary information of the image D. However, the blur information of the image in the main subject area and the main subject This determination may be performed by comparing blur information of an image in a region other than the region. Similarly, in the image processing system C, the certainty factor that the image D is an image with a shallow depth of field may be calculated based on the additional information of the image D.

デジタル写真画像が被写界深度の浅い画像であるか否かの判別、またはデジタル写真画像が被写界深度の浅い画像である確信度の算出については、画像処理システムBとCにおいて用いられた方法に限らず、デジタル写真画像を複数のブロックに分割し、各ブロックの画像のボケ情報を比較することによって行うようにしてもよい。図27は、この方法を用いた実施形態の画像処理システムDの構成を示している。なお、図27に示す画像処理システムDは、例としてデジタル写真画像を複数のブロックに分割し、各ブロックの画像のボケ情報を比較することによってデジタル写真画像が被写界深度の浅い画像であるか否かの判別を行って画像処理を施すものであるが、各ブロックの画像のボケ情報を比較することによってデジタル写真画像が被写界深度の浅い画像である確信度を算出して画像処理を行ってもよい。   The image processing systems B and C used to determine whether or not a digital photographic image is an image with a shallow depth of field or to calculate a certainty factor that a digital photographic image is an image with a shallow depth of field. Not limited to the method, the digital photographic image may be divided into a plurality of blocks, and the blur information of the images of the respective blocks may be compared. FIG. 27 shows a configuration of an image processing system D according to the embodiment using this method. In the image processing system D shown in FIG. 27, for example, a digital photographic image is divided into a plurality of blocks, and the digital photographic image is an image with a shallow depth of field by comparing the blur information of the image of each block. Image processing is performed by determining whether or not a digital photo image is an image with a shallow depth of field by comparing the blur information of the image of each block. May be performed.

図27に示す実施形態の画像処理システムDは、図21に示す実施形態の画像処理システムBと比べ、画像Dが被写界深度の浅い画像であるか否かの判別を行う処理が異なる点を除けば、他の処理が略同様であるため、ここでは、画像処理システムDにおける、画像Dが被写界深度の浅い画像であるか否かの判別を行う処理についてのみその詳細を説明する。   The image processing system D of the embodiment shown in FIG. 27 is different from the image processing system B of the embodiment shown in FIG. 21 in the processing for determining whether or not the image D is an image with a shallow depth of field. Since the other processes are substantially the same except for, only the process for determining whether the image D is an image with a shallow depth of field in the image processing system D will be described in detail here. .

図27には、画像Dが被写界深度の浅い画像であるか否かの判別を行う処理を点線により示している。図示のように、まず、縮小手段10dにより得られた画像Dの縮小画像dが判別手段200dにも出力される。判別手段200dは、縮小画像dを複数のブロックに分割するブロック分割手段210dを備えている。ここで、例として、縮小手段10dは、画像Dを200画素×150画素の縮小画像dに縮小するものであり、判別手段200dに備えられたブロック分割手段210dは、縮小画像dを20画素×15画素の計100個のブロックに分割するものであるとする。判別手段200dは、ブロック分割手段210dにより得られた100個のブロックの画像をエッジ検出手段12dに出力する。エッジ検出手段12dは、まずこれらのブロックの画像(縮小されている画像)に対して、図4に示すような8方向毎に、所定の強度以上のエッジを検出し、これらのエッジの座標位置を得る。次にエッジ検出手段12dは、検出された各方向毎の各々のエッジの座標位置に基づいて、画像Dにおいて、各ブロックの部分に夫々対応する部分の画像を用いてこれらのエッジに対して、図5に示すようなエッジプロファイルを作成してエッジ絞込手段14dに出力する。エッジ検出手段12dにより作成された各々のエッジプロファイルは、エッジ絞込手段14d、エッジ特徴量取得手段16d、解析手段20dの順に夫々の処理が施されて、最後に解析手段20dから、各々のブロックの画像のボケ情報が判別手段200dに出力される。ここで、解析手段20dにより各ブロックの画像のボケ情報を算出して判別手段200dに出力する際に、ボケ方向、ボケ度N、ぶれ度K、ボケ幅L全部を算出して出力するようにしてもよいが、ここでは、演算量を減らし、処理を早くするために、画像Dが被写界深度の浅いであるか否かを判別するためのボケ情報として、各ブロックの画像のボケ度Nのみを算出して判別手段200dに出力するとする。     In FIG. 27, processing for determining whether or not the image D is an image having a shallow depth of field is indicated by a dotted line. As shown in the figure, first, a reduced image d of the image D obtained by the reduction means 10d is also output to the determination means 200d. The determination unit 200d includes a block dividing unit 210d that divides the reduced image d into a plurality of blocks. Here, as an example, the reduction unit 10d reduces the image D to a reduced image d of 200 pixels × 150 pixels, and the block dividing unit 210d provided in the determination unit 200d converts the reduced image d into 20 pixels × 150 pixels. It is assumed that the data is divided into a total of 100 blocks of 15 pixels. The discriminating means 200d outputs the 100 block images obtained by the block dividing means 210d to the edge detecting means 12d. The edge detection unit 12d first detects edges having a predetermined intensity or more in each of the eight directions as shown in FIG. 4 with respect to the image (reduced image) of these blocks, and the coordinate positions of these edges. Get. Next, the edge detection unit 12d uses the image of the part corresponding to each block part in the image D on the basis of the detected coordinate position of each edge in each direction. An edge profile as shown in FIG. 5 is created and output to the edge narrowing means 14d. Each edge profile created by the edge detection means 12d is processed in the order of the edge narrowing means 14d, the edge feature quantity acquisition means 16d, and the analysis means 20d, and finally, each block from the analysis means 20d. The blur information of the image is output to the determination unit 200d. Here, when the blur information of the image of each block is calculated by the analysis unit 20d and output to the determination unit 200d, the blur direction, the blur degree N, the blur degree K, and the blur width L are all calculated and output. However, here, in order to reduce the amount of calculation and speed up the processing, the degree of blur of the image of each block is used as blur information for determining whether or not the image D has a shallow depth of field. Assume that only N is calculated and output to the discriminating means 200d.

判別手段200dは、各ブロックの画像のボケ情報(ここではボケ度Nのみ)を比較して、画像Dが被写界深度の浅い画像であるか否かの判別を行う。具体的には、下記の手法で判別を行う。   The determination unit 200d compares the blur information (here, only the blur degree N) of the image of each block, and determines whether the image D is an image with a shallow depth of field. Specifically, the determination is performed by the following method.

1.ボケ度Nの差が所定の閾値(閾値t1)以内のブロックを同じグループにするようにして各ブロックをグループ化する
2.1において得られたグループが1つしかなければ、画像Dが被写界深度の浅い画像ではないと判別する。グループが2以上あれば、相隣するブロックが4つ以上含まれたグループのみを抽出して、下記3の処理に進む。
1. Group blocks so that blocks with a difference in blur N within a predetermined threshold value (threshold value t1) are in the same group. If there is only one group obtained in 2.1, image D is captured It is determined that the image is not a shallow depth of field. If there are two or more groups, only a group including four or more adjacent blocks is extracted, and the process proceeds to the following process 3.

3.2において抽出されたグループが1つ以下であれば、画像Dが被写界深度の浅い画像ではないと判別する。3において抽出されたグループが2つ以上であれば、これらのブロック毎の平均ボケ度N’0を夫々算出して処理5に進む。   If the number of groups extracted in 3.2 is one or less, it is determined that the image D is not an image with a shallow depth of field. If there are two or more groups extracted in 3, the average degree of blur N ′ 0 for each block is calculated, and the process proceeds to processing 5.

5.3において抽出された2つ以上のグループから平均ボケ度N’0が最も小さいグループ(そのボケ度をN’minとする)を除いた他のグループの全てのブロックの平均ボケ度N’1を算出してN’minと比較し、N’1とN’minとの差の絶対値が所定の閾値(閾値t2とする)以下であれば、画像Dが被写界深度の浅い画像ではないと判別する一方、N’1とN’minとの差の絶対値が閾値t2より大きければ、画像Dが被写界深度の浅い画像であると判別する。   The average blur degree N ′ of all blocks of other groups excluding the group having the smallest average blur degree N′0 (the blur degree is N′min) from the two or more groups extracted in 5.3 1 is compared with N′min, and if the absolute value of the difference between N′1 and N′min is equal to or smaller than a predetermined threshold (threshold t2), the image D has a shallow depth of field. On the other hand, if the absolute value of the difference between N′1 and N′min is larger than the threshold value t2, it is determined that the image D is an image with a shallow depth of field.

判別手段200dは、こうして画像Dが被写界深度の浅い画像であるか否かの判別を行い、判別の結果を縮小手段10dに出力する。   The discriminating means 200d thus discriminates whether or not the image D is an image having a shallow depth of field, and outputs the discrimination result to the reducing means 10d.

縮小手段10dが判別手段200dから判別の結果を受信した後の処理は、前述した画像処理システムBにおいて、縮小手段10bが判別手段200から判別の結果を受信した後の処理と同様であるので、ここで詳細な説明を省略する。   The processing after the reduction unit 10d receives the determination result from the determination unit 200d is the same as the processing after the reduction unit 10b receives the determination result from the determination unit 200 in the image processing system B described above. Detailed description is omitted here.

このように、本実施形態の画像処理システムDは、画像システムBと異なる判別方法で画像Dが被写界深度の浅い画像であるか否かの判別を行い、画像システムBと同様な効果を得ることができると共に、画像Dに付属情報がない、または画像Dの付属情報にF値が含まれていない場合においても判別を行うことができる。   As described above, the image processing system D according to the present embodiment determines whether the image D is an image with a shallow depth of field by a different determination method from the image system B, and has the same effect as the image system B. In addition, it is possible to make a determination even when there is no attached information in the image D or when the F information is not included in the attached information of the image D.

以上、本発明の望ましい実施形態について説明したが、本発明の画像処理方法および装置並びにそのためのプログラムは、上述した実施形態に限られることがなく、本発明の主旨を逸脱しない限り、上述した各実施形態の構成を組み合わせたり、増減、変化を加えたりすることができる。   The preferred embodiments of the present invention have been described above. However, the image processing method and apparatus of the present invention and the program therefor are not limited to the above-described embodiments, and each of the above-described embodiments is not departed from the gist of the present invention. The configuration of the embodiment can be combined, increased, decreased, or changed.

例えば、写真画像に顔が含まれているか否かの識別および顔画像の抽出については、上述した実施形態に用いられた方法に限られることがなく、従来公知の種々の技術を利用することができる。   For example, identification of whether or not a face is included in a photographic image and extraction of a face image are not limited to the methods used in the above-described embodiments, and various conventionally known techniques can be used. it can.

また、図1に示す実施形態の画像処理システムAおよび画像処理システムBにおいては、パラメータ設定手段30は複数の補正パラメータを設定し、補正手段40は、これらの複数の補正パラメータを用いて補正を施して複数の補正済み画像を得、決定手段45は、ユーザが複数の補正済み画像から選択した補正済み画像を目的画像として決定するようにしているが、補正制御手段と確認手段とを設け、パラメータ設定手段においてまず1つのみの補正パラメータを設定し、補正手段も一度には1つの補正済み画像のみを得、確認手段は、補正済み画像をユーザに確認させ、補正制御手段は、ユーザによる確認の結果が該補正済み画像を目的画像とすることになるまでパラメータ設定手段による補正パラメータを設定し直す処理と、補正手段による、設定し直された補正パラメータを用いて補正を行って補正済み画像を得る処理、確認手段による確認を繰り返させるようにして目的画像を決定するようにしてもよい。またはパラメータの設定、補正の実行、確認の繰り返しをせずに、1つのみの補正済み画像をユーザに確認させ、ユーザに気に入らない場合には補正済み画像と対応する補正前の元の画像を目的画像として決定するようにしてもよい。   Further, in the image processing system A and the image processing system B of the embodiment shown in FIG. 1, the parameter setting unit 30 sets a plurality of correction parameters, and the correction unit 40 performs correction using the plurality of correction parameters. To obtain a plurality of corrected images, the determining means 45 determines the corrected image selected by the user from the plurality of corrected images as a target image, provided with a correction control means and a confirmation means, First, only one correction parameter is set in the parameter setting means, the correction means also obtains only one corrected image at a time, the confirmation means allows the user to confirm the corrected image, and the correction control means is determined by the user. Processing for resetting correction parameters by the parameter setting means until the result of confirmation is that the corrected image is the target image; According, the process for obtaining a corrected image by performing the correction using the correction parameter re-set, may be determined a target image so as to repeat the confirmation by confirming means. Alternatively, the user can confirm only one corrected image without repeatedly setting parameters, performing correction, and checking, and if the user does not like the original image before correction corresponding to the corrected image. You may make it determine as a target image.

また、上述の実施形態の画像処理システムは、相関最小組の2つの方向のうち、平均エッジ幅が大きい方向をボケ方向としているが、例えば、相関最小組(相関値が1番目に小さい方向組)と、相関値が2番目に小さい方向組について、夫々ぶれ度を算出し、方向組の2つの方向のうち、平均エッジ幅が大きい方向をボケ方向とするようにして2つの方向組からボケ候補方向を夫々取得し、取得された2つのボケ候補方向を、算出された2つのぶれ度に応じて、ぶれ度が大きい方向組ほど、該方向組に含まれるボケ候補方向の重みが大きくなるように重み付けしてボケ方向を得るようにしてもよい。この場合、ボケ幅も、2つのボケ候補方向における夫々の平均エッジ幅を、ぶれ度が大きい方向組ほど、該方向組に含まれるボケ候補方向の平均エッジ幅の重みが大きくなるように重み付けしてボケ幅を得ることができる。   In the image processing system of the above-described embodiment, the direction with the larger average edge width is set as the blur direction among the two directions of the minimum correlation set. For example, the minimum correlation set (the direction set with the smallest correlation value) is used. ) And the direction set with the second smallest correlation value, the degree of blurring is calculated for each direction set, and the direction with the larger average edge width of the two directions in the direction set is set as the blurred direction. Candidate directions are acquired, and the obtained blur candidate directions are weighted according to the two calculated blur degrees, the greater the blur group, the greater the weight of the blur candidate directions included in the direction group. The blur direction may be obtained by weighting as described above. In this case, the blur width is also weighted so that the average edge width in each of the two blur candidate directions has a greater weight for the blur candidate direction included in the direction set in a direction set with a higher degree of blurring. The bokeh width can be obtained.

また、上述の実施形態の画像処理システムは、画像中のボケの有無に関わらず相関最小組の2つの方向のうち、平均エッジ幅が大きい方向をボケ方向にし、該ボケ方向に基づいてさらにボケ度を算出して、ボケ度に基づいて通常画像とボケ画像の判別を行い、ボケ画像として判別された画像に対してさらにぶれ度を求めるようにして補正パラメータの設定を行うようにしているが、例えば、相関最小組の相関値が所定の閾値T1以上であれば、該画像におけるボケが「無方向」とし(即ち、画像が通常画像かピンボケ画像である)、ボケ方向が「無方向」である画像に対して、ボケ度を求め、ボケ度が所定の閾値T2より小さい画像を通常画像として判別して補正しないようにする一方、ボケ度が所定の閾値T2以上の画像をピンボケ画像として判別して等方性補正用のパラメータのみを求めて補正を行うと共に、相関最小組の相関値がT1より小さい画像をぶれ画像として、相関最小組の平均エッジ幅の大きい方向をぶれ幅とするようにしてもよい。また、ぶれ画像に対して補正パラメータを設定する際に、ぶれ方向に作用する方向性補正パラメータのみを補正パラメータとして設定するようにしてもよいし、ぶれ度をさらに求め、ぶれ度に応じて等方性補正パラメータと方向性補正パラメータとを重み付け合算するようにして補正パラメータを設定するようにしてもよい。   In the image processing system of the above-described embodiment, the direction with the largest average edge width is set as the blur direction among the two directions of the minimum correlation set regardless of the presence / absence of blur in the image, and further blur is performed based on the blur direction. While calculating the degree, the normal image and the blurred image are discriminated based on the degree of blur, and the correction parameter is set so as to further obtain the degree of blur for the image discriminated as the blur image. For example, if the correlation value of the minimum correlation set is equal to or greater than the predetermined threshold T1, the blur in the image is “no direction” (that is, the image is a normal image or a defocused image), and the blur direction is “no direction”. For the image, the degree of blur is obtained and an image with the degree of blur smaller than the predetermined threshold T2 is determined as a normal image so as not to be corrected. And determining only the parameters for isotropic correction to perform correction, and using the image with the correlation value of the minimum correlation set smaller than T1 as the blur image, the direction with the larger average edge width of the minimum correlation set is defined as the blur width. You may make it do. In addition, when setting the correction parameter for the blurred image, only the directionality correction parameter acting in the blur direction may be set as the correction parameter, or the degree of blur is further obtained, according to the degree of blur, etc. The correction parameter may be set by weighting and adding the directionality correction parameter and the directionality correction parameter.

また、上述の本実施形態の画像処理システムは、処理の効率を良くするために、デジタル写真画像が通常画像かボケ画像かを判別し、ボケ画像として判別された画像に対してのみぶれ度、ぶれ幅を算出してパラメータの設定や、補正を行うようにしているが、通常画像とボケ画像の判別をせず、全ての処理対象の画像に対して、ボケ度、ボケ幅、ぶれ度をボケ情報として算出し、ボケ情報に基づいてパラメータを設定して補正を行うようにしてもよい。通常画像のボケ度が小さいため、ボケ度に応じて設定された通常画像の補正パラメータは微小な補正を行う補正パラメータまたは補正しないパラメータとなり、ピンボケ画像のぶれ度が小さいため、ぶれ度に応じて等方性補正パラメータと方向性パラメータとを重み付け合算して補正パラメータを得る際に、方向性補正パラメータの重みが小さい乃至ゼロとなる。   In addition, the image processing system of the present embodiment described above determines whether a digital photo image is a normal image or a blurred image in order to improve processing efficiency, and the degree of blurring only with respect to an image determined as a blurred image, The blur width is calculated and the parameters are set and corrected, but the normal image and the blurred image are not distinguished, and the blur degree, blur width, and blur degree are set for all the processing target images. The correction may be performed by calculating as blur information and setting a parameter based on the blur information. Since the normal image has a low degree of blurring, the normal image correction parameters set according to the degree of blurring are correction parameters that perform fine correction or parameters that are not corrected, and the blurring degree of the out-of-focus image is small. When the isotropic correction parameter and the directionality parameter are weighted and summed to obtain a correction parameter, the weight of the directionality correction parameter is small or zero.

また、上述した実施形態において、解析手段20、20c、20dは、図9に基づいて、前述した3つの要素に基づいてぶれ度を求めるようにしているが、ぶれ度を求める要素については増減があってもよい。例えば、前述した3つの要素のうちの2つのみを用いてもよく、要素を増やして、例えば相関最小組と、相関最小組と最も大きくずれた(図4に示す方向組の場合、45度ずれた)方向組との相関値の差も視野に入れてぶれ度を求めるようにしてもよい。   Further, in the above-described embodiment, the analysis means 20, 20c, and 20d obtain the degree of shake based on the above-described three elements based on FIG. There may be. For example, only two of the three elements described above may be used, and the number of elements is increased, for example, the largest correlation between the minimum correlation set and the minimum correlation set (in the case of the direction set shown in FIG. 4, 45 degrees). The degree of blur may be obtained by taking into account the difference in the correlation value with the misaligned direction set.

また、上述の実施形態において、解析手段20、20c、20dは、ボケ画像となる画像Dに対して、そのボケがピンボケかぶれかの区別をせず、ボケ画像として判別された画像であれば、ぶれ度を求めてぶれ度に応じた重み付け係数(本実施形態の画像処理システムにおいては、ぶれ度そのものを重み付け係数にしている)で当方性補正パラメータと方向性補正パラメータを重み付け合算して補正パラメータを得て補正するようにしているが、例えば、ぶれ度が所定の閾値より小さいボケ画像をピンボケ画像とし、ピンボケ画像に対しては等方性補正パラメータのみを設定して補正を行うようにしてもよい。   Further, in the above-described embodiment, the analysis units 20, 20c, and 20d do not distinguish whether the blur is out of focus with respect to the image D that is a blur image, and if the image is determined as a blur image, The correction parameter is obtained by calculating the blur degree and weighting and adding the isotropic correction parameter and the directionality correction parameter with a weighting coefficient corresponding to the blur degree (in the image processing system of the present embodiment, the blur degree itself is used as the weighting coefficient). For example, a blur image with a degree of blur smaller than a predetermined threshold is set as a blur image, and only the isotropic correction parameter is set for the blur image to perform correction. Also good.

また、上述の実施形態の画像処理システムは、処理対象となるデジタル写真画像がボケ画像か通常画像かが知られていないことを前提にして、全てのデジタル写真画像に対して通常画像かボケ画像かの判別を行うようにしているが、ボケ画像のみを対象とする処理系、例えば顧客または操作者によりボケ画像に指定された画像を補正するような処理系などにおいては、通常画像とボケ画像の判別を行うことが必ずしも必要ではない。   In addition, the image processing system of the above-described embodiment assumes that it is not known whether the digital photographic image to be processed is a blurred image or a normal image. However, in a processing system that targets only a blurred image, for example, a processing system that corrects an image designated as a blurred image by a customer or an operator, a normal image and a blurred image are used. It is not always necessary to make this determination.

また、上述の実施形態の画像処理システムは、画像の縮小から目的画像を出力するまでの処理を1つの装置において行っているが、本発明は、このような態様に限られることがなく、例えば、画像処理システムを解析装置と処理装置とに分け、解析装置は、補正パラメータを設定するまでの処理を行うと共に、設定された補正パラメータを画像の付属情報として画像に付属させて記録媒体に記録し、処理装置は、記録媒体から画像を読み出して、画像の付属情報となる補正パラメータを用いて補正を行うようにしてもよい。   In the image processing system of the above-described embodiment, processing from image reduction to output of a target image is performed in one apparatus. However, the present invention is not limited to such an aspect. The image processing system is divided into an analysis device and a processing device, and the analysis device performs processing up to the setting of the correction parameter and records the set correction parameter on the recording medium as an attached information of the image. Then, the processing apparatus may read out the image from the recording medium and perform correction using the correction parameter that is the information attached to the image.

さらに、このような態様において、解析装置は、ボケ情報を求めるまでの処理のみをし、このボケ情報を画像の付属情報として画像に付属させて記録媒体に記録し、処理装置は、記録媒体から画像を読み出して、画像の付属情報となるボケ情報に基づいて補正パラメータを設定して補正を行うようにしてもよい。   Further, in such an aspect, the analysis apparatus performs only the processing until obtaining the blur information, attaches the blur information to the image as the auxiliary information of the image, and records the blur information on the recording medium. The image may be read out, and correction may be performed by setting a correction parameter based on blur information that is attached information of the image.

さらに、補正実行指示手段を設け、ボケ情報の取得までまたは補正パラメータの設定までの処理を行うが、補正実行指示手段から補正を実行するように指示されるまで補正を実行せず、補正を実行するように指示されてから補正を実行するようにしてもよい。   Furthermore, a correction execution instruction unit is provided to perform processing up to the acquisition of blur information or the setting of the correction parameter, but the correction is not executed until the correction execution instruction unit instructs to execute the correction. Correction may be executed after an instruction to do so.

また、上述の実施形態の画像処理システムは、携帯カメラにより取得されたデジタル写真画像を対象としているが、本発明の画像処理方法および装置並びにそのためのプログラムは、携帯カメラにより取得されたデジタル写真画像に限らず、如何なるデジタル写真画像、例えば通常のデジタルカメラにより取得されたデジタル写真画像や、スキャナなどの読取装置で写真フィルムまたは紙などの印刷媒体に印刷された写真画像を読み取って得たデジタル写真画像にも適用することができる。   In addition, the image processing system of the above-described embodiment is intended for a digital photographic image acquired by a portable camera. However, the image processing method and apparatus of the present invention and the program therefor are digital photographic images acquired by a portable camera. The digital photograph obtained by reading any digital photograph image, for example, a digital photograph image obtained by a normal digital camera, or a photograph image printed on a printing medium such as photographic film or paper by a reading device such as a scanner. It can also be applied to images.

また、上述の実施形態の画像処理システムにおいて、画像から複数の顔領域が検出された場合、エッジ検出手段は、これらの複数の顔領域の画像から、最も画素数の多い画像を選択してエッジの検出に供するが、最も中央部分に位置する顔領域の画像を選択するようにしてもよい。さらに、検出された複数の顔領域の画像のうち、ユーザにより指示された画像を選択するようにしてもよく、この場合、検出された複数の顔領域の画像を候補画像として例えばモニタなどの表示装置に表示し、表示された複数の候補画像に対してユーザによりマウスなどの入力手段で指定された候補画像を選択するようにしてもよいし、顔検出の前または後にユーザに所望の位置をポインティングさせ、検出された複数の顔領域の画像のうち、ユーザによりポインティングされた位置に最も近い顔領域の画像を選択するようにしてもよい。   In addition, in the image processing system according to the above-described embodiment, when a plurality of face regions are detected from the image, the edge detection unit selects an image having the largest number of pixels from the images of the plurality of face regions and performs edge processing. However, it is also possible to select an image of the face region located at the most central portion. Furthermore, an image instructed by the user may be selected from a plurality of detected face area images. In this case, the detected plurality of face area images are displayed as candidate images, for example, on a monitor or the like. A candidate image specified by an input means such as a mouse may be selected by the user for a plurality of displayed candidate images displayed on the apparatus, or a desired position may be set to the user before or after face detection. You may make it select the image of the face area nearest to the position pointed by the user among the several face area images detected by pointing.

勿論、複数の顔領域の画像から1つのみを選択するのではなく、複数の顔領域全て、または全部ではないが1つ以上の領域の画像を選択するようにしてもよい。   Of course, instead of selecting only one image from a plurality of face area images, it is also possible to select all or not all of the plurality of face areas, but one or more area images.

1 記録媒体
10a,10b,10c,10d 縮小手段
12,12c,12d エッジ検出手段
14,14c,14d エッジ絞込手段
16,16c,16d エッジ特徴量取得手段
20,20c,20d 解析手段
30,30c,30d パラメータ設定手段
40,40c,40d 補正手段
45 決定手段
50,50c 記憶手段
60 出力手段
100,100c,100d 顔抽出手段
200,200d 判別手段
210 読取手段
210d ブロック分割手段
C0 顔を識別するための特徴量
D デジタル写真画像
D’ 目的画像
H0 参照データ
E 補正パラメータ
K ぶれ度
L ボケ幅
M1 1次元補正マスク
M2 2次元補正マスク
N ボケ度
Q ボケ情報
S エッジ特徴量
α 確信度
β 縮小率
1 Recording medium 10a, 10b, 10c, 10d Reduction means 12, 12c, 12d Edge detection means 14, 14c, 14d Edge narrowing means 16, 16c, 16d Edge feature quantity acquisition means 20, 20c, 20d Analysis means 30, 30c, 30d Parameter setting means 40, 40c, 40d Correction means 45 Determination means 50, 50c Storage means 60 Output means 100, 100c, 100d Face extraction means 200, 200d Discriminating means 210 Reading means 210d Block dividing means C0 Features for identifying a face Amount D Digital photograph image D 'Target image H0 Reference data E Correction parameter K Blur degree L Blur width M1 One-dimensional correction mask M2 Two-dimensional correction mask N Blur degree Q Blur information S Edge feature amount α Certainty factor β Reduction rate

Claims (20)

デジタル写真画像におけるボケを補正する画像処理方法において、
前記デジタル写真画像から主要被写体領域を抽出し、
該主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定して第1のパラメータとすると共に、前記デジタル写真画像全体または前記主要被写体領域以外の領域の画像を用いて前記ボケを補正するためのパラメータを設定して第2のパラメータとし、
前記デジタル写真画像が被写界深度の浅い画像である確信度を求め、
前記確信度が高いほど前記第1のパラメータの重みが大きくなるように前記第1のパラメータと前記第2のパラメータとを重付合算して前記ボケを補正するためのパラメータを取得し、
該パラメータを用いて前記デジタル写真画像に対して補正を行うことを特徴とする画像処理方法。
In an image processing method for correcting blur in a digital photographic image,
Extracting the main subject area from the digital photographic image,
A parameter for correcting the blur using the image of the main subject area is set as a first parameter, and the blur is reduced using the entire digital photograph image or an image of an area other than the main subject area. Set the parameter for correction as the second parameter,
Determining the certainty that the digital photographic image is an image with a shallow depth of field;
Obtaining a parameter for correcting the blur by weighting and adding the first parameter and the second parameter so that the weight of the first parameter increases as the certainty factor increases.
An image processing method, wherein the digital photographic image is corrected using the parameter.
前記デジタル写真画像に、該デジタル写真画像を撮像した撮像装置のレンズのF値を含む付属情報が付属されており、
前記付属情報を読み取って前記F値を取得し、
該F値に基づいて前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことを特徴とする請求項1記載の画像処理方法。
Attached information including the F value of the lens of the imaging device that captured the digital photograph image is attached to the digital photograph image,
Read the attached information to obtain the F value,
The image processing method according to claim 1, wherein a process of determining whether the digital photographic image is an image having a shallow depth of field or determining the certainty factor is performed based on the F value.
前記デジタル写真画像から抽出した主要被写体領域の画像および前記主要被写体領域以外の領域の画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を夫々施して夫々の前記ボケ情報を得、
前記主要被写体領域の画像から取得された前記ボケ情報および前記主要被写体領域以外の領域の画像から取得された前記ボケ情報とを比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことを特徴とする請求項1記載の画像処理方法。
For the image of the main subject region extracted from the digital photographic image and the image of the region other than the main subject region, an edge is detected for each of a plurality of different directions, and the feature amount of the edge in each of the directions is acquired, Each of the blur information acquisition processing for acquiring blur information based on the edge feature amount is performed to obtain the blur information.
By comparing the blur information acquired from the image of the main subject area and the blur information acquired from the image of the area other than the main subject area, the digital photographic image is an image having a shallow depth of field. The image processing method according to claim 1, further comprising: determining whether or not or determining the certainty factor.
前記デジタル写真画像を複数のブロックに分け、
各前記ブロックの画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を夫々施して夫々の前記ボケ情報を得、
各々の前記ブロックの画像から取得された前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことを特徴とする請求項1記載の画像処理方法。
Dividing the digital photographic image into a plurality of blocks;
A blur information acquisition process for detecting an edge in each of a plurality of different directions for each image of the block, acquiring a feature amount of the edge in each of the directions, and acquiring blur information based on the edge feature amount. Apply each to get the blur information of each,
By comparing the blur information acquired from the images of the respective blocks, it is possible to determine whether or not the digital photographic image is an image with a shallow depth of field or to obtain the certainty factor. The image processing method according to claim 1.
前記ボケを補正するためのパラメータを設定する際に用いられる画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を施し、
前記ボケ情報に基づいて前記パラメータを設定することを特徴とする請求項1から4のいずれか1項記載の画像処理方法。
An edge is detected for each of a plurality of different directions with respect to an image used when setting a parameter for correcting the blur, and the feature amount of the edge in each of the directions is acquired, and based on the edge feature amount Bokeh information acquisition processing to obtain the blur information
The image processing method according to claim 1, wherein the parameter is set based on the blur information.
デジタル写真画像におけるボケを補正する画像処理装置であって、
前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出手段と、
前記デジタル写真画像が被写界深度の浅い画像である確信度を求める確信度算出手段と、
前記主要被写体抽出手段により抽出された前記主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定する第1のパラメータ設定手段と、
前記デジタル写真画像全体または前記主要被写体領域以外の領域の画像を用いて前記ボケを補正するためのパラメータを設定する第2のパラメータ設定手段と、
前記確信度算出手段により得られた前記確信度が高いほど前記第1のパラメータ設定手段により設定された前記パラメータの重みが大きくなるように前記第1のパラメータにより設定されたパラメータと前記第2のパラメータ設定手段により設定されたパラメータとを重付合算して統合パラメータを取得する統合パラメータ取得手段と、
該統合パラメータ取得手段により取得された前記統合パラメータを用いて前記デジタル写真画像に対して補正を行う補正手段とを有してなることを特徴とする画像処理装置。
An image processing apparatus for correcting blur in a digital photographic image,
Main subject extraction means for extracting a main subject region from the digital photographic image;
A certainty factor calculating means for determining a certainty factor that the digital photographic image is an image having a shallow depth of field;
First parameter setting means for setting a parameter for correcting the blur using the image of the main subject area extracted by the main subject extracting means;
Second parameter setting means for setting a parameter for correcting the blur using the entire digital photographic image or an image of an area other than the main subject area;
The parameter set by the first parameter and the second parameter are set such that the higher the certainty factor obtained by the certainty factor calculating unit, the greater the weight of the parameter set by the first parameter setting unit. Integrated parameter acquisition means for acquiring an integrated parameter by adding together the parameters set by the parameter setting means;
An image processing apparatus comprising: a correcting unit that corrects the digital photographic image using the integrated parameter acquired by the integrated parameter acquiring unit.
前記デジタル写真画像を撮像した撮像装置のレンズのF値を含む付属情報が付属された前記デジタル写真画像の前記付属情報を読み取って前記F値を取得する付属情報読取手段を備え、
前記判別手段または前記確信度算出手段が、前記F値に基づいて前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うものであることを特徴とする請求項6記載の画像処理装置。
Attached information reading means for acquiring the F value by reading the attached information of the digital photographic image to which attached information including the F value of the lens of the imaging device that captured the digital photographic image is attached,
The discriminating means or the certainty factor calculating means performs processing for discriminating whether or not the digital photographic image is an image having a shallow depth of field based on the F value or obtaining the certainty factor. The image processing apparatus according to claim 6.
対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得手段を備え、
前記判別手段または前記確信度算出手段が、前記ボケ情報取得手段により前記主要被写体領域の画像および前記主要被写体領域以外の領域の画像を夫々前記対象画像にして取得された夫々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うものであることを特徴とする請求項6記載の画像処理装置。
For a target image, it comprises an edge information for each of a plurality of different directions, obtains the feature quantity of the edge in each of the directions, and comprises blur information acquisition means for acquiring blur information based on the edge feature quantity,
The determination unit or the certainty factor calculation unit compares the blur information acquired by the blur information acquisition unit using the image of the main subject region and the image of the region other than the main subject region, respectively, as the target image. The image processing apparatus according to claim 6, wherein the image processing apparatus determines whether the digital photographic image is an image having a shallow depth of field or obtains the certainty factor.
前記デジタル写真画像を複数のブロックに分けるブロック分け手段と、
対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得手段とを備え、
前記判別手段または前記確信度算出手段が、前記ボケ情報取得手段により各前記ブロックの画像を夫々前記対象画像にして取得された各々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うものであることを特徴とする請求項6記載の画像処理装置。
Block dividing means for dividing the digital photographic image into a plurality of blocks;
A blur information acquisition unit that detects an edge for each of a plurality of different directions with respect to the target image, acquires a feature amount of the edge in each of the directions, and acquires blur information based on the edge feature amount;
The determination unit or the certainty factor calculation unit compares the blur information acquired by using the image of each block as the target image by the blur information acquisition unit, so that the digital photographic image is captured. The image processing apparatus according to claim 6, wherein the image processing apparatus determines whether or not the image has a shallow depth of field or obtains the certainty factor.
前記主要被写体抽出手段が、
前記デジタル写真画像から主要被写体領域の候補を抽出する主要被写体候補抽出手段と、
該主要被写体候補抽出手段により抽出された複数の前記主要被写体候補から前記主要被写体の領域を選択する主要被写体選択手段とからなることを特徴とする請求項6から9のいずれか1項記載の画像処理装置。
The main subject extraction means is
Main subject candidate extraction means for extracting main subject region candidates from the digital photographic image;
The image according to any one of claims 6 to 9, further comprising main subject selection means for selecting a region of the main subject from the plurality of main subject candidates extracted by the main subject candidate extraction means. Processing equipment.
前記主要被写体選択手段が、複数の前記主要被写体候補から、サイズが最も大きい主要被写体候補を前記主要被写体として選択するものであることを特徴とする請求項10記載の画像処理装置。   The image processing apparatus according to claim 10, wherein the main subject selection unit is configured to select a main subject candidate having the largest size from the plurality of main subject candidates as the main subject. 前記主要被写体選択手段が、複数の前記主要被写体候補から、最も中央部分に近い主要被写体候補を前記主要被写体として選択するものであることを特徴とする請求項10記載の画像処理装置。   The image processing apparatus according to claim 10, wherein the main subject selecting unit is configured to select a main subject candidate closest to a central portion from the plurality of main subject candidates as the main subject. 前記主要被写体選択手段が、複数の前記主要被写体候補のうち、ユーザにより指示された主要被写体候補を前記主要被写体として選択するものであることを特徴とする請求項10記載の画像処理装置。   The image processing apparatus according to claim 10, wherein the main subject selection unit selects a main subject candidate instructed by a user from the plurality of main subject candidates as the main subject. 前記パラメータ設定手段により用いられる画像に対して縮小処理を施して縮小画像を得る縮小手段を備え、
前記パラメータ設定手段が、前記縮小画像を用いて前記パラメータを設定するものであり、
前記縮小手段が、前記パラメータ設定手段により用いられる前記主要被写体領域の画像のサイズに応じて、該サイズが大きいほど該画像に対する縮小強度を強めるようにして前記縮小処理を施すものであることを特徴とする請求項6から13のいずれか1項記載の画像処理装置。
A reduction unit that obtains a reduced image by performing a reduction process on the image used by the parameter setting unit;
The parameter setting means sets the parameter using the reduced image;
In accordance with the size of the image of the main subject area used by the parameter setting unit, the reduction unit performs the reduction process so that the larger the size is, the higher the reduction strength for the image is. The image processing apparatus according to any one of claims 6 to 13.
前記パラメータ設定手段が、前記ボケを補正するためのパラメータを設定するために用いられる画像に対して、該画像における複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得手段を備え、
前記ボケ情報基づいて前記パラメータを設定するものであることを特徴とする請求項6から14のいずれか1項記載の画像処理装置。
The parameter setting means detects an edge for each of a plurality of different directions in the image for an image used for setting a parameter for correcting the blur, and calculates a feature amount of the edge in each of the directions. A blur information acquisition means for acquiring and acquiring blur information based on the edge feature amount;
The image processing apparatus according to claim 6, wherein the parameter is set based on the blur information.
デジタル写真画像におけるボケを補正する画像処理をコンピュータに実行させるプログラムであって、
前記デジタル写真画像から主要被写体領域を抽出する主要被写体抽出処理と、
前記デジタル写真画像が被写界深度の浅い画像である確信度を求める確信度算出処理と、
前記主要被写体抽出処理により抽出された前記主要被写体領域の画像を用いて前記ボケを補正するためのパラメータを設定する第1のパラメータ設定処理と、
前記デジタル写真画像全体または前記主要被写体領域以外の領域の画像を用いて前記ボケを補正するためのパラメータを設定する第2のパラメータ設定処理と、
前記確信度算出処理により得られた前記確信度が高いほど前記第1のパラメータ設定処理により設定された前記パラメータの重みが大きくなるように前記第1のパラメータにより設定されたパラメータと前記第2のパラメータ設定処理により設定されたパラメータとを重付合算して統合パラメータを取得する統合パラメータ取得処理と、
該統合パラメータ取得処理により取得された前記統合パラメータを用いて前記デジタル写真画像に対して補正を行う補正処理とを有することを特徴とするプログラム。
A program for causing a computer to execute image processing for correcting blur in a digital photographic image,
A main subject extraction process for extracting a main subject region from the digital photographic image;
A certainty factor calculation process for determining the certainty factor that the digital photo image is an image having a shallow depth of field;
A first parameter setting process for setting a parameter for correcting the blur using an image of the main subject area extracted by the main subject extraction process;
A second parameter setting process for setting a parameter for correcting the blur using the entire digital photograph image or an image of an area other than the main subject area;
The parameter set by the first parameter and the second parameter are set such that the higher the certainty factor obtained by the certainty factor calculation process, the greater the weight of the parameter set by the first parameter setting process. An integrated parameter acquisition process for acquiring an integrated parameter by adding together the parameters set by the parameter setting process;
And a correction process for correcting the digital photographic image using the integrated parameter acquired by the integrated parameter acquisition process.
前記画像処理が、前記デジタル写真画像を撮像した撮像装置のレンズのF値を含む付属情報が付属された前記デジタル写真画像の前記付属情報を読み取って前記F値を取得する付属情報読取処理を有し、
前記判別処理または前記確信度算出処理が、前記F値に基づいて前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことを特徴とする請求項16記載のプログラム。
The image processing includes an attached information reading process for obtaining the F value by reading the attached information of the digital photographic image to which attached information including an F value of a lens of an imaging device that has captured the digital photograph image is attached. And
The determination process or the certainty factor calculation process performs a determination as to whether or not the digital photographic image is an image with a shallow depth of field based on the F value, or a process for obtaining the certainty factor. 16. The program according to 16.
前記画像処理が、対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を有し、
前記判別処理または前記確信度算出処理が、前記ボケ情報取得処理により前記主要被写体領域の画像および前記主要被写体領域以外の領域の画像を夫々前記対象画像にして取得された夫々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことを特徴とする請求項16記載のプログラム。
The image processing detects an edge in a plurality of different directions with respect to the target image, acquires a feature amount of the edge in each of the directions, and acquires blur information based on the edge feature amount Have processing,
The discrimination process or the certainty factor calculation process compares the blur information acquired by using the blur information acquisition process as an image of the main subject region and an image of a region other than the main subject region, respectively. The program according to claim 16, wherein the process of determining whether the digital photographic image is an image with a shallow depth of field or determining the certainty factor is performed.
前記画像処理が、前記デジタル写真画像を複数のブロックに分けるブロック分け処理と、
対象画像に対して、複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理とを有し、
前記判別処理または前記確信度算出処理が、前記ボケ情報取得処理により各前記ブロックの画像を夫々前記対象画像にして取得された各々の前記ボケ情報を比較することによって、前記デジタル写真画像が被写界深度の浅い画像か否かの判別または前記確信度を求める処理を行うことを特徴とする請求項16記載のプログラム。
The image processing is a block dividing process for dividing the digital photographic image into a plurality of blocks;
A blur information acquisition process for detecting an edge for each of a plurality of different directions with respect to the target image, acquiring a feature amount of the edge in each of the directions, and acquiring blur information based on the edge feature amount; ,
The determination process or the certainty factor calculation process compares the blur information acquired by using the image of each block as the target image by the blur information acquisition process, so that the digital photographic image is captured. The program according to claim 16, wherein the program determines whether or not the image has a shallow depth of field or obtains the certainty factor.
前記パラメータ設定処理が、前記ボケを補正するためのパラメータを設定するために用いられる画像に対して、該画像における複数の異なる方向毎にエッジを検出し、各前記方向における前記エッジの特徴量を取得し、該エッジ特徴量に基づいてボケ情報を取得するボケ情報取得処理を有し、取得された前記ボケ情報基づいて前記パラメータを設定することを特徴とする請求項16から19のいずれか1項記載のプログラム。   The parameter setting process detects an edge for each of a plurality of different directions in the image with respect to an image used for setting a parameter for correcting the blur, and calculates a feature amount of the edge in each of the directions. 20. The method according to claim 16, further comprising: a blur information acquisition process that acquires and acquires blur information based on the edge feature amount, and sets the parameter based on the acquired blur information. Program described in the section.
JP2010162746A 2003-09-26 2010-07-20 Image processing method, apparatus, and program Expired - Lifetime JP4685966B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010162746A JP4685966B2 (en) 2003-09-26 2010-07-20 Image processing method, apparatus, and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2003334607 2003-09-26
JP2010162746A JP4685966B2 (en) 2003-09-26 2010-07-20 Image processing method, apparatus, and program

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2004193389A Division JP2005122688A (en) 2003-09-25 2004-06-30 Image processing method, device, and program

Publications (2)

Publication Number Publication Date
JP2010244579A true JP2010244579A (en) 2010-10-28
JP4685966B2 JP4685966B2 (en) 2011-05-18

Family

ID=43097442

Family Applications (2)

Application Number Title Priority Date Filing Date
JP2010162745A Expired - Lifetime JP4685965B2 (en) 2003-09-26 2010-07-20 Image processing method, apparatus, and program
JP2010162746A Expired - Lifetime JP4685966B2 (en) 2003-09-26 2010-07-20 Image processing method, apparatus, and program

Family Applications Before (1)

Application Number Title Priority Date Filing Date
JP2010162745A Expired - Lifetime JP4685965B2 (en) 2003-09-26 2010-07-20 Image processing method, apparatus, and program

Country Status (1)

Country Link
JP (2) JP4685965B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118154489A (en) * 2024-05-13 2024-06-07 国科天成科技股份有限公司 Infrared image enhancement system and method based on atmospheric scattering model

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5828649B2 (en) * 2011-03-09 2015-12-09 キヤノン株式会社 Image processing apparatus, image processing method, and computer program

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000298300A (en) * 1999-04-13 2000-10-24 Ricoh Co Ltd Hand shake image correcting method, recording medium, and image pickup device
JP2001218015A (en) * 2000-01-31 2001-08-10 Fuji Photo Film Co Ltd Picture processing method and picture processor
JP2002247439A (en) * 2001-02-13 2002-08-30 Ricoh Co Ltd Image input unit, image input method, and computer readable recording medium stored with program to allow computer to execute the method
JP2002300460A (en) * 2001-03-30 2002-10-11 Minolta Co Ltd Image processor and image processing program
JP2002369071A (en) * 2001-06-08 2002-12-20 Olympus Optical Co Ltd Picture processing method and digital camera mounted with the same and its program
JP2003149698A (en) * 2001-11-16 2003-05-21 Olympus Optical Co Ltd Shake detector
JP2003172873A (en) * 2001-09-28 2003-06-20 Olympus Optical Co Ltd Data correcting method and imaging unit

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000298300A (en) * 1999-04-13 2000-10-24 Ricoh Co Ltd Hand shake image correcting method, recording medium, and image pickup device
JP2001218015A (en) * 2000-01-31 2001-08-10 Fuji Photo Film Co Ltd Picture processing method and picture processor
JP2002247439A (en) * 2001-02-13 2002-08-30 Ricoh Co Ltd Image input unit, image input method, and computer readable recording medium stored with program to allow computer to execute the method
JP2002300460A (en) * 2001-03-30 2002-10-11 Minolta Co Ltd Image processor and image processing program
JP2002369071A (en) * 2001-06-08 2002-12-20 Olympus Optical Co Ltd Picture processing method and digital camera mounted with the same and its program
JP2003172873A (en) * 2001-09-28 2003-06-20 Olympus Optical Co Ltd Data correcting method and imaging unit
JP2003149698A (en) * 2001-11-16 2003-05-21 Olympus Optical Co Ltd Shake detector

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118154489A (en) * 2024-05-13 2024-06-07 国科天成科技股份有限公司 Infrared image enhancement system and method based on atmospheric scattering model

Also Published As

Publication number Publication date
JP4685966B2 (en) 2011-05-18
JP2011003201A (en) 2011-01-06
JP4685965B2 (en) 2011-05-18

Similar Documents

Publication Publication Date Title
US7720302B2 (en) Method, apparatus and program for image processing
JP4515208B2 (en) Image processing method, apparatus, and program
US20050249429A1 (en) Method, apparatus, and program for image processing
US7356254B2 (en) Image processing method, apparatus, and program
US7970180B2 (en) Method, apparatus, and program for processing red eyes
US8805112B2 (en) Image sharpness classification system
US7848545B2 (en) Method of and system for image processing and computer program
JP4624947B2 (en) Image trimming method, apparatus and program
US20050243350A1 (en) Image processing method, apparatus, and program
EP1215626A1 (en) Automatically producing an image of a portion of a photographic image
US20060082849A1 (en) Image processing apparatus
US20050244077A1 (en) Method, apparatus and program for image processing
CN105100620B (en) Image pickup method and device
AU2014315547A1 (en) Automated selection of keeper images from a burst photo captured set
JP2005521927A (en) Method and apparatus for evaluating photographic quality of captured images in a digital still camera
US7596273B2 (en) Image processing method, image processing apparatus, and image processing program
US7738783B2 (en) Method of setting photographing conditions and photography apparatus using the method
JP2005122688A (en) Image processing method, device, and program
JP2005332381A (en) Image processing method, device and program
JP4493416B2 (en) Image processing method, apparatus, and program
CN108769543B (en) Method and device for determining exposure time
JP4685965B2 (en) Image processing method, apparatus, and program
JP2006049949A (en) Image processing apparatus, image processing method and program thereof
JP2005332382A (en) Image processing method, device and program
JP4510556B2 (en) Object identification device and method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100802

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20110118

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110210

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140218

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4685966

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250