JP4025962B2 - White balance adjustment - Google Patents

White balance adjustment Download PDF

Info

Publication number
JP4025962B2
JP4025962B2 JP2001272283A JP2001272283A JP4025962B2 JP 4025962 B2 JP4025962 B2 JP 4025962B2 JP 2001272283 A JP2001272283 A JP 2001272283A JP 2001272283 A JP2001272283 A JP 2001272283A JP 4025962 B2 JP4025962 B2 JP 4025962B2
Authority
JP
Japan
Prior art keywords
white balance
coordinates
image
distribution ratio
color
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.)
Expired - Fee Related
Application number
JP2001272283A
Other languages
Japanese (ja)
Other versions
JP2003087817A (en
Inventor
政信 白川
耕平 籬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2001272283A priority Critical patent/JP4025962B2/en
Publication of JP2003087817A publication Critical patent/JP2003087817A/en
Application granted granted Critical
Publication of JP4025962B2 publication Critical patent/JP4025962B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Description

【0001】
【発明の属する技術分野】
本発明は、ホワイトバランス調整に関する。
【0002】
【従来の技術】
人間の目は色順応によって色成分を調整しており、光源が変化しても白い物体を白と認識することができる。しかし、ディジタルカメラ等の画像機器においてその撮像素子自体には色順応の機能が存在しないため、従来からオートホワイトバランスなどと呼ばれる技術によって色のバランスを調整している。例えば、カラー画像データがR(レッド),G(グリーン),B(ブルー)の3成分から構成されるときに、3成分それぞれの階調値を画像全体で積算し、それぞれの積算比率がR:G:B=1:1:1になるように、各色成分の階調値に補正をかけている。
【0003】
【発明が解決しようとする課題】
上述した従来のディジタルカメラにおいては、被写体の色成分総てを加算すると無彩色になると言う仮説に基づいて、画像全体の平均的な色がグレーになるように補正をしているので、画像内に特定色の大きな部位があったり、分光分布が特定色に偏った光源下での撮像画像であったりすると、これらの特定色の影響によってホワイトバランス調整が失敗するカラーフェリアが生じてしまう。
本発明は、上記課題にかんがみてなされたもので、画像内の特定色や特定色に偏った光源に影響されることなくホワイトバランス調整を実施可能なホワイトバランス調整を目的とする。
【0004】
【課題を解決するための手段】
上記目的を達成するため、請求項1にかかる発明は、複数の画素についてRGB空間の座標にて色が表現された画像のホワイトバランスを調整するホワイトバランス調整装置であって、上記画像における各色成分のバランスを第1色空間の座標によって示す第1分布比を算出する第1分布比算出手段と、上記第1分布比を所定の変換式によって人間の目の錐体感度特性を反映した生理的三原色の色空間の座標によって示される第2分布比に変換する第2分布比算出手段と、上記第2分布比に基づいてホワイトバランス補正係数を算出するホワイトバランス補正係数算出手段と、上記第1色空間の座標を生理的三原色の色空間の座標に変換する変換式と、上記ホワイトバランス補正係数に基づく変換式と、生理的三原色の色空間の座標を上記第1色空間の座標に変換する変換式とを合成したホワイトバランス制御マトリクスを生成するホワイトバランス制御マトリクス生成手段と、上記画像を上記ホワイトバランス制御マトリクスによって変換することにより当該画像のホワイトバランスを制御するホワイトバランス制御手段とを具備する構成としてある。
【0005】
また、請求項2にかかる発明は、上記第1分布比算出手段は上記画像における各色成分の階調をこれらの階調の中央値を基準とした値に変換することにより上記第1分布比を算出する構成としてある。
【0016】
ところで、このようなホワイトバランス調整装置は単独で存在する場合もあるし、ある機器に組み込まれた状態で利用されることもあるなど、発明の思想としてはこれに限らず、各種の態様を含むものである。従って、ソフトウェアであったりハードウェアであったりするなど、適宜、変更可能である。発明の思想の具現化例としてホワイトバランス調整装置のソフトウェアとなる場合に対応させ、請求項6,請求項7にかかる発明は上記ホワイトバランス調整装置をコンピュータで実施させる各機能に対応した構成としてある。請求項2に対応させたプログラムとしても有効であることは言うまでもない。
【0017】
むろん、そのソフトウェアの記録媒体は、磁気記録媒体であってもよいし光磁気記録媒体であってもよいし、今後開発されるいかなる記録媒体においても全く同様に考えることができる。また、一次複製品、二次複製品などの複製段階については全く問う余地無く同等である。その他、上記媒体ではないが供給方法として通信回線を利用して行う場合でも本発明が利用されていることにはかわりない。さらに、一部がソフトウェアであって、一部がハードウェアで実現されている場合においても発明の思想において全く異なるものはなく、一部を記録媒体上に記憶しておいて必要に応じて適宜読み込まれるような形態のものとしてあってもよい。
【0018】
また、このようなホワイトバランス調整プログラムはかかる制御に従って処理を進めていく上でその根底にはその手順に発明が存在するということは当然であり、方法としても適用可能であることは容易に理解できる。すなわち、必ずしも実体のある装置に限らず、その方法としても有効であることに相違はない。むろん、上記請求項2に対応させた方法としても有効である。さらに、本発明を具体的な装置に適用することも可能であり、ホワイトバランス調整を実行可能な各手段を搭載したディジタルカメラとしても本発明を実現可能である。
【0019】
【発明の効果】
以上説明したように請求項1〜請求項3にかかる発明においては、ホワイトバランス調整に適した空間で色成分の補正を実行可能なホワイトバランス調整装置、ホワイトバランス調整プログラムおよびホワイトバランス調整方法を提供することができる。
また、請求項2にかかる発明においては、本発明を種々の画像機器に適用可能となる。
【0021】
【発明の実施の形態】
ここでは、下記の順序に従って本発明の実施の形態について説明する。
(1)ディジタルスチルカメラの概略構成:
(2)画像処理の概略:
(3)ホワイトバランス測定及び制御のための構成:
(4)ホワイトバランス測定及び制御処理:
(4−1)輝度成分取得処理:
(4−2)色成分分布情報取得処理:
(4−3)ホワイトバランス制御処理:
(4−3−1)光源種別に対応した補正:
【0022】
(1)ディジタルスチルカメラの概略構成:
図1は、本発明のホワイトバランス制御が適用されるディジタルスチルカメラの概略構成をブロック図により示している。
ディジタルスチルカメラ10は、光学部20と、CPU32を核とする制御部30とから構成されている。光学部20は、光学レンズ系21と、オートフォーカス機構22と、測距部23と、オートフォーカスコントローラ24とを備え、オートフォーカスコントローラ24がコントローラ25からの制御信号に基づいて測距部23にて被写体までの距離を測定しつつオートフォーカス機構22にて光学レンズ系21を駆動してピントを合わせる。光学レンズ系21にて被写体像を結像するのは撮像素子としてのCCD26の撮像面であり、本CCD26は1800×1200画素を有する単板で構成されている。単板で構成しているため、2×2画素について、グリーン(G)、マゼンタ(M)、イエロー(Y)、シアン(C)のカラーフィルタを順次形成してある。なお、シャッターについては電子シャッターとともにメカニカルシャッターを備えているが、メカニカルシャッターについては図示を省略している。
【0023】
この他、光学部20にはストロボ27も備えられており、コントローラ25からの駆動信号に応じて所定光量および所定回数の発光を行う。これにより、赤目防止であるとかスローシンクといった撮影を実現している。なお、CCD26が出力するアナログ量の電気信号を増幅するオートゲインコントローラ(AGC)28が備えられ、増幅後のアナログ電気信号をディジタル値に変換して出力するA/Dコンバータ29が備えられている。むろん、以上の光学部20については、ディジタルスチルカメラ10としての一般的な構成の一例に過ぎず、各種の変更が可能であることはいうまでもない。例えば、光学レンズ系21にはズームレンズを備えることもできるし、あるいは固定焦点としてオートフォーカスの機能を備えない廉価なものであっても良い。
【0024】
また、制御部30はバス31を備えており、当該バス31にCPU32とROM33とRAM34と上記A/Dコンバータ29が接続されている。CPU32はROM33に書き込まれたファームウェアを実行して光学部20の制御や画像処理の演算等を実行するものであり、その際にRAM34は画像データを保存する画像エリア34aとして機能したり演算処理のためのワークエリア34bとして機能したりする。CPU32が光学部20を制御する際には、コントローラ25に対して制御信号を出力し、同コントローラ25が各構成回路などに対する適宜制御信号を生成して出力する。
【0025】
制御部30はマンマシンインターフェイスとしての機能も有しており、操作ボタンなどを配置した操作パネル35と、撮影画像や操作指示などを表示するLCDパネル36を備えており、CPU32は操作パネル35の操作を監視し、適宜、操作を受けつつ対応する制御を実行する。また、LCDパネル36への表示はRAM34に割り当てられたビデオRAMエリア34cに対してCPU32が所定のデータを書き込むことにより、LCDパネル36に備えられたディスプレイコントローラが適宜同データを読み込んで表示を行う。そして、撮影され、所定の画像処理を経て生成される画像データはI/O37aを介して外部メモリであるフラッシュメモリカード37bに書き込まれ、また、必要に応じて同フラッシュメモリカード37bから読み出される。
【0026】
制御部30の構成もこの種のディジタルスチルカメラ10の典型例であって、各種の変更が可能である。例えば、外部メモリの種類については適宜他の種類のものに置き換えることは容易であるし、さらには着脱可能なメモリとのインターフェイスを備えなくてもUSBインターフェイスを介してコンピュータに画像データを出力するようにしてもよい。表示部としてのLCDパネル36に付随して他のLCD表示器を備えてもよいし、CPU32については制御対象が異なる複数のCPUを備えても良い。
【0027】
光学部20で撮像された画像はCCD26からアナログ電気信号として出力された後、AGC28を経てA/Dコンバータ29にてディジタルデータに変換され、さらにバス31を介してRAM34の画像エリア34aに記録される。そして、CPU32が所定の画像処理を実行することによりJPEG画像データに変換されて上述したフラッシュメモリカード37bに書き込まれることになる。
【0028】
(2)画像処理の概略:
図2は、この画像処理の主要な流れを示している。細部においては後述するような具体的な処理が実行されるものの、概略的にはこの流れに従って処理を進めている。まず、この概略について説明する。ステップS102では、欠陥画素補間を実行する。およそ200万画素を有するCCD26には欠陥画素は避けられず、所定の基準値以下のものであれば良品として供給される。このため、良品の範囲内での欠陥画素については同色画素だけを基準とした5×5画素のメヂアンフィルタを使用して補う。すなわち、欠陥画素がシアンの画素であるとすると、この欠陥画素の周囲に位置する5×5のシアン画素の出力値を順番に並べ、中央値を欠陥画素の値とする。なお、欠陥画素自体は光学部20において既に検出されている。
【0029】
次のステップS104ではホワイトバランスの測定を行う。撮影時の光源の種類、およびCCD26とカラーフィルタとの組合せによっては、ホワイトバランスがずれることがあり、本実施形態においては、各撮影ごとにステップS104にてホワイトバランスを測定し、その結果を反映させてずれを少なくするようにステップS110にてホワイトバランスの制御をする。ホワイトバランスを測定するときには間引き処理で選択した113×75画素の画像データを利用し、RGB表色系においてG成分を基準としたR成分の偏りとB成分の偏りを測定する。なお、本CCD26は補色系のカラーフィルタを備えており、補色系であることを踏まえて制御をしている。
【0030】
本実施形態では三種類の画像を生成する。一つ目は確認画像であり、二つ目はサムネール画像であり、三つ目は主画像である。確認画像は撮影後速やかにLCDパネル36に表示するための画像であり、720×240画素の画像データで構成される。サムネール画像は主画像とともに画像データとして記録されるものであり160×120画素の画像データで構成される。主画像は操作者の選択によって三つのサイズを選択可能であり、E−mail画像という720×480画素か、Print画像という1800×1200画素か、Hypict2という高解像度化した2160×1440画素かのいずれかである。
【0031】
図2において、ステップS106〜ステップS114は破線で囲む表示をしてあり、すくなくともこれらの処理は生成される三種類の画像ごとに実施される。ステップS106ではデータ補間を実施する。CCD26は単板で構成され、200万画素を有しているものの全画素のそれぞれで色情報が完結しているわけではない。すなわち、ある画素についてはシアンの情報だけ、ある画素についてはマゼンタの情報だけ、ある画素についてはイエローの情報だけ、ある画素についてはグリーンの情報だけとなっている。このデータをモザイクデータと呼ぶ。データ補間では各画素に対して不足する他の色の情報を補うことにより、各画素ごとに色情報を完結させるための処理である。不足する情報は注目画素に隣接して取り囲む8画素に含まれる色情報の平均値である。例えば、シアン画素(C1)の周囲にはイエローの画素が二個(Y1,Y2)、マゼンタの画素が二個(M1,M2)、グリーンの画素が四個(G1〜G4)存在する。
【0032】
従って、このシアン画素の色情報(C,M,Y,G)については、
C=C1
M=(M1+M2)/2
Y=(Y1+Y2)/2
G=(G1+G2+G3+G4)/4
として計算する。
【0033】
ステップS108では、表色系を変えてRGB画像データに変換する。変換のための一般式も存在するが、実際には単純な一般式を利用するのではなく、チューニングを施したルックアップテーブルを利用したり行列式を利用したりして変換を行う。RGB画像データに変換後、ステップS110では、上述したようにRGB表色系におけるR成分の偏りとB成分の偏りを少なくする制御を実行する。次のステップS112ではトーンカーブ補正を行う。トーンカーブ補正はいわゆるγ補正とも呼ばれ、このときに各成分について10ビットの画像データを8ビットの画像データに変換しつつ、さらに白色側領域と黒色側領域でのノイズの低減や階調性の保持のためにγカーブ自体についての調整も行っている。トーンカーブ補正自体はルックアップテーブルを利用しており、予めチューニングして作成した10ビット→8ビットのルックアップテーブルを参照して変換する。
【0034】
この後、JPEG画像圧縮技術を利用するため、RGB表色系からYUV表色系へと色変換する。なお、輝度とイエローを区別するため、以後において輝度はYmと表示し、また、後述するようにモザイクカラーデータから直接導き出す輝度を単純輝度Ysとして表示することにする。RGB表色系からYUV表色系への色変換は一般式あるいは行列式を利用して変換する。
なお、モザイクカラーデータからYUV表色系への変換の一般式は、
Ys=0.25×(C+M+Y+G)
U=C+M−(Y+G)
V=−C+M+Y−G
となっているが、実際には上述したようなチューニングやホワイトバランスの制御が実施され、この通りの対応関係を採用しているわけではない。
【0035】
ステップS116とステップS118は主画像の作成の際にのみ実施される処理である。ノイズ除去は色成分としてUV成分についてのみいわゆるローパスフィルタを適用する演算を行なう。すなわち、色変化が急峻すぎるものについては押さえ気味に作用する。また、エッジ強調は輝度成分についてのみ当該輝度成分に基づくエッジ量から非線形関数値(例えばコアリング関数値)を算出し、同非線形関数値を元の輝度成分に加重して演算している。従って、隣接する画素間で輝度値が変化する場合にそのエッジ量を算出し、当該エッジ量の絶対値が大きければその変化量を大きく輝度値に反映させるし、同絶対値が小さければ元輝度値はほぼ元のままの値となる。
【0036】
以上が画像処理の概略であるが、上記手順は実際の演算処理において複数の処理を同時に行うなどすることにより、演算処理時間の短縮を図ることも行なう。撮影は上述した三種類の画像ごとに上述した画像処理を実行し、最終的にはサムネール画像を含んだ主画像のJPEG圧縮画像をフラッシュメモリカード37bに書き込むことによって完了する。この他にも、本ディジタルスチルカメラではフラッシュメモリカード37bから画像データを読み込んでLCDパネル36に表示したり、データの削除や各種の設定を実行可能であるが、これについては一般的な技術を適用可能であるので説明を省略する。
【0037】
(3)ホワイトバランス測定及び制御のための構成:
以下、上記画像処理のステップS104におけるホワイトバランスの測定と当該測定結果を反映したホワイトバランス制御について詳細に説明する。図3は、上記図1に示す構成にて実現されるホワイトバランスの測定系及び制御系を示すブロック図である。同図における輝度成分取得モジュール33aと色成分分布情報取得モジュール33bとホワイトバランス制御モジュール33cとはROM33に予め記録されたプログラムモジュールを上記CPU32が適宜読み出すことにより実行される。
【0038】
ホワイトバランス制御モジュール33cはさらにマトリクス演算部33eを備えており、同マトリクス演算部33eは第1色空間変換部33e1とホワイトバランス制御部33e2と第2色空間変換部33e3とを備えている。また、各モジュールは上記RAM34の画像エリア34aおよびワークエリア34bに記録されたデータを適宜使用し、必要に応じて中間データを書き込んでホワイトバランスを制御するためのマトリクスを決定する。ホワイトバランスの制御は画像データにこのマトリクスを乗じることによって実現される。
【0039】
輝度成分取得モジュール33aは、画像エリア34aに記録されたCCDのRawデータを取得して輝度成分を取得する。ここで、輝度成分取得モジュール33aは、演算量を低下させるための間引き処理やGMYCのRawデータをRGBYsデータに変換する処理、ヒストグラム処理と同ヒストグラムの帯域分割処理を行っており、それぞれの処理にて生成され、適宜使用される間引き済データ34b1,RGBYsデータ34b2,ヒストグラムデータ34b3,帯域データ34b4は上記RAM34のワークエリア34bに記録される。それぞれの処理は後に詳述する。尚、原色系のフィルタを搭載したディジタルスチルカメラであればGMYCデータからRGBデータへの変換は不要であるが、CCDのRGBデータをsRGBデータの特性に近似させるような補正処理が必要である。
【0040】
色成分分布情報取得モジュール33bは、上記分割された帯域であってホワイトバランスを調整するための指標として好適な帯域内の色成分分布情報としてRGB色成分の積分データ34b5とその比である分布比データ34b6を取得する。ホワイトバランス制御モジュール33cは得られた分布比データ34b6から、ホワイトバランス調整に使用するための係数であってG成分に対してR成分を相対的に補正するための補正係数R’,およびG成分に対してB成分を相対的に補正するための補正係数B’(34b7)を求める。そして、この補正係数を生理的三原色による表色空間での係数に変換するとともに当該表色空間内で補正を施して補正係数R,Bを算出し、当該補正係数に基づいて最終的なホワイトバランス制御マトリクス34b9を算出する。
【0041】
尚、上記ROM33には上記Estevez−Hunt−Pointerの式に基づいて、sRGB座標系のRGB色成分を生理的三原色のRGB色成分に変換する変換マトリクスA(33d1)と当該変換の逆変換を実施する逆変換マトリクスA−1(33d2)が記録されており、上記ホワイトバランス制御モジュール33cにて使用される。以上のようにして作成された上記ホワイトバランス制御マトリクス34b9と上記画像エリア34a内のCCDRawデータをRGB色成分に変換したものとを乗じると、当該画像のホワイトバランスが制御されたRGB色成分データを得ることができる。
【0042】
本実施形態においてはこのようにホワイトバランス制御マトリクス34b9によってホワイトバランスを制御しており、実際に記憶されるマトリクスは3×3のマトリクスであるが、このマトリクスは後述する演算によって求められた補正係数R,Bと上記変換マトリクスAと逆変換マトリクスA−1とを乗じて得られるものであり、このマトリクスによる演算が上記第1色空間変換手段とホワイトバランス制御手段と第2色空間変換手段とを一度に実現していると言える。
【0043】
尚、本実施形態においてはホワイトバランスの補正係数を2段階で求めている。すなわち、第1段階として一旦補正係数R’,B’を求めた後、さらに第2段階として補正係数R,Bを求めている。このようにして補正係数を2段階で求めていることによって、画像内の大きな単色部位に影響を受けてホワイトバランス制御が失敗したり、特定の光源であるときにホワイトバランス制御が失敗するような、カラーフェリア等を確実に防止することができるが、上記段階のそれぞれは単独で実施されてもホワイトバランス制御として機能させることができる。
【0044】
また、別手法のホワイトバランス制御に対してそれぞれの段階を付加してホワイトバランスを制御する構成としても良い。例えば、第1段階で算出された補正係数R’,B’を使用してホワイトバランス制御マトリクス34b8を算出するような構成であってもホワイトバランス調整装置として機能する。本発明にかかるホワイトバランス制御は主に第2段階についてのものである。
【0045】
(4)ホワイトバランス測定及び制御処理:
以下、上記構成においてホワイトバランスの測定及び制御のために実施される処理を詳細に説明する。図4,図5はホワイトバランス測定及び制御を示すフローチャートである。図4は上記第1段階に該当し、図5は第2段階及び最終的なホワイトバランス制御マトリクス34b9を算出する段階に相当する。また、図4のステップS200〜S220が上記輝度成分取得モジュール33aの処理に該当し、図4のステップS225〜S250が上記色成分分布情報取得モジュール33bの処理に該当し、図4,図5のステップS250〜ステップS275およびステップS110が上記ホワイトバランス制御モジュール33cの処理に該当する。ここでは、各モジュール毎の処理に分けつつ一連の処理を説明する。
【0046】
(4−1)輝度成分取得処理:
輝度成分取得モジュール33aがステップS200にて上記画像エリア34a内のCCDRawデータを取得すると、ステップS205においては当該CCDRawデータに対して間引き処理を実施する。すなわち、CCDRawデータは上述のように1800×1200画素を有するデータであり、全画素について以後の処理を実行すると非常に時間がかかり、また、RAM34に必要とされる空き記憶容量も非常に大きなものとなることから、以下のようにして画素を間引いている。
【0047】
図6は、この間引き処理を説明するための説明図である。同図右側の四角はCCDRawデータの模式図であり、1800×1200画素のGMYCモザイクデータである。本実施形態においては、このモザイクデータの1/16の大きさの画像データを使用することにしており、まず、図におけるモザイクデータ左上の16×16画素群(Gr1)を取得する。画素群Gr1内にはGMYCの各色成分データが64個ずつ含まれており、各色成分毎に64個のデータの階調値平均を取る。そして、これらの平均を一画素分の色成分データ|G|,|M|,|Y|,|C|とする。
【0048】
以降は同様にして逐次上記CCDRawデータから16×16画素の画素群を取得して平均化する処理を行う。この結果、上記CCDRawデータは1/16の大きさすなわち113×75画素の階調値データとなる。この階調値データは間引き済データ34b1として上記ワークエリア34bに記憶される。むろん、この間引き処理においてその圧縮率1/16は必須の値ではなく、上記RAM34や処理負担等に応じて適宜変更することが可能である。また、上述のように平均化するとCCDRawデータの総ての情報を加味することができて好適であるものの、CCDRawデータの縦横16画素につき各色1画素残すように間引くなど、他にも種々の手法を採用可能である。
【0049】
本実施形態においては、RGB空間でホワイトバランスの調整を考えており、上記ステップS205にて間引き処理を行った後の間引き済データ34b1はステップS210にてRGB成分および単純輝度Ysに変換される。GMYC成分からRGB成分への変換は、上記ステップS108における変換式と同様の変換式を使用しており、この変換式では上述のようにチューニングが施されていることにより、高精度に色変換を行うことができる。図7は、ステップS210における変換後の画素データ(RGBYsデータ34b2)を示している。変換後の画素データは、同図に示すように113×75画素であるとともに各画素についてRGBYsの4成分の階調値データから構成されている。
【0050】
輝度成分取得モジュール33aはこの時点で画素の輝度成分を取得しているが、本実施形態では後の処理のため、ステップS215において各画素の単純輝度Ysを各階調値についてヒストグラム化してヒストグラムデータ34b3を生成する。図8は、このヒストグラムの一例を示すグラフである。同図においては、階調値ピッチが細かいため連続的な曲線として示しているが、実際のヒストグラムは離散的な値である。尚、以下のヒストグラムのグラフでも同様に曲線として示しているが実際は離散的な値である。
【0051】
ステップS215にてヒストグラムを作成すると、ステップS220にて当該ヒストグラムを10個の輝度帯域に分割する。図9は、同ステップS220における帯域分割の様子を説明する説明図である。同図上部の表は帯域を決定していく作業を示しており、下部のグラフは帯域が分割されたヒストグラムを示している。帯域を分割する際には、上部の表に示すように単純輝度Ysの階調値が「0」のものからヒストグラムを積算し、積算値が847(約113×75/10)を超えた段階で次の帯域に移って積算を繰り返す。
【0052】
このような積算を10個の帯域について繰り返すと、各帯域に属する画素数がほぼ等しくなる。すなわち、図9のグラフに示す各帯域の面積はほぼ等しい。帯域分割された後のデータは、いずれの画素がいずれの帯域に属するか判別可能な帯域データ34b4として上記ワークエリア34bに記憶される。ここで、ヒストグラムは離散的な値であるため、各帯域に属する画素数が厳密に等しくなるとは限らないが、後述の色成分分布情報取得モジュール33bによって分布比の算出プロセスが存在するので画素数の厳密性は問題とならない。積算値が上記847を超えた段階で、その階調値の画素については一方の帯域のみに含まれるとしても良いし双方に含まれるとしても良い。また、この帯域分割においては、後にホワイトバランス調整のために使用して好適な輝度帯域を特定することができればよく、分割数が10個であることが必須ではないし、分割の手法は上述のものに限られない。
【0053】
(4−2)色成分分布情報取得処理:
色成分分布情報取得モジュール33bは、上記帯域データ34b4に基づいてホワイトバランス制御に好ましい帯域から色分布情報を取得する。このために、まずステップS225にて上記分割された帯域毎に同一帯域内に属する画素のRGB成分をそれぞれ積分し、RGB積分データ34b5として上記ワークエリア34bに記憶する。ステップS230では、分布比として各帯域毎に「G成分の積分値/R成分の積分値」と「G成分の積分値/B成分の積分値」とを求め、分布比データ34b6として上記ワークエリア34bに記憶する。図10は積分値と分布比とを算出する様子を説明する説明図である。上記帯域データ34b4ではいずれの画素がいずれの帯域に属するか判別可能であるため、同図に示すように各帯域に属する画素のRGB成分を容易に知ることができる。
【0054】
このRGB成分値から、積分値は以下の式(1)にて算出し、
【数1】

Figure 0004025962
分布比は以下の式(2)にて算出する。
【数2】
Figure 0004025962
ここで、Rij,Gij,Bijは各色成分毎の階調値であり、「i」は帯域の番号に該当し「j」は画素を区別するための便宜的な番号である。また、Iri,Igi,Ibiは各帯域毎、各成分毎の積分値であり、RicとBicは各帯域毎の分布比である。
【0055】
ここで、上記積分値は色成分の階調値の積算値であることから、各帯域毎にどれほどの値の階調値がどれほど分布しているかを反映した値となっている。また、この積分値を使用して分布比を算出することは帯域毎の色成分毎の平均階調値を使用して分布比を算出することと等価である。帯域毎の色成分毎の平均階調値は、帯域内に属する画素の所定色成分の階調値を足し合わせ、画素数で除したものであり、色成分毎の画素数は各帯域で同数であるところ、分布比にした場合には分母と分子で画素数が相殺されて結局分布比に寄与するのは階調値を足し合わせた成分のみとなるからである。
【0056】
この分布比Ricは「帯域毎のG成分の平均値/帯域毎のR成分の平均値」,分布比Bicは「帯域毎のG成分の平均値/帯域毎のB成分の平均値」であり、この分布比はホワイトバランスを調整する性質を持った係数となる。すなわち、ある画素のRGB色成分それぞれがその画素の属する帯域の各色成分の平均階調値と等しい場合、分布比RicとR成分の階調値とを乗じると分母が相殺してG成分の平均値と等しくなり、分布比BicとB成分の階調値とを乗じても分母が相殺してG成分の平均値と等しくなる。従って、当該画素の全色成分が等しくなり無彩色になる。
【0057】
このように、分布比Ricと分布比Bicとはそれぞれ画素のR成分とB成分とに作用し、その帯域のG成分の平均値を基準としつつ当該基準に近づけるようにR成分とB成分とを相対的に変化させるので、ホワイトバランスを調整するための係数であると言える。従って、上記ステップS230まででは、帯域毎のホワイトバランス補正係数を算出したと言える。本発明においては、所定帯域の分布比を参照して画像全体のホワイトバランスを調整するとともに、画像内容や光源等の差異にかかわらずより好ましい結果を得るための補正を加えている。
【0058】
ステップS230にて分布比データを取得すると、上記色成分分布情報取得モジュール33bはステップS235にて以下の式(3)に従って分布比の組みの平均値R’nc,B’ncを算出する。
【数3】
Figure 0004025962
ここで、nは帯域の組番号であり「1〜5」の整数である。
【0059】
図11は、組みの平均値R’ncについて2つの帯域を組みにする様子を説明する説明図である。同図に示す上部のグラフは上述のようにして10個の帯域に分割されたヒストグラムを示している。上記式(3)においては、n番目の帯域と(11−n)番目の帯域についての平均を算出していることから、同図に示すように両端の帯域(1番目と10番目)が組みとなり、両端から2番目の帯域(2番目と9番目)が組みとなるようにして順次組み合わせられる。B’ncについての組み合わせの考え方も同様である。
【0060】
図12は、分布比を組みにして平均化する際の考え方を説明する説明図であり、同図はYUV色空間のU−Y平面に写像されたRGB色空間の色域を示す。同図において、RGB色空間の色域は、高輝度領域で負のU方向に偏り、低輝度領域で正のU方向に偏っている。V−Y平面に写像した場合も同様で、高輝度領域で負のV方向に偏り、低輝度領域で正のV方向に偏ることとなる。すなわち、高輝度領域と低輝度領域とで逆の性質を有しており、この性質を上記分布比で考えると高輝度領域と低輝度領域とで大きな差が発生することとなるが、両者を平均すればその差を相殺することができ、色域形状に起因する分布比の偏りを除去した当該分布比を評価することができる。尚、この偏りを除去するように分布比を平均化する考え方は、RGB色空間とYUV色空間との関係から発生したものであり、多くの画像機器についてのホワイトバランス調整にて採用することができる。
【0061】
ステップ235にて分布比の組みの平均値が算出されると、ステップS240にてR’ncが「1」より小さいか否かを判別し、同ステップS240にてR’ncが「1」より小さいと判別されたときにはステップS245にてR’ncに対して当該R’ncの逆数を代入する。このステップS240,ステップS245の判別処理は、ステップS240での判別結果にかかわらず、組み番号1〜5の総てについて、また、B’ncについても同様に独立に実行される。ここでの処理はR’ncとB’ncとの総てについて、「1」より小さければ「1」より大きな数に変換する処理をしているものであり、次の評価関数eによる判別のための変換であるとともに、評価関数による判別後は元の値に戻される。
【0062】
(4−3)ホワイトバランス制御処理:
ステップS250では、評価関数eに対して、各組のR’ncとB’ncとを代入し、上記ホワイトバランス制御モジュール33cは当該評価関数eが最小となる組み番号nのR’ncとB’ncとの値を第1段階のホワイトバランス補正係数R’およびB’として決定する。この第1段階のホワイトバランス補正係数も上述の分布比と同様の性質を有しており、上記図3に示すホワイトバランス制御マトリクス34b8の所定成分となり得る係数である。すなわち、画像内の任意の画素のRGB成分を成分とする行列にホワイトバランス制御マトリクス34b8を乗じると、その画像のホワイトバランスを制御することができる。
【0063】
ここで、評価関数が最小のものを選択する処理は、R’ncとB’ncとのそれぞれと「1」との差が最小のものを選択している処理であり、補正量が最も小さいものを選択していることになる。すなわち、ホワイトバランス調整においてはカラーフェリアを防止することが重要であり、補正量の大きなものをホワイトバランス補正係数としてしまうと大きな補正によってカラーフェリアが発生することが多いが、補正量が小さいものを選択しておけば、カラーフェリアの発生確率を非常に小さくすることができる。本出願人は、上述の処理によって決定されたホワイトバランス補正係数が非常に効果的にホワイトバランス調整可能であることを確認しているが、ここでは、カラーフェリアを防止することができればよく、評価関数が2番目に「1」に近いものを選択する構成にするなど適宜変更可能である。
【0064】
このとき、例えば、所定の値域内であれば2番目,3番目に「1」に近いものを選択するようにするなどの工夫を施せばカラーフェリアを防止可能である。また、本発明においては、画像の一部の輝度帯域に属するデータに基づいてホワイトバランス補正係数を算出しており、上述のように補正量の小さいものを選択しているため、上述の従来例のように画像全体のRGB積分値を反映させるホワイトバランス調整と比較して、非常にカラーフェリアが発生しにくい。
【0065】
(4−3−1)光源種別に対応した補正:
上述のように第1段階のホワイトバランス補正係数でホワイトバランス制御を行うことも可能であるが、本実施形態においては光源の差異に起因したカラーフェリアの発生を防止するために、さらに図5のステップS255以降の処理を実行している。ステップS255では、G成分の階調値「128」(中央値)を基準としたホワイトバランス補正係数となるように以下の式にて上記第1段階のホワイトバランス補正係数R’およびB’を変換する。
R=128/R’,G=128,B=128/B’
【0066】
ステップS260では、当該変換後の係数RGBを以下の式(4)に従ってEstevez−Hunt−Pointerの式にて生理的三原色の空間R’G’B’に変換する。
【数4】
Figure 0004025962
【0067】
ここで、マトリクスAは上記ROM33に記憶されたマトリクスであり、sRGB座標を生理的三原色のRGB座標に変換する。また、マトリクスAはマトリクスBとマトリクスCとを乗じて生成されたものであり、それぞれのマトリクスは上述した値であるとともにマトリクスBはsRGB座標をXYZ座標に変換する変換マトリクスであり、マトリクスCはXYZ座標を生理的三原色のRGB座標に変換するマトリクスである。尚、上記式において斜体の文字はマトリクスを示している。ステップS260にて生理的三原色の空間データR’G’B’が得られると、ステップS265にて以下の式に従って最終的なホワイトバランス補正係数Rc,Bcを決定する。
Rc=G’/R’,Bc=G’/B’
【0068】
これらステップS255〜S265の処理は、sRGB座標を一旦生理的三原色のR’G’B’座標に変換し、当該変換後の空間でホワイトバランス補正係数を補正(ステップS265)していることに該当する。この処理によって人間の見た目に応じた良好なホワイトバランスに近づけることができ、光源種に依存しないホワイトバランス制御を実施することができる。また、最終的なホワイトバランス補正係数Rc,Bcをホワイトバランス制御マトリクスWに組み込むことによって、第2色空間の座標を補正してホワイトバランス調整を実行するようにしている。図13,図14は生理的三原色に変換してホワイトバランス補正係数を補正する様子を説明する説明図である。
【0069】
図13はsRGBの理想光源(CIE標準の光源D65)の分光分布を示す図であり、図14は生理的三原色についての分光分布を示す図である。図において横軸は波長(nm)であり、縦軸は分光分布の相対値である。尚、図13,図14において450nm付近にピークがあるカーブはB成分、540nm付近にピークがあるカーブはG成分の分光分布であり、図13の610nm付近,図14の580nm付近にピークがあるカーブはR成分の分光分布である。上記ホワイトバランス補正係数はR成分とB成分とに対してそれぞれ乗ぜられるので、ホワイトバランス補正係数による調整は、上記図13,14における分光分布に対してはB成分とR成分のカーブを拡大したり縮小したりするように作用する。
【0070】
図14に示す分光分布は生理的三原色についての分布であることから、人間の色の感じ方はこの分布に非常に近く、この分布となるRGB空間でホワイトバランス補正係数の補正を行うと、人間の色の感じ方に非常に近い形でホワイトバランスを制御することができる。具体的には、図13に示す分光分布においてはR成分のピーク波長およびピーク強度が図14に示す分光分布のR成分のピーク波長およびピーク強度より大きい。従って、上記ステップS260における変換を実施せずにホワイトバランスの調整をしようとすると、R成分に対する補正が相対的に大きくなり、R成分を強調しすぎたり、弱めすぎたりしてしまう。そこで、上記ステップS260における変換を実施した後にホワイトバランス補正係数を補正することにより、より見た目に近い赤となるようにホワイトバランスを調整可能である。むろん、青に関しても同様で見た目に近い青となる。従って、白熱灯かでの撮影画像等であっても適切なホワイトバランスとなるよう調整されるようにホワイトバランス補正係数を決定可能である。
【0071】
ステップS265にて最終的なホワイトバランス補正係数Rc,Bcを決定したら、ステップS270において当該ホワイトバランス補正係数Rc,Bcを1行1列目および3行3列目の成分とし、2行2列目の成分を「1」とし、他の成分を「0」としたマトリクスの左から上記逆変換マトリクスA−1を乗じ、右から上記マトリクスAを乗じてホワイトバランス制御マトリクスW(34b9)を生成し、ステップS275にて当該ホワイトバランス制御マトリクスWを上記RAM34のワークエリア34bに保存する。
【0072】
尚、逆変換マトリクスA−1は以下の式(5)にて表現される。
【数5】
Figure 0004025962
上記式においても斜体の文字はマトリクスを示している。
【0073】
このホワイトバランス制御マトリクスWの算出/保存までがホワイトバランスの測定に該当し、ディジタルスチルカメラ10の処理としてはこの後図2に示すフローチャートに戻ってステップS106以降の処理を実行する。そして、ステップS110においてCCDRawデータをsRGBデータに変換した画像データに対してホワイトバランス制御マトリクスWを乗じることによって個々の撮像画像のホワイトバランスを制御する。
【0074】
すなわち、ホワイトバランス制御マトリクスWは、sRGB座標で表現されたカラー画像データの画像についてホワイトバランスを調整するように作用するマトリクスであり、入力および出力データはsRGBデータである。上記ホワイトバランス補正係数はsRGBに対する補正係数ではないため、上記マトリクスA等による空間の変換を行って入出力データがsRGBデータになるようにしてある。従って、ステップS270,S275およびS110の処理が上記マトリクス演算部33eでの処理に該当する。図15は、かかるホワイトバランス制御マトリクスWによる演算を説明するための説明図であり、上部のマトリクス演算式において右辺のRGBは入力sRGBデータであり、左辺のR’’G’’B’’は出力sRGBデータである。また、本実施形態の実際の処理においてホワイトバランス制御マトリクスWは3個の3×3の行列を予め計算して得られる1個の3×3の行列であるが、ここでは便宜上3個のマトリクスに分けて説明する。
【0075】
図15においてマトリクス演算式の下方には3個のマトリクスによる各演算段階を示している。上述のように入力データ▲1▼はsRGBデータである。マトリクスAはsRGB座標系のRGB色成分を生理的三原色のRGB色成分に変換するマトリクスであるので、当該入力データ▲1▼にマトリクスAを乗じると、▲2▼に示すように生理的三原色のRGB色成分に変換される。すなわち、この変換が上記第1色空間変換部33e1での処理である。この変換結果に対して上記ホワイトバランス補正係数Rc,Bcを成分として含むマトリクスを乗じると、▲3▼に示すように生理的三原色のRGB色成分にてホワイトバランスが調整される。すなわち、ここでの処理が上記ホワイトバランス制御部33e2での処理である。
【0076】
この調整後のRGBデータに逆変換マトリクスA−1を乗じると、▲4▼に示したようにホワイトバランス調整後の画像データがsRGBデータに変換される。すなわち、ここでの処理が上記第2色空間変換部33e3での処理である。本実施形態においてこの演算は一つのマトリクスで実現されており、1回の演算で第1色空間内のsRGB座標を第2色空間としての生理的三原色のRGB色成分に変換し、当該第2色空間内で補正係数にてホワイトバランスを調整し、さらに補正後のRGB色成分を第1色空間内のsRGB座標に戻している。従って、ディジタルスチルカメラの画像処理過程においてsRGBデータに1個の3×3の行列であるホワイトバランス制御マトリクスWを乗じるとホワイトバランスが調整されたsRGBデータとなり、しかもこのデータは人間の目の特性に近い空間で補正されているので、光源に影響を受けずに確実にホワイトバランスを調整することができる。
【0077】
以上説明したように、本発明においては第1色空間の座標を第2色空間の座標に変換し、同変換された第2色空間の座標を補正することによりホワイトバランスを制御し、上記補正後の座標を上記第1色空間の座標に変換する。従って、画像内の特定色や特定色に偏った光源に影響されることなくホワイトバランス調整を実施可能となる。
【図面の簡単な説明】
【図1】ディジタルスチルカメラの概略構成を示すブロック図である。
【図2】画像処理の主要な流れを示すフローチャートである。
【図3】ホワイトバランスの測定系及び制御系を示すブロック図である。
【図4】ホワイトバランス測定及び制御を示すフローチャートである。
【図5】ホワイトバランス測定及び制御を示すフローチャートである。
【図6】間引き処理を説明するための説明図である。
【図7】RGBYs変換後の画素データを示す図である。
【図8】ヒストグラムの一例を示すグラフである。
【図9】帯域分割の様子を説明する説明図である。
【図10】積分値と分布比とを算出する様子を説明する説明図である。
【図11】2つの帯域を組みにする様子を説明する説明図である。
【図12】分布比を組みにして平均化する際の考え方を説明する説明図である。
【図13】sRGBの理想光源の分光分布を示す図である。
【図14】生理的三原色についての分光分布を示す図である。
【図15】ホワイトバランス制御マトリクスによる演算を説明するための説明図である。
【符号の説明】
10…ディジタルスチルカメラ
20…光学部
21…光学レンズ系
22…オートフォーカス機構
23…測距部
24…オートフォーカスコントローラ
25…コントローラ
26…CCD
27…ストロボ
28…オートゲインコントローラ(AGC)
29…A/Dコンバータ
30…制御部
31…バス
32…CPU
33…ROM
33a…輝度成分取得モジュール
33b…色成分分布情報取得モジュール
33c…ホワイトバランス制御モジュール
33d1…変換マトリクスA
33d2…逆変換マトリクスA−1
33e…マトリクス演算部
33e1…第1色空間変換部
33e2…ホワイトバランス制御部
33e3…第2色空間変換部
34…RAM
34a…画像エリア
34b…ワークエリア
34b1…間引き済データ
34b2…RGBYsデータ
34b3…ヒストグラムデータ
34b4…帯域データ
34b5…RGB積分データ
34b6…分布比データ
34b7…補正係数R’,B’
34b8…ホワイトバランス制御マトリクス
34b9…ホワイトバランス制御マトリクス
34c…ビデオRAMエリア
35…操作パネル
36…LCDパネル
37a…I/O
37b…フラッシュメモリカード[0001]
BACKGROUND OF THE INVENTION
The present invention relates to white balance adjustment .
[0002]
[Prior art]
The human eye adjusts the color component by chromatic adaptation and can recognize a white object as white even if the light source changes. However, in an image device such as a digital camera, the image sensor itself does not have a chromatic adaptation function. Therefore, the color balance is conventionally adjusted by a technique called auto white balance. For example, when the color image data is composed of three components of R (red), G (green), and B (blue), the gradation values of the three components are integrated over the entire image, and the integration ratio is R : G: B = 1: 1: 1 The gradation value of each color component is corrected.
[0003]
[Problems to be solved by the invention]
In the above-described conventional digital camera, correction is performed so that the average color of the entire image becomes gray based on the hypothesis that adding all the color components of the subject results in an achromatic color. If there is a part with a large specific color or a captured image under a light source whose spectral distribution is biased to the specific color, a color feria in which white balance adjustment fails due to the influence of the specific color occurs.
The present invention has been made in view of the above problems, and an object of the present invention is to perform white balance adjustment capable of performing white balance adjustment without being affected by a specific color in the image or a light source biased to the specific color.
[0004]
[Means for Solving the Problems]
In order to achieve the above object, the invention according to claim 1 is a white balance adjustment device that adjusts the white balance of an image in which colors are expressed by coordinates in RGB space for a plurality of pixels, and each color component in the image A first distribution ratio calculating means for calculating a first distribution ratio indicating the balance of the first color space by coordinates of the first color space, and a physiological function in which the first distribution ratio is reflected on a cone sensitivity characteristic of the human eye by a predetermined conversion formula. Second distribution ratio calculation means for converting to a second distribution ratio indicated by the coordinates of the three primary color spaces, white balance correction coefficient calculation means for calculating a white balance correction coefficient based on the second distribution ratio, and the first The conversion formula for converting the coordinates of the color space to the coordinates of the color space of the physiological three primary colors, the conversion formula based on the white balance correction coefficient, and the coordinates of the color space of the physiological three primary colors are And white balance control matrix generating means for generating a white balance control matrix obtained by synthesizing the conversion formula for converting the coordinates of a color space, white for controlling the white balance of the image by converting the image by the white balance control matrix And a balance control means.
[0005]
According to a second aspect of the present invention, the first distribution ratio calculating means converts the gradation of each color component in the image into a value based on the central value of these gradations, thereby obtaining the first distribution ratio. This is a configuration to calculate .
[0016]
By the way, such a white balance adjustment device may exist alone, or may be used in a state of being incorporated in a certain device, but the idea of the invention is not limited to this and includes various aspects. It is a waste. Therefore, it can be changed as appropriate, such as software or hardware. As an embodiment of the idea of the invention, it corresponds to the case where the software of the white balance adjustment device is used, and the invention according to claims 6 and 7 has a configuration corresponding to each function for causing the white balance adjustment device to be implemented by a computer. . Needless to say, it is also effective as a program corresponding to claim 2 .
[0017]
Of course, the software recording medium may be a magnetic recording medium, a magneto-optical recording medium, or any recording medium to be developed in the future. In addition, the duplication stages such as the primary duplication product and the secondary duplication product are equivalent without any question. In addition, although it is not the above-mentioned medium, the present invention is not changed even when the communication method is used as a supply method. Further, even when a part is software and a part is realized by hardware, there is nothing completely different in the idea of the invention, and a part is stored on a recording medium, and it is appropriately changed as necessary. It may be in the form of being read.
[0018]
In addition, it is natural that such a white balance adjustment program can be applied as a method as a matter of course, as the process proceeds according to such control, an invention exists in the procedure. it can. That is, it is not necessarily limited to a substantial apparatus, and there is no difference that the method is effective. Of course, it is also effective as a method corresponding to the second aspect . Further, the present invention can be applied to a specific apparatus, and the present invention can be realized as a digital camera equipped with each means capable of performing white balance adjustment.
[0019]
【The invention's effect】
As described above, the inventions according to claims 1 to 3 provide a white balance adjustment device, a white balance adjustment program, and a white balance adjustment method capable of correcting color components in a space suitable for white balance adjustment. can do.
In the invention according to claim 2, the present invention can be applied to various image devices.
[0021]
DETAILED DESCRIPTION OF THE INVENTION
Here, embodiments of the present invention will be described in the following order.
(1) Schematic configuration of digital still camera:
(2) Outline of image processing:
(3) Configuration for white balance measurement and control:
(4) White balance measurement and control processing:
(4-1) Luminance component acquisition processing:
(4-2) Color component distribution information acquisition process:
(4-3) White balance control processing:
(4-3-1) Correction corresponding to light source type:
[0022]
(1) Schematic configuration of digital still camera:
FIG. 1 is a block diagram showing a schematic configuration of a digital still camera to which white balance control of the present invention is applied.
The digital still camera 10 includes an optical unit 20 and a control unit 30 having a CPU 32 as a core. The optical unit 20 includes an optical lens system 21, an autofocus mechanism 22, a distance measuring unit 23, and an autofocus controller 24, and the autofocus controller 24 controls the distance measuring unit 23 based on a control signal from the controller 25. The optical lens system 21 is driven by the autofocus mechanism 22 while the distance to the subject is measured. A subject image is formed by the optical lens system 21 on the image pickup surface of a CCD 26 as an image pickup element, and the CCD 26 is constituted by a single plate having 1800 × 1200 pixels. Since it is composed of a single plate, green (G), magenta (M), yellow (Y), and cyan (C) color filters are sequentially formed for 2 × 2 pixels. In addition, although the shutter is provided with the mechanical shutter with the electronic shutter, illustration is abbreviate | omitted about the mechanical shutter.
[0023]
In addition, the optical unit 20 is also provided with a strobe 27, which emits a predetermined amount of light and a predetermined number of times according to a drive signal from the controller 25. This realizes shooting such as red-eye prevention or slow sync. Note that an auto gain controller (AGC) 28 for amplifying an analog electric signal output from the CCD 26 is provided, and an A / D converter 29 for converting the amplified analog electric signal into a digital value and outputting the digital value. . Of course, the optical unit 20 described above is merely an example of a general configuration as the digital still camera 10, and it is needless to say that various changes can be made. For example, the optical lens system 21 may include a zoom lens, or may be an inexpensive one that does not have an autofocus function as a fixed focus.
[0024]
The control unit 30 includes a bus 31, and the CPU 32, the ROM 33, the RAM 34, and the A / D converter 29 are connected to the bus 31. The CPU 32 executes firmware written in the ROM 33 to execute control of the optical unit 20 and calculation of image processing. At this time, the RAM 34 functions as an image area 34a for storing image data or performs calculation processing. Function as a work area 34b. When the CPU 32 controls the optical unit 20, it outputs a control signal to the controller 25, and the controller 25 generates and outputs an appropriate control signal for each component circuit.
[0025]
The control unit 30 also has a function as a man-machine interface, and includes an operation panel 35 on which operation buttons and the like are arranged, and an LCD panel 36 for displaying captured images and operation instructions. The operation is monitored, and the corresponding control is executed while receiving the operation as appropriate. Further, the display on the LCD panel 36 is performed by the CPU 32 writing predetermined data in the video RAM area 34c allocated to the RAM 34, so that the display controller provided in the LCD panel 36 appropriately reads the data and displays it. . Then, image data that has been shot and generated through predetermined image processing is written to the flash memory card 37b, which is an external memory, via the I / O 37a, and is read out from the flash memory card 37b as necessary.
[0026]
The configuration of the control unit 30 is also a typical example of this type of digital still camera 10, and various changes can be made. For example, the type of external memory can be easily replaced with another type as appropriate, and image data can be output to a computer via a USB interface even without an interface with a removable memory. It may be. Another LCD display may be provided in association with the LCD panel 36 as a display unit, and the CPU 32 may be provided with a plurality of CPUs having different control targets.
[0027]
The image picked up by the optical unit 20 is output from the CCD 26 as an analog electric signal, then converted into digital data by the A / D converter 29 via the AGC 28, and further recorded in the image area 34 a of the RAM 34 via the bus 31. The Then, the CPU 32 executes predetermined image processing to convert it into JPEG image data and write it into the above-described flash memory card 37b.
[0028]
(2) Outline of image processing:
FIG. 2 shows the main flow of this image processing. Although detailed processing as described below is executed in detail, the processing is generally proceeded according to this flow. First, this outline will be described. In step S102, defective pixel interpolation is executed. A defective pixel is inevitable in the CCD 26 having about 2 million pixels, and if it is below a predetermined reference value, it is supplied as a non-defective product. For this reason, defective pixels within a non-defective range are compensated by using a 5 × 5 pixel median filter based on only the same color pixels. That is, if the defective pixel is a cyan pixel, the output values of 5 × 5 cyan pixels located around the defective pixel are arranged in order, and the median value is set as the value of the defective pixel. The defective pixel itself has already been detected by the optical unit 20.
[0029]
In the next step S104, white balance is measured. Depending on the type of light source at the time of shooting and the combination of the CCD 26 and the color filter, the white balance may be shifted. In this embodiment, the white balance is measured at step S104 for each shooting, and the result is reflected. In step S110, the white balance is controlled so as to reduce the deviation. When measuring the white balance, 113 × 75 pixel image data selected in the thinning process is used to measure the bias of the R component and the bias of the B component in the RGB color system based on the G component. The CCD 26 includes a complementary color filter, and performs control based on the fact that it is a complementary color system.
[0030]
In this embodiment, three types of images are generated. The first is a confirmation image, the second is a thumbnail image, and the third is a main image. The confirmation image is an image to be displayed on the LCD panel 36 immediately after shooting, and is composed of image data of 720 × 240 pixels. The thumbnail image is recorded as image data together with the main image, and is composed of image data of 160 × 120 pixels. The main image can be selected in three sizes according to the selection of the operator, and is either 720 × 480 pixels as an E-mail image, 1800 × 1200 pixels as a Print image, or 2160 × 1440 pixels with high resolution as Hypic2 It is.
[0031]
In FIG. 2, Steps S106 to S114 are displayed surrounded by broken lines, and at least these processes are performed for each of the three types of generated images. In step S106, data interpolation is performed. Although the CCD 26 is composed of a single plate and has 2 million pixels, the color information is not completely completed for all the pixels. That is, there is only cyan information for some pixels, only magenta information for some pixels, only yellow information for some pixels, and only green information for some pixels. This data is called mosaic data. Data interpolation is a process for completing the color information for each pixel by supplementing the information of other colors that are insufficient for each pixel. The lacking information is the average value of the color information included in the eight pixels surrounding the target pixel. For example, there are two yellow pixels (Y1, Y2), two magenta pixels (M1, M2), and four green pixels (G1-G4) around the cyan pixel (C1).
[0032]
Therefore, for the color information (C, M, Y, G) of this cyan pixel,
C = C1
M = (M1 + M2) / 2
Y = (Y1 + Y2) / 2
G = (G1 + G2 + G3 + G4) / 4
Calculate as
[0033]
In step S108, the color system is changed and converted to RGB image data. There are general formulas for conversion, but actually, a simple general formula is not used, but conversion is performed using a tuned lookup table or a determinant. After conversion into RGB image data, in step S110, as described above, control is performed to reduce the bias of the R component and the bias of the B component in the RGB color system. In the next step S112, tone curve correction is performed. Tone curve correction is also referred to as so-called γ correction. At this time, 10-bit image data is converted into 8-bit image data for each component, and further noise reduction and gradation characteristics in the white side region and the black side region are performed. The γ curve itself is also adjusted to maintain The tone curve correction itself uses a look-up table, and is converted with reference to a 10-bit → 8-bit look-up table created by tuning in advance.
[0034]
Thereafter, color conversion is performed from the RGB color system to the YUV color system in order to use the JPEG image compression technique. In order to distinguish between brightness and yellow, the brightness is hereinafter displayed as Ym, and the brightness directly derived from the mosaic color data is displayed as simple brightness Ys as described later. The color conversion from the RGB color system to the YUV color system is performed using a general formula or a determinant.
The general formula for conversion from mosaic color data to YUV color system is:
Ys = 0.25 × (C + M + Y + G)
U = C + M- (Y + G)
V = -C + M + Y-G
However, in practice, the tuning and white balance control as described above are performed, and this correspondence is not adopted.
[0035]
Steps S116 and S118 are processes performed only when the main image is created. Noise removal is performed by applying a so-called low-pass filter only for the UV component as the color component. In other words, the color change that is too steep acts on the pressing feeling. Further, edge enhancement is performed by calculating a nonlinear function value (for example, a coring function value) from an edge amount based on the luminance component only for the luminance component, and weighting the non-linear function value to the original luminance component. Therefore, when the luminance value changes between adjacent pixels, the edge amount is calculated, and if the absolute value of the edge amount is large, the amount of change is reflected in the luminance value. If the absolute value is small, the original luminance is calculated. The value is almost unchanged.
[0036]
The above is the outline of the image processing. However, the above procedure also shortens the calculation processing time by simultaneously performing a plurality of processes in the actual calculation processing. The shooting is completed by executing the above-described image processing for each of the three types of images described above, and finally writing the JPEG compressed image of the main image including the thumbnail image in the flash memory card 37b. In addition, this digital still camera can read image data from the flash memory card 37b and display it on the LCD panel 36, or can delete data and perform various settings. The description is omitted because it is applicable.
[0037]
(3) Configuration for white balance measurement and control:
Hereinafter, the white balance measurement in step S104 of the image processing and the white balance control reflecting the measurement result will be described in detail. FIG. 3 is a block diagram showing a white balance measurement system and control system realized by the configuration shown in FIG. The luminance component acquisition module 33a, the color component distribution information acquisition module 33b, and the white balance control module 33c in the figure are executed when the CPU 32 appropriately reads out program modules recorded in advance in the ROM 33.
[0038]
The white balance control module 33c further includes a matrix calculation unit 33e, and the matrix calculation unit 33e includes a first color space conversion unit 33e1, a white balance control unit 33e2, and a second color space conversion unit 33e3. Each module appropriately uses data recorded in the image area 34a and work area 34b of the RAM 34, and determines a matrix for writing intermediate data and controlling white balance as necessary. White balance control is realized by multiplying image data by this matrix.
[0039]
The luminance component acquisition module 33a acquires CCD raw data recorded in the image area 34a and acquires luminance components. Here, the luminance component acquisition module 33a performs a thinning process for reducing the amount of calculation, a process for converting GMYC Raw data to RGBYs data, a histogram process, and a band division process for the histogram. The thinned data 34 b 1, RGBYs data 34 b 2, histogram data 34 b 3, and band data 34 b 4 generated and used as appropriate are recorded in the work area 34 b of the RAM 34. Each processing will be described in detail later. A digital still camera equipped with a primary color filter does not require conversion from GMYC data to RGB data, but correction processing is required to approximate the CCD RGB data to the characteristics of sRGB data.
[0040]
The color component distribution information acquisition module 33b includes the RGB color component integration data 34b5 as the color component distribution information within the divided band and suitable as an index for adjusting the white balance, and a distribution ratio that is a ratio thereof. Data 34b6 is acquired. From the obtained distribution ratio data 34b6, the white balance control module 33c is a coefficient for use in white balance adjustment, and a correction coefficient R ′ c for correcting the R component relative to the G component, and G A correction coefficient B ′ c (34b7) for correcting the B component relative to the component is obtained. Then, the correction coefficient is converted into a coefficient in the color space of the physiological three primary colors and corrected in the color space to calculate the correction coefficients R c and B c , and the final correction is performed based on the correction coefficient. The white balance control matrix 34b9 is calculated.
[0041]
The ROM 33 carries out a conversion matrix A (33d1) for converting the RGB color components of the sRGB coordinate system into the RGB color components of the physiological three primary colors and the inverse conversion of the conversion based on the equation of Estevez-Hunt-Pointer. The inverse transformation matrix A −1 (33d2) to be recorded is recorded and used in the white balance control module 33c. Multiplying the white balance control matrix 34b9 created as described above and the CCD Raw data in the image area 34a converted into RGB color components, the RGB color component data for which the white balance of the image is controlled is obtained. Obtainable.
[0042]
In the present embodiment, the white balance is controlled by the white balance control matrix 34b9 as described above, and the actually stored matrix is a 3 × 3 matrix. This matrix is a correction coefficient obtained by an operation described later. It is obtained by multiplying R c , B c , the conversion matrix A, and the inverse conversion matrix A −1, and the calculation by this matrix is the first color space conversion means, white balance control means, and second color space conversion. It can be said that the means are realized at once.
[0043]
In this embodiment, the white balance correction coefficient is obtained in two stages. That is, once the correction coefficients R ′ c and B ′ c are obtained as the first stage, the correction coefficients R c and B c are further obtained as the second stage. By obtaining the correction coefficient in two stages in this way, white balance control fails due to the influence of a large monochromatic part in the image, or white balance control fails when a specific light source is used. Color feria and the like can be surely prevented, but each of the above steps can function as white balance control even if performed alone.
[0044]
Moreover, it is good also as a structure which adds each step | paragraph with respect to the white balance control of another method, and controls white balance. For example, even if the white balance control matrix 34b8 is calculated using the correction coefficients R ′ c and B ′ c calculated in the first stage, it functions as a white balance adjustment device. The white balance control according to the present invention is mainly for the second stage.
[0045]
(4) White balance measurement and control processing:
Hereinafter, a process performed for white balance measurement and control in the above configuration will be described in detail. 4 and 5 are flowcharts showing white balance measurement and control. FIG. 4 corresponds to the first stage, and FIG. 5 corresponds to the second stage and the stage of calculating the final white balance control matrix 34b9. 4 corresponds to the process of the luminance component acquisition module 33a, and steps S225 to S250 of FIG. 4 correspond to the process of the color component distribution information acquisition module 33b. Steps S250 to S275 and S110 correspond to the processing of the white balance control module 33c. Here, a series of processes will be described while being divided into processes for each module.
[0046]
(4-1) Luminance component acquisition processing:
When the luminance component acquisition module 33a acquires the CCD Raw data in the image area 34a in Step S200, the thinning process is performed on the CCD Raw data in Step S205. That is, the CCD Raw data is data having 1800 × 1200 pixels as described above, and it takes a long time to execute the subsequent processing for all the pixels, and the free storage capacity required for the RAM 34 is very large. Therefore, pixels are thinned out as follows.
[0047]
FIG. 6 is an explanatory diagram for explaining the thinning process. The square on the right side of the figure is a schematic diagram of CCD Raw data, which is GMYC mosaic data of 1800 × 1200 pixels. In the present embodiment, image data having a size 1/16 of the mosaic data is used. First, a 16 × 16 pixel group (Gr1) at the upper left of the mosaic data in the figure is acquired. The pixel group Gr1 includes 64 pieces of GMYC color component data, and an average of gradation values of 64 pieces of data is taken for each color component. These averages are set as color component data | G | 1 , | M | 1 , | Y | 1 , | C | 1 for one pixel.
[0048]
Thereafter, a 16 × 16 pixel group is sequentially obtained and averaged from the CCD Raw data in the same manner. As a result, the CCD Raw data is a gradation value data having a size of 1/16, that is, 113 × 75 pixels. This gradation value data is stored in the work area 34b as thinned data 34b1. Of course, in this thinning-out process, the compression ratio 1/16 is not an indispensable value, and can be appropriately changed according to the RAM 34, processing load, and the like. In addition, although averaging as described above is preferable because all information of the CCD Raw data can be taken into consideration, there are various other methods such as thinning out so that one pixel is left for each 16 pixels in the vertical and horizontal directions of the CCD Raw data. Can be adopted.
[0049]
In the present embodiment, white balance adjustment is considered in the RGB space, and the thinned data 34b1 after the thinning process in step S205 is converted into RGB components and simple luminance Ys in step S210. The conversion from the GMYC component to the RGB component uses a conversion equation similar to the conversion equation in step S108. In this conversion equation, the color conversion is performed with high accuracy by tuning as described above. It can be carried out. FIG. 7 shows the pixel data (RGBYs data 34b2) after the conversion in step S210. The pixel data after conversion is 113 × 75 pixels as shown in the figure, and is composed of RGBYs four-component gradation value data for each pixel.
[0050]
The luminance component acquisition module 33a acquires the luminance component of the pixel at this time point. However, in this embodiment, for the subsequent processing, in step S215, the simple luminance Ys of each pixel is converted into a histogram for each gradation value, and the histogram data 34b3. Is generated. FIG. 8 is a graph showing an example of this histogram. In the figure, since the gradation value pitch is fine, it is shown as a continuous curve, but the actual histogram is a discrete value. The following histogram graphs are similarly shown as curves, but are actually discrete values.
[0051]
When a histogram is created in step S215, the histogram is divided into 10 luminance bands in step S220. FIG. 9 is an explanatory diagram for explaining the state of band division in step S220. The table at the top of the figure shows the work of determining the band, and the graph at the bottom shows a histogram in which the band is divided. When dividing the band, as shown in the upper table, the histogram is accumulated from the gradation value of the simple luminance Ys “0”, and the accumulated value exceeds 847 (about 113 × 75/10). To move to the next band and repeat the integration.
[0052]
If such integration is repeated for 10 bands, the number of pixels belonging to each band becomes substantially equal. That is, the area of each band shown in the graph of FIG. 9 is substantially equal. The data after the band division is stored in the work area 34b as band data 34b4 that can determine which pixel belongs to which band. Here, since the histogram is a discrete value, the number of pixels belonging to each band is not necessarily exactly the same, but since there is a distribution ratio calculation process by the color component distribution information acquisition module 33b described later, the number of pixels The strictness of is not a problem. When the integrated value exceeds the above 847, the pixel of the gradation value may be included in only one band or both. Further, in this band division, it is only necessary to specify a suitable luminance band to be used later for white balance adjustment, and it is not essential that the number of divisions is 10, and the division method is as described above. Not limited to.
[0053]
(4-2) Color component distribution information acquisition process:
The color component distribution information acquisition module 33b acquires color distribution information from a band preferable for white balance control based on the band data 34b4. For this purpose, first in step S225, the RGB components of the pixels belonging to the same band are integrated for each of the divided bands, and are stored in the work area 34b as RGB integration data 34b5. In step S230, “integrated value of G component / integrated value of R component” and “integrated value of G component / integrated value of B component” are obtained for each band as the distribution ratio, and the above work area is obtained as distribution ratio data 34b6. 34b. FIG. 10 is an explanatory diagram for explaining how the integral value and the distribution ratio are calculated. Since it is possible to determine which pixel belongs to which band in the band data 34b4, the RGB components of the pixels belonging to each band can be easily known as shown in FIG.
[0054]
From this RGB component value, the integral value is calculated by the following equation (1),
[Expression 1]
Figure 0004025962
The distribution ratio is calculated by the following formula (2).
[Expression 2]
Figure 0004025962
Here, R ij , G ij , and B ij are gradation values for each color component, “i” corresponds to a band number, and “j” is a convenient number for distinguishing pixels. Iri, Igi, and Ibi are integral values for each band and each component, and Ric and Bic are distribution ratios for each band.
[0055]
Here, since the integrated value is an integrated value of the gradation values of the color components, it is a value reflecting how many gradation values are distributed in each band. Also, calculating the distribution ratio using this integral value is equivalent to calculating the distribution ratio using the average gradation value for each color component in each band. The average gradation value for each color component in each band is the sum of the gradation values of the predetermined color components of the pixels belonging to the band and divided by the number of pixels. The number of pixels for each color component is the same in each band. However, in the case of the distribution ratio, the number of pixels is canceled out by the denominator and the numerator, and the only contribution to the distribution ratio is that only the component obtained by adding the gradation values.
[0056]
This distribution ratio Ric is “average value of G component for each band / average value of R component for each band”, and distribution ratio Bic is “average value of G component for each band / average value of B component for each band”. This distribution ratio is a coefficient having the property of adjusting the white balance. That is, when each RGB color component of a certain pixel is equal to the average gradation value of each color component in the band to which the pixel belongs, multiplying the distribution ratio Ric and the gradation value of the R component cancels the denominator and averages the G component. Even if the distribution ratio Bic and the gradation value of the B component are multiplied, the denominator cancels and becomes equal to the average value of the G component. Therefore, all the color components of the pixel are equal and become achromatic.
[0057]
As described above, the distribution ratio Ric and the distribution ratio Bic act on the R component and the B component of the pixel, respectively, and the R component and the B component are brought close to the reference while using the average value of the G component in the band as a reference. Can be said to be a coefficient for adjusting the white balance. Therefore, it can be said that the white balance correction coefficient for each band has been calculated up to step S230. In the present invention, the white balance of the entire image is adjusted with reference to the distribution ratio of the predetermined band, and correction is performed to obtain a more preferable result regardless of differences in image content, light source, and the like.
[0058]
When the distribution ratio data is acquired in step S230, the color component distribution information acquisition module 33b calculates average values R ′ nc and B ′ nc of the set of distribution ratios according to the following equation (3) in step S235.
[Equation 3]
Figure 0004025962
Here, n is a set number of the band and is an integer of “1-5”.
[0059]
FIG. 11 is an explanatory diagram for explaining a state in which two bands are grouped for the average value R ′ nc of the group. The upper graph shown in the figure shows a histogram divided into 10 bands as described above. In the above formula (3), since the average for the nth band and the (11-n) th band is calculated, as shown in FIG. Thus, the second bands (second and ninth) from both ends are sequentially combined. The concept of combination for B ′ nc is the same.
[0060]
FIG. 12 is an explanatory diagram for explaining the concept when averaging by combining distribution ratios, and shows the color gamut of the RGB color space mapped on the UY plane of the YUV color space. In the figure, the color gamut of the RGB color space is biased in the negative U direction in the high luminance region, and is biased in the positive U direction in the low luminance region. The same applies to the case of mapping on the V-Y plane, which is biased in the negative V direction in the high luminance region and biased in the positive V direction in the low luminance region. That is, the high luminance region and the low luminance region have opposite properties, and considering this property with the above distribution ratio, a large difference occurs between the high luminance region and the low luminance region. If averaged, the difference can be canceled out, and the distribution ratio obtained by removing the distribution ratio bias due to the color gamut shape can be evaluated. Note that the idea of averaging the distribution ratio so as to eliminate this bias is generated from the relationship between the RGB color space and the YUV color space, and can be adopted in white balance adjustment for many image devices. it can.
[0061]
If the average value of the set of distribution ratio at step 235 is calculated, R 'nc is determined whether "1" or less, at the same step S240 R' in step S240 nc is from "1" When it is determined that the value is smaller, the reciprocal of the R ′ nc is substituted for R ′ nc in step S245. The determination processing in steps S240 and S245 is performed independently for all of the combination numbers 1 to 5 and for B ′ nc regardless of the determination result in step S240. For all the processing here is R 'nc and B' nc, are those that the process of converting to a number greater than smaller than "1", "1", determination by the following evaluation function e n And is returned to the original value after discrimination by the evaluation function.
[0062]
(4-3) White balance control processing:
In step S250, the evaluation function e n, substituted and each pair of R 'nc and B' nc, the above white balance control module 33c of the set number n to which the evaluation function e n is the smallest R 'nc And B ′ nc are determined as the first-stage white balance correction coefficients R ′ c and B ′ c . This first-stage white balance correction coefficient has the same properties as the distribution ratio described above, and is a coefficient that can be a predetermined component of the white balance control matrix 34b8 shown in FIG. That is, when the white balance control matrix 34b8 is multiplied by a matrix having RGB components of arbitrary pixels in the image as components, the white balance of the image can be controlled.
[0063]
Here, the process of selecting the smallest evaluation function is the process of selecting the smallest difference between R ′ nc and B ′ nc and “1”, and the correction amount is the smallest. You are selecting a thing. In other words, in white balance adjustment, it is important to prevent color failure, and if a large correction amount is used as a white balance correction coefficient, color correction often occurs due to large correction, but a correction amount is small. If selected, the occurrence probability of color feria can be made very small. The present applicant has confirmed that the white balance correction coefficient determined by the above-described processing is very effective in white balance adjustment. Here, it is only necessary to prevent color feria, and evaluation is performed. The function can be changed as appropriate, for example, by selecting a function that is second closest to “1”.
[0064]
At this time, for example, color feria can be prevented by taking measures such as selecting the second and third closest to “1” within a predetermined range. Further, in the present invention, the white balance correction coefficient is calculated based on data belonging to a part of the luminance band of the image, and the correction amount having a small correction amount is selected as described above. Compared with the white balance adjustment that reflects the RGB integral value of the entire image as described above, it is very difficult to generate color feria.
[0065]
(4-3-1) Correction corresponding to light source type:
As described above, it is possible to perform white balance control using the first-stage white balance correction coefficient. However, in the present embodiment, in order to prevent the occurrence of color failure due to the difference in the light source, it is further illustrated in FIG. The processing after step S255 is executed. In step S255, the first-stage white balance correction coefficients R ′ c and B ′ c are expressed by the following equation so that the white balance correction coefficient is based on the gradation value “128” (median value) of the G component. Convert.
R = 128 / R ′ c , G = 128, B = 128 / B ′ c
[0066]
In step S260, the converted coefficient RGB is converted into a physiological three primary color space R′G′B ′ by the equation of Estevez-Hunt-Pointer according to the following equation (4).
[Expression 4]
Figure 0004025962
[0067]
Here, the matrix A is a matrix stored in the ROM 33 and converts the sRGB coordinates to the RGB coordinates of the physiological three primary colors. The matrix A is generated by multiplying the matrix B and the matrix C. Each matrix has the above-described values, and the matrix B is a conversion matrix that converts sRGB coordinates into XYZ coordinates. It is a matrix for converting XYZ coordinates to RGB coordinates of physiological three primary colors. In the above formula, italicized characters indicate a matrix. When the spatial data R′G′B ′ of the physiological three primary colors is obtained in step S260, final white balance correction coefficients Rc and Bc are determined according to the following formula in step S265.
Rc = G ′ / R ′, Bc = G ′ / B ′
[0068]
The processes in steps S255 to S265 correspond to temporarily converting sRGB coordinates to R′G′B ′ coordinates of physiological three primary colors and correcting the white balance correction coefficient in the converted space (step S265). To do. By this processing, it is possible to approach a good white balance according to human appearance, and it is possible to perform white balance control independent of the light source type. Further, by incorporating the final white balance correction coefficients Rc and Bc into the white balance control matrix W, the coordinates of the second color space are corrected and white balance adjustment is executed. FIG. 13 and FIG. 14 are explanatory diagrams for explaining how the white balance correction coefficient is corrected by converting to physiological three primary colors.
[0069]
FIG. 13 is a diagram showing a spectral distribution of an ideal light source of sRGB (CIE standard light source D65), and FIG. 14 is a diagram showing a spectral distribution of three physiological primary colors. In the figure, the horizontal axis is the wavelength (nm), and the vertical axis is the relative value of the spectral distribution. 13 and 14, the curve having a peak near 450 nm is the B component, and the curve having a peak near 540 nm is the spectral distribution of the G component, and has a peak near 610 nm in FIG. 13 and near 580 nm in FIG. 14. The curve is the spectral distribution of the R component. Since the white balance correction coefficient is multiplied by the R component and the B component, adjustment by the white balance correction coefficient enlarges the curve of the B component and the R component for the spectral distributions in FIGS. It works to shrink or shrink.
[0070]
Since the spectral distribution shown in FIG. 14 is a distribution for the three physiological primary colors, the human perception of color is very close to this distribution, and when the white balance correction coefficient is corrected in the RGB space that is this distribution, The white balance can be controlled in a way that is very close to how you feel the colors. Specifically, in the spectral distribution shown in FIG. 13, the peak wavelength and peak intensity of the R component are larger than the peak wavelength and peak intensity of the R component of the spectral distribution shown in FIG. Therefore, if the white balance is adjusted without performing the conversion in step S260, the correction for the R component becomes relatively large, and the R component is overemphasized or weakened. Therefore, it is possible to adjust the white balance so that the color looks more red by correcting the white balance correction coefficient after the conversion in step S260. Of course, the same is true for blue. Therefore, the white balance correction coefficient can be determined so that an appropriate white balance is adjusted even for an image taken with an incandescent lamp.
[0071]
When the final white balance correction coefficients Rc and Bc are determined in step S265, in step S270, the white balance correction coefficients Rc and Bc are used as components in the first row and first column and the third row and third column, and the second row and second column. A white balance control matrix W (34b9) is generated by multiplying the matrix with “1” and other components “0” by multiplying the inverse transformation matrix A- 1 from the left and multiplying the matrix A from the right. In step S275, the white balance control matrix W is stored in the work area 34b of the RAM 34.
[0072]
The inverse transformation matrix A- 1 is expressed by the following equation (5).
[Equation 5]
Figure 0004025962
Also in the above formula, italicized characters indicate a matrix.
[0073]
The process up to the calculation / storage of the white balance control matrix W corresponds to the measurement of the white balance, and as the processing of the digital still camera 10, the process returns to the flowchart shown in FIG. In step S110, the white balance of each captured image is controlled by multiplying the image data obtained by converting the CCD Raw data into the sRGB data by the white balance control matrix W.
[0074]
That is, the white balance control matrix W is a matrix that operates to adjust the white balance of the image of the color image data expressed by the sRGB coordinates, and the input and output data are sRGB data. Since the white balance correction coefficient is not a correction coefficient for sRGB, the input / output data is converted to sRGB data by converting the space using the matrix A or the like. Therefore, the processing of steps S270, S275, and S110 corresponds to the processing in the matrix calculation unit 33e. FIG. 15 is an explanatory diagram for explaining the calculation by the white balance control matrix W. In the upper matrix calculation expression, RGB on the right side is input sRGB data, and R ″ G ″ B ″ on the left side is Output sRGB data. Further, in the actual processing of the present embodiment, the white balance control matrix W is one 3 × 3 matrix obtained by calculating three 3 × 3 matrices in advance. This will be explained separately.
[0075]
In FIG. 15, each calculation stage using three matrices is shown below the matrix calculation formula. As described above, the input data (1) is sRGB data. Since the matrix A is a matrix for converting the RGB color components of the sRGB coordinate system into the RGB color components of the physiological three primary colors, when the input data (1) is multiplied by the matrix A, the physiological three primary colors are represented as shown in (2). Converted to RGB color components. That is, this conversion is processing in the first color space conversion unit 33e1. When this conversion result is multiplied by a matrix including the white balance correction coefficients Rc and Bc as components, the white balance is adjusted with RGB color components of physiological three primary colors as shown in (3). That is, the process here is the process in the white balance control unit 33e2.
[0076]
When this adjusted RGB data is multiplied by the inverse conversion matrix A- 1 , the image data after white balance adjustment is converted into sRGB data as shown in (4). That is, the process here is a process in the second color space conversion unit 33e3. In this embodiment, this calculation is realized by a single matrix, and the sRGB coordinates in the first color space are converted into RGB color components of physiological three primary colors as the second color space by one calculation, and the second The white balance is adjusted with the correction coefficient in the color space, and the corrected RGB color components are returned to the sRGB coordinates in the first color space. Accordingly, when the sRGB data is multiplied by a white balance control matrix W, which is a 3 × 3 matrix, in the image processing process of the digital still camera, the sRGB data with the adjusted white balance is obtained. Since it is corrected in a space close to, white balance can be adjusted reliably without being affected by the light source.
[0077]
As described above, in the present invention, the coordinates of the first color space are converted into the coordinates of the second color space, and the white balance is controlled by correcting the coordinates of the converted second color space. The later coordinates are converted into the coordinates of the first color space. Therefore, white balance adjustment can be performed without being affected by a specific color in the image or a light source biased to the specific color.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a schematic configuration of a digital still camera.
FIG. 2 is a flowchart showing a main flow of image processing.
FIG. 3 is a block diagram showing a white balance measurement system and a control system;
FIG. 4 is a flowchart showing white balance measurement and control.
FIG. 5 is a flowchart showing white balance measurement and control.
FIG. 6 is an explanatory diagram for explaining a thinning process;
FIG. 7 is a diagram illustrating pixel data after RGBYs conversion.
FIG. 8 is a graph showing an example of a histogram.
FIG. 9 is an explanatory diagram illustrating a state of band division.
FIG. 10 is an explanatory diagram for explaining how an integral value and a distribution ratio are calculated.
FIG. 11 is an explanatory diagram for explaining how two bands are combined.
FIG. 12 is an explanatory diagram for explaining a concept when averaging by combining distribution ratios;
FIG. 13 is a diagram showing a spectral distribution of an ideal light source of sRGB.
FIG. 14 is a diagram showing a spectral distribution for three physiological primary colors.
FIG. 15 is an explanatory diagram for explaining calculation by a white balance control matrix;
[Explanation of symbols]
DESCRIPTION OF SYMBOLS 10 ... Digital still camera 20 ... Optical part 21 ... Optical lens system 22 ... Autofocus mechanism 23 ... Distance measuring part 24 ... Autofocus controller 25 ... Controller 26 ... CCD
27 ... Strobe 28 ... Auto gain controller (AGC)
29 ... A / D converter 30 ... Control unit 31 ... Bus 32 ... CPU
33 ... ROM
33a ... Luminance component acquisition module 33b ... Color component distribution information acquisition module 33c ... White balance control module 33d1 ... Conversion matrix A
33d2 ... Inverse transformation matrix A -1
33e ... Matrix calculation unit 33e1 ... first color space conversion unit 33e2 ... white balance control unit 33e3 ... second color space conversion unit 34 ... RAM
34a ... image area 34b ... work area 34b1 ... thinned-data-34b2 ... RGBYs data 34B3 ... histogram data 34B4 ... band data 34b5 ... RGB integrated data 34B6 ... distribution ratio data 34B7 ... correction coefficient R 'c, B' c
34b8 ... White balance control matrix 34b9 ... White balance control matrix 34c ... Video RAM area 35 ... Operation panel 36 ... LCD panel 37a ... I / O
37b ... Flash memory card

Claims (3)

複数の画素について第1色空間の座標にて色が表現された画像のホワイトバランスを調整するホワイトバランス調整装置であって、
上記画像における各色成分の階調分布のバランスを第1色空間の座標によって示す第1分布比を算出する第1分布比算出手段と、
上記第1分布比を所定の変換式によって人間の目の錐体感度特性を反映した生理的三原色の色空間の座標によって示される第2分布比に変換する第2分布比算出手段と、
上記第2分布比に基づいてホワイトバランス補正係数を算出するホワイトバランス補正係数算出手段と、
上記第1色空間の座標を生理的三原色の色空間の座標に変換する変換式と、上記ホワイトバランス補正係数に基づく変換式と、生理的三原色の色空間の座標を上記第1色空間の座標に変換する変換式とを合成したホワイトバランス制御マトリクスを生成するホワイトバランス制御マトリクス生成手段と、
上記画像を上記ホワイトバランス制御マトリクスによって変換することにより当該画像のホワイトバランスを制御するホワイトバランス制御手段とを具備することを特徴とするホワイトバランス調整装置。
A white balance adjustment device that adjusts the white balance of an image in which colors are expressed by coordinates in a first color space for a plurality of pixels,
First distribution ratio calculating means for calculating a first distribution ratio indicating a balance of gradation distribution of each color component in the image by coordinates of a first color space;
Second distribution ratio calculation means for converting the first distribution ratio into a second distribution ratio indicated by coordinates of a color space of physiological three primary colors reflecting the cone sensitivity characteristic of human eyes by a predetermined conversion formula;
White balance correction coefficient calculating means for calculating a white balance correction coefficient based on the second distribution ratio;
The conversion formula for converting the coordinates of the first color space to the coordinates of the color space of the physiological three primary colors, the conversion formula based on the white balance correction coefficient, and the coordinates of the color space of the physiological three primary colors are the coordinates of the first color space. A white balance control matrix generating means for generating a white balance control matrix obtained by synthesizing the conversion formula for conversion to
A white balance adjustment device comprising: white balance control means for controlling the white balance of the image by converting the image with the white balance control matrix.
上記第1分布比は、各色成分の階調分布のバランスを各色成分の階調の中央値を基準とした値で表した座標であることを特徴とする請求項1に記載のホワイトバランス調整装置。2. The white balance adjustment device according to claim 1 , wherein the first distribution ratio is a coordinate representing a balance of gradation distribution of each color component with a value based on a median value of gradation of each color component. . 複数の画素についてRGB空間の座標にて色が表現された画像のホワイトバランスを調整する機能をコンピュータに実行させるコンピュータ読みとり可能なホワイトバランス調整プログラムであって、
上記画像における各色成分の階調分布のバランスを第1色空間の座標によって示す第1分布比を算出する第1分布比算出機能と、
上記第1分布比を所定の変換式によって人間の目の錐体感度特性を反映した生理的三原色の色空間の座標によって示される第2分布比に変換する第2分布比算出機能と、
上記第2分布比に基づいてホワイトバランス補正係数を算出するホワイトバランス補正係数算出機能と、
上記第1色空間の座標を生理的三原色の色空間の座標に変換する変換式と、上記ホワイトバランス補正係数に基づく変換式と、生理的三原色の色空間の座標を上記第1色空間の座標に変換する変換式とを合成したホワイトバランス制御マトリクスを生成するホワイトバランス制御マトリクス生成機能と、
上記画像を上記ホワイトバランス制御マトリクスによって変換することにより当該画像のホワイトバランスを制御するホワイトバランス制御機能とをコンピュータに実行させることを特徴とするホワイトバランス調整プログラム。
A computer-readable white balance adjustment program for causing a computer to execute a function of adjusting a white balance of an image in which colors are expressed by coordinates in RGB space for a plurality of pixels,
A first distribution ratio calculation function for calculating a first distribution ratio indicating a balance of gradation distribution of each color component in the image by coordinates of a first color space;
A second distribution ratio calculation function for converting the first distribution ratio into a second distribution ratio indicated by the coordinates of the color space of the physiological three primary colors reflecting the cone sensitivity characteristics of the human eye by a predetermined conversion formula;
A white balance correction coefficient calculation function for calculating a white balance correction coefficient based on the second distribution ratio;
The conversion formula for converting the coordinates of the first color space to the coordinates of the color space of the physiological three primary colors, the conversion formula based on the white balance correction coefficient, and the coordinates of the color space of the physiological three primary colors are the coordinates of the first color space. A white balance control matrix generation function for generating a white balance control matrix that combines the conversion formula for conversion into
A white balance adjustment program for causing a computer to execute a white balance control function for controlling white balance of an image by converting the image by the white balance control matrix.
JP2001272283A 2001-09-07 2001-09-07 White balance adjustment Expired - Fee Related JP4025962B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001272283A JP4025962B2 (en) 2001-09-07 2001-09-07 White balance adjustment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001272283A JP4025962B2 (en) 2001-09-07 2001-09-07 White balance adjustment

Publications (2)

Publication Number Publication Date
JP2003087817A JP2003087817A (en) 2003-03-20
JP4025962B2 true JP4025962B2 (en) 2007-12-26

Family

ID=19097679

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001272283A Expired - Fee Related JP4025962B2 (en) 2001-09-07 2001-09-07 White balance adjustment

Country Status (1)

Country Link
JP (1) JP4025962B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005086495A1 (en) * 2004-03-10 2005-09-15 National University Corporation Shizuoka University Filter and moving picture camera

Also Published As

Publication number Publication date
JP2003087817A (en) 2003-03-20

Similar Documents

Publication Publication Date Title
US8103119B2 (en) Image processing device, image processing method, image processing program product, and image-capturing device
EP0757473B1 (en) Image processing apparatus and method
US6823083B1 (en) Saturation correcting apparatus and method
US7999978B2 (en) Matrix coefficient determining method and image input apparatus
US8767103B2 (en) Color filter, image processing apparatus, image processing method, image-capture apparatus, image-capture method, program and recording medium
JP4635828B2 (en) Imaging apparatus, image processing apparatus, image processing method, and image processing program
US8243164B2 (en) Method, apparatus, and system for selecting pixels for automatic white balance processing
US20090060326A1 (en) Image processing apparatus and method
US20060245008A1 (en) Image processing apparatus, image processing method, electronic camera, and scanner
WO2011118071A1 (en) Image processing method and device, image processing program, and medium having said program recorded thereon
JP2005210526A (en) Image processing apparatus, method, and program, image pickup device, and image data outputting method and program
JP2005210495A (en) Image processing apparatus, method, and program
KR20070091208A (en) Automatic white balance control
US20020085750A1 (en) Image processing device
JP2010139324A (en) Color irregularity measuring method and color irregularity measuring device
US7184174B2 (en) Color picture signal processing method and color picture using the method
US7514669B2 (en) Imaging apparatus and light source estimating device for the imaging apparatus
JP2005045446A (en) Color conversion matrix calculation method and color correction method
JP2002109523A (en) Image pickup device, optical filter group, and image data converter
US20040057060A1 (en) Method for fast color saturation control
JP4003037B2 (en) White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera
JPH1141622A (en) Image processor
JP2003304556A (en) Video signal processing apparatus and video signal processing method
JP4025962B2 (en) White balance adjustment
JP2006222783A (en) Preparation of color conversion table

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050114

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070330

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070404

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070604

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070711

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070810

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070925

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

Free format text: PAYMENT UNTIL: 20101019

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20101019

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20111019

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20121019

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20121019

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20131019

Year of fee payment: 6

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees