JP2570249B2 - Color image compression / decompression method - Google Patents

Color image compression / decompression method

Info

Publication number
JP2570249B2
JP2570249B2 JP5082755A JP8275593A JP2570249B2 JP 2570249 B2 JP2570249 B2 JP 2570249B2 JP 5082755 A JP5082755 A JP 5082755A JP 8275593 A JP8275593 A JP 8275593A JP 2570249 B2 JP2570249 B2 JP 2570249B2
Authority
JP
Japan
Prior art keywords
color
limited
image
pixel
data
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
JP5082755A
Other languages
Japanese (ja)
Other versions
JPH06274609A (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.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP5082755A priority Critical patent/JP2570249B2/en
Publication of JPH06274609A publication Critical patent/JPH06274609A/en
Application granted granted Critical
Publication of JP2570249B2 publication Critical patent/JP2570249B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Image Processing (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、ディジタル化されたカ
ラー画像より得られる限定色を利用し、カラー画像を小
容量のデータに圧縮し、伸長する方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for compressing and expanding a color image into a small amount of data by using limited colors obtained from a digitized color image.

【0002】[0002]

【発明が解決しようとする課題】従来、画像の圧縮・伸
長に関しては多くの手法が提案されてきている。その中
でも限定色表示という方法は、もとの画像の色分布の統
計処理により代表色を選択して画像を記述し表現するも
ので、よく使われる方法である。たとえば、カラー画像
を1670万色から256色の代表色を限定色として選
択するような場合には、画像の1点を表現するのに必要
なビット数が24ビットから8ビットに削減され、画像
の記憶に必要な容量は1/3になって結果としてカラー
画像の圧縮となる。この限定色表示法における色分布の
統計処理としては、いくつかの方法が提案されている
が、メディアン・カット・アルゴリズムが基本でありよ
く使用される。
Conventionally, many techniques have been proposed for compressing and expanding images. Among them, the limited color display method is a method that is used to describe and express an image by selecting a representative color through statistical processing of the color distribution of the original image, and is a commonly used method. For example, when a representative color of a color image from 16.7 million colors to 256 colors is selected as a limited color, the number of bits required to represent one point of the image is reduced from 24 bits to 8 bits. Is reduced to one third, resulting in compression of a color image. The statistical processing of the color distribution in the limited color display method, several methods have been proposed, media down-cut algorithm is often used a basic.

【0003】メディアン・カット・アルゴリズムは文献
(“Color image quantizatio
n for frame buffer displa
y”−Graphics,16,3,pp.297−3
07,1982)に述べられているように、赤R、緑
G、青Bの3次元の色空間に対応する色立方体を、3色
の色軸それぞれについて5ビット(32個)に量子化
し、32×32×32=32768色の立方体に分け、
対象画像の各画素値が各立体に入る頻度(3次元ヒスト
グラムとなる)を作成する。ここで、色立方体を1つの
箱とみなし、箱の1番長い方向に沿って1次元のヒスト
グラムを作成して、両側で頻度が半分づつになる分割面
(メディアン)を求めて2つの箱に分割する。
[0003] The median cut algorithm is described in the literature ("Color image quantizatio").
n for frame buffer displa
y "-Graphics, 16, 3, pp. 297-3
07, 1982), a color cube corresponding to a three-dimensional color space of red R, green G, and blue B is quantized to 5 bits (32) for each of three color axes, 32 × 32 × 32 = 32768 color cubes,
A frequency (a three-dimensional histogram) in which each pixel value of the target image enters each solid is created. Here, the color cube is regarded as one box, a one-dimensional histogram is created along the longest direction of the box, and a dividing plane (median) in which the frequency is halved on both sides is obtained, and the two boxes are obtained. To divide.

【0004】この分割処理を箱が目的の数になるまで繰
り返していき、各箱の中の色を平均してN個の代表色と
し、32768色について最も距離値の小さい色の代表
色を割り当てる。各画素を32768色のいずれかに変
換し、得られた代表色の番号iで各画素を表現して、代
表色番号iのアドレスに代表色(Ri、Gi、Bi)を
持つカラーマップを生成する。また各画素の番号でカラ
ーマップを読みだし、カラーマップの代表色で表示する
ことによって画像を再生するものである。
This division process is repeated until the number of boxes reaches the target number, and the colors in each box are averaged to N representative colors, and a representative color having the smallest distance value is assigned to 32768 colors. . Each pixel is converted into any of 32768 colors, each pixel is represented by the obtained representative color number i, and a color map having a representative color (Ri, Gi, Bi) at the address of the representative color number i is generated. I do. In addition, an image is reproduced by reading a color map with the number of each pixel and displaying the color map with a representative color of the color map.

【0005】近来この方法についての改良案も各種提案
されており、一例として特開平2−146685号、限
定色画像生成方法が参照できる。
[0005] Various improvement proposals for this method have recently been proposed, and for example, Japanese Patent Application Laid-Open No. 2-146885 and a limited color image generation method can be referred to.

【0006】図4は従来の限定色画像生成方法が適用さ
れるシステム構成を示すブロック図であり、限定色画像
生成処理を行う画像処理装置50、画像データ等を記憶
するメモリ51、画像データ源52、画像表示用の表示
装置53と入力装置54を含んでいる。画像データ源5
2はビデオ・カメラ、VTR、その他の画像信号を発生
するもので、この画像信号はディジタル画像データに変
換されて画像処理装置50に与えられる。画像処理装置
50では限定色圧縮が行われるが、人膚のようになだら
かに色が変化する部分は限定色表示によると疑似輪郭を
生じやすいという問題があるので、疑似輪郭の生じやす
い領域を強調領域に指定し、強調領域には限定色を優先
的にかつ可能な限り数多く割り当てるようにして、さら
にきめ細かな表示を行うように改良したものである。
FIG. 4 is a block diagram showing a system configuration to which a conventional limited color image generation method is applied. An image processing apparatus 50 for performing a limited color image generation process, a memory 51 for storing image data and the like, and an image data source 52, a display device 53 for displaying images and an input device 54 are included. Image data source 5
Reference numeral 2 denotes a video camera, a VTR, and other image signals which are converted into digital image data and supplied to the image processing device 50. In the image processing device 50, limited color compression is performed. However, there is a problem that pseudo contours are likely to occur in a portion where the color changes smoothly, such as human skin, according to the limited color display. An area is designated, and a limited color is preferentially assigned to the emphasized area as much as possible, so that a more detailed display is provided.

【0007】一方、従来の文字データ圧縮方法としてハ
フマン符号化があり、文字データに対するハフマン符号
化とは、各文字に対応する“葉”を作り、それぞれの
“ 葉”にはその文字の生起確率をつけておいて、生起
確率の最も小さい二つの“ 葉”に対し新しい“節点”
を一つ作り、その節点と2枚の“葉”を“枝”で結び、
この2本の“枝”の一方には“0”、他方には“1”の
ラベルを付ける。また、“節点”には“葉”の確率の和
を付け、この“節点”を新たな“葉”と考える。これら
を“葉”が一枚になるまで繰り返し、“根”から文字に
対応する“葉まで“枝”を辿って得られる“1”と
“0”の系列をその文字に対する符号語とするものであ
る。
On the other hand, there is Huffman coding as a conventional character data compression method. Huffman coding for character data creates "leaves" corresponding to each character, and each "leaf" has a probability of occurrence of the character. With a new “node” for the two “leaves” with the lowest probability of occurrence
, And connect that node with two "leaves" with "branches"
One of these two "branches" is labeled "0" and the other is labeled "1". The “node” is given the sum of the probabilities of “leaves”, and this “node” is considered as a new “leaf”. These are repeated until the number of "leaves" becomes one, and the sequence of "1" and "0" obtained by following the "branch" from the "root" to the "leaf" corresponding to the character is used as a code word for the character It is.

【0008】これらについて、図5〜図10に示す従来
のハフマン符号化での符号語生成例を参照して具体的に
説明する。図5〜図10に示す例は、A、B、C、D、
E、Fの6種類の各文字が、それぞれ1/3、1/6、
1/6、1/6、1/12、1/12の生起確率が発生
する場合のハフマン符号化の符号語生成例である。まず
AからFまでの文字に対応する“葉”A〜Fを作り、各
“葉”の生起確率(1/3〜1/12等)を書いておく
(図5)。この中で生起確率の最も小さい二つのは
“葉”は文字“E”と“F”の“葉”であり、それらの
“葉”より“節点”Gを作り各“枝”にラベル“1”と
“0”を与える。この、“節点”Gの生起確率は“葉”
の生起確率の和である1/6となる(図6)。
These will be specifically described with reference to examples of codeword generation in the conventional Huffman coding shown in FIGS. Examples shown in FIGS. 5 to 10 are A, B, C, D,
The six types of characters E and F are 1/3, 1/6,
It is a codeword generation example of Huffman coding when occurrence probabilities of 1/6, 1/6, 1/12, and 1/12 occur. First, "leaves" A to F corresponding to the characters from A to F are created, and the occurrence probabilities (1/3 to 1/12 etc.) of each "leaf" are written (FIG. 5). Among these, the “leaf” having the smallest occurrence probability is the “leaf” of the letters “E” and “F”, and a “node” G is formed from those “leaves”, and the label “1” is assigned to each “branch”. "And" 0 ". The occurrence probability of this “node” G is “leaf”
(1/6), which is the sum of the occurrence probabilities of FIG.

【0009】“節点”Gを“葉”と考え“葉”の集合
「A、B、C、D、G」の生起確率の最も小さい二つの
“葉”D、Gより“節点”Hを作り、各“枝”にラベル
“1”と“0”を与え、“葉”D、Gの生起確率の和か
ら“節点”Hの生起確率1/3を求める(図7)。同様
に、“節点”Hを“葉”と考えて、“葉”の集合「A、
B、C、H」中の生起確率の最も小さい二つの“葉”
B、Cから“節点”Iを作り、各“枝”にラベル“1”
と“0”を与え、これら“葉”B、Cの生起確率の和か
ら“節点”Iの生起確率1/3を求める(図8)。この
“節点”Iを“葉”と考え、“葉”の集合「A、I、
H」の生起確率の最も小さい二つの“葉”I、Hより
“節点”Jを作り、各“枝”にラベル“1”と“0”を
与え、“葉”I、Hの生起確率の和から“節点”Jの生
起確率2/3を求める(図9)。
Considering the "node" G as a "leaf", a "node" H is formed from the two "leaves" D and G having the smallest probability of occurrence of the set of "leaves""A, B, C, D and G". The labels "1" and "0" are given to each "branch", and the occurrence probability of "node" H is determined by the sum of the occurrence probabilities of "leaves" D and G (FIG. 7). Similarly, considering a “node” H as a “leaf”, a set “A,
Two "leaves" with the lowest probability of occurrence in "B, C, H"
A "node" I is created from B and C, and a label "1" is assigned to each "branch".
And “0”, and the occurrence probability of the “node” I is determined as 1/3 from the sum of the occurrence probabilities of the “leaves” B and C (FIG. 8). This “node” I is considered as a “leaf”, and a set of “leaves” “A, I,
A “node” J is created from the two “leaves” I and H with the smallest occurrence probability of “H”, and labels “1” and “0” are given to each “branch”, and the occurrence probability of “leaves” I and H is calculated. The occurrence probability 2/3 of the "node" J is obtained from the sum (FIG. 9).

【0010】この“節点”Jを“葉”とすると“葉”の
集合「A、J」には二つの“葉”しか残らない。“葉”
A、Jより“節点”Kを作り、各“枝”にラベル“1”
と“0”を与える。この“節点”Kは生起確率が1とな
る“根”である(図10)。結果としてハフマン符号化
による生成符号語は、“0”、“100”、“10
1”、“110”、“1110”、“1111”とな
る。従って、各要素を4ビットで示した場合、もともと
6×4=24ビット必要としていた場合に比較して18
ビットで足りるので、75%に圧縮できたことになる。
Assuming that this "node" J is a "leaf", only two "leaves" remain in the set of "leaves""A,J"."leaf"
Create "node" K from A and J, and label "1" on each "branch"
And “0”. The “node” K is a “root” having an occurrence probability of 1 (FIG. 10). As a result, the generated code words by Huffman coding are “0”, “100”, “10”.
1 "," 110 "," 1110 ", and" 1111 " Therefore, when each element is represented by 4 bits,
6 × 4 = 18 compared to when 24 bits were required
Since a bit is enough, it can be reduced to 75%.

【0011】さらに、画像データの圧縮方法として、隣
接画素との違いが少ないという性質を用いた予測圧縮と
いう手法がある。図11は従来の予測圧縮例の図であ
り、画素Xj、iに対し前ライン、現ラインで、全値予
測、1ライン予測、平均予測、平面予測などいくつかの
予測手法がある。それらの予測誤差値を、値の大きいと
ころは荒く量子化し、量子化レベルを減らすことで誤差
値を表現するのに必要な符号長を減らし、結果として圧
縮される。あるいは、予測誤差値の頻度をもとに多数回
出現する値は短い符号長で表現することで、結果として
圧縮される。
Further, as a method for compressing image data, there is a method called predictive compression using the property that there is little difference from adjacent pixels. FIG. 11 is a diagram of a conventional prediction compression example. There are several prediction methods such as full value prediction, one-line prediction, average prediction, and plane prediction for the previous line and the current line for the pixels Xj and i. Those prediction error values are roughly quantized at large values, and the quantization level is reduced to reduce the code length required to represent the error value, resulting in compression. Alternatively, a value that appears many times based on the frequency of the prediction error value is represented by a short code length, and is compressed as a result.

【0012】[0012]

【発明が解決しようとする課題】しかしながら、以上の
ような従来の限定色表示を使った画像圧縮方法では、画
質の低下が少ないかわりに24ビットが8ビットに削減
されるだけなので、削減率(圧縮率)が低いという問題
がある。
However, in the conventional image compression method using the limited color display as described above, the reduction in image quality is small, but only 24 bits are reduced to 8 bits. Compression ratio) is low.

【0013】本発明は上述の問題点に鑑みて、単純な処
理で限定色表示の圧縮率を向上させ画像保存に必要なフ
ァイル容量を削減できるカラー画像の圧縮・伸長方法を
提供することを目的としている。
SUMMARY OF THE INVENTION The present invention has been made in view of the above problems, and has as its object to provide a color image compression / decompression method which can improve the compression ratio of limited color display by simple processing and reduce the file capacity required for image storage. And

【0014】[0014]

【課題を解決するための手段】本発明のカラー画像の圧
縮・伸長方法は、カラー画像の色分布より目的の数の限
定色を抽出して前記カラー画像より各限定色に割り当て
られる画素数の頻度分布を計数し、前記限定色の頻度と
隣接画素の位置関係より各限定色と位置関係とにハフマ
ン符号を割り当て、各画素を、前記画素の限定色が隣接
画素の限定色と同一であれば前記位置関係を符号化した
ハフマン符号で、隣接画素のいずれとも異なれば前記限
定色を符号化したハフマン符号で符号化することを特徴
としている。
The color image compression / expansion method according to the present invention extracts a desired number of limited colors from the color distribution of the color image and determines the number of pixels assigned to each limited color from the color image. The frequency distribution is counted, and a Huffman code is assigned to each of the limited colors and the positional relationship based on the frequency of the limited color and the positional relationship between the adjacent pixels, and if each pixel has the same limited color as the limited color of the adjacent pixel, For example, the positional relationship is encoded by a Huffman code, and if it is different from any of the adjacent pixels, the limited color is encoded by a Huffman code.

【0015】また、前記の圧縮方法によって圧縮された
圧縮データからハフマン符号を検出し、隣接関係を符号
化したハフマン符号の場合には対応する元の隣接位置デ
ータに、それ以外の場合は元の限定色データに変換・復
号して各画素の色を表すR、G、B値を出力することに
より圧縮データの伸長を行うことを特徴としている。
Further, a Huffman code is detected from the compressed data compressed by the above-described compression method, and in the case of a Huffman code in which the adjacency relationship is coded, the original adjacent position data is used. It is characterized in that compressed data is expanded by converting and decoding into limited color data and outputting R, G, B values representing the color of each pixel.

【0016】[0016]

【作用】上記構成によれば、各画素を符号化する際に、
画素の限定色が隣接画素の限定色と同一の場合は、位置
関係を符号化したハフマン符号で符号化し、隣接画素の
いずれとも異なっている場合は、頻度による限定色を符
号化したハフマン符号で符号化を行う。画像の伸長、再
生の際は、符号化とは逆の手順により変換・複号して、
R、G、B値を出力するので、単純な処理によって圧縮
率を向上させることができる。
According to the above arrangement, when each pixel is encoded,
If the limited color of the pixel is the same as the limited color of the adjacent pixel, it is encoded by a Huffman code that encodes the positional relationship, and if it is different from any of the adjacent pixels, the Huffman code that encodes the limited color by frequency is used. Perform encoding. At the time of image decompression and playback, conversion and decoding are performed in the reverse procedure of encoding,
Since the R, G, and B values are output, the compression ratio can be improved by simple processing.

【0017】[0017]

【実施例】以下、本発明の一実施例について図を参照し
て説明する。図1は本発明のカラー画像の圧縮・伸長方
法が適用されるシステムの構成図である。図2は本発明
のカラー画像の圧縮・伸長方法の作成手順を示す図であ
る。
DESCRIPTION OF THE PREFERRED EMBODIMENTS One embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a configuration diagram of a system to which a color image compression / expansion method of the present invention is applied. FIG. 2 is a diagram showing a procedure for creating a color image compression / decompression method according to the present invention.

【0018】図1に示す画像システムの圧縮符号処理を
行うCPU10には、画像データを含む各種のデータを
記憶するメモリ20と、コマンドやテキストデータの入
力などを行うための入力装置30と、画像を含むデータ
をディスプレイに表示する表示装置40が結合される。
CPU10は処理対象のカラー画像をメモリ20より読
みだし、圧縮符号を作り読み出したカラー画像を符号に
変換してメモリ20に戻す。
The CPU 10 for performing the compression encoding process of the image system shown in FIG. 1 includes a memory 20 for storing various data including image data, an input device 30 for inputting commands and text data, and an image processing device. And a display device 40 for displaying data including the data on a display.
The CPU 10 reads the color image to be processed from the memory 20, creates a compression code, converts the read color image into a code, and returns the code to the memory 20.

【0019】表示装置40にカラー画像を表示する場合
には、入力装置30より表示コマンドと表示対象の画像
名を入力すれば、CPU10がメモリ20に符号の形で
保存されている画像を読みだし、圧縮と反対の手順でカ
ラー画像の伸長処理を行い、伸長されたカラー画像を表
示装置40に転送し表示する。
When a color image is displayed on the display device 40, a display command and the name of an image to be displayed are input from the input device 30, and the CPU 10 reads the image stored in the memory 20 in the form of a code. The decompression process of the color image is performed in a procedure opposite to the compression, and the decompressed color image is transferred to the display device 40 and displayed.

【0020】つぎに処理動作について説明する。Next, the processing operation will be described.

【0021】もとのカラー画像を表現するのに使われる
限定色の使用頻度には偏りがあり、この使用頻度の偏り
を利用して使用頻度の高い値ほど短い符号になるハフマ
ン符号化により符号化すれば、限定色を表現する平均ビ
ット長を短縮でき結果として圧縮率が高められる。さら
に、画像の各画素は隣接する画素と同じ場合が多いの
で、どの画素と同じかを符号化する、予測符号化の考え
方を組み合わせれば圧縮率をより高めることができる。
There is a bias in the frequency of use of the limited colors used to represent the original color image, and by using this bias in the frequency of use, the higher the value of the frequency of use, the shorter the code. With such a configuration, the average bit length for expressing the limited color can be reduced, and as a result, the compression ratio can be increased. Furthermore, since each pixel of an image is often the same as an adjacent pixel, the compression ratio can be further increased by combining the concept of predictive coding, which encodes which pixel is the same as the pixel.

【0022】以下に、図2を参照して圧縮符号の作成手
順を説明する。まず、図1に示すシステムでシステム使
用者が求める限定色の色数、例えば圧縮で情報が落ちな
い程度の限定色の色数を、例として256を、指定する
(ステップ1)。従来技術で説明した、メディアン・カ
ット・アルゴリズムに従った限定色抽出手法により、処
理対象のカラー画像から指定数の限定色を抽出する(ス
テップ2)。即ち、上述したように、例えば、赤R、緑
G、青Bの3次元の色空間に対応する色立方体を、3色
の色軸それぞれについて5ビット(32個)に量子化
し、32×32×32=32768色の立方体に分け、
対象画像の各画素値が各立方体に入る頻度(3次元ヒス
トグラムとなる)を作成する。ここで、色立方体を1つ
の箱とみなし、箱の1番長い方向に沿って1次元のヒス
トグラムを作成して、両側で頻度が半分づつになる分割
面(メディアン)を求めて2つの箱に分割する。この分
割処理を箱が目的の数になるまで繰り返していき、各箱
の中の色を平均してN個の代表色とし、32768色に
ついて最も距離値の小さい色の代表色を割り当てる。各
画素を32768色のいずれかに変換し、得られた代表
色の番号iで各画素を表現して、代表色番号iのアドレ
スに代表色(Ri、Gi、Bi)を持つカラーマップを
生成する。また各画素の番号(インデックス)でカラー
マップを読みだし、カラーマップの代表色で表示するこ
とによって画像を再生するものである。こうして、この
メディアン・カット・アルゴリズムによって、指定数の
代表色を求められ、この得られた代表色が限定色とな
る。続いて、上述の通り、各画素の色値に対応する限定
色を求め、各限定色に入る画素数を頻度とする頻度分布
を作成する(ステップ3)。即ち、画像上の画素の色値
を画素番号値に変換し、各画素番号値を有する画素数を
積算していくと、同一画素番号値を持つ画素数、即ち各
限定色に入る画素数が求められる。この画素番号値ごと
の画素数を配列にして保存すると、得られる配列が頻度
分布として作成される。更に、頻度分布より各限定色の
生起確率を求め、従来技術で説明したハフマン符号化手
法により各限定色にハフマン符号を割り当てる(ステッ
プ4)。即ち、対称画像が持つ色の度数分布が頻度分布
に入っているので、頻度分布の各画素数 を対称画像の画
素数で正規化すると、頻度分布は対称画像が持つ色の確
率となり、この確率を生起確率として求められる。ま
た、従来技術で説明したように、ハフマン符号は確率の
高い順に、ビット長の短いビットから順番に割り当てて
いくので、限定色の頻度分布で頻度の多い順に、ハフマ
ン符号を割り当て、指定色数の限定色おのおのに割り当
てられた符号ビットをカラーマップの画素番号値に対応
付けする。また、処理対象のカラー画像の全画素に対し
てステップ4を繰り返す(ステップ5)。即ち、ステッ
プ4で限定色に対する符号割り当てを行い、各画素の色
値が色立方体のどこに入るのかを求め、その色立方体に
入っている画素番号値を呼び出し、画素番号値にに対応
付けされた符号ビットを割り当て、全画素について符号
ビットを割り当てる。
The procedure for creating a compression code will be described below with reference to FIG. First, the system shown in FIG.
The number of limited colors required by the user , for example,
A limited number of limited colors, for example, 256 is designated (step 1). Described in the prior art, median mosquitoes
A specified number of limited colors are extracted from the color image to be processed by a limited color extraction method according to the set algorithm (step 2). That is, as described above, for example, red R, green
Color cube corresponding to the three-dimensional color space of G and blue B
Quantized to 5 bits (32) for each color axis
And divided into 32 × 32 × 32 = 32768 color cubes,
Frequency at which each pixel value of the target image enters each cube (three-dimensional hiss
To become a program). Here, one color cube
And a one-dimensional hiss along the longest direction of the box.
Create a tomogram and split it so that the frequency is halved on both sides
Divide into two boxes for median. This minute
Repeat the splitting process until the number of boxes reaches the desired number.
The colors in are averaged to N representative colors, giving 32768 colors
The representative color of the color with the smallest distance value is assigned. each
Pixels are converted to any of 32768 colors and the resulting representative
Each pixel is represented by the color number i, and the address of the representative color number i
Color map with representative colors (Ri, Gi, Bi)
Generate. In addition, color by the number (index) of each pixel
Read the map and display it in the representative color of the color map.
Thus, an image is reproduced. Thus, this
The median cut algorithm allows a specified number of
A representative color is requested, and the obtained representative color is a limited color.
You. Subsequently, as described above, a limited color corresponding to the color value of each pixel is obtained, and a frequency distribution is generated with the number of pixels included in each limited color as a frequency (step 3). That is, the color value of the pixel on the image
Is converted to a pixel number value, and the number of pixels having each pixel number value is
By integrating, the number of pixels having the same pixel number value,
The number of pixels that fall into the limited color is determined. For each pixel number value
If you save the number of pixels in an array, the resulting array
Created as a distribution. Further, the occurrence probability of each limited color is obtained from the frequency distribution, and a Huffman code is assigned to each limited color by the Huffman coding method described in the related art (step 4). That is, the frequency distribution of the color of the symmetric image is the frequency distribution.
The number of pixels in the frequency distribution
When normalized by prime numbers, the frequency distribution is
The probability is obtained as the occurrence probability. Ma
As described in the related art, the Huffman code is
Bits are allocated in order from high bit to short bit
In the order of frequency in the frequency distribution of limited colors.
Code and assign each of the specified number of limited colors
The assigned sign bit to the pixel number value in the color map
Attach. Step 4 is repeated for all pixels of the color image to be processed (step 5). That is,
In step 4, code is assigned to the limited color, and the color of each pixel is
Find where the value falls in the color cube, and
Recalls the contained pixel number value and corresponds to the pixel number value
Allocated sign bit is assigned and sign is applied to all pixels.
Allocate bits.

【0023】つぎに、図3の予測圧縮での符号化例に示
すように、隣接画素の位置関係の符号化の場合は、先頭
ビットが“0”であれば位置関係の符号であることを示
し、その場合は2番目のビットによって前ラインの画素
と同じか、直前の画素と同じかが符号化される。図3で
は画素Xj、iに対し、前ラインの画素がXj−1、
i、直前の画素がXj、i−1の例を示している。ま
た、先頭ビットが“1”であれば、続くビット列は限定
色の符号としているので、位置関係の符号である位置符
と、限定色の符号であるハフマン符号とをカラー画像
情報の連続する符号として一緒に扱うことができる。
Next, as shown in the coding example of predictive compression in FIG. 3, in the case of encoding of the positional relationship between adjacent pixels, if the leading bit is "0", it is determined that the code is of the positional relationship. In this case, whether the pixel is the same as the pixel on the previous line or the pixel immediately before is encoded by the second bit. In FIG. 3, the pixels on the previous line are Xj−1,
i shows an example in which the immediately preceding pixel is Xj, i-1. If the first bit is “1”, the subsequent bit string is a limited color code.
No. and, Huffman codes and the color image is a sign of the limited color
They can be treated together as consecutive codes of information .

【0024】このような符号化処理に従って、画素ごと
に位置関係の符号、限定色のハフマン符号を割り当て圧
縮データとしてメモリ20に保存する(ステップ6)。
続いて、画像サイズ、位置関係の符号、各限定色のハフ
マン符号および赤R、緑G、青Bの色値を圧縮データの
付加情報として保存する(ステップ7)。
In accordance with such an encoding process, a positional relationship code and a limited color Huffman code are assigned to each pixel and stored in the memory 20 as compressed data (step 6).
Then, the image size, the code of the positional relationship, the Huffman code of each limited color, and the color values of red R, green G, and blue B are stored as additional information of the compressed data (step 7).

【0025】以上がカラー画像の圧縮処理であるが、伸
長処理の場合はメモリ20に保存されている圧縮データ
をCPU10が読み出して、圧縮データからハフマン符
号を検出し、検出したハフマン符号が先頭ビット“0”
の位置関係の符号の場合は、その対応する位置データに
変換・復号する。先頭ビットが“1”の限定色ハフマン
符号の場合は対応する限定色データに復号して、各画素
の色を表すR、G、B値を出力する、符号化とは逆手順
の操作により伸長・再生するものである。
The above is the compression processing of the color image. In the case of the decompression processing, the CPU 10 reads out the compressed data stored in the memory 20 and detects the Huffman code from the compressed data. “0”
In the case of a code having a positional relationship of, the data is converted and decoded into the corresponding position data. If the first bit is a limited color Huffman code of "1", it is decoded into the corresponding limited color data, and R, G, B values representing the color of each pixel are output.・ It is something to regenerate.

【0026】なお、いままでは赤R、緑G、青Bの色立
方体の分割により限定色を求めていたが、人の色感覚に
合わせた均等色空間を色立方体としても、圧縮効果が得
られることはいうまでもない。
Although a limited color has been obtained by dividing the color cubes of red R, green G, and blue B, a compression effect can be obtained by using a uniform color space that matches the color sensation of a person as a color cube. Needless to say,

【0027】このような、本実施例においては、限定色
の使用頻度の偏りを利用するハフマン符号化によって限
定色を表現する平均ビット長を短縮し、この限定色の符
号と予測符号化による位置関係の符号のビット列を区別
した形で、一緒に扱うように構成しているので、従来例
に比較して圧縮の相乗効果が高められる。
In this embodiment, the average bit length for expressing the limited color is reduced by Huffman coding utilizing the bias of the frequency of use of the limited color, and the code of the limited color and the position by predictive coding are used. Since the bit strings of the related codes are treated together in a distinguished manner, the synergistic effect of the compression is enhanced as compared with the conventional example.

【0028】[0028]

【発明の効果】以上説明したように、本発明によれば、
処理対象の画像より得られる限定色の生起確率をもとに
ハフマン符号を求める符号化と、予測圧縮の符号化との
組み合わせによって圧縮されるので、限定色表示よりも
高い圧縮率を達成できる効果がある。
As described above, according to the present invention,
Since compression is performed by a combination of encoding for obtaining a Huffman code based on the probability of occurrence of a limited color obtained from an image to be processed and encoding of predictive compression, an effect of achieving a higher compression ratio than limited color display can be achieved. There is.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明のカラー画像の圧縮・伸長方法が適用さ
れる画像システムの構成図である。
FIG. 1 is a configuration diagram of an image system to which a color image compression / decompression method of the present invention is applied.

【図2】本発明のカラー画像の圧縮・伸長方法の作成手
順を示す図である。
FIG. 2 is a diagram showing a procedure for creating a color image compression / decompression method according to the present invention.

【図3】本発明の予測圧縮の符号化例を示す図である。FIG. 3 is a diagram illustrating an encoding example of predictive compression according to the present invention.

【図4】従来の限定色画像生成方法が適用されるシステ
ム構成図である。
FIG. 4 is a system configuration diagram to which a conventional limited color image generation method is applied.

【図5】従来のハフマン符号化での符号語生成における
“葉”の説明図である。
FIG. 5 is an explanatory diagram of “leaves” in codeword generation in conventional Huffman coding.

【図6】図5に示す“葉”より作成する“節点”Gの説
明図である。
FIG. 6 is an explanatory diagram of “nodes” G created from “leaves” shown in FIG. 5;

【図7】図6に示す“葉”より作成する“節点”Hの説
明図である。
FIG. 7 is an explanatory diagram of “nodes” H created from “leaves” shown in FIG. 6;

【図8】図7に示す“葉”より作成する“節点”Iの説
明図である。
8 is an explanatory diagram of a “node” I created from the “leaf” shown in FIG. 7;

【図9】図8に示す“葉”より作成する“節点”Jの説
明図である。
FIG. 9 is an explanatory diagram of “node” J created from “leaves” shown in FIG. 8;

【図10】図9に示す“葉”より作成する“節点”Kの
説明図である。
FIG. 10 is an explanatory diagram of “nodes” K created from “leaves” shown in FIG. 9;

【図11】従来の予測圧縮例を示す図である。FIG. 11 is a diagram showing an example of conventional prediction compression.

【符号の説明】[Explanation of symbols]

10 CPU 20 メモリ 30 入力装置 40 表示装置 DESCRIPTION OF SYMBOLS 10 CPU 20 Memory 30 Input device 40 Display device

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 処理対象のカラー画像の色分布より目的
の色数の限定色を抽出し前記カラー画像より前記各限
定色に割り当てられる画素番号値における画素の頻度分
布を計数し、前記頻度分布より前記各限定色の生起確率
を求め、前記各限定色にハフマン符号を割り当て、当該
画素と隣接画素との位置関係を符号化するカラー画像の
圧縮方法であって、 当該画素の 限定色が前記隣接画素の限定色と同一であれ
ば前記位置関係を符号化した位置符及び前記隣接
画素のいずれとも異なれば前記限定色を割り当てた前記
ハフマン符号で形成した圧縮データとすることを特徴と
するカラー画像の圧縮方法。
1. A extracts the limited color object number of colors than the color distribution of the color image to be processed, it counts the frequency distribution of the pixels in the pixel number value assigned from the color image to the each limited color, the frequency Occurrence probability of each limited color from distribution
Asking assigns Huffman codes to the each limited color, the
Of a color image that encodes the positional relationship between pixels and adjacent pixels
A compression method, limited color of the pixel is at the position marks No. obtained by encoding the positional relationship when the same limited color of the adjacent pixels, and allocating the limited color Different with any of the adjacent pixels A method for compressing a color image, wherein the compressed data is formed by the Huffman code.
【請求項2】 請求項1に記載のカラー画像の圧縮方法
により圧縮された前記圧縮データを読み出し、前記圧縮
データから前記位置関係を符号化した前記位置符号及び
前記ハフマン符号を検出し、前記位置関係を符号化した
前記位置符号の場合は対応する前記隣接画素のデータを
読み出して復号し、前記ハフマン符号であれば対応する
限定色データに復号し、前記各画素の色を表すR、
G、B値を出力することにより前記圧縮データの伸長を
行うことを特徴とするカラー画像の伸長方法。
Wherein reading the data compressed by the method of compressed color image according to claim 1, wherein the position code and to encoding the compressed data or al the positional relationship
Detecting the Huffman code, and coding the positional relationship
In the case of the position code, the data of the corresponding adjacent pixel is read and decoded, and in the case of the Huffman code, the data is decoded into data of a corresponding limited color , and R representing the color of each pixel is read.
A method for expanding a color image, comprising expanding the compressed data by outputting G and B values.
JP5082755A 1993-03-17 1993-03-17 Color image compression / decompression method Expired - Fee Related JP2570249B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5082755A JP2570249B2 (en) 1993-03-17 1993-03-17 Color image compression / decompression method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5082755A JP2570249B2 (en) 1993-03-17 1993-03-17 Color image compression / decompression method

Publications (2)

Publication Number Publication Date
JPH06274609A JPH06274609A (en) 1994-09-30
JP2570249B2 true JP2570249B2 (en) 1997-01-08

Family

ID=13783261

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5082755A Expired - Fee Related JP2570249B2 (en) 1993-03-17 1993-03-17 Color image compression / decompression method

Country Status (1)

Country Link
JP (1) JP2570249B2 (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5346211A (en) * 1976-10-08 1978-04-25 Matsushita Electric Ind Co Ltd Data compressing unit
JPS5364211A (en) * 1976-11-22 1978-06-08 Tokyo Gas Co Ltd Method of constructing furnaces
JPS5666971A (en) * 1979-11-05 1981-06-05 Dainippon Screen Mfg Co Ltd Picture data compressing method
JPH02146685A (en) * 1988-11-29 1990-06-05 Nec Home Electron Ltd Method for preparing picture with limited color

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
宮川、原島、今井「岩波講座(情報科学4)情報と符号の理論」(昭和57年8月10日)P.22−25

Also Published As

Publication number Publication date
JPH06274609A (en) 1994-09-30

Similar Documents

Publication Publication Date Title
US6614939B1 (en) Image compression apparatus and decoding apparatus suited to lossless image compression
US20060153443A1 (en) Image compression usable with animated images
JP3341962B2 (en) Variable length decoder and method for decoding variable length code value
KR100708180B1 (en) Apparatus and method for compressing color or gray scale documents
US5907635A (en) Picture data decompression apparatus
US6233282B1 (en) Methods and apparatus for providing reduced bit rate digital video formats
US7565025B2 (en) Image recording method for image data having image components of three channels and a transmission ratio component of one channel, apparatus and computer readable recording medium storing program
JP3269359B2 (en) Data encoding device and method, and data decoding device and method
JP2570249B2 (en) Color image compression / decompression method
CN107801031A (en) A kind of lossless compression-encoding method to pure three primary colors image data
JP2002185331A (en) Method for filtering digital data
JPS6118387B2 (en)
Bist et al. IMPROVED IMAGE COMPRESSION USING LOSSLESS HUFFMAN ENCODING (I2COM)
JP2002369201A (en) Image data compression equipment, image data compressing method, recording medium and program
JPH0621828A (en) Vector quantizing decoder
JP4034385B2 (en) Multi-color image encoding apparatus and method, and multi-color image decoding apparatus and method
JP2011139175A (en) Image processor and image processing method
JPH10262249A (en) Expansion method and device for image compression data
JP2006060490A (en) Image compressor and image compression program
CN117333559A (en) Image compression method, device, electronic equipment and storage medium
JP3152772B2 (en) Image data restoration device
JP3065393B2 (en) Image data restoration method and image data restoration device
JPH11259636A (en) Image converting method
US20020094126A1 (en) Fractal image compression
JP2002199227A (en) Image compression method and device, recording medium

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees