JP2018185576A - Image processing device and image processing method - Google Patents

Image processing device and image processing method Download PDF

Info

Publication number
JP2018185576A
JP2018185576A JP2017085446A JP2017085446A JP2018185576A JP 2018185576 A JP2018185576 A JP 2018185576A JP 2017085446 A JP2017085446 A JP 2017085446A JP 2017085446 A JP2017085446 A JP 2017085446A JP 2018185576 A JP2018185576 A JP 2018185576A
Authority
JP
Japan
Prior art keywords
light source
image
virtual light
subject
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
JP2017085446A
Other languages
Japanese (ja)
Other versions
JP6921606B2 (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 JP2017085446A priority Critical patent/JP6921606B2/en
Publication of JP2018185576A publication Critical patent/JP2018185576A/en
Application granted granted Critical
Publication of JP6921606B2 publication Critical patent/JP6921606B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)
  • Studio Circuits (AREA)

Abstract

PROBLEM TO BE SOLVED: To solve a problem that effect of relighting processing is changed, when setting a parameter of the relighting processing for each frame image, in a moving picture photographing a moving subject, and the moving picture after the relighting processing is difficult for a user to see.SOLUTION: An image processing device performs image processing which gives relighting effect by a virtual light source to a plurality of frame images constituting a moving picture. The image processing device comprises: processing means which performs the image processing for giving the relighting effect to the frame image; and setting means which sets a parameter used for the image processing by the processing means. The setting means switches fixedly setting of the parameter, or variably setting of the parameter for each frame image, to the frame image of a predetermined period continuous in the plurality of frame images.SELECTED DRAWING: Figure 1

Description

本発明は、動画を構成する複数のフレーム画像に対して仮想光源によるリライティング効果を付与する画像処理に関する。   The present invention relates to image processing for providing a relighting effect by a virtual light source to a plurality of frame images constituting a moving image.

従来から、撮影画像に撮影時に存在しなかった仮想的な光源(以下、仮想光源と称する)を設定し、画像内の被写体に対して仮想光源から光が照射されたような効果を付与する画像処理が知られている。このような画像処理はリライティング処理と称され、撮影時の環境光で生じた影などの暗部領域を明るくするなどすることが可能である。   Conventionally, a virtual light source (hereinafter referred to as a virtual light source) that has not existed at the time of photographing is set in a photographed image, and an image that gives an effect as if light is emitted from the virtual light source to a subject in the image Processing is known. Such image processing is called relighting processing, and it is possible to brighten dark areas such as shadows caused by ambient light at the time of shooting.

下記特許文献1は、画像内の顔領域に関する情報に応じて画像の領域単位でリライティング処理を行う方法を開示している。具体的には、画像内の顔の有無および位置といった顔領域に関する情報と画像のシーン判別結果に基づいて、画像の顔領域に対してリライティング処理を行う。   Patent Document 1 below discloses a method of performing relighting processing in units of image areas in accordance with information on face areas in the image. Specifically, the relighting process is performed on the face area of the image based on the information about the face area such as the presence / absence and position of the face in the image and the scene discrimination result of the image.

特開2007−148537号公報JP 2007-148537 A

画像にリライティング処理を行って陰影を補正する場合、仮想光源の位置、強度、角度といったリライティング処理に用いるパラメータを画像内の被写体の状態に応じて、適切に設定することが必要である。   When correcting the shadow by performing the relighting process on the image, it is necessary to appropriately set parameters used for the relighting process such as the position, intensity, and angle of the virtual light source according to the state of the subject in the image.

特許文献1の方法は、静止画を対象としており、動画については考慮していない。従って、特許文献1の方法を、動きのある被写体を撮影した動画に適用すると、フレーム画像ごとにリライティング処理のパラメータが設定されるので、リライティング処理の効果が次々と変化してしまい、リライティング処理後の動画が視聴者によって見づらいという課題がある。   The method of Patent Document 1 targets still images and does not consider moving images. Therefore, when the method of Patent Document 1 is applied to a moving image obtained by shooting a moving subject, the parameters of the relighting process are set for each frame image, so that the effect of the relighting process changes one after another. There is a problem that it is difficult for viewers to see the video.

そこで、本発明は、動画に対して仮想光源によるリライティング効果を適切に付与する画像処理を提供する。   Therefore, the present invention provides image processing for appropriately giving a relighting effect by a virtual light source to a moving image.

本発明の1実施態様は、動画を構成する複数のフレーム画像に対して仮想光源によるリライティング効果を付与する画像処理を行う画像処理装置であって、前記フレーム画像にリライティング効果を付与する画像処理を行う処理手段と、前記処理手段による画像処理に用いるパラメータを設定する設定手段と、を備え、前記設定手段は、前記複数のフレーム画像における一連のフレーム画像に対して、前記パラメータを固定するか、前記パラメータをフレーム画像ごとに可変するかを、切り替え可能であることを特徴とする画像処理装置である。   One embodiment of the present invention is an image processing apparatus that performs image processing for imparting a relighting effect by a virtual light source to a plurality of frame images constituting a moving image, and performs image processing for imparting a relighting effect to the frame image. Processing means, and setting means for setting parameters used for image processing by the processing means, wherein the setting means fixes the parameters for a series of frame images in the plurality of frame images, An image processing apparatus is characterized in that the parameter can be changed for each frame image.

本発明によれば、動画に対して適切なリライティング処理を行うことが可能となる。   According to the present invention, it is possible to perform appropriate relighting processing on a moving image.

本発明におけるデジタルカメラの構成を示すブロック図である。It is a block diagram which shows the structure of the digital camera in this invention. 本発明における画像処理部の構成を示すブロック図である。It is a block diagram which shows the structure of the image process part in this invention. 本発明におけるリライティング処理部の構成を示すブロック図である。It is a block diagram which shows the structure of the relighting process part in this invention. 本発明における仮想光源による照射に対する反射を説明する図であるIt is a figure explaining the reflection with respect to irradiation by the virtual light source in this invention 本発明におけるリライティング処理前後の画像を説明する図である。It is a figure explaining the image before and after the relighting process in this invention. 本発明における仮想光源パラメータを決定するフローチャートである。It is a flowchart which determines the virtual light source parameter in this invention. 本発明における仮想光源パラメータと追尾の対応を示す表である。It is a table | surface which shows a response | compatibility with the virtual light source parameter and tracking in this invention. 本発明における被写体と仮想光源のイメージ図である。It is an image figure of the to-be-photographed object and virtual light source in this invention. 本発明における仮想光源パラメータを決定するフローチャートである。It is a flowchart which determines the virtual light source parameter in this invention.

以下、本発明の実施形態について図面を用いて詳細に説明する。なお、本発明をデジタルカメラに適用した実施形態を用いて説明するが、本発明はデジタルカメラに限らず、他の画像処理装置に適用することができる。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. Although the present invention is described using an embodiment in which the present invention is applied to a digital camera, the present invention is not limited to a digital camera and can be applied to other image processing apparatuses.

(第1の実施形態)
図1〜7を参照して、本発明の第1の実施形態を説明する。
(First embodiment)
A first embodiment of the present invention will be described with reference to FIGS.

図1は、第1の実施形態にかかるデジタルカメラの構成例を示すブロック図である。   FIG. 1 is a block diagram illustrating a configuration example of a digital camera according to the first embodiment.

図1において、100はデジタルカメラ全体、101はズームレンズ、フォーカスレンズを含むレンズ群、102は絞り機能を備えるシャッター、103は光学像を電気信号に変換するCCDやCMOS素子等で構成される撮像部、104は、アナログ信号をデジタル信号に変換するA/D変換器、105はA/D変換器104から出力される画像データに対し、ホワイトバランス処理や、γ処理、輪郭強調、色補正処理などの各種画像処理を行う画像処理部である。   In FIG. 1, reference numeral 100 denotes an entire digital camera, 101 denotes a lens group including a zoom lens and a focus lens, 102 denotes a shutter having a diaphragm function, and 103 denotes an image pickup composed of a CCD or a CMOS element that converts an optical image into an electric signal. , 104 is an A / D converter that converts an analog signal into a digital signal, and 105 is white balance processing, γ processing, contour enhancement, and color correction processing for image data output from the A / D converter 104. It is an image processing unit that performs various image processing such as.

また、106は画像メモリ、107は画像メモリ106を制御するメモリ制御部、108は入力デジタル信号をアナログ信号に変換するD/A変換器、109はLCD等の表示器、110は画像データを圧縮符号化・復号化するコーデック部である。   Reference numeral 106 denotes an image memory, 107 denotes a memory control unit that controls the image memory 106, 108 denotes a D / A converter that converts an input digital signal into an analog signal, 109 denotes a display such as an LCD, and 110 denotes compression of image data. It is a codec unit for encoding / decoding.

111は記録媒体112とのインタフェースI/F、112はメモリカードやハードディスク等の記録媒体、113は撮影画像中から被写体の位置や顔の向きといった被写体の情報を検出する被写体情報取得部、114は撮影画像にリライティング処理を行うリライティング処理部、50はデジタルカメラ100のシステム全体を制御するシステム制御部である。   111 is an interface I / F with the recording medium 112, 112 is a recording medium such as a memory card or a hard disk, 113 is a subject information acquisition unit that detects subject information such as the position of the subject and the orientation of the face from the captured image, and 114 A relighting processing unit 50 that performs relighting processing on a captured image, and a system control unit 50 that controls the entire system of the digital camera 100.

また、121はプログラムやパラメータなどを格納するEEPROMなどの不揮発性メモリであり、122はシステム制御部50の動作用の定数、変数、不揮発性メモリ124から読みだしたプログラム等を展開するシステムメモリである。123は被写体との距離を測定し、撮影画素の画素単位に対応する距離情報を2次元の距離マップ画像として出力する測距センサである。   Reference numeral 121 denotes a nonvolatile memory such as an EEPROM for storing programs and parameters. Reference numeral 122 denotes a system memory for developing constants and variables for operation of the system control unit 50, programs read from the nonvolatile memory 124, and the like. is there. A distance measuring sensor 123 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 operation at the time of photographing an object in the digital camera 100 configured as described above will be described. The imaging unit 103 photoelectrically converts light that has entered through the lens 101 and the shutter 102 and outputs it to the A / D converter 104 as an input image signal. The A / D converter 104 converts the analog image signal output from the imaging unit 103 into a digital image signal and outputs the digital image signal to the image processing unit 105.

画像処理部105は、A/D変換器104からの画像データ、又は、メモリ制御部107からの画像データに対し、ホワイトバランスなどの色変換処理、γ処理、輪郭強調処理などを行う。また、画像処理部105では、被写体情報取得部113で取得した被写体情報の結果や、撮像した画像データを用いて所定の評価値算出処理(図示しない)を行い、得られた評価値結果に基づいてシステム制御部50が露光制御、測距制御を行う。これにより、TTL(スルー・ザ・レンズ)方式のAF(オートフォーカス)処理、AE(自動露出)処理、AWB(オートホワイトバランス)処理などを行う。   The image processing unit 105 performs color conversion processing such as white balance, γ processing, and contour enhancement processing on the image data from the A / D converter 104 or the image data from the memory control unit 107. Further, the image processing unit 105 performs a predetermined evaluation value calculation process (not shown) using the result of the subject information acquired by the subject information acquisition unit 113 and the captured image data, and based on the obtained evaluation value result. Then, the system control unit 50 performs exposure control and distance measurement control. Thus, TTL (through-the-lens) AF (autofocus) processing, AE (automatic exposure) processing, AWB (auto white balance) processing, and the like are performed.

画像処理部105から出力された画像データは、メモリ制御部107を介して画像メモリ106に書き込まれる。画像メモリ106は、撮像部103から出力された画像データや、表示部109に表示するための画像データを格納する。   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 memory 106 stores image data output from the imaging unit 103 and image data to be displayed on the display unit 109.

また、D/A変換器108は、画像メモリ106に格納されている画像表示用のデータをアナログ信号に変換して表示部109に供給する。表示部109は、LCD等の表示器上に、D/A変換器108からのアナログ信号に応じた表示を行う。   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.

コーデック部110は、画像メモリ106に記録された画像データをMPEGなどの規格に基づきそれぞれ圧縮符号化する。システム制御部50は符号化した画像データを関連付けて、記録インタフェース111を介して記録媒体112に格納する。   The codec unit 110 compresses and encodes the image data recorded in the image memory 106 based on a standard such as MPEG. The system control unit 50 associates the encoded image data and stores them in the recording medium 112 via the recording interface 111.

上記の基本動作以外に、システム制御部50は、前述した不揮発性メモリ124に記録されたプログラムを実行することで、後述の各処理を実現する。ここでいうプログラムとは、後述の各種フローチャートを実行するためのプログラムのことである。この際、システム制御部50の動作用の定数、変数、不揮発性メモリ121から読み出したプログラム等をシステムメモリ122に展開する。   In addition to the above basic operations, the system control unit 50 executes the programs recorded in the nonvolatile memory 124 described above, thereby realizing each process described later. The program here is a program for executing various flowcharts described later. At this time, constants, variables for operation of the system control unit 50, programs read from the nonvolatile memory 121, and the like are expanded in the system memory 122.

次に、画像処理部105の詳細について図2を用いて説明する。図2は画像処理部105の構成を示すブロック図である。   Next, details of the image processing unit 105 will be described with reference to FIG. FIG. 2 is a block diagram illustrating a configuration of the image processing unit 105.

図2において、200は同時化処理部、201はWB増幅部、202は輝度・色信号生成部、203は輪郭強調処理部、204は輝度ガンマ処理部、205は色変換処理部、206は色γ処理部、207は色差信号生成部、208は陰影情報取得部である。   In FIG. 2, reference numeral 200 denotes a synchronization processing unit, 201 denotes a WB amplification unit, 202 denotes a luminance / color signal generation unit, 203 denotes a contour enhancement processing unit, 204 denotes a luminance gamma processing unit, 205 denotes a color conversion processing unit, and 206 denotes a color. A γ processing unit, 207 is a color difference signal generation unit, and 208 is a shadow information acquisition unit.

次に、画像処理部105における処理について説明する。図1のA/D変換部104から入力された画像信号が画像処理部105に入力される。   Next, processing in the image processing unit 105 will be described. The image signal input from the A / D conversion unit 104 in FIG. 1 is input to the image processing unit 105.

画像処理部105に入力された画像信号は同時化処理部200に入力される。同時化処理部200は入力されたベイヤーRGBの画像データに対して、同時化処理を行い、色信号R,G,Bを生成する。WB増幅部201は、システム制御部50が算出するホワイトバランスゲイン値に基づき、RGBの色信号にゲインをかけ、ホワイトバランスを調整する。WB増幅部201が出力したRGB信号は輝度・色信号生成部202に入力される。輝度・色信号生成部202はRGB信号から輝度信号Yを生成し、生成した輝度信号Yを輪郭強調処理部203、色信号RGBを色変換処理部205へ出力する。   The image signal input to the image processing unit 105 is input to the synchronization processing unit 200. The synchronization processing unit 200 performs synchronization processing on the input Bayer RGB image data to generate color signals R, G, and B. Based on the white balance gain value calculated by the system control unit 50, the WB amplification unit 201 applies a gain to the RGB color signals and adjusts the white balance. The RGB signal output from the WB amplification unit 201 is input to the luminance / color signal generation unit 202. The luminance / color signal generation unit 202 generates a luminance signal Y from the RGB signals, and outputs the generated luminance signal Y to the contour enhancement processing unit 203 and the color signal RGB to the color conversion processing unit 205.

輪郭強調処理部203では、輝度信号に対して輪郭強調処理を行い、輝度ガンマ処理部204へ出力する。輝度ガンマ処理部204では輝度信号Yに対してガンマ補正を行い、輝度信号Yを画像メモリ106に出力する。   The contour enhancement processing unit 203 performs contour enhancement processing on the luminance signal and outputs the luminance signal to the luminance gamma processing unit 204. The luminance gamma processing unit 204 performs gamma correction on the luminance signal Y and outputs the luminance signal Y to the image memory 106.

色変換処理部205は、RGB信号に対するマトリクス演算などにより、所望のカラーバランスへ変換する。色ガンマ処理部206では、RGBの色信号にガンマ補正を行う。色差信号生成部207では、RGB信号から色差信号R−Y、B−Y信号を生成する。   The color conversion processing unit 205 performs conversion to a desired color balance by performing a matrix operation on the RGB signals. The color gamma processing unit 206 performs gamma correction on the RGB color signals. The color difference signal generation unit 207 generates color difference signals RY and BY signals from the RGB signals.

画像メモリ106に出力された画像信号(Y,R−Y,B−Y)信号は、コーデック部110によって圧縮符号化し、記録媒体112に記録する。   The image signal (Y, RY, BY) signal output to the image memory 106 is compression encoded by the codec unit 110 and recorded on the recording medium 112.

また、色変換処理部205の出力RGB信号は陰影情報取得部208へも入力する。陰影情報取得部208は、環境光源によって被写体に生じた陰影の状態を解析するための情報を取得する。例えば、被写体の平均輝度情報および顔領域の輝度ヒストグラム情報などを陰影情報として取得する。   The output RGB signal of the color conversion processing unit 205 is also input to the shadow information acquisition unit 208. The shadow information acquisition unit 208 acquires information for analyzing the state of the shadow generated on the subject by the environmental light source. For example, average luminance information of the subject, luminance histogram information of the face area, and the like are acquired as shadow information.

次にリライティング処理部114の構成および動作について図3を用いて説明する。   Next, the configuration and operation of the relighting processing unit 114 will be described with reference to FIG.

たとえばユーザ操作によりリライティング処理が選択されている場合は、画像処理部105から出力したデータをリライティング処理部114に入力し、仮想光源によるリライティング処理を行う。   For example, when the relighting process is selected by a user operation, the data output from the image processing unit 105 is input to the relighting process unit 114, and the relighting process using a virtual light source is performed.

図3はリライティング処理部114の構成を示すブロック図である。   FIG. 3 is a block diagram showing a configuration of the relighting processing unit 114.

図3において、301は入力された輝度・色差信号(Y、B−Y、R−Y)をRGB信号に変換するRGB信号変換部、302はデガンマ処理を行うデガンマ処理部である。また、303は測距センサ123から出力される撮像装置と被写体との距離情報を取得する距離算出部、304は被写体の法線を算出する法線算出部、305は、仮想光源が被写体に反射した成分を算出する仮想光源反射成分算出部、306は仮想光源によるリライティング効果を付加する仮想光源付加処理部である。   In FIG. 3, reference numeral 301 denotes an RGB signal conversion unit that converts input luminance / color difference signals (Y, BY, RY) into RGB signals, and 302 denotes a degamma processing unit that performs degamma processing. Reference numeral 303 denotes a distance calculation unit that acquires distance information between the imaging device output from the distance measuring sensor 123 and the subject, 304 denotes a normal calculation unit that calculates the normal of the subject, and 305 denotes a virtual light source that reflects the subject. A virtual light source reflection component calculation unit 306 that calculates the calculated component is a virtual light source addition processing unit that adds a relighting effect by the virtual light source.

また、307はRGB信号にガンマ特性をかけるガンマ処理部、308は、RGB信号を輝度・色差信号(Y、B−Y、R−Y)に変換する輝度・色差信号変換部である。   Reference numeral 307 denotes a gamma processing unit that applies gamma characteristics to the RGB signal, and reference numeral 308 denotes a luminance / color difference signal conversion unit that converts the RGB signal into luminance / color difference signals (Y, BY, RY).

上記構成のリライティング処理部114の動作について説明する。   The operation of the relighting processing unit 114 configured as described above will be described.

リライティング処理部114は、画像メモリ106に記録された画像データについて輝度・色差信号(Y、B−Y、R−Y)を読み出し、入力とする。RGB信号変換部301は、入力された輝度・色差信号(Y、B−Y、R−Y)をRGB信号に変換し、デガンマ処理部302へ出力する。   The relighting processing unit 114 reads out luminance / color difference signals (Y, BY, RY) from the image data recorded in the image memory 106 and inputs them. The RGB signal conversion unit 301 converts the input luminance / color difference signals (Y, BY, RY) into RGB signals and outputs them to the degamma processing unit 302.

デガンマ処理部302は、画像処理部105のガンマ処理部で掛けられたガンマ特性と逆の特性の演算を行いリニアデータに変換する。デガンマ処理部302は、リニア変換後のRGB信号(Rt、Gt、Bt)を、仮想光源反射成分算出部305および仮想光源付加処理部306に出力する。   The de-gamma processing unit 302 calculates a characteristic opposite to the gamma characteristic multiplied by the gamma processing unit of the image processing unit 105 and converts it to linear data. The degamma processing unit 302 outputs the RGB signals (Rt, Gt, Bt) after linear conversion to the virtual light source reflection component calculation unit 305 and the virtual light source addition processing unit 306.

一方、距離算出部303は測距センサ123から取得した被写体距離情報から距離マップを算出する。被写体距離情報とは、撮影画像の画素単位で得られる2次元の距離情報のことである。法線算出部304は距離算出部303から取得した距離情報から法線マップを算出する。距離マップから法線マップを生成する方法に関しては、公知の技術を用いるものとするが、具体的な処理例について図4を用いて説明する。   On the other hand, the distance calculation unit 303 calculates a distance map from the subject distance information acquired from the distance measuring sensor 123. The subject distance information is two-dimensional distance information obtained for each pixel of the captured image. The normal calculation unit 304 calculates a normal map from the distance information acquired from the distance calculation unit 303. As a method for generating a normal map from a distance map, a known technique is used. A specific processing example will be described with reference to FIG.

図4はカメラ撮影座標と、被写体の関係を示す図である。例えば、図4に示すようにある被写体401に対して、撮影画像の水平方向の差分ΔHに対する距離(奥行き)Dの差分ΔDから勾配情報を算出し、勾配情報から法線Nを算出することが可能である。各画素に対して上記の処理を行うことで、撮影画像の各画素に対応する法線情報Nを算出可能である。法線算出部304は、撮影画像の各画素に対応する法線情報を法線マップとして仮想光源反射成分算出部305に出力する。   FIG. 4 is a diagram illustrating the relationship between camera shooting coordinates and a subject. For example, as shown in FIG. 4, for a subject 401, gradient information is calculated from a difference ΔD of a distance (depth) D with respect to a difference ΔH in the horizontal direction of a captured image, and a normal N is calculated from the gradient information. Is possible. By performing the above processing on each pixel, it is possible to calculate normal information N corresponding to each pixel of the captured image. The normal calculation unit 304 outputs normal information corresponding to each pixel of the captured image to the virtual light source reflection component calculation unit 305 as a normal map.

仮想光源反射成分算出部305では、光源と被写体の距離K、法線情報N、仮想光源パラメータLに基づき、仮想光源が被写体に反射する成分を算出する。   The virtual light source reflection component calculation unit 305 calculates a component that the virtual light source reflects to the subject based on the distance K between the light source and the subject, the normal information N, and the virtual light source parameter L.

具体的には、光源と被写体との距離Kの二乗に反比例し、被写体法線ベクトルNと光源方向ベクトルLの内積に比例するように、撮影画像に対応する座標位置の反射成分を算出する。   Specifically, the reflection component at the coordinate position corresponding to the captured image is calculated so as to be inversely proportional to the square of the distance K between the light source and the subject and proportional to the inner product of the subject normal vector N and the light source direction vector L.

これについて、図4を用いて説明する。図4において、401が被写体、402は設定した仮想光源の位置を示している。デジタルカメラ100で撮影された撮影画像の水平画素位置H1(垂直画素位置は説明の簡略化のため省略)における反射成分は、カメラ座標H1における法線N1と仮想光源の方向ベクトルL1の内積に比例し、仮想光源と被写体位置の距離K1に反比例する値となる。   This will be described with reference to FIG. In FIG. 4, 401 indicates the subject, and 402 indicates the position of the set virtual light source. The reflection component at the horizontal pixel position H1 (the vertical pixel position is omitted for the sake of simplicity) of the captured image captured by the digital camera 100 is proportional to the inner product of the normal N1 at the camera coordinate H1 and the direction vector L1 of the virtual light source. The value is inversely proportional to the distance K1 between the virtual light source and the subject position.

この関係を数式で表現すると仮想光源による被写体反射成分(Ra、Ga、Ba)は下記の通り(式1)となる。
Ra=α×(−L・N)/K×Rt
Ga=α×(−L・N)/K×Gt (式1)
Ba=α×(−L・N)/K×Bt
When this relationship is expressed by a mathematical expression, the subject reflection components (Ra, Ga, Ba) by the virtual light source are as follows (Formula 1).
Ra = α × (−L · N) / K 2 × Rt
Ga = α × (−L · N) / K 2 × Gt (Formula 1)
Ba = α × (−L · N) / K 2 × Bt

ここで、αは仮想光源の強さでありリライティング補正量のゲイン値である。Lは仮想光源の3次元方向ベクトル、Nは被写体の3次元法線ベクトル、Kは仮想光源と被写体の距離である。Rt、Gt、Btはデガンマ処理部302から出力された撮影RGBデータである。   Here, α is the strength of the virtual light source and the gain value of the relighting correction amount. L is the three-dimensional direction vector of the virtual light source, N is the three-dimensional normal vector of the subject, and K is the distance between the virtual light source and the subject. Rt, Gt, and Bt are photographing RGB data output from the degamma processing unit 302.

上記のように算出した仮想光源による反射成分(Ra、Ga、Ba)は仮想光源付加処理部306へ出力される。仮想光源付加処理部306では、仮想光源成分(Ra、Ga、Ba)を付加する下記の(式2)に従う処理を行う。
Rout=Rt+Ra
Gout=Gt+Ga (式2)
Bout=Bt+Ba
The reflection components (Ra, Ga, Ba) by the virtual light source calculated as described above are output to the virtual light source addition processing unit 306. The virtual light source addition processing unit 306 performs processing according to the following (Equation 2) for adding virtual light source components (Ra, Ga, Ba).
Rout = Rt + Ra
Gout = Gt + Ga (Formula 2)
Bout = Bt + Ba

仮想光源付加処理部306から出力された画像信号(Rout、Gout、Bout)はガンマ処理部307に入力される。ガンマ処理部307では、RGBの入力信号にガンマ補正を行う。色差信号生成部308では、RGB信号から輝度Y、色差信号R−Y、B−Y信号を生成する。   The image signals (Rout, Gout, Bout) output from the virtual light source addition processing unit 306 are input to the gamma processing unit 307. The gamma processing unit 307 performs gamma correction on the RGB input signals. The color difference signal generation unit 308 generates luminance Y, color difference signals RY, and BY signals from the RGB signals.

以上が、リライティング処理部114の動作である。リライティング処理部114によりリライティング処理した例を図5に示す。図5(a)がリライティング処理前の撮影画像、図5(b)がリライティング処理後の撮影画像である。図5(a)で暗かった被写体が仮想光源をあててリライティング処理をすることで、図5(b)のように明るく補正されている。   The above is the operation of the relighting processing unit 114. An example of the relighting process performed by the relighting processing unit 114 is shown in FIG. FIG. 5A shows a photographed image before the relighting process, and FIG. 5B shows a photographed image after the relighting process. The dark subject in FIG. 5A is brightly corrected as shown in FIG. 5B by applying relighting processing to the virtual light source.

システム制御部50は、リライティング補正部114が出力した輝度・色差信号を、メモリ制御部107の制御によって、画像メモリ106に蓄積したのち、コーデック部110で圧縮符号化を行う。また、I/F111を介して記録媒体112に記録する。   The system control unit 50 accumulates the luminance / color difference signal output from the relighting correction unit 114 in the image memory 106 under the control of the memory control unit 107, and then performs compression encoding in the codec unit 110. In addition, recording is performed on the recording medium 112 via the I / F 111.

次に、システム制御部50が、被写体情報取得部113で取得した被写体情報に基づいてリライティング処理部114で仮想光源のパラメータを決定する処理フローについて以下で説明する。   Next, a processing flow in which the system control unit 50 determines the parameters of the virtual light source in the relighting processing unit 114 based on the subject information acquired by the subject information acquisition unit 113 will be described below.

ここでの被写体情報取得部113は、主被写体を検出する主被写体検出部と、主被写体検出部により検出した主被写体の顔器官を検出する顔器官検出部、及び主被写体検出部により検出した主被写体を追尾する追尾部で構成されている。主被写体検出方法、顔器官検出方法、追尾方法については、公知の技術を用いるものとする。例えば、主被写体検出方法としては、画面内の特徴点から被写体の位置を推定し、特徴量の最も大きい領域を主被写体と判定するなどの方法がある。例えば、顔器官検出方法としては、エッジから顔の輪郭や目などの複数の部位を検出し、その位置関係に基づいて顔の向きを検出するなどの方法がある。例えば、追尾方法としては、時間方向に異なる画像を比較して移動ベクトルを求める方法や、被写体又はその一部を特徴色パターン化し、異なる時間で撮影された画像を特徴色パターンマッチングによって追尾する方法などがある。   Here, the subject information acquisition unit 113 includes a main subject detection unit that detects a main subject, a face organ detection unit that detects a facial organ of the main subject detected by the main subject detection unit, and a main subject detection unit that detects the main subject. It consists of a tracking unit that tracks the subject. Known techniques are used for the main subject detection method, face organ detection method, and tracking method. For example, as a main subject detection method, there is a method of estimating the position of a subject from feature points in the screen and determining a region having the largest feature amount as a main subject. For example, as a face organ detection method, there is a method of detecting a plurality of parts such as a face outline and eyes from an edge and detecting a face direction based on the positional relationship. For example, as a tracking method, a method of obtaining a movement vector by comparing different images in the time direction, or a method of making a subject or a part thereof a characteristic color pattern and tracking an image taken at different times by characteristic color pattern matching and so on.

図6は、システム制御部50の動作を示したフローチャートである。以下、図6のフローチャートに従って、システム制御部50が被写体情報取得部113で取得した被写体情報に基づいて、リライティング処理部114の仮想光源のパラメータを決定する動作について説明する。   FIG. 6 is a flowchart showing the operation of the system control unit 50. Hereinafter, the operation of the relighting processing unit 114 for determining the parameters of the virtual light source based on the subject information acquired by the subject information acquisition unit 113 will be described with reference to the flowchart of FIG.

ステップS601では、操作部120を介してユーザからの操作によってリライティング処理が選択されているか判定する。即ち、リライティング処理部114による処理を行うか否かを判定する。リライティングを行う場合はステップ602に進む。   In step S601, it is determined whether relighting processing is selected by an operation from the user via the operation unit 120. That is, it is determined whether or not processing by the relighting processing unit 114 is performed. If rewriting is performed, the process proceeds to step 602.

ステップS602では、被写体を撮影する。   In step S602, the subject is photographed.

ステップS603では、被写体情報取得部113において、各フレームで被写体を追尾出来ているか否かを判定する。追尾が成功している場合はステップS604に進み、追尾が失敗している場合はステップS605に進む。   In step S603, the subject information acquisition unit 113 determines whether the subject can be tracked in each frame. If tracking has succeeded, the process proceeds to step S604, and if tracking has failed, the process proceeds to step S605.

具体的には、図7(a)に示すフレーム番号(フレームNo.)と追尾結果の対応表に示した被写体情報を取得する。図7(a)において、701はフレーム番号を示す。702は追尾が出来ているか否かのフラグを示す。   Specifically, the subject information shown in the correspondence table between the frame number (frame No.) and the tracking result shown in FIG. In FIG. 7A, reference numeral 701 denotes a frame number. Reference numeral 702 denotes a flag indicating whether or not tracking is possible.

追尾が成功している場合はフラグを1とし、追尾が失敗している場合はフラグを0とする。703は追尾結果、すなわち主被写体の顔位置の座標を示す。図7(a)の702で示す追尾が成功しているか否かのフラグに応じて、フラグが1であった場合はステップS604に進み、フラグが0であった場合はステップS605に進む。   The flag is set to 1 when tracking is successful, and the flag is set to 0 when tracking fails. Reference numeral 703 denotes the tracking result, that is, the coordinates of the face position of the main subject. In accordance with the flag indicating whether or not the tracking indicated by 702 in FIG. 7A is successful, the process proceeds to step S604 if the flag is 1, and proceeds to step S605 if the flag is 0.

ステップS604では、ステップS603において追尾が成功していた場合に、リライティング処理部114において、追尾OK時の仮想光源のパラメータ設定表に基づき、仮想光源のパラメータを決定する。具体的には、図7(b)に示す追尾OK時の仮想光源設定表に基づいて決定する。図7(b)において、704はモードを示し、705は仮想光源設定を示す。モードが0の時は仮想光源の位置をフレーム毎に変えないよう制御する。   In step S604, if tracking is successful in step S603, the relighting processing unit 114 determines the parameters of the virtual light source based on the parameter setting table of the virtual light source when tracking is OK. Specifically, it is determined based on the virtual light source setting table at the time of tracking OK shown in FIG. In FIG. 7B, 704 indicates a mode, and 705 indicates a virtual light source setting. When the mode is 0, control is performed so that the position of the virtual light source is not changed for each frame.

例えば、フレーム番号が3の時は、追尾フラグが1であり、1フレーム前のフレーム番号2の時の仮想光源の位置と同一の位置となるよう仮想光源のパラメータを制御する。
また、モードが1の時は、追尾結果に合わせて仮想光源の位置をフレーム毎に変えるよう制御する。例えば、フレーム番号が2の時は、主被写体の顔位置(x,y)に仮想光源があたるように仮想光源の位置、角度、強度といった仮想光源のパラメータを決定し、フレーム番号が3の時は、主被写体の顔位置(x,y)に仮想光源があたるように仮想光源の位置・角度・強度といったパラメータを決定する。すなわち、フレーム番号が2の時の仮想光源による被写体反射成分(Ra(x,y)、Ga(x,y)、Ba(x,y))は、次式(式3)で表わされる。なお、モード0とモード1の設定はユーザからの指示操作によって決めてもよいし、画像を解析して被写体の状態に応じて自動的に決定するようにしてもよい。
Ra(x,y)=
α×(−L(x,y)・N(x,y))/K(x,y×Rt
Ga(x,y)=
α×(−L(x,y)・N(x,y))/K(x,y×Gt
Ba(x,y)=
α×(−L(x,y)・N(x,y))/K(x,y×Bt
(式3)
For example, when the frame number is 3, the tracking flag is 1, and the parameters of the virtual light source are controlled so as to be the same position as the virtual light source at the time of frame number 2 one frame before.
When the mode is 1, control is performed to change the position of the virtual light source for each frame in accordance with the tracking result. For example, when the frame number is 2, the virtual light source parameters such as the position, angle, and intensity of the virtual light source are determined so that the virtual light source hits the face position (x 2 , y 2 ) of the main subject, and the frame number is 3 In this case, parameters such as the position, angle, and intensity of the virtual light source are determined so that the virtual light source hits the face position (x 3 , y 3 ) of the main subject. That is, the subject reflection components (Ra (x 2 , y 2 ), Ga (x 2 , y 2 ), Ba (x 2 , y 2 )) by the virtual light source when the frame number is 2 are expressed by the following formulas (formula 3 ). It should be noted that the setting of mode 0 and mode 1 may be determined by an instruction operation from the user, or may be determined automatically according to the state of the subject by analyzing the image.
Ra (x 2 , y 2 ) =
α × (−L (x 2 , y 2 ) · N (x 2 , y 2 )) / K (x 2 , y 2 ) 2 × Rt
Ga (x 2 , y 2 ) =
α × (−L (x 2 , y 2 ) · N (x 2 , y 2 )) / K (x 2 , y 2 ) 2 × Gt
Ba (x 2 , y 2 ) =
α × (−L (x 2 , y 2 ) · N (x 2 , y 2 )) / K (x 2 , y 2 ) 2 × Bt
(Formula 3)

L(x,y)は、仮想光源の3次元方向ベクトル、N(x,y)は、(x,y)の位置にいる被写体の3次元法線ベクトル、K(x,y)は仮想光源と(x,y)の位置にいる被写体との距離を示す。仮想光源があたるとは、(Ra(x,y)、Ga(x,y)、Ba(x,y))が正の値となる条件を満たしていれば良い。 L (x 2 , y 2 ) is the three-dimensional direction vector of the virtual light source, N (x 2 , y 2 ) is the three-dimensional normal vector of the subject at the position (x 2 , y 2 ), and K (x 2 , y 2 ) indicates the distance between the virtual light source and the subject at the position (x 2 , y 2 ). In order to hit a virtual light source, it is only necessary to satisfy the condition that (Ra (x 2 , y 2 ), Ga (x 2 , y 2 ), Ba (x 2 , y 2 )) is a positive value.

同様に、フレーム番号が3の時の仮想光源による被写体反射成分(Ra(x,y)、Ga(x,y)、Ba(x,y))は、次式(式4)で表わされる。
Ra(x,y)=
α×(−L(x,y)・N(x,y))/K(x,y×Rt
Ga(x,y)=
α×(−L(x,y)・N(x,y))/K(x,y×Gt
Ba(x,y)=
α×(−L(x,y)・N(x,y))/K(x,y×Bt
(式4)
Similarly, the subject reflection components (Ra (x 3 , y 3 ), Ga (x 3 , y 3 ), Ba (x 3 , y 3 )) by the virtual light source when the frame number is 3 are expressed by the following equations (formulas) 4).
Ra (x 3 , y 3 ) =
α × (−L (x 3 , y 3 ) · N (x 3 , y 3 )) / K (x 3 , y 3 ) 2 × Rt
Ga (x 3 , y 3 ) =
α × (−L (x 3 , y 3 ) · N (x 3 , y 3 )) / K (x 3 , y 3 ) 2 × Gt
Ba (x 3 , y 3 ) =
α × (−L (x 3 , y 3 ) · N (x 3 , y 3 )) / K (x 3 , y 3 ) 2 × Bt
(Formula 4)

L(x,y)は、仮想光源の3次元方向ベクトル、N(x,y)は、(x,y)の位置にいる被写体の3次元法線ベクトル、K(x,y)は仮想光源と(x,y)の位置にいる被写体との距離を示す。仮想光源があたるとは、(Ra(x,y)、Ga(x,y)、Ba(x,y))が正の値となる条件を満たしていれば良い。 L (x 3 , y 3 ) is the three-dimensional direction vector of the virtual light source, N (x 3 , y 3 ) is the three-dimensional normal vector of the subject at the position (x 3 , y 3 ), and K (x 3 , y 3 ) indicates the distance between the virtual light source and the subject at the position (x 3 , y 3 ). In order to hit the virtual light source, it is only necessary to satisfy the condition that (Ra (x 3 , y 3 ), Ga (x 3 , y 3 ), Ba (x 3 , y 3 )) is a positive value.

ステップS605では、ステップS603において追尾が出来なかった場合に、リライティング処理部114において、追尾NG時の仮想光源のパラメータ設定表に基づき、仮想光源のパラメータを決定する。具体的には、図7(c)に示す追尾NG時の仮想光源設定表に基づいて決定する。   In step S605, when tracking cannot be performed in step S603, the relighting processing unit 114 determines the parameters of the virtual light source based on the virtual light source parameter setting table at the time of tracking NG. Specifically, it is determined based on the virtual light source setting table at the time of tracking NG shown in FIG.

図7(c)において、706はモードを示し、707は仮想光源設定を示す。モードが0の時は仮想光源をOFFにする。例えば、フレーム番号が101の時は、追尾フラグが0となり、追尾が出来ていないので仮想光源をOFFにする。具体的には、仮想光源の強さを示すゲインαを0とする。   In FIG. 7C, 706 indicates a mode, and 707 indicates a virtual light source setting. When the mode is 0, the virtual light source is turned off. For example, when the frame number is 101, the tracking flag is 0, and tracking is not performed, so the virtual light source is turned off. Specifically, the gain α indicating the strength of the virtual light source is set to zero.

また、モードが1の時は、仮想光源の強度を弱めるよう制御する。例えば、フレーム番号が101の時は、フレーム番号が100の時よりも仮想光源の強度を弱めるよう制御する。具体的には、仮想光源の強さを示すゲインαの値をフレーム番号が100の時よりも小さい値とする。   When the mode is 1, control is performed so as to weaken the intensity of the virtual light source. For example, when the frame number is 101, the intensity of the virtual light source is controlled to be weaker than when the frame number is 100. Specifically, the value of the gain α indicating the strength of the virtual light source is set to a value smaller than that when the frame number is 100.

以上の処理によって制御部50は、被写体情報取得部113で取得した被写体情報に基づいて、リライティング処理部114の仮想光源のパラメータを決定する。   Based on the above processing, the control unit 50 determines the parameters of the virtual light source of the relighting processing unit 114 based on the subject information acquired by the subject information acquisition unit 113.

また、本実施例では、追尾OK時、追尾NG時の仮想光源設定表において、モードが0、1の2つある場合について説明したが、被写体情報取得部113で取得した被写体情報を基に仮想光源の位置・角度・強度などのパラメータを制御するものであれば、これに限定するものではない。   Further, in this embodiment, the case where there are two modes of 0 and 1 in the virtual light source setting table at the time of tracking OK and tracking NG has been described, but the virtual information is based on the subject information acquired by the subject information acquisition unit 113. The present invention is not limited to this as long as it controls parameters such as the position, angle, and intensity of the light source.

例えば、被写体情報取得部113の顔器官検出部において、主被写体の顔の向きについての被写体情報を取得し、その顔の向き情報に基づいて、仮想光源の角度を変えるよう制御する構成であっても良い。   For example, the face organ detection unit of the subject information acquisition unit 113 acquires subject information about the face orientation of the main subject, and controls to change the angle of the virtual light source based on the face orientation information. Also good.

また、本実施例では、リライティングにより明るく補正する場合について述べたが、逆に暗くするリライティングを行ってもよい。その場合、仮想光源のゲイン値αをマイナスにする。   In this embodiment, the case of correcting brightly by relighting has been described, but conversely, relighting that darkens may be performed. In that case, the gain value α of the virtual light source is made negative.

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

また、仮想光源によるリライティング効果を付加する場合に、距離の二乗に反比例する式で計算したが、リライティング効果の付加量をこの方式で算出するものに限定するものではない。例えば、距離Dに反比例するものや、ガウス分布的に照射範囲が変化する式であってもよい。   In addition, when the relighting effect by the virtual light source is added, the calculation is performed using an equation that is inversely proportional to the square of the distance. However, the amount of the relighting effect added is not limited to that calculated by this method. For example, an expression that is inversely proportional to the distance D or an expression in which the irradiation range changes in a Gaussian distribution may be used.

以上の形態によれば、複数のフレーム画像において連続する所定期間のフレーム画像に対して、リライティング処理に用いるパラメータを固定して設定するか、フレーム画像ごとに可変して設定するかを切り替えることができるので、動画における被写体の状態に応じて適切なリライティング処理を行うことができる。   According to the above embodiment, it is possible to switch between setting a parameter used for relighting processing fixedly for a frame image of a predetermined period in a plurality of frame images or setting a variable for each frame image. Therefore, it is possible to perform appropriate relighting processing according to the state of the subject in the moving image.

(第2の実施形態)
次に第2の実施形態として、主被写体検出部のみから構成される被写体情報取得部113による被写体情報に基づいて、リライティング処理部114の仮想光源のパラメータを決定する方法について説明する。
(Second Embodiment)
Next, as a second embodiment, a method for determining the parameters of the virtual light source of the relighting processing unit 114 based on the subject information by the subject information acquisition unit 113 composed only of the main subject detection unit will be described.

なお、第2の実施形態においては、撮像装置の一例として実施例1と同じくデジタルカメラに本発明を適用した例を説明することとし、基本構成は実施例1と共通であり、以下の説明においては実施例1との差異点についてのみ記載することとする。   In the second embodiment, an example in which the present invention is applied to a digital camera as in Example 1 will be described as an example of an imaging apparatus, and the basic configuration is the same as that in Example 1. In the following description, Will describe only the differences from the first embodiment.

第1の実施形態において、被写体情報取得部113は、主被写体検出部、器官検出部、追尾部により構成されていたが、第2の実施形態では被写体情報取得部113は、主被写体検出部のみから構成されている点が第1の実施形態と異なる。   In the first embodiment, the subject information acquisition unit 113 includes a main subject detection unit, an organ detection unit, and a tracking unit. However, in the second embodiment, the subject information acquisition unit 113 includes only the main subject detection unit. This is different from the first embodiment.

また、第1の実施形態では追尾結果を基にリライティング処理を撮影とほぼ同時にリアルタイムに処理することが可能であったが、第2の実施形態においては、リアルタイムではなく撮影後も後処理としてリライティング処理を実行できる点が第1の実施形態と異なる。   In the first embodiment, the relighting process can be processed in real time almost simultaneously with the shooting based on the tracking result. However, in the second embodiment, the relighting is performed as a post process after shooting instead of in real time. The point which can perform a process is different from 1st Embodiment.

図8は、システム制御部50の動作を示したフローチャートである。以下、図8のフローチャートに従って、システム制御部50が被写体情報取得部113で取得した被写体情報に基づいて、リライティング処理部114の仮想光源のパラメータを決定する動作について説明する。   FIG. 8 is a flowchart showing the operation of the system control unit 50. Hereinafter, the operation of the relighting processing unit 114 for determining the parameters of the virtual light source based on the subject information acquired by the subject information acquisition unit 113 will be described with reference to the flowchart of FIG.

ステップS801では、操作部120を介してユーザからの操作によってリライティング処理が選択されているか判定する。即ち、リライティング処理部114による処理を行うか否かを判定する。リライティングを行う場合はステップ802に進む。   In step S <b> 801, it is determined whether relighting processing is selected by an operation from the user via the operation unit 120. That is, it is determined whether or not processing by the relighting processing unit 114 is performed. When rewriting is performed, the process proceeds to step 802.

ステップS802では、被写体を撮影する。   In step S802, the subject is photographed.

ステップS803では、被写体情報取得部113において、時刻tの主被写体の位置情報を取得する。 In step S803, the photographic subject information obtaining unit 113 obtains the position information of the main subject at the time t 1.

ステップS804では、被写体情報取得部113において、時刻tの主被写体の位置情報を取得する。ここで、時刻t1、時刻tは、それぞれフレーム番号1、フレーム番号nの画像であってもよい。 At step S804, the in the photographic subject information obtaining unit 113 obtains the position information of the main subject at time t n. Here, time t 1 and time t n may be images of frame number 1 and frame number n, respectively.

ステップS805では、ステップS802、ステップS803で取得した主被写体の位置情報からリライティング処理部114の仮想光源パラメータを決定する。例えば、図9(a)、(b)に示すように被写体が移動している場合、時刻tにおける被写体位置(xt1、yt1)、時刻tにおける被写体位置(xtn、ytn)と被写体の位置情報を取得する。 In step S805, the virtual light source parameter of the relighting processing unit 114 is determined from the position information of the main subject acquired in steps S802 and S803. For example, FIG. 9 (a), the case where moving the subject (b), the object position at time t 1 (x t1, y t1 ), object position at time t n (x tn, y tn ) And position information of the subject.

リライティング処理部114では、被写体が(xt1、yt1)から(xtn、ytn)まで移動したという情報を基に、どちらの位置にいても仮想光源からの光が被写体にあたるように仮想光源の位置、強度、角度のパラメータを決定する。 Based on the information that the subject has moved from (x t1 , y t1 ) to (x tn , y tn ), the relighting processing unit 114 makes the virtual light source so that the light from the virtual light source strikes the subject at any position. Determine the parameters of position, intensity and angle.

例えば、被写体が(xt1、yt1)から動かなかった場合の仮想光源の位置よりも、被写体が(xt1、yt1)から(xtn、ytn)まで移動した場合の仮想光源の位置は被写体から遠くに設定し、角度は(xt1、yt1)の位置でも(xtn、ytn)の位置でもあたる範囲の角度、強度に関しても(xt1、yt1)の位置でも(xt1、yt1)の位置でもあたる強度に設定する。 For example, the position of the virtual light source in the case of moving from the position of the virtual light source when the subject did not move from the (x t1, y t1), the subject from (x t1, y t1) to (x tn, y tn) is set far from the object, the angle (x t1, y t1) be (x tn, y tn) at the position of the angular range which corresponds at the position of, and (x t1, y t1) with respect to strength at the position (x The intensity corresponding to the position of t1 , yt1 ) is set.

具体的には、被写体位置が(xt1、yt1)の時の仮想光源による被写体反射成分(Ra(xt1,yt1)、Ga(xt1,yt1)、Ba(xt1,yt1))は、次式(式5)で表わされる。
Ra(xt1,yt1)=
α×(−L(xt1,yt1)・N(xt1,yt1))/K(xt1,yt1×Rt
Ga(xt1,yt1)=
α×(−L(xt1,yt1)・N(xt1,t1))/K(xt1,yt1×Gt
Ba(xt1,yt1)=
α×(−L(xt1,yt1)・N(xt1,yt1))/K(xt1,yt1×Bt
(式5)
Specifically, subject reflection components (Ra (x t1 , y t1 ), Ga (x t1 , y t1 ), Ba (x t1 , y t1 ) by the virtual light source when the subject position is (x t1 , y t1 ). )) Is expressed by the following formula (Formula 5).
Ra (x t1 , y t1 ) =
α × (−L (x t1 , y t1 ) · N (x t1 , y t1 )) / K (x t1 , y t1 ) 2 × Rt
Ga (x t1 , y t1 ) =
α × (−L (x t1 , y t1 ) · N (x t1, y t1 )) / K (x t1 , y t1 ) 2 × Gt
Ba (x t1 , y t1 ) =
α × (−L (x t1 , y t1 ) · N (x t1 , y t1 )) / K (x t1 , y t1 ) 2 × Bt
(Formula 5)

L(xt1,yt1)は、仮想光源の3次元方向ベクトル、N(xt1,yt1)は、(xt1,yt1)の位置にいる被写体の3次元法線ベクトル、K(xt1,yt1)は仮想光源と(xt1,yt1)の位置にいる被写体との距離を示す。仮想光源があたるとは、(Ra(xt1,yt1)、Ga(xt1,yt1)、Ba(xt1,yt1))が正の値となる条件を満たしていれば良い。 L (x t1 , y t1 ) is the three-dimensional direction vector of the virtual light source, N (x t1 , y t1 ) is the three-dimensional normal vector of the subject at the position (x t1 , y t1 ), and K (x t1 , yt1 ) indicates the distance between the virtual light source and the subject at the position of ( xt1 , yt1 ). In order to hit the virtual light source, it is only necessary to satisfy a condition in which (Ra ( xt1 , yt1 ), Ga ( xt1 , yt1 ), Ba ( xt1 , yt1 )) is a positive value.

同様に、被写体位置が(xtn、ytn)の時の仮想光源による被写体反射成分(Ra(xtn,ytn)、Ga(xtn,ytn)、Ba(xtn,ytn))は、次式(式6)で表わされる。
Ra(xtn,ytn)=
α×(−L(xtn,ytn)・N(xtn,ytn))/K(xtn,ytn×Rt
Ga(xtn,ytn)=
α×(−L(xtn,ytn)・N(xtn,tn))/K(xtn,ytn×Gt
Ba(xtn,ytn)=
α×(−L(xtn,ytn)・N(xtn,ytn))/K(xtn,ytn×Bt
(式6)
Similarly, the subject position (x tn, y tn) subject reflected component due to virtual light source when the (Ra (x tn, y tn ), Ga (x tn, y tn), Ba (x tn, y tn)) Is represented by the following formula (formula 6).
Ra (x tn , y tn ) =
α × (−L (x tn , y tn ) · N (x tn , y tn )) / K (x tn , y tn ) 2 × Rt
Ga (x tn , y tn ) =
α × (−L (x tn , y tn ) · N (x tn, y tn )) / K (x tn , y tn ) 2 × Gt
Ba (x tn , y tn ) =
α × (−L (x tn , y tn ) · N (x tn , y tn )) / K (x tn , y tn ) 2 × Bt
(Formula 6)

L(xtn,ytn)は、仮想光源の3次元方向ベクトル、N(xtn,ytn)は、(xtn,ytn)の位置にいる被写体の3次元法線ベクトル、K(xtn,ytn)は仮想光源と(xtn,ytn)の位置にいる被写体との距離を示す。仮想光源があたるとは、(Ra(xtn,ytn)、Ga(xtn,ytn)、Ba(xtn,ytn))が正の値となる条件を満たしていれば良い。 L (x tn , y tn ) is the three-dimensional direction vector of the virtual light source, N (x tn , y tn ) is the three-dimensional normal vector of the subject at the position (x tn , y tn ), and K (x tn , y tn ) indicates the distance between the virtual light source and the subject at the position of (x tn , y tn ). In order to hit the virtual light source, it is only necessary to satisfy the condition that (Ra ( xtn , ytn ), Ga ( xtn , ytn ), Ba ( xtn , ytn )) is a positive value.

以上の処理によって制御部50は、被写体情報取得部113で取得した異なる時間t、tの被写体の位置情報に基づいて、リライティング処理部114の仮想光源のパラメータを決定する。 Based on the above processing, the control unit 50 determines the parameters of the virtual light source of the relighting processing unit 114 based on the position information of the subjects at different times t 1 and t n acquired by the subject information acquisition unit 113.

また、本実施形態では、被写体の移動しており、移動元と移動先における被写体の位置から、移動元、移動先のどちらの位置に被写体がいても仮想光源からの光があたるように仮想光源のパラメータを決定する方法について説明した。しかし、これに限るものではない。例えば、被写体が移動によって決まる移動線を基に、仮想光源の位置を並行して移動するようにしても良い。   In the present embodiment, the virtual light source is such that the subject is moving and the light from the virtual light source shines from the position of the subject at the movement source and the movement destination regardless of the position of the movement source or the movement destination. The method of determining the parameters of was described. However, it is not limited to this. For example, the position of the virtual light source may be moved in parallel based on a movement line determined by the movement of the subject.

また、本実施形態では、被写体の位置情報を基に仮想光源のパラメータを決定する方法について説明したが、位置情報に限るものではない。位置情報に限らず、被写体情報取得部113において、例えば被写体の表情の変化、被写体が喋っているか否か、被写体の人数が変わったなどといったシーンの切り替わりを判別し、そのシーンの切り替わりの情報を基に仮想光源のパラメータを決定しても良い。   In the present embodiment, the method for determining the parameters of the virtual light source based on the position information of the subject has been described. However, the present invention is not limited to the position information. Not only the position information but also the subject information acquisition unit 113 discriminates scene changes such as changes in the facial expression of the subject, whether the subject is speaking, whether the number of subjects has changed, etc. Based on this, the parameters of the virtual light source may be determined.

また、本実施形態では、撮像装置としてデジタルカメラが被写体情報を基に仮想光源のパラメータを決定しリライティング処理する例について説明したがこれに限るものではない。例えば、パーソナルコンピューター等において、デジタルカメラで撮影した画像データを取り込み、取り込んだ画像データの被写体情報を解析することで、仮想光源のパラメータを決定してパーソナルコンピューターにおいてリライティング処理を行う構成であっても良い。   In this embodiment, the example in which the digital camera as the imaging apparatus determines the parameters of the virtual light source based on the subject information and performs the relighting process is described, but the present invention is not limited to this. For example, in a configuration where a personal computer or the like captures image data captured by a digital camera, analyzes the subject information of the captured image data, determines virtual light source parameters, and performs relighting processing in the personal computer. good.

また、パーソナルコンピューター等において、リライティング処理機能を有するデジタルカメラで撮影したリライティング処理前の画像データと、デジタルカメラにおいて取得した被写体情報、仮想光源のパラメータ情報とを取り込み、デジタルカメラでのリライティング処理ではユーザの意図通りにリライティング出来ていないシーンに限り、再度仮想光源のパラメータを編集しリライティング処理をし直すといった構成としても良い。   In addition, in a personal computer or the like, image data before relighting processing taken with a digital camera having a relighting processing function, subject information acquired by the digital camera, and virtual light source parameter information are captured. As long as the scene is not relighted as intended, the virtual light source parameters may be edited again and the relighting process may be performed again.

50 システム制御部
100 デジタルカメラ
105 画像処理部
114 リライティング処理部
120 操作部
123 測距センサ
50 System Control Unit 100 Digital Camera 105 Image Processing Unit 114 Relighting Processing Unit 120 Operation Unit 123 Distance Sensor

Claims (6)

動画を構成する複数のフレーム画像に対して仮想光源によるリライティング効果を付与する画像処理を行う画像処理装置であって、
前記フレーム画像にリライティング効果を付与する画像処理を行う処理手段と、
前記処理手段による画像処理に用いるパラメータを設定する設定手段と、を備え、
前記設定手段は、前記複数のフレーム画像において連続する所定期間のフレーム画像に対して、前記パラメータを固定して設定するか、前記パラメータをフレーム画像ごとに可変して設定するかを切り替えることを特徴とする画像処理装置。
An image processing apparatus for performing image processing for providing a relighting effect by a virtual light source to a plurality of frame images constituting a moving image,
Processing means for performing image processing for providing a relighting effect to the frame image;
Setting means for setting parameters used for image processing by the processing means,
The setting means switches between setting the parameter fixedly or setting the parameter variably for each frame image for a frame image of a predetermined period that is continuous in the plurality of frame images. An image processing apparatus.
前記複数のフレーム画像で被写体を追尾する追尾手段を有し、
前記設定手段は、追尾が成功した期間において、前記パラメータを固定して設定するか、前記パラメータをフレーム画像ごとに可変して設定するかを切り替えることを特徴とする請求項1に記載の画像処理装置。
Tracking means for tracking the subject in the plurality of frame images;
2. The image processing according to claim 1, wherein the setting unit switches between setting the parameter fixedly and setting the parameter variably for each frame image during a period in which tracking is successful. apparatus.
前記画像処理に用いるパラメータは前記仮想光源の位置であり、
前記設定手段は、前記パラメータをフレーム画像ごとに可変する場合は、追尾する被写体に応じて前記仮想光源の位置を変えることを特徴とする請求項2に記載の画像処理装置。
The parameter used for the image processing is the position of the virtual light source,
The image processing apparatus according to claim 2, wherein when the parameter is changed for each frame image, the setting unit changes a position of the virtual light source according to a subject to be tracked.
前記複数のフレーム画像で被写体の位置を検出する検出手段を有し、
前記設定手段は、前記パラメータを固定して設定する場合、前記複数のフレーム画像から検出された被写体の位置の変化に基づいて前記パラメータを設定することを特徴とする請求項1に記載の撮像装置。
Detecting means for detecting a position of a subject in the plurality of frame images;
The imaging apparatus according to claim 1, wherein the setting unit sets the parameter based on a change in a position of a subject detected from the plurality of frame images when the parameter is fixedly set. .
前記パラメータは、前記仮想光源の位置、角度、強度の少なくとも一つであることを特徴とする請求項4に記載の撮像装置。   The imaging apparatus according to claim 4, wherein the parameter is at least one of a position, an angle, and an intensity of the virtual light source. 動画を構成する複数のフレーム画像に対して仮想光源によるリライティング効果を付与する画像処理を行う画像処理方法であって、
前記フレーム画像にリライティング効果を付与する画像処理を行う処理ステップ、
前記処理ステップでの画像処理に用いるパラメータを設定する設定ステップと、
を備え、
前記設定ステップでは、前記複数のフレーム画像において連続する所定期間のフレーム画像に対して、前記パラメータを固定して設定するか、前記パラメータをフレーム画像ごとに可変して設定するかを切り替えることを特徴とする画像処理方法。
An image processing method for performing image processing to give a relighting effect by a virtual light source to a plurality of frame images constituting a moving image,
A processing step of performing image processing for imparting a relighting effect to the frame image;
A setting step for setting parameters used for image processing in the processing step;
With
In the setting step, whether to set the parameter fixedly or to set the parameter variably for each frame image is switched for a frame image of a predetermined period that is continuous in the plurality of frame images. An image processing method.
JP2017085446A 2017-04-24 2017-04-24 Image processing equipment, image processing methods and programs Active JP6921606B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017085446A JP6921606B2 (en) 2017-04-24 2017-04-24 Image processing equipment, image processing methods and programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017085446A JP6921606B2 (en) 2017-04-24 2017-04-24 Image processing equipment, image processing methods and programs

Publications (2)

Publication Number Publication Date
JP2018185576A true JP2018185576A (en) 2018-11-22
JP6921606B2 JP6921606B2 (en) 2021-08-18

Family

ID=64356061

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017085446A Active JP6921606B2 (en) 2017-04-24 2017-04-24 Image processing equipment, image processing methods and programs

Country Status (1)

Country Link
JP (1) JP6921606B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109688341A (en) * 2018-12-27 2019-04-26 维沃移动通信有限公司 A kind of method for polishing and terminal device
US11405562B2 (en) 2020-03-26 2022-08-02 Canon Kabushiki Kaisha Image processing apparatus, method of controlling the same, image capturing apparatus, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6980697B1 (en) * 2001-02-01 2005-12-27 At&T Corp. Digitally-generated lighting for video conferencing applications
JP2016018560A (en) * 2014-07-08 2016-02-01 三星電子株式会社Samsung Electronics Co.,Ltd. Device and method to display object with visual effect
US20160364602A1 (en) * 2015-06-09 2016-12-15 Samsung Electronics Co., Ltd. Electronic device for processing image and method for controlling the same
JP2016213717A (en) * 2015-05-11 2016-12-15 キヤノン株式会社 Image processing apparatus, image processing method, program, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6980697B1 (en) * 2001-02-01 2005-12-27 At&T Corp. Digitally-generated lighting for video conferencing applications
JP2016018560A (en) * 2014-07-08 2016-02-01 三星電子株式会社Samsung Electronics Co.,Ltd. Device and method to display object with visual effect
JP2016213717A (en) * 2015-05-11 2016-12-15 キヤノン株式会社 Image processing apparatus, image processing method, program, and storage medium
US20160364602A1 (en) * 2015-06-09 2016-12-15 Samsung Electronics Co., Ltd. Electronic device for processing image and method for controlling the same

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109688341A (en) * 2018-12-27 2019-04-26 维沃移动通信有限公司 A kind of method for polishing and terminal device
US11405562B2 (en) 2020-03-26 2022-08-02 Canon Kabushiki Kaisha Image processing apparatus, method of controlling the same, image capturing apparatus, and storage medium

Also Published As

Publication number Publication date
JP6921606B2 (en) 2021-08-18

Similar Documents

Publication Publication Date Title
JP6911192B2 (en) Image processing methods, equipment and devices
JP5108093B2 (en) Imaging apparatus and imaging method
JP6833415B2 (en) Image processing equipment, image processing methods, and programs
JP2016143022A (en) Imaging device and imaging method
JP6412386B2 (en) Image processing apparatus, control method therefor, program, and recording medium
JP2019101996A (en) Image processing apparatus and image processing method reducing noise by composing plural captured images
JP6718253B2 (en) Image processing apparatus and image processing method
JP6937603B2 (en) Image processing equipment and its control methods, programs, and storage media
JP6564284B2 (en) Image processing apparatus and image processing method
JP6921606B2 (en) Image processing equipment, image processing methods and programs
JP2017138927A (en) Image processing device, imaging apparatus, control method and program thereof
JP2018182700A (en) Image processing apparatus, control method of the same, program, and storage medium
JP2017147568A (en) Image processing apparatus, imaging apparatus, control method, and program
JP2019179463A (en) Image processing device, control method thereof, program, and recording medium
KR101630307B1 (en) A digital photographing apparatus, a method for controlling the same, and a computer-readable storage medium
JP2019101997A (en) Image processing apparatus and image processing method reducing noise by composing plural captured images
JP2011066827A (en) Image processing apparatus, image processing method and program
JP2018050149A (en) Image processing apparatus
JP5615012B2 (en) White balance stable adjustment device and control method thereof, program for white balance stable adjustment
JP7458769B2 (en) Image processing device, imaging device, image processing method, program and recording medium
JP2021158513A (en) Image processing apparatus, control method therefor, image capturing apparatus, program, and storage medium
JP2016213717A (en) Image processing apparatus, image processing method, program, and storage medium
JP2018190257A (en) Image processing device
JP6946055B2 (en) Image processing equipment and image processing methods, programs
JP7462464B2 (en) Image processing device and method, program, and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200403

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210309

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210426

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210728

R151 Written notification of patent or utility model registration

Ref document number: 6921606

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151