JP6921606B2 - Image processing equipment, image processing methods and programs - Google Patents

Image processing equipment, image processing methods and programs Download PDF

Info

Publication number
JP6921606B2
JP6921606B2 JP2017085446A JP2017085446A JP6921606B2 JP 6921606 B2 JP6921606 B2 JP 6921606B2 JP 2017085446 A JP2017085446 A JP 2017085446A JP 2017085446 A JP2017085446 A JP 2017085446A JP 6921606 B2 JP6921606 B2 JP 6921606B2
Authority
JP
Japan
Prior art keywords
light source
virtual light
image processing
image
subject
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2017085446A
Other languages
Japanese (ja)
Other versions
JP2018185576A (en
Inventor
尚子 渡澤
尚子 渡澤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to 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)

Description

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

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

下記特許文献1は、画像内の顔領域に関する情報に応じて画像の領域単位でリライティング処理を行う方法を開示している。具体的には、画像内の顔の有無および位置といった顔領域に関する情報と画像のシーン判別結果に基づいて、画像の顔領域に対してリライティング処理を行う。 The following Patent Document 1 discloses a method of performing rewriting processing for each area of an image according to information about a face area in the image. Specifically, the rewriting process is performed on the face area of the image based on the information on 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-A-2007-148537

画像にリライティング処理を行って陰影を補正する場合、仮想光源の位置、強度、角度といったリライティング処理に用いるパラメータを画像内の被写体の状態に応じて、適切に設定することが必要である。 When rewriting an image to correct shadows, it is necessary to appropriately set parameters used for the rewriting 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 of a moving subject, the parameters of the rewriting process are set for each frame image, so that the effect of the rewriting process changes one after another, and after the rewriting process. There is a problem that it is difficult for viewers to see the video.

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

本発明の一実施態様は、動画を構成する複数のフレーム画像に対して仮想光源によるリライティング効果を付与する画像処理を行う画像処理装置であって、前記フレーム画像にリライティング効果を付与する画像処理を行う処理手段と、前記処理手段による画像処理に用いるパラメータを設定する設定手段と、前記複数のフレーム画像で被写体を追尾する追尾手段と、を備え、前記設定手段は、前記複数のフレーム画像のうち、前記追尾が成功した期間において連続するフレーム画像に対して、前記パラメータを固定して設定するか、前記パラメータをフレーム画像ごとに可変して設定するかを切り替えることを特徴とする画像処理装置である。One embodiment of the present invention is an image processing device that performs image processing for imparting a rewriting effect by a virtual light source to a plurality of frame images constituting a moving image, and performs image processing for imparting a rewriting effect to the frame image. A processing means to be performed, a setting means for setting parameters used for image processing by the processing means, and a tracking means for tracking a subject with the plurality of frame images are provided, and the setting means is among the plurality of frame images. An image processing apparatus characterized in that the parameters are fixedly set or the parameters are variably set for each frame image for continuous frame images during the period in which the tracking is successful. be.

本発明によれば、動画に対して適切なリライティング処理を行うことが可能となる。 According to the present invention, it is possible to perform an appropriate rewriting process 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 processing part in this invention. 本発明におけるリライティング処理部の構成を示すブロック図である。It is a block diagram which shows the structure of the rewriting processing part in this invention. 本発明における仮想光源による照射に対する反射を説明する図であるIt is a figure explaining the reflection with respect to the irradiation by a virtual light source in this invention. 本発明におけるリライティング処理前後の画像を説明する図である。It is a figure explaining the image before and after the rewriting process in this invention. 本発明における仮想光源パラメータを決定するフローチャートである。It is a flowchart which determines the virtual light source parameter in this invention. 本発明における仮想光源パラメータと追尾の対応を示す表である。It is a table which shows the correspondence between the virtual light source parameter and tracking in this invention. 本発明における被写体と仮想光源のイメージ図である。It is an image diagram of a subject and a 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 will be described using an embodiment in which the present invention is applied to a digital camera, the present invention is not limited to the digital camera and can be applied to other image processing devices.

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

図1は、第1の実施形態にかかるデジタルカメラの構成例を示すブロック図である。 FIG. 1 is a block diagram showing 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, 100 is an entire digital camera, 101 is a lens group including a zoom lens and a focus lens, 102 is a shutter having an aperture function, and 103 is an image image composed of a CCD or CMOS element that converts an optical image into an electric signal. Part 104 is an A / D converter that converts an analog signal into a digital signal, and 105 is an image data output from the A / D converter 104 that undergoes white balance processing, γ processing, contour enhancement, and color correction processing. It is an image processing unit that performs various image processing such as.

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

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 is a subject information acquisition unit. The rewriting processing unit 50 that performs rewriting processing on the captured image is a system control unit that controls the entire system of the digital camera 100.

また、121はプログラムやパラメータなどを格納するEEPROMなどの不揮発性メモリであり、122はシステム制御部50の動作用の定数、変数、不揮発性メモリ124から読みだしたプログラム等を展開するシステムメモリである。123は被写体との距離を測定し、撮影画素の画素単位に対応する距離情報を2次元の距離マップ画像として出力する測距センサである。 Further, 121 is a non-volatile memory such as EEPROM for storing programs and parameters, and 122 is a system memory for expanding constants and variables for operation of the system control unit 50, programs read from the non-volatile memory 124, and the like. be. Reference numeral 123 denotes a distance measuring sensor that measures the distance to the subject and outputs the distance information corresponding to each pixel of the photographing pixel as a two-dimensional distance map image.

次に、上記のように構成されたデジタルカメラ100における被写体撮影時の基本動作について説明する。撮像部103は、レンズ101及びシャッター102を介して入射した光を光電変換し、入力画像信号としてA/D変換器104へ出力する。A/D変換器104は撮像部103から出力されるアナログ画像信号をデジタル画像信号に変換し画像処理部105に出力する。 Next, the basic operation at the time of shooting a subject with the digital camera 100 configured as described above will be described. The imaging unit 103 photoelectrically converts the light incident through the lens 101 and the shutter 102, and outputs the light as an input image signal to the A / D converter 104. The A / D converter 104 converts the analog image signal output from the image pickup unit 103 into a digital image signal and outputs the analog 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, contour enhancement processing, and the like 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 is based on the obtained evaluation value result. The system control unit 50 performs exposure control and distance measurement control. As a result, TTL (through-the-lens) AF (autofocus) processing, AE (autoexposure) 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 to the image memory 106 via the memory control unit 107. The image memory 106 stores the image data output from the imaging unit 103 and the image data to be displayed on the display unit 109.

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

コーデック部110は、画像メモリ106に記録された画像データを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 it 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 realizes each of the processes described below by executing the program recorded in the non-volatile memory 124 described above. The program referred to here is a program for executing various flowcharts described later. At this time, the constants and variables for the operation of the system control unit 50, the program read from the non-volatile memory 121, and the like are expanded in the system memory 122.

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

図2において、200は同時化処理部、201はWB増幅部、202は輝度・色信号生成部、203は輪郭強調処理部、204は輝度ガンマ処理部、205は色変換処理部、206は色γ処理部、207は色差信号生成部、208は陰影情報取得部である。 In FIG. 2, 200 is a simultaneous processing unit, 201 is a WB amplification unit, 202 is a brightness / color signal generation unit, 203 is a contour enhancement processing unit, 204 is a brightness gamma processing unit, 205 is a color conversion processing unit, and 206 is a color. The γ 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, the processing in the image processing unit 105 will be described. The image signal input from the A / D conversion unit 104 of 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 simultaneous processing unit 200. The simultaneous processing unit 200 performs simultaneous processing on the input Bayer RGB image data to generate color signals R, G, and B. The WB amplification unit 201 applies a gain to the RGB color signal based on the white balance gain value calculated by the system control unit 50, and adjusts the white balance. The RGB signal output by 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 signal, outputs the generated luminance signal Y to the contour enhancement processing unit 203, and outputs 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 it 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 converts the RGB signal into a desired color balance by performing a matrix calculation or the like. The color gamma processing unit 206 performs gamma correction on the RGB color signal. The color difference signal generation unit 207 generates color difference signals RY and BY signals from RGB signals.

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

また、色変換処理部205の出力RGB信号は陰影情報取得部208へも入力する。陰影情報取得部208は、環境光源によって被写体に生じた陰影の状態を解析するための情報を取得する。例えば、被写体の平均輝度情報および顔領域の輝度ヒストグラム情報などを陰影情報として取得する。 Further, 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, the average brightness information of the subject, the brightness histogram information of the face area, and the like are acquired as shadow information.

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

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

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

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

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

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

リライティング処理部114は、画像メモリ106に記録された画像データについて輝度・色差信号(Y、B−Y、R−Y)を読み出し、入力とする。RGB信号変換部301は、入力された輝度・色差信号(Y、B−Y、R−Y)をRGB信号に変換し、デガンマ処理部302へ出力する。 The rewriting processing unit 114 reads the 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 degamma processing unit 302 calculates the gamma characteristic multiplied by the gamma processing unit of the image processing unit 105 and converts it into 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 the distance map from the subject distance information acquired from the distance measurement sensor 123. The subject distance information is two-dimensional distance information obtained in pixel units of a captured image. The normal calculation unit 304 calculates a normal map from the distance information acquired from the distance calculation unit 303. As for the method of generating the normal map from the distance map, a known technique is used, but 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 showing the relationship between the camera shooting coordinates and the subject. For example, for a subject 401 as shown in FIG. 4, the gradient information can be calculated from the difference ΔD of the distance (depth) D with respect to the horizontal difference ΔH of the captured image, and the normal N can be calculated from the gradient information. It is possible. By performing the above processing on each pixel, the normal information N corresponding to each pixel of the captured image can be calculated. The normal calculation unit 304 outputs the normal information corresponding to each pixel of the captured image as a normal map to the virtual light source reflection component calculation unit 305.

仮想光源反射成分算出部305では、光源と被写体の距離K、法線情報N、仮想光源パラメータLに基づき、仮想光源が被写体に反射する成分を算出する。 The virtual light source reflection component calculation unit 305 calculates the component that the virtual light source reflects on 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 of 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 simplification of explanation) of the captured image taken by the digital camera 100 is proportional to the inner product of the normal N1 at the camera coordinates H1 and the direction vector L1 of the virtual light source. However, 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
Expressing this relationship with a mathematical formula, the subject reflection components (Ra, Ga, Ba) by the virtual light source are as follows (Equation 1).
Ra = α × (−L ・ N) / K 2 × Rt
Ga = α × (−L · N) / K 2 × Gt (Equation 1)
Ba = α × (−L ・ N) / K 2 × Bt

ここで、αは仮想光源の強さでありリライティング補正量のゲイン値である。Lは仮想光源の3次元方向ベクトル、Nは被写体の3次元法線ベクトル、Kは仮想光源と被写体の距離である。Rt、Gt、Btはデガンマ処理部302から出力された撮影RGBデータである。 Here, α is the intensity of the virtual light source and is the gain value of the rewriting 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 captured 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 (Equation 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 signal. The color difference signal generation unit 308 generates brightness Y, color difference signals RY, and BY signals from RGB signals.

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

システム制御部50は、リライティング補正部114が出力した輝度・色差信号を、メモリ制御部107の制御によって、画像メモリ106に蓄積したのち、コーデック部110で圧縮符号化を行う。また、I/F111を介して記録媒体112に記録する。 The system control unit 50 stores the luminance / color difference signal output by the rewriting correction unit 114 in the image memory 106 under the control of the memory control unit 107, and then compresses and encodes it in the codec unit 110. Also, 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 rewriting processing unit 114 based on the subject information acquired by the subject information acquisition unit 113 will be described below.

ここでの被写体情報取得部113は、主被写体を検出する主被写体検出部と、主被写体検出部により検出した主被写体の顔器官を検出する顔器官検出部、及び主被写体検出部により検出した主被写体を追尾する追尾部で構成されている。主被写体検出方法、顔器官検出方法、追尾方法については、公知の技術を用いるものとする。例えば、主被写体検出方法としては、画面内の特徴点から被写体の位置を推定し、特徴量の最も大きい領域を主被写体と判定するなどの方法がある。例えば、顔器官検出方法としては、エッジから顔の輪郭や目などの複数の部位を検出し、その位置関係に基づいて顔の向きを検出するなどの方法がある。例えば、追尾方法としては、時間方向に異なる画像を比較して移動ベクトルを求める方法や、被写体又はその一部を特徴色パターン化し、異なる時間で撮影された画像を特徴色パターンマッチングによって追尾する方法などがある。 The subject information acquisition unit 113 here includes a main subject detection unit that detects the main subject, a face organ detection unit that detects the face 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 shall be used for the main subject detection method, facial organ detection method, and tracking method. For example, as a main subject detection method, there is a method of estimating the position of the subject from the feature points on the screen and determining the region having the largest feature amount as the main subject. For example, as a method for detecting facial organs, there is a method of detecting a plurality of parts such as facial contours and eyes from edges and detecting the orientation of the face based on the positional relationship. For example, as a tracking method, a method of comparing different images in the time direction to obtain a movement vector, or a method of patterning a subject or a part thereof into a feature color pattern and tracking images taken at different times by feature 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, an operation in which the system control unit 50 determines the parameters of the virtual light source of the rewriting processing unit 114 based on the subject information acquired by the subject information acquisition unit 113 will be described according to the flowchart of FIG.

ステップS601では、操作部120を介してユーザからの操作によってリライティング処理が選択されているか判定する。即ち、リライティング処理部114による処理を行うか否かを判定する。リライティングを行う場合はステップ602に進む。 In step S601, it is determined whether the rewriting process is selected by the operation from the user via the operation unit 120. That is, it is determined whether or not the processing by the rewriting processing unit 114 is performed. If rewriting is to be 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 or not the subject can be tracked in each frame. If the tracking is successful, the process proceeds to step S604, and if the tracking is unsuccessful, 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.) shown in FIG. 7A and the tracking result is acquired. In FIG. 7A, 701 indicates a frame number. 702 indicates a flag as to whether or not tracking is possible.

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

ステップS604では、ステップS603において追尾が成功していた場合に、リライティング処理部114において、追尾OK時の仮想光源のパラメータ設定表に基づき、仮想光源のパラメータを決定する。具体的には、図7(b)に示す追尾OK時の仮想光源設定表に基づいて決定する。図7(b)において、704はモードを示し、705は仮想光源設定を示す。モードが0の時は仮想光源の位置をフレーム毎に変えないよう制御する。 In step S604, when the tracking is successful in step S603, the rewriting processing unit 114 determines the parameters of the virtual light source based on the parameter setting table of the virtual light source when the tracking is OK. Specifically, the determination is made based on the virtual light source setting table at the time of tracking OK shown in FIG. 7 (b). In FIG. 7B, 704 indicates the mode and 705 indicates the virtual light source setting. When the mode is 0, the position of the virtual light source is controlled so as not to be 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 parameter of the virtual light source is controlled so that the position is the same as the position of the virtual light source when the frame number is 2 one frame before.
When the mode is 1, the position of the virtual light source is controlled to be changed for each frame according to the tracking result. For example, when the frame number is 2, the position of the virtual light source as a virtual light source hits the face position of the main object (x 2, y 2), the angle determines the parameters of the virtual light source such as strength, frame number 3 when determines parameters such position, angle, intensity of the virtual light source as a virtual light source hits the face position of the main object (x 3, y 3) of the. That is, the subject reflected component frame number by the virtual light source when the 2 (Ra (x 2, y 2), Ga (x 2, y 2), Ba (x 2, y 2)) , the following equation (Equation 3 ). The settings of mode 0 and mode 1 may be determined by an instruction operation from the user, or may be automatically determined 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
(Equation 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). A virtual light source hits are, (Ra (x 2, y 2), Ga (x 2, y 2), Ba (x 2, y 2)) may satisfy the condition that 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, when the frame number is 3, the subject reflection component (Ra (x 3 , y 3 ), Ga (x 3 , y 3 ), Ba (x 3 , y 3 )) by the virtual light source is given by the following equation (Equation). It is represented by 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
(Equation 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 3D direction vector of the virtual light source, N (x 3 , y 3 ) is the 3D 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). The virtual light source is defined as long as it satisfies the condition that (Ra (x 3 , y 3 ), Ga (x 3 , y 3 ), Ba (x 3 , y 3)) has a positive value.

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

図7(c)において、706はモードを示し、707は仮想光源設定を示す。モードが0の時は仮想光源をOFFにする。例えば、フレーム番号が101の時は、追尾フラグが0となり、追尾が出来ていないので仮想光源をOFFにする。具体的には、仮想光源の強さを示すゲインαを0とする。 In FIG. 7 (c), 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 becomes 0 and tracking is not completed, so the virtual light source is turned off. Specifically, the gain α indicating the strength of the virtual light source is set to 0.

また、モードが1の時は、仮想光源の強度を弱めるよう制御する。例えば、フレーム番号が101の時は、フレーム番号が100の時よりも仮想光源の強度を弱めるよう制御する。具体的には、仮想光源の強さを示すゲインαの値をフレーム番号が100の時よりも小さい値とする。 When the mode is 1, the intensity of the virtual light source is controlled to be weakened. 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 intensity of the virtual light source is set to a value smaller than that when the frame number is 100.

以上の処理によって制御部50は、被写体情報取得部113で取得した被写体情報に基づいて、リライティング処理部114の仮想光源のパラメータを決定する。 Through the above processing, the control unit 50 determines the parameters of the virtual light source of the rewriting 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 0 and 1 in the virtual light source setting table when tracking is OK and when tracking is NG has been described, but it is virtual based on the subject information acquired by the subject information acquisition unit 113. It 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 orientation of the face of the main subject, and controls to change the angle of the virtual light source based on the orientation information of the face. Is also good.

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

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

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

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

(第2の実施形態)
次に第2の実施形態として、主被写体検出部のみから構成される被写体情報取得部113による被写体情報に基づいて、リライティング処理部114の仮想光源のパラメータを決定する方法について説明する。
(Second embodiment)
Next, as a second embodiment, a method of determining the parameters of the virtual light source of the rewriting processing unit 114 based on the subject information by the subject information acquisition unit 113 composed of only 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 the first embodiment will be described as an example of the imaging device, and the basic configuration is the same as that of the first embodiment. Will describe only the differences from Example 1.

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

また、第1の実施形態では追尾結果を基にリライティング処理を撮影とほぼ同時にリアルタイムに処理することが可能であったが、第2の実施形態においては、リアルタイムではなく撮影後も後処理としてリライティング処理を実行できる点が第1の実施形態と異なる。 Further, in the first embodiment, it was possible to process the rewriting process in real time at almost the same time as the shooting based on the tracking result, but in the second embodiment, the rewriting is not in real time but as post-processing after shooting. It differs from the first embodiment in that the process can be executed.

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

ステップS801では、操作部120を介してユーザからの操作によってリライティング処理が選択されているか判定する。即ち、リライティング処理部114による処理を行うか否かを判定する。リライティングを行う場合はステップ802に進む。 In step S801, it is determined whether or not the rewriting process is selected by the operation from the user via the operation unit 120. That is, it is determined whether or not the processing by the rewriting processing unit 114 is performed. To perform rewriting, 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, the time t 1 and the time t n may be images having frame numbers 1 and 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 rewriting 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 acquire the position information of the subject.

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

例えば、被写体が(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 Set the strength to correspond to the position of t1 and y t1).

具体的には、被写体位置が(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, when the subject position is (x t1 , y t1 ), the subject reflection component (Ra (x t1 , y t1 )), Ga (x t1 , y t1 ), Ba (x t1 , y t1) by the virtual light source is used. )) Is expressed by the following equation (Equation 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
(Equation 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, and N (x t1 , y t1 ) is the three-dimensional normal vector of the subject at the position (x t1 , y t1), K (x). t1 , y t1 ) indicates the distance between the virtual light source and the subject at the position (x t1 , y t1). The virtual light source does not have to satisfy the condition that (Ra (x t1 , y t1 ), Ga (x t1 , y t1 ), Ba (x t1 , y t1)) has 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 reflection component by the virtual light source when the subject position is (x nt , y nt ) (Ra (x tun , y tun ), Ga (x tun , y tun ), Ba (x tun , y tun )). Is expressed by the following equation (Equation 6).
Ra (x tun , y tun ) =
α × (−L (x tun , y tun ) ・ N (x tun , y tun )) / K (x tun , y tun ) 2 × Rt
Ga (x tun , y tun ) =
α × (−L (x tun , y tun ) ・ N (x tun, y tun )) / K (x tun , y tun ) 2 × Gt
Ba (x tun , y tun ) =
α × (−L (x tun , y tun ) ・ N (x tun , y tun )) / K (x tun , y tun ) 2 × Bt
(Equation 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 nt , y tun ) is the three-dimensional direction vector of the virtual light source, N (x tun , y tun ) is the three-dimensional normal vector of the subject at the position (x tun , y tun), and K (x). tn, y tn) denotes the distance to the subject who is in the position of the virtual light source (x tn, y tn). The virtual light source does not have to satisfy the condition that (Ra (x tun , y tun ), Ga (x tun , y tun ), Ba (x tun , y tun)) has a positive value.

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

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

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

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

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

50 システム制御部
100 デジタルカメラ
105 画像処理部
114 リライティング処理部
120 操作部
123 測距センサ
50 System control unit 100 Digital camera 105 Image processing unit 114 Rewriting processing unit 120 Operation unit 123 Distance measurement sensor

Claims (7)

動画を構成する複数のフレーム画像に対して仮想光源によるリライティング効果を付与する画像処理を行う画像処理装置であって、
前記フレーム画像にリライティング効果を付与する画像処理を行う処理手段と、
前記処理手段による画像処理に用いるパラメータを設定する設定手段と、
前記複数のフレーム画像で被写体を追尾する追尾手段と、
を備え、
前記設定手段は、前記複数のフレーム画像のうち、前記追尾が成功した期間において連続するフレーム画像に対して、前記パラメータを固定して設定するか、前記パラメータをフレーム画像ごとに可変して設定するかを切り替えることを特徴とする画像処理装置。
An image processing device that performs image processing that imparts a rewriting effect by a virtual light source to a plurality of frame images that make up a moving image.
A processing means for performing image processing for imparting a rewriting effect to the frame image, and
Setting means for setting parameters used for image processing by the processing means, and
A tracking means for tracking a subject with the plurality of frame images, and
With
The setting means either fixes the parameter or sets the parameter variably for each frame image with respect to the frame images that are continuous during the period in which the tracking is successful among the plurality of frame images. An image processing device characterized by switching between.
前記画像処理に用いるパラメータは前記仮想光源の位置であり、
前記設定手段は、前記追尾が成功した期間において前記パラメータをフレーム画像ごとに可変して設定する場合は、追尾する被写体に応じて前記仮想光源の位置を変えることを特徴とする請求項に記載の画像処理装置。
The parameter used for the image processing is the position of the virtual light source.
The setting means, if the variable to set the parameters for each frame image in the period in which the tracking is successful, according to claim 1, characterized in that changing the position of the virtual light source according to the object to be tracked Image processing equipment.
前記パラメータは、前記仮想光源の位置、角度、強度の少なくとも一つであることを特徴とする請求項1に記載の画像処理装置。 The image processing apparatus according to claim 1, wherein the parameter is at least one of the position, angle, and intensity of the virtual light source. 前記設定手段は、前記追尾が成功した期間において前記パラメータを固定して設定する場合は、前記追尾が成功しない期間においては仮想光源をオフにすることを特徴とする請求項1乃至3のいずれか1項に記載の画像処理装置。 The setting means is any one of claims 1 to 3, wherein when the parameter is fixedly set during the period when the tracking is successful, the virtual light source is turned off during the period when the tracking is not successful. The image processing apparatus according to item 1. 前記設定手段は、前記追尾が成功した期間において前記パラメータをフレーム画像ごとに可変して設定する場合は、前記追尾が成功しない期間においては前記追尾が成功した期間よりも前記仮想光源の強度を弱くすることを特徴とする請求項1乃至4のいずれか1項に記載の画像処理装置。 When the setting means variably sets the parameter for each frame image during the period when the tracking is successful, the intensity of the virtual light source is weaker during the period when the tracking is not successful than during the period when the tracking is successful. The image processing apparatus according to any one of claims 1 to 4, wherein the image processing apparatus is used. 動画を構成する複数のフレーム画像に対して仮想光源によるリライティング効果を付与する画像処理を行う画像処理方法であって、
前記フレーム画像にリライティング効果を付与する画像処理を行う処理工程と
前記処理工程での画像処理に用いるパラメータを設定する設定工程と、
前記複数のフレーム画像で被写体を追尾する追尾工程と、
を備え、
前記設定工程では、前記追尾が成功した期間において連続する前記複数のフレーム画像において連続する所定期間のフレーム画像に対して、前記パラメータを固定して設定するか、前記パラメータをフレーム画像ごとに可変して設定するかを切り替えることを特徴とする画像処理方法。
This is an image processing method that performs image processing that imparts a rewriting effect by a virtual light source to a plurality of frame images that make up a moving image.
A processing step of performing image processing for imparting a rewriting effect to the frame image, and
A setting process for setting parameters used for image processing in the processing process , and a setting process for setting parameters.
The tracking process of tracking the subject with the plurality of frame images,
With
In the setting step , the parameters are fixedly set for the frame images of the plurality of frame images that are continuous in the period in which the tracking is successful, or the parameters are changed for each frame image. An image processing method characterized by switching between setting and setting.
コンピュータを、請求項1乃至5のいずれか1項に記載の画像処理装置の各手段として機能させるプログラム A program that causes a computer to function as each means of the image processing apparatus according to any one of claims 1 to 5 .
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 JP2018185576A (en) 2018-11-22
JP6921606B2 true 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)

Families Citing this family (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
JP2021158513A (en) 2020-03-26 2021-10-07 キヤノン株式会社 Image processing apparatus, control method therefor, image capturing apparatus, program, and storage medium

Family Cites Families (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
US10593113B2 (en) * 2014-07-08 2020-03-17 Samsung Electronics Co., Ltd. Device and method to display object with visual effect
JP6541416B2 (en) * 2015-05-11 2019-07-10 キヤノン株式会社 IMAGE PROCESSING APPARATUS, IMAGE PROCESSING METHOD, PROGRAM, AND STORAGE MEDIUM
KR102507567B1 (en) * 2015-06-09 2023-03-09 삼성전자주식회사 Electronic apparatus for processing image and mehotd for controlling thereof

Also Published As

Publication number Publication date
JP2018185576A (en) 2018-11-22

Similar Documents

Publication Publication Date Title
EP3198852B1 (en) Image processing apparatus and control method thereof
JP6833415B2 (en) Image processing equipment, image processing methods, and programs
JP5713885B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP7292905B2 (en) Image processing device, image processing method, and imaging device
JP6412386B2 (en) Image processing apparatus, control method therefor, program, and recording medium
JP2016086246A (en) Image processing apparatus and method, and imaging device
JP7277158B2 (en) Setting device and method, program, storage medium
JP6718253B2 (en) Image processing apparatus and image processing method
US10863103B2 (en) Setting apparatus, setting method, and storage medium
CN110324529B (en) Image processing apparatus and control method thereof
JP2019101996A (en) Image processing apparatus and image processing method reducing noise by composing plural captured images
JP6921606B2 (en) Image processing equipment, image processing methods and programs
JP6937603B2 (en) Image processing equipment and its control methods, programs, and storage media
JP2017147568A (en) Image processing apparatus, imaging apparatus, control method, and program
JP2018182700A (en) Image processing apparatus, control method of the same, program, and storage medium
JP7398939B2 (en) Image processing device and its control method, imaging device, program, and storage medium
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
JP6946055B2 (en) Image processing equipment and image processing methods, programs
JP2016213717A (en) Image processing apparatus, image processing method, program, and storage medium
JP6663246B2 (en) Image processing apparatus, imaging apparatus, control method thereof, and program
JP7462464B2 (en) Image processing device and method, program, and storage medium
JP7356255B2 (en) Image processing device and its processing method, imaging device, program, storage medium
JP7446080B2 (en) Image processing device, imaging device, control method, program and imaging system
JP7011694B2 (en) Image processing equipment and its control method, program

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 Written amendment

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