JP4052894B2 - Gamma correction method and apparatus for imaging means - Google Patents

Gamma correction method and apparatus for imaging means Download PDF

Info

Publication number
JP4052894B2
JP4052894B2 JP2002226379A JP2002226379A JP4052894B2 JP 4052894 B2 JP4052894 B2 JP 4052894B2 JP 2002226379 A JP2002226379 A JP 2002226379A JP 2002226379 A JP2002226379 A JP 2002226379A JP 4052894 B2 JP4052894 B2 JP 4052894B2
Authority
JP
Japan
Prior art keywords
value
exposure time
pixel
gamma correction
imaging
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
JP2002226379A
Other languages
Japanese (ja)
Other versions
JP2004072262A (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.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
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 Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP2002226379A priority Critical patent/JP4052894B2/en
Publication of JP2004072262A publication Critical patent/JP2004072262A/en
Application granted granted Critical
Publication of JP4052894B2 publication Critical patent/JP4052894B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明が属する技術分野】
本発明は、撮像手段のガンマ補正方法及び装置、特にCCDカメラ等の撮像手段について、ガンマ補正のためのルックアップテーブルを画素を単位に自動的に作成し、該テーブルに基づいて撮像手段を補正する際に適用して好適な、撮像手段のガンマ補正方法及び装置に関する。
【0002】
【従来の技術】
CCD(Charge Coupled Device)カメラ等の撮像手段では、入射した光の強度に応じた大きさの出力(電圧、電流)が発生し、その出力から画像データ(各画素の輝度値)が作成されるようになっている。ところが、必ずしも入射光の強度に比例した出力が得られるとは限らない。特に、画像計測の分野では、CCDカメラ等を使用し、得られる画像データに基づいて測定や検査を行なう場合には、出力が入力に比例している、即ちγ値が1であることが要求される。従って、このような場合には、使用するCCDカメラ等において、γ値が1でない場合には、その補正(ガンマ補正)を行なう必要がある。又、対象によっては、1以外の任意の値への補正が必要になる場合もある。このガンマ補正は、画像処理の際に利用される補正処理の1つであり、補正時に使われる関数(2次関数)が表わす曲線がギリシャ文字のガンマに似ていることから、このように呼ばれている。
【0003】
従来、このようなガンマ補正には、入力画像の輝度値を出力画像の輝度値に変換するための変換テーブルからなるルックアップテーブルを用いて補正する方法がある。そして、このようなガンマ補正に使用するルックアップテーブルを作成する方法として以下の2つが知られている。
【0004】
(1)テストチャートを使用する方法
濃度が段階的に変化しているパターンで構成された校正板(テストチャート)を撮像し、その際に得られる画像データ(輝度値)からルックアップテーブルを作成する。
【0005】
(2)カメラレンズの絞りを利用する方法
絞りの数値が小さくなるほどカメラに入射する光の強度が大きくなるが、小さくする際の数値1目盛毎に光の強度が倍になることを利用する。絞りを1目盛ずつ変えながら、均一な照明光を撮像し、各絞り毎の画像データからルックアップテーブルを作成する。
【0006】
【発明が解決しようとする課題】
しかしながら、前記(1)、(2)の従来のルックアップテーブルの作成方法には、それぞれ以下に説明する(A)〜(D)のような多くの問題がある。
【0007】
(A)1画素単位で補正が出来ない。
【0008】
(1)テストチャートを用いた場合
CCDカメラでは1画素毎に感度の差があるので、画素単位でルックアップテーブルを作り、ガンマ補正する方法が最も高い精度が得られる。しかし、従来はi)画面全体で1個のルックアップテーブルを共用する方法、あるいは、ii)各画素をいくつかの領域に分割し、各領域毎にルックアップテーブルを作成す方法、が用いられているに過ぎず、1画素毎のガンマ補正は行われていない。
【0009】
(2)レンズの絞りを用いた場合
画素単位でルックアップテーブルを作成することは可能ではあるが、一般的には行なわれていない。
【0010】
(B)入力する光に起因して精度が低い。
【0011】
(1)テストチャートを用いた場合
濃度の変化(ステップ)が正確なテストチャートを作ることが難しい。仮にテストチャートの濃度の変化が正確に作られたとしても、チャート全体が一様に照明されていなければ、チャートの濃度通りの光は入力されない。チャート全体を一様に照明することは実際には難しく、一般的には不均一な照明光となる。従って、得られるデータには誤差が含まれることになる。
【0012】
(2)レンズの絞りを用いた場合
理論的には絞りの1目盛で光の強度が倍になるとは言え、実際には正確に倍にならないため、得られたデータには誤差が含まれることになる。
【0013】
(C)作成されるルックアップテーブルにおいては、実際に測定できるデータの間隔が広いために、テーブル内のいくつかのデータには補間による推定値を使用せざるを得ないことから、精度が低い。
【0014】
(1)テストチャートを用いた場合
濃度の変化(ステップ)が少ない場合は、上記のようにルックアップテーブルの途中の値を補間しなければならない。データ8ビットのCCDカメラの場合は、濃度の変化を細かくすることで補間するデータを少なくすることは可能であるが、例えば10ビット以上等のデータビット数が多いカメラでは、補間するデータが多くなる。
【0015】
(2)レンズの絞りを用いた場合
絞り1目盛で光の強度が倍になるだけなので、補間しなければルックアップテーブルを作成できない。特に、明るい側のデータ間隔が暗い側に比べて広くなるために、補間の精度が落ちる。
【0016】
(D)機械の制御等を目的とする画像計測用に、FA(Factory Automation)の生産現場等にカメラを設置する場合には、カメラを取り付けた状態でガンマ補正用のルックアップテーブルを自動的に更新する自動化は難しい。
【0017】
(1)テストチャートを用いた場合
対象物の代わりにテストチャートを自動的に退避・復帰する機構等が別途必要になる。使用していないテストチャートを、汚れるなどしてその機能が損なわれない状態に管理保管しておくための機構あるいは作業が必要になる。実際には、こういった機構を設けること自体が、設置スペースの制限等から困難な場合が多い。
【0018】
(2)レンズの絞りを用いた場合
絞りを自動で変えられるレンズを用いれば自動化できる。しかし、機械的な機構によって絞りを変えているため、耐久性の問題から定期的(頻繁)にガンマ補正を行なうことは難しい。
【0019】
本発明は、前記従来の問題点を解決するべくなされたもので、ガンマ補正用の高精度なルックアップテーブルを、補助的な治具を使用することなく、画素を単位に自動的に作成することができ、結果としてCCDカメラ等の撮像手段を正確にガンマ補正することができる撮像手段のガンマ補正方法及び装置を提供することを課題とする。
【0020】
【課題を解決するための手段】
本発明は、撮像手段が有する撮像部を構成する全画素を所定の順番で個別に選択し、順次選択される画素について、所定の照明下で撮像した際に単位出力が得られるベース露光時間を決定し、選択された画素に対して、決定されたベース露光時間の整数倍を実露光時間に設定し、設定された実露光時間毎に前記照明下で撮像して同画素の各出力値を測定し、各画素毎に、測定された各出力値を、該当する実露光時間の算出に使用された整数値からなる各入力値に対応付けて記録したルックアップテーブルを作成し、作成されたルックアップテーブルに基づいて、前記撮像手段のガンマ補正を画素を単位に行なうことにより、前記課題を解決したものである。
【0021】
本発明は、又、撮像手段が有する撮像部を構成する全画素を所定の順番で個別に選択する選択手段と、順次選択される画素について、所定の照明下で撮像した際に単位出力が得られるベース露光時間を決定する決定手段と、選択された画素に対して、決定されたベース露光時間の整数倍を実露光時間に設定する設定手段と、設定された実露光時間毎に前記照明下で撮像して同画素の各出力値を測定する測定手段と、各画素毎に、測定された各出力値を、該当する実露光時間の算出に使用された整数値からなる各入力値に対応付けて記録したルックアップテーブルを作成する作成手段と、作成されたルックアップテーブルに基づいて、前記撮像手段のガンマ補正を画素を単位に行なう補正手段とを備えたことにより、同様に前記課題を解決したものである。
【0022】
即ち、本発明においては、入力画像の輝度値を、順次選択される画素を単位に、単位出力が得られるベース露光時間の整数倍(実露光時間)で設定するようにしたので、画素毎のルックアップテーブルを自動的に作成することが可能となり、ガンマ補正を画素単位で正確に行なうことが可能となる。
【0023】
【発明の実施の形態】
以下、図面を参照して、本発明の実施の形態について詳細に説明する。
【0024】
図1は、本発明に係る一実施形態の撮像手段のガンマ補正装置が適用されるCCDラインセンサカメラ10の概要を示すブロック図である。
【0025】
このCCDラインセンサカメラ(撮像手段)10は、多数の画素がCCD素子により構成されているイメージセンサ(撮像部)12と、撮像時に該センサ12から出力される電気信号をアナログ/デジタル変換部14を介して入力されるA/D変換値後の信号を記録する測定値記録用RAM15と、該記録用RAM15から読み出された画像信号をガンマ補正するガンマ補正部16と、該補正部16で補正処理する際に参照するルックアップテーブルを格納しておく該テーブル記録用RAM18と、各種演算処理を実行するCPU(中央演算処理装置)20と、該CPU20による処理結果に基づいて、前記イメージセンサ12に対して撮像タイミングを制御するための信号を出力するタイミング発生回路22とを備えている。
【0026】
又、このカメラ10では、前記ガンマ補正部16により補正された画像信号は、RS422規格のシリアルインタフェイス24を介して出力単子からビデオ出力(差動デジタル信号)として出力されるようになっている。又、前記CPU20には、ROM26とRAM28がそれぞれ接続されているとともに、RS232C規格のシリアルインタフェイス30を介して外部端子(I/F)と接続され、各種データの入出力が可能になっている。
【0027】
本実施形態の補正装置は、前記イメージセンサ12を構成する全画素を所定の順番で個別に選択する選択手段と、順次選択される画素について、図示しない所定の照明下で撮像した際に単位出力が得られるベース露光時間を決定する決定手段と、選択された画素に対して、決定されたベース露光時間の整数倍を実露光時間に設定する設定手段と、設定された実露光時間毎に前記照明下で撮像して同画素の出力値を測定する測定手段と、各画素毎に、測定された各出力値を、該当する実露光時間の算出に使用された整数値からなる各入力値に対応付けて記録したルックアップテーブルを作成する作成手段と、作成されたルックアップテーブルに基づいて、前記撮像手段のガンマ補正を画素を単位に行なう前記ガンマ補正部(補正手段)16とを備えている。
【0028】
本実施形態では、前記補正手段16を除き、画像処理を含む演算処理を実行する前記各手段は、前記CPU20においてROM26及びRAM28に格納されているソフトウェア等により実現されている。特に、前記測定手段は、前記測定値記録用RAM15から画素単位で信号を読み込み、その輝度値を認識するCPU20により実現されている。又、γ補正部16は、前記RAM18に記録されているルックアップテーブルと前記RAM15に記録されている画像信号の値から、出力すべき補正後の輝度値を決定して出力するようになっている。但し、この補正手段16も同様に前記CPU20においてソフトウェアにより実現するようにしてもよい。
【0029】
次に、本実施形態の作用を、各画素の輝度データ(階調値)が8ビットで、有効画素数が1024のCCDラインセンサカメラの場合を例に、図2のフローチャートに従って説明する。
【0030】
このフローチャートで使用する各記号の意味は以下のとおりである。
【0031】

Figure 0004052894
【0032】
まず、本実施形態の補正装置の初期化を行なう(ステップ1)。この初期化では、使用するカメラにおいて設定可能な最も短い下限露光時間Sminで撮像した時の画素Pの輝度値:V[P][Smin]≦1となるレベルに照明の明るさを調整する。この照明レベルは予め実験的に決めておく。又、このレベルが予め分っている場合は、ここでの作業はしなくてよい。又、このステップ1の初期化では、ルックアップテーブル記録用RAM18の値をゼロクリアする処理も行なう。この時、0列目の値(補正前の値が0のときに補正後の値として0を出力するためのもの)もゼロクリアされる。
【0033】
上記ステップ1で使用する照明強度の設定が終了した後、画素の通し番号Pを1に設定する(ステップ2)。ここでは、次のステップ3と後述するステップ17とで示されるように、1番目の画素から1024番目の画素まで、順番に選択してガンマ補正用のルックアップテーブルを作成していくことにする。但し、最終的に全画素について作成されるようにできれば選択する順番は任意でよい。
【0034】
次いで、1番目の画素について、ベース露光時間を求めるために、最初の実露光時間Sを設定する。この実露光時間Sとしては、前述した下限露光時間Sminを設定する(ステップ4)。但し、出力値(輝度値)が階調値で1(単位出力)となる場合の露光時間が予め想定できる場合は、その値より若干小さい値を設定するようにしてもよい。このようにすることにより、処理時間を短縮することができる。
【0035】
次いで、上記ステップ4で設定された下限の実露光時間Sで撮像する画像入力を行い(ステップ5)、入力されたP(=1)番目の画素の輝度値(出力)が1か否かを判定し(ステップ6)、該P番目の画素の輝度値が1に達していない場合は、実露光時間Sを変更可能な最も小さな値である最小増加量ΔSだけ長くし(ステップ7)、再びステップ5の画像入力を行なう。
【0036】
上記ステップ6において、P番目の画素の輝度値が1となったときの実露光時間Sを、該画素Pのベース露光時間S[P]として記録(設定)すると共に、入力値H=1のときの該P番目の画素に関するガンマ補正用ルックアップテーブルの出力値L[P][1]に、単位出力値1を設定する(ステップ8、9)。但し、全ての画素において初期出力値L[P][1]の値は1に決まっているので、ステップ1の初期化で一括して設定しておくようにしても、あるいは特にデータとしてもたなくてもよい。
【0037】
初期入力値H=1に対する単位出力値設定の処理が終了した後、ルックアップテーブル作成の対象とする入力値Hに次の入力値2を設定し(ステップ10)、次のステップ11でルックアップテーブルの入力値の全について測定したか否かの判定を行う。この例では、8ビットカメラなので、入力値の最大は255(=28-1)となる。
【0038】
この段階では、当然入力値Pが255以下であるため、ステップ11でYesの方向へ進み、そのときの入力値H=2に相当する実露光時間Sにベース露光時間S[P]のH倍を設定し(ステップ12)、該実露光時間Sで実際に撮像して画像入力を行い(ステップ13)、そのときの輝度値V[P][S]を測定し、測定された該輝度値(階調値)をP番目の画素のガンマ補正用ルックアップテーブルの出力値L[P][V[P][S]]に設定し、画素Pに関する入力値Hに対応する出力値L[P][V[P][S]]としてメモリ(RAM)に保存する(ステップ14)。その後、この入力値Hのときの実測輝度値V[P][S]が255に達していないときには、入力値Hを1増加し(ステップ15、16)、ガンマ補正用のルックアップテーブル作成の対象とする入力値を、未だ出力測定していない次の入力値に変更し、以上のステップ11〜16までの各処理を最後の入力値H=255まで繰り返す。
【0039】
1番目のP=1の画素について、全ての入力値Hに対する出力輝度値の測定が終了したら(ステップ11でNo)、又は実測輝度値V[P][S]が255に達したら(ステップ15でNo)、画素番号Pを1増加させ、ガンマ補正用のルックアップテーブル作成の対象とする画素を、未だ測定していない次の画素に変更し(ステップ17)、該画素について前記ステップ4〜16の各処理を行なうと共に、前記ステップ3により対象とする画素が無くなるまで各処理を繰り返す。全ての画素について上記各処理が終了した後(ステップ3でNo)、テーブル補間処理を行ない(ステップ18)、ルックアップテーブルの作成を終了する。
【0040】
この最後のステップ18で行なうテーブル補間処理では、前記ステップ14に従って補正後の輝度値Lを記録していくと、ルックアップテーブルに値が確定しない箇所(初期値0のまま)が生じている場合があるので、該テーブル全体を走査L、未確定の値を補間して決定する。
【0041】
これを、ルックアップテーブル記録用RAM18におけるn行(n画素、フローチャートではP画素)目のテーブルを具体例として説明する。前記ステップ9により初期入力値H=1に対して単位出力値=1が設定された状態は、図3(A)のように表わすことができる。次いで、前記ステップ14により、入力値H=2に対して出力値2が得られたとすると、同図(B)に示すようになるが、同じくステップ14により、次の入力値H=3、H=4に対しては出力値が、それぞれ4、7であったとすると、同図(C)、(D)に示すように、値が初期値0のままの確定しない箇所(列)が生じることになる。
【0042】
このような値が未確定の列が生じている場合には、図4にm列目がWに、(m+k)列目がZ(Z−W=1)にそれぞれ確定している場合の補間方法のイメージを示すように、テーブル上で最も近い位置にある確定値を使って補間する。この補間方法を、前記図3(D)に適用すれば、図5に示すようになる。
【0043】
又、H=256になり、前記ステップ11の判定処理を抜けた状態で255列までテーブルの値が確定していない場合には、図6に示すように、残りは全て255に設定するテーブル補間処理(終端処理)を行なう。
【0044】
本実施形態においては、図7にCCDラインセンサカメラのイメージセンサ12が有する各画素に対応させて、測定値記録用RAM15及びルックアップテーブル記録用RAM18にそれぞれ保存されるデータのイメージを示すように、以上詳述した処理により、実測値に基づく出力値が記録されたルックアップテーブルを作成することができる。
【0045】
ここで使用しているルックアップテーブル記録用RAMには、カメラとして1024画素、8ビット(0〜255階調)のCCDラインセンサカメラを使用しているため、262144[バイト](1024[画素]×256[階調(入力)]×8[ビット(出力)]=1024[行]×256[列]×1[バイト])の容量が必要になる。
【0046】
このルックアップテーブルでは、前記フローチャートに従って作成された実測データに基づいて画素単位でガンマ補正することにより、行番号がCCDの画素の通し番号Pに、列番号がルックアップテーブルの入力値Hに対応し、各行・各列により規定される升目に対応する番地のRAMには実測値に基づく補正後の出力値Lが記録されている。つまり、記録用RAMで「P行H列に値Lが記録されている」場合の補正は、「P番目の画素が入力した輝度値がH階調の場合には、P番目の画素の補正後の出力値をL階調とする」ということを意味する。
【0047】
図8には、1画素についての補正前と補正後の入力値と出力値の関係を示す。補正前の出力値は、前記フローチャートに従って実測された輝度値である。同図(A)、(B)には任意のγ値で実測された輝度値をγ=1に補正する場合のイメージを、同図(C)、(D)は逆の場合のイメージをそれぞれ示している。
【0048】
一般に、スキャナやカラープリンタなどの、画像データの入出力機器は、それぞれ固有のガンマ値をもっている。画像を忠実に再現するためには、画像入力から最終出力までの全体のガンマが1になるようにする必要がある。入出力機器間で画像データを処理するさいにガンマ補正を施すと、ガンマ値は各ガンマ変換の値の積になる。たとえばスキャナのガンマ=0.56で、ディスプレイのガンマ=1.8なら、全体のガンマは0.56×1.8となってほぼ1になる。
【0049】
本実施形態によれば、図4(C)、(D)に示すように1以外の任意のガンマ値に補正できることから、このような入出力機器間のガンマ補正を行なうこともできる。
【0050】
ここに、補正する際の具体的な操作を簡単に説明する。前記測定値記録用RAM15には(A/D変換された)センサからの信号がガンマ補正される前の輝度値として記録されている。又、ルックアップテーブルには、測定値記録用RAM15に記録されている画素Pの輝度値V[P][S]に対応する補正後の輝度値L[P][V[P][S]]が記録されている。
【0051】
具体例ではγ=1となる補正後の輝度値L’を得るには、まずγ=1となる補正後の輝度値Lを求め、次に下記ガンマ補正の式
L’=255×(L/255)1/γ
に従ってLからL’を計算し、Lを書き換える。ルックアップテーブルの全ての値についてこのL’を求める。この任意のγ値への変換作業は、前記フローチャートには省略されているが、CPU20によって前記ステップ18の「テーブル補間処理」を終了した後に行う。
【0052】
以上詳述した本実施形態によれば、CCDカメラ等のガンマ補正用ルックアップテーブルを、従来の方法より正確に作成することができると共に、画素を単位として、例えばグレースケール等の補正のための補助的な治具を使用することなく、自動的に(定期的に)作成することができることから、該ルックアップテ−ブルを用いることにより、画素単位で高精度なガンマ補正を行なうことができる。
【0053】
以上、本発明について具体的に説明したが、本発明は、前記実施形態に示したものに限られるものでなく、その要旨を逸脱しない範囲で種々変更可能である。
【0054】
例えば、本発明に係る補正装置の具体的な構成は前記実施形態に示したものに限定されない。
【0055】
又、前記実施形態では、撮像手段がCCDカメラである場合を示したが、これに限定されず、CMOS(Complementary Metal Oxide Semiconductor)等であってもよい。
【0056】
又、ベース露光時間を決定する単位出力は、階調値ではなく、所定の電流値や電圧値であってもよい。
【0057】
又、入力値Hの設定は必ずしも全階調値について行わなくてもよく、例えば1つ置きや2つ置き等であってもよい。
【0058】
【発明の効果】
以上説明したとおり、本発明によれば、CCDカメラ等の撮像手段のガンマ補正に使用する高精度なルックアップテーブルを、補助的な治具を使用することなく、画素を単位として自動的に作成することができ、結果として撮像手段を正確にガンマ補正することができる。
【図面の簡単な説明】
【図1】本発明に係る一実施形態の補正装置の概要を示すブロック図
【図2】ガンマ補正用のルックアップテーブルの作成手順を示すフローチャート
【図3】ルックアップテーブルに未確定値が生じる理由を示す説明図
【図4】ルックアップテーブルの未確定値の補間方法を示す説明図
【図5】ルックアップテーブルの未確定値を補間した結果を示す説明図
【図6】ルックアップテーブルの終端未確定値の補間方法を示す説明図
【図7】作成されるルックアップテーブルの全体のイメージを示す説明図
【図8】ガンマ補正前と後の入力と出力の関係を説明するための線図
【符号の説明】
10…CCDラインセンサカメラ[0001]
[Technical field to which the invention belongs]
The present invention automatically creates a lookup table for gamma correction in units of pixels for a gamma correction method and apparatus for an imaging means, particularly an imaging means such as a CCD camera, and corrects the imaging means based on the table. The present invention relates to a gamma correction method and apparatus for imaging means, which is suitable for application.
[0002]
[Prior art]
An imaging unit such as a CCD (Charge Coupled Device) camera generates an output (voltage, current) having a magnitude corresponding to the intensity of incident light, and generates image data (luminance value of each pixel) from the output. It is like that. However, an output proportional to the intensity of incident light is not always obtained. In particular, in the field of image measurement, when a CCD camera or the like is used and measurement or inspection is performed based on the obtained image data, the output is proportional to the input, that is, the γ value is required to be 1. Is done. Therefore, in such a case, if the γ value is not 1 in the CCD camera or the like to be used, it is necessary to perform correction (gamma correction). Also, depending on the target, correction to an arbitrary value other than 1 may be required. This gamma correction is one of the correction processes used at the time of image processing, and is called in this way because the curve represented by the function (secondary function) used at the time of correction is similar to Greek gamma. It is.
[0003]
Conventionally, such gamma correction includes a correction method using a lookup table including a conversion table for converting the luminance value of the input image into the luminance value of the output image. The following two methods are known as methods for creating a lookup table used for such gamma correction.
[0004]
(1) Method using a test chart Image a calibration plate (test chart) composed of a pattern whose density changes stepwise, and create a lookup table from the image data (luminance values) obtained at that time To do.
[0005]
(2) Method of using the aperture of the camera lens The smaller the aperture value, the greater the intensity of the light incident on the camera. While changing the aperture one by one, uniform illumination light is imaged, and a lookup table is created from the image data for each aperture.
[0006]
[Problems to be solved by the invention]
However, the conventional lookup table creation methods (1) and (2) have many problems such as (A) to (D) described below.
[0007]
(A) Correction cannot be performed in units of one pixel.
[0008]
(1) When a test chart is used Since there is a difference in sensitivity for each pixel in a CCD camera, a method of creating a look-up table for each pixel and performing gamma correction provides the highest accuracy. However, conventionally, i) a method of sharing one lookup table for the entire screen, or ii) a method of dividing each pixel into several regions and creating a lookup table for each region is used. However, gamma correction for each pixel is not performed.
[0009]
(2) When a lens diaphragm is used, it is possible to create a lookup table for each pixel, but this is not generally performed.
[0010]
(B) The accuracy is low due to the input light.
[0011]
(1) When using a test chart It is difficult to produce a test chart in which the density change (step) is accurate. Even if the change in the density of the test chart is made accurately, light according to the density of the chart is not inputted unless the entire chart is illuminated uniformly. It is actually difficult to illuminate the entire chart uniformly, and generally the illumination light is uneven. Therefore, the obtained data includes an error.
[0012]
(2) When a lens diaphragm is used Theoretically, although the intensity of light doubles at one scale of the diaphragm, it does not actually double exactly, so the obtained data contains errors. become.
[0013]
(C) In the created look-up table, since the interval of data that can be actually measured is wide, it is necessary to use estimated values by interpolation for some data in the table, so the accuracy is low. .
[0014]
(1) When using a test chart When there are few changes (steps) in density, it is necessary to interpolate intermediate values in the lookup table as described above. In the case of an 8-bit data CCD camera, it is possible to reduce the amount of data to be interpolated by making the change in density fine. However, in a camera with a large number of data bits, such as 10 bits or more, there are many data to be interpolated. Become.
[0015]
(2) When a lens diaphragm is used Since the light intensity is only doubled at one scale of the diaphragm, a lookup table cannot be created without interpolation. In particular, since the data interval on the bright side is wider than that on the dark side, the accuracy of interpolation decreases.
[0016]
(D) When installing a camera at the FA (Factory Automation) production site, etc. for image measurement for machine control, etc., a look-up table for gamma correction is automatically installed with the camera attached. Automation to update to is difficult.
[0017]
(1) When a test chart is used A mechanism for automatically retracting / returning the test chart instead of the object is required. A mechanism or operation is required to manage and store the test charts that are not being used in a state where the function of the test charts is not impaired due to contamination. In practice, it is often difficult to provide such a mechanism because of limitations on installation space.
[0018]
(2) In the case of using a lens diaphragm It can be automated by using a lens that can automatically change the diaphragm. However, since the aperture is changed by a mechanical mechanism, it is difficult to perform gamma correction periodically (frequently) due to durability.
[0019]
The present invention has been made to solve the above-described conventional problems, and automatically creates a high-precision look-up table for gamma correction in units of pixels without using an auxiliary jig. As a result, it is an object of the present invention to provide a gamma correction method and apparatus for an imaging means capable of accurately performing gamma correction on an imaging means such as a CCD camera.
[0020]
[Means for Solving the Problems]
According to the present invention, all the pixels constituting the imaging unit included in the imaging unit are individually selected in a predetermined order, and the base exposure time at which a unit output is obtained when the sequentially selected pixels are imaged under predetermined illumination. For the selected pixel, an integer multiple of the determined base exposure time is set as the actual exposure time, and images are taken under the illumination for each set actual exposure time, and each output value of the same pixel is set. Created a lookup table that was measured and recorded for each pixel in which each measured output value was recorded in association with each input value consisting of an integer value used to calculate the corresponding actual exposure time. The above-mentioned problem is solved by performing gamma correction of the image pickup means on a pixel basis based on a lookup table.
[0021]
The present invention also provides a selection unit that individually selects all the pixels constituting the imaging unit included in the imaging unit in a predetermined order, and obtains a unit output when the sequentially selected pixels are imaged under a predetermined illumination. Determining means for determining a base exposure time to be set, setting means for setting an integral multiple of the determined base exposure time for the selected pixel as the actual exposure time, and for each selected actual exposure time under the illumination Measurement means for imaging and measuring each output value of the same pixel, and each measured output value for each pixel corresponds to each input value consisting of an integer value used to calculate the corresponding actual exposure time In addition, the above-mentioned problem is similarly achieved by providing a creation unit for creating a lookup table recorded with the addition, and a correction unit for performing gamma correction of the imaging unit on a pixel basis based on the created lookup table. Settled Than is.
[0022]
That is, in the present invention, the luminance value of the input image is set by an integral multiple of the base exposure time (actual exposure time) at which the unit output is obtained in units of sequentially selected pixels. A lookup table can be automatically created, and gamma correction can be accurately performed on a pixel-by-pixel basis.
[0023]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0024]
FIG. 1 is a block diagram showing an outline of a CCD line sensor camera 10 to which a gamma correction device for imaging means according to an embodiment of the present invention is applied.
[0025]
The CCD line sensor camera (imaging means) 10 includes an image sensor (imaging unit) 12 in which a large number of pixels are constituted by CCD elements, and an analog / digital converter 14 that converts an electrical signal output from the sensor 12 during imaging. A measurement value recording RAM 15 for recording the signal after the A / D conversion value input via the gamma, a gamma correction unit 16 for gamma correcting the image signal read from the recording RAM 15, and the correction unit 16. Based on the table recording RAM 18 for storing a look-up table to be referred to when the correction processing is performed, a CPU (Central Processing Unit) 20 for executing various arithmetic processing, and the processing result by the CPU 20, the image sensor is used. 12 includes a timing generation circuit 22 that outputs a signal for controlling the imaging timing.
[0026]
In the camera 10, the image signal corrected by the gamma correction unit 16 is output as a video output (differential digital signal) from the output unit via the RS422 standard serial interface 24. Yes. The CPU 20 is connected to a ROM 26 and a RAM 28, and is connected to an external terminal (I / F) via a serial interface 30 of the RS232C standard so that various data can be input and output. .
[0027]
The correction apparatus according to the present embodiment includes a selection unit that individually selects all pixels constituting the image sensor 12 in a predetermined order, and a unit output when the sequentially selected pixels are imaged under a predetermined illumination (not shown). Determining means for determining the base exposure time to obtain, a setting means for setting an integral multiple of the determined base exposure time for the selected pixel as the actual exposure time, and for each set actual exposure time Measuring means for imaging under illumination and measuring the output value of the same pixel, and for each pixel, the measured output value is converted into an input value consisting of an integer value used for calculating the corresponding actual exposure time. A creation unit that creates a lookup table that is recorded in association with each other, and a gamma correction unit (correction unit) 16 that performs gamma correction of the imaging unit in units of pixels based on the created lookup table. Eteiru.
[0028]
In the present embodiment, except for the correction means 16, the respective means for executing arithmetic processing including image processing are realized by software stored in the ROM 26 and RAM 28 in the CPU 20. In particular, the measurement means is realized by the CPU 20 which reads a signal in pixel units from the measurement value recording RAM 15 and recognizes the luminance value. The γ correction unit 16 determines and outputs a corrected luminance value to be output from the look-up table recorded in the RAM 18 and the value of the image signal recorded in the RAM 15. Yes. However, the correcting means 16 may be realized by software in the CPU 20 as well.
[0029]
Next, the operation of this embodiment will be described with reference to the flowchart of FIG. 2, taking as an example the case of a CCD line sensor camera in which the luminance data (gradation value) of each pixel is 8 bits and the number of effective pixels is 1024.
[0030]
The meaning of each symbol used in this flowchart is as follows.
[0031]
Figure 0004052894
[0032]
First, the correction apparatus of the present embodiment is initialized (step 1). In this initialization, the brightness of the illumination is adjusted to a level satisfying the luminance value of the pixel P: V [P] [Smin] ≦ 1 when imaging is performed with the shortest lower limit exposure time Smin that can be set in the camera to be used. This illumination level is determined experimentally in advance. If this level is known in advance, it is not necessary to perform this work. In the initialization in step 1, the process of clearing the value of the lookup table recording RAM 18 to zero is also performed. At this time, the value in the 0th column (for outputting 0 as a value after correction when the value before correction is 0) is also cleared to zero.
[0033]
After the setting of the illumination intensity used in step 1 is completed, the pixel serial number P is set to 1 (step 2). Here, as shown in the next step 3 and step 17 to be described later, a lookup table for gamma correction is created by selecting in order from the first pixel to the 1024th pixel. . However, the order of selection may be arbitrary as long as all pixels are finally created.
[0034]
Next, in order to obtain the base exposure time for the first pixel, the first actual exposure time S is set. As the actual exposure time S, the above-described lower limit exposure time Smin is set (step 4). However, if the exposure time when the output value (luminance value) is 1 (unit output) as the gradation value can be estimated in advance, a value slightly smaller than that value may be set. By doing in this way, processing time can be shortened.
[0035]
Next, image input for imaging with the lower limit actual exposure time S set in step 4 is performed (step 5), and whether or not the luminance value (output) of the input P (= 1) th pixel is 1 is determined. If the brightness value of the P-th pixel does not reach 1 (step 6), the actual exposure time S is lengthened by the minimum value ΔS that is the smallest value that can be changed (step 7), and again. The image input of step 5 is performed.
[0036]
In step 6, the actual exposure time S when the luminance value of the Pth pixel becomes 1 is recorded (set) as the base exposure time S [P] of the pixel P, and the input value H = 1. The unit output value 1 is set to the output value L [P] [1] of the gamma correction lookup table for the P-th pixel at that time (steps 8 and 9). However, since the value of the initial output value L [P] [1] is determined to be 1 for all the pixels, it may be set all at the time of initialization in step 1 or may be data. It does not have to be.
[0037]
After the unit output value setting process for the initial input value H = 1 is completed, the next input value 2 is set to the input value H that is the target of the lookup table creation (step 10). It is determined whether or not all the input values in the table have been measured. In this example, since the camera is an 8-bit camera, the maximum input value is 255 (= 2 8 −1).
[0038]
At this stage, since the input value P is naturally 255 or less, the process proceeds in the direction of Yes in step 11, and the actual exposure time S corresponding to the input value H = 2 at that time is H times the base exposure time S [P]. (Step 12), the image is actually captured with the actual exposure time S and image input is performed (step 13), the brightness value V [P] [S] at that time is measured, and the measured brightness value The (gradation value) is set to the output value L [P] [V [P] [S]] of the P-th pixel gamma correction lookup table, and the output value L [ P] [V [P] [S]] is stored in the memory (RAM) (step 14). Thereafter, when the actually measured luminance value V [P] [S] at this input value H does not reach 255, the input value H is incremented by 1 (steps 15 and 16), and a lookup table for gamma correction is created. The target input value is changed to the next input value that has not yet been measured for output, and the above-described steps 11 to 16 are repeated until the final input value H = 255.
[0039]
When the measurement of the output luminance values for all the input values H is completed for the first pixel of P = 1 (No in step 11), or when the actually measured luminance value V [P] [S] reaches 255 (step 15). No), the pixel number P is incremented by 1, and the pixel for which the gamma correction lookup table is created is changed to the next pixel that has not yet been measured (step 17). Each of the 16 processes is performed, and each process is repeated until there is no target pixel in step 3. After each of the above processes is completed for all pixels (No in step 3), table interpolation processing is performed (step 18), and the creation of the lookup table is completed.
[0040]
In the table interpolation processing performed in the final step 18, when the corrected luminance value L is recorded in accordance with the step 14, a portion where the value is not fixed (the initial value is 0) occurs in the lookup table. Therefore, the entire table is determined by scanning L and interpolating uncertain values.
[0041]
This will be described using a table of the nth row (n pixels, P pixels in the flowchart) in the lookup table recording RAM 18 as a specific example. The state where the unit output value = 1 is set with respect to the initial input value H = 1 in the step 9 can be expressed as shown in FIG. Next, assuming that the output value 2 is obtained with respect to the input value H = 2 by the step 14, as shown in FIG. 5B, the next input value H = 3, H = 4, if the output values are 4 and 7, respectively, as shown in (C) and (D) of the figure, there are places (columns) where the value remains at the initial value 0 and are not fixed. become.
[0042]
When such an undefined column is generated, interpolation is performed when the m-th column is determined as W and the (m + k) -th column is determined as Z (Z-W = 1) in FIG. As shown in the image of the method, interpolation is performed using the fixed value at the closest position on the table. If this interpolation method is applied to FIG. 3D, the result is as shown in FIG.
[0043]
Further, if H = 256 and the table values up to 255 columns have not been determined after the determination process of step 11 has been completed, all the remaining table interpolations are set to 255 as shown in FIG. Processing (terminal processing) is performed.
[0044]
In the present embodiment, FIG. 7 shows images of data stored in the measurement value recording RAM 15 and the look-up table recording RAM 18 in correspondence with the respective pixels of the image sensor 12 of the CCD line sensor camera. By the process described in detail above, a lookup table in which output values based on actual measurement values are recorded can be created.
[0045]
The lookup table recording RAM used here uses a CCD line sensor camera of 1024 pixels and 8 bits (0 to 255 gradations) as the camera, and therefore 262144 [bytes] (1024 [pixels]). × 256 [gradation (input)] × 8 [bit (output)] = 1024 [row] × 256 [column] × 1 [byte]) is required.
[0046]
In this lookup table, the row number corresponds to the serial number P of the CCD pixel and the column number corresponds to the input value H of the lookup table by performing gamma correction on a pixel basis based on the actual measurement data created according to the flowchart. The output value L after correction based on the actual measurement value is recorded in the RAM at the address corresponding to the cell defined by each row / column. That is, the correction when “value L is recorded in P rows and H columns” in the recording RAM is “correction of the Pth pixel when the luminance value input by the Pth pixel is H gradation”. This means that the subsequent output value is L gradation.
[0047]
FIG. 8 shows the relationship between input values and output values before and after correction for one pixel. The output value before correction is a luminance value measured according to the flowchart. FIGS. 7A and 7B show images when the luminance value actually measured with an arbitrary γ value is corrected to γ = 1, and FIGS. 8C and 9D show images in the opposite case. Show.
[0048]
Generally, image data input / output devices such as scanners and color printers each have a unique gamma value. In order to faithfully reproduce an image, it is necessary to set the total gamma from the image input to the final output to be 1. When gamma correction is performed when processing image data between input / output devices, the gamma value is the product of the values of each gamma conversion. For example, if the gamma of the scanner is 0.56 and the gamma of the display is 1.8, the total gamma is 0.56 × 1.8, which is almost 1.
[0049]
According to the present embodiment, as shown in FIGS. 4C and 4D, correction can be made to an arbitrary gamma value other than 1, so that such gamma correction between input / output devices can also be performed.
[0050]
Here, a specific operation for correction will be briefly described. In the measurement value recording RAM 15, a signal from the sensor (A / D converted) is recorded as a luminance value before gamma correction. In the lookup table, the corrected luminance value L [P] [V [P] [S] corresponding to the luminance value V [P] [S] of the pixel P recorded in the measurement value recording RAM 15 is displayed. ] Is recorded.
[0051]
In a specific example, in order to obtain a corrected luminance value L ′ where γ = 1, first, a corrected luminance value L where γ = 1 is obtained, and then the following gamma correction formula L ′ = 255 × (L / 255) 1 / γ
To calculate L ′ from L and rewrite L. This L ′ is obtained for all values in the lookup table. This conversion to an arbitrary γ value is omitted in the flowchart, but is performed after the “table interpolation process” in step 18 is completed by the CPU 20.
[0052]
According to this embodiment described above in detail, a lookup table for gamma correction such as a CCD camera can be created more accurately than the conventional method, and for correction of gray scale, for example, in units of pixels. Since it can be created automatically (periodically) without using an auxiliary jig, high-precision gamma correction can be performed on a pixel-by-pixel basis by using the lookup table. .
[0053]
Although the present invention has been specifically described above, the present invention is not limited to that shown in the above embodiment, and various modifications can be made without departing from the scope of the invention.
[0054]
For example, the specific configuration of the correction apparatus according to the present invention is not limited to that shown in the above embodiment.
[0055]
In the above-described embodiment, the imaging unit is a CCD camera. However, the imaging unit is not limited to this and may be a CMOS (Complementary Metal Oxide Semiconductor) or the like.
[0056]
Further, the unit output for determining the base exposure time may be a predetermined current value or voltage value instead of the gradation value.
[0057]
Further, the input value H does not necessarily have to be set for all gradation values, and may be, for example, every other one or every two.
[0058]
【The invention's effect】
As described above, according to the present invention, a high-precision look-up table used for gamma correction of an imaging means such as a CCD camera is automatically created in units of pixels without using an auxiliary jig. As a result, the imaging means can be accurately gamma corrected.
[Brief description of the drawings]
FIG. 1 is a block diagram showing an outline of a correction apparatus according to an embodiment of the present invention. FIG. 2 is a flowchart showing a procedure for creating a lookup table for gamma correction. FIG. FIG. 4 is an explanatory diagram showing a method for interpolating uncertain values in a lookup table. FIG. 5 is an explanatory diagram showing a result of interpolating uncertain values in a lookup table. FIG. FIG. 7 is an explanatory diagram showing an overall image of a lookup table to be created. FIG. 8 is a line for explaining the relationship between input and output before and after gamma correction. Figure [Explanation of symbols]
10 ... CCD line sensor camera

Claims (4)

撮像手段が有する撮像部を構成する全画素を所定の順番で個別に選択し、順次選択される画素について、所定の照明下で撮像した際に単位出力が得られるベース露光時間を決定し、
選択された画素に対して、決定されたベース露光時間の整数倍を実露光時間に設定し、設定された実露光時間毎に前記照明下で撮像して同画素の各出力値を測定し、
各画素毎に、測定された各出力値を、該当する実露光時間の算出に使用された整数値からなる各入力値に対応付けて記録したルックアップテーブルを作成し、
作成されたルックアップテーブルに基づいて、前記撮像手段のガンマ補正を画素を単位に行なうことを特徴とする撮像手段のガンマ補正方法。
Select all the pixels constituting the imaging unit of the imaging means individually in a predetermined order, determine the base exposure time for obtaining unit output when imaging under predetermined illumination for the sequentially selected pixels,
For the selected pixel, an integer multiple of the determined base exposure time is set as the actual exposure time, and each output value of the pixel is measured by imaging under the illumination for each set actual exposure time,
For each pixel, create a lookup table in which each measured output value is recorded in association with each input value consisting of an integer value used to calculate the corresponding actual exposure time,
A gamma correction method for an image pickup means, wherein gamma correction of the image pickup means is performed in units of pixels based on a created lookup table.
前記単位出力が、設定可能な単位階調値であることを特徴とする請求項1に記載の撮像手段のガンマ補正方法。2. The gamma correction method for an imaging unit according to claim 1, wherein the unit output is a settable unit gradation value. 撮像手段が有する撮像部を構成する全画素を所定の順番で個別に選択する選択手段と、
順次選択される画素について、所定の照明下で撮像した際に単位出力が得られるベース露光時間を決定する決定手段と、
選択された画素に対して、決定されたベース露光時間の整数倍を実露光時間に設定する設定手段と、
設定された実露光時間毎に前記照明下で撮像して同画素の各出力値を測定する測定手段と、
各画素毎に、測定された各出力値を、該当する実露光時間の算出に使用された整数値からなる各入力値に対応付けて記録したルックアップテーブルを作成する作成手段と、
作成されたルックアップテーブルに基づいて、前記撮像手段のガンマ補正を画素を単位に行なう補正手段とを備えたことを特徴とする撮像手段のガンマ補正装置。
A selection means for individually selecting all the pixels constituting the imaging unit included in the imaging means in a predetermined order;
Determining means for determining a base exposure time at which a unit output is obtained when images are picked up under predetermined illumination for sequentially selected pixels;
Setting means for setting an integral multiple of the determined base exposure time to the actual exposure time for the selected pixel;
Measuring means for imaging under the illumination for each set actual exposure time and measuring each output value of the same pixel;
Creating means for creating a lookup table in which each output value measured for each pixel is recorded in association with each input value consisting of an integer value used for calculating the corresponding actual exposure time;
A gamma correction apparatus for imaging means, comprising: correction means for performing gamma correction of the imaging means for each pixel based on the created lookup table.
前記単位出力が、設定可能な単位階調値であることを特徴とする請求項3に記載の撮像手段のガンマ補正装置。4. The gamma correction apparatus for an image pickup unit according to claim 3, wherein the unit output is a settable unit gradation value.
JP2002226379A 2002-08-02 2002-08-02 Gamma correction method and apparatus for imaging means Expired - Fee Related JP4052894B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002226379A JP4052894B2 (en) 2002-08-02 2002-08-02 Gamma correction method and apparatus for imaging means

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002226379A JP4052894B2 (en) 2002-08-02 2002-08-02 Gamma correction method and apparatus for imaging means

Publications (2)

Publication Number Publication Date
JP2004072262A JP2004072262A (en) 2004-03-04
JP4052894B2 true JP4052894B2 (en) 2008-02-27

Family

ID=32013741

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002226379A Expired - Fee Related JP4052894B2 (en) 2002-08-02 2002-08-02 Gamma correction method and apparatus for imaging means

Country Status (1)

Country Link
JP (1) JP4052894B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100411424C (en) * 2005-04-18 2008-08-13 凌阳科技股份有限公司 Gama correcting method and system
KR101313637B1 (en) 2006-06-09 2013-10-02 서강대학교산학협력단 Image processing apparatus and method for contrast enhancement
JP6025392B2 (en) * 2011-06-22 2016-11-16 株式会社日立国際電気 Television camera device

Also Published As

Publication number Publication date
JP2004072262A (en) 2004-03-04

Similar Documents

Publication Publication Date Title
JP4062031B2 (en) Gamma correction method, gamma correction apparatus and image reading system
JP4384092B2 (en) Method and apparatus for correcting pixel value in image sensor capable of addressing in line and column
JPH0879520A (en) Calibrating method for image scanner signal processing circuit
JP2005341612A5 (en)
JP2012070089A (en) Image reader
JP2012075071A (en) Signal processing apparatus, image processing apparatus, and image capturing apparatus
KR100484163B1 (en) Method and apparatus for improvement of digital image quality
JP4052894B2 (en) Gamma correction method and apparatus for imaging means
JP3552996B2 (en) Gamma correction device
JPH117524A (en) Image reader
JP2942072B2 (en) How to create a gamma correction table
JPH11298794A (en) Electronic image-pickup device
KR20070012129A (en) Method and apparatus for adjusting defect pixel in image sensor
JP2007049533A (en) Imaging apparatus and electronic information equipment
JP2007053479A (en) Signal processing method of imaging apparatus, and imaging apparatus
JP4265374B2 (en) Image reading apparatus and image processing program
JP4538742B2 (en) Signal processing method for imaging apparatus and imaging apparatus
JPH06225187A (en) Image pickup device
KR100242025B1 (en) Apparatus and method for scanning color image using shading correction
JP4131017B2 (en) Image processing apparatus and method
JPH1155511A (en) Image reader
JP4311138B2 (en) Data processing device for performing multiple data input / output processing
JP5178039B2 (en) Imaging device
JPH0671309B2 (en) Image sensor output correction method
JPH01106184A (en) Image signal correcting device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050729

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20071129

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20071204

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

Free format text: PAYMENT UNTIL: 20101214

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees