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

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

Info

Publication number
JP2021145385A
JP2021145385A JP2021097301A JP2021097301A JP2021145385A JP 2021145385 A JP2021145385 A JP 2021145385A JP 2021097301 A JP2021097301 A JP 2021097301A JP 2021097301 A JP2021097301 A JP 2021097301A JP 2021145385 A JP2021145385 A JP 2021145385A
Authority
JP
Japan
Prior art keywords
image
subject
face
image data
pixel
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.)
Pending
Application number
JP2021097301A
Other languages
Japanese (ja)
Inventor
有一 中田
Yuichi Nakada
有一 中田
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
Priority claimed from JP2019151519A external-priority patent/JP6896811B2/en
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2021097301A priority Critical patent/JP2021145385A/en
Publication of JP2021145385A publication Critical patent/JP2021145385A/en
Pending legal-status Critical Current

Links

Images

Abstract

To obtain an image provided with a shadow according to a posture and facial expression of a subject.SOLUTION: The image processing apparatus includes: acquisition means for acquiring a color image obtained by imaging a subject; specifying means for specifying a face area of the subject as a face area in the color image; and generation means for generating a corrected image formed by modifying brightness of at least a part of the face area in the color image.SELECTED DRAWING: Figure 4

Description

本発明は、画像データに陰影を付与する技術に関する。 The present invention relates to a technique for imparting shading to image data.

撮像装置を用いて被写体を撮影する場合、被写体に対する光の当たり方によって得られる画像は大きく変わる。例えば逆光の状態で撮影した場合、被写体の全体あるいは一部が影になり暗く写ってしまう。また、ストロボを用いて被写体に光を照射して撮影を行う場合には、光の影響により被写体の陰影が飛ばされ、被写体が平坦に見えるような場合もある。これらの画像を補正する方法として、特定の方向から疑似的に光を当てたように被写体の暗部を補正する方法が知られている(特許文献1)。特許文献1に記載の技術では、仮想光源の影響をガウス分布で表現する。この際、別途設定したライティング方向に従って輝度補正のガウス分布を偏らせることにより、仮想的に所望の方向から照明を与えたような画像を得ることができる。 When a subject is photographed using an imaging device, the image obtained varies greatly depending on how the light hits the subject. For example, when shooting against the sun, all or part of the subject becomes a shadow and appears dark. Further, when the subject is irradiated with light using a strobe for shooting, the shadow of the subject may be skipped due to the influence of the light, and the subject may appear flat. As a method of correcting these images, there is known a method of correcting a dark part of a subject as if light is applied from a specific direction in a pseudo manner (Patent Document 1). In the technique described in Patent Document 1, the influence of a virtual light source is expressed by a Gaussian distribution. At this time, by biasing the Gaussian distribution of the brightness correction according to the lighting direction set separately, it is possible to obtain an image as if the illumination was applied from a virtually desired direction.

また、被写体に対応する3Dモデルを用いて所定の仮想照明条件下でCGのレンダリング処理を行い、レンダリングしたCG画像を、撮影により得られた画像中の被写体像と置き換えることで被写体のライティングを変更する方法も知られている(特許文献2)。特許文献2に記載の技術では、あらかじめ用意しておいた3Dモデルの中から被写体と置き換える3Dモデルを決定する。 In addition, the lighting of the subject is changed by performing CG rendering processing under predetermined virtual lighting conditions using a 3D model corresponding to the subject and replacing the rendered CG image with the subject image in the image obtained by shooting. A method for rendering is also known (Patent Document 2). In the technique described in Patent Document 2, a 3D model to be replaced with the subject is determined from the 3D models prepared in advance.

特許第5281878号公報Japanese Patent No. 5281878 特許第5088220号公報Japanese Patent No. 5088220

撮影者が所望する照明条件下で撮影したかのような別の画像を撮影画像から生成する場合、被写体の姿勢や表情に合わせた陰影を付与した画像が得られることが好ましい。しかしながら特許文献1、2の技術では以下のような課題がある。 When another image is generated from the captured image as if it was captured under the lighting conditions desired by the photographer, it is preferable to obtain an image with shading according to the posture and facial expression of the subject. However, the techniques of Patent Documents 1 and 2 have the following problems.

特許文献1に記載の技術のように仮想光源の影響をガウス分布で表現する場合、人間の顔のような複雑な形状の被写体に対して自然な陰影を付与することは困難である。また、特許文献2に記載の技術のように、被写体の3Dモデルを用いてレンダリングした結果で画像中の被写体像を置きかえる場合、置き換えた後の被写体の姿勢や表情が3Dモデルの姿勢や表情に置き換わってしまい不自然な結果となってしまう。そこで、本発明は被写体の姿勢や表情に合わせた陰影を付与した画像を得ることを目的とする。 When the influence of a virtual light source is expressed by a Gaussian distribution as in the technique described in Patent Document 1, it is difficult to give a natural shadow to a subject having a complicated shape such as a human face. Further, when the subject image in the image is replaced with the result of rendering using the 3D model of the subject as in the technique described in Patent Document 2, the posture or facial expression of the subject after the replacement becomes the posture or facial expression of the 3D model. It will be replaced and the result will be unnatural. Therefore, an object of the present invention is to obtain an image in which a shadow is added according to the posture and facial expression of the subject.

上記課題を解決するために、本発明に係る画像処理装置は、被写体を撮像することにより得られたカラー画像を取得する取得手段と、前記カラー画像において前記被写体の顔の領域を顔領域として特定する特定手段と、前記カラー画像における前記顔領域の少なくとも一部の明るさが変更された補正画像を生成する生成手段を有することを特徴とする。 In order to solve the above problems, the image processing apparatus according to the present invention specifies an acquisition means for acquiring a color image obtained by photographing a subject and a region of the face of the subject as a face region in the color image. It is characterized by having a specific means for generating a corrected image in which the brightness of at least a part of the face region in the color image is changed.

本発明によれば、被写体の姿勢や表情に合わせた陰影を付与した画像を得ることができる。 According to the present invention, it is possible to obtain an image in which a shadow is added according to the posture and facial expression of the subject.

本発明の実施形態1に係る撮像装置の外観を示す図。The figure which shows the appearance of the image pickup apparatus which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る撮像装置の内部構成を示す図。The figure which shows the internal structure of the image pickup apparatus which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る画像処理部の構成を示すブロック図。The block diagram which shows the structure of the image processing part which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る処理の流れを示すフローチャート。The flowchart which shows the flow of the process which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る画像データの例を示す図。The figure which shows the example of the image data which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る顔情報を示す図。The figure which shows the face information which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る距離補正処理の流れを示すフローチャート。The flowchart which shows the flow of the distance correction processing which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る距離補正処理の概要を表す図。The figure which shows the outline of the distance correction processing which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る法線補正処理の流れを示すフローチャート。The flowchart which shows the flow of the normal correction processing which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る法線補正処理の概要を表す図。The figure which shows the outline of the normal correction processing which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係る法線平滑化処理の概要を表す図。The figure which shows the outline of the normal smoothing process which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係るライティング処理の流れを示すフローチャート。The flowchart which shows the flow of the lighting process which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係るライティング処理の概要を示す図。The figure which shows the outline of the lighting process which concerns on Embodiment 1 of this invention. 本発明の実施形態1に係るライティング処理の効果を表す図。The figure which shows the effect of the lighting process which concerns on Embodiment 1 of this invention. 本発明の実施形態2に係る補正係数の例を示す図。The figure which shows the example of the correction coefficient which concerns on Embodiment 2 of this invention. 本発明の実施形態3に係るライティング処理の効果を表わす図。The figure which shows the effect of the lighting process which concerns on Embodiment 3 of this invention. 本発明の実施形態4に係る処理の流れを示すフローチャート。The flowchart which shows the flow of the process which concerns on Embodiment 4 of this invention.

[実施形態1]
<撮像装置の外観>
図1は本実施形態に係る撮像装置の外観を示す図であり、図1(a)は撮像装置の前面、図1(b)は背面の外観を示している。撮像装置101は、光学部102、撮像ボタン103、ストロボ104、距離取得部105、表示部106、および操作ボタン107を有している。
[Embodiment 1]
<Appearance of imaging device>
1A and 1B are views showing the appearance of the image pickup apparatus according to the present embodiment, FIG. 1A shows the appearance of the front surface of the image pickup apparatus, and FIG. 1B shows the appearance of the back surface of the image pickup apparatus. The image pickup apparatus 101 includes an optical unit 102, an image pickup button 103, a strobe 104, a distance acquisition unit 105, a display unit 106, and an operation button 107.

光学部102はズームレンズ、フォーカスレンズ、ブレ補正レンズ、絞り、およびシャッターによって構成される鏡筒であり、被写体の光情報を集光する。撮像ボタン103は、ユーザが撮像の開始を撮像装置101に指示するためのボタンである。ストロボ104は、ユーザ指示に従い撮像の開始に合わせて発光させることができる照明である。距離取得部105は、撮像指示に応じて被写体の距離画像データを取得する距離取得モジュールである。距離画像データとは、画像の各画素の画素値としてその画素に対応する被写体距離を格納した画像データのことを意味する。距離取得部105は、赤外光を発光する赤外発光部と、被写体に反射した赤外光を受光する受光部とを含み、発光した赤外光が被写体に反射し受光するまでの時間を基に撮像装置から被写体までの距離値を算出する。そして、算出した距離値と受光部のセンサ画素数や画角等を含む距離撮像情報に基づき被写体の位置情報を算出し距離画像データを生成する。なお、距離画像データの取得方法はこれに限られない。例えば距離取得部105の代わりに光学部102と同様の光学系を設け、異なる2つの視点から撮像された画像データの間の視差に基づいて、三角測量を行うことにより距離画像データを取得するようにしてもよい。 The optical unit 102 is a lens barrel composed of a zoom lens, a focus lens, a blur correction lens, an aperture, and a shutter, and collects light information of a subject. The image pickup button 103 is a button for the user instructing the image pickup apparatus 101 to start imaging. The strobe 104 is an illumination that can emit light at the start of imaging according to a user instruction. The distance acquisition unit 105 is a distance acquisition module that acquires distance image data of a subject in response to an imaging instruction. The distance image data means image data in which the subject distance corresponding to the pixel is stored as the pixel value of each pixel of the image. The distance acquisition unit 105 includes an infrared light emitting unit that emits infrared light and a light receiving unit that receives infrared light reflected by the subject, and takes a time until the emitted infrared light is reflected by the subject and received. Based on this, the distance value from the image pickup device to the subject is calculated. Then, the position information of the subject is calculated based on the calculated distance value and the distance imaging information including the number of sensor pixels of the light receiving unit, the angle of view, and the like, and the distance image data is generated. The method of acquiring the distance image data is not limited to this. For example, instead of the distance acquisition unit 105, an optical system similar to the optical unit 102 is provided, and distance image data is acquired by performing triangulation based on the parallax between the image data captured from two different viewpoints. It may be.

表示部106は、撮像装置101にて処理された画像データや他の各種データなどを表示する、液晶ディスプレイなどのディスプレイである。本実施形態では撮像装置101に光学ファインダを設けていないので、フレーミング操作(ピントや構図の確認)は、表示部106を用いて行われる。すなわち、表示部106でライブビュー画像を確認しながら撮像が行われるので、フレーミングやフォーカシングの操作を行っている間は、表示部106は電子ファインダとして機能すると言える。表示部106では、撮像範囲をリアルタイムに表示するライブビュー表示が行われる他、カメラ設定メニューが表示される。 The display unit 106 is a display such as a liquid crystal display that displays image data processed by the image pickup apparatus 101, various other data, and the like. Since the image pickup apparatus 101 is not provided with an optical viewfinder in the present embodiment, the framing operation (confirmation of focus and composition) is performed using the display unit 106. That is, since the image is taken while checking the live view image on the display unit 106, it can be said that the display unit 106 functions as an electronic viewfinder while performing framing and focusing operations. On the display unit 106, a live view display for displaying the imaging range in real time is performed, and a camera setting menu is displayed.

操作ボタン107は、撮像装置101の動作モードの切り換え操作や、撮像時の各種パラメータなどをユーザが撮像装置101に指示するためのボタンである。なお、本実施形態では動作モードの一つとして、撮像された画像における照明の当たり具合を撮像後に補正するライティング補正処理モードが含まれる。ユーザは操作ボタン107、あるいは撮像ボタン103を用いてライティング補正処理モードへの切り替えや、ライティング補正に用いる仮想照明の照明パラメータの設定や、照明の当たり具合を調整する被写体の選択などを行うことができる。また、ユーザは補正された画像データを出力する際に、距離画像データを出力するかどうか等の指示をすることもできるものとする。なお、表示部106はタッチスクリーン機能を有していても良く、その場合はタッチスクリーンを用いたユーザ指示を操作ボタン107の入力として扱うことも可能である。 The operation button 107 is a button for the user to instruct the image pickup apparatus 101 of an operation for switching the operation mode of the image pickup apparatus 101, various parameters at the time of imaging, and the like. In the present embodiment, as one of the operation modes, a lighting correction processing mode for correcting the lighting condition in the captured image after imaging is included. The user can switch to the lighting correction processing mode using the operation button 107 or the image pickup button 103, set the lighting parameters of the virtual lighting used for the lighting correction, select the subject for adjusting the lighting condition, and the like. can. Further, when outputting the corrected image data, the user can also give an instruction as to whether or not to output the distance image data. The display unit 106 may have a touch screen function, and in that case, a user instruction using the touch screen can be treated as an input of the operation button 107.

<撮像装置の内部構成>
図2は本実施形態における撮像装置101の内部構成を示すブロック図である。
<Internal configuration of imaging device>
FIG. 2 is a block diagram showing an internal configuration of the image pickup apparatus 101 according to the present embodiment.

CPU202は、各構成の処理すべてに関わり、ROM(Read Only Memory)203や、RAM(Rondom Access Memory)204に格納された命令を順に読み込み、解釈し、その結果に従って処理を実行する。システムバス212はデータを送受信するためのバスである。なお、本実施形態において、ROM203には、人間の顔に対応する顔法線モデルが格納されているものとする。顔法線モデルは、所定の形状の顔に対応する、顔表面の法線ベクトルを画素値に格納した法線画像データと、法線画像データにおける人の、目や口などの器官位置を示す器官位置情報とを含む。 The CPU 202 is involved in all the processes of each configuration, reads and interprets the instructions stored in the ROM (Read Only Memory) 203 and the RAM (Random Access Memory) 204 in order, and executes the processes according to the result. The system bus 212 is a bus for transmitting and receiving data. In the present embodiment, it is assumed that the face normal model corresponding to the human face is stored in the ROM 203. The face normal model shows normal image data in which the normal vector of the face surface corresponding to a face having a predetermined shape is stored in pixel values, and the positions of human organs such as eyes and mouth in the normal image data. Includes organ location information.

制御部206は、撮像ボタン103や操作ボタン107からのユーザ指示を受取り、撮像、ライティング補正処理モードの切り換え、被写体領域の選択、照明パラメータの設定などの制御を行う制御回路である。光学系制御部205は光学部102に対して、フォーカスを合わせる、シャッターを開く、絞りを調整するなどのCPU202から指示された制御を行う制御回路である。 The control unit 206 is a control circuit that receives user instructions from the image pickup button 103 and the operation button 107 and controls imaging, switching of the lighting correction processing mode, selection of a subject area, setting of lighting parameters, and the like. The optical system control unit 205 is a control circuit that controls the optical unit 102 instructed by the CPU 202, such as focusing, opening a shutter, and adjusting the aperture.

カラー撮像素子部201は、光学部102にて集光された光情報を電流値へと変換する撮像素子である。カラー撮像素子部201にはベイヤ配列などの所定の配列を有するカラーフィルタが備えてあり、光学部102にて集光された光から被写体の色情報が取得される。 The color image sensor unit 201 is an image sensor that converts the light information collected by the optical unit 102 into a current value. The color image pickup element unit 201 is provided with a color filter having a predetermined arrangement such as a Bayer arrangement, and color information of a subject is acquired from the light focused by the optical unit 102.

A/D変換部208は、カラー撮像素子部201にて検知された被写体の色情報をデジタル信号値に変換しRAW画像データとする処理回路である。なお、本実施形態では同時刻に撮像した距離画像データとRAW画像データが取得可能であるとする。 The A / D conversion unit 208 is a processing circuit that converts the color information of the subject detected by the color image sensor unit 201 into digital signal values and converts them into RAW image data. In this embodiment, it is assumed that the distance image data and the RAW image data captured at the same time can be acquired.

画像処理部209はA/D変換部208で取得されたRAW画像データに対して現像処理を行い、カラー画像データを生成する。また、画像処理部209はカラー画像データや距離画像データを用いて、カラー画像データにライティング補正を行った補正画像データを生成するなどの、各種画像処理を行う。画像処理部209の内部構造は後に詳述する。 The image processing unit 209 develops the RAW image data acquired by the A / D conversion unit 208 to generate color image data. Further, the image processing unit 209 performs various image processing such as generating corrected image data in which lighting correction is performed on the color image data by using the color image data and the distance image data. The internal structure of the image processing unit 209 will be described in detail later.

また、キャラクタージェネレーション部207は文字やグラフィックなどを生成する処理回路である。キャラクタージェネレーション部207により生成された文字やグラフィックは、画像データや補正画像データなどに重畳して表示部106に表示される。 Further, the character generation unit 207 is a processing circuit that generates characters, graphics, and the like. The characters and graphics generated by the character generation unit 207 are superimposed on the image data, the corrected image data, and the like and displayed on the display unit 106.

エンコーダ部210は、画像処理部209にて処理したカラー画像データやライティング補正処理によって生成される補正画像データを含む各種画像データをJpegなどのファイルフォーマットに変換する処理を行う。 The encoder unit 210 performs a process of converting various image data including the color image data processed by the image processing unit 209 and the corrected image data generated by the lighting correction process into a file format such as JPEG.

メディアI/F211は、PC/メディア213(例えば、ハードディスク、メモリカード、CFカード、SDカードなど)に画像データを送受信するためのインタフェースである。メディアI/F211としては、例えばUSB(Universal Serial Bus)などが用いられる。 The media I / F211 is an interface for transmitting and receiving image data to and from a PC / media 213 (for example, a hard disk, a memory card, a CF card, an SD card, etc.). As the media I / F211 for example, USB (Universal Serial Bus) or the like is used.

<画像処理部の内部構成>
図3は本実施形態における画像処理部209の機能構成を示すブロック図である。現像処理部301は、A/D変換部208から取得したRAW画像データに対してホワイトバランス処理、デモザイク処理、ノイズリダクション処理、色変換処理、エッジ強調処理およびガンマ処理等を施し、カラー画像データを生成する。生成したカラー画像データは表示部106へ出力して表示したり、RAM204、PC/メディア213などの記憶装置に記憶することができる。なお、本実施形態では、現像処理部301はガンマ処理を施さずにカラー画像データを生成し、ライティング部305に出力する。
<Internal configuration of image processing unit>
FIG. 3 is a block diagram showing a functional configuration of the image processing unit 209 in the present embodiment. The development processing unit 301 performs white balance processing, demosaic processing, noise reduction processing, color conversion processing, edge enhancement processing, gamma processing, and the like on the RAW image data acquired from the A / D conversion unit 208, and obtains the color image data. Generate. The generated color image data can be output to the display unit 106 for display or stored in a storage device such as a RAM 204 or a PC / media 213. In this embodiment, the development processing unit 301 generates color image data without performing gamma processing and outputs the color image data to the lighting unit 305.

距離補正部302は、カラー画像データ、顔情報、ユーザにより選択された被写体位置に基づいて、距離画像データから選択された被写体に対応する補正距離データを生成する。本実施形態では、補正距離データは、主に選択された被写体位置に対応した人物と、それ以外の背景に対応する距離値を格納しているものとする。 The distance correction unit 302 generates correction distance data corresponding to the subject selected from the distance image data based on the color image data, face information, and the subject position selected by the user. In the present embodiment, it is assumed that the correction distance data mainly stores a person corresponding to the selected subject position and a distance value corresponding to other backgrounds.

顔検出部303は、現像処理部301から取得したカラー画像データから被写体の顔情報を取得する。被写体の顔情報には、少なくともカラー画像データにおいて被写体の顔が占める領域を示す顔領域と、顔に含まれる目や口などのカラー画像データにおける位置を示す器官位置とに関する情報が含まれる。 The face detection unit 303 acquires the face information of the subject from the color image data acquired from the development processing unit 301. The face information of the subject includes at least information on a face region indicating an area occupied by the subject's face in the color image data and an organ position indicating a position in the color image data such as eyes and mouth included in the face.

法線補正部304は、顔検出部303から取得した顔情報と、現像部301から取得したカラー画像データとに基づいて、ROM203に格納された顔法線モデルを補正する。 The normal correction unit 304 corrects the face normal model stored in the ROM 203 based on the face information acquired from the face detection unit 303 and the color image data acquired from the development unit 301.

ライティング処理部305は、距離補正部302から取得した補正距離データと、法線補正部304から取得した補正法線データと、制御部206から取得した照明パラメータとに基づいて、カラー画像データに対してライティング処理を行う。ライティング処理により生成された補正画像データはRAM204やPC/メディア213などの記憶装置に出力して記憶したり、表示部106へ出力して表示したりすることができる。 The lighting processing unit 305 refers to the color image data based on the correction distance data acquired from the distance correction unit 302, the correction normal data acquired from the normal correction unit 304, and the illumination parameters acquired from the control unit 206. And perform the lighting process. The corrected image data generated by the lighting process can be output and stored in a storage device such as a RAM 204 or a PC / media 213, or can be output and displayed on the display unit 106.

<画像処理部の処理フロー>
図4は本実施形態の撮像装置における画像処理部209の動作手順を示すフローチャートである。本実施形態において、画像処理部209は、カラー画像データから取得した顔情報と、ユーザ指示に基づき取得した被写体位置P0とを用いて、選択された被写体に対応する補正距離データを距離画像データから生成する。そして、被写体の顔情報と、あらかじめ保持していた顔法線モデルとに基づき、被写体の顔に合わせた法線画像データを生成する。その後、ユーザ操作によって設定された照明パラメータ、補正距離データ及び生成された法線画像データに基づき、カラー画像データに仮想光源を追加するライティング処理を行い補正画像データを生成する。以下、画像処理部209の動作手順の詳細について述べる。
<Processing flow of image processing unit>
FIG. 4 is a flowchart showing an operation procedure of the image processing unit 209 in the image pickup apparatus of the present embodiment. In the present embodiment, the image processing unit 209 uses the face information acquired from the color image data and the subject position P0 acquired based on the user's instruction to obtain the correction distance data corresponding to the selected subject from the distance image data. Generate. Then, based on the face information of the subject and the face normal model held in advance, normal image data matching the face of the subject is generated. After that, based on the lighting parameters set by the user operation, the correction distance data, and the generated normal image data, a lighting process of adding a virtual light source to the color image data is performed to generate the correction image data. The details of the operation procedure of the image processing unit 209 will be described below.

ステップS401において、現像処理部301がA/D変換部208から取得したRAW画像データにデモザイク処理などの現像処理を施してカラー画像データを生成する。本実施形態におけるカラー画像データについて図5(a)を用いて説明する。カラー画像データI501の画素(i,j)にはRGB値が画素値として格納されているものとし、それぞれIr(i,j)、Ig(i,j)、Ib(i,j)と表すものとする。なお、カラー画像データの取得方法はこれに限るものではない。例えば、RAM204やPC/メディア213に記憶されているRAW画像データを取得し現像処理部301がカラー画像データを生成してもよい。あるいは、既に現像処理が行われたカラー画像データをRAM204やPC/メディア213から取得してもよい。そして、ステップS402において、現像部301はステップS401で取得したカラー画像データを表示部106に出力する。ユーザは、表示部106での表示に基づいて、ライティング補正処理を行うかどうかの判断を行う。 In step S401, the development processing unit 301 performs development processing such as demosaic processing on the RAW image data acquired from the A / D conversion unit 208 to generate color image data. The color image data in this embodiment will be described with reference to FIG. 5 (a). It is assumed that RGB values are stored as pixel values in the pixels (i, j) of the color image data I501, and they are represented as Ir (i, j), Ig (i, j), and Ib (i, j), respectively. And. The method for acquiring color image data is not limited to this. For example, the RAW image data stored in the RAM 204 or the PC / media 213 may be acquired and the development processing unit 301 may generate the color image data. Alternatively, the color image data that has already been developed may be acquired from the RAM 204 or the PC / media 213. Then, in step S402, the developing unit 301 outputs the color image data acquired in step S401 to the display unit 106. The user determines whether or not to perform the lighting correction process based on the display on the display unit 106.

ステップS403において、制御部206が操作部107からの入力に従い、ライティング補正処理を行う指示が入力されているか否かの判定を行う。ライティング補正処理を行う指示が入力されていない場合はステップS404に進む。ライティング補正処理を行う指示が入力されている場合は、制御部206はライティング補正を行うことを示す信号を現像部301と距離補正部302とに出力してステップS406に進む。 In step S403, the control unit 206 determines whether or not an instruction to perform the lighting correction process is input according to the input from the operation unit 107. If the instruction to perform the lighting correction process is not input, the process proceeds to step S404. When an instruction to perform the lighting correction process is input, the control unit 206 outputs a signal indicating that the lighting correction is performed to the developing unit 301 and the distance correction unit 302, and proceeds to step S406.

ステップS404において、制御部206は、ユーザにより画像の出力指示が入力されているかどうかを判定する。ユーザにより画像の出力指示が入力されていると判定された場合は、ステップS405に進む。ユーザにより画像の出力指示が入力されていると判定されない場合は、ステップS403に戻る。 In step S404, the control unit 206 determines whether or not an image output instruction has been input by the user. If it is determined that the image output instruction has been input by the user, the process proceeds to step S405. If it is not determined that the image output instruction has been input by the user, the process returns to step S403.

ステップS405において、制御部206は画像の出力指示を現像部301に出力し、現像部301は、カラー画像データをPC/メディア213に出力して処理を終了する。 In step S405, the control unit 206 outputs an image output instruction to the developing unit 301, and the developing unit 301 outputs the color image data to the PC / media 213 to end the process.

ステップS406において、距離補正部302が距離取得部105から距離画像データを取得する。本実施形態における距離画像データについて図5(b)を用いて説明する。距離画像データD502の画素(i,j)には画素値として撮像装置から被写体までの距離値D(i,j)を格納しているものとする。なお、距離画像データの取得方法はこれに限るものではない。例えば、RAM204やPC/メディア213に記憶されている距離画像データを取得してもよい。 In step S406, the distance correction unit 302 acquires the distance image data from the distance acquisition unit 105. The distance image data in this embodiment will be described with reference to FIG. 5 (b). It is assumed that the pixel (i, j) of the distance image data D502 stores the distance value D (i, j) from the image pickup apparatus to the subject as a pixel value. The method of acquiring the distance image data is not limited to this. For example, the distance image data stored in the RAM 204 or the PC / media 213 may be acquired.

ステップS407において、現像部301は顔検出部303にカラー画像データを出力し、顔検出部303は入力されたカラー画像データから被写体の顔情報を取得する。本実施形態における顔情報について図6を用いて説明する。本実施形態における顔情報は、顔領域601および器官位置602を示す情報を含む。顔領域は、カラー画像データ501において顔が含まれる領域の画素の集合を表す。器官位置602は、顔領域内における目や口に対応する座標を表す。顔領域、器官位置の検出方法については既存のアルゴリズムが適用可能である。例として、テンプレートマッチングを用いたアルゴリズムや、Haar−Like特徴量を用いたアルゴリズムなどが挙げられる。本実施形態では、テンプレートマッチングによって顔領域・器官位置を検出する。まず、カラー画像データに対してしきい値処理を行うことで肌色の領域を顔候補領域として抽出する。すなわち、様々な肌色に基づいて決定された画素値の範囲の中に画素値が収まる画素を、顔候補領域として抽出する。そして、様々な大きさの顔画像テンプレートを用いて顔候補領域に対してマッチング処理を行い、顔領域としての尤度を算出する。最後に、算出された尤度が所定の閾値以上である領域を顔領域として抽出する。また、顔検出部303は、抽出された顔領域に対して目、口画像テンプレートを用いて同様のテンプレートマッチングを行い、目および口に対応する座標を抽出する。以上の処理により顔領域601、器官位置602が取得される。顔検出部303は、取得した顔情報を法線補正部304に出力する。なお、検出する器官としては、目や口以外にも鼻や耳など別の器官を抽出してもよい。 In step S407, the developing unit 301 outputs the color image data to the face detecting unit 303, and the face detecting unit 303 acquires the face information of the subject from the input color image data. The face information in this embodiment will be described with reference to FIG. The face information in the present embodiment includes information indicating the face area 601 and the organ position 602. The face region represents a set of pixels in a region including a face in the color image data 501. The organ position 602 represents the coordinates corresponding to the eyes and mouth in the facial area. Existing algorithms can be applied to the method of detecting the facial region and organ position. Examples include an algorithm using template matching and an algorithm using Haar-Like features. In this embodiment, the face region / organ position is detected by template matching. First, the skin color region is extracted as a face candidate region by performing threshold processing on the color image data. That is, pixels whose pixel values fall within the range of pixel values determined based on various skin colors are extracted as face candidate regions. Then, matching processing is performed on the face candidate region using face image templates of various sizes, and the likelihood as the face region is calculated. Finally, a region whose calculated likelihood is equal to or higher than a predetermined threshold value is extracted as a face region. Further, the face detection unit 303 performs the same template matching on the extracted face area using the eye and mouth image templates, and extracts the coordinates corresponding to the eyes and mouth. By the above processing, the face area 601 and the organ position 602 are acquired. The face detection unit 303 outputs the acquired face information to the normal correction unit 304. In addition to the eyes and mouth, other organs such as the nose and ears may be extracted as the organs to be detected.

ステップS408において、距離補正部302はユーザによって指定された被写体の位置を決定する。本実施形態において、ユーザは表示部106に設けられたタッチパネルや、操作ボタン107を用いて、ライティング補正処理を行いたい被写体の位置を指定する。距離補正部302は、ユーザ操作により入力された被写体選択位置P0’を制御部206から取得する。そして、取得した被写体選択位置P0’に基づいて、カラー画像データにおける指定された被写体位置P0を算出する。本実施形態では、タッチスクリーン機能を有した表示部106にカラー画像データを表示し、表示画面中の被写体をユーザがタッチする操作を受け付け、距離補正部302はユーザがタッチした位置を被写体選択位置P0’として制御部206から取得する。この際、被写体選択位置P0’は表示部106の画素位置に対応する。距離補正部302は、この表示部106上での画素位置を、カラー画像データの画素位置に変換することで被写体位置P0を算出する。 In step S408, the distance correction unit 302 determines the position of the subject designated by the user. In the present embodiment, the user uses the touch panel provided on the display unit 106 and the operation buttons 107 to specify the position of the subject to be subjected to the lighting correction processing. The distance correction unit 302 acquires the subject selection position P0'input by the user operation from the control unit 206. Then, the designated subject position P0 in the color image data is calculated based on the acquired subject selection position P0'. In the present embodiment, the color image data is displayed on the display unit 106 having the touch screen function, the operation of the user touching the subject on the display screen is accepted, and the distance correction unit 302 sets the position touched by the user as the subject selection position. Obtained from the control unit 206 as P0'. At this time, the subject selection position P0'corresponds to the pixel position of the display unit 106. The distance correction unit 302 calculates the subject position P0 by converting the pixel position on the display unit 106 into the pixel position of the color image data.

ステップS409において、距離補正部302が、ステップS408で取得した被写体位置P0と、現像部301から取得したカラー画像データとを用いて、ステップS406で取得した距離画像データから補正距離データを生成する。補正距離データ生成処理の詳細については後述する。距離補正部302は、生成した補正距離データをライティング部305に出力する。 In step S409, the distance correction unit 302 generates correction distance data from the distance image data acquired in step S406 by using the subject position P0 acquired in step S408 and the color image data acquired from the developing unit 301. The details of the correction distance data generation process will be described later. The distance correction unit 302 outputs the generated correction distance data to the lighting unit 305.

ステップS410において、法線補正部304が顔検出部303から取得した顔情報と、現像部301から入力されたカラー画像データとに基づいて、被写体の顔に合わせた法線画像データである補正法線データを生成する。補正法線データ生成処理の詳細については後述する。法線補正部304は、生成した補正法線データをライティング部305に出力する。 In step S410, a correction method that is normal image data that matches the face of the subject based on the face information acquired by the normal correction unit 304 from the face detection unit 303 and the color image data input from the development unit 301. Generate line data. The details of the correction normal data generation process will be described later. The normal correction unit 304 outputs the generated correction normal data to the lighting unit 305.

ステップS411において、ライティング部305が、入力された補正距離データと補正法線データとに基づいて、カラー画像データに対して仮想的な光源を加えるなどのライティング処理を行い補正画像データを生成する。ライティング処理の詳細については後述する。 In step S411, the lighting unit 305 performs lighting processing such as adding a virtual light source to the color image data based on the input correction distance data and the correction normal data to generate the correction image data. The details of the lighting process will be described later.

ステップS412において、ライティング部305が制御部206から、ライティング処理に用いる照明パラメータの設定の変更が入力されたかどうかを判定する。照明パラメータの設定が変更されたと判定された場合はステップS411に戻り再びライティング処理を行う。照明パラメータの設定が変更されていないと判定された場合はステップS413に進む。 In step S412, the lighting unit 305 determines whether or not a change in the setting of the lighting parameter used for the lighting process has been input from the control unit 206. If it is determined that the lighting parameter setting has been changed, the process returns to step S411 and the lighting process is performed again. If it is determined that the lighting parameter settings have not been changed, the process proceeds to step S413.

ステップS413では、ライティング部305が、制御部206から画像の出力指示が入力されたかどうかを判定する。画像の出力指示が入力されたと判定された場合は、ステップS414に進む。画像の出力指示が入力されていないと判定された場合はステップS412に戻る。ステップS414では、ライティング処理部305が、生成された補正画像データをPC/メディア213に出力して処理を終了する。以上が本実施形態の画像処理部209で行われる処理の流れである。以上の処理によれば、被写体に合わせて変形した顔法線モデルを用いてライティング処理を行うことができるので、被写体の姿勢や表情に合わせた自然な陰影を付与した画像を得ることができる。以下、画像処理部209の各構成部で行われる処理の詳細について説明する。 In step S413, the lighting unit 305 determines whether or not an image output instruction has been input from the control unit 206. If it is determined that the image output instruction has been input, the process proceeds to step S414. If it is determined that the image output instruction has not been input, the process returns to step S412. In step S414, the lighting processing unit 305 outputs the generated corrected image data to the PC / media 213 and ends the processing. The above is the flow of processing performed by the image processing unit 209 of the present embodiment. According to the above processing, since the lighting processing can be performed using the face normal model deformed according to the subject, it is possible to obtain an image with natural shading according to the posture and facial expression of the subject. Hereinafter, the details of the processing performed in each component of the image processing unit 209 will be described.

<補正距離データ生成処理>
ここでは、ステップS409で距離補正部302が行う補正距離データ生成処理について、図7に示すフローチャートを参照して説明する。ステップS701において、距離補正部302は、顔情報と被写体位置P0と距離画像データとに基づき被写体候補領域の抽出を行う。図8(a)(b)を用いて本ステップの処理を説明する。まず、距離補正部302は、顔情報が示す顔領域の中から被写体位置P0に最も近い顔領域601を選択する。そして、選択された顔領域中の各画素の距離値を距離画像データから取得し、それらの平均値を顔領域の距離値として算出する。その後、距離補正部302は、顔領域の距離値との距離値の差が所定の閾値以下となる画素とそれ以外の画素とに分けた二値画像801を生成する。すなわち、ここで行われる処理は、選択された被写体からの距離が所定の範囲に含まれる被写体とそれ以外の被写体とを判別する処理である。ここで、二値画像801において、顔領域の距離値との距離値の差が閾値以下である画素を被写体候補領域802とする。なお、ここで行われる被写体候補領域の判別は上記の方法に限られず、単に選択された被写体位置からの距離値の差が所定の閾値以内となる領域を被写体候補領域として決定してもよい。
<Correction distance data generation process>
Here, the correction distance data generation process performed by the distance correction unit 302 in step S409 will be described with reference to the flowchart shown in FIG. 7. In step S701, the distance correction unit 302 extracts the subject candidate region based on the face information, the subject position P0, and the distance image data. The process of this step will be described with reference to FIGS. 8A and 8B. First, the distance correction unit 302 selects the face area 601 closest to the subject position P0 from the face areas indicated by the face information. Then, the distance value of each pixel in the selected face region is acquired from the distance image data, and the average value thereof is calculated as the distance value of the face region. After that, the distance correction unit 302 generates a binary image 801 divided into pixels in which the difference between the distance value in the face region and the distance value is equal to or less than a predetermined threshold value and other pixels. That is, the process performed here is a process of discriminating between a subject whose distance from the selected subject is within a predetermined range and a subject other than that. Here, in the binary image 801, the pixel in which the difference between the distance value of the face region and the distance value is equal to or less than the threshold value is defined as the subject candidate region 802. The determination of the subject candidate area performed here is not limited to the above method, and an area in which the difference in the distance value from the selected subject position is within a predetermined threshold value may be determined as the subject candidate area.

ステップS702において、距離補正部302は、二値画像801に対して小成分除去処理や穴埋め処理を施すことにより被写体候補領域に含まれる小さな連結成分を除去したり、穴を埋める整形処理を行う。小成分除去処理・穴埋め処理としては、モルフォロジ演算を用いた方法やラベリング処理を利用した方法などが適用可能である。ここではモルフォロジ演算を用いた方法を利用する。距離補正部302は小成分除去処理として、二値画像801に含まれる被写体候補領域に対してオープニング処理を行う。そして、その後の穴埋め処理としては、被写体候補領域に対してクロージング処理を行う。図8(c)に本ステップによって得られる二値画像803の例を示す。 In step S702, the distance correction unit 302 performs a small component removal process or a hole filling process on the binary image 801 to remove a small connected component included in the subject candidate region or perform a shaping process to fill the hole. As the small component removal process / fill-in-the-blank process, a method using a morphology calculation or a method using a labeling process can be applied. Here, a method using morphology calculation is used. The distance correction unit 302 performs an opening process on the subject candidate region included in the binary image 801 as a small component removal process. Then, as the subsequent fill-in-the-blank process, a closing process is performed on the subject candidate area. FIG. 8C shows an example of the binary image 803 obtained by this step.

ステップS703において、距離補正部302は、ステップS702で整形処理が行われた二値画像803に対して平滑化処理を施し、多値の補正距離データ804(図8(d))を生成する。例えば、二値画像803のうち被写体候補領域802に含まれる画素の画素値を255、その他の画素の画素値を0とした画像に対して平滑化処理を行うこと、一画素あたり8ビットの距離情報を有する補正距離データ804を生成する。このとき、画素値が大きいほど被写体までの距離が小さいものとする。 In step S703, the distance correction unit 302 performs smoothing processing on the binary image 803 subjected to the shaping process in step S702 to generate multi-value correction distance data 804 (FIG. 8D). For example, in the binary image 803, a smoothing process is performed on an image in which the pixel value of the pixel included in the subject candidate area 802 is 255 and the pixel value of the other pixels is 0, and the distance of 8 bits per pixel. The correction distance data 804 having information is generated. At this time, it is assumed that the larger the pixel value, the smaller the distance to the subject.

なお、平滑化処理としては、ガウシアンフィルタやカラー画像データの画素値を参照しつつ平滑化を行うジョイントバイラテラルフィルタ等が適用可能である。本実施形態では以下の式(1)で表されるジョイントバイラテラルフィルタを利用するものとする。 As the smoothing process, a Gaussian filter, a joint bilateral filter that performs smoothing while referring to the pixel values of color image data, and the like can be applied. In this embodiment, the joint bilateral filter represented by the following equation (1) is used.

Figure 2021145385
Figure 2021145385

sは処理対象画素、Ωはsの近傍領域、pはΩに含まれる画素、Iは平滑化を行う画像データ、Rは参照用画像データ、fはpとsと間の距離に基づく重み、gは画素値に基づく重みを表す。fはsとpとの距離が大きくなるほど重みが小さくなるように設定される。gは参照用画像の画素pと画素sの画素値の差が大きいほど重みが小さくなるように設定する。式(1)ではYは画素pと画素sの画素値の輝度差を表すものとする。ステップS703では、Iとして補正距離データ803を、Rとしてカラー画像データを使用し平滑化処理を行う。カラー画像データを参照しつつ二値画像803に対してジョイントバイラテラルフィルタを利用することにより、カラー画像データ内の画素値の近い画素のみを利用して平滑化処理を施すことができる。これにより、被写体領域802の輪郭を、カラー画像データ中の被写体の輪郭に合わせつつ平滑化をおこなう事ができる。なお、平滑化処理の方法はこれに限るものではない。例えば、fの設定方法として近傍領域内で等しい重み与えても構わない。また、gの設定方法として輝度値の代わりに色差に基づいて重みを構わない。あるいは、画素値が一定値以内であれば重みを一定にするなどしても良い。 s is the pixel to be processed, Ω is the neighborhood region of s, p is the pixel included in Ω, I is the image data for smoothing, R is the reference image data, and f is the weight based on the distance between p and s. g represents a weight based on the pixel value. f is set so that the weight decreases as the distance between s and p increases. g is set so that the larger the difference between the pixel values of the pixel p and the pixel s of the reference image, the smaller the weight. In the formula (1), Y represents the brightness difference between the pixel values of the pixel p and the pixel s. In step S703, smoothing processing is performed using the correction distance data 803 as I and the color image data as R. By using a joint bilateral filter for the binary image 803 while referring to the color image data, it is possible to perform the smoothing process using only the pixels having similar pixel values in the color image data. As a result, the contour of the subject area 802 can be smoothed while matching the contour of the subject in the color image data. The method of smoothing processing is not limited to this. For example, as a method of setting f, equal weights may be given in the neighborhood region. Further, as a method of setting g, a weight may be used based on a color difference instead of a luminance value. Alternatively, if the pixel value is within a certain value, the weight may be made constant.

また、補正距離データ804を多値画像で取得することにより、ステップS409で行うライティング処理の際に被写体輪郭部の違和感を軽減することができる。以上の処理により、距離補正部302は、主に手前の被写体とそれ以外の背景に分割され、それぞれに対応する距離値が格納された補正距離データ804を取得することができる。なお、ここで行われるフィルタ処理はジョイントバイラテラルフィルタである必要はなく、カラー画像データの画素値を基準とするフィルタ処理であればどのようなものを利用してもよい。 Further, by acquiring the correction distance data 804 as a multi-valued image, it is possible to reduce the discomfort of the subject contour portion during the lighting process performed in step S409. By the above processing, the distance correction unit 302 is mainly divided into a subject in the foreground and a background other than the subject, and can acquire the correction distance data 804 in which the distance values corresponding to the respective subjects are stored. The filter processing performed here does not have to be a joint bilateral filter, and any filter processing based on the pixel value of the color image data may be used.

<法線画像データ生成処理>
ここでは、ステップS410で法線生成部304が行う補正法線データ生成処理について説明する。本実施形態における補正法線データ生成処理は、ROM203やPC/メディア213に格納された顔法線モデルを、カラー画像データに基づいて補正する処理である。以下、補正法線データ生成処理の詳細について図9に示すフローチャートを参照して述べる。
<Normal image data generation processing>
Here, the correction normal data generation process performed by the normal generation unit 304 in step S410 will be described. The correction normal data generation process in the present embodiment is a process for correcting the face normal model stored in the ROM 203 or the PC / media 213 based on the color image data. Hereinafter, the details of the correction normal data generation process will be described with reference to the flowchart shown in FIG.

ステップS901において、顔法線モデルをカラー画像データに合わせて変形する際の変形パラメータを算出する。本実施形態の顔法線情報の例を図10(a)に示す。顔法線モデルには顔法線画像データ1001と、それに対応する器官位置情報1002が含まれている。顔法線画像データ1001は、画素N(i,j)に画素値として顔の向きの法線ベクトル(Nx(i,j)、Ny(i,j)、Nz(i,j))を格納した画像データである。Nx(i,j)、Ny(i,j)、Nz(i,j)はそれぞれ画素(i,j)に格納された法線ベクトルの、互いに直交する3本の座標軸であるx軸、y軸、z軸方向の成分である。また、顔法線画像データ1001に含まれる法線ベクトルは全て単位ベクトルとする。顔の領域に対応する画素は顔表面に垂直な方向のベクトルが法線ベクトルとして格納されており、顔以外の領域に対応する画素は撮像装置の光軸とは逆方向のベクトルが法線ベクトルとして格納されているものとする。本実施形態ではz軸を撮像装置の光軸と逆方向とし、顔以外の領域に対応する画素では法線ベクトルとして(0,0,1)が格納されるものとする。器官位置情報1002は、顔法線画像データ1001中の右目、左目、口の座標値を示す。 In step S901, the deformation parameter when the face normal model is deformed according to the color image data is calculated. An example of the face normal information of this embodiment is shown in FIG. 10 (a). The face normal model includes face normal image data 1001 and corresponding organ position information 1002. The face normal image data 1001 stores the normal vector of the face orientation (Nx (i, j), Ny (i, j), Nz (i, j)) as a pixel value in the pixel N (i, j). This is the image data. Nx (i, j), Ny (i, j), and Nz (i, j) are the x-axis and y, which are three coordinate axes of the normal vector stored in the pixel (i, j), which are orthogonal to each other. It is a component in the axial and z-axis directions. Further, all the normal vectors included in the face normal image data 1001 are unit vectors. For the pixels corresponding to the face area, the vector in the direction perpendicular to the face surface is stored as a normal vector, and for the pixels corresponding to the area other than the face, the vector in the direction opposite to the optical axis of the image pickup device is the normal vector. It is assumed that it is stored as. In the present embodiment, the z-axis is in the direction opposite to the optical axis of the image pickup apparatus, and (0, 0, 1) is stored as a normal vector in the pixels corresponding to the region other than the face. The organ position information 1002 indicates the coordinate values of the right eye, the left eye, and the mouth in the face normal image data 1001.

本ステップでは、法線補正部304が、顔法線モデルに対応する器官位置1002と、カラー画像データの顔情報に含まれる器官位置602とから、カラー画像データ501と顔法線画像データ1001との右目、左目、口の座標を対応づける。そして、法線補正部304は、顔法線画像データ1001の器官位置1002を器官位置602に合わせるための変形パラメータを算出する。変形パラメータとしては、アフィン変換に用いるためのアフィン変換係数を算出する。アフィン変換係数の算出法としては最小二乗法などが利用可能である。すなわち、器官位置1002をアフィン変換した際の、器官位置602との誤差の事情輪が最小になるアフィン変換係数が、ここでの変換パラメータとして決定される。なお、本実施形態では顔法線画像データ1001は画素値として法線ベクトルのx軸、y軸、z軸方向の成分を保有しているが、例えば3チャンネル8bitカラー画像データの各チャンネルにこれらを割り当てても構わない。例えば、法線ベクトルの各軸方向の成分は−1.0から1.0の値をとるため、この間の値を0から255に割り当てることで法線ベクトルの情報を3チャンネル8bitカラー画像データとして保有することができる。 In this step, the normal correction unit 304 uses the organ position 1002 corresponding to the face normal model and the organ position 602 included in the face information of the color image data to obtain the color image data 501 and the face normal image data 1001. Associate the coordinates of the right eye, left eye, and mouth of. Then, the normal correction unit 304 calculates a deformation parameter for adjusting the organ position 1002 of the face normal image data 1001 to the organ position 602. As the deformation parameter, the affine transformation coefficient for use in the affine transformation is calculated. As a method for calculating the affine transformation coefficient, the least squares method or the like can be used. That is, the affine transformation coefficient that minimizes the circumstance of the error from the organ position 602 when the organ position 1002 is affine-transformed is determined as the conversion parameter here. In the present embodiment, the face normal image data 1001 has components in the x-axis, y-axis, and z-axis directions of the normal vector as pixel values. For example, these are included in each channel of the 3-channel 8-bit color image data. May be assigned. For example, since each axial component of the normal vector takes a value of -1.0 to 1.0, by assigning a value between them from 0 to 255, the information of the normal vector can be used as 3-channel 8-bit color image data. Can be owned.

ステップS902において、法線補正部304は、ステップS901で算出したアフィン変換係数を用いて顔法線画像データ1001を変換し法線画像データ1003を生成する。これにより、カラー画像データ501に含まれる顔領域に顔法線画像データ1001をフィッティングした法線画像データ1003が生成される。法線画像データ1003は、画素N’(i,j)には画素値として法線ベクトル(N’x(i,j)、N’y(i,j)、N’z(i,j))を格納した画像データである。法線画像データ1003の法線ベクトルは、顔法線画像1001に対応する領域(図10(b))については、顔法線画像1001の各画素に格納された法線ベクトル(Nx,Ny,Nz)に基づいて算出される。そして、顔法線画像1001に対応しない領域については、撮像装置の光軸と逆方向の法線ベクトル(0,0,1)が格納されるものとする。本ステップにより顔法線画像1001中の顔領域をカラー画像データ中の顔領域に概ね合わせる事ができる。しかし、顔の輪郭など器官以外の位置は正確に合わせられない場合があるため、以降のステップでこれを補正する。 In step S902, the normal correction unit 304 converts the face normal image data 1001 using the affine transformation coefficient calculated in step S901 to generate the normal image data 1003. As a result, the normal image data 1003 is generated by fitting the face normal image data 1001 to the face region included in the color image data 501. In the normal image data 1003, the normal vector (N'x (i, j), N'y (i, j), N'z (i, j)) is used as a pixel value for the pixel N'(i, j). ) Is stored in the image data. The normal vector of the normal image data 1003 is a normal vector (Nx, Ny, It is calculated based on Nz). Then, for the region that does not correspond to the face normal image 1001, it is assumed that the normal vector (0, 0, 1) in the direction opposite to the optical axis of the imaging device is stored. By this step, the face area in the face normal image 1001 can be roughly matched with the face area in the color image data. However, positions other than organs such as the contour of the face may not be accurately aligned, so this will be corrected in the subsequent steps.

ステップS903において、法線補正部304は、法線画像データ1003をx軸、y軸、z軸方向の成分毎に分け、x軸成分法線データ1101、y軸成分法線データ1102、z軸成分法線データ1103の3つの画像データに分解する(図11(a))。これにより、二値画像803と同様の平滑化処理が適用可能となる。本実施形態では、法線補正部304は、ステップS703と同様にジョイントバイラテラルフィルタを作用させる。 In step S903, the normal correction unit 304 divides the normal image data 1003 into components in the x-axis, y-axis, and z-axis directions, and divides the normal image data 1003 into x-axis component normal data 1101, y-axis component normal data 1102, and z-axis. It is decomposed into three image data of the component normal data 1103 (FIG. 11 (a)). This makes it possible to apply the same smoothing process as the binary image 803. In the present embodiment, the normal correction unit 304 operates the joint bilateral filter in the same manner as in step S703.

ステップS904において、法線補正部304は、x軸成分法線データ1101に対して平滑化処理を行い、平滑化x軸成分法線データ1104を生成する。平滑化処理としては、カラー画像データ501を参照画像とするジョイントバイラテラルフィルタを適用する。本処理によって得られる平滑化x軸成分法線データ1104は各画素に平滑化されたx軸成分の値N”xが格納されているものとする。 In step S904, the normal correction unit 304 performs a smoothing process on the x-axis component normal data 1101 to generate the smoothed x-axis component normal data 1104. As the smoothing process, a joint bilateral filter using the color image data 501 as a reference image is applied. It is assumed that the smoothed x-axis component normal data 1104 obtained by this process stores the smoothed x-axis component value N "x in each pixel.

ステップS905において、法線補正部304は、y軸成分法線データ1102に対して平滑化処理を行い、平滑化y軸成分法線データ1105を生成する。平滑化処理としては、カラー画像データ501を参照画像とするジョイントバイラテラルフィルタを適用する。本処理によって得られる平滑化y軸成分法線データ1105は各画素に平滑化されたy軸成分の値N”yが格納されているものとする。 In step S905, the normal correction unit 304 performs a smoothing process on the y-axis component normal data 1102 to generate the smoothed y-axis component normal data 1105. As the smoothing process, a joint bilateral filter using the color image data 501 as a reference image is applied. It is assumed that the smoothed y-axis component normal data 1105 obtained by this processing stores the smoothed y-axis component value N "y in each pixel.

ステップS906において、法線補正部304は、z軸成分法線データ1103に対して平滑化処理を行い、平滑化z軸成分法線データ1106を生成する。平滑化処理としては、カラー画像データ501を参照画像とするジョイントバイラテラルフィルタを適用する。本処理によって得られる平滑化z軸成分法線データ1106は各画素に平滑化されたz軸成分の値N”zが格納されているものとする。
上記ステップS904からステップS906により、法線画像データの1003中の顔の輪郭を、カラー画像データ中の被写体の輪郭に合わせる事ができる。
In step S906, the normal correction unit 304 performs a smoothing process on the z-axis component normal data 1103 and generates the smoothed z-axis component normal data 1106. As the smoothing process, a joint bilateral filter using the color image data 501 as a reference image is applied. It is assumed that the smoothed z-axis component normal data 1106 obtained by this process stores the smoothed z-axis component value N "z in each pixel.
From step S904 to step S906, the contour of the face in the normal image data 1003 can be matched with the contour of the subject in the color image data.

ステップS907において、法線補正部304は平滑化x軸成分法線データ1104、平滑化y軸成分法線データ1105、平滑化z軸成分法線データ1106を統合し、平滑化法線画像データ1107を生成する(図11(b))。平滑化法線画像データ1107は画素(i,j)に法線ベクトル(N”x(i,j)、N”y(i,j)、N”z(i,j))を格納した画像データである。 In step S907, the normal correction unit 304 integrates the smoothed x-axis component normal data 1104, the smoothed y-axis component normal data 1105, and the smoothed z-axis component normal data 1106, and the smoothed normal image data 1107. Is generated (FIG. 11 (b)). The smoothed normal image data 1107 is an image in which normal vectors (N "x (i, j), N" y (i, j), N "z (i, j)) are stored in pixels (i, j). It is data.

ステップS908において、平滑化法線画像データ1107の各画素に格納された法線ベクトルを単位ベクトルになるように正規化する。ステップS904からステップS906では、各軸成分ごとに平滑化処理を行ったため、画素によって格納されている法線ベクトルの大きさが異なる。これを補正するため、本ステップでは式(2)のように法線ベクトルの大きさが1になるように正規化を行う。 In step S908, the normal vector stored in each pixel of the smoothed normal image data 1107 is normalized so as to be a unit vector. In steps S904 to S906, since the smoothing process is performed for each axis component, the magnitude of the normal vector stored in each pixel is different. In order to correct this, in this step, normalization is performed so that the magnitude of the normal vector becomes 1 as in Eq. (2).

Figure 2021145385
Figure 2021145385

これにより、画素(i,j)に大きさ1の法線ベクトル(N’’’x(i,j)、N’’’y(i,j)、N’’’z(i,j))を格納した補正法線データが取得される。 As a result, the normal vector of size 1 (N ′ ″ x (i, j), N ″ ″ y (i, j), N ″ ′ z (i, j) for the pixel (i, j). ) Is stored in the correction normal data.

以上により、法線補正部304は補正法線データを取得する。以上の処理によれば、被写体の顔に合わせて顔法線モデルを補正することができるので、ライティング処理において被写体の顔に対して自然な陰影を付与することができる。また、上記のように各座標軸成分について独立に平滑化処理を行うことで、法線方向が平滑化処理により大きく変わることを防ぐことができる。 As described above, the normal correction unit 304 acquires the correction normal data. According to the above processing, since the face normal model can be corrected according to the face of the subject, it is possible to give a natural shadow to the face of the subject in the lighting process. Further, by performing the smoothing process independently for each coordinate axis component as described above, it is possible to prevent the normal direction from being significantly changed by the smoothing process.

<ライティング処理>
ここでは、ステップS411で行われるライティング処理について説明する。本実施形態におけるライティング処理は、補正距離データ、補正法線データに基づき、ユーザ操作によって設定された照明パラメータに応じてカラー画像データに対して仮想光源を加える処理を行って補正画像を生成する処理である。以下、ライティング処理の詳細について図12に示すフローチャートを参照して説明する。
<Lighting process>
Here, the lighting process performed in step S411 will be described. The lighting process in the present embodiment is a process of generating a corrected image by adding a virtual light source to the color image data according to the lighting parameters set by the user operation based on the correction distance data and the correction normal data. Is. Hereinafter, the details of the lighting process will be described with reference to the flowchart shown in FIG.

ステップS1201において、ライティング部305が制御部206からユーザによって設定された、ライティング処理に用いる照明パラメータを取得する。本実施形態では、ユーザは操作部107の操作により照明パラメータとして仮想照明の位置Q、姿勢U、強度α、光源色Lを設定する。 In step S1201, the lighting unit 305 acquires the lighting parameters used for the lighting process set by the user from the control unit 206. In the present embodiment, the user sets the position Q, the posture U, the intensity α, and the light source color L of the virtual lighting as lighting parameters by operating the operation unit 107.

ステップS1202において、ライティング部305が補正距離データ804、法法線画像データ1003、ステップS1101で取得された照明パラメータに基づいて、カラー画像データ501の画素値の補正を行う。本実施形態では式(3)に従ってカラー画像データの画素値を補正し、補正画像データをI’を生成するものとする。 In step S1202, the lighting unit 305 corrects the pixel value of the color image data 501 based on the correction distance data 804, the normal image data 1003, and the illumination parameters acquired in step S1101. In the present embodiment, the pixel value of the color image data is corrected according to the equation (3), and the corrected image data is generated as I'.

Figure 2021145385
Figure 2021145385

ここで、I’r、I’g、I’bは補正画像データI’の画素値、Lrm、Lgm、Lbmはm番目の照明の色、kmはm番目の照明に対する画素値の補正度合いを表す。kmは照明の明るさα、位置Q、姿勢Uおよび画素(x、y)に対応する距離値、法線ベクトルVに基づいて決定する。例えば式(4)のように求めることができる。 Here, I'r, I'g, and I'b are the pixel values of the corrected image data I', Lrm, Lgm, and Lbm are the m-th illumination colors, and km is the correction degree of the pixel values for the m-th illumination. show. km is determined based on the brightness α of the illumination, the position Q, the attitude U, the distance value corresponding to the pixel (x, y), and the normal vector V. For example, it can be obtained by the equation (4).

Figure 2021145385
Figure 2021145385

式(4)について図13を用いて説明する。tは仮想光源による補正度合いを調整する補正係数である。本実施形態ではt=1とする。αは照明の明るさを表す変数である。Qは光源の位置を表すベクトルである。Pは画素(i、j)の三次元的な位置を表すベクトルであり、補正距離データ804から下記のように算出される。まず、補正距離データ804の画素値に基づき、撮像装置101から各画素に対応する被写体位置までの仮想的な距離値を算出する。この際、補正距離データ804において画素値の大きな画素ほど撮像装置101からの距離が小さいものとする。続いて、ライティング部305は各画素に対応する仮想的な距離値と、撮像装置101の画角とカラー画像データ501の画像サイズなどに基づき、画素(i、j)の三次元的な位置Pを算出する。Wは画素(i、j)の位置Pから光源の位置Qまでの距離が大きくなるに従い大きな値を返す関数である。ρはQからP(i,j)に向かうベクトルと、照明の姿勢Uのなす角度を表す。Kはρが小さいほど大きな値となるような関数である。N(i,j)は画素(i、j)に対応する法線ベクトル、V(i,j)はQからP(i,j)に向かう方向を表す単位ベクトルである。本実施形態のように補正画像を生成することにより、照明の位置と被写体の形状に応じた明るさの補正が可能である。以上のように、仮想光源からの距離に応じて画素値を加算するライティング処理が行われる。以上の処理により、仮想光源に近く、仮想光源から画素(i,j)に向かうベクトルと法線ベクトルとのなす角が小さい画素ほど明るくなるように補正することができる。これにより、図14に示すように、仮想照明により被写体を照らしたかのような補正画像1401を得る事ができる。 Equation (4) will be described with reference to FIG. t is a correction coefficient for adjusting the degree of correction by the virtual light source. In this embodiment, t = 1. α is a variable that represents the brightness of the illumination. Q is a vector representing the position of the light source. P is a vector representing the three-dimensional position of the pixel (i, j), and is calculated from the correction distance data 804 as follows. First, based on the pixel value of the correction distance data 804, a virtual distance value from the image pickup apparatus 101 to the subject position corresponding to each pixel is calculated. At this time, it is assumed that the larger the pixel value in the correction distance data 804, the smaller the distance from the image pickup apparatus 101. Subsequently, the lighting unit 305 uses the virtual distance value corresponding to each pixel, the angle of view of the imaging device 101, the image size of the color image data 501, and the like, and the three-dimensional positions P of the pixels (i, j). Is calculated. W is a function that returns a larger value as the distance from the position P of the pixel (i, j) to the position Q of the light source increases. ρ represents the angle formed by the vector from Q to P (i, j) and the attitude U of the illumination. K is a function such that the smaller ρ is, the larger the value is. N (i, j) is a normal vector corresponding to the pixel (i, j), and V (i, j) is a unit vector representing the direction from Q to P (i, j). By generating the corrected image as in the present embodiment, it is possible to correct the brightness according to the position of the illumination and the shape of the subject. As described above, the lighting process of adding the pixel values according to the distance from the virtual light source is performed. By the above processing, it is possible to correct the pixel so that it is closer to the virtual light source and the angle between the vector from the virtual light source toward the pixel (i, j) and the normal vector is smaller, the brighter the pixel. As a result, as shown in FIG. 14, it is possible to obtain a corrected image 1401 as if the subject was illuminated by virtual illumination.

ステップS1203において、ライティング部305は、画素値の補正を行った補正画像データを表示部106に表示して処理を終了する。ユーザは、ここで表示部106に表示された補正画像データを見て、照明パラメータの変更指示や画像の出力指示を入力する。 In step S1203, the lighting unit 305 displays the corrected image data in which the pixel value has been corrected on the display unit 106, and ends the process. The user sees the corrected image data displayed on the display unit 106, and inputs an instruction to change the lighting parameter and an instruction to output the image.

以上の処理によれば、被写体に合わせて変形した顔法線モデルを用いてライティング処理を行うことができるので、被写体の姿勢や表情に合わせた自然な陰影を付与した画像を得ることができる。 According to the above processing, since the lighting processing can be performed using the face normal model deformed according to the subject, it is possible to obtain an image with natural shading according to the posture and facial expression of the subject.

[実施形態2]
実施形態1では被写体の画素値によらずにカラー画像データの画素値を補正する例について生成した。実施形態2では、被写体の輝度値に基づいて補正量を制御する方法について説明する。被写体の輝度値に基づいて補正量を制御することにより、あらかじめ輝度値の高い領域を補正した場合に発生する白とびや、暗部を補正した際に発生するノイズ増加を抑制することができる。
[Embodiment 2]
In the first embodiment, an example of correcting the pixel value of the color image data regardless of the pixel value of the subject is generated. In the second embodiment, a method of controlling the correction amount based on the brightness value of the subject will be described. By controlling the correction amount based on the brightness value of the subject, it is possible to suppress overexposure that occurs when a region having a high brightness value is corrected in advance and noise increase that occurs when a dark part is corrected.

本実施形態の撮像装置101の構成と、基本的な処理の流れは実施形態1と同様であるので説明を省略する。実施形態2において実施形態1と異なる点は、ライティング処理部305で行われるライティング処理において、式4に示す補正係数tが各画素の輝度値によって決定される点である。 Since the configuration of the image pickup apparatus 101 of the present embodiment and the basic processing flow are the same as those of the first embodiment, the description thereof will be omitted. The difference between the second embodiment and the first embodiment is that the correction coefficient t shown in the equation 4 is determined by the luminance value of each pixel in the lighting process performed by the lighting processing unit 305.

本実施形態における補正係数tの決定方法の例を図15を参照して説明する。図15(a)では、あらかじめ設定したしきい値th1、th2に基づいて補正係数tが決定される例を示している。この例では、画素の輝度値Yが0≦Y<th1の区間ではt=1、th1≦Y<th2の区間ではtが単調に減少、th2≦Yの区間ではt=0となるように補正係数tが決定される。このように補正係数tを決定すると、輝度値の大きな画素ほど仮想光源による補正度合いを小さくすることができる。そのため、仮想光源の影響により輝度値の高い画素が白とびするのを抑制する効果が得られる。なお、図15(a)では、th1≦Y<th2の区間でtがYの一次関数となるように直線的に減少させているが、減少のさせかたはこれに限らない。tをYの一次関数とした場合、補正画像I’はカラー画像データIの画素値の二次関数として表現される。この場合、th1≦Y<th2の区間に補正画像の画素値が極大となり、階調反転が発生してしまう場合がある。これを抑制する手段として、th1≦Y<th2の区間における減少を二次曲線や三角関数等を利用して表現してもよい。こうすることによって、補正画像における階調反転の発生を抑制することができる。あるいは、図15(b)に示すように補正係数tを決めることもできる。図15(b)では、あらかじめ設定したしきい値th1、th2、th3によって決定される補正係数の例を示している。この例では、輝度値Yが0≦Y<th3の区間ではtが単調増加、th3≦Y<th1の区間ではt=1、th1≦Y<th2の区間ではtが単調減少、th2≦Yの区間ではt=0となるように補正係数tが決定される。図15(b)のように補正係数tを設定することにより、白とびに加え輝度値の小さい暗部のノイズが、ライティング処理により強調されることを抑制することができる。また、輝度値Yが0≦Y<th3の区間における増加や、th1≦Y<th2の区間における減少を二次曲線や三角関数等を利用して表現する方法することで、図15(a)の場合と同様に、階調反転の発生を抑制することができる。 An example of a method for determining the correction coefficient t in the present embodiment will be described with reference to FIG. FIG. 15A shows an example in which the correction coefficient t is determined based on the preset threshold values th1 and th2. In this example, the pixel brightness value Y is corrected so that t = 1 in the section where 0 ≦ Y <th1, t decreases monotonically in the section where th1 ≦ Y <th2, and t = 0 in the section where th2 ≦ Y. The coefficient t is determined. When the correction coefficient t is determined in this way, the degree of correction by the virtual light source can be reduced as the pixel has a larger luminance value. Therefore, it is possible to obtain the effect of suppressing overexposure of pixels having a high luminance value due to the influence of the virtual light source. In FIG. 15A, t is linearly reduced so that t becomes a linear function of Y in the interval of th1 ≦ Y <th2, but the method of reduction is not limited to this. When t is a linear function of Y, the corrected image I'is expressed as a quadratic function of the pixel value of the color image data I. In this case, the pixel value of the corrected image becomes maximum in the interval of th1 ≦ Y <th2, and gradation inversion may occur. As a means of suppressing this, the decrease in the interval of th1 ≦ Y <th2 may be expressed by using a quadratic curve, a trigonometric function, or the like. By doing so, it is possible to suppress the occurrence of gradation inversion in the corrected image. Alternatively, the correction coefficient t can be determined as shown in FIG. 15 (b). FIG. 15B shows an example of the correction coefficient determined by the preset threshold values th1, th2, and th3. In this example, t increases monotonically in the section where the brightness value Y is 0 ≦ Y <th3, t = 1 in the section where th3 ≦ Y <th1, t decreases monotonically in the section where th1 ≦ Y <th2, and th2 ≦ Y. In the interval, the correction coefficient t is determined so that t = 0. By setting the correction coefficient t as shown in FIG. 15B, it is possible to suppress that the noise in the dark portion having a small brightness value in addition to the overexposure is emphasized by the lighting process. Further, by expressing the increase in the interval where the luminance value Y is 0 ≦ Y <th3 and the decrease in the section where th1 ≦ Y <th2 by using a quadratic curve, a trigonometric function, or the like, FIG. As in the case of, the occurrence of gradation inversion can be suppressed.

以上のように、本実施形態の処理によれば、あらかじめ輝度値の高い領域を補正した場合に発生する白とびや、暗部を補正した際に発生するノイズ増加を抑制することができる。 As described above, according to the processing of the present embodiment, it is possible to suppress overexposure that occurs when a region having a high luminance value is corrected in advance and noise increase that occurs when a dark portion is corrected.

[実施形態3]
実施形態1、実施形態2ではシーンに対して仮想光源を付与することにより暗く写っている被写体を明るくするようなライティング処理を行う例について説明した。実施形態3では、ストロボの発光の影響などで平坦に写ってしまった被写体に対して影を付与することにより、被写体の立体感を強調する方法について説明する。
[Embodiment 3]
In the first and second embodiments, an example of performing a lighting process for brightening a dark subject by applying a virtual light source to the scene has been described. In the third embodiment, a method of emphasizing the three-dimensional effect of the subject by adding a shadow to the subject which is projected flat due to the influence of the light emission of the strobe or the like will be described.

本実施形態の撮像装置101の構成と、基本的な処理の流れは実施形態1と同様であるので説明を省略する。実施形態3において実施形態1と異なる点は、ステップS1202で行われる画素値補正の処理が異なる点である。以下、本実施形態のステップS1202で行われる処理について説明する。本実施形態ノステップS1202では、実施形態1とは異なり、以下の式(5)に基づいて画素値の補正が行われる。 Since the configuration of the image pickup apparatus 101 of the present embodiment and the basic processing flow are the same as those of the first embodiment, the description thereof will be omitted. The difference between the third embodiment and the first embodiment is that the pixel value correction process performed in step S1202 is different. Hereinafter, the process performed in step S1202 of the present embodiment will be described. In the present embodiment Nostep S1202, unlike the first embodiment, the pixel value is corrected based on the following equation (5).

Figure 2021145385
Figure 2021145385

式(3)との違いは、k’mに応じてカラー画像データの画素値が小さくなるように画素値を補正している点である。すなわち、本実施形態で行われるのは、仮想光源からの距離に応じて画素値を減算するライティング処理である。k’mは照明の明るさα、位置Q、姿勢Uおよび画素(x、y)に対応する距離値、法線ベクトルVに基づいて決定する。例えば式(6)のように求めることができる。 The difference from the equation (3) is that the pixel value is corrected so that the pixel value of the color image data becomes smaller according to k'm. That is, what is performed in this embodiment is a lighting process in which the pixel value is subtracted according to the distance from the virtual light source. k'm is determined based on the brightness α of the illumination, the position Q, the attitude U, the distance value corresponding to the pixel (x, y), and the normal vector V. For example, it can be obtained as in Eq. (6).

Figure 2021145385
Figure 2021145385

式(4)との違いは、主に法線ベクトルN(i,j)とV(i,j)のなす角の影響である。式(4)では法線ベクトルNが仮想光源方向を向いているほどkの値は大きくなったが、式(6)では逆に法線ベクトルNが仮想光源方向を向いているほどkの値は小さくなる。つまり、式(6)により、仮想照明に近く法線ベクトルNが仮想光源方向を向いていない画素ほど強い影を付与することができる。これにより、図16に示す補正画像1601のように、法線画像データに基づき顔の頬や鼻にのみ影を付与することが可能となる。 The difference from the equation (4) is mainly the influence of the angle formed by the normal vectors N (i, j) and V (i, j). In equation (4), the value of k increased as the normal vector N pointed in the direction of the virtual light source, whereas in equation (6), the value of k increased as the normal vector N pointed in the direction of the virtual light source. Becomes smaller. That is, according to the equation (6), a pixel closer to the virtual illumination and the normal vector N does not face the direction of the virtual light source can give a stronger shadow. As a result, as in the corrected image 1601 shown in FIG. 16, it is possible to add shadows only to the cheeks and nose of the face based on the normal image data.

以上の処理によれば、ストロボの発光などの影響により平坦に写ってしまった被写体に対して立体感が出るように影を付与する補正を行うことができる。 According to the above processing, it is possible to perform correction for adding a shadow to a subject that appears flat due to the influence of light emission of a strobe or the like so as to give a three-dimensional effect.

[実施形態4]
上記の実施形態では、シーンに仮想的な光源を付与するリライティング処理と、画像に影を付与するリライティング処理とについて説明した。実施形態4では、上記の2つの処理を撮影条件に基づいて切り替える方法について説明する。図17は、実施形態4における画像処理部209の動作手順を示すフローチャートである。実施形態1と比較し、新たにステップS1701とステップS1702とが加わっている点が異なる。
[Embodiment 4]
In the above embodiment, the rewriting process of giving a virtual light source to the scene and the rewriting process of giving a shadow to the image have been described. In the fourth embodiment, a method of switching between the above two processes based on the shooting conditions will be described. FIG. 17 is a flowchart showing an operation procedure of the image processing unit 209 according to the fourth embodiment. The difference is that step S1701 and step S1702 are newly added as compared with the first embodiment.

ステップS1701では、ライティング部305が、実光源に関する情報を取得する。ここで、実光源とは被写体を撮像する空間において実際に存在する光源のことである。本実施形態では、制御部206がユーザによるストロボ使用の指示や、ストロボ104からの入力信号に基づいてストロボ発光の有無を判定し、画像データの撮像時にストロボが用いられたかどうかをライティング部305に出力するとする。画像データの撮像時にストロボが用いられたと判定された場合は所定の位置Q’に配置されたストロボが発光しているものとして取得される。なお、実光源の情報の取得方法はこれに限られず、例えば選択された被写体の顔領域の画素の平均輝度を求め、平均輝度が閾値以上である場合には撮像時にストロボが発光されたものとして判定してもよい。 In step S1701, the lighting unit 305 acquires information about the actual light source. Here, the actual light source is a light source that actually exists in the space where the subject is imaged. In the present embodiment, the control unit 206 determines whether or not the strobe is emitted based on the user's instruction to use the strobe and the input signal from the strobe 104, and informs the lighting unit 305 whether or not the strobe is used when capturing the image data. Suppose you want to output. If it is determined that the strobe has been used at the time of capturing the image data, it is acquired as if the strobe arranged at the predetermined position Q'is emitting light. The method of acquiring the information of the actual light source is not limited to this. For example, the average brightness of the pixels in the face region of the selected subject is obtained, and if the average brightness is equal to or more than the threshold value, it is assumed that the strobe is emitted at the time of imaging. You may judge.

ステップS1702では、ライティング部305が、ステップS1701で取得された実光源情報に基づいて、ライティング処理のモードを設定する。このステップでは、ステップS1701で、撮像時にストロボが発光されていないと判定された場合は、実施形態1に示す仮想光源を付与するライティングモードが設定される。そして、ステップS1701で、撮像時にストロボが発光されていると判定された場合は、実施形態3に示す影を付与するライティングモードが設定される。 In step S1702, the lighting unit 305 sets the lighting processing mode based on the actual light source information acquired in step S1701. In this step, if it is determined in step S1701 that the strobe is not emitting light at the time of imaging, a lighting mode for applying the virtual light source shown in the first embodiment is set. Then, in step S1701, when it is determined that the strobe is emitting light at the time of imaging, the lighting mode for imparting the shadow shown in the third embodiment is set.

そして、ステップS411では、ライティング部305が、ステップS1702で設定されたライティングモードに対応するライティング処理をカラー画像データに対して行い、補正画像データを生成する。 Then, in step S411, the lighting unit 305 performs the lighting process corresponding to the lighting mode set in step S1702 on the color image data to generate the corrected image data.

以上が本実施形態における処理の流れである。以上の処理によれば、被写体を撮像した時の光源の状態に応じて、適切なライティング処理を選択することができる。 The above is the flow of processing in this embodiment. According to the above processing, an appropriate lighting processing can be selected according to the state of the light source when the subject is imaged.

なお、本実施形態の処理は上記に限られるものではない。例えば、ステップS1701において実光源情報としてストロボ光の位置Q’を取得し、ステップS411のライティング処理において、照明パラメータの初期値としてストロボ光の位置Q’を入力するようにしてもよい。また、カラー画像データにおいて輝度が所定の閾値よりも大きな領域にはストロボ以外の実光源が存在しているとし、検出された実光源が被写体よりも撮像装置101に近い位置に存在する場合に、ライティングモードを影付与モードとするようにしてもよい。また、カラー画像データから実光源の位置を取得して、照明パラメータの初期値に入力してもよい。 The processing of this embodiment is not limited to the above. For example, the position Q'of the strobe light may be acquired as the actual light source information in step S1701, and the position Q'of the strobe light may be input as the initial value of the lighting parameter in the lighting process of step S411. Further, it is assumed that an actual light source other than the strobe exists in a region where the brightness is larger than a predetermined threshold value in the color image data, and when the detected actual light source exists at a position closer to the image pickup apparatus 101 than the subject. The lighting mode may be set to the shadow addition mode. Alternatively, the position of the actual light source may be acquired from the color image data and input to the initial value of the illumination parameter.

<その他の実施形態>
本発明の実施形態は上記に示す実施形態に限定されるものではない。例えば、ライティング処理において法線画像データを用いずに、被写体の距離情報を直接用いてライティング処理を行うようにしてもよい。この場合は、上記の式とは異なる計算式を用いる必要があるため処理が煩雑になるが、本発明と同様の効果を得ることができる。また、その際に顔法線モデルの代わりに所定の顔の3Dモデルを保持しておいてもよい。すなわち、本発明の実施において、被写体の3次元形状を示す情報を広く用いることが可能である。また、顔法線モデルの代わりに所定の顔の3Dモデルを保持しておき、変形した3Dモデルに基づいて法線情報を取得するようにしてもよい。
<Other Embodiments>
The embodiment of the present invention is not limited to the embodiment shown above. For example, the lighting process may be performed by directly using the distance information of the subject without using the normal image data in the lighting process. In this case, since it is necessary to use a calculation formula different from the above formula, the processing becomes complicated, but the same effect as that of the present invention can be obtained. At that time, a 3D model of a predetermined face may be held instead of the face normal model. That is, in carrying out the present invention, it is possible to widely use information indicating the three-dimensional shape of the subject. Further, a 3D model of a predetermined face may be held instead of the face normal model, and normal information may be acquired based on the deformed 3D model.

本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。 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.

301 現像部
302 距離補正部
303 顔検出部
304 法線補正部
305 ライティング部
301 Development unit 302 Distance correction unit 303 Face detection unit 304 Normal correction unit 305 Lighting unit

上記課題を解決するために、本発明に係る画像処理装置は、被写体を撮像することにより得られた撮像画像を取得する取得手段と、前記撮像画像において前記被写体の顔の領域を顔領域として特定する特定手段と、前記撮像画像における前記顔領域の少なくとも一部の明るさが変更された補正画像を生成する生成手段を有し、前記生成手段は、前記顔領域のうち仮想光源を向かない領域に対応する画素ほど強い影が付与されるよう前記明るさを変更し、該変更の度合いを、前記顔領域において輝度値が相対的に小さい画素では抑制することを特徴とする。 In order to solve the above problems, the image processing apparatus according to the present invention specifies an acquisition means for acquiring an captured image obtained by imaging a subject and a region of the face of the subject as a face region in the captured image. The specific means for generating the corrected image in which the brightness of at least a part of the face region in the captured image is changed is provided, and the generating means is a region of the face region that does not face the virtual light source. The brightness is changed so that a stronger shadow is given to the pixel corresponding to the above, and the degree of the change is suppressed in the pixel having a relatively small brightness value in the face region.

Claims (10)

被写体を撮像することにより得られた画像を取得する取得手段と、
前記カラー画像において前記被写体の顔の領域を顔領域として特定する特定手段と、
前記カラー画像における前記顔領域の少なくとも一部の明るさが変更された補正画像を生成する生成手段を有することを特徴とする画像処理装置。
An acquisition means for acquiring an image obtained by photographing a subject, and
A specific means for identifying the face area of the subject as a face area in the color image, and
An image processing apparatus comprising a generation means for generating a corrected image in which the brightness of at least a part of the face region in the color image is changed.
前記生成手段は、前記顔の形状に応じて明るさが変更された画像を前記補正画像として生成することを特徴とする請求項1に記載の画像処理装置。 The image processing apparatus according to claim 1, wherein the generation means generates an image whose brightness is changed according to the shape of the face as the correction image. 前記生成手段は、前記顔領域における明るさが変更された度合いが、前記特定手段が前記顔領域を特定した被写体および前記被写体の近傍の領域を除く背景の領域、における明るさが変更された度合いよりも、大きくなるように前記補正画像を生成することを特徴とする請求項1に記載の画像処理装置。 In the generation means, the degree to which the brightness in the face region is changed is the degree to which the brightness in the subject for which the specific means has specified the face region and the background region excluding the region in the vicinity of the subject is changed. The image processing apparatus according to claim 1, wherein the corrected image is generated so as to be larger than the above. 前記特定手段は、前記カラー画像における被写体のうち、人物の顔のみを前記顔領域として特定することを特徴とする請求項1に記載の画像処理装置。 The image processing apparatus according to claim 1, wherein the specifying means specifies only the face of a person as the face region among the subjects in the color image. 前記生成手段は、前記顔領域における形状に応じた陰影を付与することを特徴とする請求項1に記載の画像処理装置。 The image processing apparatus according to claim 1, wherein the generation means imparts a shadow according to a shape in the face region. 前記カラー画像における前記顔領域の明るさから前記補正画像における前記顔領域の明るさへの変更の度合いは、前記カラー画像における前記顔領域の明るさに応じていることを特徴とする請求項1に記載の画像処理装置。 Claim 1 is characterized in that the degree of change from the brightness of the face region in the color image to the brightness of the face region in the corrected image depends on the brightness of the face region in the color image. The image processing apparatus according to. 前記補正画像において、前記顔領域に含まれる第1の画素と、前記顔領域に含まれ、前記第1の画素における撮像装置との距離と撮像装置からの距離が同じで、第1の画素における法線方向と異なる法線方向が対応する第2の画素とについて、前記カラー画像における前記第1の画素および前記第2の画素それぞれの明るさからの変更の度合いが異なることを特徴とする請求項1乃至6の何れか一項に記載の画像処理装置。 In the corrected image, the distance between the first pixel included in the face region and the image pickup device included in the face region and the image pickup device in the first pixel is the same, and the distance from the image pickup device is the same, and the first pixel A claim characterized in that, for a second pixel corresponding to a normal direction different from the normal direction, the degree of change from the brightness of each of the first pixel and the second pixel in the color image is different. Item 6. The image processing apparatus according to any one of Items 1 to 6. 前記生成手段は、前記特定手段が特定した前記顔領域と前記顔領域の近傍とを除く領域においては、被写体の法線方向に応じた明るさの変更はしないことを特徴とする請求項1に記載の画像処理装置。 The first aspect of the present invention is characterized in that the generation means does not change the brightness according to the normal direction of the subject in a region other than the face region specified by the specific means and the vicinity of the face region. The image processing apparatus described. コンピュータを請求項1乃至8のいずれか一項に記載の画像処理装置として機能させるプログラム。 A program that causes a computer to function as the image processing device according to any one of claims 1 to 8. 被写体を撮像することにより得られたカラー画像の明るさを変更された補正画像を生成する画像処理方法であって、
前記カラー画像を取得し、
前記カラー画像において前記被写体の顔の領域を顔領域として特定し、
前記カラー画像における前記顔領域の少なくとも一部の明るさが変更された前記補正画像を生成することを特徴とする画像処理方法。
It is an image processing method that generates a corrected image in which the brightness of a color image obtained by photographing a subject is changed.
Acquire the color image and
In the color image, the face area of the subject is specified as the face area, and the face area is specified.
An image processing method for generating the corrected image in which the brightness of at least a part of the face region in the color image is changed.
JP2021097301A 2019-08-21 2021-06-10 Image processing apparatus, image processing method, and program Pending JP2021145385A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2021097301A JP2021145385A (en) 2019-08-21 2021-06-10 Image processing apparatus, image processing method, and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2019151519A JP6896811B2 (en) 2015-04-15 2019-08-21 Image processing equipment, image processing methods, and programs
JP2021097301A JP2021145385A (en) 2019-08-21 2021-06-10 Image processing apparatus, image processing method, and program

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2019151519A Division JP6896811B2 (en) 2015-04-15 2019-08-21 Image processing equipment, image processing methods, and programs

Publications (1)

Publication Number Publication Date
JP2021145385A true JP2021145385A (en) 2021-09-24

Family

ID=77767369

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2021097301A Pending JP2021145385A (en) 2019-08-21 2021-06-10 Image processing apparatus, image processing method, and program

Country Status (1)

Country Link
JP (1) JP2021145385A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013235537A (en) * 2012-05-11 2013-11-21 Nikon Corp Image creation device, image creation program and recording medium
WO2014102878A1 (en) * 2012-12-27 2014-07-03 パナソニック株式会社 Image processing device and image processing method
JP2016208098A (en) * 2015-04-15 2016-12-08 キヤノン株式会社 Image processor, image processing method, and program

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013235537A (en) * 2012-05-11 2013-11-21 Nikon Corp Image creation device, image creation program and recording medium
WO2014102878A1 (en) * 2012-12-27 2014-07-03 パナソニック株式会社 Image processing device and image processing method
JP2016208098A (en) * 2015-04-15 2016-12-08 キヤノン株式会社 Image processor, image processing method, and program

Similar Documents

Publication Publication Date Title
US11948282B2 (en) Image processing apparatus, image processing method, and storage medium for lighting processing on image using model data
JP6576083B2 (en) Image processing apparatus, image processing method, and program
JP6685827B2 (en) Image processing apparatus, image processing method and program
US10997696B2 (en) Image processing method, apparatus and device
JP6864449B2 (en) Methods and devices for adjusting the brightness of the image
CN108846807B (en) Light effect processing method and device, terminal and computer-readable storage medium
JP6646936B2 (en) Image processing apparatus, control method thereof, and program
JP2017147658A (en) Image processing apparatus, imaging apparatus, control method, and program
CN108668093A (en) The generation method and device of HDR image
JP2018163648A (en) Image processor, method for image processing, and program
JP6552266B2 (en) Image processing apparatus, image processing method, and program
JP7301683B2 (en) Image processing device, image processing method, and program
JP6896811B2 (en) Image processing equipment, image processing methods, and programs
CN111275648B (en) Face image processing method, device, equipment and computer readable storage medium
JP7057086B2 (en) Image processing equipment, image processing methods, and programs
KR100422470B1 (en) Method and apparatus for replacing a model face of moving image
JP2021145385A (en) Image processing apparatus, image processing method, and program
WO2018180860A1 (en) Image processing device, image processing method, and program
JP7321772B2 (en) Image processing device, image processing method, and program
JP7011694B2 (en) Image processing equipment and its control method, program
JP7102192B2 (en) Image processing device, its control method, program
US11842467B2 (en) Image processing apparatus, image processing method and storage medium
JP7462464B2 (en) Image processing device and method, program, and storage medium
JP2021069004A (en) Image processing device, image processing method, and program
JP2017092688A (en) Image processing device, image processing method, program and imaging apparatus

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210708

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210708

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220517

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220628

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220826

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20221101

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20230418