JP7311995B2 - IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM - Google Patents

IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM Download PDF

Info

Publication number
JP7311995B2
JP7311995B2 JP2019061357A JP2019061357A JP7311995B2 JP 7311995 B2 JP7311995 B2 JP 7311995B2 JP 2019061357 A JP2019061357 A JP 2019061357A JP 2019061357 A JP2019061357 A JP 2019061357A JP 7311995 B2 JP7311995 B2 JP 7311995B2
Authority
JP
Japan
Prior art keywords
information
color
image processing
subject
light source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2019061357A
Other languages
Japanese (ja)
Other versions
JP2020160945A (en
Inventor
遥平 豊原
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2019061357A priority Critical patent/JP7311995B2/en
Publication of JP2020160945A publication Critical patent/JP2020160945A/en
Application granted granted Critical
Publication of JP7311995B2 publication Critical patent/JP7311995B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Processing Of Color Television Signals (AREA)
  • Image Analysis (AREA)

Description

本発明は、入力された画像に、仮想的な光源の影響を反映させる画像処理装置に関するものである。 The present invention relates to an image processing apparatus that reflects the influence of a virtual light source on an input image.

従来より、撮影後の画像中の被写体に対して、仮想的な光源からの光を照射し、リライティングを行う技術が知られている。これにより、ユーザーは、画像中の被写体に任意の陰影の付与、ならびに仮想光源色の付与を行うことができる。 2. Description of the Related Art Conventionally, there has been known a technique of performing relighting by irradiating light from a virtual light source to a subject in an image after photographing. This allows the user to add arbitrary shadows and virtual light source colors to the subject in the image.

例えば、特許文献1では、被写体の陰影情報を解析し、あらかじめ定めた目標条件を満たすように、照射する仮想光源の向きを定めている。これにより、ユーザーが直接仮想光源の向きを指定することなく、自動的にあらかじめ定めた条件に合う陰影を持つ被写体の画像を得ることができる。 For example, in Patent Document 1, shadow information of a subject is analyzed, and the direction of a virtual light source for irradiation is determined so as to satisfy a predetermined target condition. This makes it possible to automatically obtain an image of a subject having shadows that match predetermined conditions without the user having to directly specify the direction of the virtual light source.

特開2016-72692号公報JP 2016-72692 A

しかしながら、特許文献1に記載のリライティング手法では、予め定められた光源色の仮想光源を照射することしかできなかった。例えば撮影した画像中の被写体に、複数の、それぞれ色の異なる光源から光が照射されている場合、被写体は複数の色が混ざり合った状態になり、その中の特定の色の光源から照射された光によって被写体の印象が悪くなることがある。このような例のように、被写体の領域ごとに色味が異なる場合に、特許文献1に記載の技術では対応することができない。 However, in the relighting method described in Patent Document 1, only a virtual light source with a predetermined light source color can be applied. For example, if a subject in a photographed image is illuminated by multiple light sources of different colors, the subject will be in a state where multiple colors are mixed, and the subject will be illuminated by a light source of a specific color. The bright light may give a bad impression of the subject. As in such an example, the technique described in Japanese Patent Application Laid-Open No. 2002-200013 cannot handle the case where the color tone differs for each area of the subject.

本発明は上述した課題に鑑みてなされたものであり、その目的は、例えば色の異なる複数の環境光源下で撮影された被写体を、好ましい印象に補正することができる画像処理装置を提供することである。 SUMMARY OF THE INVENTION The present invention has been made in view of the problems described above, and its object is to provide an image processing apparatus capable of correcting a subject photographed under a plurality of environmental light sources having different colors so as to have a favorable impression. is.

本発明に係わる画像処理装置は、入力画像から被写体を選択する選択手段と、選択した前記被写体の色情報を取得する色情報取得手段と、選択した前記被写体の立体形状情報を取得する形状情報取得手段と、選択した前記被写体について目標とする色情報を取得する目標色取得手段と、選択した前記被写体に対し、仮想光源からの光を加算または減算する補正を行う補正手段と、前記補正手段による補正を行う場合に、補正した前記被写体の色情報が前記目標とする色情報に近づくように、前記立体形状情報を用いて前記仮想光源の少なくとも色と向きとを設定する設定手段と、を備え、前記設定手段は、前記目標とする色情報に基づいて、前記仮想光源の強度をさらに設定し、前記立体形状情報は、前記被写体の表面に対する法線方向の情報である法線情報であり、前記設定手段は、前記被写体における画素ごとに、前記法線情報と前記色情報とを取得し、各画素の色情報に応じて各画素の法線情報に重みをつけた情報に基づいて、前記仮想光源の向きを設定することを特徴とする。 An image processing apparatus according to the present invention comprises selection means for selecting a subject from an input image, color information acquisition means for acquiring color information on the selected subject, and shape information acquisition for acquiring three-dimensional shape information on the selected subject. target color acquisition means for acquiring target color information for the selected subject; correction means for performing correction by adding or subtracting light from a virtual light source to the selected subject; and setting means for setting at least the color and orientation of the virtual light source using the three-dimensional shape information so that the corrected color information of the subject approaches the target color information when correction is performed. , the setting means further sets the intensity of the virtual light source based on the target color information , and the three-dimensional shape information is normal information that is information of a normal direction to the surface of the subject; The setting means acquires the normal line information and the color information for each pixel in the subject, and based on the information obtained by weighting the normal line information of each pixel according to the color information of each pixel, determines the It is characterized by setting the direction of the virtual light source .

本発明によれば、例えば色の異なる複数の環境光源下で撮影された被写体を、好ましい印象に補正することが可能となる。 According to the present invention, it is possible to correct a subject photographed under, for example, a plurality of environmental light sources with different colors so that the subject has a favorable impression.

本発明の画像処理装置の一実施形態であるデジタルカメラの構成を示すブロック図。1 is a block diagram showing the configuration of a digital camera that is an embodiment of the image processing apparatus of the present invention; FIG. 一実施形態のデジタルカメラの画像処理部の構成を示すブロック図。FIG. 2 is a block diagram showing the configuration of the image processing section of the digital camera of one embodiment; 一実施形態におけるリライティング処理部の構成を示すブロック図。FIG. 3 is a block diagram showing the configuration of a relighting processing unit according to one embodiment; 一実施形態におけるリライティングによる反射成分の演算を示す図。FIG. 4 is a diagram showing calculation of reflection components by relighting in one embodiment; 一実施形態における仮想光源情報算出部の処理を示すフローチャート。4 is a flow chart showing processing of a virtual light source information calculation unit in one embodiment.

以下、添付図面を参照して実施形態を詳しく説明する。なお、以下の実施形態は特許請求の範囲に係る発明を限定するものではない。実施形態には複数の特徴が記載されているが、これらの複数の特徴の全てが発明に必須のものとは限らず、また、複数の特徴は任意に組み合わせられてもよい。さらに、添付図面においては、同一若しくは同様の構成に同一の参照番号を付し、重複した説明は省略する。 Hereinafter, embodiments will be described in detail with reference to the accompanying drawings. In addition, the following embodiments do not limit the invention according to the scope of claims. Although multiple features are described in the embodiments, not all of these multiple features are essential to the invention, and multiple features may be combined arbitrarily. Furthermore, in the accompanying drawings, the same or similar configurations are denoted by the same reference numerals, and redundant description is omitted.

図1は、本発明の画像処理装置の一実施形態であるデジタルカメラ100の構成を示すブロック図である。 FIG. 1 is a block diagram showing the configuration of a digital camera 100 which is an embodiment of the image processing apparatus of the invention.

本実施形態におけるデジタルカメラ100は、光学系101、撮像素子102、A/D変換部103、画像処理部104、測距部105、顔検出部106、記録部107、制御部108、メモリ109、操作部110、表示部111を備える。光学系101にはフォーカスレンズや絞り、シャッターが含まれる。光学系101は、撮影時には、フォーカスレンズを駆動し被写体のピント合わせを行うとともに、絞りやシャッターを制御することにより露光量の調節を行う。撮像素子102は、光学系101により結像された被写体像を光電変換によってアナログの電気信号に変換するCCDやCMOSセンサ等からなる。 The digital camera 100 in this embodiment includes an optical system 101, an image sensor 102, an A/D conversion unit 103, an image processing unit 104, a distance measurement unit 105, a face detection unit 106, a recording unit 107, a control unit 108, a memory 109, An operation unit 110 and a display unit 111 are provided. The optical system 101 includes a focus lens, diaphragm, and shutter. The optical system 101 drives a focus lens to focus an object and adjusts the amount of exposure by controlling an aperture and a shutter during photographing. The imaging device 102 is composed of a CCD, a CMOS sensor, or the like that converts an object image formed by the optical system 101 into an analog electric signal by photoelectric conversion.

A/D変換部103は、入力されたアナログの電気信号をデジタル信号に変換する。デジタル信号に変換された画像信号は、画像処理部104において、同時化処理、ホワイトバランス補正処理、合焦度算出処理、リライティング処理、ガンマ処理などが施され、記録部107に出力される。測距部105は、撮影時の被写体までの距離情報を取得し、距離マップを生成する。距離マップとは、撮影した画像の画素単位での被写体までの距離情報を示す二次元配列情報である。 The A/D converter 103 converts the input analog electric signal into a digital signal. The image signal converted into a digital signal is subjected to synchronization processing, white balance correction processing, focus degree calculation processing, relighting processing, gamma processing, etc. in the image processing unit 104 and output to the recording unit 107 . A distance measuring unit 105 acquires distance information to a subject at the time of shooting and generates a distance map. A distance map is two-dimensional array information indicating distance information to a subject in units of pixels of a photographed image.

顔検出部106は、画像処理部104で行うリライティング処理の被写体領域を決めるため、撮影画像中の人物の顔領域を検出する。この時、右目、左目、口などの顔器官の座標を検出し、右目と左目の距離など各顔器官同士の距離を算出する。その各顔器官同士の距離に基づいて、背景領域を含まないように、各器官の座標の重心座標を中心とする楕円領域を設定し、それを顔領域として検出する。記録部107は、画像処理部104から出力された画像信号をJPEG等の形式に変換し、記録する。 A face detection unit 106 detects a person's face area in a captured image in order to determine a subject area for relighting processing performed by the image processing unit 104 . At this time, the coordinates of the facial features such as the right eye, the left eye, and the mouth are detected, and the distance between the facial features, such as the distance between the right eye and the left eye, is calculated. Based on the distance between each facial organ, an elliptical area centered on the barycentric coordinates of each organ is set so as not to include the background area, and is detected as a facial area. A recording unit 107 converts the image signal output from the image processing unit 104 into a format such as JPEG and records the converted signal.

制御部108は、本実施形態の撮像装置100全体の動作制御を行う。例えば、撮影直前の被写体の明るさから、目標とする露光量を算出する。他にも、撮影した画像に基づいて所定の評価値を算出し、画像処理部104で行う画像処理のパラメータを決定する。メモリ109は、画像処理部104で用いる情報ならびに撮影時の設定や照明条件などが記憶されており、必要に応じて画像処理部104にその情報を出力する。操作部110は、ユーザーが撮像装置に対し操作指示を行うスイッチなどの複数の部材を有する。表示部111は、例えばカメラ背面に設置された液晶ディスプレイ等であり、撮影時の操作の補助を行うための画面や、記録部107に保存されている画像等を表示する。 The control unit 108 controls the operation of the entire imaging apparatus 100 of this embodiment. For example, the target exposure amount is calculated from the brightness of the subject immediately before shooting. In addition, a predetermined evaluation value is calculated based on the captured image, and parameters for image processing performed by the image processing unit 104 are determined. A memory 109 stores information used by the image processing unit 104 as well as settings and illumination conditions at the time of shooting, and outputs the information to the image processing unit 104 as necessary. The operation unit 110 has a plurality of members such as switches with which the user gives operation instructions to the imaging device. A display unit 111 is, for example, a liquid crystal display or the like installed on the rear surface of the camera, and displays a screen for assisting operations during shooting, images stored in the recording unit 107, and the like.

図2は、本実施形態における画像処理部104の構成を示すブロック図である。画像処理部104は、同時化処理部201、ホワイトバランス補正処理部202、リライティング処理部203、ガンマ処理部204を備える。 FIG. 2 is a block diagram showing the configuration of the image processing unit 104 in this embodiment. The image processing unit 104 includes a synchronization processing unit 201 , a white balance correction processing unit 202 , a relighting processing unit 203 and a gamma processing unit 204 .

画像処理部104の処理の流れについて説明する。A/D変換部103でデジタル信号に変換された、ベイヤー配列の映像信号が画像処理部104に入力される。画像処理部104に入力された映像信号は同時化処理部201に入力され、入力されたベイヤー配列のRGB信号に対して同時化処理が行われ、色信号R,G,Bが生成される。生成されたR,G,Bの色信号はホワイトバランス補正処理部202に入力され、制御部107が算出したホワイトバランスゲイン値に基づいてRGBの色信号にゲインがかけられ、ホワイトバランスが調整される。 A processing flow of the image processing unit 104 will be described. A video signal in the Bayer array converted into a digital signal by the A/D conversion unit 103 is input to the image processing unit 104 . The image signal input to the image processing unit 104 is input to the synchronization processing unit 201, and the input Bayer array RGB signals are subjected to synchronization processing to generate color signals R, G, and B. FIG. The generated R, G, and B color signals are input to the white balance correction processing unit 202, gains are applied to the RGB color signals based on the white balance gain values calculated by the control unit 107, and the white balance is adjusted. be.

ホワイトバランスが調整された色信号RGBはリライティング処理部203に出力される。リライティング処理部203では、ホワイトバランス補正処理部202から色信号RGB、測距部105から距離マップD_MAP、顔検出部106から画像内の顔の座標や大きさを示した情報を受ける。そして、色信号R,G,Bに対して、仮想光源を照射した画像を生成し、処理後の色信号R_out,G_out,B_outをガンマ処理部204に出力する。ガンマ処理部204は、リライティング処理後の信号R_out,G_out,B_outが入力され、入力された信号にガンマ処理を施し、ガンマ処理後の色信号Rg,Gg,Bgを記録部107に出力する。 The color signals RGB whose white balance has been adjusted are output to the relighting processing unit 203 . The relighting processing unit 203 receives color signals RGB from the white balance correction processing unit 202 , distance map D_MAP from the distance measurement unit 105 , and information indicating the coordinates and size of the face in the image from the face detection unit 106 . Then, an image is generated by illuminating the color signals R, G, and B with a virtual light source, and the processed color signals R_out, G_out, and B_out are output to the gamma processing unit 204 . The gamma processing unit 204 receives the signals R_out, G_out, and B_out after the relighting process, performs gamma processing on the input signals, and outputs color signals Rg, Gg, and Bg after the gamma processing to the recording unit 107 .

続いて、図3はリライティング処理部203の構成を示すブロック図である。 Next, FIG. 3 is a block diagram showing the configuration of the relighting processing unit 203. As shown in FIG.

リライティング処理部203は、法線取得部301、仮想光源情報算出部302、仮想光源拡散反射成分算出部303、仮想光源付加処理部304を備える。リライティング処理部203には、測距部105から距離情報が入力され、ホワイトバランス補正処理部202から色信号R,G,Bが入力され、顔検出部106から顔領域情報が入力される。 The relighting processing unit 203 includes a normal acquisition unit 301 , a virtual light source information calculation unit 302 , a virtual light source diffuse reflection component calculation unit 303 , and a virtual light source addition processing unit 304 . The relighting processing unit 203 receives distance information from the distance measurement unit 105 , color signals R, G, and B from the white balance correction processing unit 202 , and face area information from the face detection unit 106 .

法線取得部301は、顔検出部106から入力された顔座標位置における被写体の表面の法線方向を取得する。本実施形態では、法線取得部301は、測距部105で計測した距離情報を参照し、被写体領域の法線情報を算出する(立体形状情報取得)。このようにして取得した法線情報Nを仮想光源情報算出部302と、仮想光源拡散反射成分算出部303へ出力する。 The normal acquisition unit 301 acquires the normal direction of the surface of the subject at the face coordinate position input from the face detection unit 106 . In the present embodiment, the normal obtaining unit 301 refers to the distance information measured by the distance measuring unit 105 and calculates the normal information of the subject area (acquisition of three-dimensional shape information). The normal information N obtained in this manner is output to the virtual light source information calculation unit 302 and the virtual light source diffuse reflection component calculation unit 303 .

仮想光源情報算出部302には、ホワイトバランス処理部202からの色信号R,G,B(色情報取得)と、法線取得部301からの法線Nの情報が入力される。仮想光源情報算出部302は、後述する手法により、仮想光源の向きを示す3次元方向ベクトルL、仮想光源照射強度を示すα、光源色成分Rw,Gw,Bwを算出し、仮想光源拡散反射成分算出部303へ出力する。 The virtual light source information calculation unit 302 receives the color signals R, G, and B (color information acquisition) from the white balance processing unit 202 and the normal line N information from the normal line acquisition unit 301 . The virtual light source information calculation unit 302 calculates a three-dimensional direction vector L indicating the orientation of the virtual light source, α indicating the irradiation intensity of the virtual light source, light source color components Rw, Gw, and Bw by a method described later, and calculates the virtual light source diffuse reflection component Output to the calculation unit 303 .

仮想光源拡散反射成分算出部303は、拡散反射成分Rd,Gd,Bdを算出する。拡散反射成分の求め方について、図4を用いて説明する。 The virtual light source diffuse reflection component calculator 303 calculates diffuse reflection components Rd, Gd, and Bd. A method of obtaining the diffuse reflection component will be described with reference to FIG.

図4は撮影時のデジタルカメラ100、被写体401、仮想光源402の位置関係と、仮想光源の反射特性を示した図である。 FIG. 4 is a diagram showing the positional relationship among the digital camera 100, the subject 401, and the virtual light source 402 at the time of photographing, and the reflection characteristics of the virtual light source.

カメラ100で撮影された撮影画像の水平画素位置H1(垂直画素位置は説明を分かりやすくするために省略)における拡散反射成分は、カメラ座標H1における法線N1と仮想光源の方向ベクトルL1の内積に比例し、仮想光源と被写体位置の距離K1の二乗に反比例する値となる。仮想光源による拡散反射成分強度Pdは(式1)で表すことができ、色ごとの拡散反射成分Rd,Gd,Bdは(式2)で表すことができる。 The diffuse reflection component at the horizontal pixel position H1 (the vertical pixel position is omitted for the sake of clarity) of the captured image captured by the camera 100 is the inner product of the normal N1 at the camera coordinates H1 and the direction vector L1 of the virtual light source. It becomes a value proportional to the square of the distance K1 between the virtual light source and the object position. The diffuse reflection component intensity Pd by the virtual light source can be expressed by (Equation 1), and the diffuse reflection components Rd, Gd, and Bd for each color can be expressed by (Equation 2).

Figure 0007311995000001
Figure 0007311995000001

Rd=Pd×Rw×R
Gd=Pd×Gw×G
Bd=Pd×Bw×B …(式2)
ここで、(式1)におけるNは被写体の3次元法線ベクトル、Kは仮想光源と被写体の距離である。kdは被写体の拡散反射率である。α、Lはそれぞれ仮想光源情報算出部302から入力された仮想光源の強さ、仮想光源の3次元方向ベクトルである。また(式2)におけるR,G,Bはホワイトバランス補正処理部202から入力された色信号R,G,Bである。Rw,Gw,Bwは仮想光源の色を示すパラメータである。これらパラメータの算出方法は後述する。
Rd = Pd x Rw x R
Gd = Pd x Gw x G
Bd=Pd×Bw×B (Formula 2)
Here, N in (Equation 1) is the three-dimensional normal vector of the subject, and K is the distance between the virtual light source and the subject. kd is the diffuse reflectance of the object. α and L are the intensity of the virtual light source input from the virtual light source information calculation unit 302 and the three-dimensional directional vector of the virtual light source, respectively. Also, R, G, and B in (Equation 2) are the color signals R, G, and B input from the white balance correction processing unit 202 . Rw, Gw, and Bw are parameters indicating the color of the virtual light source. A method of calculating these parameters will be described later.

仮想光源付加処理部304は、仮想光源拡散反射成分算出部303で算出した拡散反射成分Rd,Gd,Bdを入力色信号R,G,Bに付加する処理を行う。仮想光源照射後色信号R_out,G_out,B_outは(式3)のように表すことができる。 A virtual light source addition processing unit 304 performs processing for adding the diffuse reflection components Rd, Gd, and Bd calculated by the virtual light source diffuse reflection component calculation unit 303 to the input color signals R, G, and B. FIG. Color signals R_out, G_out, and B_out after irradiation with a virtual light source can be expressed as in (Equation 3).

R_out=R+Rd
G_out=G+Gd
B_out=B+Bd …(式3)
このように算出した仮想光源照射後色信号R_out,G_out,B_outを
ガンマ処理部205へ出力する。
R_out = R + Rd
G_out=G+Gd
B_out=B+Bd (Formula 3)
The post-irradiation color signals R_out, G_out, and B_out calculated in this manner are output to the gamma processing unit 205 .

次に、図5は仮想光源情報算出部302の処理を示すフローチャートである。 Next, FIG. 5 is a flowchart showing processing of the virtual light source information calculation unit 302. As shown in FIG.

S501において、仮想光源情報算出部302は、顔検出部106から顔検出情報を、ホワイトバランス補正処理部202から入力画像の色信号R,G,Bを、法線取得部301から顔領域法線情報を取得する。 In step S<b>501 , the virtual light source information calculation unit 302 receives face detection information from the face detection unit 106 , color signals R, G, and B of the input image from the white balance correction processing unit 202 , and the face area normal from the normal acquisition unit 301 . Get information.

S502において、顔検出部106から取得した顔領域内における目標とする肌色である補正目標色Rt,Gt,Btを算出する(目標色取得)。補正目標色Rt,Gt,Btは、たとえば、顔領域内の色信号R,G,Bそれぞれの平均値であるが、この他にも、顔領域内の色信号R,G,Bそれぞれの中央値や最頻値といった統計的に処理した値を用いることができる。 In S502, correction target colors Rt, Gt, and Bt, which are target skin colors in the face area acquired from the face detection unit 106, are calculated (target color acquisition). The correction target colors Rt, Gt, and Bt are, for example, the average values of the color signals R, G, and B in the face area. Statistically processed values such as values and modes can be used.

S503において、顔検出部106から取得した顔領域内における補正対象色Rs,Gs,Bsを取得する。ここで補正対象色Rs,Gs,Bsは撮影時の環境光源下での肌色のバランスを示すものであり、Rs+Gs+Bs=1の関係を満たすものとする。補正対象色Rs,Gs,Bsは、補正対象となる光源色が既知である場合、予めメモリ109に格納された既知光源色の値を参照することにより取得する。補正対象となる光源色はメモリ109に格納された撮影時の照明条件を参照すること、もしくは操作部110でユーザーから色の入力を受けることで知ることができる。 In S503, the correction target colors Rs, Gs, and Bs in the face area obtained from the face detection unit 106 are obtained. Here, the correction target colors Rs, Gs, and Bs indicate the balance of the skin color under the environmental light source at the time of photographing, and satisfy the relationship Rs+Gs+Bs=1. When the light source colors to be corrected are known, the correction target colors Rs, Gs, and Bs are obtained by referring to the known light source color values stored in advance in the memory 109 . The light source color to be corrected can be known by referring to the lighting conditions at the time of shooting stored in the memory 109 or by receiving a color input from the user through the operation unit 110 .

補正対象となる光源が未知の場合は、顔検出部106から取得した顔領域内の各画素の色信号R,G,Bのうち、補正目標色Rt,Gt,Btから最も異なる色信号R,G,Bに基づいて(式4)のように定める。(式4)におけるRe,Ge,Beとは、顔領域内の色信号R,G,Bのうち、補正目標色Rt,Gt,Btと最も異なる色信号R,G,Bの値である。色信号同士の比較方法は公知の方法であり、たとえば、注目画素の色信号R,G,Bと補正目標色Rt,Gt,Btのユークリッド距離が最も大きくなる画素の色信号R,G,Bの値をRe,Ge,Beとすればよい。 If the light source to be corrected is unknown, among the color signals R, G, and B of each pixel in the face region acquired from the face detection unit 106, the color signals R, G, and B that are most different from the correction target colors Rt, Gt, and Bt. Based on G and B, it is determined as in (Equation 4). Re, Ge, and Be in (Equation 4) are the values of the color signals R, G, and B that are most different from the correction target colors Rt, Gt, and Bt among the color signals R, G, and B in the face area. A method for comparing the color signals is a known method. should be set to Re, Ge, and Be.

Rs=Re/(Re+Ge+Be)
Gs=Ge/(Re+Ge+Be)
Bs=Be/(Re+Ge+Be) …(式4)
S504において、各画素の補正対象色重みCwを取得する。補正対象色重みCwは、各画素の色信号R,G,Bが補正対象色Rs,Gs,Bsの成分をどれだけ有しているかを示す値であり、(式5)のように表す。(式5)は注目画素の色信号R,G,Bと補正対象色Rs,Gs,Bsの内積値を補正対象色重みCwとすることを示している。
Rs=Re/(Re+Ge+Be)
Gs=Ge/(Re+Ge+Be)
Bs=Be/(Re+Ge+Be) (Formula 4)
In S504, the correction target color weight Cw of each pixel is acquired. The correction target color weight Cw is a value that indicates how much the color signals R, G, and B of each pixel have the components of the correction target colors Rs, Gs, and Bs, and is expressed as in (Equation 5). (Equation 5) indicates that the inner product value of the color signals R, G, B of the target pixel and the correction target colors Rs, Gs, Bs is used as the correction target color weight Cw.

Cw=R×Rs+G×Gs+B×Bs …(式5)
S505において、仮想光源の照射方向ベクトルLを算出する。仮想光源の照射ベクトルLは(式6)のように表す。(式6)は顔検出部106から取得した顔領域内の各画素1~mの法線ベクトルN1~Nmを各画素の補正対象色重みCw1~Cwmを重みとする加算平均で得られる方向ベクトルを仮想光源の照射ベクトルLとすることを示している。
Cw=R×Rs+G×Gs+B×Bs (Formula 5)
In S505, the irradiation direction vector L of the virtual light source is calculated. The irradiation vector L of the virtual light source is expressed as in (Equation 6). (Equation 6) is a directional vector obtained by averaging the normal vectors N1 to Nm of pixels 1 to m in the face region obtained from the face detection unit 106 using the correction target color weights Cw1 to Cwm of each pixel. is the irradiation vector L of the virtual light source.

Figure 0007311995000002
Figure 0007311995000002

S506において、仮想光源の強度αを算出する。仮想光源の強度αは(式7)のように表す。(式7)は、仮想光源を照射することにより被写体を補正目標色Rt,Gt,Btに近づけるような補正強度αを算出することを目的とした式である。仮想光源の強度αは正の値と負の値の両方を持つことがあり、正の値を持つ場合は、仮想光源による光の加算効果を付与し、負の値を持つ場合は、仮想光源による光の減算効果を付与する。 In S506, the intensity α of the virtual light source is calculated. The intensity α of the virtual light source is represented by (Equation 7). (Formula 7) is a formula for the purpose of calculating the correction intensity α that brings the subject closer to the correction target colors Rt, Gt, and Bt by irradiating the virtual light source. The intensity α of the virtual light source can have both positive and negative values. Adds a light subtraction effect.

α=-1×Ct/(Cmax-Ct) …(式7)
(式7)において、Ctとは補正目標色Rt,Gt,Btが、補正対象色Rs,Gs,Bsの成分をどれだけ有しているかを示す値であり、補正目標色Rt,Gt,Btと補正対象色Rs,Gs,Bsの内積値である。Cmaxとは顔検出部106から取得した顔領域内において、補正対象色Rs,Gs,Bsの成分を多く有し、補正目標色Rt,Gt,Btから最も異なる画素のCwの値である。本実施形態では、Cmaxの値は、各画素の色信号R,G,Bと補正対象色Rs,Gs,Bsの内積値CwとCtの差分絶対値が最大となるCwの値である。これにより、Cmaxの値がCtより小さい場合、αは正の値をとり、補正目標値に近づくように仮想光源による照射効果を加算できる。また、Cmaxの値がCtより大きい場合、αは負の値をとり、補正目標に近づくように仮想光源による照射効果を減算することができる。
α = -1 × Ct / (Cmax - Ct) ... (Equation 7)
In (Equation 7), Ct is a value indicating how much the correction target colors Rt, Gt, and Bt have the components of the correction target colors Rs, Gs, and Bs. and the inner product value of the correction target colors Rs, Gs, and Bs. Cmax is the value of Cw of a pixel that has many components of the correction target colors Rs, Gs, and Bs in the face area obtained from the face detection unit 106 and is most different from the correction target colors Rt, Gt, and Bt. In this embodiment, the value of Cmax is the value of Cw that maximizes the difference absolute value between the inner product values Cw and Ct of the color signals R, G, B of each pixel and the correction target colors Rs, Gs, Bs. Accordingly, when the value of Cmax is smaller than Ct, α takes a positive value, and the irradiation effect by the virtual light source can be added so as to approach the correction target value. Also, when the value of Cmax is greater than Ct, α takes a negative value, and the illumination effect of the virtual light source can be subtracted so as to approach the correction target.

S507では、α<0か否かが判断される。α<0の場合はS508に進み、α<0でない場合はS509に進む。 In S507, it is determined whether or not α<0. If α<0, proceed to S508; otherwise, proceed to S509.

S508においては、α<0の場合の仮想光源色Rw,Gw,Bwを算出する。仮想光源色Rw,Gw,Bwは仮想光源の色バランスを示し、Rw+Gw+Bw=1となる特性を持つ。 In S508, virtual light source colors Rw, Gw, and Bw are calculated when α<0. The virtual light source colors Rw, Gw, and Bw indicate the color balance of the virtual light sources, and have the characteristic of Rw+Gw+Bw=1.

α<0の場合、仮想光源によって、補正色成分を減算することにより補正目標色に近づけるため、(式8)に示すように仮想光源色Rw,Gw,Bwは補正対象色Rs,Gs,Bsと等価でよい。 When α<0, the virtual light source colors Rw, Gw, and Bw are corrected to the correction target colors Rs, Gs, and Bs as shown in (Equation 8) because the correction target colors are approximated by subtracting the correction color components. can be equivalent to

Rw=Rs
Gw=Gs
Bw=Bs …(式8)
S509においては、α≧0の場合の仮想光源色Rw,Gw,Bwを算出する。α≧0の場合、仮想光源における照射効果を加算することにより補正目標色に近づけるため、(式9)に示すように仮想光源色Rw,Gw,Bwは補正対象色Rs,Gs,Bsと対称となる色バランスを有する。(式9)におけるMAX(Rs,Gs,Bs)とは補正対象色Rs,Gs,Bsのうち最大値を選択する関数である。
Rw = Rs
Gw = Gs
Bw=Bs (Formula 8)
In S509, virtual light source colors Rw, Gw, and Bw are calculated when α≧0. When α≧0, since the correction target color is approximated by adding the irradiation effect in the virtual light source, the virtual light source colors Rw, Gw, and Bw are symmetrical with the correction target colors Rs, Gs, and Bs as shown in (Equation 9). It has a color balance of MAX(Rs, Gs, Bs) in (Expression 9) is a function that selects the maximum value among the correction target colors Rs, Gs, and Bs.

Rw’=max(Rs,Gs,Bs)-Rs
Gw’=max(Rs,Gs,Bs)-Gs
Bw’=max(Rs,Gs,Bs)-Bs
Rw=Rw’/(Rw’+Gw’+Bw’)
Gw=Gw’/(Rw’+Gw’+Bw’)
Bw=Bw’/(Rw’+Gw’+Bw’) …(式9)
S510において、上記のように算出した仮想光源の方向ベクトルL、仮想光源の強度α、仮想光源の色Rw,Gw,Bwを仮想光源拡散反射成分算出部303へ出力する。
Rw'=max(Rs, Gs, Bs)-Rs
Gw'=max(Rs, Gs, Bs)-Gs
Bw'=max(Rs, Gs, Bs)-Bs
Rw=Rw'/(Rw'+Gw'+Bw')
Gw=Gw'/(Rw'+Gw'+Bw')
Bw=Bw'/(Rw'+Gw'+Bw') ... (Formula 9)
In S 510 , the direction vector L of the virtual light source, the intensity α of the virtual light source, and the colors Rw, Gw, and Bw of the virtual light source calculated as described above are output to the virtual light source diffuse reflection component calculator 303 .

このようにして撮影時に被写体に照射された光源の色により悪くなった印象を、好ましい印象となるように補正する仮想光源を設定することができる。 In this way, it is possible to set a virtual light source that corrects the bad impression caused by the color of the light source that illuminates the subject at the time of photographing so as to obtain a favorable impression.

なお、本実施形態では、法線情報をメモリ109から直接取得する例について説明したが、法線情報ではなくても、被写体の立体形状を示すものであればどのような情報であってもかまわない。例えば、被写体の立体形状を示す3次元のワイヤーフレーム情報であってもかまわない。この場合、ワイヤーフレームの各点の角度情報から法線情報を算出することができる。 In this embodiment, an example of directly acquiring normal line information from the memory 109 has been described. do not have. For example, it may be three-dimensional wireframe information indicating the three-dimensional shape of the subject. In this case, the normal line information can be calculated from the angle information of each point of the wire frame.

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

発明は上記実施形態に制限されるものではなく、発明の精神及び範囲から離脱することなく、様々な変更及び変形が可能である。従って、発明の範囲を公にするために請求項を添付する。 The invention is not limited to the embodiments described above, and various modifications and variations are possible without departing from the spirit and scope of the invention. Accordingly, the claims are appended to make public the scope of the invention.

100:デジタルカメラ、101:光学系、102:撮像素子、104:画像処理部、105:測距部、106:顔検出部、108:制御部 100: Digital camera, 101: Optical system, 102: Imaging element, 104: Image processing unit, 105: Distance measurement unit, 106: Face detection unit, 108: Control unit

Claims (14)

入力画像から被写体を選択する選択手段と、
選択した前記被写体の色情報を取得する色情報取得手段と、
選択した前記被写体の立体形状情報を取得する形状情報取得手段と、
選択した前記被写体について目標とする色情報を取得する目標色取得手段と、
選択した前記被写体に対し、仮想光源からの光を加算または減算する補正を行う補正手段と、
前記補正手段による補正を行う場合に、補正した前記被写体の色情報が前記目標とする色情報に近づくように、前記立体形状情報を用いて前記仮想光源の少なくとも色と向きとを設定する設定手段と、を備え、
前記設定手段は、前記目標とする色情報に基づいて、前記仮想光源の強度をさらに設定し、
前記立体形状情報は、前記被写体の表面に対する法線方向の情報である法線情報であり、
前記設定手段は、前記被写体における画素ごとに、前記法線情報と前記色情報とを取得し、各画素の色情報に応じて各画素の法線情報に重みをつけた情報に基づいて、前記仮想光源の向きを設定することを特徴とする画像処理装置。
a selection means for selecting a subject from an input image;
a color information obtaining means for obtaining color information of the selected subject;
shape information acquiring means for acquiring three-dimensional shape information of the selected subject;
target color acquisition means for acquiring target color information about the selected subject;
correction means for correcting the selected subject by adding or subtracting light from a virtual light source;
setting means for setting at least the color and direction of the virtual light source using the three-dimensional shape information so that the corrected color information of the subject approaches the target color information when the correction is performed by the correction means; and
The setting means further sets the intensity of the virtual light source based on the target color information ,
the three-dimensional shape information is normal information that is information about a normal direction to the surface of the subject;
The setting means acquires the normal line information and the color information for each pixel in the subject, and based on the information obtained by weighting the normal line information of each pixel according to the color information of each pixel, determines the An image processing device that sets the direction of a virtual light source .
前記被写体は人の顔であり、前記目標とする色情報は、目標とする肌色の色情報であることを特徴とする請求項1に記載の画像処理装置。 2. The image processing apparatus according to claim 1, wherein the subject is a human face, and the target color information is target skin color information. 前記色情報取得手段は、前記被写体の肌色の色情報を取得することを特徴とする請求項2に記載の画像処理装置。 3. The image processing apparatus according to claim 2, wherein said color information acquiring means acquires color information of a skin color of said subject. 前記目標とする色情報は、前記人の顔における色信号の平均値であることを特徴とする請求項2または3に記載の画像処理装置。 4. The image processing apparatus according to claim 2, wherein said target color information is an average value of color signals of said person's face. 前記目標とする色情報は、前記人の顔における色信号の中央値であることを特徴とする請求項2または3に記載の画像処理装置。 4. The image processing apparatus according to claim 2, wherein said target color information is a median value of color signals in said person's face. 前記目標とする色情報は、前記人の顔における色信号の最頻値であることを特徴とする請求項2または3に記載の画像処理装置。 4. The image processing apparatus according to claim 2, wherein the target color information is a mode of color signals of the person's face. 前記設定手段は、前記各画素の色情報に応じて重みをつけた法線方向を加算平均して得られる方向を、前記仮想光源の向きとして設定することを特徴とする請求項に記載の画像処理装置。 2. The setting device according to claim 1 , wherein the setting means sets a direction obtained by averaging normal directions weighted according to the color information of each pixel as the direction of the virtual light source. Image processing device. 前記設定手段は、前記被写体において、前記目標とする色情報から最も異なる色を補正の対象である補正対象色として選択することを特徴とする請求項またはに記載の画像処理装置。 8. The image processing apparatus according to claim 1 , wherein said setting means selects a color most different from said target color information in said object as a correction target color to be corrected. 前記重みは、各画素の色成分が前記補正対象色をどれだけ含んでいるかに基づいて決定されることを特徴とする請求項に記載の画像処理装置。 9. The image processing apparatus according to claim 8 , wherein the weight is determined based on how much the color component of each pixel contains the correction target color. 前記設定手段は、前記入力画像の撮影時の照明条件に基づいて前記補正対象色を設定することを特徴とする請求項またはに記載の画像処理装置。 10. The image processing apparatus according to claim 8 , wherein the setting unit sets the correction target color based on lighting conditions when the input image was captured. 前記設定手段は、ユーザーの指定した色を前記補正対象色として設定することを特徴とする請求項またはに記載の画像処理装置。 10. The image processing apparatus according to claim 8 , wherein said setting means sets a color specified by a user as said color to be corrected. 入力画像から被写体を選択する選択工程と、
選択した前記被写体の色情報を取得する色情報取得工程と、
選択した前記被写体の立体形状情報を取得する形状情報取得手段と、
選択した前記被写体について目標とする色情報を取得する目標色取得工程と、
選択した前記被写体に対し、仮想光源からの光を加算または減算する補正を行う補正工程と、
前記補正工程において補正を行う場合に、補正した前記被写体の色情報が前記目標とする色情報に近づくように、前記立体形状情報を用いて前記仮想光源の少なくとも色と向きとを設定する設定工程と、を有し、
前記設定工程では、前記目標とする色情報に基づいて、前記仮想光源の強度をさらに設定し、
前記立体形状情報は、前記被写体の表面に対する法線方向の情報である法線情報であり、
前記設定工程では、前記被写体における画素ごとに、前記法線情報と前記色情報とを取得し、各画素の色情報に応じて各画素の法線情報に重みをつけた情報に基づいて、前記仮想光源の向きを設定することを特徴とする画像処理方法。
a selection step of selecting a subject from the input image;
a color information acquisition step of acquiring color information of the selected subject;
shape information acquiring means for acquiring three-dimensional shape information of the selected subject;
a target color acquisition step of acquiring target color information about the selected subject;
a correction step of correcting the selected subject by adding or subtracting light from a virtual light source;
A setting step of setting at least the color and orientation of the virtual light source using the three-dimensional shape information so that the corrected color information of the subject approaches the target color information when correction is performed in the correcting step. and
In the setting step, further setting the intensity of the virtual light source based on the target color information ,
the three-dimensional shape information is normal information that is information about a normal direction to the surface of the subject;
In the setting step, the normal information and the color information are acquired for each pixel of the subject, and based on the information obtained by weighting the normal information of each pixel according to the color information of each pixel, the An image processing method characterized by setting the direction of a virtual light source .
コンピュータを、請求項1乃至11のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラム。 A program for causing a computer to function as each means of the image processing apparatus according to any one of claims 1 to 11 . コンピュータを、請求項1乃至11のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラムを記憶したコンピュータが読み取り可能な記憶媒体。 A computer-readable storage medium storing a program for causing a computer to function as each means of the image processing apparatus according to any one of claims 1 to 11 .
JP2019061357A 2019-03-27 2019-03-27 IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM Active JP7311995B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019061357A JP7311995B2 (en) 2019-03-27 2019-03-27 IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019061357A JP7311995B2 (en) 2019-03-27 2019-03-27 IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM

Publications (2)

Publication Number Publication Date
JP2020160945A JP2020160945A (en) 2020-10-01
JP7311995B2 true JP7311995B2 (en) 2023-07-20

Family

ID=72639512

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019061357A Active JP7311995B2 (en) 2019-03-27 2019-03-27 IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM

Country Status (1)

Country Link
JP (1) JP7311995B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112258622A (en) * 2020-10-26 2021-01-22 北京字跳网络技术有限公司 Image processing method, image processing device, readable medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006222928A (en) 2004-09-30 2006-08-24 Fuji Photo Film Co Ltd Image processing apparatus and method, and image processing program
JP2017152866A (en) 2016-02-23 2017-08-31 キヤノン株式会社 Image processing system and image processing method
JP2018010498A (en) 2016-07-14 2018-01-18 キヤノン株式会社 Image processing device and method and control program
CN107610080A (en) 2017-09-11 2018-01-19 广东欧珀移动通信有限公司 Image processing method and device, electronic installation and computer-readable recording medium
JP2019004290A (en) 2017-06-14 2019-01-10 キヤノン株式会社 Image processing apparatus, imaging apparatus, image processing method and program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006222928A (en) 2004-09-30 2006-08-24 Fuji Photo Film Co Ltd Image processing apparatus and method, and image processing program
JP2017152866A (en) 2016-02-23 2017-08-31 キヤノン株式会社 Image processing system and image processing method
JP2018010498A (en) 2016-07-14 2018-01-18 キヤノン株式会社 Image processing device and method and control program
JP2019004290A (en) 2017-06-14 2019-01-10 キヤノン株式会社 Image processing apparatus, imaging apparatus, image processing method and program
CN107610080A (en) 2017-09-11 2018-01-19 广东欧珀移动通信有限公司 Image processing method and device, electronic installation and computer-readable recording medium

Also Published As

Publication number Publication date
JP2020160945A (en) 2020-10-01

Similar Documents

Publication Publication Date Title
US10997696B2 (en) Image processing method, apparatus and device
US11503219B2 (en) Image processing apparatus, image capture apparatus, and control method for adding an effect of a virtual light source to a subject
JP6381404B2 (en) Image processing apparatus and method, and imaging apparatus
JP6412386B2 (en) Image processing apparatus, control method therefor, program, and recording medium
JP7179472B2 (en) Processing device, processing system, imaging device, processing method, program, and recording medium
US9894339B2 (en) Image processing apparatus, image processing method and program
JP2018163648A (en) Image processor, method for image processing, and program
US11893716B2 (en) Image processing apparatus and image processing method, and image capturing apparatus
JP7311995B2 (en) IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM
JP2017147568A (en) Image processing apparatus, imaging apparatus, control method, and program
JP2019179463A (en) Image processing device, control method thereof, program, and recording medium
JP2019205055A (en) Image processing apparatus, image processing apparatus control method, and program
JP6917796B2 (en) Image processing equipment, imaging equipment, image processing methods, and programs
JP2017138927A (en) Image processing device, imaging apparatus, control method and program thereof
JP2019129469A (en) Image processing device
JP2019149719A (en) Image processing apparatus and method, and imaging apparatus
JP7462464B2 (en) Image processing device and method, program, and storage medium
JP7356255B2 (en) Image processing device and its processing method, imaging device, program, storage medium
JP7455578B2 (en) Image processing device and image processing method
JP2021064884A (en) Image processing apparatus, imaging apparatus, control method, program, and imaging system
JP6429655B2 (en) Image processing apparatus, image processing method, and program
JP2023090494A (en) Imaging apparatus, control method for the same, program, and storage medium
JP2024017210A (en) Information processing apparatus, head-mounted display device, method for controlling information processing apparatus, program, and storage medium
JP2019003694A (en) Image processing apparatus, control method of the same, and program
JP2021005418A (en) Image processing apparatus and control method for the same, and program

Legal Events

Date Code Title Description
RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20210103

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210113

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20220328

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20230127

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230210

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230406

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230421

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230529

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230707

R151 Written notification of patent or utility model registration

Ref document number: 7311995

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151