JP7356255B2 - Image processing device and its processing method, imaging device, program, storage medium - Google Patents

Image processing device and its processing method, imaging device, program, storage medium Download PDF

Info

Publication number
JP7356255B2
JP7356255B2 JP2019083205A JP2019083205A JP7356255B2 JP 7356255 B2 JP7356255 B2 JP 7356255B2 JP 2019083205 A JP2019083205 A JP 2019083205A JP 2019083205 A JP2019083205 A JP 2019083205A JP 7356255 B2 JP7356255 B2 JP 7356255B2
Authority
JP
Japan
Prior art keywords
virtual light
subject
light source
reliability
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2019083205A
Other languages
Japanese (ja)
Other versions
JP2020181330A (en
Inventor
尚子 渡澤
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.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2019083205A priority Critical patent/JP7356255B2/en
Publication of JP2020181330A publication Critical patent/JP2020181330A/en
Application granted granted Critical
Publication of JP7356255B2 publication Critical patent/JP7356255B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)
  • Studio Devices (AREA)
  • Image Analysis (AREA)

Description

本発明は、入力された画像に、仮想的な光源の影響を反映させる画像処理装置に関するものである。 The present invention relates to an image processing device that reflects the influence of a virtual light source on an input image.

従来より、撮影後の画像中の被写体に対して、仮想的な光源からの光を照射し、リライティング処理する技術が知られている。リライティング処理により、環境光によって生じた影などの暗部領域を明るくし、好ましい画像を得ることが可能となる。 2. Description of the Related Art Conventionally, a technique is known in which a subject in a photographed image is irradiated with light from a virtual light source to perform relighting processing. The relighting process brightens dark areas such as shadows caused by ambient light, making it possible to obtain a preferable image.

例えば、特許文献1では、被写体の陰影の状態を適切に補正することができるリライティング処理について開示されている。具体的には、撮影画像の所定領域の陰影の状態を検出し、検出された陰影の状態に基づいて、仮想光源の特性を決定する。そして決定された特性を有する仮想光源で光を照射した場合の陰影の状態になるように、撮影画像を補正する。 For example, Patent Document 1 discloses relighting processing that can appropriately correct the state of shadows of a subject. Specifically, the state of the shadow in a predetermined area of the photographed image is detected, and the characteristics of the virtual light source are determined based on the state of the detected shadow. Then, the photographed image is corrected so that it will be in a shadow state when irradiated with light by a virtual light source having the determined characteristics.

特開2016-72694号公報Japanese Patent Application Publication No. 2016-72694

上記の特許文献1に記載された方法では、複数人の人物が写るシーンにおいては、被写体として検出された被写体毎の陰影の状態を検出し、各々の被写体に適した仮想光源の特性を決定することになる。 In the method described in Patent Document 1 mentioned above, in a scene in which multiple people are photographed, the shadow state of each detected subject is detected, and the characteristics of a virtual light source suitable for each subject are determined. It turns out.

しかしながら複数人の人物が写るシーンにおいて、顔の傾き角度が大きい、顔が暗すぎるなどといった理由で一部の人物が被写体として検出されない場合がある。そういった場合においては、検出された被写体に対してはリライティング処理が行われるが、検出されなかった被写体に対しては何も処理がなされないこととなる。その結果、逆光で顔が暗いシーンにおいて、ある人物はリライティング処理により顔が明るくなるが、ある人物は顔が暗いままの不自然な画像になってしまう。 However, in a scene where multiple people are photographed, some of the people may not be detected as subjects due to reasons such as the tilt angle of their faces being large or their faces being too dark. In such a case, relighting processing is performed on the detected subject, but no processing is performed on the undetected subject. As a result, in a backlit scene with a dark face, the face of a certain person becomes brighter through relighting processing, but the face of another person remains dark, resulting in an unnatural image.

本発明は上述した課題に鑑みてなされたものであり、その目的は、複数の被写体が写るシーンにリライティング処理を施す場合に、不自然なリライティング処理結果になることを抑制することである。 The present invention has been made in view of the above-mentioned problems, and its purpose is to suppress unnatural relighting processing results when performing relighting processing on a scene in which multiple subjects are photographed.

本発明に係わる画像処理装置は、撮影画像を取得する取得手段と、前記撮影画像に含まれる被写体を検出する複数の検出手段と、前記被写体を照明する仮想的な光源である仮想光源を設定する設定手段と、前記設定手段が設定した仮想光源を用いて前記撮影画像の明るさを補正する補正手段と、を備え、前記設定手段は、前記複数の検出手段による1つの被写体についての検出結果に基づいて、前記1つの被写体についての前記複数の検出手段の検出結果それぞれについて被写体検出の信頼度を別々に算出し、別々に算出された信頼度を平均することにより、明るさを補正すべき被写体である信頼度を示すリライティング信頼度を算出し、算出されたリライティング信頼度に基づいて、前記仮想光源のパラメータを設定することを特徴とする。 The image processing device according to the present invention sets an acquisition unit that acquires a captured image, a plurality of detection units that detects a subject included in the captured image, and a virtual light source that is a virtual light source that illuminates the subject. The setting means includes a setting means, and a correction means for correcting the brightness of the photographed image using a virtual light source set by the setting means, and the setting means is configured to adjust the brightness of the photographed image based on the detection results for one subject by the plurality of detection means. Based on this, the reliability of object detection is calculated separately for each of the detection results of the plurality of detection means for the one object, and the separately calculated reliability is averaged to determine the object whose brightness should be corrected. The present invention is characterized in that a relighting reliability indicating a reliability is calculated, and a parameter of the virtual light source is set based on the calculated relighting reliability.

本発明によれば、複数の被写体が写るシーンにリライティング処理を施す場合に、不自然なリライティング処理結果になることを抑制することが可能となる。 According to the present invention, when performing relighting processing on a scene in which multiple subjects are photographed, it is possible to suppress unnatural relighting processing results.

本発明の画像処理装置の一実施形態であるデジタルカメラの構成を示すブロック図。1 is a block diagram showing the configuration of a digital camera that is an embodiment of an image processing device of the present invention. 一実施形態における画像処理部の構成を示すブロック図。FIG. 2 is a block diagram showing the configuration of an image processing section in one embodiment. 一実施形態おける画像処理部の処理を示すフローチャート。5 is a flowchart showing processing of an image processing unit in one embodiment. 一実施形態おけるリライティング処理部の構成を示すブロック図。FIG. 2 is a block diagram showing the configuration of a rewriting processing unit in an embodiment. 一実施形態おける仮想光源からの仮想的な光の反射を説明する模式図。FIG. 3 is a schematic diagram illustrating reflection of virtual light from a virtual light source in one embodiment. 一実施形態における仮想光源のパラメータ設定の説明図。FIG. 3 is an explanatory diagram of parameter settings of a virtual light source in one embodiment. 一実施形態におけるリライティング処理前後の画像の一例を示す図。FIG. 3 is a diagram illustrating an example of images before and after rewriting processing in an embodiment. 一実施形態におけるリライティング処理を示すフローチャート。5 is a flowchart showing rewriting processing in one embodiment. 一実施形態におけるリライティング処理を示すフローチャート。5 is a flowchart showing rewriting processing in one embodiment. 一実施形態における複数人のリライティング処理を説明する図。FIG. 3 is a diagram illustrating rewriting processing for multiple people in one embodiment. 一実施形態におけるリライティング信頼度算出の説明図。FIG. 2 is an explanatory diagram of rewriting reliability calculation in one embodiment. 一実施形態におけるリライティング信頼度算出の説明図。FIG. 2 is an explanatory diagram of rewriting reliability calculation in one embodiment. 一実施形態におけるリライティング信頼度算出の説明図。FIG. 2 is an explanatory diagram of rewriting reliability calculation in one embodiment.

以下、添付図面を参照して実施形態を詳しく説明する。なお、以下の実施形態は特許請求の範囲に係る発明を限定するものではない。実施形態には複数の特徴が記載されているが、これらの複数の特徴の全てが発明に必須のものとは限らず、また、複数の特徴は任意に組み合わせられてもよい。さらに、添付図面においては、同一若しくは同様の構成に同一の参照番号を付し、重複した説明は省略する。 Hereinafter, embodiments will be described in detail with reference to the accompanying drawings. Note that the following embodiments do not limit the claimed invention. Although a plurality of features are described in the embodiments, not all of these features are essential to the invention, and the plurality of features may be arbitrarily combined. Furthermore, in the accompanying drawings, the same or similar components are designated by the same reference numerals, and redundant description will be omitted.

図1は、本発明の画像処理装置の一実施形態であるデジタルカメラ100の構成を示すブロック図である。 FIG. 1 is a block diagram showing the configuration of a digital camera 100, which is an embodiment of the image processing apparatus of the present invention.

図1に示すデジタルカメラ100において、ズームレンズ、フォーカスレンズを含むレンズ群101(撮像光学系)、及び、絞り機能を備えるシャッター102を介して入射した光は、撮像部103において光電変換される。撮像部103は、CCDやCMOS素子などで構成され、光電変換により得られた電気信号は、画像信号としてA/D変換器104へ出力される。A/D変換器104は、撮像部103から出力されるアナログ画像信号をデジタル画像信号(画像データ)に変換し、画像処理部105に出力する。 In the digital camera 100 shown in FIG. 1, light that enters through a lens group 101 (imaging optical system) including a zoom lens and a focus lens, and a shutter 102 having an aperture function is photoelectrically converted in an imaging unit 103. The imaging unit 103 is composed of a CCD, a CMOS element, etc., and an electrical signal obtained by photoelectric conversion is output to an A/D converter 104 as an image signal. The A/D converter 104 converts the analog image signal output from the imaging section 103 into a digital image signal (image data) and outputs it to the image processing section 105.

画像処理部105は、A/D変換器104からの画像データ、または、メモリ制御部107を介して画像メモリ106から読み出された画像データに対し、ホワイトバランス処理などの色変換処理、γ処理、輪郭強調処理、色補正処理などの各種画像処理を行う。画像処理部105から出力された画像データは、メモリ制御部107を介して画像メモリ106に書き込まれる。画像メモリ106は、画像処理部105から出力された画像データや、表示部109に表示するための画像データを格納する。 The image processing unit 105 performs color conversion processing such as white balance processing, and γ processing on the image data from the A/D converter 104 or the image data read from the image memory 106 via the memory control unit 107. , performs various image processing such as contour enhancement processing and color correction processing. Image data output from the image processing section 105 is written into the image memory 106 via the memory control section 107. The image memory 106 stores image data output from the image processing section 105 and image data to be displayed on the display section 109.

顔・顔器官検出部113は、撮影された画像から、人物の顔及び器官が存在する顔領域及び顔器官領域を検出する。頭部検出部115は、パターン認識や機械学習に基づく手法により、撮影された画像から、人物の頭部が存在する頭部領域を検出する。 The face/facial organ detection unit 113 detects a face area and a facial organ area where a person's face and organs are present from the captured image. The head detection unit 115 detects a head region in which a person's head exists from a captured image using a method based on pattern recognition or machine learning.

画像処理部105では、顔・顔器官検出部113の顔検出結果や顔器官検出結果、頭部検出部115の頭部検出結果、及び撮像した画像データを用いて所定の評価値算出処理を行う。そして、得られた評価値に基づいてシステム制御部50が露光制御、焦点検出制御を行う。これにより、TTL(スルー・ザ・レンズ)方式のAF(オートフォーカス)処理、AE(自動露出)処理、AWB(オートホワイトバランス)処理などを行う。 The image processing unit 105 performs a predetermined evaluation value calculation process using the face detection result and facial organ detection result of the face/facial organ detection unit 113, the head detection result of the head detection unit 115, and the captured image data. . Then, the system control unit 50 performs exposure control and focus detection control based on the obtained evaluation value. As a result, TTL (through-the-lens) type AF (autofocus) processing, AE (automatic exposure) processing, AWB (auto white balance) processing, etc. are performed.

また、D/A変換器108は、画像メモリ106に格納されている表示用のデジタル画像データをアナログ信号に変換して表示部109に供給する。表示部109は、LCD等の表示器上に、D/A変換器108からのアナログ信号に応じた表示を行う。 Further, the D/A converter 108 converts the digital image data for display stored in the image memory 106 into an analog signal and supplies the analog signal to the display unit 109. The display unit 109 displays on a display such as an LCD according to the analog signal from the D/A converter 108.

コーデック部110は、画像メモリ106に格納された画像データをJPEGやMPEGなどの規格に基づいてそれぞれ圧縮符号化する。システム制御部50は符号化した画像データを、インタフェース(I/F)111を介して、メモリカードやハードディスク等の記録媒体112に格納する。また、I/F111を介して記録媒体112から読み出された画像データをコーデック部110により復号して伸長し、画像メモリ106に格納する。そして、画像メモリ106に格納された画像データを、メモリ制御部107、D/A変換器108を介して表示部109に表示することで、画像を再生表示することができる。 The codec unit 110 compresses and encodes the image data stored in the image memory 106 based on standards such as JPEG and MPEG. The system control unit 50 stores the encoded image data in a recording medium 112 such as a memory card or a hard disk via an interface (I/F) 111. Further, image data read from the recording medium 112 via the I/F 111 is decoded and expanded by the codec unit 110, and stored in the image memory 106. Then, by displaying the image data stored in the image memory 106 on the display unit 109 via the memory control unit 107 and the D/A converter 108, the image can be reproduced and displayed.

リライティング処理部114は、撮影された画像に仮想光源を当てて明るさを補正するリライティング処理(再照明処理)を行う。なお、リライティング処理部114により行われるリライティング処理の詳細については後述する。 The relighting processing unit 114 performs a relighting process (relighting process) that corrects brightness by applying a virtual light source to a captured image. Note that details of the rewriting processing performed by the rewriting processing unit 114 will be described later.

システム制御部50は、デジタルカメラ100のシステム全体を制御する。不揮発性メモリ121は、EEPROMなどのメモリにより構成され、システム制御部50の処理に必要なプログラムやパラメータなどを格納する。システム制御部50は、不揮発性メモリ121に記録されたプログラム、及び、システム制御部50の動作用の定数、変数をシステムメモリ122に展開して実行することにより、後述する本実施形態の各処理を実現する。 The system control unit 50 controls the entire system of the digital camera 100. The nonvolatile memory 121 is constituted by a memory such as an EEPROM, and stores programs, parameters, etc. necessary for processing by the system control unit 50. The system control unit 50 expands programs recorded in the non-volatile memory 121 and constants and variables for operation of the system control unit 50 into the system memory 122 and executes them, thereby executing each process of the present embodiment described later. Realize.

操作部120は、ユーザによるメニューの設定や画像選択などの操作を受け付ける。測距センサ123は被写体までの距離を測定し、撮影画素の各画素に対応する距離情報を出力する(距離情報検出)。 The operation unit 120 accepts operations such as menu settings and image selection by the user. The distance sensor 123 measures the distance to the subject and outputs distance information corresponding to each pixel of the photographed pixels (distance information detection).

次に、画像処理部105の詳細について、図2及び図3を用いて説明する。図2は画像処理部105の構成を示すブロック図、図3は、画像処理部105における処理を示すフローチャートである。なお、本実施形態では、撮像部103はベイヤー配列のカラーフィルタにより覆われているものとする。従って、撮像部103の各画素からはR、G、Bいずれかの画素信号が出力される。 Next, details of the image processing unit 105 will be explained using FIGS. 2 and 3. FIG. 2 is a block diagram showing the configuration of the image processing unit 105, and FIG. 3 is a flowchart showing the processing in the image processing unit 105. In this embodiment, it is assumed that the imaging unit 103 is covered with a Bayer array color filter. Therefore, each pixel of the imaging unit 103 outputs an R, G, or B pixel signal.

まず、S301において、図1のA/D変換器104から入力されたベイヤーRGBの画像データは同時化処理部200に入力される。同時化処理部200は、入力されたR、G、Bの画像信号に対して同時化処理を行い、各画素について色信号RGBを生成する。 First, in S301, Bayer RGB image data input from the A/D converter 104 in FIG. 1 is input to the synchronization processing unit 200. The synchronization processing unit 200 performs synchronization processing on the input R, G, and B image signals, and generates color signals RGB for each pixel.

次に、S302において、WB増幅部201は、公知の処理によりシステム制御部50が算出するホワイトバランスゲイン値に基づき、生成された各画素の色信号RGBにゲインをかけ、ホワイトバランスを調整する。WB増幅部201によりホワイトバランスが調整された色信号RGBは、S303において、輝度・色信号生成部202に入力される。輝度・色信号生成部202は色信号RGBから輝度信号Yを生成し、生成した輝度信号Yを輪郭強調処理部203へ、また、色信号RGBを色変換処理部205へ出力する。 Next, in S302, the WB amplification unit 201 adjusts the white balance by applying a gain to the generated color signal RGB of each pixel based on the white balance gain value calculated by the system control unit 50 using known processing. The color signal RGB whose white balance has been adjusted by the WB amplification unit 201 is input to the luminance/color signal generation unit 202 in S303. The brightness/color signal generation unit 202 generates a brightness signal Y from the color signals RGB, and outputs the generated brightness signal Y to the edge enhancement processing unit 203 and the color signal RGB to the color conversion processing unit 205.

S304では、輪郭強調処理部203において、輝度信号Yに対して輪郭強調処理を行い、輝度ガンマ処理部204へ出力する。一方、色変換処理部205では、色信号RGBに、例えばマトリクス演算を行って、所望のカラーバランスへ変換し、色ガンマ処理部206と被写体情報検出部208へ出力する。 In S<b>304 , the edge enhancement processing unit 203 performs edge enhancement processing on the luminance signal Y and outputs it to the luminance gamma processing unit 204 . On the other hand, the color conversion processing unit 205 performs, for example, matrix calculation on the color signals RGB to convert the signal into a desired color balance, and outputs the result to the color gamma processing unit 206 and the subject information detection unit 208 .

S305では、被写体情報検出部208において、顔・顔器官検出部113から出力される顔・顔器官検出情報と、頭部検出部115から出力される頭部検出情報、及び色変換処理部205から出力される色信号RGBとから、撮影画像における被写体に関する情報を検出する(被写体情報検出)。ここで、被写体に関する情報とは、撮影画像内の被写体の人数、被写体の大きさ、被写体同士の位置関係、被写体への光のあたり方、被写体の陰影情報などである。例えば、被写体の人数、大きさ、位置関係に関しては、顔・顔器官検出部113が出力する各顔・顔器官の座標位置情報や頭部検出部115が出力する頭部の座標位置情報から検出する。また、光の当たり方や陰影情報は、撮影画像全体及び各被写体の平均輝度情報や輝度ヒストグラム情報から検出する。 In S305, the subject information detection unit 208 detects the face/facial organ detection information output from the face/facial organ detection unit 113, the head detection information output from the head detection unit 115, and the color conversion processing unit 205. Information regarding the subject in the photographed image is detected from the output color signals RGB (subject information detection). Here, the information regarding the subjects includes the number of subjects in the photographed image, the size of the subjects, the positional relationship between the subjects, the way the subjects are hit by light, the shadow information of the subjects, and the like. For example, the number of subjects, their sizes, and positional relationships are detected from the coordinate position information of each face/facial organ output by the face/facial organ detection unit 113 or the coordinate position information of the head output by the head detection unit 115. do. In addition, the way the light hits and the shadow information are detected from the average brightness information and brightness histogram information of the entire photographed image and each subject.

S306では、輝度ガンマ処理部204において、輝度信号Yに対してガンマ補正を行い、メモリ制御部107を介してガンマ補正した輝度信号Yを画像メモリ106に出力する。一方、色ガンマ処理部206においては、色信号RGBにガンマ補正を行い、色差信号生成部207に出力する。 In S306, the luminance gamma processing unit 204 performs gamma correction on the luminance signal Y, and outputs the gamma-corrected luminance signal Y to the image memory 106 via the memory control unit 107. On the other hand, the color gamma processing unit 206 performs gamma correction on the color signals RGB and outputs them to the color difference signal generation unit 207.

S307では、色差信号生成部207においてRGB信号から色差信号R-Y、B-Y信号を生成し、メモリ制御部107を介して画像メモリ106に出力する。 In S307, the color difference signal generation unit 207 generates color difference signals RY and BY signals from the RGB signals, and outputs them to the image memory 106 via the memory control unit 107.

次に、本実施形態におけるリライティング処理について説明する。 Next, rewriting processing in this embodiment will be explained.

図4はリライティング処理部114の構成を示すブロック図である。リライティング処理部114は、画像処理部105により処理されて画像メモリ106に記録された輝度信号Y及び色差信号B-Y、R-Yを読み出して入力とし、仮想光源によるリライティング処理を行う。 FIG. 4 is a block diagram showing the configuration of the rewriting processing section 114. The relighting processing unit 114 reads out the luminance signal Y and color difference signals BY and RY processed by the image processing unit 105 and recorded in the image memory 106 as input, and performs relighting processing using a virtual light source.

まず、RGB信号変換部401は、入力された輝度信号Y及び色差信号B-Y、R-YをRGB信号に変換し、デガンマ処理部402へ出力する。デガンマ処理部402は、画像処理部105の輝度ガンマ処理部204及び色ガンマ処理部206におけるガンマ補正のガンマ特性と逆の特性の演算(デガンマ処理)を行い、リニアデータに変換する。そしてデガンマ処理部402は、リニアデータに変換後のRGB信号(Rt,Gt,Bt)を、仮想光源反射成分算出部406及び仮想光源付加処理部407に出力する。 First, the RGB signal converter 401 converts the input luminance signal Y and color difference signals BY, RY into RGB signals and outputs them to the degamma processor 402. The degamma processing unit 402 performs calculation (degamma processing) of a gamma characteristic inverse to the gamma characteristics of the gamma correction in the luminance gamma processing unit 204 and color gamma processing unit 206 of the image processing unit 105, and converts it into linear data. Then, the degamma processing unit 402 outputs the RGB signals (Rt, Gt, Bt) converted into linear data to the virtual light source reflection component calculation unit 406 and the virtual light source addition processing unit 407.

一方、距離算出部403は測距センサ123から取得した被写体の距離情報から、距離マップを作成する。被写体の距離情報とは、撮影画像の画素単位で得られる2次元の距離情報のことである。法線算出部404は距離算出部403で作成した距離マップから、被写体の形状を表す形状情報として法線マップを作成する。距離マップから法線マップを生成する方法に関しては、公知の技術を用いるものとするが、具体的な処理例について図5を用いて説明する。 On the other hand, the distance calculation unit 403 creates a distance map from the object distance information acquired from the distance measurement sensor 123. The object distance information is two-dimensional distance information obtained for each pixel of a photographed image. The normal calculation unit 404 creates a normal map from the distance map created by the distance calculation unit 403 as shape information representing the shape of the subject. As for the method of generating a normal map from a distance map, a known technique will be used, and a specific processing example will be explained using FIG. 5.

図5は、カメラ撮影座標と被写体の関係を示す図である。例えば、図5に示すようにある被写体501に対して、撮影画像の水平方向の差分ΔHに対する、距離Dの差分ΔDHと、不図示ではあるが、垂直方向(図5の紙面に対して垂直な方向)の差分ΔVに対する距離Dの差分ΔDVとから、被写体の一部分における勾配情報を算出する。そして、求めた被写体の一部分における勾配情報から法線Nを算出することが可能である。撮影した各画素に対して上記の処理を行うことにより、撮影画像の各画素に対応する法線Nを算出することが可能である。法線算出部404は、撮影画像の各画素に対応する法線Nの情報を法線マップとして仮想光源反射成分算出部406に出力する。 FIG. 5 is a diagram showing the relationship between camera shooting coordinates and a subject. For example, for a certain subject 501 as shown in FIG. Gradient information in a part of the subject is calculated from the difference ΔDV in the distance D with respect to the difference ΔV in the direction (direction). Then, it is possible to calculate the normal N from the obtained gradient information for the part of the subject. By performing the above processing on each photographed pixel, it is possible to calculate the normal N corresponding to each pixel of the photographed image. The normal calculation unit 404 outputs information on the normal N corresponding to each pixel of the photographed image to the virtual light source reflection component calculation unit 406 as a normal map.

なお、距離算出部403及び法線算出部404は、リライティング処理部114内に構成されるものとして説明したが、本発明はこれに限られるものでは無く、例えば、測距センサ123または画像処理部105内に構成してもよいし、独立した構成としてもよい。 Note that although the distance calculation unit 403 and the normal line calculation unit 404 have been described as being configured in the relighting processing unit 114, the present invention is not limited to this. It may be configured within 105 or may be configured independently.

仮想光源設定部405は、画像処理部105の被写体情報検出部208から入力される被写体情報に基づいて、仮想光源のパラメータを設定する。例えば、顔全体が暗い被写体に対して顔の明るさを全体的に明るくしたい場合においては、顔全体が仮想光源の照射範囲に含まれるように、仮想光源の位置、照射範囲、強度などのパラメータを制御する。 The virtual light source setting unit 405 sets parameters of the virtual light source based on subject information input from the subject information detecting unit 208 of the image processing unit 105. For example, if you want to brighten the entire face of a subject whose entire face is dark, you can adjust parameters such as the position, irradiation range, and intensity of the virtual light source so that the entire face is included in the irradiation range of the virtual light source. control.

ここで、被写体が1人である場合を例に挙げて、仮想光源に設定するパラメータについて、図6を用いて説明する。図6(a)は、被写体と仮想光源の位置関係を表した斜視図、図6(b)は、被写体と仮想光源の位置関係を表した平面図である。 Here, the parameters to be set for the virtual light source will be explained using FIG. 6, taking as an example the case where there is only one subject. FIG. 6(a) is a perspective view showing the positional relationship between the subject and the virtual light source, and FIG. 6(b) is a plan view showing the positional relationship between the subject and the virtual light source.

仮想光源の位置に関しては、仮想光源から被写体までの距離を短く設定すれば仮想光源の光は被写体に強く当たるようになり、逆に被写体までの距離を長く設定すれば仮想光源の光は被写体に弱く当たるようになる。仮想光源の照射範囲に関しては、仮想光源の照射範囲を広く設定すれば被写体全体に光を当てることができ、逆に照射範囲を狭く設定すれば被写体の一部にだけ光を当てることができる。また、仮想光源の強度に関しては、仮想光源の強度を強く設定すれば、被写体に強く光を当てることになり、逆に強度を弱く設定すれば、被写体に弱く光を当てることになる。 Regarding the position of the virtual light source, if you set the distance from the virtual light source to the subject short, the light from the virtual light source will hit the subject more strongly, and conversely, if you set the distance from the virtual light source to the subject longer, the light from the virtual light source will hit the subject more strongly. It starts to hit weakly. Regarding the irradiation range of the virtual light source, if the irradiation range of the virtual light source is set wide, the entire subject can be illuminated, and conversely, if the irradiation range is set narrow, only a part of the subject can be illuminated. Regarding the intensity of the virtual light source, if the intensity of the virtual light source is set high, the subject will be illuminated strongly, and conversely, if the intensity is set low, the subject will be illuminated weakly.

仮想光源反射成分算出部406では、光源と被写体の距離K、法線情報N及び仮想光源設定部405が設定した仮想光源のパラメータに基づき、設定した仮想光源から仮想的に照射された光のうち、被写体により反射される成分を算出する。以下、仮想光源から仮想的に照射された光を「仮想光」と呼ぶ。具体的には、仮想光源と各画素に対応する被写体の部分との距離Kの二乗に反比例し、法線Nのベクトルと光源方向Lのベクトルの内積に比例するように、撮影画像の座標位置に対応する被写体の部分における仮想光の反射成分を算出する。 The virtual light source reflection component calculation unit 406 calculates the amount of light emitted virtually from the set virtual light source based on the distance K between the light source and the subject, the normal information N, and the parameters of the virtual light source set by the virtual light source setting unit 405. , calculate the component reflected by the object. Hereinafter, light radiated virtually from a virtual light source will be referred to as "virtual light." Specifically, the coordinate position of the captured image is inversely proportional to the square of the distance K between the virtual light source and the part of the subject corresponding to each pixel, and proportional to the inner product of the vector of the normal N and the vector of the light source direction L. The reflected component of the virtual light in the part of the subject corresponding to is calculated.

ここで、仮想光の反射成分の一般的な算出方法について、図5を用いて説明する。なお、図5では説明を分かりやすくするために撮影画像の水平方向についてのみ示しているが、上述したように、紙面に対して垂直な方向が撮影画像の垂直方向となる。以下の説明では、撮影画像における水平画素位置H1と不図示の垂直画素位置V1に対応する、被写体501上の点P1における仮想光の反射成分の算出方法について説明する。 Here, a general method for calculating the reflected component of virtual light will be explained using FIG. 5. Note that in FIG. 5, only the horizontal direction of the photographed image is shown to make the explanation easier to understand, but as described above, the direction perpendicular to the plane of the paper is the vertical direction of the photographed image. In the following description, a method for calculating the reflection component of virtual light at a point P1 on the subject 501, which corresponds to a horizontal pixel position H1 in a captured image and a vertical pixel position V1 (not shown), will be described.

図5において、仮想光源502は被写体501に対して設定した仮想光源である。カメラ100で撮影された撮影画像の位置(H1,V1)における仮想光の反射成分は、被写体501上の点P1における法線ベクトルN1と仮想光源502の光源方向ベクトルL1との内積に比例し、仮想光源502と点P1との距離K1の二乗に反比例する値となる。なお、法線ベクトルN1と光源方向ベクトルL1は、水平方向、垂直方向、及び奥行き方向(図5の距離Dで示す方向)からなる3次元のベクトルである。この関係を数式で表現すると、仮想光の被写体501上の点P1における反射成分(Ra,Ga,Ba)は下記の式(1)に示す通りとなる。 In FIG. 5, a virtual light source 502 is a virtual light source set for the subject 501. The reflection component of the virtual light at the position (H1, V1) of the photographed image photographed by the camera 100 is proportional to the inner product of the normal vector N1 at the point P1 on the subject 501 and the light source direction vector L1 of the virtual light source 502, The value is inversely proportional to the square of the distance K1 between the virtual light source 502 and the point P1. Note that the normal vector N1 and the light source direction vector L1 are three-dimensional vectors consisting of a horizontal direction, a vertical direction, and a depth direction (direction indicated by distance D in FIG. 5). If this relationship is expressed mathematically, the reflected components (Ra, Ga, Ba) of the virtual light at point P1 on the subject 501 will be as shown in the following equation (1).

Ra=α×(-L1・N1)/K12×Rt
Ga=α×(-L1・N1)/K12×Gt …(1)
Ba=α×(-L1・N1)/K12×Bt
ここで、αは仮想光源の光の強度であり、リライティング補正量のゲイン値、Rt、Gt、Btはデガンマ処理部402から出力されたRGB信号である。
Ra=α×(-L1・N1)/K1 2 ×Rt
Ga=α×(−L1・N1)/K1 2 ×Gt…(1)
Ba=α×(-L1・N1)/K1 2 ×Bt
Here, α is the intensity of light from the virtual light source, the gain value of the relighting correction amount, Rt, Gt, and Bt are RGB signals output from the degamma processing unit 402.

上記のようにして算出された仮想光の反射成分(Ra,Ga,Ba)は、仮想光源付加処理部407へ出力される。仮想光源付加処理部407では、仮想光の反射成分(Ra,Ga,Ba)をデガンマ処理部402から出力されたRGB信号に付加する、下記の式(2)に示す処理を行う。 The reflected components (Ra, Ga, Ba) of the virtual light calculated as described above are output to the virtual light source addition processing section 407. The virtual light source addition processing unit 407 performs processing shown in the following equation (2) to add the reflected components (Ra, Ga, Ba) of the virtual light to the RGB signal output from the degamma processing unit 402.

Rout=Rt+Ra
Gout=Gt+Ga …(2)
Bout=Bt+Ba
仮想光源付加処理部407によりリライティング処理されたRBG信号(Rout,Gout,Bout)は、ガンマ処理部408に入力され、ガンマ補正が行われる。そして、輝度・色差信号生成部409では、ガンマ処理されたRGB信号(R’out,G’out,B’out)から輝度信号Y及び色差信号R-Y、B-Y信号を生成して出力する。
Rout=Rt+Ra
Gout=Gt+Ga...(2)
Bout=Bt+Ba
The RBG signals (Rout, Gout, Bout) that have been relighted by the virtual light source addition processing unit 407 are input to the gamma processing unit 408, where gamma correction is performed. Then, the luminance/color difference signal generation unit 409 generates and outputs a luminance signal Y and color difference signals RY, BY signals from the gamma-processed RGB signals (R'out, G'out, B'out). do.

リライティング処理部114で上述したリライティング処理を行った例を図7に示す。図7(a)は、リライティング処理前の撮影画像、図7(b)は、リライティング処理後の撮影画像の例である。図7(a)に示すように暗かった被写体が、仮想光を当ててリライティング処理をすることにより、図7(b)に示すように明るく補正されている。 FIG. 7 shows an example in which the rewriting processing unit 114 performs the above-mentioned rewriting processing. FIG. 7(a) is an example of a captured image before relighting processing, and FIG. 7(b) is an example of a captured image after relighting processing. The dark object shown in FIG. 7(a) is corrected to be brighter as shown in FIG. 7(b) by applying virtual light and performing relighting processing.

システム制御部50は、リライティング処理部114が出力した輝度信号Y及び色差信号R-Y、B-Yを、メモリ制御部107の制御によって、画像メモリ106に蓄積した後、コーデック部110で圧縮符号化を行う。また、I/F111を介して記録媒体112に記録する。 The system control unit 50 stores the luminance signal Y and the color difference signals RY and BY outputted by the relighting processing unit 114 in the image memory 106 under the control of the memory control unit 107, and then uses the codec unit 110 to compress and code them. make a change. Further, the information is recorded on the recording medium 112 via the I/F 111.

次に、本実施形態におけるリライティング処理部114によるリライティング処理について、図8及び図9のフローチャートに沿って説明する。この処理は、操作部120を介したユーザからの操作によってリライティング処理が選択されている場合に、画像処理部105によって処理されて、画像メモリ106に記憶された画像(輝度信号Y及び色差信号R-Y、B-Y)に対して実施される。 Next, rewriting processing by the rewriting processing unit 114 in this embodiment will be explained along the flowcharts of FIGS. 8 and 9. This process is performed when the relighting process is selected by the user's operation via the operation unit 120, and the image processed by the image processing unit 105 and stored in the image memory 106 (luminance signal Y and color difference signal R -Y, BY).

S801では、仮想光源設定部405は、第1の被写体情報として、図3のS305において被写体情報検出部208が顔・顔器官検出部113から取得したリライティング処理を行う対象の画像に含まれる被写体の人数、大きさ、位置関係などの被写体情報を取得する。 In S801, the virtual light source setting unit 405 sets, as the first subject information, information about the subject included in the image to be relighted, which the subject information detection unit 208 acquired from the face/facial organ detection unit 113 in S305 of FIG. Obtain subject information such as number of people, size, and positional relationship.

S802では、仮想光源設定部405は、第2の被写体情報として、S305において被写体情報検出部208が頭部検出部115から取得したリライティング処理を行う対象の画像に含まれる被写体の人数、大きさ、位置関係などの被写体情報を取得する。 In S802, the virtual light source setting unit 405 sets, as second subject information, the number, size, Obtain subject information such as positional relationship.

S803では、距離算出部403が、更に、デジタルカメラ100と被写体との距離による重み付けマップ(mapK)を生成する。具体的には、まず、距離算出部403が測距センサ123から取得した撮影画像の画素単位で得られる2次元の被写体距離情報に基づいて距離Kを画素単位で算出する(距離マップ)。そして、画素単位で1/(K2)を任意のビット幅で正規化した値を、距離による重み付けマップ(mapK)とする。 In S803, the distance calculation unit 403 further generates a weighted map (mapK) based on the distance between the digital camera 100 and the subject. Specifically, first, the distance calculation unit 403 calculates the distance K in pixel units based on two-dimensional object distance information obtained in pixel units of the captured image acquired from the distance measurement sensor 123 (distance map). Then, a value obtained by normalizing 1/(K 2 ) with an arbitrary bit width for each pixel is used as a distance weighting map (mapK).

S804では、法線算出部404において距離算出部403から取得した距離マップに基づいて、法線マップ(mapN)を生成する。具体的には、図5で説明したように被写体法線ベクトルNを画素単位で算出し、その各座標軸方向に対する方向余弦を求める。そして、画素単位で、求めた方向余弦を任意のビット幅で表現して法線による重み付けマップ(mapN)とする。 In S804, the normal line calculation unit 404 generates a normal line map (mapN) based on the distance map acquired from the distance calculation unit 403. Specifically, as described with reference to FIG. 5, the object normal vector N is calculated for each pixel, and the direction cosine with respect to each coordinate axis direction is determined. Then, the obtained direction cosine is expressed in an arbitrary bit width for each pixel to form a weighting map (mapN) based on the normal line.

S805では、仮想光源設定部405において、各被写体のリライティング信頼度を算出する。図10と図11を用いて、リライティング信頼度の算出方法について説明する。 In S805, the virtual light source setting unit 405 calculates the relighting reliability of each subject. A method for calculating rewriting reliability will be explained using FIGS. 10 and 11.

図10は、被写体が2人の場合の撮影画像の例を示す。図10(a)は、リライティング処理前の撮影画像、図10(b)は、撮影画像に対し、仮想光源の位置と照射範囲を示したイメージ図である。さらに、図10(c)は、仮想光源反射成分算出部406により算出された仮想光の反射成分算出結果のイメージ図、図10(d)は、リライティング処理後の画像の例である。図10(a)に示すように暗かった2人の被写体が、仮想光を当ててリライティング処理をすることにより、図10(d)に示すように明るく補正されている。図10(e)は、例えば向かって右側の被写体が被写体検出されて、向かって左側の被写体が被写体検出されなかった場合に、その情報のみを使用してリライティング処理を行った場合の例を示している。図10(e)では、検出した右側の被写体に対してのみリライティング処理がなされるため、不自然な画像となっている。 FIG. 10 shows an example of a captured image when there are two subjects. FIG. 10(a) is a photographed image before relighting processing, and FIG. 10(b) is an image diagram showing the position and irradiation range of a virtual light source with respect to the photographed image. Furthermore, FIG. 10(c) is an image diagram of the virtual light reflection component calculation result calculated by the virtual light source reflection component calculation unit 406, and FIG. 10(d) is an example of the image after the relighting process. The two subjects, which were dark as shown in FIG. 10(a), are corrected to be brighter as shown in FIG. 10(d) by applying virtual light and performing relighting processing. FIG. 10(e) shows an example in which relighting processing is performed using only that information when, for example, a subject on the right side is detected and a subject on the left side is not detected. ing. In FIG. 10E, the relighting process is performed only on the detected right subject, resulting in an unnatural image.

図11は、S801で取得した第1の被写体情報、S802で取得した第2の被写体情報から、リライティング信頼度を算出する方法について説明する図である。ここでは、図10(a)に示したような2人の撮影画像に対して、被写体検出を行った例について説明する。なお、ここで挙げる例は、第1の被写体情報としての顔・顔器官検出部113による被写体の検出数と、第2の被写体情報としての頭部検出部115による被写体の検出数が一致している場合の例である。 FIG. 11 is a diagram illustrating a method for calculating rewriting reliability from the first subject information acquired in S801 and the second subject information acquired in S802. Here, an example will be described in which subject detection is performed on captured images of two people as shown in FIG. 10(a). Note that in the example given here, the number of subjects detected by the face/facial organ detection unit 113 as the first subject information and the number of subjects detected by the head detection unit 115 as the second subject information match. This is an example of a case where

図11(a)は、被写体情報検出部208が第1の被写体情報として検出した検出画像を示している。図11(b)は、被写体情報検出部208が、第1の被写体情報として取得した情報を示している。1101は、画像No.、1102は被写体検出の種類、1103は被写体No.、1104は検出された顔の顔中心座標、1105は検出された顔の顔サイズ、1106は被写体検出の信頼度を示す。 FIG. 11A shows a detected image detected by the subject information detection unit 208 as the first subject information. FIG. 11B shows information acquired by the subject information detection unit 208 as the first subject information. 1101 is the image No. , 1102 is the type of object detection, and 1103 is the object number. , 1104 indicates the face center coordinates of the detected face, 1105 indicates the face size of the detected face, and 1106 indicates the reliability of subject detection.

図11(c)は、被写体情報検出部208が第2の被写体情報として検出した検出画像を示している。図11(d)は、被写体情報検出部208が、第2の被写体情報として取得した情報を示している。1107は、画像No.、1108は被写体検出の種類、1109は被写体No.、1110は検出された顔の顔中心座標、1111は検出された顔の顔サイズ、1112は被写体検出の信頼度を示す。 FIG. 11C shows a detected image detected by the subject information detection unit 208 as second subject information. FIG. 11D shows information acquired by the subject information detection unit 208 as the second subject information. 1107 is image No. , 1108 is the type of object detection, and 1109 is the object number. , 1110 indicates the face center coordinates of the detected face, 1111 indicates the face size of the detected face, and 1112 indicates the reliability of subject detection.

図11(e)は、図11(a)~(d)の第1及び第2の被写体検出情報からリライティング信頼度を算出した結果を示している。1113は画像No.、1114は被写体No.、1115は被写体検出種類、1116は検出された顔の顔中心座標、1117は検出された顔の顔サイズを示す。さらに、1118は検出された被写体が主要被写体群であるか否かのフラグ、1119は被写体検出の信頼度、1120はリライティング信頼度を示す。 FIG. 11(e) shows the results of calculating the rewriting reliability from the first and second object detection information shown in FIGS. 11(a) to 11(d). 1113 is image No. , 1114 is the subject No. , 1115 indicates the type of subject detection, 1116 indicates the face center coordinates of the detected face, and 1117 indicates the face size of the detected face. Further, 1118 indicates a flag indicating whether the detected subject is a main subject group, 1119 indicates the reliability of subject detection, and 1120 indicates the rewriting reliability.

ここで、1118に示した被写体が主要被写体群であるか否かのフラグについては、公知の主被写体検出技術を用いて判定する。例えば被写体の位置座標が撮影画像の中心に近く、撮影画像における被写体の顔面積が大きい場合などは主要被写体群と判定し、フラグは1となる。1120に示したリライティング信頼度の算出方法としては、例えば、1119に示した各被写体検出の信頼度の平均値をリライティング信頼度とする。 Here, the flag indicating whether or not the subject shown at 1118 is a main subject group is determined using a known main subject detection technique. For example, if the positional coordinates of the subject are close to the center of the captured image and the face area of the subject in the captured image is large, it is determined that the subject is in the main subject group, and the flag is set to 1. As a method for calculating the rewriting reliability shown in 1120, for example, the average value of the reliability of each object detection shown in 1119 is set as the rewriting reliability.

図8の説明に戻って、S806では、仮想光源設定部405において、撮影画像に含まれる全員のリライティング信頼度が所定の閾値Th以上か否かを判定する。全員のリライティング信頼度が閾値以上の場合はS807に進み、閾値未満の場合は図9のS907に進む。 Returning to the description of FIG. 8, in S806, the virtual light source setting unit 405 determines whether the rewriting reliability of all the people included in the captured image is equal to or greater than a predetermined threshold Th. If everyone's rewriting reliability is equal to or higher than the threshold, the process advances to S807, and if it is less than the threshold, the process advances to S907 in FIG.

S807では、仮想光源設定部405において、仮想光の重み付けマップを生成する。具体的には、仮想光源の光源方向ベクトル-Lを画素単位で算出し、その各座標軸方向に対する方向余弦を求める。そして、画素単位で、求めた方向余弦を任意のビット幅で表現して仮想光源による重み付けマップ(mapL)とする。なお、仮想光源の光源ベクトル-Lを算出するための仮想光源のパラメータ設定に関しては、被写体情報検出部208から入力される被写体情報に基づいて決定する。例えば、取得した顔領域内の輝度分布が偏っていた場合、輝度値が低い領域に仮想光が当たるように仮想光源の位置、照射範囲、強度を決定する。 In S807, the virtual light source setting unit 405 generates a virtual light weighting map. Specifically, the light source direction vector -L of the virtual light source is calculated for each pixel, and its direction cosine with respect to each coordinate axis direction is determined. Then, the obtained direction cosine is expressed in an arbitrary bit width for each pixel to form a weighting map (mapL) based on the virtual light source. Note that the parameter settings of the virtual light source for calculating the light source vector -L of the virtual light source are determined based on the subject information input from the subject information detection unit 208. For example, if the brightness distribution within the acquired face area is biased, the position, irradiation range, and intensity of the virtual light source are determined so that the virtual light shines on the area where the brightness value is low.

例えば、輝度値が低い領域の撮影画像における座標が(x1,y1)であるとすると、仮想光の被写体による反射成分(Ra(x1, y1),Ga(x1, y1),Ba(x1, y1))は、次式(3)で表される。 For example, if the coordinates in the photographed image of an area with low luminance value are (x1, y1), the reflected components of virtual light by the subject (Ra(x1, y1), Ga(x1, y1), Ba(x1, y1) )) is expressed by the following equation (3).

Ra(x1, y1)=α×(-L(x1, y1)・N(x1, y1))/K(x1, y1)2×Rt
Ga(x1, y1)=α×(-L(x1, y1)・N(x1, y1))/K(x1, y1)2×Gt …(3)
Ba(x1, y1)=α×(-L(x1, y1)・N(x1, y1))/K(x1, y1)2×Bt
なお、式(3)において、αは仮想光源の光の強度である。また、L(x1, y1)は、座標(x1,y1)に対応する被写体上の位置における仮想光源の光源方向ベクトル、N(x1, y1)は、座標(x1,y1)に対応する被写体上の位置における法線ベクトルである。更に、K(x1, y1)は、仮想光源と座標(x1,y1)に対応する被写体上の位置との距離を示す。仮想光が輝度値の低い領域である座標(x1,y1)にある被写体に当たるようにするには、(Ra(x1, y1),Ga(x1, y1),Ba(x1, y1))が正の値となるように、仮想光源の強さαと、被写体との距離K(x1, y1)を制御する。また、仮想光源の照射範囲は、取得した顔領域内の輝度分布情報に基づいて、所定の閾値よりも低い輝度値となる座標情報を取得し、その座標が含まれる照射範囲になるよう制御する。また、仮想光源の強さαを大きくし過ぎて白飛びや階調反転などの弊害が生じる可能性もあるので、仮想光源の強さαの範囲としては、照射範囲外となる輝度値が高い領域の平均輝度値±βの範囲内の輝度値とし、ある閾値βの範囲内で制御する。上述した処理により、仮想光源設定部405は仮想光源の位置の範囲、照射する範囲、強度の範囲を算出し、その範囲内の平均値を仮想光源の位置、照射範囲、強度として設定値を決定する。
Ra(x1, y1)=α×(-L(x1, y1)・N(x1, y1))/K(x1, y1) 2 ×Rt
Ga(x1, y1)=α×(−L(x1, y1)・N(x1, y1))/K(x1, y1) 2 ×Gt…(3)
Ba(x1, y1)=α×(-L(x1, y1)・N(x1, y1))/K(x1, y1) 2 ×Bt
Note that in equation (3), α is the intensity of light from the virtual light source. Furthermore, L(x1, y1) is the light source direction vector of the virtual light source at the position on the subject corresponding to the coordinates (x1, y1), and N(x1, y1) is the light source direction vector on the subject corresponding to the coordinates (x1, y1). is the normal vector at the position. Further, K(x1, y1) indicates the distance between the virtual light source and the position on the subject corresponding to the coordinates (x1, y1). In order for the virtual light to hit the subject at coordinates (x1, y1), which is an area with low brightness, (Ra(x1, y1), Ga(x1, y1), Ba(x1, y1)) must be correct. The intensity α of the virtual light source and the distance K(x1, y1) to the subject are controlled so that the value . Furthermore, the irradiation range of the virtual light source is controlled by acquiring coordinate information that has a luminance value lower than a predetermined threshold value based on the acquired luminance distribution information within the face area, and controlling the irradiation range to include the coordinates. . In addition, if the strength α of the virtual light source is set too high, there is a possibility that problems such as overexposure or gradation inversion may occur, so the range of the strength α of the virtual light source should be set to a high luminance value that is outside the irradiation range. The brightness value is set within the range of the average brightness value of the area ±β, and is controlled within the range of a certain threshold value β. Through the above-described processing, the virtual light source setting unit 405 calculates the position range, irradiation range, and intensity range of the virtual light source, and determines the average value within the range as the position, irradiation range, and intensity of the virtual light source. do.

S808では、仮想光源反射成分算出部406において、検出された被写体の領域について、仮想光の反射成分(Ra,Ga,Ba)を算出する。なお、反射成分(Ra,Ga,Ba)は前述した通り、式(1)を用いて算出することができる。この式(1)を、S803の距離による重み付けマップ(mapK)、S804の被写体の法線による重み付けマップ(mapN)、S807の仮想光源による重み付けマップ(mapL)で置き換える。すなわち、下記の式(4)を用いて仮想光の反射成分を算出することができる。 In S808, the virtual light source reflection component calculation unit 406 calculates virtual light reflection components (Ra, Ga, Ba) for the detected subject area. Note that the reflected components (Ra, Ga, Ba) can be calculated using equation (1) as described above. This equation (1) is replaced by a weighting map based on distance (mapK) in S803, a weighting map based on the normal to the subject (mapN) in S804, and a weighting map based on the virtual light source (mapL) in S807. That is, the reflected component of the virtual light can be calculated using the following equation (4).

Ra=α×mapL・mapN・mapK×Rt
Ga=α×mapL・mapN・mapK×Gt …(4)
Ba=α×mapL・mapN・mapK×Bt
仮想光反射成分の算出結果とは、ゲインα(強度)と仮想光源による重みづけマップ(mapL)と法線による重み付けマップ(mapN)と、距離による重み付けマップ(mapK)とを乗算した結果を示している。仮想光源反射成分算出部406において、S808で算出した各被写体グループの仮想光反射成分を合成し、画像全体の仮想光源からの仮想的な光の反射成分(Ra,Ga,Ba)を算出する。例えば、図10に示した撮影画像のように複数人の例では、各被写体の仮想光反射成分を合成する。合成方法は既存の方法でよいが、例えば、比較明合成処理などで合成する。合成した例を図10(c)に示す。
Ra=α×mapL・mapN・mapK×Rt
Ga=α×mapL・mapN・mapK×Gt…(4)
Ba=α×mapL・mapN・mapK×Bt
The calculation result of the virtual light reflection component is the result of multiplying the gain α (intensity), the weighting map by the virtual light source (mapL), the weighting map by the normal (mapN), and the weighting map by distance (mapK). ing. The virtual light source reflection component calculation unit 406 combines the virtual light reflection components of each subject group calculated in S808, and calculates virtual light reflection components (Ra, Ga, Ba) from the virtual light source for the entire image. For example, in the case of a plurality of subjects as in the photographed image shown in FIG. 10, the virtual light reflection components of each subject are combined. The compositing method may be an existing method, but for example, a relatively bright compositing process may be used. A synthesized example is shown in FIG. 10(c).

S809では、リライティング処理を行う。具体的には、上述した式(2)に示すように、S808で算出した仮想光の反射成分(Ra,Ga,Ba)を、仮想光源付加処理部407において、デガンマ処理部402の出力(Rt,Gt,Bt)と加算する。リライィング処理を終えると、リライティング処理部114による処理を終了する。 In S809, rewriting processing is performed. Specifically, as shown in equation (2) above, the virtual light reflection components (Ra, Ga, Ba) calculated in S808 are converted to the output (Rt) of the degamma processing unit 402 in the virtual light source addition processing unit 407 , Gt, Bt). When the rewriting processing is finished, the processing by the rewriting processing unit 114 is ended.

以上の処理により、リライティング処理部114において、撮影画像中の被写体のリライティング処理を行う。 Through the above processing, the relighting processing unit 114 performs relighting processing on the subject in the captured image.

一方、S806において、撮影画像に含まれる全員のリライティング信頼度が所定の閾値以上ではないと判断された場合、図9のS907に進む。 On the other hand, if it is determined in S806 that the rewriting reliability of all the people included in the photographed image is not greater than or equal to the predetermined threshold, the process advances to S907 in FIG.

S907では、主要被写体群の各被写体のリライティング信頼度が、所定の閾値以上か否かを判別する。所定の閾値より小さい場合は、S911へ進み、所定の閾値以上の場合は、S908に進む。この判定方法について図12を用いて説明する。 In S907, it is determined whether the relighting reliability of each subject in the main subject group is greater than or equal to a predetermined threshold. If it is smaller than the predetermined threshold, the process advances to S911, and if it is greater than or equal to the predetermined threshold, the process advances to S908. This determination method will be explained using FIG. 12.

図12は、S801で取得した第1の被写体情報、S802で取得した第2の被写体情報から、リライティング信頼度を算出する方法について説明する図である。ここでは、図10(a)に示したような2人の被写体の遠くに別の被写体が小さく写っている撮影画像に対して、被写体検出した例について説明する。 FIG. 12 is a diagram illustrating a method of calculating rewriting reliability from the first subject information acquired in S801 and the second subject information acquired in S802. Here, a description will be given of an example in which a subject is detected in a photographed image such as that shown in FIG. 10(a) in which another subject appears small in the distance from two subjects.

図12(a)は、被写体情報検出部208が第1の被写体情報として検出した検出画像を示している。図12(b)は、被写体情報検出部208が、第1の被写体情報として取得した情報を示している。1201は、画像No.、1202は被写体検出の種類、1203は被写体No.、1204は検出された顔の顔中心座標、1205は検出された顔の顔サイズ、1206は被写体検出の信頼度を示す。 FIG. 12A shows a detected image detected by the subject information detection unit 208 as the first subject information. FIG. 12(b) shows information acquired by the subject information detection unit 208 as the first subject information. 1201 is the image No. , 1202 is the type of subject detection, and 1203 is the subject number. , 1204 indicates the face center coordinates of the detected face, 1205 indicates the face size of the detected face, and 1206 indicates the reliability of subject detection.

図12(c)は、被写体情報検出部208が第2の被写体情報として検出した検出画像を示している。図12(d)は、被写体情報検出部208が、第2の被写体情報として取得した情報を示している。1207は、画像No.、1208は被写体検出の種類、1209は被写体No.、1210は検出された顔の顔中心座標、1211は検出された顔の顔サイズ、1212は被写体検出の信頼度を示す。 FIG. 12C shows a detected image detected by the subject information detection unit 208 as second subject information. FIG. 12(d) shows information acquired by the subject information detection unit 208 as the second subject information. 1207 is image No. , 1208 is the type of object detection, and 1209 is the object number. , 1210 indicates the face center coordinates of the detected face, 1211 indicates the face size of the detected face, and 1212 indicates the reliability of subject detection.

図12(e)は、図12(a)~(d)の第1及び第2の被写体検出情報からリライティング信頼度を算出した結果を示している。1213は画像No.、1214は被写体No.、1215は被写体検出種類、1216は検出された顔の顔中心座標、1217は検出された顔の顔サイズを示す。さらに、1218は検出された被写体が主要被写体群であるか否かのフラグ、1219は被写体検出の信頼度、1220はリライティング信頼度を示す。 FIG. 12(e) shows the results of calculating the rewriting reliability from the first and second object detection information shown in FIGS. 12(a) to 12(d). 1213 is image No. , 1214 is the subject No. , 1215 indicates the type of subject detection, 1216 indicates the face center coordinates of the detected face, and 1217 indicates the face size of the detected face. Further, 1218 indicates a flag indicating whether the detected subject is a main subject group, 1219 indicates the reliability of subject detection, and 1220 indicates the rewriting reliability.

ここで、1218に示した被写体が主要被写体群であるか否かのフラグについては、公知の主被写体検出技術により判定する。例えば被写体の位置座標が撮影画像の中心に近く、撮影画像における被写体の顔面積が大きい場合などは主要被写体群と判定し、フラグは1となる。1220に示したリライティング信頼度の算出方法としては、1219に示した各被写体検出の信頼度の平均値をリライティング信頼度とする。前述のステップS907では、主要被写体群だと判定された被写体において、リライティング信頼度が所定の閾値以上か否かを判定する。例えば、信頼度の閾値が80であった場合に、図12では、撮影画像の主要被写体群と判定された被写体はNo.1とNo.2である。そして、No.1とNo.2の被写体のリライティング信頼度は100と90で閾値80を超えている。そのため、S907では信頼度が高いと判定されてS908に進む。 Here, the flag indicating whether or not the subject shown at 1218 is a main subject group is determined by a known main subject detection technique. For example, if the positional coordinates of the subject are close to the center of the captured image and the face area of the subject in the captured image is large, it is determined that the subject is in the main subject group, and the flag is set to 1. As a method for calculating the rewriting reliability shown in 1220, the average value of the reliability of each object detection shown in 1219 is used as the rewriting reliability. In step S907 described above, it is determined whether the rewriting reliability of the subjects determined to be the main subject group is equal to or greater than a predetermined threshold. For example, when the reliability threshold is 80, in FIG. 12, the subject determined to be the main subject group of the captured image is No. 1 and no. It is 2. And No. 1 and no. The relighting reliability of subject No. 2 is 100 and 90, which exceeds the threshold of 80. Therefore, in S907, it is determined that the reliability is high, and the process advances to S908.

S908では、仮想光源設定部405において、それぞれ仮想光源の位置、照射範囲、強度などのパラメータを設定する。この仮想光源の位置、照射範囲、強度などのパラメータの設定は、上述したS807と同様にして行うが、S807では通常の仮想光源パラメータで照射しているのに対し、S908ではリライティング信頼度に応じて仮想光源パラメータを制御する。制御方法としては、主要被写体群の各被写体のリライティング信頼度が高ければ高いほど、非主要被写体群の主要被写体の程度が小さければ小さいほど(すなわち主要被写体ではない可能性が高ければ高いほど)、通常の仮想光源パラメータと同等の設定値となるよう制御する。逆の場合は、通常の仮想光源パラメータよりも効果が弱くなるように制御する。このように設定された仮想光源のパラメータに基づいて、仮想光源による重み付けマップを生成する。具体的には、仮想光源の光源方向ベクトル-Lを画素単位で算出し、その各座標軸方向に対する方向余弦を求める。求めた方向余弦を任意のビット幅で表現して仮想光源による重み付けマップ(mapL)とする。 In S908, the virtual light source setting unit 405 sets parameters such as the position, irradiation range, and intensity of each virtual light source. Parameters such as the position, irradiation range, and intensity of this virtual light source are set in the same manner as in S807 described above. However, in S807, irradiation is performed using normal virtual light source parameters, whereas in S908, irradiation is performed according to the rewriting reliability. to control virtual light source parameters. As a control method, the higher the relighting reliability of each subject in the main subject group, the smaller the degree of the main subject in the non-main subject group (in other words, the higher the possibility that it is not the main subject), Control so that the setting values are the same as normal virtual light source parameters. In the opposite case, the effect is controlled to be weaker than the normal virtual light source parameters. Based on the parameters of the virtual light source set in this way, a weighting map based on the virtual light source is generated. Specifically, the light source direction vector -L of the virtual light source is calculated for each pixel, and its direction cosine with respect to each coordinate axis direction is determined. The obtained direction cosine is expressed with an arbitrary bit width to form a weighting map (mapL) based on the virtual light source.

S909では、仮想光源反射成分算出部406において、検出された被写体の領域について、仮想光の反射成分(Ra,Ga,Ba)を算出する。算出方法は、S808で前述した方法と同じである。 In S909, the virtual light source reflection component calculation unit 406 calculates the virtual light reflection components (Ra, Ga, Ba) for the detected subject area. The calculation method is the same as the method described above in S808.

S910では、リライティング処理を行う。具体的には、S908で算出した仮想光の反射成分(Ra,Ga,Ba)を、仮想光源付加処理部407において、デガンマ処理部402の出力(Rt,Gt,Bt)と加算する。リライティング処理を終えると、リライティング処理部114による処理を終了する。 In S910, rewriting processing is performed. Specifically, the virtual light source addition processing unit 407 adds the reflection components (Ra, Ga, Ba) of the virtual light calculated in S908 to the output (Rt, Gt, Bt) of the degamma processing unit 402. When the rewriting processing is finished, the processing by the rewriting processing unit 114 is ended.

一方、S907において主要被写体群の各被写体のリライティング信頼度が、所定の閾値未満であった場合は、S911に進む。この判定方法について図13を用いて説明する。 On the other hand, if the rewriting reliability of each subject in the main subject group is less than the predetermined threshold in S907, the process advances to S911. This determination method will be explained using FIG. 13.

図13は、S801で取得した第1の被写体情報、S802で取得した第2の被写体情報から、リライティング信頼度を算出する方法について説明する図である。ここでは、図10(a)に示したような2人の撮影画像に対して、第1の被写体検出では2人が検出され、第2の被写体検出では片方のみが検出された例について説明する。 FIG. 13 is a diagram illustrating a method for calculating rewriting reliability from the first subject information acquired in S801 and the second subject information acquired in S802. Here, we will explain an example in which two people are detected in the first object detection and only one is detected in the second object detection in the photographed image of two people as shown in FIG. 10(a). .

図13(a)は、被写体情報検出部208が第1の被写体情報として検出した検出画像を示している。図13(b)は、被写体情報検出部208が、第1の被写体情報として取得した情報を示している。1301は、画像No.、1302は被写体検出の種類、1303は被写体No.、1304は検出された顔の顔中心座標、1305は検出された顔の顔サイズ、1306は被写体検出の信頼度を示す。 FIG. 13A shows a detected image detected by the subject information detection unit 208 as the first subject information. FIG. 13(b) shows information acquired by the subject information detection unit 208 as the first subject information. 1301 is image No. , 1302 is the type of subject detection, and 1303 is the subject number. , 1304 indicates the face center coordinates of the detected face, 1305 indicates the face size of the detected face, and 1306 indicates the reliability of subject detection.

図13(c)は、被写体情報検出部208が第2の被写体情報として検出した検出画像を示している。図13(d)は、被写体情報検出部208が、第2の被写体情報として取得した情報を示している。1307は、画像No.、1308は被写体検出の種類、1309は被写体No.、1310は検出された顔の顔中心座標、1311は検出された顔の顔サイズ、1312は被写体検出の信頼度を示す。 FIG. 13(c) shows a detected image detected by the subject information detection unit 208 as second subject information. FIG. 13(d) shows information acquired by the subject information detection unit 208 as the second subject information. 1307 is image No. , 1308 is the type of subject detection, and 1309 is the subject number. , 1310 indicates the face center coordinates of the detected face, 1311 indicates the face size of the detected face, and 1312 indicates the reliability of subject detection.

図13(e)は、図13(a)~(d)の第1及び第2の被写体検出情報からリライティング信頼度を算出した結果を示している。1313は画像No.、1314は被写体No.、1315は被写体検出種類、1316は検出された顔の顔中心座標、1317は検出された顔の顔サイズを示す。さらに、1318は検出された被写体が主要被写体群であるか否かのフラグ、1319は被写体検出の信頼度、1320はリライティング信頼度を示す。なお、図13(c)では、第2の被写体検出情報において、2人の被写体のうちNo.2の被写体が検出されていない。そのため、この検出されないNo.2の被写体の被写体信頼度は0と考える。そのため、図13(e)のリライティング信頼度の計算では、No.2の被写体に対して、第1の被写体検出情報での被写体検出信頼度100と第2の被写体検出情報での被写体信頼度0との平均をとって、リライティング信頼度が50となる。 FIG. 13(e) shows the results of calculating the rewriting reliability from the first and second object detection information shown in FIGS. 13(a) to 13(d). 1313 is image No. , 1314 is the subject No. , 1315 indicates the type of subject detection, 1316 indicates the face center coordinates of the detected face, and 1317 indicates the face size of the detected face. Further, 1318 indicates a flag indicating whether the detected subject is a main subject group, 1319 indicates the reliability of subject detection, and 1320 indicates the rewriting reliability. In addition, in FIG. 13(c), in the second subject detection information, No. 1 of the two subjects is detected. Subject 2 has not been detected. Therefore, this undetected No. The subject reliability of subject No. 2 is considered to be 0. Therefore, in the calculation of rewriting reliability in FIG. 13(e), No. For subject No. 2, the rewriting reliability is 50 by taking the average of the object detection reliability of 100 in the first object detection information and the object reliability of 0 in the second object detection information.

ここで、1318に示した被写体が主要被写体群であるか否かのフラグについては、公知の主被写体検出技術により判定する。例えば被写体の位置座標が撮影画像の中心に近く、撮影画像における被写体の顔面積が大きい場合などは主要被写体群と判定し、フラグは1となる。1320に示したリライティング信頼度の算出方法としては、1319に示した各被写体検出の信頼度の平均値をリライティング信頼度とする。前述のステップS907では、主要被写体群だと判定された被写体において、リライティング信頼度が任意の閾値以上か否かを判定する。例えば、信頼度の閾値が80であった場合に、図13では、撮影画像の主要被写体群と判定された被写体はNo.1とNo.2である。そして、No.1とNo.2の被写体のリライティング信頼度は100と50であり、一方が閾値80を下回っている。そのため、S907では信頼度が低いと判定されてS911へと進む。 Here, the flag indicating whether or not the subject shown at 1318 is a main subject group is determined by a known main subject detection technique. For example, if the positional coordinates of the subject are close to the center of the captured image and the face area of the subject in the captured image is large, it is determined that the subject is in the main subject group, and the flag is set to 1. As a method for calculating the rewriting reliability shown in 1320, the average value of the reliability of each object detection shown in 1319 is used as the rewriting reliability. In step S907 described above, it is determined whether the rewriting reliability of the subjects determined to be the main subject group is equal to or higher than an arbitrary threshold value. For example, when the reliability threshold is 80, in FIG. 13, the subject determined to be the main subject group of the captured image is No. 1 and no. It is 2. And No. 1 and no. The relighting reliability of subject No. 2 is 100 and 50, and one of them is below the threshold of 80. Therefore, in S907, it is determined that the reliability is low, and the process advances to S911.

S911では、リライティング処理をせずに、画面全体で明るさ補正処理を行う。例えば、個々の被写体に対し仮想光源を設定して明るさ補正をするのではなく、輝度値が低いほど明るくなるようなゲイン処理により、明るさ補正を行う。 In S911, brightness correction processing is performed on the entire screen without performing relighting processing. For example, instead of correcting the brightness by setting a virtual light source for each subject, the brightness is corrected by gain processing such that the lower the brightness value, the brighter it becomes.

以上の処理により、リライティング処理部114において、撮影画像中の被写体のリライティング処理を行う。これにより、主要被写体群の被写体にも関わらず、一部の被写体は明るくなり、一部の被写体が暗くなるといった不自然なリライティング処理画像を生成することを回避することが可能となる。 Through the above processing, the relighting processing unit 114 performs relighting processing on the subject in the captured image. This makes it possible to avoid generating an unnatural relighting-processed image in which some subjects become brighter and some subjects become darker, despite the subjects being in the main subject group.

なお、本実施形態では、画像処理装置としてデジタルカメラ100を例に挙げて説明したが、パーソナルコンピューター等の画像処理装置に本発明を適用することも可能である。その場合、カメラ等の撮像手段で撮影した画像を取得し、取得した画像に対してユーザが任意に仮想光源パラメータを設定してリライティング処理する画像処理装置であってもよい。画像と共に、顔検出結果、頭部検出結果、距離情報、法線情報などの付加情報があれば、それらの情報を用いてリライティング処理を行ってもよい。その場合においても、被写体をグループ分けすることで、ユーザが被写体1人ずつに対して仮想光源のパラメータを設定する必要がなくなるため、仮想光源のパラメータ設定方法を煩雑にせずにリライティング処理することが可能となる。 Although the present embodiment has been described using the digital camera 100 as an example of an image processing device, the present invention can also be applied to an image processing device such as a personal computer. In that case, the image processing apparatus may be an image processing apparatus that acquires an image photographed by an imaging means such as a camera, and performs relighting processing by the user arbitrarily setting virtual light source parameters for the acquired image. If there is additional information such as face detection results, head detection results, distance information, normal information, etc. together with the image, the relighting process may be performed using such information. Even in that case, by dividing the subjects into groups, the user does not need to set virtual light source parameters for each subject individually, so relighting can be performed without complicating the virtual light source parameter setting method. It becomes possible.

また、本実施形態では、仮想光源が1つの場合について説明したが、これに限るものではない。例えば、1つの仮想光源は被写体に対し右斜め上から、もう1つの仮想光源は被写体に対し真横からといったように、複数の仮想光源でリライティング処理する構成にしてもよい。 Further, in this embodiment, the case where there is one virtual light source has been described, but the present invention is not limited to this. For example, a configuration may be adopted in which relighting processing is performed using a plurality of virtual light sources, such as one virtual light source from diagonally above and to the right of the subject, and another virtual light source from directly to the side of the subject.

また、本実施形態では、加算光により明るく補正する場合について説明したが、暗くするリライティングを行ってもよい。その場合、仮想光源のゲイン値αをマイナス(減算光)にする。また被写体に鏡面反射光を付加する構成にしてもよい。このように、複数の種類のいずれかを選択して仮想光とすることができる。 Furthermore, in this embodiment, a case has been described in which brightening is corrected using added light, but relighting to darken may also be performed. In that case, the gain value α of the virtual light source is made negative (subtraction light). Alternatively, a configuration may be adopted in which specular reflection light is added to the subject. In this way, one of a plurality of types can be selected as virtual light.

また、設定される仮想光源のパラメータは、被写体を明るくする加算光の数、被写体を暗くする減算光の数、被写体に鏡面反射を付加する鏡面反射光の数などの仮想光源の数に関する値を含むようにしてもよい。 In addition, the virtual light source parameters that are set include values related to the number of virtual light sources, such as the number of additional lights that brighten the subject, the number of subtractive lights that darken the subject, and the number of specular lights that add specular reflection to the subject. It may be included.

また、仮想光源の位置と処理対象画素の距離Dの算出方法は、本実施形態の方向に限定されるものではなく、どのような算出方法をとってもよい。例えば、カメラの位置および被写体位置を3次元位置として取得し、3次元での距離で計算してもよい。 Further, the method of calculating the distance D between the position of the virtual light source and the pixel to be processed is not limited to the direction of this embodiment, and any calculation method may be used. For example, the camera position and subject position may be acquired as three-dimensional positions, and the distance may be calculated in three dimensions.

また、仮想光源を付加する場合に、距離の二乗に反比例する式で計算したが、仮想光源の付加量をこの方式で算出するものに限定されるものではない。例えば、距離Dに反比例するものや、ガウス分布的に照射範囲が変化する式であってもよい。 Further, when adding a virtual light source, calculation was performed using a formula that is inversely proportional to the square of the distance, but the amount of added virtual light sources is not limited to calculation using this method. For example, a formula that is inversely proportional to the distance D or a formula that changes the irradiation range in a Gaussian distribution may be used.

また、本実施形態では、複数の被写体検出手段として顔・顔器官検出手段と頭部検出手段の例を用いて説明したが、これに限るものではなく、他の被写体領域検出手段を用いても構わない。 Furthermore, in this embodiment, the description has been made using an example of a face/facial organ detection means and a head detection means as a plurality of object detection means, but the present invention is not limited to this, and other object area detection means may also be used. I do not care.

また、上述した例では、人を被写体として検出する場合について説明したが、被写体は人に限られるものでは無く、予め決められた被写体(例えば、車、動物、植物など)を検出してもよい。 Furthermore, in the above example, the case where a person is detected as the subject is explained, but the subject is not limited to a person, and a predetermined subject (for example, a car, an animal, a plant, etc.) may be detected. .

(他の実施形態)
また本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現できる。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現できる。
(Other embodiments)
The present invention also provides a system or device with a program that implements one or more functions of the above-described embodiments via a network or a storage medium, and one or more processors in a computer of the system or device reads the program. This can also be achieved by executing a process. It can also be implemented by a circuit (eg, ASIC) that implements one or more functions.

発明は上記実施形態に制限されるものではなく、発明の精神及び範囲から離脱することなく、様々な変更及び変形が可能である。従って、発明の範囲を公にするために請求項を添付する。 The invention is not limited to the embodiments described above, and various changes and modifications can be made without departing from the spirit and scope of the invention. Therefore, the following claims are hereby appended to disclose the scope of the invention.

50:システム制御部、101:光学系、102:シャッター、103:撮像部、104:A/D変換器、105:画像処理部、106:画像メモリ、107:メモリ制御部、109:表示部、113:顔・顔器官検出部、114:リライティング処理部、115:頭部検出部 50: system control unit, 101: optical system, 102: shutter, 103: imaging unit, 104: A/D converter, 105: image processing unit, 106: image memory, 107: memory control unit, 109: display unit, 113: Face/facial organ detection section, 114: Rewriting processing section, 115: Head detection section

Claims (13)

撮影画像を取得する取得手段と、
前記撮影画像に含まれる被写体を検出する複数の検出手段と、
前記被写体を照明する仮想的な光源である仮想光源を設定する設定手段と、
前記設定手段が設定した仮想光源を用いて前記撮影画像の明るさを補正する補正手段と、を備え、
前記設定手段は、前記複数の検出手段による1つの被写体についての検出結果に基づいて、前記1つの被写体についての前記複数の検出手段の検出結果それぞれについて被写体検出の信頼度を別々に算出し、別々に算出された信頼度を平均することにより、明るさを補正すべき被写体である信頼度を示すリライティング信頼度を算出し、算出されたリライティング信頼度に基づいて、前記仮想光源のパラメータを設定することを特徴とする画像処理装置。
an acquisition means for acquiring a photographed image;
a plurality of detection means for detecting subjects included in the captured image;
a setting means for setting a virtual light source that is a virtual light source that illuminates the subject;
a correction means for correcting the brightness of the photographed image using the virtual light source set by the setting means,
The setting means separately calculates reliability of object detection for each of the detection results of the plurality of detection means for the one object based on the detection results of the one object by the plurality of detection means, and A relighting reliability indicating the reliability of the subject whose brightness should be corrected is calculated by averaging the reliability calculated in , and parameters of the virtual light source are set based on the calculated relighting reliability. An image processing device characterized by:
前記撮影画像に含まれる複数の被写体の前記リライティング信頼度が全て所定の閾値以上である場合に、前記設定手段は、前記複数の被写体の全てを前記仮想光源で照明するように、前記仮想光源のパラメータを設定することを特徴とする請求項1に記載の画像処理装置。 When the relighting reliabilities of the plurality of subjects included in the captured image are all equal to or higher than a predetermined threshold, the setting means adjusts the virtual light source so that all of the plurality of subjects are illuminated with the virtual light source. The image processing apparatus according to claim 1, wherein parameters are set. 前記撮影画像に含まれる複数の被写体の前記リライティング信頼度のうち所定の閾値より小さいものがある場合、前記設定手段は、前記複数の被写体から1つまたは複数の主要被写体を選択し、該1つまたは複数の主要被写体の前記リライティング信頼度が全て前記所定の閾値以上である場合に、前記設定手段は、前記1つまたは複数の主要被写体の全てを前記仮想光源で照明するように、前記仮想光源のパラメータを設定することを特徴とする請求項1に記載の画像処理装置。 If some of the rewriting reliability of a plurality of subjects included in the photographed image is smaller than a predetermined threshold, the setting means selects one or more main subjects from the plurality of subjects, and selects one or more main subjects from the plurality of subjects, and Alternatively, when the relighting reliabilities of a plurality of main subjects are all greater than or equal to the predetermined threshold, the setting means sets the virtual light source to illuminate all of the one or more main subjects with the virtual light source. The image processing apparatus according to claim 1, wherein the image processing apparatus sets parameters of . 前記撮影画像に含まれる複数の被写体の前記リライティング信頼度のうち所定の閾値より小さいものがある場合、前記設定手段は、前記複数の被写体から1つまたは複数の主要被写体を選択し、該1つまたは複数の主要被写体の前記リライティング信頼度のうち前記所定の閾値より小さいものがある場合、前記補正手段は、前記仮想光源を用いた補正を行わないことを特徴とする請求項1に記載の画像処理装置。 If some of the rewriting reliability of a plurality of subjects included in the photographed image is smaller than a predetermined threshold, the setting means selects one or more main subjects from the plurality of subjects, and selects one or more main subjects from the plurality of subjects, and The image according to claim 1, wherein the correction means does not perform correction using the virtual light source if any of the relighting reliability of a plurality of main subjects is smaller than the predetermined threshold value. Processing equipment. 前記補正手段は、前記仮想光源を用いた補正を行わない場合に、画面全体について明るさを補正することを特徴とする請求項4に記載の画像処理装置。 5. The image processing apparatus according to claim 4, wherein the correction means corrects the brightness of the entire screen when the correction using the virtual light source is not performed. 前記設定手段は、前記複数の検出手段による被写体の検出数が一致する場合写体の検出数が異なる場合よりも、前記リライティング信頼度を高く算出することを特徴とする請求項1乃至5のいずれか1項に記載の画像処理装置。 The setting means calculates the rewriting reliability higher when the number of objects detected by the plurality of detection means matches than when the number of objects detected is different. 5. The image processing device according to any one of 5. 前記設定手段が設定する前記仮想光源のパラメータは、前記仮想光源の位置、仮想光の照射範囲、仮想光の強度を含むことを特徴とする請求項1乃至のいずれか1項に記載の画像処理装置。 The image according to any one of claims 1 to 6 , wherein the parameters of the virtual light source set by the setting means include a position of the virtual light source, an irradiation range of the virtual light, and an intensity of the virtual light. Processing equipment. 前記設定手段が設定する前記仮想光源のパラメータは、被写体を明るくする加算光、被写体を暗くする減算光、被写体に鏡面反射を付加する鏡面反射光を含む複数の種類の仮想光のいずれかを示すパラメータを含むことを特徴とする請求項1乃至のいずれか1項に記載の画像処理装置。 The parameters of the virtual light source set by the setting means indicate any of a plurality of types of virtual light including additive light that brightens the subject, subtracted light that darkens the subject, and specular light that adds specular reflection to the subject. The image processing apparatus according to any one of claims 1 to 7 , characterized in that the image processing apparatus includes a parameter. 前記設定手段が設定する仮想光源のパラメータは、被写体を明るくする加算光の数、被写体を暗くする減算光の数、被写体に鏡面反射を付加する鏡面反射光の数を含む複数の種類の仮想光の数を示すパラメータを含むことを特徴とする請求項1乃至のいずれか1項に記載の画像処理装置。 The virtual light source parameters set by the setting means include a plurality of types of virtual light including the number of additional lights that brighten the subject, the number of subtractive lights that darken the subject, and the number of specularly reflected lights that add specular reflection to the subject. 9. The image processing apparatus according to claim 1, further comprising a parameter indicating the number of images. 被写体を撮影して、前記撮影画像を出力する撮像手段と、
請求項1乃至のいずれか1項に記載の画像処理装置と、
を備えることを特徴とする撮像装置。
an imaging means for photographing a subject and outputting the photographed image;
An image processing device according to any one of claims 1 to 9 ,
An imaging device comprising:
撮影画像を取得する取得手段と、前記撮影画像に含まれる被写体を検出する複数の検出手段と、を備える画像処理装置を制御する方法であって、
前記被写体を照明する仮想的な光源である仮想光源を設定する設定工程と、
前記設定工程において設定された仮想光源を用いて前記撮影画像の明るさを補正する補正工程と、を備え、
前記設定工程では、前記複数の検出手段による1つの被写体についての検出結果に基づいて、前記1つの被写体についての前記複数の検出手段の検出結果それぞれについて被写体検出の信頼度を別々に算出し、別々に算出された信頼度を平均することにより、明るさを補正すべき被写体である信頼度を示すリライティング信頼度を算出し、算出されたリライティング信頼度に基づいて、前記仮想光源のパラメータを設定することを特徴とする画像処理装置の制御方法。
A method for controlling an image processing apparatus, comprising: an acquisition means for acquiring a photographed image; and a plurality of detection means for detecting a subject included in the photographed image, the method comprising:
a setting step of setting a virtual light source that is a virtual light source that illuminates the subject;
a correction step of correcting the brightness of the photographed image using the virtual light source set in the setting step,
In the setting step, the reliability of object detection is separately calculated for each of the detection results of the plurality of detection means for the one object based on the detection results of the one object by the plurality of detection means, and A relighting reliability indicating the reliability of the subject whose brightness should be corrected is calculated by averaging the reliability calculated in , and parameters of the virtual light source are set based on the calculated relighting reliability. A method for controlling an image processing device, characterized in that:
コンピュータを、請求項1乃至のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラム。 A program for causing a computer to function as each means of the image processing apparatus according to claim 1 . コンピュータを、請求項1乃至のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラムを記憶したコンピュータが読み取り可能な記憶媒体。 A computer-readable storage medium storing a program for causing a computer to function as each means of the image processing apparatus according to any one of claims 1 to 9 .
JP2019083205A 2019-04-24 2019-04-24 Image processing device and its processing method, imaging device, program, storage medium Active JP7356255B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019083205A JP7356255B2 (en) 2019-04-24 2019-04-24 Image processing device and its processing method, imaging device, program, storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019083205A JP7356255B2 (en) 2019-04-24 2019-04-24 Image processing device and its processing method, imaging device, program, storage medium

Publications (2)

Publication Number Publication Date
JP2020181330A JP2020181330A (en) 2020-11-05
JP7356255B2 true JP7356255B2 (en) 2023-10-04

Family

ID=73024706

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019083205A Active JP7356255B2 (en) 2019-04-24 2019-04-24 Image processing device and its processing method, imaging device, program, storage medium

Country Status (1)

Country Link
JP (1) JP7356255B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018182699A (en) 2017-04-21 2018-11-15 キヤノン株式会社 Image processing apparatus, control method of the same, program, and storage medium
JP2019004290A (en) 2017-06-14 2019-01-10 キヤノン株式会社 Image processing apparatus, imaging apparatus, image processing method and program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6412386B2 (en) * 2014-09-26 2018-10-24 キヤノン株式会社 Image processing apparatus, control method therefor, program, and recording medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018182699A (en) 2017-04-21 2018-11-15 キヤノン株式会社 Image processing apparatus, control method of the same, program, and storage medium
JP2019004290A (en) 2017-06-14 2019-01-10 キヤノン株式会社 Image processing apparatus, imaging apparatus, image processing method and program

Also Published As

Publication number Publication date
JP2020181330A (en) 2020-11-05

Similar Documents

Publication Publication Date Title
JP6442209B2 (en) Image processing apparatus and control method thereof
JP6833415B2 (en) Image processing equipment, image processing methods, and programs
JP6381404B2 (en) Image processing apparatus and method, and imaging apparatus
JP6412386B2 (en) Image processing apparatus, control method therefor, program, and recording medium
JP7277158B2 (en) Setting device and method, program, storage medium
US10863103B2 (en) Setting apparatus, setting method, and storage medium
US11893716B2 (en) Image processing apparatus and image processing method, and image capturing apparatus
JP7307541B2 (en) IMAGE PROCESSING DEVICE, IMAGING DEVICE, IMAGE PROCESSING METHOD, AND PROGRAM
JP6718253B2 (en) Image processing apparatus and image processing method
JP7114335B2 (en) IMAGE PROCESSING DEVICE, CONTROL METHOD FOR IMAGE PROCESSING DEVICE, AND PROGRAM
JP6937603B2 (en) Image processing equipment and its control methods, programs, and storage media
JP6921606B2 (en) Image processing equipment, image processing methods and programs
JP2017138927A (en) Image processing device, imaging apparatus, control method and program thereof
JP7356255B2 (en) Image processing device and its processing method, imaging device, program, storage medium
JP7398939B2 (en) Image processing device and its control method, imaging device, program, and storage medium
JP7311995B2 (en) IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM
JP7462464B2 (en) Image processing device and method, program, and storage medium
JP7446080B2 (en) Image processing device, imaging device, control method, program and imaging system
JP7011694B2 (en) Image processing equipment and its control method, program
JP6663246B2 (en) Image processing apparatus, imaging apparatus, control method thereof, and program
US20200051212A1 (en) Image processing apparatus, image processing method, and storage medium
JP2021087125A (en) Image processing device, control method thereof, and program
JP2019037004A (en) Image processing apparatus, control method thereof, and program
JP2019003694A (en) Image processing apparatus, control method of the same, and program

Legal Events

Date Code Title Description
RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20210103

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210113

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20220425

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20230406

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230508

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230703

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: 20230825

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230922

R151 Written notification of patent or utility model registration

Ref document number: 7356255

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151