JP2015005927A - Image processing apparatus and control method of the same - Google Patents
Image processing apparatus and control method of the same Download PDFInfo
- Publication number
- JP2015005927A JP2015005927A JP2013131051A JP2013131051A JP2015005927A JP 2015005927 A JP2015005927 A JP 2015005927A JP 2013131051 A JP2013131051 A JP 2013131051A JP 2013131051 A JP2013131051 A JP 2013131051A JP 2015005927 A JP2015005927 A JP 2015005927A
- Authority
- JP
- Japan
- Prior art keywords
- specular reflection
- reflection component
- color
- white
- input image
- 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.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 238000000605 extraction Methods 0.000 claims abstract description 114
- 239000000284 extract Substances 0.000 claims abstract description 7
- 238000004364 calculation method Methods 0.000 claims description 26
- 230000008569 process Effects 0.000 description 24
- 239000013598 vector Substances 0.000 description 16
- 230000005457 Black-body radiation Effects 0.000 description 14
- 101150000003 subB gene Proteins 0.000 description 12
- 238000003384 imaging method Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 7
- 230000007274 generation of a signal involved in cell-cell signaling Effects 0.000 description 6
- 238000001514 detection method Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 5
- 230000003321 amplification Effects 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 3
- 239000003086 colorant Substances 0.000 description 3
- 230000007423 decrease Effects 0.000 description 3
- 238000003199 nucleic acid amplification method Methods 0.000 description 3
- 229920006395 saturated elastomer Polymers 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000008901 benefit Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000001678 irradiating effect Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Landscapes
- Color Television Image Signal Generators (AREA)
- Processing Of Color Television Signals (AREA)
Abstract
Description
本発明は、画像処理装置およびその制御方法に関し、特には画像のホワイトバランスを調節する技術に関する。 The present invention relates to an image processing apparatus and a control method thereof, and more particularly to a technique for adjusting white balance of an image.
従来、デジタルカメラに用いられるオートホワイトバランス制御機能は、外部センサを使用せず、撮像素子の出力を用いてホワイトバランスを調整するものが主流となっている。例えば特許文献1には、撮像素子の出力を用いてホワイトバランスを調整する手法として、入力画像中から白(無彩色)であると思われる色を抽出し、抽出した色が白になるようなホワイトバランスゲインを算出する方法(白抽出方式)が開示されている。 Conventionally, an auto white balance control function used in a digital camera has been mainly used to adjust white balance using an output of an image sensor without using an external sensor. For example, in Patent Document 1, as a method of adjusting white balance using the output of an image sensor, a color that is considered to be white (achromatic color) is extracted from an input image, and the extracted color becomes white. A method (white extraction method) for calculating a white balance gain is disclosed.
また、被写体物体光を鏡面反射成分と拡散反射成分に分離する二色性反射モデルを利用したものが知られている。 Also known is a dichroic reflection model that separates subject object light into a specular reflection component and a diffuse reflection component.
また、特許文献2には、明るさの異なる近接画素間の差分を算出することで、被写体を照射する光源色を特定する方法が開示されている。この方法は、高輝度な第1の画素(物体色を反映する拡散反射成分と光源色を反映する鏡面反射成分の両方を含む)から第1の画素よりも低輝度な画素(物体色のみを含む拡散反射成分)の差分を算出することで、光源色の成分を抽出する原理に基づいている。 Patent Document 2 discloses a method for specifying a light source color for irradiating a subject by calculating a difference between adjacent pixels having different brightnesses. In this method, a first pixel having a high luminance (including both a diffuse reflection component reflecting the object color and a specular reflection component reflecting the light source color) to a pixel having a lower luminance than the first pixel (only the object color is detected). This is based on the principle of extracting the light source color component by calculating the difference of the diffuse reflection component.
具体的には、高輝度の第1の画素のRGB値と、第1の画素よりも低輝度な第2の画素のRGB値の差分を算出する。この差分RGB値は光源色と同じベクトル成分を持つRGB値であるから、差分RGB値の成分比からホワイトバランスゲインを算出することができる。 Specifically, the difference between the RGB value of the first pixel with high luminance and the RGB value of the second pixel with lower luminance than the first pixel is calculated. Since the difference RGB value is an RGB value having the same vector component as the light source color, the white balance gain can be calculated from the component ratio of the difference RGB value.
特許文献1に記載される方法では、特に被写体が暗い場合など、条件によっては誤った色を白として抽出してしまい、ホワイトバランスの精度が低下するという課題があった。また、特許文献2の技術では、大まかな光源色は推定可能であるが、高精度で光源の色温度を推定することが困難であるという課題があった。 In the method described in Patent Document 1, there is a problem that an incorrect color is extracted as white depending on conditions, particularly when the subject is dark, and the accuracy of white balance is lowered. Moreover, although the technique of Patent Document 2 can roughly estimate the light source color, there is a problem that it is difficult to estimate the color temperature of the light source with high accuracy.
本発明はこのような従来技術の課題に鑑みなされたものであり、入力画像から精度良くホワイトバランスゲインを得ることが可能な画像処理装置およびその制御方法を提供することを目的とする。 The present invention has been made in view of the above-described problems of the prior art, and an object thereof is to provide an image processing apparatus capable of obtaining a white balance gain from an input image with high accuracy, and a control method therefor.
上述の目的は、所定の色空間における白抽出範囲を設定する設定手段と、入力画像に含まれる鏡面反射成分を抽出する第1の抽出手段と、抽出された鏡面反射成分に基づいて、白抽出範囲を補正する補正手段と、入力画像から、補正された白抽出範囲に含まれる色を有する画素を抽出する第2の抽出手段と、抽出された画素の値に基づいて、入力画像に対するホワイトバランスゲインを算出する算出手段と、を有することを特徴とする画像処理装置によって達成される。 The above-described object is to set a white extraction range in a predetermined color space, a first extraction unit that extracts a specular reflection component included in an input image, and a white extraction based on the extracted specular reflection component. Correction means for correcting the range, second extraction means for extracting pixels having a color included in the corrected white extraction range from the input image, and white balance for the input image based on the value of the extracted pixel This is achieved by an image processing apparatus comprising a calculation means for calculating a gain.
本発明によれば、入力画像から精度良くホワイトバランスゲインを得ることが可能な画像処理装置およびその制御方法を提供することができる。 ADVANTAGE OF THE INVENTION According to this invention, the image processing apparatus which can obtain a white balance gain from an input image accurately, and its control method can be provided.
本発明の例示的な実施形態を、添付図面に基づいて詳細に説明する。以下の実施形態では、本発明に係る画像処理装置の一例としてのデジタルカメラを説明するが、本発明において撮影に係る構成は必須ではなく、画像データを取得可能な任意の装置で本発明を実施可能である。 Exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. In the following embodiments, a digital camera as an example of an image processing apparatus according to the present invention will be described. However, a configuration related to shooting is not essential in the present invention, and the present invention is implemented by any apparatus capable of acquiring image data. Is possible.
(第1の実施形態)
図1は、本発明の第1の実施形態に係るデジタルカメラ100の構成例を示すブロック図である。
図1において、レンズ群101は、フォーカスレンズを含むズームレンズである。絞り機能を備えるシャッタ102が、レンズ群101と撮像部103との間に設けられている。撮像部103は、レンズ群101によって撮像面に形成される光学像を画素単位の電気信号に変換するCCD/CMOSイメージセンサを代表とする撮像素子を有する。A/D変換器104は、撮像部103が出力するアナログ信号をデジタル信号(画像データ)に変換する。
(First embodiment)
FIG. 1 is a block diagram illustrating a configuration example of a digital camera 100 according to the first embodiment of the present invention.
In FIG. 1, a lens group 101 is a zoom lens including a focus lens. A shutter 102 having a diaphragm function is provided between the lens group 101 and the imaging unit 103. The imaging unit 103 includes an imaging element represented by a CCD / CMOS image sensor that converts an optical image formed on the imaging surface by the lens group 101 into an electrical signal in pixel units. The A / D converter 104 converts the analog signal output from the imaging unit 103 into a digital signal (image data).
画像処理部105は、A/D変換器104から出力される画像データに対し、色補間(デモザイク)、ホワイトバランス調整、γ補正、輪郭強調、ノイズリダクション、色補正などの各種画像処理を行う。画像メモリ106は画像データを一時的に記憶する。メモリ制御部107は、画像メモリ106の読み書きを制御する。D/A変換器108は、画像データをアナログ信号に変換する。表示部109はLCDや有機ELディスプレイ等の表示装置を有し、各種GUIやライブビュー画像、記録媒体112から読み出して再生した画像などを表示する。コーデック部110は、画像メモリ106に記憶されている画像データを記録媒体に記録するために予め定められた方法で符号化したり、画像ファイルに含まれる符号化画像データを例えば表示のために復号したりする。 The image processing unit 105 performs various image processing such as color interpolation (demosaic), white balance adjustment, γ correction, contour enhancement, noise reduction, and color correction on the image data output from the A / D converter 104. The image memory 106 temporarily stores image data. A memory control unit 107 controls reading and writing of the image memory 106. The D / A converter 108 converts the image data into an analog signal. The display unit 109 includes a display device such as an LCD or an organic EL display, and displays various GUIs, live view images, images read out from the recording medium 112 and reproduced. The codec unit 110 encodes the image data stored in the image memory 106 by a predetermined method for recording on the recording medium, or decodes the encoded image data included in the image file for display, for example. Or
インタフェース(I/F)111は、例えば半導体メモリカードやカード型ハードディスクなどの着脱可能な記録媒体112を、デジタルカメラ100と機械的および電気的に接続する。システム制御部50は例えばCPUやMPUなどのプログラマブルなプロセッサであってよい。システム制御部50は、例えば不揮発性メモリ124や内蔵する不揮発性メモリに記録されたプログラムを実行して必要なブロックや回路を制御することにより、後述する光源推定処理を始めとしたデジタルカメラ100の機能を実現する。 The interface (I / F) 111 mechanically and electrically connects a detachable recording medium 112 such as a semiconductor memory card or a card type hard disk to the digital camera 100. The system control unit 50 may be a programmable processor such as a CPU or MPU. The system control unit 50 executes a program recorded in, for example, the non-volatile memory 124 or the built-in non-volatile memory to control necessary blocks and circuits, so that the digital camera 100 including the light source estimation process described later is started. Realize the function.
操作部120は、ユーザがデジタルカメラ100に各種の指示を入力するためのボタンやスイッチなどをまとめて記載したものである。電源スイッチ121は操作部120に含まれるスイッチ群の1つであるが、便宜上異なるブロックで記載している。電源制御部122は、電池検出回路、DC−DCコンバータ、通電するブロックを切り替えるスイッチ回路等により構成され、例えば充電池である電源部123について、装着の有無、種類、電池残量等の情報を検出する。また、電源制御部122は、電源部123に関する検出結果及びシステム制御部50の指示に基づいてDC−DCコンバータを制御し、必要な電圧を必要な期間、記録媒体112を含むデジタルカメラ100の各部へ供給する。 The operation unit 120 collectively describes buttons and switches for the user to input various instructions to the digital camera 100. The power switch 121 is one of the switches included in the operation unit 120, but is illustrated in different blocks for convenience. The power control unit 122 is configured by a battery detection circuit, a DC-DC converter, a switch circuit that switches a block to be energized, and the like, for example, information on presence / absence of installation, type, remaining battery level, etc. To detect. Further, the power control unit 122 controls the DC-DC converter based on the detection result related to the power supply unit 123 and the instruction of the system control unit 50, and each unit of the digital camera 100 including the recording medium 112 for a necessary voltage for a necessary period. To supply.
不揮発性メモリ124は電気的に消去・記録可能な、例えばEEPROM等であってよい。不揮発性メモリ124は、各種の設定値、GUIデータをはじめ、システム制御部50がMPUやCPUである場合にはプログラムが記録される。 The nonvolatile memory 124 may be an electrically erasable / recordable, for example, an EEPROM. The nonvolatile memory 124 stores various setting values, GUI data, and programs when the system control unit 50 is an MPU or CPU.
システムタイマ125は各種制御に用いる時間や、内蔵時計の時刻を計測する。システムメモリ126は、システム制御部50の動作用の定数や変数を保存したり、不揮発性メモリ124から読みだしたプログラム等を展開するために用いられる、例えば揮発性メモリである。 The system timer 125 measures the time used for various controls and the time of the built-in clock. The system memory 126 is, for example, a volatile memory that is used for storing constants and variables for the operation of the system control unit 50 and for developing programs read from the nonvolatile memory 124.
次に、デジタルカメラ100における撮影時の動作について説明する。
例えば撮像部103は、シャッタ102が開いている際にレンズ群101が撮像面に形成する被写体像を撮像素子によって光電変換し、アナログ画像信号としてA/D変換器104へ出力する。A/D変換器104は撮像部103から出力されるアナログ画像信号をデジタル画像信号(画像データ)に変換し画像処理部105に出力する。
Next, the operation at the time of shooting in the digital camera 100 will be described.
For example, the imaging unit 103 photoelectrically converts a subject image formed on the imaging surface by the lens group 101 when the shutter 102 is opened, and outputs the subject image to the A / D converter 104 as an analog image signal. The A / D converter 104 converts the analog image signal output from the imaging unit 103 into a digital image signal (image data) and outputs the digital image signal to the image processing unit 105.
画像処理部105は、A/D変換器104からの画像データ、又は、メモリ制御部107からの画像データに対し、色補間(デモザイク)、γ補正、輪郭強調、ノイズリダクション、色補正などの各種画像処理を行う。 The image processing unit 105 performs various processes such as color interpolation (demosaic), γ correction, edge enhancement, noise reduction, and color correction on the image data from the A / D converter 104 or the image data from the memory control unit 107. Perform image processing.
また、画像処理部105では、撮影で得られた画像データを用いて輝度やコントラストなどに関する所定の演算処理を行い、得られた演算結果に基づいてシステム制御部50が測距制御、露光制御を行う。このように、本実施形態のデジタルカメラ100では、TTL(スルー・ザ・レンズ)方式のAF(オートフォーカス)処理、AE(自動露出)処理を行う。画像処理部105ではさらに、撮影で得られた画像データを用いて、撮影時に被写体を照明した光源色を推定し、推定した光源色に基づくオートホワイトバランス(AWB)調整も行う。 In addition, the image processing unit 105 performs predetermined calculation processing relating to luminance, contrast, and the like using image data obtained by photographing, and the system control unit 50 performs distance measurement control and exposure control based on the obtained calculation result. Do. As described above, the digital camera 100 according to the present embodiment performs TTL (through the lens) AF (autofocus) processing and AE (automatic exposure) processing. The image processing unit 105 further estimates a light source color that illuminates the subject at the time of shooting using image data obtained by shooting, and also performs auto white balance (AWB) adjustment based on the estimated light source color.
画像処理部105から出力された画像データは、メモリ制御部107を介して画像メモリ106に書き込まれる。画像メモリ106は、撮像部103から出力された画像データや、表示部109に表示するための画像データを格納する。 The image data output from the image processing unit 105 is written into the image memory 106 via the memory control unit 107. The image memory 106 stores image data output from the imaging unit 103 and image data to be displayed on the display unit 109.
また、D/A変換器108は、画像メモリ106に格納されている画像表示用のデータをアナログ信号に変換して表示部109に供給する。表示部109は、LCD等の表示装置に、D/A変換器108からのアナログ信号に応じた表示を行う。 The D / A converter 108 converts the image display data stored in the image memory 106 into an analog signal and supplies the analog signal to the display unit 109. The display unit 109 performs display in accordance with an analog signal from the D / A converter 108 on a display device such as an LCD.
コーデック部110は、画像メモリ106に記録された画像データをJPEGやMPEGなどの規格に基づき符号化する。システム制御部50は符号化した画像データに対して予め定められたヘッダなどを付与して画像ファイルを形成し、インタフェース111を介して記録媒体112に記録する。 The codec unit 110 encodes the image data recorded in the image memory 106 based on a standard such as JPEG or MPEG. The system control unit 50 assigns a predetermined header or the like to the encoded image data, forms an image file, and records the image file on the recording medium 112 via the interface 111.
なお、現在のデジタルカメラでは、撮影スタンバイ状態においては動画撮影を行い、撮影された動画を表示部109に表示し続けることにより表示部109を電子ビューファインダ(EVF)として機能させるのが一般的である。この場合、シャッタ102は開いた状態とし、撮像部103のいわゆる電子シャッタを用いて例えば30フレーム/秒の撮影を行う。 Note that with current digital cameras, it is common to perform moving image shooting in the shooting standby state, and keep the captured moving image displayed on the display unit 109 so that the display unit 109 functions as an electronic viewfinder (EVF). is there. In this case, the shutter 102 is opened and a so-called electronic shutter of the imaging unit 103 is used to capture an image at, for example, 30 frames / second.
そして、操作部120に含まれるシャッタボタンが半押しされると上述のAF,AE制御が行われ、全押しされると本撮影により記録用の静止画撮影が実行され、記録媒体112に記録される。また、動画撮影ボタンなどにより動画撮影が指示された場合は、記録媒体112への動画記録を開始する。 When the shutter button included in the operation unit 120 is half-pressed, the above-described AF and AE control is performed. When the shutter button is fully pressed, the still image shooting for recording is executed by the main shooting and is recorded on the recording medium 112. The Also, when moving image shooting is instructed by a moving image shooting button or the like, moving image recording on the recording medium 112 is started.
図2は、画像処理部105の機能構成例を示すブロック図である。
図1のA/D変換器104から出力された画像データは、輝度・色信号生成部200に入力される。画像データは、撮像素子に設けられたカラーフィルタを構成する色成分の1つに対応した値を有する。一般的に用いられるベイヤー配列の原色カラーフィルタが用いられる場合、画像データは、R画素,G画素,B画素のデータから構成される。
FIG. 2 is a block diagram illustrating a functional configuration example of the image processing unit 105.
The image data output from the A / D converter 104 in FIG. 1 is input to the luminance / color signal generation unit 200. The image data has a value corresponding to one of the color components constituting the color filter provided in the image sensor. When a commonly used primary color filter with a Bayer array is used, the image data is composed of R pixel, G pixel, and B pixel data.
輝度・色信号生成部200はこのような画像データに対してデモザイク処理を行い、各画素について輝度信号Yおよび色信号R,G,Bを生成する。輝度・色信号生成部200は、生成した色信号R,G,Bをホワイトバランス(WB)増幅部201へ、輝度信号Yを輝度γ処理部205へ出力する。また、輝度・色信号生成部200は、色信号R,G,Bを、画像データ(R, G, B)として、メモリ制御部107を介して画像メモリ106に出力する。 The luminance / color signal generation unit 200 performs demosaic processing on such image data, and generates a luminance signal Y and color signals R, G, and B for each pixel. The luminance / color signal generation unit 200 outputs the generated color signals R, G, and B to the white balance (WB) amplification unit 201 and the luminance signal Y to the luminance γ processing unit 205. Further, the luminance / color signal generation unit 200 outputs the color signals R, G, and B as image data (R, G, and B) to the image memory 106 via the memory control unit 107.
また、輝度・色信号生成部200で生成した色信号R,G,Bは色空間変換処理部207にも入力される。色空間変換処理部207では、以下の式を用いて、色信号R,G,Bを色度Cx,Cyに変換し、画像データ(Cx, Cy)としてメモリ制御部107を介して画像メモリ106に出力する。
Cx = (R - B) / Y
Cy = (R + B -2G) / Y
Y = (R + G + B) / 2
The color signals R, G, and B generated by the luminance / color signal generation unit 200 are also input to the color space conversion processing unit 207. The color space conversion processing unit 207 converts the color signals R, G, and B into chromaticities Cx and Cy using the following equations, and the image memory 106 via the memory control unit 107 as image data (Cx, Cy). Output to.
Cx = (R-B) / Y
Cy = (R + B -2G) / Y
Y = (R + G + B) / 2
WB増幅部201は、後述する処理によりシステム制御部50が算出するホワイトバランスゲイン値に基づき、色信号R,G,Bにゲインを適用し、ホワイトバランスを調整する。色γ処理部202では、色信号R,G,Bにガンマ補正を行う。色差信号生成部203では、色信号R,G,Bから色差信号R−Y、B−Y信号を生成し色補正部204に出力する。色補正部204では色差信号R−Y、B−Yにゲインを適用するなどにより、色相や彩度を調整する。色補正部204は、補正後の色差信号R−Y、B−Yをメモリ制御部107を介して画像メモリ106に出力する。 The WB amplifying unit 201 adjusts the white balance by applying gain to the color signals R, G, and B based on the white balance gain value calculated by the system control unit 50 through processing described later. The color γ processing unit 202 performs gamma correction on the color signals R, G, and B. The color difference signal generation unit 203 generates color difference signals RY and BY from the color signals R, G, and B and outputs them to the color correction unit 204. The color correction unit 204 adjusts the hue and saturation by applying a gain to the color difference signals RY and BY. The color correction unit 204 outputs the corrected color difference signals RY and BY to the image memory 106 via the memory control unit 107.
一方、輝度γ処理部205では輝度信号Yに対してガンマ補正を行い、輪郭強調処理部206へ出力する。輪郭強調処理部206は輝度信号Yに対して輪郭強調処理を行い、メモリ制御部107を介して画像メモリ106に出力する。輪郭強調処理部206の出力する輝度信号Yと、色補正部204が出力する色差信号R−Y,B−Yが、コーデック部110によって符号化され、最終的に記録媒体112に記録される。 On the other hand, the luminance γ processing unit 205 performs gamma correction on the luminance signal Y and outputs it to the contour enhancement processing unit 206. The contour emphasis processing unit 206 performs contour emphasis processing on the luminance signal Y and outputs it to the image memory 106 via the memory control unit 107. The luminance signal Y output from the contour enhancement processing unit 206 and the color difference signals RY and BY output from the color correction unit 204 are encoded by the codec unit 110 and finally recorded on the recording medium 112.
システム制御部50は、画像処理部105から画像メモリ106に出力された画像データ(RGB)および画像データ(CxCy)を読み出してシステムメモリ126に展開する。そして、システム制御部50はこれらの画像データを解析して光源色の成分を推定し、推定した光源色に応じたホワイトバランスゲインを算出する。 The system control unit 50 reads the image data (RGB) and the image data (CxCy) output from the image processing unit 105 to the image memory 106 and develops them in the system memory 126. Then, the system control unit 50 analyzes these image data to estimate a light source color component, and calculates a white balance gain corresponding to the estimated light source color.
このホワイトバランスゲインの算出処理について図3のフローチャートを用いて詳細に説明する。まず、S301で第1の抽出手段としてのシステム制御部50は、鏡面反射成分の抽出を行う。S301における処理の詳細を、図4に示すフローチャートを用いて説明する。 The white balance gain calculation process will be described in detail with reference to the flowchart of FIG. First, in S301, the system control unit 50 as the first extraction unit extracts a specular reflection component. Details of the processing in S301 will be described using the flowchart shown in FIG.
図4において、S401およびS407は、S402〜S406の処理が、対象画素をラスタスキャンしながら全画素に対して実施されることを示している。 4, S401 and S407 indicate that the processes of S402 to S406 are performed on all the pixels while raster scanning the target pixel.
S402でシステム制御部50は、処理対象画素が飽和していないか確認する。具体的には、システム制御部50は、RGB成分のそれぞれを所定の閾値と比較し、閾値より大きい成分があれば画素が飽和していると判断し、現在の処理対象画素の処理をスキップして、次の画素について飽和の確認を行う。一方、RGB成分がいずれも閾値以下であれば画素は飽和していないと判断してシステム制御部50は処理をS403に進める。 In S402, the system control unit 50 checks whether the processing target pixel is saturated. Specifically, the system control unit 50 compares each of the RGB components with a predetermined threshold value, and if there is a component larger than the threshold value, determines that the pixel is saturated and skips processing of the current processing target pixel. Then, the saturation is confirmed for the next pixel. On the other hand, if all of the RGB components are equal to or smaller than the threshold value, it is determined that the pixel is not saturated, and the system control unit 50 advances the process to S403.
S403でシステム制御部50は、処理対象画素と比較画素の差分を算出する。処理対象画素および比較画素について、図5(a)を用いて説明する。図5(a)において500は入力画像を示しており、501は入力画像500の一部を拡大した状態を模式的に示している。501におけるメッシュは画素の境界を示している。502は現在の処理における処理対象画素を示し、図4の処理は、処理対象画素502の位置を順次ラスタスキャンしながら各画素について実施される。503、504、505は処理対象画素502に対する比較画素を示しており、本実施形態では処理対象画素502から所定の方向に所定の距離(画素数)離れた位置の複数の画素を比較画素とする。 In S403, the system control unit 50 calculates a difference between the processing target pixel and the comparison pixel. The processing target pixel and the comparison pixel will be described with reference to FIG. In FIG. 5A, reference numeral 500 denotes an input image, and reference numeral 501 schematically shows a state in which a part of the input image 500 is enlarged. A mesh in 501 indicates a pixel boundary. Reference numeral 502 denotes a processing target pixel in the current processing, and the processing in FIG. 4 is performed for each pixel while sequentially raster-scanning the position of the processing target pixel 502. Reference numerals 503, 504, and 505 denote comparison pixels for the processing target pixel 502. In this embodiment, a plurality of pixels that are separated from the processing target pixel 502 by a predetermined distance (number of pixels) in a predetermined direction are used as comparison pixels. .
処理対象画素と比較画素とが満たすべき位置関係は予め定めておくことができるが、基本的には処理対象画素に近接した複数の位置にある画素を比較画素とする。ここでは、一例として処理対象画素を左上角の画素として有する4×4画素のブロックにおける残り3つの角の画素を比較画素としている。処理対象画素と比較画素との距離が短すぎると画素間の差が少なくなる可能性が高くなり、また距離が長すぎると同一物体に対応しない可能性が高くなる。従って、例えば数〜10画素程度の範囲で実験的に距離を定める。なお、処理対象画素と比較画素との位置関係は、処理対象画素の位置が入力画像の端部となる場合などにおいて適宜変更されてよい。 Although the positional relationship to be satisfied by the processing target pixel and the comparison pixel can be determined in advance, basically, pixels at a plurality of positions close to the processing target pixel are set as the comparison pixels. Here, as an example, the remaining three corner pixels in the 4 × 4 pixel block having the processing target pixel as the upper left corner pixel are used as comparison pixels. If the distance between the pixel to be processed and the comparison pixel is too short, there is a high possibility that the difference between the pixels will be small, and if the distance is too long, there is a high possibility that the pixel does not correspond to the same object. Therefore, the distance is experimentally determined within a range of, for example, several tens of pixels. Note that the positional relationship between the processing target pixel and the comparison pixel may be appropriately changed when the position of the processing target pixel is an end of the input image.
S403でシステム制御部50は、処理対象画素502と比較画素503との差分を算出する。即ち、システム制御部50は、処理対象画素502のRGB値(R1, G1, B1)と比較画素503のRGB値(R2, G2, B2)との色成分ごとの差分(subR, subG, subB)を算出する。 In step S <b> 403, the system control unit 50 calculates a difference between the processing target pixel 502 and the comparison pixel 503. That is, the system control unit 50 determines the difference (subR, subG, subB) for each color component between the RGB value (R1, G1, B1) of the processing target pixel 502 and the RGB value (R2, G2, B2) of the comparison pixel 503. Is calculated.
S404でシステム制御部50は、S403で算出した差分(subR, subG, subB)の大きさSが所定の閾値T1よりも大きい(T1<S)か否かを判定する。差分(subR, subG, subB)の大きさSは次の式から算出する。
S=√{(subR)2+(subG)2+(subB)2}
システム制御部50は、差分の大きさSが閾値T1よりも大きい場合にはS405に、閾値T1以下の場合はS406に、それぞれ処理を進める。
In S404, the system control unit 50 determines whether the magnitude S of the differences (subR, subG, subB) calculated in S403 is larger than a predetermined threshold T1 (T1 <S). The size S of the difference (subR, subG, subB) is calculated from the following equation.
S = √ {(subR) 2 + (subG) 2 + (subB) 2 }
The system control unit 50 proceeds to S405 when the difference size S is larger than the threshold T1, and proceeds to S406 when the difference is equal to or smaller than the threshold T1.
S405で、システム制御部50は、処理対象画素と比較画素の差分(subR, subG, subB)を、システムメモリ126に保存(加算)し、差分合計値sumSを算出する。差分(subR, subG, subB)の保存形式の例を図6に示す。本実施形態では、差分の大きさSが閾値T1より大きい場合に、図6に示すように、差分(subR, subG, subB)を処理対象画素が属するブロックごとに合計し、差分合計値sumSを得る。 In S405, the system control unit 50 saves (adds) the difference (subR, subG, subB) between the processing target pixel and the comparison pixel in the system memory 126, and calculates a difference sum value sumS. An example of the storage format of the difference (subR, subG, subB) is shown in FIG. In this embodiment, when the magnitude S of the difference is larger than the threshold value T1, as shown in FIG. 6, the differences (subR, subG, subB) are summed for each block to which the pixel to be processed belongs, and the difference sum value sumS is calculated. obtain.
なお、ここでのブロックとは入力画像の分割領域を指し、図5(a)は、入力画像500を水平方向8×垂直方向8に64分割した例を示している。このように、入力画像の部分領域ごとに、その部分領域に含まれる画素に対して算出された差分(subR, subG, subB)を、各ブロックで合計し、ブロックを代表する差分値(ブロック差分値)とする。また、差分(subR, subG, subB)を加算するごとに、差分合計値sumSに対応付けられたカウント値CountSを1加算する。従って、カウント値CountSはブロック差分値の算出に用いられた差分値の数を示す。 Here, the block indicates a divided area of the input image, and FIG. 5A shows an example in which the input image 500 is divided into 64 in the horizontal direction 8 × vertical direction 8. Thus, for each partial area of the input image, the difference (subR, subG, subB) calculated for the pixels included in the partial area is summed up for each block, and a difference value (block difference) representing the block is added. Value). Each time the difference (subR, subG, subB) is added, the count value CountS associated with the difference sum value sumS is incremented by one. Therefore, the count value CountS indicates the number of difference values used for calculating the block difference value.
なお、S404、S405において、差分の大きさSが閾値T1より大きい場合だけ、差分(subR, subG, subB)を合計する理由は、光源色の特徴を示す度合が大きいと思われる差分値だけを抽出するためである。これについて図5(b)、図7を用いてより具体的に説明する。 In S404 and S405, the reason for summing the differences (subR, subG, subB) only when the difference size S is larger than the threshold value T1 is that only the difference value that is considered to have a high degree of characteristics of the light source color. It is for extracting. This will be described more specifically with reference to FIGS. 5B and 7.
図5(b)は鏡面反射を含む被写体の画像と、処理対象画素506および比較画素507〜509とを示している。ここで、輝度の高い比較画素507、509は鏡面反射成分を比較的多く含み、処理対象画素506および比較画素508は、ほぼ拡散反射成分のみからなる画素であるとする。 FIG. 5B shows an image of a subject including specular reflection, a processing target pixel 506, and comparison pixels 507 to 509. Here, it is assumed that the comparison pixels 507 and 509 having high luminance include a relatively large amount of specular reflection components, and the processing target pixel 506 and the comparison pixel 508 are pixels that are substantially composed of only diffuse reflection components.
図7(a)は、画素が含む鏡面反射成分と拡散反射成分との関係の例をRGB色空間で模式的に示している。RGB空間において、ある画素のRGB値は原点からRGB値に対応する座標へのベクトルで表すことができる。ベクトル701はRGB値が物体色(拡散反射成分)のみからなる場合を、ベクトル702は、RGB値が物体色(拡散反射成分)と光源色(鏡面反射成分)とからなる場合を示すものとする。この場合、得たい光源色(鏡面反射成分)のRGB値を示すベクトル703は、ベクトル702と701との差分ベクトルとして求めることができる。なお、ベクトルの始点はいずれも座標原点であるため、実際には座標間の差として求まるRGB値が光源のRGB値となる。従って、物体色のみからなる画素のRGB値と、物体色と光源色からなる画素のRGB値との差分を、光源色のRGB値として得ることができる。図5(b)の例では、処理対象画素506と、比較画素507または509とのRGB値の差分が、光源色のRGB値の推定値として求められる。 FIG. 7A schematically shows an example of the relationship between the specular reflection component and the diffuse reflection component included in the pixel in the RGB color space. In the RGB space, the RGB value of a certain pixel can be represented by a vector from the origin to the coordinates corresponding to the RGB value. A vector 701 indicates a case where the RGB value is composed only of an object color (diffuse reflection component), and a vector 702 indicates a case where the RGB value is composed of an object color (diffuse reflection component) and a light source color (specular reflection component). . In this case, a vector 703 indicating the RGB value of the light source color (specular reflection component) to be obtained can be obtained as a difference vector between the vectors 702 and 701. Note that since the starting point of each vector is the coordinate origin, the RGB value obtained as the difference between the coordinates is actually the RGB value of the light source. Therefore, the difference between the RGB value of the pixel consisting only of the object color and the RGB value of the pixel consisting of the object color and the light source color can be obtained as the RGB value of the light source color. In the example of FIG. 5B, the RGB value difference between the processing target pixel 506 and the comparison pixel 507 or 509 is obtained as an estimated value of the RGB value of the light source color.
一方、図5(b)における処理対象画素506と比較画素508はどちらも拡散反射成分が支配的であるため、これら画素のRGB値は図7(a)の例ではベクトル701に近い。例えば、図7(b)において、処理対象画素506と比較画素508のRGB値がそれぞれベクトル711、712であるとすると、RGB値の差分は非常に小さい値となる。図示しないが、同様に比較画素509と509とはどちらも拡散反射成分と鏡面反射成分を持っており、RGB値はいずれもベクトル702と似たベクトルで表されるため、やはりRGB値の差分は非常に小さい値となる。 On the other hand, since the diffuse reflection component is dominant in both the processing target pixel 506 and the comparison pixel 508 in FIG. 5B, the RGB values of these pixels are close to the vector 701 in the example of FIG. For example, in FIG. 7B, if the RGB values of the processing target pixel 506 and the comparison pixel 508 are vectors 711 and 712, respectively, the difference between the RGB values is very small. Although not shown in the figure, the comparison pixels 509 and 509 both have a diffuse reflection component and a specular reflection component, and the RGB values are both represented by vectors similar to the vector 702. Very small value.
比較画素507のRGB値が図7(b)のベクトル713で表されるとすると、処理対象画素506のRGB値に対応するベクトル711と、比較画素507のRGB値に対応するベクトル713の差分は大きくなる。この差分は光源色のRGB値に近いベクトルであるため、抽出したい差分である。 If the RGB value of the comparison pixel 507 is represented by the vector 713 in FIG. 7B, the difference between the vector 711 corresponding to the RGB value of the processing target pixel 506 and the vector 713 corresponding to the RGB value of the comparison pixel 507 is growing. Since this difference is a vector close to the RGB value of the light source color, it is a difference to be extracted.
このように、画素のRGB値の差分の大きさSが小さい場合は、両者が類似した反射成分を持つ場合が多いと考えられ、差分値における光源の特性の寄与は少ないと考えられるため、本実施形態では光源色の推定には使用しない。このため前述のように閾値T1を設け、差分の大きさSが閾値T1より大きい場合だけ、差分(subR, subG, subB)をシステムメモリ126で合計し、差分合計値sumS(R, G, B)を求めている。 As described above, when the magnitude S of the differences between the RGB values of the pixels is small, it is considered that the two often have similar reflection components, and the contribution of the light source characteristics to the difference values is considered to be small. In the embodiment, the light source color is not used for estimation. Therefore, the threshold value T1 is provided as described above, and only when the magnitude S of the difference is larger than the threshold value T1, the differences (subR, subG, subB) are summed in the system memory 126, and the difference sum value sumS (R, G, B )
システム制御部50は、差分合計値sumSを64個のブロックのそれぞれについて算出する。また、ブロック1の差分合計値をsumS1(R1, G1, B1)、ブロック2の差分合計値をsumS2(R2, G2, B2)、・・・、ブロック64の差分合計値をsumS64(R64, G64, B64)とする。また、差分合計値sumSに差分を加算した際、システム制御部50は差分カウント値countSに1を加算する。ブロックごとの差分合計値sumS1〜sumS64と差分カウント値countSを図6に示す。 The system control unit 50 calculates the difference sum value sumS for each of the 64 blocks. Further, the sum of differences of block 1 is sumS1 (R1, G1, B1), the sum of differences of block 2 is sumS2 (R2, G2, B2),..., The sum of differences of block 64 is sumS64 (R64, G64 , B64). When the difference is added to the difference total value sumS, the system control unit 50 adds 1 to the difference count value countS. FIG. 6 shows the difference sum values sumS1 to sumS64 and the difference count value countS for each block.
図4に戻り、S406でシステム制御部50は、全ての比較画素503〜505についてS402〜S405の処理を行ったか確認する。図5に示した通り、本実施形態では1つの処理対象画素502に対して比較画素は503、504、505の3つある。そのため全ての処理対象画素に対して、差分算出(S403)を行い、差分の大きさSが所定の閾値T1よりも大きい場合に、差分(subR, subG, subB)をシステムメモリ126で加算して、差分カウント値に1を加える。 Returning to FIG. 4, in S406, the system control unit 50 confirms whether or not the processing of S402 to S405 has been performed for all the comparison pixels 503 to 505. As shown in FIG. 5, in this embodiment, there are three comparison pixels 503, 504, and 505 for one processing target pixel 502. Therefore, the difference calculation (S403) is performed on all the processing target pixels, and the difference (subR, subG, subB) is added in the system memory 126 when the difference size S is larger than the predetermined threshold T1. 1 is added to the difference count value.
以上説明したS402〜S406の処理を、処理対象画素をラスタスキャンしながら入力画像の全画素に対して行う。 The processes of S402 to S406 described above are performed on all the pixels of the input image while raster scanning the processing target pixel.
S407までの処理により、入力画像の全画素について差分値の集計が完了すると、システム制御部50は、S408〜S413で8×8=64個のブロックのそれぞれについて平均差分値を算出する。 When the summation of the difference values for all the pixels of the input image is completed by the processing up to S407, the system control unit 50 calculates the average difference value for each of 8 × 8 = 64 blocks in S408 to S413.
まずS409でシステム制御部50は、処理対象のブロックの差分カウント値countSを参照し、差分カウント値countSが所定の閾値T2より大きいか判定する。システム制御部50は、差分カウント値countSが閾値T2より大きいブロックは鏡面反射成分を含んでいると判断して処理をS410に進める。またシステム制御部50は、差分カウント値countSが閾値T2以下のブロックについては鏡面反射成分を含んでいないと判断して次のブロックの処理に移る。 First, in step S409, the system control unit 50 refers to the difference count value countS of the block to be processed, and determines whether the difference count value countS is greater than a predetermined threshold T2. The system control unit 50 determines that the block having the difference count value countS greater than the threshold T2 includes a specular reflection component, and advances the processing to S410. Further, the system control unit 50 determines that the block whose difference count value countS is equal to or less than the threshold T2 does not include the specular reflection component, and moves to the processing of the next block.
S410でシステム制御部50は、平均差分値(blkR, blkG, blkB)を算出する。具体的には、差分合計値sumSの値をRGB成分ごとに差分カウント値countSで除算する。その結果、処理対象ブロックについての平均差分値(blkR, blkG, blkB)が得られる。 In S410, the system control unit 50 calculates average difference values (blkR, blkG, blkB). Specifically, the difference total value sumS is divided by the difference count value countS for each RGB component. As a result, an average difference value (blkR, blkG, blkB) for the processing target block is obtained.
S411でシステム制御部50は、S410で算出した処理対象ブロックの平均差分値(blkR, blkG, blkB)を、システムメモリ126内のブロック合計値(sumBlkR,sumBlkG,sumBlkB)に加算する。ブロック合計値は、後述する画像全体の平均差分値を算出するために利用される。 In S411, the system control unit 50 adds the average difference value (blkR, blkG, blkB) of the processing target block calculated in S410 to the block total value (sumBlkR, sumBlkG, sumBlkB) in the system memory 126. The block total value is used to calculate an average difference value of the entire image, which will be described later.
S412でシステム制御部50は、鏡面反射ブロック数blkCountSに1を加算する。鏡面反射ブロック数blkCountSは入力画像を分割した64個のブロックのうち、鏡面反射成分を持つと判断されたブロックの数を示している。 In S412, the system control unit 50 adds 1 to the number of specular reflection blocks blkCountS. The number of specular reflection blocks blkCountS indicates the number of blocks determined to have a specular reflection component among the 64 blocks obtained by dividing the input image.
システム制御部50は、8×8=64個の全ブロックに対して、前述のS409〜612の処理を行うと、S414で入力画像全体の平均差分値(aveR, aveG, aveB)を算出する。具体的には、システム制御部50は、ブロック合計値(sumBlkR,sumBlkG,sumBlkB)の各成分を鏡面反射ブロック数blkCountSで除算することによって入力画像全体の平均差分値(aveR, aveG, aveB)を算出する。この、入力画像全体の平均差分値(aveR, aveG, aveB)は、図5を用いて説明したとおり、鏡面反射成分の平均値を示している。 The system control unit 50 calculates the average difference value (aveR, aveG, aveB) of the entire input image in S414 when the above-described processing of S409 to 612 is performed on all 8 × 8 = 64 blocks. Specifically, the system control unit 50 divides each component of the block total value (sumBlkR, sumBlkG, sumBlkB) by the number of specular reflection blocks blkCountS to obtain the average difference value (aveR, aveG, aveB) of the entire input image. calculate. The average difference values (aveR, aveG, aveB) of the entire input image indicate the average value of the specular reflection component as described with reference to FIG.
図3に戻り、S302でシステム制御部50は、被写体の明るさ(EV値)に基づき白抽出範囲(白(無彩色)と見なす範囲)を決定する。図8はCxCy平面における白抽出範囲の例を示した図であり、図8(a)及び(b)は被写体の明るさに応じて変化する白抽出範囲の例を示している。 Returning to FIG. 3, in S <b> 302, the system control unit 50 determines a white extraction range (a range regarded as white (achromatic color)) based on the brightness (EV value) of the subject. FIG. 8 is a diagram showing an example of the white extraction range on the CxCy plane, and FIGS. 8A and 8B show examples of the white extraction range that change according to the brightness of the subject.
図8(a)は被写体が暗い場合に設定される白抽出範囲801の例を示している。被写体が暗い場合は、白熱灯や蛍光灯などの人工照明、あるいは日陰など、様々な色温度の光源が想定されるため白抽出範囲を広く設定する。一方、図8(b)は被写体が明るい場合に設定される白抽出範囲802の例を示している。被写体が明るい場合、光源は日中の太陽光の可能性が高いため、日中太陽光の色温度に対応した狭い白検出範囲を設定する。なお、本実施形態では被写体の明るさが閾値以下か閾値より高いかに基づいて、白抽出範囲801と802を切り替えるものとするが、被写体の明るさの範囲を3つ以上に分割して3つ以上の白検出範囲を切り替えてもよい。 FIG. 8A shows an example of the white extraction range 801 set when the subject is dark. When the subject is dark, a white extraction range is set wide because light sources with various color temperatures such as artificial lighting such as incandescent lamps and fluorescent lamps, or shade are assumed. On the other hand, FIG. 8B shows an example of the white extraction range 802 set when the subject is bright. When the subject is bright, the light source has a high possibility of sunlight in the daytime, so a narrow white detection range corresponding to the color temperature of daylight sunlight is set. In this embodiment, the white extraction ranges 801 and 802 are switched based on whether the brightness of the subject is equal to or lower than the threshold value, but the subject brightness range is divided into three or more and divided into three. The above white detection range may be switched.
なお、被写体の明るさを示す値の種類や算出方法に特に制限はなく、公知の任意の方法を用いることができる。例えば、画像全体の輝度平均値や、焦点検出領域の輝度平均値、人間の顔など特定の被写体に対応した領域の輝度平均値を用いてもよい。また、入力画像から被写体の明るさを求める方法ではなく、測光センサを用いて被写体の明るさを求めてもよい。また、輝度平均値を求める際に特定の領域に重みを付与するなど様々な算出方法を用いることができる。また、被写体の明るさの閾値については、予め実験的に定めておくことができる。 There is no particular limitation on the type of value indicating the brightness of the subject and the calculation method, and any known method can be used. For example, the average luminance value of the entire image, the average luminance value of the focus detection area, or the average luminance value of an area corresponding to a specific subject such as a human face may be used. Further, instead of a method of obtaining the brightness of the subject from the input image, the brightness of the subject may be obtained using a photometric sensor. In addition, various calculation methods such as assigning a weight to a specific area when obtaining the luminance average value can be used. Further, the threshold value of the brightness of the subject can be experimentally determined in advance.
S303でシステム制御部50は、入力画像が鏡面反射成分を含むか否かを判定する。具体的にはシステム制御部50は、S301で算出した鏡面反射成分の鏡面反射ブロック数blkCountSが閾値T3よりも大きいかどうか判定する。そして、鏡面反射ブロック数blkCountSが閾値T3よりも大きい場合は入力画像が鏡面反射成分を所定量以上含むと判定して処理をS304に進める。鏡面反射ブロック数blkCountSが閾値T3以下であればシステム制御部50は入力画像が鏡面反射成分の含有量が少ないと判定し、S304をスキップして処理をS305へ進める。 In step S303, the system control unit 50 determines whether the input image includes a specular reflection component. Specifically, the system control unit 50 determines whether or not the number of specular reflection blocks blkCountS of the specular reflection component calculated in S301 is larger than the threshold T3. If the number of specular reflection blocks blkCountS is larger than the threshold T3, it is determined that the input image includes a specular reflection component at a predetermined amount or more, and the process proceeds to S304. If the number of specular reflection blocks blkCountS is equal to or smaller than the threshold T3, the system control unit 50 determines that the input image has a small amount of specular reflection component, skips S304, and proceeds to S305.
S304でシステム制御部50は、鏡面反射成分に基づき、S302で設定した白抽出範囲を補正する。この処理について図8(c)に基づいて説明する。図8(c)は白抽出範囲と鏡面反射色との関係例を示した図である。
ここでは、被写体が暗い場合を例に説明する。前述したように、被写体が暗い場合には広い白抽出範囲801(図8(a))が設定されている。本実施形態においてシステム制御部50は、S301で算出した、鏡面反射成分の平均値を示す平均差分値(aveR, aveG, aveB)に基づき白抽出範囲801を補正する。
In S304, the system control unit 50 corrects the white extraction range set in S302 based on the specular reflection component. This process will be described with reference to FIG. FIG. 8C shows an example of the relationship between the white extraction range and the specular reflection color.
Here, a case where the subject is dark will be described as an example. As described above, when the subject is dark, a wide white extraction range 801 (FIG. 8A) is set. In the present embodiment, the system control unit 50 corrects the white extraction range 801 based on the average difference values (aveR, aveG, aveB) indicating the average value of the specular reflection component calculated in S301.
まずシステム制御部50は、RGB形式の平均差分値(aveR, aveG, aveB)を、CxCy平面の値(色度座標)に変換する。図8(c)において、座標803が変換後の平均差分値を示している。そして、システム制御部50は、座標803を基準としてCy方向に±d2の範囲を黒体放射軸に沿ってCx方向に±d1の範囲移動した範囲を、鏡面反射成分に基づく白抽出範囲804とする。そして、システム制御部50は、明るさに基づき算出した白抽出範囲801と鏡面反射成分に基づく白抽出範囲と重複する領域を補正後の白抽出範囲とする。図8(c)の例では、鏡面反射に基づく白抽出範囲804が、明るさに基づく白抽出範囲801に全て含まれるため、鏡面反射に基づく白抽出範囲804がそのまま補正後の白抽出範囲となる。白抽出範囲の補正が終わると、システム制御部50は処理をS305に進める。 First, the system control unit 50 converts the average difference values (aveR, aveG, aveB) in the RGB format into values (chromaticity coordinates) on the CxCy plane. In FIG. 8C, the coordinates 803 indicate the average difference value after conversion. Then, the system control unit 50 sets, as a white extraction range 804 based on the specular reflection component, a range obtained by moving the range of ± d2 in the Cy direction with respect to the coordinates 803 and a range of ± d1 in the Cx direction along the black body radiation axis. To do. Then, the system control unit 50 sets a region that overlaps the white extraction range 801 calculated based on the brightness and the white extraction range based on the specular reflection component as the corrected white extraction range. In the example of FIG. 8C, since the white extraction range 804 based on specular reflection is entirely included in the white extraction range 801 based on brightness, the white extraction range 804 based on specular reflection is directly used as the corrected white extraction range. Become. When the correction of the white extraction range is completed, the system control unit 50 advances the process to S305.
なお、d1およびd2の値は、例えば、鏡面反射成分の分布範囲に基づいて決定することができる。例えば、差分カウント値countSが閾値T2より大きいブロックについての平均差分値(blkR, blkG, blkB)が所定割合(例えば80%)以上含まれる範囲となるような値として設定することができる。 In addition, the value of d1 and d2 can be determined based on the distribution range of a specular reflection component, for example. For example, the difference count value countS can be set as a value that falls within a range that includes an average difference value (blkR, blkG, blkB) for a block that is greater than the threshold T2 within a predetermined ratio (for example, 80%).
S305で第2の抽出手段としてのシステム制御部50は、入力画像の全ての画素に対して、白抽出範囲804に含まれる色を有するか否かを判定する。白抽出範囲に含まれる画素値(Cx, Cy)は、例えばシステムメモリ126であってよいバッファに加算される。
また、システム制御部50は、白抽出範囲に含まれる画素値(Cx, Cy)を有する画素数を変数である白画素カウントに加算する。
In step S <b> 305, the system control unit 50 as the second extraction unit determines whether all pixels of the input image have a color included in the white extraction range 804. Pixel values (Cx, Cy) included in the white extraction range are added to a buffer that may be the system memory 126, for example.
Further, the system control unit 50 adds the number of pixels having pixel values (Cx, Cy) included in the white extraction range to the white pixel count that is a variable.
S306でシステムは、S305における白抽出処理の結果に基づきホワイトバランスゲインを算出する。まずシステム制御部50は、抽出した画素値(Cx, Cy)の合計値を、白画素カウント値で除算し、ホワイトバランスゲインを算出する。この演算は、白抽出範囲401に含まれる色を有する画素値の平均の算出である。図8(c)の座標805は、算出された平均値の例を示す。
次にシステム制御部50は、算出した平均値(Cx,Cy)の色空間を変換し、RGB色空間の値に変換する。このRGB値を白抽出平均RGB値(wR,wG,wB)とよぶ。
In S306, the system calculates a white balance gain based on the result of the white extraction process in S305. First, the system control unit 50 calculates the white balance gain by dividing the total value of the extracted pixel values (Cx, Cy) by the white pixel count value. This calculation is an average calculation of pixel values having colors included in the white extraction range 401. A coordinate 805 in FIG. 8C indicates an example of the calculated average value.
Next, the system control unit 50 converts the color space of the calculated average value (Cx, Cy) and converts it into a value in the RGB color space. This RGB value is called the white extraction average RGB value (wR, wG, wB).
そして、システム制御部50は、白抽出平均RGB値(wR,wG,wB)からホワイトバランスゲインを算出する。GのホワイトバランスゲインwG-Gainを固定とした場合、システム制御部50は、RとBのホワイトバランスゲイン(wR-Gain, wB-Gain)を、以下の式によって算出する。
wR-Gain = (wG / wR) × wG-Gain
wB-Gain = (wG / wB) × wG-Gain
このように、wR-Gain, wB-Gainは白抽出に基づくホワイトバランスゲイン(第1のホワイトバランスゲイン)を示している。
Then, the system control unit 50 calculates a white balance gain from the white extracted average RGB values (wR, wG, wB). When the G white balance gain wG-Gain is fixed, the system control unit 50 calculates the R and B white balance gains (wR-Gain, wB-Gain) by the following equations.
wR-Gain = (wG / wR) × wG-Gain
wB-Gain = (wG / wB) × wG-Gain
Thus, wR-Gain and wB-Gain indicate the white balance gain (first white balance gain) based on white extraction.
S307でシステム制御部50は、算出したホワイトバランスゲインを、WB増幅部201(図2)に設定する。WB増幅部201は設定されたホワイトバランスゲインに基づき入力RGB値の増幅処理を行う。 In S307, the system control unit 50 sets the calculated white balance gain in the WB amplification unit 201 (FIG. 2). The WB amplifying unit 201 amplifies input RGB values based on the set white balance gain.
以上説明したように、本実施形態は、被写体の明るさに応じて設定される白抽出範囲を、入力画像から抽出した鏡面反射成分に基づいて補正することにより、特に被写体が暗い場合における白抽出の精度を向上させることができる。その結果、ホワイトバランス調整の精度を向上させることができる。 As described above, the present embodiment corrects the white extraction range set in accordance with the brightness of the subject based on the specular reflection component extracted from the input image, and thereby performs white extraction particularly when the subject is dark. Accuracy can be improved. As a result, the accuracy of white balance adjustment can be improved.
なお、本実施形態では、鏡面反射成分の平均値(平均色)に基づいて白抽出範囲を補正したが、平均値以外の鏡面反射成分の情報を用いて白抽出範囲を補正してもよい。例えば、鏡面反射成分(Cx,Cy)の分布から標準偏差を算出し標準偏差の定数倍の範囲を鏡面反射成分に基づく白抽出範囲としてもよい。また、鏡面反射成分のCx最大値、Cx最小値、Cy最大値、Cx最大値を求め、(Cx最大値,Cy最大値)と(Cx最小値,Cy最小値)と黒体放射軸によって定まる範囲を鏡面反射成分に基づく白抽出範囲としてもよい。 In the present embodiment, the white extraction range is corrected based on the average value (average color) of the specular reflection components. However, the white extraction range may be corrected using information on specular reflection components other than the average value. For example, the standard deviation may be calculated from the distribution of the specular reflection components (Cx, Cy), and a range that is a constant multiple of the standard deviation may be used as the white extraction range based on the specular reflection component. Further, the Cx maximum value, Cx minimum value, Cy maximum value, and Cx maximum value of the specular reflection component are obtained and determined by (Cx maximum value, Cy maximum value), (Cx minimum value, Cy minimum value), and the black body radiation axis. The range may be a white extraction range based on a specular reflection component.
また、本実施形態では、入力画像がある程度の鏡面反射成分を有する場合は常に鏡面反射成分に基づく白抽出範囲の補正を行う構成を説明した。しかし、被写体の明るさに応じた白抽出範囲に基づくホワイトバランス調整の信頼度が低下する条件を満たした場合にのみ、鏡面反射成分に基づく白抽出範囲の補正を行ってもよい。例えば、被写体の明るさが所定値未満の場合のみ鏡面反射成分に基づく白抽出範囲の補正を行う構成としてもよい。 In the present embodiment, the configuration in which the white extraction range is corrected based on the specular reflection component whenever the input image has a certain amount of specular reflection component has been described. However, the white extraction range based on the specular reflection component may be corrected only when the condition that the reliability of the white balance adjustment based on the white extraction range corresponding to the brightness of the subject is lowered is satisfied. For example, the white extraction range may be corrected based on the specular reflection component only when the brightness of the subject is less than a predetermined value.
また、本実施形態では、鏡面反射成分を処理対象画素と比較画素の差分から算出する方法について述べたが、他のいかなる方法を用いて鏡面反射成分を抽出してもよい。 In this embodiment, the method of calculating the specular reflection component from the difference between the processing target pixel and the comparison pixel has been described. However, the specular reflection component may be extracted using any other method.
また、本実施形態では、入力画像を水平,垂直の両方向に8分割して64個のブロックに分割する例について説明したが、ブロックの分割方法や分割数に制限はない。例えば64以上のブロックに分割しても、画像全体を1つのブロックとして扱ってもよい。また、ブロックの大きさも同一としなくてもよい。 In the present embodiment, an example in which an input image is divided into eight blocks by dividing the input image into eight in both the horizontal and vertical directions has been described, but there is no limitation on the block division method and the number of divisions. For example, even if the image is divided into 64 or more blocks, the entire image may be handled as one block. Also, the block sizes need not be the same.
また、本実施形態は、CxCy平面の値(色度)を用いて白抽出を行ったが、他の色空間(表色系)、例えばL*a*b*色空間など別の色空間での値を用いてもよい。 In this embodiment, white extraction is performed using the value (chromaticity) of the CxCy plane. However, in another color space (color system), for example, another color space such as an L * a * b * color space. The value of may be used.
(第2の実施形態)
次に、本発明の第2の実施形態について説明する。第1の実施形態は、鏡面反射成分の色情報に基づき白抽出の範囲を制御する構成について述べた。第2の実施形態では、白抽出範囲の補正は行わずに、抽出した白色(無彩色)画素値に鏡面反射成分の色に基づく重み付けを行うことを特徴とする。
(Second Embodiment)
Next, a second embodiment of the present invention will be described. The first embodiment has described the configuration for controlling the white extraction range based on the color information of the specular reflection component. In the second embodiment, the white extraction range is not corrected, and the extracted white (achromatic) pixel value is weighted based on the color of the specular reflection component.
本実施形態においても第1の実施形態で説明したデジタルカメラ100において実施可能であるため、デジタルカメラ100の構成についての説明は省略し、本実施形態に特有なホワイトバランスゲインの算出処理について、図9〜図10を用いて説明する。 Since this embodiment can also be implemented in the digital camera 100 described in the first embodiment, a description of the configuration of the digital camera 100 is omitted, and a white balance gain calculation process unique to this embodiment is illustrated in FIG. This will be described with reference to FIGS.
図9は、本実施形態におけるホワイトバランスゲイン算出処理を説明するためのフローチャートであり、第1の実施形態と同様の動作ステップについては図3と同じ参照数字を付して説明は省略する。
S303において入力画像が鏡面反射成分を所定量以上含むと判定された場合、S904でシステム制御部50は、鏡面反射成分に基づいて白抽出重みを決定する。図10(a)はCxCy平面における白抽出範囲1001と、差分平均値(aveR, aveG, aveB)のCxCy平面座標1002の例を、図10(b)はCx座標値と重みとの関係例を、それぞれ示している。
FIG. 9 is a flowchart for explaining the white balance gain calculation process in the present embodiment. The same operation steps as those in the first embodiment are denoted by the same reference numerals as those in FIG.
If it is determined in S303 that the input image contains a predetermined amount or more of the specular reflection component, the system control unit 50 determines the white extraction weight based on the specular reflection component in S904. 10A shows an example of the white extraction range 1001 on the CxCy plane and the CxCy plane coordinates 1002 of the difference average values (aveR, aveG, aveB), and FIG. 10B shows an example of the relationship between the Cx coordinate values and the weights. , Respectively.
システム制御部50は、鏡面反射成分の平均値である差分平均値(aveR, aveG, aveB)をCxCy色空間の値(Cx, Cy)に変換し、そのCx座標値に基づき重みを決定する。具体的には図10(b)に示すように、差分平均値のCxCy平面座標(Cx, Cy)1002のCx座標値付近は大きな重み(3.0)を、一定値以上離れた座標値については小さな重み(1.0)を決定する。なお、1.0は元の値を変更しない重みであるため、重み付けしないことと等価である。
一方、S303において入力画像が鏡面反射成分を所定量以上含むと判定されなかった場合、S905でシステム制御部50は、図10(c)に示すように一定かつ小さな重み(1.0)を設定する。
The system control unit 50 converts an average difference value (aveR, aveG, aveB), which is an average value of specular reflection components, into a CxCy color space value (Cx, Cy), and determines a weight based on the Cx coordinate value. Specifically, as shown in FIG. 10B, the CxCy plane coordinate (Cx, Cy) 1002 of the difference average value has a large weight (3.0) in the vicinity of the Cx coordinate value, and the coordinate value separated by a certain value or more. Determines a small weight (1.0). Since 1.0 is a weight that does not change the original value, it is equivalent to no weighting.
On the other hand, if it is determined in S303 that the input image does not contain a specular reflection component at a predetermined amount or more, the system control unit 50 sets a constant and small weight (1.0) as shown in FIG. 10C in S905. To do.
このように、本実施形態では、入力画像が鏡面反射成分を所定量以上含む場合は、差分平均値のCxCy平面座標1002のCx座標値付近に1より大きな重みを決定する。また、入力画像が鏡面反射成分を所定量以上含まない場合と、入力画像が鏡面反射成分を所定量以上含む場合の差分平均値のCxCy平面座標1002のCx座標値付近でない部分とについては、いずれも1の重みを決定する。これにより、鏡面反射成分から推定される光源色近辺の画素値に対して1より大きな重み付けを行う。 Thus, in this embodiment, when the input image includes a specular reflection component at a predetermined amount or more, a weight greater than 1 is determined in the vicinity of the Cx coordinate value of the CxCy plane coordinate 1002 of the difference average value. In addition, when the input image does not include a specular reflection component at a predetermined amount or more, and when the input image includes a specular reflection component at a predetermined amount or more, the difference average value is not near the Cx coordinate value of the CxCy plane coordinate 1002. Also determine a weight of 1. As a result, the pixel value near the light source color estimated from the specular reflection component is weighted larger than 1.
S906でシステム制御部50は、S904、S905で算出した重みを用いた白抽出を行う。具体的には、入力画像の全ての画素に対して、その画素の色が白抽出範囲1001の範囲に入るか否かを判定する。白抽出範囲1001は、S302で被写体の明るさに応じて設定されたものである。システム制御部50は、白抽出範囲1001に入ると判定した画素値(Cx,Cy)のCx座標値に対応する重みw(Cx)を取得し、重み付き画素値を算出する。具体的には、
重み付きCx = w(Cx) × Cx
重み付きCy = w(Cx) × Cy
を算出する。システム制御部50は、重み付き画素値(w(Cx)Cx, w(Cx)Cy)を例えばシステムメモリ126であってよいバッファに加算する。また、システム制御部50は、画素ごとに算出した重みw(Cx)を変数である白画素カウントに加算する。例えば重みが3.0の場合は3を白画素カウントに加算する。
In step S906, the system control unit 50 performs white extraction using the weights calculated in steps S904 and S905. Specifically, it is determined whether or not the color of the pixel falls within the white extraction range 1001 for all the pixels of the input image. The white extraction range 1001 is set according to the brightness of the subject in S302. The system control unit 50 obtains the weight w (Cx) corresponding to the Cx coordinate value of the pixel value (Cx, Cy) determined to fall within the white extraction range 1001, and calculates the weighted pixel value. In particular,
Weighted Cx = w (Cx) × Cx
Weighted Cy = w (Cx) × Cy
Is calculated. The system control unit 50 adds weighted pixel values (w (Cx) Cx, w (Cx) Cy) to a buffer that may be the system memory 126, for example. Further, the system control unit 50 adds the weight w (Cx) calculated for each pixel to the white pixel count that is a variable. For example, when the weight is 3.0, 3 is added to the white pixel count.
S306でシステム制御部50は、重み付け白抽出の結果に基づきホワイトバランスゲインを算出する。具体的には、バッファに記憶された、重み付け画素値の合計値を、Cx成分、Cy成分ごとに白画素カウントの値で除算する。この処理は、白抽出範囲1001に含まれる画素の重み付き平均値の算出に相当する。重み付け平均値(Cx,Cy)の例を図10(a)の1003に示す。システム制御部50は、算出した重み付け平均値(Cx, Cy)をRGB色空間の値に変換した値を第1の実施形態における白抽出平均RGB値(wR,wG,wB)と同様に用いてホワイトバランスゲインを算出する。 In step S306, the system control unit 50 calculates a white balance gain based on the weighted white extraction result. Specifically, the total weighted pixel value stored in the buffer is divided by the white pixel count value for each Cx component and Cy component. This process corresponds to the calculation of the weighted average value of the pixels included in the white extraction range 1001. An example of the weighted average value (Cx, Cy) is shown at 1003 in FIG. The system control unit 50 uses a value obtained by converting the calculated weighted average value (Cx, Cy) into a value in the RGB color space, similarly to the white extraction average RGB value (wR, wG, wB) in the first embodiment. Calculate the white balance gain.
本実施形態では、入力画像から抽出した鏡面反射成分と近い画素値に1より大きな重みを付与して白抽出を行うことにより、光源色に近い可能性が高い色に重みを付けしたホワイトバランスゲインが得られる。そのため、第1の実施形態と同様、特に被写体が暗い場合など、白抽出の精度が低下する状況におけるホワイトバランスゲインの精度を向上させることができる。 In this embodiment, white extraction is performed by assigning a weight greater than 1 to a pixel value close to the specular reflection component extracted from the input image, thereby weighting a color that is likely to be close to the light source color. Is obtained. Therefore, as in the first embodiment, it is possible to improve the accuracy of the white balance gain in a situation where the accuracy of white extraction decreases, particularly when the subject is dark.
なお、本実施形態では、鏡面反射成分の平均値付近の画素値に1より大きな重み付けを行ったが、他の方法で重み付けしてもよい。例えば、鏡面反射成分のCx座標値の度数分布を生成し、度数分布が大きいCx座標値ほど大きな重みを付与してもよい。また、平均値のCx座標値から離れるにつれてより細かく段階的に重みを減らすようにしてもよい。
また、本実施形態ではCx座標値のみに基づいてCx成分とCy成分の両方の重みを決定したが、Cy座標値についても独立した重みを決定してCy成分に適用することも可能である。
In the present embodiment, the pixel values near the average value of the specular reflection component are weighted greater than 1, but may be weighted by other methods. For example, a frequency distribution of the Cx coordinate value of the specular reflection component may be generated, and a greater weight may be given to a Cx coordinate value having a larger frequency distribution. Further, the weight may be reduced in a finer stepwise manner as the distance from the average Cx coordinate value increases.
In this embodiment, the weights of both the Cx component and the Cy component are determined based on only the Cx coordinate value. However, it is also possible to determine an independent weight for the Cy coordinate value and apply it to the Cy component.
なお、図10(b)において重みを3.0にする範囲や、重み3.0から重み1.0に遷移する範囲の大きさの設定方法や重みの最大値の設定方法に制限はない。例えば暗い状況で撮影した様々な被写体の画像を用いて得られるホワイトバランスゲインの精度に基づいて実験的に定めることができる。 In FIG. 10B, there is no limitation on the setting method of the range in which the weight is set to 3.0, the size of the range in which the weight changes from 3.0 to 1.0, and the setting method of the maximum value of the weight. For example, it can be determined experimentally based on the accuracy of white balance gain obtained using images of various subjects photographed in a dark situation.
(第3の実施形態)
次に、本発明の第3の実施形態について説明する。第2の実施形態では、画像全体で抽出した鏡面反射成分に基づいて重みを決定したが、第3の実施形態では、入力画像の局所領域ごとに重みを決定、適用することを特徴とする。
(Third embodiment)
Next, a third embodiment of the present invention will be described. In the second embodiment, the weight is determined based on the specular reflection component extracted from the entire image. However, the third embodiment is characterized in that the weight is determined and applied for each local region of the input image.
本実施形態においても第1の実施形態で説明したデジタルカメラ100において実施可能であるため、デジタルカメラ100の構成についての説明は省略し、本実施形態に特有なホワイトバランスゲインの算出処理について、図11を用いて説明する。 Since this embodiment can also be implemented in the digital camera 100 described in the first embodiment, a description of the configuration of the digital camera 100 is omitted, and a white balance gain calculation process unique to this embodiment is illustrated in FIG. 11 will be used for explanation.
図11は、本実施形態におけるホワイトバランスゲイン算出処理を説明するためのフローチャートであり、第1の実施形態と同様の動作ステップについては図3と同じ参照数字を付して説明は省略する。 FIG. 11 is a flowchart for explaining the white balance gain calculation processing in the present embodiment. The same operation steps as those in the first embodiment are denoted by the same reference numerals as those in FIG.
S1103でシステム制御部50は、ブロック単位の平均色block_C(R, G, B)を算出する。ここで、ブロックは第1および第2の実施形態と同様、図5(a)に示すような8×8のメッシュブロックの1つである。システム制御部50は、画像メモリ106に蓄積された入力画像のRGBデータをブロック単位で平均化して平均色block_C(R, G, B)を算出し、全ブロックについて算出した平均色block_C(R, G, B)をシステムメモリ126に格納する。 In S1103, the system control unit 50 calculates an average color block_C (R, G, B) for each block. Here, the block is one of 8 × 8 mesh blocks as shown in FIG. 5A, as in the first and second embodiments. The system control unit 50 averages the RGB data of the input image accumulated in the image memory 106 in units of blocks to calculate an average color block_C (R, G, B), and calculates the average color block_C (R, G, B) is stored in the system memory 126.
S1104およびS1110は、S1105〜S1109の処理がブロック単位で全ブロックに対して実施されることを示している。
S1105でシステム制御部50は、ブロックの平均色をCxCy色空間の値に変換し、白抽出範囲に含まれるか否かを判定する。図12(a)に、白抽出範囲1210の例を示す。システム制御部50は、ブロックの平均色が白抽出範囲に含まれると判定されれば処理をS1106に進める。一方、ブロックの平均色が白抽出範囲に含まれると判定されなければ、システム制御部50はこのブロックに対する処理を終了し、次の未処理ブロックについてS1105からの処理を行う。未処理ブロックがなければS1111へ処理を進める。
S1104 and S1110 indicate that the processing of S1105 to S1109 is performed on all blocks in units of blocks.
In step S1105, the system control unit 50 converts the average color of the block into a value in the CxCy color space, and determines whether or not it is included in the white extraction range. FIG. 12A shows an example of the white extraction range 1210. If it is determined that the average color of the block is included in the white extraction range, the system control unit 50 advances the process to step S1106. On the other hand, if it is not determined that the average color of the block is included in the white extraction range, the system control unit 50 ends the process for this block, and performs the process from S1105 for the next unprocessed block. If there is no unprocessed block, the process proceeds to S1111.
S1106〜S1109の処理は平均色が白抽出範囲に含まれるブロック(白色ブロック)に対して実行される。S1106でシステム制御部50は、処理対象のブロックが鏡面反射成分を含むブロックかどうか判定する。第1の実施形態と同様、処理対象のブロックの差分カウント値countSが所定の閾値T2よりも大きければ鏡面反射成分を含むブロックであると判定することができる。システム制御部50は、処理対象のブロックが鏡面反射成分を含むと判定した場合はS1107に、鏡面反射成分を含まないと判定した場合はS1108に、それぞれ処理を進める。 The processing of S1106 to S1109 is executed for blocks (white blocks) whose average color is included in the white extraction range. In step S1106, the system control unit 50 determines whether the processing target block includes a specular reflection component. Similar to the first embodiment, if the difference count value countS of the block to be processed is larger than the predetermined threshold T2, it can be determined that the block includes a specular reflection component. If the system control unit 50 determines that the processing target block includes a specular reflection component, the system control unit 50 proceeds to S1107. If the system control unit 50 determines that the processing target block does not include a specular reflection component, the system control unit 50 proceeds to S1108.
S1107でシステム制御部50は、鏡面反射成分とブロック平均色と関係に基づく重みとして、鏡面反射成分とブロック平均色の差分に基づく重みを算出する。
具体的には、システム制御部50は、処理対象ブロックの差分合計値sumS(R, G, B)を、対応づけられたカウント値countSで除算した結果を鏡面反射成分のブロック平均色block_S(R, G, B)とする。
In step S1107, the system control unit 50 calculates a weight based on the difference between the specular reflection component and the block average color as the weight based on the relationship between the specular reflection component and the block average color.
Specifically, the system control unit 50 divides the difference total value sumS (R, G, B) of the processing target block by the associated count value countS, and the block average color block_S (R of the specular reflection component , G, B).
システム制御部50は、鏡面反射成分のブロック平均色block_S(R, G, B)およびブロック平均色Block_C(R, G, B)をCxCy平面の値(色度座標)に変換し、block_S(Cx, Cy), block_C(Cx, Cy)を算出する。block_S(Cx, Cy)とblock_C(Cx, Cy)と関係を図12(a)に示す。図12(a)において入力画像1200は8×8のブロックに分割されている。ここで、ブロック1201の鏡面反射成分の平均色(block_S)およびブロック平均値(block_C)が1203,1204である。また、ブロック1202の鏡面反射成分の平均色(block_S)およびブロック平均値(block_C)が1205,1206である。 The system control unit 50 converts the block average color block_S (R, G, B) and the block average color Block_C (R, G, B) of the specular reflection component into values (chromaticity coordinates) on the CxCy plane, and blocks_S (Cx , Cy), block_C (Cx, Cy). FIG. 12A shows the relationship between block_S (Cx, Cy) and block_C (Cx, Cy). In FIG. 12A, the input image 1200 is divided into 8 × 8 blocks. Here, the average color (block_S) and the block average value (block_C) of the specular reflection component of the block 1201 are 1203 and 1204. In addition, the average color (block_S) and the block average value (block_C) of the specular reflection component of the block 1202 are 1205 and 1206, respectively.
システム制御部50は、同一ブロックについて算出されたblock_S(Cx,Cy)とblock_C(Cx,Cy)との距離Dを以下の式から算出し、算出した距離に基づくブロック単位の重みを決定する。
D = |block_S (Cx) - block_C(Cx)| + | block_S(Cy) - block_C(Cy)|
The system control unit 50 calculates a distance D between block_S (Cx, Cy) and block_C (Cx, Cy) calculated for the same block from the following formula, and determines a weight for each block based on the calculated distance.
D = | block_S (Cx)-block_C (Cx) | + | block_S (Cy)-block_C (Cy) |
本実施形態において、ブロック単位の重みは、図12(b)に示すように距離Dが0から所定値までは大きな重み(ここでは3.0)とし、その後は距離が大きくなるほど重みが小さくなり、最終的には1.0になるように制御する。距離Dが大きい、すなわち同一ブロックにおける鏡面反射成分の平均色と画素値の平均色との差異が大きい場合、そのブロック内の画素の平均色は白抽出範囲内であってもホワイトバランスゲインの算出時に重視しない方が良い。一方、距離Dが小さければ、鏡面反射成分の平均色と画素値の平均色が近い色であり、ブロック平均色が実際に白である可能性が高いため、重みを大きくしてホワイトバランスゲインの算出時に重視するようにする。 In this embodiment, as shown in FIG. 12B, the weight of the block unit is a large weight (here, 3.0) when the distance D is from 0 to a predetermined value, and thereafter, the weight decreases as the distance increases. In the end, control is performed to be 1.0. When the distance D is large, that is, when the difference between the average color of the specular reflection component and the average color of the pixel values in the same block is large, the white balance gain is calculated even if the average color of the pixels in the block is within the white extraction range. Sometimes it is better not to focus on it. On the other hand, if the distance D is small, the average color of the specular reflection component and the average color of the pixel values are close, and the block average color is likely to be white. Emphasize on calculation.
一方、S1108でシステム制御部50は鏡面反射成分を含またはブロックと判定されたブロックに対する重みを決定する。本実施形態でシステム制御部50は、鏡面反射成分を含まないと判定されたブロックについては、一律に1.5の重みを決定する。なお、この重みの値は一例であり、中程度の信頼性に対応する値として、鏡面反射成分とブロック平均色と関係に基づく重みの範囲(ここでは1.0〜3.0)の中間値を適宜定めることができる。 On the other hand, in S1108, the system control unit 50 determines a weight for a block that includes a specular reflection component or is determined to be a block. In this embodiment, the system control unit 50 uniformly determines a weight of 1.5 for blocks determined not to include a specular reflection component. This weight value is an example, and an intermediate value of a weight range (here, 1.0 to 3.0) based on the relationship between the specular reflection component and the block average color as a value corresponding to medium reliability. Can be determined as appropriate.
S1109でシステム制御部50は、ブロック平均色block_C(R,G,B)に対してS1107またはS1108で決定した重みを乗算し、バッファに加算する。また、重みの値を変数であるブロック合計カウント値に加算する。これらの値は画像に含まれる白色ブロック全体の重み付き平均値を算出する際に利用する。 In S1109, the system control unit 50 multiplies the block average color block_C (R, G, B) by the weight determined in S1107 or S1108, and adds it to the buffer. Further, the weight value is added to the block total count value which is a variable. These values are used when calculating the weighted average value of the entire white block included in the image.
全ブロックについてS1105〜S1109の処理を行った後、システム制御部50は 処理をS1111に進める。S1111でシステム制御部50は、S1109で加算したブロック平均色の重み付け加算値をブロック合計カウント値で除算し、入力画像に含まれる白色ブロック全体の重み付き平均値(R, G, B)を算出する。以降は、この重み付け平均値(R, G, B)を第1の実施形態の白抽出平均RGB値(wR,wG,wB)として用いてS306でホワイトバランスゲインを算出し、S307でホワイトバランスゲインを適用する。 After performing the processing of S1105 to S1109 for all the blocks, the system control unit 50 advances the processing to S1111. In S1111, the system control unit 50 divides the weighted addition value of the block average color added in S1109 by the block total count value, and calculates the weighted average value (R, G, B) of the entire white block included in the input image. To do. Subsequently, using this weighted average value (R, G, B) as the white extraction average RGB value (wR, wG, wB) of the first embodiment, the white balance gain is calculated in S306, and the white balance gain is calculated in S307. Apply.
本実施形態では、入力画像の部分領域であるブロックのうち、平均色が白抽出範囲内の白色ブロックごとに、平均色と鏡面反射成分の平均色を算出し、その差が小さいブロックの平均色ほど大きな重みを付与して入力画像の白抽出平均を算出するようにした。そのため、鏡面反射成分に近い平均色に大きな重み付けをしてホワイトバランスゲインを算出することができ、ホワイトバランスゲインの精度を向上させることができる。本実施形態もまた、被写体が暗い場合など、白抽出の精度が低下する条件下で効果が大きい。 In the present embodiment, among the blocks that are partial areas of the input image, the average color and the average color of the specular reflection component are calculated for each white block whose average color is within the white extraction range, and the average color of the blocks having a small difference is calculated. The white extraction average of the input image is calculated with a greater weight. Therefore, the white balance gain can be calculated by weighting the average color close to the specular reflection component with a large weight, and the accuracy of the white balance gain can be improved. This embodiment is also very effective under conditions where the accuracy of white extraction is reduced, such as when the subject is dark.
なお、本実施形態では、ブロック単位で色平均値と鏡面反射成分の平均値とを比較したが、部分領域単位であれば、部分領域の大きさや形状には制限がない。 In the present embodiment, the color average value and the average value of the specular reflection component are compared in units of blocks. However, the size and shape of the partial areas are not limited as long as they are in units of partial areas.
(第4の実施形態)
次に、本発明の第4の実施形態について説明する。第1〜第3の実施形態では、鏡面反射成分に基づいて白抽出範囲や白抽出結果の重みを制御したが、第4の実施形態では、ホワイトバランスゲインの範囲を鏡面反射成分に基づいて制御することを特徴とする。
(Fourth embodiment)
Next, a fourth embodiment of the present invention will be described. In the first to third embodiments, the white extraction range and the weight of the white extraction result are controlled based on the specular reflection component. In the fourth embodiment, the white balance gain range is controlled based on the specular reflection component. It is characterized by doing.
本実施形態においても第1の実施形態で説明したデジタルカメラ100において実施可能であるため、デジタルカメラ100の構成についての説明は省略し、本実施形態に特有なホワイトバランスゲインの算出処理について、図13〜図15を用いて説明する。 Since this embodiment can also be implemented in the digital camera 100 described in the first embodiment, a description of the configuration of the digital camera 100 is omitted, and a white balance gain calculation process unique to this embodiment is illustrated in FIG. This will be described with reference to FIGS.
図13は、本実施形態におけるホワイトバランスゲイン算出処理を説明するためのフローチャートであり、第1の実施形態と同様の動作ステップについては図3と同じ参照数字を付して説明は省略する。 FIG. 13 is a flowchart for explaining the white balance gain calculation processing in the present embodiment. The same operation steps as those in the first embodiment are denoted by the same reference numerals as those in FIG.
S1405でシステム制御部50は、被写体の明るさに基づきホワイトバランスゲインの限界値を決定する。ホワイトバランスゲインの限界値について図14を用いて説明する。図14(a)はRとBのホワイトバランスゲイン(wR-Gain, wB-Gain)の関係例を示す図である。本実施形態では、RとBのホワイトバランスゲイン(wR-Gain, wB-Gain)を、黒体放射軸1501上の値を取るように制御するものとする。なお、光源が蛍光灯の場合など、実際にはホワイトバランスゲインが黒体放射軸から外れた値となることもあるが、ここでは説明および理解を容易にするため、ホワイトバランスゲインがすべて黒体放射軸1501上の値を有する場合について説明する。図14(a)において、Lo_limは低色温度側の限界値、Hi_limは高色温度側の限界値である。 In step S1405, the system control unit 50 determines the limit value of the white balance gain based on the brightness of the subject. The limit value of the white balance gain will be described with reference to FIG. FIG. 14A is a diagram showing an example of the relationship between R and B white balance gains (wR-Gain, wB-Gain). In the present embodiment, it is assumed that the white balance gains (wR-Gain, wB-Gain) of R and B are controlled to take values on the black body radiation axis 1501. In some cases, such as when the light source is a fluorescent lamp, the white balance gain may actually deviate from the black body radiation axis. However, for ease of explanation and understanding, the white balance gain is all black body. A case of having a value on the radial axis 1501 will be described. In FIG. 14A, Lo_lim is a limit value on the low color temperature side, and Hi_lim is a limit value on the high color temperature side.
S1405においてシステム制御部50は、被写体の明るさ(たとえばEV値)が所定の閾値以下の暗い場合は、ホワイトバランスゲインの限界値をLo_lim1およびHi_lim1に設定する。また、システム制御部50は、被写体の明るさが所定の閾値より大きい場合は、ホワイトバランスゲインの限界値をLo_lim2およびHi_lim2に設定する。このように設定する理由は、被写体が明るい場合は光源が日中の太陽光の可能性が高く、ホワイトバランスゲインが取り得る範囲を日中の太陽光に対応した狭い範囲に制限する。一方、被写体が暗い場合は、様々な光源が存在する可能性があるため、ホワイトバランスゲインが取り得る範囲が日中の太陽光に対応する範囲より広くなるように限界値を設定する。 In S1405, the system control unit 50 sets the white balance gain limit values to Lo_lim1 and Hi_lim1 when the brightness of the subject (for example, the EV value) is dark below a predetermined threshold. Further, the system control unit 50 sets the limit value of the white balance gain to Lo_lim2 and Hi_lim2 when the brightness of the subject is larger than a predetermined threshold. The reason for this setting is that when the subject is bright, the light source has a high possibility of sunlight in the daytime, and the range that the white balance gain can take is limited to a narrow range corresponding to daylight in the daytime. On the other hand, when the subject is dark, various light sources may exist, and therefore the limit value is set so that the range that the white balance gain can take is wider than the range corresponding to daylight in the daytime.
S1406でシステム制御部50は、第1の実施形態のS303と同様にして入力画像が鏡面反射成分を含むか否かを判定し、鏡面反射成分を含むと判定した場合はS1407へ、鏡面反射成分を含まないと判定した場合はS1409へ、処理を進める。 In S1406, the system control unit 50 determines whether or not the input image includes a specular reflection component in the same manner as in S303 of the first embodiment. If it is determined that the input image includes a specular reflection component, the system control unit 50 proceeds to S1407. If it is determined that it does not contain, the process proceeds to S1409.
S1407でシステム制御部50は、鏡面反射成分の基準値からの差分を算出する。具体的には、システム制御部50は、鏡面反射成分の平均Cx値とCxの基準値Cx_baseとの差分を距離d_baseとして算出する。すなわち、距離d_base = Cx - Cx_baseである。 In step S1407, the system control unit 50 calculates a difference from the reference value of the specular reflection component. Specifically, the system control unit 50 calculates the difference between the average Cx value of the specular reflection component and the reference value Cx_base of Cx as the distance d_base. That is, the distance d_base = Cx−Cx_base.
図14(b)に距離d_baseの例を示す。図14(b)はCxCy平面における白抽出範囲1502と、鏡面反射成分の平均値1503,1504の例を示している。図14(b)では、基準値Cx_base=0にした場合の例を示している。鏡面反射成分の平均値1503についての距離をd_base1、鏡面反射成分の平均値1504についての距離をd_base2で示している。基準値Cx_baseは、鏡面反射成分の色温度が高いか低いかを判定するための閾値であり、他の値を用いてもよい。例えば、基準値は、Cx_base=0以外に太陽光(D50光源)のCx値を基準として用いてもよい。鏡面反射成分の色温度が高いと判定されればホワイトバランスゲインの高色温度側の限界値を制御し、鏡面反射成分の色温度が低いと判定されればホワイトバランスゲインの低色温度側の限界値を制御する。 FIG. 14B shows an example of the distance d_base. FIG. 14B shows an example of a white extraction range 1502 on the CxCy plane and average values 1503 and 1504 of specular reflection components. FIG. 14B shows an example in which the reference value Cx_base = 0 is set. The distance for the average value 1503 of the specular reflection component is indicated by d_base1, and the distance for the average value 1504 of the specular reflection component is indicated by d_base2. The reference value Cx_base is a threshold value for determining whether the color temperature of the specular reflection component is high or low, and other values may be used. For example, the reference value may be a Cx value of sunlight (D50 light source) other than Cx_base = 0. If the color temperature of the specular reflection component is determined to be high, the limit value on the high color temperature side of the white balance gain is controlled, and if the color temperature of the specular reflection component is determined to be low, the low color temperature side of the white balance gain is controlled. Control limit values.
S1408でシステム制御部50は、S1407で算出した距離d_baseに基づき、S1405で算出したホワイトバランスゲイン限界値を補正する。この処理について図14(c)および図15を用いて説明する。 In step S1408, the system control unit 50 corrects the white balance gain limit value calculated in step S1405 based on the distance d_base calculated in step S1407. This process will be described with reference to FIG. 14C and FIG.
図14(c)は図14(a)と同様にRとBのホワイトバランスゲイン(wR-Gain, wB-Gain)の関係例を示す図であるが、低色温度の限界値Lo_lim3および、高色温度の限界値Hi_lim3が追加されている。システム制御部50は、S1407で算出した距離d_baseと図15に示す特性に基づき、ホワイトバランスゲインの限界値を補正する。 FIG. 14C is a diagram showing an example of the relationship between R and B white balance gains (wR-Gain, wB-Gain) as in FIG. 14A, but the low color temperature limit value Lo_lim3 and high A color temperature limit value Hi_lim3 has been added. The system control unit 50 corrects the limit value of the white balance gain based on the distance d_base calculated in S1407 and the characteristics shown in FIG.
図15(a)は距離d_baseがプラスの場合(鏡面反射成分が低色温度である場合)、図15(b)は距離d_baseがマイナスの場合(鏡面反射成分が高色温度である場合)の限界値の制御特性を示している。距離d_baseがプラスの場合は、鏡面反射成分の色温度が低い場合であるため、システム制御部50は図15(a)の特性に従って距離d_baseが大きくなるほど高色温度側の限界値を小さくするように制御する。すなわち、鏡面反射成分により光源が低色温度である可能性が高いため、より高色温度側の色を取り込みにくくなるように高色温度側の限界値を小さくするように制御する。そして、システム制御部50は、距離d_baseに応じた高色温度側の限界値と、S1405で決定した明るさに基づく高色温度側の限界値Hi_limと比較し、小さい方を最終的な高色温度側の限界値として決定する。 15A shows a case where the distance d_base is positive (when the specular reflection component is a low color temperature), and FIG. 15B shows a case where the distance d_base is negative (when the specular reflection component is a high color temperature). The control characteristic of the limit value is shown. When the distance d_base is positive, the color temperature of the specular reflection component is low. Therefore, the system control unit 50 decreases the limit value on the high color temperature side as the distance d_base increases according to the characteristics of FIG. To control. That is, since there is a high possibility that the light source has a low color temperature due to the specular reflection component, control is performed to reduce the limit value on the high color temperature side so that it is difficult to capture colors on the higher color temperature side. Then, the system control unit 50 compares the limit value on the high color temperature side according to the distance d_base with the limit value Hi_lim on the high color temperature side based on the brightness determined in S1405, and the smaller one is the final high color It is determined as the temperature limit value.
一方、距離d_baseがマイナスの場合は、鏡面反射成分の色温度が高い場合であるため、システム制御部50は図15(b)の特性に従って距離d_baseの絶対値が大きくなるほど低色温度側の限界値を大きくするように制御する。すなわち、鏡面反射成分により光源が高色温度である可能性が高いため、より低色温度側の色を取り込みにくくなるように低色温度側の限界値を大きくするように制御する。そして、システム制御部50は、距離d_baseに応じた低色温度側の限界値と、S1405で決定した明るさに基づく低色温度側の限界値Lo_limと比較し、大きい方を最終的な高色温度側の限界値として決定する。 On the other hand, when the distance d_base is negative, the color temperature of the specular reflection component is high. Therefore, the system control unit 50 limits the lower color temperature side as the absolute value of the distance d_base increases according to the characteristics of FIG. Control to increase the value. That is, since there is a high possibility that the light source has a high color temperature due to the specular reflection component, control is performed to increase the limit value on the low color temperature side so that it is difficult to capture colors on the low color temperature side. Then, the system control unit 50 compares the limit value on the low color temperature side corresponding to the distance d_base with the limit value Lo_lim on the low color temperature side based on the brightness determined in S1405, and the larger one is the final high color It is determined as the temperature limit value.
S1409でシステム制御部50は、算出したホワイトバランスゲインが補正後の限界値で定まる範囲内に収まるよう必要に応じて補正するリミット処理を行う。例えば図14(a)において、S306で算出したホワイトバランスゲインが1505で示される場合のリミット処理について説明する。ホワイトバランスゲイン1505は黒体放射軸1501上の値でないため、システム制御部50はまずBのホワイトバランスゲイン(Bゲイン)のみを補正し、黒体放射軸1501上の値1506に補正する。次にシステム制御部50は、補正後のホワイトバランスゲイン1506が限界値で定まる範囲内に含まれるかどうか判定する。ここでは、ホワイトバランスゲインの限界値がLo_lim2とHi_lim2であるとする。この場合、黒体放射軸1501上の値に補正されたホワイトバランスゲイン1506はLo_lim2以下であるため、黒体放射軸1501上でLo_lim2に対応するホワイトバランスゲイン1507に補正する。一方、S306で算出したホワイトバランスゲインが黒体放射軸1501上でHi_lim2以上である場合、システム制御部50は、黒体放射軸1501上でHi_Lim2に対応するホワイトバランスゲイン1508になるように補正する。 In step S1409, the system control unit 50 performs limit processing for correcting the calculated white balance gain as necessary so that the calculated white balance gain is within a range determined by the corrected limit value. For example, in FIG. 14A, the limit process when the white balance gain calculated in S306 is indicated by 1505 will be described. Since the white balance gain 1505 is not a value on the black body radiation axis 1501, the system control unit 50 first corrects only the white balance gain (B gain) of B to a value 1506 on the black body radiation axis 1501. Next, the system control unit 50 determines whether or not the corrected white balance gain 1506 is included in the range determined by the limit value. Here, it is assumed that the limit values of the white balance gain are Lo_lim2 and Hi_lim2. In this case, since the white balance gain 1506 corrected to the value on the blackbody radiation axis 1501 is equal to or smaller than Lo_lim2, the white balance gain 1507 corresponding to Lo_lim2 is corrected on the blackbody radiation axis 1501. On the other hand, when the white balance gain calculated in S306 is equal to or higher than Hi_lim2 on the black body radiation axis 1501, the system control unit 50 corrects the white balance gain 1508 corresponding to Hi_Lim2 on the black body radiation axis 1501. .
S306で算出したホワイトバランスゲインが黒体放射軸1501上の値であり、かつ限界値で定まる範囲に含まれている場合、システム制御部50はS306で算出したホワイトバランスゲインを補正せずにそのまま用いる。 If the white balance gain calculated in S306 is a value on the blackbody radiation axis 1501 and is included in the range determined by the limit value, the system control unit 50 does not correct the white balance gain calculated in S306 without any correction. Use.
S307でシステム制御部50は、S306で算出したホワイトバランスゲインもしくはS1409で補正されたホワイトバランスゲインをWB増幅部201(図2)に設定する。 In step S307, the system control unit 50 sets the white balance gain calculated in step S306 or the white balance gain corrected in step S1409 in the WB amplification unit 201 (FIG. 2).
本実施形態では、白抽出に基づいて算出したホワイトバランスゲインを、入力画像の鏡面反射成分の情報に基づき補正する構成とした。具体的には、鏡面反射成分の色を考慮して、ホワイトバランスゲインの範囲を制御する構成とした。
光源色を示す鏡面反射成分の情報を利用して、白抽出に基づくホワイトバランスゲインの範囲を制御することにより、ホワイトバランスゲインが適切でない値となることを抑制することができ、ホワイトバランスゲインの精度を向上することができる。
In this embodiment, the white balance gain calculated based on the white extraction is corrected based on the specular reflection component information of the input image. Specifically, the range of the white balance gain is controlled in consideration of the color of the specular reflection component.
By using the specular reflection component information indicating the light source color to control the range of white balance gain based on white extraction, it is possible to suppress the white balance gain from becoming an inappropriate value. Accuracy can be improved.
なお、本実施形態では、鏡面反射成分の色温度の高低に応じてホワイトバランスゲインの範囲を制御する構成について述べたが、範囲を規定する限界値を、鏡面反射成分の色情報を利用する他の方法で設定してもよい。 In the present embodiment, the configuration in which the range of the white balance gain is controlled according to the color temperature of the specular reflection component is described. However, the limit value that defines the range is determined by using the color information of the specular reflection component. You may set by the method.
また、本実施形態では、ホワイトバランスゲインの値を黒体放射軸上の値としながら限界値を設定する構成としたが、黒体放射軸に沿った方向の範囲を制御する構成には限定されない。例えば、鏡面反射成分の色情報を利用して黒体放射軸に直交する方向に対するホワイトバランスゲインの範囲を制御する構成とすることも可能である。 In this embodiment, the limit value is set while setting the white balance gain value on the blackbody radiation axis. However, the present invention is not limited to the configuration for controlling the range in the direction along the blackbody radiation axis. . For example, it is possible to use a configuration in which the range of white balance gain in the direction orthogonal to the blackbody radiation axis is controlled using color information of the specular reflection component.
(その他の実施形態)
また、本発明は、以下の処理を実行することによっても実現される。即ち、上述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(またはCPUやMPU等)がプログラムを読み出して実行する処理である。
(Other embodiments)
The present invention can also be realized by executing the following processing. That is, software (program) that realizes the functions of the above-described embodiments is supplied to a system or apparatus via a network or various storage media, and a computer (or CPU, MPU, etc.) of the system or apparatus reads the program. It is a process to be executed.
Claims (16)
入力画像に含まれる鏡面反射成分を抽出する第1の抽出手段と、
前記抽出された鏡面反射成分に基づいて、前記白抽出範囲を補正する補正手段と、
前記入力画像から、前記補正された前記白抽出範囲に含まれる色を有する画素を抽出する第2の抽出手段と、
前記抽出された画素の値に基づいて、前記入力画像に対するホワイトバランスゲインを算出する算出手段と、
を有することを特徴とする画像処理装置。 Setting means for setting a white extraction range in a predetermined color space;
First extraction means for extracting a specular reflection component included in the input image;
Correction means for correcting the white extraction range based on the extracted specular reflection component;
Second extraction means for extracting pixels having a color included in the corrected white extraction range from the input image;
Calculation means for calculating a white balance gain for the input image based on the extracted pixel value;
An image processing apparatus comprising:
入力画像に含まれる鏡面反射成分を抽出する第1の抽出手段と、
前記入力画像から、前記白抽出範囲に含まれる色を有する画素を抽出する第2の抽出手段と、
前記第2の抽出手段によって抽出された画素の色に、前記抽出された鏡面反射成分との関係に基づく重み付けを行う補正手段と、
前記重み付けされた画素の色に基づいて、前記入力画像に対するホワイトバランスゲインを算出する算出手段と、
を有し、
前記補正手段は、前記色空間において前記鏡面反射成分との距離が小さい画素の色ほど大きな重み付けを行うことを特徴とする画像処理装置。 Setting means for setting a white extraction range in a predetermined color space;
First extraction means for extracting a specular reflection component included in the input image;
Second extraction means for extracting pixels having a color included in the white extraction range from the input image;
Correction means for weighting the color of the pixel extracted by the second extraction means based on the relationship with the extracted specular reflection component;
Calculation means for calculating a white balance gain for the input image based on the weighted pixel color;
Have
The image processing apparatus according to claim 1, wherein the correction unit weights a color of a pixel having a smaller distance from the specular reflection component in the color space.
前記第2の抽出手段が、前記部分領域ごとに前記画素の抽出を行い、
前記補正手段が、前記部分領域ごとに前記重み付けを行う、
ことを特徴とする請求項5記載の画像処理装置。 The first extraction means extracts the specular reflection component for each partial region of the input image;
The second extracting means extracts the pixel for each partial region;
The correction means performs the weighting for each of the partial areas;
The image processing apparatus according to claim 5.
前記抽出された画素の値に基づいて、前記入力画像に対するホワイトバランスゲインを算出する算出手段と、
前記入力画像に含まれる鏡面反射成分を抽出する第2の抽出手段と、
前記入力画像の明るさと、前記抽出された鏡面反射成分とに基づいて、ホワイトバランスゲインの限界値を決定する決定手段と、
前記算出手段が算出したホワイトバランスゲインを、前記限界値の範囲内となるように補正する補正手段と、
を有することを特徴とする画像処理装置。 First extraction means for extracting pixels having a color included in a white extraction range in a predetermined color space from an input image;
Calculation means for calculating a white balance gain for the input image based on the extracted pixel value;
Second extraction means for extracting a specular reflection component included in the input image;
Determining means for determining a limit value of white balance gain based on the brightness of the input image and the extracted specular reflection component;
Correction means for correcting the white balance gain calculated by the calculation means so as to be within the range of the limit value;
An image processing apparatus comprising:
前記補正手段は、前記補正された限界値の範囲内となるように前記算出手段が算出したホワイトバランスゲインを補正することを特徴とする請求項11記載の画像処理装置。 The determination means is configured such that the higher the color temperature of the specular reflection component, the smaller the limit value on the high color temperature side, and the lower the color temperature of the specular reflection component, the larger the limit value on the low color temperature side. Correct the limit value based on the brightness of the image,
12. The image processing apparatus according to claim 11, wherein the correction unit corrects the white balance gain calculated by the calculation unit so as to be within the range of the corrected limit value.
第1の抽出手段が、入力画像に含まれる鏡面反射成分を抽出する第1の抽出工程と、
補正手段が、前記抽出された鏡面反射成分に基づいて、前記白抽出範囲を補正する補正工程と、
第2の抽出手段が、前記入力画像から、前記補正された前記白抽出範囲に含まれる色を有する画素を抽出する第2の抽出工程と、
算出手段が、前記抽出された画素の値に基づいて、前記入力画像に対するホワイトバランスゲインを算出する算出工程と、
を有することを特徴とする画像処理装置の制御方法。 A setting step in which the setting means sets a white extraction range in a predetermined color space;
A first extraction means for extracting a specular reflection component included in the input image;
A correcting step for correcting the white extraction range based on the extracted specular reflection component;
A second extraction step in which a second extraction unit extracts pixels having a color included in the corrected white extraction range from the input image;
A calculating step of calculating a white balance gain for the input image based on the value of the extracted pixel;
A control method for an image processing apparatus, comprising:
第1の抽出手段が、入力画像に含まれる鏡面反射成分を抽出する第1の抽出工程と、
第2の抽出手段が、前記入力画像から、前記白抽出範囲に含まれる色を有する画素を抽出する第2の抽出工程と、
補正手段が、前記第2の抽出手段によって抽出された画素の色に、前記抽出された鏡面反射成分との関係に基づく重み付けを行う補正工程と、
算出手段が、前記重み付けされた画素の色に基づいて、前記入力画像に対するホワイトバランスゲインを算出する算出工程と、
を有し、
前記補正工程において前記補正手段は、前記色空間において前記鏡面反射成分との距離が小さい画素の色ほど大きな重み付けを行うことを特徴とする画像処理装置の制御方法。 A setting step in which the setting means sets a white extraction range in a predetermined color space;
A first extraction means for extracting a specular reflection component included in the input image;
A second extraction step in which a second extraction unit extracts pixels having a color included in the white extraction range from the input image;
A correction step in which the correction means weights the color of the pixel extracted by the second extraction means based on the relationship with the extracted specular reflection component;
A calculating step of calculating a white balance gain for the input image based on the weighted pixel color;
Have
The image processing apparatus control method according to claim 1, wherein in the correction step, the correction unit performs greater weighting on a color of a pixel having a smaller distance from the specular reflection component in the color space.
算出手段が、前記抽出された画素の値に基づいて、前記入力画像に対するホワイトバランスゲインを算出する算出工程と、
第2の抽出手段が、前記入力画像に含まれる鏡面反射成分を抽出する第2の抽出工程と、
決定手段が、前記入力画像の明るさと、前記抽出された鏡面反射成分とに基づいて、ホワイトバランスゲインの限界値を決定する決定工程と、
補正手段が、前記算出手段が算出したホワイトバランスゲインを、前記限界値の範囲内となるように補正する補正工程と、
を有することを特徴とする画像処理装置の制御方法。 A first extraction unit for extracting pixels having a color included in a white extraction range in a predetermined color space from an input image;
A calculating step of calculating a white balance gain for the input image based on the value of the extracted pixel;
A second extraction unit for extracting a specular reflection component included in the input image;
A determining step for determining a limit value of a white balance gain based on the brightness of the input image and the extracted specular reflection component;
A correcting step for correcting the white balance gain calculated by the calculating unit so as to be within the range of the limit value;
A control method for an image processing apparatus, comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013131051A JP2015005927A (en) | 2013-06-21 | 2013-06-21 | Image processing apparatus and control method of the same |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013131051A JP2015005927A (en) | 2013-06-21 | 2013-06-21 | Image processing apparatus and control method of the same |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2015005927A true JP2015005927A (en) | 2015-01-08 |
JP2015005927A5 JP2015005927A5 (en) | 2016-07-28 |
Family
ID=52301470
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013131051A Withdrawn JP2015005927A (en) | 2013-06-21 | 2013-06-21 | Image processing apparatus and control method of the same |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2015005927A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105407340A (en) * | 2015-11-23 | 2016-03-16 | 深圳市金立通信设备有限公司 | White balance processing method and terminal |
CN105681774A (en) * | 2016-02-26 | 2016-06-15 | 深圳市金立通信设备有限公司 | Image processing method and terminal |
WO2017043811A1 (en) * | 2015-09-09 | 2017-03-16 | 삼성전자 주식회사 | Image processing apparatus and image processing method |
KR20170030418A (en) * | 2015-09-09 | 2017-03-17 | 삼성전자주식회사 | Imaging processing device and Imaging processing method |
CN111476731A (en) * | 2020-04-01 | 2020-07-31 | Oppo广东移动通信有限公司 | Image correction method, device, storage medium and electronic device |
-
2013
- 2013-06-21 JP JP2013131051A patent/JP2015005927A/en not_active Withdrawn
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017043811A1 (en) * | 2015-09-09 | 2017-03-16 | 삼성전자 주식회사 | Image processing apparatus and image processing method |
KR20170030418A (en) * | 2015-09-09 | 2017-03-17 | 삼성전자주식회사 | Imaging processing device and Imaging processing method |
US10491875B2 (en) | 2015-09-09 | 2019-11-26 | Samsung Electronics Co., Ltd. | Image processing apparatus and image processing method |
KR102491544B1 (en) | 2015-09-09 | 2023-01-26 | 삼성전자주식회사 | Imaging processing device and Imaging processing method |
CN105407340A (en) * | 2015-11-23 | 2016-03-16 | 深圳市金立通信设备有限公司 | White balance processing method and terminal |
CN105681774A (en) * | 2016-02-26 | 2016-06-15 | 深圳市金立通信设备有限公司 | Image processing method and terminal |
CN105681774B (en) * | 2016-02-26 | 2017-11-17 | 深圳市金立通信设备有限公司 | The method and terminal of a kind of image procossing |
CN111476731A (en) * | 2020-04-01 | 2020-07-31 | Oppo广东移动通信有限公司 | Image correction method, device, storage medium and electronic device |
CN111476731B (en) * | 2020-04-01 | 2023-06-27 | Oppo广东移动通信有限公司 | Image correction method, device, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10574961B2 (en) | Image processing apparatus and image processing method thereof | |
US10397486B2 (en) | Image capture apparatus and method executed by image capture apparatus | |
JP6006543B2 (en) | Image processing apparatus and image processing method | |
JP5321163B2 (en) | Imaging apparatus and imaging method | |
JP6446790B2 (en) | Image processing apparatus, imaging apparatus, image correction method, and program | |
US8810681B2 (en) | Image processing apparatus and image processing method | |
US9961319B2 (en) | Image processing apparatus and control method thereof | |
JP2009094997A (en) | Imaging apparatus, imaging method | |
JP2015005927A (en) | Image processing apparatus and control method of the same | |
JP2015211233A (en) | Image processing apparatus and control method for image processing apparatus | |
JP2018107741A (en) | Image processing apparatus, image processing method, and program | |
JP5956844B2 (en) | Image processing apparatus and control method thereof | |
JP2009004966A (en) | Imaging device | |
CN116266877A (en) | Image processing device and method, imaging device, and computer-readable medium | |
US10469761B2 (en) | Image capturing apparatus | |
JP2017126920A (en) | Imaging apparatus | |
JP5791454B2 (en) | Imaging apparatus and control method thereof | |
JP2017130836A (en) | Image processing apparatus, image processing method, and program | |
JP5915242B2 (en) | Image processing apparatus, image processing method, image processing program, and recording medium recording the image processing program on a computer | |
JP6701299B2 (en) | Image processing apparatus and image processing method | |
JP5807378B2 (en) | Imaging apparatus, imaging method, and imaging program | |
JP6011146B2 (en) | Image processing apparatus, imaging apparatus, and image processing program | |
JP2017050591A (en) | Imaging controller, imaging control method, and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20160614 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20160614 |
|
A761 | Written withdrawal of application |
Free format text: JAPANESE INTERMEDIATE CODE: A761 Effective date: 20161121 |