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

Image processing apparatus and image processing method Download PDF

Info

Publication number
JP3972192B2
JP3972192B2 JP2002186044A JP2002186044A JP3972192B2 JP 3972192 B2 JP3972192 B2 JP 3972192B2 JP 2002186044 A JP2002186044 A JP 2002186044A JP 2002186044 A JP2002186044 A JP 2002186044A JP 3972192 B2 JP3972192 B2 JP 3972192B2
Authority
JP
Japan
Prior art keywords
luminance
image
image processing
processing apparatus
conversion
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
JP2002186044A
Other languages
Japanese (ja)
Other versions
JP2003051947A5 (en
JP2003051947A (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 JP2002186044A priority Critical patent/JP3972192B2/en
Publication of JP2003051947A publication Critical patent/JP2003051947A/en
Publication of JP2003051947A5 publication Critical patent/JP2003051947A5/ja
Application granted granted Critical
Publication of JP3972192B2 publication Critical patent/JP3972192B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、画像処理装置および画像処理方法に関し、特に、画素が縦方向と横方向に並ぶ画像のコントラストを強調させる画像処理装置および画像処理方法に関する。
【0002】
【従来の技術】
スキャナで写真を取り込んだり、デジタルスチルカメラで撮影した画像データはドットマトリクス状に構成されている。取り込んだ画像データが好ましい状態であれば良いものの、デジタル画像の特性を活かして好みに応じた修正を行いたいこともある。特に、コントラストが弱い場合、これまでのカラーフィルムを使用した写真であれば修正が困難であり、そのような写真は撮り直さざるを得ないものの、デジタル画像であれば画像修正ソフトなどを使用してコントラストの強調も可能である。
【0003】
すなわち、従来よりこのようなデジタル画像データを修正するために画像修正ソフトが利用されており、コンピュータ上にて起動することにより、オペレータは各種の修正が可能となっている。例えば、上述したようなコントラストの強調であれば輝度の拡大操作をすることによって可能である。より具体的には、変換元の輝度と変換先の輝度との対応関係を正比例状態から適度にS字状に歪めた状態に変更せしめることにより、変換元でのある幅をもった輝度が変換先でより広い幅となるよう対応づけることができる。
【0004】
【発明が解決しようとする課題】
上述した従来の画像処理装置においては、オペレータの操作によってコントラストを強調させる処理が可能ではあるものの、必要なパラメータの値は勘によって与えるしかなく、画像データの処理に慣れていない者にとっては思い通りにコントラストを強調できず、薄暮の写真が真昼のようになってしまったりするなど、操作性の課題があった。
また、画素が縦方向と横方向に並ぶ画像の画素をサンプリングして間引く際、図10(a)に示す(width)×(height)の画素数のビットマップ画像のように、width>>heightであるとすると、長い方のwidthでサンプリング周期を決めてしまった場合には、同図(b)に示すように、縦方向には上端と下端の2ラインしか画素を抽出されないといったことが起こりかねない。
【0005】
本発明は、画素が縦方向と横方向に並ぶ画像の画素をサンプリングして間引く際に画像の抽出点の偏りを無くして画像のコントラストを強調する処理を行うことが可能な画像処理装置および画像処理方法の提供を目的とする。
【0006】
【課題を解決するための手段】
上記目的を達成するため、請求項1にかかる発明は、画素が縦方向と横方向に並ぶ画像のコントラストを強調する処理を行う画像処理装置であって、上記画像の画素を上記縦方向と上記横方向とでサンプリングして間引く際に上記縦方向と上記横方向とで画素数の少ない方の方向の画素数に基づいた抽出数が確保されるように間引きを行い、間引き後の画素毎の所定階調数の輝度相当値から上記画像の輝度分布を求め、求めた輝度分布から前記画素毎の輝度相当値のばらつきを表す量を算出し、当該ばらつきを表す量に基づいて上記画像のコントラストを強調する処理を行う構成としてある。
【0007】
上記のように構成した発明においては、上記画像の画素を上記縦方向と上記横方向とでサンプリングして間引く際に上記縦方向と上記横方向とで画素数の少ない方の方向の画素数に基づいた抽出数が確保されるように間引きが行われる。間引き後の画素毎の所定階調数の輝度相当値からは、上記画像の輝度分布が求められる。求めた輝度分布からは、前記画素毎の輝度相当値のばらつきを表す量が算出される。当該ばらつきを表す量に基づいて上記画像のコントラストを強調する処理が行われる。
ところで、上記輝度相当値のばらつきを表す量に基づいて階調数を割り当ててもよい。
例えば、ある幅に輝度分布が集中していたとするときに、その幅を広げるように階調数を与えればコントラストが強調されて明暗がはっきりする。
このとき、輝度分布が集中していないような部分に割り当てられていた階調数を減らしても支障はない。
このため、請求項2にかかる発明は、上記請求項1に記載の画像処理装置において、上記輝度相当値のばらつきを表す量に基づいて分布密度の小さい階調範囲に少ない階調数を割り当てるとともに分布密度の大きい階調範囲に多い階調数を割り当て、階調数の割り当ての変更に対応させて各画素の輝度相当値を変換する構成としてある。
【0008】
むろん、輝度分布の集中がなくまんべんに広がっているような場合には階調数の割り当てをあえて変化させる必要はない。
【0009】
このような輝度相当値のばらつきを表す量を求める作業は、従来の操作でオペレータが行っていた勘に頼って検知していたものであり、この輝度相当値のばらつきを表す量に応じて階調数をどの範囲に多く割り当てるかという操作は、オペレータが与えていたパラメータを設定することに対応する。
【0010】
ここにおいて、輝度分布から輝度相当値のばらつきを表す量を求めるにあたっては各種の手法が可能である。既知の輝度相当値のばらつきを表す量に対応する値を求めるものであっても良いし、計算量を軽減するための処置を施して輝度相当値のばらつきを表す量を求めるものであっても良い。既知の輝度相当値のばらつきを表す量を利用するものとして、請求項3にかかる発明は、上記請求項1または請求項2に記載の画像処理装置において、上記輝度相当値のばらつきを表す量は標準偏差に対応する値を利用し、輝度分布の標準偏差が大きいときに入出力比を小さくして階調数の割り当てを均一化するするとともに、標準偏差が小さいときに入出力比を大きくして階調数の割り当て変化を拡大化する構成としてある。
【0011】
上記のように構成した発明においては、標準偏差は平均値に対して個々の要素のバラツキ量を表すものであるから、バラツキが多ければ輝度の変換は必要なく、入出力比を大きくして階調数の割り当て変化を拡大化するような変換は必要ない。すなわち、輝度分布が集中していることもないので階調数の割り当てを大きくしたり小さくしたりする必要はない。しかしながら、標準偏差が小さいということはバラツキが少ないことを意味し、その場合には輝度分布が集中していることになるので、分布密度の大きい範囲に多くの階調数を与えてコントラストを強調させる。
【0012】
むろん、標準偏差はバラツキを表すものとして使用するので、分散と同義であるし、その計算課程においては必ずしもサンプル数による除算などを必要とするわけでもない。
【0013】
階調数を多く与えたり少なく与えたりするというのは、概ね入出力比に対応するものであり、階調数を多く与えるのであれば、入力側で与えられていた階調数よりもたくさんの階調数を与えてその範囲内で階調を広げることになり、コントラストの強調にあたる。一方、階調数の総数を増減させることはできないので、ある範囲に階調数を多く与えればその反動として残りの範囲には階調数を多く与えることができなくなり、入力側で与えられていた階調数よりも少ない階調数が与えられてその範囲内でコントラストが狭められることになる。
【0014】
このような階調数の与え方は個々の階調毎にどのように変換するかを定めることも可能であるが、より簡便な例とし、請求項4にかかる発明は、上記請求項3に記載の画像処理装置において、輝度分布にγ補正を行うとともに標準偏差が大きいときにγ補正による変化量が小さくなるようにγの値を設定し、標準偏差が小さいときにγ補正の変化量が大きくなるようにγの値を設定する構成としてある。
【0015】
上記のように構成した発明においては、γ補正の手法によって上に凸となったり下に凸となったりする対応関係を与えるものであり、上に凸となる場合には前半部分に階調数を多く割り当てることになるとともに後半部分に少ない階調数を割り当てることになり、また、下に凸となる場合には前半部分に少ない階調数を割り当てることになるとともに後半部分に階調数を多く割り当てることになる。
そして、かかる割り当て量の大小はγ補正による変化量で適宜調整でき、与えるγの値にて対応している。
【0016】
このγ補正の一対応として、請求項5にかかる発明は、上記請求項4に記載の画像処理装置において、輝度分布の概略中心位置を求めるとともに、この概略中心位置を基準として高輝度側と低輝度側とで輝度変換の極性を反転させることにより入力と出力との関係で概略S字カーブの輝度変換を行う構成としてある。
【0017】
上記のように構成した発明においては、γ補正による輝度変換の極性を反転させるべく、高輝度側でγ<1のγ補正をするとともに低輝度側でγ>1のγ補正をすることにより、下に凸のカーブと上に凸のカーブとが連続することになり、いわゆるS字カーブの入出力関係が成立する。ここにおいてその中央部分には階調数を多く割り当てることになるから、輝度分布の概略中心に二つのカーブの連続点を持ってくるようにすれば輝度分布を拡大したい範囲に多くの階調数を割り当てることが可能となる。
【0018】
各種の手法で輝度を変換するにあたり、請求項6にかかる発明は、上記請求項1〜請求項5のいずれかに記載の画像処理装置において、変換元の輝度の取りうる範囲内で変換先の輝度を演算して記憶しておき、変換時にはこの対応関係を呼び起こして変換することを構成としてある。
【0019】
変換式に基づいて輝度を毎回計算することも不可能ではないが、輝度分布のとりうる値の範囲は決まっている。このため、あらかじめ変換元の輝度に基づいて変換先の輝度を演算して記憶しておけば、変換時に対応関係を呼び起こすだけで変換することが可能となる。
【0020】
輝度を変換するにあたっては画像データが輝度のデータとして含んでいる場合もあるし、間接的でしか輝度のデータを含んでいない場合もある。むろん、直接の輝度のデータを含んでいればそれを変換すればよいし、間接的な輝度のデータである場合でも輝度のデータに変換してから所定の輝度変換を行えばよい。しかしながら、輝度の変換は極めて正確でなければならないわけではなく、大まかに分かれば良いともいえる。
【0021】
その意味では厳格な正確さが要求されるわけではないので、請求項7にかかる発明は、上記請求項1〜請求項6のいずれかに記載の画像処理装置において、画像データが輝度に対応した複数の成分値で表される場合において、輝度の演算を同成分値の線形加算で求めることを構成としてある。
【0022】
画像データがいわゆるRGB(赤緑青)の階調データで表されている場合、赤緑青についての各成分値はそれぞれが輝度に対応しているといえる。このため、同成分値の線形加算は十分に輝度を表すものといえ、極めて容易な変換手法となりうる。
【0023】
各画素についての輝度が求められるものとして、画像としての輝度分布は必ずしも画像データの全画素について求める必要がなく、画像データについて所定の抽出率に対応した間引きを行って輝度分布を求める。
【0024】
分布を求めることを目的とすれば、全画素に対して輝度を求めることなく、所定の抽出率で間引きを行なったとしても抽出率に応じた程度の確かさの輝度分布を得ることができる。
【0025】
ここにおいて、縦方向と横方向の範囲での短い側において所定の抽出数が確保されるようにすることを構成としてある。
【0026】
画像は平面的であるが故、自ずからその画像データも縦方向と横方向とに分布するが、ある抽出率を決定するにあたっては、少なくとも短い側においてある抽出数を確保することにより、抽出率に応じた確かさを保持することになる。
【0027】
さらに、請求項8にかかる発明は、上記請求項1〜請求項7のいずれかに記載の画像処理装置において、コントラストの強調程度に制限を設定することを構成としてある。
【0028】
コントラストが狭いことが当然の場合がある。例えば、夕方の風景であれば輝度分布の幅が狭いのは自然であり、これを必要以上に拡大してしまうと昼の風景となってしまう。同様の例は他の場合においてもあり得ることで、輝度分布の拡大範囲に制限を設定することにより、かかる現象を回避する。
【0029】
さらに、請求項9にかかる発明は、上記請求項1〜請求項8のいずれかに記載の画像処理装置において、輝度分布に基づいて二値画像データを判定するとともに、二値画像データであればコントラストの強調を行わないことを構成としてある。
【0030】
二値画像については実質的な意味での輝度分布はないといえるので、輝度分布から二値画像データを判定したらコントラストの強調は行わないようにしている。
【0031】
二値画像データはある色を持ったものでもあり得るため、その色の有りと無しに対応する二つの輝度となりうる。その色の輝度か否かを判定することも可能であるが、それを示唆する情報がない場合に対応し、請求項10にかかる発明は、上記請求項9に記載の画像処理装置において、再現可能な範囲内の両端に輝度分布が集中しているときに白黒の二値画像データであると判断することを構成としてある。
【0032】
すなわち、白黒画像については再現可能な範囲内の両端に輝度分布が集中しているといえ、判断可能となる。
【0033】
さらに、請求項11にかかる発明は、上記請求項1〜請求項10のいずれかに記載の画像処理装置において、突出する輝度分布に基づいて画像データの枠部を判定するとともに、枠部があれば枠部のデータについてコントラストの強調に利用しない構成としてある。
【0034】
画像を処理する場合に頻繁に起こり得るのは枠を持っていることであり、単色の枠として存在すれば当然にその色に対応する輝度分布だけが突出する。従って、かかる突出した輝度分布をもってして強調の判断の基準とすれば有効な判断ができなくなり得るから、枠部と判断してコントラストの強調に利用しない。
【0035】
さらに、その一例として、請求項12にかかる発明は、上記請求項11に記載の画像処理装置において、再現可能な範囲内での端部に集中している輝度分布が枠部であると判定することを構成としてある。
【0036】
白枠あるいは黒枠は頻繁にあり採用されるし、トリミングの結果によっても生じ得るものであり、再現可能な範囲内での端部に該当する。従って、この端部に集中している輝度分布を枠部と判定する。
【0037】
ところで、請求項13にかかる発明は、上記請求項1〜請求項12のいずれかに記載の画像処理装置において、画像データが自然画でない場合にコントラストの強調を行わない構成としてある。
【0038】
コントラストの幅の狭さが問題となりやすいのは写真のような自然画であり、ビジネスグラフのようなものでは殆ど必要が無いと言える。逆に、ビジネスグラフのようなものについて手を加えることが作り手のイメージと異ならせる結果になりかねない。従って、このような自然画の場合にだけ輝度分布を拡大するようにしている。
【0039】
自然画か否かの判断の一例として、請求項14にかかる発明は、上記請求項13に記載の画像処理装置において、輝度分布がスペクトル状に存在する場合に上記画像データが自然画でないと判定する自然画判定手段を備えることを構成としてある。
【0040】
自然画の特徴として輝度分布が滑らかに幅を持つことが言える。従って、輝度分布が線スペクトル状に表れていれば自然画でないと判断して概ね差し支えない。上記のように構成した請求項14にかかる発明においては、自然画判定手段が輝度分布の状態を判定し、線スペクトル状に存在する場合に画像データが自然画でないと判定し、これにより輝度分布の拡大が行われなくなる。
【0041】
さらに、請求項15にかかる発明は、画素が縦方向と横方向に並ぶ画像のコントラストを強調する処理を行う画像処理方法であって、上記画像の画素を上記縦方向と上記横方向とでサンプリングして間引く際に上記縦方向と上記横方向とで画素数の少ない方の方向の画素数に基づいた抽出数が確保されるように間引きを行い、間引き後の画素毎の所定階調数の輝度相当値から上記画像の輝度分布を求め、求めた輝度分布から前記画素毎の輝度相当値のばらつきを表す量を算出し、当該ばらつきを表す量に基づいて上記画像のコントラストを強調する処理を行う構成としてある。
【0042】
すなわち、必ずしも実体のある装置に限らず、その方法としても有効であることに相違はない。
【0043】
ところで、このような画像処理装置は単独で存在する場合もあるし、ある機器に組み込まれた状態で利用されることもあるなど、発明の思想としては、各種の態様を含むものである。また、ソフトウェアであったりハードウェアであったりするなど、適宜、変更可能である。
【0044】
その一例として、入力される複数の画素からなる画像の画像データに基づいて印刷インクに対応した画像データに変換し、所定のカラープリンタに印刷せしめるプリンタドライバにおいても、各画素を処理の対象として注目画素を移動させながら、注目画素の輝度相当値を集計して輝度分布を求め、求められた輝度分布に基づいて個々の要素のばらつき量に相当する当該輝度分布の広がり量を算出し、この広がり量に基づいて分布密度の大きい階調範囲に多くの階調数を割り当てる対応関係となるように、入力と出力と間で変換処理を施してコントラストを強調せしめる構成とすることができる。
【0045】
すなわち、プリンタドライバは入力された画像データを印刷インクに対応して変換するが、このとき各画素を処理の対象として注目画素を移動させながら、注目画素の輝度相当値を集計して輝度分布を求め、求められた輝度分布に基づいて個々の要素のばらつき量に相当する当該輝度分布の広がり量を算出し、この広がり量に基づいて分布密度の大きい階調範囲に多くの階調数を割り当てる対応関係となるように、入力と出力と間で変換処理を施してコントラストを強調せしめるように入力画像を変換し、印刷させる。
【0046】
発明の思想の具現化例として画像処理装置のソフトウェアとなる場合には、かかるソフトウェアを記録した記録媒体上においても当然に存在し、利用されるといわざるをえない。むろん、その記録媒体は、磁気記録媒体であってもよいし光磁気記録媒体であってもよいし、今後開発されるいかなる記録媒体においても全く同様に考えることができる。また、一次複製品、二次複製品などの複製段階については全く問う余地無く同等である。
【0047】
さらに、一部がソフトウェアであって、一部がハードウェアで実現されている場合においても発明の思想において全く異なるものではなく、一部を記録媒体上に記憶しておいて必要に応じて適宜読み込まれるような形態のものとしてあってもよい。さらには、カラーファクシミリ機やカラーコピー機などの画像処理装置においても適用可能であることはいうまでもない。
【0048】
【発明の効果】
以上説明したように、請求項1、請求項2にかかる発明によれば、輝度相当値のばらつきを表す量から自動的にコントラストの強調程度を判断するため、非熟練者でも容易にコントラストを適正量だけ強調せしめることが可能であるとともに、画素が縦方向と横方向に並ぶ画像の画素をサンプリングして間引く際に画像の抽出点の偏りを無くして画像のコントラストを強調する処理を行うことが可能な画像処理装置を提供することができる。
【0049】
また、請求項3にかかる発明によれば、よく知られている標準偏差に基づいて入出力比を定めるだけであり、構成が容易となる。
【0050】
さらに、請求項4にかかる発明によれば、γ補正による変換であるので、構成が容易となる。
【0051】
さらに、請求項5にかかる発明によれば、輝度分布の概略中心位置を基準とした概略S字カーブの対応関係で輝度変換することによりコントラストを強調したい場合に効率よく分散した変換が可能となる。
【0052】
さらに、請求項6にかかる発明によれば、変換を容易にすることができる。
【0053】
さらに、請求項7にかかる発明によれば、必要十分な程度の正確さで輝度を容易に求めることができるようになる。
【0054】
さらに、請求項8にかかる発明によれば、コントラストを強調しすぎて画像の雰囲気を変えてしまわないようにすることができる。
【0055】
さらに、請求項9にかかる発明によれば、コントラスト強調の不要な条件を容易に判定して強調を行わないようにすることができる。
【0056】
さらに、請求項10にかかる発明によれば、頻度の多い白黒画像を効率よく判定することができる。
【0057】
さらに、請求項11にかかる発明によれば、画像に表れがちな枠部の輝度によって処理が不正確になるのを防止することができる。
【0058】
さらに、請求項12にかかる発明によれば、頻度の多い白黒の枠部を容易に判定することができる。
【0059】
さらに、請求項13にかかる発明によれば、コントラストの強調が必要な自然画の場合にだけ行うようにすることができ、さらに、請求項14にかかる発明によれば、自然画か否かを容易に判定することができる。
【0060】
さらに、請求項15にかかる発明によれば、輝度相当値のばらつきを表す量から自動的にコントラストの強調程度を判断するため、非熟練者でも容易にコントラストを適正量だけ強調せしめることが可能であるとともに、画素が縦方向と横方向に並ぶ画像の画素をサンプリングして間引く際に画像の抽出点の偏りを無くして画像のコントラストを強調する処理を行うことが可能な画像処理方法を提供することができる。
【0061】
【発明の実施の形態】
以下、図面にもとづいて本発明の実施形態を説明する。
【0062】
図1は、本発明の一実施形態にかかる画像処理システムをブロック図により示しており、図2は具体的ハードウェア構成例をブロック図により示している。
【0063】
同図において、画像入力装置10は画像を撮像するなどして画像データを画像処理装置20へ出力し、同画像処理装置20は所定のコントラスト強調などの画像処理を行なって画像出力装置30に出力し、同画像出力装置30はコントラストを強調された画像を表示する。
【0064】
ここにおいて、画像入力装置10の具体例はスキャナ11やデジタルスチルカメラ12あるいはビデオカメラ14などが該当し、画像処理装置20の具体例はコンピュータ21とハードディスク22などからなるコンピュータシステムが該当し、画像出力装置30の具体例はプリンタ31やディスプレイ32等が該当する。むろん、これら以外にもカラーコピー機やカラーファクシミリ機などにも適用可能である。
【0065】
本画像処理システムにおいては、コントラストの弱い画像に対して最適なコントラストを与えようとしているものであるから、画像入力装置10としてのスキャナ11で写真を撮像した画像データであるとか、デジタルスチルカメラ12で撮影したコントラストの弱い画像データであるとか、ビデオカメラ14で撮影した動画画像などが処理の対象となり、画像処理装置20としてのコンピュータシステムに入力される。なお、ビデオカメラ14の入力画像については、演算速度が間に合わないこともあり得る。そのような場合には演算時間を要する最初の条件設定を撮影のシーンごとに行っておき、撮影中は同じ条件設定のもとで各フレームの画像変換だけを行なうということによって対処可能である。
【0066】
本画像処理装置20は、少なくとも、輝度の分布を抽出する輝度分布検出手段と、この検出された輝度分布に基づいて先ず輝度分布の広がり量を検出する輝度分布広がり量検出手段と、この広がり量に基づいて分布密度の大きい範囲に多くの階調数を与えつつ分布密度の小さい範囲に少ない階調数を割り当てる階調数割当手段と、割り当てられた輝度の階調に基づいて画像データを変換する画像データ変換手段とを構成する。むろん、本画像処理装置20は、この他にも機種毎による色の違いを補正する色変換手段であったり、機種毎に対応した解像度を変換する解像度変換手段などを構成していても構わない。この例では、コンピュータ21はRAMなどを使用しながら、内部のROMやハードディスク22に保存されている各画像処理のプログラムを実行していく。
【0067】
この画像処理のプログラムの実行結果は後述するようにコントラストを強調した画像データとして得られ、得られた画像データに基づいて画像出力装置30であるプリンタ31で印刷したり、同じ画像出力装置30であるディスプレイ32に表示する。なお、この画像データは、より具体的にはRGB(緑、青、赤)の階調データとなっており、また、画像は縦方向(height)と横方向(width)に格子状に並ぶドットマトリクスデータとして構成されている。
【0068】
本実施形態においては、画像の入出力装置の間にコンピュータシステムを組み込んで画像処理を行うようにしているが、必ずしもかかるコンピュータシステムを必要とする訳ではなく、図3に示すようにデジタルスチルカメラ12a内にコントラストを強調する意味での画像処理装置を組み込み、変換した画像データを用いてディスプレイ32aに表示させたりプリンタ31aに印字させるようなシステムであっても良い。また、図4に示すように、コンピュータシステムを介することなく画像データを入力して印刷するプリンタ31bにおいては、スキャナ11bやデジタルスチルカメラ12bあるいはモデム13b等を介して入力される画像データを自動的にコントラスト強調するように構成することも可能である。
【0069】
コンピュータ21にて実行する画像処理の内、輝度分布検出手段と輝度分布広がり量検出手段とに相当する輝度の分布検出処理を図5に示しており、階調数割当手段と画像データ変換手段とに相当する輝度変換処理を図6に示している。
【0070】
図5は主に輝度の分布検出処理に該当しており、まず、この輝度の分布検出処理について説明する。
【0071】
輝度をいかにして表すかについて説明する前に、分布対象となる画素について説明する。図5のステップS102で示すように対象となる画素を間引く間引き処理を実行する。図7に示すように、ビットマップの画像であれば、縦方向に所定ドットと横方向に所定ドットからなる二次元のドットマトリクスとして成り立っており、正確な輝度の分布を求めるのであれば全画素について輝度を調べる必要がある。しかしながら、この分布抽出処理は輝度分布の広がり量を求めることを目的としており、必ずしも正確である必要はない。従って、ある誤差の範囲内となる程度に間引きを行うことが可能である。統計的誤差によれば、サンプル数Nに対する誤差は概ね1/(N**(1/2))と表せる。ただし、**は累乗を表している。従って、1%程度の誤差で処理を行うためにはN=10000となる。
【0072】
ここにおいて、図7に示すビットマップ画面は(width)×(height)の画素数となり、サンプリング周期ratioは、
ratio=min(width,height)/A+1
…(1)
とする。このmin(width,height)はwidthとheightのいずれか小さい方であり、Aは定数とする。また、ここでいうサンプリング周期ratioは何画素ごとにサンプリングするかを表しており、図8の○印の画素はサンプリング周期ratio=2の場合を示している。すなわち、縦方向及び横方向に二画素ごとに一画素のサンプリングであり、一画素おきにサンプリングしている。A=200としたときの1ライン中のサンプリング画素数は図9に示すようになる。
【0073】
同図から明らかなように、サンプリングしないことになるサンプリング周期ratio=1の場合を除いて、200画素以上の幅があるときには最低でもサンプル数は100画素以上となることが分かる。従って、縦方向と横方向について200画素以上の場合には(100画素)×(100画素)=(10000画素)が確保され、誤差を1%以下にできる。
【0074】
ここにおいてmin(width,height)を基準としているのは次のような理由による。例えば、図10(a)に示すビットマップ画像のように、width>>heightであるとすると、長い方のwidthでサンプリング周期ratioを決めてしまった場合には、同図(b)に示すように、縦方向には上端と下端の2ラインしか画素を抽出されないといったことが起こりかねない。しかしながら、min(width,height)として、小さい方に基づいてサンプリング周期ratioを決めるようにすれば同図(c)に示すように少ない方の縦方向においても中間部を含むような間引きを行うことができるようになる。
【0075】
なお、この例では、縦方向と横方向の画素について正確なサンプリング周期で間引きを行うようにしている。これは、逐次入力される画素について間引きしながら処理する場合に好適である。しかし、全画素が入力されている場合には縦方向や横方向についてランダムに座標を指定して画素を選択するようにしても良い。このようにすれば、10000画素というような必要最低限の画素数が決まっている場合に10000画素となるまでランダムに抽出する処理を繰り返し、10000画素となった時点で抽出を止めればよくなる。
【0076】
このように選択した画素についての画素データがその成分要素として輝度を持っていればその輝度値を用いて分布を求めることが可能である。しかしながら、輝度値が直接の成分値となっていない画像データの場合でも、間接的には輝度を表す成分値を備えている。従って、輝度値が直接の成分値となっていない表色空間から輝度値が直接の成分値となっている表色空間への変換を行えば輝度値を得ることができる。
【0077】
このような異なる表色空間の間での色変換は変換式によって一義的に定まるものではなく、それぞれの成分値を座標とする色空間について相互に対応関係を求めておき、この対応関係を記憶した色変換テーブルを参照して逐次変換する必要がある。テーブルとする関係上、成分値は階調値として表され、三次元の座標軸を備えている256階調の場合には、約1670万個(256×256×256)の要素の色変換テーブルを持たなければならない。効率的な記憶資源の利用を考えた結果、すべての座標値についての対応関係を用意しておくのではなく、通常は適当なとびとびの格子点について対応関係を用意しておき、補間演算を併用するようにしている。この補間演算はいくつかの乗算や加算を経て可能となるものであるため、演算処理量は膨大となってくる。
【0078】
すなわち、フルサイズの色変換テーブルを使用するのであれば処理量としては少なくなるもののテーブルサイズが非現実的な問題となり、テーブルサイズを現実的なサイズにすれば演算処理量が非現実的となることが多い。
【0079】
このような状況に鑑み、本実施形態においては、テレビジョンなどの場合に利用されているように、RGBの三原色から輝度を求める次式の変換式を採用している。すなわち、P点での輝度yp についてはRGBの成分値(Rp,Gp,Bp )から、
yp=0.30Rp+0.59Gp+0.11Bp …(2)
とする。このようにすれば、三回の乗算と二回の加算だけで輝度値を求めることができるようになる。そして、全階調分に相当する配列の変数領域を利用して度数分布を求める。
【0080】
本実施形態においては、RGBの表色空間を対象としている結果、このような変換式を採用しているが、その背景には各成分値が色の明るさを示しているので、それぞれの成分値を単独で見た場合に輝度に線形に対応しているという性質がある。従って、よりおおざっぱに言えばそれぞれの加算割合を考慮することなく単に
yp=(Rp+Gp+Bp)/3 …(3)
というように簡略化することも不可能ではないし、さらには、
yp=Gp …(4)
というように、(3)式においても最も割合の大きい緑の成分値を輝度値としてしまうことも可能である。
【0081】
間引き処理では、選択した画素についてRGBの画像データから同時に輝度を求めて分布をとる。最終的にはステップS114にてこの分布に基づいてその広がり量に対応する標準偏差を求めることになるが、その前に考慮しておく事項がある。
【0082】
一つ目は画像が白黒画像のような二値画像である場合である。白黒画像を含めて二値画像であればコントラストの強調という概念は不適切である。図11に示すような白黒画像があったとすると、この画像に対する輝度分布は図12に示すように階調数の割り当て範囲内で両端に集中する。それも、基本的には階調「0」と階調「255」に集中する。
【0083】
従って、ステップS104で白黒チェックを行う場合には、階調「0」と階調「255」の画素数の和が、間引いて選択した画素数と一致するか否かで判断できる。そして、白黒画像の場合であれば以下の処理を実行することなく処理を中断するためにステップS106にて非拡大処理を実行する。本実施形態においては分布抽出処理と輝度変換処理とを大きく分けているので、この非拡大処理では後段の輝度変換処理も実行しないようなフラグを立てて当該分布抽出処理を終了している。
【0084】
二値データは白黒だけに限らず、色の付いた二値データもあり得る。このような場合も同様にコントラストの強調を図る処理は不要であり、分布状態を調べて二つの値(一方は概ね「0」)にしか分布が集中していなければ二値データとして処理の中断を図ればよい。
【0085】
二つ目は画像がビジネスグラフのようなものか写真のような自然画であるか否かを考慮する。自然画においてはコントラストの強調という処理が要求される場合があるものの、ビジネスグラフであるとか絵画のようなものではコントラストの強調を図らない方が好まれる場合が多い。従って、ステップS108では自然画か否かのチェックを行う。
【0086】
自然画では陰影を含めて色数が極めて多いがビジネスグラフやドロー系などのある種の絵画では色数が限られていることが多い。従って、色数が少なければ自然画ではないと判断することが可能である。色数を正確に判断しようとすれば上述したように1670万色のうちの何色を使用しているかを判別する必要があるが、現実的ではない。一方、ビジネスグラフのような極めて色数が少ない場合には異なる色であって同じ輝度になる確率は低い。すなわち、輝度によって概ねの色数を判断できる。色数が少なければ輝度の分布もまばらであり、ビジネスグラフのようなものでは線スペクトル状に表れる。このようなことから、ステップS108では256階調の輝度のうち分布数が「0」でない輝度値がいくつ表れているかカウントする。そして、概ね1/4となる「64」色(階調)以下であれば自然画でないと判断し、二値データの場合と同様、ステップS106にて非拡大処理を実行する。むろん、しきい値となる「64」色(階調)以下か否かについては適宜変更可能である。
【0087】
また、分布が線スペクトル状か否かは分布数が「0」でない輝度値の隣接割合で判断することも可能である。すなわち、分布数が「0」でない輝度値であって隣接する輝度値に分布数があるか否かを判断する。隣接する二つの輝度値のうち少なくとも一方で隣接していれば何もせず、両方で隣接していない場合にカウントを行い、その結果、「0」でない輝度値の数とカウント値との割合で判断すればよい。例えば、「0」でない輝度値の数が「64」であって、隣接しないものの数が「64」であれば線スペクトル状に分布していることが分かる。
【0088】
さらに、オペレーティングシステムを介して画像処理プログラムが実行されているような場合には、画像ファイルの拡張子で判断することも可能である。ビットマップファイルのうち、特に写真画像などではファイル圧縮がなされ、その圧縮方法を表すために暗示の拡張子が利用されることが多い。例えば、「JPG」という拡張子であれば、JPEGフォーマットで圧縮されていることが分かる。
オペレーティングシステムがファイル名を管理していることから、プリンタドライバなどの側からオペレーティングシステムに問い合わせを出せば、同ファイルの拡張子が回答されることになるため、その拡張子に基づいて自然画であると判断してコントラストの強調を行うようにすればよい。また、「XLS」というようなビジネスグラフに特有の拡張子であればコントラストの強調を行わないと判断することもできる。
【0089】
三つ目に考慮することは、図13に示すように画像の周りに枠部があるか否かである。このような枠部が白色または黒色であれば、その輝度分布は図14に示すように、階調数の割り当て範囲内における両端に線スペクトル状に表れるとともに、内部の自然画に対応して両端以外の内側に滑らかな輝度分布としても表れる。
【0090】
むろん、枠部を輝度分布の考慮に入れない方が適切であるため、ステップS108の枠部のチェックでは階調「0」と階調「255」の画素数の和が十分に大きく、かつ、間引いて選択した画素数とは一致しないかを判断し、肯定的ならば枠部があると判定してステップS112にて枠部処理を実施する。この枠部処理では、枠部を無視するために輝度分布のうち階調「0」と階調「255」の画素数を「0」にセットする。これにより、以下の処理では枠部がないものと同様に扱うことができる。
【0091】
この例では白色または黒色の枠部を対象としているが、特定の色の枠がある場合も考えられる。このような場合、輝度分布が描く本来の滑らかなカーブの中で突出する線スペクトル状のものが表れる。従って、隣接する輝度値の間で大きく差が生じている線スペクトル状のものについては枠部として考えて輝度分布の対象としないようにすればよい。この場合、枠部以外でその色を使用していることがあり得るので、両隣の輝度値の平均を割り当てるようにしても良い。
【0092】
以上のような考慮を経た上で、コントラストの強調を行う場合にはステップS114で輝度分布の標準偏差を求めるとともに、後段の輝度変換処理のためにメジアンyMeを求めておく。標準偏差については二つの考え方があるが本実施形態においては、次式に基づいて演算する。
【0093】
【数1】

Figure 0003972192
【0094】
標準偏差は輝度分布の広がり量に対応するものであるが、広がり量を表す意味では分散を利用してもよい。
【0095】
以上の処理が分布検出処理に該当し、次に、このようにして求めた輝度分布の広がり量である標準偏差σに基づいて画像データの変換を行なう輝度変換処理について説明する。なお、上述したようにステップS106にて非拡大処理を実行した場合には、ステップS202にて所定のフラグを参照してそれを検知し、以下の処理を行うことなく当該画像処理を終了する。
【0096】
輝度変換処理では、輝度分布の広がり量に基づいて分布密度の大きい範囲に多くの階調数を与えつつ分布密度の小さい範囲に少ない階調数を割り当てる。ここで、分布密度の大きい範囲に多くの階調数を与えつつ分布密度の小さい範囲に少ない階調数を割り当てるパターンについて説明する。変換前の輝度y(入力)と変換先の輝度Y(出力)が、
Y=y …(6)
というように正比例の関係にある場合、図15に示すように、再現可能範囲内の中央部分を基準として、変換前に割り当てられている階調範囲r0と変換後に割り当てられる階調範囲R0 は一致している。しかしながら、図16に示すように入出力の対応関係がいわゆるS字カーブとなると変換前に割り当てられている階調範囲r0 に対して変換後に割り当てられる階調範囲R1 ,R2 は大きくなり、割り当てられた階調数が多くなったことになる。一方、入力における低輝度側と高輝度側における階調範囲r0を外れた範囲についていえば、変換後に割り当てられる階調範囲は少なくなったことになる。
【0097】
すなわち、このような対応関係こそ、分布密度の大きい範囲に多くの階調数を与えつつ分布密度の小さい範囲に少ない階調数を割り当てることを意味する。ここにおいて、この対応関係を実現する具体的な割り当て手法は各種のものが可能である。図17は階調範囲の中心位置ymid から高輝度側の階調範囲上端までの領域に対してγ<1のγ補正を施したものであり、変換前の中心位置ymid から上方側四分点yq3までの階調範囲rに対する変換後の階調範囲Rは拡大している。同様に図18は階調範囲の中心位置ymid から低輝度側の階調範囲下端までの領域に対してγ>1のγ補正を施したものであり、変換前の中心位置ymid から下方側四分点yq1までの階調範囲rに対する変換後の階調範囲Rは拡大している。
【0098】
一方、これらの場合において、変換前の階調範囲rに対する変換後の階調範囲Rの比はγの与え方によって変化してくる。本実施形態においては、かかる比を輝度分布の広がり量である標準偏差σに基づいて制御している。すなわち、階調範囲の中心位置ymid を「128」として、この中心位置ymid 以下ではγ1を与えるとともに、中心位置ymid より大きい範囲ではγ2を与えるものとすると、
y≦128では、
γ1=(σstd_limit/σ)**a …(7)
y>128では、
γ2=(σ/σstd_limit)**a …(8)
とし、ステップS204にてこれらのパラメータ演算を実行する。なお、上述したようにこのパラメータ演算こそ階調数割当手段を構成する。ここにおいて、σstd_limitとaは変換結果を考慮して実験的に求めて与えたパラメータであり、本実施形態においてはσstd_limitを「128」とするとともにaを「0.1」としている。標準偏差σは概して「128」よりも小さな値となるからこれらの関係式では標準偏差σが大きいと、γ2とγ1はそれぞれ「1」に近づくことになり、S字カーブの傾斜は緩やかになる。これは、広がり量が大きいときに中心位置ymid を中心とする階調範囲rに対して変換先の階調範囲Rはさほど広くならないことを意味しており、より具体的には画像データの輝度が広く分布しているときには輝度範囲を拡大するような変換を行わないことを意味する。これに対して、標準偏差σが小さいと、γ2とγ1はそれぞれ「1」から離れることになり、S字カーブの傾斜は急になる。これは、広がり量が小さいときに中心位置ymid を中心とする階調範囲rに対して変換先の階調範囲Rが広く拡大されることを意味しており、より具体的には画像データの輝度が狭い範囲にしか分布していないときには輝度範囲を拡大させる変換を行なうことを意味する。
【0099】
この例のように、階調範囲を低輝度側と高輝度側との二つに分けるとともにそれぞれにγ補正を掛けるにあたり、γが互いに逆数となる関係を与えるようにすると、低輝度側と高輝度側との接続点で滑らかに接続することになり、良好なS字カーブを与えることができる。むろん、低輝度側と高輝度側とによってγ補正の極性を変えること自体がS字カーブの対応関係を形成し、変換前の輝度yに対して変換後の輝度Yを大きく変化させることができるようになる。
【0100】
本実施形態においては、S字カーブの対応関係をγ補正によって成立させているが、図19には階調範囲の中心位置ymid の前後においてY=f・y+gなる線形の対応関係で実現する例を示している。この例では下方側四分点yq1以下と上方側四分点yq3以上の領域で再び線形の対応関係を形成している。この例においても標準偏差σが大きいときに傾斜fを「1」に近づけ、標準偏差σが小さいときに傾斜fを「1」よりも大きくなるように対応づければよい。むろん、この場合においては対応関係の急激な変化を防止するため、図20に示すように二つの対応直線を滑らかに接続するようにしても良い。
【0101】
一方、輝度分布が階調範囲の中心に収まっている場合は上述したようなγ1,γ2の設定だけで良好な輝度変換が可能となるが、図21に示すように、輝度分布のメジアンyMeがやや低輝度側に寄っていたり、図22に示すように、輝度分布のメジアンyMeがやや高輝度側に寄っていたりする場合もある。
【0102】
これに対し、図23に示す例では全範囲に対してγ<1のγ補正を施しており、この場合は変換前の低輝度側の階調範囲rに対する変換後の階調範囲Rは拡大しているし、図24に示す例では全範囲に対してγ>1のγ補正を施しており、この場合は変換前の高輝度側の階調範囲rに対する変換後の階調範囲Rは拡大している。
【0103】
従って、ステップS114にて求めたメジアンyMeと階調範囲の中央位置である「128」との大小関係を比較し、図21に示すようにメジアンyMeが低輝度側の領域に偏っているようであれば、図23に示すような全範囲に対してγ<1のγ補正を施すことにより、変換前に分布密度の高かった低輝度側の階調範囲rが拡大することになる。また、図22に示すようにメジアンyMeが高輝度側の領域に偏っているようであれば、図24に示すような全範囲に対してγ>1のγ補正を施すことにより、変換前に分布密度の高かった高輝度側の階調範囲rが拡大することになる。このようにして必ずしもS字カーブの対応関係とすることなく階調数の割り当ての拡大や縮小は可能である。むろん、これらの場合においても、γはγ<1とするかγ>1とするかに応じて(7)式や(8)式に基づいて決定すればよい。
【0104】
さらには、図25に示す例では、階調「0」、下方側四分点yq1、中心位置ymid 、上方側四分点yq3、階調「255」という五点を基準点としつつ、階調「0」と中心位置ymid と階調「255」に対してはY=yとしつつ、下方側四分点yq1と上方側四分点yq3における変換点を標準偏差に基づいて決定する。そして、これらの五点を結ぶ対応関係をスプライン補間演算やニュートン補間で求めるようにしてもよい。むろん、中心位置ymid から下方側の三点や上方側の三点をそれぞれスプライン補間演算やニュートン補間で求めるようにしてもよい。
【0105】
ところで、変換前の階調範囲に対して余りにも大きな階調範囲を割り当てるとすると、却って好ましくないことになる場合もある。夕方のような薄暮の状態では最も明るい部分から暗い部分までのコントラストの幅が狭くて当然であるのに、この画像についてコントラストを大きく拡大しようとする結果、昼間の画像のように変換されてしまいかねない。このような変換は希望されないので、拡大率には制限を設けていおき、γ1,γ2ともに制限する。例えば、γ2<0.7となっても、γ2=0.7とし、γ1>1.3となっても、γ1=1.3とする。
【0106】
以上のようにして、本実施形態ではパラメータγ1,γ2を得ることができ、ステップS204を終了する。なお、このような階調数の割り当ての変更は、言葉を換えると量子化ビット数の割り当てを変更するともいえる。
【0107】
ところで、輝度の変換時に、毎回、γ補正による演算を実行するのは非合理的である。というのは、輝度yの取りうる範囲が「0」〜「255」でしかあり得ないため、予め輝度yが取りうる全ての値に対応して変換後の輝度Yを求めておくことも可能だからである。従って、ステップS206にてこの対応関係を求め、図26に示すようなテーブルとして記憶しておく。
【0108】
ここにおいて、対応関係の具体的な演算は次のようにする。
【0109】
y≦128では、
Y=128*(y/128)**γ1 …(9)
y>128では、
Y=128*{(y−128)/128}**γ2+128
…(10)
しかしながら、メジアンyMeに基づいてγ補正の変換点を変えることも可能である。すなわち、
y≦yMeでは、
Y=yMe*(y/yMe)**γ1 …(11)
y>yMeでは、
Y=yMe*{(y−yMe)/yMe}**γ2+yMe …(12)
とすれば、メジアンyMeを中心として高輝度側と低輝度側とで輝度変換の極性を反転させたS字カーブとなり分布密度の高い辺りを中心に両側に階調数を多く割り当てることができ、全体の明るさにさほど影響を与えることなく変換することができるようになるなどの効果がある。
【0110】
このようにして演算した変換テーブルが形成されたところで画像データを変更することが可能になる。
【0111】
最後に、ステップS208にて画像データの変換を行う。ここまでは輝度を変換するための対応関係を求めてきており、例えば、RGB座標軸における成分値(Rp,Gp,Bp )についての変換関係ではなかった。しかしながら、(2)式の変換式は、このRGBの成分値(Rp,Gp,Bp )との対応関係においても当てはめることができる。また、輝度y,Yが階調「0」〜階調「255」であるのに対応してRGBの各成分値(r,g,b),(R,G,B )も同じ範囲となっており、上述した輝度y,Yの変換テーブルをそのまま利用すればよいといえる。
【0112】
従って、ステップS208では全画素の画像データ(r,g,b)について図26に示す変換テーブルを参照し、変換後の画像データ(R,G,B )を得るという処理を繰り返すことになる。
【0113】
次に、上記構成からなる本実施形態の動作を順を追って説明する。
【0114】
スキャナ11などで写真を撮像したとすると、同写真をRGBの階調データで表した画像データがコンピュータ21に取り込まれ、CPUは図5及び図6に示す画像処理のプログラムを実行して画像データのコントラストを強調する処理を実行する。
【0115】
まず、ステップS102では画像データを所定の誤差内となる範囲で間引き、選択した画素についての輝度yを求めて分布を取る。このままの分布を使用することはできず、まず、画像が白黒のような二値画像でないかステップS104にて判断するとともに、ステップS108では自然画か否かを判断する。二値画像である場合や自然画でない場合などを除き、ステップS110では画像データに枠部がないか判断し、枠部があれば除いて得られた輝度分布についてステップS114にて標準偏差σを求める。本実施形態においては、標準偏差σを求めるだけでもよいが、γ補正の極性変換点を輝度分布に合わせて変更する場合にはメジアンyMeを求めておく。
【0116】
輝度分布の標準偏差σが得られたら、
y≦128では、
γ1=(σstd_limit/σ)**a …(7)
Y=128*(y/128)**γ1 …(9)
y>128では、
γ2(σ/σstd_limit)**a …(8)
Y=128*{(y−128)/128}**γ2+128
…(10)
なる関係式より、ステップS204にてパラメータγ1,γ2を求めるとともに、ステップS206では輝度yから輝度Yへの変換関係をテーブルに記憶する。そして、ステップS208にて完成した変換テーブルを参照して全画素についての画像データを変換する。
【0117】
むろん、上述したように二値画像や自然画でない場合においてはかかる画像処理は行われないが、本発明の画像処理が行われた場合には、写真の状態では非常にコントラストが弱かったにもかかわらず、輝度の範囲を広げるように補正することにより、明暗がはっきりして鮮明な画像を得られるようになる。
【0118】
なお、上述した実施形態においては、γ1やγ2を求める際のパラメータσstd_limit,aを一定としているが、コンピュータ21上では所定のGUIを介してユーザーが選択できるようにしても良い。また、ユーザーが画像データの一部を指定して当該範囲内でのみかかるコントラストの強調処理を実行するようにすることも可能である。
【0119】
このように、ステップS102で間引きするなどしながら画像データの画素について輝度yの分布を求めた後、ステップS114にてその輝度分布の広がり量に対応する標準偏差σを求め、同標準偏差σに基づいてステップS204にてS字カーブの対応関係を形成するためのγ補正のパラメータ(γ1,γ2)を演算するようにしているため、ステップS208にて画像データ変換して変換元の輝度yにおける分布密度の高い領域には多くの階調数を割り当てるとともに分布密度の少ない領域には少ない階調数を割り当てるといった作業を自動化し、非熟練者でも容易にコントラストの強調を行うことができるようになる。
【図面の簡単な説明】
【図1】 本発明の一実施形態にかかる画像処理装置が適用される画像処理システムのブロック図である。
【図2】 同画像処理装置の具体的ハードウェア構成例を示すブロック図である。
【図3】 本発明の画像処理装置の他の適用例を示す概略ブロック図である。
【図4】 本発明の画像処理装置の他の適用例を示す概略ブロック図である。
【図5】 本発明の画像処理装置における輝度の分布検出処理部分を示すフローチャートである。
【図6】 本発明の画像処理装置における輝度変換処理部分を示すフローチャートである。
【図7】 変換元の画像における座標を示す図である。
【図8】 サンプリング周期を示す図である。
【図9】 サンプリング画素数を示す図である。
【図10】 変換元の画像とサンプリングされる画素の関係を示す図である。
【図11】 白黒の画像を示す図である。
【図12】 白黒の画像の輝度分布を示す図である。
【図13】 枠部のある画像を示す図である。
【図14】 枠部のある画像の輝度分布を示す図である。
【図15】 階調数の割り当てを変更しない場合の変換前の輝度と変換後の輝度との関係を示すグラフである。
【図16】 変換前の輝度と変換後の輝度とがγ補正によってS字カーブの対応関係となるグラフである。
【図17】 高輝度側の領域でγ<1のγ補正をかけた場合のグラフである。
【図18】 低輝度側の領域でγ>1のγ補正をかけた場合のグラフである。
【図19】 変換前の輝度と変換後の輝度とが線形の変換でS字カーブの対応関係となるグラフである。
【図20】 同対応関係で変換特性の変換点で滑らかに変換されるようにする場合の変形例である。
【図21】 メジアンが低輝度側に寄っている場合の輝度分布を示す図である。
【図22】 メジアンが高輝度側に寄っている場合の輝度分布を示す図である。
【図23】 全領域でγ<1のγ補正をかけた場合のグラフである。
【図24】 全領域でγ>1のγ補正をかけた場合のグラフである。
【図25】 特定した変換点を補間法で接続する場合のグラフである。
【図26】 輝度分布を拡大する際の変換テーブルを示す図である。
【符号の説明】
10…画像入力装置
11…スキャナ
11b…スキャナ
12…デジタルスチルカメラ
12a…デジタルスチルカメラ
12b…デジタルスチルカメラ
13b…モデム
20…画像処理装置
21…コンピュータ
22…ハードディスク
30…画像出力装置
31…プリンタ
31a…プリンタ
31b…プリンタ
32…ディスプレイ
32a…ディスプレイ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image processing apparatus and an image processing method, and more particularly to an image processing apparatus and an image processing method for enhancing the contrast of an image in which pixels are arranged in a vertical direction and a horizontal direction.
[0002]
[Prior art]
Image data taken with a scanner or taken with a digital still camera is configured in a dot matrix. Although it is sufficient if the captured image data is in a preferable state, there are cases where it is desired to make corrections according to preferences using the characteristics of digital images. In particular, when the contrast is weak, it is difficult to correct a photo using a conventional color film. Such a photo must be re-taken, but if it is a digital image, use image correction software. The contrast can be enhanced.
[0003]
That is, conventionally, image correction software has been used to correct such digital image data, and the operator can perform various corrections by being started on the computer. For example, the contrast enhancement as described above can be performed by performing a brightness enlargement operation. More specifically, by changing the correspondence between the luminance of the conversion source and the luminance of the conversion destination from a directly proportional state to a moderately distorted S-shape, the luminance having a certain width at the conversion source is converted. It can be associated with a wider width first.
[0004]
[Problems to be solved by the invention]
In the above-described conventional image processing apparatus, although it is possible to enhance the contrast by an operator's operation, the necessary parameter values can only be given by intuition, and for those who are not used to processing image data, as expected There was a problem of operability, such as the contrast could not be emphasized, and the twilight photos became like noon.
Further, when sampling and thinning out pixels of an image in which pixels are arranged in the vertical direction and the horizontal direction, a width >> height as shown in a bitmap image having the number of pixels of (width) × (height) shown in FIG. If the sampling period is determined with the longer width, only the upper and lower lines of pixels are extracted in the vertical direction as shown in FIG. It might be.
[0005]
The present invention relates to an image processing apparatus and an image which can perform processing for enhancing the contrast of an image by eliminating the bias of extraction points of an image when sampling and thinning out pixels of an image in which pixels are arranged in a vertical direction and a horizontal direction The purpose is to provide a processing method.
[0006]
[Means for Solving the Problems]
In order to achieve the above object, an invention according to claim 1 is an image processing apparatus for performing a process of enhancing contrast of an image in which pixels are arranged in a vertical direction and a horizontal direction. When sampling and thinning in the horizontal direction, thinning is performed so that the number of extraction based on the number of pixels in the smaller direction in the vertical direction and the horizontal direction is ensured, and for each pixel after thinning A luminance distribution of the image is obtained from a luminance equivalent value of a predetermined number of gradations, an amount representing a variation in the luminance equivalent value for each pixel is calculated from the obtained luminance distribution, and the contrast of the image is calculated based on the amount representing the variation. The processing for emphasizing is performed.
[0007]
In the invention configured as described above, when the pixels of the image are sampled and thinned out in the vertical direction and the horizontal direction, the number of pixels in the smaller direction in the vertical direction and the horizontal direction is reduced. Thinning is performed so that the number of extractions based on the number is secured. From the luminance equivalent value of the predetermined number of gradations for each pixel after thinning, the luminance distribution of the image is obtained. From the obtained luminance distribution, an amount representing the variation of the luminance equivalent value for each pixel is calculated. A process of enhancing the contrast of the image based on the amount representing the variation is performed.
Incidentally, the number of gradations may be assigned based on the amount representing the variation of the luminance equivalent value.
For example, when the luminance distribution is concentrated in a certain width, if the number of gradations is given so as to widen the width, the contrast is enhanced and the contrast becomes clear.
At this time, there is no problem even if the number of gradations assigned to the portion where the luminance distribution is not concentrated is reduced.
For this reason, according to a second aspect of the present invention, in the image processing apparatus according to the first aspect, a small number of gradations is assigned to a gradation range having a small distribution density based on an amount representing variation in the luminance equivalent value. In this configuration, a large number of gradations are assigned to a gradation range having a large distribution density, and the luminance equivalent value of each pixel is converted in accordance with the change in the assignment of the number of gradations.
[0008]
Of course, if the luminance distribution is not concentrated, it is not necessary to change the number of gradations.
[0009]
Such an operation for obtaining the amount representing the variation in the luminance equivalent value is detected based on the intuition that the operator has performed in the conventional operation, and the level corresponding to the amount representing the variation in the luminance equivalent value is determined. The operation of assigning a large number of logarithms corresponds to setting the parameter given by the operator.
[0010]
Here, various methods are possible for obtaining the amount representing the variation of the luminance equivalent value from the luminance distribution. It may be a value that corresponds to an amount that represents a known variation in luminance equivalent value, or a measure that reduces the amount of calculation to obtain an amount that represents a variation in luminance equivalent value. good. The invention according to claim 3 is the image processing apparatus according to claim 1 or 2, wherein the amount representing the variation in the luminance equivalent value is the amount representing the variation in the luminance equivalent value. Using the value corresponding to the standard deviation, when the standard deviation of the luminance distribution is large, the input / output ratio is reduced to equalize the number of gradations, and when the standard deviation is small, the input / output ratio is increased. Thus, the change in the number of gradations is enlarged.
[0011]
In the invention configured as described above, the standard deviation represents the variation amount of each element with respect to the average value. Therefore, if the variation is large, the luminance conversion is not necessary, and the input / output ratio is increased to increase the scale. There is no need for a transformation that enlarges the change in key assignment. That is, since the luminance distribution is not concentrated, it is not necessary to increase or decrease the number of gradations. However, a small standard deviation means that there is little variation, in which case the luminance distribution is concentrated, so contrast is enhanced by giving a large number of gradations to a large distribution density range. Let
[0012]
Of course, since the standard deviation is used to represent variation, it is synonymous with variance, and the calculation process does not necessarily require division by the number of samples.
[0013]
Giving more or less gradations generally corresponds to the input / output ratio. If more gradations are given, the number of gradations is larger than that given on the input side. The number of gradations is given and the gradation is expanded within the range, which is an enhancement of contrast. On the other hand, since the total number of gradations cannot be increased or decreased, if a large number of gradations is given to a certain range, it is impossible to give a large number of gradations to the remaining range as a reaction. The number of gradations smaller than the number of gradations is given, and the contrast is narrowed within the range.
[0014]
It is possible to determine how to convert the number of gradations for each gradation, but as a simpler example, the invention according to claim 4 is the invention according to claim 3. In the described image processing apparatus, the value of γ is set so that the amount of change due to γ correction is small when the luminance distribution is subjected to γ correction and the standard deviation is large, and the amount of change in γ correction is small when the standard deviation is small. The value of γ is set so as to increase.
[0015]
In the invention configured as described above, a correspondence relationship of being convex upward or convex downward is given by the method of γ correction. And a small number of gradations is assigned to the second half, and if it is convex downward, a small number of gradations is assigned to the first half and a gradation is assigned to the second half. A lot will be allocated.
The magnitude of the allocated amount can be adjusted as appropriate by the amount of change due to γ correction, and corresponds to the value of γ given.
[0016]
As one correspondence to this γ correction, the invention according to claim 5 is the image processing apparatus according to claim 4, wherein the approximate center position of the brightness distribution is obtained and the high brightness side and the low brightness side are determined based on the approximate center position. By reversing the polarity of the luminance conversion on the luminance side, the luminance conversion of the approximate S-shaped curve is performed according to the relationship between the input and the output.
[0017]
In the invention configured as described above, in order to reverse the polarity of luminance conversion by γ correction, by performing γ correction of γ <1 on the high luminance side and γ correction of γ> 1 on the low luminance side, The downwardly convex curve and the upwardly convex curve are continuous, and the so-called S-curve input / output relationship is established. In this case, a large number of gradations are assigned to the central part, so if a continuous point of two curves is brought to the approximate center of the luminance distribution, a large number of gradations will be included in the range where the luminance distribution is to be expanded. Can be assigned.
[0018]
In converting the luminance by various methods, the invention according to claim 6 is the image processing apparatus according to any one of claims 1 to 5, wherein the conversion destination is within the range that the conversion source luminance can take. Luminance is calculated and stored, and this correspondence is called up and converted at the time of conversion.
[0019]
Although it is not impossible to calculate the luminance every time based on the conversion formula, the range of values that the luminance distribution can take is determined. For this reason, if the brightness of the conversion destination is calculated and stored in advance based on the brightness of the conversion source, it is possible to perform the conversion simply by invoking the correspondence at the time of conversion.
[0020]
In converting the luminance, the image data may be included as luminance data, or may be indirect only including luminance data. Of course, if direct luminance data is included, it may be converted, and even if it is indirect luminance data, it may be converted into luminance data before performing predetermined luminance conversion. However, the luminance conversion does not have to be very accurate, and it can be said that it is sufficient to know roughly.
[0021]
In that sense, since strict accuracy is not required, the invention according to claim 7 is the image processing apparatus according to any one of claims 1 to 6, wherein the image data corresponds to the luminance. In the case of being expressed by a plurality of component values, the luminance is calculated by linear addition of the same component values.
[0022]
When the image data is represented by so-called RGB (red, green, and blue) gradation data, it can be said that each component value for red, green, and blue corresponds to the luminance. For this reason, it can be said that linear addition of the same component values sufficiently represents luminance, and can be an extremely easy conversion method.
[0023]
As the luminance for each pixel is obtained, the luminance distribution as an image is not necessarily obtained for all the pixels of the image data, and the luminance distribution is obtained by thinning out the image data corresponding to a predetermined extraction rate.
[0024]
For the purpose of obtaining the distribution, it is possible to obtain a luminance distribution with a certain degree of certainty according to the extraction rate even if thinning is performed at a predetermined extraction rate without obtaining luminance for all pixels.
[0025]
Here, the predetermined number of extractions is ensured on the short side in the vertical and horizontal ranges.
[0026]
Since the image is flat, the image data is also naturally distributed in the vertical and horizontal directions, but in determining a certain extraction rate, by ensuring a certain number of extractions at least on the short side, the extraction rate is reduced. The certainty corresponding to it is held.
[0027]
The invention according to claim 8 is characterized in that, in the image processing apparatus according to any one of claims 1 to 7, a limit is set to the degree of contrast enhancement.
[0028]
It may be natural that the contrast is narrow. For example, in the evening scenery, it is natural that the width of the luminance distribution is narrow, and if it is enlarged more than necessary, it becomes a daytime scenery. A similar example is possible in other cases, and this phenomenon is avoided by setting a limit on the expansion range of the luminance distribution.
[0029]
Furthermore, the invention according to claim 9 is the image processing apparatus according to any one of claims 1 to 8, wherein the binary image data is determined based on the luminance distribution, and if the binary image data is used. The configuration is such that no contrast enhancement is performed.
[0030]
Since it can be said that there is no substantial luminance distribution for a binary image, contrast enhancement is not performed when binary image data is determined from the luminance distribution.
[0031]
Since the binary image data can also have a certain color, it can have two luminance levels corresponding to the presence or absence of the color. Although it is possible to determine whether or not the brightness of the color, the invention according to claim 10 is reproduced in the image processing apparatus according to claim 9 in response to a case where there is no information suggesting the brightness. When the luminance distribution is concentrated at both ends within the possible range, it is determined that the binary image data is black and white.
[0032]
That is, for a black and white image, it can be determined that the luminance distribution is concentrated at both ends within the reproducible range.
[0033]
Furthermore, the invention according to claim 11 is the image processing device according to any one of claims 1 to 10, wherein the frame portion of the image data is determined based on the protruding luminance distribution and the frame portion is provided. For example, the frame data is not used for contrast enhancement.
[0034]
When an image is processed, it can frequently occur that it has a frame. If it exists as a single-color frame, only the luminance distribution corresponding to that color naturally protrudes. Therefore, if such a protruding luminance distribution is used as a criterion for enhancement determination, effective determination cannot be made. Therefore, it is determined that the frame portion is not used for contrast enhancement.
[0035]
Further, as an example, the invention according to claim 12 determines that the luminance distribution concentrated on the end within the reproducible range is the frame in the image processing apparatus according to claim 11. That is the configuration.
[0036]
A white frame or a black frame is frequently used and may be generated depending on a trimming result, and corresponds to an end portion within a reproducible range. Therefore, the luminance distribution concentrated on the end portion is determined as the frame portion.
[0037]
By the way, the invention according to claim 13 is configured such that the image processing apparatus according to any one of claims 1 to 12 does not perform contrast enhancement when the image data is not a natural image.
[0038]
The narrowness of contrast tends to be a problem for natural images such as photographs, and it can be said that there is almost no need for such things as business graphs. Conversely, modifying something like a business graph can lead to a difference from the creator's image. Therefore, the luminance distribution is expanded only in the case of such a natural image.
[0039]
As an example of determining whether or not the image is a natural image, the invention according to claim 14 is the image processing device according to claim 13, wherein the image data is determined not to be a natural image when the luminance distribution exists in a spectral form. The image processing apparatus includes a natural image determination unit that performs the operation.
[0040]
It can be said that the brightness distribution has a smooth width as a feature of the natural image. Therefore, if the luminance distribution appears in a line spectrum, it can be determined that the image is not a natural image. In the invention according to claim 14 configured as described above, the natural image determination means determines the state of the luminance distribution, determines that the image data is not a natural image when it exists in a line spectrum, and thereby the luminance distribution Will not be expanded.
[0041]
Furthermore, the invention according to claim 15 is an image processing method for performing a process of enhancing the contrast of an image in which pixels are arranged in the vertical direction and the horizontal direction, and sampling the pixels of the image in the vertical direction and the horizontal direction. When thinning out, thinning is performed so that the number of extraction based on the number of pixels in the direction of the smaller number of pixels in the vertical direction and the horizontal direction is ensured, and a predetermined number of gradations for each pixel after thinning is performed. A process of obtaining a luminance distribution of the image from the luminance equivalent value, calculating an amount representing a variation of the luminance equivalent value for each pixel from the obtained luminance distribution, and enhancing a contrast of the image based on the amount representing the variation. The configuration is to be performed.
[0042]
That is, it is not necessarily limited to a substantial apparatus, and there is no difference that the method is effective.
[0043]
By the way, such an image processing apparatus may exist independently, or may be used in a state of being incorporated in a certain device, and includes various aspects as an idea of the invention. Further, it can be changed as appropriate, such as software or hardware.
[0044]
As an example, even in a printer driver that converts image data corresponding to printing ink based on image data of a plurality of input pixels and prints it on a predetermined color printer, attention is paid to each pixel as a processing target. While moving the pixel, the luminance equivalent value of the target pixel is aggregated to obtain the luminance distribution, and the spread amount of the luminance distribution corresponding to the variation amount of each element is calculated based on the obtained luminance distribution. It is possible to adopt a configuration in which the contrast is enhanced by performing conversion processing between the input and the output so that a correspondence relationship in which a large number of gradations is assigned to a gradation range having a large distribution density based on the amount.
[0045]
In other words, the printer driver converts the input image data corresponding to the printing ink. At this time, while moving the pixel of interest with each pixel as a processing target, the luminance equivalent value of the pixel of interest is aggregated to obtain the luminance distribution. Based on the obtained luminance distribution, the spread amount of the luminance distribution corresponding to the variation amount of each element is calculated, and a large number of gradations is assigned to the gradation range having a large distribution density based on the spread amount. The input image is converted and printed so as to enhance the contrast by performing a conversion process between the input and the output so as to have a correspondence relationship.
[0046]
In the case of software for an image processing apparatus as an embodiment of the idea of the invention, it naturally exists on a recording medium on which such software is recorded and must be used. Of course, the recording medium may be a magnetic recording medium, a magneto-optical recording medium, or any recording medium that will be developed in the future. In addition, the duplication stages such as the primary duplication product and the secondary duplication product are equivalent without any question.
[0047]
Further, even when a part is software and a part is realized by hardware, the idea of the invention is not completely different, and a part is stored on a recording medium and is appropriately changed as necessary. It may be in the form of being read. Furthermore, it goes without saying that the present invention can also be applied to an image processing apparatus such as a color facsimile machine or a color copier.
[0048]
【The invention's effect】
As described above, according to the first and second aspects of the invention, since the degree of contrast enhancement is automatically determined from the amount representing the variation of the luminance equivalent value, even a non-expert can easily adjust the contrast appropriately. It is possible to enhance the contrast of the image by eliminating the bias of the extraction points of the image when sampling and thinning out the pixels of the image in which the pixels are arranged in the vertical direction and the horizontal direction. A possible image processing apparatus can be provided.
[0049]
According to the invention of claim 3, the input / output ratio is only determined based on the well-known standard deviation, and the configuration becomes easy.
[0050]
Furthermore, according to the fourth aspect of the present invention, since the conversion is performed by γ correction, the configuration becomes easy.
[0051]
Furthermore, according to the fifth aspect of the present invention, it is possible to efficiently perform distributed conversion when it is desired to enhance contrast by performing luminance conversion based on the correspondence relationship of the approximate S-curve based on the approximate center position of the luminance distribution. .
[0052]
Furthermore, according to the sixth aspect of the invention, conversion can be facilitated.
[0053]
Furthermore, according to the seventh aspect of the present invention, the luminance can be easily obtained with a necessary and sufficient degree of accuracy.
[0054]
Furthermore, according to the eighth aspect of the present invention, it is possible to prevent the contrast of the image from being changed too much by changing the atmosphere of the image.
[0055]
Furthermore, according to the ninth aspect of the present invention, it is possible to easily determine a condition that does not require contrast enhancement and prevent enhancement.
[0056]
Furthermore, according to the tenth aspect of the present invention, it is possible to efficiently determine a monochrome image having a high frequency.
[0057]
Furthermore, according to the invention concerning Claim 11, it can prevent that a process becomes inaccurate by the brightness | luminance of the frame part which tends to appear in an image.
[0058]
Furthermore, according to the twelfth aspect of the present invention, it is possible to easily determine a black and white frame portion having a high frequency.
[0059]
Furthermore, according to the invention of claim 13, it can be performed only in the case of a natural image that requires contrast enhancement. Further, according to the invention of claim 14, whether or not the image is a natural image can be determined. It can be easily determined.
[0060]
According to the fifteenth aspect of the present invention, since the degree of contrast enhancement is automatically determined from the amount representing the variation in the luminance equivalent value, even an unskilled person can easily enhance the contrast by an appropriate amount. There is also provided an image processing method capable of enhancing the contrast of an image by eliminating the bias of the extraction points of the image when sampling and thinning out the pixels of the image in which the pixels are arranged in the vertical direction and the horizontal direction. be able to.
[0061]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0062]
FIG. 1 is a block diagram illustrating an image processing system according to an embodiment of the present invention, and FIG. 2 is a block diagram illustrating a specific hardware configuration example.
[0063]
In the figure, an image input device 10 captures an image and outputs image data to the image processing device 20. The image processing device 20 performs image processing such as predetermined contrast enhancement and outputs the image data to the image output device 30. Then, the image output device 30 displays an image with enhanced contrast.
[0064]
Here, a specific example of the image input device 10 corresponds to the scanner 11, the digital still camera 12, or the video camera 14, and a specific example of the image processing device 20 corresponds to a computer system including the computer 21 and the hard disk 22. Specific examples of the output device 30 include a printer 31, a display 32, and the like. Of course, the present invention can be applied to color copiers, color facsimile machines and the like in addition to these.
[0065]
In the present image processing system, since an optimum contrast is to be given to an image having a low contrast, image data obtained by taking a photograph with a scanner 11 as the image input device 10 or a digital still camera 12 is used. The image data having a low contrast taken in step 1 or the moving image taken by the video camera 14 is a processing target and is input to the computer system as the image processing apparatus 20. Note that the calculation speed of the input image of the video camera 14 may not be in time. In such a case, it is possible to cope with this by setting the first condition that requires calculation time for each shooting scene and performing only the image conversion of each frame under the same condition setting during shooting.
[0066]
The image processing apparatus 20 includes at least a luminance distribution detection unit that extracts a luminance distribution, a luminance distribution spread amount detection unit that first detects a spread amount of the luminance distribution based on the detected luminance distribution, and the spread amount. Based on the above, a gradation number assigning unit that assigns a large number of gradations to a range with a high distribution density and assigns a small number of gradations to a range with a low distribution density, and converts image data based on the assigned luminance gradation And image data conversion means. Of course, the image processing apparatus 20 may also be a color conversion unit that corrects a color difference for each model, or a resolution conversion unit that converts a resolution corresponding to each model. . In this example, the computer 21 executes each image processing program stored in the internal ROM or the hard disk 22 while using a RAM or the like.
[0067]
The execution result of this image processing program is obtained as image data with enhanced contrast as will be described later, and is printed by the printer 31 that is the image output device 30 based on the obtained image data, or by the same image output device 30. It is displayed on a certain display 32. More specifically, this image data is RGB (green, blue, red) gradation data, and the image has dots arranged in a grid in the vertical direction (height) and the horizontal direction (width). It is configured as matrix data.
[0068]
In the present embodiment, a computer system is incorporated between image input / output devices to perform image processing. However, such a computer system is not necessarily required, and a digital still camera as shown in FIG. A system in which an image processing device for emphasizing contrast is incorporated in 12a and the converted image data is displayed on the display 32a or printed on the printer 31a may be used. As shown in FIG. 4, in the printer 31b that inputs and prints image data without using a computer system, the image data input through the scanner 11b, the digital still camera 12b, the modem 13b, or the like is automatically received. It is also possible to configure so as to enhance contrast.
[0069]
FIG. 5 shows luminance distribution detection processing corresponding to luminance distribution detection means and luminance distribution spread amount detection means in the image processing executed by the computer 21. The gradation number allocation means, image data conversion means, A luminance conversion process corresponding to is shown in FIG.
[0070]
FIG. 5 mainly corresponds to luminance distribution detection processing. First, the luminance distribution detection processing will be described.
[0071]
Before describing how to represent luminance, the pixels to be distributed will be described. As shown in step S102 of FIG. 5, a thinning process for thinning out the target pixels is executed. As shown in FIG. 7, in the case of a bitmap image, it is formed as a two-dimensional dot matrix consisting of predetermined dots in the vertical direction and predetermined dots in the horizontal direction, and all pixels can be obtained if an accurate luminance distribution is obtained. It is necessary to examine the brightness. However, this distribution extraction process is intended to determine the amount of spread of the luminance distribution, and is not necessarily accurate. Therefore, it is possible to perform thinning to such an extent that it is within a certain error range. According to the statistical error, the error with respect to the number of samples N can be expressed as 1 / (N ** (1/2)). However, ** represents a power. Therefore, in order to perform processing with an error of about 1%, N = 10000.
[0072]
Here, the bitmap screen shown in FIG. 7 has the number of pixels of (width) × (height), and the sampling period ratio is
ratio = min (width, height) / A + 1
... (1)
And This min (width, height) is the smaller of width and height, and A is a constant. Further, the sampling period ratio here indicates how many pixels are sampled, and the pixels marked with ◯ in FIG. 8 indicate the case where the sampling period ratio = 2. That is, one pixel is sampled every two pixels in the vertical and horizontal directions, and every other pixel is sampled. The number of sampling pixels in one line when A = 200 is as shown in FIG.
[0073]
As can be seen from the figure, except for the case where the sampling period ratio = 1 in which sampling is not performed, when there is a width of 200 pixels or more, the number of samples is at least 100 pixels. Therefore, in the case of 200 pixels or more in the vertical direction and the horizontal direction, (100 pixels) × (100 pixels) = (10000 pixels) is secured, and the error can be reduced to 1% or less.
[0074]
Here, the reason for using min (width, height) as a reference is as follows. For example, as shown in FIG. 10 (a), when width >> height is satisfied and the sampling period ratio is determined by the longer width, as shown in FIG. 10 (b). In addition, in the vertical direction, only two lines of the upper end and the lower end may be extracted. However, if the sampling period ratio is determined based on the smaller one as min (width, height), thinning is performed so as to include the intermediate portion in the smaller vertical direction as shown in FIG. Will be able to.
[0075]
In this example, thinning is performed with an accurate sampling period for pixels in the vertical and horizontal directions. This is suitable for processing while thinning out pixels that are sequentially input. However, when all the pixels have been input, the pixels may be selected by randomly specifying coordinates in the vertical direction or the horizontal direction. In this way, when the necessary minimum number of pixels, such as 10,000 pixels, is determined, the extraction process is repeated at random until the number of pixels reaches 10,000, and the extraction is stopped when the number of pixels reaches 10,000.
[0076]
If the pixel data for the selected pixel has luminance as its component element, the distribution can be obtained using the luminance value. However, even in the case of image data in which the luminance value is not a direct component value, the component value that indirectly represents the luminance is provided. Accordingly, the luminance value can be obtained by performing conversion from the color space where the luminance value is not a direct component value to the color space where the luminance value is a direct component value.
[0077]
Such color conversion between different color spaces is not uniquely determined by a conversion formula, but a mutual relationship is obtained for each color space having the respective component values as coordinates, and this correspondence is stored. It is necessary to perform sequential conversion with reference to the color conversion table. In relation to the table, the component value is expressed as a gradation value, and in the case of 256 gradations having a three-dimensional coordinate axis, a color conversion table of about 16.7 million (256 × 256 × 256) elements is obtained. Must have. As a result of considering the efficient use of storage resources, correspondence is not prepared for all coordinate values, but usually correspondence is prepared for appropriate discrete lattice points, and interpolation is used together. Like to do. Since this interpolation calculation is possible through several multiplications and additions, the amount of calculation processing becomes enormous.
[0078]
That is, if a full-size color conversion table is used, the processing amount is reduced, but the table size becomes an unrealistic problem, and if the table size is made a realistic size, the calculation processing amount becomes unrealistic. There are many cases.
[0079]
In view of such a situation, in the present embodiment, as used in the case of a television or the like, the following conversion formula for obtaining luminance from the three primary colors of RGB is adopted. That is, for the luminance yp at the point P, from the RGB component values (Rp, Gp, Bp),
yp = 0.30Rp + 0.59Gp + 0.11Bp (2)
And In this way, the luminance value can be obtained by only three multiplications and two additions. Then, a frequency distribution is obtained by using a variable region of an array corresponding to all gradations.
[0080]
In this embodiment, as a result of targeting the RGB color space, such a conversion formula is adopted, but since each component value indicates the brightness of the color in the background, each component is When the value is viewed alone, it has a property of linearly corresponding to the luminance. Therefore, more roughly speaking, without considering each addition ratio simply
yp = (Rp + Gp + Bp) / 3 (3)
It is not impossible to simplify it, and
yp = Gp (4)
As described above, in the equation (3), the green component value having the largest ratio can be used as the luminance value.
[0081]
In the thinning-out process, the luminance is obtained from the RGB image data at the same time for the selected pixel, and the distribution is obtained. Finally, in step S114, a standard deviation corresponding to the spread amount is obtained based on this distribution, but there are matters to consider before that.
[0082]
The first is a case where the image is a binary image such as a black and white image. The concept of contrast enhancement is inappropriate for binary images including black and white images. If there is a black and white image as shown in FIG. 11, the luminance distribution for this image is concentrated at both ends within the allocated number of gradations as shown in FIG. Basically, it concentrates on the gradation “0” and the gradation “255”.
[0083]
Therefore, when performing the black and white check in step S104, it can be determined whether or not the sum of the number of pixels of gradation “0” and gradation “255” matches the number of pixels selected by thinning. In the case of a monochrome image, the non-enlargement process is executed in step S106 in order to interrupt the process without executing the following process. In the present embodiment, the distribution extraction process and the luminance conversion process are roughly divided. Therefore, in this non-enlarging process, a flag is set so that the subsequent luminance conversion process is not executed, and the distribution extraction process is terminated.
[0084]
The binary data is not limited to black and white, and there may be binary data with color. In such a case as well, there is no need to perform the process of enhancing the contrast, and if the distribution state is examined and the distribution is concentrated only on two values (one is approximately “0”), the process is interrupted as binary data. Can be achieved.
[0085]
Second, consider whether the image is like a business graph or a natural picture like a photograph. Although a process of enhancing contrast is sometimes required for natural images, it is often preferred that contrast is not enhanced for business graphs or paintings. Accordingly, in step S108, it is checked whether or not the image is a natural image.
[0086]
In natural paintings, the number of colors including shadows is extremely large, but in certain types of paintings such as business graphs and draws, the number of colors is often limited. Therefore, if the number of colors is small, it can be determined that the image is not a natural image. In order to accurately determine the number of colors, it is necessary to determine how many of 16.7 million colors are used as described above, but this is not realistic. On the other hand, when the number of colors is extremely small as in the business graph, the probability that the colors are different and have the same luminance is low. That is, the approximate number of colors can be determined based on the luminance. If the number of colors is small, the luminance distribution is sparse, and in a business graph, it appears as a line spectrum. For this reason, in step S108, the number of luminance values whose distribution number is not “0” among the luminances of 256 gradations is counted. If it is less than “64” color (gradation), which is approximately ¼, it is determined that the image is not a natural image, and the non-enlargement process is executed in step S106 as in the case of binary data. Of course, whether or not it is equal to or less than “64” color (gradation) as the threshold can be changed as appropriate.
[0087]
It is also possible to determine whether or not the distribution is a line spectrum by the adjacent ratio of luminance values whose distribution number is not “0”. That is, it is determined whether or not there is a distribution number in the luminance values adjacent to the luminance value that is not “0”. If at least one of the two adjacent luminance values is adjacent, nothing is performed, and if both are not adjacent, the count is performed. As a result, the ratio between the number of luminance values other than “0” and the count value is used. Just judge. For example, if the number of luminance values other than “0” is “64” and the number of non-adjacent ones is “64”, it can be seen that the line spectrum is distributed.
[0088]
Further, when the image processing program is executed via the operating system, it is possible to make a determination based on the extension of the image file. Of bitmap files, especially photographic images are compressed, and an implicit extension is often used to indicate the compression method. For example, an extension “JPG” indicates that the file is compressed in the JPEG format.
Since the operating system manages the file name, if you send an inquiry to the operating system from the printer driver, the extension of the file will be answered. What is necessary is just to judge that there exists and to perform contrast emphasis. In addition, if the extension is unique to a business graph such as “XLS”, it can be determined that contrast enhancement is not performed.
[0089]
A third consideration is whether or not there is a frame around the image as shown in FIG. If such a frame portion is white or black, as shown in FIG. 14, the luminance distribution appears in a line spectrum shape at both ends in the gradation number allocation range, and both ends corresponding to the internal natural image. It also appears as a smooth luminance distribution inside
[0090]
Of course, since it is more appropriate not to take the frame portion into consideration of the luminance distribution, the sum of the number of pixels of the gradation “0” and the gradation “255” is sufficiently large in the frame check in step S108, and It is determined whether the number of pixels selected by the thinning does not match. If the result is affirmative, it is determined that there is a frame, and the frame processing is performed in step S112. In this frame processing, in order to ignore the frame, the number of pixels of gradation “0” and gradation “255” in the luminance distribution is set to “0”. Thereby, in the following process, it can handle like the thing without a frame part.
[0091]
In this example, a white or black frame portion is targeted, but there may be a case where there is a specific color frame. In such a case, a protruding line spectrum appears in the original smooth curve drawn by the luminance distribution. Accordingly, a line spectrum having a large difference between adjacent luminance values may be considered as a frame portion and not subjected to luminance distribution. In this case, since the color may be used other than the frame portion, an average of luminance values on both sides may be assigned.
[0092]
In the case where contrast enhancement is performed after considering the above consideration, in step S114, the standard deviation of the luminance distribution is obtained, and the median yMe is obtained for the luminance conversion processing in the subsequent stage. There are two ways of thinking about the standard deviation, but in the present embodiment, calculation is performed based on the following equation.
[0093]
[Expression 1]
Figure 0003972192
[0094]
The standard deviation corresponds to the spread amount of the luminance distribution, but dispersion may be used to express the spread amount.
[0095]
The above processing corresponds to the distribution detection processing. Next, luminance conversion processing for converting image data based on the standard deviation σ that is the amount of spread of the luminance distribution thus obtained will be described. As described above, when the non-enlargement process is executed in step S106, the predetermined process is detected with reference to a predetermined flag in step S202, and the image process is terminated without performing the following process.
[0096]
In the luminance conversion processing, a small number of gradations is assigned to a range with a small distribution density while giving a large number of gradations to a range with a large distribution density based on the spread amount of the luminance distribution. Here, a pattern that assigns a small number of gradations to a range with a small distribution density while giving a large number of gradations to a range with a large distribution density will be described. The luminance y (input) before conversion and the luminance Y (output) of the conversion destination are
Y = y (6)
As shown in FIG. 15, the gradation range r0 assigned before the conversion and the gradation range R0 assigned after the conversion are equal to each other with the central portion in the reproducible range as a reference, as shown in FIG. I'm doing it. However, as shown in FIG. 16, when the input / output correspondence is a so-called S-shaped curve, the gradation ranges R1 and R2 assigned after conversion become larger and assigned to the gradation range r0 assigned before conversion. The number of tones increased. On the other hand, regarding the range outside the gradation range r0 on the low luminance side and the high luminance side in the input, the gradation range assigned after conversion is reduced.
[0097]
That is, this correspondence means that a large number of gradations is given to a range with a large distribution density and a small number of gradations is assigned to a range with a small distribution density. Here, various concrete allocation methods for realizing this correspondence can be used. FIG. 17 is obtained by performing γ correction of γ <1 on the region from the center position ymid of the gradation range to the upper end of the gradation range on the high luminance side, and the upper quadrant from the center position ymid before conversion. The converted gradation range R with respect to the gradation range r up to yq3 is expanded. Similarly, FIG. 18 is obtained by performing γ correction with γ> 1 on the region from the center position ymid of the gradation range to the lower end of the gradation range on the low luminance side. The converted gradation range R with respect to the gradation range r up to the dividing point yq1 is enlarged.
[0098]
On the other hand, in these cases, the ratio of the gradation range R after conversion to the gradation range r before conversion varies depending on how γ is given. In this embodiment, the ratio is controlled based on the standard deviation σ that is the amount of spread of the luminance distribution. That is, assuming that the center position ymid of the gradation range is “128”, γ1 is given below this center position ymid, and γ2 is given in a range larger than the center position ymid.
For y ≦ 128,
γ1 = (σstd_limit / σ) ** a (7)
For y> 128,
γ2 = (σ / σstd_limit) ** a (8)
In step S204, these parameter calculations are executed. As described above, this parameter calculation constitutes the gradation number assigning means. Here, σstd_limit and a are parameters obtained experimentally in consideration of the conversion result. In this embodiment, σstd_limit is set to “128” and a is set to “0.1”. Since the standard deviation σ is generally smaller than “128”, in these relational expressions, when the standard deviation σ is large, γ2 and γ1 each approach “1”, and the slope of the S-shaped curve becomes gentle. . This means that the gradation range R of the conversion destination is not so wide with respect to the gradation range r centered on the center position ymid when the spread amount is large, more specifically, the brightness of the image data. Means that the conversion for expanding the luminance range is not performed. On the other hand, when the standard deviation σ is small, γ2 and γ1 are separated from “1”, and the slope of the S-curve becomes steep. This means that when the spread amount is small, the gradation range R of the conversion destination is widened with respect to the gradation range r centered on the center position ymid. When the luminance is distributed only in a narrow range, it means that conversion for expanding the luminance range is performed.
[0099]
As shown in this example, when the gradation range is divided into two, the low luminance side and the high luminance side, and γ correction is applied to each of them, if γ is given a reciprocal relationship, the low luminance side and the high luminance side A smooth connection is made at the connection point with the luminance side, and a good S-shaped curve can be given. Of course, changing the polarity of the γ correction between the low luminance side and the high luminance side itself forms an S-shaped curve correspondence, and the luminance Y after conversion can be greatly changed with respect to the luminance y before conversion. It becomes like this.
[0100]
In the present embodiment, the correspondence relationship of the S-shaped curve is established by γ correction, but FIG. 19 shows an example in which a linear correspondence relationship of Y = f · y + g is realized before and after the center position ymid of the gradation range. Is shown. In this example, a linear correspondence is formed again in the region below the lower quadrant yq1 and above the upper quadrant yq3. In this example as well, the slope f may be made closer to “1” when the standard deviation σ is large, and the slope f may be made larger than “1” when the standard deviation σ is small. Of course, in this case, two corresponding straight lines may be smoothly connected as shown in FIG.
[0101]
On the other hand, when the luminance distribution is in the center of the gradation range, satisfactory luminance conversion is possible only by setting γ1 and γ2 as described above. However, as shown in FIG. 21, the median yMe of the luminance distribution is In some cases, the luminance distribution is slightly on the low luminance side, and as shown in FIG. 22, the median yMe of the luminance distribution is slightly on the high luminance side.
[0102]
On the other hand, in the example shown in FIG. 23, γ correction of γ <1 is applied to the entire range. In this case, the gradation range R after conversion with respect to the gradation range r on the low luminance side before conversion is enlarged. In the example shown in FIG. 24, γ correction of γ> 1 is applied to the entire range. In this case, the gradation range R after conversion with respect to the gradation range r on the high luminance side before conversion is It is expanding.
[0103]
Therefore, the magnitude relationship between the median yMe obtained in step S114 and “128”, which is the center position of the gradation range, is compared, and the median yMe seems to be biased toward the low luminance side region as shown in FIG. If so, by applying γ correction of γ <1 to the entire range as shown in FIG. 23, the gradation range r on the low luminance side having a high distribution density before conversion is expanded. Also, as shown in FIG. 22, if the median yMe seems to be biased toward the high-luminance region, the entire range as shown in FIG. The gradation range r on the high luminance side having a high distribution density is expanded. In this way, it is possible to enlarge or reduce the number of gradations without necessarily having the S-curve correspondence. Of course, in these cases, γ may be determined based on the formulas (7) and (8) depending on whether γ <1 or γ> 1.
[0104]
Further, in the example shown in FIG. 25, the gradation is “0”, the lower quadrant yq1, the center position ymid, the upper quadrant yq3, and the gradation “255”. For “0”, the center position ymid, and the gradation “255”, while Y = y, conversion points at the lower quadrant yq1 and the upper quadrant yq3 are determined based on the standard deviation. Then, a correspondence relationship connecting these five points may be obtained by spline interpolation calculation or Newton interpolation. Of course, the lower three points and the upper three points from the center position ymid may be obtained by spline interpolation calculation or Newton interpolation, respectively.
[0105]
By the way, if a tone range that is too large is assigned to the tone range before conversion, it may be undesirable. In the twilight state like the evening, the range of contrast from the brightest part to the dark part is naturally narrow, but as a result of trying to enlarge the contrast greatly for this image, it is converted like a daytime image. It might be. Since such conversion is not desired, the enlargement ratio is limited and both γ1 and γ2 are limited. For example, even when γ2 <0.7, γ2 = 0.7, and even when γ1> 1.3, γ1 = 1.3.
[0106]
As described above, in this embodiment, the parameters γ1 and γ2 can be obtained, and step S204 is ended. It can be said that such a change in the number of gradations changes the assignment of the number of quantization bits in other words.
[0107]
By the way, it is irrational to execute the calculation by γ correction every time the luminance is converted. This is because the range that the luminance y can take is only “0” to “255”, and it is possible to obtain the luminance Y after conversion corresponding to all the values that the luminance y can take in advance. That's why. Therefore, this correspondence is obtained in step S206 and stored as a table as shown in FIG.
[0108]
Here, the specific calculation of the correspondence is as follows.
[0109]
For y ≦ 128,
Y = 128 * (y / 128) ** γ1 (9)
For y> 128,
Y = 128 * {(y−128) / 128} ** γ2 + 128
(10)
However, the conversion point of γ correction can be changed based on the median yMe. That is,
If y ≦ yMe,
Y = yMe * (y / yMe) ** γ1 (11)
If y> yMe,
Y = yMe * {(y−yMe) / yMe} ** γ2 + yMe (12)
Then, it becomes an S-shaped curve in which the polarity of luminance conversion is inverted between the high luminance side and the low luminance side with the median yMe as the center, and a large number of gradations can be assigned to both sides centering around the high distribution density, There is an effect that conversion can be performed without greatly affecting the overall brightness.
[0110]
The image data can be changed when the calculated conversion table is formed.
[0111]
Finally, image data is converted in step S208. Up to this point, the correspondence relationship for converting the luminance has been obtained, and for example, it was not the conversion relationship for the component values (Rp, Gp, Bp) on the RGB coordinate axes. However, the conversion equation (2) can also be applied in correspondence with the RGB component values (Rp, Gp, Bp). In addition, the RGB component values (r, g, b), (R, G, B) are in the same range corresponding to the luminance y, Y ranging from “0” to “255”. Therefore, it can be said that the above-described conversion table of luminance y and Y may be used as it is.
[0112]
Therefore, in step S208, the conversion table shown in FIG. 26 is referred to for the image data (r, g, b) of all pixels, and the process of obtaining the converted image data (R, G, B) is repeated.
[0113]
Next, the operation of the present embodiment having the above configuration will be described step by step.
[0114]
If a photograph is taken with the scanner 11 or the like, image data representing the photograph as RGB gradation data is taken into the computer 21, and the CPU executes the image processing program shown in FIGS. 5 and 6 to execute the image data. The process of enhancing the contrast is executed.
[0115]
First, in step S102, the image data is thinned out within a predetermined error, and the luminance y for the selected pixel is obtained to obtain a distribution. The distribution as it is cannot be used. First, it is determined in step S104 whether the image is a binary image such as black and white, and in step S108, it is determined whether the image is a natural image. Except when the image is a binary image or not a natural image, in step S110, it is determined whether the image data has a frame portion, and if there is a frame portion, the standard deviation σ is determined in step S114 with respect to the luminance distribution obtained. Ask. In this embodiment, it is only necessary to obtain the standard deviation σ, but when the polarity conversion point for γ correction is changed in accordance with the luminance distribution, the median yMe is obtained.
[0116]
Once the standard deviation σ of the luminance distribution is obtained,
For y ≦ 128,
γ1 = (σstd_limit / σ) ** a (7)
Y = 128 * (y / 128) ** γ1 (9)
For y> 128,
γ2 (σ / σstd_limit) ** a (8)
Y = 128 * {(y−128) / 128} ** γ2 + 128
(10)
In step S204, parameters γ1 and γ2 are obtained, and in step S206, the conversion relationship from luminance y to luminance Y is stored in a table. Then, the image data for all the pixels is converted with reference to the conversion table completed in step S208.
[0117]
Of course, as described above, such image processing is not performed when the image is not a binary image or a natural image. However, when the image processing of the present invention is performed, the contrast is very low in the state of the photograph. Regardless, by correcting so as to widen the luminance range, a clear image with clear contrast can be obtained.
[0118]
In the above-described embodiment, the parameter σstd_limit, a for obtaining γ1 and γ2 is constant, but the computer 21 may be able to select it via a predetermined GUI. It is also possible for the user to designate a part of the image data and execute the contrast enhancement process only within the range.
[0119]
In this manner, after obtaining the luminance y distribution for the pixels of the image data while thinning out in step S102, the standard deviation σ corresponding to the spread amount of the luminance distribution is obtained in step S114, and the standard deviation σ is obtained. On the basis of this, since the γ correction parameters (γ1, γ2) for forming the correspondence relationship of the S-curve are calculated in step S204, the image data is converted in step S208 to obtain the conversion source luminance y. Automate the task of assigning a large number of gradations to areas with high distribution density and assigning a small number of gradations to areas with low distribution density so that even non-experts can easily enhance contrast. Become.
[Brief description of the drawings]
FIG. 1 is a block diagram of an image processing system to which an image processing apparatus according to an embodiment of the present invention is applied.
FIG. 2 is a block diagram illustrating a specific hardware configuration example of the image processing apparatus.
FIG. 3 is a schematic block diagram illustrating another application example of the image processing apparatus of the present invention.
FIG. 4 is a schematic block diagram illustrating another application example of the image processing apparatus of the present invention.
FIG. 5 is a flowchart showing a luminance distribution detection processing portion in the image processing apparatus of the present invention.
FIG. 6 is a flowchart showing a luminance conversion processing portion in the image processing apparatus of the present invention.
FIG. 7 is a diagram illustrating coordinates in a conversion source image.
FIG. 8 is a diagram showing a sampling period.
FIG. 9 is a diagram illustrating the number of sampling pixels.
FIG. 10 is a diagram illustrating a relationship between a conversion source image and pixels to be sampled.
FIG. 11 is a diagram illustrating a black and white image.
FIG. 12 is a diagram illustrating a luminance distribution of a black and white image.
FIG. 13 is a diagram illustrating an image with a frame portion.
FIG. 14 is a diagram illustrating a luminance distribution of an image having a frame portion.
FIG. 15 is a graph showing a relationship between luminance before conversion and luminance after conversion when the number of gradations is not changed.
FIG. 16 is a graph in which the luminance before conversion and the luminance after conversion become a correspondence relationship of the S curve by γ correction.
FIG. 17 is a graph when γ correction of γ <1 is applied in a region on the high luminance side.
FIG. 18 is a graph when γ correction of γ> 1 is applied in a low luminance side region.
FIG. 19 is a graph in which the luminance before conversion and the luminance after conversion become a correspondence relationship of the S-shaped curve by linear conversion.
FIG. 20 is a modified example in which smooth conversion is performed at the conversion point of the conversion characteristic in the same correspondence relationship.
FIG. 21 is a diagram showing a luminance distribution when the median is on the low luminance side.
FIG. 22 is a diagram showing a luminance distribution when the median is close to the high luminance side.
FIG. 23 is a graph when γ correction of γ <1 is applied in the entire region.
FIG. 24 is a graph when γ correction of γ> 1 is applied in the entire region.
FIG. 25 is a graph in a case where specified conversion points are connected by an interpolation method.
FIG. 26 is a diagram illustrating a conversion table when a luminance distribution is enlarged.
[Explanation of symbols]
10. Image input device
11 ... Scanner
11b ... Scanner
12 ... Digital still camera
12a ... Digital still camera
12b ... Digital still camera
13b Modem
20 Image processing apparatus
21 ... Computer
22 ... Hard disk
30. Image output device
31 ... Printer
31a ... Printer
31b ... Printer
32 ... Display
32a ... Display

Claims (15)

画素が縦方向と横方向に並ぶ画像のコントラストを強調する処理を行う画像処理装置であって、
上記画像の画素を上記縦方向と上記横方向とでサンプリングして間引く際に上記縦方向と上記横方向とで画素数の少ない方の方向の画素数に基づいた抽出数が確保されるように間引きを行い、間引き後の画素毎の所定階調数の輝度相当値から上記画像の輝度分布を求め、求めた輝度分布から前記画素毎の輝度相当値のばらつきを表す量を算出し、当該ばらつきを表す量に基づいて上記画像のコントラストを強調する処理を行うことを特徴とする画像処理装置。
An image processing apparatus that performs processing for enhancing contrast of an image in which pixels are arranged in a vertical direction and a horizontal direction,
When sampling and thinning out the pixels of the image in the vertical direction and the horizontal direction, the number of extractions based on the number of pixels in the smaller direction in the vertical direction and the horizontal direction is ensured. The luminance distribution of the image is obtained from the luminance equivalent value of the predetermined number of gradations for each pixel after the thinning, and the amount representing the variation of the luminance equivalent value for each pixel is calculated from the obtained luminance distribution. An image processing apparatus that performs a process of enhancing the contrast of the image based on an amount representing.
上記請求項1に記載の画像処理装置において、上記輝度相当値のばらつきを表す量に基づいて分布密度の小さい階調範囲に少ない階調数を割り当てるとともに分布密度の大きい階調範囲に多い階調数を割り当て、階調数の割り当ての変更に対応させて各画素の輝度相当値を変換することを特徴とする画像処理装置。  The image processing apparatus according to claim 1, wherein a small number of gradations is assigned to a gradation range with a small distribution density and a large number of gradations in a gradation range with a high distribution density based on the amount representing the variation of the luminance equivalent value. An image processing apparatus characterized by assigning a number and converting a luminance equivalent value of each pixel in accordance with a change in the number of gradations. 上記請求項1または請求項2に記載の画像処理装置において、上記輝度相当値のばらつきを表す量は標準偏差に対応する値を利用し、輝度分布の標準偏差が大きいときに入出力比を小さくして階調数の割り当てを均一化するとともに、標準偏差が小さいときに入出力比を大きくして階調数の割り当て変化を拡大化することを特徴とする画像処理装置。  3. The image processing apparatus according to claim 1 or 2, wherein an amount representing the variation of the luminance equivalent value uses a value corresponding to a standard deviation, and the input / output ratio is reduced when the standard deviation of the luminance distribution is large. An image processing apparatus characterized in that the gradation number assignment is made uniform, and when the standard deviation is small, the input / output ratio is increased to enlarge the gradation number assignment change. 上記請求項3に記載の画像処理装置において、輝度分布にγ補正を行うとともに標準偏差が大きいときにγ補正による変化量が小さくなるようにγの値を設定し、標準偏差が小さいときにγ補正の変化量が大きくなるようにγの値を設定することを特徴とする画像処理装置。  4. The image processing apparatus according to claim 3, wherein a value of γ is set so that the amount of change due to γ correction is reduced when the luminance distribution is subjected to γ correction and the standard deviation is large, and when the standard deviation is small. An image processing apparatus, wherein the value of γ is set so that the amount of change in correction becomes large. 上記請求項4に記載の画像処理装置において、輝度分布の概略中心位置を求めるとともに、この概略中心位置を基準として高輝度側と低輝度側とで輝度変換の極性を反転させることにより入力と出力との関係で概略S字カーブの輝度変換を行うことを特徴とする画像処理装置。  5. The image processing apparatus according to claim 4, wherein the approximate center position of the luminance distribution is obtained, and the input and output are performed by inverting the polarity of the luminance conversion between the high luminance side and the low luminance side with reference to the approximate center position. An image processing apparatus that performs luminance conversion of an approximately S-shaped curve in relation to 上記請求項1〜請求項5のいずれかに記載の画像処理装置において、変換元の輝度の取りうる範囲内で変換先の輝度を演算して記憶しておき、変換時にはこの対応関係を呼び起こして変換することを特徴とする画像処理装置。  6. The image processing apparatus according to claim 1, wherein the conversion destination luminance is calculated and stored within a possible range of the conversion source luminance, and this correspondence is evoked during conversion. An image processing apparatus for converting. 上記請求項1〜請求項6のいずれかに記載の画像処理装置において、画像データが輝度に対応した複数の成分値で表される場合において、輝度の演算を同成分値の線形加算で求めることを特徴とする画像処理装置。  The image processing apparatus according to any one of claims 1 to 6, wherein when the image data is represented by a plurality of component values corresponding to the luminance, the luminance calculation is obtained by linear addition of the same component values. An image processing apparatus. 上記請求項1〜請求項7のいずれかに記載の画像処理装置において、コントラストの強調程度に制限を設定することを特徴とする画像処理装置。  8. The image processing apparatus according to claim 1, wherein a limit is set for a degree of contrast enhancement. 上記請求項1〜請求項8のいずれかに記載の画像処理装置において、輝度分布に基づいて二値画像データを判定するとともに、二値画像データであればコントラストの強調を行わないことを特徴とする画像処理装置。  The image processing apparatus according to any one of claims 1 to 8, wherein binary image data is determined based on a luminance distribution, and contrast enhancement is not performed for binary image data. An image processing apparatus. 上記請求項9に記載の画像処理装置において、再現可能な範囲内の両端に輝度分布が集中しているときに白黒の二値画像データであると判断することを特徴とする画像処理装置。  10. The image processing apparatus according to claim 9, wherein when the luminance distribution is concentrated at both ends within a reproducible range, the image processing apparatus determines that the binary image data is black and white. 上記請求項1〜請求項10のいずれかに記載の画像処理装置において、突出する輝度分布に基づいて画像データの枠部を判定するとともに、枠部があれば枠部のデータをコントラストの強調に利用しないことを特徴とする画像処理装置。  11. The image processing apparatus according to claim 1, wherein a frame portion of the image data is determined based on the protruding luminance distribution, and if there is a frame portion, the data of the frame portion is used to enhance contrast. An image processing apparatus that is not used. 上記請求項11に記載の画像処理装置において、再現可能な範囲内での端部に集中している輝度分布が枠部であると判定することを特徴とする画像処理装置。  12. The image processing apparatus according to claim 11, wherein the luminance distribution concentrated at the end within a reproducible range is determined to be a frame. 上記請求項1〜請求項12のいずれかに記載の画像処理装置において、画像データが自然画でない場合にコントラストの強調を行わないことを特徴とする画像処理装置。  13. The image processing apparatus according to claim 1, wherein contrast enhancement is not performed when the image data is not a natural image. 上記請求項13に記載の画像処理装置において、輝度分布がスペクトル状に存在する場合に上記画像データが自然画でないと判定する自然画判定手段を備えることを特徴とする画像処理装置。  The image processing apparatus according to claim 13, further comprising a natural image determination unit that determines that the image data is not a natural image when the luminance distribution exists in a spectral form. 画素が縦方向と横方向に並ぶ画像のコントラストを強調する処理を行う画像処理方法であって、
上記画像の画素を上記縦方向と上記横方向とでサンプリングして間引く際に上記縦方向と上記横方向とで画素数の少ない方の方向の画素数に基づいた抽出数が確保されるように間引きを行い、間引き後の画素毎の所定階調数の輝度相当値から上記画像の輝度分布を求め、求めた輝度分布から前記画素毎の輝度相当値のばらつきを表す量を算出し、当該ばらつきを表す量に基づいて上記画像のコントラストを強調する処理を行うことを特徴とする画像処理方法。
An image processing method for performing processing for enhancing contrast of an image in which pixels are arranged in a vertical direction and a horizontal direction,
When sampling and thinning out the pixels of the image in the vertical direction and the horizontal direction, the number of extractions based on the number of pixels in the smaller direction in the vertical direction and the horizontal direction is ensured. The luminance distribution of the image is obtained from the luminance equivalent value of the predetermined number of gradations for each pixel after the thinning, and the amount representing the variation of the luminance equivalent value for each pixel is calculated from the obtained luminance distribution. An image processing method characterized by performing a process of enhancing the contrast of the image based on an amount representing.
JP2002186044A 2002-06-26 2002-06-26 Image processing apparatus and image processing method Expired - Fee Related JP3972192B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002186044A JP3972192B2 (en) 2002-06-26 2002-06-26 Image processing apparatus and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002186044A JP3972192B2 (en) 2002-06-26 2002-06-26 Image processing apparatus and image processing method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP9006898A Division JPH10208034A (en) 1997-01-17 1997-01-17 Processor and method for image processing

Publications (3)

Publication Number Publication Date
JP2003051947A JP2003051947A (en) 2003-02-21
JP2003051947A5 JP2003051947A5 (en) 2004-07-29
JP3972192B2 true JP3972192B2 (en) 2007-09-05

Family

ID=19195416

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002186044A Expired - Fee Related JP3972192B2 (en) 2002-06-26 2002-06-26 Image processing apparatus and image processing method

Country Status (1)

Country Link
JP (1) JP3972192B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104504722A (en) * 2015-01-09 2015-04-08 电子科技大学 Method for correcting image colors through gray points

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3956887B2 (en) * 2003-04-10 2007-08-08 セイコーエプソン株式会社 Image processing apparatus, image processing method, and image processing program
KR100736614B1 (en) * 2005-08-26 2007-07-09 엘지전자 주식회사 A apparatus for displaying video image and method for controlling contrast of video image
JP5889431B2 (en) 2012-10-25 2016-03-22 三菱電機株式会社 Image processing apparatus and image processing method
EP2953340B1 (en) 2013-01-31 2018-03-21 Mitsubishi Electric Corporation Image processing device, image processing method, program, and recording medium
CN114202491B (en) * 2021-12-08 2022-09-09 深圳市研润科技有限公司 Method and system for enhancing optical image

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104504722A (en) * 2015-01-09 2015-04-08 电子科技大学 Method for correcting image colors through gray points

Also Published As

Publication number Publication date
JP2003051947A (en) 2003-02-21

Similar Documents

Publication Publication Date Title
JP4069333B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JPH10208034A (en) Processor and method for image processing
JP3972192B2 (en) Image processing apparatus and image processing method
JP4993028B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP3693086B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP2003051947A5 (en)
JP4126509B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP3698205B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP3664395B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP4123387B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP3985147B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP4123385B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP4182365B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP3596614B2 (en) Image processing apparatus, image processing method, and medium recording image processing program
JP3682872B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP3664394B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP4228243B2 (en) Image processing apparatus, image processing method, and computer-readable recording medium recording program
JP3646798B2 (en) Image processing apparatus, image processing method, and medium on which image processing program is recorded
JP2003125213A5 (en)
JP4475316B2 (en) Image processing apparatus, recording medium storing image processing program, and image processing method
JP2003092687A5 (en)
JP2003085552A5 (en)

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060510

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060707

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20061018

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061215

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070124

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070216

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070529

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

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110622

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110622

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120622

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130622

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20130622

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees