JP4003037B2 - White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera - Google Patents

White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera Download PDF

Info

Publication number
JP4003037B2
JP4003037B2 JP2001272282A JP2001272282A JP4003037B2 JP 4003037 B2 JP4003037 B2 JP 4003037B2 JP 2001272282 A JP2001272282 A JP 2001272282A JP 2001272282 A JP2001272282 A JP 2001272282A JP 4003037 B2 JP4003037 B2 JP 4003037B2
Authority
JP
Japan
Prior art keywords
white balance
color
component
color component
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2001272282A
Other languages
Japanese (ja)
Other versions
JP2003087816A (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 JP2001272282A priority Critical patent/JP4003037B2/en
Publication of JP2003087816A publication Critical patent/JP2003087816A/en
Application granted granted Critical
Publication of JP4003037B2 publication Critical patent/JP4003037B2/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)

Description

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

Figure 0004003037
分布比は以下の式(2)にて算出する。
【数2】
Figure 0004003037
ここで、Rij,Gij,Bijは各色成分毎の階調値であり、「i」は帯域の番号に該当し「j」は画素を区別するための便宜的な番号である。また、Iri,Igi,Ibiは各帯域毎、各成分毎の積分値であり、RicとBicは各帯域毎の分布比である。
【0065】
ここで、上記積分値は色成分の階調値の積算値であることから、各帯域毎にどれほどの値の階調値がどれほど分布しているかを反映した値となっている。また、この積分値を使用して分布比を算出することは帯域毎の色成分毎の平均階調値を使用して分布比を算出することと等価である。帯域毎の色成分毎の平均階調値は、帯域内に属する画素の所定色成分の階調値を足し合わせ、画素数で除したものであり、色成分毎の画素数は各帯域で同数であるところ、分布比にした場合には分母と分子で画素数が相殺されて結局分布比に寄与するのは階調値を足し合わせた成分のみとなるからである。
【0066】
この分布比Ricは「帯域毎のG成分の平均値/帯域毎のR成分の平均値」,分布比Bicは「帯域毎のG成分の平均値/帯域毎のB成分の平均値」であり、この分布比はホワイトバランスを調整する性質を持った係数となる。すなわち、ある画素のRGB色成分それぞれがその画素の属する帯域の各色成分の平均階調値と等しい場合、分布比RicとR成分の階調値とを乗じると分母が相殺してG成分の平均値と等しくなり、分布比BicとB成分の階調値とを乗じても分母が相殺してG成分の平均値と等しくなる。従って、当該画素の全色成分が等しくなり無彩色になる。
【0067】
このように、分布比Ricと分布比Bicとはそれぞれ画素のR成分とB成分とに作用し、その帯域のG成分の平均値を基準としつつ当該基準に近づけるようにR成分とB成分とを相対的に変化させるので、ホワイトバランスを調整するための係数であると言える。従って、上記ステップS230まででは、帯域毎のホワイトバランス補正係数を算出したと言える。本発明においては、所定帯域の分布比を参照して画像全体のホワイトバランスを調整するとともに、画像内容や光源等の差異にかかわらずより好ましい結果を得るための補正を加えている。
【0068】
ステップS230にて分布比データを取得すると、上記色成分分布情報取得モジュール33bはステップS235にて以下の式(3)に従って分布比の組みの平均値R’nc,B’ncを算出する。
【数3】
Figure 0004003037
ここで、nは帯域の組番号であり「1〜5」の整数である。
【0069】
図11は、組みの平均値R’ncについて2つの帯域を組みにする様子を説明する説明図である。同図に示す上部のグラフは上述のようにして10個の帯域に分割されたヒストグラムを示している。上記式(3)においては、n番目の帯域と(11−n)番目の帯域についての平均を算出していることから、同図に示すように両端の帯域(1番目と10番目)が組みとなり、両端から2番目の帯域(2番目と9番目)が組みとなるようにして順次組み合わせられる。B’ncについての組み合わせの考え方も同様である。
【0070】
図12は、分布比を組みにして平均化する際の考え方を説明する説明図であり、同図はYUV色空間のU−Y平面に写像されたRGB色空間の色域を示す。同図において、RGB色空間の色域は、高輝度領域で負のU方向に偏り、低輝度領域で正のU方向に偏っている。V−Y平面に写像した場合も同様で、高輝度領域で負のV方向に偏り、低輝度領域で正のV方向に偏ることとなる。すなわち、高輝度領域と低輝度領域とで逆の性質を有しており、この性質を上記分布比で考えると高輝度領域と低輝度領域とで大きな差が発生することとなるが、両者を平均すればその差を相殺することができ、色域形状に起因する分布比の偏りを除去した当該分布比を評価することができる。尚、この偏りを除去するように分布比を平均化する考え方は、RGB色空間とYUV色空間との関係から発生したものであり、多くの画像機器についてのホワイトバランス調整にて採用することができる。
【0071】
ステップ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による判別のための変換であるとともに、評価関数による判別後は元の値に戻される。
【0072】
(4−3)ホワイトバランス制御処理:
ステップS250では、評価関数eに対して、各組のR’ncとB’ncとを代入し、上記ホワイトバランス制御モジュール33cは当該評価関数eが最小となる組み番号nのR’ncとB’ncとの値を第1段階のホワイトバランス補正係数R’およびB’として決定する。この第1段階のホワイトバランス補正係数も上述の分布比と同様の性質を有しており、上記図3に示すホワイトバランス制御マトリクス34b8の所定成分となり得る係数である。すなわち、画像内の任意の画素のRGB成分を成分とする行列にホワイトバランス制御マトリクス34b8を乗じると、その画像のホワイトバランスを制御することができる。
【0073】
ここで、評価関数が最小のものを選択する処理は、R’ncとB’ncとのそれぞれと「1」との差が最小のものを選択している処理であり、補正量が最も小さいものを選択していることになる。すなわち、ホワイトバランス調整においてはカラーフェリアを防止することが重要であり、補正量の大きなものをホワイトバランス補正係数としてしまうと大きな補正によってカラーフェリアが発生することが多いが、補正量が小さいものを選択しておけば、カラーフェリアの発生確率を非常に小さくすることができる。また、補正量が小さいものを選択しているとともに、他の領域と比較して色成分分布の偏りが少ない領域を選択していると言うこともできる。この場合、上記輝度成分取得モジュール33aが上記画像分割手段に該当するし、色成分分布情報取得モジュール33bにて評価関数が最小となるものを選択する処理が上記色成分分布の偏りが少ない領域を選択することに該当する。さらに、評価関数が最小となるものを選択する処理は、G成分に対してR成分およびB成分が他の領域と比較して比較的均等に分布している領域を選択している処理であると言うこともできる。
【0074】
本出願人は、上述の処理によって決定されたホワイトバランス補正係数が非常に効果的にホワイトバランス調整可能であることを確認しているが、ここでは、カラーフェリアを防止することができればよく、評価関数が2番目に「1」に近いものを選択する構成にするなど適宜変更可能である。このとき、例えば、所定の値域内であれば2番目,3番目に「1」に近いものを選択するようにするなどの工夫を施せばカラーフェリアを防止可能である。また、本発明においては、画像の一部の輝度帯域に属するデータに基づいてホワイトバランス補正係数を算出しており、上述のように補正量の小さいものを選択しているため、上述の従来例のように画像全体のRGB積分値を反映させるホワイトバランス調整と比較して、非常にカラーフェリアが発生しにくい。
【0075】
(4−3−1)光源種別に対応した補正:
上述のように第1段階のホワイトバランス補正係数でホワイトバランス制御を行うことも可能であるが、本実施形態においてはより見た目に近づけるために、さらに図5のステップS255以降の処理を実行している。ステップS255では、G成分の階調値「128」(中央値)を基準としたホワイトバランス補正係数となるように以下の式にて上記第1段階のホワイトバランス補正係数R’およびB’を変換する。
R=128/R’,G=128,B=128/B’
【0076】
ステップS260では、当該変換後の係数RGBを以下の式(4)に従ってEstevez−Hunt−Pointerの式にて生理的三原色の空間R’G’B’に変換する。
【数4】
Figure 0004003037
【0077】
ここで、マトリクス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’
【0078】
これらステップS255〜S265の処理は、sRGB座標を一旦生理的三原色のR’G’B’座標に変換し、当該変換後の空間でホワイトバランス補正係数を補正(ステップS265)していることに該当する。この処理によって人間の見た目に応じた良好なホワイトバランスに近づけることができ、光源種に依存しないホワイトバランス制御を実施することができる。図13,図14は生理的三原色に変換してホワイトバランス補正係数を補正する様子を説明する説明図である。
【0079】
図13はsRGBの理想光源(CIE標準の光源D65)の分光分布を示す図であり、図14は生理的三原色についての分光分布を示す図である。図において横軸は波長(nm)であり、縦軸は分光分布の相対値である。尚、図13,図14において450nm付近にピークがあるカーブはB成分、540nm付近にピークがあるカーブはG成分の分光分布であり、図13の610nm付近,図14の580nm付近にピークがあるカーブはR成分の分光分布である。上記ホワイトバランス補正係数はR成分とB成分とに対してそれぞれ乗ぜられるので、ホワイトバランス補正係数による調整は、上記図13,14における分光分布に対してはB成分とR成分のカーブを拡大したり縮小したりするように作用する。
【0080】
図14に示す分光分布は生理的三原色についての分布であることから、人間の色の感じ方はこの分布に非常に近く、この分布となるRGB空間でホワイトバランス補正係数の補正を行うと、人間の色の感じ方に非常に近い形でホワイトバランスを制御することができる。具体的には、図13に示す分光分布においてはR成分のピーク波長およびピーク強度が図14に示す分光分布のR成分のピーク波長およびピーク強度より大きい。従って、上記ステップS260における変換を実施せずにホワイトバランスの調整をしようとすると、R成分に対する補正が相対的に大きくなり、R成分を強調しすぎたり、弱めすぎたりしてしまう。そこで、上記ステップS260における変換を実施した後にホワイトバランス補正係数を補正することにより、より見た目に近い赤となるようにホワイトバランスを調整可能である。むろん、青に関しても同様で見た目に近い青となる。従って、白熱灯かでの撮影画像等であっても適切なホワイトバランスとなるよう調整されるようにホワイトバランス補正係数を決定可能である。
【0081】
ステップS265にて最終的なホワイトバランス補正係数Rc,Bcを決定したら、ステップS270において当該ホワイトバランス補正係数Rc,Bcを1行1列目および3行3列目の成分とし、2行2列目の成分を「1」とし、他の成分を「0」としたマトリクスの左から上記逆変換マトリクスA−1を乗じ、右から上記マトリクスAを乗じてホワイトバランス制御マトリクスW(34b9)を生成し、ステップS275にて当該ホワイトバランス制御マトリクスWを上記RAM34のワークエリア34bに保存する。
【0082】
尚、逆変換マトリクスA−1は以下の式(5)にて表現される。
【数5】
Figure 0004003037
上記式においても斜体の文字はマトリクスを示している。
【0083】
このホワイトバランス制御マトリクスWの算出/保存までがホワイトバランスの測定に該当し、ディジタルスチルカメラ10の処理としてはこの後図2に示すフローチャートに戻ってステップS106以降の処理を実行する。そして、ステップS110においてCCDRawデータをsRGBデータに変換した画像データに対してホワイトバランス制御マトリクスWを乗じることによって個々の撮像画像のホワイトバランスを制御する。
【0084】
すなわち、ホワイトバランス制御マトリクスWは、sRGB座標で表現されたカラー画像データの画像についてホワイトバランスを調整するように作用するマトリクスであり、入力および出力データはsRGBデータである。上記ホワイトバランス補正係数はsRGBに対する補正係数ではないため、上記マトリクスA等による空間の変換を行って入出力データがsRGBデータになるようにしてある。図15は、かかるホワイトバランス制御マトリクスWによる演算を説明するための説明図であり、上部のマトリクス演算式において右辺のRGBは入力sRGBデータであり、左辺のR’’G’’B’’は出力sRGBデータである。また、本実施形態の実際の処理においてホワイトバランス制御マトリクスWは3個の3×3の行列を予め計算して得られる1個の3×3の行列であるが、ここでは便宜上3個のマトリクスに分けて説明する。
【0085】
図15においてマトリクス演算式の下方には3個のマトリクスによる各演算段階を示している。上述のように入力データ▲1▼はsRGBデータである。マトリクスAはsRGB座標系のRGB色成分を生理的三原色のRGB色成分に変換するマトリクスであるので、当該入力データ▲1▼にマトリクスAを乗じると、▲2▼に示すように生理的三原色のRGB色成分に変換される。この変換結果に対して上記ホワイトバランス補正係数Rc,Bcを成分として含むマトリクスを乗じると、▲3▼に示すように生理的三原色のRGB色成分にてホワイトバランスが調整される。この調整後のRGBデータに逆変換マトリクスA−1を乗じると、▲4▼に示したようにホワイトバランス調整後の画像データがsRGBデータに変換される。従って、ディジタルスチルカメラの画像処理過程においてsRGBデータに1個の3×3の行列であるホワイトバランス制御マトリクスWを乗じるとホワイトバランスが調整される。
【0086】
以上説明したように、本発明においては画像の輝度成分を取得して帯域分割し、所定の帯域内にある画像の色成分分布情報に基づいてホワイトバランスを調整するためのホワイトバランス補正係数を算出する。従って、画像内の特定色や特定色に偏った光源に影響されることなくホワイトバランス調整を実施可能となる。
【図面の簡単な説明】
【図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
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[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a white balance adjustment device, a white balance adjustment program, a white balance adjustment method, and a digital camera.
[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. A white balance adjustment device, a white balance adjustment program, a white balance adjustment program capable of performing white balance adjustment without being affected by a specific color or a light source biased to a specific color in an image. An object is to provide a balance adjustment method and a digital camera.
[0004]
[Means for Solving the Problems]
  To achieve the above purpose, PaintingAn image dividing unit that divides an image into a plurality of reference regions composed of a plurality of parts, and a reference region that is divided by the image dividing unit, and the color component distribution in the region is biased compared to other reference regions Color component distribution information acquisition means for acquiring color component distribution information for a small predetermined area, and white balance control means for controlling the white balance by correcting the color components of the image based on the acquired color component distribution information. As constitution to haveAlso good.the aboveConstitution, The image is divided into a plurality of reference areas composed of a plurality of parts, color component distribution information for any one or combination of the reference areas is acquired, and the color components of the image are determined based on the color component distribution information. Correct and control the white balance. Here, the color component distribution information acquisition unit acquires the color component distribution information for a region where the deviation of the color component distribution in the region is small compared to other reference regions.
[0005]
That is, the white balance is adjusted based on the color components in the region where the color component distribution is less biased, and the overall balance is not adjusted based on the color components of the entire image. Therefore, even if there is a large portion of a single color in the image, this portion can be excluded, and the color feria can be prevented without being greatly affected by this single color portion. Here, the region where the color component distribution is less biased is compared with the other reference regions, and an area where the color component is less unevenly distributed, i.e., an achromatic region, is selected. I don't mean to get it. Further, the reference area does not need to be a continuous area, and may be composed of a plurality of parts extracted from the entire image. For example, a plurality of parts may be extracted from the entire image, or a part having a luminance within a predetermined range may be extracted, and the reference region can be configured with parts extracted based on various indices. The predetermined color may be any one of the color components when the image is composed of three color components, or may be a predetermined color expressed by a combination thereof.
[0006]
  Also, PaintingWhen the image is expressed by the first color component to the third color component, the other second color component and the third color component are compared with the other regions in the image with respect to the reference first color component. A color component distribution information acquisition unit that acquires color component distribution information of a relatively uniformly distributed region, and a white that controls white balance by correcting the color components of the image based on the acquired color component distribution information As a configuration comprising a balance control meansAlso good.
[0007]
  the aboveConstitutionIn FIG. 2, the image is expressed by the first to third color components, and the first color component is used as a reference in controlling the white balance. Then, color component distribution information is acquired for a region in which the other second color component and the third color component are distributed relatively evenly with respect to the reference first color component as compared with other regions in the image. Then, the color component of the image is corrected based on the color component distribution information of this region.
[0008]
That is, since the white balance is adjusted based on the color component distribution information in a region where the second color component and the third color component are not distributed with respect to the reference first color component, the presence of the specific color is greatly affected. Color feria can be prevented without being affected. Here, the first to third color components can be realized by various color components such as RGB components and CMY components, but are preferably RGB components close to the color distribution felt by the human cone. In addition, it is preferable that the G component that occupies most of the luminance component be the reference color.
[0009]
  The present inventionAre acquired by a luminance component acquisition unit that acquires a luminance component of an image and a color component distribution information acquisition unit that acquires color component distribution information of an image of a part of the image where the luminance component is in a predetermined band. White balance control means for controlling the white balance by correcting the color components of the image based on the color component distribution information is provided.
[0010]
  the aboveConstitutionThe luminance component acquisition unit acquires the luminance component of the image, and the color component distribution information acquisition unit acquires the color component distribution information of the image of the part where the luminance component is in a predetermined band. Then, the white balance control means corrects the color component of the image based on the acquired color component distribution information and controls the white balance.
[0011]
That is, since color component distribution information is used for an image of a part where the luminance component is within a predetermined band, color feria can be prevented without being greatly affected by a large specific color of the entire image. In all the above-mentioned inventions, since the color component distribution information is acquired, it is preferable to apply it to an image device that handles digital image data. However, it is of course preferable for an image device that handles analog data such as a television. The present invention can also be applied.
[0012]
  Here, the luminance component acquisition unit only needs to acquire the luminance component of the image, and various configurations can be employed. As an example of its configurationClaim 2According to the invention, the luminance component acquisition means is configured to divide the dot matrix image data into predetermined sections and acquire an average value of color components for each section as the luminance component. That is, in recent image devices, a very large amount of pixel data such as millions of pixels can be handled. In such image devices, the luminance component is referred to for all of the dot matrix image data, and all In order to process the color component distribution information, a very large amount of calculation time is required and a very large amount of buffer memory is required.
[0013]
Therefore, it is preferable to thin out the reference data as long as the overall white balance can be adjusted. In the present invention, the image data is divided into predetermined sections, and the average value of the color components for each section is acquired. In addition, when data as a luminance component is included in the image data, the data may be used. However, when the image data includes data of a color component, generally, the luminance component can be calculated from the color component data. . There are various formulas for calculating the luminance component, but if the average value of the color component is calculated as in the present invention, the calculation is very simple and can be performed easily. Of course, for example, the luminance component can be calculated as Y = 0.30R + 0.59G + 0.11B based on the RGB components.
[0014]
  Furthermore, the luminance component acquisition unit only needs to be able to provide an index for extracting the pixel to be referenced for white balance adjustment for each band.The present inventionThe luminance component acquisition means is configured to form a histogram of the luminance component of the image and divide the band into a predetermined luminance range. That is, when the luminance component is converted into a histogram, the distribution of the luminance component for each level, for example, each gradation value can be grasped, and if the distribution of the luminance component is known, the band can be easily divided. For example, it is possible to divide the band so that the number of pixels existing in each band becomes substantially equal.
[0015]
  As color component distribution information, various information that can be used as guidelines for adjusting white balance can be acquired.The present inventionThe color component distribution information acquisition means isDistribution ratio for each color component of the image for each divided bandIs obtained. In other words, when the image contains a lot of specific color components, the white balance tends to shift, so if the distribution ratio is obtained for each color component, it becomes easier to compare the distribution ratio of each color component, and the white balance can be adjusted easily. can do.
[0016]
Here, the color component distribution information is acquired for a predetermined reference area, or is acquired for an area in which the second color component and the third color component are distributed relatively evenly with respect to the standard first color component. If it is acquired for each predetermined band, a color failure can be prevented without being greatly influenced by a specific color of the entire image. Also in this case, various color components such as an RGB component and a CMY component can be adopted as the color component, but an RGB component close to the color distribution felt by a human cone is preferable. Furthermore, the distribution ratio may be any ratio that reflects the distribution of the color components, and various modes can be adopted. For example, the integrated value of the gradation value and level for each color component or an average value may be used. Further, the ratio may be any ratio regarding the color component distribution, and any color component may be a denominator or a numerator.
[0017]
  further,Claim 3In the invention according to the aspect of the invention, the color component distribution information acquisition unit may be configured such that when the image is expressed by a first color component to a third color component,As distribution ratio“1” is acquired for the first color component, the ratio between the distribution of the first color component and the distribution of the second color component is acquired for the second color component, and the distribution of the first color component and the first color component are acquired for the third color component. The ratio to the distribution of the three color components is obtained.
[0018]
That is, it is preferable to acquire color component distribution information that can be used for white balance adjustment as a distribution ratio, and if the ratio between the distribution of the first color component and the amount of the second color component is acquired, the first color component is obtained. The relative distribution of the second color component as a reference can be grasped, and at the same time, the relative correction amount of the second color component can be grasped. The same applies to the third color component, and if the ratio between the distribution of the first color component and the third color component is obtained, the relative distribution of the third color component based on the first color component can be grasped. can do.
[0019]
Accordingly, “1” is set for each of the first color components in the entire image, “ratio between the distribution of the first color component and the distribution of the second color component” for each of the second color components, and “ By multiplying the ratio of the distribution of the first color component and the distribution of the third color component ”, adjustment that reduces the deviation of the distribution of the color component, that is, adjustment of white balance can be performed.
[0020]
  further,The present inventionThe white balance control means averages the distribution ratio for at least two luminance bands.Turn intoThe configuration is as follows. That is, without referring to the color component distribution information for the entire image, refer to the color component distribution information for a predetermined reference region, a region where the distribution ratio of the color components is equal, or a region where the luminance component is within a predetermined band. In controlling the white balance, various guidelines can be adopted as to how the color component distribution information is acquired. As an example, if the distribution ratio is averaged over at least two luminance bands, the deviation of the color component distribution over the entire luminance range can be compensated, and this distribution ratio is made a coefficient for each color component. If the correction amount is determined in this way, white balance control can be performed while compensating for deviations in the color component distribution.
[0021]
As a more specific example, it is possible to compensate for a color gamut shift of an imaging device. That is, when the color gamut of the imaging device is considered in the Luv space, the color gamut broadens in the opposite direction in the high-luminance region and the low-luminance region. Therefore, by averaging the color component distribution ratio in the high luminance part and the low luminance part, it is possible to compensate for the color gamut shift along the luminance axis. Also, it is not necessary to average the distribution ratio only once. It is also possible to average the distribution ratio for many areas and adopt the most preferable average value to determine the correction amount for each color component. It is.
[0022]
  Furthermore, as a specific configuration example when averagingClaim 4In the invention according to claim 1, the white balance control means includesThe above histogram is divided into N bandsWhen divided, the distribution ratio of the band i and the distribution ratio of the band N + 1-i are averaged. That is, when the luminance band is divided into N (N is a positive integer) and a band number i (i is a positive integer) is assigned from the smaller luminance gradation value or level, the distribution ratio of the band i and the band If the distribution ratio of N + 1-i is averaged, the two bands at both ends of the luminance band are averaged, and the bands are sequentially averaged so that the second two bands are averaged from both ends of the luminance band. In addition, the color component distribution ratio is averaged at a portion where the color gamut of the image device is shifted to the substantially opposite side with respect to the L axis, and the shift of the color gamut can be compensated.
[0023]
  As described above, if the correction amount of the color component of the entire image is determined using the color component distribution ratio as a coefficient for each color component, white balance control can be performed while compensating for the deviation of the color component distribution. As an example of a configuration suitable for obtaining a preferable color component distribution ratio in controlling white balanceThe present inventionThen, the white balance control means is the distribution ratio.Is an averaged value ofThus, a value close to 1 is obtained as a coefficient for white balance correction.
[0024]
That is, the distribution ratio is a coefficient for adjusting the white balance. However, when a plurality of distribution ratios are calculated by considering the divided bands, the distribution ratio is very far from 1. If a product is used as the above coefficient, when it is multiplied as a coefficient of arbitrary image data, the color balance is changed greatly. Therefore, the possibility of incurring a color feria is very high. Therefore, if the distribution ratio is close to 1 and the correction amount by the coefficient is suppressed, there is almost no color failure.
[0025]
In addition, selecting a distribution ratio close to 1 is equivalent to selecting a small correction amount, but even if the correction amount is small, it functions well as white balance adjustment and is a preferable coefficient. Often. Specifically, if the one closest to 1 is acquired, it is often the most preferable coefficient, but of course, it is not essential to be closest to 1, and may be the second closest, or a predetermined value. Various configurations such as obtaining a value close to 1 within a range not exceeding the threshold value can be employed. Furthermore, even if the distribution ratio is averaged as described above, it is preferable to obtain a distribution ratio close to 1.
[0026]
  further,The present inventionThe white balance control means controls the white balance by multiplying each color component of dot matrix image data forming the image by the coefficient. That is, as described above, the distribution ratio is a coefficient for adjusting the white balance. Therefore, when the image is expressed by dot matrix image data, each color component of the image data is multiplied by the coefficient. White balance can be easily controlled. In addition, the occurrence of color feria can be prevented with a very high probability.
[0027]
  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 implementation example of the idea of the invention, it corresponds to the case of becoming software of a white balance adjustment device.,UpAs a configuration corresponding to each function that allows the white balance adjustment device to be implemented by a computerAlso good. Claims 2 to 4Needless to say, it is also effective as a program corresponding to.
[0028]
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 medium, the present invention is used 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.
[0029]
  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. For this reason,Claim 5The present invention has a configuration corresponding to the white balance adjustment method performed by the white balance adjustment apparatus. That is, it is not necessarily limited to a substantial apparatus, and there is no difference that the method is also effective. Of course, the aboveClaims 2 to 4It is also effective as a method corresponding to. Furthermore, the present invention can be applied to a specific device,Claim 6As described above, the present invention can also be realized as a digital camera equipped with each means capable of performing white balance adjustment.
[0030]
【The invention's effect】
  As explained above,singleA white balance adjustment device, a white balance adjustment program, and a white balance adjustment method capable of preventing color feria without being greatly affected by a color part can be provided.
  Also, SpecialIt is possible to provide a white balance adjustment device, a white balance adjustment program, and a white balance adjustment method capable of preventing color feria without being greatly affected by the presence of a constant color.
[0031]
  further,Claims 1, 5 and 6In the invention according to the present invention, the white balance adjustment device capable of preventing color failure without being greatly affected by a large specific color of the entire image., HoA weight balance adjusting method and a digital camera can be provided.
  further,Claim 2According to the invention, resources can be reduced.
[0032]
  further,Claim 1According to the invention, the luminance component can be easily divided into bands.
  further,Claim 1According to the invention, the white balance can be easily adjusted by comparing the distribution ratios of the respective color components of the image.
  further,Claim 3According to the invention, color component distribution information that can be directly used for white balance adjustment can be acquired.
  further,Claim 1According to the invention, it is possible to adjust the white balance while compensating for the deviation of the color component distribution for the entire luminance range.
[0033]
  further,Claim 4According to the invention, the color gamut shift can be easily compensated.
  further,Claim 1According to the invention, the white balance can be adjusted while the occurrence rate of color feria is very low.
  further,Claim 1According to the invention, white balance can be easily controlled by multiplying coefficients.
[0034]
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:
[0035]
(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.
[0036]
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.
[0037]
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.
[0038]
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.
[0039]
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.
[0040]
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.
[0041]
(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.
[0042]
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.
[0043]
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.
[0044]
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).
[0045]
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
[0046]
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.
[0047]
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.
[0048]
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.
[0049]
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.
[0050]
(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. 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.
[0051]
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.
[0052]
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. The white balance control module 33c, based on the obtained distribution ratio data 34b6, is a coefficient used for white balance adjustment and a correction coefficient R 'for correcting the R component relative to the G component.c, And a correction coefficient B 'for correcting the B component relative to the G componentc(34b7) is obtained. Then, the correction coefficient is converted into a coefficient in a color space with physiological three primary colors and corrected in the color space to correct the correction coefficient Rc, BcAnd a final white balance control matrix 34b9 is calculated based on the correction coefficient.
[0053]
The ROM 33 includes a conversion matrix A (33d1) for converting RGB color components of the sRGB coordinate system into RGB color components of physiological three primary colors based on an adaptation conversion equation such as an equation of Estevez-Hunt-Pointer and the conversion. Inverse transformation matrix A for performing inverse transformation-1(33d2) is recorded and used by the white balance control module 33c. The white balance of the image can be controlled by 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.
[0054]
In this embodiment, the white balance correction coefficient is obtained in two stages. That is, as the first stage, the correction coefficient R ′ is temporarily set.c, B 'cAfter obtaining the correction coefficient R as a second stepc, BcSeeking. 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 etc. can be prevented, but each of the above stages functions as white balance control even if implemented alone, and each stage is added to white balance control of another method to achieve white balance. It is good also as a structure to control. For example, the correction coefficient R ′ calculated in the first stagec, B 'cEven if the configuration is such that the white balance control matrix 34b8 is calculated using the function, it functions as a white balance adjustment device.
[0055]
(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.
[0056]
(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.
[0057]
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. Then, the average of these is calculated as color component data | G | for one pixel.1, | M |1, | Y |1, | C |1And
[0058]
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.
[0059]
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.
[0060]
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.
[0061]
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.
[0062]
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.
[0063]
(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.
[0064]
From this RGB component value, the integral value is calculated by the following equation (1),
[Expression 1]
Figure 0004003037
The distribution ratio is calculated by the following formula (2).
[Expression 2]
Figure 0004003037
Where Rij, Gij, BijIs a gradation value 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.
[0065]
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.
[0066]
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.
[0067]
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.
[0068]
When the distribution ratio data is acquired in step S230, the color component distribution information acquisition module 33b acquires the average value R ′ of the set of distribution ratios according to the following equation (3) in step S235.nc, B 'ncIs calculated.
[Equation 3]
Figure 0004003037
Here, n is a set number of the band and is an integer of “1-5”.
[0069]
FIG. 11 shows the average value R ′ of the setncIt is explanatory drawing explaining a mode that two bands are grouped. 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, the bands at both ends (first and tenth) are combined as shown in FIG. Thus, the second bands (second and ninth) from both ends are sequentially combined to form a pair. B ’ncThe same applies to the combination concept.
[0070]
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 onto 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. In other words, the high luminance region and the low luminance region have opposite properties. 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 remove 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.
[0071]
When the average value of the set of distribution ratios is calculated in step 235, R ′ is determined in step S240.ncIs smaller than “1”, and R ′ is determined in step S240.ncIs determined to be smaller than “1”, R ′ is determined in step S245.ncR 'ncSubstitute the inverse of. The determination processing in steps S240 and S245 is performed for all of the combination numbers 1 to 5 regardless of the determination result in step S240.ncAre also performed independently. Processing here is R 'ncAnd B ’ncIs converted to a number larger than “1” if it is smaller than “1”, the following evaluation function enIs converted to the original value after the evaluation function.
[0072]
(4-3) White balance control processing:
In step S250, the evaluation function enFor each set of R 'ncAnd B ’ncAnd the white balance control module 33c determines that the evaluation function enR 'of the set number n that minimizesncAnd B ’ncAnd the value of the first stage white balance correction coefficient R ′cAnd B ’cDetermine as. 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.
[0073]
Here, the process of selecting the smallest evaluation function is R ′ncAnd B ’ncAre selected with the smallest difference between “1” and “1”, and the process with the smallest correction amount is selected. 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. It can also be said that a region with a small correction amount is selected, and a region with a small bias in color component distribution is selected compared to other regions. In this case, the luminance component acquisition module 33a corresponds to the image dividing means, and the color component distribution information acquisition module 33b selects an area with the smallest evaluation function in a region where the color component distribution is less biased. It corresponds to selecting. Further, the process of selecting the one having the smallest evaluation function is a process of selecting a region in which the R component and the B component are distributed relatively evenly with respect to the G component as compared with other regions. It can also be said.
[0074]
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”. 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.
[0075]
(4-3-1) Correction corresponding to light source type:
As described above, it is possible to perform white balance control with the first-stage white balance correction coefficient. However, in this embodiment, in order to make it look more visually, the processing after step S255 in FIG. 5 is further executed. Yes. In step S255, the first-stage white balance correction coefficient R ′ is expressed by the following equation so that the white balance correction coefficient is based on the G component gradation value “128” (median value).cAnd B ’cConvert.
R = 128 / R ′c, G = 128, B = 128 / B ′c
[0076]
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 0004003037
[0077]
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 physiological three primary color space data R'G'B 'is obtained in step S260, final white balance correction coefficients Rc and Bc are determined in step S265 according to the following equations.
Rc = G ′ / R ′, Bc = G ′ / B ′
[0078]
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. 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.
[0079]
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.
[0080]
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.
[0081]
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. Inverse matrix A from the left of the matrix in which the component of “1” is “1” and the other components are “0”-1Is multiplied by the matrix A from the right to generate a white balance control matrix W (34b9), and the white balance control matrix W is stored in the work area 34b of the RAM 34 in step S275.
[0082]
Inverse transformation matrix A-1Is expressed by the following equation (5).
[Equation 5]
Figure 0004003037
Also in the above formula, italicized characters indicate a matrix.
[0083]
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.
[0084]
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. 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.
[0085]
In FIG. 15, each calculation stage using three matrices is shown below the matrix calculation expression. 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. 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). This adjusted RGB data is converted into an inverse transformation matrix A.-1Is multiplied, the image data after white balance adjustment is converted into sRGB data as shown in (4). Therefore, white balance is adjusted by multiplying the sRGB data by the white balance control matrix W which is one 3 × 3 matrix in the image processing process of the digital still camera.
[0086]
As described above, in the present invention, the luminance component of the image is acquired and divided into bands, and the white balance correction coefficient for adjusting the white balance is calculated based on the color component distribution information of the image within the predetermined band. To do. 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 to calculate an integral value and a distribution ratio.
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]
10. Digital still camera
20 ... Optical part
21 ... Optical lens system
22 ... Autofocus mechanism
23. Ranging section
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
34 ... RAM
34a ... Image area
34b ... Work area
34b1 ... thinned data
34b2 ... RGBYs data
34b3 ... Histogram data
34b4: Band data
34b5 ... RGB integration 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 ... Control panel
36 ... LCD panel
37a ... I / O

Claims (6)

画像の輝度成分を取得し、輝度成分をヒストグラム化するとともに所定の輝度範囲に帯域分割する輝度成分取得手段と、
上記分割した帯域毎に、上記画像の色成分毎の分布比を取得する色成分分布情報取得手段と、
少なくとも2以上の帯域の分布比を平均化するとともに、平均化した値で1に近い値をホワイトバランス補正のための係数とし、当該係数を上記画像の各色成分に乗じることによってホワイトバランスを制御するホワイトバランス制御手段とを具備することを特徴とするホワイトバランス調整装置。
A luminance component acquisition unit that acquires a luminance component of an image, forms a histogram of the luminance component, and divides the band into a predetermined luminance range ;
Color component distribution information acquisition means for acquiring a distribution ratio for each color component of the image for each of the divided bands ;
The distribution ratio of at least two bands is averaged, and the average value close to 1 is set as a coefficient for white balance correction, and the white balance is controlled by multiplying each color component of the image by the coefficient. A white balance adjustment device comprising: a white balance control means.
上記輝度成分取得手段は、ドットマトリクス状の画像データを所定区画に分割するとともに各区画毎の色成分の平均値を上記輝度成分として取得することを特徴とする上記請求項1に記載のホワイトバランス調整装置。2. The white balance according to claim 1 , wherein the luminance component acquisition unit divides dot matrix image data into predetermined sections and acquires an average value of color components for each section as the luminance component. Adjustment device. 上記色成分分布情報取得手段は、上記画像が第1色成分〜第3色成分で表現されるときに、分布比として第1色成分について「1」を取得し、第2色成分について第1色成分の分布と第2色成分の分布との比を取得し、第3色成分について第1色成分の分布と第3色成分の分布との比を取得することを特徴とする上記請求項1または請求項2のいずれかに記載のホワイトバランス調整装置。The color component distribution information acquisition unit acquires “1” for the first color component as the distribution ratio when the image is expressed by the first color component to the third color component, and the first for the second color component. The ratio of the distribution of the color component and the distribution of the second color component is acquired, and the ratio of the distribution of the first color component and the distribution of the third color component is acquired for the third color component. The white balance adjustment apparatus according to claim 1 or 2 . 上記ホワイトバランス制御手段は、上記ヒストグラムをN個の帯域に分割したときに、帯域iの分布比と帯域N+1−iの分布比とを平均化することを特徴とする上記請求項1〜請求項3のいずれかに記載のホワイトバランス調整装置。Said white balance control means, when dividing the histogram into N bands, the claims 1, characterized in that averaging the distribution ratio of the distribution ratio and the band N + 1-i of the band i 4. The white balance adjusting device according to any one of 3 . 画像の輝度成分を取得し、輝度成分をヒストグラム化するとともに所定の輝度範囲に帯域分割する輝度成分取得工程と、
上記分割した帯域毎に、上記画像の色成分毎の分布比を取得する色成分分布情報取得工程と、
少なくとも2以上の帯域の分布比を平均化するとともに、平均化した値で1に近い値をホワイトバランス補正のための係数とし、当該係数を上記画像の各色成分に乗じることによってホワイトバランスを制御するホワイトバランス制御工程とを具備することを特徴とするホワイトバランス調整方法。
A luminance component acquisition step of acquiring a luminance component of an image, forming a histogram of the luminance component and dividing the band into a predetermined luminance range ;
A color component distribution information acquisition step for acquiring a distribution ratio for each color component of the image for each of the divided bands ;
The distribution ratio of at least two bands is averaged, and the average value close to 1 is set as a coefficient for white balance correction, and the white balance is controlled by multiplying each color component of the image by the coefficient. A white balance adjustment method comprising: a white balance control step.
CCD素子にて撮像された画像を所定の要素色の階調値で表現したドットマトリクス状のカラー画像データを取得するカラー画像データ取得手段と、
このカラー画像データを所定区画に分割するとともに各区画毎の色成分の平均値を輝度成分とし、当該輝度成分をヒストグラム化するとともに所定の輝度範囲に帯域をN分割して取得する輝度成分取得手段と、
上記輝度成分の帯域毎に上記カラー画像データの色成分毎の分布比を取得し、帯域iの分布比と帯域N+1−iの分布比とを平均化する色成分分布情報取得手段と、
同平均化された分布比で1に近い値をホワイトバランス補正のための係数として取得し、上記カラー画像データにおいて補正対象となる色成分に上記係数を乗じることによってホワイトバランスを制御することを特徴とするディジタルカメラ。
Color image data acquisition means for acquiring dot matrix-like color image data in which an image captured by a CCD element is expressed by gradation values of predetermined element colors;
Luminance component acquisition means for dividing the color image data into predetermined sections and using the average value of the color components for each section as a luminance component, forming the luminance component into a histogram, and dividing the band into a predetermined luminance range by N. When,
Color component distribution information acquisition means for acquiring a distribution ratio for each color component of the color image data for each band of the luminance component, and averaging the distribution ratio of the band i and the distribution ratio of the band N + 1-i;
A value close to 1 with the averaged distribution ratio is acquired as a coefficient for white balance correction, and the white balance is controlled by multiplying the color component to be corrected in the color image data by the coefficient. A digital camera.
JP2001272282A 2001-09-07 2001-09-07 White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera Expired - Fee Related JP4003037B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001272282A JP4003037B2 (en) 2001-09-07 2001-09-07 White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001272282A JP4003037B2 (en) 2001-09-07 2001-09-07 White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera

Publications (2)

Publication Number Publication Date
JP2003087816A JP2003087816A (en) 2003-03-20
JP4003037B2 true JP4003037B2 (en) 2007-11-07

Family

ID=19097678

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001272282A Expired - Fee Related JP4003037B2 (en) 2001-09-07 2001-09-07 White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera

Country Status (1)

Country Link
JP (1) JP4003037B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4951312B2 (en) * 2006-10-30 2012-06-13 富士フイルム株式会社 Imaging device
CN114390266B (en) * 2021-12-28 2024-05-21 杭州涂鸦信息技术有限公司 Image white balance processing method, device and computer readable storage medium
CN114630095B (en) * 2022-03-15 2024-02-09 锐迪科创微电子(北京)有限公司 Automatic white balance method and device for target scene image and terminal

Also Published As

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

Similar Documents

Publication Publication Date Title
EP0757473B1 (en) Image processing apparatus and method
US8103119B2 (en) Image processing device, image processing method, image processing program product, and image-capturing device
US7999978B2 (en) Matrix coefficient determining method and image input apparatus
US8243164B2 (en) Method, apparatus, and system for selecting pixels for automatic white balance processing
US7362895B2 (en) Image processing apparatus, image-taking system and image processing method
EP1930853A1 (en) Image signal processing apparatus and image signal processing
US20090060326A1 (en) Image processing apparatus and method
JP2008205691A (en) Image processor and image processing method, recording medium, and program
JP2005210526A (en) Image processing apparatus, method, and program, image pickup device, and image data outputting method and program
US6822657B2 (en) Method and apparatus for improving image quality in digital cameras
JP2005210495A (en) Image processing apparatus, method, and program
JP4544308B2 (en) Image processing apparatus, imaging apparatus, method, and program
US20020085750A1 (en) Image processing device
KR20070091208A (en) Automatic white balance control
JP2014033273A (en) Color gamut conversion device, digital camera, color gamut conversion program, and color gamut conversion method
US7184174B2 (en) Color picture signal processing method and color picture using the method
JP2002109523A (en) Image pickup device, optical filter group, and image data converter
JP4003037B2 (en) White balance adjustment device, white balance adjustment program, white balance adjustment method, and digital camera
JPH1141622A (en) Image processor
JP4025962B2 (en) White balance adjustment
JP2002131133A (en) Method for specifying color of image, method for extracting color of image, and image processor
JP2001078235A (en) Method and system for image evaluation
JP2002094826A (en) Image processing unit, image forming unit and method for processing image
JP4168229B2 (en) Edge enhancement processing device
JPH09147098A (en) Method and device for processing color image

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

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070807

R150 Certificate of patent or registration of utility model

Ref document number: 4003037

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20100831

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110831

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120831

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130831

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