JP6675461B2 - Image processing apparatus, control method therefor, and program - Google Patents
Image processing apparatus, control method therefor, and program Download PDFInfo
- Publication number
- JP6675461B2 JP6675461B2 JP2018184977A JP2018184977A JP6675461B2 JP 6675461 B2 JP6675461 B2 JP 6675461B2 JP 2018184977 A JP2018184977 A JP 2018184977A JP 2018184977 A JP2018184977 A JP 2018184977A JP 6675461 B2 JP6675461 B2 JP 6675461B2
- Authority
- JP
- Japan
- Prior art keywords
- virtual light
- light source
- shadow
- image processing
- setting
- 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
Links
Images
Landscapes
- Image Processing (AREA)
- Studio Devices (AREA)
- Processing Or Creating Images (AREA)
Description
本発明は、画像処理装置およびその制御方法、プログラムならびに記録媒体に関し、特に入力された画像の明るさを補正する技術に関する。 The present invention relates to an image processing apparatus, a control method therefor, a program, and a recording medium, and more particularly to a technique for correcting the brightness of an input image.
従来、ある環境光のもとで撮影された画像中の被写体に対して、仮想的な光源(仮想光源)からの光を照射して被写体の陰影を変更する、リライティングと呼ばれる技術が知られている。リライティング技術を用いることにより、環境光によって生じた被写体の陰影が好ましい状態となるように撮影した画像を補正することができる。例えば、特許文献1には、撮影画像に対して仮想光源を用いたリライティングを行う技術が開示されている。
Conventionally, there is known a technique called relighting, which irradiates light from a virtual light source (virtual light source) to a subject in an image photographed under a certain environmental light to change a shadow of the subject. I have. By using the relighting technique, it is possible to correct the captured image so that the shadow of the subject caused by the ambient light is in a preferable state. For example,
被写体の陰影は、被写体の三次元形状と照射される光の特性とによって決まるため、リライティング処理によって陰影を補正する際には、リライティングに用いる仮想光源の特性を適切に決定することが必要である。 Since the shadow of the subject is determined by the three-dimensional shape of the subject and the characteristics of the light to be irradiated, when correcting the shadow by the relighting process, it is necessary to appropriately determine the characteristics of the virtual light source used for relighting. .
特許文献1には、ライティング処理パラメータとして、ライティング処理される被写体像の範囲、仮想光源の方向、ライティング処理の強度を定め、リライティングを行うことが開示されている。しかし、特許文献1には、仮想光源から照射される光の拡散特性を制御することは考慮されていない。このため、被写体の陰影の状態を適切に補正することができない場合がある。
本発明は、上述の従来技術の問題点に鑑みてなされ、仮想光源を用いてリライティング処理を行う場合に、被写体の陰影の状態を適切に補正することができる画像処理装置およびその制御方法、ならびにプログラムを提供することを目的とする。 The present invention has been made in view of the above-described problems of the related art, and has an image processing apparatus and a control method thereof capable of appropriately correcting the state of shadow of a subject when performing a relighting process using a virtual light source, and an object of the present invention is to provide a program.
この課題を解決するため、例えば本発明の画像処理装置は以下の構成を備える。すなわち、撮影画像を取得する取得手段と、撮影画像の一部領域の陰影の度合いを判断する判断手段と、撮影画像に対する仮想的な光源である仮想光源のパラメータを設定する設定手段と、設定手段により設定されたパラメータに基づき、撮影画像に仮想光源からの仮想光が照射された効果を付加する補正手段と、を有し、補正手段は、複数の仮想光源を組み合わせて仮想光が照射された効果を付加する補正が可能であって、設定手段は、判断手段により検出された陰影の度合いに基づき、複数の仮想光源のパラメータの組み合わせを設定することで、撮影画像に照射される仮想光の拡散特性を変化させることを特徴とする。 In order to solve this problem, for example, an image processing apparatus of the present invention has the following configuration. That is, acquiring means for acquiring a captured image, determining means for determining the degree of shading of a partial area of the captured image, setting means for setting parameters of a virtual light source which is a virtual light source for the captured image, and setting means Correction means for adding the effect of irradiating the virtual light from the virtual light source to the captured image based on the parameters set by the control unit, and the correction means is configured to irradiate the virtual light by combining a plurality of virtual light sources. A correction for adding an effect is possible, and the setting unit sets a combination of a plurality of virtual light source parameters based on the degree of shading detected by the determining unit, thereby setting the virtual light emitted to the captured image. It is characterized in that the diffusion characteristics are changed.
本発明によれば、仮想光源を用いてリライティング処理を行う場合に、被写体の陰影の状態を適切に補正することが可能になる。 ADVANTAGE OF THE INVENTION According to this invention, when performing relighting processing using a virtual light source, it becomes possible to correct the state of shading of a subject appropriately.
(実施形態1)
以下、本発明の例示的な実施形態について、図面を参照して詳細に説明する。なお、以下に説明する実施形態では、本発明に係る画像処理装置をデジタルカメラに適用した例について説明する。なお、デジタルカメラは光電変換素子を用いた撮影機能を有する電子機器を意味し、携帯電話機、ゲーム機、パーソナルコンピュータ等、カメラを有するまたは使用可能な任意の電子機器が含まれる。また、本発明に撮影機能は必須でなく、本発明に係る画像処理装置は、画像処理が可能な任意の電子機器に対して適用可能である。
(Embodiment 1)
Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the drawings. In the embodiment described below, an example in which the image processing apparatus according to the present invention is applied to a digital camera will be described. Note that a digital camera refers to an electronic device having a shooting function using a photoelectric conversion element, and includes any electronic device having or usable with a camera, such as a mobile phone, a game machine, and a personal computer. Further, a photographing function is not essential to the present invention, and the image processing apparatus according to the present invention is applicable to any electronic device capable of performing image processing.
(デジタルカメラ100の構成)
図1は、本実施形態の画像処理装置の一例としてデジタルカメラ100の機能構成例を示すブロック図である。なお、図1に示す機能ブロックの1つ以上は、ASICやプログラマブルロジックアレイ(PLA)などのハードウェアによって実現されてもよいし、CPUやMPU等のプログラマブルプロセッサがソフトウェアを実行することによって実現されてもよい。また、ソフトウェアとハードウェアの組み合わせによって実現されてもよい。従って、以下の説明において、異なる機能ブロックが動作主体として記載されている場合であっても、同じハードウェアが主体として実現されうる。
(Configuration of Digital Camera 100)
FIG. 1 is a block diagram illustrating a functional configuration example of a
レンズ群101は、フォーカスレンズを含むズームレンズである。シャッタ102は、絞り機能を備え、システム制御部50の制御に応じて撮像部103に含まれる撮像素子を露光する。撮像部103は、レンズ群101を通して得られる光学像を光電変換により電気信号に変換するCCD/CMOSイメージセンサ等の撮像素子を含む。A/D変換部104は、撮像部103から読み出されたアナログ信号をデジタル信号に変換して画像処理部105に画像データを出力する。
The
画像処理部105は、A/D変換部104から出力された画像データまたはメモリ制御部107から出力された画像データに対して、ホワイトバランス調整、γ補正などの各種画像処理を行う。また、画像処理部105では、顔検出部113の顔検出結果や、撮像した画像データを用いて所定の評価値算出処理(図示しない)を行い、得られた評価値に基づいてシステム制御部50が露光制御、測距制御を行う。これにより、TTL(スルー・ザ・レンズ)方式のAF(オートフォーカス)処理、AE(自動露出)処理、AWB(オートホワイトバランス)処理などを行う。また、画像処理部105は、後述する方法により、仮想的な光源(仮想光源)からの光を照射した状態になるように被写体の陰影を変更するリライティング処理も行う。
The
画像メモリ106は、画像処理部105が各種画像処理を行う際に一時的に画像データを記憶するほか、I/F111を介して記録媒体112から読み込まれた画像データや、表示部109に表示するための画像データを記憶する。メモリ制御部107は、画像メモリ106の読み書きを制御する。D/A変換器108は、入力デジタル信号をアナログ信号に変換する。例えば画像メモリ106に格納されている画像表示用のデータをアナログ信号に変換して表示部109に出力する。
The
表示部109は、LCD等の表示装置を有し、撮影された画像、記録媒体112から読み出された画像、ライブビュー画像等を表示するほか、操作を行うためのユーザインターフェースを表示する。コーデック部110は、画像データを圧縮符号化・復号化する。コーデック部110は、画像メモリ106に記録された画像データを例えばMPEGなどの規格に準拠した形式で符号化または復号化する。
The
インターフェース(I/F)111は、例えば半導体メモリカードやカード型ハードディスクなどの着脱可能な記録媒体112を、デジタルカメラ100と機械的および電気的に接続する。顔検出部113は、画像データを解析して画像内の顔が映っている領域を検出する。
The interface (I / F) 111 mechanically and electrically connects the
システム制御部50は、CPUまたはMPUを含み、不揮発性メモリ121に記憶されていたプログラムをシステムメモリ122の作業領域に展開することにより実行して、デジタルカメラ100全体の各機能を制御する。
The
操作部120は、上述したインターフェースを表示するタッチパネルやボタン、スイッチを含み、ユーザによる操作を検出するとシステム制御部50に当該操作を通知する。
The
不揮発性メモリ121は、補助記憶装置として、プログラムやパラメータなどを格納するEEPROMなどの不揮発性の半導体メモリを含む。システムメモリ122は、主記憶装置として、不揮発性メモリ121から読みだしたプログラム等を展開するほか、システム制御部50の動作用の定数、変数を記憶する。
The
(画像処理部105の構成)
画像処理部105の構成と画像処理部105の各部の処理を、図2を参照して説明する。
(Configuration of Image Processing Unit 105)
The configuration of the
画像信号生成部201は、A/D変換部104から出力された画像データを入力する。画像信号生成部201は、入力されたベイヤー配列で構成されたRGBの画像データに対して同時化処理を行って、1画素あたり複数の色を有する画像信号R,G,Bを生成する。画像信号生成部201は、生成した画像信号をWB増幅部202に出力する。
The image
WB増幅部202は、システム制御部50が算出するホワイトバランスゲイン値に基づき、画像信号R,G,Bに所定のホワイトバランスゲインを適用し、ホワイトバランスを調整する。WB増幅部202は、調整した画像信号R,G,Bをガンマ処理部203、および、陰影状態検出部207に出力する。
The WB amplifying
陰影状態検出部207は、入力された画像信号R,G,Bに基づいて、撮影時に被写体を照らしている環境光によって被写体領域に生じた、陰影の状態を検出する。ここで、環境光は、太陽光などのデジタルカメラ100とは別個の照明、および、デジタルカメラ100に備えられた不図示の撮影補助光などを含む。陰影状態検出部207は、検出した結果を被写体陰影情報として、特性決定部208へ出力する。なお、陰影状態検出部207による被写体の陰影状態の検出処理は、後に詳細に説明する。
Based on the input image signals R, G, and B, the shadow
特性決定部208は、入力した被写体陰影情報に基づいて被写体をリライティングするための仮想光源の特性を決定する。そして、決定した仮想光源の特性を拡散特性情報として輝度補正部205へ出力する。なお、仮想光源の拡散特性の決定処理については、後に詳細に説明する。
The characteristic determining
ガンマ処理部203は、記録や表示のためにRGBの画像信号にガンマ補正を行う。ガンマ処理部203は、ガンマ補正後の画像信号を、デガンマ処理部204へ出力する。ただし、リライティング処理を行わない撮影の場合には、ガンマ補正後の画像信号を、画像メモリ106へ出力し、画像信号を記憶させる。
The
デガンマ処理部204は、入力された画像信号R,G,Bに対してデガンマ処理を行い、ガンマ補正前の画像信号R,G,Bを生成して輝度補正部205へ出力する。
The
輝度補正部205は、拡散特性情報に基づいて仮想光源の特性を設定し、入力された画像信号に対して仮想光源に対応する仮想光源信号を付加するリライティング処理を行う。輝度補正部205は、リライティング処理によって補正された画像信号を、再ガンマ処理部206へ出力する。
The
再ガンマ処理部206は、入力されたリライティング後の画像信号に対して、再度ガンマ補正を行う。再ガンマ処理部206は、ガンマ補正を施した画像信号を画像メモリ106へ出力する。
The
(陰影状態の検出処理に係る一連の動作)
次に、図3を参照して、陰影状態検出部207が、環境光によって生じる被写体の陰影状態を検出する処理の一連の動作について説明する。本処理は、例えばデジタルカメラ100の撮影動作により得られた画像データが陰影状態検出部207に入力されたときに開始される。
(Series of operations related to shadow state detection processing)
Next, a series of operations of a process in which the shadow
本処理において、被写体に生じる陰影の状態を表す情報として、陰影が生じている領域の境界部分の特性を表す情報を用いる。具体的には、陰影の境界がくっきりしているか、ぼんやりしているかの度合いを表す情報を用いることとする。 In the present process, information representing the characteristics of the boundary of the region where the shadow occurs is used as the information indicating the state of the shadow occurring in the subject. Specifically, information indicating the degree of whether the boundary of the shadow is sharp or blurred is used.
S301において、陰影状態検出部207は、WB増幅部202から入力された画像信号のうち、リライティング処理の対象とする被写体領域に対応する画像信号のみを抽出する。例えば、顔検出部113で検出した被写体の顔領域を、リライティング処理の対象とし、顔領域に対応する画像信号を抽出する。図4は、抽出した被写体領域の例を示しており、被写体に対して、斜線で示す領域402が陰になっている状態を表している。また、顔検出部113により検出された被写体の顔領域は、例えば顔領域401で示す領域のように検出されている。
In step S <b> 301, the shading
S302において、陰影状態検出部207は、抽出した顔領域401に含まれる画像信号に基づいて、被写体の明るさを算出する。具体的には、陰影状態検出部207は、図4に示すように顔領域を複数のブロック(例えば、8×8=64個)に分割して、分割したブロック毎に輝度の平均値を算出する。
In S302, the shadow
S303において、陰影状態検出部207は、算出した輝度の平均値に基づいて、被写体陰影情報を算出する。まず、陰影状態検出部207は、算出したブロック毎の輝度平均値が所定の閾値以下となるブロック(低輝度領域)を抽出して陰影領域を検出する。次に、検出した陰影領域の境界に位置するブロックとそのブロックに隣接する陰影領域でないブロックとの間で、輝度の差分値を算出する。ここで、算出した輝度の差分値が大きいほど被写体の陰影領域の境界はくっきりとした状態であり、反対に、輝度の差分値が小さいほど被写体の陰影領域の境界はぼんやりとした状態であると判断できる。陰影状態検出部207は、算出した輝度の差分値を被写体陰影情報として特性決定部208へ出力する。
In S303, the shadow
S304において、陰影状態検出部207は、環境光の位置の推定を行う。環境光の位置の推定は、種々の公知の方法を用いて行うことができるため、詳細な説明は省略するが、例えば、被写体の中で最も明るい領域を検出して、その領域の法線ベクトルを算出し、算出した方向の所定の位置に環境光が位置するものとして定めても良い。また、人物の顔領域であれば、鼻などの所定の部位とその陰の位置を検出することにより、環境光の位置を推定するようにしてもよい。陰影状態検出部207は、推定した環境光の位置情報を、特性決定部208に出力する。
In S304, the shadow
(拡散特性の制御方法の概要)
本実施形態では、仮想光源の個数、形状、大きさ、仮想光源間での相対的な位置関係を制御することにより、仮想光源の拡散特性を制御する例を説明する。特に、図5(a)〜(e)に示した代表的な仮想光源の拡散特性を例に、それぞれに対する拡散特性の制御方法を説明する。
(Outline of control method for diffusion characteristics)
In the present embodiment, an example will be described in which the number, shape, size, and relative positional relationship between virtual light sources are controlled to control the diffusion characteristics of the virtual light sources. In particular, a method of controlling the diffusion characteristics of each of the representative virtual light sources shown in FIGS.
図5(a)は、仮想光源として、点光源が一つだけ配置された場合を示している。被写体表面501と仮想光源502は、距離Dを隔てて位置し、仮想光源502からの光はβの角度で広がっている。この場合、距離Dを大きくするほど、あるいは、角度βを大きくするほど、仮想光源502からの光が被写体表面501に対して照射される範囲が広がる。また、照射される範囲の境界における光の減衰はゆるやかになる。従って、特性決定部208は、距離Dまたは角度βを大きな値に設定することで拡散性の高い光によってリライティングすることが可能となる。逆に、距離Dまたは角度βを小さな値に設定することで拡散性の低い光でリライティングすることが可能となる。
FIG. 5A shows a case where only one point light source is arranged as a virtual light source. The
図5(b)は、仮想光源として、点光源が複数配置された場合を示している。距離Lは、複数の仮想光源502の間の距離を表す。仮想光源502を互いに異なる位置に複数配置すると、仮想光源502からの光が被写体表面501に対して照射される範囲が広がる。また、照射される範囲の境界における光の減衰はゆるやかになる。さらに、仮想光源502が1つのみ配置された場合に陰となる領域に対しても、別の位置に配置された仮想光源502の光が照射される。
FIG. 5B shows a case where a plurality of point light sources are arranged as virtual light sources. The distance L represents a distance between the plurality of virtual
例えば、被写体表面501にある点503の位置には、中央に配置された仮想光源502(V2)からの光は照射されないが、左側に距離Lだけ離れた仮想光源502(V1)からの光は照射される。すなわち、レフ板などで照明光を反射させたバウンス光のような拡散性の高い光を用いたリライティングを実現することが可能となる。従って、特性決定部208は、仮想光源の個数N、仮想光源間の距離Lを大きな値に設定することで拡散性を高く、反対に、個数Nまたは仮想光源間の距離Lを小さな値に設定することで拡散性を低くするように仮想光源の拡散特性を制御できる。
For example, the position of the
図5(c)は、仮想光源として、サイズの大きなスポット光が配置された場合を示している。Sは仮想光源502のサイズを表しており、例えば、仮想光源502の形状が球である場合は球の半径を表す。仮想光源502の表面の各点から、スポット光が照射されるものとする。図5(b)の場合と同様に、仮想光源502のサイズSを大きくすると、仮想光源502からの光が照射される範囲が広がって、仮想光源502が点光源の場合に陰となる領域に対しても光が照射される。従って、特性決定部208は、サイズSを大きな値に設定することで拡散性を高く、反対にサイズSを小さな値に設定することによって拡散性を低くするように仮想光源の拡散特性を制御できる。
FIG. 5C shows a case where a large-sized spot light is arranged as a virtual light source. S represents the size of the virtual
図5(d)は、仮想光源として、曲率Rを持つ面光源または線状の光源が配置された場合を示している。曲率Rが0に近づくと仮想光源502からの光は平行光となる。曲率Rが0でない値の場合、平行光を照射する仮想光源502が配置された場合では陰となっていた領域に対しても、仮想光源502の光が照射されることとなる。従って、特性決定部208は、曲率Rを0よりも大きな値に設定することで拡散性を高く、0に近い値に設定することで拡散性を低くするように仮想光源の拡散特性を制御できる。
FIG. 5D shows a case where a surface light source having a curvature R or a linear light source is arranged as a virtual light source. When the curvature R approaches 0, the light from the virtual
図5(e)は、仮想光源として、複数の面光源または線状の光源が、互いに異なる角度に配置された場合を示している。角度γは、仮想光源502間の相対的な角度を表す。角度γが大きな値をとると、仮想光源502からの光が照射される範囲が広がる。また、照射される範囲の境界における光の減衰はゆるやかになる。つまり角度γを大きな値にすれば、角度γが0である場合に陰となっていた領域に対しても、異なる角度に配置された仮想光源からの光が照射されることとなる。従って、特性決定部208、仮想光源間の角度γを大きな値に設定することで拡散性を高く、反対に角度γを小さな値に設定することで拡散性を低くするよう仮想光源の拡散特性を制御できる。
FIG. 5E shows a case where a plurality of surface light sources or linear light sources are arranged at different angles as virtual light sources. The angle γ represents a relative angle between the virtual
なお、以降の説明では、特性決定部208は、図5(a)〜(e)で説明した何れかの仮想光源のパラメータまたはそれらの組み合わせを変更することによって、仮想光源の拡散特性を制御するものとする。
In the following description, the characteristic determining
(仮想光源の拡散特性の決定処理に係る一連の動作)
さらに、図6を参照して、特性決定部208が、被写体陰影情報に基づいて、仮想光源の拡散特性を決定する処理の一連の動作について説明する。
(A series of operations related to the process of determining the diffusion characteristics of the virtual light source)
Further, with reference to FIG. 6, a description will be given of a series of operations of the process in which the characteristic determining
S601において、特性決定部208は、システム制御部50から標準的な仮想光源の設定を表す情報(即ち、仮想光源の設定の標準値)を取得する。仮想光源の設定を表す情報とは、図5で説明した仮想光源の個数、形状、位置関係の仮想光源のパラメータを設定した情報を指す。標準的な仮想光源の設定を表す情報は、予め実験等により定められた値が不揮発性メモリ121に記憶されており、システム制御部50がこれを読み出すことによって特性決定部208に提供される。
In step S <b> 601, the characteristic determining
S602において、特性決定部208は、陰影状態検出部207から出力された被写体陰影情報を取得する。上述したように、被写体陰影情報は、被写体の陰影の状態を示す情報であり、陰影領域の境界における輝度の差分値が設定されている。
In step S <b> 602, the
S603において、特性決定部208は、システム制御部50から出力される、目標とする陰影情報を取得する。目標とする陰影情報は、リライティング処理の際に目標とする陰影状態であり、例えば、目標とする、陰影領域の境界における輝度の差分値(以下、単に目標輝度差という)を表す。目標輝度差については、例えば予め実験等により定められた値が不揮発性メモリ121に記憶されており、特性決定部208は、目標輝度差をシステム制御部50を介して取得する。
In step S603, the
S604において、特性決定部208は、S602において取得した被写体陰影情報の示す輝度の差分値が、S603において取得した目標輝度差より高いかを判定する。特性決定部208は、当該輝度の差分値と目標輝度差とを比較して、輝度の差分値が目標輝度差より高い場合はS605に処理を進める。この場合は、被写体上の陰影領域が目標とする陰影状態よりもくっきりとして被写体の陰影が優勢な状態である。一方、特性決定部208は、輝度の差分値が目標輝度差以下の場合にはS606に処理を進める。この場合は、環境光によって生じる被写体の陰影領域の境界の状態がぼんやりとして被写体の陰影が劣勢な状態である。
In step S604, the characteristic determining
S605において、特性決定部208は、仮想光源の拡散特性をS601において取得した標準値よりも高く設定する。即ち、拡散特性の高い仮想光源を設定したリライティングを行うように仮想光源の拡散特性を制御する。より具体的には、特性決定部208は、S601で読みだした標準値を変更して、仮想光源の拡散特性がより高くなるように制御する。設定値の具体的な制御方法は、図5を用いて上述した通りである。
In S605, the characteristic determining
S606において、特性決定部208は、S601で読み出した標準値を変更して、仮想光源の拡散特性がより低くなるように制御する。
In step S606, the
S607において、特性決定部208は、変更した仮想光源の拡散特性の設定値を、拡散特性情報として、輝度補正部205へ出力する。なお、仮想光源を配置する位置は、陰影状態検出部207が、図3のS304で推定した環境光の位置、方向と同一となるよう設定する。ただし、環境光の位置が正確に推定できなかった場合は、仮想光源を撮影画像外の位置に設定してリライティングするように仮想光源を配置する位置を設定する。
In step S607, the characteristic determining
特性決定部208は、上述した処理を終えると本処理に係る一連の動作を終了する。
When the above-described processing ends, the characteristic determining
(リライティング処理)
さらに、輝度補正部205が行う、仮想光源を用いたリライティング処理について説明する。本実施形態では、仮想光源によって照射された対象画素の出力値(R,G,B)を算出する。なお、輝度補正部205は(R、G、B)を下記の式により算出する。
R =[Rt + sum_n[Rv×A_n×cos(α_n)/D_n^2] ]/M
G =[Gt + sum_n[Gv×A_n×cos(α_n)/D_n^2] ]/M
B =[Bt + sum_n[Bv×A_n×cos(α_n)/D_n^2] ]/M
ここで、(Rt、Gt、Bt)は処理対象の画素値、nは複数の仮想光源を区別するための添え字であり、仮想光源がN個設定されている場合は、n=1…Nとなる。sum_nは、nについて和を取る処理を表す。A_nはn番目の仮想光源の強度を表す所定の定数、D_nはn番目の仮想光源と被写体までの距離、(Rv、Gv、Bv)は光源反射色を表す。Mはリライティング処理後の出力RGB値を正規化するための定数である。角度α_nは、n番目の仮想光源が配置された位置と対象画素を結ぶ直線と、対象画素における被写体の法線ベクトルの成す角である。
(Rewriting process)
Further, rewriting processing using a virtual light source, which is performed by the
R = [Rt + sum_n [Rv × A_n × cos (α_n) / D_n ^ 2]] / M
G = [Gt + sum_n [Gv × A_n × cos (α_n) / D_n ^ 2]] / M
B = [Bt + sum_n [Bv × A_n × cos (α_n) / D_n ^ 2]] / M
Here, (Rt, Gt, Bt) is a pixel value to be processed, n is a suffix for distinguishing a plurality of virtual light sources, and n = 1... N when N virtual light sources are set. Becomes sum_n represents a process for summing n. A_n is a predetermined constant representing the intensity of the n-th virtual light source, D_n is the distance between the n-th virtual light source and the subject, and (Rv, Gv, Bv) represents the light source reflection color. M is a constant for normalizing the output RGB values after the relighting process. The angle α_n is an angle formed by a straight line connecting the position where the n-th virtual light source is arranged and the target pixel, and a normal vector of the subject at the target pixel.
角度αを算出する際に、リライティングの対象画素の各画素に対して被写体の法線ベクトルを算出して、角度αを算出するようにしても良い。また、図4に示したように被写体領域を複数のブロックに分割し、ブロック毎に算出した法線ベクトルに基づいて角度αを算出するようにしても良い。さらに、人物の顔のように被写体の3次元形状が予め分かっている場合には、対象画素が顔領域中でどこの位置であるかに基づいて、法線ベクトルの方向を推定し、角度αを算出するようにしても良い。光源反射色は、仮想光源が被写体表面で反射したときの反射色を、予め設定された仮想光源色と被写体色とによって推定したものである。 When calculating the angle α, the normal vector of the subject may be calculated for each pixel of the rewriting target pixel, and the angle α may be calculated. Further, as shown in FIG. 4, the subject area may be divided into a plurality of blocks, and the angle α may be calculated based on the normal vector calculated for each block. Further, when the three-dimensional shape of the subject is known in advance, such as a person's face, the direction of the normal vector is estimated based on the position of the target pixel in the face area, and the angle α is determined. You may make it calculate. The light source reflection color is obtained by estimating the reflection color when the virtual light source reflects on the surface of the subject, based on the preset virtual light source color and the subject color.
以上説明したように、本実施形態では、被写体に生じる陰影領域の境界における輝度差を検出して、当該輝度差を目標とする輝度差と比較した結果に基づき、仮想光源の特性を設定するようにした。このようにすることで、環境光によって生じた被写体の陰影の状態を、目標とする状態に近づけるようリライティング処理を行うことができる。即ち、環境光による被写体の陰影の状態に応じて仮想光源の拡散特性を決定することにより、仮想光源を用いてリライティング処理を行う場合に、被写体の陰影を適切にすることができる。 As described above, in the present embodiment, the characteristic of the virtual light source is set based on the result of detecting the luminance difference at the boundary of the shadow area generated in the subject and comparing the luminance difference with the target luminance difference. I made it. By doing so, it is possible to perform the relighting process so that the state of the shadow of the subject caused by the ambient light approaches the target state. In other words, by determining the diffusion characteristic of the virtual light source according to the state of the shadow of the subject due to the ambient light, the shadow of the subject can be made appropriate when performing the relighting process using the virtual light source.
(本実施形態に係る変形例)
本実施形態において説明した、環境光による被写体の陰影の状態に応じて仮想光源の拡散特性を決定して、リライティング処理を行う構成は、上述した実施形態に限られず、例えば以下に説明する変形例によっても実現することができる。
(Modification according to the present embodiment)
The configuration for determining the diffusion characteristic of the virtual light source in accordance with the state of the shadow of the subject due to the ambient light and performing the relighting processing described in the present embodiment is not limited to the above-described embodiment, and is, for example, a modification described below Can also be realized.
本実施形態では、陰影領域の境界における輝度差に基づいて、仮想光源の拡散特性を決定する方法を用いたが、被写体の陰影の状態を表す情報であれば、どのようなものを用いても良い。例えば、環境光によって生じる被写体のコントラストの値を検出し、その値を目標とするコントラストの値と比較した結果に基づいて、仮想光源の特性を決定するようにしても良い。具体的には、被写体のコントラストの値が所定の目標より高い(低い)場合は、仮想光源の拡散特性を高く(低く)設定するようにすれば良い。このようにすることで、被写体のコントラストを好ましい状態に近づけるようリライティング処理を制御することが可能となる。 In the present embodiment, the method of determining the diffusion characteristic of the virtual light source based on the luminance difference at the boundary of the shadow area is used. However, any information that indicates the state of the shadow of the subject may be used. good. For example, the characteristic of the virtual light source may be determined based on a result of detecting a contrast value of a subject caused by ambient light and comparing the detected value with a target contrast value. Specifically, when the contrast value of the subject is higher (lower) than a predetermined target, the diffusion characteristic of the virtual light source may be set higher (lower). By doing so, it is possible to control the relighting process so that the contrast of the subject approaches a desirable state.
また、被写体領域内の陰影領域の面積を算出し、その結果を被写体の陰影の状態を表す情報として用いても良い。具体的には、被写体領域内の陰影領域(例えば低輝度領域)が、被写体領域内に占める割合を算出し、その値が所定の目標より高い(低い)場合は、仮想光源の拡散特性を高く(低く)設定するようにすれば良い。即ち、被写体領域内で陰影領域となっている面積が多い場合には、その陰影領域の面積を減らすようにリライティング処理を行い、被写体領域内で陰影領域となっている面積が少ない場合には、その面積を増やすようリライティング処理を行うことができる。このようにすれば、被写体の陰影の状態を適切に補正した画像を得ることができる。 Alternatively, the area of the shadow area in the subject area may be calculated, and the result may be used as information indicating the state of the shadow of the subject. Specifically, the ratio of the shadow area (for example, low-luminance area) in the object area to the object area is calculated, and when the value is higher (lower) than a predetermined target, the diffusion characteristic of the virtual light source is increased. (Low) should be set. That is, if there is a large area that is a shadow area in the subject area, rewriting processing is performed to reduce the area of the shadow area, and if the area that is a shadow area in the subject area is small, A relighting process can be performed to increase the area. This makes it possible to obtain an image in which the state of the shadow of the subject is appropriately corrected.
さらに、被写体領域に対して、輝度ヒストグラムを算出し、その度数分布の偏り(即ち明るさの分布)に応じて、仮想光源の特性を決定する方法を用いても良い。具体的には、所定の閾値を下回る輝度値に対応する度数を算出し、その値が所定の目標より高い(低い)場合は、仮想光源の拡散特性を高く(低く)設定する。 Furthermore, a method may be used in which a luminance histogram is calculated for the subject region and the characteristics of the virtual light source are determined according to the bias of the frequency distribution (ie, the brightness distribution). Specifically, a frequency corresponding to a luminance value lower than a predetermined threshold is calculated, and if the value is higher (lower) than a predetermined target, the diffusion characteristic of the virtual light source is set higher (lower).
また、本実施形態では、目標とする陰影状態を予め定めておくものとして説明したが、本発明は、目標とする陰影状態の決定方法をこれに限定するものではない。例えば、目標とする陰影状態を表す値を、デジタルカメラの撮影モードやカメラパラメータなどの撮影時の撮影パラメータに応じて決定するようにしても良い。例えば、撮影時に用いるガンマ曲線の特性がコントラストを強く表現する特性である場合は、目標とする輝度差を高く設定し、ガンマ曲線の特性がコントラストを弱く表現する特性である場合は、目標とする輝度差を低く設定するようにする。 Further, in the present embodiment, a description has been given assuming that a target shadow state is determined in advance, but the present invention is not limited to a method of determining a target shadow state. For example, the value representing the target shade state may be determined according to the shooting parameters at the time of shooting, such as the shooting mode and camera parameters of the digital camera. For example, if the characteristic of the gamma curve used at the time of shooting is a characteristic that strongly expresses the contrast, the target luminance difference is set high, and if the characteristic of the gamma curve is a characteristic that expresses the contrast weakly, the target is set. Set the brightness difference low.
また、リライティング処理の対象となる被写体領域以外の領域、例えば被写体の背景に位置する背景領域の陰影の状態に応じて、目標とする陰影状態を決定するようにしても良い。具体的には、背景の被写体上の陰影の境界がくっきりしている場合は目標とする輝度差も高く設定し、背景の被写体上の陰影の境界がぼんやりしている場合は目標とする輝度差を低く設定するようにする。このようにすることで、リライティング処理の対象とする被写体と、周囲の被写体の陰影の状態を近づけることができ、リライティング処理を行う際に生じる違和感を低減することができる。 Further, the target shade state may be determined according to the shade state of a region other than the subject region to be subjected to the relighting process, for example, a background region located in the background of the subject. Specifically, if the boundary of the shadow on the background subject is clear, the target luminance difference is set high, and if the boundary of the shadow on the background subject is blurry, the target luminance difference is set. Be set low. By doing so, the state of the shadow of the subject to be rewritten and the surrounding subject can be brought close to each other, and the sense of discomfort that occurs when performing the rewriting process can be reduced.
また、本実施形態では、目標とする陰影状態との比較によって、仮想光源の拡散特性を決定する方法を説明したが、被写体陰影情報に基づいて仮想光源の拡散特性を決定する方法であれば、他の方法を用いても構わない。例えば、検出した被写体の輝度差が、所定の閾値範囲内にあるか否かによって、仮想光源の拡散特性を決定するようにしても良い。具体的には、被写体の陰領域の境界における輝度差が所定の閾値以上(以下)である場合、仮想光源の拡散特性を標準より高く(低く)設定する。このようにすることで、特定の目標とする値を定めない場合でも、被写体陰影情報に基づいて仮想光源の拡散特性を決定することができ、リライティング処理を制御することができる。また、被写体の陰影状態を表す情報と、目標とする陰影状態を表す情報との差分が、所定の閾値以下である場合には、リライティング処理を行わないよう制御するようにしても良い。 Further, in the present embodiment, the method of determining the diffusion characteristic of the virtual light source by comparison with the target shadow state has been described. However, if the method of determining the diffusion characteristic of the virtual light source based on the subject shadow information, Other methods may be used. For example, the diffusion characteristic of the virtual light source may be determined based on whether or not the detected luminance difference of the subject is within a predetermined threshold range. Specifically, when the luminance difference at the boundary of the shadow region of the subject is equal to or greater than (or less than) a predetermined threshold, the diffusion characteristic of the virtual light source is set higher (lower) than the standard. In this way, even when a specific target value is not determined, the diffusion characteristic of the virtual light source can be determined based on the subject shadow information, and the relighting process can be controlled. Further, when the difference between the information indicating the shadow state of the subject and the information indicating the target shadow state is equal to or smaller than a predetermined threshold value, control may be performed so that the relighting process is not performed.
さらに、リライティング処理の対象としない被写体に対しても、明るさの補正処理を行うようにしても良い。具体的には、リライティング処理の対象とする被写体の、リライティング処理後のコントラスト値を算出し、リライティング処理の対象としない被写体のコントラストが、その値に近づくよう明るさを補正する。このようにすることで、リライティング処理の対象となる被写体と、対象とならない被写体との間で生ずる違和感を低減することが可能となる。 Further, brightness correction processing may be performed on a subject that is not a target of the relighting processing. Specifically, the contrast value of the subject to be subjected to the rewriting process is calculated after the rewriting process, and the brightness is corrected so that the contrast of the subject not to be subjected to the rewriting process approaches the value. By doing so, it is possible to reduce the sense of discomfort that occurs between the subject to be rewritten and the non-target subject.
また、本実施形態では、仮想光源の位置は、推定した環境光の位置と同じ位置となるように設定したが、本発明は仮想光源の位置の決定方法をこれに限定するものではない。例えば、被写体正面に対して、斜め45度方向など、予め決められた方向に仮想光源を配置するようにしても良い。 Further, in the present embodiment, the position of the virtual light source is set to be the same as the position of the estimated environment light. However, the present invention is not limited to the method of determining the position of the virtual light source. For example, the virtual light source may be arranged in a predetermined direction such as a 45-degree diagonal direction with respect to the front of the subject.
また、本実施形態では、被写体となる人物が一人である場合を例に説明したが、本発明はリライティングの対象とする被写体をこれに限定するものではない。例えば、複数人の被写体が撮影された場合におけるリライティング処理に対して、本発明の方法を用いても構わない。このとき、同じ環境光によって照明があてられている場合であっても、顔の向きなどの条件によって被写体の陰影の状態が互いに異なる場合がある。このため、本実施形態で説明した陰影状態の検出処理と、その結果に基づく仮想光源の拡散特性の決定処理とを、被写体毎に個別に行うようにすれば良い。このとき、リライティング処理の目標とする陰影状態の情報は共通の値を用いるようにすればよい。このようにすれば、複数の被写体が撮影された場合であっても、各被写体の陰影の状態を好ましい状態とするようリライティング処理することが可能になる。 Further, in the present embodiment, an example has been described in which the subject is a single person, but the present invention is not limited to the subject to be relighted. For example, the method of the present invention may be used for relighting processing when a plurality of subjects are photographed. At this time, even if the illumination is performed by the same environmental light, the state of the shadow of the subject may be different depending on conditions such as the direction of the face. For this reason, the process of detecting the shadow state described in the present embodiment and the process of determining the diffusion characteristic of the virtual light source based on the result may be individually performed for each subject. At this time, a common value may be used as the information of the shadow state as a target of the relighting process. In this way, even when a plurality of subjects are photographed, it is possible to perform the relighting process so that the shading state of each subject is in a preferable state.
さらに、複数の被写体が撮影された場合、被写体のうち最も主要な被写体の陰影の状態を基準に仮想光源の特性を決定し、他の被写体に対しても同一の特性の仮想光源を用いてリライティングするように制御しても良い。このようにすることで、同じ環境の中にいる被写体が、互いに異なる特性を持つ光源で照明されるような不自然さを防止することが可能となる。 Furthermore, when a plurality of subjects are photographed, the characteristics of the virtual light source are determined based on the state of the shadow of the most main subject among the subjects, and rewriting is performed for other subjects using the virtual light source having the same characteristics. Control may be performed. By doing so, it is possible to prevent unnaturalness in which subjects in the same environment are illuminated by light sources having different characteristics.
また、本実施形態では、仮想光源の個数や形状について代表的な例を図示して、仮想光源の拡散特性の制御処理を説明したが、本発明は仮想光源の個数や形状を、図示した例に限定するものではない。例えば、複数の点光源を直線上に配置するように説明したが、湾曲した曲線上に複数の点光源を配置し、リライティングするようにしても良い。この場合、曲線の曲率や仮想光源間の距離を制御することによって、仮想光源の拡散特性を意図する状態に設定することができる。また、本実施形態では、一律の曲率で湾曲した曲線状の仮想光源を用いるように説明したが、それ以外の形状を用いても構わない。例えば、仮想光源の形状を所定の角度で折れ曲がった折れ線としても良い。 Further, in the present embodiment, a typical example of the number and shape of the virtual light source is illustrated to explain the control processing of the diffusion characteristics of the virtual light source. It is not limited to. For example, although a case has been described in which a plurality of point light sources are arranged on a straight line, a plurality of point light sources may be arranged on a curved curve to perform rewriting. In this case, by controlling the curvature of the curve and the distance between the virtual light sources, the diffusion characteristics of the virtual light sources can be set to the intended state. Also, in the present embodiment, a description has been given of using a curved virtual light source curved with a uniform curvature, but other shapes may be used. For example, the shape of the virtual light source may be a broken line bent at a predetermined angle.
さらに、本実施形態では、仮想光源の形状や個数などのパラメータを制御することで、仮想光源の拡散特性を制御するものとして説明したが、本発明は仮想光源の拡散特性の制御方法をこれに限定するものではない。例えば、所定の形状、個数に設定された仮想光源に対応する仮想光源信号を算出した後、当該信号に対して平滑化フィルタをかけることにより、擬似的に仮想光源の拡散特性が高くなるように制御しても良い。即ち、被写体の陰影状態の検出結果に基づいて、仮想光源の拡散特性を制御する方法であれば、どのような方法を用いても構わない。 Furthermore, in the present embodiment, the description has been made assuming that the diffusion characteristics of the virtual light source are controlled by controlling parameters such as the shape and the number of the virtual light sources. It is not limited. For example, after calculating a virtual light source signal corresponding to a virtual light source set to a predetermined shape and number, by applying a smoothing filter to the signal, the diffusion characteristics of the virtual light source are increased in a pseudo manner. It may be controlled. That is, any method may be used as long as the method controls the diffusion characteristics of the virtual light source based on the detection result of the shadow state of the subject.
また、環境光の拡散特性に応じて、仮想光源の拡散特性を制御するようにしても良い。例えば、環境光によって照射されている範囲を推定し、仮想光源から照射される光が広がる範囲を定める際に、環境光と仮想光源とが同じ範囲を照射するよう仮想光源の拡散特性を制御するようにしても良い。このようにすることで、より自然なリライティング結果を得ることが可能となる。 Further, the diffusion characteristics of the virtual light source may be controlled according to the diffusion characteristics of the ambient light. For example, when estimating a range illuminated by ambient light and determining a range in which light illuminated from the virtual light source spreads, the diffusion characteristics of the virtual light source are controlled so that the ambient light and the virtual light source illuminate the same range. You may do it. By doing so, a more natural relighting result can be obtained.
(実施形態2)
次に本発明に係る実施形態2について説明する。実施形態1では、特定の被写体上に生じる陰影の状態に応じて、仮想光源の拡散特性を制御した。これに対して、実施形態2では、撮影画像の全体における陰影の状態に応じて、仮想光源の拡散特性を制御する。このため、本実施形態は、陰影状態の検出処理および仮想光源の拡散特性の制御処理が実施形態1と異なるが、デジタルカメラ100の構成および画像処理部の構成は、図1および図2に示した構成と同一の構成を用いることができる。このため、同一の構成については同一の符号を付して重複する説明は省略し、相違点について重点的に説明する。
(Embodiment 2)
Next, a second embodiment according to the present invention will be described. In the first embodiment, the diffusion characteristic of the virtual light source is controlled according to the state of the shadow generated on a specific subject. On the other hand, in the second embodiment, the diffusion characteristic of the virtual light source is controlled according to the state of the shadow in the entire captured image. For this reason, the present embodiment is different from the first embodiment in the shading state detection process and the control process of the diffusion characteristic of the virtual light source, but the configuration of the
陰影状態検出部207による陰影状態の検出処理について説明する。図7には、本実施形態における撮影画像の例を示しており、撮影画像全体がリライティング処理の対象領域として用いられる。撮影画像は、後述するように、複数のブロックに分割されて処理される。図7は、斜線部分、即ち陰になっている状態の領域が多い撮影画像を現しており、環境光の拡散性が低く、局所的にしか照らされていない状態を示している。このため、画像全体が暗い印象となっている。
The shadow state detection processing by the shadow
(陰影状態の検出処理に係る一連の動作)
次に、図7に示す撮影画像に対する、陰影状態検出部207が行う陰影状態の検出処理に係る一連の動作を、図3を参照して説明する。
(Series of operations related to shadow state detection processing)
Next, a series of operations related to a shadow state detection process performed by the shadow
S301において、陰影状態検出部207は、WB増幅部202から入力された画像信号のうち、リライティング処理の対象となる領域の画像信号を抽出する。実施形態1では、特定の被写体領域を抽出してリライティング処理を行ったが、本実施形態では、陰影状態検出部207は、より広い領域(すなわち撮影画像全体)を抽出してリライティング処理を行う。
In step S <b> 301, the shadow
S302において、陰影状態検出部207は、抽出した画像信号に基づいて、予め定められた大きさの領域毎に明るさを算出する。具体的には、図7に示すように、リライティング処理の対象となる領域を複数のブロック(例えば、8×8=64個)に分割して、分割したブロック毎に輝度の平均値を算出する。
In S302, the shadow
S303において、陰影状態検出部207は、算出した輝度の平均値に基づいて、被写体陰影情報を算出する。本実施形態では、環境光によって照らされ明るくなっている領域の面積が、画像全体に対して占める割合(単に、環境光の割合という)を算出し、当該割合を被写体陰影情報として用いる。図7の例では、環境光の拡散性が低く、局所的にしか照らされていない場合には、仮想光源の拡散特性が高くなるようにリライティングすれば、好ましい画像となるよう補正することができる。反対に、環境光の拡散性が高く、画像領域全体が一様に照らされている場合には、画像全体でのコントラストが低くなり、平板な印象の画像となる。このため、仮想光源の拡散特性が低くなるようにリライティングすれば、メリハリのある好ましい画像となるよう補正することができる。陰影状態検出部207は、算出した環境光の割合を、特性決定部208へ出力する。
In S303, the shadow
なお、陰影状態検出部207は、以降のS304において実施形態1の場合と同様にして環境光の位置の推定を行い、その結果を特性決定部208へ出力する。
The shadow
(仮想光源の拡散特性の決定処理に係る一連の動作)
次に、特性決定部208が、被写体陰影情報に基づいて、仮想光源の拡散特性の決定処理について、図8を参照して説明する。
(A series of operations related to the process of determining the diffusion characteristics of the virtual light source)
Next, a process in which the characteristic determining
図5に示した場合と同様にして、仮想光源の形状、大きさ、個数、位置関係などの特性を制御することによって、仮想光源の拡散特性を制御する。ここでは、図5(a)に示した仮想光源のうち、仮想光源からの光が広がる範囲を表す角度βの値を制御する例について説明するが、図5(a)〜(e)の何れの場合を用いても良い。 As in the case shown in FIG. 5, the diffusion characteristics of the virtual light source are controlled by controlling characteristics such as the shape, size, number, and positional relationship of the virtual light source. Here, an example will be described in which the value of the angle β representing the range in which the light from the virtual light source spreads out of the virtual light sources shown in FIG. 5A is controlled, but any of FIGS. 5A to 5E will be described. May be used.
S801において、特性決定部208は、システム制御部50から出力された仮想光源の設定の標準値を取得する。本実施形態では、特性決定部208は、例えば角度βの値の標準的な設定値を取得するものとする。
In step S <b> 801, the
S802において、特性決定部208は、陰影状態検出部207から出力された被写体陰影情報を取得する。本実施形態では、被写体陰影情報として設定されている環境光の割合の値を取得する。
In step S802, the
S803において、特性決定部208は、システム制御部50から出力されたリライティング処理時の目標とする被写体の陰影の状態、即ち目標とする環境光の割合(単に目標値ともいう)を取得する。より具体的には、目標値は、環境光が照射されて明るくなっている領域が撮影画像の領域に占める割合を、予め定めた目標値として設定したものである。
In step S <b> 803, the
S804において、特性決定部208は、環境光の割合が目標値より小さいかを判定する。特性決定部208は、環境光の割合と目標値とを比較して、環境光の割合が目標値より小さい場合は処理をS805に進め、それ以外の場合は処理をS806に進める。ここで、環境光の割合が目標値より小さい場合は、環境光が当たっている領域が狭いため、被写体の陰影が優勢となり画像全体が暗い印象になっている。このため、拡散性の高い仮想光源によってリライティングし、画像内の暗い領域を少なくするためS805に処理を進める。
In S804, the characteristic determining
一方、環境光の割合が目標値以上である場合は、環境光が撮影画像内の広い領域に当たっているため、被写体の陰影が劣勢となっている。このため、拡散特性の低い仮想光源によってリライティングし、画像の明るさにメリハリのある好ましい画像にするためS806に処理を進める。 On the other hand, when the ratio of the ambient light is equal to or greater than the target value, the shadow of the subject is inferior because the ambient light hits a wide area in the captured image. For this reason, rewriting is performed with a virtual light source having a low diffusion characteristic, and the process proceeds to S806 in order to obtain a preferable image with sharp image brightness.
S805において、特性決定部208は、S801で読みだした標準値を変更して、仮想光源の拡散性がより高くなるよう制御する。すなわち、角度βを標準値よりも所定の値だけ大きくした値として設定する。
In step S805, the
S806において、特性決定部208は、S801で読みだした標準値を変更して、仮想光源の拡散特性がより低くなるよう制御する。すなわち、角度βを標準値よりも所定の値だけ小さくした値として設定する。
In step S806, the characteristic determining
S807において、特性決定部208は、実施形態1で説明したS607と同様の処理、即ち拡散特性情報の出力を行って、本処理に係る一連の動作を終了する。
In step S807, the
以降の処理においては、実施形態1と同様に、輝度補正部205が仮想光源に対応した信号を画像信号に付加することにより画像信号を補正する処理を行う。
In the subsequent processing, as in the first embodiment, the
以上説明したように、本実施形態では、画像領域において環境光によって明るく照らされている面積の割合と目標値との比較結果に基づいて、仮想光源の拡散特性を設定するようにした。これにより、環境光によって生じる画像領域内の陰影の状態を、目標とする状態に近づけるようリライティング処理を行うことができる。即ち、環境光による陰影の状態に応じて仮想光源の拡散特性を決定することにより、仮想光源を用いてリライティング処理を行う場合に、画像内の陰影の状態を適切に補正することができる。 As described above, in the present embodiment, the diffusion characteristic of the virtual light source is set based on the comparison result between the target value and the ratio of the area of the image area that is brightly illuminated by the ambient light. Thereby, the relighting process can be performed so that the state of the shadow in the image area caused by the ambient light approaches the target state. In other words, by determining the diffusion characteristics of the virtual light source according to the state of the shadow due to the ambient light, it is possible to appropriately correct the state of the shadow in the image when performing the relighting process using the virtual light source.
(その他の実施形態)
なお、上述の説明では、仮想光源の拡散特性を変化させる場合に、標準的な設定値から、所定の値だけ変化させる場合について説明したが、本発明は、仮想光源の拡散特性の制御方法をこれに限定するものではない。例えば、仮想光源の拡散特性を設定し、リライティング処理した状態でさらに被写体陰影情報を算出し、その値を目標とする状態と比較することを繰り返し行うようにしてもよい。このようにすれば、被写体の陰影の状態が漸近的に目標に近づいてより精度の高い制御が可能になる。
(Other embodiments)
In the above description, the case where the diffusion characteristic of the virtual light source is changed by a predetermined value from the standard setting value has been described. However, the present invention provides a method of controlling the diffusion characteristic of the virtual light source. It is not limited to this. For example, the diffusion characteristic of the virtual light source may be set, subject shadow information may be further calculated in a state where the relighting process has been performed, and the value may be repeatedly compared with a target state. In this way, the state of the shadow of the subject asymptotically approaches the target, and more precise control becomes possible.
また、画像領域内の被写体の位置に基づいて、仮想光源の拡散特性を制御するようにしても良い。例えば、図7に示した場合において、仮想光源の拡散特性を高く設定し、仮想光源からの光が照射される範囲を広げるようにしてもよい。この際、図7に示す画像の左下に位置する人物が主要な被写体である場合には、人物が位置する領域まで仮想光源の光が照射されるよう、仮想光源の拡散特性を設定するようにする。逆に、環境光の拡散性が高いために、仮想光源の拡散特性を低く設定する場合には、主要な被写体である人物の位置には仮想光源の光が照射されないように仮想光源の拡散特性を設定すれば良い。このようにすることで、画像内の主要な被写体を際立たせる照明効果を生むことができ、被写体の陰影の状態が好ましい画像を生成することが可能となる。 Further, the diffusion characteristic of the virtual light source may be controlled based on the position of the subject in the image area. For example, in the case shown in FIG. 7, the diffusion characteristic of the virtual light source may be set high to widen the range in which light from the virtual light source is irradiated. At this time, if the person located at the lower left of the image shown in FIG. 7 is the main subject, the diffusion characteristics of the virtual light source are set so that the light of the virtual light source is irradiated to the area where the person is located. I do. Conversely, when the diffusion characteristics of the virtual light source are set low because the diffusion characteristics of the ambient light are high, the diffusion characteristics of the virtual light source are set so that the light of the virtual light source is not irradiated to the position of the person who is the main subject. Should be set. By doing so, it is possible to produce a lighting effect that makes the main subject in the image stand out, and it is possible to generate an image in which the shadow state of the subject is preferable.
また、上述の説明では、仮想光源の拡散特性を制御する際に、仮想光源からの光が広がる角度を制御したが、本発明は仮想光源の拡散特性の制御方法をこれに限定するものではない。例えば、仮想光源から照射される光に対する画素の出力値を算出する際のパラメータを変えるようにしても良い。仮想光源からの距離の二乗に反比例して、仮想光源からの光が減衰するようにしたが、その減衰の度合いがより急峻あるいは緩やかになるよう仮想光源信号の算出方法を変更して、仮想光源の拡散特性を制御するようにしても良い。 In the above description, when controlling the diffusion characteristics of the virtual light source, the angle at which the light from the virtual light source spreads is controlled. However, the present invention is not limited to the method for controlling the diffusion characteristics of the virtual light source. . For example, a parameter for calculating an output value of a pixel with respect to light emitted from a virtual light source may be changed. The light from the virtual light source is attenuated in inverse proportion to the square of the distance from the virtual light source. May be controlled.
また、実施形態2で説明した仮想光源の拡散特性の制御方法と、実施形態1で説明した仮想光源の拡散特性の制御方法とを組み合わせて用いるようにしても良い。例えば、実施形態2のように、仮想光源から照射される光の広がりを表す角度を大きな値に設定した場合に、更に、実施形態1で説明した制御方法によって仮想光源の形状や個数を設定し、仮想光源の拡散特性を高く設定するようにしてもよい。このようにすることで、より自然な拡散特性を持つ仮想光源を設定し、リライティング処理することが可能となる。 Further, the method for controlling the diffusion characteristic of the virtual light source described in the second embodiment and the method for controlling the diffusion characteristic of the virtual light source described in the first embodiment may be used in combination. For example, when the angle representing the spread of the light emitted from the virtual light source is set to a large value as in the second embodiment, the shape and number of the virtual light sources are further set by the control method described in the first embodiment. Alternatively, the diffusion characteristics of the virtual light source may be set high. By doing so, it becomes possible to set a virtual light source having a more natural diffusion characteristic and perform relighting processing.
さらに、上述の説明では、リライティングによって画像の明るさを補正する場合に、仮想光源のみを用いて補正する方法で説明したが、本発明は明るさの補正方法を仮想光源のみを用いる場合に限定するものではない。例えば、環境光によって明るく照らされている領域が非常に少なく、残りの領域が暗い場合には、仮想光源のみで明るさを補正することが難しい場合がある。この場合には、ストロボやビデオライトなどの他の照明を発光して画像全体の明るさを一律に明るくした後、仮想光源を用いたリライティング処理を行うようにすれば良い。このようにすることで、仮想光源を用いたリライティング処理によって、著しくノイズが増幅されることを防ぎながら、好ましい画像となるよう補正することが可能となる。 Furthermore, in the above description, when correcting the brightness of an image by relighting, the method of correcting using only a virtual light source has been described. However, the present invention limits the brightness correction method to the case of using only a virtual light source. It does not do. For example, when there are very few areas brightly illuminated by ambient light and the remaining areas are dark, it may be difficult to correct the brightness using only the virtual light source. In this case, it is only necessary to emit the other illumination such as a strobe or a video light to uniformly brighten the entire image, and then perform the relighting process using the virtual light source. By doing so, it becomes possible to correct a preferable image while preventing the noise from being remarkably amplified by the relighting process using the virtual light source.
また、上述の説明では、リライティングによって画像の明るさを補正する場合に、処理対象の画素値に対して仮想光源の照射により生じる画素値の変化を加算する方法を説明したが、補正方法は加算する方法に限定されない。例えば、環境光によって生じた被写体の陰影の状態を目標とする状態に近づけるよう、処理対象の画素値を減算するようにしてもよい。あるいは、一部の処理対象は画素値を加算し、一部の処理対象は画素値を減算するようにしてもよい。すなわち、被写体の陰影の状態を目標とする陰影の状態とすることを目的としてリライティング処理を行うのであれば、仮想光源の照射により画像の明るさが明るくならなくてもよい。 Further, in the above description, when correcting the brightness of an image by rewriting, a method of adding a change in pixel value caused by irradiation of a virtual light source to a pixel value to be processed has been described. The method is not limited to this. For example, the pixel value to be processed may be subtracted such that the state of the shadow of the subject caused by the ambient light approaches the target state. Alternatively, some processing targets may add pixel values, and some processing targets may subtract pixel values. That is, if the relighting process is performed for the purpose of setting the state of the shadow of the subject to the state of the target shadow, the image does not have to be brightened by the irradiation of the virtual light source.
また、本発明は、以下の処理を実行することによっても実現される。即ち、上述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(またはCPUやMPU等)がプログラムを読み出して実行する処理である。 The present invention is also realized by executing the following processing. That is, software (program) that realizes the functions of the above-described embodiments is supplied to a system or apparatus via a network or various storage media, and a computer (or CPU, MPU, or the like) of the system or apparatus reads the program and reads the program. This is the process to be performed.
50…システム制御部、103…撮像部、105…画像処理部、207…陰影状態検出部、208…特性決定部、205…輝度補正部 Reference numeral 50: system control unit, 103: imaging unit, 105: image processing unit, 207: shadow state detection unit, 208: characteristic determination unit, 205: luminance correction unit
Claims (16)
前記撮影画像の一部領域の陰影の度合いを判断する判断手段と、
前記撮影画像に対する仮想的な光源である仮想光源のパラメータを設定する設定手段と、
前記設定手段により設定されたパラメータに基づき、前記撮影画像に前記仮想光源からの仮想光が照射された効果を付加する補正手段と、を有し、
前記補正手段は、複数の仮想光源を組み合わせて前記仮想光が照射された効果を付加する補正が可能であって、
前記設定手段は、前記判断手段により検出された陰影の度合いに基づき、前記複数の仮想光源のパラメータの組み合わせを設定することで、前記撮影画像に照射される前記仮想光の拡散特性を変化させることを特徴とする画像処理装置。 Acquisition means for acquiring a captured image;
Determining means for determining the degree of shading of the partial region of the captured image,
Setting means for setting parameters of a virtual light source that is a virtual light source for the captured image,
Correction means for adding an effect of irradiating the virtual light from the virtual light source to the captured image based on the parameters set by the setting means,
The correction means is capable of performing a correction to add an effect of irradiating the virtual light by combining a plurality of virtual light sources,
The setting unit changes a diffusion characteristic of the virtual light emitted to the captured image by setting a combination of parameters of the plurality of virtual light sources based on a degree of shading detected by the determining unit. An image processing apparatus characterized by the above-mentioned.
前記判断手段により判断された前記陰影の度合いが前記第1の度合いよりも強い第2の度合いである場合、前記設定手段は、前記撮影画像に前記第1の拡散特性よりも拡散度合いの大きい第2の拡散特性の仮想光が照射される前記複数の仮想光源のパラメータの組み合わせを設定することを特徴とする請求項1乃至7のいずれか1項に記載の画像処理装置。 If the degree of the shadow is determined by the determining means is a first degree, the setting means the combination of the parameters of the first virtual light before Symbol plurality of virtual light sources that will be irradiated in the diffusion properties on the captured image And set
When the degree of the shadow determined by the determining means is a second degree that is stronger than the first degree, the setting means sets a second degree of diffusion larger than the first diffusion characteristic in the captured image. the image processing apparatus according to any one of claims 1 to 7 virtual light second diffusion characteristic and sets a combination of parameters of the previous SL plurality of virtual light sources that will be illuminated.
前記設定手段は、前記判断手段により判断された前記陰影の度合いに基づき、前記一部領域の陰影の度合いが弱まるよう、前記仮想光源のパラメータを設定することを特徴とする請求項1乃至8のいずれか1項に記載の画像処理装置。 The image processing apparatus further includes a determination unit configured to determine a degree of shading of a partial region of the captured image,
The setting means, based on the degree of the shadow is determined by the determining means, so that the degree of shading of the partial region is weakened, according to claim 1 to 8, characterized in that to set the parameters of the virtual light source The image processing device according to claim 1.
前記撮影画像に対する仮想的な光源である仮想光源のパラメータを設定する設定手段と、
前記設定手段により設定されたパラメータに基づき、前記撮影画像に前記仮想光源からの仮想光が照射された効果を付加する補正手段と、を有し、
前記設定手段は、前記仮想光源における仮想光の照射面の曲率を設定可能であり、前記仮想光の曲率の大きさを変化させることで、前記撮影画像に照射される前記仮想光の拡散特性を変化させることを特徴とする画像処理装置。 Acquisition means for acquiring a captured image;
Setting means for setting parameters of a virtual light source that is a virtual light source for the captured image,
Correction means for adding an effect of irradiating the virtual light from the virtual light source to the captured image based on the parameters set by the setting means,
The setting unit is capable of setting a curvature of a virtual light irradiation surface of the virtual light source, and changing a magnitude of a curvature of the virtual light to change a diffusion characteristic of the virtual light irradiated on the captured image. An image processing device characterized by changing.
判断手段が、前記撮影画像の一部領域の陰影の度合いを判断する判断工程と、
設定手段が、前記撮影画像に対する仮想的な光源である仮想光源のパラメータを設定する設定工程と、
補正手段が、前記設定工程において設定されたパラメータに基づき、前記撮影画像に前記仮想光源からの仮想光が照射された効果を付加する補正工程と、を有し、
前記補正工程では、複数の仮想光源を組み合わせて前記仮想光が照射された効果を付加する補正が可能であって、
前記設定工程では、前記判断手段により検出された陰影の度合いに基づき、前記複数の仮想光源のパラメータの組み合わせを設定することで、前記撮影画像に照射される前記仮想光の拡散特性を変化させることを特徴とする画像処理装置の制御方法。 Acquiring means for acquiring a captured image,
Determining means for determining the degree of shading of a partial region of the captured image;
Setting means for setting parameters of a virtual light source that is a virtual light source for the captured image;
Correction means, based on the parameters set in the setting step, a correction step of adding an effect of irradiating the virtual light from the virtual light source to the captured image,
In the correction step, it is possible to perform correction to add the effect of irradiating the virtual light by combining a plurality of virtual light sources,
In the setting step, a diffusion characteristic of the virtual light emitted to the photographed image is changed by setting a combination of parameters of the plurality of virtual light sources based on a degree of shading detected by the determination unit. A method for controlling an image processing apparatus, comprising:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2018184977A JP6675461B2 (en) | 2018-09-28 | 2018-09-28 | Image processing apparatus, control method therefor, and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2018184977A JP6675461B2 (en) | 2018-09-28 | 2018-09-28 | Image processing apparatus, control method therefor, and program |
Related Parent Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2014197512A Division JP6412386B2 (en) | 2014-09-26 | 2014-09-26 | Image processing apparatus, control method therefor, program, and recording medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2019003694A JP2019003694A (en) | 2019-01-10 |
| JP6675461B2 true JP6675461B2 (en) | 2020-04-01 |
Family
ID=65008029
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2018184977A Active JP6675461B2 (en) | 2018-09-28 | 2018-09-28 | Image processing apparatus, control method therefor, and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP6675461B2 (en) |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2003216970A (en) * | 2002-01-23 | 2003-07-31 | Canon Inc | Three-dimensional image processing device, three-dimensional image processing system, three-dimensional image processing method, and three-dimensional image processing program |
| JP2007148567A (en) * | 2005-11-24 | 2007-06-14 | Canon Inc | Image processing method and image processing apparatus |
| JP5147287B2 (en) * | 2006-05-23 | 2013-02-20 | パナソニック株式会社 | Image processing apparatus, image processing method, program, recording medium, and integrated circuit |
| JP2009053748A (en) * | 2007-08-23 | 2009-03-12 | Nikon Corp | Image processing apparatus, image processing program, and camera |
| JP5088220B2 (en) * | 2008-04-24 | 2012-12-05 | カシオ計算機株式会社 | Image generating apparatus and program |
| JP5281878B2 (en) * | 2008-12-03 | 2013-09-04 | オリンパスイメージング株式会社 | IMAGING DEVICE, LIGHTING PROCESSING DEVICE, LIGHTING PROCESSING METHOD, AND LIGHTING PROCESSING PROGRAM |
| JP5715778B2 (en) * | 2010-07-16 | 2015-05-13 | 東芝アルパイン・オートモティブテクノロジー株式会社 | Image display device for vehicle |
-
2018
- 2018-09-28 JP JP2018184977A patent/JP6675461B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2019003694A (en) | 2019-01-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR101861153B1 (en) | Image processing apparatus and control method thereof | |
| JP6412386B2 (en) | Image processing apparatus, control method therefor, program, and recording medium | |
| WO2019072190A1 (en) | Image processing method, electronic apparatus, and computer readable storage medium | |
| JP6833415B2 (en) | Image processing equipment, image processing methods, and programs | |
| JP6381404B2 (en) | Image processing apparatus and method, and imaging apparatus | |
| JP7292905B2 (en) | Image processing device, image processing method, and imaging device | |
| JP7114335B2 (en) | IMAGE PROCESSING DEVICE, CONTROL METHOD FOR IMAGE PROCESSING DEVICE, AND PROGRAM | |
| JP6718253B2 (en) | Image processing apparatus and image processing method | |
| US11115637B2 (en) | Image processing apparatus, image capturing apparatus, image processing method, and storage medium | |
| JP2017138927A (en) | Image processing device, imaging apparatus, control method and program thereof | |
| JP6702752B2 (en) | Image processing device, imaging device, control method, and program | |
| JP2021128791A (en) | Image processing apparatus, image processing method, and program | |
| US10863103B2 (en) | Setting apparatus, setting method, and storage medium | |
| JP7059076B2 (en) | Image processing device, its control method, program, recording medium | |
| JP6663246B2 (en) | Image processing apparatus, imaging apparatus, control method thereof, and program | |
| JP2019145097A (en) | Setting device and method, program, and storage medium | |
| JP6675461B2 (en) | Image processing apparatus, control method therefor, and program | |
| JP2018182700A (en) | IMAGE PROCESSING APPARATUS, CONTROL METHOD THEREOF, PROGRAM, AND STORAGE MEDIUM | |
| JP2021170222A (en) | Image processing equipment and methods, programs, storage media | |
| JP6921606B2 (en) | Image processing equipment, image processing methods and programs | |
| JP7398939B2 (en) | Image processing device and its control method, imaging device, program, and storage medium | |
| JP2021087125A (en) | Image processing device, control method thereof, and program | |
| JP2018098744A (en) | Image processing apparatus and image processing method | |
| JP2016091376A (en) | Image processor and control method thereof, program and recording medium | |
| JP7356255B2 (en) | Image processing device and its processing method, imaging device, program, storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20181029 |
|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20181029 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20190920 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20190930 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20191129 |
|
| 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: 20200210 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20200310 |
|
| R151 | Written notification of patent or utility model registration |
Ref document number: 6675461 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |