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

Image processing method and image processing apparatus Download PDF

Info

Publication number
JP3804214B2
JP3804214B2 JP26169297A JP26169297A JP3804214B2 JP 3804214 B2 JP3804214 B2 JP 3804214B2 JP 26169297 A JP26169297 A JP 26169297A JP 26169297 A JP26169297 A JP 26169297A JP 3804214 B2 JP3804214 B2 JP 3804214B2
Authority
JP
Japan
Prior art keywords
line
luminance value
pixel
luminance
processing
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
JP26169297A
Other languages
Japanese (ja)
Other versions
JPH10191048A (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 JP26169297A priority Critical patent/JP3804214B2/en
Publication of JPH10191048A publication Critical patent/JPH10191048A/en
Application granted granted Critical
Publication of JP3804214B2 publication Critical patent/JP3804214B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Image Input (AREA)
  • Image Processing (AREA)
  • Transforming Light Signals Into Electric Signals (AREA)
  • Facsimile Image Signal Circuits (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、映像および画像関連機器における画像処理技術に関するもので、CCDカメラなどのシェーディング(照明むらによる輝度差)が生じるセンサで撮られた画像のシェーディングを補正するのに適した画像処理方法および画像処理装置に関する。
【0002】
【従来の技術】
CCDカメラなどのエリアセンサで撮られた画像は、シェーディングによる影響により、ディジタル処理後の画像に暗い影が生じる場合がある。特に、画像の端部に近い部分(画像の周辺部という)にシェーディングの影響が現れやすい。さらに、風景などの自然画を取り込んだ場合に比べ、均一な背景色の中に文字や図形などの線画が存在する画像を取り込んだ場合に、シェーディングの影響が画像に顕著に現れ、見た目によくない画像となる場合が多い。
【0003】
ところで、最近では、手書き入力情報だけでなくCCDカメラを内蔵して画像の取り込みをも可能にした小型携帯情報処理機器が実用化されてきている。この小型携帯情報処理機器は、取り込んだ情報を取り込みと同時に表示したり、すでに取り込まれている情報を読み出して表示するための表示部が設けられている。このような小型携帯機器の表示部としては、電池の寿命を考慮して反射形の液晶表示装置(LCDという)が用いられることが多い。
【0004】
このLCDは、一般に、表示階調数が少なく、たとえば4階調程度である場合が多い。これに対して、CCD撮像素子を用いたCCDカメラは、256階調というように高い階調数を持っている。したがって、CCDカメラで取り込んだ画像をLCDに表示する場合は、階調数を減らす必要がある。
【0005】
この階調を減らす処理を行う際、前記したようなシェーディングの影響を受けて周辺が暗くなった画像を、たとえば、4値化処理すると、処理後の画像は、周辺部の暗い部分が黒いつぶれとなって現れる場合もある。
【0006】
そこで、シェーディングの影響を受けた画像に対して、そのシェーディングの影響を補正する必要が生じてくる。
【0007】
従来のシェーディング補正の方法として、シェーディングの影響を受けた1画面分の画像データを取り込んだのち、似たような明るさになるように画面を幾つかの領域に分割して、全体が滑らかな明るさの変化となるような処理を行うものがある(信学技報、IE96−21,1996−09、「CCDカメラで取り込んだ画像の2値化に関する研究」)。
【0008】
【発明が解決しようとする課題】
この従来技術は、シェーディング補正を行う際、1画面分の画像データを取り込んで幾つかの領域に分割する処理を行うため、ワークメモリとして、少なくとも1画面分の画像データを蓄えるための大きな容量を持ったメモリが必要となる。
【0009】
しかし、CCDカメラは一般に小型の機器に使用される場合が多い。特に、電子手帳のような携帯用の情報処理機器に、今後、さらに使用されることが多くなると思われる。この種の機器にあっては、小型、軽量化は勿論、低コスト化も要求され、使用する部品にも大きな制約がある。したがって、ワークメモリなどもなるべく小容量のものを使用することが望ましい。
【0010】
また、CCDカメラで撮影される被写体は、線画のみではなく、風景などの自然画もその対象となる。そして、これらの画像を前記したように、階調数の少ない表示部で表示する場合には、階調数を少なくする処理(たとえば、256階調を4階調とする処理)を行う必要がある。
【0011】
この階調数を少なくする処理としては、「大津の方法」(電気通信学会論文誌、'84/4,vol.J63-D No.4 349頁)や誤差拡散法、ディザ法などを適用することで対応できる。
【0012】
前記した「大津の方法」は、2値化するためのしきい値を設定するには適した技術である。これを利用して、たとえば、4値化する場合には、まず、2値化のためのしきい値を決定する処理を行ったのち、そのしきい値により分割されたそれぞれの領域に対して同様にそれぞれしきい値を求めるという処理を行う。この方法は、n値化を行うための演残量は多いが、線画などエッジを明瞭に保存する必要のある画像に対しては有効な方法である。
【0013】
一方、誤差拡散法やディザ法は、面積的に階調を出そうとするものであるため、エッジが保存されにくい欠点がある。このため、明るい背景の中に文字や図形などの線画が存在するような画像を取り込んで、階調変換処理するような場合は、その有意情報である線画のエッジ部分が不明瞭なものとなりやすく、見た目によい画像が得られないという問題がある。
【0014】
このように、文字や図形などの線画に対しては、大津の方法などによる固定的なしきい値を用いた2値化処理が適し、自然画に対しては面積的に階調を出そうとする誤差拡散法やディザ法階調が適している。したがって、階調を減らすためには、線画か自然画かに応じて、階調処理方法を選択して階調処理を施すことが望ましい。
【0015】
そこで本発明は、まず、シェーディングの影響が顕著に現れやすい文字や図形などの線画に対して、所定ライン単位でシェーディングの影響を除去することで、ワークメモリの小容量化を図ることを目的とし、装置全体の小型軽量化を図り、低コスト化をも可能とすることを1つの目的としている。
【0016】
また、このシェーディング補正と、n−1個のしきい値によるn値化処理とを組み合わせることにより、CCDカメラなどのエリアセンサで撮られたシェーディングのある画像に対して、そのシェーディングの影響を無くし、かつ、エッジが保存された状態で階調を減らすことができるようにし、さらに、線画か否かを判断し、線画である場合のみにシェーディング補正するという処理を行うことにより、シェーディングが顕著に現れやすい線画のみに対してシェーディング補正処理を行うことができ、処理を軽減し、処理時間の短縮化を図る。さらにまた、線画か否かを判断し、線画であればシェーディング補正を行うとともに、nー1個のしきい値を用いた階調処理を行い、線画でなければ、自然画とみなして自然画に適した階調処理方法により階調処理するという処理を行うことにより、CCDカメラなどのシェーディングの発生しやすいエリアセンサで撮られた画像を反射型のLCDなどに表示する際に、撮影対象に関係なく撮影対象に適した処理を自動的に行い、良好な画像を表示することを目的としている。
【0018】
【課題を解決するための手段】
その具体的な方法としては、入力された画像データの所定ラインごとにその所定ラインを構成する画素が線画のエッジ部を構成する画素か否かを判断し、エッジを構成する画素でない場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をもとに処理中の画素の輝度値を演算により求め、この求められた輝度値により、それ以前に処理された輝度値を更新し、エッジを構成する画素である場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をそのまま保持する処理を、所定ラインづつその所定ラインを構成する画素ごとに繰り返して行うことで、線画におけるエッジ部分の輝度の影響を除去した各画素ごとの輝度値を所定ライン単位で求める背景予測処理を行ったのち、この背景予測処理において得られた所定ラインにおける各画素ごとの輝度値が、所望とする輝度値以下であると判定された場合に、その輝度値を有する画素を含む所定の探索範囲を設定し、その探索範囲内における隣接画素との輝度変化を各画素ごとに調べ、探索範囲内において輝度変化の少ない画素が予め設定した数以上である場合には、その輝度変化の少ない画素の輝度値を基にして輝度値を決定し、探索範囲内において輝度変化の少ない画素が予め設定した数より少ない場合には、探索範囲全体の画素の輝度値をもとにして輝度値を決定して、この決定された値により背景予測結果の修正処理を行い、さらに、この背景予測結果の修正処理により修正された結果と、所望とする値として設定された輝度値とを比較して、その差分を求め、求められた差分を前記入力された画像データの対応する画素位置の輝度値に対して加減することにより、所望の輝度値となるような背景補正を行うことを特徴としている。
【0019】
このように本発明では、シェーディングの影響が顕著に現れやすい文字や図形などの線画に対して、所定ライン単位でシェーディングの影響を除去するようにしている。特に、1ラインづつの処理を行うことにより、ワークメモリとしては1ライン分のラインメモリで済むためワークメモリの小容量化を図ることができ、また、1ラインごとの処理であるため、画像の取り込みを行いながら1ラインの処理が終了したらそれを表示し、次の1ラインの処理が終了したらそれを表示するということができるため、連続的な入力に対応しやすいという利点がある。さらに、前記処理されたライン上の対応する画素位置の画素の輝度値をもとに処理対象画素の輝度値を演算により求める処理は、それ以前に処理されたライン上の対応する画素位置の輝度値と、処理中の画素の輝度値との平均をとる処理である。これにより、簡単な演算でエッジ部分の輝度の影響を減らすことができる。
【0032】
その具体的な装置としては、入力された画像データの所定ライン分のデータを保持する画像データ用ラインメモリと、この画像データ用ラインメモリに保持された画像データの所定ラインごとにその所定ラインを構成する画素が線画のエッジ部を構成する画素か否かを判断し、エッジを構成する画素でない場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をもとに、処理中の画素の輝度値を演算により求め、この求められた輝度値により、それ以前に処理された輝度値を更新し、エッジを構成する画素である場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をそのまま保持する処理を、所定ラインづつその所定ラインを構成する画素ごとに繰り返して行うことで、線画におけるエッジ部分の輝度の影響を除去した処理対象ラインにおける各画素ごとの輝度値をライン単位で求める背景予測手段と、この背景予測手段で得られた処理対象ラインにおける各画素ごとの輝度値を保持する背景予測用ラインメモリと、前記背景予測処理において得られた背景予測用ラインメモリの内容をもとに、処理対象ラインにおいて、各画素位置対応の輝度値が、所望とする輝度値以下であると判定された場合に、その輝度値を有する画素を含む所定範囲の探索範囲を設定し、その探索範囲内における隣接画素との輝度変化を各画素ごとに調べ、探索範囲内において輝度変化の少ない画素が予め設定した数以上である場合には、その輝度変化の少ない画素の輝度値を基にして輝度値を決定し、探索範囲内において輝度変化の少ない画素が予め設定した数より少ない場合には、探索範囲全体の画素の輝度値を基にして輝度値を決定し、前記背景予測用ラインメモリの対応する画素位置の内容を前記決定された内容に更新して背景予測結果の修正を行う背景予測修正手段と、前記背景予測結果修正手段により修正された結果と、所望とする値として設定された輝度値とを比較してその差分を求め、求められた差分を前記画像データ用ラインメモリの対応する画素位置の輝度値に対して加減することにより所望とする輝度値に輝度補正する背景補正手段とを有することを特徴としている。
【0033】
このように本発明では、シェーディングの影響が顕著に現れやすい文字や図形などの線画に対して、所定ライン単位でシェーディングの影響を除去するようにしている。特に、1ラインづつの処理を行うことにより、ワークメモリとしては1ライン分の画像データ用ラインメモリと背景予測用ラインメモリで済むためワークメモリの小容量化を図ることができ、装置全体を小型軽量化が図れ、低コスト化も可能となる。また、1ラインごとの処理であるため、画像の取り込みを行いながら1ラインの処理が終了したらそれを表示し、次の1ラインの処理が終了したらそれを表示するということができるため、連続的な入力に対応しやすいという利点がある。
【0034】
さらに、前記処理されたライン上の対応する画素位置の画素の輝度値をもとに処理対象画素の輝度値を演算により求める処理は、それ以前に処理されたライン上の対応する画素位置の輝度値と、処理中の画素の輝度値との平均をとる処理である。これにより、簡単な演算でエッジ部分の輝度の影響を減らすことができる。
【0045】
【発明の実施の形態】
以下、本発の実施の形態を図面を参照して説明する。
【0046】
(第1の実施の形態)
この第1の実施の形態では、撮影対象画像はほぼ均一色の背景内に文字や図形などの線画が描かれているような画像であるものとし、その画像がシェーディングの影響を受けているものとする。図1は第1の実施の形態の全体的な概略処理を説明するフローチャートであり、以下、処理手順を説明する。
【0047】
まず、概略的な処理について説明し、個々の詳細な処理については、のちに説明する。
【0048】
図1において、CCDカメラで取り込まれた画像データの1ライン分のデータについて背景を予測するための背景予測を行う(ステップs1)。そして、その背景予測された結果を用いて、予測結果の修正を行い(ステップs2)、その予測結果の修正データを参照して背景補正を行う(ステップs3)。そして1画面の全ラインの処理が終了したか否かを判断して(ステップs4)、終了していなければ、次のラインについてステップs1以降の処理を行う。
【0049】
前記背景予測処理は以下のようにして行う。
【0050】
図2はCCDカメラにより取り込まれた或る1画面分の画像例を示すもので、明るい均一色の背景10に文字などの線画20が存在している。そして、この図2では表現されていないが、シェーディングの影響を受けて、画像の周辺部が中央部に比べて暗い画像となっているものとする。
【0051】
図3(a)は図2で示すような画像のある1ライン(たとえば、図2の破線で示す1ライン)における画素(それぞれの画素番号を「0,1,2,・・・,i,・・・,n」で表す)に対する輝度値(0から255の輝度範囲をとるものとする)の関係を示すもので、輝度値が急激に落ち込んでいる部分は、文字を構成する画素の輝度を示すものであり、その他は背景を構成する画素の輝度を示している。なお、図2の破線で示す1ライン上における文字部分の輝度と図3の輝度の変化はこの場合、必ずしも一致していない。また、この画像はシェーディングの影響を受けているので、背景部分の輝度の変化曲線は、画像の中央付近の輝度が高く、両端部に近いほど輝度が小さくなるような曲線を描いている。
【0052】
このようなシェーディングの影響を受けた背景に対してシェーディングの影響を除去するのであるが、まず、文字の影響を殆ど除去して背景部分の輝度変化を大まかになだらかにする処理を行う。これをここでは背景予測処理と呼ぶ。この背景予測処理について、図4のフローチャートを参照しながら説明する。
【0053】
図4において、まず、処理対象のラインが最初のラインか否かを判定する(ステップs11)。最初のラインである場合には、予測結果バッファに最初のラインを構成する各画素の輝度を画素対応にそのまま格納する(ステップs12)。一方、処理対象のラインが最初のラインでない場合には、ステップs13以降の処理に入る。
【0054】
ステップs13では、当該ラインにおける処理対象画素の輝度値a〔i〕をその処理対象画素の直前の画素の輝度値a〔i-1〕から引いて、その差をCとする処理を行う。次に、ステップs13で求めたCの絶対値と予め定めた定数αとを比較して(ステップs14)、当該画素が文字のエッジ部分の画素であるか、それ以外の画素であるかを判定する。つまり、取り込まれた画像データの輝度範囲を0〜255とした場合、ここでは、αを「10」程度に定め、|C|≦αであれば、当該画素は背景部分を構成する画素であると判断し、|C|≦αでなければ、文字のエッジ部分の画素であるとみなす。なお、αの値は「10」に限られるものではなく、様々な条件によって最適な値を設定することができる。
【0055】
この処理によって、処理対象画素が背景画素であると判定された場合は、当該処理対象画素に対応する予測結果バッファの内容を更新する。すなわち、予測結果バッファの内容のうち、処理対象画素の位置に対応する画素の輝度値に、処理対象画素の輝度値を足し算してそれを2で割って、つまり、平均を取って、その計算結果を予測結果バッファの対応する画素位置に格納する(ステップs15)。これをさらに具体的に説明する。
【0056】
1ライン分の画素の番号を、1,2,・・・,i,・・・,nで表すとすれば、予測結果バッファには1ライン分の各画素に対応した輝度値b〔1〕,b〔2〕,・・・,b〔i〕,・・・,b〔n〕が格納される。そして、現在の処理対象画素が、あるラインのi番目の画素であるとすれば、その処理対象画素の輝度値a〔i〕と、予測結果バッファにすでに格納されている前ラインのi番目の画素の輝度値b〔i〕との平均を取って、その値を新たなデータとして、予測結果バッファのb〔i〕とする。背景の輝度において急激な変化はないと考えられるので、平均を取ることによりノイズに強い背景予測となる。
【0057】
そして次に、現在処理中の1ラインの全画素について処理を終了したか否かを判断し(ステップs16)、処理が終了していなければ、そのラインの次の画素について、ステップs13の処理を行い、ステップs14にて|C|≦αであれば、当該画素は背景部分を構成する画素であると判断し、ステップs15,s16の処理を行う。このように、予測結果バッファには、それぞれの位置の画素ごとに、前ラインの同位置の画素の輝度値と現在処理中の画素との平均の輝度値が格納される。
【0058】
そして、その1ラインのすべての画素についての処理が終了すると、次に予測結果の修正処理に移る。この処理については後に詳細に説明する。
【0059】
以上のように、処理対象のラインにおけるそれぞれの画素が背景であるとみなされた場合には、それまでの計算結果(処理されたラインのそれぞれ対応する位置における画素の輝度値の平均値)を用いて、その計算結果と現在処理中の画素の輝度値の平均を求めて、それを新たなデータとして予測結果バッファに格納し、次のラインでは、対応する位置の画素が背景であるとみなされた場合には、それまでの計算結果(対応する位置の画素の輝度値の平均値)を用いて、その計算結果と現在処理中の画素の輝度値の平均を求めて、それを新たなデータとして予測結果バッファに格納するという処理を行う。
【0060】
一方、ステップs14において、|C|≦αでないと判定された場合、つまり、処理対象画素がエッジ部を構成する画素であると判定された場合には、背景の輝度の変化はなだらかであること、および、文字等を構成するエッジ部分の影響の除去を考慮して、何も処理を行わない。したがって、予測結果バッファの値は変更されず、その画素に対応する位置の輝度値は、前ラインまでに求められたデータがそのまま保持される。
【0061】
図3(b)は以上のような背景予測処理を行ったあとの或るライン(図3(a)と同じライン)におけるそれぞれの画素に対する輝度変化を示す曲線である。この図3(b)からもわかるように、図3(a)に比べて、シェーディングの影響による背景部分の輝度の予測は、ある程度は滑らかなものとなっている。なお。図3(b)において、L0はシェーディングの影響を除去して或る一定の輝度値にしようとする際の所望とする輝度値を示している。
【0062】
また、図3(b)において、まだ、輝度の急激な低下部分が残っている。これは、これまでの背景予測処理ではエッジ部分以外の文字のデータは使われるため、その影響により生じるものである。
【0063】
つまり、図4のフローチャートにおけるステップs14は、|C|≦αであれば背景、|C|≦αでなければエッジというように説明したが、実際には文字は一定の幅を持ち、幅を持つ線の部分を構成する画素の場合は、隣接する画素との間で、|C|≦αが成り立つことになり、その線の部分のデータが用いられて、ステップs15の処理が行われることになる。したがって、図3(b)の輝度が急激に下がっている部分は、文字の影響が少し残っているために生じるものである。これを修正するのが予測結果の修正処理である。この予測結果修正処理は予測結果バッファのデータを用いて、予測結果の修正処理を行う(ステップs2)。この予測結果の修正処理は、文字の影響が残った部分を中心に背景を修正し、背景のみの輝度曲線を得る処理であり、以下に、この予測結果の修正処理について図5のフローチャートを参照しながら説明する。
【0064】
図5において、まず、所望とする輝度L0と処理対象ラインにおける1つの画素の輝度b〔i〕を比較し(ステップs21)、L0>b〔i〕、つまり、所望とする輝度L0よりも予測結果バッファ内のある画素の輝度が小さい場合は、その画素は文字の影響が残っていて輝度が落ち込んでいるものとみなして修正処理を行う。この修正処理はステップs22以降の手順に従って行う。
【0065】
始めに探索範囲の設定を行う(ステップs22)。この探索範囲の設定は、処理対象画素を中心に、画像における1ライン上の幅の1/10程度を探索範囲とし、その範囲の画素を探索範囲画素として設定する。たとえば、図3(b)において、iの位置の画素が、L0>b〔i〕と判断された場合、その画素を中心に、図示の如く、探索範囲wが設定される。
【0066】
このようにして探索範囲の設定が行われると、次に初期化を行う(ステップs23)。この初期化は、add〔1〕を0、countを0とするとともに、add〔2〕を0、refを直前の画素の予測結果とする。これらの意味については、説明を分かり易くするため、ステップs24,s25,s26の処理説明のなかで述べる。
【0067】
ステップs24では、refから探索範囲内のある画素の予測結果b〔j〕を引いた値が、予め定めた定数βより小さいか否かの判断を行う。つまり、ref−b〔j〕<βを判断する。ここで、jはステップs22で設定された探索範囲内での位置を示す変数である。また、βは画像の輝度範囲0〜255とした場合、β=20程度に設定される。この値βは、これに限られるものではなく、様々な条件によって最適な値とすればよい。
【0068】
そして、ref−b〔j〕<βである場合には、処理対象画素の予測結果が直前の画素の予測結果と差が比較的小さいということであるため、その処理対象画素の予測結果は良好な値であって輝度の変化が滑らかであると判断する。このような処理対象画素の予測結果が良好であると判断された場合は、その処理対象画素の予測結果をこれまでのadd〔1〕に新たにプラスして、それをadd〔1〕とする。さらに、良好であると判断された画素の数をこれまでのcountにプラスする(ステップs25)。
【0069】
このように、add〔1〕は探索範囲内において良好な予測結果を有する画素の予測結果を加算して得られる値であり、countはその画素数を表すものである。
【0070】
ここで、処理対象画素が探索範囲内での最初の画素であれば、add〔1〕は初期値として「0」、countも初期値として「0」となっているので、この1番目の画素に対する処理後には、add〔1〕の値は当該画素の予測結果そのものとなるとともに、countは「1」となる。
【0071】
次に、ステップ26により、その処理対象画素の予測結果を、これまでのadd〔2〕に新たにプラスして、それをadd〔2〕とする。たとえば、処置対象画素の予測結果をb〔j〕とすれば、add〔2〕+b〔j〕とし、その結果を新たなadd〔2〕とする。このadd〔2〕は、良好な予測結果か良好でない予測結果にかかわらず探索範囲全体の画素の予測結果を加算して得られる値である。たとえば、処理対象画素が探索範囲内での最初の画素であれば、add〔2〕は初期値として「0」となっているので、この1番目の画素に対する処理後には、add〔2〕の値は当該画素の予測結果そのものとなる。
【0072】
ところで、前記ステップs24において、ref−b〔j〕<βでない場合には、処理対象画素の予測結果が直前の画素の予測結果と差が大きいということであるため、その処理対象画素の予測結果は良好でない値、すなわち背景以外の文字等の影響が残る画素であると判断する。このように、処理対象画素の予測結果が良好でないと判断された場合は、直接、ステップ26の処理を行い、その処理対象画素の予測結果をこれまでのadd〔2〕に新たにプラスして、それをadd〔2〕とする。このように、add〔2〕は、良好な予測結果か良好でない予測結果にかかわらず探索範囲全体の画素の予測結果を加算して得られる値となる。
【0073】
そして次に、探索範囲のすべての画素について処理が終了したか否かを判断し(ステップs27)、終了していなければ、当該探索範囲内の次の画素についてステップs24、s25,s26の処理を行う。
【0074】
このようにして、探索範囲内のすべての画素について処理が終了すると、次に、修正値の決定処理を行う(ステップs28)。この修正値の決定処理は、次のようにして行う。
【0075】
まず、1つの探索範囲内における各画素についての処理(ステップs24〜s26)が終了したのち、countの数、つまり、良好であるとされた予測結果を有する画素数が幾つあるかを判断して、その数がある一定数以上に達しているときは、add〔1〕の値(この値は、良好であるとされた予測結果の累計値)を、countの数で割って、平均の予測結果を求める。そして、このようにして求められた平均の予測結果を、L0>b〔i〕となった画素(ステップs21)に対する予測結果の修正輝度値とする。ここである一定数以上としたのは、ステップs2の予測結果の修正は統計量を基に修正を行っており、サンプル数が少ない場合は、統計量として適切でないからである。
【0076】
一方、良好であるとされた予測結果を有する画素数がある一定数以上に達していないとき、つまり、良好であるとされた予測結果を有する画素数が少ないときは、ステップs26にて求められた探索範囲内の予測結果累計値add〔2〕を、探索範囲内のすべての画素数で割って、探索範囲内の平均の予測結果を求め、その探索範囲内の平均の予測結果を、L0>b〔i〕となった画素(ステップs21)に対する予測結果の修正輝度値とする。
【0077】
このように、この修正処理は、設定された探索範囲内において、良好であるとされた画素数がある一定数以上存在する場合には、良好であるとされた予測結果の累計値の平均の予測結果を用いて処理対象画素の輝度値を修正処理し、良好であるとされた予測結果を有する画素数が少ないときは、探索範囲内全体の予測結果累計値の平均の予測結果を求め、探索範囲内全体の平均の予測結果を用いて、処理対象画素の輝度値を修正処理を行う。
【0078】
以上のようにして、ある画素についての処理が終了すると、次に、現在処理中のラインの全画素について処理が終了したか否かを判断し(ステップs29)、終了していなければ、ステップs21に処理が戻って、再び、ステップs21以降の処理を行う。
【0079】
図3(c)は以上説明した予測結果の修正処理が終了して、文字の影響が殆どなくなった背景部分の予測結果を示すものである。
【0080】
次に、このような背景の予測結果を用いて、シェーディングの影響を除去した一定の輝度値とする背景補正処理を行う(ステップs3)。
【0081】
この背景補正処理は、図3(c)に示される予測結果の修正処理がなされた処理対象ラインの輝度曲線において、処理対象ラインのそれぞれの画素に対する輝度値を、所望とするある一定の輝度値L0とする処理であり、たとえば、ある一定の輝度値L0と予測結果修正された輝度曲線との差を各画素ごとに取って、その差を0とするように、処理対象ラインの各画素の輝度に適当な値をプラスあるいはマイナスして行う。これにより、背景の輝度は、ある一定の輝度値L0となって、明るさが一定となり、シェーディングの影響が除去されたものとなる。
【0082】
そして、最終的には、処理対象ラインにおける文字の部分を含めた輝度分布は図3(d)のようになる。以上のような処理をすべてのラインについて行ったのちの画像は、画面全体がほぼ均一の明るい背景となり、シェーディングの影響が取り除かれた画像となる。
【0083】
図6は本発明の実施の形態を実現するための装置の構成例を示すもので、レンズ1、CCDカメラ2、A/D変換器3、CCD制御回路4、画像処理装置5から構成されている。
【0084】
画像処理装置5はこれまで説明した処理を行う部分であり、画像データ用ラインメモリ51、背景予測用ラインメモリ52、背景予測手段53、予測結果修正手段54、背景補正手段55を有し、前記背景予測用ラインメモリ52、背景予測手段53、予測結果修正手段54、背景補正手段55によりシェーディング補正部56を構成している。
【0085】
前記画像データ用ラインメモリ51は、CCDカメラ2で取り込まれてA/D変換された画像データのある1ライン分のデータを格納するメモリである。そして、背景予測手段52は、画像データ用ラインメモリ51に格納された1ライン分の画像データを用いて、前記図4のフローチャートで説明したような背景予測処理を行い、この背景予測を行う際のワークメモリとして背景予測用ラインメモリ52が用いられる。この背景予測用ラインメモリ52は、図4においては予測結果バッファに相当するものであり、ある1ラインにおける全画素の処理が終了した時点では、当該ラインにおける各画素の予測結果がそれぞれの画素対応に格納される。
【0086】
また、予測結果修正手段54は、図5のフローチャートで説明した背景結果修正処理を行うもので、背景予測用ラインメモリ52の内容を用いて図5の処理手順に沿った修正処理を行う。そして、背景予測用ラインメモリ52のデータを、修正後のデータに更新する。
【0087】
さらに、背景補正手段55は、図1のフローチャートのステップs3の処理を行うもので、修正後のデータが格納された背景予測用ラインメモリ52のデータを用て、画像データラインメモリ51の内容に対して背景補正を行い、最終的に図3(d)に示すような画像とする。
【0088】
以上の処理は1ライン毎に行われるもので、画像の取り込みを行いながら1ラインの処理が終了したらそれを表示し、次の1ラインの処理が終了したらそれを表示するというような1ライン毎の連続的な処理を行う。
【0089】
以上説明したように、第1の実施の形態は、線画部分の影響がでないような背景部分の予測を行い、しかも、前ラインにおいて求められたデータを使用して背景部分の予測を行っているので、シェーディングにより輝度変化の大きい背景画像を、なだらかな輝度変化とすることができ、最終的には、シェーディングの影響が除去された所望とする輝度の背景画像とすることができる。
【0090】
また、図6の構成からもわかるように、ワークメモリとしてはラインメモリのみで済むので、1画面分のフレームメモリを使用する場合に比べてメモリの小容量化が図れる。また、前記したように、1ライン毎の処理であるため、画像の取り込みを行いながら1ラインの処理が終了したらそれを表示し、次の1ラインの処理が終了したらそれを表示するということができるため、連続的な入力に対応しやすいという効果も得られる。
【0091】
なお、図1において背景予測(ステップs1)を省いて、入力された画像データをステップs1の背景予測結果にみたてて、ステップs2以降の処理を行うこともできる。この場合、処理速度は速くなるが、ステップs2により求められた背景予測の精度は落ちる。
【0092】
(第2の実施の形態)
この第2の実施の形態は、第1の実施の形態で説明したシェーディング補正処理と、階調を落とす処理とを組み合わせた処理を行うものである。
【0093】
すなわち、前記従来技術の項で述べたように、CCDカメラなどのように階調数の多い撮像手段で取り込んだ画像を、反射型のLCDのように階調数の小さい表示部で表示する場合、階調数を減らす必要がある。この階調を落とす際、前記したようなシェーディングの影響を受けて周辺が暗くなった画像を、たとえば、4値化処理すると、処理後の画像は、周辺部の暗い部分が黒いつぶれとなって現れる場合もある。そこで、階調を落とす処理を行う際、シェーディングの影響を受けた画像に対して、そのシェーディングの影響を補正する必要が生じてくる。
この第2の実施の形態では、CCDカメラなどのエリアセンサで撮られたシェーディングのある画像に対しても、そのシェーディングによる影響を無くして階調を減らすことを可能とするものであり、以下、この第2の実施の形態について説明する。
【0094】
図7は第2の実施の形態の全体的な処理手順を説明するフローチャートであり、まず、処理対象画像からn値化するための第1〜第n−1のしきい値を求める(ステップs31)。これは、CCDカメラなどにより入力された、たとえば、0〜255の256階調の画像データを、4階調の画像データとする場合には、第1〜第3のしきい値を求める処理である。
【0095】
そして、シェーディング補正処理(ステップs32)を行い、その後、第1〜第n−1のしきい値を用いてn値化処理する(ステップs33)。
【0096】
前記ステップs31におけるn値化のためのn−1個のしきい値を求める処理は、特に限定されるものではなく、撮影対象が線画であれば、たとえば、「大津の方法」を拡張して用いることも可能である。
【0097】
この「大津の方法」は前記したように、線画には適した2値化方法であるが、それを用いて4値化しようとすると、まず、最初に2値化して、それにより分割された領域を、さらにそれぞれ2値化するというように、2値化する処理を3回行なう必要があるため、演算量が膨大なものとなり、多くの処理時間を要する問題がある。
【0098】
そこで、この第2の実施の形態では、n値化するためのn−1個のしきい値を求める方法として、「大津の方法」にわずかな演算を加えるだけでn−1個のしきい値を求める方法を採用する。このn値化するためのn−1個のしきい値を求める方法を図8のフローチャートを参照しながら以下に説明する。
【0099】
まず、CCDカメラで取り込まれた画像データについて累積度数分布を求める(ステップs41)。求められた累積度数分布の例を図9(a)に示す。なお、ここでの処理対象画像は、前記同様、画像の大部分を占める明るい背景内に文字や図形などの線画が描かれているような画像であるとする。したがって、0〜255の輝度範囲における各輝度に対する累積度数の曲線は、図9(a)に示されるように、輝度の大きい側に累積度数が多くなる曲線となる。なお、この場合、CCDカメラによる輝度範囲を0〜255の256階調とする。
【0100】
そして、このような累積度数分布を用いて「大津の方法」により2値化しきい値th〔0〕を求める。この2値化しきい値により分割された領域のうち、低輝度側を第1のクラスC1、高輝度側を第2のクラスC2とする。ここで、第1のクラスC1の累積輝度は主に線画によるものであり、第2のクラスC2の累積輝度はは主に背景によるものである。
【0101】
次に、前記第2のクラスC2における輝度の平均μ2と標準偏差σ2を算出する(ステップs42)。この第2のクラスC2は大部分が背景で占められているので、第2のクラスC2における輝度の平均値μ2は、ほぼ、背景の輝度の平均値と考えることができる。そして、これらの輝度の平均μ2と標準偏差σ2を用いて、n値化するためのn−1個のしきい値のうち、第1のしきい値th〔1〕を求める(ステップs43)。この第1のしきい値th〔1〕は
th〔1〕=μ2−σ2×α・・・(1)
で求められる。(1)式においてαは係数であり、実験では、α=1/2とするとよい結果が得られたが、これに限られるものではなく、種々の条件によって、最適な値を設定すればよい。
【0102】
この(1)式により求められる第1のしきい値th〔1〕は、線画と背景のほぼ境界を意味するものとなる。線画と背景の境界は、前記背景の輝度の平均値μ2より暗い側に存在すると考えられる。したがって、第1のしきい値th〔1〕は背景の輝度の平均値μ2からある値を引いた値とすればよい。
【0103】
ところで、背景の色がたとえ均一であったとしても背景の輝度の累積度数は、画像を入力するデバイスや撮影状態によってその幅が異なってくる。特に、CCDカメラなどのエリアセンサで撮られたシェーディングの存在する画像においては、累積度数分布における背景に相当する部分の幅の変動は激しいものとなる。そこで、累積輝度の幅を吸収するために、幅の指標となる第2のクラスC2の標準偏差σ2をパラメータとしてそのパラメータに適当な係数αを掛けたものを背景の輝度の平均値μ2から引き算して第1のしきい値th〔1〕を求めている。このようにして求められた第1のしきい値th〔1〕を図9(b)に示す。
【0104】
そして次に、図8のステップs44では、この第1のしきい値th〔1〕をもとに、他のしきい値を求める。ここで、求めるべき階調数をn階調とすれば、n−1個のしきい値を決定することになる。したがって、このステップs44では、第1のしきい値th〔1〕をもとに第2のしきい値th〔2〕〜第n−1のしきい値th〔n−1〕を求めることになる。この第1のしきい値th〔1〕をもとに、第2のしきい値th〔2〕〜第n−1のしきい値th〔n−1〕を求める処理について以下に説明する。
【0105】
第1のしきい値th〔1〕以下の各輝度ごとの累積画素数をすべて足し算して、合計の累積画素数を求め、その合計の累積画素数をn−1等分する。この実施の形態では、求めるべき階調数を4階調(n=4)としているので、第1のしきい値th〔1〕以下の各輝度ごとの画素数を足し算して得られた合計の累積画素数を3等分して、第2のしきい値th〔2〕と第3のしきい値th〔3〕を求めることになる。
【0106】
具体例として、第1のしきい値th〔1〕以下の各輝度ごとの累積画素数をすべて足し算して得られた合計累積画素数が仮りに120であるとすると、それを3等分して「40」を得る。そして、40画素ごとにしきい値を設定する。つまり、輝度0から明るい方へ各輝度毎の累積画素数を足し算して行き、合計画素数が40画素となったところをしきい値(第3のしきい値th〔3〕)とし、この第3のしきい値th〔3〕から明るい方へ各輝度毎の累積画素数を足し算して再び合計画素数が40画素となったところをしきい値(第2のしきい値th〔2〕)とするというようにして、第2、第3のしきい値th〔2〕,th〔3〕を決定する。
【0107】
このようにして第1〜第n−1のしきい値が決定される。
【0108】
ところで、図7のステップs32のシェーディング補正処理は、第1の実施の形態において、図1〜図6を用いて説明した背景予測処理、予測結果の修正処理、背景補正処理などの一連の処理であり、これらに処理方法に関しては、前述したとおりであるので、ここではその詳細な処理ついては説明を省略する。
【0109】
なお、この第2の実施の形態においては、所望とする輝度値L0は、最も輝度値の高い側に設定される第1のしきい値th〔1〕よりも大きい値とするのがよい。このように、所望とする輝度値L0を、最も輝度値の高い側に設定される第1のしきい値th〔1〕よりも大きい値とすることにより、n値化処理後において、背景がより明るくなって文字などが見やすい画像となる。具体例としては、前記第2のクラスC2における輝度の平均値μ2程度とすることが考えられる。
【0110】
次に、シェーディング補正を終了したのち、第1〜第n−1のしきい値を用いてn値化処理を行う。このn値化処理の一例について図10を参照しながら説明する。なお、この図10のフローチャートはある1つの画素ごとのn値化処理を示すものである。図10において、まず、第1〜第n−1のしきい値のどのしきい値を選ぶかについての初期化を行う(ステップs51)。この初期化は、この場合、k=1とする。つまり、初期のしきい値として、第1のしきい値th〔1〕とする。次に、処理対象の画素の輝度値aが、a>th〔k〕であるか否かを判断する(ステップs52)。この場合、k=1であるからa>th〔1〕を判断する。そして、a>th〔1〕であれば、その画素の輝度値をn−kとする(ステップs53)。ここで、画素の輝度値を0〜3の4値化とすることを考えると、a>th〔1〕であるときは、n=4、k=1であるから、当該画素の輝度値を「3」とする。
【0111】
このように、ある1画素のn値化(ここでは4値化)処理が終了すると、次の画素のn値化処理に移る。次の1画素に対しても、前記同様、輝度aが、a>th〔1〕であるか否かを判断する。そして、a>th〔1〕でないとすると、ステップs54に進み、kをk+1(この場合、k=2)とする。そして、k<nを判断し(ステップs55)、k<nであれば、ステップs52に戻って、今度は、a>th〔2〕であるか否かを判断する。そして、a>th〔2〕であれば、その画素の輝度値をn−kとする(ステップs53)。このとき、n=4、k=2であるから、当該画素の輝度値を「2」とする。一方、前記ステップs52におけるa>th〔2〕の判断において、a>th〔2〕でない場合には、ステップs54に進み、kをk+1とする。これにより、k=3となり、k<nを判断し(ステップs55)、k<nであれば、ステップs12に戻って、今度は、a>th〔3〕であるか否かを判断する。そして、a>th〔3〕であれば、その画素の輝度値をn−kとする。このとき、n=4、k=3であるから、当該画素の輝度値を「1」とする。そして、次の画素について同様の処理を行う。
【0112】
図11はこの第2の実施の形態を実現するための装置の構成例をを示すもので、概略的には図6と同様、レンズ1、CCDカメラ2、A/D変換器3、CCD制御回路4、画像処理装置5から構成されている。
【0113】
画像処理装置5はこの第2の実施の形態で説明した処理を行う部分であり、画像データ用ラインメモリ51、しきい値算出手段61、n値化処理手段62、シェーディング補正部56を有している。
【0114】
シェーディング補正部56は、図6で示したシェーディング補正部56と同じものであり、背景予測用ラインメモリ52、背景予測手段53、予測結果修正手段54、背景補正手段55から構成されているが、ここでは、これらの図示は省略されている。また、このシェーディング補正部56が行う処理内容は、第1の実施の形態で説明したので、ここではその説明は省略する。
【0115】
前記しきい値算出手段61は、n値化するための第1〜第n−1のしきい値を算出するもので、そのしきい値算出の一例として、図8のフローチャートで示されるような処理によりn−1個のしきい値の算出を行う。ただし、実際には、直前に取り込んだ1画面分の画像データから第1〜第n−1のしきい値を求めて、そのしきい値を次の1画面分の画像に反映しながら処理を行う。
【0116】
以下にこの画像処理装置の動作を説明する。
【0117】
最初に取り込んだ1ラインづつの画像データは、シェーディング補正部56にて前記したような処理によりシェーディング補正される。これと同時に、しきい値設定手段61では画像データラインメモリ51に格納された1ライン分づつのデータを用いて、しきい値を算出するために必要なデータを得て、1画面の入力が終了したところで、図8の処理手順によって第1〜第n−1のしきい値を求める。このようにして求められた第1〜第n−1のしきい値は次の1画面の画像におけるしきい値として使用される。
【0118】
次の1画面における1ラインのデータが画像データ用ラインメモリ51に取り込まれると、その1ラインのデータは、シェーディング補正されるとともに、n値化処理手段62により、前の1画面により算出され第1〜第n−1のしきい値を用いてn値化処理される。また、このとき同時に、しきい値決定手段61では画像データラインメモリ51に格納された処理対象画面の1ライン分づつのデータを用いて、その1画面分のデータを用いて第1〜第n−1のしきい値を算出し、これを新たな第1〜第n−1のしきい値とする。このようにして、直前に取り込んだ1画面分の画像データから第1〜第n−1のしきい値を算出してそれを次の1画面分の画像に反映しながら処理を行う。
【0119】
なお、ここでのn値化処理は、第1〜第n−1のしきい値というような固定的なしきい値を用いてのn値化処理であり、エッジの保存を特に必要とする文字などの線画に適したn値化である。そこで、これらしきい値算出手段61、シェーディング補正部56、n値化処理手段62をここでは線画用階調処理部63という。
【0120】
なお、図7において、処理ステップをステップs32、ステップs31、ステップs33の順で行うことも可能である。
【0121】
以上説明したように、この第2の実施の形態によれば、CCDカメラなどのように階調数の多い撮像手段で取り込んだ画像を、LCDのように階調数の小さい表示部で表示する場合、階調を落とす処理を行う際に、シェーディングのある画像画像に対しても、そのシェーディングによる影響を無くして階調を減らすことが可能となり、特に、明るい背景に文字などの線画が描かれているような撮影対象に対し、シェーディングの影響を除去し、つぶれのない良好な画像を得ることができ、きわめて見やすい画像を得ることができる。
【0122】
(第3の実施の形態)
この第3の実施の形態は、処理対象画像が線画であるか否かを判断して、線画に対してのみこれまで説明したシェーディング補正を行うものである。これは、線画の場合は自然画に比べると、シェーディングの影響がより一層顕著に現れるため、対象画像が線画である場合のみにシェーディング補正を行おうとするものである。
【0123】
図12はこの第3の実施の形態の全体的な処理手順を概略的に説明するフローチャートであり、処理対象画像が線画であるか否かを判断するための処理を行い(ステップs61)、その処理結果をもとにして線画であるか否かを判断し(ステップs62)、線画であると判断された場合のみにシェーディング補正処理を行う(ステップs63)。
【0124】
ここでの線画判断処理について図13のフローチャートを参照しながら説明する。まず、初期化を行う(ステップs71)。この初期化は、輝度変化の立ち上がりまたは立ち上がりを判断するためのスイッチswを“1”(立ち下がりを判断する場合を“1”、立ち上がりを判断する場合を“0”とする)に設定するとともに、線画部分の幅の長さの累計を示す値lengを「0」、さらに、線の数を表す値numを「0」とする。
【0125】
そして、処理対象画素の輝度値a[i]からその直前の画素の輝度値a[i-1]を引いて、その差をCとする(ステップs72)。
【0126】
次に、輝度の立ち上がりまたは立ち上がりを判断するためのスイッチswの状態を判断する(ステップs73)。ここでは、初期設定として、sw=“1”となっているので、立ち下がりの検出処理を行い、C≦−γであるか否かを判断する(ステップs74)。ここで、γは立ち下がりまたは立ち上がりを判断する指標となる値であり、入力画像が256階調である場合、γ=15程度に設定する。しかし、この値は、様々な条件によって最適な値を設定すればよい。
【0127】
ステップs74において、C≦−γである場合は、輝度値が所定以上立ち下がっていると判断し、次の処理として立ち上がりを検出するために、スイッチsw=“0”とするとともに、当該画素の位置iをstart位置とする(ステップs75)。つまり、輝度値が所定以上立ち下がっている画素の位置が保存されることになる。
【0128】
そして、すべての画素についての処理が終了したか否かを判断し(ステップs76)、終了していなければ、ステップs72に処理が戻り、次の画素について直前の画素の輝度値との差を取る(ステップs72)。そして、sw=“1”か否かの判断を行うが、このとき、sw=“0”となっているので、立ち上がりの検出に入る。
【0129】
この立ち上がりの検出は、C≧γを判断して(ステップs77)、C≧γであれば、輝度値が所定以上立ち上がっていると判断し、C≧γでなければ、所定以上の立ち上がりでないと判断する。
【0130】
たとえば、図14に示すような場合を例にすると、iの位置の画素においては、直前の画素(i−1の位置の画素)との輝度差Cが、C≦−γである場合、その位置iが保存され、次の画素(i+1の位置の画素)について、直前の画素との輝度値の差を取り、C≧γを判断するが、この場合、C≧γとはならないので、次の画素について、再び、C≧γを判断する。このような処理を繰り返し、やがて、i+nの画素について、C≧γの処理がなされると、C≧γが成り立ち、立ち上がりが検出されることになる。
【0131】
そして、立ち上がりが検出されると、ステップs78に処理が移り、次の処理として立ち下がりを検出するために、sw=“0”とするとともに、文字の幅の累計を示す値lengをこれまでのlengに今回の文字幅をプラスする。つまり、leng+{i−start}を計算する。なお図14の例ではleng+{(i+n)−i}が計算されることになる。さらに、これまでの線の数の累計を表すnumに1をプラスする。
【0132】
このようにして、画像を構成するすべての画素について処理が終了すると(ステップs76)、ステップs78にて計算された累計のlengとnumを用いて、累計のlengを累計のnumで割って、1個当たりの線の太さを判断する。そして、その1個当たりの太さをある値δと比較して線画であるか否かを判断する(ステップs79)。ここで、δは解像度が320画素×240画素の画像の場合、δ=7程度に設定する。ただし、この値も様々な条件により最適な値を設定すればよい。
【0133】
ここで線画は高周波成分が多く、自然画は低周波成分が多い。よって、線の太さの平均値を示すleng/numは線画の場合は小さく、自然画の場合は大きくなる。よって、leng/num≦δである場合は、線画と判断し、leng/num≦δでない場合は、自然画など線画以外であると判断する(ステップs80a,s80b)。
【0134】
このようにして、線画か線画以外化の判断がなされる。そして、線画である場合のみに、第1の実施の形態で説明したシェーディング補正処理を行うようにする。
【0135】
図15はこの第3の実施の形態を実現するための装置の構成例をを示すもので、概略的には図6と同様、レンズ1、CCDカメラ2、A/D変換器3、CCD制御回路4、画像処理装置5から構成されている。
【0136】
画像処理装置5はこの第3の実施の形態で説明した処理を行う部分であり、画像データ用ラインメモリ51、線画判断手段71、シェーディング補正部56、シェーディング補正を行うか否かを設定するシェーディング補正設定スイッチ72を有している。
【0137】
前記シェーディング補正部56は、図6で示したシェーディング補正部56と同じものであり、背景予測用ラインメモリ52、背景予測手段53、予測結果修正手段54、背景補正手段55から構成されているが、ここでは、これらの図示は省略されている。また、このシェーディング補正部56が行う処理内容は、第1の実施の形態で説明したのでここでの説明は省略する。
【0138】
線画判断手段71は図13のフローチャートで示した処理を行うもので、この場合、実際の処理は直前に取り込んだ1画面分の画像データから線画であるか否かを判断した結果を次の1画面分の画像に反映しながら処理を行う。
【0139】
したがって、シェーディング補正設定スイッチ72は、初期設定では、たとえば、オフ、つまり、最初の1画面分については線画以外の画像に対する処理設定としておく。
【0140】
このように、初期設定においてシェーディング補正設定スイッチ72がオフに設定されているとすると、最初に取り込んだ1ラインづつの画像データは、シェーディング補正がなされずに、そのまま、1ラインづつ出力されて表示される。これと同時に、線画判断手段71では画像データラインメモリ51に格納された1ライン分づつのデータを用いて、図13の処理手順にて各ライン毎に1画面分の処理を行う。
【0141】
そして、1画面分の処理が終了したところで、その画面が線画であるか否かを判断する。この判断結果は次の1画面の画像の種類の判別に使われる。たとえば、最初の1画面の画像が線画であると判断された場合は、シェーディング補正設定スイッチ72をオンとし、次の1画面はシェーディング補正が行われる。
【0142】
このように、シェーディング補正設定スイッチ72がオンとなると、画像データ用ラインメモリ51に取り込まれた1ラインごとのデータは、1ライン毎にシェーディング補正されたのち、1ラインごとに出力される。そして、このとき同時に、線画判断手段71では画像データラインメモリ51に格納された1ライン分づつのデータを用いて、図13の処理手順にて各ライン毎に1画面分の処理を行う。そして、1画面分の処理が終了したところで、その画面が線画であるか否かを判断する。この判断結果は次の1画面の画像の種類の判別に使われる。このようにして、直前に取り込んだ1画面分の画像データから線画であるか否かを判断した結果を次の1画面分の画像に反映しながら処理を行う。
【0143】
以上説明したように、第3の実施の形態では、処理対象画像が線画であるか否かを判断して、シェーディングの影響がより一層顕著に現れる線画に対してのみシェーディング補正を行うようにしている。また、この第3の実施の形態では、線画以外の自然画はシェーディングの影響は余り目立たないので、特別な処理を施さないようにしている。したがって、シェーディング補正は線画に対して行えばよいので、処理時間の短縮にもつながる。
【0144】
(第4の実施の形態)
この第4の実施の形態は、処理対象画像が線画か否かを判断し、線画である場合には、シェーディング補正を行い、かつ、前記のようにして求められた第1〜第n−1のしきい値を用いた階調処理を行って、線画でないと判断された場合には、自然画とみなして自然画に適した階調変更処理を行うものである。
【0145】
図16は第4の実施の形態の概略的な処理手順を説明するフローチャートであり、まず、線画判断を行うための処理(ステップs81)を行い、その処理結果を用いて線画であるか否かの判断を行う(ステップs82)。そして、線画であれば、線画用階調処理を行い(ステップs83)、線画でなければ自然画用の階調処理を行う(ステップs84)。
【0146】
ステップs81における線画判断を行うための処理は、図13のフローチャートで説明した処理であり、この処理で得られた結果が線画である場合には、線画用階調処理を行う。この線画用の階調処理は、第2の実施の形態で説明した処理であり、概略的な処理手順としては、図7に示されているように、まず、処理対象画像からn値化するためのn−1個のしきい値を求める(ステップs31)。これは、CCDカメラなどにより入力された、たとえば、0〜255の256階調の画像データを、4階調の画像データとするために、第1〜第3のしきい値を求める処理である。そして、シェーディング補正処理(ステップs32)を行ったのち、n−1個のしきい値を用いてn値化処理(ステップs33)を行う。
【0147】
一方、線画でないと判断された場合には、自然画に適した階調処理を行う。この自然画に適した階調処理というのは、面積的な階調を得ようとする階調処理であり、たとえば、ディザ法や誤差拡散法などがある。
【0148】
このように、線画に対しては、エッジが保存される階調処理を行い、自然画に対しては、ディザ法や誤差拡散法などの面積的な階調処理を施すことにより、階調数を減らす必要がある場合、より一層見た目に良好な画像とすることができる。
【0149】
図17はこの第4の実施の形態を実現するための装置の構成例を示すもので、第1〜第3の実施の形態同様、概略的には、レンズ1、CCDカメラ2、A/D変換器3、CCD制御回路4、画像処理装置5から構成されている。
【0150】
画像処理装置5は、この第4の実施の形態の場合、画像データ用ラインメモリ51、線画判断手段71、線画用階調処理部63、自然画用階調処理部81と、これら線画用階調処理部63、自然画用階調処理部81を選択する選択スイッチ82などを有している。
【0151】
前記線画判断手段71は図15の構成で示した線画判断手段71と同じものであり、図13で説明した処理を行い、1フレーム(1画面分)の処理が終了後に、その1画面の画像が線画であるか線画でないかを判定して、線画であることを示す信号または線画でないことを示す信号を選択スイッチ82に出力する。
【0152】
選択スイッチ82はこの線画判断手段71からの線画であることを示す信号を受けると、線画用階調処理部63を選択し、線画でないことを示す信号を受けると自然画用階調処理部81を選択するように切替動作を行う。
【0153】
また、線画用階調処理部63は、図11の構成図で説明した線画用階調処理部63と同じものであり、しきい値決定手段61、シェーディング補正部56、n値化処理手段62から構成されている。
【0154】
ところで、線画判断手段71は図13のフローチャートで示した処理を行うものであるが、前記したように、1画面分の処理が終了した後、その結果を次の1画面の画像データに反映させるものであるため、選択スイッチ82は、初期設定では、たとえば、自然画用階調処理部82側としておく。
【0155】
したがって、最初に取り込んだ1ラインづつの画像データは、自然画用階調処理部82により階調処理されて出力される。これと同時に、線画判断手段71では画像データラインメモリ51に格納された1ライン分づつのデータを用いて、図13の処理手順にて各ライン毎に1画面分の処理を行う。そして、1画面分の処理が終了したところで、その画面が線画であるか否かを判断する。この判断結果は次の1画面の画像の種類の判別に使われる。たとえば、最初の1画面の画像が線画であると判断された場合は、選択スイッチ82を線画用階調処理部63側に切り替えて、次の1画面は線画用階調処理部63による階調処理がなされる。このとき同時に、線画判断手段71では画像データラインメモリ51に格納された1ライン分づつのデータを用いて、図13の処理手順にて各ライン毎に1画面分の処理を行う。そして、1画面分の処理が終了したところで、その画面が線画であるか否かを判断する。この判断結果は次の1画面の画像の種類の判別に使われる。このようにして、直前に取り込んだ1画面分の画像データから線画であるか否かを判断した結果を次の1画面分の画像に反映しながら処理を行う。
【0156】
以上のように、この第4の実施の形態によれば、処理対象画像が線画か否かを判断し、線画である場合には、シェーディング補正を行い、かつ、前記のようにして求められた第1〜第n−1のしきい値を用いた線画用の階調処理を行い、線画でないと判断された場合には、自然画とみなして自然画に適したディザ法や誤差拡散法といった階調変更処理を行うようにしているので、それぞれに適した階調処理が行え、CCDカメラなどで取り込んだ画像を反射型のLCDに表示するような場合、撮影する対象に関係なく、線画あるいは自然画それぞれに適した処理がなされることにより見た目によい画像を表示することができる。
【0157】
ところで、以上説明した第2の実施の形態から第4の実施の形態において、画像データがCCDカメラなどから連続入力されている場合は、前の1フレーム分(1画面分)で作成されたデータ(第1〜第n−1のしきい値、線画か否かの判断結果など)を用いて処理を行うことにより、全体的な処理を簡素化することができる。この処理について、第4の実施の形態で説明した処理内容の場合を例にして、図18のフローチャートを参照しながら説明する。
【0158】
図18において、しきい値および線画判断結果の初期化を行う(ステップs91)。このしきい値の初期化は、たとえば、n値化とする場合は、第1〜第n−1のしきい値th〔1〕〜th〔n−1〕の値を初期値として適当な値を設定するというような処理であり、また、線画判断結果の初期値としては、たとえば、自然画とする。
【0159】
次に、あるフレームにおける1ラインデータの入力(ステップs92)を行ったのち、その1ラインデータから各種のデータを取得する(ステップs93)。ここでの各種のデータというのは、しきい値算出に必要な累積度数分布作成のためのデータや線画か否かを判断するためのデータとして図13のフローチャートで説明したleng、numなどのデータである。
【0160】
そして次に、直前のフレームデータを基に得られた線画か否かの結果を判断し(ステップs94)、線画でなければ自然画用の階調処理による階調処理を行い(ステップs95)、線画であれば、直前のフレームデータを基に算出された第1〜第n−1のしきい値を用いた線画用の階調処理(シェーディング処理を含む)を行う(ステップs96)、
次に、1フレーム分における全ラインの処理が終了したか否かを判断し(ステップs97)、終了していなければ、ステップs92に処理が戻り、終了していればn値化のための第1〜第n−1のしきい値を更新するとともに、線画判断結果を更新する(ステップs98)。そして、次のフレームデータがあるか否かを判断し(ステップs99)、次のフレームデータがあれば、その新たなフレームに対してステップs92以降の処理を行い、次のフレームがなければ処理を終了する。
【0161】
このように、画像データが連続して入力されている場合は、前の1フレームにおいて求められたしきい値や線画判断結果を、現在取り込んでいるフレームデータに用いて処理することが可能となる。なお、この連続入力を考慮した処理は、ここで説明した第4の実施の形態への対応だけではなく、第2に実施の形態、第3の実施の形態に対しても同様に可能である。
【0162】
さらに、本発明は、最初に説明した第1の実施の形態において、レンズの収差への対応処理を可能とする。
【0163】
このレンズの収差による影響というのは、たとえば、図19(a)に示すように、背景10の中に同じ太さでかつ同じ濃さの直線の線画11が存在した場合、それをレンズを通して取り込んだ画像の輝度(図19(a)の破線で示すラインにおける輝度)は、同図(b)に示すように、画像の端部に近いほど線の幅が太く背景との輝度のコントラストが小さくなって中央部に比べてシャープさに欠けた画像となる現象である。
【0164】
これを解消するために、本発明では、背景補正処理後のデータ(図3(d))に対して、図20(a)のように、所望とする背景輝度L0より少し小さい輝度値L1(図示破線で示す)を設定し、これより小さな輝度値を有する部分に対してレンズ収差を考慮した係数を掛けることで、少なくとも輝度の高さを補正しコントラストを良くすることができる。
【0165】
前記所望とする背景輝度L0より少し小さい輝度値L1は、たとえば、所望とする背景輝度L0×0.8により得られる値とする。また、前記レンズ収差を考慮した係数は、1画面分におけるある1ライン上の画素の位置0,1,2,・・・,nに対して、図20(b)のような曲線を描く係数値とする。つまり、画面の中央部は係数は「1」とし、中央部から端部に行くに従って、係数値を小さく(係数値<1)する。ここで、レンズの収差の影響は事前に決定できるので、計測によって予め係数を求めておくことができる。されるこのような係数曲線から得られる係数値を図20(a)の線画部分の輝度値に掛けることにより、端部付近に存在する線画の輝度値は、図20(c)に示すように、より小さな値となり、背景とのコントラストが大きくなり、レンズ収差の影響が改善される。
【0166】
なお、以上説明した第2〜第4の実施の形態において用いられるn値化するためのしきい値算出用のデータや線画判断のためのデータは、1つの画面全体から求めるのではなく、画面の周辺部を除いて求めるようにしてもよい。これは、画面の周辺部にはこれらのデータを求める際に重要なデータが少ないと考えられるためである。
【0167】
また、線画判断は、1画面単位で行っているが、たとえば、文字などと風景などの画像が両方入り交じっているような画像に対処しやすいように、線画領域と自然画領域とを分離して、それぞれの領域ごとに線画か否かを判断して、領域毎に必要な処理を行うようにしてもよい。
【0168】
また、第1〜第4の実施の形態において、輝度(モノクロ)に対する処理として説明したが、カラーへの対応も可能である。すなわち、カラー入力(例えばRGB)されたデータを輝度と色に関する他のデータ(例えばYUV)に変換し、輝度に対して上述の処理を行い、再び基に変換(例えばRGB)することにより対応できる。
【0169】
また、本発明の処理を行う処理プログラムは、フロッピィディスク、光ディスク、ハードディスクなどの記憶媒体に記憶させておくことができ、本発明は、それらの記憶媒体をも含むものであり、また、ネットワークからデータを得る形式でもよい。
【0170】
【発明の効果】
以上説明したように、本発明は、シェーディングの影響が顕著に現れやすい文字や図形などの線画に対して、所定ライン単位でシェーディングの影響を除去するようにしている。特に、1ラインづつの処理を行うことにより、ワークメモリとしては1ライン分の画像データ用ラインメモリと背景予測用ラインメモリで済むためワークメモリの小容量化を図ることができ、装置全体の小型軽量化に寄与し、低コスト化も図れる。また、1ラインごとの処理であるため、画像の取り込みを行いながら1ラインの処理が終了したらそれを表示し、次の1ラインの処理が終了したらそれを表示するということができるため、連続的な入力に対応しやすいという効果も得られる。
【図面の簡単な説明】
【図1】本発明の第1の実施の形態の全体的な処理を説明するフローチャート。
【図2】第1の実施の形態を説明するための画像の一例を示す図。
【図3】第1の実施の形態において画像のある1ラインにおける背景予測処理から背景補正処理までを説明する図。
【図4】第1の実施の形態における背景予測処理を説明するフローチャート。
【図5】第1の実施の形態における背景予測の修正処理を説明するフローチャート。
【図6】第1の実施の形態における画像処理装置をCCDカメラと組み合わせた装置構成例を示す図。
【図7】本発明の第2の実施の形態の全体的な処理を説明するフローチャート。
【図8】第2の実施の形態におけるn−1個のしきい値を算出する処理手順を説明するフローチャート。
【図9】n−1個のしきい値算出方法の一例を説明するための輝度値に対する画素の累積度数分布を示す図。
【図10】第2の実施の形態におけるn値化処理を説明するフローチャート。
【図11】第2の実施の形態における画像処理装置をCCDカメラと組み合わせた装置構成例を示す図。
【図12】本発明の第3の実施の形態の全体的な処理を説明するフローチャート。
【図13】第3の実施の形態における線画判断の処理手順を説明するフローチャート。
【図14】線画判断に必要なデータについてを文字部分の輝度変化を例にして説明する図。
【図15】第3の実施の形態における画像処理装置をCCDカメラと組み合わせた装置構成例を示す図。
【図16】本発明の第4の実施の形態の全体的な処理を説明するフローチャート。
【図17】第4の実施の形態における画像処理装置をCCDカメラと組み合わせた装置構成例を示す図。
【図18】本発明において画像を連続入力する場合の処理を第4の実施の形態を例にとって説明するフローチャート。
【図19】レンズの収差に対処する処理を説明するための画像例とレンズ収差の影響を受けた画像の輝度分布例を示す図。
【図20】レンズの収差に対処する処理を説明するための図。
【符号の説明】
1 レンズ
2 CCDカメラ
3 A/D変換器
4 CCD制御回路
5 画像処理装置
51 画像データ用ラインメモリ
52 背景予測用ラインメモリ
53 背景予測手段
54 予測結果修正手段
55 背景補正手段
56 シェーディング補正部
61 しきい値算出手段
62 n値化処理手段
63 線画用階調処理部
71 線画判断手段
72 シェーディング補正設定スイッチ
81 自然画用階調処理手段
82 選択スイッチ
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image processing technique for video and image-related equipment, and an image processing method suitable for correcting shading of an image taken by a sensor in which shading (luminance difference due to uneven illumination) such as a CCD camera occurs. The present invention relates to an image processing apparatus.
[0002]
[Prior art]
An image taken with an area sensor such as a CCD camera may have a dark shadow on the image after digital processing due to the influence of shading. In particular, the influence of shading tends to appear in a portion near the edge of the image (referred to as the peripheral portion of the image). Furthermore, compared to the case of capturing natural images such as landscapes, the effect of shading is noticeable in the image and is more visually appealing when images with line drawings such as text and figures in a uniform background color are captured. In many cases, the result is no image.
[0003]
Recently, small portable information processing devices that incorporate not only handwritten input information but also a built-in CCD camera that can capture images have been put into practical use. This small portable information processing device is provided with a display unit for displaying captured information at the same time as capturing, or for reading and displaying already captured information. As a display unit of such a small portable device, a reflective liquid crystal display device (LCD) is often used in consideration of battery life.
[0004]
In general, the LCD has a small number of display gradations, for example, about 4 gradations in many cases. On the other hand, a CCD camera using a CCD image sensor has a high number of gradations, such as 256 gradations. Therefore, when displaying an image captured by the CCD camera on the LCD, it is necessary to reduce the number of gradations.
[0005]
When performing the process of reducing the gradation, if an image whose periphery has been darkened due to the influence of shading as described above, for example, quaternary processing is performed, the dark image in the periphery of the processed image is crushed black. It may appear as
[0006]
Therefore, it becomes necessary to correct the influence of shading on the image affected by the shading.
[0007]
As a conventional shading correction method, after capturing image data for one screen affected by shading, the screen is divided into several areas so that the brightness is similar, and the whole is smooth. Some perform processing that changes the brightness (Science Technical Report, IE96-21, 1996-09, “Study on Binarization of Images Captured with CCD Camera”).
[0008]
[Problems to be solved by the invention]
In this prior art, when shading correction is performed, image data for one screen is captured and divided into several regions. Therefore, a large capacity for storing at least one screen of image data is provided as a work memory. You will need some memory.
[0009]
However, CCD cameras are often used for small devices. In particular, it will be used more frequently in portable information processing devices such as electronic notebooks in the future. In this type of equipment, not only miniaturization and weight reduction but also cost reduction is required, and there are significant restrictions on the parts to be used. Therefore, it is desirable to use a work memory having a capacity as small as possible.
[0010]
The subject photographed by the CCD camera is not only a line drawing but also a natural image such as a landscape. As described above, when these images are displayed on a display unit with a small number of gradations, it is necessary to perform a process of reducing the number of gradations (for example, a process of changing 256 gradations to 4 gradations). is there.
[0011]
As a process to reduce the number of gradations, the “Otsu's method” (The Institute of Electrical Communication, '84 / 4, vol.J63-D No.4 page 349), error diffusion method, dither method, etc. are applied. It can respond.
[0012]
The aforementioned “Otsu's method” is a technique suitable for setting a threshold value for binarization. For example, in the case of quaternarization using this, first, a process for determining a threshold value for binarization is performed, and then each region divided by the threshold value is processed. Similarly, a process of obtaining a threshold value is performed. This method is effective for an image that requires a clear preservation of edges, such as a line drawing, although there is a large amount of remaining performance for performing n-value conversion.
[0013]
On the other hand, the error diffusion method and the dither method have a drawback that it is difficult to preserve edges because they are intended to produce gradation in terms of area. For this reason, when an image with a line drawing such as a character or figure in a bright background is captured and gradation conversion is performed, the edge of the line drawing, which is significant information, tends to be unclear. There is a problem that a good-looking image cannot be obtained.
[0014]
In this way, binarization processing using a fixed threshold by the method of Otsu is suitable for line drawings such as characters and figures, and an attempt is made to produce gradation in terms of area for natural images. An error diffusion method or dither method gradation is suitable. Therefore, in order to reduce gradation, it is desirable to select a gradation processing method and perform gradation processing according to whether it is a line image or a natural image.
[0015]
Therefore, the present invention has an object to reduce the capacity of work memory by first removing the influence of shading in units of a predetermined line for line drawings such as characters and figures that are likely to show the influence of shading. One object is to reduce the size and weight of the entire apparatus and to reduce the cost.
[0016]
Further, by combining this shading correction and n-value conversion processing with n-1 threshold values, the influence of the shading is eliminated on the image with shading taken by an area sensor such as a CCD camera. In addition, it is possible to reduce the gradation with the edge preserved, and further determine whether or not the image is a line drawing, and perform shading correction only when the image is a line drawing, so that shading is conspicuous. Shading correction processing can be performed only on line drawings that are likely to appear, reducing processing and shortening processing time. Further, it is determined whether or not the image is a line image. If the image is a line image, shading correction is performed, and gradation processing using n−1 thresholds is performed. By performing gradation processing using a gradation processing method suitable for the image, when an image taken with an area sensor that is prone to shading such as a CCD camera is displayed on a reflective LCD or the like, The purpose is to automatically perform a process suitable for the photographing object regardless of the image and display a good image.
[0018]
[Means for Solving the Problems]
As a specific method, for each predetermined line of the input image data, it is determined whether or not the pixels constituting the predetermined line are pixels constituting the edge portion of the line drawing. The luminance value of the pixel being processed is calculated based on the luminance value of the corresponding pixel position on the previously processed line, and the previously processed luminance value is updated with this calculated luminance value. However, in the case of a pixel constituting an edge, the process of holding the luminance value of the corresponding pixel position on the previously processed line as it is is repeated for each pixel constituting the predetermined line for each predetermined line. Thus, after performing the background prediction processing to obtain the luminance value for each pixel in which the influence of the luminance of the edge portion in the line drawing is removed in a predetermined line unit, When it is determined that the luminance value for each pixel in the line is less than or equal to the desired luminance value, a predetermined search range including pixels having the luminance value is set, and the adjacent pixels in the search range Check the luminance change for each pixel, and if the number of pixels with little luminance change in the search range is more than the preset number, determine the luminance value based on the luminance value of the pixel with little luminance change, and search If the number of pixels with little luminance change in the range is less than the preset number, the luminance value is determined based on the luminance value of the pixels in the entire search range, and the background prediction result is corrected based on the determined value. The result is further corrected by comparing the result corrected by the correction process of the background prediction result with the luminance value set as a desired value, and the obtained difference is input. Picture By adding or subtracting to the corresponding luminance value of the pixel position data it is characterized by performing the background correction such that a desired luminance values.
[0019]
As described above, according to the present invention, the influence of shading is removed in units of a predetermined line for line drawings such as characters and figures that are likely to have a significant influence on shading. In particular, by performing processing for each line, it is possible to reduce the capacity of the work memory because only one line of work memory is required as the work memory, and since processing is performed for each line, Since it can be displayed when processing of one line is completed while capturing, and is displayed when processing of the next one line is completed, there is an advantage that it is easy to cope with continuous input. Furthermore, the process of calculating the luminance value of the pixel to be processed based on the luminance value of the pixel at the corresponding pixel position on the processed line is the luminance at the corresponding pixel position on the previously processed line. This is a process of averaging the value and the luminance value of the pixel being processed. Thereby, the influence of the brightness | luminance of an edge part can be reduced by simple calculation.
[0032]
The specific apparatus includes an image data line memory that holds data for a predetermined line of input image data, and a predetermined line for each predetermined line of image data held in the image data line memory. Judgment is made as to whether or not the constituent pixel is a pixel constituting the edge portion of the line drawing, and if it is not a pixel constituting the edge, processing is performed based on the luminance value of the corresponding pixel position on the line processed before that. The luminance value of the pixel inside is calculated, and the previously processed luminance value is updated with the calculated luminance value. If the pixel constitutes an edge, the luminance value on the previously processed line is updated. The process of retaining the luminance value of the corresponding pixel position as it is is repeated for each pixel that constitutes the predetermined line for each predetermined line, so that the influence of the luminance of the edge portion in the line drawing A background prediction means for obtaining a luminance value for each pixel in the removed processing target line in units of lines, a background prediction line memory for holding a luminance value for each pixel in the processing target line obtained by the background prediction means, Based on the content of the background prediction line memory obtained in the background prediction process, when it is determined that the luminance value corresponding to each pixel position in the processing target line is less than or equal to the desired luminance value, A search range of a predetermined range including pixels having luminance values is set, the luminance change with the adjacent pixels in the search range is examined for each pixel, and the number of pixels with little luminance change in the search range is equal to or more than a preset number. In some cases, the luminance value is determined based on the luminance value of the pixel having a small luminance change, and the number of pixels having a small luminance variation in the search range is smaller than the preset number. In this case, the brightness value is determined based on the brightness value of the pixels in the entire search range, and the content of the corresponding pixel position in the background prediction line memory is updated to the determined content to correct the background prediction result. The background prediction correction means for performing the correction, the result corrected by the background prediction result correction means, and the luminance value set as a desired value are compared to obtain the difference, and the obtained difference is used for the image data And background correction means for correcting the luminance to a desired luminance value by adding or subtracting the luminance value at the corresponding pixel position of the line memory.
[0033]
As described above, according to the present invention, the influence of shading is removed in units of a predetermined line for line drawings such as characters and figures that are likely to have a significant influence on shading. In particular, by performing processing for each line, the work memory requires only one line of image data line memory and background prediction line memory, so that the capacity of the work memory can be reduced, and the entire apparatus can be reduced in size. The weight can be reduced and the cost can be reduced. In addition, since it is a process for each line, it can be displayed when one line process is completed while capturing an image, and can be displayed when the next one line process is completed. There is an advantage that it is easy to cope with various inputs.
[0034]
Furthermore, the process of calculating the luminance value of the pixel to be processed based on the luminance value of the pixel at the corresponding pixel position on the processed line is the luminance at the corresponding pixel position on the previously processed line. This is a process of averaging the value and the luminance value of the pixel being processed. Thereby, the influence of the brightness | luminance of an edge part can be reduced by simple calculation.
[0045]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0046]
(First embodiment)
In the first embodiment, it is assumed that the image to be captured is an image in which line drawings such as characters and figures are drawn in a substantially uniform background, and the image is affected by shading. And FIG. 1 is a flowchart for explaining the overall schematic processing of the first embodiment, and the processing procedure will be described below.
[0047]
First, a schematic process will be described, and each detailed process will be described later.
[0048]
In FIG. 1, background prediction is performed to predict the background of one line of image data captured by the CCD camera (step s1). Then, the prediction result is corrected using the background prediction result (step s2), and the background correction is performed with reference to the correction data of the prediction result (step s3). Then, it is determined whether or not the processing of all the lines on one screen has been completed (step s4). If not completed, the processing from step s1 is performed on the next line.
[0049]
The background prediction process is performed as follows.
[0050]
FIG. 2 shows an example of an image for one screen captured by a CCD camera. A line drawing 20 such as characters is present on a bright uniform background 10. Although not shown in FIG. 2, it is assumed that the peripheral portion of the image is darker than the central portion due to the influence of shading.
[0051]
FIG. 3A shows pixels (respective pixel numbers “0, 1, 2,..., I,...) In one line (for example, one line shown by a broken line in FIG. 2) of the image as shown in FIG. .., N ") and the luminance value (with a luminance range of 0 to 255), and the portion where the luminance value is drastically dropped is the luminance of the pixels constituting the character The others indicate the luminance of the pixels constituting the background. In this case, the change in the luminance of the character portion on one line indicated by the broken line in FIG. 2 and the luminance in FIG. 3 do not necessarily match. Also, since this image is affected by shading, the luminance change curve of the background portion is a curve in which the luminance near the center of the image is high, and the luminance decreases as it approaches the both ends.
[0052]
In order to remove the influence of shading on the background affected by such shading, first, a process of removing the influence of characters almost and smoothing the luminance change of the background portion is performed. This is referred to herein as background prediction processing. This background prediction process will be described with reference to the flowchart of FIG.
[0053]
In FIG. 4, it is first determined whether or not the processing target line is the first line (step s11). If it is the first line, the luminance of each pixel constituting the first line is stored in the prediction result buffer as it is corresponding to the pixel (step s12). On the other hand, if the line to be processed is not the first line, the processing after step s13 is entered.
[0054]
In step s13, the luminance value a [i] of the pixel to be processed in the line is subtracted from the luminance value a [i-1] of the pixel immediately before the pixel to be processed, and the difference is set to C. Next, the absolute value of C obtained in step s13 is compared with a predetermined constant α (step s14) to determine whether the pixel is a pixel at the edge portion of the character or any other pixel. To do. That is, when the luminance range of the captured image data is 0 to 255, here, α is set to about “10”, and if | C | ≦ α, the pixel is a pixel constituting the background portion. If | C | ≦ α, it is regarded as a pixel at the edge portion of the character. Note that the value of α is not limited to “10”, and an optimal value can be set according to various conditions.
[0055]
When it is determined that the processing target pixel is a background pixel by this process, the contents of the prediction result buffer corresponding to the processing target pixel are updated. That is, in the contents of the prediction result buffer, the luminance value of the pixel corresponding to the position of the pixel to be processed is added to the luminance value of the pixel to be processed and divided by 2, that is, the average is taken and the calculation is performed. The result is stored in the corresponding pixel position in the prediction result buffer (step s15). This will be described more specifically.
[0056]
If the numbers of pixels for one line are represented by 1, 2,..., I,..., N, the prediction result buffer has a luminance value b [1] corresponding to each pixel for one line. , B [2], ..., b [i], ..., b [n] are stored. Then, if the current pixel to be processed is the i-th pixel of a certain line, the luminance value a [i] of the pixel to be processed and the i-th pixel of the previous line already stored in the prediction result buffer The average of the luminance value b [i] of the pixel is taken, and that value is used as new data as b [i] of the prediction result buffer. Since it is considered that there is no sudden change in the brightness of the background, taking an average provides a background prediction resistant to noise.
[0057]
Next, it is determined whether or not the processing has been completed for all the pixels in one line currently being processed (step s16). If the processing has not been completed, the processing in step s13 is performed for the next pixel in the line. If | C | ≦ α in step s14, it is determined that the pixel is a pixel constituting the background portion, and the processes in steps s15 and s16 are performed. As described above, the prediction result buffer stores, for each pixel at each position, the average luminance value of the pixel at the same position on the previous line and the pixel currently being processed.
[0058]
Then, when the processing for all the pixels in the one line is completed, the process proceeds to a prediction result correction process. This process will be described in detail later.
[0059]
As described above, when each pixel in the processing target line is considered to be the background, the calculation result so far (the average value of the luminance values of the pixels at the corresponding positions in the processed line) is calculated. The average of the calculation result and the luminance value of the currently processed pixel is obtained and stored in the prediction result buffer as new data. In the next line, the pixel at the corresponding position is regarded as the background. If it is, the average of the calculation result and the luminance value of the pixel currently being processed is obtained using the previous calculation result (average value of the luminance value of the pixel at the corresponding position) A process of storing the data in the prediction result buffer is performed.
[0060]
On the other hand, if it is determined in step s14 that | C | ≦ α is not satisfied, that is, if it is determined that the pixel to be processed is a pixel constituting the edge portion, the change in luminance of the background is gentle. No processing is performed in consideration of the removal of the influence of edge portions constituting characters and the like. Therefore, the value of the prediction result buffer is not changed, and the data obtained up to the previous line is retained as the luminance value at the position corresponding to the pixel.
[0061]
FIG. 3B is a curve showing the luminance change for each pixel in a certain line (the same line as FIG. 3A) after the background prediction process as described above is performed. As can be seen from FIG. 3B, the prediction of the luminance of the background portion due to the influence of shading is smooth to some extent as compared with FIG. Note that. In FIG. 3B, L0 indicates a desired luminance value when attempting to obtain a certain luminance value by removing the influence of shading.
[0062]
Further, in FIG. 3B, there is still a portion where the brightness is rapidly reduced. This is caused by the influence of character data other than the edge portion used in the background prediction processing so far.
[0063]
That is, step s14 in the flowchart of FIG. 4 is described as background when | C | ≦ α, and edge when | C | ≦ α, but in actuality, a character has a certain width and width. In the case of a pixel constituting a line portion, the relationship | C | ≦ α is established between adjacent pixels, and the processing of step s15 is performed using the data of the line portion. become. Therefore, the portion where the luminance in FIG. 3B is drastically decreased is caused by a little influence of characters. Correcting this is the process of correcting the prediction result. In the prediction result correction process, the prediction result correction process is performed using the data in the prediction result buffer (step s2). This correction process of the prediction result is a process of correcting the background centering on the portion where the influence of characters remains, and obtaining a luminance curve of only the background. Hereinafter, refer to the flowchart of FIG. 5 for the correction process of the prediction result. While explaining.
[0064]
In FIG. 5, first, the desired luminance L0 is compared with the luminance b [i] of one pixel in the processing target line (step s21), and L0> b [i], that is, the predicted value is higher than the desired luminance L0. If the brightness of a certain pixel in the result buffer is small, the correction is performed assuming that the pixel remains affected by the character and the brightness has dropped. This correction process is performed according to the procedure after step s22.
[0065]
First, a search range is set (step s22). The search range is set by setting about 1/10 of the width on one line in the image as the search range centering on the processing target pixel, and setting the pixels in the range as the search range pixel. For example, in FIG. 3B, when the pixel at the position i is determined as L0> b [i], the search range w is set around the pixel as shown in the figure.
[0066]
Once the search range is set in this way, initialization is performed next (step s23). In this initialization, add [1] is set to 0, count is set to 0, add [2] is set to 0, and ref is set to the prediction result of the immediately preceding pixel. These meanings will be described in the processing description of steps s24, s25, and s26 for easy understanding.
[0067]
In step s24, it is determined whether or not the value obtained by subtracting the prediction result b [j] of a pixel in the search range from ref is smaller than a predetermined constant β. That is, ref−b [j] <β is determined. Here, j is a variable indicating the position within the search range set in step s22. Also, β is set to about β = 20 when the luminance range of the image is 0 to 255. This value β is not limited to this, and may be an optimum value depending on various conditions.
[0068]
If ref−b [j] <β, the prediction result of the processing target pixel is good because the prediction result of the processing target pixel is relatively small from the prediction result of the previous pixel. It is determined that the brightness change is smooth. When it is determined that the prediction result of such a processing target pixel is good, the prediction result of the processing target pixel is newly added to the previous add [1], and this is added [1]. . Further, the number of pixels determined to be good is added to the count so far (step s25).
[0069]
Thus, add [1] is a value obtained by adding the prediction results of pixels having a good prediction result within the search range, and count represents the number of pixels.
[0070]
Here, if the pixel to be processed is the first pixel in the search range, add [1] is “0” as an initial value and count is also “0” as an initial value. After the process for, the value of add [1] becomes the prediction result of the pixel itself, and count becomes “1”.
[0071]
Next, in step 26, the prediction result of the pixel to be processed is newly added to the previous add [2], and this is added [2]. For example, if the prediction result of the treatment target pixel is b [j], add [2] + b [j] is set, and the result is a new add [2]. This add [2] is a value obtained by adding the prediction results of the pixels in the entire search range regardless of whether the prediction result is good or not. For example, if the pixel to be processed is the first pixel in the search range, add [2] is “0” as an initial value. Therefore, after processing for the first pixel, add [2] The value is the prediction result itself of the pixel.
[0072]
By the way, in step s24, when ref−b [j] <β is not satisfied, the prediction result of the processing target pixel is largely different from the prediction result of the immediately preceding pixel. Is determined to be an unfavorable value, that is, a pixel that remains affected by characters other than the background. As described above, when it is determined that the prediction result of the processing target pixel is not good, the process of step 26 is directly performed, and the prediction result of the processing target pixel is newly added to the previous add [2]. Let it be add [2]. Thus, add [2] is a value obtained by adding the prediction results of the pixels in the entire search range regardless of whether the prediction result is good or not.
[0073]
Next, it is determined whether or not the processing has been completed for all the pixels in the search range (step s27). If not, the processing in steps s24, s25, and s26 is performed for the next pixel in the search range. Do.
[0074]
When the processing is completed for all the pixels in the search range in this way, a correction value determination process is performed (step s28). This correction value determination process is performed as follows.
[0075]
First, after the processing (steps s24 to s26) for each pixel in one search range is completed, the number of counts, that is, the number of pixels having a prediction result determined to be good is determined. When the number reaches a certain number or more, the value of add [1] (this value is the cumulative value of the prediction results determined to be good) is divided by the number of counts to obtain an average prediction. Find the result. Then, the average prediction result obtained in this way is set as the corrected luminance value of the prediction result for the pixel (step s21) that satisfies L0> b [i]. The reason why the number is set to a certain number or more is that the correction of the prediction result in step s2 is performed based on the statistic and is not appropriate as the statistic when the number of samples is small.
[0076]
On the other hand, when the number of pixels having the prediction result determined to be good does not reach a certain number or more, that is, when the number of pixels having the prediction result determined to be good is small, it is obtained in step s26. The predicted result accumulated value add [2] in the search range is divided by the total number of pixels in the search range to obtain an average prediction result in the search range, and the average prediction result in the search range is expressed as L0. The corrected luminance value of the prediction result for the pixel (step s21) with> b [i] is set.
[0077]
As described above, this correction process is performed by calculating the average of the cumulative values of the prediction results determined to be good when there are a certain number of pixels that are determined to be good within a set search range. When the luminance value of the processing target pixel is corrected using the prediction result and the number of pixels having the prediction result determined to be good is small, an average prediction result of the prediction result cumulative value of the entire search range is obtained, Using the average prediction result of the entire search range, the luminance value of the processing target pixel is corrected.
[0078]
When the process for a certain pixel is completed as described above, it is next determined whether or not the process has been completed for all the pixels in the currently processed line (step s29). The process returns to step s21 and the processes after step s21 are performed again.
[0079]
FIG. 3C shows the prediction result of the background portion where the influence of the characters is almost eliminated after the above-described correction processing of the prediction result is completed.
[0080]
Next, using such a background prediction result, a background correction process is performed to obtain a constant luminance value from which the influence of shading is removed (step s3).
[0081]
This background correction processing is performed by setting a desired luminance value for each pixel of the processing target line in the luminance curve of the processing target line on which the prediction result correction processing shown in FIG. For example, the difference between a certain luminance value L0 and the luminance curve corrected for the prediction result is taken for each pixel, and the difference is set to 0 so that the difference is zero. This is done by adding or subtracting an appropriate value for luminance. Thereby, the luminance of the background becomes a certain luminance value L0, the luminance becomes constant, and the influence of shading is removed.
[0082]
Finally, the luminance distribution including the character portion in the processing target line is as shown in FIG. The image after the above processing has been performed for all lines is an image in which the entire screen has a substantially uniform light background and the influence of shading is removed.
[0083]
FIG. 6 shows an example of the configuration of an apparatus for realizing the embodiment of the present invention. The apparatus includes a lens 1, a CCD camera 2, an A / D converter 3, a CCD control circuit 4, and an image processing device 5. Yes.
[0084]
The image processing apparatus 5 is a part that performs the processing described so far, and includes an image data line memory 51, a background prediction line memory 52, a background prediction unit 53, a prediction result correction unit 54, and a background correction unit 55. The background prediction line memory 52, the background prediction unit 53, the prediction result correction unit 54, and the background correction unit 55 constitute a shading correction unit 56.
[0085]
The image data line memory 51 is a memory for storing data for one line of image data captured by the CCD camera 2 and A / D converted. Then, the background prediction means 52 performs the background prediction processing as described in the flowchart of FIG. 4 using the image data for one line stored in the image data line memory 51, and performs this background prediction. The background prediction line memory 52 is used as the work memory. The background prediction line memory 52 corresponds to the prediction result buffer in FIG. 4, and when the processing of all pixels in one line is completed, the prediction result of each pixel in the line corresponds to each pixel. Stored in
[0086]
The prediction result correcting means 54 performs the background result correcting process described with reference to the flowchart of FIG. 5, and performs the correcting process according to the processing procedure of FIG. 5 using the contents of the background prediction line memory 52. Then, the data in the background prediction line memory 52 is updated to the corrected data.
[0087]
Further, the background correction means 55 performs the processing of step s3 in the flowchart of FIG. 1, and uses the data of the background prediction line memory 52 in which the corrected data is stored to the contents of the image data line memory 51. The background is corrected for the final image as shown in FIG.
[0088]
The above processing is performed for each line. When the processing for one line is completed while the image is being captured, the processing is displayed. When the processing for the next one line is completed, the processing is displayed. Perform continuous processing.
[0089]
As described above, according to the first embodiment, the background portion is predicted so as not to be affected by the line drawing portion, and the background portion is predicted using the data obtained in the previous line. Therefore, a background image having a large luminance change due to shading can be changed to a gentle luminance change, and finally a background image having a desired luminance from which the influence of shading has been removed can be obtained.
[0090]
Further, as can be seen from the configuration of FIG. 6, since only the line memory is required as the work memory, the memory capacity can be reduced as compared with the case where the frame memory for one screen is used. Further, as described above, since the processing is performed for each line, it is displayed when the processing for one line is completed while capturing an image, and is displayed when the processing for the next one line is completed. Therefore, it is possible to obtain an effect that it is easy to cope with continuous input.
[0091]
In FIG. 1, the background prediction (step s1) can be omitted, and the input image data can be viewed as the background prediction result in step s1, and the processing after step s2 can be performed. In this case, the processing speed is increased, but the accuracy of the background prediction obtained in step s2 is reduced.
[0092]
(Second Embodiment)
In the second embodiment, a process that combines the shading correction process described in the first embodiment and the process of reducing the gradation is performed.
[0093]
That is, as described in the section of the prior art, when an image captured by an imaging means having a large number of gradations such as a CCD camera is displayed on a display unit having a small number of gradations such as a reflective LCD. It is necessary to reduce the number of gradations. When the gradation is lowered, if the image whose periphery is darkened due to the influence of shading as described above, for example, is converted into a four-valued image, the dark portion of the periphery of the processed image becomes blackish. It may appear. Therefore, when performing a process of reducing gradation, it is necessary to correct the influence of shading on an image affected by the shading.
In the second embodiment, even for an image with shading taken by an area sensor such as a CCD camera, it is possible to eliminate the influence of the shading and reduce the gradation. This second embodiment will be described.
[0094]
FIG. 7 is a flowchart for explaining the overall processing procedure of the second embodiment. First, first to n-1th threshold values for n-value conversion are obtained from the processing target image (step s31). ). This is a process for obtaining first to third threshold values when, for example, image data of 256 gradations from 0 to 255 input by a CCD camera or the like is converted to image data of 4 gradations. is there.
[0095]
Then, a shading correction process (step s32) is performed, and then an n-value conversion process is performed using the first to n-1th threshold values (step s33).
[0096]
The process for obtaining n-1 threshold values for n-value conversion in step s31 is not particularly limited. For example, if the object to be imaged is a line drawing, the “Otsu method” is expanded. It is also possible to use it.
[0097]
As described above, this “Otsu's method” is a binarization method suitable for a line drawing. However, when attempting to use the binarization method, the binarization is first performed and then divided. Since the binarization process needs to be performed three times, such as further binarizing each region, the amount of calculation becomes enormous, and there is a problem that a lot of processing time is required.
[0098]
Therefore, in the second embodiment, as a method for obtaining n−1 threshold values for n-value conversion, n−1 thresholds can be obtained by adding a slight calculation to the “Otsu's method”. A method for obtaining a value is adopted. A method of obtaining n-1 threshold values for n-value conversion will be described below with reference to the flowchart of FIG.
[0099]
First, a cumulative frequency distribution is obtained for image data captured by a CCD camera (step s41). An example of the obtained cumulative frequency distribution is shown in FIG. Note that the processing target image here is an image in which line drawings such as characters and figures are drawn in a bright background occupying most of the image, as described above. Therefore, as shown in FIG. 9A, the cumulative frequency curve for each luminance in the luminance range of 0 to 255 is a curve in which the cumulative frequency increases on the higher luminance side. In this case, the luminance range by the CCD camera is 256 gradations from 0 to 255.
[0100]
Then, the binarization threshold th [0] is obtained by the “Otsu's method” using such cumulative frequency distribution. Of the areas divided by the binarization threshold, the low luminance side is the first class C1, and the high luminance side is the second class C2. Here, the accumulated luminance of the first class C1 is mainly due to the line drawing, and the accumulated luminance of the second class C2 is mainly due to the background.
[0101]
Next, the average luminance [mu] 2 and standard deviation [sigma] 2 in the second class C2 are calculated (step s42). Since most of the second class C2 is occupied by the background, the average luminance value μ2 in the second class C2 can be considered as an average value of the background luminance. Then, a first threshold th [1] is obtained from n−1 thresholds for n-value conversion using the average μ2 of brightness and the standard deviation σ2 (step s43). The first threshold th [1] is
th [1] = μ2−σ2 × α (1)
Is required. In the equation (1), α is a coefficient, and in the experiment, a good result was obtained when α = ½. However, the present invention is not limited to this, and an optimal value may be set according to various conditions. .
[0102]
The first threshold th [1] obtained by the equation (1) means an almost boundary between the line drawing and the background. It is considered that the boundary between the line drawing and the background exists on the darker side than the average value μ2 of the background luminance. Accordingly, the first threshold th [1] may be a value obtained by subtracting a certain value from the average value μ2 of the background luminance.
[0103]
By the way, even if the background color is uniform, the background luminance cumulative frequency varies depending on the device that inputs the image and the shooting state. In particular, in an image with shading taken by an area sensor such as a CCD camera, the width of the portion corresponding to the background in the cumulative frequency distribution varies greatly. Therefore, in order to absorb the width of the accumulated luminance, the standard deviation σ2 of the second class C2 serving as an index of the width is used as a parameter, and the parameter is multiplied by an appropriate coefficient α, which is subtracted from the average value μ2 of the background luminance. Thus, the first threshold th [1] is obtained. The first threshold th [1] obtained in this way is shown in FIG.
[0104]
Then, in step s44 of FIG. 8, another threshold value is obtained based on the first threshold value th [1]. Here, if the number of gradations to be obtained is n gradations, n-1 threshold values are determined. Accordingly, in this step s44, the second threshold th [2] to the (n-1) th threshold th [n-1] are obtained based on the first threshold th [1]. Become. A process for obtaining the second threshold th [2] to the (n−1) th threshold th [n−1] based on the first threshold th [1] will be described below.
[0105]
The total number of accumulated pixels is obtained by adding all the accumulated pixel numbers for each luminance below the first threshold th [1], and the total accumulated pixel number is divided into n-1 equal parts. In this embodiment, since the number of gradations to be obtained is 4 gradations (n = 4), the total obtained by adding the number of pixels for each luminance below the first threshold th [1]. The second threshold th [2] and the third threshold th [3] are obtained by dividing the cumulative number of pixels into three.
[0106]
As a specific example, if the total number of accumulated pixels obtained by adding all the accumulated pixels for each luminance below the first threshold th [1] is 120, it is divided into three equal parts. To get “40”. Then, a threshold value is set for every 40 pixels. In other words, the cumulative number of pixels for each luminance is added from the luminance 0 to the brighter side, and the point where the total number of pixels becomes 40 pixels is set as a threshold value (third threshold value th [3]). From the third threshold th [3], the cumulative number of pixels for each luminance is added to the brighter side, and the total pixel count becomes 40 pixels again (the second threshold th [2] ] And the second threshold value th [2], th [3] are determined.
[0107]
In this way, the first to (n-1) th threshold values are determined.
[0108]
By the way, the shading correction process in step s32 in FIG. 7 is a series of processes such as the background prediction process, the prediction result correction process, and the background correction process described with reference to FIGS. 1 to 6 in the first embodiment. Since the processing methods are the same as described above, the detailed processing is omitted here.
[0109]
In the second embodiment, the desired luminance value L0 is preferably a value larger than the first threshold th [1] set on the highest luminance value side. In this way, by setting the desired luminance value L0 to a value larger than the first threshold th [1] set on the side with the highest luminance value, the background becomes clear after the n-value conversion processing. The image becomes brighter and easier to see. As a specific example, it is conceivable that the luminance is about an average value μ2 in the second class C2.
[0110]
Next, after the shading correction is completed, an n-value conversion process is performed using the first to (n-1) th threshold values. An example of this n-value conversion processing will be described with reference to FIG. Note that the flowchart of FIG. 10 shows an n-value conversion process for each pixel. In FIG. 10, first, initialization of which threshold value among the first to n-1th threshold values is selected is performed (step s51). This initialization is in this case k = 1. That is, the initial threshold value is the first threshold value th [1]. Next, it is determined whether or not the luminance value a of the pixel to be processed is a> th [k] (step s52). In this case, since k = 1, a> th [1] is determined. If a> th [1], the luminance value of the pixel is set to nk (step s53). Here, considering that the luminance value of a pixel is quaternized from 0 to 3, when a> th [1], n = 4 and k = 1, so the luminance value of the pixel is “3”.
[0111]
In this manner, when the n-value conversion (four-value conversion in this case) of one pixel is completed, the process proceeds to the next pixel n-value conversion. Also for the next one pixel, similarly to the above, it is determined whether the luminance a is a> th [1]. If a> th [1] is not satisfied, the process proceeds to step s54, and k is set to k + 1 (in this case, k = 2). Then, k <n is determined (step s55). If k <n, the process returns to step s52 to determine whether a> th [2] is satisfied. If a> th [2], the luminance value of the pixel is set to nk (step s53). At this time, since n = 4 and k = 2, the luminance value of the pixel is “2”. On the other hand, in the determination of a> th [2] in step s52, if a> th [2] is not satisfied, the process proceeds to step s54, and k is set to k + 1. As a result, k = 3, and k <n is determined (step s55). If k <n, the process returns to step s12 to determine whether a> th [3]. If a> th [3], the luminance value of the pixel is nk. At this time, since n = 4 and k = 3, the luminance value of the pixel is “1”. Then, the same processing is performed for the next pixel.
[0112]
FIG. 11 shows an example of the configuration of an apparatus for realizing the second embodiment, and schematically, like FIG. 6, the lens 1, the CCD camera 2, the A / D converter 3, and the CCD control. The circuit 4 and the image processing device 5 are included.
[0113]
The image processing apparatus 5 is a part that performs the processing described in the second embodiment, and includes an image data line memory 51, a threshold value calculation unit 61, an n-value conversion processing unit 62, and a shading correction unit 56. ing.
[0114]
The shading correction unit 56 is the same as the shading correction unit 56 shown in FIG. 6 and includes a background prediction line memory 52, a background prediction unit 53, a prediction result correction unit 54, and a background correction unit 55. Here, these illustrations are omitted. Further, since the processing content performed by the shading correction unit 56 has been described in the first embodiment, the description thereof is omitted here.
[0115]
The threshold value calculation means 61 calculates first to (n-1) th threshold values for n-value conversion, and an example of the threshold value calculation is as shown in the flowchart of FIG. N-1 threshold values are calculated by the processing. However, in practice, the first to (n-1) th threshold values are obtained from the image data for one screen captured immediately before, and the processing is performed while the threshold values are reflected in the next one screen image. Do.
[0116]
The operation of this image processing apparatus will be described below.
[0117]
The image data for each line captured first is subjected to shading correction by the shading correction unit 56 by the process as described above. At the same time, the threshold value setting means 61 uses the data for each line stored in the image data line memory 51 to obtain data necessary for calculating the threshold value, and inputs one screen. When the processing is completed, the first to (n-1) th threshold values are obtained by the processing procedure of FIG. The first to (n-1) th threshold values obtained in this way are used as threshold values in the next one-screen image.
[0118]
When the data for one line in the next screen is taken into the image data line memory 51, the data for the one line is subjected to shading correction, calculated by the n-value conversion processing unit 62 from the previous screen, The n-ary process is performed using the first to (n-1) th threshold values. At the same time, the threshold value determining means 61 uses the data for one line of the processing target screen stored in the image data line memory 51, and uses the data for one screen to obtain the first to n-th data. A threshold value of −1 is calculated, and this is set as new first to n−1th threshold values. In this way, the first to (n-1) th threshold values are calculated from the image data for one screen captured immediately before, and the processing is performed while reflecting it in the image for the next one screen.
[0119]
Note that the n-value conversion processing here is an n-value conversion processing using a fixed threshold value such as the first to (n-1) th threshold values, and a character that particularly needs to preserve edges. N-value suitable for line drawings such as. Therefore, the threshold value calculation unit 61, the shading correction unit 56, and the n-value conversion processing unit 62 are herein referred to as a line drawing gradation processing unit 63.
[0120]
In FIG. 7, the processing steps can be performed in the order of step s32, step s31, and step s33.
[0121]
As described above, according to the second embodiment, an image captured by an imaging means having a large number of gradations such as a CCD camera is displayed on a display unit having a small number of gradations such as an LCD. In this case, when performing gradation reduction processing, it is possible to reduce the gradation by eliminating the influence of the shading even on an image image with shading, and line drawings such as characters are drawn on a light background. Therefore, it is possible to remove the influence of shading and obtain a good image without being crushed and to obtain an image that is extremely easy to see.
[0122]
(Third embodiment)
In the third embodiment, it is determined whether or not the processing target image is a line drawing, and the shading correction described so far is performed only on the line drawing. This is because, in the case of a line drawing, the influence of shading appears more conspicuously than that of a natural image, and therefore shading correction is performed only when the target image is a line drawing.
[0123]
FIG. 12 is a flowchart schematically illustrating the overall processing procedure of the third embodiment, in which processing for determining whether or not the processing target image is a line drawing is performed (step s61). Based on the processing result, it is determined whether or not the image is a line drawing (step s62), and shading correction processing is performed only when it is determined that the image is a line drawing (step s63).
[0124]
The line drawing determination process here will be described with reference to the flowchart of FIG. First, initialization is performed (step s71). In this initialization, the switch sw for determining the rise or rise of the luminance change is set to “1” (“1” is set when the fall is determined, and “0” is set when the rise is determined). The value leng indicating the total length of the width of the line drawing portion is “0”, and the value num indicating the number of lines is “0”.
[0125]
Then, the luminance value a [i−1] of the immediately preceding pixel is subtracted from the luminance value a [i] of the processing target pixel, and the difference is set as C (step s72).
[0126]
Next, the state of the switch sw for determining the rising or the rising of the luminance is determined (step s73). Here, since sw = “1” as an initial setting, the falling detection process is performed to determine whether or not C ≦ −γ (step s74). Here, γ is a value serving as an index for determining the falling or rising, and is set to about γ = 15 when the input image has 256 gradations. However, this value may be set to an optimum value according to various conditions.
[0127]
In step s74, if C ≦ −γ, it is determined that the luminance value has fallen by a predetermined value or more, and in order to detect the rise as the next processing, the switch sw = “0” and the pixel of the pixel The position i is set as the start position (step s75). That is, the position of the pixel whose luminance value falls more than a predetermined value is stored.
[0128]
Then, it is determined whether or not the processing has been completed for all the pixels (step s76). If not completed, the processing returns to step s72, and the next pixel is compared with the luminance value of the previous pixel. (Step s72). Then, it is determined whether or not sw = “1”. At this time, since sw = “0”, detection of rising edge is started.
[0129]
In the detection of the rising edge, C ≧ γ is determined (step s77). If C ≧ γ, it is determined that the luminance value has risen above a predetermined value. If C ≧ γ, the rising edge is not higher than a predetermined value. to decide.
[0130]
For example, in the case shown in FIG. 14, in the pixel at the position i, when the luminance difference C from the immediately preceding pixel (the pixel at the position i−1) is C ≦ −γ, The position i is stored, and for the next pixel (the pixel at the position of i + 1), the difference in luminance value from the previous pixel is taken and C ≧ γ is determined. In this case, however, C ≧ γ is not satisfied. Again, it is determined whether C ≧ γ. When such processing is repeated and eventually C ≧ γ processing is performed for the pixel i + n, C ≧ γ is established, and a rising edge is detected.
[0131]
When the rising edge is detected, the process proceeds to step s78. In order to detect the falling edge as the next process, sw = “0” and a value “leng” indicating the accumulated character width is set so far. Add leng to this character width. That is, leng + {i−start} is calculated. In the example of FIG. 14, leng + {(i + n) −i} is calculated. Furthermore, 1 is added to num representing the cumulative number of lines so far.
[0132]
In this way, when the processing is completed for all the pixels constituting the image (step s76), the cumulative leng and num calculated in step s78 are used to divide the cumulative leng by the cumulative num, and 1 Judge the thickness of the line per piece. Then, the thickness per piece is compared with a certain value δ to determine whether or not it is a line drawing (step s79). Here, δ is set to about δ = 7 in the case of an image having a resolution of 320 × 240 pixels. However, this value may be set to an optimum value according to various conditions.
[0133]
Here, a line drawing has many high frequency components, and a natural drawing has many low frequency components. Therefore, leng / num indicating the average value of the line thickness is small for a line drawing and large for a natural drawing. Therefore, if leng / num ≦ δ, it is determined as a line drawing, and if not leng / num ≦ δ, it is determined that the image is not a line drawing such as a natural image (steps s80a and s80b).
[0134]
In this way, a determination is made as to whether to draw a line drawing or other than a line drawing. Only in the case of a line drawing, the shading correction processing described in the first embodiment is performed.
[0135]
FIG. 15 shows an example of the configuration of an apparatus for realizing the third embodiment, and schematically, like FIG. 6, the lens 1, the CCD camera 2, the A / D converter 3, and the CCD control. The circuit 4 and the image processing device 5 are included.
[0136]
The image processing apparatus 5 is a part that performs the processing described in the third embodiment, and includes an image data line memory 51, a line drawing determination unit 71, a shading correction unit 56, and shading for setting whether to perform shading correction. A correction setting switch 72 is provided.
[0137]
The shading correction unit 56 is the same as the shading correction unit 56 shown in FIG. 6 and includes a background prediction line memory 52, a background prediction unit 53, a prediction result correction unit 54, and a background correction unit 55. Here, these illustrations are omitted. Further, since the processing content performed by the shading correction unit 56 has been described in the first embodiment, the description thereof is omitted here.
[0138]
The line drawing determining means 71 performs the processing shown in the flowchart of FIG. 13. In this case, the actual processing is performed by using the result of determining whether or not the image is a line drawing from the image data for one screen captured immediately before. Process while reflecting the image for the screen.
[0139]
Therefore, in the initial setting, the shading correction setting switch 72 is, for example, off, that is, the first one screen is set as a processing setting for an image other than a line drawing.
[0140]
As described above, assuming that the shading correction setting switch 72 is set to OFF in the initial setting, the image data for each line captured first is output and displayed as it is without being subjected to shading correction. Is done. At the same time, the line drawing determination means 71 uses the data for each line stored in the image data line memory 51 to perform processing for one screen for each line in the processing procedure of FIG.
[0141]
When the processing for one screen is completed, it is determined whether or not the screen is a line drawing. This determination result is used to determine the type of the next one-screen image. For example, when it is determined that the first one-screen image is a line drawing, the shading correction setting switch 72 is turned on, and the next one screen is subjected to shading correction.
[0142]
As described above, when the shading correction setting switch 72 is turned on, the data for each line taken into the image data line memory 51 is subjected to shading correction for each line and then output for each line. At the same time, the line drawing determination means 71 uses the data for each line stored in the image data line memory 51 to perform processing for one screen for each line in the processing procedure of FIG. When the processing for one screen is completed, it is determined whether or not the screen is a line drawing. This determination result is used to determine the type of the next one-screen image. In this way, processing is performed while reflecting the result of determining whether or not the image is a line drawing from the image data for one screen captured immediately before, in an image for the next one screen.
[0143]
As described above, in the third embodiment, it is determined whether or not the processing target image is a line drawing, and shading correction is performed only for the line drawing in which the influence of shading appears more remarkably. Yes. In the third embodiment, a natural image other than a line drawing is not so conspicuous as being affected by shading, so that special processing is not performed. Therefore, the shading correction may be performed on the line drawing, which leads to a reduction in processing time.
[0144]
(Fourth embodiment)
In the fourth embodiment, it is determined whether or not the processing target image is a line drawing. If the processing target image is a line drawing, shading correction is performed, and the first to n-1th obtained as described above are performed. When gradation processing using the threshold value is performed and it is determined that the image is not a line drawing, it is regarded as a natural image and gradation changing processing suitable for the natural image is performed.
[0145]
FIG. 16 is a flowchart for explaining a schematic processing procedure according to the fourth embodiment. First, processing for determining a line drawing (step s81) is performed, and whether or not the drawing is a line drawing using the processing result. Is determined (step s82). If the image is a line image, line image gradation processing is performed (step s83). If the image is not a line image, natural image gradation processing is performed (step s84).
[0146]
The process for determining the line drawing in step s81 is the process described with reference to the flowchart of FIG. 13. If the result obtained by this process is a line drawing, the line drawing gradation process is performed. The gradation processing for line drawing is the processing described in the second embodiment. As a rough processing procedure, first, as shown in FIG. N-1 threshold values are obtained (step s31). This is processing for obtaining first to third threshold values in order to convert, for example, image data of 256 gradations from 0 to 255, which is input by a CCD camera or the like, into image data of 4 gradations. . Then, after performing shading correction processing (step s32), n-value conversion processing (step s33) is performed using n-1 threshold values.
[0147]
On the other hand, when it is determined that the image is not a line image, gradation processing suitable for a natural image is performed. The gradation processing suitable for the natural image is gradation processing for obtaining an area gradation, such as a dither method or an error diffusion method.
[0148]
In this way, gradation processing that preserves edges is performed on line images, and area gradation processing such as dithering and error diffusion is performed on natural images, so that the number of gradations is increased. When it is necessary to reduce the image quality, it is possible to obtain an image that is more visually appealing.
[0149]
FIG. 17 shows a configuration example of an apparatus for realizing the fourth embodiment. As in the first to third embodiments, the lens 1, the CCD camera 2, and the A / D are schematically shown. It comprises a converter 3, a CCD control circuit 4, and an image processing device 5.
[0150]
In the case of the fourth embodiment, the image processing apparatus 5 includes an image data line memory 51, a line drawing determination unit 71, a line drawing gradation processing unit 63, a natural image gradation processing unit 81, and a line drawing floor. A tone switch 63, a selection switch 82 for selecting a natural image gradation processor 81, and the like are provided.
[0151]
The line drawing determination means 71 is the same as the line drawing determination means 71 shown in the configuration of FIG. 15, and after the processing described in FIG. 13 is performed and the processing of one frame (for one screen) is completed, the image of the one screen is displayed. Is a line drawing or a line drawing, and a signal indicating that it is a line drawing or a signal indicating that it is not a line drawing is output to the selection switch 82.
[0152]
When the selection switch 82 receives a signal indicating that the image is a line image from the line image determining means 71, the selection switch 82 selects the line image gradation processing unit 63. When the selection switch 82 receives a signal indicating that the image is not a line image, the natural image gradation processing unit 81 is selected. The switching operation is performed so that is selected.
[0153]
The line drawing gradation processing unit 63 is the same as the line drawing gradation processing unit 63 described with reference to the configuration diagram of FIG. 11, and includes a threshold value determination unit 61, a shading correction unit 56, and an n-value conversion processing unit 62. It is composed of
[0154]
Incidentally, the line drawing determination means 71 performs the processing shown in the flowchart of FIG. 13. As described above, after the processing for one screen is completed, the result is reflected in the image data of the next one screen. Therefore, the selection switch 82 is, for example, on the natural image gradation processing unit 82 side in the initial setting.
[0155]
Therefore, the image data for each line captured first is subjected to gradation processing by the natural image gradation processing unit 82 and is output. At the same time, the line drawing determination means 71 uses the data for each line stored in the image data line memory 51 to perform processing for one screen for each line in the processing procedure of FIG. When the processing for one screen is completed, it is determined whether or not the screen is a line drawing. This determination result is used to determine the type of the next one-screen image. For example, when it is determined that the first one-screen image is a line drawing, the selection switch 82 is switched to the line drawing gradation processing unit 63 side, and the next one screen is a gradation by the line drawing gradation processing unit 63. Processing is done. At the same time, the line drawing determination means 71 uses the data for each line stored in the image data line memory 51 to perform processing for one screen for each line in the processing procedure of FIG. When the processing for one screen is completed, it is determined whether or not the screen is a line drawing. This determination result is used to determine the type of the next one-screen image. In this way, processing is performed while reflecting the result of determining whether or not the image is a line drawing from the image data for one screen captured immediately before, in an image for the next one screen.
[0156]
As described above, according to the fourth embodiment, it is determined whether or not the processing target image is a line drawing. If the processing target image is a line drawing, shading correction is performed and it is obtained as described above. When gradation processing for line drawing using the first to n-1th threshold values is performed and it is determined that the line drawing is not a line drawing, it is regarded as a natural image and a dither method or an error diffusion method suitable for the natural image is used. Since gradation change processing is performed, gradation processing suitable for each can be performed, and when an image captured by a CCD camera or the like is displayed on a reflective LCD, line drawing or Appropriately visible images can be displayed by performing processing suitable for each natural image.
[0157]
By the way, in the second embodiment to the fourth embodiment described above, when image data is continuously input from a CCD camera or the like, data created in the previous one frame (one screen). By performing the processing using (the first to (n-1) th threshold values, the determination result of whether or not the image is a line drawing, etc.), the overall processing can be simplified. This processing will be described with reference to the flowchart of FIG. 18 taking the case of the processing content described in the fourth embodiment as an example.
[0158]
In FIG. 18, the threshold value and the line drawing determination result are initialized (step s91). For example, when the threshold value is initialized to an n-value, the values of the first to n-1th threshold values th [1] to th [n-1] are set to appropriate values. And the initial value of the line drawing determination result is, for example, a natural picture.
[0159]
Next, after inputting one line data in a frame (step s92), various data are acquired from the one line data (step s93). The various data here are data such as leng and num described in the flowchart of FIG. 13 as data for creating a cumulative frequency distribution necessary for threshold calculation and data for determining whether or not the image is a line drawing. It is.
[0160]
Then, the result of whether or not the line drawing is obtained based on the immediately preceding frame data is determined (step s94). If it is not a line drawing, gradation processing by gradation processing for natural images is performed (step s95). If it is a line drawing, gradation processing (including shading processing) for line drawing using the first to n-1th threshold values calculated based on the immediately preceding frame data is performed (step s96).
Next, it is determined whether or not the processing of all the lines for one frame has been completed (step s97). If not completed, the processing returns to step s92. The 1st to (n-1) th threshold values are updated, and the line drawing determination result is updated (step s98). Then, it is determined whether or not there is the next frame data (step s99). If there is the next frame data, the process from step s92 is performed on the new frame, and if there is no next frame, the process is performed. finish.
[0161]
As described above, when image data is continuously input, it is possible to process the threshold value and the line drawing determination result obtained in the previous frame using the currently acquired frame data. . Note that the processing in consideration of the continuous input is not limited to the correspondence to the fourth embodiment described here, but can be similarly applied to the second embodiment and the third embodiment. .
[0162]
Furthermore, the present invention makes it possible to handle the lens aberration in the first embodiment described first.
[0163]
For example, as shown in FIG. 19 (a), the influence of the aberration of the lens is taken through the lens when a linear line drawing 11 having the same thickness and the same darkness exists in the background 10. The luminance of the image (the luminance in the line indicated by the broken line in FIG. 19A) is, as shown in FIG. 19B, the thicker the line is the closer to the edge of the image and the lower the luminance contrast with the background. This is a phenomenon that results in an image lacking sharpness compared to the central portion.
[0164]
In order to eliminate this, in the present invention, as shown in FIG. 20 (a), the luminance value L1 (a little smaller than the desired background luminance L0) is applied to the data after the background correction processing (FIG. 3 (d)). By setting a portion having a luminance value smaller than this and multiplying a portion having a luminance value smaller than this by a coefficient considering lens aberration, at least the luminance height can be corrected and the contrast can be improved.
[0165]
The luminance value L1 slightly smaller than the desired background luminance L0 is, for example, a value obtained by the desired background luminance L0 × 0.8. Further, the coefficient considering the lens aberration is a function for drawing a curve as shown in FIG. 20B with respect to the pixel positions 0, 1, 2,..., N on one line in one screen. Numerical value. That is, the coefficient is “1” at the center of the screen, and the coefficient value is decreased (coefficient value <1) from the center to the end. Here, since the influence of the aberration of the lens can be determined in advance, the coefficient can be obtained in advance by measurement. By multiplying the coefficient value obtained from such a coefficient curve by the luminance value of the line drawing portion of FIG. 20A, the luminance value of the line drawing existing near the end portion is as shown in FIG. The value becomes smaller, the contrast with the background increases, and the influence of lens aberration is improved.
[0166]
Note that the threshold value calculation data for n-value conversion and the data for line drawing determination used in the second to fourth embodiments described above are not obtained from one entire screen, but are displayed on the screen. You may make it obtain | require except a peripheral part. This is because it is considered that there is little important data in obtaining the data in the peripheral part of the screen.
[0167]
In addition, the line drawing determination is performed in units of one screen. For example, the line drawing area and the natural picture area are separated so that it is easy to deal with an image in which both characters and landscape images are mixed. Thus, it may be determined whether each area is a line drawing, and necessary processing may be performed for each area.
[0168]
In the first to fourth embodiments, the processing for luminance (monochrome) has been described. However, it is possible to cope with color. That is, it is possible to cope with this by converting color input (for example, RGB) data into other data (for example, YUV) relating to luminance and color, performing the above-described processing on the luminance, and converting the data again (for example, RGB). .
[0169]
Further, the processing program for performing the processing of the present invention can be stored in a storage medium such as a floppy disk, an optical disk, or a hard disk, and the present invention includes those storage media, and also from a network. A format for obtaining data may also be used.
[0170]
【The invention's effect】
As described above, according to the present invention, the influence of shading is removed in units of a predetermined line for line drawings such as characters and figures that are likely to have a significant influence on shading. In particular, by performing processing for each line, the work memory can be reduced by reducing the capacity of the work memory since only one line of image data line memory and background prediction line memory are required. It contributes to weight reduction and can also reduce costs. In addition, since it is a process for each line, it can be displayed when one line process is completed while capturing an image, and can be displayed when the next one line process is completed. The effect that it is easy to correspond to a simple input is also obtained.
[Brief description of the drawings]
FIG. 1 is a flowchart illustrating an overall process according to a first embodiment of this invention.
FIG. 2 is a view showing an example of an image for explaining a first embodiment;
FIG. 3 is a diagram for explaining from background prediction processing to background correction processing for one line with an image in the first embodiment;
FIG. 4 is a flowchart for explaining background prediction processing according to the first embodiment;
FIG. 5 is a flowchart for explaining background prediction correction processing according to the first embodiment;
FIG. 6 is a diagram showing an example of the configuration of an apparatus in which the image processing apparatus according to the first embodiment is combined with a CCD camera.
FIG. 7 is a flowchart for explaining overall processing according to the second embodiment of the present invention;
FIG. 8 is a flowchart illustrating a processing procedure for calculating n−1 threshold values according to the second embodiment.
FIG. 9 is a diagram illustrating a cumulative frequency distribution of pixels with respect to a luminance value for explaining an example of n−1 threshold value calculation methods;
FIG. 10 is a flowchart for explaining n-value conversion processing according to the second embodiment.
FIG. 11 is a diagram illustrating an apparatus configuration example in which the image processing apparatus according to the second embodiment is combined with a CCD camera.
FIG. 12 is a flowchart for explaining overall processing according to the third embodiment of the present invention;
FIG. 13 is a flowchart illustrating a line drawing determination processing procedure according to the third embodiment.
FIG. 14 is a diagram for explaining data necessary for line drawing determination, taking a change in luminance of a character part as an example;
FIG. 15 is a diagram illustrating an apparatus configuration example in which an image processing apparatus according to a third embodiment is combined with a CCD camera.
FIG. 16 is a flowchart for explaining overall processing according to the fourth embodiment of the present invention;
FIG. 17 is a diagram showing an example of the configuration of an apparatus in which the image processing apparatus according to the fourth embodiment is combined with a CCD camera.
FIG. 18 is a flowchart illustrating processing when images are continuously input in the present invention, taking the fourth embodiment as an example.
FIG. 19 is a diagram illustrating an image example for explaining processing for dealing with lens aberration and an example of luminance distribution of an image affected by lens aberration;
FIG. 20 is a diagram for explaining processing for dealing with lens aberration.
[Explanation of symbols]
1 lens
2 CCD camera
3 A / D converter
4 CCD control circuit
5 Image processing device
51 Line memory for image data
52 Line memory for background prediction
53 Background prediction means
54 Prediction result correction means
55 Background correction means
56 Shading correction unit
61 Threshold value calculation means
62 n-value conversion processing means
63 Tone processing unit for line drawing
71 Line drawing judgment means
72 Shading correction setting switch
81 Gradation processing means for natural images
82 selection switch

Claims (4)

入力された画像データの所定ラインごとにその所定ラインを構成する画素が線画のエッジ部を構成する画素か否かを判断し、エッジを構成する画素でない場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をもとに処理中の画素の輝度値を演算により求め、この求められた輝度値により、それ以前に処理された輝度値を更新し、エッジを構成する画素である場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をそのまま保持する処理を、所定ラインづつその所定ラインを構成する画素ごとに繰り返して行うことで、線画におけるエッジ部分の輝度の影響を除去した各画素ごとの輝度値を所定ライン単位で求める背景予測処理を行ったのち、
この背景予測処理において得られた所定ラインにおける各画素ごとの輝度値が、所望とする輝度値以下であると判定された場合に、その輝度値を有する画素を含む所定の探索範囲を設定し、その探索範囲内における隣接画素との輝度変化を各画素ごとに調べ、探索範囲内において輝度変化の少ない画素が予め設定した数以上である場合には、その輝度変化の少ない画素の輝度値を基にして輝度値を決定し、探索範囲内において輝度変化の少ない画素が予め設定した数より少ない場合には、探索範囲全体の画素の輝度値をもとにして輝度値を決定して、この決定された値により背景予測結果の修正処理を行い、
さらに、この背景予測結果の修正処理により修正された結果と、所望とする値として設定された輝度値とを比較して、その差分を求め、求められた差分を前記入力された画像データの対応する画素位置の輝度値に対して加減することにより、所望の輝度値となるような背景補正を行うことを特徴とする画像処理方法。
For each predetermined line of input image data, it is determined whether the pixels constituting the predetermined line are pixels constituting an edge portion of the line drawing. The luminance value of the pixel being processed is calculated by calculation based on the luminance value at the corresponding pixel position, and the previously processed luminance value is updated with the calculated luminance value, and the pixel constituting the edge is updated. In some cases, the process of holding the luminance value of the corresponding pixel position on the previously processed line as it is is repeatedly performed for each pixel constituting the predetermined line for each predetermined line, thereby After performing the background prediction processing to obtain the luminance value for each pixel from which the influence of luminance has been removed in a predetermined line unit,
When it is determined that the luminance value for each pixel in the predetermined line obtained in the background prediction process is equal to or less than the desired luminance value, a predetermined search range including pixels having the luminance value is set, The brightness change with the adjacent pixels in the search range is examined for each pixel. If the number of pixels with a small change in brightness in the search range is greater than or equal to the preset number, the brightness value of the pixel with the small change in brightness is used as the basis. If the number of pixels with little change in brightness in the search range is less than the preset number, the brightness value is determined based on the brightness values of the pixels in the entire search range. The background prediction result is corrected according to the set value,
Further, the result corrected by the correction process of the background prediction result is compared with the luminance value set as a desired value to obtain the difference, and the obtained difference is associated with the input image data. An image processing method comprising performing background correction so as to obtain a desired luminance value by adding or subtracting to a luminance value at a pixel position to be performed.
前記処理されたライン上の対応する画素位置の画素の輝度値をもとに処理対象画素の輝度値を演算により求める処理は、それ以前に処理されたライン上の対応する画素位置の輝度値と、処理中の画素の輝度値との平均をとる処理であることを特徴とする請求項1記載の画像処理方法。  The processing for calculating the luminance value of the pixel to be processed based on the luminance value of the pixel at the corresponding pixel position on the processed line is the luminance value at the corresponding pixel position on the previously processed line. The image processing method according to claim 1, wherein the image processing method is an average processing with the luminance value of the pixel being processed. 入力された画像データの所定ライン分のデータを保持する画像データ用ラインメモリと、
この画像データ用ラインメモリに保持された画像データの所定ラインごとにその所定ラインを構成する画素が線画のエッジ部を構成する画素か否かを判断し、エッジを構成する画素でない場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をもとに、処理中の画素の輝度値を演算により求め、この求められた輝度値により、それ以前に処理された輝度値を更新し、エッジを構成する画素である場合は、それ以前に処理されたライン上の対応する画素位置の輝度値をそのまま保持する処理を、所定ラインづつその所定ラインを構成する画素ごとに繰り返して行うことで、線画におけるエッジ部分の輝度の影響を除去した処理対象ラインにおける各画素ごとの輝度値をライン単位で求める背景予測手段と、
この背景予測手段で得られた処理対象ラインにおける各画素ごとの輝度値を保持する背景予測用ラインメモリと、
前記背景予測処理において得られた背景予測用ラインメモリの内容をもとに、処理対象ラインにおいて、各画素位置対応の輝度値が、所望とする輝度値以下であると判定された場合に、その輝度値を有する画素を含む所定範囲の探索範囲を設定し、その探索範囲内における隣接画素との輝度変化を各画素ごとに調べ、探索範囲内において輝度変化の少ない画素が予め設定した数以上である場合には、その輝度変化の少ない画素の輝度値を基にして輝度値を決定し、探索範囲内において輝度変化の少ない画素が予め設定した数より少ない場合には、探索範囲全体の画素の輝度値を基にして輝度値を決定し、前記背景予測用ラインメモリの対応する画素位置の内容を前記決定された内容に更新して背景予測結果の修正を行う背景予測修正手段と、
前記背景予測結果修正手段により修正された結果と、所望とする値として設定された輝度値とを比較してその差分を求め、求められた差分を前記画像データ用ラインメモリの対応する画素位置の輝度値に対して加減することにより所望とする輝度値に輝度補正する背景補正手段と、
を有することを特徴とする画像処理装置。
A line memory for image data that holds data for a predetermined line of input image data;
For each predetermined line of image data held in the image data line memory, it is determined whether or not the pixels constituting the predetermined line are pixels constituting an edge portion of the line drawing. Based on the luminance value of the corresponding pixel position on the previously processed line, the luminance value of the pixel being processed is calculated, and the previously processed luminance value is updated with the calculated luminance value. However, in the case of a pixel constituting an edge, the process of holding the luminance value of the corresponding pixel position on the previously processed line as it is is repeated for each pixel constituting the predetermined line for each predetermined line. Thus, a background prediction means for obtaining the luminance value for each pixel in the processing target line in which the influence of the luminance of the edge portion in the line drawing is removed, in units of lines,
A background prediction line memory that holds a luminance value for each pixel in the processing target line obtained by the background prediction means;
Based on the content of the background prediction line memory obtained in the background prediction process, when it is determined that the luminance value corresponding to each pixel position in the processing target line is less than or equal to the desired luminance value, A search range of a predetermined range including pixels having luminance values is set, and the luminance change with adjacent pixels in the search range is checked for each pixel. In some cases, the luminance value is determined based on the luminance value of the pixel with a small change in luminance. When the number of pixels with a small luminance change in the search range is less than the preset number, A background prediction correction unit that determines a luminance value based on the luminance value, updates the content of the corresponding pixel position in the background prediction line memory to the determined content, and corrects the background prediction result;
The result corrected by the background prediction result correcting means is compared with the luminance value set as a desired value to obtain the difference, and the obtained difference is calculated at the corresponding pixel position in the image data line memory. Background correction means for correcting the luminance to a desired luminance value by adjusting the luminance value;
An image processing apparatus comprising:
前記処理されたライン上の対応する画素位置の画素の輝度値をもとに処理対象画素の輝度値を演算により求める処理は、それ以前に処理されたライン上の対応する画素位置の輝度値と現在処理している画素の輝度値の平均をとる処理であることを特徴とする請求項3記載の画像処理装置。  The processing for calculating the luminance value of the pixel to be processed based on the luminance value of the pixel at the corresponding pixel position on the processed line is the luminance value at the corresponding pixel position on the previously processed line. 4. The image processing apparatus according to claim 3, wherein the image processing apparatus is an average process of luminance values of pixels currently being processed.
JP26169297A 1996-10-29 1997-09-26 Image processing method and image processing apparatus Expired - Fee Related JP3804214B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP26169297A JP3804214B2 (en) 1996-10-29 1997-09-26 Image processing method and image processing apparatus

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP28690696 1996-10-29
JP8-286906 1996-10-29
JP26169297A JP3804214B2 (en) 1996-10-29 1997-09-26 Image processing method and image processing apparatus

Publications (2)

Publication Number Publication Date
JPH10191048A JPH10191048A (en) 1998-07-21
JP3804214B2 true JP3804214B2 (en) 2006-08-02

Family

ID=26545197

Family Applications (1)

Application Number Title Priority Date Filing Date
JP26169297A Expired - Fee Related JP3804214B2 (en) 1996-10-29 1997-09-26 Image processing method and image processing apparatus

Country Status (1)

Country Link
JP (1) JP3804214B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3882640B2 (en) * 2002-02-27 2007-02-21 日産自動車株式会社 Infrared camera
CN101789121B (en) * 2009-01-22 2013-11-13 佳能株式会社 Device and method for shadow correcting

Also Published As

Publication number Publication date
JPH10191048A (en) 1998-07-21

Similar Documents

Publication Publication Date Title
JP2871127B2 (en) Image processing apparatus and method
US6137541A (en) Image processing method and image processing apparatus
CN107395991B (en) Image synthesis method, image synthesis device, computer-readable storage medium and computer equipment
JP2006013558A (en) Image processing apparatus and image processing program
CN111183630B (en) Photo processing method and processing device of intelligent terminal
JP3543774B2 (en) Image processing apparatus, image processing method, and recording medium
JPH10214339A (en) Picture filtering method
EP1933549B1 (en) Image correction device and image correction method
US20060159340A1 (en) Digital image photographing apparatus and method
JP2004007202A (en) Image processor
CN116504190B (en) Image processing method and device for electronic ink screen and related equipment
JP3804214B2 (en) Image processing method and image processing apparatus
US6192163B1 (en) Image processing method and image processing apparatus
JP4219577B2 (en) Image processing apparatus, image output apparatus, image processing method, and storage medium
JP2006157599A (en) Imaging device
JP2003046807A (en) Image display device and image display method
JP4247621B2 (en) Image processing apparatus, image processing method, and medium on which image processing control program is recorded
JP2000307869A (en) Device and method for image processing and computer- readable storage medium with image processing procedure stored therein
JP4396766B2 (en) Image degradation detection apparatus, image degradation detection method, program for executing image degradation detection method, and recording medium
JP4560845B2 (en) Image processing apparatus, image processing method, and medium on which image processing control program is recorded
JPH1042191A (en) Method and device for correcting back light of picture
JPH09163164A (en) Image processing method and image processing unit
JPH10191044A (en) Image processing method and device
JPH08265572A (en) Picture processor
JP2001169114A (en) Method and device for image processing and medium with image processing control program recorded thereon

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050520

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20051004

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051028

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060501

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20100519

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110519

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120519

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees