JP4447520B2 - Image processing apparatus and image processing method - Google Patents

Image processing apparatus and image processing method Download PDF

Info

Publication number
JP4447520B2
JP4447520B2 JP2005189916A JP2005189916A JP4447520B2 JP 4447520 B2 JP4447520 B2 JP 4447520B2 JP 2005189916 A JP2005189916 A JP 2005189916A JP 2005189916 A JP2005189916 A JP 2005189916A JP 4447520 B2 JP4447520 B2 JP 4447520B2
Authority
JP
Japan
Prior art keywords
pixel
value
light source
image
average
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2005189916A
Other languages
Japanese (ja)
Other versions
JP2007013415A (en
Inventor
川 芳 邦 市
Original Assignee
株式会社市川ソフトラボラトリー
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 株式会社市川ソフトラボラトリー filed Critical 株式会社市川ソフトラボラトリー
Priority to JP2005189916A priority Critical patent/JP4447520B2/en
Publication of JP2007013415A publication Critical patent/JP2007013415A/en
Application granted granted Critical
Publication of JP4447520B2 publication Critical patent/JP4447520B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Color Television Image Signal Generators (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Color Image Communication Systems (AREA)

Description

本発明は、光源色を検出する画像処理装置に関する。   The present invention relates to an image processing apparatus that detects a light source color.

ビデオカメラ等においてホワイトバランスの調整を行うホワイトバランス制御装置が知られている(特許文献1,2、3参照)。この種の従来のホワイトバランス制御装置では、撮像被写体の白色領域内の信号を積分してホワイトバランスのずれを検出するのが一般的である。
特開平2-94890号公報 特開平5-344530号公報 特開平11-205806号公報
2. Description of the Related Art A white balance control device that adjusts white balance in a video camera or the like is known (see Patent Documents 1, 2, and 3). In this type of conventional white balance control device, it is common to detect a white balance deviation by integrating signals within a white region of an imaging subject.
Japanese Patent Laid-Open No. 2-94890 Japanese Patent Laid-Open No. 5-344530 JP-A-11-205806

しかしながら、実際の撮像被写体は、白色に近い色であっても完全な白色ではなく、また、光源の色温度は光源ごとに異なるため、完全な白色領域を特定するのは困難である。例えば、上述した特許文献3では、色信号と輝度信号で構成される色空間を複数の領域に分割し、各領域に含まれる信号量を検出して得られる被写体の色分布に基づいてホワイトバランスのずれを検出しているが、白色領域を基準としてホワイトバランスのずれを検出する点では、他の公知文献と同様である。   However, an actual imaging subject is not completely white even if the color is close to white, and the color temperature of the light source varies from light source to light source, so it is difficult to specify a complete white region. For example, in Patent Document 3 described above, white balance is based on the color distribution of a subject obtained by dividing a color space composed of color signals and luminance signals into a plurality of regions and detecting the amount of signal included in each region. This is the same as other known documents in that white balance deviation is detected with reference to the white region.

このように、従来のホワイトバランス制御装置は、白色領域に基づいてホワイトバランスのずれ検出とその調整を行うため、もともと白色部分の少ない撮像被写体を用いて正しくホワイトバランスの調整を行うことは困難である。また、上述したように、光源の色温度や被写体自身の色などを考慮に入れてホワイトバランスの調整を行うおうとすると、複雑な処理を行わなければならず、処理に時間がかかるという問題もある。   As described above, since the conventional white balance control device detects and adjusts the white balance deviation based on the white region, it is difficult to adjust the white balance correctly by using an imaging subject having a small white portion. is there. In addition, as described above, when white balance adjustment is performed in consideration of the color temperature of the light source or the color of the subject itself, complicated processing must be performed, and there is a problem that processing takes time. .

本発明は、上記の問題点に鑑みてなされたものであり、その目的は、簡易かつ精度良く入力画像の光源色を予測可能な画像処理装置および画像処理方法を提供することにある。   The present invention has been made in view of the above problems, and an object of the present invention is to provide an image processing apparatus and an image processing method capable of predicting the light source color of an input image easily and accurately.

本発明の一態様によれば、画像の中で該画像の画素値の平均よりも明るい、該画像中の任意の位置に設けられる第1の画素位置での画素値を検出する第1画素値検出手段と、
前記第1の領域に近接し前記第1の画素位置よりも暗い第2の画素位置での画素値を検出する第2画素値検出手段と、
前記第1画素値検出手段にて検出された画素値と前記第2画素値検出手段にて検出された画素値との差分により、前記画像に照射される光源の光源色を特定する光源色特定手段と、を備えることを特徴とする画像処理装置が提供される。
According to one aspect of the present invention, a first pixel value that detects a pixel value at a first pixel position provided at an arbitrary position in the image that is brighter than an average of the pixel values of the image in the image. Detection means;
Second pixel value detection means for detecting a pixel value at a second pixel position that is close to the first region and darker than the first pixel position;
More difference between the detected pixel values at the detected pixel values and the second pixel value detection means at the first pixel value detection means, the light source color for specifying a light source color of the light source to be irradiated on the image An image processing apparatus comprising: a specifying unit.

本発明によれば、簡易かつ精度良く入力画像の光源色を予測でき、その予測結果を用いることで、精度よくホワイトバランス調整を行うことができる。   According to the present invention, the light source color of the input image can be predicted easily and accurately, and white balance adjustment can be performed with accuracy by using the prediction result.

以下、図面を参照しながら、本発明の一実施形態について説明する。   Hereinafter, an embodiment of the present invention will be described with reference to the drawings.

図1は本発明の一実施形態による画像処理装置の概略構成を示すブロック図である。図1の画像処理装置は、画像に照射された光源色を検出する光源色検出部1と、光源色検出部1で検出した光源色の各色値に基づいてホワイトバランスを算出するホワイトバランス算出部2と、算出したホワイトバランスに基づいてホワイトバランスの調整を行うホワイトバランス補正部3とを備えている。   FIG. 1 is a block diagram showing a schematic configuration of an image processing apparatus according to an embodiment of the present invention. The image processing apparatus in FIG. 1 includes a light source color detection unit 1 that detects a light source color irradiated on an image, and a white balance calculation unit that calculates a white balance based on each color value of the light source color detected by the light source color detection unit 1. 2 and a white balance correction unit 3 that adjusts the white balance based on the calculated white balance.

まず、光源色検出部1の動作原理について説明する。物体に光が当たった場合、2つの異なる反射が起きることが知られている。一つは方向性を持たずに反射される乱反射(拡散反射)と呼ばれる反射であり、物体の色を反映している。もう一つは特定方向散乱(鏡面反射)と呼ばれる反射であり、物体の色を反映しない代わりに光源の色を持っている(http://www.rsch.tuis.ac.jp~naka/naka/scola/member/chapter5_html/chapter5.html参照)。   First, the operation principle of the light source color detection unit 1 will be described. It is known that two different reflections occur when light strikes an object. One is a reflection called diffuse reflection (diffuse reflection) that is reflected without directivity, and reflects the color of the object. The other is a reflection called specific direction scattering (specular reflection), which has the color of the light source instead of reflecting the color of the object (http: //www.rsch.tuis.ac.jp~naka/naka /scola/member/chapter5_html/chapter5.html).

ここで、ある画像から検出された輝度の高い部分(より具体的には、その画像の平均輝度よりも高い部分)の色をA、その近傍の少し輝度が落ちている部分の色をBとする。この場合、Aの位置とBの位置は近接しているため、同一物体である可能性が高い。仮に、同一物体でない場合でも、画像から多くの部分を検出して平均化等の処理を施すことで、誤差を少なくすることができる。   Here, the color of a portion with high luminance detected from a certain image (more specifically, the portion with higher luminance than the average luminance of the image) is A, and the color of a portion with a little luminance decrease in the vicinity thereof is B. To do. In this case, since the position of A and the position of B are close to each other, there is a high possibility that they are the same object. Even if they are not the same object, errors can be reduced by detecting many portions from the image and performing processing such as averaging.

乱射光をD、特定方向散乱光をSとすると、Aの位置とBの位置は近接しているため、Dは略同一である。一方、Sは、光の入射角と反射角が等しくなる近傍で急激な変化を起こすことが知られている。このため、A,Bは近似的に以下の(1)および(2)式で表すことができる。
A=fa*S+D …(1)
B=fb*S+D …(2)
ここで、faはAの位置での乱反射に対する鏡面反射の比率を表し、fbはBの位置での乱反射に対する鏡面反射の比率を表している。
Assuming that the diffuse light is D and the specific direction scattered light is S, the positions of A and B are close to each other, so D is substantially the same. On the other hand, S is known to cause a rapid change in the vicinity where the incident angle and the reflection angle of light are equal. For this reason, A and B can be approximately expressed by the following equations (1) and (2).
A = fa * S + D (1)
B = fb * S + D (2)
Here, fa represents the ratio of specular reflection to irregular reflection at the position A, and fb represents the ratio of specular reflection to irregular reflection at the position B.

物体に照射される光線を3刺激値R,G,Bでサンプルした場合、A値、B値、D値およびS値は三次元ベクトルとなる。これらベクトルは、以下の(3)〜(6)式で表される。
A=(A.R,A.G,A.B) …(3)
B=(B.R,B.G,B.B) …(4)
D=(D.R,D.G,D.B) …(5)
S=(S.R,S.G,S.B) …(6)
なお、光線を4刺激値C,M,Y,Gでサンプルした場合、A値、B値、D値およびS値は四次元ベクトルになる。
When the light beam irradiated to the object is sampled with tristimulus values R, G, and B, the A value, B value, D value, and S value are three-dimensional vectors. These vectors are expressed by the following equations (3) to (6).
A = (AR, AG, AB) (3)
B = (BR, BG, BB) (4)
D = (DR, DG, DB) (5)
S = (SR, SG, SB) (6)
When the light beam is sampled with the four stimulus values C, M, Y, and G, the A value, the B value, the D value, and the S value are four-dimensional vectors.

ある物体の色(A,B,C)が仮に、(10,20,40)だとする。このとき、この物体に対してより強い光(例えば10倍の強さの光)を照射すると、(100,200,400)となる。(10,20,40)と(100,200,400)は、光の強さが異なるものの同じ色を表している。   Assume that the color (A, B, C) of an object is (10, 20, 40). At this time, if this object is irradiated with stronger light (for example, 10 times the intensity of light), (100, 200, 400) is obtained. (10, 20, 40) and (100, 200, 400) represent the same color with different light intensities.

このように、線形のRGB空間において、ある色(R,G,B)と、その色をf倍した色(f*R,f*G,f*B)とは同一色である。   Thus, in a linear RGB space, a certain color (R, G, B) and a color (f * R, f * G, f * B) obtained by multiplying that color by f are the same color.

色(R,G,B)のホワイトバランスゲインGainR,GainBは、以下の(7)および(8)式で表される。
GainR=20/10=2.0 …(7)
GainB=20/40=0.5 …(8)
The white balance gains GainR and GainB of the colors (R, G, and B) are expressed by the following equations (7) and (8).
GainR = 20/10 = 2.0 (7)
GainB = 20/40 = 0.5 (8)

R値にゲインGainRを乗算し、B値にゲインGainBを乗算することでホワイトバランスを調整でき、ある物体の色(10,20,40)のホワイトバランス調整値は、(20,20,20)となる。これは、グレーの色を表している。同様に、強い光(100,200,400)のホワイトバランス調整値は(200,200,200)となり、やはりグレーになる。   The white balance can be adjusted by multiplying the R value by the gain GainR and multiplying the B value by the gain GainB. The white balance adjustment value for the color (10, 20, 40) of an object is (20, 20, 20) It becomes. This represents a gray color. Similarly, the white balance adjustment value for strong light (100, 200, 400) is (200, 200, 200), which is also gray.

物体の明るい場所で取得(サンプル)された画素値A,Bはそれぞれ、より厳密には以下の(9)および(10)式で表される。
A=fs*S+fd*D …(9)
ここで、fa=fs/fdとおいて、fd=1となるように正規化を行うと、(1)式と同じ式が得られる。B値も同様に正規化を行うことにより、(2)式が得られる。
More precisely, the pixel values A and B acquired (sampled) in a bright place of the object are expressed by the following expressions (9) and (10).
A = fs * S + fd * D (9)
Here, if normalization is performed so that fd = 1 when fa = fs / fd, the same expression as expression (1) is obtained. The B value is also normalized in the same way to obtain the equation (2).

上述した(1)および(2)式の差分を取ると、以下の(11)式が得られる。
A−B=(fa−fb)*S …(11)
Taking the difference between the above-described equations (1) and (2), the following equation (11) is obtained.
A−B = (fa−fb) * S (11)

(11)式より、(A−B)値は、鏡面反射光Sの倍数になることがわかる。これは、(A−B)値が鏡面反射光と同じ色(すなわち、光源色の色)を表し、物体の色にはまったく依存しないことを示している。このように、明るさを問題にして、単に色(専門的には色座標あるいは色度座標)を扱う場合には、物体の色の差(A−B)と鏡面反射光Sとは同一の色として扱うことができる。   From the equation (11), it can be seen that the (AB) value is a multiple of the specular reflection light S. This indicates that the (AB) value represents the same color as the specular reflection light (that is, the color of the light source color) and does not depend on the color of the object at all. As described above, when the brightness is a problem and only the color (specially, the color coordinate or chromaticity coordinate) is handled, the color difference (AB) of the object and the specular reflected light S are the same. Can be treated as a color.

この場合のホワイトバランスゲインGainR,GainBはそれぞれ(12)および(13)式で表される。
GainR=(fa−fb)*S.G/(fa−fb)*S.R …(12)
GainB=(fa−fb)*S.G/(fa−fb)*S.B …(13)
(12)および(13)式とも、分母と分子の(fa−fb)が打ち消されて、(14)および(15)式のようになる。
GainR=S.G/S.R …(14)
GainB=S.G/S.B …(15)
これら(14)および(15)式は、以下の(16)および(17)式と等価である。
GainR=(A.G−B.G)/(A.R−B.R) …(16)
GainB=(A.G−B.G)/(A.B−B.B) …(17)
これら(16)および(17)式からわかるように、ホワイトバランスゲインには、光源色の明るさは関係ないため、上述した(fa−fb)を無視することができる。
The white balance gains GainR and GainB in this case are expressed by equations (12) and (13), respectively.
GainR = (fa−fb) * SG / (fa−fb) * SR (12)
GainB = (fa−fb) * SG / (fa−fb) * SB (13)
In both the expressions (12) and (13), the denominator and the numerator (fa−fb) are canceled, and the expressions (14) and (15) are obtained.
GainR = SG / SR (14)
GainB = SG / SB (15)
These expressions (14) and (15) are equivalent to the following expressions (16) and (17).
GainR = (AG−BG) / (AR−BR) (16)
GainB = (AG−BG) / (AB−BB) (17)
As can be seen from these equations (16) and (17), since the brightness of the light source color is not related to the white balance gain, the above-mentioned (fa−fb) can be ignored.

以上に説明したように、ある物体の近接した2点A,Bの差分を検出することで、光源色を推測でき、その結果を用いてホワイトバランスゲインを計算することができる。   As described above, the light source color can be estimated by detecting the difference between two adjacent points A and B of a certain object, and the white balance gain can be calculated using the result.

以下、本実施形態の具体的な処理動作を説明する。図2は光源色検出部1の処理手順の一例を示すフローチャートである。まず、画像中の輝度の高い部分Aと、その近傍の輝度が少し落ちている部分Bとを検出するために、画像全体を複数画素からなるブロックに分割する(ステップS1)。以下では、図3に示すように画像を6×5画素の計30個のブロックに分割する例を示している。例えば、デジタルカメラで撮影した画像を用いて図2の処理を行う場合、一つのブロック内の画素数は5万〜50万画素である。ただし、ブロックのサイズには特に制限はなく、適宜最適な値を設定すればよい。   Hereinafter, a specific processing operation of the present embodiment will be described. FIG. 2 is a flowchart illustrating an example of a processing procedure of the light source color detection unit 1. First, in order to detect a high-luminance portion A in the image and a portion B in the vicinity of which the luminance is slightly reduced, the entire image is divided into blocks composed of a plurality of pixels (step S1). In the following, an example is shown in which an image is divided into a total of 30 blocks of 6 × 5 pixels as shown in FIG. For example, when the processing of FIG. 2 is performed using an image taken with a digital camera, the number of pixels in one block is 50,000 to 500,000 pixels. However, the block size is not particularly limited, and an optimal value may be set as appropriate.

次に、画像中の各画素の画素値を分類して格納するためのスキャン結果蓄積バッファ11内の全領域を初期化(ゼロクリア)する(ステップS2)。このバッファには、画像中の各画素の画素値がブロックごとに分類して格納される。図4は蓄積バッファ11のデータ構造を示す図である。図示のように、蓄積バッファ11は、30個のブロックに大きく分けられ、各ブロックが16個の段階を有し、各段階にSumとCntが格納される。例えば各画素値がR値、G値およびB値で構成される場合には、Sumは3次のベクトル量となり、R値、G値およびB値が格納される。あるいは、各画素値がC値、M値、Y値およびG値で構成される場合には、Sumは4次のベクトル量となり、C値、M値、Y値およびG値が格納される。Cntは各段階に格納される画素の数である。 Next, the entire area in the scan result accumulation buffer 11 for classifying and storing the pixel values of each pixel in the image is initialized (zero cleared) (step S2). In this buffer, pixel values of each pixel in the image are classified and stored for each block. FIG. 4 is a diagram showing a data structure of the accumulation buffer 11. As shown in the figure, the accumulation buffer 11 is roughly divided into 30 blocks, each block having 16 stages, and Sum and Cnt are stored in each stage. For example, when each pixel value is composed of an R value, a G value, and a B value, Sum is a third-order vector quantity, and the R value, the G value, and the B value are stored. Alternatively, when each pixel value is composed of a C value, an M value, a Y value, and a G value, Sum is a fourth-order vector quantity, and the C value, the M value, the Y value, and the G value are stored. Cnt is the number of pixels stored in each stage.

スキャン結果蓄積バッファ11の初期化が終わると、次に、画像をスキャンして各画素の画素値を順に取得する(ステップS3)。そして、取得した画素のブロック番号を検出する(ステップS4)。次に、取得した画素の明るさを示す画素値を計算し(ステップS5)、その画素値を格納すべき段階を決定する(ステップS6)。そして、決定した段階中のSumに、計算した画素値を足し合わせ、Cntに1を加算する(ステップS7)。 When the initialization of the scan result accumulation buffer 11 is completed, the image is next scanned to obtain the pixel values of the respective pixels in order (step S3). Then, the block number of the acquired pixel is detected (step S4). Next, a pixel value indicating the brightness of the acquired pixel is calculated (step S5), and a stage where the pixel value is to be stored is determined (step S6). Then, the calculated pixel value is added to Sum in the determined stage, and 1 is added to Cnt (step S7).

次に、画像中の全画素をスキャンしたか否かを判定する(ステップS8)。まだスキャンしていない画素があれば、ステップS3以降の処理を繰り返す。   Next, it is determined whether or not all the pixels in the image have been scanned (step S8). If there is a pixel that has not been scanned yet, the processing from step S3 is repeated.

スキャンが完了した場合には、各ブロックごとに、Cntが0でない段階の中で最も明るい段階のSum/CntをAとし、Cntが0でない二番目に明るい段階のSum/CntをBとし、これらA,BをAB値バッファ12に格納する(ステップS9)。   When the scan is completed, for each block, Sum / Cnt at the brightest stage among the stages where Cnt is not 0 is set as A, and Sum / Cnt at the second brightest stage where Cnt is not 0 is set as B. A and B are stored in the AB value buffer 12 (step S9).

なお、A値とB値は実際にはベクトルであるため、より詳細にはAB値バッファ12には以下の(18)〜(23)式に示す値が格納される。
A.R = 最も明るい段階のSum.R/Cnt …(18)
A.G =最も明るい段階のSum.G/Cnt …(19)
A.B =最も明るい段階のSum.B/Cnt …(20)
B.R = 二番目に明るい段階のSum.R/Cnt …(21)
B.G =二番目に明るい段階のSum.G/Cnt …(22)
B.B =二番目に明るい段階のSum.B/Cnt …(23)
Since the A value and the B value are actually vectors, the AB value buffer 12 stores values shown in the following equations (18) to (23) in more detail.
AR = Sum.R / Cnt at the brightest stage (18)
AG = Sum.G / Cnt at the brightest stage (19)
AB = Sum.B / Cnt at the brightest stage (20)
BR = Sum.R / Cnt at the second brightest stage (21)
BG = Sum.G / Cnt at the second brightest stage (22)
BB = Sum.B / Cnt at the second brightest stage (23)

図5はAB値バッファ12のデータ構造の一例を示す図である。図示のように、AB値バッファ12は各ブロックごとにA値とB値を格納する領域を有する。   FIG. 5 is a diagram showing an example of the data structure of the AB value buffer 12. As shown in the figure, the AB value buffer 12 has an area for storing the A value and the B value for each block.

上記ステップS9の処理が終了すると、すべてのブロックについてAB値バッファ12への格納が終了したか否かを判定し(ステップS10)、まだ終了していなければステップS9の処理を繰り返し、終了した場合には、AB値バッファ12の全A値の平均値と全B値の平均値との差分Cを計算する(ステップS11)。このステップS11は、上述した(11)式の演算を行っていることと等価であり、この差分Cが光源色になる。   When the process of step S9 is completed, it is determined whether or not the storage in the AB value buffer 12 has been completed for all blocks (step S10). If the process has not been completed, the process of step S9 is repeated. The difference C between the average value of all A values and the average value of all B values in the AB value buffer 12 is calculated (step S11). This step S11 is equivalent to performing the calculation of the above-described equation (11), and this difference C becomes the light source color.

上述したステップS10の処理を行う際、全ブロックのA値の平均とB値の平均を計算する代わりに、AB値バッファ12に格納されたA値とB値のそれぞれについて、大きいものからn個(1≦n<30)の平均を計算して、その差分を演算してもよい。   When performing the processing of step S10 described above, instead of calculating the average of the A values and the average of the B values of all the blocks, each of the A value and the B value stored in the AB value buffer 12 is increased from the largest to n. An average of (1 ≦ n <30) may be calculated and the difference may be calculated.

あるいは、以下の手法で(A値−B値)の重みを加重平均してもよい。実在する光Cの階調値を(C.R,C.G,C.B)とし、(A値−B値)をS=(S.R,S.G,S.B)とする。このとき、色距離kは以下の(24)式で表される。

Figure 0004447520
Alternatively, the weight of (A value−B value) weights may be averaged by the following method. Assume that the gradation value of the actual light C is (CR, CG, CB), and (A value−B value) is S = (SR, SG, SB). At this time, the color distance k is expressed by the following equation (24).
Figure 0004447520

(24)式に示すkを偏差として、その逆数1/kを各ブロックの(A値−B値)の重みとして加重平均することが考えられる。ここで、k=0の場合には、重みが無限大となるため、実装上は重み=1/(k+1)のように近似させればよい。   It can be considered that k shown in the equation (24) is a deviation and the inverse 1 / k is weighted and averaged as a weight of (A value−B value) of each block. Here, when k = 0, the weight is infinite, so that it may be approximated as weight = 1 / (k + 1) in implementation.

光源色検出部1は、上述したステップS10で計算された差分Cを光源色として記憶する。以上で、光源色検出部1の処理が終了する。   The light source color detection unit 1 stores the difference C calculated in step S10 described above as a light source color. Thus, the processing of the light source color detection unit 1 is completed.

光源色検出部1の処理が終わった後、図1のホワイトバランス算出部2は、図6のフローチャートの処理手順に沿ってホワイトバランスゲインを計算する。まず、上述した(16)式に従って、R値のホワイトバランスゲインGainRを計算する(ステップS21)。具体的には、光源色検出部1で検出した光源色のG値/光源色のR値をGainRとして計算する。   After the processing of the light source color detection unit 1 is finished, the white balance calculation unit 2 in FIG. 1 calculates a white balance gain according to the processing procedure of the flowchart in FIG. First, the white balance gain GainR of the R value is calculated according to the above equation (16) (step S21). Specifically, the G value of the light source color / the R value of the light source color detected by the light source color detection unit 1 is calculated as GainR.

次に、(17)式に従って、B値のホワイトバランスゲインGainBを計算する(ステップS22)。具体的には、光源色検出部1で検出した光源色のG値/光源色のB値をGainBとして計算する。以上により、ホワイトバランス算出部2の処理が終了する。   Next, a B-value white balance gain GainB is calculated according to equation (17) (step S22). Specifically, the G value of the light source color / the B value of the light source color detected by the light source color detection unit 1 is calculated as GainB. Thus, the processing of the white balance calculation unit 2 ends.

上述した(16)および(17)式は、光源色が白(R値、G値およびB値が同一値)としているが、光源色は必ずしも白である必要はない。例えば、人間が色順応しにくい低い色温度の光源の場合、若干黄色成分がある方が自然に見えることがある。この場合、例えば、光源色<3500K(ケルビン)のときは、以下の(25)〜(27)式に従ってホワイトバランスゲインを計算すればよい。
R値のホワイトバランスゲイン=0.9*Gc*Rc …(25)
G値のホワイトバランスゲイン=Gc/Gc=1 …(26)
B値のホワイトバランスゲイン=1.1*Gc/Bc …(27)
In the expressions (16) and (17) described above, the light source color is white (the R value, the G value, and the B value are the same value), but the light source color is not necessarily white. For example, in the case of a light source with a low color temperature that is difficult for humans to adapt to color, it may look natural if there is a slight yellow component. In this case, for example, when the light source color <3500 K (Kelvin), the white balance gain may be calculated according to the following equations (25) to (27).
White balance gain of R value = 0.9 * Gc * Rc (25)
White balance gain of G value = Gc / Gc = 1 (26)
B value white balance gain = 1.1 * Gc / Bc (27)

一方、光源色≧3500Kのときは、以下の(28)〜(30)式に従ってホワイトバランスゲインを計算すればよい。
R値のホワイトバランスゲイン=Gc/Rc …(28)
G値のホワイトバランスゲイン=Gc/Gc=1 …(29)
B値のホワイトバランスゲイン=Gc/Bc …(30)
On the other hand, when the light source color ≧ 3500K, the white balance gain may be calculated according to the following equations (28) to (30).
White balance gain of R value = Gc / Rc (28)
White balance gain of G value = Gc / Gc = 1 (29)
B value white balance gain = Gc / Bc (30)

ホワイトバランスゲインの算出が終了すると、次に、図1のホワイトバランス補正部3は、図7のフローチャートの処理手順に沿って、ホワイトバランス算出部2が算出したホワイトバランスゲインGainR,GainBを用いて、画像のホワイトバランス調整を行う。   When the calculation of the white balance gain is completed, the white balance correction unit 3 in FIG. 1 uses the white balance gains GainR and GainB calculated by the white balance calculation unit 2 in accordance with the processing procedure of the flowchart in FIG. , Adjust the white balance of the image.

まず、画像をスキャンして画素を順に取得し(ステップS31)、各画素のR値およびB値をそれぞれ以下の(31)および(32)式に従って補正する(ステップS32)。
R値=R値*(R値のホワイトバランスゲイン) …(31)
B値=B値*(B値のホワイトバランスゲイン) …(32)
これにより、ホワイトバランス調整を行った最終的な画像データが得られる。
First, the image is scanned to obtain pixels in order (step S31), and the R value and B value of each pixel are corrected according to the following equations (31) and (32), respectively (step S32).
R value = R value * (white balance gain of R value) (31)
B value = B value * (white balance gain of B value) (32)
Thereby, final image data subjected to white balance adjustment is obtained.

このように、本実施形態では、入力画像中の近接した2点A,Bの画素値の差分を取ることで光源色を検出し、その光源色を用いてホワイトバランス調整を行うため、画像の色に左右されずに、きわめて簡易かつ精度よくホワイトバランス調整を行うことができる。   Thus, in this embodiment, since the light source color is detected by taking the difference between the pixel values of two adjacent points A and B in the input image and the white balance is adjusted using the light source color, Regardless of the color, the white balance can be adjusted very easily and accurately.

上述した図2のステップS9では、AB値バッファ12中でCnt値が0でない段階を対象としてA値とB値を決定したが、Cntが例えば対象ブロック内の全画素数の所定割合(例えば1%)以上となる段階の中で最も明るい段階のSumをA値とし、二番目に明るい段階のSumをB値としてもよい。このように、A値とB値の候補を予め絞り込むことで、画像のノイズの影響を軽減できる。   In step S9 of FIG. 2 described above, the A value and the B value are determined for the stage where the Cnt value is not 0 in the AB value buffer 12, but Cnt is, for example, a predetermined ratio of the total number of pixels in the target block (for example, 1 %), The brightest stage Sum may be the A value, and the second brightest Sum may be the B value. In this way, the influence of image noise can be reduced by narrowing down the candidates for the A value and the B value in advance.

また、上述したステップS9では、最も明るい段階のSumをA値、二番目に明るい段階のSumをB値としたが、最も明るい段階から数段階のSumの平均をA値とし、その次に明るい段階から数段階のSumの平均をB値としてもよい。   In step S9 described above, the brightest stage Sum is A value and the second brightest Sum is B value, but the average of Sum from the brightest stage to several stages is A value and the next brightest. The average of Sum from several stages may be used as the B value.

また、上述したステップS9において、AB値バッファ12に格納されたSumのうち、所定の基準値に満たないSumはA値とB値の対象から予め除外してもよい。   In step S9 described above, among the sums stored in the AB value buffer 12, Sums that do not satisfy the predetermined reference value may be excluded in advance from the target of the A value and the B value.

図1に示す画像処理装置は、すべての構成部分をソフトウェアで実現することができる。したがって、例えば、パーソナルコンピュータのオペレーティングシステム上で起動するアプリケーションソフトウェアの形態で実現したり、あるいはデジタルカメラ内のファームウェアとして実装することも可能である。いずれの場合も、上述した図2および図6の処理手順はマイクロプロセッサにより実行可能である。   The image processing apparatus shown in FIG. 1 can realize all the components by software. Therefore, for example, it can be realized in the form of application software activated on an operating system of a personal computer, or can be implemented as firmware in a digital camera. In any case, the processing procedures of FIGS. 2 and 6 described above can be executed by a microprocessor.

本発明の具体的な実装形態は、例えばプリンタ、デジタル現像機、街角にあるデジタルカメラ写真印刷機や、プリント倶楽部(登録商標)などである。   Specific implementation forms of the present invention are, for example, a printer, a digital developing machine, a digital camera photo printer on a street corner, a print club (registered trademark), and the like.

また、本発明の構成要件の少なくとも一部を半導体チップ等のハードウェアで構成してもよい。ハードウェアで構成することにより、処理の迅速化が図れる。また、システムLSIの内部に本発明を実装してもよい。   Further, at least a part of the configuration requirements of the present invention may be configured by hardware such as a semiconductor chip. By configuring with hardware, processing can be speeded up. Further, the present invention may be implemented inside the system LSI.

本発明の一実施形態による画像処理装置の概略構成を示すブロック図。1 is a block diagram showing a schematic configuration of an image processing apparatus according to an embodiment of the present invention. 光源色検出部1の処理手順の一例を示すフローチャート。6 is a flowchart illustrating an example of a processing procedure of the light source color detection unit 1. 画像を30個のブロックに分割した例を示す図。The figure which shows the example which divided | segmented the image into 30 blocks. 蓄積バッファ11のデータ構造を示す図。The figure which shows the data structure of the storage buffer 11. AB値バッファ12のデータ構造の一例を示す図。The figure which shows an example of the data structure of the AB value buffer. ホワイトバランス算出部の処理手順の一例を示すフローチャート。The flowchart which shows an example of the process sequence of a white balance calculation part. ホワイトバランス補正部の処理手順の一例を示すフローチャート。The flowchart which shows an example of the process sequence of a white balance correction | amendment part.

符号の説明Explanation of symbols

1 光源色検出部
2 ホワイトバランス算出部
3 ホワイトバランス補正部
11 スキャン結果蓄積バッファ
12 AB値バッファ
DESCRIPTION OF SYMBOLS 1 Light source color detection part 2 White balance calculation part 3 White balance correction | amendment part 11 Scan result accumulation | storage buffer 12 AB value buffer

Claims (5)

画像の中で該画像の画素値の平均よりも明るい、該画像中の任意の位置に設けられる第1の画素位置での画素値を検出する第1画素値検出手段と、
前記第1の領域に近接し前記第1の画素位置よりも暗い第2の画素位置での画素値を検出する第2画素値検出手段と、
前記第1画素値検出手段にて検出された画素値と前記第2画素値検出手段にて検出された画素値との差分により、前記画像に照射される光源の光源色を特定する光源色特定手段と、を備えることを特徴とする画像処理装置。
First pixel value detection means for detecting a pixel value at a first pixel position provided at an arbitrary position in the image that is brighter than an average of the pixel values of the image in the image ;
Second pixel value detection means for detecting a pixel value at a second pixel position that is close to the first region and darker than the first pixel position;
More difference between the detected pixel values at the detected pixel values and the second pixel value detection means at the first pixel value detection means, the light source color for specifying a light source color of the light source to be irradiated on the image An image processing apparatus comprising: an identification unit;
画像をそれぞれが複数画素からなる複数のブロックに分割して、各ブロック内の各画素の輝度を複数段階に分類する輝度分類手段を備え、
前記第1画素値検出手段は、各ブロックごとに、最も明るい段階に分類された画素の平均画素値をそれぞれ検出し、
前記第2画素値検出手段は、各ブロックごとに、二番目に明るい段階に分類された画素の平均画素値をそれぞれ検出し、
前記光源色特定手段は、前記第1画素値検出手段にて検出されたブロックごとの画素値の平均値の少なくとも一部と、前記第2画素値検出手段にて検出されたブロックごとの画素値の平均値の少なくとも一部との差分に基づいて、前記光源色を特定することを特徴とする請求項1に記載の画像処理装置。
A luminance classification means for dividing an image into a plurality of blocks each consisting of a plurality of pixels and classifying the luminance of each pixel in each block into a plurality of stages,
The first pixel value detecting means detects an average pixel value of pixels classified in the brightest stage for each block,
The second pixel value detecting means detects an average pixel value of pixels classified in the second brightest stage for each block,
The light source color specifying means includes at least a part of an average value of pixel values for each block detected by the first pixel value detecting means and a pixel value for each block detected by the second pixel value detecting means. The image processing apparatus according to claim 1, wherein the light source color is specified based on a difference from at least a part of an average value of the light source.
画像をそれぞれが複数画素からなる複数のブロックに分割して、各ブロック内の各画素の輝度を複数段階に分類する輝度分類手段を備え、
前記第1画素値検出手段にて検出されたブロックごとの画素値の平均値のうち、平均値の大きい順に所定個のブロックのそれぞれに対応する所定個の平均値を検出する第1の画素平均値検出手段と、
前記第2画素値検出手段にて検出されたブロックごとの画素値の平均値のうち、平均値の大きい順に所定個のブロックのそれぞれに対応する所定個の平均値を検出する第2の画素平均値検出手段と、を備え、
前記光源色特定手段は、前記第1の画素平均値検出手段にて検出された平均値と前記第2の画素平均値検出手段にて検出された平均値との差分に基づいて、前記光源色を特定することを特徴とする請求項に記載の画像処理装置。
A luminance classification means for dividing an image into a plurality of blocks each consisting of a plurality of pixels and classifying the luminance of each pixel in each block into a plurality of stages,
A first pixel average for detecting a predetermined average value corresponding to each of the predetermined blocks in descending order of the average value among the average values of the pixel values detected by the first pixel value detecting means. A value detection means;
A second pixel average for detecting a predetermined average value corresponding to each of the predetermined blocks in descending order of the average value among the average values of the pixel values for each block detected by the second pixel value detecting means; A value detection means,
The light source color specifying means is based on a difference between the average value detected by the first pixel average value detecting means and the average value detected by the second pixel average value detecting means. the image processing apparatus according to claim 1, wherein the identifying the.
前記光源色特定手段にて検出された光源色に基づいてホワイトバランス調整を行うホワイトバランス調整手段と、
前記光源色特定手段にて検出された光源色を構成する複数の色成分に基づいて、ホワイトバランス調整を行うためのホワイトバランスゲインを算出するホワイトバランス算出手段と、を備え、
前記ホワイトバランス調整手段は、前記ホワイトバランスゲインに基づいてホワイトバランス調整を行うことを特徴とする請求項1乃至3のいずれかに記載の画像処理装置。
White balance adjustment means for performing white balance adjustment based on the light source color detected by the light source color specifying means;
White balance calculating means for calculating a white balance gain for performing white balance adjustment based on a plurality of color components constituting the light source color detected by the light source color specifying means,
The white balance adjusting means, the image processing apparatus according to any one of claims 1 to 3, characterized in that the white balance adjustment is performed based on the white balance gain.
画像の中で該画像の画素値の平均よりも明るい、該画像中の任意の位置に設けられる第1の画素位置での画素値を検出するステップと、
前記第1の領域に近接し前記第1の画素位置よりも暗い第2の画素位置での画素値を検出するステップと、
前記第1画素位置で検出された画素値と前記第2画素位置で検出された画素値との差分に基づいて、前記画像に照射される光源の光源色を特定するステップと、を備えることを特徴とする画像処理方法。
Detecting a pixel value at a first pixel position provided at an arbitrary position in the image that is brighter than an average of the pixel values of the image in the image ;
Detecting a pixel value at a second pixel position proximate to the first region and darker than the first pixel position;
Identifying a light source color of a light source irradiated on the image based on a difference between a pixel value detected at the first pixel position and a pixel value detected at the second pixel position. A featured image processing method.
JP2005189916A 2005-06-29 2005-06-29 Image processing apparatus and image processing method Active JP4447520B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005189916A JP4447520B2 (en) 2005-06-29 2005-06-29 Image processing apparatus and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005189916A JP4447520B2 (en) 2005-06-29 2005-06-29 Image processing apparatus and image processing method

Publications (2)

Publication Number Publication Date
JP2007013415A JP2007013415A (en) 2007-01-18
JP4447520B2 true JP4447520B2 (en) 2010-04-07

Family

ID=37751352

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005189916A Active JP4447520B2 (en) 2005-06-29 2005-06-29 Image processing apparatus and image processing method

Country Status (1)

Country Link
JP (1) JP4447520B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8970728B2 (en) 2012-05-16 2015-03-03 Canon Kabushiki Kaisha Image pickup apparatus and image processing method
US8988549B2 (en) 2012-06-22 2015-03-24 Canon Kabushiki Kaisha Image processing apparatus and control method therefor
US9129188B2 (en) 2012-06-22 2015-09-08 Canon Kabushiki Kaisha Image processing apparatus and control method thereof
US10212780B2 (en) 2015-12-14 2019-02-19 Olympus Corporation Light source device

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5941351B2 (en) * 2012-06-25 2016-06-29 キヤノン株式会社 Image processing apparatus and control method thereof
JP5956844B2 (en) * 2012-06-22 2016-07-27 キヤノン株式会社 Image processing apparatus and control method thereof
JP5973804B2 (en) * 2012-06-25 2016-08-23 キヤノン株式会社 Image processing apparatus and control method thereof
JP6261430B2 (en) 2014-04-01 2018-01-17 キヤノン株式会社 Imaging apparatus and image processing system
JP6415139B2 (en) * 2014-07-02 2018-10-31 キヤノン株式会社 Focus detection apparatus, imaging apparatus, focus detection method, and focus detection program
CN107801013B (en) 2017-10-30 2019-05-17 Oppo广东移动通信有限公司 White balancing treatment method and device, electronic device and computer readable storage medium
CN107801012B (en) 2017-10-30 2019-05-17 Oppo广东移动通信有限公司 White balancing treatment method and device, electronic device and computer readable storage medium
CN107635123B (en) 2017-10-30 2019-07-19 Oppo广东移动通信有限公司 White balancing treatment method and device, electronic device and computer readable storage medium
CN112150563B (en) * 2019-06-28 2024-03-26 浙江宇视科技有限公司 Method and device for determining light source color, storage medium and electronic equipment
CN113709438B (en) * 2020-05-22 2024-02-27 浙江宇视科技有限公司 White balance correction method, device, storage medium and equipment for image

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8970728B2 (en) 2012-05-16 2015-03-03 Canon Kabushiki Kaisha Image pickup apparatus and image processing method
US8988549B2 (en) 2012-06-22 2015-03-24 Canon Kabushiki Kaisha Image processing apparatus and control method therefor
US9129188B2 (en) 2012-06-22 2015-09-08 Canon Kabushiki Kaisha Image processing apparatus and control method thereof
US9338419B2 (en) 2012-06-22 2016-05-10 Canon Kabushiki Kaisha Image processing apparatus and control method therefor
US10212780B2 (en) 2015-12-14 2019-02-19 Olympus Corporation Light source device

Also Published As

Publication number Publication date
JP2007013415A (en) 2007-01-18

Similar Documents

Publication Publication Date Title
JP4447520B2 (en) Image processing apparatus and image processing method
US11138705B2 (en) Image data conversion device, image data conversion method, image data conversion program, POS terminal device, and server
JP4849818B2 (en) White balance adjustment device and color identification device
CN101283604B (en) Image processing device with automatic white balance
JP4707450B2 (en) Image processing apparatus and white balance adjustment apparatus
US8295606B2 (en) Device and method for detecting shadow in image
US8976174B2 (en) Bi-illuminant dichromatic reflection model for image manipulation
US8169504B2 (en) Image processing device and image processing method
JP2008035518A (en) Method, medium, and system for compensating shadow areas
JP6520919B2 (en) Image correction apparatus, image correction method and program
US20080025601A1 (en) Image processing apparatus and method
US8594416B2 (en) Image processing apparatus, image processing method, and computer program
JP4728265B2 (en) Noise characteristic measuring apparatus and noise characteristic measuring method
JP2009224971A (en) Image processing device
US9235773B2 (en) Image processing device capable of determining types of images accurately
US10097736B2 (en) Image processing device and image processing method
US20180176528A1 (en) Light locus generation for automatic white balance
JP4539964B2 (en) Image segmentation
JP4851624B2 (en) Designated color region defining circuit, detection circuit, and image processing apparatus using the same
JP2010198476A (en) Defect detecting apparatus, defect detecting method and defect detecting program
WO2018189772A1 (en) Correlation value calculation device
KR101491334B1 (en) Apparatus and method for detecting color chart in image
JP3801177B2 (en) Image processing apparatus, image processing program, and image processing method
JP6774004B2 (en) Change degree derivation device, change degree derivation method and program
JP6718171B2 (en) Image processing apparatus, image processing system, and image processing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080509

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20091002

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20091201

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20091222

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100120

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130129

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 4447520

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130129

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140129

Year of fee payment: 4

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250