JP4035456B2 - Image compression method and image compression apparatus - Google Patents

Image compression method and image compression apparatus Download PDF

Info

Publication number
JP4035456B2
JP4035456B2 JP2003061865A JP2003061865A JP4035456B2 JP 4035456 B2 JP4035456 B2 JP 4035456B2 JP 2003061865 A JP2003061865 A JP 2003061865A JP 2003061865 A JP2003061865 A JP 2003061865A JP 4035456 B2 JP4035456 B2 JP 4035456B2
Authority
JP
Japan
Prior art keywords
color
image
compression
index
value
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
JP2003061865A
Other languages
Japanese (ja)
Other versions
JP2004229261A5 (en
JP2004229261A (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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2003061865A priority Critical patent/JP4035456B2/en
Priority to EP03252432.4A priority patent/EP1355484B1/en
Priority to US10/417,102 priority patent/US7158669B2/en
Priority to CN03122140.8A priority patent/CN1253010C/en
Publication of JP2004229261A publication Critical patent/JP2004229261A/en
Publication of JP2004229261A5 publication Critical patent/JP2004229261A5/ja
Application granted granted Critical
Publication of JP4035456B2 publication Critical patent/JP4035456B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Compression Of Band Width Or Redundancy In Fax (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、カラー文書画像を圧縮処理する画像圧縮方法、画像圧縮装置及びプログラム並びに記録媒体に関する。
【0002】
【従来の技術】
近年、カラープリンタやカラースキャナ等の普及により、カラー化された文書が増え、これをスキャンにより取り込んで電子ファイルとして保存したり、インターネット等を介して第三者等に送付する機会が増えてきている。しかし、フルカラーデータのままでは記憶装置や回線への負荷が大きいため、圧縮処理等の方法で取り扱うデータ量を小さくする必要がある。
【0003】
従来、カラー画像を圧縮する方法として、例えば、誤差拡散等で擬似階調を持った2値画像にして圧縮する方法、JPEG形式で圧縮する方法、8ビットのパレットカラーに変換を行ってZIP圧縮やLZW圧縮をする方法等があった(例えば、特許文献1参照)。
【0004】
【特許文献1】
特開2002−077631号公報
【0005】
【発明が解決しようとする課題】
しかしながら、擬似階調の2値画像ではサイズ(データ量)は小さくなるものの、カラー情報が失われてしまう。また、JPEG形式で圧縮した場合は、JPEG特有のモスキートノイズのために、圧縮サイズと文字品位とのトレードオフが生ずる。
【0006】
さらに、パレットカラーに変換してZIP圧縮やLZW圧縮をする方法は、カラー文書画像の大半の色分布は離散的ではなく局所的であるために、その画像を多ビットで保持した場合はもともと効率が悪いので、それを圧縮した結果も当然に効率が悪くなる。
【0007】
さらにまた、特許文献1に記載の方法によれば、領域判定とMMRによる2値圧縮とZIPによる可逆圧縮と、JPEGによる非可逆圧縮との組み合わせにより、通常の文字領域については高い品位が得られるが、例えば原稿に手書き修正したような部分は領域判定が難しく、JPEG圧縮の対象となりモスキートノイズが生ずるような問題があった。
【0008】
本発明は、このような事情を考慮してなされたものであり、高い圧縮効率でカラー文書画像を好適に圧縮することができる画像圧縮方法、画像圧縮装置及びプログラム並びに記録媒体を提供することを目的とする。また、本発明は、上記カラー文書だけの画像に限らず、文字領域と非文字領域が混在する画像の圧縮にも対応できるようにすることを更なる目的とする。
【0009】
【課題を解決するための手段】
上記課題を解決するために、本発明は、カラー画像を圧縮する画像圧縮方法であって、前記カラー画像の各画素をカラー値に対応して付与されるインデックスに変換し、インデックス化された色ごとの画素数及び色に関するデータを含むカラー情報と、前記各画素をインデックスに変換したインデックス画像とを生成するインデックス変換工程と、前記インデックス画像における特定インデックスに対応するカラー値を前記カラー画像の背景色とする背景色決定工程と、前記カラー情報及び前記背景色に基づいて、前記カラー画像をインデックスごとに圧縮する際の圧縮順位を決定する圧縮順位決定工程と、前記インデックス画像からそれぞれのインデックスごとに2値画像を生成する2値画像生成工程と、前記圧縮順位に従って、前記2値画像を圧縮する圧縮工程と、前記カラー画像の大きさと前記背景色のカラー値とを含む背景データ及び前記インデックスごとの前記2値画像の圧縮データを統合して圧縮画像データを生成する生成工程とを有することを特徴とする。
【0010】
【発明の実施の形態】
以下の実施の形態では、例えばカラー複写機に搭載可能な、カラー画像の圧縮技術を説明する。
【0011】
なお、カラー複写機の機能としては、例えば、カラーコピー機能、カラープリント機能及びカラースキャナ機能があるが、本実施形態で説明する圧縮技術は、このうちカラーコピー機能及びカラースキャナ機能で適用可能である。具体的には、カラー原稿を読み取ることにより得られたカラー画像データを圧縮する際に用いられる圧縮技術である。
【0012】
また、カラースキャナ機能としては、例えば、カラー原稿を読み取ることにより得られたカラー画像データを圧縮して外部へ送信するデータ送信機能及び同カラー画像データを圧縮して複写機内部の記憶手段に記憶する保存機能があるが、この両方の機能に搭載可能な圧縮技術である。
【0013】
本実施形態では、以下に示すように複数の圧縮モードを備える。これらモードは、圧縮対象となるカラー画像(カラー原稿)の内容が如何なるものかによって選択される。この選択は、自動的であっても良いし、ユーザの手動であっても良い。
【0014】
<<第1の圧縮モード>>
まず、第1の圧縮モードに関する実施形態として、以下で詳細に説明する圧縮方法を実行可能である。この圧縮モードは、少ない色数で構成されたカラー画像の圧縮に適している。よって、この圧縮モードを自動的に選択するには、カラー画像の色分布を判断するか文字及び写真領域を判定してその割合によって判断すれば可能である。或いは、ユーザが手動で選択すれば良い。
【0015】
以下、図面を参照して、第1の圧縮モードの実施する構成または方法について詳細に説明する。
【0016】
図7は、本実施形態における圧縮処理対象となるカラー文書画像を構成するデータを説明するための概要図である。図7に示すように、本実施形態では、もとのカラー原稿として、白地の下地に赤文字と黒文字が形成されており、さらに青ボールペンで手書き修正が加えられているものを用いる。これをスキャナで取り込んだカラー画像(すなわち、原画像)に対して、減色処理、同色判定処理、中間色削減処理等をすることにより白色、黒色、赤色、青色の部分2値画像に分割する。
【0017】
ここで、分割された色毎の画素数を比較すると通常は下地の白色が最も多くなるため、この色が背景色として判定される。そして、背景色と判定された白色は画像データとして保持せず、原稿の実サイズとカラー値によってそのデータが保存され、残る黒色、赤色、青色のカラーに関しては、図7に示すようにその色毎に部分(2値)画像に分割してそれぞれ圧縮保存するようにする。このようにカラー文書画像は、カラー写真等の自然画像と異なり、色の分布が局所的であるため、圧縮効率が高くなる。
【0018】
ここで、図8は、前景色画像と中間色画像と補完中間色画像を説明するための概要図である。すなわち、中間色削減処理で削減されなかった部分2値画像は図8(b)に示すようになるので、(c)に示す補完中間色画像のように内部を補完してエッジ量を減らし、圧縮効率が上がるようにして画像伸長時に補完中間色画像、次いで前景色画像の順に伸長が行われるようにする。このようにすることで、補完された部分を上のレイヤーとなる前景色画像によって上書きされ、補完処理がなされたかった場合と同じ画像を再現し、かつ圧縮サイズも小さくすることができる。
【0019】
図9は、本実施形態における補完処理の原理を説明するための概要図である。図9において、「A」という画像パターンの横線91で示した部分をレイヤー表現した場合、左下図92のようになる。ここで中間色はエッジを8つ持つパターンで表現されるが、前景色より先に描画するようにすれば右の様に補完処理をしても上から見た場合、補完処理があるなしにかかわらず同じように見える。ここで、補完処理した中間色のエッジ数を調べると、右下図93に示すように4つであり補完処理前の半分に減少している。これにより部分2値画像の冗長性が高くなり、圧縮効率が向上する。
【0020】
ここで圧縮順位は、図8(b)に示す中間色画像のようなパターンを持つ色を上位に選べば圧縮サイズは小さくなるが、実際に画像パターンを調べることは処理の負荷が高くなってしまう。通常、文書画像で前景色となる色は白地に黒色や青地に黄色等の可視性の高い色が使われ、問題となる中間色は例えば白と黒の間の灰色といった具合になる。そこで、減色されて残った色について輝度や色差等の値でソーティングし、抽出された背景色を基準に圧縮順位を決めることによって、画像パターンを調べた場合と同じ効果を得ることができる。
【0021】
図1は、本発明の第1の圧縮モードにおけるカラー文書画像を圧縮する圧縮装置の細部構成を説明するためのブロック図である。図1において、101は例えば、スキャナ等でカラー原稿を読み取ることによって得られた原画像(カラー画像)である。また、102は減色処理部であり、入力された原画像101に対して予め決められた色数に単純減色処理を行い、インデックス化する。
【0022】
103はカラー情報であり、減色処理部102でインデックス化された色毎の画素数と色重心と色分布範囲とを表すデータで構成される。104はインデックスカラー画像であり、減色処理部102で減色された画像が出力されたものである。
【0023】
105はカラー情報ソート部であり、カラー情報103のデータを画素数によってソーティングする。また、106は同色統合部であり、カラー情報ソート部105でソートされたカラー情報103を比較して同一色を判断して統合処理を行い、カラー情報の更新をする。
【0024】
107は中間色削減部であり、カラー情報103の近傍にあるカラー情報同士の結合処理を行い、中間調に位置する色数の削減を行う。ここで処理された後、残ったカラー情報の最上位の色重心の値が背景色データ108となる。113は圧縮順位決定部であり、中間色削減部107で削減されたカラー情報を輝度でソーティングし、背景色のカラー情報を基準に圧縮を行う順番を決定する。
【0025】
109は2値画像作成圧縮部であり、圧縮順位決定部113が決定した順番に従って、背景色以外の残ったカラー情報毎に2値画像を作成し圧縮を行う。この時、圧縮順位の高いカラー情報の画像は、低い順位の画像データによって補完処理をするようにする。
【0026】
110は2値画像圧縮データであり、2値画像作成圧縮部109で作成されたデータ群から成り、それぞれに色情報が付加されている。また、112はデータ統合部であり、背景色データ108と2値画像圧縮データ110とを統合して、圧縮画像112を作成する。
【0027】
すなわち、本実施形態では、以下に詳細を説明するように、カラー画像(特に、カラー文書画像)を圧縮する画像圧縮方法について示す。その手順は、まず、減色処理部102によって、カラー画像の各画素をカラー値に対応して付与されるインデックスに変換し、インデックス化された色ごとの画素数を含むカラー情報103と、各画素をインデックスに変換したインデックス画像(インデックスカラー画像104)とを生成する。そして、カラー情報ソート部105等によって、インデックス画像における所定インデックスに対応するカラー値をカラー画像の背景色とする。また、圧縮順位決定部113によって、カラー情報及び背景色に基づいて、カラー画像をインデックスごとに圧縮する際の圧縮順位を決定する。さらに、2値画像作成圧縮部109によって、インデックス画像からそれぞれのインデックスごとに2値画像を生成するとともに、圧縮順位に従って、2値画像を圧縮する。そして、データ結合部111によって、カラー画像の大きさと背景色のカラー値とを含む背景データ108及びインデックスごとの2値画像の圧縮データを統合して圧縮画像データ(圧縮データ112)を生成することを特徴とする。
【0028】
図2は、本発明の第1の圧縮モードにおけるカラー画像の圧縮処理の流れを説明するためのフローチャートである。
【0029】
まず、原画像101であるカラー画像が入力されると、減色処理部102は予め決められた色数に当該原画像101の減色処理を行い、カラー情報103とインデックスカラー画像104を出力する。ここで、本実施形態では、インデックス化においては、所定範囲のカラー値に一のインデックスを対応させ、カラー画像のビット数を減少させたインデックス画像(インデックスカラー画像104)を生成することを特徴とする。
【0030】
尚、本実施形態における減色処理は、フルカラーRGB24ビットのデータをR−G−Bそれぞれ、2−2−2、3−3−2、3−3−3ビット等のビット数に落とすものである。このビット数の選び方は、色の判定をどの程度の精度で行うかによって任意に選択可能である。以下に示す実施形態では、2−2−2ビットを選択したものとして説明を行う。また、減色処理部102から出力されたカラー情報103は、減色された色毎の画素数と色重心(色の平均値)と色分布範囲を表す座標データとで構成される。
【0031】
すなわち、本実施形態における上記画像圧縮方法においては、上述したインデックス変換処理においては、カラー情報として、画素数の他に、さらにカラー画像のインデックス化された色ごとの色重心及び色分布範囲を計数することを特徴とする。
【0032】
次に、減色処理部102で得られたカラー情報103は、カラー情報ソート部105へ入力され、その画素数とインデックス番号とに応じた重み付けが行われた値によってソーティングされる(ステップS202)。
【0033】
ソーティングは基本的に画素数が多いものほど上位に位置させるが、上記重み付け、すなわち係数は、同程度の画素数のカラー情報を比較した場合に原色に近い色が上位になるように調整された値である。図3は、第1の圧縮モードにおけるカラー情報ソート部105でのソーティング重み係数の例を示す図である。図3に示すように、本実施形態では、RGB各4階調のそれぞれに0.9〜1.2の係数を振り分けている。この値は任意であり、減色処理部102での減色数や色の優先度によって変えても良い。
【0034】
さらに、カラー情報ソート部105でソーティングされたカラー情報は、同色統合部106へ入力される。同色統合部106では、カラー情報の色重心の値をそれぞれ比較して、その距離が近い場合には同一色としてカラー情報の統合を行う(ステップS203)。この処理は、本来は同じ色でありながら、RGBの何れかの値が最初の減色処理における閾値に近いために複数のカラーに分離した色を一つの色に戻す処理である。統合が行われるカラー情報は、ソーティングされた上位のカラー情報が残され、色ごとの画素数、色重心及び色分布範囲の各データが再計算される。
【0035】
すなわち、本実施形態に係る画像圧縮処理では、カラー情報において、色重心が近いカラー情報同士を統合する同色統合処理を行うことを特徴とする。また、当該同色統合処理が、同色をソーティング上位の色に統合する場合、計数された画素数、色分布範囲及びカラー値の重心を再計算することを特徴とする。さらに、同色統合処理が、カラー画像におけるそれぞれの色ごとの画素数と色空間上の位置に応じて予め決められた係数の積をとった値によってソーティングを行い、ソーティング順位を基準にして同色判定を行うことを特徴とする。
【0036】
さらに、中間色削減部107では、同色統合部106で更新されたカラー情報の色重心の値を輝度色差の値に変換し、その値をそれぞれ比較して、近傍のカラー情報同士の結合処理を行う(ステップS204)。これにより中間調に位置する色数の削減を行う。この処理の目的は、例えば元の文書画像が白黒の原稿であっても、スキャナで取り込んだ場合に下地の白色と文字部の黒色の境界部分に白から黒にかけて生じる多くの階調成分を取り除くことである。すなわち、白に近い灰色は白にして、黒に近い灰色は黒にする。また、他の色も同様に処理する。このように、色の画素数と色空間上の位置に応じた係数の積の大きさによってソーティングを行い、その順位によって同色統合処理、中間色削減処理を行う際に色重心の値を再計算しないことにより色の再現性が良くなる。
【0037】
尚、同色統合部106では、削減され結合されるカラー情報はステップS203におけるカラー情報の更新と同様に再計算され更新するが、色重心の値だけはそのまま残すものとする。これは、色重心の値が最終的な表示色であり、中間色を統合してその色重心を求めた場合、例えば黒であれば灰色が混じって明るめの色になり、白は逆に暗めになってしまうのを防ぐためである。結合された色情報の代表色はソーティング順位の高いカラー情報の色重心が採用される。ここで、ソーティングにおいて画素数だけではなく重み係数を用いるのは、カラー文書原稿で用いられるであろう原色系の色を優先するためである。
【0038】
すなわち、本実施形態に係る画像圧縮処理では、カラー情報において、互いに輝度色差が近いカラー情報同士を結合して中間色を削減する中間色削減処理を行うことを特徴とする。そして、当該中間色削減処理が、ソーティング順位を基準にして中間色の削減を行うことを特徴とする。また、中間色削減処理が、同系色をソーティング上位の色に統合する場合、計数された画素数、色分布範囲を再計算し、色重心のみ再計算しないことを特徴とする。
【0039】
そして、中間色削減部107で処理された結果の最上位カラー情報が持つ色重心の値を背景色データ108として出力する(ステップS205)。すなわち、本実施形態に係る画像圧縮処理では、ソーティングの最上位に位置する色のカラー値の重心を背景色として抽出することを特徴とする。
【0040】
さらに、カラー情報のソーティングを行い、その結果を用いてステップS205で求められた背景色を基準として圧縮順位を決定する(ステップS206)。例えば、中間色削減部107で削減されたカラー情報が識別番号1〜5の5色であって背景色の識別番号が4とした場合、輝度でソーティングした結果が2、3、5、1、4であるとすると圧縮順番は1、5、3、2の順となる。また、白抜き文字を多用した原稿の時は4、1、5、3、2というような順となり、圧縮順番は1、5、3、2の順とする。さらに、2、3、4、5、1のように白抜き文字と通常の文字が混在していると推測される場合は、文書中の使用頻度が低いと思われる白抜き文字の優先度を低くするため、圧縮順番は5、1、3、2とする。
【0041】
そして、中間色削減部107で残ったカラー情報と圧縮順位決定部113との結果とインデックスカラー画像104とを用いて色毎の2値画像を作成し、MMR等の方法で圧縮処理する(ステップS207)。尚、ここで作成される2値画像は、カラー情報が保持している色分布範囲に応じた大きさであり、原稿の一部にしか存在しない場合はその部分しか圧縮保存しないものとする。
【0042】
すなわち、本実施形態に係る画像圧縮方法では、背景色決定においては、最大画素数のインデックスに対応するカラー値を前記カラー画像の背景色とする。そして、当該インデックスについての圧縮順位の決定、2値画像の生成及び圧縮を実行しないことを特徴とする。
【0043】
この色毎の2値画像であるが、例えば、インデックスカラー画像104のインデックス番号を0〜63として、インデックス63にインデックス60と62のカラー情報が統合されているとすると、その2値画像はインデックス60と62のデータを論理和した画像であり、インデックス63が持つカラー情報の色重心の値で描画されることになる。これが色毎の2値画像の基本部分であり、さらにステップS206において決定された順位に従って補完処理がなされる。
【0044】
この補完処理においては、背景色の識別番号が1、残りの色の順番が2、3、4とする。識別番号は統合されたインデックス番号の集合を表す仮の識別子である。例えば、ある8画素の並びが1、2、3、4、2、3、3、1であった場合、まず優先順位が最も高い識別番号2について見る。識別番号2のみ注目すれば、ビットパターンは01001000であるが補完処理がなされて01111000のビットパターンとなる。また、識別番号3、4については、それぞれ00100110、00010000である。
【0045】
この結果作られるのが2値画像圧縮データ110であり、カラー情報のデータ毎に色の値、位置と大きさ、MMR圧縮のデータ本体からなるデータ群である。そして、データ結合部111では、背景色データ108と2値画像圧縮データ110とをまとめて圧縮データ112を作成して出力する(ステップS208)。すなわち、本実施形態に係る圧縮処理では、2値画像をMMR圧縮することを特徴とする。
【0046】
図4は、第1の圧縮モードにおける圧縮データ112の構成を説明するための図である。まず、ヘッダ部分には、入力された文書画像(原稿)の大きさ、背景色のカラー値、解像度等の情報が格納されている。ここで、背景色には基本的に画素数が最も多い色が選択されるため、例えば原稿が赤等のカラー用紙に印刷されている場合は赤系の値が入る。しかし、通常は、下地が白色の場合が多いと考えられるので、背景色の白色判定を行い、白色と判断される場合は背景色の値を省略するようにしてもよい。白色判定は、例えば、RGBのそれぞれの値が一定値以上であって、それぞれの値の差が一定値以内であった場合、白色とみなすようにする。
【0047】
また、図4に示すように、ヘッダ部の次には各色毎の圧縮データが続く。圧縮データは、その色の値とその色が存在する位置座標と大きさ、MMR圧縮データ本体で構成される。例えば、背景色を除いて残った色数がNであった場合、その色数分だけ同じ構造のデータが存在する。この格納順番であるが、圧縮順位決定部113に従うものとする。尚、入力された画像が白紙等の単色原稿であった場合、この部分のデータは作成されない。
【0048】
また、入力された画像が白黒原稿であった場合、カラー圧縮データ数は1になるので2値画像とほぼ等価のデータ量になる。ここで、黒画素が原稿の一部分のみであればMMR圧縮データはその部分のみ圧縮するため、通常のMMR圧縮より小さくなる。
【0049】
次に、この圧縮データ112を原画像に戻す方法であるが、図4に示すヘッダ部分に記憶されている背景色で原稿の全領域をベタ書きした後、格納されている順番に従ってカラー圧縮データのMMR画像を伸長し、その画像をマスクにして記憶されている位置に色の値で上書きすることで可能である。ここで、格納順は圧縮順位決定部113の順に従っており、伸長もこの順番通りになされるため、2値画像作成圧縮部109で補完処理の有無にかかわらず伸長の結果は同じになる。このように、圧縮順位に従って部分2値画像を補完することにより、圧縮効率が向上する。また、背景色を基準に圧縮順位を決定することにより、補完処理をした場合に圧縮効率が向上する順位を高速に調べることができる。
【0050】
図5は、図2の圧縮処理におけるステップS204で示される中間色削減部107の動作手順を詳細に説明するためのフローチャートである。
【0051】
まず、カラー情報のソーティング順位にリストを作成する(ステップS501)。そして、このリストにそって中間色の削減処理が行われる。次に、カラー情報の色重心の値をRGBからYCrCbの輝度色差信号に変換を行ってデータを付加する(ステップS502)。色差へ変換を行うのは、輝度差の近い同系色を統合して中間色を削減するのに適しているためである。
【0052】
ステップS503、S504,S505では、それぞれのカラー情報に付加されているY、Cr、Cbの各成分の差分がそれぞれ予め決められた閾値以内かどうか比較を行い、その条件以内であればカラー情報の統合を行い色数を削減する。図6は、図5におけるステップS503〜S505における処理の詳細を説明するためのフローチャートである。尚、図6に示すフローチャートの処理は、ステップS503〜S505における処理において、YCrCbの比較を行う閾値のみが異なっているものとする。
【0053】
まず、カラー情報Iを図5のステップS501の処理から与えられたカラー情報のリストの最上位のもの選択する(ステップS601)。次に、カラー情報IのYCrCb値をY'Cr'Cb'に記憶する(ステップS602)。そして、カラー情報Jに当該リストの最下位のカラー情報を選択する(ステップS603)。
【0054】
ここで、カラー情報I、JのY、Cr、Cbのそれぞれの値を比較して、その差が図5のステップS503〜S505の各ステップにおいて与えられた閾値以内かどうか調べる(ステップS604)。
【0055】
その結果、その閾値以内と判断された場合(YES)はステップS606に進み、そうでないと判断された場合(NO)はステップS608へ進む。しかし、カラー情報I、JのCr又はCb値の符号が異なる場合は、カラー情報JのCr又はCb値の絶対値を調べて、予め決められたある一定値以上であればこの条件は成立させないようにする。例えば、カラー情報I、JのCr値の差が図5に示すフローチャートで与えられた閾値以内であっても、その符号が異なる場合は、カラー情報Jの絶対値を予め決められた値と比較し、小さい場合はステップS605へ進み、大きい場合はステップS608へ進むようにする。
【0056】
Cbの値についても同様の処理をする。これは図5のフローで設定された閾値の大きさによっては単純に差分を比較して統合を行った場合に、淡い青と淡い赤色のような異なる色同士のカラー情報が統合されてしまうのを防ぐためである。逆に、淡い青と淡い赤色のような異なる色同士が統合されないように閾値を設定してしまうと、青と淡い青のような同系色を統合することはできなくなる。
【0057】
また、ステップS606では、カラー情報Iにカラー情報Jのデータを統合する。これによってカラー情報Iの色数、分布範囲等の各データは更新されるが色重心の値は更新しない。その代わり、統合した場合の色重心を計算し、それをステップS602で記憶しておいたY'Cr'Cb'に反映させる。
【0058】
次いで、カラー情報Jのデータをリストから外す(ステップS607)。そして、ステップS608では、カラー情報Jのリスト上の一つ上位に位置していたカラー情報がIであるかどうかを調べる。その結果、Iでない場合(NO)はステップS609へ進み、Iである場合(YES)はステップS610へ進む。
【0059】
ステップS609では、カラー情報Jの一つ上位に位置していたカラー情報をカラー情報Jに設定してステップS604へ戻る。一方、ステップS610では、記憶しているY'Cr'Cb'の値をカラー情報IのYCrCbに戻して、図5及び図6に示すフローチャートで閾値比較を行う基準値をステップS604〜S609で統合されたカラー情報本来の色重心の値に更新する。
【0060】
ステップS611では、カラー情報Iの一つ下のカラー情報が最下位であるか、又はステップS607でリストから削除されて存在しないかどうか調べ、存在し、かつ最下位でなければ(NO)、ステップS612に進む。そして、ステップS612において、カラー情報Iの一つ下のカラー情報をIに設定してステップS602に戻る。一方、ステップS611でそうでなければ(YES)、処理を終了して、更新したカラー情報のリストを図5のフローチャートに返す。
【0061】
本実施形態では、図6で説明したステップS503〜S505のそれぞれで設定される閾値は、同系色を統合する目的のため色差CrCbに比較して輝度Yの閾値は少し大きめに設定する。そして、ステップS503では閾値が小さめで比較的輝度色差の差が小さい同系色のカラー情報を統合し、ステップS504、S505になるにしたがって閾値を大きくして、輝度色差の差が比較的大きい同系色のカラー情報を統合する。ステップS502で付加した仮の色重心であるYCrCbの値を図6のフローチャートで再計算を行うのは、ステップS504以降の閾値をあまり大きな値に設定しなくても、色の統合をできるようにするためである。
【0062】
例えば、最初のステップS503の処理で黒色に明るい黒色が統合されたとする。その場合の仮の色重心であるYCrCbの値は明るい黒方向へ移動する。このような場合、暗い灰色との距離が近づくため、次のステップS504以降の閾値をある程度大きくするだけで黒色に暗い灰色が統合できる。
【0063】
また、ステップS503〜S505に示すように、多段の処理にするのは、色の近いものから統合することができ、この段数を変化させることで圧縮データ112のサイズを制御することができるためである。
【0064】
また、図4を見れば分かるように、圧縮データ112のサイズを決定する要素の一つがカラー圧縮データの数である。すなわち、最終的に残る色数を制御すれば圧縮サイズの制御も可能になる。例えば、色数を多くすれば元のカラー画像に近い品位になり色数を少なくすれば単純2値の画像に近づく。よって、得ようとする画質と圧縮サイズによってこの段数を決めれば良い。
【0065】
以下、ステップS506において、この更新したカラー情報を図2のフローチャートで示す処理に返して終了する。
【0066】
すなわち、本実施形態に係る画像圧縮方法では、中間色削減処理においては予め決められた複数の閾値を持ち、カラー値の重心を輝度色差信号に変換して閾値範囲の色をソーティング順位に従って統合削減を行うことを特徴とする。また、カラー値の重心について、輝度色差信号に変換した値を仮のカラー重心として統合削減を行うたびに再計算することを特徴とする。さらに、複数の閾値が、圧縮率優先か画像品位優先かによって値を変更することを特徴とする。
【0067】
上述したように、多くのカラー文書画像が、特定の背景色上に1色又は複数色の文字等が形成されていることに鑑み、これを圧縮する際に色毎の部分2値画像を持つことにより効率よく圧縮することができる。また、中間色削減処理で複数の閾値を用いて、その閾値の数と値を制御することにより画質とサイズを制御することができる。
【0068】
尚、本圧縮モードでは、カラー文書画像を構成する各画素を所定数の限定色のうちの何れかに分類し、その限定色のうち、背景に相当する色を特定し、背景色の輝度値を基準とし、かつ他の各限定色の輝度値に応じて、各限定色の上書き関係を順位付けし、各限定色について、その限定色に相当する画素及びその隣接画素で構成される連結画素群を生成し、ある限定色A(例えば、図9では中間色に相当)に相当する連結画素群について、そこに含まれる隣接画素に、上書き関係として上記限定色Aよりも上位(後に上書きされる優先関係であり、例えば、図9では前景色に相当)に相当する限定色が存在する位置の画素が有れば、これに該当する隣接画素を前記限定色Aに置換し、ここで得られた連結画素群を圧縮するという手順をとることで、背景(例えば、図9では背景色に相当)を上書き関係で最低優先度であると考えて処理する場合において、多くのカラー文書画像が効率よく圧縮される。
【0069】
(変形例)
上述した第1の圧縮モードの説明では、補完処理を行うのは1次方向(ラスタ方向)だけであったが、採用する2値画像の圧縮手法が2次方向の補完も行うことでサイズの効果が期待できる場合は行うようにしてもよい。
【0070】
また、上記説明では、輝度によってソーティングを行ったが、背景色と残りの色との色空間上の距離によってソーティングを行ってもかまわない。すなわち、この場合、圧縮順位が、決定した背景色と残りの色との色空間上の距離を基準に決定されることを特徴とする。
【0071】
さらに、上記説明では、補完方法は注目する色の識別番号の空白部分が下位の識別番号で埋められるかどうかで補完を行っていたが、これを前の画素が1になるかどうかで補完を行っても良い。
【0072】
さらにまた、上記説明と同じく、識別番号が1で残りの色の順番が2、3、4、そして、8画素の並びが1、2、3、4、2、3、3、1であった場合、識別番号2は2画素目で見つかるため01、次は識別番号3で前の画素が1になったため011、次は4で同様に0111というように処理を行い、8画素のビットパターンは01111110となる。識別番号3、4についてはそれぞれ00110110、00010000となる。従って、上述した第1の圧縮モードに係る実施形態とは得られるビットパターンは異なるが、エッジ量が同じであるため、大体同じ圧縮サイズを得られ、かつ逐次画素を見ていくだけなので処理が軽く高速処理が可能である。
【0073】
<<第2の圧縮モード>>
次に、第2の圧縮モードとして、以下で詳細に説明する圧縮方法を実行可能である。この圧縮モードは、文字と非文字(例えば、写真画像)が混在しているカラー画像の圧縮に適している。よって、この圧縮モードを自動的に選択するには、カラー画像の色分布を判断すれば可能である。或いは、ユーザが手動で選択すれば良い。
【0074】
以下、第2の圧縮モードの実施する構成又は方法について説明する。
【0075】
最初に、モードが実施する工程の概略を説明する。まず、符号化対象となる画像全体について輝度ヒストグラムを生成し、2値化し、いくつかの文字領域を取り出す。次に、各文字領域について、文字切り処理を行い、その結果から、再度文字領域として扱うべき領域か否か判断する。その結果、文字領域として扱うべき領域でない場合には、その領域内のオブジェクトが単色かどうか判断し、単色の場合にはMMR圧縮の対象とし、単色でなければ、JPEG圧縮の対象とする。
【0076】
一方、文字領域として扱うべき画像と判断された場合には、その領域を構成する色を所定の減色処理によって減らす。この減色処理の結果、1色になった場合にはその色を示すパレット(例えば、(R,G,B)=(20,30,40))と、2値画像とを関連づけてMMR圧縮の対象とする。減色処理の結果、所定の色数(例えば、4色)以下で表すことができる場合には、文字切り毎に、各色を示すパレットと、各色の画素位置を示す多値画像とを関連づけてZIP圧縮の対象とする。所定の色数では表すことができない場合には、減色処理前の原画像をJPEG圧縮処理の対象とする。
【0077】
図10は、第2の圧縮モードにおける画像圧縮方法を実施するための処理及び中間画像を説明するためのブロック図ある。図10において、1101は原画像である。1102は原画像を入力し、画像の最適2値化を行う画像2値化部である。1103は画像2値化部により2値化された全面2値化画像である。1104は全面2値化画像1103を入力して文字領域を検出し、文字領域座標1112を作成する文字領域検出部である。
【0078】
1108は文字領域座標1112を入力し、その座標内の原画像と2値画像を参照しながら2値画像の黒部分の原画像色を算出し複数のパレット1114を作成し、それにしたがって原画像の減色処理を行う文字色抽出部である。
【0079】
1105は文字領域検出部1104で文字として検出された領域で、かつ文字色抽出部1108にて文字色がM色未満となった領域の2値画像1103の黒の領域を原画像から抜いて、その周りの色で塗りつぶし、画像Aを作成する文字部塗りつぶし部である。
【0080】
1106は画像Aを入力し、縮小して画像Bを作成する縮小部である。1107は画像Bを入力し、JPEG圧縮して圧縮コードX(113)を作成するJPEG圧縮部である。
【0081】
1109は文字色抽出部1108により減色された複数の文字領域の減色画像である。1110は減色画像1109が1ビットであるときに、減色画像を入力しMMR圧縮して複数の圧縮コードY(1115)を作成するMMR圧縮部である。1111は減色画像1109が2ビット以上であるときに、減色画像を入力しZIP圧縮して複数の圧縮コードZ(1116)を作成するZIP圧縮部である。最終的に1Aでまとめた1112から1116までのデータが結合してこれが圧縮データとなる。
【0082】
<文字領域検出処理>
図11は、文字領域検出部1104での文字領域検出処理を説明するためのフローチャートである。まず、カラー画像を入力し、間引いて解像度を落しながら輝度変換を行い、輝度画像Jを作成する(ステップS1301)。例えば、原画像がRGB24ビット300dpiであるとすると、縦方向、横方向とも4画素ごとに、
Y=0.299R+0.587G+0.114B
の演算を行い、新しい画像Jを作成すると、画像JはY8ビット75dpiの画像となる。次に、輝度データのヒストグラムを取り、2値化閾値Tを算出する(ステップS1302)。
【0083】
次に、輝度画像Jを閾値Tによって2値化し、2値画像Kを作成する(ステップS1303)。さらに、黒画素の輪郭線追跡を行い、すべての黒領域をラベル付けする(ステップS1304)。次に、黒領域中の文字らしい領域を判定する(ステップS1305)。そして、形や位置から結合するものを結合する(ステップS1306)。
【0084】
<文字領域に対する文字色抽出処理>
図12は、文字色抽出部1108における文字色抽出処理を説明するためのフローチャートである。尚、ここでは2値画像として全面2値化画像1103を利用したが、これに限られることはなく、例えば、文字領域の座標とカラー画像のみ入力し、カラー画像を改めて2値化した結果を利用して、代表色演算処理を行っても良い。
【0085】
図12のフローチャートで示される処理は文字領域検出部1104で文字と判定されたすべての領域に対して以下に示すように行われる。
【0086】
(ステップS3001:再2値化処理)
まず、ステップS3001で再2値化の判断を行う。全面2値化画像1103は、すべての文字領域が良好に2値化されたものとは限らない。2値画像が濃すぎる場合も、薄すぎる場合も、共に結果の画質に悪影響を及ぼすので、理想的には文字領域ごとに最適2値化を行うことが望ましい。
【0087】
具体的には、文字領域検出部1104において、文字と判定された領域の2値画像を走査し、孤立点フィルタとのパターンマッチングを行う。そして、孤立点がその領域中に閾値以上存在するか判定し、閾値以上の場合は、その領域の輝度ヒストグラムをとり、最適閾値を算出して再2値化を行う。通常の文字領域であれば、部分的に輝度ヒストグラムを通すことによって、よりよい2値画像が得られるが、まれに前よりも悪い結果(すなわち、再2値化後、前よりも濃い2値結果になる)場合が存在する。
【0088】
そこで、このような現象を防ぐために、再2値化では全面2値化画像を得る際に使用した2値化閾値を入力し、再2値化のための閾値と比較して、前よりも濃い結果が得られる場合は、再2値化を行わない等の例外処理を設ける。
【0089】
(ステップS3002:文字切り処理)
次に、ステップS3002で、文字切り情報を作成する。文字きりの処理では、文字領域が横書きであるか縦書きであるかによって処理内容が変わる。この横書きか縦書きかの情報は、文字領域検出部1104において黒色の固まりの並びから判断され、作成される。その結果、横書きの場合は、まず主走査方向に2値画像の黒画素の射影を取る。そして、行の切れ目を検出した後、行ごとに副走査方向に黒画素の射影を取り、1文字毎の情報を得る。一方、縦書きの場合は、行切り出しが副走査方向に行われ、文字切り出しが主走査方向に行われる。この時、多少の画像の傾きにも耐えられるように、行切り出しの射影を取るのに行方向に3分割して行う等するとよい。この処理によって、各行の座標情報、及び各行に存在する文字の座標情報を得ることができる。
【0090】
一方、文字判断処理(後述のステップS3003)では、文字領域検出部1104において文字と判定された領域内の黒オブジェクトのそれぞれを、さらに文字であるかどうかを判定するために文字きり情報を利用する。具体的には、1文字の大きさや形から文字であるか否かを判定する。例えば、画質や圧縮という点から鑑みると、単色又は複数色に変換するために「文字である」ことにこだわる必要はない。一例として、単色で表現されたマーク等は、JPEGで表現するより単色MMRで表現したほうが画質圧縮率ともによい。しかし、確率の問題として、文字以外の領域はグラデーションで表現されていることが多いため、文字であるか否かを判定することは重要である。
【0091】
(ステップS3003:文字判断処理)
次に、ステップS3003で文字判断を行う。ここでは、文字切り(ステップS3002)での情報を入力し、行ごとにその行の平均文字サイズを演算する。このとき、極端に小さい文字の情報は無視すると、よりよい結果が出る。また、その平均サイズよりも極端に大きい文字矩形は文字でないと判定する。さらに、平均に関わらず、縦横比情報等から明らかに文字でない形状の場合は文字でないと判定する。
【0092】
判定の結果、その領域中にm文字存在する場合、m文字すべてが文字でないという判定になった場合、文字領域検出部1104は、この領域は画像である、という結果を出力する。
【0093】
しかし、m文字中n文字(m>n,n>=0)が文字でない、すなわち文字である矩形が残っている場合は、2値画像上から文字でないと判定された黒オブジェクトを消去して、この領域は文字である、という結果を出力する。
【0094】
さらに、最終画質を考慮して、本実施形態では以下に示す例外処理を加える。例えば、領域中に10文字存在するときに、飛び飛びの5文字が文字として単色化され、残りが文字でないとしてJPEG圧縮されると「ムラ」のある画像が得られ、目視的に好ましくない画像となる。そこで、この文字判断処理において、文字、画像の判断が頻繁に切り替わるようなケースには、その並びや文字と判断される矩形の頻度等から全矩形文字に揃える、又は全矩形画像に揃えるようにする。
【0095】
上述した文字判断処理で、文字と判断された領域についてはステップS3004に進み、文字でないと判断された領域については、ステップS3005に進む。
【0096】
(ステップS3005:単色判断処理)
ステップS3005では単色判断を行う。この処理を通る領域は文字領域検出部1104にて文字と判定されたものの、文字判断にて文字でないと判定された領域である。前述したように、文字であるか否かにかかわらず、単色で表現されている領域であれば単色化してMMRしたほうが、画質圧縮率ともによい。そこで、この領域に対しては、単色であるか否かの判断を行う。
【0097】
具体例として、2値画像の黒色部に相当するカラー画像の画素のRGBそれぞれのレベルのヒストグラムを取り、それぞれのヒストグラムすべての分散値が閾値以下であればこの領域は単色であると判定する。その結果、単色である場合にはステップS3006の1色抽出処理に進み、複数色である場合にはDOJPEGを返す。
【0098】
(ステップS3006:1色抽出処理)
ステップS3006での1色抽出処理を、図13のフローチャートを用いて説明する。すなわち、図13は、第2の圧縮モードにおける1色抽出処理を説明するためのフローチャートである。まず、その文字座標が参照する2値画像の細線化処理を行い、スキャナ読み込み時の下地から文字部への変化部にあたる黒画素を減らし、新しい2値画像newbiを作成する(ステップS1201)。
【0099】
次に、newbiの黒画素に対応する原画像のRGBのそれぞれの値のヒストグラムを取る(ステップS1202)。この処理は、もちろん、YUV等の他の色空間で行っても構わない。そして、RGBそれぞれの代表値を算出する(ステップS1203)。この代表値は、例えば、一番大きな値とする。又は、ヒストグラムのステップ数を少なくして、大まかなヒストグラムで一番大きな値を得た後に、このヒストグラムに存在する細かなヒストグラムで一番大きな値を得る方法で代表値を求めてもよい。
【0100】
後者のような方法を取ることにより、図14に示したようなヒストグラムからノイズ1402に惑わされることなく、真の代表値1401を得ることができる。図14は、1色抽出処理における代表値の算出方法を説明する図である。細かなヒストグラムとしては、例えば8ビットのRデータから図14に示すような256段階のヒストグラムが得られるわけであるが、この場合の最大値は1402になり、これは真の代表値ではない。そこで、当該ヒストグラムをオーバーラップする64の幅に分け、8段階のものを256段階のヒストグラムから再計算する。それをAからHに示したが、AとHは32幅しかない。この再計算により代表値はGに存在することがわかり、G内の最大値を検索して1401を得ることができる。以上の処理をすべての文字座標に繰り返すことにより、すべての文字座標に1つずつ代表色が算出される。
【0101】
(ステップS3004:減色処理)
ステップS3004では、文字に対し、減色処理を行う。減色処理部1082においては、文字部の色について、元の原稿が単色で表現されていた場合においても、スキャナ読み取り時に、下地から文字部への色の遷移部分が存在する。
【0102】
図15は、スキャナにより発生する文字部の遷移部分(グラデーション)を説明する図である。図15では簡単のため、RGBのうち、Rのみで説明し、GBについては省略する。Aという文字はもともとR=32レベルの単色にて構成されていたものであるが、スキャナにより読み込むと、そのデータは拡大の画素で示すようにばらついてしまう。図15では、もともとのレベルR=32近くの黒まで達している画素は3201、3202、3203の3つだけに過ぎず、他の画素は、下地色(例えば、白)とR=32の間のいずれかのレベルとなる結果、文字が遷移部分のあるグラデーションで表現されている。
【0103】
また、図16は、スキャナにより発生する文字部の遷移部分(グラデーション)を3次元ヒストグラムで表した図である。図16では、下地色が3501に示す白であり、文字色が3502に示す黒であるとする。このときの遷移部分を3503に示す。ここで、本来単色で表現されていた文字部のスキャナ読み込みによるバラツキである遷移部分を厳密に表現する必要はない。すなわち、その代表色のみで表現することができれば画質もよく、データ量も少なくてすむ。しかしながら、2値画像の細線化等を行ったとしても、この下地から文字部の遷移部分の色を完全に除去することは難しい。
【0104】
そこで、1文字は単色であらわされることが多いということを利用して、文字切り情報を使い、1文字1色に限定することにより画質、圧縮率の向上を目指す。但し、当初からグラデーションで表現される文字等を更に高画質で圧縮したい場合には、その文字が複数色で表現されているかの判定等の例外処理を加えればよい。すなわち、このように文字切り情報を利用して1文字1色にすれば、元々単色で表現されていた文字画像のスキャナ読み込みによるバラツキとして発生する遷移部を除去することができる。
【0105】
<文字部塗りつぶし部1105>
文字部塗りつぶし部1105の処理の一例を図17と図18を用いて説明する。図17は、文字塗りつぶし処理の概要を説明するための図である。また、図18は、文字部塗りつぶし処理の流れを説明するためのフローチャートである。
【0106】
図17(a)に示すように、グラデーション画像を背景とし、一例として、ABCという青色の文字が中央付近に描かれた画像を原画像とする。この原画像から図17(b)に示すような1つの文字領域の2値画像を得たとする。そして、文字部塗りつぶし処理として、まず、ステップS11010で、全画像を例えば32×32の領域(以下、パーツ)に分割し、パーツごとに処理を行う。図17(c)にパーツごとに分けた様子を示す。この図では簡単に説明するため、4×5のパーツに分割した状態を示している。図17(c)の各領域の左上の数字はパーツ番号を示す。この領域分割の個数はこれに限るものではなく、他の分割数であってもよい。
【0107】
ステップS11020では、未処理のパーツがあるか否かを判断し、未処理のパーツについては、ステップS11030に進んで文字塗りつぶし対象領域がそのパーツ内に存在するか否か判断される。尚、文字領域検出部1104で文字領域と判定された領域でも、文字色抽出部1108でDOJPEGが返された領域は、文字部塗りつぶしの対象領域とはしない。
【0108】
図17(c)に示すように、パーツ00〜04、10、14、20、24、30〜35は、ステップS11030において文字塗りつぶし対象領域がないと判断され、処理は行われずに、次のパーツに進む。文字塗りつぶし対象領域の存在するパーツ(例えばパーツ11)に対しては、ステップS11040に進み、対応する2値画像を参照し、2値画像の白部分に対応するカラー画像のRGB値(またはYUV等でも良い)の平均値ave_colorを算出する。次にステップS11050において、対応する2値画像を参照し、黒画素に対応する画素の濃度データをave_colorとする。以上の処理を文字塗りつぶし対象領域の存在するパーツ(ここでは、パーツ12、13、21、22、23)に繰り返す。このようにして、文字の存在した部分に周りの画素の平均値を埋めることができる。
【0109】
このようにして得られた塗りつぶし画像を縮小部1106において縮小する。本実施形態では一例として単純間引き処理を行うものとする。尚、この縮小処理と文字部塗りつぶし処理は順番を逆にしても構わない。その場合、2値画像とカラー画像の位置のずれに留意する必要がある。
【0110】
さらに、文字領域座標1112、パレット1114、圧縮コードX(1113)、圧縮コードY(1115)、圧縮コードZ(1116)の5つをまとめたフォーマットを必要ならば作成する。
【0111】
5つをまとめるフォーマットの一例として、Adobe(登録商標)のPDF等が考えられる。AdobeのPDFとは、Adobeが無償配布しているAcrobat Reader(登録商標)というアプリケーションで表示できるフォーマットであり、ドキュメントを作成したアプリケーションがないために、受け手側でファイルを開けないなどのトラブルを避けることができる。その他のフォーマットとしては、XML等がある。XMLとは、ネットワークを介して文書やデータを交換したり配布したりするための記述言語である。
【0112】
(変形例)
上記第2の圧縮モードでは、2値画像は全面単一閾値によって作成したが、これに限られるものではなく、例えば、文字領域検出104により検出された文字領域ごとに最適閾値を演算して2値画像を作成してもよい。その場合、図12のフローチャートにおけるステップS3001の再2値化判断が必要なくなる。
【0113】
また、文字部塗りつぶし部1105、文字色抽出部1108において同じ2値画像を使用したが、これに限られることはなく、それぞれに最適な2値化部を文字部塗りつぶし部1105、文字色抽出部1108内部に所有するようにしてもよい。
【0114】
<<他の実施の形態>>
尚、本発明は、複数の機器(例えば、ホストコンピュータ、インタフェース機器、リーダ、プリンタ等)から構成されるシステムに適用しても、一つの機器からなる装置(例えば、複写機、ファクシミリ装置等)に適用してもよい。
【0115】
また、本発明の目的は、前述した実施形態の機能を実現するソフトウェアのプログラムコードを記録した記録媒体(または記憶媒体)を、システムあるいは装置に供給し、そのシステムあるいは装置のコンピュータ(またはCPUやMPU)が記録媒体に格納されたプログラムコードを読み出し実行することによっても、達成されることは言うまでもない。この場合、記録媒体から読み出されたプログラムコード自体が前述した実施形態の機能を実現することになり、そのプログラムコードを記録した記録媒体は本発明を構成することになる。また、コンピュータが読み出したプログラムコードを実行することにより、前述した実施形態の機能が実現されるだけでなく、そのプログラムコードの指示に基づき、コンピュータ上で稼働しているオペレーティングシステム(OS)などが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。
【0116】
さらに、記録媒体から読み出されたプログラムコードが、コンピュータに挿入された機能拡張カードやコンピュータに接続された機能拡張ユニットに備わるメモリに書き込まれた後、そのプログラムコードの指示に基づき、その機能拡張カードや機能拡張ユニットに備わるCPUなどが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。
【0117】
本発明を上記記録媒体に適用する場合、その記録媒体には、先に説明したフローチャートに対応するプログラムコードが格納されることになる。
【0118】
【発明の効果】
以上説明したように、本発明によれば、高い圧縮効率でカラー文書画像を好適に圧縮することができる。また、上記カラー文書だけの画像に限らず、文字領域と非文字領域が混在する画像の圧縮にも対応できる。
【図面の簡単な説明】
【図1】本発明の第1の圧縮モードにおけるカラー文書画像を圧縮する圧縮装置の細部構成を説明するためのブロック図である。
【図2】本発明の第1の圧縮モードにおけるカラー画像の圧縮処理の流れを説明するためのフローチャートである。
【図3】第1の圧縮モードにおけるカラー情報ソート部105でのソーティング重み係数の例を示す図である。
【図4】第1の圧縮モードにおける圧縮データ112の構成を説明するための図である。
【図5】図2の圧縮処理におけるステップS204で示される中間色削減部107の動作手順を詳細に説明するためのフローチャートである。
【図6】図5におけるステップS503〜S505における処理の詳細を説明するためのフローチャートである。
【図7】本実施形態における圧縮処理対象となるカラー文書画像を構成するデータを説明するための概要図である。
【図8】前景色画像と中間色画像と補完中間色画像を説明するための概要図である。
【図9】同実施形態における補完処理の原理を説明するための概要図である。
【図10】第2の圧縮モードにおける画像圧縮方法を実施するための処理及び中間画像を説明するためのブロック図ある。
【図11】文字領域検出部1104での文字領域検出処理を説明するためのフローチャートである。
【図12】文字色抽出部1108における文字色抽出処理を説明するためのフローチャートである。
【図13】第2の圧縮モードにおける1色抽出処理を説明するためのフローチャートである。
【図14】1色抽出処理における代表値の算出方法を説明する図である。
【図15】スキャナにより発生する文字部の遷移部分(グラデーション)を説明する図である。
【図16】スキャナにより発生する文字部の遷移部分(グラデーション)を3次元ヒストグラムで表した図である。
【図17】文字塗りつぶし処理の概要を説明するための図である。
【図18】文字塗りつぶし処理を説明するためのフローチャートである。
【符号の説明】
101 原画像
102 減色処理部
103 カラー情報
104 インデックスカラー情報
105 カラー情報ソート部
106 同色統合部
107 中間色削減部
108 背景色データ
109 2値画像作成圧縮部
110 2値画像圧縮データ
111 データ結合部
112 圧縮データ
113 圧縮順位決定部
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image compression method for compressing a color document image, an image compression apparatus, a program, and a recording medium.
[0002]
[Prior art]
In recent years, with the widespread use of color printers, color scanners, etc., the number of colorized documents has increased, and there has been an increased opportunity to capture and store them as electronic files or send them to third parties via the Internet. Yes. However, if the full color data is used as it is, the load on the storage device and the line is large, so it is necessary to reduce the amount of data handled by a method such as compression processing.
[0003]
Conventionally, as a method for compressing a color image, for example, a method of compressing a binary image having a pseudo gradation by error diffusion or the like, a method of compressing in a JPEG format, and a ZIP compression by converting to an 8-bit palette color And a method of performing LZW compression (see, for example, Patent Document 1).
[0004]
[Patent Document 1]
JP 2002-077631 A
[0005]
[Problems to be solved by the invention]
However, although the size (data amount) is small in the pseudo gradation binary image, the color information is lost. Further, when compression is performed in the JPEG format, a trade-off between the compression size and the character quality occurs due to mosquito noise peculiar to JPEG.
[0006]
Furthermore, the method of converting to palette colors and performing ZIP compression or LZW compression is efficient when the color document image is held in multiple bits because the color distribution of most of the color document image is local rather than discrete. However, as a result of compressing it, the efficiency is naturally inferior.
[0007]
Furthermore, according to the method described in Patent Document 1, high quality can be obtained for a normal character region by combining region determination, binary compression by MMR, lossless compression by ZIP, and lossy compression by JPEG. However, for example, it is difficult to determine the area of a portion of a manuscript that has been corrected by handwriting, and there is a problem that mosquito noise occurs due to JPEG compression.
[0008]
The present invention has been made in view of such circumstances, and provides an image compression method, an image compression apparatus, a program, and a recording medium capable of suitably compressing a color document image with high compression efficiency. Objective. Another object of the present invention is to be able to cope with compression of an image in which character areas and non-character areas are mixed, in addition to the above-described image of only a color document.
[0009]
[Means for Solving the Problems]
In order to solve the above-described problem, the present invention provides an image compression method for compressing a color image, wherein each pixel of the color image is converted into an index assigned corresponding to a color value, and an indexed color is converted. An index conversion step for generating color information including data on the number of pixels and color for each pixel, an index image obtained by converting each pixel into an index, and a color value corresponding to a specific index in the index image as a background of the color image. A background color determination step to be a color, a compression order determination step for determining a compression order when the color image is compressed for each index based on the color information and the background color, and each index from the index image A binary image generating step for generating a binary image and the binary according to the compression order A compression step of compressing an image; and a generation step of generating compressed image data by integrating background data including the size of the color image and the color value of the background color and compressed data of the binary image for each index. It is characterized by having.
[0010]
DETAILED DESCRIPTION OF THE INVENTION
In the following embodiments, a color image compression technique that can be mounted on, for example, a color copying machine will be described.
[0011]
The functions of the color copying machine include, for example, a color copy function, a color print function, and a color scanner function. The compression technology described in this embodiment is applicable to the color copy function and the color scanner function. is there. Specifically, it is a compression technique used when compressing color image data obtained by reading a color original.
[0012]
As the color scanner function, for example, a data transmission function for compressing color image data obtained by reading a color original and transmitting the compressed data to the outside, and the color image data are compressed and stored in a storage unit inside the copier. This is a compression technology that can be installed in both functions.
[0013]
In the present embodiment, a plurality of compression modes are provided as described below. These modes are selected depending on the content of the color image (color document) to be compressed. This selection may be automatic or manual by the user.
[0014]
<< first compression mode >>
First, as an embodiment related to the first compression mode, a compression method described in detail below can be executed. This compression mode is suitable for compressing a color image composed of a small number of colors. Therefore, this compression mode can be automatically selected by determining the color distribution of the color image or determining the character and photographic area and determining the ratio. Alternatively, the user may select manually.
[0015]
Hereinafter, a configuration or method for implementing the first compression mode will be described in detail with reference to the drawings.
[0016]
FIG. 7 is a schematic diagram for explaining data constituting a color document image to be compressed in the present embodiment. As shown in FIG. 7, in the present embodiment, an original color document in which red letters and black letters are formed on a white background and handwritten correction is added with a blue ballpoint pen is used. The color image (that is, the original image) captured by the scanner is divided into white, black, red, and blue partial binary images by performing color reduction processing, same color determination processing, intermediate color reduction processing, and the like.
[0017]
Here, when the number of pixels for each of the divided colors is compared, the white color of the background is usually the largest, so this color is determined as the background color. The white color determined as the background color is not stored as image data, but is stored according to the actual size and color value of the original. The remaining black, red, and blue colors are displayed as shown in FIG. Each is divided into partial (binary) images and compressed and stored. In this way, unlike a natural image such as a color photograph, a color document image has a local color distribution and therefore has high compression efficiency.
[0018]
Here, FIG. 8 is a schematic diagram for explaining the foreground color image, the intermediate color image, and the complementary intermediate color image. That is, since the partial binary image that has not been reduced by the intermediate color reduction processing is as shown in FIG. 8B, the inside is complemented to reduce the edge amount as in the complementary intermediate color image shown in FIG. The image is expanded in the order of the complementary intermediate color image and then the foreground color image. By doing so, the complemented portion is overwritten by the foreground color image that is the upper layer, and the same image as when the complement processing was not performed can be reproduced and the compression size can be reduced.
[0019]
FIG. 9 is a schematic diagram for explaining the principle of the complementary processing in the present embodiment. In FIG. 9, when the portion indicated by the horizontal line 91 of the image pattern “A” is expressed as a layer, it is as shown in FIG. Here, the intermediate color is represented by a pattern with 8 edges, but if it is drawn ahead of the foreground color, even if complement processing is performed as shown on the right, if viewed from above, there is no complement processing. Looks the same. Here, when the number of edges of the intermediate color subjected to the complement processing is examined, it is four as shown in the lower right FIG. 93, which is reduced to half before the complement processing. This increases the redundancy of the partial binary image and improves the compression efficiency.
[0020]
Here, as for the compression order, if a color having a pattern like the intermediate color image shown in FIG. 8B is selected at the top, the compression size becomes small, but actually checking the image pattern increases the processing load. . In general, a foreground color in a document image is a highly visible color such as black on a white background or yellow on a blue background, and an intermediate color in question is, for example, gray between white and black. Thus, the same effect as when the image pattern is examined can be obtained by sorting the colors remaining after the color reduction by values such as luminance and color difference and determining the compression order based on the extracted background color.
[0021]
FIG. 1 is a block diagram for explaining a detailed configuration of a compression apparatus for compressing a color document image in the first compression mode of the present invention. In FIG. 1, reference numeral 101 denotes an original image (color image) obtained by reading a color document with a scanner or the like. Reference numeral 102 denotes a color reduction processing unit, which performs simple color reduction processing on an input original image 101 to a predetermined number of colors and indexes it.
[0022]
Reference numeral 103 denotes color information, which includes data representing the number of pixels, the color centroid, and the color distribution range for each color indexed by the color reduction processing unit 102. Reference numeral 104 denotes an index color image to which an image reduced in color by the color reduction processing unit 102 is output.
[0023]
A color information sorting unit 105 sorts the data of the color information 103 according to the number of pixels. The same color integration unit 106 compares the color information 103 sorted by the color information sorting unit 105, determines the same color, performs integration processing, and updates the color information.
[0024]
Reference numeral 107 denotes an intermediate color reduction unit that performs a process of combining the color information in the vicinity of the color information 103 to reduce the number of colors located in the halftone. After processing here, the value of the top color centroid of the remaining color information becomes the background color data 108. A compression order determination unit 113 sorts the color information reduced by the intermediate color reduction unit 107 by luminance, and determines the order of compression based on the background color information.
[0025]
Reference numeral 109 denotes a binary image creation / compression unit, which creates a binary image for each remaining color information other than the background color and performs compression in accordance with the order determined by the compression order determination unit 113. At this time, the color information image having a high compression order is complemented by the image data having a low order.
[0026]
Reference numeral 110 denotes binary image compression data, which is composed of data groups created by the binary image creation compression unit 109, and color information is added to each. A data integration unit 112 integrates the background color data 108 and the binary image compressed data 110 to create a compressed image 112.
[0027]
That is, in the present embodiment, as will be described in detail below, an image compression method for compressing a color image (particularly a color document image) will be described. The procedure is as follows. First, the color reduction processing unit 102 converts each pixel of the color image into an index assigned corresponding to the color value, and the color information 103 including the number of pixels for each indexed color and each pixel. And an index image (index color image 104) converted into an index. Then, the color value corresponding to the predetermined index in the index image is set as the background color of the color image by the color information sorting unit 105 or the like. In addition, the compression order determination unit 113 determines the compression order when the color image is compressed for each index based on the color information and the background color. Further, the binary image creation compression unit 109 generates a binary image for each index from the index image, and compresses the binary image according to the compression order. Then, the data combining unit 111 integrates the background data 108 including the size of the color image and the color value of the background color and the compressed data of the binary image for each index to generate compressed image data (compressed data 112). It is characterized by.
[0028]
FIG. 2 is a flowchart for explaining the flow of color image compression processing in the first compression mode of the present invention.
[0029]
First, when a color image that is the original image 101 is input, the color reduction processing unit 102 performs color reduction processing of the original image 101 to a predetermined number of colors, and outputs color information 103 and an index color image 104. Here, in the present embodiment, the indexing is characterized by generating an index image (index color image 104) in which one index is associated with a predetermined range of color values and the number of bits of the color image is reduced. To do.
[0030]
Note that the color reduction processing in the present embodiment is to reduce the full-color RGB 24-bit data to R-G-B, such as 2-2-2, 3-2-2, 3-3-3 bits, etc. . The method of selecting the number of bits can be arbitrarily selected depending on the accuracy of the color determination. In the following embodiment, description will be made assuming that 2-2-2 bits are selected. The color information 103 output from the color reduction processing unit 102 includes the number of pixels for each reduced color, the color centroid (average value of colors), and coordinate data representing the color distribution range.
[0031]
That is, in the image compression method according to the present embodiment, in the index conversion process described above, in addition to the number of pixels, the color centroid and color distribution range for each indexed color of the color image are counted as color information. It is characterized by doing.
[0032]
Next, the color information 103 obtained by the color reduction processing unit 102 is input to the color information sorting unit 105, and is sorted by a value that is weighted according to the number of pixels and the index number (step S202).
[0033]
Sorting is basically positioned higher as the number of pixels is higher, but the weighting, that is, the coefficient, is adjusted so that the color close to the primary color is higher when comparing the color information of the same number of pixels. Value. FIG. 3 is a diagram illustrating an example of a sorting weight coefficient in the color information sorting unit 105 in the first compression mode. As shown in FIG. 3, in this embodiment, coefficients of 0.9 to 1.2 are assigned to each of the four gradations of RGB. This value is arbitrary, and may be changed according to the number of color reductions in the color reduction processing unit 102 and the priority of colors.
[0034]
Further, the color information sorted by the color information sorting unit 105 is input to the same color integration unit 106. The same color integration unit 106 compares the values of the color centroids of the color information, and if the distance is short, the color information is integrated as the same color (step S203). This process is a process for returning a color separated into a plurality of colors to one color because any RGB value is close to the threshold value in the first color reduction process, although they are originally the same color. For the color information to be integrated, the sorted upper color information remains, and the data of the number of pixels for each color, the color centroid, and the color distribution range are recalculated.
[0035]
That is, the image compression processing according to the present embodiment is characterized by performing the same color integration processing for integrating color information having close color centroids in color information. Further, when the same color integration process integrates the same color into a sorting higher color, the calculated number of pixels, the color distribution range, and the centroid of the color value are recalculated. Furthermore, the same color integration process performs sorting based on the product of coefficients determined in advance according to the number of pixels for each color in the color image and the position in the color space, and determines the same color based on the sorting order. It is characterized by performing.
[0036]
Further, the intermediate color reduction unit 107 converts the color centroid value of the color information updated by the same color integration unit 106 into a luminance color difference value, compares the values, and performs a process of combining neighboring color information. (Step S204). Thereby, the number of colors located in the halftone is reduced. The purpose of this processing is to remove many gradation components generated from white to black at the boundary between the white of the background and the black of the character part when the original document image is a black and white document, for example. That is. That is, gray near white is white and gray near black is black. The other colors are processed in the same manner. In this way, sorting is performed according to the product of the coefficients corresponding to the number of pixels in the color and the position in the color space, and the color centroid value is not recalculated when performing the same color integration processing and intermediate color reduction processing according to the order. This improves the color reproducibility.
[0037]
In the same color integration unit 106, the color information to be reduced and combined is recalculated and updated similarly to the update of the color information in step S203, but only the value of the color centroid is left as it is. This is because the value of the color centroid is the final display color, and if the intermediate colors are integrated to obtain the color centroid, for example, if it is black, gray will be mixed and become a lighter color, and white will be darker This is to prevent it from becoming. As the representative color of the combined color information, the color centroid of the color information having a high sorting order is adopted. Here, the reason why the weighting coefficient is used in the sorting as well as the number of pixels is to give priority to the primary colors that will be used in the color document original.
[0038]
In other words, the image compression processing according to the present embodiment is characterized in that the color information is subjected to intermediate color reduction processing for combining the color information having similar luminance color differences with each other to reduce the intermediate color. The intermediate color reduction process is characterized in that intermediate colors are reduced based on the sorting order. In addition, when the intermediate color reduction process integrates similar colors into sorting upper colors, the number of counted pixels and the color distribution range are recalculated, and only the color centroid is not recalculated.
[0039]
Then, the value of the color centroid of the most significant color information obtained as a result of processing by the intermediate color reduction unit 107 is output as the background color data 108 (step S205). That is, the image compression processing according to the present embodiment is characterized in that the centroid of the color value of the color positioned at the top of the sorting is extracted as the background color.
[0040]
Further, the color information is sorted, and the compression order is determined based on the background color obtained in step S205 using the result (step S206). For example, if the color information reduced by the intermediate color reduction unit 107 is five colors with identification numbers 1 to 5 and the background color identification number is 4, the result of sorting by luminance is 2, 3, 5, 1, 4 , The compression order is 1, 5, 3, 2 in this order. In the case of a document using many white characters, the order is 4, 1, 5, 3, 2, and the compression order is 1, 5, 3, 2. Furthermore, when it is estimated that white characters and normal characters are mixed, such as 2, 3, 4, 5, 1, the priority of white characters that are considered to be less frequently used in the document is set. In order to make it low, the compression order is set to 5, 1, 3, 2.
[0041]
Then, a binary image for each color is created using the color information remaining in the intermediate color reduction unit 107, the result of the compression order determination unit 113, and the index color image 104, and is compressed by a method such as MMR (step S207). ). Note that the binary image created here has a size corresponding to the color distribution range held in the color information, and if it exists only in a part of the document, only that part is compressed and stored.
[0042]
That is, in the image compression method according to this embodiment, in determining the background color, the color value corresponding to the index of the maximum number of pixels is used as the background color of the color image. Then, determination of the compression order for the index is not performed, and generation and compression of a binary image are not executed.
[0043]
For example, assuming that the index number of the index color image 104 is 0 to 63 and the color information of the indexes 60 and 62 is integrated into the index 63, the binary image is an index image. This is an image obtained by ORing the data of 60 and 62, and is drawn with the value of the color centroid of the color information that the index 63 has. This is the basic part of the binary image for each color, and complement processing is performed according to the order determined in step S206.
[0044]
In this complementing process, the background color identification number is 1, and the order of the remaining colors is 2, 3, and 4. The identification number is a temporary identifier representing a set of integrated index numbers. For example, when the arrangement of 8 pixels is 1, 2, 3, 4, 2, 3, 3, 1, first, the identification number 2 having the highest priority is first viewed. If attention is paid only to the identification number 2, the bit pattern is 01001000, but complement processing is performed to obtain a bit pattern of 01111000. The identification numbers 3 and 4 are 00100110 and 00010000, respectively.
[0045]
The result is binary image compression data 110, which is a data group comprising color values, position and size, and MMR compression data for each color information data. Then, the data combining unit 111 creates the compressed data 112 by combining the background color data 108 and the binary image compressed data 110 and outputs them (step S208). That is, the compression processing according to the present embodiment is characterized in that the binary image is MMR compressed.
[0046]
FIG. 4 is a diagram for explaining the configuration of the compressed data 112 in the first compression mode. First, information such as the size of the input document image (original), the color value of the background color, and the resolution is stored in the header portion. Here, since the color having the largest number of pixels is basically selected as the background color, for example, when the original is printed on color paper such as red, a red value is entered. However, it is generally considered that the background is often white, so the white color of the background color may be determined, and if the background color is determined to be white, the background color value may be omitted. In the white determination, for example, when each value of RGB is equal to or larger than a certain value and the difference between the values is within a certain value, it is regarded as white.
[0047]
Further, as shown in FIG. 4, the header portion is followed by compressed data for each color. The compressed data is composed of the color value, the position coordinates and size where the color exists, and the MMR compressed data body. For example, when the number of colors remaining excluding the background color is N, data having the same structure exists for the number of colors. This storage order is assumed to follow the compression order determination unit 113. Note that if the input image is a single-color original such as a blank sheet, data for this portion is not created.
[0048]
If the input image is a black and white document, the number of color compressed data is 1, so the data amount is almost equivalent to that of a binary image. Here, if the black pixel is only a part of the document, the MMR compressed data is compressed only in that part, so that it becomes smaller than the normal MMR compression.
[0049]
Next, the compressed data 112 is returned to the original image. The entire area of the original is written with the background color stored in the header portion shown in FIG. This is possible by expanding the MMR image and overwriting the stored position with a color value using the image as a mask. Here, the storage order follows the order of the compression order determination unit 113, and the decompression is performed in this order. Therefore, the binary image creation compression unit 109 has the same decompression result regardless of the presence or absence of the complement processing. Thus, the compression efficiency is improved by complementing the partial binary image according to the compression order. In addition, by determining the compression order based on the background color, it is possible to quickly check the order in which the compression efficiency is improved when complement processing is performed.
[0050]
FIG. 5 is a flowchart for explaining in detail the operation procedure of the intermediate color reduction unit 107 shown in step S204 in the compression processing of FIG.
[0051]
First, a list is created in the sorting order of color information (step S501). Then, intermediate color reduction processing is performed along this list. Next, the color centroid value of the color information is converted from RGB to YCrCb luminance color difference signals and data is added (step S502). The reason for converting to a color difference is that it is suitable for reducing intermediate colors by integrating similar colors with close luminance differences.
[0052]
In steps S503, S504, and S505, a comparison is made as to whether or not the difference between each component of Y, Cr, and Cb added to each color information is within a predetermined threshold value. Reduce the number of colors by integrating. FIG. 6 is a flowchart for explaining details of the processing in steps S503 to S505 in FIG. Note that the processing of the flowchart shown in FIG. 6 is different from the processing in steps S503 to S505 only in the threshold for comparing YCrCb.
[0053]
First, color information I is selected from the color information list given from the processing of step S501 in FIG. 5 (step S601). Next, the YCrCb value of the color information I is stored in Y′Cr′Cb ′ (step S602). Then, the lowest color information in the list is selected as the color information J (step S603).
[0054]
Here, the respective values of Y, Cr, and Cb of the color information I and J are compared, and it is checked whether or not the difference is within the threshold value given in each of steps S503 to S505 in FIG. 5 (step S604).
[0055]
As a result, if it is determined that the value is within the threshold (YES), the process proceeds to step S606, and if not (NO), the process proceeds to step S608. However, if the signs of the Cr or Cb values of the color information I and J are different, the absolute value of the Cr or Cb value of the color information J is checked, and this condition is not satisfied if it is greater than a predetermined value. Like that. For example, even if the difference between the Cr values of the color information I and J is within the threshold value given in the flowchart shown in FIG. 5, if the signs are different, the absolute value of the color information J is compared with a predetermined value. If it is smaller, the process proceeds to step S605. If it is larger, the process proceeds to step S608.
[0056]
The same process is performed for the value of Cb. This is because, depending on the size of the threshold set in the flow of FIG. 5, when the differences are simply compared and integrated, the color information of different colors such as light blue and light red is integrated. Is to prevent. Conversely, if the threshold value is set so that different colors such as light blue and light red are not integrated, it is impossible to integrate similar colors such as blue and light blue.
[0057]
In step S606, the color information J is integrated with the color information I. As a result, the data such as the number of colors and the distribution range of the color information I are updated, but the value of the color centroid is not updated. Instead, the color centroid when integrated is calculated and reflected in Y′Cr′Cb ′ stored in step S602.
[0058]
Next, the color information J data is removed from the list (step S607). In step S608, it is checked whether or not the color information located at the top of the color information J list is I. As a result, if it is not I (NO), the process proceeds to step S609, and if it is I (YES), the process proceeds to step S610.
[0059]
In step S609, the color information located one level above color information J is set as color information J, and the process returns to step S604. On the other hand, in step S610, the stored Y′Cr′Cb ′ value is returned to YCrCb of color information I, and the reference values for threshold comparison in the flowcharts shown in FIGS. 5 and 6 are integrated in steps S604 to S609. The updated color information is updated to the original color centroid value.
[0060]
In step S611, it is checked whether the color information immediately below color information I is at the lowest level, or is deleted from the list in step S607 and does not exist. The process proceeds to S612. In step S612, the color information immediately below the color information I is set to I, and the process returns to step S602. On the other hand, if not (YES) in step S611, the process is terminated, and the updated color information list is returned to the flowchart of FIG.
[0061]
In the present embodiment, the threshold value set in each of steps S503 to S505 described with reference to FIG. 6 is set slightly larger than the color difference CrCb for the purpose of integrating similar colors. In step S503, the color information of similar colors with a small threshold and a relatively small difference in luminance color difference is integrated, and the threshold is increased in steps S504 and S505, and the similar color having a relatively large difference in luminance color difference. Integrate color information. The value of YCrCb, which is the temporary color centroid added in step S502, is recalculated in the flowchart of FIG. 6 so that the colors can be integrated without setting the threshold value after step S504 to a very large value. It is to do.
[0062]
For example, it is assumed that bright black is integrated with black in the process of the first step S503. In this case, the value of YCrCb, which is the temporary color centroid, moves in the bright black direction. In such a case, since the distance from the dark gray is closer, the dark gray can be integrated into the black simply by increasing the threshold value after the next step S504 to some extent.
[0063]
In addition, as shown in steps S503 to S505, multi-stage processing is performed because it is possible to integrate from the closest color, and the size of the compressed data 112 can be controlled by changing the number of stages. is there.
[0064]
As can be seen from FIG. 4, one of the factors that determine the size of the compressed data 112 is the number of color compressed data. That is, if the number of colors finally remaining is controlled, the compression size can be controlled. For example, if the number of colors is increased, the quality is close to that of the original color image, and if the number of colors is decreased, the image is closer to a simple binary image. Therefore, the number of stages may be determined according to the image quality to be obtained and the compression size.
[0065]
Thereafter, in step S506, the updated color information is returned to the processing shown in the flowchart of FIG.
[0066]
In other words, in the image compression method according to the present embodiment, the intermediate color reduction process has a plurality of predetermined thresholds, converts the centroid of the color value into a luminance color difference signal, and performs integrated reduction of the colors in the threshold range according to the sorting order. It is characterized by performing. Further, the centroid of the color value is recalculated every time integration reduction is performed using the value converted into the luminance color difference signal as the temporary color centroid. Further, the plurality of threshold values are changed depending on whether the compression rate priority or the image quality priority is given.
[0067]
As described above, in view of the fact that many color document images have one or more characters or the like formed on a specific background color, there is a partial binary image for each color when this is compressed. Therefore, it can compress efficiently. Also, the image quality and size can be controlled by using a plurality of threshold values in the intermediate color reduction processing and controlling the number and values of the threshold values.
[0068]
In this compression mode, each pixel constituting the color document image is classified into one of a predetermined number of limited colors, a color corresponding to the background is specified from the limited colors, and the luminance value of the background color is determined. In accordance with the brightness value of each other limited color, the overwriting relationship of each limited color is ranked, and for each limited color, a connected pixel composed of a pixel corresponding to the limited color and its adjacent pixels A group is generated, and for a connected pixel group corresponding to a certain limited color A (for example, equivalent to an intermediate color in FIG. 9), an adjacent pixel included in the connected pixel group is higher than the limited color A (overwritten later) as an overwrite relationship. For example, if there is a pixel at a position where a limited color corresponding to the foreground color in FIG. 9 is present, the corresponding adjacent pixel is replaced with the limited color A and obtained here. The procedure to compress the connected pixel group In the background (e.g., corresponding to the background 9 color) in the case of processing considered to be the lowest priority override relationship, many color document image is compressed efficiently.
[0069]
(Modification)
In the description of the first compression mode described above, the interpolation processing is performed only in the primary direction (raster direction). However, since the binary image compression method employed also performs the interpolation in the secondary direction, If an effect can be expected, it may be performed.
[0070]
In the above description, the sorting is performed based on the luminance. However, the sorting may be performed based on the distance in the color space between the background color and the remaining colors. That is, in this case, the compression order is determined based on the distance in the color space between the determined background color and the remaining colors.
[0071]
Further, in the above description, the complementing method performs complementation based on whether or not the blank portion of the identification number of the color of interest is filled with the lower identification number, but this is complemented depending on whether the previous pixel is 1 or not. You can go.
[0072]
Furthermore, as in the above description, the identification number is 1, the order of the remaining colors is 2, 3, 4, and the arrangement of 8 pixels is 1, 2, 3, 4, 2, 3, 3, 1. In this case, the identification number 2 is found at the second pixel, 01, the next is identification number 3, the previous pixel is 0, the next is 011, the next is 4, and so on. 01111110. The identification numbers 3 and 4 are 00110110 and 1000010000, respectively. Therefore, although the bit pattern obtained is different from that of the first compression mode described above, since the edge amount is the same, roughly the same compression size can be obtained and only the pixels are sequentially viewed, so the processing is light. High-speed processing is possible.
[0073]
<< second compression mode >>
Next, as the second compression mode, a compression method described in detail below can be executed. This compression mode is suitable for compression of color images in which characters and non-characters (for example, photographic images) are mixed. Therefore, this compression mode can be automatically selected by judging the color distribution of the color image. Alternatively, the user may select manually.
[0074]
Hereinafter, a configuration or a method for implementing the second compression mode will be described.
[0075]
First, an outline of the steps performed by the mode will be described. First, a luminance histogram is generated for the entire image to be encoded, binarized, and several character areas are extracted. Next, character cut processing is performed for each character area, and it is determined from the result whether the area should be treated as a character area again. As a result, if it is not an area to be handled as a character area, it is determined whether or not the object in the area is a single color. If it is a single color, it is a target for MMR compression, and if it is not a single color, it is a target for JPEG compression.
[0076]
On the other hand, if it is determined that the image is to be handled as a character area, the colors constituting the area are reduced by a predetermined color reduction process. As a result of this color reduction processing, when one color is obtained, a palette indicating that color (for example, (R, G, B) = (20, 30, 40)) and a binary image are associated with each other to perform MMR compression. set to target. As a result of the color reduction processing, when it can be expressed by a predetermined number of colors (for example, 4 colors) or less, for each character cut, a pallet indicating each color and a multi-value image indicating the pixel position of each color are associated with the ZIP. Target of compression. If it cannot be represented by a predetermined number of colors, the original image before the color reduction process is set as a target for JPEG compression processing.
[0077]
FIG. 10 is a block diagram for explaining the processing for carrying out the image compression method in the second compression mode and the intermediate image. In FIG. 10, reference numeral 1101 denotes an original image. Reference numeral 1102 denotes an image binarization unit that inputs an original image and performs optimum binarization of the image. Reference numeral 1103 denotes an entire binarized image binarized by the image binarizing unit. Reference numeral 1104 denotes a character area detection unit that inputs the entire binarized image 1103 and detects a character area to create character area coordinates 1112.
[0078]
1108 inputs character area coordinates 1112, calculates the original image color of the black portion of the binary image while referring to the original image and the binary image within the coordinates, creates a plurality of palettes 1114, and accordingly, It is a character color extraction unit that performs color reduction processing.
[0079]
Reference numeral 1105 denotes a region detected as a character by the character region detection unit 1104 and a black region of the binary image 1103 of the region where the character color is less than M by the character color extraction unit 1108 is extracted from the original image. This is a character portion fill portion that fills the surrounding color and creates an image A.
[0080]
Reference numeral 1106 denotes a reduction unit that inputs an image A and reduces it to create an image B. Reference numeral 1107 denotes a JPEG compression unit that inputs an image B and compresses it to create a compression code X (113).
[0081]
Reference numeral 1109 denotes a color-reduced image of a plurality of character areas reduced by the character color extraction unit 1108. Reference numeral 1110 denotes an MMR compression unit that inputs a reduced color image and performs MMR compression to generate a plurality of compressed codes Y (1115) when the reduced color image 1109 is 1 bit. Reference numeral 1111 denotes a ZIP compression unit that inputs a reduced color image and performs ZIP compression to create a plurality of compressed codes Z (1116) when the reduced color image 1109 is 2 bits or more. Finally, the data from 1112 to 1116 summarized in 1A are combined to become compressed data.
[0082]
<Character area detection processing>
FIG. 11 is a flowchart for explaining the character area detecting process in the character area detecting unit 1104. First, a color image is input, and luminance conversion is performed while reducing the resolution by thinning out, thereby creating a luminance image J (step S1301). For example, if the original image is RGB 24-bit 300 dpi, the vertical direction and the horizontal direction are every 4 pixels,
Y = 0.299R + 0.587G + 0.114B
When a new image J is created by performing the above calculation, the image J becomes a Y8-bit 75 dpi image. Next, a histogram of luminance data is taken and a binarization threshold T is calculated (step S1302).
[0083]
Next, the luminance image J is binarized by the threshold value T to create a binary image K (step S1303). Further, the black pixel outline is traced, and all black areas are labeled (step S1304). Next, a character-like area in the black area is determined (step S1305). Then, the objects to be combined from the shape and position are combined (step S1306).
[0084]
<Character color extraction processing for character area>
FIG. 12 is a flowchart for explaining the character color extraction processing in the character color extraction unit 1108. Here, the entire binarized image 1103 is used as the binary image. However, the present invention is not limited to this. For example, only the coordinates of the character area and the color image are input, and the result of binarizing the color image again is obtained. The representative color calculation process may be performed by using it.
[0085]
The process shown in the flowchart of FIG. 12 is performed as described below for all areas determined to be characters by the character area detection unit 1104.
[0086]
(Step S3001: Re-binarization process)
First, re-binarization is determined in step S3001. The entire binarized image 1103 is not necessarily a binarized image of all character areas. Even if the binary image is too dark or too thin, the resulting image quality is adversely affected. Therefore, ideally, it is desirable to perform optimum binarization for each character area.
[0087]
Specifically, the character area detection unit 1104 scans a binary image of an area determined as a character, and performs pattern matching with an isolated point filter. Then, it is determined whether or not an isolated point is present in the area over the threshold. If the isolated point is over the threshold, a luminance histogram of the area is taken, an optimum threshold is calculated, and re-binarization is performed. In the case of a normal character region, a better binary image can be obtained by partially passing through a luminance histogram, but in rare cases, the result is worse than before (ie, binary values that are darker than before after re-binarization). There will be cases).
[0088]
Therefore, in order to prevent such a phenomenon, in the re-binarization, the binarization threshold value used when obtaining the entire binarized image is input, and compared with the threshold value for the re-binarization, compared with the previous one. If a dark result can be obtained, exception processing such as re-binarization is not provided.
[0089]
(Step S3002: Character cutting process)
In step S3002, character cut information is created. In the character-only processing, the processing contents vary depending on whether the character area is horizontal writing or vertical writing. This horizontal writing or vertical writing information is determined by the character area detection unit 1104 based on the arrangement of black clusters. As a result, in the case of horizontal writing, projection of black pixels of the binary image is first taken in the main scanning direction. Then, after detecting line breaks, projection of black pixels is taken in the sub-scanning direction for each line to obtain information for each character. On the other hand, in the case of vertical writing, line segmentation is performed in the sub-scanning direction and character segmentation is performed in the main scanning direction. At this time, in order to withstand a slight inclination of the image, it is preferable to divide into three in the row direction in order to take a projection of the row cutout. By this processing, coordinate information of each line and character coordinate information existing in each line can be obtained.
[0090]
On the other hand, in the character determination process (step S3003 described later), the character limit information is used to determine whether each of the black objects in the area determined as a character by the character area detection unit 1104 is further a character. . Specifically, it is determined whether the character is a character based on the size and shape of the character. For example, in view of image quality and compression, there is no need to stick to “character” in order to convert to a single color or multiple colors. As an example, a mark or the like expressed in a single color is better in image quality compression rate if expressed in a single color MMR than expressed in JPEG. However, as a problem of probability, since regions other than characters are often expressed in gradation, it is important to determine whether or not they are characters.
[0091]
(Step S3003: Character determination process)
Next, character determination is performed in step S3003. Here, information on character cutting (step S3002) is input, and the average character size of the line is calculated for each line. At this time, if the information of extremely small characters is ignored, a better result is obtained. A character rectangle that is extremely larger than the average size is determined not to be a character. Furthermore, regardless of the average, it is determined that the character is not a character when the shape is clearly not a character from the aspect ratio information.
[0092]
As a result of the determination, if m characters exist in the area, and if it is determined that all m characters are not characters, the character area detection unit 1104 outputs a result that this area is an image.
[0093]
However, when n characters (m> n, n> = 0) of m characters are not characters, that is, when a rectangle that is a character remains, the black object determined not to be a character is deleted from the binary image. The result that this area is a character is output.
[0094]
Further, in consideration of the final image quality, the present embodiment adds the following exception processing. For example, when there are 10 characters in the area, 5 characters that are skipped are monochromatic as characters, and JPEG compression is performed assuming that the remaining characters are not characters. Become. Therefore, in this character determination process, in the case where the determination of characters and images is frequently switched, it is arranged so that all rectangle characters are aligned or all rectangle images are aligned based on the arrangement and frequency of rectangles determined to be characters. To do.
[0095]
In the above-described character determination process, the process proceeds to step S3004 for an area determined as a character, and the process proceeds to step S3005 for an area determined not to be a character.
[0096]
(Step S3005: monochrome determination processing)
In step S3005, monochrome determination is performed. An area that passes through this process is an area that is determined not to be a character by character determination although it is determined to be a character by the character area detection unit 1104. As described above, regardless of whether it is a character or not, if the region is expressed in a single color, it is better to use a single color and perform MMR in terms of image quality compression rate. Therefore, it is determined whether or not this area is a single color.
[0097]
As a specific example, a histogram of each RGB level of a color image pixel corresponding to a black portion of a binary image is taken, and if the variance values of all the histograms are less than or equal to a threshold value, this region is determined to be a single color. As a result, if it is a single color, the process proceeds to one color extraction processing in step S3006, and if it is a plurality of colors, DOJPEG is returned.
[0098]
(Step S3006: one color extraction process)
One color extraction processing in step S3006 will be described with reference to the flowchart of FIG. That is, FIG. 13 is a flowchart for explaining the one-color extraction process in the second compression mode. First, thinning processing of a binary image referred to by the character coordinates is performed, black pixels corresponding to a change portion from the background to the character portion at the time of reading the scanner are reduced, and a new binary image newbi is created (step S1201).
[0099]
Next, a histogram of the RGB values of the original image corresponding to newbi black pixels is taken (step S1202). Of course, this processing may be performed in another color space such as YUV. Then, representative values for each of RGB are calculated (step S1203). This representative value is, for example, the largest value. Alternatively, the representative value may be obtained by reducing the number of steps in the histogram and obtaining the largest value in the rough histogram and then obtaining the largest value in the fine histogram existing in the histogram.
[0100]
By taking the latter method, a true representative value 1401 can be obtained from the histogram as shown in FIG. 14 without being confused by the noise 1402. FIG. 14 is a diagram for explaining a representative value calculation method in the one-color extraction process. As a fine histogram, for example, a 256-stage histogram as shown in FIG. 14 is obtained from 8-bit R data. In this case, the maximum value is 1402, which is not a true representative value. Therefore, the histogram is divided into 64 overlapping widths, and the 8-level histogram is recalculated from the 256-level histogram. This is shown from A to H. A and H are only 32 widths. This recalculation indicates that the representative value exists in G, and the maximum value in G can be searched to obtain 1401. By repeating the above processing for all character coordinates, one representative color is calculated for each character coordinate.
[0101]
(Step S3004: Color reduction processing)
In step S3004, a color reduction process is performed on the character. In the color reduction processing unit 1082, even when the original document is expressed in a single color with respect to the color of the character portion, there is a color transition portion from the background to the character portion at the time of scanning with the scanner.
[0102]
FIG. 15 is a diagram for explaining a transition part (gradation) of a character part generated by a scanner. In FIG. 15, for simplicity, only R of RGB is described, and GB is omitted. The letter A was originally composed of R = 32 level monochrome, but when read by the scanner, the data varies as shown by the enlarged pixels. In FIG. 15, there are only three pixels 3201, 3202, and 3203 that have reached black near the original level R = 32, and the other pixels are between the background color (for example, white) and R = 32 As a result, the character is expressed by gradation with a transition portion.
[0103]
FIG. 16 is a diagram showing a transition portion (gradation) of the character portion generated by the scanner as a three-dimensional histogram. In FIG. 16, it is assumed that the background color is white indicated by 3501 and the character color is black indicated by 3502. A transition portion at this time is indicated by 3503. Here, there is no need to strictly represent a transition portion that is a variation due to reading of a character portion that was originally expressed in a single color. In other words, if only the representative color can be expressed, the image quality is good and the data amount is small. However, even if the binary image is thinned, it is difficult to completely remove the color of the transition portion of the character portion from this background.
[0104]
Therefore, by utilizing the fact that one character is often expressed in a single color, the character cut information is used to limit the image to one color and aim to improve the image quality and compression rate. However, when it is desired to compress characters and the like expressed in gradation from the beginning with higher image quality, exception processing such as determination of whether or not the characters are expressed in multiple colors may be added. That is, if the character cut information is used to make each character one color, it is possible to remove a transition portion that occurs as a variation due to reading of a character image originally expressed in a single color.
[0105]
<Character part filling part 1105>
An example of processing performed by the character portion filling unit 1105 will be described with reference to FIGS. 17 and 18. FIG. 17 is a diagram for explaining the outline of the character filling process. FIG. 18 is a flowchart for explaining the flow of the character portion filling process.
[0106]
As shown in FIG. 17A, a gradation image is used as a background, and as an example, an image in which a blue character ABC is drawn near the center is used as an original image. Assume that a binary image of one character area as shown in FIG. 17B is obtained from this original image. As the character portion filling process, first, in step S11010, the entire image is divided into, for example, 32 × 32 regions (hereinafter, parts), and the process is performed for each part. FIG. 17C shows a state where the parts are divided. This figure shows a state of being divided into 4 × 5 parts for simple explanation. The numbers on the upper left of each area in FIG. The number of area divisions is not limited to this, and may be other division numbers.
[0107]
In step S11020, it is determined whether there is an unprocessed part. For an unprocessed part, the process proceeds to step S11030, and it is determined whether a character fill target area exists in the part. It should be noted that even if the area is determined to be a character area by the character area detection unit 1104, the area for which DOJPEG is returned by the character color extraction unit 1108 is not a target area to be painted.
[0108]
As shown in FIG. 17C, the parts 00 to 04, 10, 14, 20, 24, and 30 to 35 are determined to have no character filling target area in step S 11030, and the next part is not processed. Proceed to For a part (for example, part 11) in which a character filling target area exists, the process proceeds to step S11040, the corresponding binary image is referred to, and the RGB value (or YUV, etc.) of the color image corresponding to the white portion of the binary image is referred to. Average value ave_color may be calculated. In step S11050, the corresponding binary image is referred to, and the density data of the pixel corresponding to the black pixel is set as ave_color. The above processing is repeated for the parts where the character filling target area exists (here, parts 12, 13, 21, 22, 23). In this way, the average value of surrounding pixels can be filled in the portion where the character exists.
[0109]
The filled image obtained in this way is reduced in the reduction unit 1106. In this embodiment, simple thinning processing is performed as an example. Note that the order of the reduction process and the character part filling process may be reversed. In that case, it is necessary to pay attention to the displacement between the binary image and the color image.
[0110]
Furthermore, if necessary, a format in which five character region coordinates 1112, a palette 1114, a compression code X (1113), a compression code Y (1115), and a compression code Z (1116) are collected is created.
[0111]
As an example of a format that combines the five, Adobe (registered trademark) PDF or the like can be considered. Adobe's PDF is a format that can be displayed by Adobe Reader (registered trademark), which is distributed free of charge by Adobe, and since there is no application that created the document, troubles such as the inability to open the file on the receiver side are avoided. be able to. Other formats include XML. XML is a description language for exchanging and distributing documents and data via a network.
[0112]
(Modification)
In the second compression mode, the binary image is created with the entire single threshold value. However, the present invention is not limited to this. For example, an optimal threshold value is calculated for each character area detected by the character area detection 104 to 2 A value image may be created. In that case, the re-binarization determination in step S3001 in the flowchart of FIG. 12 is not necessary.
[0113]
Further, the same binary image is used in the character portion filling unit 1105 and the character color extracting unit 1108, but the present invention is not limited to this, and the optimum binarization unit is selected as the character portion filling unit 1105, the character color extracting unit, respectively. It may be owned inside 1108.
[0114]
<< Other Embodiments >>
Note that the present invention can be applied to a system composed of a plurality of devices (for example, a host computer, an interface device, a reader, a printer, etc.), but a device (for example, a copier, a facsimile machine, etc.) composed of a single device. You may apply to.
[0115]
Also, an object of the present invention is to supply a recording medium (or storage medium) in which a program code of software that realizes the functions of the above-described embodiments is recorded to a system or apparatus, and a computer (or CPU or CPU) of the system or apparatus. Needless to say, this can also be achieved when the MPU) reads and executes the program code stored in the recording medium. In this case, the program code itself read from the recording medium realizes the functions of the above-described embodiment, and the recording medium on which the program code is recorded constitutes the present invention. Further, by executing the program code read by the computer, not only the functions of the above-described embodiments are realized, but also an operating system (OS) running on the computer based on the instruction of the program code. It goes without saying that a case where the function of the above-described embodiment is realized by performing part or all of the actual processing and the processing is included.
[0116]
Further, after the program code read from the recording medium is written into a memory provided in a function expansion card inserted into the computer or a function expansion unit connected to the computer, the function expansion is performed based on the instruction of the program code. It goes without saying that the CPU or the like provided in the card or the function expansion unit performs part or all of the actual processing, and the functions of the above-described embodiments are realized by the processing.
[0117]
When the present invention is applied to the recording medium, program code corresponding to the flowchart described above is stored in the recording medium.
[0118]
【The invention's effect】
As described above, according to the present invention, a color document image can be suitably compressed with high compression efficiency. Further, the present invention is not limited to the above-described image of only a color document, and can support compression of an image in which character areas and non-character areas are mixed.
[Brief description of the drawings]
FIG. 1 is a block diagram for explaining a detailed configuration of a compression apparatus for compressing a color document image in a first compression mode of the present invention.
FIG. 2 is a flowchart for explaining the flow of color image compression processing in the first compression mode of the present invention;
FIG. 3 is a diagram illustrating an example of a sorting weighting factor in the color information sorting unit 105 in the first compression mode.
FIG. 4 is a diagram for explaining a configuration of compressed data 112 in a first compression mode.
5 is a flowchart for explaining in detail an operation procedure of an intermediate color reduction unit 107 shown in step S204 in the compression processing of FIG. 2;
6 is a flowchart for explaining details of processing in steps S503 to S505 in FIG. 5;
FIG. 7 is a schematic diagram for explaining data constituting a color document image to be compressed in the present embodiment.
FIG. 8 is a schematic diagram for explaining a foreground color image, an intermediate color image, and a complementary intermediate color image.
FIG. 9 is a schematic diagram for explaining the principle of complement processing in the same embodiment;
FIG. 10 is a block diagram for explaining processing and an intermediate image for carrying out an image compression method in a second compression mode.
FIG. 11 is a flowchart for explaining character region detection processing in a character region detection unit 1104;
FIG. 12 is a flowchart for explaining a character color extraction process in a character color extraction unit 1108;
FIG. 13 is a flowchart for explaining one-color extraction processing in a second compression mode.
FIG. 14 is a diagram for explaining a representative value calculation method in one-color extraction processing;
FIG. 15 is a diagram for explaining a transition part (gradation) of a character part generated by a scanner.
FIG. 16 is a diagram showing a transition portion (gradation) of a character portion generated by a scanner as a three-dimensional histogram.
FIG. 17 is a diagram for explaining an outline of character filling processing;
FIG. 18 is a flowchart for explaining a character filling process;
[Explanation of symbols]
101 Original image
102 Color reduction processing unit
103 Color information
104 Index color information
105 Color information sorting section
106 Same color integration unit
107 Intermediate color reduction unit
108 Background color data
109 Binary image creation compression unit
110 Binary compressed image data
111 Data combiner
112 Compressed data
113 Compression order determination unit

Claims (18)

カラー画像を圧縮する画像圧縮方法であって、
前記カラー画像の各画素をカラー値に対応して付与されるインデックスに変換し、インデックス化された色ごとの画素数及び色に関するデータを含むカラー情報と、前記各画素をインデックスに変換したインデックス画像とを生成するインデックス変換工程と、
前記インデックス画像における特定インデックスに対応するカラー値を前記カラー画像の背景色とする背景色決定工程と、
前記カラー情報及び前記背景色に基づいて、前記カラー画像をインデックスごとに圧縮する際の圧縮順位を決定する圧縮順位決定工程と、
前記インデックス画像からそれぞれのインデックスごとに2値画像を生成する2値画像生成工程と、
前記圧縮順位に従って、前記2値画像を圧縮する圧縮工程と、
前記カラー画像の大きさと前記背景色のカラー値とを含む背景データ及び前記インデックスごとの前記2値画像の圧縮データを統合して圧縮画像データを生成する生成工程と
を有することを特徴とする画像圧縮方法。
An image compression method for compressing a color image,
An index image in which each pixel of the color image is converted into an index assigned corresponding to a color value, and includes color information including data regarding the number of pixels for each indexed color and the color, and each pixel is converted into an index. An index conversion process for generating
A background color determination step in which a color value corresponding to a specific index in the index image is used as a background color of the color image;
A compression order determination step for determining a compression order when compressing the color image for each index based on the color information and the background color;
A binary image generation step of generating a binary image for each index from the index image;
A compression step of compressing the binary image according to the compression order;
And a generation step of generating compressed image data by integrating background data including the size of the color image and the color value of the background color and compressed data of the binary image for each index. Compression method.
前記背景色決定工程は、前記最大画素数のインデックスに対応するカラー値を前記カラー画像の背景色とし、
前記圧縮順位決定工程、2値画像生成工程及び圧縮工程は、該インデックスについての圧縮順位の決定、2値画像の生成及び圧縮を実行しない
ことを特徴とする請求項1に記載の画像圧縮方法。
In the background color determination step, a color value corresponding to the index of the maximum number of pixels is set as a background color of the color image,
The image compression method according to claim 1, wherein the compression order determination step, the binary image generation step, and the compression step do not execute determination of a compression order for the index and generation and compression of a binary image.
前記インデックス変換工程は、特定範囲のカラー値に一のインデックスを対応させ、前記カラー画像のビット数を減少させたインデックス画像を生成することを特徴とする請求項1又は2に記載の画像圧縮方法。  3. The image compression method according to claim 1, wherein the index conversion step generates an index image in which one index corresponds to a color value in a specific range and the number of bits of the color image is reduced. . 前記インデックス変換工程は、前記カラー情報として、さらに、前記カラー画像のインデックス化された色ごとの色重心及び色分布範囲を計数することを特徴とする請求項1から3までのいずれか1項に記載の画像圧縮方法。  The index conversion step further includes, as the color information, counting a color centroid and a color distribution range for each indexed color of the color image. The image compression method as described. 前記カラー情報において、前記色重心が近いカラー情報同士を統合する同色統合工程をさらに有することを特徴とする請求項記載の画像圧縮方法。5. The image compression method according to claim 4 , further comprising the same color integration step of integrating color information having the color centroids close to each other in the color information. 前記カラー情報において、互いに輝度色差が近いカラー情報同士を結合して中間色を削減する中間色削減工程をさらに有することを特徴とする請求項1から5までのいずれか1項に記載の画像圧縮方法。  6. The image compression method according to claim 1, further comprising an intermediate color reduction step of combining the color information having luminance color differences close to each other to reduce intermediate colors in the color information. 前記同色統合工程は、前記カラー画像におけるそれぞれの色ごとの画素数と色空間上の位置に応じて予め決められた係数の積をとった値によってソーティングを行い、ソーティング順位を基準にして同色判定を行うことを特徴とする請求項5記載の画像圧縮方法。  In the same color integration step, sorting is performed using a value obtained by multiplying a predetermined coefficient according to the number of pixels for each color in the color image and the position in the color space, and the same color determination is performed based on the sorting order 6. The image compression method according to claim 5, wherein: 前記同色統合工程は、同色をソーティング上位の色に統合する場合、計数された画素数、色分布範囲及びカラー値の重心を再計算することを特徴とする請求項5又は7に記載の画像圧縮方法。  8. The image compression according to claim 5, wherein the same color integration step recalculates the counted number of pixels, the color distribution range, and the centroid of the color value when integrating the same color into a sorting higher color. Method. 前記中間色削減工程は、ソーティング順位を基準にして中間色の削減を行うことを特徴とする請求項6記載の画像圧縮方法。  7. The image compression method according to claim 6, wherein in the intermediate color reduction step, intermediate colors are reduced based on a sorting order. 前記中間色削減工程は、同系色をソーティング上位の色に統合する場合、計数された画素数、色分布範囲を再計算し、色重心のみ再計算しないことを特徴とする請求項6又は9に記載の画像圧縮方法。  10. The method according to claim 6, wherein the intermediate color reduction step recalculates the counted number of pixels and the color distribution range when integrating similar colors into sorting upper colors, and does not recalculate only the color centroid. Image compression method. 前記背景色決定工程は、ソーティングの最上位に位置する色のカラー値の重心を前記背景色として抽出することを特徴とする請求項1から10までのいずれか1項に記載の画像圧縮方法。  11. The image compression method according to claim 1, wherein the background color determination step extracts a centroid of a color value of a color positioned at the top of sorting as the background color. 前記中間色削減工程が予め決められた複数の閾値を持ち、カラー値の重心を輝度色差信号に変換して閾値範囲の色をソーティング順位に従って統合削減を行うことを特徴とする請求項記載の画像圧縮方法。7. The image according to claim 6, wherein the intermediate color reduction step has a plurality of predetermined threshold values, converts the centroid of the color value into a luminance color difference signal, and performs integrated reduction of the colors in the threshold range according to the sorting order. Compression method. 前記カラー値の重心について、輝度色差信号に変換した値を仮のカラー重心として統合削減を行うたびに再計算することを特徴とする請求項12記載の画像圧縮方法。  13. The image compression method according to claim 12, wherein the centroid of the color value is recalculated every time integration reduction is performed using a value converted into a luminance color difference signal as a temporary color centroid. 前記複数の閾値は、圧縮率優先か画像品位優先かによって値を変更することを特徴とする請求項12載の画像圧縮方法。The plurality of threshold values, the image compression method of claim 12 Symbol mounting and changing the value depending compressibility priority or image quality priority. 前記圧縮工程は、前記2値画像をMMR圧縮することを特徴とする請求項1から14までのいずれか1項に記載の画像圧縮方法。  The image compression method according to any one of claims 1 to 14, wherein in the compression step, the binary image is subjected to MMR compression. 圧縮順位の決定は、前記背景色抽出工程で抽出された色との色空間上の距離を基準にすることを特徴とする請求項1から15までのいずれか1項に記載の画像圧縮方法。  16. The image compression method according to claim 1, wherein the determination of the compression order is based on a distance in a color space from the color extracted in the background color extraction step. 前記画像圧縮方法は、複数の画像圧縮モードによる画像圧縮を実行可能とし、
第1の圧縮モードにおいては、符号化対象のカラー画像に対して、前記インデックス変換工程と、前記背景色決定工程と、前記圧縮順位決定工程と、前記2値画像生成工程と、前記圧縮工程と、前記生成工程とを実行し、
第2の圧縮モードにおいては、符号化対象のカラー画像に対して、
前記カラー画像の文字領域と非文字領域とを識別する領域識別工程と、
前記文字領域の画像を2値画像用アルゴリズムで圧縮する第2圧縮工程と、
前記非文字領域の画像を多値画像用アルゴリズムで圧縮する第3圧縮工程とを実行する
ことを特徴とする請求項1に記載の画像圧縮方法。
The image compression method enables execution of image compression in a plurality of image compression modes;
In the first compression mode, for the color image to be encoded, the index conversion step, the background color determination step, the compression order determination step, the binary image generation step, the compression step, Performing the generating step,
In the second compression mode, for a color image to be encoded,
An area identifying step for identifying a character area and a non-character area of the color image;
A second compression step of compressing the image of the character region with a binary image algorithm;
The image compression method according to claim 1, further comprising: performing a third compression step of compressing the image of the non-character region using a multi-value image algorithm.
カラー画像を圧縮する画像圧縮装置であって、
前記カラー画像の各画素をカラー値に対応して付与されるインデックスに変換し、インデックス化された色ごとの画素数及び色に関するデータを含むカラー情報と、前記各画素をインデックスに変換したインデックス画像とを生成するインデックス変換手段と、
前記インデックス画像における特定インデックスに対応するカラー値を前記カラー画像の背景色とする背景色決定手段と、
前記カラー情報及び前記背景色に基づいて、前記カラー画像をインデックスごとに圧縮する際の圧縮順位を決定する圧縮順位決定手段と、
前記インデックス画像からそれぞれのインデックスごとに2値画像を生成する2値画像生成手段と、
前記圧縮順位に従って、前記2値画像を圧縮する圧縮手段と、
前記カラー画像の大きさと前記背景色のカラー値とを含む背景データ及び前記インデックスごとの前記2値画像の圧縮データを統合して圧縮画像データを生成する生成手段と
を備えることを特徴とする画像圧縮装置。
An image compression apparatus for compressing a color image,
An index image in which each pixel of the color image is converted into an index assigned corresponding to a color value, and includes color information including data regarding the number of pixels for each indexed color and the color, and each pixel is converted into an index. Index conversion means for generating
A background color determining means that uses a color value corresponding to a specific index in the index image as a background color of the color image;
Compression order determining means for determining a compression order when compressing the color image for each index based on the color information and the background color;
Binary image generation means for generating a binary image for each index from the index image;
Compression means for compressing the binary image according to the compression order;
Image data comprising: generating means for generating compressed image data by integrating background data including a size of the color image and a color value of the background color and compressed data of the binary image for each index Compression device.
JP2003061865A 2002-04-17 2003-03-07 Image compression method and image compression apparatus Expired - Fee Related JP4035456B2 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2003061865A JP4035456B2 (en) 2002-11-27 2003-03-07 Image compression method and image compression apparatus
EP03252432.4A EP1355484B1 (en) 2002-04-17 2003-04-16 Image compression method and apparatus, and image coding method and apparatus
US10/417,102 US7158669B2 (en) 2002-04-17 2003-04-17 Image compression method and apparatus, and image coding method and apparatus
CN03122140.8A CN1253010C (en) 2002-04-17 2003-04-17 Picture compression method and device, and picture coding device and method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2002344574 2002-11-27
JP2003061865A JP4035456B2 (en) 2002-11-27 2003-03-07 Image compression method and image compression apparatus

Publications (3)

Publication Number Publication Date
JP2004229261A JP2004229261A (en) 2004-08-12
JP2004229261A5 JP2004229261A5 (en) 2006-04-20
JP4035456B2 true JP4035456B2 (en) 2008-01-23

Family

ID=32910899

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003061865A Expired - Fee Related JP4035456B2 (en) 2002-04-17 2003-03-07 Image compression method and image compression apparatus

Country Status (1)

Country Link
JP (1) JP4035456B2 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4609155B2 (en) * 2005-03-30 2011-01-12 セイコーエプソン株式会社 Image compression method, image compression apparatus, image compression program, and image reading apparatus
JP4948442B2 (en) 2008-02-06 2012-06-06 株式会社Pfu Image processing apparatus, image processing method, and image processing program
JP4528846B2 (en) 2008-04-21 2010-08-25 シャープ株式会社 Image compression method, image compression apparatus, image processing apparatus, image forming apparatus, computer program, and recording medium
JP4538514B2 (en) * 2008-07-30 2010-09-08 シャープ株式会社 Image compression method, image compression apparatus, image forming apparatus, computer program, and recording medium
JP5595151B2 (en) * 2010-07-13 2014-09-24 キヤノン株式会社 Image processing apparatus, compression method in image processing apparatus, and program
JP5742231B2 (en) * 2011-01-17 2015-07-01 富士通株式会社 Image processing program, image processing method, and image processing apparatus
CN105900413A (en) 2014-01-14 2016-08-24 富士通株式会社 Image processing program, display program, image processing method, display method, image processing device, and information processing device
WO2018174591A1 (en) * 2017-03-22 2018-09-27 김기백 Image encoding/decoding method using pixel value range constituting image
CN110113617B (en) * 2019-06-13 2022-09-20 腾讯科技(深圳)有限公司 Image compression and decompression method and device, electronic equipment and storage medium
CN112070656B (en) * 2020-08-10 2023-08-25 上海明略人工智能(集团)有限公司 Frame data modification method and device
CN115834504A (en) * 2022-11-04 2023-03-21 电子科技大学 AXI bus-based data compression/decompression method and device
CN117014557B (en) * 2023-10-07 2024-01-23 福昕鲲鹏(北京)信息科技有限公司 Compression method and device for document image, electronic equipment and storage medium

Also Published As

Publication number Publication date
JP2004229261A (en) 2004-08-12

Similar Documents

Publication Publication Date Title
EP1355484B1 (en) Image compression method and apparatus, and image coding method and apparatus
US7221790B2 (en) Processing for accurate reproduction of symbols and other high-frequency areas in a color image
JP4295882B2 (en) Method for classifying digital image data and method for classifying and classifying data blocks
US7783117B2 (en) Systems and methods for generating background and foreground images for document compression
US5696842A (en) Image processing system for adaptive coding of color document images
JP4242532B2 (en) Digital image data classification method
US7133565B2 (en) Image processing apparatus and method
US8125679B2 (en) Image processing method and image processing apparatus
US8503036B2 (en) System and method of improving image quality in digital image scanning and printing by reducing noise in output image data
US8395813B2 (en) Subtractive color method, subtractive color processing apparatus, image forming apparatus, and computer-readable storage medium for computer program
JP2004529404A (en) Method and apparatus for analyzing images
US20070286507A1 (en) Image processing apparatus, image processing method, and image processing program
US20040165782A1 (en) Image processing apparatus
US20090284801A1 (en) Image processing apparatus and image processing method
US10523843B2 (en) Image processing apparatus, image processing method, and non-transitory computer-readable storage medium
JP6743092B2 (en) Image processing apparatus, image processing control method, and program
JP4035456B2 (en) Image compression method and image compression apparatus
JP3715905B2 (en) Image processing apparatus, image processing method, program, and storage medium
US7190837B2 (en) Compression of mixed raster content (MRC) image data
US7308136B2 (en) Weak edge repositioning in a MRC segmentor
JP3899872B2 (en) Image processing apparatus, image processing method, image processing program, and computer-readable recording medium recording the same
JP4695914B2 (en) Image processing apparatus and image processing method
US7456982B2 (en) Segmentation method and system for multiple raster content (MRC) representation of documents
JP2000295469A (en) Image forming device
RU2737001C1 (en) Image processing device and method and data medium

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060307

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060307

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070824

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070912

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20071029

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

Free format text: PAYMENT UNTIL: 20101102

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20101102

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20111102

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20121102

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20131102

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees