JPH07220070A - Converter for multi-level image - Google Patents

Converter for multi-level image

Info

Publication number
JPH07220070A
JPH07220070A JP6014339A JP1433994A JPH07220070A JP H07220070 A JPH07220070 A JP H07220070A JP 6014339 A JP6014339 A JP 6014339A JP 1433994 A JP1433994 A JP 1433994A JP H07220070 A JPH07220070 A JP H07220070A
Authority
JP
Japan
Prior art keywords
colors
image
color
gradation
gradations
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
JP6014339A
Other languages
Japanese (ja)
Inventor
Akihiko Matsuo
昭彦 松尾
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 JP6014339A priority Critical patent/JPH07220070A/en
Publication of JPH07220070A publication Critical patent/JPH07220070A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Controls And Circuits For Display Device (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Color Image Communication Systems (AREA)

Abstract

PURPOSE:To provide an image to be outputted as an image using available colors sufficiently and with high quality when an image with many colors is converted to the one with small colors. CONSTITUTION:A gradation number decision means decides the number of gradation of each color component based on the available number of colors. For example, when 256 available colors are prepared, the number of gradation of a red color component. a green color component, and a blue color component can be prepared by six, respectively. An optimum gradation number decision means finds the numof colors to be used in a conversion image when a color original image is converted based on the present number of gradation (1). and starts up an output image generating means by informing the number of gradation just before when the number of colors to be used exceeds the available number of colors (2), and stores the present number of gradation and increases the number of gradation when the former is less than the latter (3), then, returns processing to the above processing (1). The output image generating means converts the color original image based on the number of gradation informed from the optimum gradation number decision means. and generates an output image.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、多数の色で表現された
画像を、少数の色で表現される画像に変換する多階調画
像の変換装置に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a multi-tone image conversion device for converting an image expressed in a large number of colors into an image expressed in a small number of colors.

【0002】[0002]

【従来の技術】図17は従来の多階調画像の変換装置の
構成を示す図である。同図において、1は入力画像用フ
ァイル、2は出力画像用ファイル、3は変換手段、4は
階調決定手段をそれぞれ示している。ファイル1は入力
画像を格納する。入力画像の各画素の色は、例えば0な
いし255階調のR成分(赤色成分),0ないし255
階調のG成分(緑色成分),0ないし255階調のB成
分(青色成分)で表現される。
2. Description of the Related Art FIG. 17 is a diagram showing the structure of a conventional multi-gradation image conversion device. In the figure, 1 is an input image file, 2 is an output image file, 3 is a conversion means, and 4 is a gradation determination means. File 1 stores the input image. The color of each pixel of the input image is, for example, R component (red component) of 0 to 255 gradations, 0 to 255
It is expressed by a G component (green component) of gradation and a B component (blue component) of 0 to 255 gradations.

【0003】ファイル2は出力画像を格納する。出力画
像の各色成分の階調数は固定もしくは外部から与えられ
る。階調決定手段4は、各色成分ごとの階調数から使用
する階調を決める。例えば、入力画像の各色成分が0か
ら255までの256階調であり、それを3階調に変換
する場合は、使用する階調は均等に割り振れば0,12
7,255となる。変換手段3は、階調決定手段4で決
められた階調だけを使うように、入力画像を変換する。
3階調に変換する場合では、入力画像の点(画素)の値
で0,127,255の何れかを選択し、置き換える。
File 2 stores the output image. The gradation number of each color component of the output image is fixed or given from the outside. The gradation determining means 4 determines the gradation to be used from the number of gradations for each color component. For example, each color component of the input image has 256 gradations from 0 to 255, and when converting it to 3 gradations, the gradations to be used are 0, 12 if they are evenly distributed.
It becomes 7,255. The conversion unit 3 converts the input image so that only the gradation determined by the gradation determination unit 4 is used.
In the case of converting to three gradations, one of 0, 127, and 255 is selected and replaced by the value of the point (pixel) of the input image.

【0004】図18は従来の変換装置の変換動作フロー
を示す図である。ステップS1では、ファイル1から入
力画像を読み込む。ステップS2では、各色成分の階調
数を得る。各色成分とは、例えば上述の3階調である。
ステップS3では、各色成分毎に使用する階調を決め
る。各色成分毎の使用する階調とは、例えば上述の0,
127,255である。ステップS4では、各点の色を
置き換える。例えば、入力画素の色がR成分=15,G
成分=100,B成分=240の場合は、その画素の色
はR成分=0,G成分=127,B成分=255に変換
される。ステップS5では、変換された色を持つ画像を
ファイル2に出力する。
FIG. 18 is a diagram showing a conversion operation flow of a conventional conversion device. In step S1, the input image is read from the file 1. In step S2, the number of gradations of each color component is obtained. Each color component is, for example, the above-mentioned three gradations.
In step S3, the gradation to be used is determined for each color component. The gradation used for each color component is, for example, 0,
127 and 255. In step S4, the color of each point is replaced. For example, the color of the input pixel is R component = 15, G
When the component = 100 and the B component = 240, the color of the pixel is converted to R component = 0, G component = 127, and B component = 255. In step S5, the image having the converted color is output to the file 2.

【0005】[0005]

【発明か解決しようとする課題】上述のように、自然画
像等をコンピュータで扱う際に良く使われる形式では、
画像を細かい点(画素)の並びに変換し、各々の点で色
成分の値を数値化する。典型的な例では、色成分として
緑,赤,青の三原色を使い、それぞれを256階調で数
値化する。この形式では、各画素の色は約1600万色
(256×256×256)の内のいずれかになる。
As described above, in the format which is often used when a natural image or the like is handled by a computer,
The image is converted into an array of fine points (pixels), and the value of the color component is digitized at each point. In a typical example, three primary colors of green, red, and blue are used as color components, and each of them is digitized with 256 gradations. In this format, the color of each pixel is any one of about 16 million colors (256 × 256 × 256).

【0006】一方、現在一般的に使われているコンピュ
ータの画像表示装置では、同時に表示できる色数が制限
されていることが多い。これは、表示速度の向上および
表示用メモリの節約を目的としている。或る種の画像表
示装置は、1画素を8ビットで表現する表示用メモリ
と、256個のエントリを持つカラー・ルックアップ・
テーブルとを有しており、約1600万色の中の任意の
256色を同時に表示することが出来る。
On the other hand, in the image display device of the computer which is generally used at present, the number of colors that can be displayed simultaneously is often limited. This is intended to improve display speed and save display memory. Some image display devices have a display memory that represents one pixel in 8 bits and a color lookup display that has 256 entries.
It has a table and can display any 256 colors out of about 16 million colors at the same time.

【0007】この種の表示装置では、上記の形式の画像
をそのまま表示することが出来ない場合があるので、そ
の画像を変換し、使用されている色数を表示装置で使用
可能な数まで減少させる必要がある。従来の技術では、
各色成分の階調数を予め計算しておいた階調数まで減じ
て表示していた。例えば上記装置の場合、赤,青,緑の
各成分を6階調ずつに変換すれば、最大でも216色し
か使わないので、表示可能となる。
In this type of display device, it may not be possible to display the image in the above format as it is, so that the image is converted and the number of colors used is reduced to the number usable by the display device. Need to let. With conventional technology,
The number of gradations of each color component is reduced to the previously calculated number of gradations for display. For example, in the case of the above device, if each of the red, blue, and green components is converted into 6 gradations, only 216 colors are used at the maximum, so that display is possible.

【0008】従来の方法で変換した画像は、256階調
の色成分を6階調に減じているため、原画像に比較して
著しく画質が劣化しており、利用者の用途によっては役
に立たない場合も多い。しかし、同時表示可能な色数の
制限がない表示装置を別に用意するのは負担が大きく、
一般的な表示装置でも質の高い画像を表示できる装置が
強く求められていた。
The image converted by the conventional method has the color components of 256 gradations reduced to 6 gradations, so the image quality is remarkably deteriorated as compared with the original image, and it is not useful depending on the user's application. In many cases. However, it is burdensome to prepare a separate display device that does not limit the number of colors that can be displayed simultaneously.
There has been a strong demand for a device capable of displaying a high-quality image even in a general display device.

【0009】本発明は、この点に鑑みて創作されたもの
であって、色数の多い画像を色数の少ない画像に変換し
て出力する場合に、出力される画像が使用可能な色を十
分に使った質の高いものにすることを目的としている。
The present invention was created in view of this point, and when converting an image having a large number of colors into an image having a small number of colors and outputting the converted image, the colors usable by the output image are determined. The goal is to make sure you have a good quality product that you have used.

【0010】[0010]

【課題を解決するための手段】図1は請求項1の発明の
原理説明図である。請求項1の多階調画像の変換装置
は、多階調のカラー原画像を、使用可能な色数以内の色
数を持つ画像に変換する変換装置であって、使用可能な
色数に基づいて階調数を決定する階調数決定手段と、階
調数決定手段によって階調数が決定された後に動作を開
始する最適階調数決定手段と、最適階調数決定手段から
通知された階調数に基づいて、カラー原画像を変換し出
力画像を生成する出力画像生成手段とを具備し、最適階
調数決定手段は、 現在の階調数に基づいてカラー原画像を変換した場
合の変換画像での使用色数を求め、 変換画像での使用色数が使用可能な色数を越えてい
るか否かを調べ、越えている場合は、その直前の階調数
を出力画像生成手段に通知して起動し、 越えていない場合は、現在の階調数を記憶し、階調
数を増加させ、の処理に戻る 処理を行うよう構成されていることを特徴とするもので
ある。
FIG. 1 is a diagram for explaining the principle of the invention of claim 1. The multi-gradation image conversion device according to claim 1 is a conversion device for converting a multi-gradation color original image into an image having a number of colors within the usable number of colors, based on the number of usable colors. From the optimum gradation number determining means, which starts the operation after the gradation number is determined by the gradation number determining means, and the optimum gradation number determining means And an output image generating means for converting the color original image based on the gradation number to generate an output image, wherein the optimum gradation number determining means converts the color original image based on the current gradation number. The number of colors used in the converted image is calculated, and it is checked whether the number of colors used in the converted image exceeds the number of colors that can be used. If it exceeds, the number of gradations immediately before that is output image generation means. When the number of gradations is not exceeded, the current number of gradations is memorized and the number of gradations is increased. And it is characterized in that it is configured to perform processing to return to the process.

【0011】図2は請求項2,3の発明の原理説明図で
ある。請求項2の多階調画像の変換装置は、多階調のカ
ラー原画像を、使用可能な色数以内の色数を持つ画像に
変換する変換装置であって、多階調のカラー原画像で使
用されている色数を計測する入力画像使用色数計測手段
と、入力画像使用色数計測手段によって色数が計測され
た後に動作を開始する最適階調数決定手段と、最適階調
数決定手段から通知された階調数に基づいて、カラー原
画像を変換し出力画像を生成する出力画像生成手段とを
具備し、最適階調数決定手段は、 現在の色数,変換画像での使用可能な色数および現
在の階調数に基づいて新たな階調数を推定し、推定した
階調数に基づいてカラー原画像を変換し、変換画像での
使用色数を求め、 変換画像での使用色数が使用可能な色数と等しいか
否かを調べ、等しい場合には、現在の階調数を出力画像
生成手段に通知して起動し、 変換画像での使用色数が使用可能な色数と等しくな
い場合には、変換画像での使用色数が使用可能な色数を
越えているか否かを調べ、越えている場合はの処理に
戻り、 変換画像での使用色数が使用可能な色数を越えてい
ない場合は、変換画像での使用色数が直前の使用色数を
越えたか否かを調べ、変換画像での使用色数が直前の使
用色数を越えない場合は、直前の階調数を出力画像生成
手段に通知して起動し、 変換画像での使用色数が直前の使用色数を越えた場
合は、現在の階調数および色数を記憶して、の処理に
戻る 処理を行うよう構成されていることを特徴とするもので
ある。
FIG. 2 is a diagram for explaining the principle of the invention of claims 2 and 3. The multi-gradation image conversion device according to claim 2 is a conversion device for converting a multi-gradation color original image into an image having a number of colors within a usable color number, and the multi-gradation color original image. Input image used color number measuring means for measuring the number of colors used in, an optimum gradation number determining means for starting operation after the color number is measured by the input image used color number measuring means, and an optimum gradation number And an output image generating means for converting the color original image to generate an output image based on the gradation number notified from the determining means. A new gradation number is estimated based on the number of colors available and the current number of gradations, the original color image is converted based on the estimated number of gradations, and the number of colors used in the converted image is calculated. Check if the number of colors used in is equal to the number of colors available, and if so, the current When the number of gradations is notified to the output image generation means and started, and the number of colors used in the converted image is not equal to the number of colors available, the number of colors used in the converted image exceeds the number of colors available. If the number of colors used in the converted image does not exceed the number of colors that can be used, the number of colors used in the converted image is the number of colors used immediately before. If the number of colors used in the converted image does not exceed the number of colors used immediately before, the output image generation means is notified of the number of gradations immediately before, and the colors are used in the converted image. When the number exceeds the number of colors used immediately before, the present number of gradations and the number of colors are stored, and the process is returned to the process of.

【0012】請求項3の多階調画像の変換装置は、多階
調のカラー原画像を、使用可能な色数以内の色数を持つ
画像に変換する変換装置であって、多階調のカラー原画
像で使用されている色数を計測すると共に、各色成分毎
の階調の数を計測する入力画像使用色数計測手段と、入
力画像使用色数計測手段よって色数および各色成分毎の
階調数が計測された後に動作を開始する最適階調数決定
手段と、最適階調数決定手段から通知された各色成分毎
の階調数の組に基づいて、カラー原画像を変換し出力画
像を生成する出力画像生成手段とを具備し、最適階調数
決定手段は、 現在の色数,変換画像での使用可能な色数,現在の
各色成分毎の階調数およびカラー原画像における各色成
分毎の階調数に基づいて、新たな各色成分毎の階調数の
組を推定し、推定した各色成分毎の階調数の組に基づい
てカラー原画像を変換し、変換画像での使用色数を求
め、 変換画像での使用色数が使用可能な色数と等しいか
否かを調べ、等しい場合には、現在の各色成分毎の階調
数の組を出力画像生成手段に通知して出力画像生成手段
を起動し、 変換画像での使用色数が使用可能な色数と等しくな
い場合には、変換画像での使用色数が使用可能な色数を
越えているか否かを調べ、越えている場合はの処理に
戻り、 変換画像での使用色数が使用可能な色数を越えてい
ない場合は、変換画像での使用色数が直前の使用色数を
越えたか否かを調べ、変換画像での使用色数が直前の使
用色数を越えない場合は、直前の各色成分毎の階調数の
組を出力画像生成手段に通知して起動し、 変換画像での使用色数が直前の使用色数を越えた場
合は、現在の各色成分毎の階調数の組および色数を記憶
して、の処理に戻る 処理を行うよう構成されていることを特徴とするもので
ある。
According to a third aspect of the present invention, there is provided a multi-gradation image conversion device for converting a multi-gradation color original image into an image having a color number within the usable color number. The number of colors used in the color original image is measured, and the number of gradations for each color component is also measured, and the number of colors and each color component are measured by the input image used color number measurement unit. An original color image is converted and output based on a combination of the optimum gradation number determining means for starting the operation after the gradation number is measured and the gradation number for each color component notified from the optimum gradation number determining means. And an output image generation means for generating an image, wherein the optimum gradation number determination means is configured to determine the current number of colors, the number of colors usable in the converted image, the current number of gradations for each color component, and the original color image. Estimate a new set of gradation numbers for each color component based on the gradation number for each color component Then, the original color image is converted based on the estimated set of gradation numbers for each color component, the number of colors used in the converted image is calculated, and it is determined whether the number of colors used in the converted image is equal to the number of usable colors. If they are equal, the set of gradation numbers for each current color component is notified to the output image generation means, the output image generation means is activated, and the number of colors used in the converted image is the number of usable colors. If it is not equal to, check whether the number of colors used in the converted image exceeds the number of colors that can be used. If it exceeds, return to the process of and the number of colors used in the converted image can be used. If the number of colors does not exceed the number of colors used in the converted image, check to see if the number of colors used in the converted image has exceeded the number of colors used immediately before. The output image generation means is notified of the set of gradation numbers for each color component of the If the number of colors to be used is exceeded, the present set of gradation numbers for each color component and the number of colors are stored, and the process is returned to the process.

【0013】図3は請求項4の発明の原理説明図であ
る。請求項4の多階調画像の変換装置は、請求項1また
は請求項2または請求項3の多階調画像の変換装置にお
いて、出力画像生成手段によって生成された出力画像に
おける色数が使用可能な色数よりも少ない場合には、カ
ラー原画像における使用頻度の高い色を持つ画素に対応
する変換画像における画素の色を、カラー原画像におけ
る当該画素の色で置き換える出力画像修正手段を設けた
ことを特徴とするものである。
FIG. 3 is a diagram for explaining the principle of the invention of claim 4. A multi-gradation image conversion device according to claim 4 is the multi-gradation image conversion device according to claim 1, 2 or 3, wherein the number of colors in the output image generated by the output image generation means can be used. If the number of colors is less than the number of colors, an output image correction means is provided for replacing the color of the pixel in the converted image corresponding to the pixel having a color that is frequently used in the color original image with the color of the pixel in the color original image. It is characterized by that.

【0014】[0014]

【作用】従来の変換装置で変換した画像を分析して見る
と、殆どの画像では、実際に使用されている色数は最大
数(各色成分の積)より少なくなっている。例えば、6
階調に減じた場合、最大216色が使われる可能性があ
るが、変換した画像に含まれている色数はせいぜい数十
色程度であることが多い。したがって、実際には6階調
よりも多くの階調数を使っても、使われている色数は2
56色を越えない場合が多い。
When the images converted by the conventional conversion device are analyzed and viewed, the number of colors actually used is less than the maximum number (product of each color component) in most images. For example, 6
When the gradation is reduced, a maximum of 216 colors may be used, but the number of colors included in the converted image is often several tens at most. Therefore, even if more than 6 gradations are actually used, the number of colors used is 2
It often does not exceed 56 colors.

【0015】そこで、本発明では、変換した画像中に含
まれている色数を計測し、未だ使用可能な色が残ってい
る場合は階調数を増加させて再び変換を試みる。この動
作を繰り返すことで、最終的に出力される画像は使用可
能な色を十分に使った質の高いものとなる。
Therefore, in the present invention, the number of colors included in the converted image is measured, and if there are still usable colors, the number of gradations is increased and conversion is tried again. By repeating this operation, the finally output image becomes a high quality image using the usable colors sufficiently.

【0016】また、最終的に出力される画像でも使用可
能な色を全て使っていない場合があるが、このような場
合には、余った色に,カラー原画像中における出現頻度
の高い色を割り当て、出力画像の対応点をその色に置き
換えると、出力画像の質がより高くなる。なお、本発明
では、画像を変換する際にディザリングと呼ばれる技術
を併用することも可能である。本発明とディザリング技
術を併用すると、従来のディザリングより質の高い出力
が得られる。
In some cases, all the colors that can be used are not used even in the image that is finally output. In such a case, the surplus colors are replaced by colors that frequently appear in the color original image. Assigning and replacing corresponding points in the output image with that color results in a higher quality output image. In the present invention, a technique called dithering can be used together when converting an image. The combined use of the present invention and dithering techniques provides higher quality output than conventional dithering.

【0017】本発明の請求項1の変換装置の作用につい
て説明する。請求項1の変換装置では、カラー原画像を
従来と同様な手法で決められた階調数の画像に変換し、
そこで使用されている色数を調べる。色数に未だ余分が
あれば成分のどれかの階調数を増加させ、再び変換を行
う。この手続きを繰り返し、変換画像における色数が使
用可能な色数を越えた時点で、画像を変換して出力す
る。
The operation of the converting device according to the first aspect of the present invention will be described. In the conversion device according to claim 1, the color original image is converted into an image having the number of gradations determined by the same method as the conventional method,
Check the number of colors used there. If there is still an excess in the number of colors, increase the number of gradations of any of the components and perform conversion again. This procedure is repeated, and when the number of colors in the converted image exceeds the number of usable colors, the image is converted and output.

【0018】本発明の請求項2の変換装置の作用につい
て説明する。請求項2の変換装置では、先ず最初にカラ
ー原画像に含まれている色数を調べ、この色数を使っ
て、各色成分の適切な階調数を推定する。例えば、赤の
成分が256階調だったときに100色使われていた
ら、128階調にしたときには半分の50色程度使われ
るだろうと推定出来る。
The operation of the converting device according to the second aspect of the present invention will be described. In the conversion device according to the second aspect, first, the number of colors included in the color original image is checked, and the appropriate number of gradations of each color component is estimated using this number of colors. For example, if the red component has 256 gradations and 100 colors are used, it can be estimated that when the gradation is 128 gradations, half the 50 colors will be used.

【0019】色成分が3つあるとすると、階調数をn倍
に変化させたとき、使われる色はnの3乗に変化すると
推定できる。これを逆にみれば、使われる色をm倍にし
たければ、赤,青,緑の各成分の階調数をmの1/3乗
倍にすれば良いと言うことである。こうして推定した階
調数を使って変換を行う。請求項1の変換装置に比べて
次回の階調数をより適切に推定できるので、短い時間で
結果を出力できる。ただし、請求項2の変換装置では、
階調数を増やすだけでなく、減らす必要がある場合もあ
る。なお、この推定の方法は此処で述べた方法に限定す
るものでなく、扱う画像の性質によりより有効な方法が
あれば、それを使うことも出来る。
Assuming that there are three color components, it can be estimated that when the number of gradations is changed by n times, the color used changes to the cube of n. Conversely, if the colors used are to be multiplied by m, the number of gradations of each of the red, blue, and green components should be multiplied by 1/3 of m. Conversion is performed using the number of gradations thus estimated. Compared with the conversion device according to the first aspect, the number of gradations for the next time can be estimated more appropriately, so that the result can be output in a short time. However, in the conversion device of claim 2,
In some cases, it is necessary to reduce not only the number of gradations but also the number of gradations. Note that this estimation method is not limited to the method described here, and if there is a more effective method depending on the nature of the image to be handled, it can be used.

【0020】請求項3の変換装置の作用について説明す
る。請求項3の変換装置では、色数を調べる際に、各色
成分毎に使われている階調数も同時に調べる。この結
果、どれかの色成分で使われている階調数が、その成分
に割り当てられている階調数よりも少ない場合、使われ
ていない階調数を使って他の成分の割当て数を計算し直
す。例えば、青成分で使われているのが2階調しかなか
った場合、全ての成分に6階調を割り当てる必要はな
く、赤と緑の成分には11階調を割り当てることが出来
る(2×11×11=242)。こうすることで、無駄
な割当てを無くし、より高速に結果を出力できる。
The operation of the converter of claim 3 will be described. In the conversion device of the third aspect, when checking the number of colors, the number of gradations used for each color component is also checked at the same time. As a result, if the number of gradations used in any color component is less than the number of gradations assigned to that component, the number of unused gradations is used to determine the number of allocations of other components. Recalculate. For example, if only two gradations are used in the blue component, it is not necessary to allocate 6 gradations to all components, and 11 gradations can be allocated to red and green components (2 × 11 × 11 = 242). By doing so, useless allocation can be eliminated and the result can be output at higher speed.

【0021】請求項4の変換装置の作用について説明す
る。請求項4の変換装置では、上記のどれかの変換装置
で得られた画像で使われている色数が使用可能な色数よ
り少ない場合、余った色に原画像中における出現頻度の
高い色の順に割り当て、出力画像の対応点をその色で置
き換える。
The operation of the converter of claim 4 will be described. The conversion device according to claim 4, wherein when the number of colors used in the image obtained by any one of the above conversion devices is less than the number of colors that can be used, the surplus color is a color having a high appearance frequency in the original image. , And replace the corresponding points in the output image with the color.

【0022】[0022]

【実施例】図4は本発明の第1実施例の構成を示す図で
ある。同図において、1は入力画像用ファイル、2は出
力画像用ファイル、3は変換手段、4は階調決定手段、
5は使用色数計測手段、6は階調数決定手段、7は階調
数増加手段、8は制御手段、9は記憶手段をそれぞれ示
している。
FIG. 4 is a diagram showing the configuration of the first embodiment of the present invention. In the figure, 1 is an input image file, 2 is an output image file, 3 is conversion means, 4 is gradation determination means,
Reference numeral 5 is a used color number measuring means, 6 is a gradation number determining means, 7 is a gradation number increasing means, 8 is a controlling means, and 9 is a storing means.

【0023】本発明を実施する手段は、計算機とプログ
ラムによって実現することが出来る。第1実施例におい
て、変換手段3や階調決定手段4,使用色数計測手段
5,階調数決定手段6,階調数増加手段7などはサブル
ーチンに相当し、制御手段8はメイン・ルーチンに相当
する。
The means for carrying out the present invention can be realized by a computer and a program. In the first embodiment, the converting means 3, the gradation determining means 4, the used color number measuring means 5, the gradation number determining means 6, the gradation number increasing means 7, etc. correspond to a subroutine, and the control means 8 is a main routine. Equivalent to.

【0024】出力画像で使用可能な最大色数は外部から
与えられる。階調数決定手段6は、使用可能な最大色数
から、各色成分に割り当てる階調数を決定する。例え
ば、使用可能な最大色数が256の場合には、R成分,
G成分,B成分の階調数はそれぞれ6とされる。本実施
例では、全ての成分を均等に扱っているが、画像への影
響が大きい色成分を優先させても良い。例えば、人間の
目は緑色に一番敏感に作用し、次に赤色に敏感に作用
し、青色には余り敏感に作用しないので、緑色に対する
階調数を一番多くし、次に赤色に対する階調数を多く
し、青色に対する階調数を一番少なくすることも出来
る。
The maximum number of colors that can be used in the output image is given externally. The gradation number determining means 6 determines the number of gradations assigned to each color component from the maximum number of colors that can be used. For example, when the maximum number of colors that can be used is 256, the R component,
The number of gradations of the G component and the B component is 6, respectively. In this embodiment, all the components are treated equally, but the color components that have a great influence on the image may be prioritized. For example, the human eye is most sensitive to green, then red, and less sensitively to blue, so the number of gray levels for green is the highest, and the level for red is second. It is also possible to increase the number of tones and minimize the number of tones for blue.

【0025】階調決定手段4は、従来のものと同様に、
与えられた階調数に従って使用する階調を決定する。6
階調の場合には、使用する階調を例えば0,51,10
2,153,204,255とする。使用色数計測手段
5は、階調決定手段4で決められた階調だけを使うよう
に入力画像を変換した場合に、変換された画像の中で使
用されている色数を計測する。階調数増加手段7は、色
成分のどれかの階調数を増加させる。本実施例では、す
べての成分を均等に扱っているが、画像への影響が大き
い色成分を優先させても良い。
The gradation determining means 4 is the same as the conventional one.
The gradation to be used is determined according to the given gradation number. 6
In the case of gradation, the gradation to be used is, for example, 0, 51, 10
2,153,204,255. The used color number measuring unit 5 measures the number of colors used in the converted image when the input image is converted so that only the gradation determined by the gradation determining unit 4 is used. The gradation number increasing means 7 increases the gradation number of any of the color components. In this embodiment, all the components are treated equally, but the color components that have a great influence on the image may be prioritized.

【0026】記憶手段9は、最も良い結果を出した階調
数の組合せ,色数等を記憶する。制御手段8は、変換手
段3,階調決定手段4,使用色数計測手段5,階調数決
定手段6,階調数増加手段7に対する処理依頼を行うと
共に、記憶手段8に対するリード/ライトなどを行う。
変換手段3は、従来のものと同一である。
The storage means 9 stores the combination of the number of gradations, the number of colors, etc., which gives the best result. The control unit 8 requests the conversion unit 3, the gradation determination unit 4, the used color number measurement unit 5, the gradation number determination unit 6, and the gradation number increase unit 7 to perform processing, and reads / writes the storage unit 8. I do.
The conversion means 3 is the same as the conventional one.

【0027】図5は第1実施例の制御手段による動作フ
ローを示す図である。ステップS1では、ファイル1か
ら入力画像を読み込む。ステップS2では、出力画像で
使用可能な色数を得る。ステップS3では、階調数決定
手段6を呼び出して、各色成分に割り当てられる階調数
を求める。次いで、階調決定手段4を呼び出して、現在
の階調数に基づく、階調を決定する。ステップS4で
は、使用色数計測手段5を呼び出して、現在の階調数
(階調)で使用される色数を求める。
FIG. 5 is a diagram showing an operation flow by the control means of the first embodiment. In step S1, the input image is read from the file 1. In step S2, the number of colors usable in the output image is obtained. In step S3, the gradation number determining unit 6 is called to obtain the gradation number assigned to each color component. Next, the gradation determining means 4 is called to determine the gradation based on the current number of gradations. In step S4, the number-of-used-colors measuring means 5 is called to obtain the number of colors used at the current number of gradations (gradation).

【0028】ステップS5では、ステップS4で得られ
た色数が所定値(例えば256)をオーバしたか否かを
調べる。YESの場合はステップS8に進み、NOの場
合はステップS6に進む。ステップS6では、現在の階
調数や色数などを記憶手段9に記憶させる。ステップS
7では、階調数増加手段7を呼び出して、何れかの階調
数を1だけ増加させる。次に、階調決定手段4を呼び出
して、階調数が増加された色成分の階調を求める。次
に、ステップS4に戻る。
In step S5, it is checked whether or not the number of colors obtained in step S4 exceeds a predetermined value (for example, 256). If YES, the process proceeds to step S8, and if NO, the process proceeds to step S6. In step S6, the current number of gradations and the number of colors are stored in the storage unit 9. Step S
In step 7, the gradation number increasing means 7 is called to increase one of the gradation numbers. Next, the gradation determining unit 4 is called to obtain the gradation of the color component with the increased number of gradations. Then, the process returns to step S4.

【0029】ステップS8では、記憶している階調数を
通信領域に設定して階調決定手段4を起動し、記憶して
いる階調数での階調を得る。ステップS9,S10で
は、変換手段3を呼び出して、入力画像の各点の色を置
き換え、その結果得られる画像をファイル2に出力す
る。
In step S8, the stored gradation number is set in the communication area and the gradation determining means 4 is activated to obtain the gradation with the stored gradation number. In steps S9 and S10, the conversion means 3 is called to replace the color of each point of the input image, and the resulting image is output to the file 2.

【0030】図6は第1実施例の階調数決定手段の動作
フローを示す図である。ステップS1では、使用可能な
色数の1/3乗を整数化する。ステップS2では、その
結果が0になるか否かを調べる。0でない場合はステッ
プS3に進み、0の場合はステップS4に進む。ステッ
プSS3では、その値を階調数とする。ステップS4で
は、エラーを出力して変換処理を中止する。
FIG. 6 is a diagram showing an operation flow of the gradation number determining means of the first embodiment. In step S1, the 1/3 power of the number of usable colors is converted into an integer. In step S2, it is checked whether or not the result becomes 0. If it is not 0, the process proceeds to step S3, and if it is 0, the process proceeds to step S4. In step SS3, that value is set as the number of gradations. In step S4, an error is output and the conversion process is stopped.

【0031】図7は第1実施例の階調数増加手段の動作
フローを示す図である。ステップS1では、階調数が一
番少ない色成分を求める。ステップS2では、ステップ
S1で求めた色成分が複数個あるか否かを調べ、1個の
場合はステップS3に進み、複数個の場合はステップS
4に進む。ステップS3では、その色成分の階調数を一
つ増やす。ステップS4では、そのうちの一つを選択
し、選択した色成分の階調数を一つ増やす。
FIG. 7 is a diagram showing an operation flow of the gradation number increasing means of the first embodiment. In step S1, the color component having the smallest number of gradations is obtained. In step S2, it is checked whether or not there are a plurality of color components obtained in step S1. If there is one, the process proceeds to step S3.
Go to 4. In step S3, the number of gradations of the color component is increased by one. In step S4, one of them is selected and the number of gradations of the selected color component is increased by one.

【0032】図8は第1実施例の使用色数計測手段の動
作フローを示す図である。ステップS1では、全ての可
能な色にフラグを用意し、クリアする。例えば、R成
分,G成分,B成分の階調数が6で、且つ使用階調が
0,51,102,153,204,255の場合に
は、可能な色は、 1番目の色 R=0,G=0,B=0 2番目の色 R=0,G=0,B=51 3番目の色 R=0,G=0,B=102 ・ ・ 216番の色 R=255,G=255,B=255 となる。ステップS2では、決められた使用階調で、入
力画像の各点を変換する。ステップS3では、変換後の
画像において使用された色に付加されているフラグを立
てる。ステップS4では、立っているフラグの数をカウ
ントする。
FIG. 8 is a diagram showing an operation flow of the used color number measuring means of the first embodiment. In step S1, flags are prepared and cleared for all possible colors. For example, when the number of gradations of the R component, the G component, and the B component is 6, and the used gradations are 0, 51, 102, 153, 204, 255, the possible color is the first color R = 0, G = 0, B = 0 2nd color R = 0, G = 0, B = 51 3rd color R = 0, G = 0, B = 102 ... 216th color R = 255, G = 255, B = 255. In step S2, each point of the input image is converted with the determined use gradation. In step S3, a flag added to the color used in the converted image is set. In step S4, the number of standing flags is counted.

【0033】図9は本発明の第2実施例の構成を示す図
である。同図において、8′は制御手段、10は階調数
推定手段、11は入力画像使用色数計測手段をそれぞれ
示している。なお、図3と同一符号は同一物を示してい
る。
FIG. 9 is a diagram showing the configuration of the second embodiment of the present invention. In the figure, 8'denotes a control means, 10 a gradation number estimating means, and 11 an input image used color number measuring means. The same reference numerals as those in FIG. 3 indicate the same items.

【0034】出力画像が使用する最大の色数は外部から
与えられる。入力画像使用色数計測手段11は、第1の
実施例での使用色数計測手段と同様な動作を行い、入力
画像で使われている色数を計測する。階調数推定手段1
0は、使用されている色数と使用できる最大の色数とか
ら、各色成分の階調数を推定する。
The maximum number of colors used in the output image is given externally. The input image used color number measuring means 11 performs the same operation as the used color number measuring means in the first embodiment, and measures the number of colors used in the input image. Gradation number estimating means 1
A value of 0 estimates the number of gradations of each color component from the number of colors used and the maximum number of colors that can be used.

【0035】制御手段8′は、階調数推定手段10によ
って推定された階調数に基づいて使用される色数を求
め、最善の結果が得られるまで、それを繰り返す。最善
の組合せが決まったら、その階調数を使って変換手段3
を呼び出し、変換の結果得られる画像を出力する。階調
決定手段4や使用色数計測手段5,変換手段3,記憶手
段9は、第1の実施例のものと同様である。
The control means 8'determines the number of colors to be used based on the gradation number estimated by the gradation number estimating means 10 and repeats it until the best result is obtained. When the best combination is determined, the number of gradations is used to convert 3
And output the image obtained as a result of the conversion. The gradation determining means 4, the used color number measuring means 5, the converting means 3, and the storing means 9 are the same as those in the first embodiment.

【0036】図10は第2実施例の制御手段による動作
フローを示す図である。ステップS1では、ファイル1
から入力画像を読み込む。ステップS2では、使用可能
な色数を求める。使用可能な色数は例えば256であ
る。ステップS3では、入力画像使用色数計測手段11
を呼び出して、入力画像で使用されている色数を求め
る。
FIG. 10 is a diagram showing an operation flow by the control means of the second embodiment. In step S1, file 1
Read the input image from. In step S2, the number of usable colors is calculated. The number of colors that can be used is 256, for example. In step S3, the input image used color number measuring means 11 is used.
Call to obtain the number of colors used in the input image.

【0037】ステップS4では、階調数推定手段10を
呼び出して、各色成分の階調数を推定する。次いで、階
調決定手段4を呼び出して、推定された階調数に基づ
く、階調を決定する。ステップS5では、使用色数計測
手段5を呼び出して、現在の階調数(階調)で使用され
る色数を求める。
In step S4, the gradation number estimating means 10 is called to estimate the gradation number of each color component. Next, the gradation determining means 4 is called to determine the gradation based on the estimated number of gradations. In step S5, the used color number measuring means 5 is called to obtain the number of colors used in the current number of gradations (gradation).

【0038】ステップS6では、ステップS5で求めた
色数が最大か否かを調べる。YESの場合はステップS
10に進み、NOの場合はステップS7に進む。例え
ば、使用可能な色数が256の場合は、最大数は256
となる。ステップS7では、色数がオーバしているか否
かを調べる。YESの場合はステップS4に戻り、NO
の場合はステップS8に進む。
In step S6, it is checked whether the number of colors obtained in step S5 is maximum. If YES, step S
If NO, proceed to step S7. For example, if the number of colors available is 256, the maximum number is 256.
Becomes In step S7, it is checked whether the number of colors is over. If YES, then return to step S4, NO
In the case of, it progresses to step S8.

【0039】ステップS8では、色数が最善値を更新し
たか否かを調べる。YESの場合はステップS9に進
み、NOの場合はステップS10に進む。例えば、使用
可能な色数が256の場合、直前にステップS5で求め
た色数が200で、今回ステップS5で求めた色数が2
10の場合には、最善値を更新したことになる。ステッ
プS9では、現在の各色成分の階調数,色数を記憶す
る。次に、ステップS4に戻る。
In step S8, it is checked whether or not the number of colors has updated its optimum value. If yes, then continue with step S9; if no, continue with step S10. For example, when the number of colors that can be used is 256, the number of colors obtained in step S5 immediately before is 200, and the number of colors obtained in step S5 this time is 2
In the case of 10, the best value has been updated. In step S9, the current gradation number and color number of each color component are stored. Then, the process returns to step S4.

【0040】ステップS10では、最善値を更新しない
場合には、記憶している階調数を通信領域に設定して階
調決定手段4を起動し、記憶している階調数に基づく階
調を得る。色数が最大数と判定された場合には、その時
点の階調数を通信領域に設定して階調決定手段4を起動
し、最大数と判定された時点での階調数に基づく階調を
得る。ステップS11,S12では、変換手段3を呼び
出して、入力画像の各点の色を置き換え、変換の結果得
られる画像をファイル2に出力する。
In step S10, if the optimum value is not updated, the stored gradation number is set in the communication area and the gradation determining means 4 is activated to execute gradation based on the stored gradation number. To get When it is determined that the number of colors is the maximum number, the number of gradations at that time is set in the communication area and the gradation determining means 4 is activated, and the floor based on the number of gradations at the time when the maximum number is judged. Get the key. In steps S11 and S12, the conversion means 3 is called to replace the color of each point of the input image, and the image obtained as a result of the conversion is output to the file 2.

【0041】図11は第2実施例の階調数推定手段の動
作フローを示す図である。ステップS1では、現在使用
されている色数で使用可能な色数を割り、商(Dとす
る)を求める。例えば、入力画像で使用されている色数
が10000で、使用可能な色数が256の場合には、
256/10000を求める。なお、対象とする画像は
最初は入力画像になり、その後は変換画像となる。
FIG. 11 is a diagram showing an operation flow of the gradation number estimating means of the second embodiment. In step S1, the number of colors available is divided by the number of colors currently used to obtain a quotient (denoted as D). For example, if the number of colors used in the input image is 10,000 and the number of colors available is 256,
Calculate 256/10000. Note that the target image is initially the input image and then the converted image.

【0042】ステップS2では、商の1/3乗
(D1/3 )を係数とする。ステップS3では、各色成分
の階調数に係数を掛けて整数化する。ステップS4で
は、元の階調数と変わらないか否かを調べる。変わらな
い場合はステップS5に進み、変わる場合はエンドとす
る。
In step S2, the quotient is the 1/3 power (D 1/3 ) as a coefficient. In step S3, the gradation number of each color component is multiplied by a coefficient to be an integer. In step S4, it is checked whether the number of gradations is the same as the original number. If it does not change, the process proceeds to step S5, and if it does change, the process ends.

【0043】ステップS5では、係数が1より大きいか
否かを調べる。YESの場合はステップS7に進み、N
Oの場合はステップS6に進む。ステップS6では、色
成分のどれかを減らす。ステップS7では、色成分のど
れかを増やす。
In step S5, it is checked whether the coefficient is larger than 1. If YES, proceed to step S7, N
In the case of O, the process proceeds to step S6. In step S6, one of the color components is reduced. In step S7, one of the color components is increased.

【0044】本発明の第3実施例について説明する。第
3実施例の構成は第2実施例の構成と同じである。第3
実施例における入力画像使用色数計測手段は、第2実施
例のものに加えて、入力画像で使われている各色成分の
階調の数も計測する。第3実施例における階調数推定手
段は、使用されている色と,使用できる最大の色数と,
使用される各色成分の階調の数とから、各色成分の階調
数を推定する。制御手段,階調決定手段,使用色数計測
手段,変換手段,記憶手段は、第2実施例のものと同様
である。
A third embodiment of the present invention will be described. The configuration of the third embodiment is the same as that of the second embodiment. Third
The input image used color number measuring means in the embodiment also measures the number of gradations of each color component used in the input image in addition to that in the second embodiment. The gradation number estimating means in the third embodiment uses the used colors, the maximum number of colors that can be used,
The number of gradations of each color component is estimated from the number of gradations of each color component used. The control means, the gradation determining means, the used color number measuring means, the converting means, and the storing means are the same as those in the second embodiment.

【0045】図12は第3実施例の階調数推定手段の動
作フローを示す図である。ステップS1では、現在使用
されている色数で使用可能な色数を割り、商(Dとす
る)を係数とする。例えば、入力画像で実際に使用され
ている色数が786432(1024×768)で、使
用可能な色数が256の場合には、256/78643
2が係数となる。なお、表示画面は1024×768=
786432であり、値が等しい画素が存在しないと仮
定すると、入力画像で使用されている色の数は7864
32となる。
FIG. 12 is a diagram showing an operation flow of the gradation number estimating means of the third embodiment. In step S1, the number of colors that can be used is divided by the number of colors that are currently used, and the quotient (denoted as D) is used as a coefficient. For example, when the number of colors actually used in the input image is 786432 (1024 × 768) and the number of colors that can be used is 256, 256/78643
2 is a coefficient. The display screen is 1024 × 768 =
786432, and assuming that there are no pixels of equal value, the number of colors used in the input image is 786432.
32.

【0046】ステップS2では、各色成分の階調数に係
数の1/3乗を掛けて、整数化する。カラー原画像の画
素の色成分が0ないし255の内のいずれかの値を取り
得ると仮定すると、各色成分の階調数の初期値は25
6,256,256となる。係数が256/78643
2の場合は、係数の1/3乗は1/14.5になり、入
力画像の各色成分の階調数=256に1/14.5を掛
けて整数化すると、各色成分の階調数は17になる。ス
テップS3では、入力画像で使用されるいる階調数の方
が少ないか否かを調べる。YESの場合はステップS4
に進み、NOの場合はステップS7に進む。例えば、入
力画像ではR成分の取り得る256個の階調のうちで1
0個の階調が使用されており、ステップS2で求めたR
成分の階調数が17の場合には、入力画像で使用されて
いる階調数の方が少ないことになる。
In step S2, the gradation number of each color component is multiplied by the coefficient to the 1/3 power to make it an integer. Assuming that the color component of the pixel of the color original image can take any value from 0 to 255, the initial value of the gradation number of each color component is 25.
It becomes 6,256,256. Coefficient is 256/78643
In the case of 2, the 1/3 power of the coefficient becomes 1 / 14.5, and when the gradation number of each color component of the input image = 256 is multiplied by 1 / 14.5 to be an integer, the gradation number of each color component is obtained. Becomes 17. In step S3, it is checked whether or not the number of gradations used in the input image is smaller. If YES, step S4
If NO, proceed to step S7. For example, in the input image, 1 out of 256 possible gradations of the R component
0 gradations are used, and R obtained in step S2
When the number of gradations of the component is 17, the number of gradations used in the input image is smaller.

【0047】ステップS4では、入力画像で使用されて
いる階調数の方が少ない色成分については、それらの色
成分の階調数を入力画像で使用されている階調数にす
る。例えば、入力画像でR成分の取り得る256個の階
調のうちで10個の階調が使用されており、ステップS
2で求めたR成分の階調数が17の場合は、R成分の階
調数を10にする。ステップS5では、変化させる成分
の数をnとする。例えば、R成分についてのみ、入力画
像で使用されているR成分の階調数がステップS2で求
めた階調数よりも少ない場合には、nは2となる。
In step S4, for color components having a smaller number of gradations used in the input image, the number of gradations of those color components is set to the number of gradations used in the input image. For example, of the 256 possible gradations of the R component in the input image, 10 gradations are used.
When the number of R component gradations obtained in 2 is 17, the number of R component gradations is set to 10. In step S5, the number of components to be changed is n. For example, when the number of gradations of the R component used in the input image is smaller than the number of gradations obtained in step S2 only for the R component, n is 2.

【0048】ステップS6では、変化させる成分の階調
数に補正された係数の1/n乗を掛けて整数化する。例
えば、R成分の取り得る階調数が256であり、R成分
の256個の階調のうち実際に使用されている階調が1
0個であり、係数が256/786432である場合に
は、補正された係数は256÷10×256÷7864
32になる。補正された係数の平方根を取ると、1/1
1になる。G成分の階調数256に1/11を掛けて整
数化すると23になり、B成分の階調数256に1/1
1を掛けて整数化すると23になる。したがって、R成
分の階調数=10、G成分の階調数=23、B成分の階
調数=23が得られる。
In step S6, the gradation number of the component to be changed is multiplied by the corrected coefficient to the power of 1 / n to be an integer. For example, the number of gradations that the R component can take is 256, and of the 256 gradations of the R component, the gradation that is actually used is 1.
When the number is 0 and the coefficient is 256/786432, the corrected coefficient is 256 ÷ 10 × 256 ÷ 7864.
32. Taking the square root of the corrected coefficient, it is 1/1
Becomes 1. When the gradation number 256 of the G component is multiplied by 1/11, and it is an integer, it becomes 23, and the gradation number 256 of the B component is 1/1.
Multiplying by 1 to make an integer gives 23. Therefore, the gradation number of the R component = 10, the gradation number of the G component = 23, and the gradation number of the B component = 23 are obtained.

【0049】ステップS7では、もとの階調数と変わる
か否かを調べる。変わる場合はエンドとし、変わらない
場合はステップS8に進む。ステップS8では、係数が
1よりも大きいか否かを調べる。YESの場合はステッ
プS10に進み、NOの場合はステップS9に進む。ス
テップS9では、どれかの成分の階調数を1だけ減ら
す。ステップS10では、どれかの成分の階調数を1だ
け増やす。
In step S7, it is checked whether or not the original gradation number is different. If it changes, the process ends. If it does not change, the process proceeds to step S8. In step S8, it is checked whether the coefficient is larger than 1. If YES, the process proceeds to step S10, and if NO, the process proceeds to step S9. In step S9, the number of gradations of any component is reduced by 1. In step S10, the number of gradations of any component is increased by 1.

【0050】図13は第3実施例の使用色数計測手段の
動作フローを示す図である。なお、入力画像使用色数計
測手段の動作フローは図13の使用色数の動作フローと
同様であり、入力画像における使用色数を計測する場合
には、変換手段が使用できる階調と入力画像で使用でき
る階調とを同じとする。このようにすると、入力画像が
変換手段をスルーで通り抜ける。
FIG. 13 is a diagram showing the operation flow of the used color number measuring means of the third embodiment. The operation flow of the input image used color number measuring means is the same as the operation flow of the used color number in FIG. 13, and when measuring the used color number in the input image, the gradation and the input image which can be used by the conversion means are measured. The same gradations that can be used in. In this way, the input image passes through the conversion means through.

【0051】ステップS1では、全ての可能な色にフラ
グを用意し、クリアする。例えば、R成分の取り得る階
調の個数が256、G成分の取り得る階調の個数が25
6、B成分の取り得る階調の個数が256の場合には、
全ての可能な色数は256×256×256=1677
7216になる。また、R成分の取り得る階調の個数が
6、G成分の取り得る階調の個数が6、B成分の取り得
る階調の個数が6の場合には、全ての可能な色数は6×
6×6=216になる。
In step S1, flags are prepared and cleared for all possible colors. For example, the number of gradations that the R component can take is 256, and the number of gradations that the G component can take is 25.
6, when the number of gradations that the B component can take is 256,
All possible colors are 256 x 256 x 256 = 1677
7216. Further, when the number of gradations that the R component can take is 6, the number of gradations that the G component can take is 6 and the number of gradations that the B component can take, the total number of possible colors is 6. ×
6 × 6 = 216.

【0052】ステップS2では、各成分毎に各階調にフ
ラグを用意し、クリアする。例えば、R成分の階調が
0,1,…,255の場合には、0,1,…,255毎
にフラグを用意する。G成分,B成分についても同様で
ある。
In step S2, a flag is prepared for each gradation for each component and cleared. For example, when the gradation of the R component is 0, 1, ..., 255, a flag is prepared for each 0, 1 ,. The same applies to the G and B components.

【0053】ステップS3では、決められた階調で入力
画像の各点を変換する。例えば、256階調を6階調に
変換する場合に、 0ないし42を0 43ないし84を51 85ないし127を102 128ないし169を153 170ないし212を204 213ないし255を255 に変換すると仮定する。このよう場合には、R=50,
G=100,B=200の色は、R=51,G=10
2,B=204の色に変換される。なお、入力画像にお
ける使用色数を計測する場合には、0,1,…255の
256階調を、0,1,…,255の256階調に変換
するとすれば良い。
In step S3, each point of the input image is converted with the determined gradation. For example, when converting 256 gradations to 6 gradations, it is assumed that 0 to 42 are converted to 0 43 to 84, 51 85 to 127 are 102 128 to 169, 153 170 to 212 are converted to 204 213 to 255, and 255 are converted to 255. . In such a case, R = 50,
Colors with G = 100 and B = 200 have R = 51 and G = 10.
2, the color is converted to B = 204. When measuring the number of colors used in the input image, 256 gradations of 0, 1, ..., 255 may be converted into 256 gradations of 0, 1 ,.

【0054】ステップS4では、変換画像(変換手段の
出力画像)において使用されている色にフラグを立て
る。例えば、変換画像において、R=50,G=10
0,B=200の色が使用されていたと仮定すると、R
=50,G=100,B=200の色に対応するフラグ
を1にする。ステップS5では、各成分毎に使用された
階調のフラグを立てる。例えば、R=50,G=10
0,B=200の色が使用されていたと仮定すると、R
=50のフラグを1にし、G=100のフラグを1に
し、B=200のフラグを1にする。ステップS6で
は、立っているフラグの数をカウントする。
In step S4, a flag is set for the color used in the converted image (output image of the converting means). For example, in the converted image, R = 50, G = 10
Assuming that 0, B = 200 colors were used, then R
The flags corresponding to the colors of = 50, G = 100, B = 200 are set to 1. In step S5, a flag of the gradation used for each component is set. For example, R = 50, G = 10
Assuming that 0, B = 200 colors were used, then R
The flag of = 50 is set to 1, the flag of G = 100 is set to 1, and the flag of B = 200 is set to 1. In step S6, the number of standing flags is counted.

【0055】図14は本発明の第4実施例の構成を示す
図である。同図において、8″は制御手段、12は使用
色頻度計測手段、13は置換手段をそれぞれ示してい
る。なお、図9と同一符号は同一物を示している。使用
色頻度計測手段12は、入力画像に使われている色をカ
ウントし、それを出現頻度に並べるものである。置換手
段13は、変換手段3が出力した画像が使っている色数
が最大数よりも少ない場合、余っている数だけ頻度の高
い色を求め、出力画像中で代用されているそれらの色を
置き換えるものである。制御手段8″は、最適と判定さ
れた階調数で入力画像を変換するための一連の処理を行
った後で、使用色頻度計測手段12を呼び出し、次いで
置換手段13を呼び出し、置換手段13で置換された画
像をファイル2に出力する処理を行う。
FIG. 14 is a diagram showing the configuration of the fourth embodiment of the present invention. In the figure, 8 ″ indicates a control unit, 12 indicates a used color frequency measuring unit, and 13 indicates a replacing unit. The same reference numerals as those in FIG. 9 indicate the same items. The number of colors used in the input image is counted, and the colors are arranged in order of appearance frequency.When the number of colors used in the image output by the conversion unit 3 is less than the maximum number, the replacement unit 13 has a surplus. The number of colors that are frequently used is calculated and the colors that are substituted in the output image are replaced. The control means 8 ″ is for converting the input image with the optimum number of gradations. After performing a series of processing, the used color frequency measuring means 12 is called, then the replacing means 13 is called, and the image replaced by the replacing means 13 is output to the file 2.

【0056】図15は第4実施例の使用色頻度計測手段
の動作フローを示す図である。ステップS1では、全て
の可能な色にカウンタを用意し、クリアする。入力画像
のR成分が256階調,G成分が256階調,B成分が
256階調の場合は、全ての可能な色の個数は256×
256×256=16777216となる。ステップS
2では、入力画像の各画素毎に、該当する色のカウンタ
の値を増加させる。ステップS3では、カウンタの値で
各色をソートする。
FIG. 15 is a diagram showing an operation flow of the used color frequency measuring means of the fourth embodiment. In step S1, counters are prepared and cleared for all possible colors. When the R component of the input image has 256 gradations, the G component has 256 gradations, and the B component has 256 gradations, the number of all possible colors is 256 ×.
It becomes 256 × 256 = 167777216. Step S
In 2, the value of the counter of the corresponding color is increased for each pixel of the input image. In step S3, each color is sorted by the value of the counter.

【0057】図16は第4実施例の置換手段の動作フロ
ーを示す図である。ステップS1では、出力画像でまだ
使用可能な色数を求める。例えば、使用可能な色数が2
56であり、出力画像で使用されるいる色の数が216
の場合は、まだ使用可能な色数は40となる。ステップ
S2では、入力画像の使用色頻度を求め、高い順に置き
換える色とする。ステップS3では、入力画像の各画素
を調べ、置き換える色ならば、出力画像の対応する画素
の値を置き換える。例えば、R=50,G=100,B
=200の色が置き換える色であり、入力画像の第10
0行第500列の画素の色がR=50,G=100,B
=200であった場合には、出力画像の第100行第5
00列の色の値をR=50,G=100,B=200に
置き換える。
FIG. 16 is a diagram showing an operation flow of the replacing means of the fourth embodiment. In step S1, the number of colors still usable in the output image is obtained. For example, the number of colors that can be used is 2
56, and the number of colors used in the output image is 216
In this case, the number of colors that can still be used is 40. In step S2, the used color frequency of the input image is obtained, and the replacement color is set in descending order. In step S3, each pixel of the input image is examined, and if it is a color to be replaced, the value of the corresponding pixel of the output image is replaced. For example, R = 50, G = 100, B
= 200 is the color to be replaced and is the 10th color of the input image.
The color of the pixel in the 0th row and the 500th column is R = 50, G = 100, B
= 200, the 100th line, 5th line of the output image
Replace the color values in column 00 with R = 50, G = 100, B = 200.

【0058】[0058]

【発明の効果】以上の説明から明らかなように、本発明
によれば、変換された画像は従来の方法の画像に比べて
使用される色数が多く、また原画像に値が近い色が選ば
れていることになるので、原画像により近い内容を表現
できる。このため、従来では別の表示装置を必要とした
画像でも、通常の表示装置だけで良好な出力結果が得ら
れる。
As is apparent from the above description, according to the present invention, the converted image has a larger number of colors used as compared with the image obtained by the conventional method, and the color whose value is close to that of the original image is obtained. Since it has been selected, the content closer to the original image can be expressed. Therefore, a good output result can be obtained with only a normal display device even for an image which conventionally requires another display device.

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

【図1】請求項1の発明の原理説明図である。FIG. 1 is a diagram illustrating the principle of the invention of claim 1;

【図2】請求項2,3の発明の原理説明図である。FIG. 2 is a diagram for explaining the principle of the invention of claims 2 and 3.

【図3】請求項4の発明の原理説明図である。FIG. 3 is a diagram illustrating the principle of the invention of claim 4;

【図4】本発明の第1実施例の構成を示す図である。FIG. 4 is a diagram showing a configuration of a first exemplary embodiment of the present invention.

【図5】第1実施例の制御手段の動作フローを示す図で
ある。
FIG. 5 is a diagram showing an operation flow of the control means of the first embodiment.

【図6】第1実施例の階調数決定手段の動作フローを示
す図である。
FIG. 6 is a diagram showing an operation flow of a gradation number determining means of the first embodiment.

【図7】第1実施例の階調数増加手段の動作フローを示
す図である。
FIG. 7 is a diagram showing an operation flow of a gradation number increasing means of the first embodiment.

【図8】第1実施例の使用色数計測手段の動作フローを
示す図である。
FIG. 8 is a diagram showing an operation flow of a used color number measuring means of the first embodiment.

【図9】本発明の第2実施例の構成を示す図である。FIG. 9 is a diagram showing a configuration of a second exemplary embodiment of the present invention.

【図10】第2実施例の制御手段の動作フローを示す図
である。
FIG. 10 is a diagram showing an operation flow of the control means of the second embodiment.

【図11】第2実施例の階調数推定手段の動作フローを
示す図である。
FIG. 11 is a diagram showing an operation flow of a gradation number estimating means of the second embodiment.

【図12】第3実施例の階調数推定手段の動作フローを
示す図である。
FIG. 12 is a diagram showing an operation flow of a gradation number estimating means of a third embodiment.

【図13】第3実施例の使用色数計測手段の動作フロー
を示す図である。
FIG. 13 is a diagram showing an operation flow of a used color number measuring means of the third embodiment.

【図14】本発明の第4実施例の構成を示す図である。FIG. 14 is a diagram showing a configuration of a fourth exemplary embodiment of the present invention.

【図15】第4実施例の使用色頻度計測手段の動作フロ
ーを示す図である。
FIG. 15 is a diagram showing an operation flow of a used color frequency measuring unit of the fourth embodiment.

【図16】第4実施例の置換手段の動作フローを示す図
である。
FIG. 16 is a diagram showing an operation flow of a replacing means of the fourth embodiment.

【図17】従来の変換装置の構成を示す図である。FIG. 17 is a diagram showing a configuration of a conventional conversion device.

【図18】従来の変換装置の変換動作フローを示す図で
ある。
FIG. 18 is a diagram showing a conversion operation flow of a conventional conversion device.

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

1 入力画像用ファイル 2 出力画像用ファイル 3 変換手段 4 階調決定手段 5 使用色数計測手段 6 階調数決定手段 7 階調数増加手段 8 制御手段 8′ 制御手段 8″ 制御手段 9 記憶手段 10 階調数推定手段 11 入力画像使用色数計測手段 12 使用色頻度計測手段 13 置換手段 1 Input Image File 2 Output Image File 3 Converting Means 4 Gradation Determining Means 5 Number of Colors Measuring Means 6 Gradient Determining Means 7 Gradient Increasing Means 8 Control Means 8 ′ Control Means 8 ″ Control Means 9 Storage Means 10 gradation number estimating means 11 input image used color number measuring means 12 used color frequency measuring means 13 replacing means

フロントページの続き (51)Int.Cl.6 識別記号 庁内整理番号 FI 技術表示箇所 // H04N 1/60 1/46 H04N 1/40 D 1/46 Z Continuation of the front page (51) Int.Cl. 6 Identification code Office reference number FI technical display location // H04N 1/60 1/46 H04N 1/40 D 1/46 Z

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 多階調のカラー原画像を、使用可能な色
数以内の色数を持つ画像に変換する変換装置であって、 使用可能な色数に基づいて階調数を決定する階調数決定
手段と、 階調数決定手段によって階調数が決定された後に動作を
開始する最適階調数決定手段と、 最適階調数決定手段から通知された階調数に基づいて、
カラー原画像を変換し出力画像を生成する出力画像生成
手段とを具備し、 最適階調数決定手段は、 現在の階調数に基づいてカラー原画像を変換した場
合の変換画像での使用色数を求め、 変換画像での使用色数が使用可能な色数を越えてい
るか否かを調べ、越えている場合は、その直前の階調数
を出力画像生成手段に通知して起動し、 越えていない場合は、現在の階調数を記憶し、階調
数を増加させ、の処理に戻る 処理を行うよう構成されていることを特徴とする多階調
画像の変換装置。
1. A conversion device for converting a multi-gradation color original image into an image having the number of colors within the usable number of colors, wherein the number of gradations is determined based on the number of usable colors. Based on the number of gradations notified from the optimum number of gradations determining means, the optimum number of gradations determining means for starting the operation after the number of gradations is determined by the number of gradations determining means,
And an output image generating means for converting the color original image to generate an output image. The optimum gradation number determining means is a color used in the converted image when the color original image is converted based on the current gradation number. Calculate the number, check whether the number of colors used in the converted image exceeds the number of colors that can be used, and if it exceeds, notify the output image generation means of the number of gradations immediately before and start it. A multi-gradation image conversion device configured to store the current number of gradations, increase the number of gradations, and return to the process when the number of gradations is not exceeded.
【請求項2】 多階調のカラー原画像を、使用可能な色
数以内の色数を持つ画像に変換する変換装置であって、 多階調のカラー原画像で使用されている色数を計測する
入力画像使用色数計測手段と、 入力画像使用色数計測手段によって色数が計測された後
に動作を開始する最適階調数決定手段と、 最適階調数決定手段から通知された階調数に基づいて、
カラー原画像を変換し出力画像を生成する出力画像生成
手段とを具備し、 最適階調数決定手段は、 現在の色数,変換画像での使用可能な色数および現
在の階調数に基づいて新たな階調数を推定し、推定した
階調数に基づいてカラー原画像を変換し、変換画像での
使用色数を求め、 変換画像での使用色数が使用可能な色数と等しいか
否かを調べ、等しい場合には、現在の階調数を出力画像
生成手段に通知して起動し、 変換画像での使用色数が使用可能な色数と等しくな
い場合には、変換画像での使用色数が使用可能な色数を
越えているか否かを調べ、越えている場合はの処理に
戻り、 変換画像での使用色数が使用可能な色数を越えてい
ない場合は、変換画像での使用色数が直前の使用色数を
越えたか否かを調べ、変換画像での使用色数が直前の使
用色数を越えない場合は、直前の階調数を出力画像生成
手段に通知して起動し、 変換画像での使用色数が直前の使用色数を越えた場
合は、現在の階調数および色数を記憶して、の処理に
戻る 処理を行うよう構成されていることを特徴とする多階調
画像の変換装置。
2. A conversion device for converting a multi-tone color original image into an image having a color number within the usable color number, wherein the number of colors used in the multi-tone color original image is An input image used color number measuring means for measuring, an optimum gradation number determining means for starting operation after the color number is measured by the input image used color number measuring means, and a gradation notified from the optimum gradation number determining means Based on the number
And an output image generation means for converting the color original image to generate an output image, wherein the optimum gradation number determination means is based on the current number of colors, the number of colors usable in the converted image and the current number of gradations. , The new number of gradations is estimated, the original color image is converted based on the estimated number of gradations, the number of colors used in the converted image is calculated, and the number of colors used in the converted image is equal to the number of colors that can be used. If it is equal, the current number of gradations is notified to the output image generation means to start up. If the number of colors used in the converted image is not equal to the number of usable colors, the converted image is displayed. Check to see if the number of colors used in exceeds the number of colors that can be used. If it exceeds, return to the process of. If the number of colors used in the converted image does not exceed the number of colors that can be used, Check whether the number of colors used in the converted image exceeds the number of colors used immediately before, and determine the number of colors used in the converted image directly. If the number of used colors does not exceed the number of gradations used immediately before, the output image generation means is notified, and the number of used colors in the converted image exceeds the number of colors used immediately before. A multi-gradation image conversion device, which is configured to store the number of colors and the number of colors and return to the process.
【請求項3】 多階調のカラー原画像を、使用可能な色
数以内の色数を持つ画像に変換する変換装置であって、 多階調のカラー原画像で使用されている色数を計測する
と共に、各色成分毎の階調数を計測する入力画像使用色
数計測手段と、 入力画像使用色数計測手段よって色数および各色成分毎
の階調数が計測された後に動作を開始する最適階調数決
定手段と、 最適階調数決定手段から通知された各色成分毎の階調数
の組に基づいて、カラー原画像を変換し出力画像を生成
する出力画像生成手段とを具備し、 最適階調数決定手段は、 現在の色数,変換画像での使用可能な色数,現在の
各色成分毎の階調数およびカラー原画像における各色成
分毎の階調数に基づいて、新たな各色成分毎の階調数の
組を推定し、推定した各色成分毎の階調数の組に基づい
てカラー原画像を変換し、変換画像での使用色数を求
め、 変換画像での使用色数が使用可能な色数と等しいか
否かを調べ、等しい場合には、現在の各色成分毎の階調
数の組を出力画像生成手段に通知して出力画像生成手段
を起動し、 変換画像での使用色数が使用可能な色数と等しくな
い場合には、変換画像での使用色数が使用可能な色数を
越えているか否かを調べ、越えている場合はの処理に
戻り、 変換画像での使用色数が使用可能な色数を越えてい
ない場合は、変換画像での使用色数が直前の使用色数を
越えたか否かを調べ、変換画像での使用色数が直前の使
用色数を越えない場合は、直前の各色成分毎の階調数の
組を出力画像生成手段に通知して起動し、 変換画像での使用色数が直前の使用色数を越えた場
合は、現在の各色成分毎の階調数の組および色数を記憶
して、の処理に戻る 処理を行うよう構成されていることを特徴とする多階調
画像の変換装置。
3. A conversion device for converting a multi-tone color original image into an image having the number of colors within the usable color number, wherein the number of colors used in the multi-tone color original image is The operation is started after the color number and the gradation number for each color component are measured by the input image used color number measuring means for measuring and measuring the gradation number for each color component, and the input image used color number measuring means. An optimum gradation number determining means and an output image generating means for converting an original color image to generate an output image based on a set of gradation numbers for each color component notified from the optimum gradation number determining means. The optimum gradation number determining means is based on the current number of colors, the number of colors usable in the converted image, the current number of gradations for each color component, and the number of gradations for each color component in the color original image. Estimate the set of gradation numbers for each color component, and The original color image is converted based on the above, the number of colors used in the converted image is calculated, and it is checked whether the number of colors used in the converted image is equal to the number of colors that can be used. If the number of colors used in the converted image is not equal to the number of colors that can be used, the output image generating means is activated by notifying the output image generating means of a set of gradation numbers for each Check whether the number exceeds the number of colors that can be used, and if it exceeds, return to the process of. If the number of colors used in the converted image does not exceed the number of colors that can be used, Check whether the number of colors used exceeds the number of colors used immediately before, and if the number of colors used in the converted image does not exceed the number of colors used immediately before, output the set of gradation numbers for each color component immediately before. If the number of colors used in the converted image exceeds the number of colors used immediately before, the current colors are displayed. Stores sets and the number of colors of gradation number per minute, a multi-tone image, characterized in that it is configured to perform processing to return to the processing conversion apparatus.
【請求項4】 出力画像生成手段によって生成された出
力画像における色数が使用可能な色数よりも少ない場合
には、カラー原画像における使用頻度の高い色を持つ画
素に対応する変換画像における画素の色を、カラー原画
像における当該画素の色で置き換える出力画像修正手段
を具備することを特徴とする請求項1または請求項2ま
たは請求項3の多階調画像の変換装置。
4. A pixel in a converted image corresponding to a pixel having a frequently used color in a color original image when the number of colors in the output image generated by the output image generating means is less than the number of colors available. 4. The multi-gradation image conversion apparatus according to claim 1, further comprising an output image correction unit that replaces the color of 1. with the color of the pixel in the color original image.
JP6014339A 1994-02-08 1994-02-08 Converter for multi-level image Withdrawn JPH07220070A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6014339A JPH07220070A (en) 1994-02-08 1994-02-08 Converter for multi-level image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6014339A JPH07220070A (en) 1994-02-08 1994-02-08 Converter for multi-level image

Publications (1)

Publication Number Publication Date
JPH07220070A true JPH07220070A (en) 1995-08-18

Family

ID=11858317

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6014339A Withdrawn JPH07220070A (en) 1994-02-08 1994-02-08 Converter for multi-level image

Country Status (1)

Country Link
JP (1) JPH07220070A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005057911A1 (en) * 2003-12-08 2005-06-23 Ricoh Company, Ltd. Image processing method and apparatus, image forming apparatus and system, program and recording medium
JP2010103681A (en) * 2008-10-22 2010-05-06 Canon Inc Image processing device and method
JP2015037204A (en) * 2013-08-12 2015-02-23 キヤノン株式会社 Projection apparatus and method of controlling the same

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005057911A1 (en) * 2003-12-08 2005-06-23 Ricoh Company, Ltd. Image processing method and apparatus, image forming apparatus and system, program and recording medium
US7210757B2 (en) 2003-12-08 2007-05-01 Ricoh Compnay, Ltd. Image processing method and apparatus, image forming apparatus and system, program and recording medium
KR100749146B1 (en) * 2003-12-08 2007-08-14 가부시키가이샤 리코 Image processing method and apparatus, image forming apparatus and system, and recording medium
CN100429923C (en) * 2003-12-08 2008-10-29 株式会社理光 Image processing method and apparatus, image forming apparatus and system, program and recording medium
JP2010103681A (en) * 2008-10-22 2010-05-06 Canon Inc Image processing device and method
JP2015037204A (en) * 2013-08-12 2015-02-23 キヤノン株式会社 Projection apparatus and method of controlling the same

Similar Documents

Publication Publication Date Title
EP0594312A1 (en) Method and apparatus for converting color image data to a non-linear palette
JPH04278779A (en) Computerized method and output generating device
JPH01158487A (en) Picture processor
KR100458593B1 (en) Method and apparatus to control power of the address data for plasma display panel and a plasma display panel device having that apparatus
EP1544839A1 (en) Method and apparatus for generating look-up table data in the video picture field
JP2979485B2 (en) Method and apparatus for dithering and displaying digital images
JP2002325185A (en) Efficient method of computing gamma correction table
US20080075365A1 (en) Gamma image correction method and device
JPH07220070A (en) Converter for multi-level image
US20010003456A1 (en) Image display device
JP3694333B2 (en) Color conversion processing apparatus and method
US20030052868A1 (en) Image display unit
US7126591B2 (en) Image display device
JPH08272954A (en) Image data converting device
JP2003122323A (en) Display density converting method and display device
JP2023126059A (en) Image processing apparatus, image processing method, and program
JP3006522B2 (en) Color reduction processing device
JP3034402B2 (en) Color image reduction apparatus and method
JPH06124343A (en) Method and device for determining limited color
JPH01176561A (en) Color image processing apparatus
JPH04257984A (en) Picture output device
JP2739345B2 (en) Color correction method
US20070253619A1 (en) Color profile generating apparatus and method
JPH0816784A (en) Color information comparing and managing device
JPH0378094A (en) Picture gradient converting device

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20010508