JPH0721346A - Limited color display procession method in image processing - Google Patents

Limited color display procession method in image processing

Info

Publication number
JPH0721346A
JPH0721346A JP5147217A JP14721793A JPH0721346A JP H0721346 A JPH0721346 A JP H0721346A JP 5147217 A JP5147217 A JP 5147217A JP 14721793 A JP14721793 A JP 14721793A JP H0721346 A JPH0721346 A JP H0721346A
Authority
JP
Japan
Prior art keywords
color
section
colors
representative
limited
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.)
Withdrawn
Application number
JP5147217A
Other languages
Japanese (ja)
Inventor
Katsuhiko Maehara
克彦 前原
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP5147217A priority Critical patent/JPH0721346A/en
Publication of JPH0721346A publication Critical patent/JPH0721346A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

PURPOSE:To reduce the number of times of a distance calculation for allowing a limited representative color to correspond to a picture element of an object image, and to execute the processing at a high speed with regard to the limited color display processing method in an image processing for limiting the number of colors of a color image to a prescribed value and displaying it. CONSTITUTION:A color space 20 is divided into several blocks, and the block of a representative color being a limited color is derived by a frequency method. By calculating a distance between each block in which the picture element exists and the representative color, the representative color at the shortest distance is set as a candidate color of its block, and only in the case plural candidate colors exist, the calculation of the distance between picture element which belongs to its block and the representative color is executed.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は,カラー画像を所定の色
数に限定して表示する画像処理における限定色表示処理
方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a limited color display processing method in image processing for displaying a color image with a limited number of colors.

【0002】限定色表示処理方法とは,例えばR
(赤),G(緑),B(青)の各色成分が0〜255の
値で表現されるようなフルカラーの現画像を,その中の
256色とか64色とかいったいくつかの色数で表現す
る方法である。この処理では,限定した結果が元の画像
に近い色で表現されること,処理時間が短く効率的に色
の限定ができることが必要である。
The limited color display processing method is, for example, R
A full-color current image in which each color component of (red), G (green), and B (blue) is represented by a value of 0 to 255 is displayed in several colors such as 256 colors or 64 colors. It is a way of expressing. In this process, it is necessary that the limited result be expressed in colors close to the original image and that the processing time be short and the colors be efficiently limited.

【0003】[0003]

【従来の技術】図8は従来技術の説明図である。図8
(A)において,80はスキャナやカメラ等の画像入力
装置,81は本発明に関係する色限定処理部,82はデ
ィジタル化された画像情報が格納されるフレームバッフ
ァ,83は色変換を行うためのルックアップテーブル
(LUT),84〜85はD/A変換器,87はCRT
ディスプレイを表す。
2. Description of the Related Art FIG. 8 is an explanatory diagram of a conventional technique. Figure 8
In (A), 80 is an image input device such as a scanner or camera, 81 is a color limitation processing section related to the present invention, 82 is a frame buffer in which digitized image information is stored, and 83 is for performing color conversion. Lookup table (LUT), 84 to 85 D / A converters, 87 CRT
Represents a display.

【0004】通常,フルカラーディスプレイでは,1画
素がRGB各8ビット,すなわち0から255の値で表
され,全部で256×256×256=約1670万色
の表示ができるようになっている。しかし,このような
フルカラーディスプレイでは,画像データを格納するた
めの非常に大きなメモリ(フレームバッファ)を必要と
する。そのため,ワークステーション等では,図8
(A)に示すような限定色表示装置が用いられている
(参考文献:「画像解析ハンドブック」東京大学出版
会,監修:高木幹雄,下田陽久)。
Normally, in a full-color display, one pixel is represented by RGB each having 8 bits, that is, a value of 0 to 255, and a total of 256 × 256 × 256 = about 16.7 million colors can be displayed. However, such a full-color display requires a very large memory (frame buffer) for storing image data. Therefore, in a workstation, etc.,
A limited color display device as shown in (A) is used (reference: "Image Analysis Handbook", University of Tokyo Press, supervised by: Mikio Takagi, Yoshihisa Shimoda).

【0005】スキャナ等の画像入力装置80から画像を
入力すると,色限定処理部81は,フルカラーの中から
いくつかの代表色を選び,原画像の各画素を各々代表色
の一つに対応づけ,その色番号をフレームバッファ82
に格納する。この色番号は代表色を表す番号で,例えば
1画素当り3〜8ビット(8〜256色)程度で表され
る。各代表色が実際にフルカラーのどの色に対応するか
はルックアップテーブル83に設定され,フレームバッ
ファ82から読み出された各画素の色番号によってルー
クアップテーブル83が検索される。検索結果は,RG
Bのそれぞれに対して8ビットである。これをD/A変
換器84〜86によりアナログ信号に変換し,CRTデ
ィスプレイ87に表示する。
When an image is input from the image input device 80 such as a scanner, the color limitation processing section 81 selects some representative colors from the full colors and associates each pixel of the original image with one of the representative colors. , The color number of the frame buffer 82
To store. This color number is a number representing a representative color, and is represented by, for example, about 3 to 8 bits (8 to 256 colors) per pixel. Which of the full colors each representative color actually corresponds to is set in the look-up table 83, and the rook-up table 83 is searched by the color number of each pixel read from the frame buffer 82. Search results are RG
There are 8 bits for each of the Bs. This is converted into an analog signal by the D / A converters 84 to 86 and displayed on the CRT display 87.

【0006】色限定処理部81による限定色表示処理
は,一般に以下のようなステップに分けて行われる。以
下の説明では,限定色の色数を64として説明するが,
もちろん,64色ではなく256色など他の色数でも同
様である。
The limited color display processing by the color limitation processing section 81 is generally performed in the following steps. In the following description, the number of limited colors is 64, but
Of course, the same applies to other colors such as 256 colors instead of 64 colors.

【0007】ステップ1:原画像の色分布の統計量を計
算し,その画像を再現するための最適な64色を選定す
る。このときに選定された色を「代表色」と呼ぶ。 ステップ2:原画像の各画素値に最も近い色を代表色か
ら選定し,ディスプレイに表示する。ここで,代表色は
1670万色の中から64色を選んでいるため,代表色
以外の原画像の色を,代表色のどの色に対応させるかが
重要である。
Step 1: Calculate the statistics of the color distribution of the original image and select the optimum 64 colors for reproducing the image. The color selected at this time is called a "representative color". Step 2: The color closest to each pixel value of the original image is selected from the representative colors and displayed on the display. Here, since 64 representative colors are selected from the 16.7 million colors, it is important that the colors of the original image other than the representative colors correspond to the representative colors.

【0008】限定色表示処理のアルゴリズムとしていく
つか存在するうち,前記のステップ1には頻度法を用い
たものがある。また,ステップ2には,徹底探索法を用
いたものがある。頻度法は,原画像における同じ画素値
の範囲を持つ画素の個数を,画素値の範囲ごとにカウン
トしていき,最も多く現れた画素値の範囲から順番に代
表色とする方法である。また,ステップ2における徹底
探索法は,全画素一つ一つに対し,64個の全代表色と
の距離を計算し,各画素を最も距離の小さい代表色に対
応させる方法である。
Among the algorithms for the limited color display processing, there is one using the frequency method in the above step 1. Further, in step 2, there is one using a thorough search method. The frequency method is a method in which the number of pixels having the same range of pixel values in the original image is counted for each range of pixel values, and the representative color is selected in order from the range of pixel values that appears most. The thorough search method in step 2 is a method in which the distances from all the representative colors of 64 pixels are calculated for each pixel and each pixel is associated with the representative color having the smallest distance.

【0009】また,従来のカラー画像の限定色表現装置
として,特開平4−190466号公報に開示されてい
るような方法を用いるものがある。この限定色表現装置
では,カラー画像を表現するための色空間を,点在する
色の数(画素数)が均等になるように有限個の領域に分
割して,各領域の代表色を設定し,その代表色と,それ
と似通った色を登録したテーブル上の代表色との間の色
空間距離を計算し,その最短の代表色を原画素に割り当
てるようにしている。
As a conventional limited color expression device for color images, there is one which uses a method disclosed in Japanese Patent Laid-Open No. 4-190466. In this limited color expression device, a color space for expressing a color image is divided into a finite number of areas so that the number of scattered colors (the number of pixels) is equal, and a representative color of each area is set. Then, the color space distance between the representative color and the representative color on the table in which similar colors are registered is calculated, and the shortest representative color is assigned to the original pixel.

【0010】ところで,限定色表示処理において,RG
B空間をN×N×Nの区画に分割して処理するような場
合に,従来,各区画の情報を格納するための制御表は,
それぞれの区画情報をポインタで連結して管理してい
た。図8(B)は従来の制御表の例を示している。
By the way, in the limited color display processing, RG
In the case where the B space is divided into N × N × N partitions and processed, conventionally, a control table for storing information of each partition is
Each section information was managed by connecting it with a pointer. FIG. 8B shows an example of a conventional control table.

【0011】この区画情報を管理する制御表をC言語に
よって表すと,例えば以下のようなデータ構造になる。 struct{ unsigned char red_start /* RED 成分の開始画素値 */ unsigned char red_end /* RED 成分の終了画素値 */ unsigned char green_start /* GREEN 成分の開始画素値 */ unsigned char green_end /* GREEN 成分の終了画素値 */ unsigned char blue _start /* BLUE 成分の開始画素値 */ unsigned char blue _end /* BLUE 成分の終了画素値 */ long number; /* 画素数 */ unsigned char *red _inf; /* RED 成分方向の制御表 */ unsigned char *green _inf; /* GREEN 成分方向の制御表 */ unsigned char *blue_inf; /* BLUE 成分方向の制御表 */ }X すなわち,各区画情報は,R成分方向,G成分方向,B
成分方向に各々隣接する区画情報へのポインタを持つよ
うにされている。
When the control table for managing this partition information is expressed in C language, it has the following data structure, for example. struct {unsigned char red_start / * start pixel value of RED component * / unsigned char red_end / * end pixel value of RED component * / unsigned char green_start / * start pixel value of GREEN component * / unsigned char green_end / * end of GREEN component Pixel value * / unsigned char blue _start / * Start pixel value of BLUE component * / unsigned char blue _end / * End pixel value of BLUE component * / long number; / * Number of pixels * / unsigned char * red _inf; / * RED Component direction control table * / unsigned char * green _inf; / * GREEN component direction control table * / unsigned char * blue_inf; / * BLUE component direction control table * /} X That is, each partition information is the R component direction , G component direction, B
It has pointers to partition information that are adjacent to each other in the component direction.

【0012】[0012]

【発明が解決しようとする課題】従来技術におけるステ
ップ2で用いている徹底探索法は,全画素について全代
表色との距離を計算するので,処理時間が非常に長くな
るという問題がある。距離計算として,X,Y,Zの3
次元の場合, 距離=(X2 +Y2 +Z2 1/2 によりユークリッド距離を正確に求める方法の他に,い
わゆる4−近傍距離,8近傍距離等の近似距離の計算手
法を用いる方法がある。しかし,このような近似距離の
計算方法を用いたとしても,かなりの処理時間がかかる
という問題があった。
The exhaustive search method used in step 2 in the prior art has a problem that the processing time becomes very long because the distances between all the pixels and all the representative colors are calculated. As distance calculation, 3 of X, Y, Z
In the case of dimension, in addition to the method of accurately calculating the Euclidean distance by the distance = (X 2 + Y 2 + Z 2 ) 1/2, there is also a method of using an approximate distance calculation method such as so-called 4-neighbor distance and 8-neighbor distance. . However, even if such an approximate distance calculation method is used, there is a problem that it takes a considerable amount of processing time.

【0013】また,例えば特開平4−190466号公
報に開示されているような方法の場合,画像の濃度分布
により代表色の領域を決定するため,領域の大きさはR
GB空間上で同一の大きさではない。そのため,あらか
じめ代表色を決定するために分割した区画と各代表色と
の関連テーブルを作成するが,その関連テーブルには多
くの候補色が存在し,原画素との距離計算を行う回数が
多くなるという問題がある。
Further, in the case of the method disclosed in, for example, Japanese Patent Laid-Open No. 4-190466, the area size of the area is R because the area of the representative color is determined by the density distribution of the image.
They are not the same size in GB space. Therefore, in order to determine the representative color in advance, a relation table between the divided sections and each representative color is created. However, since there are many candidate colors in the relation table, the distance calculation with the original pixel is often performed. There is a problem of becoming.

【0014】また,区画情報を管理するために,図8
(B)に示すような制御表を用いた場合,原画像の各画
素を区画の制御情報に割り当てるには,ポインタを追っ
て目的の区画を探す必要がある。そのため,1画素を処
理するごとに,特に画素が後方の区画にあると検索時間
がかかり,全画素を対象した処理では処理時間が長くか
かるという問題がある。さらに,ポインタを格納するた
めの領域が必要になるため,メモリが余分に必要になる
という問題がある。
Further, in order to manage the section information, FIG.
In the case of using the control table as shown in (B), in order to assign each pixel of the original image to the control information of the section, it is necessary to follow the pointer to search for the target section. Therefore, each time one pixel is processed, it takes a long time to search, especially when the pixel is in the rear section, and there is a problem that the processing for all pixels takes a long processing time. Further, there is a problem that an extra memory is required because an area for storing the pointer is required.

【0015】本発明は上記問題点の解決を図り,処理を
高速化するとともに,少ないメモリ量で限定色表示処理
を可能とすることを目的とする。
An object of the present invention is to solve the above problems, to speed up the processing, and to enable the limited color display processing with a small memory amount.

【0016】[0016]

【課題を解決するための手段】図1は本発明の原理説明
図である。本発明では,以下の処理により限定色表示を
行う。
FIG. 1 is a diagram for explaining the principle of the present invention. In the present invention, limited color display is performed by the following processing.

【0017】まず,処理11では,RGBの色成分で表
現された色空間20の各成分を限定色数に適した幅で区
切り,N×N×Nの区画に分割する。処理12では,対
象画像の各画素を色空間20の区画に分布させ,各区画
に含まれる画素数を計算する。
First, in process 11, each component of the color space 20 represented by RGB color components is divided into widths suitable for the limited number of colors and divided into N × N × N sections. In the process 12, each pixel of the target image is distributed to the section of the color space 20, and the number of pixels included in each section is calculated.

【0018】処理13では,色空間20の全区画から画
素数の多い順に限定色の数分の区画を選び,その各区画
の位置に基づいて代表色を決定する。処理14では,色
空間20の各区画ごとに各代表色との距離を計算し,最
も距離の短い代表色の全てをその区画の候補色とする。
In the process 13, the partitions corresponding to the number of limited colors are selected from all the partitions of the color space 20 in descending order of the number of pixels, and the representative color is determined based on the position of each partition. In the process 14, the distance from each representative color is calculated for each section of the color space 20, and all the representative colors with the shortest distance are set as the candidate colors of the section.

【0019】処理15では,対象画像の各画素の値を,
その画素が含まれる区画の候補色の一つに対応させる。
これにより各画素に代表色を割り当て,ディスプレイに
表示する。
In process 15, the value of each pixel of the target image is
It is made to correspond to one of the candidate colors of the section including the pixel.
This assigns a representative color to each pixel and displays it on the display.

【0020】区間管理制御表21は,色空間20の各区
画の情報を格納するための制御表である。本発明では,
この区間管理制御表21を,色空間20における各RG
B方向に隣接する区画の情報に対するポインタ情報を持
たない一つの配列として構成し,ある区画の情報が格納
された位置が,その区画に対応する各色成分の値によっ
て一意に定められるように構成する。
The section management control table 21 is a control table for storing information on each section of the color space 20. In the present invention,
This section management control table 21 is used for each RG in the color space 20.
It is configured as one array that does not have pointer information for the information of the section adjacent in the B direction, and the position where the information of a certain section is stored is uniquely determined by the value of each color component corresponding to that section. .

【0021】[0021]

【作用】本発明では,代表色を決定するための手段とし
て頻度法を用い,次に,各画素値に代表色を割り当てる
処理では,頻度法の処理で使用した色空間20の区画情
報を利用し,各画素値に最も近い色を代表色として選定
する。具体的には,各画素値と代表色との距離を計算す
るのではなく,各区画と代表値との距離の計算から各区
画の候補色を決めておき,各画素がどの区画に属するか
によって,各区画に属する画素の代表値を決定する。各
区画に対する候補色は,稀に複数存在することもある
が,多くの場合一つであるため,原画素と代表色との距
離計算はほとんど必要がなくなる。したがって,高速な
処理が可能になる。
In the present invention, the frequency method is used as a means for determining the representative color, and then, in the process of assigning the representative color to each pixel value, the partition information of the color space 20 used in the process of the frequency method is used. Then, the color closest to each pixel value is selected as the representative color. Specifically, instead of calculating the distance between each pixel value and the representative color, the candidate color of each partition is determined by calculating the distance between each partition and the representative value, and which partition each pixel belongs to. Then, the representative value of the pixels belonging to each section is determined. Although there are rare cases in which there are a plurality of candidate colors for each section, in most cases there is only one, so there is almost no need to calculate the distance between the original pixel and the representative color. Therefore, high-speed processing becomes possible.

【0022】また,区画管理制御表21は連続領域に一
つの配列として設けられるため,区画情報の格納領域を
一回の計算で求めることができ,ポインタにより検索す
る場合に比べて高速に求めることができるようになる。
リンクのためのアドレス格納領域を節約することも可能
になる。
Further, since the partition management control table 21 is provided as one array in the continuous area, the storage area of the partition information can be obtained by one calculation, and can be obtained at a higher speed than in the case of searching by the pointer. Will be able to.
It is also possible to save the address storage area for the link.

【0023】[0023]

【実施例】図2は本発明の実施例におけるRGB空間の
分割例,図3は本発明の実施例における区間管理制御表
の構成例を示す。
FIG. 2 shows an example of division of RGB space in the embodiment of the present invention, and FIG. 3 shows an example of the configuration of a section management control table in the embodiment of the present invention.

【0024】R(赤),G(緑),B(青)の各色成分
で表現された色空間は,例えば各成分の画素値が0(薄
い)から255(濃い)までの3次元空間で表される。
図2に示すように,これらの各成分を一定の幅で,N×
N×Nに分割する。限定色が64色の場合,各成分の画
素値0〜255を26ずつの画素値(0〜25,26〜
51,…)に分割すると,各成分が約10等分され,R
GB空間は10×10×10=1000個の区画に分割
されることになる。この場合,N=10である。
The color space represented by R (red), G (green), and B (blue) color components is, for example, a three-dimensional space in which the pixel value of each component is from 0 (light) to 255 (dark). expressed.
As shown in FIG. 2, each of these components has a constant width and N ×
Divide into N × N. When the limited color is 64 colors, the pixel values 0 to 255 of each component are set to 26 pixel values (0 to 25, 26 to
51, ...), each component is divided into about 10 equal parts, and R
The GB space will be divided into 10 × 10 × 10 = 1000 partitions. In this case, N = 10.

【0025】分割した区画の管理情報を格納するための
区画管理制御表21は,例えば図3(A)に示すよう
に,配列の形で連続した領域に獲得する。この区画情報
の格納領域は,R,G,Bの各画素値が0から25まで
の区画を(1,1,1)とし,R,Gの各画素値が0か
ら25で,Bの画素値が26から51までの区画を
(1,1,2)とし,……というように,(Rの画素値
の区分,Gの画素値の区分,Bの画素値の区分)で表す
と,図3(B)に示すようになる。
The partition management control table 21 for storing the management information of the divided partitions is acquired in a continuous area in the form of an array, as shown in FIG. 3A, for example. In the storage area of the partition information, the partition where the pixel values of R, G, B are 0 to 25 is (1, 1, 1), the pixel value of R, G is 0 to 25, and the pixel of B is Letting (1, 1, 2) be the sections whose values are from 26 to 51, and ... (R pixel value section, G pixel value section, B pixel value section), It becomes as shown in FIG.

【0026】このデータ構造をC言語の表記によって表
すと, struct{ long number; /* 画素数 */ }X となり,簡略になる。この制御表を配列で定義・獲得す
ることにより,従来の制御表における他の区画へのポイ
ンタ部分が不要となるだけでなく,一連の区画の開始・
終了を判断する必要もなくなるため,各成分ごとの開始
画素値,終了画素値の情報も不要となる。
When this data structure is expressed in C language, it becomes struct {long number; / * number of pixels * /} X, which is simplified. By defining / acquiring this control table as an array, not only does the pointer part to the other partition in the conventional control table become unnecessary, but also the start / stop of a series of partitions
Since there is no need to determine the end, information on the start pixel value and end pixel value for each component is also unnecessary.

【0027】このように区画管理制御表21を構成した
場合,原画像のRGBの各成分がどの区画に対応するか
は,以下の式で求めることができる。分割した画素値の
分割幅をMとする。この例ではM=26である。
When the partition management control table 21 is constructed in this way, which partition each RGB component of the original image corresponds to can be obtained by the following formula. Let M be the division width of the divided pixel values. In this example, M = 26.

【0028】区画=(R成分/M,G成分/M,B成分
/M) したがって,区画情報の格納領域位置は, 位置=R成分/M+(G成分/M)×N+(B成分/
M)×N×N として求められる。
Partition = (R component / M, G component / M, B component / M) Therefore, the storage area position of the partition information is: position = R component / M + (G component / M) × N + (B component /
M) × N × N.

【0029】例えば,分割数N=10,分割幅M=26
の場合には,画素値(100,120,230)の画素
が含まれる区画は,(100/26, 120/26, 230/26) =
(3,4,8)の位置にある区画である。ただし,区画
の先頭を(1,1,1)ではなく,(0,0,0)とし
ている。
For example, the division number N = 10 and the division width M = 26
In the case of, the section including the pixel of the pixel value (100, 120, 230) is (100/26, 120/26, 230/26) =
It is a section at the position (3, 4, 8). However, the beginning of the section is not (1,1,1) but (0,0,0).

【0030】この区画の区画管理制御表21における位
置は, 100/26+(120/26)×10+(230/26)×10×10=843(番
目) である。ただし,先頭は1番目ではなく0番目としてい
る。
The position of this section in the section management control table 21 is 100/26 + (120/26) × 10 + (230/26) × 10 × 10 = 843 (th). However, the beginning is not the first but the 0th.

【0031】図4は本発明の実施例の処理フローチャー
トを示す。以下,図4に示す処理(a) 〜(j) に従って説
明する。 (a) 限定色数に対応したRGB空間の分割幅Mを決定
し,R,G,Bの各色成分で表現されたRGB空間の各
成分を,その分割幅MでN×N×Nに分割する。RGB
空間は,各成分の画素値0(薄い)から255(濃い)
で表現される。限定色が64色の場合,各成分の画素値
0〜255を26ずつ(0〜25,26〜51,……)
に分割すると,各成分が約10等分され,RGB空間は
N=10で1000個の区画に分割されることになる。
FIG. 4 shows a processing flowchart of the embodiment of the present invention. Hereinafter, description will be given according to the processes (a) to (j) shown in FIG. (a) The division width M of the RGB space corresponding to the limited number of colors is determined, and each component of the RGB space represented by each color component of R, G, B is divided into N × N × N with the division width M. To do. RGB
The space is from pixel value 0 (light) to 255 (dark) of each component.
It is expressed by. When the limited color is 64 colors, 26 pixel values 0 to 255 of each component (0 to 25, 26 to 51, ...)
When divided into, each component is divided into about 10 equal parts, and the RGB space is divided into 1000 sections with N = 10.

【0032】(b) スキャナから原画像を取り込む。R,
G,Bの各成分の画素値が8ビットのディジタル信号と
して得られる。 (c) RGB空間に原画像の全画素を分布させる。具体的
には,画素値から区画管理制御表21における該当する
区画情報の位置を求め,その区画に含まれる画素数をカ
ウントアップする。
(B) The original image is taken in from the scanner. R,
The pixel value of each of the G and B components is obtained as an 8-bit digital signal. (c) All pixels of the original image are distributed in the RGB space. Specifically, the position of the relevant section information in the section management control table 21 is obtained from the pixel value, and the number of pixels included in the section is counted up.

【0033】(d) RGB空間に全画素を分布させたなら
ば,各区画に含まれる画素数の多い順にm個の区画を選
ぶ。なお,mは限定色の数であり,本例では64であ
る。 (e) 選ばれた64個の区画の中心の画素値を代表色とす
る。Rの画素値が0〜25,Gの画素値が26〜51,
Bの画素値が52〜77の区画の中心は,(13,3
9,65)で表現される色である。図8で説明したよう
なルックアップテーブル83を用いて表示するシステム
では,そのルックアップテーブル83に代表色の色情報
を設定する。
(D) If all pixels are distributed in the RGB space, m sections are selected in descending order of the number of pixels included in each section. Note that m is the number of limited colors, which is 64 in this example. (e) The pixel value at the center of the selected 64 sections is used as the representative color. The pixel value of R is 0 to 25, the pixel value of G is 26 to 51,
The center of the section where the pixel value of B is 52 to 77 is (13, 3
9, 65). In the display system using the lookup table 83 as described with reference to FIG. 8, the color information of the representative color is set in the lookup table 83.

【0034】(f) 次に,代表色として選ばれなかった区
画の中心と,64個の全代表色との距離を計算する。距
離の計算は,ユークリッド距離計算法を用いる。代表色
として選ばれた区画は距離が0であり,計算は不要であ
る。また,画素の存在しない区画に対しても候補色の計
算は不要である。距離の最も近い代表色を探し,その代
表色を候補色とする。距離が同じ代表色は同じく候補に
入れる。
(F) Next, the distance between the center of the section not selected as the representative color and all 64 representative colors is calculated. The Euclidean distance calculation method is used to calculate the distance. The section selected as the representative color has a distance of 0, and calculation is unnecessary. Further, it is not necessary to calculate a candidate color even for a section having no pixels. The representative color with the closest distance is searched, and the representative color is set as the candidate color. Representative colors with the same distance are also included in the candidates.

【0035】(g) 原画像の各画素に代表色を割り当てる
ために,再度,スキャナから原画像を取り込む。 (h) 全画像の全画素に対し,その画素が含まれる区画の
候補色とのみ距離を計算し,最も近い代表色を対応させ
る。なお,候補色は代表色であるため区画の中心であ
り,原画像の画素は区画の中心とは限らない。該当する
区画の候補色が一つしかない場合,あるいは代表色の存
在する区画の場合には,最も距離の短い候補色に対応さ
せるための距離計算は不要である。
(G) In order to assign a representative color to each pixel of the original image, the original image is read again from the scanner. (h) For all pixels of all images, calculate the distance only to the candidate color of the section containing that pixel, and associate the closest representative color. Since the candidate color is the representative color, it is the center of the section, and the pixel of the original image is not limited to the center of the section. When there is only one candidate color in the corresponding section, or in the case where there is a representative color, distance calculation for matching the candidate color with the shortest distance is unnecessary.

【0036】(i) 原画像の画素を,対応する代表色でデ
ィスプレイに表示する。 図5ないし図7は本発明の実施例の処理説明図である。
以下,図5ないし図7を参照しつつ,具体例を説明す
る。実際には,RGBの3次元色空間に対する処理が行
われるが,図5〜図7では,説明を分かりやすくするた
めに,Bの次元を省略し,R・Gの2次元で色空間を表
した例を示している。限定色については,この例では8
色とする。
(I) The pixels of the original image are displayed on the display in the corresponding representative colors. 5 to 7 are process explanatory diagrams of the embodiment of the present invention.
Hereinafter, a specific example will be described with reference to FIGS. Actually, processing is performed on the RGB three-dimensional color space, but in FIGS. 5 to 7, the dimension B is omitted and the color space is represented by the two dimensions R and G in order to make the explanation easy to understand. An example is shown. For the limited color, 8 in this example
Color.

【0037】図5(A)に示すようなRの画素値が0〜
255,Gの画素値が0〜255の,RG(Bは省略)
空間について,各成分を一定の幅10×10(×10)
で分割する。なお,この分割幅は,限定色の数で異なる
が,ここでは便宜上10としている。分割した結果は,
図5(B)に示すようになる。
The pixel value of R as shown in FIG.
RG with 255, G pixel values of 0 to 255 (B is omitted)
Regarding space, each component has a fixed width of 10 × 10 (× 10)
Split with. The division width differs depending on the number of limited colors, but here it is set to 10 for convenience. The result of the division is
As shown in FIG. 5 (B).

【0038】次にRG(B)空間に原画像の全画素を分
布させる。図5(C)において,ハッチングを施した区
画は,分布させた画素を表している。このとき,分割さ
れている各区画に原画像の画素がいくつ含まれているか
を計算する。全画素を分布させる処理が終了したなら
ば,各区画に含まれる画素数の多い順に8個(限定色数
=8)を選ぶ。図5(D)において,濃いハッチングを
施した部分は,選択された区画を表している。図5
(E)に示すように,選択された区画に番号を付け,そ
の区画の中心を代表色とする。
Next, all pixels of the original image are distributed in the RG (B) space. In FIG. 5C, hatched sections represent distributed pixels. At this time, how many pixels of the original image are included in each divided section is calculated. When the process of distributing all pixels is completed, eight pixels (limited color number = 8) are selected in descending order of the number of pixels included in each section. In FIG. 5D, the darkly shaded portion represents the selected section. Figure 5
As shown in (E), the selected section is numbered, and the center of the section is set as the representative color.

【0039】各区画は,0〜25,26〜51,52〜
77,78〜103,104〜129,130〜15
5,156〜181,182〜207,208〜23
3,234〜255に分けられているため,各区画の中
心の値は,13,39,65,91,117,143,
169,195,221,244である。したがって,
図5(E)に示す0〜7の代表色について,図8に示す
ルックアップテーブル83を用いて,ディスプレイへの
出力色を定めるとすると,本例におけるルックアップテ
ーブル83への変換値の設定は,図6(A)に示すよう
になる。
Each section is 0-25, 26-51, 52-
77, 78 to 103, 104 to 129, 130 to 15
5,156-181,182-207,208-23
Since it is divided into 3,234 to 255, the value of the center of each section is 13,39,65,91,117,143,
169, 195, 221, 244. Therefore,
For the representative colors of 0 to 7 shown in FIG. 5E, if the output color to the display is determined using the look-up table 83 shown in FIG. 8, the conversion values are set in the look-up table 83 in this example. Is as shown in FIG.

【0040】次に,代表色として選ばれなかった区画の
中心と8個の全代表色との距離を,ユークリッド距離計
算法を用いて計算する。距離を計算する区画は,画素が
あり,代表色として選ばれなかった区画(図6(B)に
おいて薄いハッチングを施してある区画)である。対象
となる区画ごとに距離の最も近い代表色を探し,候補色
とする。距離が同じ代表色は同じく候補に入れる。図6
(C)において,Xの区画の場合の候補色は,AとBの
二つとなる。
Next, the distance between the center of the section not selected as the representative color and all eight representative colors is calculated using the Euclidean distance calculation method. The section for calculating the distance is a section that has pixels and is not selected as the representative color (section with light hatching in FIG. 6B). The representative color with the closest distance is searched for in each target section, and it is set as a candidate color. Representative colors with the same distance are also included in the candidates. Figure 6
In (C), there are two candidate colors A and B in the case of the section X.

【0041】図7(B)は,図7(A)の一部を拡大し
て表したものである。図7(B)に示すように,区画X
には候補色としてA,Bがある。画素X1が区画Xの中
心にあるとすると,画素X1と候補色A,Bとの距離は
同じであるので,画素X1の代表色はAでもBでもどち
らでもよい。区画X内の画素X2は,候補色との距離を
計算するとAのほうが近いので,Aに対応させる。
FIG. 7 (B) is an enlarged view of a part of FIG. 7 (A). As shown in FIG. 7B, section X
Has A and B as candidate colors. If the pixel X1 is at the center of the section X, the distance between the pixel X1 and the candidate colors A and B is the same, so either A or B may be the representative color of the pixel X1. The pixel X2 in the section X corresponds to A because the A is closer when the distance from the candidate color is calculated.

【0042】同図において,画素Y内の画素Y1は候補
色がBのみであるため,距離計算を行うことなく,Bに
対応させる。区画B内の画素B1は,代表色のある区画
であるため,同様に距離計算を行うことなく,Bに対応
させる。
In the figure, since the pixel Y1 in the pixel Y has only B as a candidate color, it is made to correspond to B without performing distance calculation. Since the pixel B1 in the section B has a representative color, the pixel B1 is made to correspond to B without performing distance calculation in the same manner.

【0043】このように,原画像の全画素に対し,その
画素が含まれる区画の候補色とのみ距離を計算し,最も
近い代表色を対応させ,その代表色でもってディスプレ
イへの表示を行う。
In this way, for all the pixels of the original image, the distance is calculated only with the candidate color of the section including the pixel, the closest representative color is made to correspond, and the representative color is displayed on the display. .

【0044】[0044]

【発明の効果】以上説明したように,本発明によれば,
代表色を選定するための距離計算の数を削減し,処理を
高速化することが可能になる。また,区画情報を格納す
る制御表を一つの配列として管理するため,画素と区画
情報の領域の対応を1回の計算で求めることができる。
また,その領域の獲得,解放も1回で済む。さらに各区
画情報の領域間のポインタが必要なくなるため,リンク
のためのアドレス格納領域を節約することが可能にな
る。
As described above, according to the present invention,
It is possible to reduce the number of distance calculations for selecting the representative color and speed up the processing. Further, since the control table storing the partition information is managed as one array, the correspondence between the pixel and the area of the partition information can be obtained by one calculation.
In addition, the area can be acquired and released only once. Further, since the pointer between the areas of each section information is not necessary, it becomes possible to save the address storage area for linking.

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

【図1】本発明の原理説明図である。FIG. 1 is a diagram illustrating the principle of the present invention.

【図2】本発明の実施例におけるRGB空間の分割例を
示す図である。
FIG. 2 is a diagram showing an example of RGB space division according to an embodiment of the present invention.

【図3】本発明の実施例における区間管理制御表の構成
例を示す図である。
FIG. 3 is a diagram showing a configuration example of a section management control table in the embodiment of the present invention.

【図4】本発明の実施例の処理フローチャートである。FIG. 4 is a processing flowchart of an embodiment of the present invention.

【図5】本発明の実施例の処理説明図である。FIG. 5 is a process explanatory diagram of the embodiment of the present invention.

【図6】本発明の実施例の処理説明図である。FIG. 6 is a process explanatory diagram of the embodiment of the present invention.

【図7】本発明の実施例の処理説明図である。FIG. 7 is a process explanatory diagram of the embodiment of the present invention.

【図8】従来技術の説明図である。FIG. 8 is an explanatory diagram of a conventional technique.

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

11〜15 処理ステップ 20 色空間 21 区画管理制御表 11 to 15 processing steps 20 color space 21 division management control table

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 カラー画像を所定の色数に限定して表示
する画像処理における限定色表示処理方法において,各
色成分で表現された色空間(20)の各成分を所定の幅で区
切り,複数個の区画に分割する過程(11)と,対象画像の
画素を前記色空間(20)の区画に分布させ,各区画に含ま
れる画素数を計算する過程(12)と,前記色空間(20)の全
区画から画素数の多い順に限定色の数分の区画を選び,
その各区画の位置に基づいて代表色を決定する過程(13)
と,前記色空間(20)の各区画ごとに各代表色との距離を
計算し,最も距離の短い代表色をその区画の候補色とす
る過程(14)と,対象画像の各画素の値を,その画素が含
まれる区画の候補色の一つに対応させる過程(15)とを有
することを特徴とする画像処理における限定色表示処理
方法。
1. A limited color display processing method in image processing for displaying a color image limited to a predetermined number of colors, wherein each component of a color space (20) represented by each color component is separated by a predetermined width, A step (11) of dividing the image into individual sections, a step (12) of distributing the pixels of the target image to the sections of the color space (20) and calculating the number of pixels included in each section, and a step (12) of the color space (20). ) Select the partitions for the limited number of colors from all the partitions of
Process of determining the representative color based on the position of each section (13)
And (14) calculating the distance to each representative color for each section of the color space (20) and setting the shortest representative color as the candidate color for that section, and the value of each pixel of the target image And a step (15) of associating with one of the candidate colors of the section including the pixel, the limited color display processing method in image processing.
【請求項2】 請求項1記載の画像処理における限定色
表示処理方法において,前記色空間(20)の各区画の情報
を格納するための制御表(21)を,該色空間(20)における
各次元方向に隣接する区画の情報に対するポインタ情報
を持たない一つの配列として構成し,かつ,その制御表
(21)において,ある区画の情報が格納された位置が,そ
の区画に対応する各色成分の値によって一意に定められ
るように構成したことを特徴とする画像処理における限
定色表示処理方法。
2. The limited color display processing method according to claim 1, wherein a control table (21) for storing information of each section of the color space (20) is provided in the color space (20). A control table that is configured as one array that does not have pointer information for the information of adjacent sections in each dimension
In (21), the limited color display processing method in image processing is characterized in that the position where the information of a certain section is stored is uniquely determined by the value of each color component corresponding to that section.
JP5147217A 1993-06-18 1993-06-18 Limited color display procession method in image processing Withdrawn JPH0721346A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5147217A JPH0721346A (en) 1993-06-18 1993-06-18 Limited color display procession method in image processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5147217A JPH0721346A (en) 1993-06-18 1993-06-18 Limited color display procession method in image processing

Publications (1)

Publication Number Publication Date
JPH0721346A true JPH0721346A (en) 1995-01-24

Family

ID=15425224

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5147217A Withdrawn JPH0721346A (en) 1993-06-18 1993-06-18 Limited color display procession method in image processing

Country Status (1)

Country Link
JP (1) JPH0721346A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102165487A (en) * 2008-09-25 2011-08-24 乐天株式会社 Foreground area extracting program, foreground area extracting apparatus and foreground area extracting method
CN111401316A (en) * 2020-04-13 2020-07-10 网易(杭州)网络有限公司 Image dominant color determining method and device, storage medium and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102165487A (en) * 2008-09-25 2011-08-24 乐天株式会社 Foreground area extracting program, foreground area extracting apparatus and foreground area extracting method
CN111401316A (en) * 2020-04-13 2020-07-10 网易(杭州)网络有限公司 Image dominant color determining method and device, storage medium and electronic equipment
CN111401316B (en) * 2020-04-13 2023-08-15 网易(杭州)网络有限公司 Image dominant color determining method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
EP0159691B1 (en) Color image display system
US4710806A (en) Digital display system with color lookup table
JP2582999B2 (en) Color palette generation method, apparatus, data processing system, and lookup table input generation method
JP2000196907A (en) Method for selecting color to be assigned to pixel and method for encoding and storing picture
US5774386A (en) Method and apparatus for performing function evaluation using a cache
US4607340A (en) Line smoothing circuit for graphic display units
JP2647033B2 (en) Lookup table creation method and lookup table creation device
US6373580B1 (en) Method and apparatus for multi-dimensional interpolation
JPH0721346A (en) Limited color display procession method in image processing
KR20130135538A (en) Image composing apparatus of around view monitor system for changing view mode easily and method thereof
US5175809A (en) Pipeline architecture for generating video signal
JPH1141625A (en) Color moving image data compression method
JP3215156B2 (en) Color image processing method
JPH05284346A (en) Color conversion device
JP3861592B2 (en) Image color reduction processing apparatus and image color reduction processing method
JPS6232569A (en) Color picture device
KR0155925B1 (en) Digital color image
JP3026850B2 (en) Automatic tracking device
JPH10134167A (en) Method and device for generating local color space representative color list
JP2981292B2 (en) Image display method and apparatus
JPH06348827A (en) Limited color display method for color image
JP2987169B2 (en) How to make a cutout mask
JPH0765169A (en) Image retrieving method
JPH05333835A (en) Image display method
JPH0573667A (en) Color picture display device

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20000905