JP2017138730A - Image processing device, imaging apparatus, control method and program of image processing device - Google Patents

Image processing device, imaging apparatus, control method and program of image processing device Download PDF

Info

Publication number
JP2017138730A
JP2017138730A JP2016018244A JP2016018244A JP2017138730A JP 2017138730 A JP2017138730 A JP 2017138730A JP 2016018244 A JP2016018244 A JP 2016018244A JP 2016018244 A JP2016018244 A JP 2016018244A JP 2017138730 A JP2017138730 A JP 2017138730A
Authority
JP
Japan
Prior art keywords
image
intensity
light source
light
virtual
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
JP2016018244A
Other languages
Japanese (ja)
Other versions
JP6666735B2 (en
JP2017138730A5 (en
Inventor
宏史 鈴木
Hiroshi Suzuki
宏史 鈴木
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 JP2016018244A priority Critical patent/JP6666735B2/en
Publication of JP2017138730A publication Critical patent/JP2017138730A/en
Publication of JP2017138730A5 publication Critical patent/JP2017138730A5/ja
Application granted granted Critical
Publication of JP6666735B2 publication Critical patent/JP6666735B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To control processing to a highlight area by using illumination environmental information at the time of imaging and illumination environmental information at the time of relighting.SOLUTION: An image processing device which sets a virtual light source with respect to an image and generates a relighting image obtained by emitting light to a subject image in the image from the virtual light source includes: detection means which detects a highlight area in the image on the basis of a luminance value of pixels constituting the subject image; estimation means which estimates the intensity of environmental light in the image; and processing means which corrects the highlight area in the image on the basis of comparison between the intensity of the light of the virtual light source and the estimated intensity of the environmental light in the processing of generating the relighting image. The processing means does not correct the pixel value of the highlight area when the intensity of the environmental light is larger than the intensity of the light of the virtual light source, and corrects the pixel value of the highlight area when the intensity of the environmental light is equal to or less than the intensity of the light of the virtual light source.SELECTED DRAWING: Figure 1

Description

本発明は、画像処理装置、撮像装置、画像処理装置の制御方法及びプログラムに関する。   The present invention relates to an image processing apparatus, an imaging apparatus, an image processing apparatus control method, and a program.

リライティングと呼ばれる、撮影した画像に対して撮影時とは異なる照明環境で撮影したような画像を作成する方法がある。リライティングを行う際、撮影時の照明環境によって生じたハイライト領域が残ってしまうとリライティング後の画像が不自然になる場合がある。これに対して、撮影時の照明環境によって生じたハイライト領域を除去する技術が提案されている(特許文献1を参照)。   There is a method called relighting that creates an image that has been shot in a lighting environment different from that at the time of shooting. When performing relighting, if a highlight area caused by the lighting environment at the time of photographing remains, the image after relighting may become unnatural. On the other hand, a technique for removing a highlight area caused by an illumination environment at the time of photographing has been proposed (see Patent Document 1).

特開2004−21388号公報JP 2004-21388 A

上述の技術を用いることで、撮影時の照明環境によって生じたハイライト領域を除去することは可能である。しかし、その場合は常に撮影時の照明環境によって生じたハイライト領域が除去されてしまうため、撮影時の照明環境によって生じたハイライト領域を残したい場合に対応できない。   By using the above-described technique, it is possible to remove a highlight area caused by an illumination environment at the time of shooting. However, in such a case, the highlight area generated by the lighting environment at the time of shooting is always removed, so that it is not possible to keep the highlight area generated by the lighting environment at the time of shooting left.

そこで本発明は、撮影時の照明環境情報(以下、環境光情報)とリライティング時の照明環境情報(以下、仮想光源情報)とを用いて、ハイライト領域に対する処理の制御を可能とする。   Therefore, the present invention makes it possible to control processing for a highlight region using illumination environment information at the time of photographing (hereinafter, ambient light information) and illumination environment information at the time of relighting (hereinafter, virtual light source information).

上記課題を解決するための発明は画像に対して仮想光源を設定し、前記仮想光源から前記画像内の被写体像に光が照射されたリライティング画像を生成する画像処理装置に関連し、当該画像処理装置は、
前記被写体像を構成する画素の輝度値に基づき、前記画像におけるハイライト領域を検出する検出手段と、
前記画像における環境光の強度を推定する推定手段と、
前記リライティング画像を生成する処理において、前記仮想光源の光の強度と、推定された前記環境光の強度との比較に基づき、前記画像におけるハイライト領域を補正する処理手段と
を備え、
前記処理手段は、前記環境光の強度が前記仮想光源の光の強度よりも大きい場合に前記ハイライト領域の画素値を補正せず、前記環境光の強度が前記仮想光源の光の強度以下の場合に前記ハイライト領域の画素値を補正する。
The invention for solving the above-described problem relates to an image processing apparatus that sets a virtual light source for an image and generates a relighting image in which light is emitted from the virtual light source to a subject image in the image. The device
Detecting means for detecting a highlight area in the image based on a luminance value of a pixel constituting the subject image;
Estimating means for estimating the intensity of ambient light in the image;
In the process of generating the relighting image, a processing unit that corrects a highlight area in the image based on a comparison between the light intensity of the virtual light source and the estimated intensity of the ambient light,
The processing means does not correct the pixel value of the highlight region when the intensity of the ambient light is larger than the intensity of the light of the virtual light source, and the intensity of the ambient light is equal to or less than the intensity of the light of the virtual light source. In this case, the pixel value in the highlight area is corrected.

環境光情報と仮想光源情報とを用いて、被写体に生じるハイライト領域に対する処理を制御することができる。   Using the ambient light information and the virtual light source information, it is possible to control processing for a highlight area generated in the subject.

発明の実施形態に対応する画像処理装置の構成例を示すブロック図。1 is a block diagram showing a configuration example of an image processing apparatus corresponding to an embodiment of the invention. 発明の実施形態に対応する画像処理部の機能構成の一例を示す図。The figure which shows an example of a function structure of the image process part corresponding to embodiment of invention. 発明の実施形態に対応する処理の一例を示すフローチャート。The flowchart which shows an example of the process corresponding to embodiment of invention. 発明の実施形態に対応する法線テンプレート、及び、環境光の入射方向と仮想光源の光の入射方向とに応じて求まる係数の一例を示す図。The figure which shows an example of the coefficient calculated | required according to the normal line template corresponding to embodiment of invention, and the incident direction of environmental light, and the incident direction of the light of a virtual light source. 発明の実施形態に対応する座標系を説明するための図。The figure for demonstrating the coordinate system corresponding to embodiment of invention.

以下に、本発明の実施形態を、添付の図面に基づいて詳細に説明する。本実施形態に対応する画像処理装置は、画像に対して仮想光源を設定し、当該仮想光源から画像内の被写体像に光が照射されたリライティング画像を生成する。その際、被写体に対して光源からを照射される光(環境光と、仮想光源からの光とを含む)により生じるハイライト領域を制御する。ここで、ハイライト領域とは、光源から照射された光が被写体の表面で反射することにより、白く写った一部の被写体領域のことをいう。   Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. The image processing apparatus corresponding to the present embodiment sets a virtual light source for an image, and generates a relighting image in which light is emitted from the virtual light source to a subject image in the image. At that time, a highlight region generated by light (including ambient light and light from a virtual light source) irradiated from the light source to the subject is controlled. Here, the highlight area refers to a part of the subject area that appears white due to the light emitted from the light source being reflected by the surface of the subject.

[実施形態1]
以下、添付の図面を参照して、発明の第1の実施形態に対応する画像処理装置について説明する。本実施形態では、画像処理装置としてデジタルカメラを例に説明する。但し、画像処理装置の実施形態には、デジタルカメラ以外に、例えばパーソナルコンピュータ、携帯電話、スマートフォン、PDA、タブレット端末、デジタルビデオカメラなどの任意の情報処理端末或いは撮像装置が含まれる。
[Embodiment 1]
Hereinafter, an image processing apparatus corresponding to a first embodiment of the invention will be described with reference to the accompanying drawings. In the present embodiment, a digital camera will be described as an example of the image processing apparatus. However, the embodiment of the image processing apparatus includes any information processing terminal or imaging device such as a personal computer, a mobile phone, a smartphone, a PDA, a tablet terminal, and a digital video camera in addition to the digital camera.

図1はデジタルカメラ100の構成を示すブロック図である。図1においてデジタルカメラ100は、以下の構成を備える。レンズ群101は、ズームレンズ、フォーカスレンズを含んで構成される。レンズ群101は、デジタルカメラ100が一眼レフのデジタルカメラの場合は交換レンズとして取り付け可能に構成されてもよい。シャッター102は絞り機能を備える。撮像部103は光学像を電気信号に変換するCCDやCMOS素子等で構成される。A/D変換器104はアナログ信号をデジタル信号に変換する。画像処理部105は、A/D変換器104から出力される画像データに対し、ホワイトバランス処理や、γ処理、色補正処理などの各種画像処理を行う。画像メモリ106はデジタルカメラ100において処理される画像を保持する。メモリ制御部107は画像メモリ106を制御し、画像の書き込み、読み出しを制御する。D/A変換器108は入力デジタル信号をアナログ信号に変換する。表示部109はLCDや有機EL等で構成されるディスプレイである。コーデック部110は画像データを圧縮符号化・復号化する。   FIG. 1 is a block diagram showing the configuration of the digital camera 100. In FIG. 1, the digital camera 100 has the following configuration. The lens group 101 includes a zoom lens and a focus lens. The lens group 101 may be configured to be attachable as an interchangeable lens when the digital camera 100 is a single-lens reflex digital camera. The shutter 102 has an aperture function. The imaging unit 103 includes a CCD, a CMOS element, or the like that converts an optical image into an electrical signal. The A / D converter 104 converts an analog signal into a digital signal. The image processing unit 105 performs various image processing such as white balance processing, γ processing, and color correction processing on the image data output from the A / D converter 104. The image memory 106 holds an image processed by the digital camera 100. A memory control unit 107 controls the image memory 106 to control image writing and reading. The D / A converter 108 converts the input digital signal into an analog signal. The display unit 109 is a display composed of an LCD, an organic EL, or the like. The codec unit 110 compresses and decodes image data.

媒体インタフェース(I/F)111は記憶媒体200とのインタフェースである。記憶媒体112はメモリカードやハードディスク等の記憶媒体であり、媒体I/F111を介してデジタルカメラ100に着脱可能になっている。システム制御部50はデジタルカメラ100のシステム全体を制御する。操作部120は各種の操作指示をユーザから受け付ける。電源スイッチ121はデジタルカメラ100の電源のオン/オフを制御するスイッチである。電源制御部122は電池の装着の有無、電池の種類、電池残量の検出を行う。電源部123はデジタルカメラ100に電力を供給する電池である。不揮発性メモリ124は電気的に消去・記憶が可能な記憶媒体であり、例えばEEPROM等が用いられる。   A medium interface (I / F) 111 is an interface with the storage medium 200. The storage medium 112 is a storage medium such as a memory card or a hard disk, and is detachable from the digital camera 100 via a medium I / F 111. The system control unit 50 controls the entire system of the digital camera 100. The operation unit 120 receives various operation instructions from the user. The power switch 121 is a switch that controls on / off of the power of the digital camera 100. The power control unit 122 detects the presence / absence of a battery, the type of battery, and the remaining battery level. The power supply unit 123 is a battery that supplies power to the digital camera 100. The non-volatile memory 124 is an electrically erasable / storable storage medium such as an EEPROM.

システムタイマ125は各種制御に用いる時間や、内蔵された時計の時間を計測する。システムメモリ126はシステム制御部50の動作用の定数、変数、不揮発性メモリ124から読みだしたプログラム等を展開するためのメモリである。測距センサ127は被写体との距離を測定し、撮影画素の画素単位に対応する距離情報を2次元の距離マップ画像として出力する。   The system timer 125 measures the time used for various controls and the time of a built-in clock. The system memory 126 is a memory for expanding constants and variables for operation of the system control unit 50, programs read from the nonvolatile memory 124, and the like. The distance measuring sensor 127 measures the distance to the subject and outputs distance information corresponding to the pixel unit of the photographic pixel as a two-dimensional distance map image.

次に、上記のように構成されたデジタルカメラ100における被写体撮影時の基本的な処理の流れについて説明する。撮像部103は、レンズ群101及びシャッター102を介して入射した光を光電変換し、画像信号をA/D変換器104へ出力する。A/D変換器104は撮像部103から出力されるアナログ画像信号をデジタル画像信号(画像データ)に変換し画像処理部105に出力する。   Next, a basic processing flow at the time of shooting an object in the digital camera 100 configured as described above will be described. The imaging unit 103 photoelectrically converts light incident through the lens group 101 and the shutter 102 and outputs an image signal to the A / D converter 104. The A / D converter 104 converts the analog image signal output from the imaging unit 103 into a digital image signal (image data) and outputs the digital image signal to the image processing unit 105.

画像処理部105は、A/D変換器104からの画像データ、又は、メモリ制御部107を介して画像メモリ106から読み出した画像データに対し、ホワイトバランスなどの色変換処理、γ処理などを行い、ベイヤーRGBデータ、輝度・色差信号Y、R−Y、B−Yの中で何れかの画像データを出力する。画像処理部105から出力された画像データは、メモリ制御部107を介して画像メモリ106に書き込まれる。また、画像処理部105では、撮像した画像データを用いて所定の演算処理を行い、得られた演算結果に基づいてシステム制御部50が露光制御、測距制御を行う。これにより、TTL(スルー・ザ・レンズ)方式のAF(オートフォーカス)処理、AE(自動露出)処理、などを行う。画像処理部105では更に、撮像した画像データを解析し、光源を推定し、推定した光源に基づきAWB(オートホワイトバランス)処理も行う。   The image processing unit 105 performs color conversion processing such as white balance and γ processing on the image data from the A / D converter 104 or the image data read from the image memory 106 via the memory control unit 107. Any image data among the Bayer RGB data and the luminance / color difference signals Y, RY, and BY is output. The image data output from the image processing unit 105 is written into the image memory 106 via the memory control unit 107. The image processing unit 105 performs predetermined calculation processing using the captured image data, and the system control unit 50 performs exposure control and distance measurement control based on the obtained calculation result. Thus, TTL (through the lens) AF (autofocus) processing, AE (automatic exposure) processing, and the like are performed. The image processing unit 105 further analyzes the captured image data, estimates the light source, and performs AWB (auto white balance) processing based on the estimated light source.

画像メモリ106は、撮像部103による撮像により得られた画像データや、表示部109に表示するための画像データを格納する。また、D/A変換器108は、画像メモリ106に格納されている画像表示用のデータをアナログ信号に変換して表示部109に供給する。表示部109は、LCD等の表示器上に、D/A変換器108からのアナログ信号に応じた表示を行う。コーデック部110は、画像メモリ106に記録された画像データをJPEGやMPEGなどの静止画または動画の標準規格に基づき圧縮符号化する。   The image memory 106 stores image data obtained by imaging by the imaging unit 103 and image data to be displayed on the display unit 109. The D / A converter 108 converts the image display data stored in the image memory 106 into an analog signal and supplies the analog signal to the display unit 109. The display unit 109 performs display according to an analog signal from the D / A converter 108 on a display such as an LCD. The codec unit 110 compresses and encodes the image data recorded in the image memory 106 based on a still image or moving image standard such as JPEG or MPEG.

上記の基本動作以外に、システム制御部50は、前述した不揮発性メモリ124に記録されたプログラムを実行することで、後述する本実施形態の各処理を実現する。ここでいうプログラムとは、本実施形態にて後述する各種フローチャートを実行するためのプログラムのことである。この際、システム制御部50の動作用の定数、変数、不揮発性メモリ124から読み出したプログラム等をシステムメモリ126に展開する。以上、デジタルカメラ100のブロック構成と、基本動作について説明した。   In addition to the basic operations described above, the system control unit 50 implements each process of the present embodiment, which will be described later, by executing the program recorded in the nonvolatile memory 124 described above. The program here is a program for executing various flowcharts described later in the present embodiment. At this time, constants, variables for operation of the system control unit 50, programs read from the nonvolatile memory 124, and the like are expanded in the system memory 126. The block configuration and basic operation of the digital camera 100 have been described above.

上述の図1のデジタルカメラ100において、撮像素子や表示素子のような物理的デバイスを除き、各ブロックは専用ロジック回路やメモリを用いてハードウェア的に構成されてもよい。或いは、メモリに記憶されている処理プログラムをCPU等のコンピュータが実行することにより、ソフトウェア的に構成されてもよい。また、上記ではデジタルカメラ100をレンズ群101、シャッター103、撮像部103を含む構成として説明した。しかし、発明の実施形態として、ハイライト領域を処理するための画像編集装置、画像処理装置或いは情報処理装置として、撮像機能を有しない構成で実現してもよい。   In the digital camera 100 of FIG. 1 described above, each block may be configured by hardware using a dedicated logic circuit or memory except for a physical device such as an image sensor or a display element. Alternatively, the processing program stored in the memory may be configured by software by a computer such as a CPU executing the processing program. In the above description, the digital camera 100 is described as including the lens group 101, the shutter 103, and the imaging unit 103. However, as an embodiment of the invention, an image editing apparatus, an image processing apparatus, or an information processing apparatus for processing a highlight area may be realized with a configuration that does not have an imaging function.

次に、発明の実施形態に対応するハイライト領域の処理の概要について図2から図4を参照して説明する。図2は、発明の実施形態に対応する画像処理部105の機能構成の一例を示す図である。図3は、発明の実施形態に対応する画像処理部105における処理の一例を示すフローチャートである。図4(A)は、発明の実施形態に対応する画像処理部105における処理を説明するための法線テンプレートの一例を示す図である。以下では、図3のフローチャートの流れに従い処理を説明する。該フローチャートに対応する処理は、例えば、画像処理部105として機能する1以上のプロセッサが対応するプログラム(ROM等に格納)を実行することにより実現できる。   Next, an outline of highlight area processing corresponding to the embodiment of the invention will be described with reference to FIGS. FIG. 2 is a diagram illustrating an example of a functional configuration of the image processing unit 105 corresponding to the embodiment of the invention. FIG. 3 is a flowchart showing an example of processing in the image processing unit 105 corresponding to the embodiment of the invention. FIG. 4A is a diagram illustrating an example of a normal template for explaining processing in the image processing unit 105 corresponding to the embodiment of the invention. Hereinafter, the processing will be described according to the flow of the flowchart of FIG. The processing corresponding to the flowchart can be realized by executing a program (stored in a ROM or the like) corresponding to one or more processors functioning as the image processing unit 105, for example.

まず、撮像部103から出力された画像信号がA/D変換器104を経て画像データとして画像処理部105に入力されると、S301において被写体領域検出部201が、入力画像データから被写体像を検出する。本実施形態では、被写体として人間を撮像した場合について説明し、特に被写体像として顔領域を検出する。顔領域の検出処理は周知の方法を用いることができる。当該方法には、例えば、目や口などの器官を検出して顔領域を検出する方法がある。次にS302では、法線情報取得部202が、図4(A)に示すような法線テンプレートを参照してS301で被写体領域検出部201が検出した顔領域における法線情報を取得する。次にS303では、ハイライト領域検出部203が、顔領域の中で輝度の高い領域をハイライト領域として検出する。次にS304では、環境光情報推定部204が、S302で取得した法線情報と、S303で検出したハイライト領域から、環境光の光源情報を推定する。S305では、仮想光源情報設定部205が、ユーザの入力に基づいて仮想光源の光源情報を設定する。S306では、ハイライト領域処理部206が、S304で推定した環境光の光源情報と、S305で設定した仮想光源の光源情報とに基づき、ハイライト領域の処理を行う。   First, when an image signal output from the imaging unit 103 is input to the image processing unit 105 as image data via the A / D converter 104, the subject region detection unit 201 detects a subject image from the input image data in S301. To do. In this embodiment, a case where a person is imaged as a subject will be described, and in particular, a face area is detected as a subject image. A known method can be used for the face area detection process. As the method, for example, there is a method of detecting a face region by detecting organs such as eyes and mouth. In step S302, the normal line information acquisition unit 202 acquires normal line information in the face area detected by the subject area detection unit 201 in step S301 with reference to the normal line template as illustrated in FIG. In step S303, the highlight area detection unit 203 detects an area having a high luminance in the face area as a highlight area. In step S304, the ambient light information estimation unit 204 estimates ambient light source information from the normal information acquired in step S302 and the highlight area detected in step S303. In step S305, the virtual light source information setting unit 205 sets light source information of the virtual light source based on the user input. In step S306, the highlight region processing unit 206 performs highlight region processing based on the ambient light source information estimated in step S304 and the virtual light source information set in step S305.

以上が、本実施形態に対応するハイライト領域の処理の概要であるが、ここでは撮像部103から出力された画像信号がA/D変換器104を経て画像データとして画像処理部105に入力された場合の処理として説明した。しかし、本発明が適用可能な実施形態はこれに限定されるものではない。例えば、媒体インタフェース111を介して記憶媒体112から読み出された圧縮画像データをコーデック部110で伸長し画像メモリ106に格納した後、当該画像メモリ106が格納する画像データに対して画像処理部105がハイライト処理を実施しても良い。   The above is the outline of the processing of the highlight area corresponding to the present embodiment. Here, the image signal output from the imaging unit 103 is input to the image processing unit 105 as image data through the A / D converter 104. It was explained as a process in the case of. However, embodiments to which the present invention is applicable are not limited to this. For example, after the compressed image data read from the storage medium 112 via the medium interface 111 is decompressed by the codec unit 110 and stored in the image memory 106, the image processing unit 105 performs processing on the image data stored in the image memory 106. However, highlight processing may be performed.

次に、S302からS306の処理の詳細について説明する。まず、S302では、撮影した画像の顔領域の法線情報を取得する。この処理では、図4(A)で示すような法線テンプレートを用いてもよい。法線テンプレートとは、オブジェクトである顔の表面の各法線ベクトルのx、y、z成分に対応するRGB画素値により、当該顔の表面を表現した画像のことであり、法線マップともいう。図4(A)の法線テンプレートでは、顔が正面を向いている場合の法線情報を示しているが、顔の側面の法線情報を含んでいてもよい。実際に撮影した画像では、顔が正面を向いているとは限らないので、撮影された顔の向きに合わせた法線テンプレートを参照して法線情報を計算する必要がある。この計算を行うためには、撮影された顔の向きが正面方向から何度傾いているかの角度情報がわかればよい。角度情報の算出方法としては、公知の技術を用いることができる。例えば、特開2014−115859号公報に開示されるような、右目、左目、鼻などの器官を画像から抽出し、これらの相対的な位置関係から顔が向いている角度を算出する方法がある。本実施形態では、当該方法により算出した角度情報に応じて法線テンプレートを回転させることで、撮影された顔領域の法線情報を取得することができる。   Next, details of the processing from S302 to S306 will be described. First, in S302, the normal information of the face area of the photographed image is acquired. In this process, a normal template as shown in FIG. 4A may be used. A normal template is an image that represents the face surface by RGB pixel values corresponding to x, y, and z components of each normal vector of the face surface that is an object, and is also referred to as a normal map. . The normal template in FIG. 4A shows normal information when the face is facing the front, but may include normal information on the side of the face. In an actually captured image, the face is not always facing the front, so it is necessary to calculate normal information with reference to a normal template that matches the orientation of the captured face. In order to perform this calculation, it is only necessary to know angle information indicating how many times the direction of the photographed face is tilted from the front direction. As a method for calculating the angle information, a known technique can be used. For example, as disclosed in Japanese Patent Application Laid-Open No. 2014-115859, there is a method of extracting an organ such as a right eye, a left eye, and a nose from an image, and calculating an angle at which the face is directed from the relative positional relationship thereof. . In the present embodiment, the normal information of the captured face region can be acquired by rotating the normal template according to the angle information calculated by the method.

次にS303のハイライト領域を検出する処理では、ハイライト領域検出部203が、顔領域中の高輝度領域を、ハイライト領域として検出する。ハイライト領域の検出方法としては、S301で検出された顔領域を構成する各画素の輝度値を所定の閾値Lthと比較し、輝度値が閾値以上の画素領域をハイライト領域として検出する方法がある。閾値Lthは、例えば顔領域の平均輝度を用いることが考えられるが、この方法に限られない。高輝度画素として抽出された各画素が互いに隣接する場合は、これらの画素を纏めて一つのハイライト領域として扱う。このようにして、顔領域の各画素のうち輝度がLth以上である画素で構成される領域がハイライト領域として抽出される。   Next, in the process of detecting a highlight area in S303, the highlight area detection unit 203 detects a high luminance area in the face area as a highlight area. As a method for detecting the highlight area, there is a method in which the luminance value of each pixel constituting the face area detected in S301 is compared with a predetermined threshold Lth, and a pixel area having a luminance value equal to or higher than the threshold is detected as the highlight area. is there. The threshold Lth may be, for example, the average luminance of the face area, but is not limited to this method. When the pixels extracted as high luminance pixels are adjacent to each other, these pixels are collectively treated as one highlight area. In this way, an area composed of pixels having a luminance of Lth or higher among the pixels of the face area is extracted as the highlight area.

次に、S304の環境光情報を推定する処理では、環境光情報推定部204が、画像撮影時の環境光の情報を推定する。本実施形態では、環境光の入射方向(位置)、強度を推定する。まず、環境光の入射方向の推定方法について図5を参照して説明する。まず、環境光に基づきハイライト領域が発生するのは、図5(a)に示すように、環境光の光源(例えば、太陽や室内の照明)から対象物(本実施形態では被写体である人間の顔)の表面に入射したときの入射角θiと、表面から反射したときの反射角θrとがほぼ等しい場合である。このような反射形態を一般には「鏡面反射」といい、画像データのうち鏡面反射した反射光がデジタルカメラ100に直接入射している部位では、被写体そのもの色よりも光源色が支配的になる。本実施形態では、鏡面反射時にθi=θrとなることを利用して、被写体の法線とデジタルカメラ100との角度θrに基づき、環境光の入射方向VL1を推定する。   Next, in the process of estimating the ambient light information in S304, the ambient light information estimation unit 204 estimates the ambient light information at the time of image capturing. In this embodiment, the incident direction (position) and intensity of ambient light are estimated. First, a method for estimating the incident direction of ambient light will be described with reference to FIG. First, as shown in FIG. 5A, the highlight region is generated based on the ambient light, as shown in FIG. 5A, from the light source of the ambient light (for example, the sun or indoor lighting) to the object (in this embodiment, the human being who is the subject). In this case, the incident angle θi when the light is incident on the surface of the face and the reflection angle θr when the light is reflected from the surface are substantially equal. Such a reflection form is generally referred to as “specular reflection”, and in the portion of the image data where the reflected light that is specularly reflected is directly incident on the digital camera 100, the light source color is more dominant than the subject itself. In the present embodiment, the incident direction VL1 of the ambient light is estimated based on the angle θr between the normal line of the subject and the digital camera 100 using the fact that θi = θr during specular reflection.

図5(b)及び(c)は、本実施形態における座標系を説明する図である。図5(b)に示すように、デジタルカメラ100で被写体501を撮像する場合、デジタルカメラ100の撮像部103を原点(Ocamera)とした3次元空間(以下、カメラ座標系という)を設定する。被写体の顔の表面を構成する任意の点の座標は、カメラ座標系でXn=(xn、yn、zn)で表される(nは1以上の自然数)。このとき、カメラ座標系で座標が与えられる各点は、当該点を含む平面Pnの法線ベクトルの原点とする。例えば、被写体の顔の表面の点X1のカメラ座標系における座標を(x1、y1、z1)とすると、カメラ座標系における当該点X1の方向Xv1は、(x1、y1、z1)でベクトルとして表すことができる。そして、当該点X1は、被写体に設定されたローカル座標系における原点(Olocal)と一致し、点X1を含む平面P1の法線ベクトルNx1は、ローカル座標系においてNx1=(xnl、yn1、zn1)となる。当該ローカル座標系はカメラ座標系内に設定され、各軸方向はカメラ座標系と一致しているものとする。また、ローカル座標系から見たデジタルカメラ100の方向は−Xv1=(−x1、−y1、−z1)で表すことができる。 FIGS. 5B and 5C are diagrams illustrating a coordinate system in the present embodiment. As shown in FIG. 5B, when the subject 501 is imaged by the digital camera 100, a three-dimensional space (hereinafter referred to as a camera coordinate system) with the imaging unit 103 of the digital camera 100 as the origin (O camera ) is set. . The coordinates of an arbitrary point constituting the surface of the subject's face are represented by Xn = (xn, yn, zn) in the camera coordinate system (n is a natural number of 1 or more). At this time, each point to which coordinates are given in the camera coordinate system is the origin of the normal vector of the plane Pn including the point. For example, if the coordinates of the point X1 on the face of the subject in the camera coordinate system are (x1, y1, z1), the direction Xv1 of the point X1 in the camera coordinate system is expressed as a vector by (x1, y1, z1). be able to. The point X1 coincides with the origin (Olocal) in the local coordinate system set for the subject, and the normal vector Nx1 of the plane P1 including the point X1 is Nx1 = (xnl, yn1, zn1) in the local coordinate system. It becomes. It is assumed that the local coordinate system is set in the camera coordinate system, and each axis direction coincides with the camera coordinate system. In addition, the direction of the digital camera 100 viewed from the local coordinate system can be expressed by -Xv1 = (-x1, -y1, -z1).

よって、平面P1がハイライト領域に含まれる場合、環境光の入射角度θiは、法線ベクトルNx1と、カメラ座標系における当該点X1のベクトルXv1との交差角度と一致し、当該交差角度が図5(a)のθrに相当する。このとき、環境光の入射方向を示すベクトルVL1は、Xv1を法線ベクトルNx1の回りに点X1を基準に180度回転させたベクトルと見なすことができ、以下の式(1)で求めることができる。
VL1=Nx1(Nx1・(−Xv1))−[−Xv1-Nx1(Nx1・(−Xv1))] (1)
Therefore, when the plane P1 is included in the highlight region, the incident angle θi of the ambient light coincides with the intersection angle between the normal vector Nx1 and the vector Xv1 of the point X1 in the camera coordinate system. This corresponds to θr of 5 (a). At this time, the vector VL1 indicating the incident direction of the ambient light can be regarded as a vector obtained by rotating Xv1 around the normal vector Nx1 by 180 degrees with respect to the point X1, and is obtained by the following equation (1). it can.
VL1 = Nx1 (Nx1 · (−Xv1)) − [− Xv1−Nx1 (Nx1 · (−Xv1))] (1)

上記において、n(n・x)は、ベクトルxの単位ベクトルnへの射影を表す。このようにして環境光の入射方向VL1をS302で得られた法線テンプレートを利用して求めることができる。上述の方法は一例として記載したものであって、環境光の入射方向を上述とは異なる方法により算出しても良い。また、ハイライト領域に複数画素が含まれる場合、各画素について計算した式(1)の計算結果を平均した値を環境光の入射方向としても良い。また、各画素の法線ベクトルの平均を先に算出し、当該平均法線ベクトルを強度が最も強い平面の法線ベクトルとして上述の計算によりVL1を求めても良い。或いは、環境光の入射方向の情報はデジタルカメラ100での撮影時に予め与えられても良い。   In the above, n (n · x) represents the projection of the vector x onto the unit vector n. In this way, the incident direction VL1 of the ambient light can be obtained by using the normal template obtained in S302. The above method is described as an example, and the incident direction of the ambient light may be calculated by a method different from the above method. In addition, when a plurality of pixels are included in the highlight region, a value obtained by averaging the calculation results of Expression (1) calculated for each pixel may be used as the incident direction of the ambient light. Alternatively, the average of the normal vectors of each pixel may be calculated first, and VL1 may be obtained by the above calculation using the average normal vector as the normal vector of the plane having the strongest intensity. Alternatively, the information on the incident direction of the ambient light may be given in advance at the time of shooting with the digital camera 100.

次に、環境光の強度の推定方法について説明する。環境光の強度としては、S303で検出されたハイライト領域と、検出されたハイライト領域の周辺領域との輝度の差分を用いる。例えば、以下のように環境光の強度を求める。まず、ハイライト領域に含まれる画素数をi、各画素の輝度の値をYh(1≦i≦i)とすると、ハイライト領域の平均輝度Yhは、式(2)のように求まる。
Yh = ΣYh/i (2)
Next, a method for estimating the intensity of ambient light will be described. As the intensity of the ambient light, the difference in luminance between the highlight area detected in S303 and the peripheral area of the detected highlight area is used. For example, the intensity of ambient light is obtained as follows. First, assuming that the number of pixels included in the highlight region is i 1 and the luminance value of each pixel is Yh i (1 ≦ i ≦ i 1 ), the average luminance Yh of the highlight region is expressed by Equation (2). I want.
Yh = ΣYh i / i 1 (2)

また、ハイライト領域からの距離がDth以下である領域を周辺領域とすると、周辺領域の平均輝度Ylは、周辺領域に含まれる画素数j及び周辺領域に含まれる各画素の輝度の値Yl(1≦j≦j)を用いて、式(3)のように求まる。
Yl = ΣYl/j (3)
式(2)、(3)で求めたYh、Ylの差分(式(4)参照)を環境光の強度L1として用いる。
Further, when the region distance is Dth or less from the highlight region and the peripheral region, the average luminance Yl of the peripheral region, the value of luminance of each pixel included in the pixel number j 1 and the peripheral region included in the peripheral area Yl Using j (1 ≦ j ≦ j 1 ), it is obtained as shown in Equation (3).
Yl = ΣYl j / j 1 (3)
The difference between Yh and Yl obtained by the equations (2) and (3) (see the equation (4)) is used as the ambient light intensity L1.

L1 = Yh − Yl (4)
S305では、ユーザの指示のもと、仮想光源情報設定部205が仮想光源の光源情報を設定する。設定する仮想光源の光源情報は、仮想光源が照射する光の入射方向(位置)及び、仮想光源の光の強度(以下、簡単のため、それぞれ仮想光源の入射方向、仮想光源の強度という。)であるとする。ここでは操作部120を介してデジタルカメラ100のユーザからの操作を受け付ける。具体的には、操作部120に対するユーザ操作によって、図示しないメニューからリライティング処理が選択され、リライティング処理で使用する情報が入力される。本実施形態では説明の簡略化のため、仮想光源の入射方向(位置)VL2、及び強度L2をユーザが入力するものとする(プリセットの中から選択する方法でもよい)。
L1 = Yh−Yl (4)
In step S <b> 305, the virtual light source information setting unit 205 sets light source information of the virtual light source based on a user instruction. The light source information of the virtual light source to be set includes the incident direction (position) of light emitted by the virtual light source and the intensity of light of the virtual light source (hereinafter referred to as the incident direction of the virtual light source and the intensity of the virtual light source for simplicity). Suppose that Here, an operation from the user of the digital camera 100 is accepted via the operation unit 120. Specifically, a relighting process is selected from a menu (not shown) by a user operation on the operation unit 120, and information used in the relighting process is input. In this embodiment, for simplification of description, it is assumed that the user inputs the incident direction (position) VL2 and the intensity L2 of the virtual light source (a method of selecting from presets may be used).

S306では、環境光の光源情報と仮想光源の光源情報とに基づき、ハイライト領域処理部206が画像データにおけるハイライト領域を処理する。本実施形態では、当該処理として環境光によって生じたハイライト領域に含まれる画素の画素値を補正する。以下、具体的な処理の流れを説明する。   In step S306, based on the light source information of the ambient light and the light source information of the virtual light source, the highlight area processing unit 206 processes the highlight area in the image data. In the present embodiment, the pixel value of the pixel included in the highlight area generated by the ambient light is corrected as the processing. Hereinafter, a specific processing flow will be described.

ハイライト領域の処理に当たっては、まず環境光の強度L1と仮想光源の強度L2との比較を行う。L1がL2よりも大きい場合(L1>L2)は、環境光のほうが仮想光源の光よりも強度が強いとして、環境光によって生じたハイライト領域の画素値を補正しない。一方、環境光の強度が仮想光源の強度以下の場合(L1≦L2)は、環境光によって生じたハイライト領域の画素値を補正することができる。このとき更に環境光の入射方向VL1と仮想光源の入射方向VL2とを比較する。VL1とVL2の方向が類似する(光源の位置が互いに近い)場合は環境光によって生じたハイライト領域の画素値を補正しない。一方、VL1とVL2の方向が類似しない(光源の位置が互いに遠い)場合、環境光によって生じたハイライト領域の画素値を補正する。当該補正は、例えば、ハイライト領域の画素値から環境光の強度L1に基づく値を減算することにより行っても良い。また、ハイライト領域の周辺領域の画素値を用いてハイライト領域の画素値を補正してもよく、例えば、周辺領域の画素の平均値、或いは、当該平均値を更に処理した値によりハイライト領域の画素値を置換してもよい。その他、ハイライト領域を低減、或いは、除去するための公知の方法を使用することができる。   In processing the highlight area, first, the ambient light intensity L1 is compared with the virtual light source intensity L2. When L1 is larger than L2 (L1> L2), the intensity of the ambient light is stronger than the light of the virtual light source, and the pixel value in the highlight area generated by the ambient light is not corrected. On the other hand, when the intensity of the environmental light is equal to or lower than the intensity of the virtual light source (L1 ≦ L2), the pixel value in the highlight area caused by the environmental light can be corrected. At this time, the incident direction VL1 of the ambient light is further compared with the incident direction VL2 of the virtual light source. When the directions of VL1 and VL2 are similar (the positions of the light sources are close to each other), the pixel value in the highlight area caused by the ambient light is not corrected. On the other hand, when the directions of VL1 and VL2 are not similar (the positions of the light sources are far from each other), the pixel value in the highlight area caused by the ambient light is corrected. The correction may be performed, for example, by subtracting a value based on the ambient light intensity L1 from the pixel value in the highlight area. Further, the pixel value of the highlight area may be corrected using the pixel value of the peripheral area of the highlight area. For example, highlighting is performed by using an average value of pixels in the peripheral area or a value obtained by further processing the average value. You may replace the pixel value of an area | region. In addition, a known method for reducing or removing the highlight area can be used.

また、VL1とVL2の方向の類似性(光源間の距離)の判定は、例えば、VL1とVL2の交差する角度θcを求め、θcが所定の閾値θthよりも小さいか否かで判定する。VL1及びVL2を用いるとcosθcを下記の式(5)で表すことができる。
cosθc = <VL1,VL2> / ( ||VL1|| × ||VL2|| ) (5)
The determination of the similarity between the directions of VL1 and VL2 (the distance between the light sources) is performed by, for example, obtaining an angle θc at which VL1 and VL2 intersect and determining whether θc is smaller than a predetermined threshold θth. When VL1 and VL2 are used, cos θc can be expressed by the following formula (5).
cos θc = <VL1, VL2> / (|| VL1 || × || VL2 ||) (5)

ここで、<a、b>はaとbの内積を、||a||はaのノルムをそれぞれ表すとする。式(5)よりcosθcが求まるので、逆三角関数を用いてθcが求まる。交差角度θcが閾値θthよりも小さい場合、環境光の入射方向と仮想光源の入射方向とが近いと判断し、環境光によって生じたハイライト領域を除去しない。求めたθが閾値θth以上の場合は、環境光の入射方向と仮想光源の入射方向とが離れていると判断し、環境光によって生じたハイライト領域を除去する。   Here, <a, b> represents an inner product of a and b, and || a || represents a norm of a. Since cos θc is obtained from Equation (5), θc is obtained using an inverse trigonometric function. When the intersection angle θc is smaller than the threshold value θth, it is determined that the incident direction of the ambient light is close to the incident direction of the virtual light source, and the highlight area caused by the ambient light is not removed. If the calculated θ is equal to or larger than the threshold θth, it is determined that the incident direction of the ambient light is away from the incident direction of the virtual light source, and the highlight area caused by the ambient light is removed.

以上、本実施形態における処理について説明した。上述の本実施形態では、法線情報を取得する方法として、法線テンプレートを使用したが、この方法に限らず、例えば測距センサ127が出力する撮影画素の画素単位に対応する距離情報を使用して法線情報を取得しても良い。また、法線テンプレートは、被写体ごとに用意しても良い。   The processing in this embodiment has been described above. In the present embodiment described above, the normal template is used as a method for acquiring the normal information. However, the present invention is not limited to this method. For example, distance information corresponding to the pixel unit of the photographing pixel output from the distance measuring sensor 127 is used. Then, normal information may be acquired. A normal template may be prepared for each subject.

また上述の実施形態では、環境光の強度が仮想光源の強度よりも弱くかつ環境光の入射方向と仮想光源の入射方向とが類似しない場合に環境光によって生じたハイライト領域の画素値を補正することとした。その際、環境光の入射方向と仮想光源の入射方向との離れ度合いに応じて、環境光によって生じたハイライトを弱めてもよい。例えば、図4(B)で示すように環境光の入射方向と仮想光源の入射方向とのなす角θcが大きくなるにつれて値が大きくなるような係数kを設定する。そして、環境光の強度L1にkを乗算した値を環境光によって生じたハイライト領域の各画素の画素値Yhから減算し、ハイライト領域の各画素値を補正することができる。補正後の画素値Yh'は式(6)に基づき算出することができる。これにより、環境光の入射方向と仮想光源の入射方向とに応じて、環境光によって生じたハイライトを弱めることができる。
Yh'=Yh−kL1 (6)
In the above-described embodiment, the pixel value in the highlight area caused by the ambient light is corrected when the ambient light intensity is weaker than the virtual light source and the incident direction of the ambient light is not similar to the incident direction of the virtual light source. It was decided to. At that time, the highlight generated by the ambient light may be weakened according to the degree of separation between the incident direction of the ambient light and the incident direction of the virtual light source. For example, as shown in FIG. 4B, the coefficient k is set such that the value increases as the angle θc formed by the incident direction of the ambient light and the incident direction of the virtual light source increases. Then, it is possible to a value obtained by multiplying the k strength L1 of the ambient light is subtracted from the pixel value Yh i of each pixel of the highlight area caused by ambient light, corrects each pixel value in the highlight region. The corrected pixel value Yh i ′ can be calculated based on Equation (6). Thereby, the highlight generated by the environmental light can be weakened according to the incident direction of the environmental light and the incident direction of the virtual light source.
Yh i ′ = Yh i −kL1 (6)

さらに上述の実施形態では、仮想光源の強度をユーザが直接指定する場合を説明したが、これに限らず、例えば環境光の強度を基準として、環境光の強度よりも強いか弱いかなどの相対的な情報をユーザが指定しても良い。   Furthermore, in the above-described embodiment, the case where the user directly designates the intensity of the virtual light source has been described. However, the present invention is not limited to this. For example, relative to whether the intensity of the ambient light is stronger or weaker based on the intensity of the ambient light. The user may specify such information.

上述の実施形態では、環境光及び仮想光源の光源情報として、光源からの光の入射方向(位置)、強度を用いたが、これに限らず、例えば光源の拡散度合いなどの情報を用いても良い。ここで、拡散度合いとは、光源から照射される光の強度の方向依存性をさしている。光源から照射される光の強度が特定の方向のみ強い場合は拡散度合いが低いとし、光源から照射される光の強度が方向によらず均一に近いほど拡散度合いが高いとする。また、光源情報に拡散度合いが含まれる場合、仮想光源の光の拡散度合いをユーザが指定することができる。このとき、環境光の拡散度合いを仮想光源の光の拡散度合いとして用いても良い。光源情報に拡散度合いが含まれる場合、光源の方向を示す各ベクトルVL1、VL2は、光源から照射される光の強度が最も強い方向を示すものとする。   In the above-described embodiment, the incident direction (position) and intensity of light from the light source are used as the light source information of the ambient light and the virtual light source. However, the present invention is not limited to this. good. Here, the degree of diffusion refers to the direction dependency of the intensity of light emitted from the light source. It is assumed that the degree of diffusion is low when the intensity of light emitted from the light source is strong only in a specific direction, and the degree of diffusion is high as the intensity of light emitted from the light source is almost uniform regardless of the direction. In addition, when the light source information includes the degree of diffusion, the user can specify the degree of light diffusion of the virtual light source. At this time, the degree of diffusion of ambient light may be used as the degree of diffusion of light from the virtual light source. When the degree of diffusion is included in the light source information, the vectors VL1 and VL2 indicating the direction of the light source indicate the direction in which the intensity of light emitted from the light source is the strongest.

以上のように、本実施形態によれば被写体に照射される環境光の入射方向と、新たに設定される仮想光源から照射される光の入射方向との関係と、環境光と仮想光源の光との強度との関係に応じて、画像データに形成された環境光に基づくハイライト領域を処理することができる。例えば、環境光の入射方向と仮想光源の入射方向とが異なり、かつ仮想光源の光の方が環境光よりも強度が強い場合、環境光によるハイライト領域が残存していては不自然となるのでこれを除去することができる。一方、仮想光源を設定した場合であっても環境光の方が仮想光源の光よりも強度が強い場合には、ハイライト領域を残存させることができる。   As described above, according to the present embodiment, the relationship between the incident direction of the ambient light irradiated to the subject and the incident direction of the light irradiated from the newly set virtual light source, and the ambient light and the light of the virtual light source The highlight area based on the ambient light formed in the image data can be processed according to the relationship with the intensity. For example, if the incident direction of the ambient light and the incident direction of the virtual light source are different and the intensity of the light of the virtual light source is stronger than the ambient light, it will be unnatural if the highlight area due to the ambient light remains. So this can be removed. On the other hand, even when the virtual light source is set, if the intensity of the ambient light is stronger than the light of the virtual light source, the highlight area can remain.

[実施形態2]
上述の実施形態1では、環境光によって生じたハイライト領域を除去する場合について説明した。これに対し、発明の第2の実施形態では、仮想光源によって生じるハイライト領域を付加する場合を説明する。
[Embodiment 2]
In the first embodiment described above, the case of removing the highlight area caused by the ambient light has been described. On the other hand, in the second embodiment of the invention, a case where a highlight area generated by a virtual light source is added will be described.

本実施形態に対応するデジタルカメラ及び画像処理部の構成は図1及び図2に示したものと同様である。また、画像処理部105におけるハイライト処理の流れも図3及び図4を参照して説明したものと同様である。但し、図3のS306における処理が異なっている。以下、本実施形態に対応するハイライト領域の処理方法について説明する。本実施形態ではS306において、環境光の光源情報と仮想光源の光源情報とに基づき、仮想光源によって生じるハイライト領域の付加を行う。当該処理の詳細を以下に説明する。   The configurations of the digital camera and the image processing unit corresponding to this embodiment are the same as those shown in FIGS. The flow of highlight processing in the image processing unit 105 is also the same as that described with reference to FIGS. However, the process in S306 of FIG. 3 is different. Hereinafter, a processing method of a highlight area corresponding to the present embodiment will be described. In this embodiment, in step S306, a highlight area generated by the virtual light source is added based on the light source information of the ambient light and the light source information of the virtual light source. Details of the processing will be described below.

本処理では、まず環境光の強度L1と仮想光源の強度L2との比較を行う。L1がL2以下の場合(L1≦L2)、仮想光源の光のほうが環境光よりも強度が強いとして、仮想光源からの光によって生じるハイライト領域を付加する。ハイライト領域は、以下の方法により設定することができる。まず、仮想光源の入射方向VL2とS302で得られた法線情報とから、式(1)に基づきS301で検出された顔を構成する任意の平面についてベクトルを算出する。次に、算出されたベクトルの値が当該ベクトルを算出した平面の法線ベクトルの原点のカメラ座標系の座標に対応するものを選択する。そして、選択されたベクトルに対応する平面を含む面を仮想光源からの光に基づくハイライト領域とすることができる。また、ハイライト領域の生成は、例えば、仮想光源の強度L2をハイライト領域に含まれる画素の画素値に加算することにより行っても良い。   In this process, first, the ambient light intensity L1 is compared with the virtual light source intensity L2. When L1 is less than or equal to L2 (L1 ≦ L2), the highlight region generated by the light from the virtual light source is added on the assumption that the light from the virtual light source is stronger than the ambient light. The highlight area can be set by the following method. First, based on the incident direction VL2 of the virtual light source and the normal information obtained in S302, a vector is calculated for an arbitrary plane constituting the face detected in S301 based on Expression (1). Next, a value corresponding to the coordinates of the camera coordinate system of the origin of the normal vector of the plane on which the calculated vector is calculated is selected. A surface including a plane corresponding to the selected vector can be used as a highlight region based on light from the virtual light source. Further, the generation of the highlight area may be performed, for example, by adding the intensity L2 of the virtual light source to the pixel value of the pixel included in the highlight area.

一方、L1がL2より大きい場合(L1>L2)は、更に環境光の入射方向VL1と仮想光源の入射方向VL2とを比較する。VL1とVL2の方向が類似する場合は、仮想光源によって生じるハイライト領域を付加し、VL1とVL2の方向が類似しない場合は、仮想光源によって生じるハイライト領域を付加しない。VL1とVL2の方向の類似性の判定方法は、実施形態1で述べたものと同様とし、ここでは詳細な説明は省略する。   On the other hand, when L1 is larger than L2 (L1> L2), the incident direction VL1 of the ambient light is further compared with the incident direction VL2 of the virtual light source. When the directions of VL1 and VL2 are similar, a highlight area generated by the virtual light source is added, and when the directions of VL1 and VL2 are not similar, the highlight area generated by the virtual light source is not added. The method of determining the similarity between the directions of VL1 and VL2 is the same as that described in the first embodiment, and detailed description thereof is omitted here.

以上のように、本実施形態によれば被写体に照射される環境光の入射方向と、新たに設定される仮想光源から照射される光の入射方向との関係と、環境光と仮想光源の光との強度との関係に応じて、画像データに仮想光源に基づくハイライト領域を付加することができる。例えば、環境光の入射方向と仮想光源の入射方向とが異なり、かつ仮想光源の光の方が環境光よりも強度が強い場合、環境光によるハイライト領域が残存していては不自然となるのでこれを除去することができる。一方、仮想光源を設定した場合であっても環境光の方が仮想光源の光よりも強度が強い場合には、ハイライト領域を残存させることができる。   As described above, according to the present embodiment, the relationship between the incident direction of the ambient light irradiated to the subject and the incident direction of the light irradiated from the newly set virtual light source, and the ambient light and the light of the virtual light source The highlight area based on the virtual light source can be added to the image data according to the relationship with the intensity. For example, if the incident direction of the ambient light and the incident direction of the virtual light source are different and the intensity of the light of the virtual light source is stronger than the ambient light, it will be unnatural if the highlight area due to the ambient light remains. So this can be removed. On the other hand, even when the virtual light source is set, if the intensity of the ambient light is stronger than the light of the virtual light source, the highlight area can remain.

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

100:デジタルカメラ、101:レンズ群、102:シャッター、103:撮像部、104:A/D変換部、105:画像処理部、106:画像メモリ、107:メモリ制御部、108:D/A変換部、109:表示部、110:コーデック部、111:媒体I/F、112:記憶媒体、113:外部出力I/F、50:システム制御部、120:操作部、121:電源スイッチ、122:電源制御部、123:電源部、124:不揮発性メモリ、125:システムタイマ、126:システムメモリ、127:距離センサ DESCRIPTION OF SYMBOLS 100: Digital camera, 101: Lens group, 102: Shutter, 103: Imaging part, 104: A / D conversion part, 105: Image processing part, 106: Image memory, 107: Memory control part, 108: D / A conversion 109: Display unit 110: Codec unit 111: Medium I / F 112: Storage medium 113: External output I / F 50: System control unit 120: Operation unit 121: Power switch 122: Power control unit, 123: power supply unit, 124: nonvolatile memory, 125: system timer, 126: system memory, 127: distance sensor

Claims (12)

画像に対して仮想光源を設定し、前記仮想光源から前記画像内の被写体像に光が照射されたリライティング画像を生成する画像処理装置であって、
前記被写体像を構成する画素の輝度値に基づき、前記画像におけるハイライト領域を検出する検出手段と、
前記画像における環境光の強度を推定する推定手段と、
前記リライティング画像を生成する処理において、前記仮想光源の光の強度と、推定された前記環境光の強度との比較に基づき、前記画像におけるハイライト領域を補正する処理手段と
を備え、
前記処理手段は、前記環境光の強度が前記仮想光源の光の強度よりも大きい場合に前記ハイライト領域の画素値を補正せず、前記環境光の強度が前記仮想光源の光の強度以下の場合に前記ハイライト領域の画素値を補正することを特徴とする画像処理装置。
An image processing apparatus that sets a virtual light source for an image and generates a relighting image in which light is emitted from the virtual light source to a subject image in the image,
Detecting means for detecting a highlight area in the image based on a luminance value of a pixel constituting the subject image;
Estimating means for estimating the intensity of ambient light in the image;
In the process of generating the relighting image, a processing unit that corrects a highlight area in the image based on a comparison between the light intensity of the virtual light source and the estimated intensity of the ambient light,
The processing means does not correct the pixel value of the highlight region when the intensity of the ambient light is larger than the intensity of the light of the virtual light source, and the intensity of the ambient light is equal to or less than the intensity of the light of the virtual light source. In this case, the image processing apparatus corrects the pixel value of the highlight area.
前記被写体像に対応する被写体の表面のうち、前記ハイライト領域に含まれる領域の法線ベクトルの情報に基づき、前記環境光の入射方向を算出する算出手段を更に備え、
前記処理手段は、前記環境光の強度が前記仮想光源の光の強度以下の場合であって、かつ、前記環境光の入射方向と設定された前記仮想光源の光の入射方向とが類似しないと判定される場合に前記ハイライト領域の画素値を補正することを特徴とする請求項1に記載の画像処理装置。
A calculation unit that calculates an incident direction of the ambient light based on information on a normal vector of a region included in the highlight region of the surface of the subject corresponding to the subject image;
The processing means is a case where the intensity of the ambient light is equal to or less than the intensity of the light of the virtual light source, and the incident direction of the ambient light is not similar to the set incident direction of the light of the virtual light source The image processing apparatus according to claim 1, wherein when it is determined, the pixel value of the highlight area is corrected.
前記環境光の入射方向と前記仮想光源の光の入射方向とは、当該方向の交差する角度が所定の閾値より小さい場合に方向が類似すると判定され、前記角度が前記閾値以上の場合に類似しないと判定されることを特徴とする請求項2に記載の画像処理装置。   The incident direction of the ambient light and the incident direction of the light of the virtual light source are determined to be similar when the angle at which the directions intersect is smaller than a predetermined threshold, and is not similar when the angle is equal to or greater than the threshold. The image processing apparatus according to claim 2, wherein the image processing apparatus is determined as follows. 前記処理手段は、前記ハイライト領域の画素値から、前記角度の大きさに応じた前記環境光の強度の値を減ずることにより、前記ハイライト領域の画素値を補正することを特徴とする請求項3に記載の画像処理装置。   The processing means corrects the pixel value of the highlight area by subtracting the value of the ambient light intensity corresponding to the magnitude of the angle from the pixel value of the highlight area. Item 4. The image processing apparatus according to Item 3. 前記処理手段は、前記ハイライト領域の周辺領域の画素値に基づき、前記ハイライト領域の画素値を補正することを特徴とする請求項1から3のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the processing unit corrects a pixel value of the highlight area based on a pixel value of a peripheral area of the highlight area. 前記処理手段は、前記環境光の強度が前記仮想光源の光の強度以下の場合に、前記仮想光源の光に基づくハイライト領域を前記画像の前記被写体像に形成することを更に特徴とする請求項2から4のいずれか1項に記載の画像処理装置。   The processing means further forms a highlight area based on the light of the virtual light source in the subject image of the image when the intensity of the environmental light is equal to or less than the light intensity of the virtual light source. Item 5. The image processing apparatus according to any one of Items 2 to 4. 前記処理手段は、前記環境光の強度が前記仮想光源の光の強度より大きい場合、
前記環境光の入射方向と前記仮想光源の光の入射方向とが類似すると判定される場合に、前記仮想光源の光に基づくハイライト領域を前記画像の前記被写体像に形成し、
前記環境光の入射方向と前記仮想光源の光の入射方向とが類似しないと判定される場合に、前記仮想光源の光に基づくハイライト領域を前記画像の前記被写体像に形成しない
ことを更に特徴とする請求項6に記載の画像処理装置。
The processing means, when the intensity of the ambient light is greater than the intensity of the light of the virtual light source,
When it is determined that the incident direction of the ambient light and the incident direction of the virtual light source are similar, a highlight region based on the light of the virtual light source is formed in the subject image of the image,
When it is determined that the incident direction of the ambient light is not similar to the incident direction of the virtual light source, a highlight region based on the light of the virtual light source is not formed in the subject image of the image. The image processing apparatus according to claim 6.
前記仮想光源の光の拡散度合いは、前記環境光の拡散度合いに対応するように設定されることを特徴とする請求項1から7のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the degree of light diffusion of the virtual light source is set so as to correspond to the degree of diffusion of the ambient light. 前記推定手段は、前記画像における前記ハイライト領域と、前記ハイライト領域の周辺領域との画素の輝度値の差分に基づき、前記環境光の強度を推定することを特徴とする請求項1から8のいずれか1項に記載の画像処理装置。   The said estimation means estimates the intensity | strength of the said ambient light based on the difference of the luminance value of the pixel of the said highlight area | region in the said image, and the peripheral area | region of the said highlight area | region. The image processing apparatus according to any one of the above. 撮像手段と、
前記撮像手段が撮像した被写体像を含む画像を処理する請求項1から9のいずれか1項に記載の画像処理装置と
を備えることを特徴とする撮像装置。
Imaging means;
An image processing apparatus comprising: the image processing apparatus according to claim 1 that processes an image including a subject image captured by the image capturing unit.
画像に対して仮想光源を設定し、前記仮想光源から前記画像内の被写体像に光が照射されたリライティング画像を生成する画像処理装置の制御方法であって、
前記画像処理装置の検出手段が、前記被写体像を構成する画素の輝度値に基づき、前記画像におけるハイライト領域を検出する検出工程と、
前記画像処理装置の推定手段が、前記画像における環境光の強度を推定する推定工程と、
前記画像処理装置の処理手段が、前記リライティング画像を生成する処理において、前記仮想光源の光の強度と、推定された前記環境光の強度との比較に基づき、前記画像におけるハイライト領域を補正する処理工程と
を含み、
前記処理工程では、前記環境光の強度が前記仮想光源の光の強度よりも大きい場合に前記ハイライト領域の画素値を補正せず、前記環境光の強度が前記仮想光源の光の強度以下の場合に前記ハイライト領域の画素値を補正する
ことを特徴とする画像処理方法。
A control method of an image processing apparatus that sets a virtual light source for an image and generates a relighting image in which light is emitted from the virtual light source to a subject image in the image,
A detecting step in which the detecting means of the image processing device detects a highlight area in the image based on a luminance value of a pixel constituting the subject image;
An estimation step in which the estimation means of the image processing apparatus estimates the intensity of ambient light in the image;
The processing unit of the image processing device corrects a highlight area in the image based on a comparison between the light intensity of the virtual light source and the estimated intensity of the ambient light in the process of generating the relighting image. Processing steps,
In the processing step, when the intensity of the ambient light is greater than the intensity of the light of the virtual light source, the pixel value of the highlight region is not corrected, and the intensity of the environment light is equal to or less than the intensity of the light of the virtual light source. And correcting the pixel value of the highlight area.
コンピュータを請求項1から9のいずれか1項に記載の画像処理装置の各手段として機能させることを特徴とするプログラム。   A program that causes a computer to function as each unit of the image processing apparatus according to any one of claims 1 to 9.
JP2016018244A 2016-02-02 2016-02-02 Image processing apparatus, imaging apparatus, control method for image processing apparatus, and program Active JP6666735B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016018244A JP6666735B2 (en) 2016-02-02 2016-02-02 Image processing apparatus, imaging apparatus, control method for image processing apparatus, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016018244A JP6666735B2 (en) 2016-02-02 2016-02-02 Image processing apparatus, imaging apparatus, control method for image processing apparatus, and program

Publications (3)

Publication Number Publication Date
JP2017138730A true JP2017138730A (en) 2017-08-10
JP2017138730A5 JP2017138730A5 (en) 2019-03-14
JP6666735B2 JP6666735B2 (en) 2020-03-18

Family

ID=59566830

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016018244A Active JP6666735B2 (en) 2016-02-02 2016-02-02 Image processing apparatus, imaging apparatus, control method for image processing apparatus, and program

Country Status (1)

Country Link
JP (1) JP6666735B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10957025B2 (en) 2018-12-03 2021-03-23 International Business Machines Corporation Photograph with variable light source distribution

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010087164A1 (en) * 2009-01-29 2010-08-05 日本電気株式会社 Color image processing method, color image processing device, and recording medium
JP2016005203A (en) * 2014-06-18 2016-01-12 キヤノン株式会社 Image processing system and control method of the same

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010087164A1 (en) * 2009-01-29 2010-08-05 日本電気株式会社 Color image processing method, color image processing device, and recording medium
JP2016005203A (en) * 2014-06-18 2016-01-12 キヤノン株式会社 Image processing system and control method of the same

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
佐々木 悠真 他: "一枚の髪型画像における毛髪のリライティング", 映像情報メディア学会技術報告, vol. 37, no. 17, JPN6020001649, 8 March 2013 (2013-03-08), JP, pages 5 - 8, ISSN: 0004197921 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10957025B2 (en) 2018-12-03 2021-03-23 International Business Machines Corporation Photograph with variable light source distribution

Also Published As

Publication number Publication date
JP6666735B2 (en) 2020-03-18

Similar Documents

Publication Publication Date Title
US11948282B2 (en) Image processing apparatus, image processing method, and storage medium for lighting processing on image using model data
JP6442209B2 (en) Image processing apparatus and control method thereof
CN108668093B (en) HDR image generation method and device
US8334907B2 (en) Photographing method and apparatus using face pose estimation of face
JP2017168982A (en) Imaging apparatus, and control method and program for imaging apparatus
JP6412386B2 (en) Image processing apparatus, control method therefor, program, and recording medium
JP2018163648A (en) Image processor, method for image processing, and program
JP6718253B2 (en) Image processing apparatus and image processing method
JP6666735B2 (en) Image processing apparatus, imaging apparatus, control method for image processing apparatus, and program
WO2012147368A1 (en) Image capturing apparatus
JP2017157043A (en) Image processing device, imaging device, and image processing method
JP6921606B2 (en) Image processing equipment, image processing methods and programs
JP7321772B2 (en) Image processing device, image processing method, and program
JP2016213717A (en) Image processing apparatus, image processing method, program, and storage medium
WO2018180860A1 (en) Image processing device, image processing method, and program
US20200322519A1 (en) Image capturing and processing device, electronic instrument, image capturing and processing method, and recording medium
JP2020010168A (en) Image processing apparatus
US11842467B2 (en) Image processing apparatus, image processing method and storage medium
JP6663246B2 (en) Image processing apparatus, imaging apparatus, control method thereof, and program
JP6727276B2 (en) Image processing apparatus, control method thereof, and program
JP6873815B2 (en) Image processing equipment, imaging equipment, image processing methods, programs, and storage media
JP2017130890A (en) Image processing device and control method and program thereof
JP2018005573A (en) Image processing device, image processing method, program, and storage medium

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20190201

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190201

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20191206

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200221

R151 Written notification of patent or utility model registration

Ref document number: 6666735

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151