JP2019004290A - Image processing apparatus, imaging apparatus, image processing method and program - Google Patents

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

Info

Publication number
JP2019004290A
JP2019004290A JP2017117019A JP2017117019A JP2019004290A JP 2019004290 A JP2019004290 A JP 2019004290A JP 2017117019 A JP2017117019 A JP 2017117019A JP 2017117019 A JP2017117019 A JP 2017117019A JP 2019004290 A JP2019004290 A JP 2019004290A
Authority
JP
Japan
Prior art keywords
image
specular reflection
color
image processing
reflection component
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.)
Granted
Application number
JP2017117019A
Other languages
Japanese (ja)
Other versions
JP6917796B2 (en
Inventor
遥平 豊原
Yohei TOYOHARA
遥平 豊原
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 JP2017117019A priority Critical patent/JP6917796B2/en
Publication of JP2019004290A publication Critical patent/JP2019004290A/en
Application granted granted Critical
Publication of JP6917796B2 publication Critical patent/JP6917796B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Studio Devices (AREA)

Abstract

To provide a technology that calculates a specular reflection component considering a color of a processing target pixel for the processing target pixel in re-lighting an image on the basis of a virtual light source.SOLUTION: An image processing apparatus that sets a virtual light source having a predetermined color for an image, and that performs image processing such that a light irradiation effect due to the virtual light source is imparted to the image is provided, and the image processing apparatus comprises: first acquisition means that acquires a first specular reflection component of light due to the virtual light source having the predetermined color for a processing target pixel in the image; second acquisition means that acquires a second specular reflection component of light due to the virtual light source corresponding to a case in which the virtual light source has a color of the processing target pixel instead of the predetermined color, for the processing target pixel; and addition means that adds the first specular reflection component and the second specular reflection component using a predetermined ratio for the processing target pixel.SELECTED DRAWING: Figure 4

Description

本発明は、画像処理装置、撮像装置、画像処理方法、及びプログラムに関する。   The present invention relates to an image processing device, an imaging device, an image processing method, and a program.

従来、撮影後の画像中の被写体に対して、仮想的な光源に基づくリライティングを行う技術が知られている。この技術によれば、ユーザは、撮影した画像の被写体に対して任意の陰影を付けることができる。また、仮想光源によるライティングにおいて、仮想光源からの光が被写体の表面上で入射角と同じ反射角で反射する成分(鏡面反射成分)をシミュレートし、被写体に付加する技術が知られている。この技術によれば、被写体の光沢などの質感を再現することができる。しかしながら、鏡面反射成分は光源の情報に基づいて生成されるため、被写体にそのまま付加しても被写体の色となじまないことがある。そこで、特許文献1では、鏡面反射中心からの距離に基づいて鏡面反射成分の色情報を変化させることで、所望の被写体の色を再現する方法を提案している。   2. Description of the Related Art Conventionally, a technique for performing relighting based on a virtual light source on a subject in an image after shooting is known. According to this technique, the user can add an arbitrary shadow to the subject of the captured image. Further, in lighting using a virtual light source, a technique for simulating a component (specular reflection component) in which light from a virtual light source is reflected on the surface of the subject at a reflection angle that is the same as an incident angle and adding the component to the subject is known. According to this technology, it is possible to reproduce the texture of the subject such as gloss. However, since the specular reflection component is generated based on the information of the light source, it may not match the color of the subject even if it is added to the subject as it is. Therefore, Patent Document 1 proposes a method for reproducing the color of a desired subject by changing the color information of the specular reflection component based on the distance from the specular reflection center.

特開2008−077410号公報JP 2008-077741A

被写体の種類によっては、画像内に部分的に急峻な色の変化が生じる場合がある。例えば、被写体が人物の場合、人物の肌には毛穴やホクロなどがあり、この部分で急峻な色の変化が生じる可能性がある。しかしながら、特許文献1の技術は、このような被写体の部分的な色変化を考慮しておらず、被写体に付加する鏡面反射成分を被写体の部分的な色変化に適合させることができない。   Depending on the type of subject, a sharp color change may occur partially in the image. For example, when the subject is a person, there are pores and moles on the person's skin, and a sharp color change may occur in this part. However, the technique of Patent Document 1 does not consider such a partial color change of the subject, and the specular reflection component added to the subject cannot be adapted to the partial color change of the subject.

本発明はこのような状況に鑑みてなされたものであり、仮想光源に基づいて画像のリライティングを行う際に、処理対象の画素に対して、処理対象の画素の色を考慮した鏡面反射成分を加算する技術を提供することを目的とする。   The present invention has been made in view of such a situation, and when performing relighting of an image based on a virtual light source, a specular reflection component considering the color of the pixel to be processed is applied to the pixel to be processed. The purpose is to provide a technique for adding.

上記課題を解決するために、本発明は、画像に対して所定の色を有する仮想光源を設定し、前記仮想光源による光照射の効果が画像に付与されるように、画像処理を行う画像処理装置であって、前記画像における処理対象の画素について、前記所定の色を有する仮想光源による光の第1の鏡面反射成分を取得する第1の取得手段と、前記処理対象の画素について、前記仮想光源が前記所定の色の代わりに前記処理対象の画素の色を持つ場合に対応して、前記仮想光源による光の第2の鏡面反射成分を取得する第2の取得手段と、前記処理対象の画素に対して、前記第1の鏡面反射成分と前記第2の鏡面反射成分とを所定の比率で加算する加算手段と、を備えることを特徴とする画像処理装置を提供する。   In order to solve the above-mentioned problems, the present invention sets an virtual light source having a predetermined color for an image, and performs image processing so that the effect of light irradiation by the virtual light source is given to the image. A first acquisition unit configured to acquire a first specular reflection component of light from the virtual light source having the predetermined color for the pixel to be processed in the image; and the virtual for the pixel to be processed. In response to the case where the light source has the color of the pixel to be processed instead of the predetermined color, second acquisition means for acquiring a second specular reflection component of the light from the virtual light source; There is provided an image processing apparatus comprising: an adding unit that adds the first specular reflection component and the second specular reflection component to a pixel at a predetermined ratio.

なお、その他の本発明の特徴は、添付図面及び以下の発明を実施するための形態における記載によって更に明らかになるものである。   Other features of the present invention will become more apparent from the accompanying drawings and the following description of the preferred embodiments.

本発明によれば、仮想光源に基づいて画像のリライティングを行う際に、処理対象の画素に対して、処理対象の画素の色を考慮した鏡面反射成分を加算することが可能となる。   According to the present invention, when image relighting is performed based on a virtual light source, it is possible to add a specular reflection component in consideration of the color of the processing target pixel to the processing target pixel.

デジタルカメラ100の構成を示すブロック図。1 is a block diagram showing a configuration of a digital camera 100. FIG. 画像処理部104の詳細な構成を示すブロック図。FIG. 2 is a block diagram showing a detailed configuration of an image processing unit 104. 第1の実施形態に係る、リライティング処理部203の詳細な構成を示すブロック図。The block diagram which shows the detailed structure of the relighting process part 203 based on 1st Embodiment. リライティング処理のフローチャート。The flowchart of a relighting process. デジタルカメラ100の撮影座標と被写体との関係を示す図。The figure which shows the relationship between the imaging | photography coordinate of the digital camera 100, and a to-be-photographed object. 被写体の輝度平均値Y_aveの算出処理のフローチャート。The flowchart of the calculation process of the brightness | luminance average value Y_ave of a to-be-photographed object. N_valueの算出方法を説明する図。The figure explaining the calculation method of N_value. 評価値Evalと合成比率aの関係を示す図。The figure which shows the relationship between evaluation value Eval and the synthetic | combination ratio a. 距離C_distと合成比率aの関係を示す図。The figure which shows the relationship between distance C_dist and the synthetic | combination ratio a. 第2の実施形態に係る、リライティング処理部203の詳細な構成を示すブロック図。The block diagram which shows the detailed structure of the relighting process part 203 based on 2nd Embodiment. 評価値Eval_cと合成比率aの関係を示す図。The figure which shows the relationship between evaluation value Eval_c and the synthetic | combination ratio a.

以下、添付図面を参照して、本発明の実施形態を説明する。なお、本発明の技術的範囲は、特許請求の範囲によって確定されるのであって、以下の個別の実施形態によって限定されるわけではない。また、実施形態の中で説明されている特徴の組み合わせすべてが、本発明に必須とは限らない。また、別々の実施形態の中で説明されている特徴を適宜組み合せることも可能である。   Embodiments of the present invention will be described below with reference to the accompanying drawings. The technical scope of the present invention is determined by the claims, and is not limited by the following individual embodiments. In addition, not all combinations of features described in the embodiments are essential to the present invention. Moreover, it is possible to appropriately combine the features described in different embodiments.

[第1の実施形態]
図1は、画像処理装置の一例であるデジタルカメラ100の構成を示すブロック図である。以下の説明においては、リライティング処理の対象画像はデジタルカメラ100により撮影された画像であるものとする。しかしながら、リライティング処理の対象画像は撮影画像に限定されず、3次元空間における所定の視点を持つ任意の画像(例えば、コンピュータグラフィックス)を対象画像として用いることができる。
[First Embodiment]
FIG. 1 is a block diagram illustrating a configuration of a digital camera 100 that is an example of an image processing apparatus. In the following description, it is assumed that the target image for the relighting process is an image captured by the digital camera 100. However, the target image of the relighting process is not limited to the captured image, and an arbitrary image (for example, computer graphics) having a predetermined viewpoint in the three-dimensional space can be used as the target image.

デジタルカメラ100は、光学系101、撮像素子102、A/D変換部103、画像処理部104、測距部105、顔検出部106、記録部107、制御部108、メモリ109、操作部110、表示部111、ストロボ112を備えている。   The digital camera 100 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, A display unit 111 and a strobe 112 are provided.

光学系101にはフォーカスレンズや絞り、シャッターが含まれる。光学系101は、撮影時にはフォーカスレンズを駆動し被写体のピント合わせを行い、絞りやシャッターを制御することにより露光量の調節をする。撮像素子102は、光学系101において結像された被写体の光量を光電変換によって電気信号にするCCDやCMOS等の光電変換素子である。A/D変換部103では、入力された電気信号をデジタル化する。デジタル化された画像信号は、画像処理部104で同時化処理、ホワイトバランス補正処理、リライティング処理、ガンマ処理などが行われ、記録部107に出力される。測距部105は、撮影時の被写体までの距離情報を取得し距離マップを生成する。距離マップとは、撮影した画像の画素単位での被写体までの距離情報を示す二次元配列である。   The optical system 101 includes a focus lens, a diaphragm, and a shutter. The optical system 101 adjusts the exposure amount by driving a focus lens to focus a subject at the time of shooting, and controlling an aperture and a shutter. The imaging element 102 is a photoelectric conversion element such as a CCD or CMOS that converts the amount of light of the subject imaged in the optical system 101 into an electrical signal by photoelectric conversion. The A / D converter 103 digitizes the input electrical signal. The digitized image signal is subjected to synchronization processing, white balance correction processing, relighting processing, gamma processing, and the like in the image processing unit 104 and is output to the recording unit 107. The distance measuring unit 105 acquires distance information to the subject at the time of shooting and generates a distance map. The distance map is a two-dimensional array indicating distance information to a subject in pixel units of a captured image.

顔検出部106は、画像処理部104で行うリライティング処理の対象領域である被写体領域を判定するため、撮影画像中の人物の顔領域を検出する。この時、顔検出部106は、右目、左目、口などの顔器官の座標を検出し、右目と左目の距離など各顔器官同士の距離を算出する。顔検出部106は、各顔器官同士の距離に基づいて、背景領域を含まないように、各顔器官の座標の重心座標を中心とする楕円領域を設定し、この楕円領域を顔領域として検出する。   The face detection unit 106 detects a face region of a person in a captured image in order to determine a subject region that is a target region for relighting processing performed by the image processing unit 104. At this time, the face detection unit 106 detects the coordinates of the facial organs such as the right eye, the left eye, and the mouth, and calculates the distance between the facial organs such as the distance between the right eye and the left eye. The face detection unit 106 sets an elliptical area centered on the barycentric coordinates of the coordinates of each facial organ based on the distance between the facial organs so as not to include the background area, and detects the elliptical area as a facial area. To do.

記録部107は、画像処理部104から出力された画像情報をJPEG等の画像形式に変換し、記録する。若しくは、記録部107は、JPEG等への変換を行わずに、撮像素子102での光電変換により得られた情報と、撮影時の情報などを組み合わせた情報を、RAW等のデータ形式で記録する。   The recording unit 107 converts the image information output from the image processing unit 104 into an image format such as JPEG and records it. Alternatively, the recording unit 107 records, in a data format such as RAW, information obtained by photoelectric conversion in the image sensor 102 and information at the time of shooting without performing conversion to JPEG or the like. .

制御部108は、デジタルカメラ100全体の動作制御を行う。例えば、制御部108は、撮影直前の被写体の明るさから、光学系101で目標とする露光量を算出する。また、制御部108は、撮影した画像に基づいて所定の評価値を算出し、画像処理部104で行う画像処理のパラメータを決定する。   The control unit 108 controls the operation of the entire digital camera 100. For example, the control unit 108 calculates a target exposure amount by the optical system 101 from the brightness of the subject immediately before shooting. Further, the control unit 108 calculates a predetermined evaluation value based on the captured image, and determines parameters for image processing performed by the image processing unit 104.

メモリ109は、画像処理部104で用いる情報を格納しており、必要に応じて画像処理部104に出力する。操作部110は、ユーザがデジタルカメラ100に対し操作指示を行う部分である。表示部111は、例えばデジタルカメラ100の背面に設置された液晶ディスプレイ等であり、撮影時の操作の補助を行うための画面や、記録部107に保存されている画像等を表示するものである。ストロボ112は、ユーザの操作に応じて発光し、被写体に光を照射する。   The memory 109 stores information used by the image processing unit 104 and outputs the information to the image processing unit 104 as necessary. The operation unit 110 is a part where the user gives an operation instruction to the digital camera 100. The display unit 111 is, for example, a liquid crystal display installed on the back of the digital camera 100, and displays a screen for assisting operations during shooting, an image stored in the recording unit 107, and the like. . The strobe 112 emits light in response to a user operation and irradiates the subject with light.

図2を参照して、画像処理部104の処理の詳細について説明する。画像処理部104は、同時化処理部201、ホワイトバランス補正部202、リライティング処理部203、ガンマ処理部204を備えている。   Details of the processing of the image processing unit 104 will be described with reference to FIG. The image processing unit 104 includes a synchronization processing unit 201, a white balance correction unit 202, a relighting processing unit 203, and a gamma processing unit 204.

画像処理部104の処理の流れについて説明する。A/D変換部103でデジタル化された、ベイヤー配列の画像信号(RGB信号)が画像処理部104に入力される。画像処理部104において、同時化処理部201は、ベイヤー配列のRGB信号に対して同時化処理を行い、色信号R、G、Bを生成する。生成された色信号R、G、Bはホワイトバランス補正部202に入力される。ホワイトバランス補正部202は、制御部108が算出したホワイトバランスゲイン値に基づいて、色信号R、G、Bにゲインをかけてホワイトバランスを調整する。ホワイトバランスが調整された色信号R、G、Bはリライティング処理部203に入力される。リライティング処理部203は、ホワイトバランス補正部202から色信号R、G、Bを取得し、測距部105から距離マップD_MAPを取得する。リライティング処理部203は、距離マップD_MAPに基づいて、色信号R、G、Bに対して仮想光源を照射した画像を生成し、処理後の色信号R_out、G_out、B_outをガンマ処理部204に出力する。ガンマ処理部204は、リライティング処理後の色信号R_out、G_out、B_outに対してガンマ処理を施し、ガンマ処理後の色信号Rg、Gg、Bgを記録部107出力する。   A processing flow of the image processing unit 104 will be described. The Bayer array image signal (RGB signal) digitized by the A / D conversion unit 103 is input to the image processing unit 104. In the image processing unit 104, the synchronization processing unit 201 performs synchronization processing on the RGB signals in the Bayer array, and generates color signals R, G, and B. The generated color signals R, G, and B are input to the white balance correction unit 202. The white balance correction unit 202 adjusts the white balance by applying gains to the color signals R, G, and B based on the white balance gain value calculated by the control unit 108. The color signals R, G, and B whose white balance has been adjusted are input to the relighting processing unit 203. The relighting processing unit 203 acquires color signals R, G, and B from the white balance correction unit 202 and acquires a distance map D_MAP from the distance measurement unit 105. Based on the distance map D_MAP, the relighting processing unit 203 generates an image obtained by irradiating the color signals R, G, and B with a virtual light source, and outputs the processed color signals R_out, G_out, and B_out to the gamma processing unit 204 To do. The gamma processing unit 204 performs gamma processing on the color signals R_out, G_out, and B_out after the relighting processing, and outputs the color signals Rg, Gg, and Bg after the gamma processing to the recording unit 107.

図3及び図4を参照して、リライティング処理の詳細について説明する。図3は、リライティング処理部203の詳細な構成を示すブロック図である。図4は、リライティング処理のフローチャートである。   Details of the relighting process will be described with reference to FIGS. 3 and 4. FIG. 3 is a block diagram illustrating a detailed configuration of the relighting processing unit 203. FIG. 4 is a flowchart of the relighting process.

本実施形態の説明において、リライティング処理による仮想光源の照射対象の被写体の例として、人物の顔を用いている。そのため、デジタルカメラ100は、画像中の顔領域を検出する顔検出部106を備えている。しかし、仮想光源の照射対象は人物の顔に限定されず、任意の物体を仮想光源の照射対象とすることができる。従って、デジタルカメラ100は、照射対象の物体に応じた物体検出部を備えていてもよい。   In the description of the present embodiment, a human face is used as an example of a subject to be irradiated with a virtual light source by relighting processing. Therefore, the digital camera 100 includes a face detection unit 106 that detects a face area in the image. However, the irradiation target of the virtual light source is not limited to a human face, and any object can be set as the irradiation target of the virtual light source. Therefore, the digital camera 100 may include an object detection unit corresponding to the object to be irradiated.

リライティング処理部203は、法線算出部301、テカリ補正量算出部302、テカリ補正部303、拡散反射成分算出部304、鏡面反射成分算出部305、仮想光源付加部306を備える。   The relighting processing unit 203 includes a normal calculation unit 301, a shine correction amount calculation unit 302, a shine correction unit 303, a diffuse reflection component calculation unit 304, a specular reflection component calculation unit 305, and a virtual light source addition unit 306.

最初に、S401で、リライティング処理部203は、測距部105から距離マップを取得し、ホワイトバランス補正部202から色信号R、G、Bを取得し、顔検出部106から顔領域情報を取得する。   First, in S 401, the relighting processing unit 203 acquires a distance map from the distance measuring unit 105, acquires color signals R, G, and B from the white balance correction unit 202, and acquires face area information from the face detection unit 106. To do.

S402で、法線算出部301は、測距部105から取得した距離マップに基づいて法線マップを生成する。距離マップに基づいて法線マップを生成する方法に関しては、任意の公知の技術を利用可能であるが、図5を参照して一例を説明する。   In step S <b> 402, the normal calculation unit 301 generates a normal map based on the distance map acquired from the distance measurement unit 105. As a method for generating a normal map based on a distance map, any known technique can be used. An example will be described with reference to FIG.

図5は、デジタルカメラ100の撮影座標と被写体との関係を示す図である。例えば被写体501の法線502を算出する場合、法線算出部301は、撮影画像の水平方向の差分ΔHに対する距離(奥行き)Dの差分ΔDから勾配情報を算出し、勾配情報から法線502を算出することが可能である。法線算出部301は、撮影した各画素に対して同様の処理を行うことで、撮影画像の各画素に対応する法線を算出し、法線マップを生成する。法線算出部301は、法線マップを拡散反射成分算出部304及び鏡面反射成分算出部305へ出力する。   FIG. 5 is a diagram illustrating the relationship between the shooting coordinates of the digital camera 100 and the subject. For example, when calculating the normal 502 of the subject 501, the normal calculation unit 301 calculates gradient information from the difference ΔD of the distance (depth) D with respect to the difference ΔH in the horizontal direction of the captured image, and calculates the normal 502 from the gradient information. It is possible to calculate. The normal line calculation unit 301 performs a similar process on each captured pixel, thereby calculating a normal line corresponding to each pixel of the captured image and generating a normal map. The normal calculation unit 301 outputs the normal map to the diffuse reflection component calculation unit 304 and the specular reflection component calculation unit 305.

S403で、テカリ補正量算出部302は、撮影時に環境光を強く反射したことにより発生した被写体の飽和領域(テカリ)の補正量Rh、Gh、Bhを算出する。テカリ補正量算出部302は、ホワイトバランス補正部202から色信号R、G、Bを取得し、顔検出部106から顔領域情報を取得する。補正量Rh、Gh、Bhはそれぞれ、補正目標色となる被写体の色の補色である。補正目標色は、例えば被写体の色の平均値である。前述の通り、本実施形態の説明において被写体は人物の顔である。そのため、テカリ補正量算出部302は、顔検出部106で検出した顔領域内における色信号R、G、Bの単純平均値をそれぞれ補正目標色Rt、Gt、Btとして算出する。   In step S403, the shine correction amount calculation unit 302 calculates correction amounts Rh, Gh, and Bh of the saturation region (shine) of the subject that is generated due to strong reflection of ambient light during shooting. The shine correction amount calculation unit 302 acquires color signals R, G, and B from the white balance correction unit 202 and acquires face area information from the face detection unit 106. The correction amounts Rh, Gh, and Bh are complementary colors of the subject color that is the correction target color. The correction target color is, for example, an average value of the subject color. As described above, in the description of the present embodiment, the subject is a human face. Therefore, the shine correction amount calculation unit 302 calculates the simple average values of the color signals R, G, and B in the face area detected by the face detection unit 106 as the correction target colors Rt, Gt, and Bt, respectively.

ここで、補色とは、対象となる色の逆の特性を持つ色であり、色信号R、G、Bがそれぞれ0〜255の範囲の値をとるとすると、補色信号、即ち補正量Rh、Gh、Bhは、下記の式1により求めることができる。

Rh=255−Rt
Gh=255−Gt ・・・(1)
Bh=255−Bt
Here, the complementary color is a color having characteristics opposite to those of the target color. If the color signals R, G, and B each take a value in the range of 0 to 255, the complementary color signal, that is, the correction amount Rh, Gh and Bh can be obtained by the following equation 1.

Rh = 255-Rt
Gh = 255−Gt (1)
Bh = 255-Bt

S404で、テカリ補正部303は、ホワイトバランス補正部202から色信号R、G、Bを取得し、テカリ補正量算出部302から補正量Rh、Gh、Bhを取得する。テカリ補正部303は、顔領域の各画素について、色信号R、G、Bが飽和しているか否かを判定する。色信号の飽和判定は、色信号の値が閾値以上であるか否かに基づいて行われる。例えば、色信号Rの値が251であり、閾値が250である場合、この色信号Rは飽和していると判定される。テカリ補正部303は、色信号R、G、B及び補正量Rh、Gh、Bhに基づき、テカリ補正後色信号R’、G’、B’を算出する。具体的には、テカリ補正部303は、下記の式2に従い、色信号R、G、Bそれぞれから、テカリ補正量Rh、Gh、Bhを減算することで、テカリ補正後色信号R’、G’、B’を算出する。なお、飽和していない色信号については、テカリ補正部303は、式2に従う演算を行わず、ホワイトバランス補正部202から取得した色信号をテカリ補正後色信号として出力する。

R’=R−ky×Rh
G’=G−ky×Gh ・・・(2)
B’=B−ky×Bh

ここで、式2におけるkyはテカリ補正量のゲインであり、kyを調整することで、テカリ補正量を調整することができる。
In step S <b> 404, the shine correction unit 303 acquires color signals R, G, and B from the white balance correction unit 202, and acquires correction amounts Rh, Gh, and Bh from the shine correction amount calculation unit 302. The shine correction unit 303 determines whether or not the color signals R, G, and B are saturated for each pixel in the face area. The color signal saturation determination is performed based on whether the value of the color signal is equal to or greater than a threshold value. For example, when the value of the color signal R is 251 and the threshold is 250, it is determined that the color signal R is saturated. Based on the color signals R, G, B and the correction amounts Rh, Gh, Bh, the shine correction unit 303 calculates the shine correction color signals R ′, G ′, B ′. Specifically, the shine correction unit 303 subtracts the shine correction amounts Rh, Gh, and Bh from the color signals R, G, and B in accordance with the following equation 2, so that the color signals R ′, G after the shine correction are performed. ', B' is calculated. For the color signal that is not saturated, the shine correction unit 303 does not perform the calculation according to Equation 2, and outputs the color signal acquired from the white balance correction unit 202 as the color signal after the shine correction.

R ′ = R−ky × Rh
G ′ = G−ky × Gh (2)
B ′ = B−ky × Bh

Here, ky in Equation 2 is the gain of the shine correction amount, and the shine correction amount can be adjusted by adjusting ky.

このようにして、環境光による影響を抑えたテカリ補正後色信号R’、G’、B’を得ることができる。テカリ補正部303は、テカリ補正後色信号R’、G’、B’を、拡散反射成分算出部304、鏡面反射成分算出部305、及び仮想光源付加部306へ出力する。このように、テカリ補正処理は、後述する鏡面反射成分算出部305による鏡面反射成分の算出前(取得前)に行われる。   In this way, it is possible to obtain post-correction color signals R ′, G ′, and B ′ that suppress the influence of ambient light. The shine correction unit 303 outputs the shine correction color signals R ′, G ′, and B ′ to the diffuse reflection component calculation unit 304, the specular reflection component calculation unit 305, and the virtual light source addition unit 306. As described above, the shine correction process is performed before the calculation of the specular reflection component by the specular reflection component calculation unit 305 described later (before the acquisition).

S405で、拡散反射成分算出部304は、拡散反射成分Rd、Gd、Bdを算出する。算出処理の詳細について、所定の色を持つ仮想光源503が配置された図5を参照して説明する。画像の水平画素位置H1に注目する(垂直画素位置は、説明の簡略化のため省略する)。水平画素位置H1における被写体の拡散反射成分は、水平画素位置H1における法線N1と仮想光源503の方向ベクトルL1の内積に比例し、仮想光源503と被写体位置の距離K1の二乗に反比例する値となる。仮想光源による拡散反射成分強度Pdは、下記の式3で表すことができ、色ごとの拡散反射成分Rd、Gd、Bdは、下記の式4で表すことができる。

Figure 2019004290

Rd=Pd×Rw×R’
Gd=Pd×Gw×G’ ・・・(4)
Bd=Pd×Bw×B’
式3において、αは仮想光源の強さ、Lは仮想光源の3次元方向ベクトル、Nは被写体の3次元法線ベクトル、Kは仮想光源と被写体の距離、kは被写体の拡散反射率である。また、式4において、Rw、Gw、Bwは仮想光源の色を示すパラメータである。 In S405, the diffuse reflection component calculation unit 304 calculates the diffuse reflection components Rd, Gd, and Bd. Details of the calculation process will be described with reference to FIG. 5 in which a virtual light source 503 having a predetermined color is arranged. Pay attention to the horizontal pixel position H1 of the image (the vertical pixel position is omitted for the sake of simplicity). The diffuse reflection component of the subject at the horizontal pixel position H1 is proportional to the inner product of the normal N1 at the horizontal pixel position H1 and the direction vector L1 of the virtual light source 503, and is a value inversely proportional to the square of the distance K1 between the virtual light source 503 and the subject position. Become. The diffuse reflection component intensity Pd by the virtual light source can be expressed by the following formula 3, and the diffuse reflection components Rd, Gd, and Bd for each color can be expressed by the following formula 4.
Figure 2019004290

Rd = Pd × Rw × R ′
Gd = Pd × Gw × G ′ (4)
Bd = Pd × Bw × B ′
In Equation 3, α is the intensity of the virtual light source, L is the three-dimensional direction vector of the virtual light source, N is the three-dimensional normal vector of the subject, K is the distance between the virtual light source and the subject, and k d is the diffuse reflectance of the subject. is there. In Expression 4, Rw, Gw, and Bw are parameters indicating the color of the virtual light source.

なお、仮想光源は複数配置することも可能であり、この場合、仮想光源毎に、強さαや色Rw、Gw、Bwなどの各種パラメータを制御することが可能である。   A plurality of virtual light sources can be arranged. In this case, various parameters such as intensity α and colors Rw, Gw, and Bw can be controlled for each virtual light source.

S406で、鏡面反射成分算出部305は、鏡面反射成分Rs、Gs、Bsを算出する。算出処理の詳細について、所定の色を持つ仮想光源503が配置された図5を参照して説明する。画像の水平画素位置H1に注目する(垂直画素位置は、説明の簡略化のため省略する)。水平画素位置H1における被写体の鏡面反射成分の強度は、被写体に対する鏡面反射方向S1と被写体位置から撮影時のデジタルカメラ100の方向V1(視線の方向)の内積に比例する。仮想光源による鏡面反射成分強度Psは、下記の式5で表すことができる。

Figure 2019004290
式5において、Sは仮想光源の鏡面反射ベクトル、Vはデジタルカメラ100から被写体位置への方向を示す視線方向ベクトル、kは被写体の鏡面反射率である。また、βは反射した光の広がり具合を示す輝き係数であり、この値が大きくなると鏡面反射特性が急峻になる。 In S406, the specular reflection component calculation unit 305 calculates specular reflection components Rs, Gs, and Bs. Details of the calculation process will be described with reference to FIG. 5 in which a virtual light source 503 having a predetermined color is arranged. Pay attention to the horizontal pixel position H1 of the image (the vertical pixel position is omitted for the sake of simplicity). The intensity of the specular reflection component of the subject at the horizontal pixel position H1 is proportional to the inner product of the specular reflection direction S1 with respect to the subject and the direction V1 (the direction of the line of sight) of the digital camera 100 at the time of shooting from the subject position. The specular reflection component intensity Ps by the virtual light source can be expressed by the following formula 5.
Figure 2019004290
In Equation 5, S is the specular reflection vector of the virtual light source, V is the line-of-sight vector indicating the direction from the digital camera 100 to the subject position, and k s is the specular reflectance of the subject. Β is a brightness coefficient indicating the extent of the reflected light, and the specular reflection characteristic becomes steep as this value increases.

次に、鏡面反射成分算出部305は、鏡面反射成分強度Psを用いて、仮想光源照射時に照射対象に反映される鏡面反射成分を算出する。仮想光源の色を反映した鏡面反射色成分Rs1、Gs1、Bs1は、仮想光源の色情報Rw、Gw、Bwを用いて、下記の式6で表すことができる。

Rs1=Ps×Rw
Gs1=Ps×Gw ・・・(6)
Bs1=Ps×Bw
Next, the specular reflection component calculation unit 305 uses the specular reflection component intensity Ps to calculate a specular reflection component that is reflected on the irradiation target when the virtual light source is irradiated. The specular reflection color components Rs1, Gs1, and Bs1 reflecting the color of the virtual light source can be expressed by the following Expression 6 using the color information Rw, Gw, and Bw of the virtual light source.

Rs1 = Ps × Rw
Gs1 = Ps × Gw (6)
Bs1 = Ps × Bw

また、鏡面反射成分算出部305は、被写体の色を反映した鏡面反射色成分Rs2、Gs2、Bs2も算出する。「被写体の色を反映した鏡面反射色成分」とは、仮想光源が、本来の仮想光源の色の代わりに被写体の色を持つ場合に対応する、仮想光源の鏡面反射色成分を意味する。被写体の色を反映した鏡面反射色成分Rs2、Gs2、Bs2は、テカリ補正後色信号R’、G’、B’を用いて、下記の式7で表すことができる。

Rs2=Ps×R’
Gs2=Ps×G’ ・・・(7)
Bs2=Ps×B’
The specular reflection component calculation unit 305 also calculates specular reflection color components Rs2, Gs2, and Bs2 reflecting the color of the subject. The “specular reflection color component reflecting the color of the subject” means the specular reflection color component of the virtual light source corresponding to the case where the virtual light source has the subject color instead of the original virtual light source color. The specular reflection color components Rs2, Gs2, and Bs2 reflecting the color of the subject can be expressed by the following Expression 7 using the color signals R ′, G ′, and B ′ after the shine correction.

Rs2 = Ps × R ′
Gs2 = Ps × G ′ (7)
Bs2 = Ps × B ′

更に、鏡面反射成分算出部305は、鏡面反射色成分Rs1、Gs1、Bs1、鏡面反射色成分Rs2、Gs2、Bs2、及び0〜1の値をとる合成比率aを用いる下記の式8に従い、最終的な鏡面反射成分Rs、Gs、Bsを算出する。

Rs=a×Rs1+(1−a)×Rs2
Gs=a×Gs1+(1−a)×Gs2 ・・・(8)
Bs=a×Bs1+(1−a)×Bs2
Further, the specular reflection component calculation unit 305 performs specular reflection color components Rs1, Gs1, Bs1, specular reflection color components Rs2, Gs2, Bs2, and a combination ratio a that takes a value of 0 to 1 according to the following equation 8: The specular reflection components Rs, Gs, and Bs are calculated.

Rs = a * Rs1 + (1-a) * Rs2
Gs = a × Gs1 + (1−a) × Gs2 (8)
Bs = a * Bs1 + (1-a) * Bs2

合成比率aの値が1に近づくほど、鏡面反射成分Rs、Gs、Bsの色は仮想光源の色に近づき、合成比率aの値が0に近づくほど、鏡面反射成分Rs、Gs、Bsの色は被写体の色に近づく。合成比率aの決定方法の具体例については後述するが、本実施形態は特定の決定方法に限定される訳ではない。   The color of the specular reflection components Rs, Gs, and Bs approaches the virtual light source as the value of the combination ratio a approaches 1, and the color of the specular reflection components Rs, Gs, and Bs as the value of the combination ratio a approaches 0. Approaches the color of the subject. A specific example of the method for determining the composition ratio a will be described later, but the present embodiment is not limited to a specific determination method.

S407で、仮想光源付加部306は、S405で算出された拡散反射成分Rd、Gd、Bdと、S406で算出された鏡面反射成分Rs、Gs、Bsとを、テカリ補正後色信号R’、G’、B’に付加する処理を行う。ここでの付加により得られるリライティング色信号R_out、G_out、B_outは、下記の式9で表すことができる。

R_out=R’+Rd+Rs
G_out=G’+Gd+Gs ・・・(9)
B_out=B’+Bd+Bs
In step S407, the virtual light source adding unit 306 converts the diffuse reflection components Rd, Gd, and Bd calculated in step S405 and the specular reflection components Rs, Gs, and Bs calculated in step S406 into color signals R ′, G after the shine correction. Processing to add to “, B” is performed. The relighting color signals R_out, G_out, and B_out obtained by the addition here can be expressed by the following Expression 9.

R_out = R ′ + Rd + Rs
G_out = G ′ + Gd + Gs (9)
B_out = B ′ + Bd + Bs

S408で、仮想光源付加部306は、リライティング色信号R_out、G_out、B_outをガンマ処理部204に出力する。   In step S <b> 408, the virtual light source adding unit 306 outputs the relighting color signals R_out, G_out, and B_out to the gamma processing unit 204.

次に、S406における合成比率aの決定方法の具体例について説明する。鏡面反射成分算出部305は、撮影画像に関する評価値Evalに基づいて合成比率aを算出する。評価値Evalは、被写体の明るさと、画像中のノイズ量に基づいて算出される値であり、被写体の輝度値が高く、かつ画像中のノイズ量が多い程、評価値Evalの値は大きくなる。評価値Evalは、被写体の輝度平均値Y_ave、撮影時の撮像素子102の受光感度によって決まる値N_valueに基づいて、下記の式10に従って算出される。

Eval=Y_ave×N_value ・・・(10)
Next, a specific example of the method for determining the composition ratio a in S406 will be described. The specular reflection component calculation unit 305 calculates the synthesis ratio a based on the evaluation value Eval related to the captured image. The evaluation value Eval is a value calculated based on the brightness of the subject and the amount of noise in the image, and the evaluation value Eval increases as the luminance value of the subject increases and the amount of noise in the image increases. . The evaluation value Eval is calculated according to the following equation 10 based on the average luminance value Y_ave of the subject and the value N_value determined by the light receiving sensitivity of the image sensor 102 at the time of shooting.

Eval = Y_ave × N_value (10)

図6を参照して、式10のY_aveの算出方法について説明する。図6は、鏡面反射成分算出部305が実行する、被写体の輝度平均値Y_aveの算出処理のフローチャートである。   With reference to FIG. 6, the calculation method of Y_ave in Expression 10 will be described. FIG. 6 is a flowchart of the calculation process of the luminance average value Y_ave of the subject executed by the specular reflection component calculation unit 305.

S601で、鏡面反射成分算出部305は、テカリ補正後色信号R’、G’、B’に基づき、輝度信号Yを算出する。輝度信号Yは、例えば下記の式11で表すことができる。

Y=0.299R’+0.587G’+0.114B’ ・・・(11)
In step S601, the specular reflection component calculation unit 305 calculates the luminance signal Y based on the shine correction corrected color signals R ′, G ′, and B ′. The luminance signal Y can be expressed by the following equation 11, for example.

Y = 0.299R ′ + 0.587G ′ + 0.114B ′ (11)

S602で、鏡面反射成分算出部305は、仮想光源を照射する被写体領域を取得する。ここでは、被写体領域として、顔検出部106が検出した顔領域が取得される。   In step S <b> 602, the specular reflection component calculation unit 305 acquires a subject region that is irradiated with a virtual light source. Here, the face area detected by the face detection unit 106 is acquired as the subject area.

S603で、鏡面反射成分算出部305は、被写体領域内の輝度値の単純平均により、被写体の輝度平均値Y_aveを算出する。   In step S603, the specular reflection component calculation unit 305 calculates the average luminance value Y_ave of the subject based on a simple average of the luminance values in the subject area.

図7を参照して、式10のN_valueの算出方法について説明する。鏡面反射成分算出部305は、図7に示す特性に従い、撮像素子102の受光感度であるISO感度に基づいてN_valueを算出する。ISO感度が高くなるほどN_valueは高くなる。ここで、図7中のThは、撮影画像のノイズ成分があまり目立たないISO感度である。Thは、例えば、PSNR(Peak Signal−to−Noise Ratio)などで表現されるノイズ成分の評価値が所定値以上の水準を保つことができるISO感度の上限である。   With reference to FIG. 7, the calculation method of N_value of Expression 10 will be described. The specular reflection component calculation unit 305 calculates N_value based on the ISO sensitivity that is the light reception sensitivity of the image sensor 102 in accordance with the characteristics shown in FIG. N_value increases as the ISO sensitivity increases. Here, Th in FIG. 7 is an ISO sensitivity in which a noise component of a captured image is not so conspicuous. Th is the upper limit of the ISO sensitivity that can maintain the evaluation value of the noise component expressed by, for example, PSNR (Peak Signal-to-Noise Ratio) or the like at a predetermined value or higher.

評価値Evalの算出後、鏡面反射成分算出部305は、図8に示す特性に従い、評価値Evalの値に基づいて合成比率aを算出する。合成比率aは、評価値Evalが大きくなるほど1に近づく特性を持つ。従って、鏡面反射成分の付加(加算)において、被写体の輝度が高いほど、また、画像の撮像時のISO感度が高いほど、仮想光源の色を反映した鏡面反射成分の割合が大きくなる。鏡面反射成分算出部305は、このようにして算出した合成比率aを用いて、鏡面反射成分Rs、Gs、Bsを算出する。   After calculating the evaluation value Eval, the specular reflection component calculation unit 305 calculates the composite ratio a based on the value of the evaluation value Eval according to the characteristics shown in FIG. The composite ratio a has a characteristic that approaches 1 as the evaluation value Eval increases. Accordingly, in the addition (addition) of the specular reflection component, the higher the luminance of the subject and the higher the ISO sensitivity at the time of image capturing, the greater the proportion of the specular reflection component reflecting the color of the virtual light source. The specular reflection component calculation unit 305 calculates the specular reflection components Rs, Gs, and Bs using the composite ratio a thus calculated.

次に、合成比率aの算出方法の他の例について説明する。鏡面反射成分算出部305は、仮想光源色Rw、Gw、Bwと、被写体色Rt、Gt、Btに関して、R、G、Bの3軸を持つ色空間上での距離C_distを算出し、距離C_distに基づいて合成比率aを算出する。ここで、被写体色Rt、Gt、Btは、顔検出部106により検出された顔領域の、テカリ補正後色信号R’、G’、B’それぞれの単純平均値である。   Next, another example of the method for calculating the composition ratio a will be described. The specular reflection component calculation unit 305 calculates a distance C_dist on a color space having three axes of R, G, and B for the virtual light source colors Rw, Gw, and Bw and the subject colors Rt, Gt, and Bt, and the distance C_dist Based on the above, the composition ratio a is calculated. Here, the subject colors Rt, Gt, and Bt are simple average values of the post-shine correction color signals R ′, G ′, and B ′ of the face area detected by the face detection unit 106.

距離C_distは、仮想光源色Rw、Gw、Bwと被写体色Rt、Gt、Btを用いて、下記の式12のようにユークリッド距離によって算出される。

Figure 2019004290
The distance C_dist is calculated based on the Euclidean distance using the virtual light source colors Rw, Gw, and Bw and the subject colors Rt, Gt, and Bt as shown in Expression 12 below.
Figure 2019004290

鏡面反射成分算出部305は、図9に示す特性に従い、距離C_distの値に基づいて合成比率aを算出する。合成比率aは、距離C_distが小さくなるほど1に近づく特性を持つ。従って、鏡面反射成分の付加(加算)において、被写体の色が仮想光源の色に近いほど、仮想光源の色を反映した鏡面反射成分の割合が大きくなる。鏡面反射成分算出部305は、このようにして算出した合成比率aを用いて、鏡面反射成分Rs、Gs、Bsを算出する。   The specular reflection component calculation unit 305 calculates the composite ratio a based on the value of the distance C_dist according to the characteristics shown in FIG. The composition ratio a has a characteristic of approaching 1 as the distance C_dist becomes smaller. Therefore, in the addition (addition) of the specular reflection component, the closer the subject color is to the color of the virtual light source, the greater the proportion of the specular reflection component reflecting the color of the virtual light source. The specular reflection component calculation unit 305 calculates the specular reflection components Rs, Gs, and Bs using the composite ratio a thus calculated.

以上説明したように、第1の実施形態によれば、デジタルカメラ100は、画像に対して所定の色を有する仮想光源を設定し、前記仮想光源による光照射の効果が画像に付与されるように、画像処理(リライティング処理)を行う。デジタルカメラ100は、リライティング処理において、所定の色を持つ仮想光源の鏡面反射成分と、仮想光源が所定の色の代わりに被写体の色を持つ場合に対応する鏡面反射成分とを算出する。そして、デジタルカメラ100は、処理対象の画素に対して、これら2種類の鏡面反射成分を所定の比率で加算する。これにより、被写体の色によりなじむ鏡面反射成分を付加することが可能になる。   As described above, according to the first embodiment, the digital camera 100 sets a virtual light source having a predetermined color for an image, and the effect of light irradiation by the virtual light source is given to the image. Then, image processing (relighting processing) is performed. In the relighting process, the digital camera 100 calculates a specular reflection component of a virtual light source having a predetermined color and a specular reflection component corresponding to the case where the virtual light source has a subject color instead of the predetermined color. Then, the digital camera 100 adds these two types of specular reflection components at a predetermined ratio to the pixel to be processed. As a result, it is possible to add a specular reflection component adapted to the color of the subject.

[第2の実施形態]
第2の実施形態では、被写体領域が検出できない(又は検出しない)場合のリライティング処理について説明する。本実施形態において、デジタルカメラ100の基本的な構成は第1の実施形態と同様であるが、画像処理部104の中のリライティング処理部203は、図3に示す構成の代わりに、図10に示す構成を持つ。図10において、図3と同一又は同様の機能を持つブロックには、図3と同一の符号を付す。以下、主に第1の実施形態と異なる点について説明する。
[Second Embodiment]
In the second embodiment, a relighting process when a subject area cannot be detected (or is not detected) will be described. In this embodiment, the basic configuration of the digital camera 100 is the same as that of the first embodiment, but the relighting processing unit 203 in the image processing unit 104 is shown in FIG. 10 instead of the configuration shown in FIG. Has the configuration shown. 10, blocks having the same or similar functions as those in FIG. 3 are denoted by the same reference numerals as those in FIG. Hereinafter, differences from the first embodiment will be mainly described.

被写体領域が検出できない場合、図3のテカリ補正量算出部302における補正目標色の算出ができない。そのため、図10においては、テカリ補正量算出部302及びテカリ補正部303が取り除かれている。   If the subject area cannot be detected, the correction target color cannot be calculated in the shine correction amount calculation unit 302 in FIG. Therefore, in FIG. 10, the shine correction amount calculation unit 302 and the shine correction unit 303 are removed.

第1の実施形態では、テカリ補正後色信号R’、G’、B’が拡散反射成分算出部304、鏡面反射成分算出部305、仮想光源付加部306に入力されていた。本実施形態では、テカリ補正後色信号R’、G’、B’に代わって、ホワイトバランス補正部202から入力された色信号R、G、Bが、拡散反射成分算出部304、鏡面反射成分算出部305、仮想光源付加部306に入力される。   In the first embodiment, the post-correction color signals R ′, G ′, and B ′ are input to the diffuse reflection component calculation unit 304, the specular reflection component calculation unit 305, and the virtual light source addition unit 306. In the present embodiment, color signals R, G, and B input from the white balance correction unit 202 instead of the shine correction color signals R ′, G ′, and B ′ are converted into the diffuse reflection component calculation unit 304, the specular reflection component, and the like. The data is input to the calculation unit 305 and the virtual light source addition unit 306.

本実施形態では、鏡面反射成分算出部305は、撮影時のパラメータから合成比率aを算出する。制御部108は、画像を撮影する直前に、光学系101における適正露出量や、ストロボ112における適正発光量を算出する(露出検出処理及び発光検出処理)。ユーザは、被写体を所望の明るさで撮影するために、操作部110を用いて、撮影時に実際に光学系101やストロボ112に適用する露出量や発光量を調整することができる。   In the present embodiment, the specular reflection component calculation unit 305 calculates the composition ratio a from the parameters at the time of shooting. The control unit 108 calculates an appropriate exposure amount in the optical system 101 and an appropriate light emission amount in the strobe 112 immediately before taking an image (exposure detection process and light emission detection process). The user can adjust the exposure amount and the light emission amount actually applied to the optical system 101 and the strobe 112 at the time of photographing using the operation unit 110 in order to photograph the subject with a desired brightness.

そこで、制御部108が算出した適正露出量や適正発光量と、ユーザが設定した露出量や発光量とを比較して、ユーザが被写体を明るく撮影しようとする度合を示す評価値Eval_cを、下記の式13のように表す。

Eval_c=EV_rate×F_rate×N_value ・・・(13)
Therefore, the appropriate exposure amount and appropriate light emission amount calculated by the control unit 108 are compared with the exposure amount and light emission amount set by the user, and an evaluation value Eval_c indicating the degree to which the user attempts to photograph the subject brightly is expressed as follows: This is expressed as in Equation 13.

Eval_c = EV_rate × F_rate × N_value (13)

式13のEV_rateの算出方法について説明する。光学系101で撮影時にユーザが設定した露出量EV_actualと、撮影直前に制御部108が算出した撮影シーンにおける適正露出量EV_correctを用いて、EV_rateを下記の式14のように表す。

EV_rate=EV_actual/EV_correct ・・・(14)
A method for calculating EV_rate in Expression 13 will be described. EV_rate is expressed as in Expression 14 below using the exposure amount EV_actual set by the user at the time of shooting with the optical system 101 and the appropriate exposure amount EV_correct in the shooting scene calculated by the control unit 108 immediately before shooting.

EV_rate = EV_actual / EV_correct (14)

式13のF_rateの算出方法について説明する。撮影時にユーザが設定したストロボ112の実際の発光量F_actualと、撮影直前に制御部108が算出した撮影シーンにおける適正発光量F_correctを用いて、F_rateを下記の式15のように表す。なお、ストロボ112が非発光の時、F_rateの値は1とする。

F_rate=F_actual/F_correct ・・・(15)
A method for calculating F_rate in Expression 13 will be described. F_rate is expressed by the following Expression 15 using the actual light emission amount F_actual of the strobe 112 set by the user at the time of shooting and the appropriate light emission amount F_correct in the shooting scene calculated by the control unit 108 immediately before shooting. Note that the value of F_rate is 1 when the strobe 112 does not emit light.

F_rate = F_actual / F_correct (15)

式13のN_valueの値は、第1の実施形態において式10を参照して説明した算出方法と同じ方法で算出される。   The value of N_value in Expression 13 is calculated by the same method as the calculation method described with reference to Expression 10 in the first embodiment.

評価値Eval_cの算出後、鏡面反射成分算出部305は、図11に示す特性に従い、評価値Eval_cの値に基づいて合成比率aを算出する。合成比率aは、評価値Eval_cが大きくなるほど1に近づく特性を持つ。従って、鏡面反射成分の付加(加算)において、適正露出量に対する撮像時の露出量の比が大きいほど、また、適正発光量に対する撮像時の発光量の比が大きいほど、仮想光源の色を反映した鏡面反射成分の割合が大きくなる。また、画像の撮像時のISO感度が高いほど、仮想光源の色を反映した鏡面反射成分の割合が大きくなる。また、撮影時の露出条件及びストロボ発光量がそれぞれ適性で、かつ、ISO感度が図8におけるThより低い場合、評価値Eval_cは1.0となり、合成比率aは0.5となる。鏡面反射成分算出部305は、このようにして算出した合成比率aを用いて、鏡面反射成分Rs、Gs、Bsを算出する。   After calculating the evaluation value Eval_c, the specular reflection component calculation unit 305 calculates the composite ratio a based on the value of the evaluation value Eval_c according to the characteristics shown in FIG. The composition ratio a has a characteristic that approaches 1 as the evaluation value Eval_c increases. Therefore, in the addition (addition) of the specular reflection component, the larger the ratio of the exposure amount at the time of imaging to the appropriate exposure amount, and the greater the ratio of the emission amount at the time of imaging to the appropriate light emission amount, the more the color of the virtual light source is reflected. The ratio of the specular reflection component is increased. In addition, the higher the ISO sensitivity at the time of capturing an image, the greater the proportion of the specular reflection component that reflects the color of the virtual light source. Further, when the exposure conditions and the strobe light emission amount at the time of photographing are appropriate and the ISO sensitivity is lower than Th in FIG. 8, the evaluation value Eval_c is 1.0 and the composition ratio a is 0.5. The specular reflection component calculation unit 305 calculates the specular reflection components Rs, Gs, and Bs using the composite ratio a thus calculated.

以上説明したように、第2の実施形態によれば、デジタルカメラ100は、リライティング処理において、所定の色を持つ仮想光源の鏡面反射成分と、仮想光源が所定の色の代わりに処理対象の画素の色を持つ場合に対応する鏡面反射成分とを算出する。そして、デジタルカメラ100は、処理対象の画素に対して、これら2種類の鏡面反射成分を所定の比率で加算する。これにより、処理対象の画素の色によりなじむ鏡面反射成分を付加することが可能になる。   As described above, according to the second embodiment, the digital camera 100 uses the specular reflection component of the virtual light source having a predetermined color and the pixel to be processed instead of the predetermined color in the relighting process. And a specular reflection component corresponding to the case of having a color of. Then, the digital camera 100 adds these two types of specular reflection components at a predetermined ratio to the pixel to be processed. Thereby, it is possible to add a specular reflection component that conforms to the color of the pixel to be processed.

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

100…デジタルカメラ、104…画像処理部、203…リライティング処理部、301…法線算出部、304…拡散反射成分算出部、305…鏡面反射成分算出部、306…仮想光源付加部   DESCRIPTION OF SYMBOLS 100 ... Digital camera, 104 ... Image processing part, 203 ... Relighting processing part, 301 ... Normal calculation part, 304 ... Diffuse reflection component calculation part, 305 ... Specular reflection component calculation part, 306 ... Virtual light source addition part

Claims (13)

画像に対して所定の色を有する仮想光源を設定し、前記仮想光源による光照射の効果が画像に付与されるように、画像処理を行う画像処理装置であって、
前記画像における処理対象の画素について、前記所定の色を有する仮想光源による光の第1の鏡面反射成分を取得する第1の取得手段と、
前記処理対象の画素について、前記仮想光源が前記所定の色の代わりに前記処理対象の画素の色を持つ場合に対応して、前記仮想光源による光の第2の鏡面反射成分を取得する第2の取得手段と、
前記処理対象の画素に対して、前記第1の鏡面反射成分と前記第2の鏡面反射成分とを所定の比率で加算する加算手段と、
を備えることを特徴とする画像処理装置。
An image processing apparatus that sets a virtual light source having a predetermined color for an image and performs image processing so that the effect of light irradiation by the virtual light source is imparted to the image,
First acquisition means for acquiring a first specular reflection component of light from the virtual light source having the predetermined color for a pixel to be processed in the image;
A second specular reflection component of light from the virtual light source is acquired for the pixel to be processed, corresponding to the case where the virtual light source has the color of the pixel to be processed instead of the predetermined color. Acquisition means of
Adding means for adding the first specular reflection component and the second specular reflection component at a predetermined ratio to the pixel to be processed;
An image processing apparatus comprising:
前記画像は、撮像手段により撮像された画像であり、
前記処理対象の画素は、所定の被写体に含まれる画素であり、
前記画像処理装置は、
前記画像から前記所定の被写体を検出する検出手段と、
前記所定の被写体の輝度、前記画像の撮像時のISO感度、及び前記被写体の色のうちの少なくともいずれかに基づいて前記所定の比率を決定する決定手段と、
を更に備えることを特徴とする請求項1に記載の画像処理装置。
The image is an image captured by an imaging unit,
The pixel to be processed is a pixel included in a predetermined subject,
The image processing apparatus includes:
Detecting means for detecting the predetermined subject from the image;
Determining means for determining the predetermined ratio based on at least one of the luminance of the predetermined subject, the ISO sensitivity at the time of capturing the image, and the color of the subject;
The image processing apparatus according to claim 1, further comprising:
前記決定手段は、前記被写体の輝度が高いほど、前記第1の鏡面反射成分の割合が大きくなるように前記所定の比率を決定する
ことを特徴とする請求項2に記載の画像処理装置。
The image processing apparatus according to claim 2, wherein the determination unit determines the predetermined ratio such that the higher the luminance of the subject, the larger the ratio of the first specular reflection component.
前記決定手段は、前記画像の撮像時のISO感度が高いほど、前記第1の鏡面反射成分の割合が大きくなるように前記所定の比率を決定する
ことを特徴とする請求項2又は3に記載の画像処理装置。
The said determination means determines the said predetermined ratio so that the ratio of a said 1st specular reflection component may become large, so that the ISO sensitivity at the time of the said imaging of an image is high. Image processing apparatus.
前記決定手段は、前記被写体の色が前記所定の色に近いほど、前記第1の鏡面反射成分の割合が大きくなるように前記所定の比率を決定する
ことを特徴とする請求項2乃至4のいずれか1項に記載の画像処理装置。
5. The determination unit according to claim 2, wherein the determination unit determines the predetermined ratio such that the ratio of the first specular reflection component increases as the color of the subject is closer to the predetermined color. The image processing apparatus according to any one of the above.
前記処理対象の画素が閾値以上の値を持つ色成分を含む場合に、前記第2の取得手段による前記第2の鏡面反射成分の取得前に、前記被写体の色に基づいて、前記処理対象の画素の前記閾値以上の値を持つ色成分を補正する補正手段を更に備える
ことを特徴とする請求項2乃至5のいずれか1項に記載の画像処理装置。
In a case where the pixel to be processed includes a color component having a value equal to or greater than a threshold value, the acquisition of the second specular reflection component by the second acquisition unit is performed based on the color of the subject. The image processing apparatus according to claim 2, further comprising a correction unit that corrects a color component having a value equal to or greater than the threshold value of the pixel.
前記画像は、撮像手段により撮像された画像であり、
前記画像処理装置は、前記画像の撮像時のISO感度、前記画像の撮像時の露出量、及び前記画像の撮像時のストロボの発光量のうちの少なくともいずれかに基づいて前記所定の比率を決定する決定手段を更に備える
ことを特徴とする請求項1に記載の画像処理装置。
The image is an image captured by an imaging unit,
The image processing apparatus determines the predetermined ratio based on at least one of ISO sensitivity at the time of capturing the image, an exposure amount at the time of capturing the image, and a light emission amount of a strobe at the time of capturing the image. The image processing apparatus according to claim 1, further comprising a determination unit that performs the determination.
前記決定手段は、前記画像の撮像時のISO感度が高いほど、前記第1の鏡面反射成分の割合が大きくなるように前記所定の比率を決定する
ことを特徴とする請求項7に記載の画像処理装置。
8. The image according to claim 7, wherein the determination unit determines the predetermined ratio such that the higher the ISO sensitivity at the time of capturing the image, the higher the ratio of the first specular reflection component. Processing equipment.
前記画像の撮像時に適正露出量を検出する露出検出手段を更に備え、
前記決定手段は、前記適正露出量に対する前記露出量の比が大きいほど、前記第1の鏡面反射成分の割合が大きくなるように前記所定の比率を決定する
ことを特徴とする請求項7又は8に記載の画像処理装置。
Further comprising an exposure detection means for detecting an appropriate exposure amount at the time of capturing the image;
The said determination means determines the said predetermined ratio so that the ratio of the said 1st specular reflection component may become large, so that the ratio of the said exposure amount with respect to the said appropriate exposure amount is large. An image processing apparatus according to 1.
前記画像の撮像時に前記ストロボの適正発光量を検出する発光検出手段を更に備え、
前記決定手段は、前記適正発光量に対する前記発光量の比が大きいほど、前記第1の鏡面反射成分の割合が大きくなるように前記所定の比率を決定する
ことを特徴とする請求項7乃至9のいずれか1項に記載の画像処理装置。
Further comprising a light emission detecting means for detecting an appropriate light emission amount of the strobe when the image is captured;
The determination unit determines the predetermined ratio such that the ratio of the first specular reflection component increases as the ratio of the light emission amount to the appropriate light emission amount increases. The image processing apparatus according to any one of the above.
請求項1乃至10のいずれか1項に記載の画像処理装置と、
前記画像を撮像する撮像手段と、
を備えることを特徴とする撮像装置。
The image processing apparatus according to any one of claims 1 to 10,
Imaging means for capturing the image;
An imaging apparatus comprising:
画像処理装置が実行する、画像に対して所定の色を有する仮想光源を設定し、前記仮想光源による光照射の効果が画像に付与されるように、画像処理を行う画像処理方法であって、
前記画像における処理対象の画素について、前記所定の色を有する仮想光源による光の第1の鏡面反射成分を取得する第1の取得工程と、
前記処理対象の画素について、前記仮想光源が前記所定の色の代わりに前記処理対象の画素の色を持つ場合に対応して、前記仮想光源による光の第2の鏡面反射成分を取得する第2の取得工程と、
前記処理対象の画素に対して、前記第1の鏡面反射成分と前記第2の鏡面反射成分とを所定の比率で加算する加算工程と、
を備えることを特徴とする画像処理方法。
An image processing method executed by an image processing apparatus for performing image processing so that a virtual light source having a predetermined color is set for an image and an effect of light irradiation by the virtual light source is imparted to the image,
A first acquisition step of acquiring a first specular reflection component of light from a virtual light source having the predetermined color for a pixel to be processed in the image;
A second specular reflection component of light from the virtual light source is acquired for the pixel to be processed, corresponding to the case where the virtual light source has the color of the pixel to be processed instead of the predetermined color. Acquisition process,
An adding step of adding the first specular reflection component and the second specular reflection component at a predetermined ratio to the pixel to be processed;
An image processing method comprising:
コンピュータを、請求項1乃至10のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラム。   The program for functioning a computer as each means of the image processing apparatus of any one of Claims 1 thru | or 10.
JP2017117019A 2017-06-14 2017-06-14 Image processing equipment, imaging equipment, image processing methods, and programs Active JP6917796B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017117019A JP6917796B2 (en) 2017-06-14 2017-06-14 Image processing equipment, imaging equipment, image processing methods, and programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017117019A JP6917796B2 (en) 2017-06-14 2017-06-14 Image processing equipment, imaging equipment, image processing methods, and programs

Publications (2)

Publication Number Publication Date
JP2019004290A true JP2019004290A (en) 2019-01-10
JP6917796B2 JP6917796B2 (en) 2021-08-11

Family

ID=65008059

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017117019A Active JP6917796B2 (en) 2017-06-14 2017-06-14 Image processing equipment, imaging equipment, image processing methods, and programs

Country Status (1)

Country Link
JP (1) JP6917796B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020160945A (en) * 2019-03-27 2020-10-01 キヤノン株式会社 Image processing device, image processing method, program, and storage medium
JP2020181330A (en) * 2019-04-24 2020-11-05 キヤノン株式会社 Image processing device, processing method thereof, imaging device, program and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016005203A (en) * 2014-06-18 2016-01-12 キヤノン株式会社 Image processing system and control method of the same
JP2017097729A (en) * 2015-11-26 2017-06-01 矢崎総業株式会社 Rendering calculation method and display device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016005203A (en) * 2014-06-18 2016-01-12 キヤノン株式会社 Image processing system and control method of the same
JP2017097729A (en) * 2015-11-26 2017-06-01 矢崎総業株式会社 Rendering calculation method and display device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020160945A (en) * 2019-03-27 2020-10-01 キヤノン株式会社 Image processing device, image processing method, program, and storage medium
JP7311995B2 (en) 2019-03-27 2023-07-20 キヤノン株式会社 IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM
JP2020181330A (en) * 2019-04-24 2020-11-05 キヤノン株式会社 Image processing device, processing method thereof, imaging device, program and storage medium
JP7356255B2 (en) 2019-04-24 2023-10-04 キヤノン株式会社 Image processing device and its processing method, imaging device, program, storage medium

Also Published As

Publication number Publication date
JP6917796B2 (en) 2021-08-11

Similar Documents

Publication Publication Date Title
US20200280667A1 (en) Image processing apparatus, image capture apparatus, and control method for adding an effect of a virtual light source to a subject
US20190164257A1 (en) Image processing method, apparatus and device
JP6381404B2 (en) Image processing apparatus and method, and imaging apparatus
JP2013106149A (en) Imaging apparatus, control method of the same and program
JP2018041380A (en) Image processing apparatus, image processing method, and program
JP6412386B2 (en) Image processing apparatus, control method therefor, program, and recording medium
JP2021128791A (en) Image processing apparatus, image processing method, and program
JP6425571B2 (en) IMAGE PROCESSING APPARATUS, IMAGE PROCESSING METHOD, AND PROGRAM
CN110324529B (en) Image processing apparatus and control method thereof
JP6917796B2 (en) Image processing equipment, imaging equipment, image processing methods, and programs
JP2019145097A (en) Setting device and method, program, and storage medium
JP2020102666A (en) Image processing device, imaging apparatus, image processing method, and program
JP2017147568A (en) Image processing apparatus, imaging apparatus, control method, and program
JP2017138927A (en) Image processing device, imaging apparatus, control method and program thereof
JP7311995B2 (en) IMAGE PROCESSING APPARATUS AND IMAGE PROCESSING METHOD, PROGRAM, STORAGE MEDIUM
JP2014098859A (en) Imaging apparatus and imaging method
JP2019129469A (en) Image processing device
JP2019149719A (en) Image processing apparatus and method, and imaging apparatus
WO2020084894A1 (en) Multi-camera system, control value calculation method and control device
JP2014155000A (en) Image processing apparatus, control method for the same, and control program
JP7462464B2 (en) Image processing device and method, program, and storage medium
JP7169841B2 (en) IMAGE PROCESSING DEVICE, IMAGING DEVICE, IMAGE PROCESSING METHOD, AND PROGRAM
JP7102192B2 (en) Image processing device, its control method, program
JP2011125051A (en) Image data generating apparatus and image data generating method
JP2020024581A (en) Image processing apparatus, image processing method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200609

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

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210420

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210720

R151 Written notification of patent or utility model registration

Ref document number: 6917796

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151