JP6937603B2 - Image processing equipment and its control methods, programs, and storage media - Google Patents

Image processing equipment and its control methods, programs, and storage media Download PDF

Info

Publication number
JP6937603B2
JP6937603B2 JP2017084760A JP2017084760A JP6937603B2 JP 6937603 B2 JP6937603 B2 JP 6937603B2 JP 2017084760 A JP2017084760 A JP 2017084760A JP 2017084760 A JP2017084760 A JP 2017084760A JP 6937603 B2 JP6937603 B2 JP 6937603B2
Authority
JP
Japan
Prior art keywords
subject
image
reliability
correction process
face
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
JP2017084760A
Other languages
Japanese (ja)
Other versions
JP2018182699A (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 JP2017084760A priority Critical patent/JP6937603B2/en
Publication of JP2018182699A publication Critical patent/JP2018182699A/en
Application granted granted Critical
Publication of JP6937603B2 publication Critical patent/JP6937603B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Description

本発明は、画像中の被写体の明るさを補正する画像処理技術に関する。 The present invention relates to an image processing technique for correcting the brightness of a subject in an image.

従来、撮影画像中の被写体に対して、仮想的な光源からの光を照射して陰影を補正する、リライティング(Relighting)を行う技術が知られている。リライティング処理により、環境光源によって生じた被写体の陰影などを明るくした画像を得ることが可能となる。特許文献1では、撮影画像に疑似的なリライティング処理を行うこと、具体的には、顔領域全体の平均輝度よりも低い輝度領域を陰影領域として抽出し、抽出した陰影領域の明度を高くすることが記載されている。 Conventionally, there is known a technique of performing relighting by irradiating a subject in a captured image with light from a virtual light source to correct shadows. The rewriting process makes it possible to obtain an image in which the shadow of the subject caused by the environmental light source is brightened. In Patent Document 1, a pseudo rewriting process is performed on a captured image, specifically, a brightness region lower than the average brightness of the entire face region is extracted as a shadow region, and the brightness of the extracted shadow region is increased. Is described.

特開2010−135996号公報Japanese Unexamined Patent Publication No. 2010-135996

上記リライティング処理によって画像中の被写体の陰影を変更する場合には、リライティング処理対象の被写体領域を適切に決定する必要がある。被写体領域が適切でない場合、リライティング処理後の画像が不自然になってしまうことがある。 When the shadow of the subject in the image is changed by the rewriting process, it is necessary to appropriately determine the subject area to be rewritten. If the subject area is not appropriate, the relighted image may look unnatural.

上記特許文献1では、リライティング処理領域を画像中の顔領域の位置および大きさに基づいて決定しているが、顔領域が誤検出された場合、適切ではない領域に対してリライティング処理を実行しまう可能性がある。例えば、顔検出処理において、顔領域の周辺の背景に含まれる顔に類似した領域を顔であると誤検出した場合、顔ではない背景の一部の領域に対してリライティング処理を実行してしまう可能性がある。 In Patent Document 1, the rewriting processing area is determined based on the position and size of the face area in the image, but if the face area is erroneously detected, the rewriting processing is executed on the inappropriate area. there is a possibility. For example, in the face detection process, if an area similar to a face included in the background around the face area is erroneously detected as a face, the rewriting process is executed for a part of the background that is not the face. there is a possibility.

本発明は、上記課題に鑑みてなされ、その目的は、被写体の陰影などを補正する処理を行う領域の信頼度に基づき、適切に処理を行うことができる技術を実現することである。 The present invention has been made in view of the above problems, and an object of the present invention is to realize a technique capable of appropriately performing processing based on the reliability of a region for performing processing for correcting shadows and the like of a subject.

上記課題を解決し、目的を達成するために、本発明の画像処理装置は、仮想的な光源である仮想光源を設定し、前記仮想光源を用いて画像中の被写体の明るさを補正する補正処理を行う処理手段と、前記画像中の被写体の特定の部分領域情報を取得する取得手段と、前記画像における前記補正処理の対象となる被写体領域を決定する決定手段と、前記取得手段により得られた前記被写体の特定の部分領域情報と前記決定手段により決定された前記被写体領域との関係に基づく前記補正処理の信頼度に応じて前記処理手段による補正処理を制御する制御手段と、を有する。 In order to solve the above problems and achieve the object, the image processing apparatus of the present invention sets a virtual light source which is a virtual light source, and corrects the brightness of the subject in the image by using the virtual light source. and processing means for processing, acquisition means for acquiring a specific partial area information of the subject in the image, and determining means for determining a subject to the subject area of the correction process in the image obtained by the acquisition unit and and a control means for controlling the correction processing by said processing means in response to the correction processing of the reliability based on a relationship between the determined said object regions by a particular partial area information and said determining means of the subject.

本発明によれば、被写体の陰影などを補正する処理を行う領域の信頼度に基づき、適切に処理を行うことができる。 According to the present invention, the processing can be appropriately performed based on the reliability of the region for which the processing for correcting the shadow of the subject or the like is performed.

本実施形態の撮像装置の構成を示すブロック図。The block diagram which shows the structure of the image pickup apparatus of this embodiment. 本実施形態の画像処理部の構成を示すブロック図。The block diagram which shows the structure of the image processing part of this embodiment. 本実施形態のリライティング処理部の構成を示すブロック図。The block diagram which shows the structure of the rewriting processing part of this embodiment. 本実施形態の撮影座標と被写体と仮想光源の位置関係を説明する図。The figure explaining the shooting coordinate of this embodiment and the positional relationship between a subject and a virtual light source. 本実施形態の顔領域情報および被写体領域情報を説明する図。The figure explaining the face area information and the subject area information of this embodiment. 本実施形態のリライティング処理前後の画像を説明する図。The figure explaining the image before and after the rewriting process of this embodiment. 本実施形態のリライティング処理を示すフローチャート。The flowchart which shows the rewriting process of this embodiment. 本実施形態のリライティング信頼度算出方法を説明する図。The figure explaining the rewriting reliability calculation method of this embodiment. 実施形態2の複数人のリライティング処理を示すフローチャート。The flowchart which shows the rewriting process of a plurality of persons of Embodiment 2.

以下に、本発明を実施するための形態について詳細に説明する。尚、以下に説明する実施の形態は、本発明を実現するための一例であり、本発明が適用される装置の構成や各種条件によって適宜修正又は変更されるべきものであり、本発明は以下の実施の形態に限定されるものではない。また、後述する各実施形態の一部を適宜組み合わせて構成してもよい。 Hereinafter, embodiments for carrying out the present invention will be described in detail. The embodiments described below are examples for realizing the present invention, and should be appropriately modified or changed depending on the configuration of the apparatus to which the present invention is applied and various conditions. It is not limited to the embodiment of. In addition, a part of each embodiment described later may be appropriately combined and configured.

[実施形態1]以下、本実施形態の画像処理装置として、例えば、静止画や動画を撮影可能なデジタルカメラ等の撮像装置に適用した例について説明する。なお、本実施形態では、撮像装置100としてデジタルカメラを例示しているが、カメラ付き携帯電話やその一種であるスマートフォン、タブレット端末、カメラ付きのパーソナルコンピュータ(PC)等の情報処理装置であってもよい。 [Embodiment 1] Hereinafter, an example in which the image processing device of the present embodiment is applied to an image pickup device such as a digital camera capable of capturing a still image or a moving image will be described. In the present embodiment, a digital camera is illustrated as the image pickup device 100, but it is an information processing device such as a camera-equipped mobile phone, a smartphone, a tablet terminal, or a personal computer (PC) with a camera. May be good.

<装置構成>まず、図1を参照して、本実施形態の撮像装置の構成および機能について説明する。 <Device Configuration> First, the configuration and functions of the imaging device of the present embodiment will be described with reference to FIG.

本実施形態の撮像装置100は、ある光源環境で撮影された画像中の被写体に対して、仮想的な光源の光を照射することで陰影を補正(変更)するリライティング(Relighting)処理を行う機能を有する。 The image pickup apparatus 100 of the present embodiment has a function of performing a relighting process of correcting (changing) shadows by irradiating a subject in an image taken in a certain light source environment with the light of a virtual light source. Has.

図1において、撮影レンズ101はズームレンズ、フォーカスレンズを含むレンズ群である。シャッター102は絞り機能を備える。撮像部103は光学像を電気信号に変換するCCDやCMOS素子等で構成される撮像素子である。A/D変換器104は、撮像部103から出力されるアナログ信号をデジタル信号に変換する。画像処理部105は、A/D変換器104から出力される画像データに対し、ホワイトバランス(WB)処理や、ガンマ処理、輪郭強調、色補正処理等の各種画像処理を行う。メモリ制御部107は、画像メモリ106を制御する。画像メモリ106は、A/D変換器104から出力される画像データや、表示部109に表示するための画像データを格納する。画像メモリ106は、所定枚数の静止画像や所定時間の動画および音声を格納するのに十分な記憶容量を備えている。また、画像メモリ106は画像表示用のメモリ(ビデオメモリ)を兼ねている。D/A変換器108は、画像メモリ106に格納されている画像表示用のデータをアナログ信号に変換して表示部109に供給する。表示部109は、LCDや有機EL等の表示器である。 In FIG. 1, the photographing lens 101 is a lens group including a zoom lens and a focus lens. The shutter 102 has an aperture function. The image pickup unit 103 is an image pickup device composed of a CCD, a CMOS element, or the like that converts an optical image into an electric signal. The A / D converter 104 converts the analog signal output from the imaging unit 103 into a digital signal. The image processing unit 105 performs various image processing such as white balance (WB) processing, gamma processing, contour enhancement, and color correction processing on the image data output from the A / D converter 104. The memory control unit 107 controls the image memory 106. The image memory 106 stores the image data output from the A / D converter 104 and the image data to be displayed on the display unit 109. The image memory 106 has a storage capacity sufficient to store a predetermined number of still images, moving images for a predetermined time, and audio. Further, the image memory 106 also serves as a memory (video memory) for displaying an image. 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 is a display device such as an LCD or an organic EL.

コーデック部110は、画像メモリ106に書き込まれた画像データをMPEGやH.264等の所定のビットレートおよびフォーマットで圧縮符号化して映像ファイルを生成し、記録媒体112に記録する。また、コーデック部110は、記録媒体112に記録されている映像ファイルを所定のビットレートおよびフォーマットで復号し、画像メモリ106に格納する。 The codec unit 110 transfers the image data written in the image memory 106 to MPEG or H.A. A video file is generated by compression coding at a predetermined bit rate and format such as 264, and recorded on the recording medium 112. Further, the codec unit 110 decodes the video file recorded on the recording medium 112 at a predetermined bit rate and format, and stores the video file in the image memory 106.

記録媒体I/F111は、記録媒体112へのアクセスを制御するインターフェースである。記録媒体112は、撮影された画像データを記録するための内蔵および/または着脱可能なメモリカードやHDD(ハードディスクドライブ)等である。 The recording medium I / F 111 is an interface that controls access to the recording medium 112. The recording medium 112 is a built-in and / or detachable memory card, HDD (hard disk drive), or the like for recording captured image data.

顔検出部113は、撮影画像中の特定の被写体情報として人物の顔領域情報を検出する。リライティング処理部114は、撮影画像にリライティング処理を行う。 The face detection unit 113 detects the face area information of a person as specific subject information in the captured image. The rewriting processing unit 114 performs rewriting processing on the captured image.

操作部115は、ユーザからの各種操作を受け付ける各種スイッチ、ボタン、タッチパネル等の操作部材であり、電源スイッチ、シャッターボタン、録画開始・終了ボタン等を含む。操作部115は、システム制御部120に各種の操作状態を通知する。 The operation unit 115 is an operation member such as various switches, buttons, and a touch panel that receives various operations from the user, and includes a power switch, a shutter button, a recording start / end button, and the like. The operation unit 115 notifies the system control unit 120 of various operation states.

システム制御部120は、不揮発性メモリ116に格納されたプログラムを実行することで、後述するフローチャートの各処理を実現する。117はシステムメモリであり、RAMが用いられる。システムメモリ117には、システム制御部120の動作用の定数、変数、不揮発性メモリ116から読み出したプログラム等を展開する。また、システム制御部120は画像メモリ106、D/A変換器108、表示部109等を制御することにより表示制御も行う。 The system control unit 120 realizes each process of the flowchart described later by executing the program stored in the non-volatile memory 116. 117 is a system memory, and RAM is used. In the system memory 117, constants and variables for the operation of the system control unit 120, a program read from the non-volatile memory 116, and the like are expanded. The system control unit 120 also controls the display by controlling the image memory 106, the D / A converter 108, the display unit 109, and the like.

距離検出部118は、被写体までの距離を計測し、後述する距離算出部303において撮影画素の画素単位に対応する距離情報を2次元の距離マップとして算出する。 The distance detection unit 118 measures the distance to the subject, and the distance calculation unit 303, which will be described later, calculates the distance information corresponding to each pixel of the photographing pixel as a two-dimensional distance map.

<撮影動作>次に、本実施形態の撮像装置100による撮影動作について説明する。 <Shooting operation> Next, a shooting operation by the imaging device 100 of the present embodiment will be described.

撮像部103は、撮影レンズ101およびシャッター102を介して入射した光を光電変換し、アナログ画像信号としてA/D変換器104へ出力する。A/D変換器104は撮像部103から出力されるアナログ画像信号をデジタル信号に変換し画像処理部105に出力する。 The imaging unit 103 photoelectrically converts the light incident through the photographing lens 101 and the shutter 102, and outputs the light as an analog image signal to the A / D converter 104. The A / D converter 104 converts the analog image signal output from the imaging unit 103 into a digital signal and outputs it to the image processing unit 105.

画像処理部105は、A/D変換器104からの画像データ、又は、メモリ制御部107からの画像データに対し、色変換処理、ガンマ処理、輪郭強調処理等を行う。また、画像処理部105では、顔検出部113により検出された顔領域情報や、撮像した画像データを用いて所定の評価値算出処理(不図示)を行い、得られた評価値に基づいてシステム制御部120が露光制御、測距制御を行う。これにより、TTL(スルー・ザ・レンズ)方式のAF(オートフォーカス)処理、AE(自動露出)処理、AWB(オートホワイトバランス)処理等を行う。 The image processing unit 105 performs color conversion processing, gamma 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 face area information detected by the face detection unit 113 and the captured image data, and the system is based on the obtained evaluation value. The control unit 120 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 display image 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等の規格に基づき圧縮符号化する。システム制御部120は符号化した画像データを関連付けて、記録媒体I/F111を介して記録媒体112に格納する。 The codec unit 110 compresses and encodes the image data stored in the image memory 106 based on a standard such as MPEG. The system control unit 120 associates the encoded image data and stores it in the recording medium 112 via the recording medium I / F 111.

<画像処理部>次に、図2を参照して、本実施形態の画像処理部105の構成および機能について説明する。 <Image Processing Unit> Next, the configuration and function of the image processing unit 105 of the present embodiment will be described with reference to FIG.

図2において、画像処理部105は、同時化処理部200、WB増幅部201、輝度・色信号生成部202、輪郭強調処理部203、輝度ガンマ処理部204、色変換処理部205、色ガンマ処理部206、色差信号生成部207、陰影情報取得部208を含む。 In FIG. 2, the image processing unit 105 includes a simultaneous processing unit 200, a WB amplification unit 201, a brightness / color signal generation unit 202, a contour enhancement processing unit 203, a brightness gamma processing unit 204, a color conversion processing unit 205, and a color gamma processing. A unit 206, a color difference signal generation unit 207, and a shadow information acquisition unit 208 are included.

次に、画像処理部105における処理を説明する。 Next, the processing in the image processing unit 105 will be described.

図1のA/D変換器104から画像処理部105に入力された画像信号は同時化処理部200に入力される。同時化処理部200は入力されたベイヤーRGBの画像データに対して、同時化処理を行い、色信号R,G,Bを生成する。WB増幅部201は、システム制御部120が算出するホワイトバランスゲイン値に基づき、RGBの色信号にゲインをかけ、ホワイトバランスを調整する。WB増幅部201から出力されるRGB信号は輝度・色信号生成部202に入力される。輝度・色信号生成部202はRGB信号から輝度信号Yを生成し、生成した輝度信号Yを輪郭強調処理部203、色信号RGBを色変換処理部205へ出力する。 The image signal input from the A / D converter 104 of FIG. 1 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 120, 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 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は、輝度信号Yに対して輪郭強調処理を行い、輝度ガンマ処理部204へ出力する。輝度ガンマ処理部204は輝度信号Yに対してガンマ補正を行い、画像メモリ106に出力する。 The contour enhancement processing unit 203 performs contour enhancement processing on the luminance signal Y 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 it to the image memory 106.

色変換処理部205は、RGB信号に対するマトリクス演算などにより、所望のカラーバランスへ変換する。色ガンマ処理部206は、RGBの色信号にガンマ補正を行う。色差信号生成部207では、RGB信号から色差信号R−Y、B−Y信号を生成し、画像メモリ106に出力する。画像メモリ106に格納された輝度・色差信号(Y,R−Y,B−Y)は、コーデック部110によって圧縮符号化され、記録媒体112に記録される。 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 and outputs them to the image memory 106. The luminance / color difference signals (Y, RY, BY) stored in the image memory 106 are compressed and coded by the codec unit 110 and recorded on the recording medium 112.

また、色変換処理部205で処理されたRGB信号は陰影情報取得部208へ出力される。陰影情報取得部208は、撮影時の光源環境によって被写体に生じた陰影の状態を解析するための情報を取得する。例えば、被写体の平均輝度情報および顔領域の輝度ヒストグラム情報などを陰影情報として取得する。 Further, the RGB signal processed by the color conversion processing unit 205 is output 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 due to the light source environment at the time of shooting. 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.

<リライティング処理部>次に、図3を参照して、本実施形態のリライティング処理部114の構成および機能について説明する。 <Rewriting Processing Unit> Next, the configuration and function of the rewriting processing unit 114 of the present embodiment will be described with reference to FIG.

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

図3において、RGB信号変換部301は入力された輝度・色差信号(Y、B−Y、R−Y)をRGB信号に変換する。デガンマ処理部302は、RGB信号変換部301から出力されるRGB信号にデガンマ処理を行う。距離算出部303は、距離検出部118から出力される撮像装置と被写体との距離情報を取得する。法線算出部304は、距離算出部303で算出された被写体の距離情報から法線情報を算出する。仮想光源反射成分算出部305は、仮想光源を設定し、設定された仮想光源から照射された光が被写体に反射した成分を算出する。仮想光源付加処理部306は、デガンマ処理部302から出力されるRGB信号に、仮想光源付加処理部306で算出された仮想光源の光が被写体に反射した成分をリライティング効果として付加する。ガンマ処理部307は、仮想光源付加処理部306から出力されるRGB信号にガンマ特性をかける。輝度・色差信号変換部308は、ガンマ処理部307から出力されるRGB信号を輝度・色差信号(Y、B−Y、R−Y)に変換する。被写体領域決定部309は、距離算出部303から取得した距離マップと、顔検出部113から取得した顔領域情報とに基づいて撮影画像における被写体領域を決定する。リライティング信頼度算出部310は、顔検出部113により検出された顔領域情報と、被写体領域決定部309により得られた被写体領域情報との関係に基づいてリライティング処理の信頼度を算出する。 In FIG. 3, the RGB signal conversion unit 301 converts the input luminance / color difference signals (Y, BY, RY) into RGB signals. The degamma processing unit 302 performs degamma processing on the RGB signal output from the RGB signal conversion unit 301. The distance calculation unit 303 acquires the distance information between the image pickup device and the subject output from the distance detection unit 118. The normal calculation unit 304 calculates the normal information from the distance information of the subject calculated by the distance calculation unit 303. The virtual light source reflection component calculation unit 305 sets a virtual light source, and calculates a component in which the light emitted from the set virtual light source is reflected on the subject. The virtual light source addition processing unit 306 adds a component obtained by reflecting the light of the virtual light source calculated by the virtual light source addition processing unit 306 to the subject as a rewriting effect to the RGB signal output from the degamma processing unit 302. The gamma processing unit 307 applies a gamma characteristic to the RGB signal output from the virtual light source addition processing unit 306. The luminance / color difference signal conversion unit 308 converts the RGB signal output from the gamma processing unit 307 into a luminance / color difference signal (Y, BY, RY). The subject area determination unit 309 determines the subject area in the captured image based on the distance map acquired from the distance calculation unit 303 and the face area information acquired from the face detection unit 113. The rewriting reliability calculation unit 310 calculates the reliability of the rewriting process based on the relationship between the face area information detected by the face detection unit 113 and the subject area information obtained by the subject area determination unit 309.

次に、リライティング処理部114の動作について説明する。 Next, the operation of the rewriting processing unit 114 will be described.

リライティング処理部114は、画像メモリ106に格納された輝度・色差信号(Y、B−Y、R−Y)を読み出し、RGB信号変換部301に入力する。RGB信号変換部301は、入力された輝度・色差信号(Y、B−Y、R−Y)をRGB信号に変換し、デガンマ処理部302へ出力する。 The rewriting processing unit 114 reads out the luminance / color difference signals (Y, BY, RY) stored in the image memory 106 and inputs them to the RGB signal conversion unit 301. 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のガンマ処理部204、206でかけられたガンマ特性と逆の特性の演算を行いリニアデータに変換する。デガンマ処理部302は、リニア変換後のRGB信号(Rt、Gt、Bt)を、仮想光源反射成分算出部305および仮想光源付加処理部306に出力する。 The degamma processing unit 302 calculates the gamma characteristic applied by the gamma processing units 204 and 206 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は、距離検出部118から取得した被写体距離情報から距離マップを算出する。被写体距離情報は、撮影画像の画素単位で得られる2次元の距離情報であり、距離マップは、撮影画像の各画素に対する距離情報をマップデータとしたものである。法線算出部304は、距離算出部303から距離マップを取得し、撮影画像の各画素に対応する法線情報をマップデータとした法線マップを算出する。距離マップから法線マップを生成する方法は、公知の技術を用いるものとするが、具体的な処理例について図4を用いて説明する。図4は撮影座標と被写体と仮想光源の位置関係を示している。例えば、図4に示すようにある被写体401に対して、撮影画像の水平方向の差分ΔHに対する距離(奥行き)Dの差分ΔDから勾配情報を算出し、勾配情報から法線Nを算出することが可能である。撮影画像の各画素に対して上記処理を行うことで、撮影画像の各画素に対応する法線情報Nを算出可能である。法線算出部304は、撮影画像の各画素に対応する法線情報を法線マップとして生成し、仮想光源反射成分算出部305に出力する。 The distance calculation unit 303 calculates a distance map from the subject distance information acquired from the distance detection unit 118. The subject distance information is two-dimensional distance information obtained in units of pixels of the captured image, and the distance map is map data of the distance information for each pixel of the captured image. The normal calculation unit 304 acquires a distance map from the distance calculation unit 303, and calculates a normal map using the normal information corresponding to each pixel of the captured image as map data. A known technique is used as a method for generating a normal map from a distance map, and a specific processing example will be described with reference to FIG. FIG. 4 shows the shooting coordinates and the positional relationship between the subject and the virtual light source. 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 of the captured image, the normal information N corresponding to each pixel of the captured image can be calculated. The normal calculation unit 304 generates normal information corresponding to each pixel of the captured image as a normal map, and outputs the normal information to the virtual light source reflection component calculation unit 305.

被写体領域決定部309は、距離算出部303から取得した距離マップと顔検出部113から取得した顔領域情報とから撮影画像における被写体領域を決定する。具体的には、顔領域情報から顔領域内の距離値の平均値Defaveを算出し、平均値Defaveが含まれる任意の範囲、例えばDefave±10といった距離値を持つ領域を被写体領域として決定する。 The subject area determination unit 309 determines the subject area in the captured image from the distance map acquired from the distance calculation unit 303 and the face area information acquired from the face detection unit 113. Specifically, the average value Def ave of the distance values in the face area is calculated from the face area information, and an arbitrary range including the average value Def ave , for example, a region having a distance value such as Def ave ± 10 is set as the subject area. decide.

リライティング信頼度算出部310は、被写体領域決定部309から取得した被写体領域情報と、顔検出部113から取得した顔領域情報との関係に基づいてリライティング処理の信頼度を算出する。リライティング信頼度とは、リライティング処理により意図通りに明るさが補正された画像が得られるか否かを数値化した指標である。リライティング処理により不自然な画像になる可能性がある場合や、絵柄が壊れてしまうといった可能性ある場合に、リライティング信頼度が低い値となる。 The rewriting reliability calculation unit 310 calculates the reliability of the rewriting process based on the relationship between the subject area information acquired from the subject area determination unit 309 and the face area information acquired from the face detection unit 113. The rewriting reliability is an index that quantifies whether or not an image whose brightness is corrected as intended by the rewriting process can be obtained. The rewriting reliability is low when there is a possibility that the rewriting process may result in an unnatural image or the pattern may be damaged.

図5は顔検出部113により検出された顔領域情報と被写体領域決定部309により得られた被写体領域情報を例示している。図5において、(a)は撮影シーン、(b)、(c)、(d)は顔検出部113により検出された顔領域情報、(e)、(f)、(g)は被写体領域決定部309により得られた被写体領域情報をそれぞれ例示している。また、図5(b)は、顔検出部113において適切に顔領域が検出された場合の顔検出結果を示している。図5(c)と(d)は顔検出部113において顔領域を誤検出した場合の顔検出結果を示している。特に、図5(c)は顔領域外の背景の領域を顔であると誤検出した場合であり、図5(d)は実際の顔の面積と比較して小さい領域を顔であると誤検出した場合である。図5(e)は、被写体領域決定部309において適切に決定された被写体領域情報を示している。図5(f)と(g)は被写体領域決定部309において被写体領域を誤判定した場合の被写体領域情報を示している。特に、図5(f)は被写体領域外の部分も被写体領域であると誤判定した場合であり、図5(g)は被写体領域の一部を領域外であると誤判定した場合である。図5(c)、(d)、(f)、(g)のように誤判定した被写体領域情報を用いてリライティング処理を行うとリライティング処理後の画像が不自然になる可能性がある。このため、上記のように誤検出したケースでは、リライティング信頼度算出部310において算出されるリライティング信頼度が低い値となる。 FIG. 5 illustrates the face area information detected by the face detection unit 113 and the subject area information obtained by the subject area determination unit 309. In FIG. 5, (a) is a shooting scene, (b), (c), and (d) are face area information detected by the face detection unit 113, and (e), (f), and (g) are subject area determinations. The subject area information obtained by the unit 309 is illustrated. Further, FIG. 5B shows the face detection result when the face region is appropriately detected by the face detection unit 113. 5 (c) and 5 (d) show the face detection result when the face region is erroneously detected by the face detection unit 113. In particular, FIG. 5C is a case where the background area outside the face area is erroneously detected as a face, and FIG. 5D is an erroneous case where a small area compared to the actual face area is a face. This is the case when it is detected. FIG. 5E shows the subject area information appropriately determined by the subject area determination unit 309. 5 (f) and 5 (g) show subject area information when the subject area is erroneously determined by the subject area determination unit 309. In particular, FIG. 5 (f) shows a case where it is erroneously determined that a portion outside the subject area is also a subject area, and FIG. 5 (g) shows a case where a part of the subject area is erroneously determined to be outside the area. If the rewriting process is performed using the subject area information that is erroneously determined as in FIGS. 5 (c), (d), (f), and (g), the image after the rewriting process may become unnatural. Therefore, in the case of erroneous detection as described above, the rewriting reliability calculated by the rewriting reliability calculation unit 310 becomes a low value.

仮想光源反射成分算出部305では、図4に示す仮想光源402と被写体401との距離K、法線情報N、仮想光源パラメータLに基づき、仮想光源402が被写体401に反射する成分を算出する。具体的には、仮想光源402と被写体401との距離Kの二乗に反比例し、法線ベクトルNと光源方向ベクトルLの内積に比例するように、撮影画像の各画素に対応する座標位置の反射成分を算出する。これについて、図4を用いて説明する。図4において、401が被写体、402は設定した仮想光源の位置を示している。撮像装置100で撮影された画像の水平画素位置H1(垂直画素位置は説明の簡略化のため省略)における反射成分は、撮影座標H1における法線N1と仮想光源の方向ベクトルL1の内積に比例し、仮想光源と被写体位置の距離K1に反比例する値となる。 The virtual light source reflection component calculation unit 305 calculates the component reflected by the virtual light source 402 on the subject 401 based on the distance K between the virtual light source 402 and the subject 401, the normal information N, and the virtual light source parameter L shown in FIG. Specifically, the reflection of the coordinate position corresponding to each pixel of the captured image is inversely proportional to the square of the distance K between the virtual light source 402 and the subject 401, and proportional to the inner product of the normal vector N and the light source direction vector L. Calculate the components. 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 image captured by the image pickup apparatus 100 is proportional to the inner product of the normal N1 at the photographing coordinates 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となる。
(式1)
Ra=α×(−L・N)/K2×Rt
Ga=α×(−L・N)/K2×Gt
Ba=α×(−L・N)/K2×Bt
ここで、αは仮想光源の強さであり、リライティング処理のゲイン値、Lは仮想光源の3次元方向ベクトル、Nは被写体の3次元法線ベクトル、Kは仮想光源と被写体の距離である。また、Rt、Gt、Btはデガンマ処理部302から出力されるRGB信号である。
Expressing the above relationship with a mathematical formula, the subject reflection components (Ra, Ga, Ba) by the virtual light source are given by the following equation 1.
(Equation 1)
Ra = α × (−L ・ N) / K 2 × Rt
Ga = α × (−L ・ N) / K 2 × Gt
Ba = α × (−L ・ N) / K 2 × Bt
Here, α is the strength of the virtual light source, 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. Further, Rt, Gt, and Bt are RGB signals output from the degamma processing unit 302.

仮想光源反射成分算出部305は、リライティング信頼度算出部310で算出したリライティング信頼度が所定の閾値よりも高い場合には、上記式1で仮想光源による反射成分(Ra、Ga、Ba)を算出する。また、リライティング信頼度が所定の閾値よりも低い場合には、リライティング処理のゲイン値αや、仮想光源の3次元方向ベクトルL、3次元法線ベクトルNを制御して反射成分(Ra、Ga、Ba)を算出する。具体的な処理については図7のフローチャートを用いて後述する。 When the rewriting reliability calculated by the rewriting reliability calculation unit 310 is higher than a predetermined threshold value, the virtual light source reflection component calculation unit 305 calculates the reflection components (Ra, Ga, Ba) by the virtual light source by the above equation 1. do. When the rewriting reliability is lower than a predetermined threshold value, the gain value α of the rewriting process and the three-dimensional direction vector L and the three-dimensional normal vector N of the virtual light source are controlled to control the reflection components (Ra, Ga, Ba) is calculated. Specific processing will be described later using the flowchart of FIG.

上記のように算出した仮想光源による反射成分(Ra、Ga、Ba)は仮想光源付加処理部306へ出力される。仮想光源付加処理部306では、仮想光源による反射成分(Ra、Ga、Ba)を付加する下記式2の処理を行う。
(式2)
Rout=Rt+Ra
Gout=Gt+Ga
Bout=Bt+Ba
仮想光源付加処理部306から出力された画像信号(Rout、Gout、Bout)はガンマ処理部307に入力される。ガンマ処理部307では、入力されるRGB信号にガンマ補正を行う。輝度・色差信号変換部308では、RGB信号から輝度Y、色差信号R−Y、B−Y信号を生成する。
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 the processing of the following formula 2 for adding reflection components (Ra, Ga, Ba) by the virtual light source.
(Equation 2)
Rout = Rt + Ra
Gout = Gt + Ga
Bout = Bt + Ba
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 input RGB signal. The luminance / color difference signal conversion unit 308 generates a luminance Y, a luminance signal RY, and a BY signal from the RGB signal.

以上がリライティング処理部114の動作である。図6はリライティング処理部114でリライティング処理した画像の一例を示している。図6(a)はリライティング処理前の撮影画像、図6(b)はリライティング処理後の撮影画像である。図6(a)で暗い被写体に対してリライティング処理を施すことで、図6(b)のように陰影が明るくなるように補正される。 The above is the operation of the rewriting processing unit 114. FIG. 6 shows an example of an image rewritten by the rewriting processing unit 114. FIG. 6A is a photographed image before the rewriting process, and FIG. 6B is a photographed image after the rewriting process. By performing the rewriting process on the dark subject in FIG. 6 (a), the shadow is corrected so as to be bright as shown in FIG. 6 (b).

システム制御部120は、リライティング処理部114から出力される輝度・色差信号(Y、B−Y、R−Y)を、メモリ制御部107によって画像メモリ106に書き込む。その後、コーデック部110で圧縮符号化を行い、記録媒体I/F111を介して記録媒体112に記録する。 The system control unit 120 writes the luminance / color difference signals (Y, BY, RY) output from the rewriting processing unit 114 into the image memory 106 by the memory control unit 107. After that, the codec unit 110 performs compression coding and records on the recording medium 112 via the recording medium I / F 111.

<リライティング処理>次に、図7を参照して、本実施形態のリライティング処理の制御手順について説明する。 <Rewriting Process> Next, the control procedure of the rewriting process of the present embodiment will be described with reference to FIG. 7.

なお、図7の処理は、不揮発性メモリ116に記録されたプログラムを、システムメモリ117に読み出してシステム制御部120が実行することにより実現する。後述する図9でも同様である。 The process of FIG. 7 is realized by reading the program recorded in the non-volatile memory 116 into the system memory 117 and executing the program by the system control unit 120. The same applies to FIG. 9 described later.

本実施形態では、システム制御部120がリライティング処理部114を制御して、リライティング処理の信頼度を算出し、算出されたリライティング信頼度に基づきリライティング処理を行う。 In the present embodiment, the system control unit 120 controls the rewriting processing unit 114, calculates the reliability of the rewriting processing, and performs the rewriting processing based on the calculated rewriting reliability.

S701では、システム制御部120は、上述した撮影動作を行い被写体を撮影する。 In S701, the system control unit 120 performs the above-described photographing operation to photograph the subject.

S702では、システム制御部120は、ユーザ操作により操作部115を介してリライティング処理モードが選択されているか判定することで、リライティング処理部114による処理を行うか否かを判定する。リライティング処理を行うと判定した場合はS703に進み、そうでない場合は本処理を終了する。 In S702, the system control unit 120 determines whether or not the rewriting processing unit 114 performs the processing by determining whether or not the rewriting processing mode is selected via the operation unit 115 by the user operation. If it is determined that the rewriting process is to be performed, the process proceeds to S703, and if not, the present process is terminated.

S703では、システム制御部120は、顔検出部113から被写体の顔領域情報を取得する。顔検出部113は、撮影画像中の被写体の顔のパーツである目、鼻、口などの器官の座標位置の情報を取得し、それら座標位置から顔領域を検出する。なお、顔検出部113は、顔のパーツである器官の位置から顔領域を検出する方法に限定されず、過去の顔領域の検出結果を学習して顔領域を検出するような他の方法を用いてもよい。 In S703, the system control unit 120 acquires the face area information of the subject from the face detection unit 113. The face detection unit 113 acquires information on the coordinate positions of organs such as eyes, nose, and mouth, which are parts of the face of the subject in the captured image, and detects the face region from those coordinate positions. The face detection unit 113 is not limited to the method of detecting the face region from the position of the organ which is a part of the face, and may use another method of learning the past detection result of the face region and detecting the face region. You may use it.

S704では、システム制御部120は、被写体領域決定部309から被写体領域情報を取得する。被写体領域決定部309は、上述したように顔検出部113から顔領域情報、距離算出部303から距離マップ情報を取得し、顔の距離値と同等の距離値を持つ領域を被写体領域として決定する。 In S704, the system control unit 120 acquires the subject area information from the subject area determination unit 309. As described above, the subject area determination unit 309 acquires face area information from the face detection unit 113 and distance map information from the distance calculation unit 303, and determines an area having a distance value equivalent to the face distance value as the subject area. ..

S705では、システム制御部120は、リライティング信頼度算出部310においてリライティング信頼度を算出する。リライティング信頼度算出部310は、図5で説明したように顔検出部113による検出結果や被写体領域決定部309による判定結果が適切でない場合には、リライティング信頼度として低い値を算出する。ここで、リライティング信頼度の算出方法について図8を用いて説明する。 In S705, the system control unit 120 calculates the rewriting reliability in the rewriting reliability calculation unit 310. The rewriting reliability calculation unit 310 calculates a low value as the rewriting reliability when the detection result by the face detection unit 113 or the determination result by the subject area determination unit 309 is not appropriate as described with reference to FIG. Here, a method of calculating the rewriting reliability will be described with reference to FIG.

図8(a)は、被写体領域と顔領域の位置の一致度レベルとリライティング信頼度との関係を例示している。被写体領域内に顔領域が含まれていればリライティング信頼度は高くなり、反対に図5(c)に示したように被写体領域内に顔領域が含まれていなければリライティング信頼度は低くなる。被写体領域の位置と顔領域の位置が離れている程、一致度レベルは低くなりリライティング信頼度は低くなる。 FIG. 8A illustrates the relationship between the level of coincidence between the positions of the subject area and the face area and the rewriting reliability. If the face area is included in the subject area, the rewriting reliability is high, and conversely, as shown in FIG. 5C, if the face area is not included in the subject area, the rewriting reliability is low. The farther the position of the subject area and the position of the face area are, the lower the matching degree level and the lower the rewriting reliability.

図8(b)は、被写体領域に対して、顔領域の面積レベルとリライティング信頼度との関係を例示している。図5(d)に示したように被写体領域に対して、顔領域が小さすぎる(両者の差異が閾値未満の)場合または大きすぎる(両者の差異が閾値以上の)場合にリライティング信頼度を低くする。撮影シーンにより、顔をアップで撮影した場合と全身を撮影した場合で被写体領域の大きさは異なる。このため、被写体領域に対して顔領域がどの程度小さいと誤検出であるのかを判断するのは難しいが、被写体領域と比較してあまりに顔領域が小さい場合は誤検出である可能性が高いのでリライティング信頼度を低くするよう制御する。 FIG. 8B illustrates the relationship between the area level of the face region and the rewriting reliability with respect to the subject region. As shown in FIG. 5D, the rewriting reliability is low when the face area is too small (the difference between the two is less than the threshold value) or too large (the difference between the two is greater than or equal to the threshold value) with respect to the subject area. do. Depending on the shooting scene, the size of the subject area differs depending on whether the face is shot up or the whole body is shot. For this reason, it is difficult to determine how small the face area is with respect to the subject area for false detection, but if the face area is too small compared to the subject area, there is a high possibility of false detection. Control to reduce rewriting reliability.

図8(c)は、顔周辺領域への被写体領域のはみ出しレベルとリライティング信頼度との関係を例示している。図5(f)に示したように顔領域の周辺領域にまで被写体領域があった場合に、リライティングの信頼度を低くする。被写体領域は、顔も含まれているが首から下の胴体部分も含まれているので、被写体領域が顔領域をはみ出ていても問題はない。しかしながら、被写体領域が顔領域の上部、すなわち頭の上などにあった場合には、誤検出である可能性が高いとしてリライティング信頼度を低くする。 FIG. 8C illustrates the relationship between the protrusion level of the subject area to the peripheral area of the face and the rewriting reliability. As shown in FIG. 5 (f), when the subject area extends to the peripheral area of the face area, the reliability of rewriting is lowered. The subject area includes the face, but also includes the body portion below the neck, so there is no problem even if the subject area extends beyond the face area. However, if the subject area is above the face area, that is, above the head, the rewriting reliability is lowered because there is a high possibility of false detection.

図8(d)は、顔領域に対して、被写体領域の欠けているレベルとリライティング信頼度との関係を例示している。図5(g)で示したように顔領域の一部が欠けている被写体領域であった場合に、リライティングの信頼度を低くする。欠けている領域が大きいほどリライティングの信頼度を低く算出するよう制御する。 FIG. 8D illustrates the relationship between the missing level of the subject area and the rewriting reliability with respect to the face area. When the subject area lacks a part of the face area as shown in FIG. 5 (g), the reliability of rewriting is lowered. The larger the missing area, the lower the rewriting reliability is controlled to be calculated.

そして、リライティング信頼度算出部310は、図8(a)〜(d)に示した複数の要素から最終的なリライティング信頼度を算出する。例えば4つの要素に対しそれぞれリライティング信頼度を算出し、その平均値を最終的なリライティング信頼度を算出するか、もしくは個々の要素の重要度に応じて重みを持たせて、最終的なリライティング信頼度を算出する。 Then, the rewriting reliability calculation unit 310 calculates the final rewriting reliability from the plurality of elements shown in FIGS. 8A to 8D. For example, the rewriting reliability is calculated for each of the four elements, and the average value is used to calculate the final rewriting reliability, or the weight is given according to the importance of each element to give the final rewriting reliability. Calculate the degree.

図7に戻り、S706では、システム制御部120は、S705で算出したリライティング信頼度が所定の閾値Thより高いか否かを判定し、閾値以上であると判定した場合はS707に進み、閾値未満であると判定した場合はS708に進む。 Returning to FIG. 7, in S706, the system control unit 120 determines whether or not the rewriting reliability calculated in S705 is higher than the predetermined threshold value Th, and if it is determined that it is equal to or higher than the threshold value, proceeds to S707 and is less than the threshold value. If it is determined that, the process proceeds to S708.

S707では、システム制御部120は、上述したリライティング処理を実行する。 In S707, the system control unit 120 executes the rewriting process described above.

S708では、システム制御部120は、リライティング処理のパラメータを通常の値から変更してリライティング処理を実行する。 In S708, the system control unit 120 changes the parameter of the rewriting process from the normal value and executes the rewriting process.

具体的には、仮想光源による反射成分(Ra、Ga、Ba)は、前述した式1を用いて算出されるが、式中で用いているリライティング処理のゲイン値αや、仮想光源の3次元方向ベクトルL、3次元法線ベクトルNを制御する。例えば、リライティング信頼度が低い場合は、リライティング処理をすると不自然に処理結果となる可能性が高いため、リライティング処理のゲイン値αを小さく制御することが望ましい。よって、リライティング信頼度の低さに応じてリライティング処理のゲイン値αを通常よりも低く設定するよう制御する。例えばリライティング信頼度が最低値の0であれば、リライティング処理のゲイン値αをゼロとし、リライティング処理をしないよう制御する。 Specifically, the reflection components (Ra, Ga, Ba) by the virtual light source are calculated using the above-mentioned equation 1, but the gain value α of the rewriting process used in the equation and the three-dimensional effect of the virtual light source. The direction vector L and the three-dimensional normal vector N are controlled. For example, when the rewriting reliability is low, there is a high possibility that the processing result will be unnatural when the rewriting process is performed. Therefore, it is desirable to control the gain value α of the rewriting process to be small. Therefore, the gain value α of the rewriting process is controlled to be set lower than usual according to the low rewriting reliability. For example, if the rewriting reliability is 0, which is the lowest value, the gain value α of the rewriting process is set to zero, and control is performed so that the rewriting process is not performed.

また、リライティング信頼度が低くなった要因により、仮想光源による反射成分を制御することも可能である。例えば、リライティング信頼度が低い要因が被写体領域決定部309による被写体領域情報の誤判定であった場合には、被写体領域決定部309に距離情報を出力している距離算出部303が適切に算出していないことになる。この場合、距離算出部303からの距離情報に基づいて算出している法線算出部304の出力である3次元法線ベクトルNもまた正確でないと考えられるため、N=1として仮想光源による反射成分(Ra、Ga、Ba)を求める。 It is also possible to control the reflection component by the virtual light source due to the factor that the rewriting reliability is lowered. For example, when the cause of the low rewriting reliability is an erroneous determination of the subject area information by the subject area determination unit 309, the distance calculation unit 303 that outputs the distance information to the subject area determination unit 309 appropriately calculates. It will not be. In this case, since the three-dimensional normal vector N, which is the output of the normal calculation unit 304 calculated based on the distance information from the distance calculation unit 303, is also considered to be inaccurate, reflection by the virtual light source is performed with N = 1. Find the components (Ra, Ga, Ba).

例えば、リライティング信頼度が低い要因が被写体領域決定部309の被写体領域情報の誤判定であって、その誤検出が図5(g)のように顔領域に対して被写体領域が欠けている場合には、その欠けている領域にリライティング処理をしなければ目立たない。このため、欠けている領域に仮想光源の光が照射しないよう仮想光源の3次元方向ベクトルLの照射範囲を制御して仮想光源による反射成分(Ra、Ga、Ba)を求める。 For example, when the factor of low rewriting reliability is an erroneous determination of the subject area information of the subject area determination unit 309, and the erroneous detection is that the subject area is lacking with respect to the face area as shown in FIG. 5 (g). Will not stand out unless the missing area is rewritten. Therefore, the reflection components (Ra, Ga, Ba) by the virtual light source are obtained by controlling the irradiation range of the three-dimensional direction vector L of the virtual light source so that the missing region is not irradiated with the light of the virtual light source.

以上、システム制御部120のリライティング処理部114の動作を説明した。 The operation of the rewriting processing unit 114 of the system control unit 120 has been described above.

[実施形態2]次に、図9を参照して、実施形態2について説明する。 [Embodiment 2] Next, the second embodiment will be described with reference to FIG.

図9は、撮影画像中に複数の被写体が存在する場合のリライティング処理の制御手順を示している。 FIG. 9 shows a control procedure of the rewriting process when a plurality of subjects are present in the captured image.

なお、図9のS701〜S705は、被写体が単体の場合の図7の処理と同一であるため、説明を省略する。 Since S701 to S705 in FIG. 9 are the same as the processing in FIG. 7 when the subject is a single subject, the description thereof will be omitted.

S901では、システム制御部120は、主要被写体レベルを算出する。主要被写体とは、例えば、撮影画像中に占める面積が大きい人物、予め登録された顔の人物、撮像装置からの距離が近い人物であり、撮影画像中において主要被写体であるほどレベルが高くなる。 In S901, the system control unit 120 calculates the main subject level. The main subject is, for example, a person who occupies a large area in the captured image, a person whose face is registered in advance, or a person who is closer to the image pickup device. The higher the main subject in the captured image, the higher the level.

S902では、システム制御部120は、被写体ごとのリライティング信頼度および主要被写体レベルの算出が完了したか否かを判定する。そして、リライティング信頼度および主要被写体レベルの算出が完了していると判定した場合にはS903に進み、完了していない場合にはS702に戻り、S702〜S902までの処理を繰り返す。 In S902, the system control unit 120 determines whether or not the calculation of the rewriting reliability and the main subject level for each subject is completed. Then, when it is determined that the calculation of the rewriting reliability and the main subject level is completed, the process proceeds to S903, and when it is not completed, the process returns to S702 and the processes from S702 to S902 are repeated.

S903では、システム制御部120は、全ての被写体のリライティング信頼度が所定の閾値Thより高いか否かを判定し、閾値以上であると判定した場合はS904に進み、閾値未満であると判定した場合はS905に進む。 In S903, the system control unit 120 determines whether or not the rewriting reliability of all the subjects is higher than the predetermined threshold value Th, and if it is determined that the rewriting reliability is equal to or higher than the threshold value, the system proceeds to S904 and determines that the rewriting reliability is less than the threshold value. If so, proceed to S905.

S904では、システム制御部120は、通常のリライティング処理を実行する。 In S904, the system control unit 120 executes a normal rewriting process.

S905では、システム制御部120は、S901で算出した主要被写体レベルが高い被写体のリライティング信頼度が所定の閾値Thより高いか否かを判定する。そして、閾値以上であると判定した場合はS906に進み、閾値未満であると判定した場合はS907に進む。 In S905, the system control unit 120 determines whether or not the rewriting reliability of a subject having a high main subject level calculated in S901 is higher than a predetermined threshold Th. Then, if it is determined that the value is equal to or higher than the threshold value, the process proceeds to S906, and if it is determined that the value is lower than the threshold value, the process proceeds to S907.

S906では、システム制御部120は、主要被写体には通常のリライティングを実行し、主要被写体ではない非主要被写体についてはリライティング処理のパラメータを変更してリライティング処理を実行する。例えば、非主要被写体はリライティング信頼度が低いので通常のリライティング処理のゲイン値よりも低いゲイン値を用いてリライティング処理を実行する。 In S906, the system control unit 120 executes normal rewriting for the main subject, and changes the parameters of the rewriting process for the non-main subject that is not the main subject to execute the rewriting process. For example, since the rewriting reliability of a non-main subject is low, the rewriting process is executed using a gain value lower than the gain value of the normal rewriting process.

S907では、システム制御部120は、全ての被写体に対して通常のリライティング処理で用いるパラメータを変更してリライティング処理を実行する。例えば、全ての被写体に対し、通常のリライティング処理のゲイン値よりも低いゲイン値を用いてリライティング処理を実行する。また、図7で説明したようにリライティング信頼度が低かった要因によって、リライティングパラメータの仮想光源の3次元方向ベクトルL、3次元法線ベクトルNの値を制御してリライティング処理を実行する。 In S907, the system control unit 120 executes the rewriting process by changing the parameters used in the normal rewriting process for all the subjects. For example, the rewriting process is executed for all the subjects using a gain value lower than the gain value of the normal rewriting process. Further, as described with reference to FIG. 7, the rewriting process is executed by controlling the values of the three-dimensional direction vector L and the three-dimensional normal vector N of the virtual light source of the rewriting parameter due to the factor that the rewriting reliability is low.

以上、撮影画像中に複数の被写体が存在する場合のリライティング処理の制御手順を説明した。 The control procedure of the rewriting process when a plurality of subjects are present in the captured image has been described above.

なお、上述した各実施形態では、リライティング信頼度算出部310においてリライティング信頼度を算出する際に、図8(a)〜(d)を用いて誤検出の要因となる4要素から最終的なリライティング信頼度を算出する例を説明したが、これに限らず、誤検出のパターンは4要素以上あっても構わない。 In each of the above-described embodiments, when the rewriting reliability calculation unit 310 calculates the rewriting reliability, the final rewriting is performed from the four elements that cause erroneous detection using FIGS. 8A to 8D. The example of calculating the reliability has been described, but the present invention is not limited to this, and the false detection pattern may have four or more elements.

また、上述した各実施形態では、リライティング信頼度算出部310において、図8で示したように、顔検出部113の顔領域情報と被写体領域決定部309の被写体領域情報との関係を分析してリライティング信頼度を算出する例を説明したが、これに限るものではない。例えば、顔検出部113において検出した顔領域情報の信頼度を算出し、被写体領域決定部309において被写体領域情報の信頼度を算出し、少なくとも一方の信頼度の情報を取得して、その情報を基にリライティング信頼度を算出する構成にしてもよい。 Further, in each of the above-described embodiments, as shown in FIG. 8, the rewriting reliability calculation unit 310 analyzes the relationship between the face area information of the face detection unit 113 and the subject area information of the subject area determination unit 309. An example of calculating the rewriting reliability has been described, but the present invention is not limited to this. For example, the reliability of the face area information detected by the face detection unit 113 is calculated, the reliability of the subject area information is calculated by the subject area determination unit 309, the information of at least one of the reliabilitys is acquired, and the information is obtained. The rewriting reliability may be calculated based on the configuration.

また、上述した各実施形態では、1画像に対し最終的なリライティング信頼度を1つ算出、もしくは1画像に含まれる複数の被写体に対して各々のリライティング信頼度を算出する場合について説明したが、これに限るものではない。例えば、画素単位でのリライティング信頼度を算出する構成にしてもよく、その場合は、例えば被写体領域と顔領域の位置がずれていた場合に被写体領域と顔領域の位置のずれ量が大きい画素ほど、リライティング信頼度を低くする。 Further, in each of the above-described embodiments, a case where one final rewriting reliability is calculated for one image or each rewriting reliability is calculated for a plurality of subjects included in one image has been described. It is not limited to this. For example, the rewriting reliability may be calculated for each pixel. In that case, for example, when the positions of the subject area and the face area are misaligned, the larger the amount of misalignment between the subject area and the face area, the larger the pixel. , Reduce rewriting reliability.

また、本実施形態では、リライティング処理により被写体の陰影(暗部)が明るくなるように補正する場合について述べたが、逆に暗くするリライティングを行ってもよい。その場合、リライティング処理のゲイン値αをマイナスにする。 Further, in the present embodiment, the case where the shadow (dark part) of the subject is corrected so as to be brightened by the rewriting process has been described, but conversely, the relighting may be performed to darken the subject. In that case, the gain value α of the rewriting process is set to minus.

また、図4で説明した仮想光源の位置とリライティング処理の対象領域の画素の距離Dの算出方法は、上述した方法に限定するものではなく、どのような算出方法をとってもよい。例えば、撮像装置および被写体の位置を3次元位置として取得し、3次元での距離で計算してもよい。 Further, the method of calculating the position of the virtual light source and the distance D of the pixels of the target area of the rewriting process described with reference to FIG. 4 is not limited to the above-mentioned method, and any calculation method may be used. For example, the positions of the image pickup apparatus and the subject may be acquired as three-dimensional positions and calculated by the distance in three dimensions.

また、各画素のRGB信号に対して仮想光源による反射成分を付加する場合に、仮想光源と被写体との距離の二乗に反比例する式を用いたが、これに限定するものではない。例えば、距離Dに反比例するものや、ガウス分布的に照射範囲が変化する式であってもよい。 Further, when adding a reflection component by a virtual light source to the RGB signal of each pixel, an equation that is inversely proportional to the square of the distance between the virtual light source and the subject is used, but the present invention is not limited to this. 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.

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

100…撮像装置、103…撮像部、105…画像処理部、113…顔検出部、114…リライティング処理部、118…距離検出部、120…システム制御部、303…距離算出部、309…被写体領域決定部、310…リライティング信頼度算出部 100 ... Imaging device, 103 ... Imaging unit, 105 ... Image processing unit, 113 ... Face detection unit, 114 ... Rewriting processing unit, 118 ... Distance detection unit, 120 ... System control unit, 303 ... Distance calculation unit, 309 ... Subject area Decision unit, 310 ... Rewriting reliability calculation unit

Claims (17)

仮想的な光源である仮想光源を設定し、前記仮想光源を用いて画像中の被写体の明るさを補正する補正処理を行う処理手段と、
前記画像中の被写体の特定の部分領域情報を取得する取得手段と、
前記画像における前記補正処理の対象となる被写体領域を決定する決定手段と、
前記取得手段により得られた前記被写体の特定の部分領域情報と前記決定手段により決定された前記被写体領域との関係に基づく前記補正処理の信頼度に応じて前記処理手段による補正処理を制御する制御手段と、を有することを特徴とする画像処理装置。
A processing means for setting a virtual light source, which is a virtual light source, and performing correction processing for correcting the brightness of the subject in the image using the virtual light source.
An acquisition unit configured to acquire a certain partial area information of the subject in the image,
Determining means for determining a subject region to be the correction process in the image,
Control for controlling the correction processing by said processing means in accordance with the reliability of the correction process based on a relationship between the determined said object regions by a particular partial area information and said determining means of the subject obtained by the acquisition unit An image processing apparatus comprising: Means.
前記画像中の人物の顔領域を検出する顔検出手段と、前記被写体までの距離情報を検出する距離検出手段とをさらに有し、
前記決定手段は、前記顔検出手段および前記距離検出手段による検出結果に基づいて前記補正処理の対象となる前記被写体領域を決定することを特徴とする請求項1に記載の画像処理装置。
Further comprising a face detecting unit that detects a human face region in the image, and a distance detecting means for detecting the distance information to the subject,
It said determining means, the image processing apparatus according to claim 1, wherein the determining the object region to be the correction process based on the detection result by the face detecting means and the distance detecting means.
前記被写体の特定の部分領域情報は、前記顔検出手段により検出された顔領域に基づき取得されることを特徴とする請求項2に記載の画像処理装置。The image processing apparatus according to claim 2, wherein the specific partial region information of the subject is acquired based on the face region detected by the face detecting means. 前記制御手段は、前記顔検出手段により検出された顔領域の周辺領域を含めて、前記決定手段が前記被写体領域として決定した場合に、前記補正処理の信頼度を低くすることを特徴とする請求項3に記載の画像処理装置。 The claim is characterized in that the control means lowers the reliability of the correction process when the determination means determines the subject region, including the peripheral region of the face region detected by the face detection means. Item 3. The image processing apparatus according to item 3. 前記制御手段は、前記決定手段により決定された前記被写体領域の面積に対して、前記顔検出手段により検出された顔領域の面積が小さい場合に、前記補正処理の信頼度を低くすることを特徴とする請求項3に記載の画像処理装置。 Said control means, characterized in that the area of the object region determined by the determination unit, when the small area of the face region detected by said face detecting means, to lower the reliability of the correction process The image processing apparatus according to claim 3. 前記制御手段は、前記決定手段により決定された前記被写体領域の面積に対して、前記顔検出手段により検出された顔領域の面積が大きい場合に、前記補正処理の信頼度を低くすることを特徴とする請求項3に記載の画像処理装置。 Said control means, characterized in that the area of the object region determined by the determination unit, when a larger area of the face region detected by said face detecting means, to lower the reliability of the correction process The image processing apparatus according to claim 3. 前記顔検出手段は、検出した顔領域の信頼度を算出し、
前記決定手段は、前記被写体領域の信頼度を算出し、
前記制御手段は、前記顔領域の信頼度と前記被写体領域の信頼度の少なくともいずれかから前記補正処理の信頼度を求めることを特徴とする請求項3から6のいずれか1項に記載の画像処理装置。
The face detecting means calculates the reliability of the detected face region and calculates the reliability.
The determining means calculates a reliability of the subject region,
The image according to any one of claims 3 to 6, wherein the control means obtains the reliability of the correction process from at least one of the reliability of the face region and the reliability of the subject region. Processing equipment.
前記制御手段は、前記補正処理の信頼度が所定の閾値未満の場合には、前記処理手段による補正処理を変更して実行するように制御することを特徴とする請求項1から7のいずれか1項に記載の画像処理装置。 Any of claims 1 to 7, wherein the control means controls to change and execute the correction process by the processing means when the reliability of the correction process is less than a predetermined threshold value. The image processing apparatus according to item 1. 前記制御手段は、前記補正処理の信頼度が所定の閾値未満の場合には、前記処理手段による補正処理を実行しないように制御することを特徴とする請求項1から7のいずれか1項に記載の画像処理装置。 The control means according to any one of claims 1 to 7, wherein the control means controls so that the correction process by the processing means is not executed when the reliability of the correction process is less than a predetermined threshold value. The image processing apparatus described. 前記制御手段は、前記画像中に複数の被写体が存在する場合は、各被写体に対して前記補正処理の信頼度を求めることを特徴とする請求項3に記載の画像処理装置。 Wherein if there are multiple objects in the image, the image processing apparatus according to claim 3, wherein the determination of the reliability of the correction processing for each object. 前記制御手段は、前記画像中の被写体のレベルを算出し、
前記被写体のレベルと前記補正処理の信頼度とに基づいて前記処理手段による補正処理を制御することを特徴とする請求項10に記載の画像処理装置。
It said control means calculates a level of the object in the image,
The image processing apparatus according to claim 10, wherein the correction process by the processing means is controlled based on the level of the subject and the reliability of the correction process.
前記制御手段は、前記補正処理の信頼度が所定の閾値未満である被写体が存在する場合には、前記被写体のレベルを判定し、
前記被写体のレベルが閾値より高い第1の被写体の前記補正処理の信頼度が前記所定の閾値以上の場合には、前記第1の被写体に前記処理手段による補正処理を実行し、前記第1の被写体ではない第2の被写体には前記処理手段による補正処理を変更して実行するように制御することを特徴とする請求項11に記載の画像処理装置。
When there is a subject whose reliability of the correction process is less than a predetermined threshold value, the control means determines the level of the subject.
When the reliability of the correction processing of the first subject whose level of the subject is higher than the threshold value is equal to or higher than the predetermined threshold value, the correction processing by the processing means is executed on the first subject, and the first subject is described. The image processing apparatus according to claim 11, wherein the second subject, which is not the subject, is controlled so that the correction process by the processing means is changed and executed.
前記制御手段は、前記第1の被写体の前記補正処理の信頼度が前記所定の閾値未満の場合には、全ての被写体に対して前記処理手段による補正処理を変更して実行するように制御することを特徴とする請求項12に記載の画像処理装置。 When the reliability of the correction process of the first subject is less than the predetermined threshold value, the control means controls to change and execute the correction process by the processing means for all the subjects. The image processing apparatus according to claim 12. 前記被写体を撮影し、撮影画像を生成する撮影手段をさらに有し、
前記処理手段は、前記撮影手段により生成された前記撮影画像を前記補正処理の対象とすることを特徴とする請求項1から13のいずれか1項に記載の画像処理装置。
It photographs the subject, further comprising an imaging means for generating the captured image,
The processing means, the image processing apparatus according to the captured image generated by the imaging means in any one of claims 1 to 13, characterized in that the object of the correction process.
処理手段が、仮想的な光源である仮想光源を設定し、前記仮想光源を用いて画像中の被写体の明るさを補正する補正処理を行うステップと、
取得手段が、前記画像中の被写体の特定の部分領域情報を取得するステップと、
決定手段が、前記画像における前記補正処理の対象となる被写体領域を決定するステップと、
制御手段が、前記被写体の特定の部分領域情報と前記被写体領域との関係に基づく前記補正処理の信頼度に応じて前記処理手段による補正処理を制御するステップと、を有することを特徴とする画像処理方法。
A step in which the processing means sets a virtual light source, which is a virtual light source, and performs correction processing for correcting the brightness of the subject in the image using the virtual light source.
Acquiring means, acquiring a specific partial region information of the subject in the image,
Determining means, determining the subject to the subject area of the correction process in the image,
An image characterized in that the control means includes a step of controlling the correction process by the processing means according to the reliability of the correction process based on the relationship between the specific partial area information of the subject and the subject area. Processing method.
コンピュータを、請求項1から14のいずれか1項に記載された画像処理装置の各手段として機能させるためのプログラム。 A program for causing a computer to function as each means of the image processing apparatus according to any one of claims 1 to 14. コンピュータを、請求項1から14のいずれか1項に記載された画像処理装置の各手段として機能させるためのプログラムを格納したコンピュータが読み取り可能な記憶媒体。 A computer-readable storage medium containing a program for causing the computer to function as each means of the image processing apparatus according to any one of claims 1 to 14.
JP2017084760A 2017-04-21 2017-04-21 Image processing equipment and its control methods, programs, and storage media Active JP6937603B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017084760A JP6937603B2 (en) 2017-04-21 2017-04-21 Image processing equipment and its control methods, programs, and storage media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017084760A JP6937603B2 (en) 2017-04-21 2017-04-21 Image processing equipment and its control methods, programs, and storage media

Publications (2)

Publication Number Publication Date
JP2018182699A JP2018182699A (en) 2018-11-15
JP6937603B2 true JP6937603B2 (en) 2021-09-22

Family

ID=64277289

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017084760A Active JP6937603B2 (en) 2017-04-21 2017-04-21 Image processing equipment and its control methods, programs, and storage media

Country Status (1)

Country Link
JP (1) JP6937603B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7356255B2 (en) * 2019-04-24 2023-10-04 キヤノン株式会社 Image processing device and its processing method, imaging device, program, storage medium
JP7398939B2 (en) * 2019-12-03 2023-12-15 キヤノン株式会社 Image processing device and its control method, imaging device, program, and storage medium
JP7455578B2 (en) 2019-12-27 2024-03-26 キヤノン株式会社 Image processing device and image processing method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7894673B2 (en) * 2004-09-30 2011-02-22 Fujifilm Corporation Image processing apparatus and method, and image processing computer readable medium for processing based on subject type
JP2014016792A (en) * 2012-07-09 2014-01-30 Sony Corp Image processor and method, and program
JP6576083B2 (en) * 2015-04-15 2019-09-18 キヤノン株式会社 Image processing apparatus, image processing method, and program

Also Published As

Publication number Publication date
JP2018182699A (en) 2018-11-15

Similar Documents

Publication Publication Date Title
EP3609177A1 (en) Control method, control apparatus, imaging device, and electronic device
JP6833415B2 (en) Image processing equipment, image processing methods, and programs
US9813634B2 (en) Image processing apparatus and method
JP7292905B2 (en) Image processing device, image processing method, and imaging device
JP6937603B2 (en) Image processing equipment and its control methods, programs, and storage media
JP2021128791A (en) Image processing apparatus, image processing method, and program
JP7277158B2 (en) Setting device and method, program, storage medium
US10863103B2 (en) Setting apparatus, setting method, and storage medium
JP2018182700A (en) Image processing apparatus, control method of the same, program, and storage medium
JP6921606B2 (en) Image processing equipment, image processing methods and programs
JP2017138927A (en) Image processing device, imaging apparatus, control method and program thereof
US10021314B2 (en) Image processing apparatus, image capturing apparatus, method of controlling the same, and storage medium for changing shading using a virtual light source
CN112911161B (en) Image processing apparatus, image processing method, image capturing apparatus, and storage medium
JP5451364B2 (en) Subject tracking device and control method thereof
JP6541416B2 (en) IMAGE PROCESSING APPARATUS, IMAGE PROCESSING METHOD, PROGRAM, AND STORAGE MEDIUM
JP2018093359A (en) Image processing apparatus, image processing method, and program
JP2020046475A (en) Image processing device and control method therefor
JP7011694B2 (en) Image processing equipment and its control method, program
JP7356255B2 (en) Image processing device and its processing method, imaging device, program, storage medium
CN112672066B (en) Image processing apparatus, image capturing apparatus, control method, and storage medium
JP7462464B2 (en) Image processing device and method, program, and storage medium
JP6946055B2 (en) Image processing equipment and image processing methods, programs
JP2021087125A (en) Image processing device, control method thereof, and program
JP2017103685A (en) Image processing device and method, and imaging device
JP2017151562A (en) Image processing device, imaging device, control method and program therefor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200403

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20201222

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20210103

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210113

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210215

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210416

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210831

R151 Written notification of patent or utility model registration

Ref document number: 6937603

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151