JP2020005084A - Image processing apparatus, image processing method, and program - Google Patents

Image processing apparatus, image processing method, and program Download PDF

Info

Publication number
JP2020005084A
JP2020005084A JP2018121853A JP2018121853A JP2020005084A JP 2020005084 A JP2020005084 A JP 2020005084A JP 2018121853 A JP2018121853 A JP 2018121853A JP 2018121853 A JP2018121853 A JP 2018121853A JP 2020005084 A JP2020005084 A JP 2020005084A
Authority
JP
Japan
Prior art keywords
light source
virtual light
image
unit
image processing
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
JP2018121853A
Other languages
Japanese (ja)
Other versions
JP7207876B2 (en
Inventor
尚子 渡澤
Naoko Tozawa
尚子 渡澤
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 JP2018121853A priority Critical patent/JP7207876B2/en
Publication of JP2020005084A publication Critical patent/JP2020005084A/en
Application granted granted Critical
Publication of JP7207876B2 publication Critical patent/JP7207876B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Studio Circuits (AREA)
  • Studio Devices (AREA)

Abstract

To make it easy for a user to set a virtual light source that can obtain a desired irradiation result.SOLUTION: An image processing apparatus (100) includes acquisition means (103) that acquires a captured image of a subject, setting means (50) that sets a virtual light source, correction means (114) that corrects the brightness of a specific subject in the captured image using the virtual light source, generating means (50) that generates a virtual light source state image representing a positional relationship between the subject and the virtual light source, and control means (50, 109) that superimposes the virtual light source state image on the captured image or the image after the brightness correction and displays the image.SELECTED DRAWING: Figure 1

Description

本発明は、画像の明るさ等を補正する技術に関する。   The present invention relates to a technique for correcting brightness or the like of an image.

従来、撮影後の画像内の被写体に対して、仮想的な光源からの光を照射するライティング処理技術が知られている。これにより、環境光によって生じた影などの暗部領域を明るくし、好ましい画像を得ることが可能となる。例えば特許文献1には、撮影画像に対する疑似的なライティング処理技術として、顔領域全体の平均輝度よりも低い輝度領域を影領域として抽出し、その抽出した影領域の明度を上げるような技術が開示されている。これにより顔の影を抑えることができる。また特許文献1の技術では、ライティングエリアとライティング方向とライティング強度といったライティングパラメータを設定することにより、被写体に対する仮想光源の照射範囲・方向・強度を調整することも可能になされている。さらに特許文献1には、ライティングパラメータを表すパラメータ画像を、ライティング処理で明るさが補正された後の画像に重畳表示することも開示されている。ユーザは、ライティング処理による補正後の画像と重畳表示されたパラメータ画像とを参照しながらライティングパラメータを設定することにより、被写体に対する仮想光源の照射範囲・方向・強度を調整することができる。   2. Description of the Related Art Conventionally, there has been known a lighting processing technique of irradiating a subject in a captured image with light from a virtual light source. As a result, it is possible to brighten a dark area such as a shadow caused by environmental light and obtain a preferable image. For example, Patent Literature 1 discloses, as a pseudo lighting processing technique for a captured image, a technique in which a brightness area lower than the average brightness of the entire face area is extracted as a shadow area, and the brightness of the extracted shadow area is increased. Have been. Thereby, the shadow of the face can be suppressed. In the technique of Patent Document 1, it is also possible to adjust the irradiation range, direction, and intensity of the virtual light source with respect to the subject by setting lighting parameters such as a writing area, a lighting direction, and a lighting intensity. Further, Patent Document 1 discloses that a parameter image representing a lighting parameter is superimposed and displayed on an image whose brightness has been corrected by the lighting process. The user can adjust the irradiation range, direction, and intensity of the virtual light source with respect to the subject by setting the lighting parameters while referring to the image after correction by the lighting process and the parameter image superimposed and displayed.

特開2010−135996号公報JP 2010-135996 A

ライティング処理によって陰影を補正する際には、ライティングパラメータを適切に設定する必要があり、ライティングパラメータが適切に設定されていない場合、絵柄によってはライティング処理後の画像が不自然なものになってしまう。例えば、被写体に対して斜め上の方向から仮想光源を照射する場合と、被写体に対して真横から仮想光源を照射する場合とでは、被写体上において仮想光源からの光の当たり具合は大きく異なる。例えば特許文献1の手法の場合、パラメータ画像は仮想光源の範囲、方向、強度が2次元的に表現されているため、2次元上の被写体に対して斜め上方向から仮想光源を照射するような場合、適切なライティングパラメータを設定することが非常に難しい。つまり、ユーザは、2次元的に表されたパラメータ画像を参照し、同じく2次元的に表された被写体に対して斜め上方向から仮想光源を照射する場合を想定して、照射範囲・方向・強度のライティングパラメータを設定するような難しい設定作業が必要となる。そして、このような難しい設定を行ったとしても、ユーザが意図した通りの照射結果が得られないことが多い。   When correcting shadows by the lighting process, it is necessary to appropriately set the lighting parameters. If the lighting parameters are not set properly, the image after the lighting process becomes unnatural depending on a picture. . For example, when the virtual light source is irradiated on the subject from an obliquely upward direction, and when the virtual light source is irradiated on the subject from right beside, the degree of the light from the virtual light source on the subject is greatly different. For example, in the case of the method disclosed in Patent Document 1, the range, direction, and intensity of the virtual light source are expressed two-dimensionally in the parameter image. In that case, it is very difficult to set appropriate lighting parameters. In other words, the user refers to the two-dimensionally expressed parameter image, and supposes that the virtual light source is illuminated from an obliquely upward direction on the subject, which is also two-dimensionally expressed. A difficult setting operation such as setting the intensity lighting parameter is required. And even if such a difficult setting is performed, the irradiation result intended by the user is often not obtained.

そこで、本発明は、ユーザが所望する照射結果が得られる仮想光源を設定し易くすることを目的とする。   Therefore, an object of the present invention is to make it easy for a user to set a virtual light source that can obtain a desired irradiation result.

本発明の画像処理装置は、被写体を撮影した撮影画像を取得する取得手段と、仮想光源を設定する設定手段と、前記仮想光源を用いて前記撮影画像の特定の被写体の明るさを補正する補正手段と、前記特定の被写体と前記仮想光源との位置関係を表わす仮想光源状態画像を生成する生成手段と、前記撮影画像または前記明るさ補正後の画像に対し、前記仮想光源状態画像を重畳して表示させる制御手段と、を有することを特徴とする。   An image processing apparatus according to the present invention includes: an obtaining unit that obtains a captured image of a subject; a setting unit that sets a virtual light source; and a correction that corrects the brightness of a specific subject in the captured image using the virtual light source. Means, generating means for generating a virtual light source state image representing a positional relationship between the specific subject and the virtual light source, and superimposing the virtual light source state image on the captured image or the image after the brightness correction. And control means for displaying the information.

本発明によれば、ユーザが所望する照射結果が得られる仮想光源を設定し易くすることが可能となる。   ADVANTAGE OF THE INVENTION According to this invention, it becomes possible to make it easy for a user to set the virtual light source which obtains a desired irradiation result.

画像処理装置の適用例の構成を示すブロック図である。FIG. 14 is a block diagram illustrating a configuration of an application example of the image processing apparatus. 画像処理部の構成を示すブロック図である。FIG. 3 is a block diagram illustrating a configuration of an image processing unit. リライティング処理部の構成を示すブロック図である。FIG. 3 is a block diagram illustrating a configuration of a rewriting processing unit. 仮想光源の照射とその反射の説明に用いる図である。It is a figure used for description of irradiation of a virtual light source, and its reflection. リライティング処理前後の画像例を示す図である。It is a figure showing an example of an image before and after rewriting processing. 第1の実施形態に係るリライティング処理のフローチャートである。5 is a flowchart of a rewriting process according to the first embodiment. リライティングお薦めマークを説明する図である。It is a figure explaining a rewriting recommendation mark. 仮想光源状態画像の例を説明する図である。FIG. 7 is a diagram illustrating an example of a virtual light source state image. 第2の実施形態に係るリライティング処理のフローチャートである。It is a flowchart of the rewriting process according to the second embodiment.

以下、本発明の好ましい実施の形態を、添付の図面に基づいて詳細に説明する。なお、以下の実施形態において示す構成は一例にすぎず、本発明は図示された構成に限定されるものではない。
<第1の実施形態>
以下、本発明に係る画像処理装置の一適用例として、第1の実施形態ではデジタルカメラを挙げて説明する。
図1(a)は、本実施形態のデジタルカメラ100の概略的な構成例を示すブロック図である。なお、図1(b)の構成については後述する第2の実施形態において説明する。
Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings. Note that the configurations described in the following embodiments are merely examples, and the present invention is not limited to the illustrated configurations.
<First embodiment>
Hereinafter, a digital camera will be described in a first embodiment as an application example of the image processing apparatus according to the present invention.
FIG. 1A is a block diagram illustrating a schematic configuration example of a digital camera 100 according to the present embodiment. The configuration of FIG. 1B will be described in a second embodiment described later.

レンズ群101は、フォーカスレンズとズームレンズおよび絞りを備えた撮像光学系であり、撮像部103が備える撮像素子上に被写体等の光学像を結像させる。シャッター102は、例えばフォーカルプレーンシャッターであり、システム制御部50による制御の下で開閉動作が行われる。
撮像部103は、レンズ群101を介して撮像素子上に形成された光学像を光電変換により電気信号に変換してアナログ画像信号を出力する。撮像部103の撮像素子は、CCDイメージセンサ又はCMOSイメージセンサである。撮像素子の撮像面には、三原色のR(赤),G(緑),B(青)の各色成分に対応したカラーフィルタがいわゆるベイヤー配列と呼ばれる配列で画素毎に設けられている。このため、撮像部103からは、ベイヤー配列に対応したRGBの各画素の色信号からなるアナログ画像信号が出力される。
A/D変換部104は、撮像部103から出力されたアナログ画像信号をデジタル画像データに変換し、その画像データを画像処理部105とメモリ制御部107に出力する。
The lens group 101 is an imaging optical system including a focus lens, a zoom lens, and a diaphragm, and forms an optical image of a subject or the like on an imaging element included in the imaging unit 103. The shutter 102 is, for example, a focal plane shutter, and opens and closes under the control of the system control unit 50.
The imaging unit 103 converts an optical image formed on the imaging element via the lens group 101 into an electric signal by photoelectric conversion and outputs an analog image signal. The imaging device of the imaging unit 103 is a CCD image sensor or a CMOS image sensor. On the imaging surface of the imaging device, color filters corresponding to the three primary color components of R (red), G (green), and B (blue) are provided for each pixel in a so-called Bayer array. For this reason, the imaging unit 103 outputs an analog image signal composed of color signals of RGB pixels corresponding to the Bayer array.
The A / D conversion unit 104 converts the analog image signal output from the imaging unit 103 into digital image data, and outputs the image data to the image processing unit 105 and the memory control unit 107.

測距センサ123は、デジタルカメラ100から被写体までの間の被写体距離を測定するセンサであり、撮像部103による撮像画像の画素単位に対応した距離情報を出力する。測距センサ123から出力された画素単位の距離情報は、メモリ制御部107を介して、画像メモリ106に一時的に記憶され、また、後述する画像処理部105に送られる。   The distance measurement sensor 123 is a sensor that measures a subject distance from the digital camera 100 to the subject, and outputs distance information corresponding to a pixel unit of an image captured by the imaging unit 103. The pixel-by-pixel distance information output from the distance measurement sensor 123 is temporarily stored in the image memory 106 via the memory control unit 107 and sent to the image processing unit 105 described later.

画像メモリ106は、メモリ制御部107による制御の下、撮像部103にて撮像されてA/D変換部104でデジタル変換された画像データや、測距センサ123からの画素単位の距離情報を、一時的に記憶する。また、画像メモリ106は、I/F部111を介して記録媒体112から読み込まれた画像データや、表示部109に表示するための画像データ等の記憶も行う。
記録媒体112は、例えば半導体メモリカードやカード型ハードディスク等であり、デジタルカメラ100に着脱可能となされており、このデジタルカメラ100にて撮影された画像データや他のデジタルカメラにより撮影された画像データ等が記録される。
I/F部111は、記録媒体112とデジタルカメラ100とを電気的に接続するインターフェース部である。デジタルカメラ100にて撮影された画像データはI/F部111を介して記録媒体112に送られて記録され、また、記録媒体112から読み出された画像データはI/F部111を介して画像メモリ106等に送られる。
The image memory 106 stores image data captured by the image capturing unit 103 and digitally converted by the A / D converter 104 under the control of the memory control unit 107, and distance information in pixel units from the distance measurement sensor 123. Remember temporarily. The image memory 106 also stores image data read from the recording medium 112 via the I / F unit 111, image data to be displayed on the display unit 109, and the like.
The recording medium 112 is, for example, a semiconductor memory card, a card-type hard disk, or the like, and is detachable from the digital camera 100. Image data taken by the digital camera 100 or image data taken by another digital camera Etc. are recorded.
The I / F unit 111 is an interface unit that electrically connects the recording medium 112 and the digital camera 100. Image data photographed by the digital camera 100 is sent to and recorded on the recording medium 112 via the I / F unit 111, and image data read from the recording medium 112 is transmitted via the I / F unit 111. The data is sent to the image memory 106 and the like.

顔検出部113は、撮像部103で撮像された画像や、画像メモリ106から読み出された画像、記録媒体112から読み出された画像等に対して、所定の画像解析処理を行うことにより、その画像内から人の顔が映っている領域を検出する。顔検出部113により検出された顔検出結果のデータは、画像メモリ106に一時的に記憶され、また必要に応じて画像メモリ106から読み出されて後述する画像処理部105やシステム制御部50に送られる。   The face detection unit 113 performs a predetermined image analysis process on an image captured by the imaging unit 103, an image read from the image memory 106, an image read from the recording medium 112, and the like. An area where a human face is reflected is detected from the image. The data of the face detection result detected by the face detection unit 113 is temporarily stored in the image memory 106, and is read out from the image memory 106 as needed, and is sent to the image processing unit 105 and the system control unit 50 to be described later. Sent.

D/A変換器108は、撮像部103にて撮像されてA/D変換部104から出力された画像データや画像メモリ106から読み出された画像データ、記録媒体112から読み出された画像データ等を、アナログ映像信号に変換して表示部109に出力する。
表示部109は、LCD(液晶ディスプレイ)等の表示装置を有し、D/A変換器108から出力されたアナログ映像信号に基づく画像を表示する。表示部109には、撮影等された画像や、いわゆるライブビュー表示の際に撮像部103にて撮像されているライブビュー画像等が表示されることになる。また、表示部109には、デジタルカメラ100をユーザが操作等する際のユーザインターフェース画像も表示される。
操作部120は、デジタルカメラ100のシャッターボタンや各種スイッチ、表示部109の画面上等に配されたタッチパネル等を含み、ユーザによる操作を検知し、その検知した操作情報をシステム制御部50に通知する。
The D / A converter 108 captures image data from the imaging unit 103 and outputs the image data from the A / D conversion unit 104, the image data read from the image memory 106, and the image data read from the recording medium 112. Are converted into analog video signals and output to the display unit 109.
The display unit 109 has a display device such as an LCD (liquid crystal display), and displays an image based on the analog video signal output from the D / A converter 108. The display unit 109 displays a captured image, a live view image captured by the image capturing unit 103 during so-called live view display, and the like. The display unit 109 also displays a user interface image when the user operates the digital camera 100 or the like.
The operation unit 120 includes a shutter button and various switches of the digital camera 100, a touch panel disposed on a screen of the display unit 109, and the like, detects an operation by a user, and notifies the system control unit 50 of the detected operation information. I do.

コーデック部110は、画像データを圧縮符号化・復号化する。コーデック部110は、画像メモリ106に記憶された画像データを、JPEGやMPEGなどの規格に準拠した形式で圧縮符号化する。コーデック部110にて圧縮符号化された画像データは、システム制御部50による制御の下、I/F部111を介して記録媒体112に記録される。また、コーデック部110は、システム制御部50による制御の下、I/F部111を介して記録媒体112から読み出された、圧縮符号化された画像データの復号化を行うことも可能である。   The codec unit 110 performs compression encoding / decoding of image data. The codec 110 compresses and encodes the image data stored in the image memory 106 in a format conforming to a standard such as JPEG or MPEG. The image data compressed and encoded by the codec unit 110 is recorded on the recording medium 112 via the I / F unit 111 under the control of the system control unit 50. Also, the codec unit 110 can decode the compression-encoded image data read from the recording medium 112 via the I / F unit 111 under the control of the system control unit 50. .

不揮発性メモリ121は、補助記憶装置として、プログラムやパラメータなどを格納するEEPROMなどの不揮発性の半導体メモリを含む。
システムメモリ122は、主記憶装置として、不揮発性メモリ121から読み出したプログラム等を展開する他、システム制御部50の動作用の定数、変数を記憶する。すなわちシステムメモリ122には、システム制御部50の動作用の定数、変数、不揮発性メモリ121から読み出したプログラム等が展開される。
The nonvolatile memory 121 includes, as an auxiliary storage device, a nonvolatile semiconductor memory such as an EEPROM that stores programs, parameters, and the like.
The system memory 122, as a main storage device, stores programs and the like read from the nonvolatile memory 121, and stores constants and variables for operation of the system control unit 50. That is, in the system memory 122, constants and variables for operation of the system control unit 50, programs read from the nonvolatile memory 121, and the like are expanded.

システム制御部50は、CPU又はMPUを含み、不揮発性メモリ121に記憶されているプログラムをシステムメモリ122の作業領域に展開することにより実行して、本実施形態のデジタルカメラ100全体の各機能を制御する。例えば、システム制御部50は、ユーザによる操作部120の操作入力や設定状態を基に、撮影の制御や、各種画像処理の制御、後述するリライティング処理の制御、カメラ動作モードの切り替え等の各種の制御を行う。本実施形態に係るプログラムには、デジタルカメラ100における被写体撮影時の基本動作プログラムの他に、後述するリライティング処理の制御や仮想光源状態画像の重畳表示等を行うためのプログラムも含まれる。システム制御部50が実行するプログラムは、不揮発性メモリ121に予め格納されている場合だけでなく、記録媒体112等から取得されてもよく、或いは不図示のネットワーク等を介して取得されてもよい。   The system control unit 50 includes a CPU or an MPU, executes a program stored in the nonvolatile memory 121 by expanding the program in a work area of the system memory 122, and executes each function of the entire digital camera 100 of the present embodiment. Control. For example, the system control unit 50 controls various operations such as control of shooting, control of various image processes, control of a rewriting process described later, switching of a camera operation mode, and the like, based on an operation input and a setting state of the operation unit 120 by the user. Perform control. The program according to the present embodiment includes, in addition to the basic operation program at the time of photographing a subject in the digital camera 100, a program for controlling rewriting processing to be described later, superimposing a virtual light source state image, and the like. The program executed by the system control unit 50 may be obtained not only from the case where it is stored in the nonvolatile memory 121 in advance, but also from the recording medium 112 or the like, or may be obtained via a network (not shown). .

画像処理部105は、撮像部103にて撮像された画像、あるいは画像メモリ106から読み出された画像に対して、ホワイトバランス処理、γ(ガンマ)処理、輪郭強調、色補正処理などの各種の画像処理を行う。また、画像処理部105は、顔検出部113による顔検出結果の情報や、撮像された画像データ、測距センサ123にて検出された画素単位の距離情報から生成した2次元の距離マップ等を用いて、露光制御や測距制御等に用いられる評価値を算出する。この算出された評価値の情報は、システム制御部50に送られる。   The image processing unit 105 performs various kinds of processing such as white balance processing, γ (gamma) processing, contour enhancement, and color correction processing on the image captured by the imaging unit 103 or the image read from the image memory 106. Perform image processing. The image processing unit 105 also outputs information on a face detection result by the face detection unit 113, captured image data, a two-dimensional distance map generated from pixel-by-pixel distance information detected by the distance measurement sensor 123, and the like. Then, an evaluation value used for exposure control, distance measurement control, and the like is calculated. Information on the calculated evaluation value is sent to the system control unit 50.

このときのシステム制御部50は、画像処理部105にて算出された評価値に基づいて、例えば被写体の顔に対して露出を合わせる露光制御や顔にピントを合わせる測距制御等を行う。具体的には、システム制御部50は、いわゆるTTL(スルー・ザ・レンズ)方式のAF(オートフォーカス)処理、AE(自動露出)処理、AWB(オートホワイトバランス)処理等の制御を行う。露光制御や測距制御等を行う際に用いられる評価値とその算出処理については公知の様々な技術を用いることができ、ここではそれらの説明及び図示は省略する。   At this time, based on the evaluation value calculated by the image processing unit 105, the system control unit 50 performs, for example, exposure control for adjusting exposure to the face of the subject, distance measurement control for adjusting focus to the face, and the like. Specifically, the system control unit 50 controls so-called TTL (through-the-lens) type AF (auto focus) processing, AE (auto exposure) processing, AWB (auto white balance) processing, and the like. Various known techniques can be used for the evaluation value used for performing the exposure control, the distance measurement control, and the like, and the calculation processing thereof, and the description and illustration thereof are omitted here.

リライティング処理部114は、撮像部103にて撮像された画像や、画像メモリ106から読み出された画像に対して、リライティング処理(ライティング処理)を行う。本実施形態に係るリライティング処理とは、画像中の特定の被写体等の領域に対して、仮想的な光源からの光を照射して明るさを補正する処理である。本実施形態に係るリライティング処理の詳細については後述する。   The rewriting processing unit 114 performs a rewriting process (writing process) on the image captured by the imaging unit 103 and the image read from the image memory 106. The relighting process according to the present embodiment is a process of correcting the brightness by irradiating light from a virtual light source to an area such as a specific subject in an image. The details of the rewriting process according to the present embodiment will be described later.

<画像処理部の概略構成>
図2は、画像処理部105の主な構成を示したブロック図である。
図2に示すように、画像処理部105は、同時化処理部200、WB増幅部201、輝度・色生成部202、輪郭強調部203、輝度ガンマ処理部204、色変換部205、色ガンマ処理部206、色差生成部207、陰影取得部208等を有している。
<Schematic configuration of image processing unit>
FIG. 2 is a block diagram illustrating a main configuration of the image processing unit 105.
As shown in FIG. 2, the image processing unit 105 includes a synchronization processing unit 200, a WB amplification unit 201, a luminance / color generation unit 202, a contour emphasis unit 203, a luminance gamma processing unit 204, a color conversion unit 205, and a color gamma processing. Unit 206, a color difference generation unit 207, a shadow acquisition unit 208, and the like.

画像処理部105において、同時化処理部200には、例えば撮像部103にて撮像されてA/D変換部104によりデジタル変換された画像データが入力される。同時化処理部200に入力される画像データは、前述したようにベイヤー配列に対応したR,G,Bのデータである。同時化処理部200は、ベイヤー配列に対応した画像データに対して同時化処理を行い、R,G,Bの各色信号(以下、RGB信号と表記する。)を生成する。同時化処理部200にて生成されたRGB信号は、WB増幅部201に送られる。   In the image processing unit 105, for example, image data captured by the imaging unit 103 and digitally converted by the A / D conversion unit 104 is input to the synchronization processing unit 200. The image data input to the synchronization processing unit 200 is R, G, and B data corresponding to the Bayer arrangement as described above. The synchronization processing unit 200 performs synchronization processing on image data corresponding to the Bayer array, and generates R, G, and B color signals (hereinafter, referred to as RGB signals). The RGB signals generated by the synchronization processing section 200 are sent to the WB amplification section 201.

WB増幅部201は、システム制御部50が算出するホワイトバランスゲイン値に基づき、RGB信号にゲインをかけてホワイトバランスを調整する処理を行う。WB増幅部201でホワイトバランスが調整されたRGB信号は、輝度・色生成部202に送られる。   The WB amplifying unit 201 performs a process of adjusting the white balance by applying a gain to the RGB signal based on the white balance gain value calculated by the system control unit 50. The RGB signals whose white balance has been adjusted by the WB amplifying unit 201 are sent to the luminance / color generating unit 202.

輝度・色生成部202は、ホワイトバランス調整後のRGB信号から輝度信号Yを生成し、その生成した輝度信号Yを輪郭強調部203へ出力する。また輝度・色生成部202は、RGB信号を色変換部205へ出力する。   The luminance / color generation unit 202 generates a luminance signal Y from the RGB signals after white balance adjustment, and outputs the generated luminance signal Y to the contour emphasis unit 203. Further, the luminance / color generation unit 202 outputs the RGB signals to the color conversion unit 205.

輪郭強調部203は、輝度・色生成部202から供給された輝度信号Yからなる画像に対して輪郭強調処理を行い、その輪郭強調処理後の輝度信号Yを輝度ガンマ処理部204へ出力する。輝度ガンマ処理部204は、輪郭強調部203から供給された輝度信号Yに対してガンマ補正を行う。このガンマ補正後の輝度信号Yは、画像メモリ106に送られて一時的に記憶される。   The contour emphasizing unit 203 performs a contour emphasizing process on the image composed of the luminance signal Y supplied from the luminance / color generating unit 202, and outputs the luminance signal Y after the contour emphasizing process to the luminance gamma processing unit 204. The luminance gamma processing unit 204 performs gamma correction on the luminance signal Y supplied from the contour emphasizing unit 203. The luminance signal Y after the gamma correction is sent to the image memory 106 and is temporarily stored.

色変換部205は、輝度・色生成部202から供給されたRGB信号に対してマトリクス演算などを行うことにより、所望のカラーバランスのRGB信号を生成して、色ガンマ処理部206と陰影取得部208へ出力する。色ガンマ処理部206は、色変換部205から供給されたRGB信号に対してガンマ補正を行って、色差生成部207へ出力する。色差生成部207は、色ガンマ処理部206にて色ガンマ処理がなされた後のRGB信号から、色差信号R−Y,B−Yを生成する。それら色差信号R−Y,B−Yは、画像メモリ106に送られて一時的に記憶される。   The color conversion unit 205 generates a RGB signal having a desired color balance by performing a matrix operation or the like on the RGB signals supplied from the luminance / color generation unit 202, and outputs a color gamma processing unit 206 and a shadow acquisition unit. 208. The color gamma processing unit 206 performs gamma correction on the RGB signals supplied from the color conversion unit 205, and outputs the result to the color difference generation unit 207. The color difference generation unit 207 generates color difference signals RY and BY from the RGB signals after the color gamma processing by the color gamma processing unit 206. The color difference signals RY and BY are sent to the image memory 106 and are temporarily stored.

なお、画像メモリ106に一時的に記憶された輝度信号Yと色差信号R−Y,B−Yからなる画像データは、その後、システム制御部50による制御の下で、図1(a)のコーデック部110に送られる。これにより、コーデック部110では、それら輝度信号Yと色差信号R−Y,B−Yからなる画像データを所定の規格に基づいて圧縮符号化する。そして、コーデック部110により圧縮符号化されたデータは、システム制御部50による制御の下、前述したように、I/F部111を介して記録媒体112に記録される。   The image data composed of the luminance signal Y and the chrominance signals RY and BY temporarily stored in the image memory 106 is then transferred to the codec of FIG. Sent to the unit 110. As a result, the codec 110 compresses and encodes the image data including the luminance signal Y and the color difference signals RY and BY based on a predetermined standard. The data compressed and encoded by the codec unit 110 is recorded on the recording medium 112 via the I / F unit 111 under the control of the system control unit 50 as described above.

陰影取得部208は、環境光源によって被写体に生じた陰影の状態を解析するための情報を取得する。また、陰影取得部208には、色変換部205からのRGB信号の他に、前述した顔検出部113にて顔が検出された場合にはその顔領域の情報も入力される。そして、陰影取得部208は、被写体の平均輝度情報および顔領域の輝度ヒストグラム情報などを陰影情報として取得する。陰影取得部208により取得された陰影情報は、システム制御部50に送られる。   The shadow obtaining unit 208 obtains information for analyzing the state of the shadow generated on the subject by the environmental light source. Further, in addition to the RGB signals from the color conversion unit 205, when a face is detected by the above-described face detection unit 113, information on the face area is also input to the shadow acquisition unit 208. Then, the shadow obtaining unit 208 obtains average brightness information of the subject, brightness histogram information of the face area, and the like as shadow information. The shadow information obtained by the shadow obtaining unit 208 is sent to the system control unit 50.

<リライティング処理部の概略構成>
図3は、リライティング処理部114の概略構成を示すブロック図である。
本実施形態のデジタルカメラ100において、リライティング処理は、リライティング処理を実行するカメラ動作モードがユーザにより選択されている場合に行われる。リライティング処理を実行するカメラ動作モードが選択されている場合、リライティング処理部114には、画像メモリ106から読み出された輝度信号Yおよび色差信号R−Y,B−Yが入力される。
<Schematic configuration of rewriting processing unit>
FIG. 3 is a block diagram illustrating a schematic configuration of the relighting processing unit 114.
In the digital camera 100 of the present embodiment, the rewriting process is performed when the camera operation mode for executing the rewriting process is selected by the user. When the camera operation mode for executing the rewriting process is selected, the luminance signal Y and the color difference signals RY and BY read from the image memory 106 are input to the rewriting processing unit 114.

図3において、リライティング処理部114は、RGB変換部301、デガンマ処理部302、反射成分算出部305、付加処理部306、ガンマ処理部307、輝度色差変換部308を有する。なお、図3に示されている距離算出部303と法線算出部304は例えば画像処理部105内に設けられている構成であるが、これらはリライティング処理部114に含まれていてもよいし、システム制御部50に含まれていてもよい。   3, the relighting processing unit 114 includes an RGB conversion unit 301, a degamma processing unit 302, a reflection component calculation unit 305, an addition processing unit 306, a gamma processing unit 307, and a luminance / color difference conversion unit 308. Although the distance calculation unit 303 and the normal line calculation unit 304 shown in FIG. 3 are provided, for example, in the image processing unit 105, they may be included in the rewriting processing unit 114. , May be included in the system control unit 50.

RGB変換部301は、入力された輝度信号Yと色差信号B−Y,R−YをRGB信号に変換し、その変換後のRGB信号をデガンマ処理部302へ出力する。
デガンマ処理部302は、RGB変換部301から入力されたRGB信号に対して、画像処理部105の色ガンマ処理部206で用いられたガンマ特性の逆特性を用いた演算処理(つまりデガンマ処理)を行うことによりRGBのリニアデータに変換する。そして、デガンマ処理部302は、そのデガンマ処理後のRGB信号(Rt信号、Gt信号、Bt信号)を、反射成分算出部305および付加処理部306に出力する。
The RGB conversion unit 301 converts the input luminance signal Y and color difference signals BY and RY into RGB signals, and outputs the converted RGB signals to the degamma processing unit 302.
The degamma processing unit 302 performs an arithmetic process (that is, degamma processing) on the RGB signal input from the RGB conversion unit 301 using the inverse characteristic of the gamma characteristic used in the color gamma processing unit 206 of the image processing unit 105. By doing so, the data is converted into RGB linear data. Then, the degamma processing unit 302 outputs the RGB signals (Rt signal, Gt signal, Bt signal) after the degamma processing to the reflection component calculation unit 305 and the addition processing unit 306.

距離算出部303は、測距センサ123により撮影画像の画素単位で取得された距離情報から2次元の距離マップを算出する。
法線算出部304は、距離算出部303にて算出された距離マップを基に、例えば顔検出部113により検出された顔等の領域の法線マップを算出する。距離マップから法線マップを生成する処理について図4を参照しながら説明する。
The distance calculation unit 303 calculates a two-dimensional distance map from the distance information acquired for each pixel of the captured image by the distance measurement sensor 123.
The normal calculating unit 304 calculates a normal map of an area such as a face detected by the face detecting unit 113 based on the distance map calculated by the distance calculating unit 303. The process of generating a normal map from a distance map will be described with reference to FIG.

図4は、デジタルカメラ100の撮影座標と顔等の特定の被写体401との間の位置関係を表した図である。前述した撮影画像の画素単位の距離情報に基づく2次元の距離マップを用いれば、例えば図4に示すように、被写体401について、撮影画像の水平方向の差分ΔHに対する、奥行き方向の距離Dの差分ΔDを算出することができる。また、その水平方向の差分ΔHと奥行き方向の距離Dの差分ΔDとから勾配を算出することができ、さらにその勾配から法線Nを算出することができる。法線算出部304は、撮影画像についてそのような処理を行うことにより、撮影画像の各画素に対応した法線Nを算出する。そして、法線算出部304は、撮影画像の各画素に対応した各法線Nを基に、2次元の法線マップを生成して反射成分算出部305に出力する。   FIG. 4 is a diagram showing a positional relationship between the shooting coordinates of the digital camera 100 and a specific subject 401 such as a face. By using the two-dimensional distance map based on the above-described pixel-based distance information of the captured image, for example, as shown in FIG. 4, for the subject 401, the difference of the distance D in the depth direction with respect to the horizontal difference ΔH of the captured image ΔD can be calculated. Further, the gradient can be calculated from the difference ΔH in the horizontal direction and the difference ΔD of the distance D in the depth direction, and the normal N can be calculated from the gradient. The normal line calculation unit 304 calculates the normal line N corresponding to each pixel of the captured image by performing such processing on the captured image. Then, the normal calculation unit 304 generates a two-dimensional normal map based on each normal N corresponding to each pixel of the captured image and outputs the map to the reflection component calculation unit 305.

反射成分算出部305は、仮想光源402から被写体401までの距離Kと、法線Nと、仮想光源402の方向ベクトルLとに基づいて、設定した仮想光源402が被写体401により反射される成分を算出する。例えば反射成分算出部305は、仮想光源402から被写体401までの距離Kの二乗に反比例し、被写体401の法線Nのベクトルと仮想光源402の方向ベクトルLとの内積に比例するように、撮影画像の各画素に対応した座標位置の反射成分を算出する。図4の例では、撮影画像の水平画素位置H1における反射成分は、水平画素位置H1の座標における法線N1と仮想光源402の方向ベクトルL1の内積に比例し、仮想光源402から被写体401までの距離K1の二乗に反比例する値となる。なお、簡略化のために、垂直画素位置における反射成分についての説明は省略する。   The reflection component calculation unit 305 calculates a component of the virtual light source 402 reflected by the subject 401 based on the distance K from the virtual light source 402 to the subject 401, the normal N, and the direction vector L of the virtual light source 402. calculate. For example, the reflection component calculation unit 305 performs shooting in such a manner that the reflection component calculation unit 305 is inversely proportional to the square of the distance K from the virtual light source 402 to the subject 401, and is proportional to the inner product of the vector of the normal line N of the subject 401 and the direction vector L of the virtual light source 402. The reflection component at the coordinate position corresponding to each pixel of the image is calculated. In the example of FIG. 4, the reflection component at the horizontal pixel position H1 of the captured image is proportional to the inner product of the normal N1 at the coordinates of the horizontal pixel position H1 and the direction vector L1 of the virtual light source 402. This value is inversely proportional to the square of the distance K1. For the sake of simplicity, description of the reflection component at the vertical pixel position will be omitted.

ここで、被写体からの仮想光源が当該被写体により反射される反射成分(Ra,Ga,Ba)は、下記の式(1)により表すことができる。なお、式(1)中のαは仮想光源の強さでありリライティング補正量のゲイン値である。また式中のLは仮想光源の3次元方向ベクトル、Nは被写体の3次元法線ベクトル、Kは仮想光源から被写体までの距離、Rt,Gt,Btは前述したデガンマ処理後のRGB信号である。   Here, the reflection components (Ra, Ga, Ba) of the virtual light source from the subject reflected by the subject can be represented by the following equation (1). Note that α in Expression (1) is the intensity of the virtual light source and is a gain value of the rewriting correction amount. In the equation, L is the three-dimensional direction vector of the virtual light source, N is the three-dimensional normal vector of the subject, K is the distance from the virtual light source to the subject, and Rt, Gt, and Bt are the RGB signals after the degamma process described above. .

Ra=α×(−L・N)/K^2×Rt
Ga=α×(−L・N)/K^2×Gt 式(1)
Ba=α×(−L・N)/K^2×Bt
Ra = α × (−L · N) / K ^ 2 × Rt
Ga = α × (−L · N) / K ^ 2 × Gt Equation (1)
Ba = α × (−L · N) / K ^ 2 × Bt

反射成分算出部305により前述のようにして算出された反射成分(Ra,Ga,Ba)は付加処理部306へ出力される。
付加処理部306は、デガンマ処理後のRGB信号(Rt,Gt,Bt)に、仮想光源成分(Ra,Ga,Ba)を付加する処理を行う。付加処理部306では、下記の式(2)により表されるような仮想光源付加処理を行うことで、付加処理後のRGB信号(Rout,Gout,Bout)を生成する。
The reflection components (Ra, Ga, Ba) calculated by the reflection component calculation unit 305 as described above are output to the additional processing unit 306.
The addition processing unit 306 performs a process of adding a virtual light source component (Ra, Ga, Ba) to the RGB signals (Rt, Gt, Bt) after the degamma processing. The addition processing unit 306 generates the RGB signals (Rout, Gout, Bout) after the addition processing by performing the virtual light source addition processing represented by the following equation (2).

Rout=Rt+Ra
Gout=Gt+Ga 式(2)
Bout=Bt+Ba
Rout = Rt + Ra
Gout = Gt + Ga Equation (2)
Bout = Bt + Ba

付加処理部306から出力されたRGB信号(Rout,Gout,Bout)は、ガンマ処理部307に入力される。
ガンマ処理部307は、RGB信号(Rout,Gout,Bout)に対してガンマ補正を行う。ガンマ処理部307では、画像処理部105の色ガンマ処理部206で用いられたガンマ特性によるガンマ補正が行われ、そのガンマ補正後のRGB信号(R'out,G'out,B'out)が輝度色差変換部308へ出力される。
The RGB signals (Rout, Gout, Bout) output from the additional processing unit 306 are input to the gamma processing unit 307.
The gamma processing unit 307 performs gamma correction on the RGB signals (Rout, Gout, Bout). The gamma processing unit 307 performs gamma correction based on the gamma characteristics used in the color gamma processing unit 206 of the image processing unit 105, and outputs the RGB signals (R'out, G'out, B'out) after the gamma correction. Output to the luminance / color difference conversion unit 308.

輝度色差変換部308は、入力されたRGB信号(R'out,G'out,B'out)から輝度信号Yと色差信号R−Y,B−Yを生成する。   The luminance / color difference conversion unit 308 generates a luminance signal Y and color difference signals RY, BY from the input RGB signals (R'out, G'out, B'out).

以上が、リライティング処理部114の動作である。図5(a)と図5(b)はリライティング処理前後の画像例を示した図である。図5(a)はリライティング処理前の撮影画像500の例であり、図5(b)はリライティング処理後の画像501の例である。リライティング処理は、図5(a)に示すように処理前の撮影画像500では暗かった被写体510に対して仮想光源520からの光を仮想的に当てた処理となる。このため、当該リライティング処理後には、図5(b)に示すように、明るく補正された被写体511の画像501が得られる。   The above is the operation of the rewriting processing unit 114. FIGS. 5A and 5B are diagrams showing examples of images before and after the rewriting process. FIG. 5A shows an example of the captured image 500 before the relighting process, and FIG. 5B shows an example of the image 501 after the relighting process. The relighting process is a process in which light from the virtual light source 520 is virtually applied to the subject 510 that is dark in the captured image 500 before the process as illustrated in FIG. For this reason, after the rewriting process, as shown in FIG. 5B, a brightly corrected image 501 of the subject 511 is obtained.

本実施形態において、システム制御部50は、リライティング処理部114が出力した輝度信号Yと色差信号R−Y,B−Yを、メモリ制御部107を介して画像メモリ106に蓄積した後、コーデック部110で圧縮符号化させる。また、システム制御部50は、I/F部111を介して記録媒体112に記録し、更には、表示部109においてリライティング処理後の画像を表示するよう制御する。   In the present embodiment, the system control unit 50 stores the luminance signal Y and the color difference signals RY and BY output from the relighting processing unit 114 in the image memory 106 via the memory control unit 107, and then stores the codec unit At 110, compression encoding is performed. Further, the system control unit 50 controls the recording unit 112 to record the image on the recording medium 112 via the I / F unit 111 and display the image after the rewriting process on the display unit 109.

なお、前述した図2の画像処理部105や図3のリライティング処理部114は、ハードウェア構成だけでなく、図2や図3の各部の処理をCPU等がプログラムを実行して実現するソフトウェア構成により実現されてもよい。また、一部がハードウェア構成で残りがソフトウェア構成により実現されてもよい。このソフトウェア構成のためのプログラムは、予め用意されている場合だけでなく、不図示の外部メモリ等の記録媒体から取得されたり、不図示のネットワーク等を介して取得されたりしてもよい。   The above-described image processing unit 105 in FIG. 2 and the relighting processing unit 114 in FIG. 3 have not only a hardware configuration but also a software configuration that realizes processing of each unit in FIGS. 2 and 3 by executing a program by a CPU or the like. May be realized by: Further, a part may be realized by a hardware configuration and the rest may be realized by a software configuration. The program for this software configuration is not limited to the case where it is prepared in advance, but may be obtained from a recording medium such as an external memory (not shown), or may be obtained via a network (not shown).

<仮想光源状態画像の重畳表示>
本実施形態のデジタルカメラ100は、前述したリライティング処理後の画像を表示部109に表示する際、仮想光源と被写体との位置関係を表す仮想光源状態画像を、撮影画像またはリライティング処理後の画像に重畳表示させる機能をも有している。
図6には、撮影画像に対するリライティング処理の実行から、仮想光源状態画像の重畳表示までの処理のフローチャートを示す。図6に示すフローチャートの処理は、システム制御部50が、本実施形態に係るプログラムを実行してデジタルカメラ100の各部を制御することにより実現される。なお、以下の説明では、各処理のステップS601〜ステップS616をS601〜S616と略記する。これらのことは後述する他のフローチャートにおいても同様であるとする。
<Superimposed display of virtual light source state image>
When displaying the image after the relighting process on the display unit 109, the digital camera 100 according to the present embodiment converts the virtual light source state image representing the positional relationship between the virtual light source and the subject into a captured image or an image after the relighting process. It also has the function of superimposed display.
FIG. 6 shows a flowchart of a process from execution of the relighting process on the captured image to superimposed display of the virtual light source state image. The process of the flowchart illustrated in FIG. 6 is realized by the system control unit 50 executing the program according to the present embodiment and controlling each unit of the digital camera 100. In the following description, steps S601 to S616 of each process are abbreviated as S601 to S616. The same applies to other flowcharts described later.

図6に示したフローチャートにおいて、S601からS606までの処理は、デジタルカメラ100において本撮影がなされる前に実行される処理である。なお、本実施形態のデジタルカメラ100の操作部120のシャッターボタンは半押し状態と全押し状態の二つの状態を取り得るボタンとなされている。シャッターボタンが半押し状態である時、システム制御部50は、デジタルカメラ100においてAF処理やAE処理、AWB処理、顔検出処理等が行われる本撮影前の動作状態に制御する。そして、シャッターボタンが半押し状態になされた時、システム制御部50は、デジタルカメラ100において本撮影を実行させるように各部を制御する。シャッターボタンの半押しや全押し時のカメラ動作については一般的なカメラと同様であるため、その詳細な説明は省略する。   In the flowchart shown in FIG. 6, the processes from S601 to S606 are processes executed before the main photographing is performed in the digital camera 100. Note that the shutter button of the operation unit 120 of the digital camera 100 of the present embodiment is a button that can take two states, a half-pressed state and a fully-pressed state. When the shutter button is half-pressed, the system control unit 50 controls the digital camera 100 to an operation state before the main shooting in which AF processing, AE processing, AWB processing, face detection processing, and the like are performed. Then, when the shutter button is half-pressed, the system control unit 50 controls each unit so that the digital camera 100 performs the main shooting. The camera operation when the shutter button is half-pressed or full-pressed is the same as that of a general camera, and a detailed description thereof will be omitted.

S601において、システム制御部50は、操作部120の操作情報から、ユーザがシャッターボタンを半押ししたことを検出すると、S602に処理を進める。
S602に進むと、システム制御部50は、カメラ動作モードがリライティング処理を実行するモードに設定されているか否か、つまりリライティング処理を実行するか否かを判定する。例えば事前にユーザにより操作部120が操作されてリライティング処理を実行するカメラ動作モードが設定されている場合、システム制御部50は、S603に処理を進める。一方、カメラ動作モードとしてリライティング処理を実行する動作モードが設定されていない場合、システム制御部50は、図6のフローチャートの処理を終了する。
In step S601, when the system control unit 50 detects from the operation information of the operation unit 120 that the user has half-pressed the shutter button, the process proceeds to step S602.
In S602, the system control unit 50 determines whether or not the camera operation mode is set to a mode for executing the rewriting process, that is, whether or not to execute the rewriting process. For example, when the camera operation mode in which the user operates the operation unit 120 to execute the rewriting process is set in advance, the system control unit 50 advances the process to S603. On the other hand, when the operation mode for executing the relighting process is not set as the camera operation mode, the system control unit 50 ends the processing of the flowchart in FIG.

S603に進むと、システム制御部50は、本撮影前に取得されている画像から顔検出部113により撮影対象の顔が検出されている場合にはその顔検出結果を取得する。具体的には、顔検出部113から、顔の座標位置やその座標位置の信頼度といった情報を取得する。   In step S603, if the face to be shot is detected by the face detection unit 113 from the image obtained before the main shooting, the system control unit 50 obtains the face detection result. Specifically, information such as the coordinate position of the face and the reliability of the coordinate position is obtained from the face detection unit 113.

次にS604とS605において、システム制御部50は、画像処理部105を制御して陰影取得部208における陰影情報の取得処理を実行させる。このとき、陰影取得部208は、S604において、顔検出部113による顔検出結果に応じた顔領域内の輝度情報として、当該顔領域内の平均輝度値や顔領域内の輝度ヒストグラムなどの輝度分布といった情報を取得する。またS605において、陰影取得部208は、顔領域外の輝度情報として、当該顔領域外の平均輝度値や輝度ヒストグラムなどの輝度分布といった情報を取得する。S605の後、システム制御部50は、S606に処理を進める。   Next, in steps S604 and S605, the system control unit 50 controls the image processing unit 105 to execute the shadow information acquisition processing in the shadow acquisition unit 208. At this time, in step S604, the shadow acquisition unit 208 determines, as luminance information in the face area according to the result of the face detection by the face detection unit 113, a luminance distribution such as an average luminance value in the face area or a luminance histogram in the face area. Get information such as. In step S605, the shading obtaining unit 208 obtains information such as an average brightness value and a brightness distribution such as a brightness histogram outside the face area as brightness information outside the face area. After S605, the system control unit 50 proceeds to S606.

S606に進むと、システム制御部50は、本撮影前に得られている画像から、撮影対象の場面(シーン)がリライティング処理を行った場合に効果があるリライティング対象シーンであるか否かを判定する。本実施形態の場合、システム制御部50は、S604とS605で陰影取得部208が取得した顔領域内の輝度情報や顔領域外の輝度情報を基に、リライティング対象シーンであるか否かを判定する。   In step S606, the system control unit 50 determines from the image obtained before the main shooting whether the shooting target scene (scene) is a rewriting target scene that is effective when the rewriting process is performed. I do. In the case of the present embodiment, the system control unit 50 determines whether or not the scene is a rewriting target scene based on the luminance information in the face area and the luminance information outside the face area acquired by the shading acquisition unit 208 in S604 and S605. I do.

例えば、S604で取得した顔領域内の平均輝度値が極端に低く黒潰れしている部分が多いシーンや、逆に平均輝度値が極端に高く白飛びしている部分が多いシーンでは、リライティング処理を施してもあまり効果のある結果が得られないと考えられる。このため、システム制御部50は、顔領域内の平均輝度値が極端に低く黒潰れしている部分や、逆に、極端に高く白飛びしている部分が多いシーンの場合、S606においてリライティング対象シーンでないと判別する。また例えば顔領域内の輝度ヒストグラムの輝度分布が偏っているようなシーンは、仮想光源を偏りのある領域に照射して輝度の偏りを減らすことでリライティングの効果が得られると考えられる。このため、システム制御部50は、顔領域内の輝度ヒストグラムの輝度分布が偏っているシーンの場合、S606においてリライティング対象シーンであると判別する。また例えば輝度ヒストグラムの輝度分布が平坦で顔の凹凸感がないシーンでは、仮想光源反射成分(Ra,Ga,Ba)をRGB信号(Rt,Gt,Bt)から減算して輝度分布の平坦さを軽減すればリライティングの効果が得られると考えられる。このため、システム制御部50は、顔領域内の輝度ヒストグラムの輝度分布が平坦なシーンの場合、S606においてリライティング対象シーンであると判別する。また例えば、顔領域内の平均輝度値が低く、顔領域外の平均輝度値が高いといった逆光シーンにおいては、リライティングの効果が表れると考えられる。このため、システム制御部50は、顔領域内の平均輝度値が低く、顔領域外の平均輝度値が高い逆光シーンの場合、S606においてリライティング対象シーンであると判定する。   For example, in a scene in which the average luminance value in the face area acquired in step S604 is extremely low and there are many portions that are crushed black, or conversely, in a scene where the average luminance value is extremely high and there are many portions that are overexposed, the rewriting process is performed. It is considered that even if the method is applied, a very effective result cannot be obtained. For this reason, in the case of a scene where the average luminance value in the face region is extremely low and is crushed by black, or conversely, if the scene is extremely high and there are many portions that are overexposed, the system control unit 50 determines in S606 that the rewriting target It is determined that the scene is not a scene. For example, in a scene in which the luminance distribution of the luminance histogram in the face region is deviated, it is considered that a relighting effect can be obtained by irradiating the virtual light source to the deviated region to reduce the luminance deviation. For this reason, in the case of a scene in which the luminance distribution of the luminance histogram in the face area is uneven, the system control unit 50 determines in S606 that the scene is a rewriting target scene. For example, in a scene in which the luminance distribution of the luminance histogram is flat and there is no sense of unevenness of the face, the virtual light source reflection components (Ra, Ga, Ba) are subtracted from the RGB signals (Rt, Gt, Bt) to reduce the flatness of the luminance distribution. It is thought that the effect of relighting can be obtained if it is reduced. Therefore, in the case where the luminance distribution of the luminance histogram in the face area is flat, the system control unit 50 determines in S606 that the scene is a rewriting target scene. Further, for example, in a backlight scene in which the average luminance value inside the face area is low and the average luminance value outside the face area is high, it is considered that the relighting effect appears. Therefore, in the case of a backlight scene where the average luminance value in the face area is low and the average luminance value outside the face area is high, the system control unit 50 determines that the scene is a rewriting target scene in S606.

また、システム制御部50は、S606におけるリライティング対象シーンの判定結果に応じたマークやメッセージ等を、表示部109に表示される画像上に重畳表示させることも可能である。例えば、リライティング対象シーンであると判定された場合に、そのシーンがリライティングお薦めシーンであることを示すお薦めマーク等を重畳表示することにより、ユーザに対し、リライティング処理することが有効であることを知らせることが可能となる。   Further, the system control unit 50 can also superimpose a mark, a message, or the like according to the determination result of the rewriting target scene in S606 on the image displayed on the display unit 109. For example, when it is determined that the scene is a rewriting target scene, a recommendation mark or the like indicating that the scene is a recommended rewriting scene is displayed in a superimposed manner to notify the user that the rewriting process is effective. It becomes possible.

図7は、リライティング対象シーンであると判別された場合に、表示部109に表示される画像700に対し、リライティングお薦めシーンであることを示すお薦めマーク701を重畳表示した例を示した図である。図7の例では、表示部109に表示されている画像700の例えば左上に、リライティングお薦めシーンであることを示すお薦めマーク701が重畳表示されている。これにより、ユーザに対し、リライティング処理することが有効であることを知らせることが可能となる。また、システム制御部50は、画像700のお薦めマーク701の近傍に、リライティング処理モードのON・ОFFの切り替えボタン702を表示してもよい。そして、システム制御部50は、操作部120のタッチパネルを介して、切り替えボタン702をONにする指示がなされた場合、カメラ動作モードを、リライティング処理の実行するモードに切り替えるようにする。なお、リライティング処理モードのON・ОFFの切り替えボタン702を表示する例の場合、システム制御部50は、図6のS601の後、S602の判定処理は行わずに、S603に処理を進めるようにする。   FIG. 7 is a diagram illustrating an example in which a recommendation mark 701 indicating a rewriting recommended scene is superimposed on an image 700 displayed on the display unit 109 when it is determined that the scene is a rewriting target scene. . In the example of FIG. 7, a recommendation mark 701 indicating a rewriting recommended scene is superimposed on, for example, the upper left of the image 700 displayed on the display unit 109. This makes it possible to inform the user that the rewriting process is effective. Further, the system control unit 50 may display a rewriting process mode ON / $ FF switch button 702 near the recommendation mark 701 of the image 700. Then, when an instruction to turn on the switch button 702 is given via the touch panel of the operation unit 120, the system control unit 50 switches the camera operation mode to a mode in which the rewriting process is performed. In the case of displaying the ON / $ FF switch button 702 of the rewriting process mode, the system control unit 50 proceeds to S603 without performing the determination process of S602 after S601 of FIG. .

システム制御部50は、前述したようにしてS606でリライティング対象シーンであると判定した場合、S607に処理を進める。一方、リライティング対象シーンでないと判定した場合、システム制御部50は、図6のフローチャートの処理を終了する。
S607に進んだ場合、システム制御部50は、ユーザが操作部120のシャッターボタンを全押しした場合、デジタルカメラ100において本撮影を実行させるように各部を制御する。
When the system control unit 50 determines in S606 that the scene is a rewriting target scene as described above, the process proceeds to S607. On the other hand, if it is determined that the scene is not a rewriting target scene, the system control unit 50 ends the processing of the flowchart in FIG.
If the process has proceeded to S607, the system control unit 50 controls each unit so that the digital camera 100 executes actual shooting when the user fully presses the shutter button of the operation unit 120.

次にS608において、システム制御部50は、距離算出部303を制御して2次元の距離マップを算出させる。この時の距離算出部303は、システム制御部50による制御の下、デジタルカメラ100から被写体等までの距離による重み付けマップ画像(mapK)を生成する。具体的には、距離算出部303は、測距センサ123から取得した撮影画像の画素単位の距離情報に基づいて画素単位で距離Kを算出し、さらに画素単位で1/K^2を任意のビット幅で正規化した値を算出する。そして、距離算出部303は、それら正規化した値が各画素に対応して2次元に配列されたものを、距離による重み付けマップ画像(mapK)として生成する。   Next, in S608, the system control unit 50 controls the distance calculation unit 303 to calculate a two-dimensional distance map. At this time, the distance calculation unit 303 generates a weighted map image (mapK) based on the distance from the digital camera 100 to the subject or the like under the control of the system control unit 50. Specifically, the distance calculation unit 303 calculates the distance K in pixel units based on the pixel-based distance information of the captured image acquired from the distance measurement sensor 123, and further calculates 1 / K1 / 2 in pixel units. Calculate the value normalized by the bit width. Then, the distance calculation unit 303 generates a two-dimensional array of the normalized values corresponding to each pixel as a distance-weighted map image (mapK).

次にS609において、システム制御部50は、法線算出部304を制御して法線マップを算出させる。この時の法線算出部304は、システム制御部50による制御の下、距離算出部303から取得した距離による重み付けマップ画像(mapK)を基に、法線マップ画像(mapN)を生成する。具体的には、法線算出部304は、図4で説明したように被写体401の法線ベクトル(N)を画素単位で算出し、それらの各座標軸方向に対する方向余弦を求め、その方向余弦を任意のビット幅で表現して、法線による重み付けマップ(mapN)とする。   Next, in step S609, the system control unit 50 controls the normal line calculation unit 304 to calculate a normal line map. At this time, under the control of the system control unit 50, the normal line calculation unit 304 generates a normal line map image (mapN) based on the weighted map image (mapK) based on the distance acquired from the distance calculation unit 303. Specifically, the normal vector calculation unit 304 calculates the normal vector (N) of the subject 401 in units of pixels as described with reference to FIG. 4, obtains the direction cosine for each of these coordinate axis directions, and calculates the direction cosine. Expressed by an arbitrary bit width, a weight map (mapN) based on the normal is used.

次にS610において、システム制御部50は、リライティング処理部の反射成分算出部305を制御して仮想光源の反射成分を算出させる。この時、システム制御部50は、顔検出部113が検出した顔の座標情報と陰影取得部208が取得した顔領域内および顔領域外の輝度情報を反射成分算出部305に送る。そして、反射成分算出部305は、システム制御部50による制御の下、それらの情報を基に、仮想光源の位置・照射範囲・強度を決定する。例えば、反射成分算出部305は、顔領域内の輝度分布が偏っていた場合、輝度値の低い領域に仮想光源が当たるように、仮想光源の位置・照射範囲・強度を決定する。ここで、例えば輝度値の低い領域の座標が(x1,y1)であるとすると、仮想光源による被写体からの反射成分(Ra(x1,y1),Ga(x1,y1),Ba(x1,y1))は、次の式(3)で表わされる。 Next, in S610, the system control unit 50 controls the reflection component calculation unit 305 of the relighting processing unit to calculate the reflection component of the virtual light source. At this time, the system control unit 50 sends to the reflection component calculation unit 305 the coordinate information of the face detected by the face detection unit 113 and the luminance information inside and outside the face area acquired by the shadow acquisition unit 208. Then, under the control of the system control unit 50, the reflection component calculation unit 305 determines the position, irradiation range, and intensity of the virtual light source based on the information. For example, when the luminance distribution in the face region is biased, the reflection component calculation unit 305 determines the position, the irradiation range, and the intensity of the virtual light source such that the virtual light source shines on a region having a low luminance value. Here, for example, assuming that the coordinates of an area having a low luminance value are (x1, y1), the reflection components (Ra (x1, y1) , Ga (x1, y1) , and Ba (x1, y1 ) reflected from the subject by the virtual light source. ) ) Is represented 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
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 Equation (3)
Ba (x1, y1) = α × (−L (x1, y1) · N (x1, y1) ) / K (x1, y1) ^ 2 × Bt

なお式(3)中のRt,Gt,Btは前述したデガンマ処理後のRGB信号であり、αは仮想光源の強さ、L(x1,y1)は仮想光源の3次元方向ベクトル、N(x1,y1)は(x1,y1)座標の位置に存在する被写体の3次元法線ベクトルである。また、式(3)のK(x1,y1)は仮想光源と(x1,y1)座標の位置に存在する被写体との間の距離である。 In the equation (3), Rt, Gt, and Bt are RGB signals after the above-described degamma processing, α is the intensity of the virtual light source, L (x1, y1) is a three-dimensional direction vector of the virtual light source, and N (x1 , y1) is a three-dimensional normal vector of the subject located at the position of (x1, y1) coordinates. Further, K (x1, y1) in Expression (3) is the distance between the virtual light source and the subject existing at the position of (x1, y1) coordinates.

さらに反射成分算出部305は、システム制御部50による制御の下、式(3)に基づいて、仮想光源の照射範囲と、仮想光源の位置と、仮想光源の強さとを決定する。本実施形態の場合、反射成分算出部305は、陰影取得部208が取得した顔領域内の輝度分布の情報を基に、任意に設定した閾値よりも低い輝度値となる各座標の情報を取得し、それら座標が含まれるように、仮想光源の照射範囲を決定する。また、反射成分算出部305は、仮想光源からの光が輝度値の低い領域(座標(x1,y1))に当たるようになる、仮想光源の強さαと、仮想光源から被写体までの距離K(x1,y1)とを決定する。仮想光源の位置は、仮想光源の3次元方向ベクトルL(x1,y1)と距離K(x1,y1)とに基づいて特定される。 Further, under the control of the system control unit 50, the reflection component calculation unit 305 determines the irradiation range of the virtual light source, the position of the virtual light source, and the intensity of the virtual light source based on Expression (3). In the case of the present embodiment, the reflection component calculation unit 305 acquires information on each coordinate having a luminance value lower than an arbitrarily set threshold, based on the information on the luminance distribution in the face area acquired by the shadow acquisition unit 208. Then, the irradiation range of the virtual light source is determined so that those coordinates are included. In addition, the reflection component calculation unit 305 determines the intensity α of the virtual light source and the distance K ( from the virtual light source to the subject) so that the light from the virtual light source falls on a region (coordinates (x1, y1)) having a low luminance value. x1, y1) . The position of the virtual light source is specified based on the three-dimensional direction vector L (x1, y1) and the distance K (x1, y1) of the virtual light source.

ここで、仮想光源が被写体の輝度値の低い領域(座標(x1,y1))に当たるようにするには、反射成分(Ra(x1,y1),Ga(x1,y1),Ba(x1,y1))が正の値となるような仮想光源の強さαと距離K(x1,y1)を決定する必要がある。また例えば、仮想光源の強さαを強くし過ぎると、白飛びや階調反転などが生じてしまう可能性もあるため、仮想光源の強さαは、予め求めた閾値範囲内の値にすることが望ましい。このため反射成分算出部305は、仮想光源の強さに対する閾値範囲として、仮想光源の照射範囲外で輝度値が高い領域の平均輝度値±βの輝度値範囲を算出し、その輝度値範囲の例えば平均値を仮想光源の強さαとして決定する。また反射成分算出部305は、反射成分(Ra(x1,y1),Ga(x1,y1),Ba(x1,y1))が正の値となるような、仮想光源から被写体までの距離の範囲を算出し、その距離の範囲の例えば平均値を、距離K(x1,y1)として決定する。また反射成分算出部305は、反射成分(Ra(x1,y1),Ga(x1,y1),Ba(x1,y1))が正の値となるような、仮想光源の各位置からなる範囲を、仮想光源の位置の範囲として決定する。 Here, in order for the virtual light source to hit an area (coordinates (x1, y1)) where the luminance value of the subject is low, the reflection components (Ra (x1, y1) , Ga (x1, y1) , Ba (x1, y1) It is necessary to determine the intensity α of the virtual light source and the distance K (x1, y1) such that the value of ) ) becomes a positive value. Also, for example, if the intensity α of the virtual light source is set too high, overexposure and gradation inversion may occur. Therefore, the intensity α of the virtual light source is set to a value within a threshold range obtained in advance. It is desirable. For this reason, the reflection component calculation unit 305 calculates, as a threshold range for the intensity of the virtual light source, a luminance value range of the average luminance value ± β of a region having a high luminance value outside the irradiation range of the virtual light source, and For example, the average value is determined as the intensity α of the virtual light source. The reflection component calculation unit 305 determines the range of the distance from the virtual light source to the subject such that the reflection components (Ra (x1, y1) , Ga (x1, y1) , and Ba (x1, y1) ) have positive values. Is calculated, and an average value of the range of the distance is determined as the distance K (x1, y1) . Further, the reflection component calculation unit 305 calculates a range including each position of the virtual light source such that the reflection components (Ra (x1, y1) , Ga (x1, y1) , and Ba (x1, y1) ) have positive values. , The position range of the virtual light source.

次にS611において、システム制御部50は、反射成分算出部305を制御して、仮想光源による重み付けマップ画像を生成させる。この時、反射成分算出部305は、仮想光源の光源方向ベクトル−Lを画素単位で算出し、それら画素単位で各座標軸方向に対する方向余弦を求め、それら方向余弦を任意のビット幅で表現して仮想光源による重み付けマップ(mapL)とする。   Next, in S611, the system control unit 50 controls the reflection component calculation unit 305 to generate a weighted map image using the virtual light source. At this time, the reflection component calculation unit 305 calculates the light source direction vector -L of the virtual light source in pixel units, obtains the direction cosine for each coordinate axis direction in pixel units, and expresses the direction cosine with an arbitrary bit width. A weighting map (mapL) based on the virtual light source is used.

次にS612において、システム制御部50は、反射成分算出部305を制御して、被写体における仮想光源の反射成分を算出させる。ここで、仮想光源の反射成分(Ra,Ga,Ba)は、前述した式(1)を用いることで算出できる。反射成分算出部305は、式(1)について、距離による重み付けマップ画像(mapK)、被写体の法線による重み付けマップ画像(mapN)、仮想光源による重み付けマップ画像(mapL)で置き換えた式(4)を用いて、仮想光源の反射成分を算出する。   Next, in S612, the system control unit 50 controls the reflection component calculation unit 305 to calculate the reflection component of the virtual light source in the subject. Here, the reflection components (Ra, Ga, Ba) of the virtual light source can be calculated by using the aforementioned equation (1). The reflection component calculation unit 305 replaces the expression (1) with the distance-weighted map image (mapK), the weighted map image based on the normal of the subject (mapN), and the weighted map image (mapL) based on the virtual light source. Is used to calculate the reflection component of the virtual light source.

Ra=α×mapL・mapN・mapK×Rt
Ga=α×mapL・mapN・mapK×Gt 式(4)
Ba=α×mapL・mapN・mapK×Bt
Ra = α × mapL ・ mapN ・ mapK × Rt
Ga = α × mapL · mapN · mapK × Gt Equation (4)
Ba = α × mapL ・ mapN ・ mapK × Bt

次にS613において、システム制御部50は、仮想光源状態画像を生成する。具体的には、システム制御部50は、反射成分算出部305が仮想光源反射成分を算出するのに用いた各パラメータを図式化した仮想光線状態画像を生成する。   Next, in S613, the system control unit 50 generates a virtual light source state image. Specifically, the system control unit 50 generates a virtual ray state image in which each parameter used by the reflection component calculation unit 305 to calculate the virtual light source reflection component is illustrated.

以下、図8(a)〜図8(e)を用いて仮想光源状態画像の例について説明する。
図8(a)は、例えば、リライティング処理後の画像800の右上の位置に、3次元の仮想光源状態画像802が重畳表示された例を示した図である。また、画像800の例えば左上の位置にはリライティング処理が行われたことを表すマーク801が表示されている。仮想光源状態画像802は、x軸・y軸・z軸の3次元空間内における、被写体803の位置、仮想光源806の位置、仮想光源806の照射範囲808、カメラ805の位置、仮想光源806の強度を表す強度バー804等が配置された画像となっている。仮想光源状態画像802の仮想光源806の位置、照射範囲808、強度バー804については、表示部109に設けられているタッチパネル等の操作部120を介して、ユーザによる操作が可能となされている。システム制御部50は、仮想光源状態画像802の仮想光源806の位置、照射範囲808、強度バー804が、操作部120を介してユーザにより操作されると、その操作に応じて、仮想光源の位置、照射範囲、仮想光源の強度等のパラメータを再設定する。
Hereinafter, an example of the virtual light source state image will be described with reference to FIGS. 8A to 8E.
FIG. 8A is a diagram illustrating an example in which a three-dimensional virtual light source state image 802 is superimposed and displayed at the upper right position of the image 800 after the rewriting process. Further, a mark 801 indicating that the rewriting process has been performed is displayed at, for example, the upper left position of the image 800. The virtual light source state image 802 includes a position of the subject 803, a position of the virtual light source 806, an irradiation range 808 of the virtual light source 806, a position of the camera 805, and a position of the virtual light source 806 in a three-dimensional space of the x-axis, the y-axis, and the z-axis. This is an image in which an intensity bar 804 indicating the intensity is arranged. The position of the virtual light source 806, the irradiation range 808, and the intensity bar 804 of the virtual light source state image 802 can be operated by a user via an operation unit 120 such as a touch panel provided on the display unit 109. When the position of the virtual light source 806, the irradiation range 808, and the intensity bar 804 of the virtual light source state image 802 are operated by the user via the operation unit 120, the system control unit 50 determines the position of the virtual light source according to the operation. , The irradiation range, the intensity of the virtual light source, etc. are reset.

図8(b)は仮想光源状態画像810の他の例を示しており、図8(a)の例と同様に、被写体813の位置、仮想光源816の位置、仮想光源816の照射範囲818、カメラ815の位置、強度バー814等が配置された画像となされている。図8(b)の仮想光源状態画像810には、さらに、ユーザが仮想光源の位置や照射範囲を操作する際の目安となる補助線819が、x軸,y軸,z軸(z軸の補助線は図示を省略している。)について設けられている。図8(b)の仮想光源状態画像810の場合、補助線819が設けられているため、ユーザは、仮想光源の位置や照射範囲の操作がし易くなる。   FIG. 8B shows another example of the virtual light source state image 810. As in the example of FIG. 8A, the position of the subject 813, the position of the virtual light source 816, the irradiation range 818 of the virtual light source 816, This is an image in which the position of the camera 815, the intensity bar 814, and the like are arranged. In the virtual light source state image 810 of FIG. 8B, an auxiliary line 819 serving as a guide when the user operates the position of the virtual light source and the irradiation range is further included in the x-axis, y-axis, and z-axis (of the z-axis). The auxiliary line is not shown.). In the case of the virtual light source state image 810 in FIG. 8B, since the auxiliary line 819 is provided, the user can easily operate the position and the irradiation range of the virtual light source.

図8(c)は仮想光源状態画像820の他の例を示しており、被写体823と仮想光源826との位置関係を真上から見た場合の平面図で表した画像となされている。図8(c)の仮想光源状態画像820には、被写体823、仮想光源826、仮想光源826の照射範囲828、カメラ825の位置、強度バー824等が配置された画像となされている。この仮想光源状態画像820においても前述同様に、仮想光源状態画像820の仮想光源826の位置、照射範囲828、強度バー824は、操作部120を介してユーザによる操作が可能となされている。図8(c)の仮想光源状態画像820の場合、ユーザは、被写体823と仮想光源826との2次元的な位置関係を容易に把握することが可能となる。   FIG. 8C shows another example of the virtual light source state image 820, which is an image represented by a plan view when the positional relationship between the subject 823 and the virtual light source 826 is viewed from directly above. The virtual light source state image 820 in FIG. 8C is an image in which the subject 823, the virtual light source 826, the irradiation range 828 of the virtual light source 826, the position of the camera 825, the intensity bar 824, and the like are arranged. In the virtual light source state image 820, the position of the virtual light source 826, the irradiation range 828, and the intensity bar 824 of the virtual light source state image 820 can be operated by the user via the operation unit 120, as described above. In the case of the virtual light source state image 820 of FIG. 8C, the user can easily grasp the two-dimensional positional relationship between the subject 823 and the virtual light source 826.

図8(d)と図8(e)は、S610で反射成分算出部305が算出した各パラメータの範囲をガイドラインとして表示している例である。図8(d)は、図8(a)の仮想光源状態画像802と同様の仮想光源状態画像830にガイドライン837を表示した例である。図8(d)の被写体833の位置、仮想光源836の位置、仮想光源836の照射範囲838、カメラ835の位置、仮想光源836の強度を表す強度バー834等は図8(a)の例と同様のものである。図8(e)は、図8(c)の仮想光源状態画像820と同様の仮想光源状態画像840にガイドライン847を表示した例である。図8(e)の被写体843の位置、仮想光源846の位置、仮想光源846の照射範囲848、カメラ845の位置、仮想光源846の強度を表す強度バー844等は図8(c)の例と同様のものである。図8(d)と図8(e)の場合、ユーザは、例えば仮想光源の位置と仮想光源の範囲をガイドラインに沿って操作することで、それら仮想光源の位置と仮想光源の範囲のパラメータを調整することが可能となる。これら図8(d)と図8(e)に示したようなガイドラインを表示し、ユーザの操作をガイドラインに沿った操作に制限することで、例えば絵柄が壊れてしまうような仮想光源のパラメータが設定されるのを回避可能となる。   FIGS. 8D and 8E are examples in which the range of each parameter calculated by the reflection component calculation unit 305 in step S610 is displayed as a guide line. FIG. 8D is an example in which a guideline 837 is displayed on a virtual light source state image 830 similar to the virtual light source state image 802 in FIG. The position of the subject 833, the position of the virtual light source 836, the irradiation range 838 of the virtual light source 836, the position of the camera 835, the intensity bar 834 indicating the intensity of the virtual light source 836, and the like in FIG. 8D are the same as those in FIG. It is similar. FIG. 8E is an example in which the guideline 847 is displayed on a virtual light source state image 840 similar to the virtual light source state image 820 in FIG. 8C. The position of the subject 843, the position of the virtual light source 846, the irradiation range 848 of the virtual light source 846, the position of the camera 845, the intensity bar 844 indicating the intensity of the virtual light source 846, and the like in FIG. 8E are the same as those in FIG. It is similar. In the case of FIG. 8D and FIG. 8E, the user operates the position of the virtual light source and the range of the virtual light source, for example, according to the guideline, thereby changing the parameters of the position of the virtual light source and the range of the virtual light source. It can be adjusted. By displaying the guidelines as shown in FIGS. 8D and 8E and restricting the user's operation to the operations in accordance with the guidelines, for example, the parameters of the virtual light source that may break the picture Setting can be avoided.

図6のフローチャートに説明を戻す。
S614において、システム制御部50は、リライティング処理部114を制御して、リライティング処理を実行させる。具体的には、付加処理部306において、前述した式(2)のように、反射成分算出部305で算出した仮想光源の反射成分(Ra,Ga,Ba)を、デガンマ処理部302の出力(Rt,Gt,Bt)と加算することによりリライティング処理が行われる。
The description returns to the flowchart of FIG.
In S614, the system control unit 50 controls the rewriting processing unit 114 to execute the rewriting process. More specifically, the additional processing unit 306 outputs the reflection components (Ra, Ga, and Ba) of the virtual light source calculated by the reflection component calculation unit 305 to the output of the degamma processing unit 302 (Expression (2)). Rt, Gt, Bt) to perform rewriting processing.

次にS615において、システム制御部50は、リライティング処理後の画像に、S613で生成した仮想光源状態画像を重畳した表示画像を表示部109に表示させる。
その後、S616において、システム制御部50は、操作部120を介してユーザから仮想光源状態画像に対する変更の操作がなされたか否かを判定する。そして、システム制御部50は、仮想光源状態画像に対する変更の操作がなされたと判定した場合には、S611に処理を戻し、前述したS611以降の制御を行う。一方、仮想光源状態画像に対する変更の操作がなされなかったと判定した場合には、図6のフローチャートの処理を終了する。
Next, in step S615, the system control unit 50 causes the display unit 109 to display a display image in which the virtual light source state image generated in step S613 is superimposed on the image after the relighting process.
Thereafter, in S616, the system control unit 50 determines whether or not the user has performed a change operation on the virtual light source state image via the operation unit 120. If the system control unit 50 determines that an operation for changing the virtual light source state image has been performed, the process returns to S611, and performs the above-described control from S611. On the other hand, when it is determined that the operation of changing the virtual light source state image has not been performed, the processing of the flowchart in FIG. 6 ends.

第1の実施形態のデジタルカメラ100は、前述したように仮想光源の位置・照射範囲・強さといったパラメータを図式化した仮想光源状態画像を生成し、撮影画像またはリライティング処理後の画像に重畳表示する機能を有している。本実施形態のデジタルカメラ100によれば、ユーザは、表示された仮想光源状態画像を基に仮想光源(ライト)の位置や照射範囲・強さを調整することで、仮想光源の各パラメータを容易に調整でき、所望のリライティング処理結果を得ることが可能となる。   As described above, the digital camera 100 according to the first embodiment generates a virtual light source state image in which parameters such as the position, irradiation range, and intensity of the virtual light source are schematized, and superimposes the captured image or the image after the rewriting process on the captured image. It has the function to do. According to the digital camera 100 of the present embodiment, the user can easily adjust each parameter of the virtual light source by adjusting the position, irradiation range, and intensity of the virtual light source (light) based on the displayed virtual light source state image. , And a desired relighting processing result can be obtained.

また、本実施形態では、仮想光源状態画像として3次元図や平面図の例を挙げたが、仮想光源状態画像は被写体と仮想光源との位置関係をユーザが把握出来るものであれば、前述の例に限るものではない。また、本実施形態では、仮想光源が一つの場合を例に挙げたが、これに限定されるものではない。例えば、一つの仮想光源は被写体に対し右斜め上から光を当て、もう一つの仮想光源は被写体に対し真横から光を当てるといったように、複数光源でリライティング処理する構成にしてもよい。この場合は、仮想光源状態画像において、それら複数の仮想光源について前述同様に位置・照射範囲・強さといったパラメータを調整可能にする。   In the present embodiment, an example of a three-dimensional view or a plan view is given as an example of the virtual light source state image. However, if the virtual light source state image allows the user to grasp the positional relationship between the subject and the virtual light source, the above-described virtual light source state image can be used. It is not limited to the example. Further, in the present embodiment, the case where there is one virtual light source is described as an example, but the present invention is not limited to this. For example, a configuration may be employed in which relighting processing is performed by a plurality of light sources such that one virtual light source irradiates light from a diagonally upper right to the subject and another virtual light source irradiates light from right beside the subject. In this case, in the virtual light source state image, parameters such as position, irradiation range, and intensity can be adjusted for the plurality of virtual light sources in the same manner as described above.

<第2の実施形態>
次に、本発明に係る画像処理装置の一適用例として、第2の実施形態ではパーソナルコンピュータ(以下、PCとする。)等の情報処理装置を例に挙げる。第2の実施形態のPCは、デジタルカメラ等から撮影画像および距離情報等の付加情報を取得する。そして、PCは、撮影画像に対するリライティング処理後の画像を生成すると共に仮想光源状態画像を生成し、その仮想光源状態画像を撮影画像またはリライティング処理後の画像に重畳表示する。なお、撮影画像と共に取得する付加情報には、距離情報の他に、デジタルカメラが求めた顔検出結果や法線情報が含まれていてもよい。また、付加情報に顔検出結果や法線情報が含まれていない場合、第2の実施形態のPCは、撮影画像から顔領域を検出して顔検出結果を生成し、距離情報から法線情報を算出する。
<Second embodiment>
Next, as an application example of the image processing apparatus according to the present invention, in the second embodiment, an information processing apparatus such as a personal computer (hereinafter, referred to as a PC) will be described. The PC according to the second embodiment acquires a captured image and additional information such as distance information from a digital camera or the like. Then, the PC generates an image after the rewriting process on the captured image, generates a virtual light source state image, and superimposes and displays the virtual light source state image on the captured image or the image after the relighting process. Note that the additional information acquired together with the captured image may include a face detection result obtained by the digital camera and normal line information in addition to the distance information. If the additional information does not include the face detection result or the normal line information, the PC according to the second embodiment detects the face area from the captured image to generate the face detection result, and the normal line information from the distance information. Is calculated.

図1(b)は、第2の実施形態に係るPC150の概略構成例を示した図である。
第2の実施形態のPC150は、CPU151、ROM152、RAM153、表示部154、操作部156、記録媒体157、I/F部158等を有して構成されている。
FIG. 1B is a diagram illustrating a schematic configuration example of a PC 150 according to the second embodiment.
The PC 150 according to the second embodiment includes a CPU 151, a ROM 152, a RAM 153, a display unit 154, an operation unit 156, a recording medium 157, an I / F unit 158, and the like.

CPU151は、PC150における全体の動作の統括的な制御や各種の演算処理を行うためのものであり、システムバスを介して、各構成部(152〜159)に接続されている。ROM152は、CPU151が処理を実行するために必要なプログラムを記憶する不揮発性メモリである。なお、当該プログラムは、後述する記録媒体157やI/F部158を介して取得されてもよい。RAM153は、CPU151の主メモリ、ワークエリアとして機能する。すなわちCPU151は、処理の実行に際してROM152から必要なプログラムをRAM153にロードし、このプログラムを実行することで各種の制御や演算処理等を実現する。第2の実施形態の場合、CPU151は、このプログラムの実行により、例えば図1(a)のデジタルカメラ100の画像処理部105、リライティング処理部114、顔検出部113、表示部154への表示制御等と同様の各処理を行う。   The CPU 151 performs overall control of the entire operation of the PC 150 and performs various arithmetic processes, and is connected to each component (152 to 159) via a system bus. The ROM 152 is a non-volatile memory that stores programs necessary for the CPU 151 to execute processing. Note that the program may be obtained via a recording medium 157 and an I / F unit 158 described below. The RAM 153 functions as a main memory and a work area of the CPU 151. That is, the CPU 151 loads a necessary program from the ROM 152 into the RAM 153 at the time of executing the processing, and realizes various controls and arithmetic processing by executing the program. In the case of the second embodiment, the CPU 151 executes display control on the image processing unit 105, the rewriting processing unit 114, the face detection unit 113, and the display unit 154 of the digital camera 100 in FIG. Each processing similar to the above is performed.

I/F部158は、無線や有線等により外部機器等と接続したり、外部メモリ等と接続等したりするためのインターフェースである。I/F部158に接続される外部機器にはデジタルカメラが含まれ、またI/F部158の接続先にはインターネット等のネットワークも含まれる。記録媒体157は、CPU151による制御の下、I/F部158を介して取得された撮影画像とその付加情報等、リライティング処理後の画像や仮想光源状態画像の情報等の記録や読み出しを行う。   The I / F unit 158 is an interface for connecting to an external device or the like by wireless or wired communication, or for connecting to an external memory or the like. An external device connected to the I / F unit 158 includes a digital camera, and a connection destination of the I / F unit 158 includes a network such as the Internet. Under the control of the CPU 151, the recording medium 157 records and reads information such as an image after rewriting processing, a virtual light source state image, and the like, such as a captured image acquired through the I / F unit 158 and additional information thereof.

表示部154は、液晶ディスプレイ(LCD)等のモニタで構成される。表示部154には、CPU151による制御の下で、前述したデジタルカメラ100の表示部109に表示されるのと同様のリライティング処理後の画像や仮想光源状態画像等が表示される。操作部156は、例えばキーボードやマウス、タッチパネル等により構成され、ユーザからの指示を取得してCPU151に伝える。ユーザは、操作部156を介して、前述の第1の実施形態で説明した仮想光源状態画像への指示を行うことができる。   The display unit 154 includes a monitor such as a liquid crystal display (LCD). Under the control of the CPU 151, the display unit 154 displays an image after rewriting processing, a virtual light source state image, and the like, which are similar to those displayed on the display unit 109 of the digital camera 100 described above. The operation unit 156 includes, for example, a keyboard, a mouse, a touch panel, and the like, acquires an instruction from a user, and transmits the instruction to the CPU 151. The user can give an instruction to the virtual light source state image described in the first embodiment via the operation unit 156.

第2の実施形態のPC150では、前述した第1の実施形態と同様に、仮想光源の位置・照射範囲・強さといったパラメータを図式化した仮想光源状態画像を生成し、撮影画像またはリライティング処理後の画像に重畳表示する。そして、第2の実施形態においても前述同様に、ユーザは、仮想光源状態画像を基に仮想光源の位置や照射範囲・強さを調整することができる。第2の実施形態においても、仮想光源状態画像の生成および重畳表示、仮想光源状態画像を介した仮想光源の位置・照射範囲・強さの調整等の基本的な処理は、前述した第1の実施形態と概ね同様である。以下の説明では、第2の実施形態において前述した第1の実施形態とは異なる点についてのみ記載する。   The PC 150 according to the second embodiment generates a virtual light source state image in which parameters such as a position, an irradiation range, and an intensity of the virtual light source are schematized, similarly to the first embodiment described above. Is superimposed on the image of. In the second embodiment, as described above, the user can adjust the position, irradiation range, and intensity of the virtual light source based on the virtual light source state image. Also in the second embodiment, basic processing such as generation and superimposed display of a virtual light source state image, and adjustment of the position, irradiation range, and intensity of the virtual light source via the virtual light source state image are performed in accordance with the first processing described above. This is almost the same as the embodiment. In the following description, only points different from the first embodiment described above in the second embodiment will be described.

図9には、第2の実施形態のPC150のCPU151が実行する処理のフローチャートを示す。図9のフローチャートは、第2の実施形態において、撮影画像に対するリライティング処理の実行から、仮想光源と被写体との位置関係を示す仮想光源状態画像の生成、さらにリライティング処理後の画像への重畳表示までの処理の流れを示している。   FIG. 9 shows a flowchart of a process executed by the CPU 151 of the PC 150 according to the second embodiment. In the flowchart of FIG. 9, in the second embodiment, from the execution of the rewriting process on the captured image to the generation of a virtual light source state image indicating the positional relationship between the virtual light source and the subject, and the superimposed display on the image after the relighting process 3 shows the flow of processing.

S901において、CPU151は、予めデジタルカメラ等から取得して記録媒体157に記録されている撮影画像の画像データを読み出す。
次のS902において、CPU151は、操作部156を介して、ユーザからリライティング処理を実行する旨の指示がなされているか否かを判定する。そして、CPU151は、ユーザによりリライティング処理を行う旨の指示がなされていないと判定した場合には図9のフローチャートの処理を終了し、一方、リライティング処理を行う旨の指示がなされていると判定した場合にはS903に処理を進める。
In step S <b> 901, the CPU 151 reads out image data of a captured image that has been acquired from a digital camera or the like in advance and recorded on the recording medium 157.
In the next step S902, the CPU 151 determines whether or not an instruction to execute the rewriting process has been issued from the user via the operation unit 156. If the CPU 151 determines that the instruction to perform the rewriting process has not been issued by the user, the CPU 151 ends the process of the flowchart in FIG. 9, while determining that the instruction to perform the rewriting process has been issued. In this case, the process proceeds to S903.

S903に進むと、CPU151は、デジタルカメラから取得された撮影画像の付加情報として、顔検出に関する情報すなわち顔検出結果の情報が含まれているか否かを判定する。そして、CPU151は、付加情報に顔検出結果が含まれていると判定した場合にはS904に処理を進め、一方、顔検出結果が含まれていないと判定した場合にはS907に処理を進める。   In step S903, the CPU 151 determines whether or not information related to face detection, that is, information on a face detection result, is included as additional information of the captured image acquired from the digital camera. If the CPU 151 determines that the additional information includes the face detection result, the process proceeds to S904. If the CPU 151 determines that the additional information does not include the face detection result, the process proceeds to S907.

S907に進んだ場合,CPU151は、第1の実施形態のデジタルカメラ100の顔検出部113における処理と同様な顔検出処理を撮影画像に対して実行する。
次にS908において、CPU151は、第1の実施形態の陰影取得部208と同様の処理により、撮影画像内に含まれる顔領域内の輝度情報を取得する。具体的には、CPU151は、顔検出結果を基に顔領域内の平均輝度値や輝度ヒストグラムなどの輝度分布といった情報を取得する。
さらにS909において、CPU151は、前述した陰影取得部208と同様の処理により、撮影画像内に含まれる顔領域外の輝度情報を取得する。具体的には、CPU151は、顔検出結果を基に顔領域外の平均輝度値や輝度ヒストグラムなどの輝度分布といった情報を取得する。このS909の後、CPU151はS910に処理を進める。
If the processing has proceeded to S907, the CPU 151 executes face detection processing similar to the processing in the face detection unit 113 of the digital camera 100 of the first embodiment on the captured image.
Next, in step S908, the CPU 151 obtains luminance information in the face area included in the captured image by performing the same processing as that performed by the shadow obtaining unit 208 according to the first embodiment. Specifically, the CPU 151 acquires information such as an average luminance value in the face area and a luminance distribution such as a luminance histogram based on the face detection result.
Further, in step S909, the CPU 151 acquires luminance information outside the face area included in the captured image by performing the same processing as that of the above-described shadow acquisition unit 208. Specifically, the CPU 151 acquires information such as an average luminance value outside the face area and a luminance distribution such as a luminance histogram based on the face detection result. After S909, the CPU 151 proceeds to S910.

またS904に進んだ場合、CPU151は、撮影画像の付加情報から顔検出結果の情報を取得する。
次にS905において、CPU151は、付加情報の顔検出結果を基に、撮影画像の顔領域内の輝度情報を取得する。
さらにS906において、CPU151は、付加情報の顔検出結果を基に、撮影画像の顔領域外の輝度情報を取得する。このS906の後、CPU151はS910に処理を進める。
If the processing has proceeded to S904, the CPU 151 acquires information on the face detection result from the additional information of the captured image.
Next, in step S905, the CPU 151 acquires luminance information in the face area of the captured image based on the face detection result of the additional information.
Further, in step S906, the CPU 151 acquires luminance information outside the face area of the captured image based on the face detection result of the additional information. After this S906, the CPU 151 advances the processing to S910.

S910に進むと、CPU151は、図6のS606で説明したのと同様にして、撮影対象の場面(シーン)がリライティング処理を行った場合に効果があるリライティング対象シーンであるか否かを判定する。そして、CPU151は、リライティング対象シーンであると判定した場合にはS911に処理を進め、リライティング対象シーンでないと判定した場合には図9のフローチャートの処理を終了する。   In step S910, the CPU 151 determines whether the shooting target scene (scene) is a rewriting target scene that is effective when the rewriting process is performed in the same manner as described in step S606 of FIG. . If the CPU 151 determines that the scene is a rewriting target scene, the process proceeds to S911, and if it is determined that the scene is not a rewriting target scene, the process of the flowchart in FIG. 9 ends.

S911に進んだ場合、CPU151は、撮影画像の付加情報として取得された距離情報を基に、第1の実施形態で説明した距離算出部303と同様の処理を行って重み付けマップ画像(mapK)の情報を生成する。
さらにS912において、CPU151は、前述した法線算出部304と同様の処理を行って法線マップ画像(mapN)を生成する。
When the processing proceeds to S911, the CPU 151 performs the same processing as the distance calculation unit 303 described in the first embodiment based on the distance information acquired as the additional information of the captured image, and generates the weighted map image (mapK). Generate information.
Further, in S912, the CPU 151 performs a process similar to that of the normal line calculation unit 304 described above to generate a normal line map image (mapN).

次にS913において、CPU151は、顔検出結果に基づく顔の座標情報と、前述した顔領域内および顔領域外の輝度情報とを基に、第1の実施形態で説明した反射成分算出部305と同様の処理により、仮想光源の位置・照射範囲・強度を決定する。
さらに、CPU151は、S914において、第1の実施形態の反射成分算出部305と同様の処理により、仮想光源による重み付けマップ画像(mapL)を生成し、また、S915において、仮想光源反射成分を算出する。
Next, in step S <b> 913, the CPU 151 determines the reflection component calculation unit 305 described in the first embodiment based on the coordinate information of the face based on the face detection result and the luminance information inside and outside the face area described above. By the same processing, the position, irradiation range, and intensity of the virtual light source are determined.
Further, in S914, the CPU 151 generates a weighted map image (mapL) using the virtual light source by the same process as the reflection component calculation unit 305 of the first embodiment, and calculates the virtual light source reflection component in S915. .

そして、次のS916において、CPU151は、第1の実施形態で説明したのと同様の仮想光源状態画像を生成する。
さらに、CPU151は、S917において、第1の実施形態で説明したのと同様のリライティング処理を実行し、次のS918において、ステップS918では、リライティング処理後の画像に仮想光源状態画像を重畳して表示部154に表示させる。
Then, in the next S916, the CPU 151 generates a virtual light source state image similar to that described in the first embodiment.
Further, in S917, the CPU 151 executes the same relighting processing as described in the first embodiment, and in the next S918, in Step S918, displays the virtual light source state image superimposed on the image after the relighting processing. It is displayed on the unit 154.

その後、S919において、CPU151は、操作部156を介したユーザからの操作によって仮想光源状態画像を変更するか否かを判定する。そして、CPU151は、ユーザからの操作に応じて変更すると判定した場合にはS914に処理を戻し、一方、変更しないと判定した場合には図9のフローチャートの処理を終了する。   Thereafter, in S919, the CPU 151 determines whether or not to change the virtual light source state image by an operation from the user via the operation unit 156. If the CPU 151 determines that the change is to be made in response to an operation from the user, the process returns to step S914. If the CPU 151 determines that the change is not to be made, the process of the flowchart in FIG. 9 ends.

以上説明したように、第2の実施形態のPC150は、デジタルカメラ等から撮影画像および付加情報を取得し、それらを基に仮想光源のパラメータを図式化した仮想光源状態画像を生成し、撮影画像またはリライティング処理後の画像に重畳表示する。これにより、第2の実施形態においても第1の実施形態と同様に、ユーザは重畳表示された仮想光源状態画像を基に仮想光源の位置や照射範囲・強さ等の各パラメータを容易に調整でき、所望のリライティング処理結果を得ることが可能となる。   As described above, the PC 150 according to the second embodiment acquires a captured image and additional information from a digital camera or the like, generates a virtual light source state image in which the parameters of the virtual light source are schematized based on the captured image and the additional information, and Alternatively, the image is superimposed on the image after the rewriting process. Thus, in the second embodiment, similarly to the first embodiment, the user can easily adjust each parameter such as the position, the irradiation range, and the intensity of the virtual light source based on the virtual light source state image superimposed and displayed. As a result, a desired relighting processing result can be obtained.

前述した第1、第2の実施形態では、撮影画像に付加された距離に基づく重み付けマップ画像と法線に基づく重み付けマップ画像とを用いてリライティング処理する例について説明したが、これに限るものではない。例えば、距離情報や法線情報の信頼度に応じて、距離による重み付けマップ画像と法線による重み付けマップ画像を整形するなどして再生成する構成にしてもよい。   In the above-described first and second embodiments, an example has been described in which the relighting process is performed using the weighted map image based on the distance added to the captured image and the weighted map image based on the normal, but the present invention is not limited to this. Absent. For example, according to the reliability of the distance information and the normal line information, the configuration may be such that the weighted map image based on the distance and the weighted map image based on the normal line are shaped and regenerated.

前述した実施形態では、デジタルカメラの撮影画像がリライティング処理される場合を例に挙げたが、例えばスマートフォンやタブレット端末等、工業用カメラ、車載カメラ、医療用カメラなどからの撮影画像をリライティング処理する場合にも適用可能である。   In the above-described embodiment, an example has been described in which an image captured by a digital camera is subjected to relighting processing. However, for example, an image captured from an industrial camera, a vehicle-mounted camera, a medical camera, or the like, such as a smartphone or a tablet terminal, is subjected to relighting processing. The case is also applicable.

本発明に係る信号処理における1以上の機能を実現するプログラムは、ネットワーク又は記憶媒体を介してシステム又は装置に供給可能であり、そのシステム又は装置のコンピュータの1つ以上のプロセッサにより読また出し実行されることで実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。   A program for realizing one or more functions in signal processing according to the present invention can be supplied to a system or an apparatus via a network or a storage medium, and is read and executed by one or more processors of a computer of the system or the apparatus. It can be realized by doing. Further, it can be realized by a circuit (for example, an ASIC) that realizes one or more functions.

前述の実施形態は、何れも本発明を実施するにあたっての具体化の例を示したものに過ぎず、これらによって本発明の技術的範囲が限定的に解釈されてはならないものである。即ち、本発明は、その技術思想、又はその主要な特徴から逸脱することなく、様々な形で実施することができる。   Each of the above-described embodiments is merely an example of an embodiment for carrying out the present invention, and the technical scope of the present invention should not be interpreted in a limited manner. That is, the present invention can be implemented in various forms without departing from the technical idea or the main features.

100:デジタルカメラ、50:システム制御部、105:画像処理部、109:表示部、113:顔検出部、114:リライティング処理部、120:操作部、123:測距センサ   100: digital camera, 50: system control unit, 105: image processing unit, 109: display unit, 113: face detection unit, 114: rewriting processing unit, 120: operation unit, 123: distance measurement sensor

Claims (15)

被写体を撮影した撮影画像を取得する取得手段と、
仮想光源を設定する設定手段と、
前記仮想光源を用いて前記撮影画像の特定の被写体の明るさを補正する補正手段と、
前記特定の被写体と前記仮想光源との位置関係を表わす仮想光源状態画像を生成する生成手段と、
前記撮影画像または前記明るさ補正後の画像に対し、前記仮想光源状態画像を重畳して表示させる制御手段と、
を有することを特徴とする画像処理装置。
Acquiring means for acquiring a photographed image of a subject;
Setting means for setting a virtual light source;
Correction means for correcting the brightness of a specific subject in the captured image using the virtual light source,
Generating means for generating a virtual light source state image representing a positional relationship between the specific subject and the virtual light source,
Control means for superimposing and displaying the virtual light source state image on the captured image or the image after the brightness correction,
An image processing apparatus comprising:
前記生成手段は、前記撮影画像または前記明るさ補正後の画像に重畳表示する前記仮想光源状態画像として、前記特定の被写体と前記仮想光源との位置関係を図式化した3次元図または平面図を生成することを特徴とする請求項1に記載の画像処理装置。   The generating means may include a three-dimensional diagram or a plan view in which the positional relationship between the specific subject and the virtual light source is schematically illustrated as the virtual light source state image superimposed on the captured image or the image after the brightness correction. The image processing apparatus according to claim 1, wherein the image is generated. 前記設定手段は、前記仮想光源を表すパラメータとして前記仮想光源の位置と前記仮想光源の照射範囲と前記仮想光源の強度とを設定し、
前記生成手段は、前記仮想光源を表すパラメータを基に、前記特定の被写体と前記仮想光源との位置関係を表す前記仮想光源状態画像を生成することを特徴とする請求項1または2に記載の画像処理装置。
The setting means sets the position of the virtual light source, the irradiation range of the virtual light source, and the intensity of the virtual light source as parameters representing the virtual light source,
3. The virtual light source state image according to claim 1, wherein the generation unit generates the virtual light source state image representing a positional relationship between the specific subject and the virtual light source based on a parameter representing the virtual light source. Image processing device.
前記設定手段は、前記特定の被写体の位置と、前記特定の被写体の領域内の輝度情報、または、前記特定の被写体の領域内および領域外の輝度情報とに基づいて、前記仮想光源を表すパラメータを設定することを特徴とする請求項3に記載の画像処理装置。   The setting unit includes a parameter indicating the virtual light source based on the position of the specific subject and luminance information in the specific subject area or luminance information in and outside the specific subject area. The image processing apparatus according to claim 3, wherein is set. 前記生成手段は、前記撮影画像に付加されている情報を基に前記仮想光源を表すパラメータを設定することを特徴とする請求項3または4に記載の画像処理装置。   The image processing apparatus according to claim 3, wherein the generation unit sets a parameter representing the virtual light source based on information added to the captured image. 前記設定手段は、前記仮想光源状態画像に対するユーザからの変更の指示が入力された場合、前記指示により変更された仮想光源状態画像に基づいて、前記パラメータを再設定し、
前記補正手段は、前記再設定されたパラメータに基づいて前記撮影画像の前記特定の被写体の明るさ補正を行うことを特徴とする請求項3から5のいずれか1項に記載の画像処理装置。
The setting means, when an instruction to change the virtual light source state image from the user is input, based on the virtual light source state image changed by the instruction, reset the parameters,
The image processing apparatus according to claim 3, wherein the correction unit corrects brightness of the specific subject in the captured image based on the reset parameters.
前記設定手段は、前記パラメータを設定する際に、設定し得るパラメータの範囲を算出し、
前記制御手段は、前記パラメータの範囲を前記仮想光源状態画像にガイドラインとして付加して表示させることを特徴とする請求項3から6のいずれか1項に記載の画像処理装置。
The setting means, when setting the parameters, calculates a range of parameters that can be set,
The image processing apparatus according to claim 3, wherein the control unit adds and displays the range of the parameter as a guideline to the virtual light source state image.
前記設定手段は、一つまたは複数の仮想光源を設定し、前記仮想光源の数が複数である場合には、各々の仮想光源に対して前記パラメータを設定することを特徴とする請求項3から7のいずれか1項に記載の画像処理装置。   The method according to claim 3, wherein the setting unit sets one or a plurality of virtual light sources and, when the number of the virtual light sources is plural, sets the parameter for each virtual light source. 8. The image processing device according to any one of items 7 to 7. 前記設定手段は、前記特定の被写体が明るさ補正を行う対象であるか否かを判定し、
前記補正手段は、前記明るさ補正を行う対象であると判定された場合に、前記被写体の明るさ補正を行うことを特徴とする請求項1から8のいずれか1項に記載の画像処理装置。
The setting means determines whether or not the specific subject is a target for performing brightness correction,
The image processing apparatus according to claim 1, wherein the correction unit corrects the brightness of the subject when it is determined that the subject is to perform the brightness correction. .
前記設定手段は、前記特定の被写体の領域内の輝度情報、または、前記特定の被写体の領域内および領域外の輝度情報に基づいて、前記特定の被写体が明るさ補正を行う対象であるか否かを判定することを特徴とする請求項9に記載の画像処理装置。   The setting means determines whether or not the specific subject is a target to be subjected to brightness correction based on luminance information within the specific subject area or luminance information within and outside the specific subject area. The image processing apparatus according to claim 9, wherein the determination is made. 前記制御手段は、前記特定の被写体が明るさ補正を行う対象であると判定された場合に、前記撮影画像または前記明るさ補正後の画像に対し、前記明るさ補正のお薦めマークを重畳表示させることを特徴とする請求項9または10に記載の画像処理装置。   The control unit, when it is determined that the specific subject is a target for which brightness correction is to be performed, superimposes the brightness correction recommendation mark on the photographed image or the image after the brightness correction. The image processing apparatus according to claim 9, wherein: 前記撮影画像から、前記特定の被写体として顔領域を検出する検出手段を有することを特徴とする請求項1から11のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, further comprising a detection unit configured to detect a face area as the specific subject from the captured image. 被写体を撮影して撮影画像を生成する撮影手段と、
請求項1から12のいずれか1項に記載の画像処理装置と、
を有することを特徴とする撮像装置。
Photographing means for photographing a subject to generate a photographed image;
An image processing apparatus according to any one of claims 1 to 12,
An imaging device comprising:
画像処理装置が実行する画像処理方法であって、
被写体を撮影した撮影画像を取得する取得工程と、
仮想光源を設定する設定工程と、
前記仮想光源を用いて前記撮影画像の特定の被写体の明るさを補正する補正工程と、
前記特定の被写体と前記仮想光源との位置関係を表わす仮想光源状態画像を生成する生成工程と、
前記撮影画像または前記明るさ補正後の画像に対し、前記仮想光源状態画像を重畳して表示させる制御工程と、
を有することを特徴とする画像処理方法。
An image processing method executed by the image processing device,
An acquisition step of acquiring a photographed image of a subject,
A setting step of setting a virtual light source,
A correction step of correcting the brightness of a specific subject in the captured image using the virtual light source,
A generation step of generating a virtual light source state image representing a positional relationship between the specific subject and the virtual light source,
A control step of superimposing and displaying the virtual light source state image on the captured image or the image after the brightness correction,
An image processing method comprising:
コンピュータを、請求項1から12のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラム。   A program for causing a computer to function as each unit of the image processing apparatus according to claim 1.
JP2018121853A 2018-06-27 2018-06-27 Image processing device, image processing method, and program Active JP7207876B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018121853A JP7207876B2 (en) 2018-06-27 2018-06-27 Image processing device, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018121853A JP7207876B2 (en) 2018-06-27 2018-06-27 Image processing device, image processing method, and program

Publications (2)

Publication Number Publication Date
JP2020005084A true JP2020005084A (en) 2020-01-09
JP7207876B2 JP7207876B2 (en) 2023-01-18

Family

ID=69100547

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018121853A Active JP7207876B2 (en) 2018-06-27 2018-06-27 Image processing device, image processing method, and program

Country Status (1)

Country Link
JP (1) JP7207876B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112116695A (en) * 2020-09-24 2020-12-22 广州博冠信息科技有限公司 Virtual light control method and device, storage medium and electronic equipment
WO2021169766A1 (en) * 2020-02-25 2021-09-02 Guangdong Oppo Mobile Telecommunications Corp., Ltd. System and method for visualizing light rays in a scene

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003008977A (en) * 2001-06-20 2003-01-10 Nikon Gijutsu Kobo:Kk Camera
JP2009267662A (en) * 2008-04-24 2009-11-12 Casio Comput Co Ltd Image generator and program
US20100103303A1 (en) * 2008-10-29 2010-04-29 Samsung Electronics Co. Ltd. Method for displaying image by virtual illumination and portable terminal using the same
JP2010135996A (en) * 2008-12-03 2010-06-17 Olympus Imaging Corp Imaging apparatus, and apparatus, method and program for lighting processing
JP2017147568A (en) * 2016-02-16 2017-08-24 キヤノン株式会社 Image processing apparatus, imaging apparatus, control method, and program
JP2018010496A (en) * 2016-07-14 2018-01-18 キヤノン株式会社 Image processing apparatus, control method thereof, and program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003008977A (en) * 2001-06-20 2003-01-10 Nikon Gijutsu Kobo:Kk Camera
JP2009267662A (en) * 2008-04-24 2009-11-12 Casio Comput Co Ltd Image generator and program
US20100103303A1 (en) * 2008-10-29 2010-04-29 Samsung Electronics Co. Ltd. Method for displaying image by virtual illumination and portable terminal using the same
JP2010135996A (en) * 2008-12-03 2010-06-17 Olympus Imaging Corp Imaging apparatus, and apparatus, method and program for lighting processing
JP2017147568A (en) * 2016-02-16 2017-08-24 キヤノン株式会社 Image processing apparatus, imaging apparatus, control method, and program
JP2018010496A (en) * 2016-07-14 2018-01-18 キヤノン株式会社 Image processing apparatus, control method thereof, and program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021169766A1 (en) * 2020-02-25 2021-09-02 Guangdong Oppo Mobile Telecommunications Corp., Ltd. System and method for visualizing light rays in a scene
CN112116695A (en) * 2020-09-24 2020-12-22 广州博冠信息科技有限公司 Virtual light control method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
JP7207876B2 (en) 2023-01-18

Similar Documents

Publication Publication Date Title
JP6445844B2 (en) Imaging device and method performed in imaging device
US10896634B2 (en) Image signal processing apparatus and control method therefor
JP5713752B2 (en) Image processing apparatus and control method thereof
JP5398156B2 (en) WHITE BALANCE CONTROL DEVICE, ITS CONTROL METHOD, AND IMAGING DEVICE
CN108012078B (en) Image brightness processing method and device, storage medium and electronic equipment
US9813634B2 (en) Image processing apparatus and method
JP2018041380A (en) Image processing apparatus, image processing method, and program
JP2013243639A (en) Image processing apparatus, image processing method, and program
JP2015144475A (en) Imaging apparatus, control method of the same, program and storage medium
JP2021182672A (en) Image processing device, image processing method, and program
US11069031B2 (en) Image processing apparatus, control method for image processing apparatus, image pickup apparatus, and non-transitory computer-readable storage medium to control reflected color components of input image
JP7277158B2 (en) Setting device and method, program, storage medium
JP7207876B2 (en) Image processing device, image processing method, and program
JP2017138927A (en) Image processing device, imaging apparatus, control method and program thereof
US9762790B2 (en) Image pickup apparatus using edge detection and distance for focus assist
JP2019179463A (en) Image processing device, control method thereof, program, and recording medium
JP2017143504A5 (en)
JP2014007528A (en) Image processing apparatus and control method thereof
JP6921606B2 (en) Image processing equipment, image processing methods and programs
JP2016129281A (en) Image processor
JP2020036162A (en) Image processing device, imaging device, image processing method, and program
JP5818515B2 (en) Image processing apparatus, image processing method and program thereof
EP3896642A2 (en) Image processing apparatus, image processing method, program, and storage medium
JP5166859B2 (en) White balance control device, imaging device using the same, and white balance control method
JP6849351B2 (en) Image processing equipment, image processing methods, and programs

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210623

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220530

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220614

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220808

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230105

R151 Written notification of patent or utility model registration

Ref document number: 7207876

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151