JP2006323870A - Image subtractive color processing device, image encoding device, image decoding device, image subtractive color processing method, image encoding method and image decoding method - Google Patents

Image subtractive color processing device, image encoding device, image decoding device, image subtractive color processing method, image encoding method and image decoding method Download PDF

Info

Publication number
JP2006323870A
JP2006323870A JP2006203339A JP2006203339A JP2006323870A JP 2006323870 A JP2006323870 A JP 2006323870A JP 2006203339 A JP2006203339 A JP 2006203339A JP 2006203339 A JP2006203339 A JP 2006203339A JP 2006323870 A JP2006323870 A JP 2006323870A
Authority
JP
Japan
Prior art keywords
image
color
small area
gradations
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2006203339A
Other languages
Japanese (ja)
Inventor
Hisafumi Saika
尚史 齋鹿
Kensaku Oji
謙作 蔭地
Keisuke Iwasaki
圭介 岩崎
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.)
Sharp Corp
Original Assignee
Sharp Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sharp Corp filed Critical Sharp Corp
Priority to JP2006203339A priority Critical patent/JP2006323870A/en
Publication of JP2006323870A publication Critical patent/JP2006323870A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image subtractive color processing device capable of subtracting the number of colors of an original image with the image prevented from being deteriorated. <P>SOLUTION: The image subtractive color processing device, which outputs an input digital image data with the subtracted number of gradations, includes a dividing section 602 which divides the input image into small areas with a predetermined process, and adaptive subtractive color processing sections 616-620 which sets the number of gradations for each small area to appropriately subtract colors of each small area based on image data included in the small area. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

この発明は画像の階調数を減少させることによりデータを圧縮するための画像減色装置、画像符号化装置およびそのように圧縮された画像を復号するための画像復号装置に関し、特に、減色後の画像の劣化を防止することができる画像減色装置、画像符号化装置および画像復号装置に関する。   The present invention relates to an image color reduction device for compressing data by reducing the number of gradations of an image, an image encoding device, and an image decoding device for decoding such a compressed image, and in particular, after color reduction. The present invention relates to an image color reduction device, an image encoding device, and an image decoding device that can prevent image degradation.

データ通信およびデータ保存を行なう場合、データ量を削減することが記憶領域を節約するために望ましい。特に画像データについては、そのデータ量が多いため、データ量を削減するさまざまな技術が工夫されている。データ量の削減を目的とした画像の符号化方式には、エントロピー符号化方式と呼ばれるものがある。エントロピー符号化方式には算術符号化およびハフマン符号化などの方式が知られている。   When performing data communication and data storage, it is desirable to reduce the amount of data in order to save the storage area. In particular, since image data has a large amount of data, various techniques for reducing the amount of data have been devised. As an image encoding method for the purpose of reducing the amount of data, there is an image encoding method called an entropy encoding method. Entropy coding methods such as arithmetic coding and Huffman coding are known.

しかし、エントロピー符号化を施す前に、画像処理で画像データのデータ量自体を削減することがよく行なわれている。その代表的なものとして、多値画像を、使用目的に応じて十分な程度の階調数まで減色する方法がある。最も単純な方法は画像全体を共通の階調数まで減色することである。しかし、画像の属性は一般には全体で一様ではない。たとえば単純なテキスト画像であっても、単色の背景領域と、少なくとも2値以上の画素値が必要な文字領域とに分割される。そのため、全体を一様に減色すると、たとえば文字領域などが必要以上に減色されてしまい画像が劣化することがある。   However, before entropy coding is performed, the amount of image data itself is often reduced by image processing. As a typical example, there is a method of reducing the color of a multi-value image to a sufficient number of gradations according to the purpose of use. The simplest method is to reduce the entire image to a common number of tones. However, image attributes are generally not uniform throughout. For example, even a simple text image is divided into a monochrome background area and a character area that requires at least two or more pixel values. Therefore, if the entire color is uniformly reduced, for example, a character area may be reduced more than necessary, and the image may be deteriorated.

こうした問題を解決するために、画像をブロックなどの小領域に分割し、それぞれの小領域ごとに異なる階調数に減色する技術が開発されてきた。そのような技術の一例が特開平6−350986号公報(特許文献1)に開示されている。この公報に開示された技術では、各小領域としてブロックをとり、ブロック内の近似誤差および統計量に基づいて、ブロックごとに階調数を決定している。   In order to solve these problems, a technique has been developed in which an image is divided into small areas such as blocks, and the color is reduced to a different number of gradations for each small area. An example of such a technique is disclosed in Japanese Patent Laid-Open No. 6-350986 (Patent Document 1). In the technique disclosed in this publication, a block is taken as each small region, and the number of gradations is determined for each block based on the approximation error and statistics within the block.

他の例は特開平5−56282号公報(特許文献2)に開示されたものである。この技術は、同じくブロックごとに階調数を決定している。しかしこの場合には階調数が大きなブロックについては、その解像度を減少させている。このようにすることにより、各ブロックのデータ量が一定となる。
特開平6−350986号公報 特開平5−56282号公報
Another example is disclosed in Japanese Patent Laid-Open No. 5-56282 (Patent Document 2). This technique also determines the number of gradations for each block. However, in this case, the resolution of the block having a large number of gradations is reduced. By doing so, the data amount of each block becomes constant.
JP-A-6-350986 JP-A-5-56282

画像の小領域ごとに階調数を設定する上に述べたような手法は、全体を一様に減色するよりも画像の劣化を防ぎながらデータ量を削減することができる。しかしその反面、上記のような手法は以下のような問題点も持っている。   The method as described above for setting the number of gradations for each small area of the image can reduce the amount of data while preventing deterioration of the image, rather than reducing the entire color uniformly. On the other hand, the above method has the following problems.

第1の問題点は、小領域ごとの視覚的つながりが考慮されていないことである。そのような問題点を図59および図60を参照して説明する。なお以下の説明では、「小領域」とは、画像のあるブロックを指すものとする。   The first problem is that the visual connection for each small area is not considered. Such a problem will be described with reference to FIGS. 59 and 60. FIG. In the following description, “small area” refers to a block having an image.

図59に入力画像の例を示す。この入力画像は全体では256階調を有するものとする。この画像は、「150」という画素値を持つ星印領域101と、「175」という画素値を持つ矢印領域102および星印領域103と、「255」という画素値を持つ背景領
域とを含んでいる。
FIG. 59 shows an example of the input image. It is assumed that this input image has 256 gradations as a whole. This image includes a star region 101 having a pixel value of “150”, an arrow region 102 and a star region 103 having a pixel value of “175”, and a background region having a pixel value of “255”. Yes.

今、各小領域ごとに、減色後の階調数として4階調または8階調のいずれかが選択されるものとする。4階調の場合には、例えば、減色後の画素値は0、85、170、255のいずれかとなる。これは、階調数0から255の空間を均等に分割することによって得られる4つの階調である。同じく8階調の場合には、例えば、画素値は0、36、73、109、146、182、219、255のいずれかの値をとる。入力画像からの変換は、減色後の階調数が決定した後は、その階調数で可能な減色後の画素値で最も入力画像に近い値をとることによって行なう。   Now, for each small area, either 4 gradations or 8 gradations are selected as the number of gradations after color reduction. In the case of four gradations, for example, the pixel value after color reduction is one of 0, 85, 170, and 255. This is four gradations obtained by equally dividing the space having the gradation number 0 to 255. Similarly, in the case of 8 gradations, for example, the pixel value takes any of 0, 36, 73, 109, 146, 182, 219, and 255. After the number of gradations after color reduction is determined, the conversion from the input image is performed by taking a value closest to the input image among the pixel values after color reduction possible with the number of gradations.

このようなロジックの下では、図59に示す矢印領域102については、4階調で画素値「170」で表わされるのが妥当のように思われる。星印領域103についても同様である。しかし、星印領域101(画素値150)については、4階調で最も近い画素値は85または170であるため、いずれを選択した場合であっても誤差が大きくなる。そのため、既存のロジックによれば星印領域101を含んだ小領域(図59に示される分割した正方領域)について8階調が必要と判断される可能性がある。そうした場合の処理結果の一例を示すのが図60である。   Under such logic, it seems reasonable that the arrow region 102 shown in FIG. 59 is represented by the pixel value “170” in four gradations. The same applies to the star area 103. However, for the star region 101 (pixel value 150), the closest pixel value in the four gradations is 85 or 170, so the error becomes large regardless of which one is selected. Therefore, according to the existing logic, it may be determined that 8 gradations are necessary for the small area including the star area 101 (divided square area shown in FIG. 59). An example of the processing result in such a case is shown in FIG.

図60を参照して、星印領域101については、8階調で、元の画素値150と比較的近い値である146が選択されている。そのため星印領域101については特に問題はない。しかし、矢印領域102のうち、星印領域101が存在する小領域と同じ小領域の中の部分は、8階調で元の画素値175と最も近い値、つまり182という画素値で表わされている。そのため、この部分は矢印領域102のその他の部分の「170」という画素値と異なる画素値を有することになる。こうして、図60に示されるように、左下の小領域と他の小領域との境界に沿って、矢印領域102の中に段差が現われる。この段差は原画には存在していなかったものである。こうした現象が好ましくないことは言うまでもない。   Referring to FIG. 60, for star region 101, 146, which is 8 gradations and relatively close to original pixel value 150, is selected. Therefore, there is no particular problem with the star area 101. However, in the arrow area 102, the part in the same small area as the small area where the star area 101 exists is represented by a value closest to the original pixel value 175 in 8 gradations, that is, a pixel value of 182. ing. Therefore, this portion has a pixel value different from the pixel value “170” of the other portion of the arrow region 102. Thus, as shown in FIG. 60, a step appears in the arrow region 102 along the boundary between the lower left small region and the other small regions. This level difference was not present in the original picture. Needless to say, such a phenomenon is not preferable.

このような現象は、従来の技術では小領域ごとの最適な減色階調数の判定が、小領域の中でほぼ閉じて行なわれるために生じる。   Such a phenomenon occurs because, in the prior art, the determination of the optimum number of subtractive color gradations for each small area is performed almost in the small area.

従来の技術のもう1つの問題点は、従来の技術では、各ブロックの最適な階調数の判定にあたって、図形的な特徴が考慮されていないことである。ブロック全体での誤差が同じであったとしても、図形的な特徴により画像の劣化が特に目立ちやすくなる場合がある。たとえば画像の比較的平坦な領域であれば誤差は目立ちにくい。それに対して直線、特に縦方向または横方向の線では、無理な減色をすると線のがたつきが生じやすく、見る者がそうした画像の劣化に気づきやすい。しかし従来の技術ではこのような問題点を十分に考慮しているとは言えなかった。   Another problem with the prior art is that the prior art does not take into account graphical features in determining the optimum number of tones for each block. Even if the error in the entire block is the same, the deterioration of the image may be particularly noticeable due to the graphic feature. For example, the error is not noticeable if the area is relatively flat. On the other hand, straight lines, particularly vertical or horizontal lines, are prone to looseness if they are subjected to excessive color reduction, and viewers are more likely to notice such image degradation. However, it cannot be said that the conventional technology fully considers such problems.

それゆえに本発明の目的は、画像の劣化を防止しながら、原画像の減色処理を行なうことができる画像減色装置およびそうした画像減色装置を用いることにより効率的に画像符号化が可能な画像符号化装置を提供することである。   SUMMARY OF THE INVENTION Therefore, an object of the present invention is to provide an image color reduction device capable of performing color reduction processing of an original image while preventing image deterioration, and image coding capable of efficiently image coding by using such an image color reduction device. Is to provide a device.

本発明の他の目的は、小領域ごとに減色処理され、さらに符号化された画像データを復号することができる画像復号装置を提供することである。   Another object of the present invention is to provide an image decoding apparatus capable of decoding image data that has been subjected to color reduction processing for each small region and further encoded.

この発明のある局面にかかる画像減色装置は、入力されたデジタル画像データの階調数を減少させて出力する画像減色装置であって、入力画像を予め定められた手法により小領域に分割するための分割手段と、各小領域ごとに、当該小領域に含まれる画像データに基
づいて、当該小領域を適切に減色するための階調数を設定するための適応的減色手段とを含む。
An image color reduction apparatus according to an aspect of the present invention is an image color reduction apparatus that outputs the input digital image data by reducing the number of gradations, and divides the input image into small regions by a predetermined method. And dividing means for each small area, and adaptive color reduction means for setting the number of gradations for appropriately reducing the color of the small area based on the image data included in the small area.

好ましくは適応的減色手段は、入力画像中から予め定められた形状、たとえば直線を抽出するための抽出手段と、抽出手段による予め定められた形状の抽出結果に基づいて、入力画像中の予め定められた形状が存在する領域の階調数が、予め定められた形状の存在しない領域の階調数以上となるように、各小領域の階調数を設定するための手段とを含む。   Preferably, the adaptive color reduction means is a predetermined shape in the input image based on an extraction means for extracting a predetermined shape from the input image, for example, a straight line, and an extraction result of the predetermined shape by the extraction means. Means for setting the number of gradations of each small region so that the number of gradations of the region where the shape is present is equal to or greater than the number of gradations of the region where the predetermined shape is not present.

さらに好ましくは、適応的減色手段は、異なる減色方法の下での、画像の少なくとも一部における背景画素および非背景画素のいずれか一方の分布を表わす指標を算出するための分布算出手段と、分布算出手段により算出された分布の比較結果に基づいて減色方法の適否を決定するための適否決定手段とを含む。   More preferably, the adaptive color reduction means includes: a distribution calculation means for calculating an index representing a distribution of either background pixels or non-background pixels in at least a part of an image under different color reduction methods; Suitability determining means for determining suitability of the color reduction method based on the comparison result of the distribution calculated by the calculating means.

さらに好ましくは、分布算出手段は、入力画像中から予め定められた形状を抽出するための抽出手段と、異なる減色方法の下での、予め定められた形状の近傍の背景画素および非背景画素のいずれか一方の分布を検出するための画素分布検出手段とを含み、適否決定手段は、画素分布検出手段により検出された、第1の減色階調数とそれより少ない第2の減色階調数との下での、背景画素および非背景画素の分布を比較し、比較結果が予め定める条件を満足しているか否かに基づいて、第2の減色階調数の適否を判定するための手段を含む。   More preferably, the distribution calculating unit is configured to extract a predetermined shape from the input image, and to extract background pixels and non-background pixels in the vicinity of the predetermined shape under different color reduction methods. A pixel distribution detecting unit for detecting any one of the distributions, and the suitability determining unit detects the first subtractive gradation number and the second subtractive gradation number detected by the pixel distribution detecting unit. For comparing the distribution of the background pixels and the non-background pixels and determining whether or not the second subtractive color gradation number is appropriate based on whether the comparison result satisfies a predetermined condition or not. including.

予め定める条件とは、第2の減色階調数の下での背景画素の数と、第1の減色階調回数の下での背景画素の数との差が一定以上であることでもよいし、第1の減色階調数の下での非背景画素の数と、第2の減色階調回数の下での非背景画素の数との差が一定以上であることでもよい。   The predetermined condition may be that a difference between the number of background pixels under the second number of subtractive color gradations and the number of background pixels under the first number of subtractive color gradations is a certain level or more. The difference between the number of non-background pixels under the first number of subtractive color gradations and the number of non-background pixels under the second number of subtractive color gradations may be a certain value or more.

適応的減色手段は、入力画像をラベリングするためのラベリング手段と、ラベリング手段の出力に基づき、共通なラベルを含む小領域に共通のラベルを付与するための小領域ラベリング手段とを含み、小領域ラベリング手段によって共通のラベルが付与された小領域には、共通の階調数を設定する構成でもよい。   The adaptive color reduction means includes a labeling means for labeling an input image, and a small area labeling means for giving a common label to a small area including a common label based on an output of the labeling means. A configuration in which a common number of gradations is set in a small region to which a common label is assigned by the labeling unit may be used.

適応的減色手段は、入力画像の小領域の境界をはさんで隣接する二つの画素が共通の画素値を持つ場合に、当該二つの画素が属する二つの小領域に共通のラベルを付与する小領域ラベリング手段とを含み、小領域ラベリング手段により共通のラベルが付与された小領域には、共通の階調数を設定する構成でもよい。   The adaptive color reduction means, when two pixels adjacent across the boundary of the small area of the input image have a common pixel value, is a small color that gives a common label to the two small areas to which the two pixels belong. It is also possible to employ a configuration in which a common number of gradations is set in a small area that includes area labeling means and is given a common label by the small area labeling means.

この発明の他の局面にかかる画像符号化装置は、入力されたデジタル画像データの階調数を減少させるための、請求項1〜請求項9のいずれかに記載の画像減色装置と、画像減色手段により減色された画像のエントロピー符号化を行なうための画像符号化手段とを含む。   An image encoding device according to another aspect of the present invention provides an image color reduction device according to any one of claims 1 to 9 and an image color reduction for reducing the number of gradations of input digital image data. Image encoding means for performing entropy encoding of the image reduced in color by the means.

この発明のさらに他の局面にかかる画像符号化装置は、小領域ごとに異なる階調数を持ち得る入力画像をビットプレーンに分割して圧縮する画像符号化装置であって、上位プレーンにおいてより隣接画素間の連続性が高まるように、符号化対象の小領域の階調数に応じて異なる変換を各画素値に施しビットプレーンに分割するための画像変換手段と、画像変換手段による変換によって得られるビットプレーンごとに所定のエントロピー符号化を行なうための画像符号化手段とを含む。   An image encoding apparatus according to still another aspect of the present invention is an image encoding apparatus that divides an input image that may have a different number of gradations for each small area into bit planes and compresses the input image, and is more adjacent in an upper plane. In order to increase the continuity between pixels, an image conversion means for performing a different conversion on each pixel value according to the number of gradations of the small area to be encoded and dividing it into bit planes, and a conversion by the image conversion means And image encoding means for performing predetermined entropy encoding for each bit plane.

この発明の別の局面にかかる画像符号化装置は、小領域ごとに異なる階調数を持ち得る入力画像をビットプレーンに分割して圧縮する画像符号化装置であって、すべての小領域
の階調数が等しいか否かを判定するための判定手段と、判定手段によりすべての小領域の階調数が等しいと判定されたことに応答して、入力画像の全体を一つの小領域とみなし、小領域の数を1として画像を符号化するための第1の画像符号化手段と、判定手段によりすべての小領域の階調数が等しいわけではないと判定されたことに応答して、入力画像の各小領域ごとに符号化するための第2の画像符号化手段とを含む。
An image encoding apparatus according to another aspect of the present invention is an image encoding apparatus that divides an input image, which may have a different number of gradations for each small area, into bit planes, and compresses the input image, wherein all of the small areas are stored. In response to the determination means for determining whether or not the logarithms are equal and the determination means determines that the gradation numbers of all the small areas are equal, the entire input image is regarded as one small area. In response to determining that the number of gradations of all the small regions is not equal by the determination unit and the first image encoding unit for encoding the image with the number of small regions being 1, Second image encoding means for encoding each small region of the input image.

この発明のさらに別の局面にかかる画像復号装置は、請求項10に記載の画像符号化装置によって符号化された画像データを入力するための入力手段と、入力手段により入力された画像データに対して、請求項10に記載のエントロピー符号化に対応した復号を行なう復号手段とを含む。   According to still another aspect of the present invention, an image decoding apparatus includes: input means for inputting image data encoded by the image encoding apparatus according to claim 10; and image data input by the input means. And decoding means for performing decoding corresponding to the entropy encoding according to claim 10.

この発明のある局面にかかる画像減色装置は、請求項11に記載の画像符号化装置によって符号化された画像データを入力するための入力手段と、入力手段により入力された画像データに対して、請求項11に記載のエントロピー符号化に対応した復号を行なう復号手段と、復号手段により復号された画像データに対して、請求項11に記載の画像変換手段に対応した逆変換を行なうための画像逆変換手段とを含む。   An image color reduction device according to an aspect of the present invention provides an input unit for inputting image data encoded by the image encoding device according to claim 11, and an image data input by the input unit. A decoding means for performing decoding corresponding to the entropy encoding according to claim 11 and an image for performing inverse conversion corresponding to the image conversion means according to claim 11 for the image data decoded by the decoding means. Reverse conversion means.

この発明のある局面にかかる画像減色装置は、請求項12に記載の画像符号化装置によって符号化された画像データを復号するための画像復号装置であって、画像符号化手段によって符号化された画像データに含まれる小領域の数がいくつかを判定するための判定手段と、判定手段により判定された数の小領域に画像データを分割して復号するための復号手段とを含む。   An image color reduction device according to an aspect of the present invention is an image decoding device for decoding image data encoded by the image encoding device according to claim 12, encoded by image encoding means. A determination unit for determining the number of small areas included in the image data; and a decoding unit for dividing and decoding the image data into the number of small areas determined by the determination unit.

以上のように本発明による画像減色装置は、小領域の間の繋がりを考慮して、小領域の減色後の階調数を決定する。そのため、色階調数の画素値の配置に制限を加えずに、視覚的に大きな影響を持つ小領域ごとの違いによる段差が起こりにくい画像の減色処理を行なうことができる。   As described above, the image color reduction device according to the present invention determines the number of gradations after color reduction in a small area in consideration of the connection between the small areas. For this reason, it is possible to perform a color reduction process for an image in which a step due to a difference in each small area that has a large visual effect is unlikely to occur without limiting the arrangement of pixel values of the number of color gradations.

また本発明に係る画像減色装置は、小領域中に線領域がある場合、小領域の減色階調数を大きくするような制御を行なう。そのため、がたつきなど線領域の劣化が目立たないように画像の減色処理を行なうことができる。   The image color reduction apparatus according to the present invention performs control to increase the number of subtractive color gradations in a small area when there is a line area in the small area. Therefore, it is possible to perform image color reduction processing so that deterioration of the line area such as rattling is not noticeable.

本発明に係る画像減色装置は、小領域中に含まれる文字の縦線、横線の周囲の過度の減色による劣化を実際に検出し、その結果に応じて適切な階調数での減色を行なう。無理な減色は行なわないので、特に文字に含まれる線部分の劣化が目立たないように画像の減色処理を行なうことができる。   The image color reduction apparatus according to the present invention actually detects deterioration due to excessive color reduction around the vertical and horizontal lines of characters included in a small area, and performs color reduction with an appropriate number of gradations according to the result. . Since unreasonable color reduction is not performed, it is possible to perform image color reduction processing so that line portions included in characters are not particularly deteriorated.

また、本発明にかかる画像圧縮装置は、異なる階調数を持つ小領域を考慮して、減色後のビットプレーンの圧縮効果が高くなるように構成されている。そのため、より効率の高い画像圧縮を行なうことができる。   In addition, the image compression apparatus according to the present invention is configured to increase the compression effect of the bit plane after color reduction in consideration of small areas having different numbers of gradations. Therefore, more efficient image compression can be performed.

さらに、上の本発明に係る画像復号装置は、小領域の階調数がどれも等しいときには、一部の情報の復号をスキップするように構成した。そのため、従来と比較してさらに符号化効率の高い画像圧縮を行なうことができる。   Further, the above image decoding apparatus according to the present invention is configured to skip decoding of a part of information when the number of gradations of the small area is equal. Therefore, it is possible to perform image compression with higher encoding efficiency than in the past.

[第1の実施の形態]
以下、本発明の第1の実施の形態である画像減色装置の説明を行なう。なお以下の説明では、第1の実施の形態の説明に限らず、理解を容易にするために具体的なデータ構造お
よび画像の階調数などの数値例を挙げる。しかしこれらは単に説明のための例にすぎず、本発明の技術的範囲を制限するようなものであると解すべきではない。
[First Embodiment]
Hereinafter, the image color reduction apparatus according to the first embodiment of the present invention will be described. In the following description, not only the description of the first embodiment, but a numerical example such as a specific data structure and the number of gradations of an image is given for easy understanding. However, these are merely illustrative examples and should not be construed as limiting the technical scope of the present invention.

また本明細書では、小領域または画像の階調数とは、その小領域または画像で許されている画素値の種類の数をいうものとし、実際にその小領域または画像に何種類の画素値が現われるかをいうものではないものとする。たとえばある小領域で0〜7の画素値が許されている場合には、実際には3種類の値しか画素値として現われなくても、その小領域は8値領域と考える。   Further, in this specification, the number of gradations of a small area or image means the number of types of pixel values allowed in the small area or image, and how many types of pixels are actually included in the small area or image. It does not mean that the value appears. For example, when pixel values of 0 to 7 are allowed in a certain small area, even if only three types of values actually appear as pixel values, the small area is considered as an 8-value area.

図1を参照して、この画像減色装置はスキャナなどの画像入力装置301と、画像入力装置301により入力された画像データを格納するための入力画像バッファ302と、入力画像バッファ302に格納された画像データに対し、小領域ごとに適切な必要最小限の階調数に減色する適応的減色処理を行なうための適応的減色器303と、適応的減色器303の出力する減色された画像データを格納するための減色画像バッファ304と、減色画像バッファ304に格納された画像データを、256階調の画像に変換して出力するための出力画像作成器305と、出力画像作成器305の出力する256階調の画像を格納するための出力画像バッファ306と、出力画像バッファ306に格納されたデータを表示または印刷するためのディスプレイまたはプリンタからなる画像出力装置307とを含む。   Referring to FIG. 1, this image color reduction device is stored in an image input device 301 such as a scanner, an input image buffer 302 for storing image data input by the image input device 301, and an input image buffer 302. An adaptive color reducer 303 for performing an adaptive color reduction process for reducing the number of gradations appropriate for each small area to an appropriate minimum color number, and the color-reduced image data output from the adaptive color reducer 303. The color-reduced image buffer 304 for storing, the output image creator 305 for converting the image data stored in the color-reduced image buffer 304 into an image of 256 gradations, and the output, and the output of the output image creator 305 An output image buffer 306 for storing images of 256 gradations, and a disk for displaying or printing the data stored in the output image buffer 306. And an image output device 307 consisting of lay or printer.

画像入力装置301としてここではスキャナを想定している。しかし画像入力装置としてはスキャナに限らず他の画像入力装置、たとえばデジタルカメラ、通信により受信した画像データを格納する記憶装置など、どのようなものであってもよい。   Here, a scanner is assumed as the image input device 301. However, the image input device is not limited to the scanner, and may be any other image input device such as a digital camera or a storage device that stores image data received through communication.

入力画像バッファ302は、各画素のデータ以外にも、横方向の画素数、縦方向の画素数、および階調数を格納するものとする。図2に入力画像バッファ302に格納される画像データのデータ構造を示す。図2を参照してこの画像データは、横方向画素数(LX)501と、縦方向画素数(LY)502と、階調数503と、画像データ504とを含む。この例では横方向画素数501、縦方向画素数502および階調数503はいずれも4バイトの整数データであるものとする。なお以下の説明では、特に断らない限り、整数とは4バイト整数を指すものとする。また画像データ504は、横方向画素数501×縦方向画素数502の数だけの画素を含み、1画素当り1バイト(8ビット)が割当てられるものとする。画像は256階調のグレイスケール画像であると仮定する。   The input image buffer 302 stores the number of pixels in the horizontal direction, the number of pixels in the vertical direction, and the number of gradations in addition to the data of each pixel. FIG. 2 shows the data structure of the image data stored in the input image buffer 302. Referring to FIG. 2, the image data includes a horizontal pixel number (LX) 501, a vertical pixel number (LY) 502, a gradation number 503, and image data 504. In this example, it is assumed that the horizontal pixel number 501, vertical pixel number 502, and gradation number 503 are all 4-byte integer data. In the following description, unless otherwise specified, an integer refers to a 4-byte integer. The image data 504 includes pixels as many as the number of horizontal pixels 501 × the number of vertical pixels 502, and 1 byte (8 bits) is assigned to each pixel. Assume that the image is a 256 grayscale image.

なお、入力画像バッファ302に格納された画像データでは、背景領域の画素値は255に近い値を、非背景領域の画素値は0に近い値をそれぞれ持つものとする。なお減色画像バッファ304および出力画像バッファ306も入力画像バッファ302と同じデータ構造を持つものとする。   In the image data stored in the input image buffer 302, the pixel value of the background area has a value close to 255, and the pixel value of the non-background area has a value close to 0. Note that the subtractive color image buffer 304 and the output image buffer 306 also have the same data structure as the input image buffer 302.

出力画像作成器305は、小領域階調数バッファ617(図3)および基準画素値テーブル622(図3)を参照して、小領域ごとに減色された、減色画像バッファ304の画像を2560階調に変換して出力画像バッファ306に出力する機能を有する。   The output image creator 305 refers to the small area gradation number buffer 617 (FIG. 3) and the reference pixel value table 622 (FIG. 3), and reduces the image of the reduced color image buffer 304 for each small area to the 2560th floor. It has a function of converting it into a key and outputting it to the output image buffer 306.

図3を参照して、図1に示される適応的減色器303は、以下に述べるさまざまな構成要素を制御して適応的減色処理を行なうためのコントローラ601を含む。適応的減色器303はさらに、小領域情報生成器602と、小領域数レジスタ603と、小領域情報バッファ604と、画像2値化器605と、2値画像バッファ606と、線抽出器607と、線本数レジスタ608と、線情報バッファ609と、文字矩形情報抽出器610と、文字矩形数レジスタ611と、文字矩形情報バッファ612と、第1カウンタ613と、文字矩形減色器614と、文字矩形階調数バッファ615と、小領域減色器616と、小領
域階調数バッファ617と、線領域階調数レジスタ618と、小領域階調数検証器619と、小領域単純減色器620と、画素値変換器621と、基準画素値テーブル622とを含む。
Referring to FIG. 3, the adaptive color reducer 303 shown in FIG. 1 includes a controller 601 for controlling various components described below to perform an adaptive color reduction process. The adaptive color reducer 303 further includes a small area information generator 602, a small area number register 603, a small area information buffer 604, an image binarizer 605, a binary image buffer 606, and a line extractor 607. The line number register 608, the line information buffer 609, the character rectangle information extractor 610, the character rectangle number register 611, the character rectangle information buffer 612, the first counter 613, the character rectangle color reducer 614, and the character rectangle Tone number buffer 615, small area color reducer 616, small area gradation number buffer 617, line area gradation number register 618, small area gradation number verifier 619, small area simple color reducer 620, A pixel value converter 621 and a reference pixel value table 622 are included.

コントローラ601は、適応的減色器303の他の構成要素の制御ならびに他の各構成要素相互間および各構成要素と適応的減色器303の外部との間のデータ通信の制御を行なうためのものである。コントローラ601は、以下に説明する適応的減色器303の各構成要素の動作に常に関与している。しかし、記載の簡略化のために、理解に差し支えがないと思われる箇所ではコントローラ601については言及しないことがある。   The controller 601 controls other components of the adaptive color reducer 303 and controls data communication between the other components and between each component and the outside of the adaptive color reducer 303. is there. The controller 601 is always involved in the operation of each component of the adaptive color reducer 303 described below. However, for the sake of simplification of description, the controller 601 may not be referred to in places where it seems that there is no problem in understanding.

文字矩形階調数バッファ615および小領域階調数バッファ617はそれぞれ整数配列である。これら2つのバッファ615および617のi番目の要素をそれぞれRLB[i]、ALB[i]と書く。   Each of the character rectangular gradation number buffer 615 and the small area gradation number buffer 617 is an integer array. The i-th elements of these two buffers 615 and 617 are written as RLB [i] and ALB [i], respectively.

小領域情報生成器602は、入力画像バッファ302に格納された画像データ(以下「原画像」と呼ぶ。)を分割するための情報を生成し、小領域の画像を小領域数レジスタ603に、各小領域の位置を含む各小領域に関する情報を小領域情報バッファ604に、それぞれ格納する機能を有する。   The small area information generator 602 generates information for dividing the image data (hereinafter referred to as “original image”) stored in the input image buffer 302, and stores the small area image in the small area number register 603. The small area information buffer 604 has a function of storing information related to each small area including the position of each small area.

画像を小領域に分割する方法にはさまざまなものが考えられる。ここでは、画像を横8ピクセルおよび縦8ピクセルの正方形の小ブロックに分割する方法を用いる。   There are various methods for dividing an image into small regions. Here, a method is used in which an image is divided into small square blocks each having 8 pixels horizontally and 8 pixels vertically.

小領域情報バッファ604の構成例を図5に示す。図5を参照して、小領域情報バッファ604には、各小領域(ブロック)の左上隅のx座標およびy座標、ならびに右下隅のx座標およびy座標からなる組が、小領域の数だけ格納されている。一般には画像の横幅および縦幅は8の倍数とは限らない。そのため、画像の一部に半端な大きさのブロックができることがある。この実施の形態ではx方向の余りは、画像の左右端に横幅が8より小さなブロックを作ることにより吸収する。y方向の余りは、画像の最下端に縦幅が8より小さなブロックを作ることで吸収する。   A configuration example of the small area information buffer 604 is shown in FIG. Referring to FIG. 5, in small area information buffer 604, a set of x and y coordinates of the upper left corner of each small area (block) and x and y coordinates of the lower right corner corresponds to the number of small areas. Stored. In general, the horizontal and vertical widths of an image are not necessarily a multiple of 8. Therefore, a half-sized block may be formed in a part of the image. In this embodiment, the remainder in the x direction is absorbed by creating blocks with a width smaller than 8 at the left and right edges of the image. The remainder in the y direction is absorbed by making a block with a vertical width smaller than 8 at the lowermost end of the image.

画像2値化器605は、入力画像バッファ302に格納された画像データから2値画像を生成して、2値画像バッファ606に格納する機能を有する。画像2値化器605は、以下に述べる2値化しきい値Tを用いて原画像データを2値化する。すなわち画像2値化器605は、原画像データのうち画素値が0以上、かつしきい値T未満の画素(非背景領域の画素)には、対応する2値化画像の画素値として0を割当てる。それ以外の画素(背景領域の画素)には、対応する2値化画像の画素値として255が割当てられる。   The image binarizer 605 has a function of generating a binary image from the image data stored in the input image buffer 302 and storing it in the binary image buffer 606. The image binarizer 605 binarizes the original image data using a binarization threshold T described below. That is, the image binarizer 605 sets 0 (zero) as the pixel value of the corresponding binarized image for pixels (pixels in the non-background area) whose pixel value is greater than or equal to 0 and less than the threshold T in the original image data. Assign. The other pixels (background region pixels) are assigned 255 as the pixel value of the corresponding binarized image.

しきい値Tを求める方法として、ここでは「大津の方法」と呼ばれるものを用いる。この「大津の方法」については、高木、下田監修「画像解析ハンドブック」、東京大学出版会、502〜504頁に解説されている。   As a method for obtaining the threshold value T, a method called “Otsu's method” is used here. This “Otsu's method” is described in “Image Analysis Handbook”, supervised by Takagi and Shimoda, University of Tokyo Press, pages 502-504.

このように、画像データバッファ302に格納されている画像データから2値化画像を生成するのは、以降の処理で背景領域と非背景領域とを区別するのを容易にするためである。   As described above, the binarized image is generated from the image data stored in the image data buffer 302 in order to facilitate the distinction between the background region and the non-background region in the subsequent processing.

2値画像バッファ606は、1画素当り1バイトとして2値化された画像データを格納する機能を有する。   The binary image buffer 606 has a function of storing image data binarized as 1 byte per pixel.

線抽出器607は、2値画像バッファ606を参照して、非背景領域から横方向および縦方向の直線を抽出してその情報を線情報バッファ609に格納する機能を有する。この
ように直線に関する情報を抽出する手法としては、特許第3100825号に記載のものなど、公知の技術を使用することができる。特に、この実施の形態にかかる線抽出器607は、横線および縦線を抽出する。このように抽出する直線を横線および縦線に限ったのは、従来の技術の項でも述べたとおり、縦方向または横方向の直線をなす画素について特別な処理を行なうことが、画像の劣化を防ぐ上で効果が大きいと考えられるためである。
The line extractor 607 has a function of referring to the binary image buffer 606 to extract horizontal and vertical straight lines from the non-background area and storing the information in the line information buffer 609. As a method for extracting information on a straight line as described above, a known technique such as that described in Japanese Patent No. 3100825 can be used. In particular, the line extractor 607 according to this embodiment extracts horizontal lines and vertical lines. The reason why the straight lines to be extracted are limited to the horizontal lines and the vertical lines is that, as described in the section of the prior art, special processing is performed on the pixels forming the straight lines in the vertical direction or the horizontal direction. This is because it is considered that the effect is great in preventing.

線情報バッファ609が格納するデータ構造を、図5に示す。図5を参照して、線情報バッファ509は、線抽出器607により抽出された直線の外接長方形の左上隅X座標およびY座標ならびに右下隅X座標およびY座標を格納する。このように直線を外接長方形で近似できるのは、線抽出器607が抽出する直線が横方向および縦方向の直線であるためである。   A data structure stored in the line information buffer 609 is shown in FIG. Referring to FIG. 5, line information buffer 509 stores the upper left corner X coordinate and Y coordinate and lower right corner X coordinate and Y coordinate of the circumscribed rectangle of the straight line extracted by line extractor 607. The reason why the straight line can be approximated by a circumscribed rectangle is that the straight line extracted by the line extractor 607 is a straight line in the horizontal direction and the vertical direction.

文字矩形情報抽出器610は、2値画像バッファ606に格納された2値画像を参照して、非背景領域に属する画素からなる文字要素に外接する矩形の情報を抽出し、抽出された矩形の数を文字矩形数レジスタ611、座標情報を文字矩形情報バッファ612にそれぞれ格納する機能を有する。なおここで文字要素と呼んでいるのは、代表的には、非背景領域に属する画素がなす各連結領域である。そうした文字要素に外接する矩形を画像から抽出する技術は、たとえば特許第3058489号公報に開示されている。   The character rectangle information extractor 610 refers to the binary image stored in the binary image buffer 606, extracts the rectangle information circumscribing the character element composed of the pixels belonging to the non-background area, and extracts the extracted rectangle The number has a function of storing the number in the character rectangle number register 611 and the coordinate information in the character rectangle information buffer 612, respectively. In addition, what is called a character element here is typically each connection area | region which the pixel which belongs to a non-background area | region makes. A technique for extracting a rectangle circumscribing such a character element from an image is disclosed in, for example, Japanese Patent No. 3058389.

文字矩形情報バッファ612のデータ構造を図6に示す。図6を参照して、文字矩形情報も、各文字要素の外接矩形の左上隅X座標およびY座標ならびに右下隅X座標およびY座標を含む。   The data structure of the character rectangle information buffer 612 is shown in FIG. Referring to FIG. 6, the character rectangle information also includes the upper left corner X coordinate and Y coordinate and the lower right corner X coordinate and Y coordinate of the circumscribed rectangle of each character element.

文字矩形減色器614は、文字矩形情報抽出器610により抽出され、文字矩形情報バッファ612に格納された文字矩形につき、各矩形の最適な階調数を決定してその情報を文字矩形階調数バッファ615に格納する機能を有する。その詳細については後述する。   The character rectangle color reducer 614 determines the optimum gradation number of each rectangle for the character rectangle extracted by the character rectangle information extractor 610 and stored in the character rectangle information buffer 612, and uses the information as the character rectangle gradation number. It has a function of storing in the buffer 615. Details thereof will be described later.

小領域減色器616は、各小領域のこの時点での最適な階調数を決定して、その情報を小領域階調数バッファ617に格納する機能を有する。この詳細についても後述する。   The small area color reducer 616 has a function of determining the optimum number of gradations of each small area at this point and storing the information in the small area gradation number buffer 617. Details of this will also be described later.

小領域階調数検証器619は、小領域階調数バッファ617の内容が整合しているかどうかを検証し、小領域階調数バッファ617の内容を書換える機能を有する。その詳細については後述する。   The small area gradation number verifier 619 has a function of verifying whether the contents of the small area gradation number buffer 617 are consistent and rewriting the contents of the small area gradation number buffer 617. Details thereof will be described later.

小領域単純減色器620は、入力画像バッファ302と小領域階調数バッファ617とを参照し、各小領域に属する各画素を減色して、減色画像バッファ304の対応する小領域に出力する機能を有する。その詳細については後述する。   The small area simple color reducer 620 refers to the input image buffer 302 and the small area gradation number buffer 617, reduces the color of each pixel belonging to each small area, and outputs it to the corresponding small area of the reduced color image buffer 304. Have Details thereof will be described later.

基準画素値テーブル622は、各階調数に応じた画素値が参照できるテーブルである。
以下、図3に示した各構成要素を用いてコントローラ601が減色処理を行なう処理の制御構造について図4を参照して説明する。各ブロックでの処理内容の詳細については後述することとして、コントローラ601で行なわれる処理の全体の流れは図4に示されるとおりである。なおこの処理はすべてコントローラ601の制御によって行なわれるものであるが、以下の説明ではコントローラ601の制御について言及しないことがある。
The reference pixel value table 622 is a table in which pixel values corresponding to the number of gradations can be referred to.
Hereinafter, a control structure of processing in which the controller 601 performs color reduction processing using each component shown in FIG. 3 will be described with reference to FIG. The details of the processing contents in each block will be described later, and the overall flow of processing performed by the controller 601 is as shown in FIG. This processing is all performed under the control of the controller 601, but in the following description, the control of the controller 601 may not be mentioned.

まず小領域情報生成器602が、入力画像バッファ302に格納された原画像を分割するための情報を生成し、小領域の数を小領域数レジスタ603に格納する。また各小領域の位置を含む、各小領域に関する情報が小領域情報バッファ600に格納される(S701)。   First, the small area information generator 602 generates information for dividing the original image stored in the input image buffer 302, and stores the number of small areas in the small area number register 603. Information about each small area including the position of each small area is stored in the small area information buffer 600 (S701).

次に、画像2値化器605は、入力画像バッファ302に格納された画像データから2値画像を生成し、2値画像バッファ606に格納する(S702)。続いて線抽出器607が、2値画像バッファ606を参照して、非背景領域から横方向および縦方向の直線を抽出して、その内容を線情報バッファ609に格納する(S703)。   Next, the image binarizer 605 generates a binary image from the image data stored in the input image buffer 302 and stores it in the binary image buffer 606 (S702). Subsequently, the line extractor 607 refers to the binary image buffer 606, extracts horizontal and vertical straight lines from the non-background area, and stores the contents in the line information buffer 609 (S703).

続いて文字矩形情報抽出器610が、2値画像バッファ606を参照して、非背景領域に属する画素からなる文字要素に外接する矩形の情報を抽出し、抽出された矩形の数を文字矩形数レジスタ611、座標情報を文字矩形情報バッファ612に、それぞれ格納する(S704)。文字矩形減色器614が、各矩形の最適な階調数を決定し、その情報を文字矩形階調数バッファ615に格納する(S705)。この詳細については後述する。小領域減色器616は、各小領域のこの時点での最適な階調数を決定して、その情報を小領域階調数バッファ617に格納する(S705A)。この詳細については後述する。   Subsequently, the character rectangle information extractor 610 refers to the binary image buffer 606, extracts the information of the rectangle circumscribing the character element composed of the pixels belonging to the non-background area, and determines the number of extracted rectangles as the number of character rectangles. The register 611 and the coordinate information are respectively stored in the character rectangle information buffer 612 (S704). The character rectangle color reducer 614 determines the optimum gradation number of each rectangle and stores the information in the character rectangle gradation number buffer 615 (S705). Details of this will be described later. The small area color reducer 616 determines the optimum number of gradations of each small area at this time, and stores the information in the small area gradation number buffer 617 (S705A). Details of this will be described later.

コントローラ601は、文字矩形階調数バッファ615に格納されている矩形ごとの階調数の情報を参照して、小領域階調数バッファ617の内容を書換える(S706)。この詳細については後述する。コントローラ601はさらに、線情報バッファ609に格納されている線の情報を参照して、小領域階調数バッファ617の内容を書換える(S707)。この詳細についても後述する。   The controller 601 rewrites the contents of the small area gradation number buffer 617 with reference to the gradation number information for each rectangle stored in the character rectangular gradation number buffer 615 (S706). Details of this will be described later. Further, the controller 601 refers to the line information stored in the line information buffer 609 and rewrites the contents of the small area gradation number buffer 617 (S707). Details of this will also be described later.

続いて小領域階調数検証器619が、小領域階調数バッファ617の内容の整合性がとれているかどうかを検証し、検証結果に従って小領域階調数バッファ617の内容を書換える(S708)。その詳細については後述する。さらに小領域単純減色器620が、入力画像バッファ302と小領域階調数バッファ617とを参照しながら、各小領域に属する各画素を減色して、減色画像バッファ304の対応する小領域に出力する(S709)。詳細については後述する。S709の処理が終了すると減色処理は終了である。   Subsequently, the small area gradation number verifier 619 verifies whether the contents of the small area gradation number buffer 617 are consistent, and rewrites the contents of the small area gradation number buffer 617 according to the verification result (S708). ). Details thereof will be described later. Further, the small area simple color reducer 620 reduces the color of each pixel belonging to each small area while referring to the input image buffer 302 and the small area gradation number buffer 617, and outputs it to the corresponding small area of the reduced color image buffer 304. (S709). Details will be described later. When the process of S709 ends, the color reduction process ends.

図4に示すS705において行なわれる処理の制御構造につき図7を参照して説明する。コントローラ601は、第1カウンタ613を0で初期化する(S1061)。カウンタ613の値を以下では「i」と呼ぶ。   The control structure of the process performed in S705 shown in FIG. 4 will be described with reference to FIG. The controller 601 initializes the first counter 613 with 0 (S1061). The value of the counter 613 is hereinafter referred to as “i”.

文字矩形減色器614が入力画像バッファ302および文字矩形情報バッファ612を参照し、i番目の矩形に含まれる領域について、最適な階調数を決定する。決定された情報は文字矩形階調数バッファ615のi番目の要素に格納される(S1062)。文字矩形減色器614の動作については後述する。   The character rectangle color reducer 614 refers to the input image buffer 302 and the character rectangle information buffer 612 to determine the optimum number of gradations for the area included in the i-th rectangle. The determined information is stored in the i-th element of the character rectangular gradation number buffer 615 (S1062). The operation of the character rectangular color reducer 614 will be described later.

続いてコントローラ601は第1カウンタ613の値iをインクリメントする(S1603)。第1カウンタ613の内容iと、文字矩形数レジスタ611の内容とが比較され(S1604)、等しければS704の処理を終了する。iと矩形数とが等しくなければ制御はS1602に戻る。   Subsequently, the controller 601 increments the value i of the first counter 613 (S1603). The contents i of the first counter 613 and the contents of the character rectangle number register 611 are compared (S1604), and if they are equal, the process of S704 is terminated. If i is not equal to the number of rectangles, the control returns to S1602.

続いて図4に示されるS705Aの処理の詳細について図8を参照して説明する。コントローラ601は、第1カウンタ613の値iを0で初期化する(S5201)。以下、第1カウンタ613の値をiと呼ぶ。   Next, details of the processing of S705A shown in FIG. 4 will be described with reference to FIG. The controller 601 initializes the value i of the first counter 613 with 0 (S5201). Hereinafter, the value of the first counter 613 is referred to as i.

続いて小領域減色器616が、入力画像バッファ302、小領域情報バッファ604を参照して、i番目の小領域について、原画像と、減色後の誤差とが一定範囲になるような減色階調数を、予め定めた可能な減色階調数から求める。小領域減色器616はその減色階調数を小領域階調数バッファ617に出力する(S5202)。小領域階調数バッファ617は、小領域と1対1に対応するような整数配列である。小領域減色器616の動作については後述する。   Subsequently, the small area color reducer 616 refers to the input image buffer 302 and the small area information buffer 604, and for the i-th small area, the subtractive color gradation such that the original image and the error after color reduction fall within a certain range. The number is determined from the number of possible subtractive color gradations. The small area color reducer 616 outputs the number of subtractive color gradations to the small area gradation number buffer 617 (S5202). The small area gradation number buffer 617 is an integer array corresponding to the small area on a one-to-one basis. The operation of the small area color reducer 616 will be described later.

続いてコントローラ601は、第1カウンタ613の値iをインクリメントする(S5203)。コントローラ601は、第1カウンタ613の値を小領域数レジスタ603の値と比較し(S5204)、等しければ処理を終了し、等しくなければ制御をS5202に戻す。   Subsequently, the controller 601 increments the value i of the first counter 613 (S5203). The controller 601 compares the value of the first counter 613 with the value of the small area number register 603 (S5204). If they are equal, the process ends. If they are not equal, the control returns to S5202.

図4に示すS706において行なわれる処理の詳細について図9を参照して説明する。まずコントローラ601は、第1カウンタ613の値iを0で初期化する(S5301)。続いてコントローラ601は、第2カウンタ616の値を0で初期化する(S5302)。以下第2カウンタ616の値をjと呼ぶ。   Details of the processing performed in S706 shown in FIG. 4 will be described with reference to FIG. First, the controller 601 initializes the value i of the first counter 613 with 0 (S5301). Subsequently, the controller 601 initializes the value of the second counter 616 with 0 (S5302). Hereinafter, the value of the second counter 616 is referred to as j.

続いてコントローラ601は、文字矩形情報バッファ612と小領域情報バッファ604とを参照し、i番目の矩形が、j番目の小領域と重なっているかどうかを判定する(S5303)。両者が重なっていれば制御はS5304に進み、重なっていなければ制御はS5306に進む。小領域情報および矩形情報が、いずれもその左上の座標と右下の座標とで一意に定められている。したがってこのS5303のような判断はi番目の矩形と小領域との座標の比較で行なうことができる。   Subsequently, the controller 601 refers to the character rectangle information buffer 612 and the small area information buffer 604, and determines whether or not the i-th rectangle overlaps the j-th small area (S5303). If they overlap, the control proceeds to S5304, and if they do not overlap, the control proceeds to S5306. Each of the small area information and the rectangular information is uniquely determined by the upper left coordinates and the lower right coordinates. Therefore, the determination as in S5303 can be made by comparing the coordinates of the i-th rectangle and the small area.

さらにコントローラ601は、文字矩形階調数バッファ615のi番目の要素の値と、小領域階調数バッファ617のj番目の要素の値とを比較する(S5304)。前者の方が大きければ制御はS5305に進み、そうでないときは制御はS5306に進む。   Further, the controller 601 compares the value of the i-th element of the character rectangular gradation number buffer 615 with the value of the j-th element of the small area gradation number buffer 617 (S5304). If the former is larger, control proceeds to S5305; otherwise, control proceeds to S5306.

ステップS5305では、小領域階調数バッファ617のj番目の要素に、文字矩形階調数バッファ615のi番目の要素の値が代入される。   In step S5305, the value of the i-th element of the character rectangle gradation number buffer 615 is substituted for the j-th element of the small area gradation number buffer 617.

続いてS5306において、コントローラ601は第2カウンタ616の値を1だけインクリメントする(S5306)。そしてその値が小領域数レジスタ603の値と比較される(S5307)。両者が等しければ制御はS5308に進み、さもなければ制御はS5303に戻る。   Subsequently, in S5306, the controller 601 increments the value of the second counter 616 by 1 (S5306). Then, the value is compared with the value of the small area number register 603 (S5307). If they are equal, control proceeds to S5308, otherwise control returns to S5303.

ステップS5308では、コントローラ601は第1カウンタ613の値を1インクリメントする。そしてこのインクリメントされた第1カウンタ613の値を文字矩形数レジスタ611の値と比較する(S5309)。両者が等しければこの処理は終了し、等しくなければ制御はS5302に戻る。   In step S5308, the controller 601 increments the value of the first counter 613 by one. The incremented value of the first counter 613 is compared with the value of the character rectangle number register 611 (S5309). If they are equal, this process ends. If they are not equal, control returns to S5302.

続いて図4のS707の処理の内容について図10を参照して説明する。なおこの処理の前に、予め線の領域に使用する減色階調数が定まっており、線領域階調数レジスタ618に既に格納されているものとする。   Next, the contents of the process of S707 in FIG. 4 will be described with reference to FIG. Prior to this processing, it is assumed that the number of subtractive color gradations to be used for the line area is determined in advance and is already stored in the line area gradation number register 618.

線領域階調数レジスタ618に格納される値に特に制限はない。しかし画像から線を抽出するのは、減色時にがたつきなどの劣化が目立たないように、他の領域より大きめの階調数を割当てるのが目的である。したがって減色後の階調数としては大きめの値をとることが望ましい。   The value stored in the line area gradation number register 618 is not particularly limited. However, the purpose of extracting lines from the image is to assign a larger number of gradations than other regions so that deterioration such as rattling is not noticeable during color reduction. Therefore, it is desirable to take a larger value as the number of gradations after color reduction.

この実施の形態の装置では線領域階調数レジスタ618には「8」が格納されているものとする。これは第2減色テーブル1103および減色テーブル1603に格納されている減色後の階調数の最大値と同じである。   In the apparatus of this embodiment, it is assumed that “8” is stored in the line area gradation number register 618. This is the same as the maximum number of gradations after color reduction stored in the second color reduction table 1103 and the color reduction table 1603.

図10を参照して、コントローラ601は、第1カウンタ613の値iを0で初期化する(S5401)。続いて第2カウンタ616の値jを0で初期化する(S5402)。   Referring to FIG. 10, the controller 601 initializes the value i of the first counter 613 with 0 (S5401). Subsequently, the value j of the second counter 616 is initialized with 0 (S5402).

コントローラ601は、線情報バッファ609と小領域情報バッファ604とを参照し、i番目の矩形がj番目の小領域と重なっているかどうかを判定する(S5403)。両者が重なっていれば制御はS5404に進み、重なっていなければ制御はS5406に進む。   The controller 601 refers to the line information buffer 609 and the small area information buffer 604 and determines whether or not the i-th rectangle overlaps the j-th small area (S5403). If they overlap, the control proceeds to S5404, and if they do not overlap, the control proceeds to S5406.

各線の情報は、その外接矩形の左上隅の座標と右下隅の座標とで一意に定まっている。したがってS5403の判定は、i番目の矩形とj番目の線の座標の比較で容易に行なうことができる。   Information on each line is uniquely determined by the coordinates of the upper left corner and the lower right corner of the circumscribed rectangle. Therefore, the determination in S5403 can be easily performed by comparing the coordinates of the i-th rectangle and the j-th line.

i番目の線とj番目の小領域とが重なっている場合、ステップS5404においてコントローラ601は、線領域階調数レジスタ618の値と小領域階調数バッファ617のj番目の要素の値とを比較する(S5405)。前者の方が大きければ制御はS5405に進み、さもなければ制御はS5406に進む。   If the i-th line and the j-th small area overlap, in step S5404 the controller 601 determines the value of the line-area gradation number register 618 and the value of the j-th element of the small-area gradation number buffer 617. Compare (S5405). If the former is larger, control proceeds to S5405, otherwise control proceeds to S5406.

線領域階調数レジスタ618の値の方が小領域階調数バッファ617のj番目の要素の値よりも大きければ、ステップS5405において、小領域階調数バッファ617のj番目の要素に、線領域階調数レジスタ618の値が代入される(S5405)。   If the value of the line area gradation number register 618 is larger than the value of the jth element of the small area gradation number buffer 617, the line area gradation number register 618 is set to the jth element of the small area gradation number buffer 617 in step S5405. The value of the area gradation number register 618 is substituted (S5405).

続いてコントローラ601は、第2カウンタ616の値jをインクリメントし(S5406)、第2カウンタ616の値jを小領域数レジスタ613の値と比較する(S5407)。両者が等しければ制御はS5408に進み、さもなければ制御はS5403に戻る。   Subsequently, the controller 601 increments the value j of the second counter 616 (S5406), and compares the value j of the second counter 616 with the value of the small area number register 613 (S5407). If the two are equal, control proceeds to S5408, otherwise control returns to S5403.

S5408ではコントローラ601は第1カウンタ613の値iをインクリメントする。さらにS5409において、第1カウンタ613の値iが線本数レジスタ608の値と比較される(S5409)。両者が等しければ処理は終了し、等しくなければ制御はS5402に戻る。   In step S5408, the controller 601 increments the value i of the first counter 613. Further, in S5409, the value i of the first counter 613 is compared with the value of the line number register 608 (S5409). If they are equal, the process ends. If they are not equal, control returns to S5402.

続いて図4に示すS709の処理の詳細につき図11を参照して説明する。コントローラ601は、第1カウンタ613の値iを0で初期化する(S5501)。   Next, details of the processing in S709 shown in FIG. 4 will be described with reference to FIG. The controller 601 initializes the value i of the first counter 613 with 0 (S5501).

小領域単純減色器620が、入力画像バッファ302と小領域階調数バッファ617とを参照しつつ、i番目の小領域に属する各画素を減色し、減色画像バッファ304の対応する画素に出力する(S5502)。画素値変換器621は、基準画素値テーブルを参照して、i番目の小領域に対応する小領域階調数バッファ617のi番目の要素の値を参照して、基準画素値テーブル622に格納された基準画素値のうち最も近いものに小領域の各画素の値を減色する。   The small area simple color reducer 620 reduces the color of each pixel belonging to the i-th small area while referring to the input image buffer 302 and the small area gradation number buffer 617, and outputs it to the corresponding pixel in the reduced color image buffer 304. (S5502). The pixel value converter 621 refers to the reference pixel value table, refers to the value of the i th element of the small area gradation number buffer 617 corresponding to the i th small area, and stores it in the reference pixel value table 622. The value of each pixel in the small area is subtracted from the closest reference pixel value.

続いてコントローラ601は第1カウンタ613の値iをインクリメントし(S5503)、第1カウンタ613の値iと小領域数レジスタ603の値とを比較する(S5504)。両者が等しければ処理は終了し、さもなければ制御はS5502に戻る。   Subsequently, the controller 601 increments the value i of the first counter 613 (S5503), and compares the value i of the first counter 613 with the value of the small area number register 603 (S5504). If they are equal, the process ends, otherwise control returns to S5502.

図12に、図3に示される文字矩形減色器614の構成を示す。図12を参照して、文字矩形減色器614は、コントローラ1101と、第1減色テーブル1102と、第2減色テーブル1103と、可能階調数レジスタ1104と、線抽出器1105と、線本数レジスタ1106と、線情報バッファ1107と、第1カウンタ1108と、第2カウンタ1109と、累積ヒストグラム生成器1110と、累積ヒストグラムバッファ1111と、テンポラリー線階調数バッファ1112とを含む。   FIG. 12 shows the configuration of the character rectangular color reducer 614 shown in FIG. Referring to FIG. 12, the character rectangular color reducer 614 includes a controller 1101, a first color reduction table 1102, a second color reduction table 1103, a possible gradation number register 1104, a line extractor 1105, and a line number register 1106. A line information buffer 1107, a first counter 1108, a second counter 1109, a cumulative histogram generator 1110, a cumulative histogram buffer 1111, and a temporary line tone number buffer 1112.

コントローラ1101は、文字矩形減色器614の他の構成要素の制御、ならびに他の各構成要素相互間および各構成要素と文字矩形減色器614の外部との間のデータ通信の制御を行なうためのものである。コントローラ1101は、文字矩形減色器614の他の各構成要素の動作に常に関与している。しかし、説明の簡略化のために、以下においては理解に差し支えないと思われる範囲でコントローラ1101の関与については言及しないことがある。   The controller 1101 controls other components of the character rectangular color reducer 614, and controls data communication between the other components and between each component and the outside of the character rectangular color reducer 614. It is. The controller 1101 is always involved in the operation of the other components of the character rectangle color reducer 614. However, for simplification of explanation, in the following description, the involvement of the controller 1101 may not be mentioned to the extent that may be understood.

第1減色テーブル1102は、文字矩形減色器614の出力として可能な階調数が予め格納されている整数配列である。文字矩形減色器614の出力は1以上であり、かつ原画像の階調数以下であることが要請される。原画像の階調数は、既に述べたように本実施の形態では256である。したがって文字矩形減色器614の出力は1以上256以下である。ただし、データ容量削減の見地からは、十分な画質が保てる範囲でなるべく小さな値であることが望ましい。   The first color reduction table 1102 is an integer array in which the number of gradations that can be output as the output of the character rectangular color reducer 614 is stored in advance. The output of the character rectangular color reducer 614 is required to be 1 or more and less than the number of gradations of the original image. As already described, the number of gradations of the original image is 256 in the present embodiment. Therefore, the output of the character rectangular color reducer 614 is 1 or more and 256 or less. However, from the viewpoint of reducing the data capacity, it is desirable that the value be as small as possible within a range where sufficient image quality can be maintained.

本実施の形態では、文字矩形減色器614の出力は1、2、4、8の4種類であるものとする。そしてこれらの値がこの順で第1減色テーブル1102に格納されているものとする。すなわち、第1減色テーブル1102は4つの要素を持つ。以後、第1減色テーブル1102のj番目の要素をS[j]と表わすことがある。この記法を用いて第1減色テーブル1102の要素を表わせば、S[0]=1、S[1]=2、S[2]=4、およびS[3]=8である。   In the present embodiment, the output of the character rectangle color reducer 614 is assumed to be four types of 1, 2, 4, and 8. These values are stored in the first color reduction table 1102 in this order. That is, the first color reduction table 1102 has four elements. Hereinafter, the j-th element of the first color reduction table 1102 may be represented as S [j]. If the elements of the first color reduction table 1102 are expressed using this notation, S [0] = 1, S [1] = 2, S [2] = 4, and S [3] = 8.

文字矩形減色器614の出力として可能な階調数は予め決定されており、可能階調数レジスタ1104に格納されている。この実施の形態では、可能階調数レジスタ1104に格納されている値は4である。以後の説明では、説明を一般化するために可能階調数レジスタ1104に格納されている値をvとして説明する。本実施の形態はv=4となる場合である。   The number of gradations that can be output from the character rectangle color reducer 614 is determined in advance and stored in the possible gradation number register 1104. In this embodiment, the value stored in the possible gradation number register 1104 is 4. In the following description, in order to generalize the description, the value stored in the possible gradation number register 1104 will be described as v. This embodiment is a case where v = 4.

第2減色テーブル1100は、2次元配列である。その(j,k)要素は、j階調に減色するときに、0から数えてk番目(ただしj>k)の階調に減色される、最小の原画像の画素値が予め格納されているものとする。以後、第2減色テーブル1103の(j,k)要素をT[j][k]と書く。   The second color reduction table 1100 is a two-dimensional array. In the (j, k) element, when the color is reduced to j gradation, the pixel value of the minimum original image that is reduced to the kth (where j> k) gradation counted from 0 is stored in advance. It shall be. Hereinafter, the (j, k) element of the second color reduction table 1103 is written as T [j] [k].

原画像の画素値から減色後の画素値を決定するアルゴリズムは以下のようなものである。前提として、基準となる画素値(以下「基準画素値」と呼ぶ。)は以下のようにして決定される。まず、256階調を構成する画素値0〜255のうち、両端の0、255をそれぞれ基準画素値とする。残りの(減色後階調数−2)個の基準画素値を、両端の0および255を含めて、その間隔が均等になるように0〜255の間に配置する。各基準画素値に、小さな基準画素値から順に0、1、2、…と番号を付ける。そして基準画素値の分布が決定される。階調数が2値、4値、8値に対応する基準画素値の分布をそれぞれ図13、図14および図15に示す。   The algorithm for determining the pixel value after color reduction from the pixel value of the original image is as follows. As a premise, a reference pixel value (hereinafter referred to as “reference pixel value”) is determined as follows. First, among pixel values 0 to 255 constituting 256 gradations, 0 and 255 at both ends are set as reference pixel values, respectively. The remaining (number of gradations after subtractive gradation−2) reference pixel values are arranged between 0 and 255 so that the intervals are equal, including 0 and 255 at both ends. Each reference pixel value is numbered as 0, 1, 2,... In order from the smallest reference pixel value. Then, the distribution of reference pixel values is determined. The distributions of the reference pixel values corresponding to the number of gradations of 2, 4, and 8 are shown in FIGS. 13, 14, and 15, respectively.

図13を参照して、2階調の場合には、基準画素値は上記の説明からわかるように0と255とからなる。原画像の画素値が0と255とのいずれに近いかによって、減色後の画素は0か1かの値をとる。   Referring to FIG. 13, in the case of two gradations, the reference pixel value is composed of 0 and 255 as can be seen from the above description. Depending on whether the pixel value of the original image is close to 0 or 255, the pixel after color reduction takes a value of 0 or 1.

図14を参照して、4階調の場合には、0と255以外に85および170が基準画素値となる。原画像の画素が0、85、170、255のいずれに最も近いかによって、減色後の画素は0〜3のいずれかの値をとる。   Referring to FIG. 14, in the case of 4 gradations, 85 and 170 are the reference pixel values in addition to 0 and 255. Depending on whether the pixel of the original image is closest to 0, 85, 170, or 255, the pixel after color reduction takes any value from 0 to 3.

8階調の場合には、図15に示されるように、0と255以外に、36、73、109
、146、182、219も基準画素値となる。図13および図14の場合と同様に原画像の画素値がこれら基準画素値のいずれに最も近いかによって減色後の画素値に0〜7のいずれかの値が割り振られる。
In the case of 8 gradations, as shown in FIG. 15, in addition to 0 and 255, 36, 73, 109
146, 182, and 219 are also reference pixel values. As in the case of FIG. 13 and FIG. 14, one of 0 to 7 is assigned to the pixel value after color reduction depending on which of the reference pixel values the pixel value of the original image is closest to.

なお、減色後の階調数、原画像の階調数および画素値によっては、上下の基準画素値との差の絶対値が同じになるような画素(上下の基準画素値のちょうど中間に位置する画素)が出現する可能性がある。そのような場合には、本実施の形態では常に低い方の基準画素値を採用するものとする。もちろんこの場合の画素値の決定方法は、矛盾がない範囲で予め取決めをしておけばどのような方法を採用してもよい。たとえば二つの基準画素値のうち、常に高い方の基準画素値を採用するなどの方法をとることもできる。   Depending on the number of gradations after color reduction, the number of gradations of the original image, and the pixel value, pixels that have the same absolute value of the difference from the upper and lower reference pixel values (positioned exactly in the middle of the upper and lower reference pixel values) May appear). In such a case, in this embodiment, the lower reference pixel value is always adopted. Of course, any pixel value determination method in this case may be adopted as long as an agreement is made in a range in which there is no contradiction. For example, a method of always adopting the higher reference pixel value of the two reference pixel values may be employed.

このアルゴリズムの下では、原画像の階調数より小さなjについて、j階調に減色するときに、減色後の画素値が0から数えてk番目の画素値になるような最小の画素値が必ず存在する。ただしここでいう最小の画素値とは、実際の入力画像からとるのではなく、入力としてあり得る画素値すべてを想定した場合の、言わば計算上の値である。たとえば画像を2階調に減色するときには、0以上127以下の値を持つ画素は0番目の基準画素値0に近いと判定される。したがってT[2][0]、すなわち第2減色テーブル1103の(2,0)番目の要素は0となる。また128以上255以下の値を持つ画素は1番目の基準画素値255に近いと判定される。したがって第2減色テーブル1103のT[2][1]は128となる。   Under this algorithm, for j smaller than the number of gradations of the original image, when the color is reduced to j gradations, the minimum pixel value is such that the pixel value after color reduction is counted from 0 and becomes the kth pixel value. It must exist. However, the minimum pixel value here is not a value from an actual input image, but a calculated value when all possible pixel values are assumed as an input. For example, when the image is reduced to two gradations, a pixel having a value between 0 and 127 is determined to be close to the 0th reference pixel value of 0. Therefore, T [2] [0], that is, the (2,0) th element of the second color reduction table 1103 is 0. A pixel having a value of 128 or more and 255 or less is determined to be close to the first reference pixel value 255. Therefore, T [2] [1] in the second color reduction table 1103 is 128.

同様に4階調に減少する場合を考えると、0以上42以下の画素値は0番目の基準画素値0に、43以上127以下の画素値は1番目の基準画素値85に、128以上212以下の画素は2番目の基準画素値170に、213以上255以下の画素は3番目の基準画素値255に、それぞれ最も近いと判定される。したがってT[4][0]=0、T[4][1]=43、T[4][2]=128、およびT[4][3]=213となる。   Similarly, when considering the case of decreasing to four gradations, pixel values of 0 to 42 are set to the 0th reference pixel value 0, pixel values of 43 to 127 are set to the first reference pixel value 85, and 128 to 212. The following pixels are determined to be closest to the second reference pixel value 170, and the pixels from 213 to 255 are determined to be closest to the third reference pixel value 255, respectively. Therefore, T [4] [0] = 0, T [4] [1] = 43, T [4] [2] = 128, and T [4] [3] = 213.

同様の計算を8階調について行なえばT[4][0]〜T[4][7]の要素はそれぞれ0、18、55、91、128、164、200および237となる。もちろんここに挙げた数値はあくまでも一例であって本発明がこれに限定されるわけではない。   If the same calculation is performed for 8 gradations, the elements of T [4] [0] to T [4] [7] are 0, 18, 55, 91, 128, 164, 200, and 237, respectively. Of course, the numerical values given here are merely examples, and the present invention is not limited thereto.

以上の説明から、第2減色テーブル1103は2次元配列ではあるが、そこには不要な要素が多く含まれていることがわかる。すなわち、第1減色テーブル1102の要素となっていないようなjに対応するT[j][k]要素は不要である。またj,kに対応するT[j][k]も不要である。本実施の形態では、このような不要な添え字の組合せに対応する第2減色テーブル1103の要素T[j]には0が格納されているものとする。   From the above description, the second color reduction table 1103 is a two-dimensional array, but it can be seen that there are many unnecessary elements. That is, a T [j] [k] element corresponding to j that is not an element of the first color reduction table 1102 is not necessary. Also, T [j] [k] corresponding to j and k is not necessary. In this embodiment, it is assumed that 0 is stored in the element T [j] of the second color reduction table 1103 corresponding to such an unnecessary combination of subscripts.

図16を参照して、文字矩形減色器614のコントローラ1101が各構成要素を制御する処理の制御構造について説明する。以下の説明でも、コントローラ1101は常に関与しているが、説明の簡略化のためにコントローラ1101には言及しないことがある。   With reference to FIG. 16, a control structure of processing in which the controller 1101 of the character rectangular color reducer 614 controls each component will be described. In the following description, the controller 1101 is always involved, but the controller 1101 may not be referred to for the sake of simplicity.

まず、線抽出器1105が、2値画像バッファ606を参照して、現在処理対象となっている矩形領域から縦方向または横方向の直線を抽出して、その情報を線情報バッファ1107に格納する(S1201)。なお図3に示す線抽出器607と図12に示す線抽出器1105との機能は似ており、そのため同じモジュールでこれらを兼用させることができる。ただし、線抽出器1105で取出すことが意図されているのは、一般的な意味での線ではなく、図17および図18に例が示されているような、文字中の横棒または縦棒である。そのため線抽出器1105が動作する際のパラメータ(線とみなすための最低の長さなど)は、図3に示す線抽出器607が動作する際のパラメータとは一般的には異なったものである。本実施の形態では、線抽出器1105では、図3の線抽出器607で用い
た方法、すなわち特許第3100825号公報に開示されているような技術を用いる。
First, the line extractor 1105 refers to the binary image buffer 606, extracts a straight line in the vertical direction or the horizontal direction from the rectangular region currently being processed, and stores the information in the line information buffer 1107. (S1201). Note that the functions of the line extractor 607 shown in FIG. 3 and the line extractor 1105 shown in FIG. 12 are similar to each other, so that they can be shared by the same module. However, what is intended to be taken out by the line extractor 1105 is not a line in a general sense, but a horizontal bar or vertical bar in characters as shown in FIGS. 17 and 18. It is. Therefore, the parameters when the line extractor 1105 operates (such as the minimum length to be regarded as a line) are generally different from the parameters when the line extractor 607 shown in FIG. 3 operates. . In the present embodiment, the line extractor 1105 uses the method used in the line extractor 607 of FIG. 3, that is, the technique disclosed in Japanese Patent No. 3100825.

再び図16を参照して、コントローラ1101は、第1カウンタ1108の値iを0に初期化する(S1202)。以下iは第1カウンタ1108の値を意味するものとする。   Referring to FIG. 16 again, the controller 1101 initializes the value i of the first counter 1108 to 0 (S1202). Hereinafter, i means the value of the first counter 1108.

累積ヒストグラム生成器1110が、i番目の線の両側の帯状の領域の、画素値の累積ヒストグラムを生成し累積ヒストグラムバッファ1111に格納する(S1203)。ここで累積ヒストグラムと呼ぶのは、i番目の線の両側の帯状領域について、各画素値ごとに、その画素値未満の画素数を集計したものである。累積ヒストグラムバッファ1111は、原画像で可能な画素値と1対1対応する整数配列である。すなわちこの例では原画像が256階調なので、累積ヒストグラムバッファ1111も256の要素からなる。以下、累積ヒストグラムバッファ1111のm番目の要素をH[m]と表わすことがある。   The cumulative histogram generator 1110 generates a cumulative histogram of pixel values of the band-like regions on both sides of the i-th line and stores it in the cumulative histogram buffer 1111 (S1203). Here, the cumulative histogram is a total of the number of pixels less than the pixel value for each pixel value in the band-like regions on both sides of the i-th line. The cumulative histogram buffer 1111 is an integer array that has a one-to-one correspondence with possible pixel values in the original image. That is, since the original image has 256 gradations in this example, the cumulative histogram buffer 1111 is also composed of 256 elements. Hereinafter, the m-th element of the cumulative histogram buffer 1111 may be expressed as H [m].

要するに、H[m]とは、処理領域中で、m未満の画素値を持つ画素の数である。したがってH[0]は、その領域の画素値分布に無関係に必ず0になる。画像の領域を指定すれば、そこに含まれる全画素からなる集合が1つ定まり、それについてこのような累積ヒストグラムを作成できるのは明らかである。当業者であれば累積ヒストグラム生成器1110の構成および動作を容易に理解し、実現させることができるであろう。   In short, H [m] is the number of pixels having a pixel value less than m in the processing region. Therefore, H [0] is always 0 regardless of the pixel value distribution in that region. If an image area is designated, one set of all the pixels contained therein is determined, and it is clear that such a cumulative histogram can be created. One skilled in the art can readily understand and implement the configuration and operation of the cumulative histogram generator 1110.

図19〜図21を参照して、この累積ヒストグラムについて説明する。図19を参照して、入力文字から抽出された横線1501の上側に帯状の領域1502を、下側に帯状の領域1503を、それぞれ想定する。帯状領域としては、ここでは線を上下に2ドットずつ(縦線の場合には左右に2ドットずつ)膨らませた領域から、当該線を除いた領域とする。   The cumulative histogram will be described with reference to FIGS. Referring to FIG. 19, a band-like region 1502 is assumed on the upper side of horizontal line 1501 extracted from the input character, and a band-like region 1503 is assumed on the lower side. Here, the band-like region is a region obtained by removing the line from the region in which the line is expanded two dots up and down (two dots left and right in the case of a vertical line).

図20は、図19と同じ入力画像を8値化した後の例である。この例では、7以外の画素値をとる非背景領域1504が得られるが、これは図19に示される横線1501より太っている。これは、直線を抽出する際に用いられる2値化しきい値が、8値で非背景領域となるような、8値に減色したときに7以外の画素値となるような画素値の基準画素値237より通常かなり低いこと、またそのようにして得られた非背景領域から直線を抽出した時点でヒゲなどが一般に取れることなどが理由である。   FIG. 20 shows an example after the same input image as FIG. 19 is converted into eight values. In this example, a non-background region 1504 having a pixel value other than 7 is obtained, which is thicker than the horizontal line 1501 shown in FIG. This is a reference pixel having a pixel value such that the binarization threshold value used when extracting a straight line becomes a non-background region with 8 values, and becomes a pixel value other than 7 when the color is reduced to 8 values. The reason is that it is usually much lower than the value 237, and that at the time when a straight line is extracted from the non-background region obtained in such a manner, whiskers and the like are generally removed.

図21には、同じ入力画像を4値化した例を示す。図21に示される例では、3以外の画素値をとる非背景領域1505は、図20に示される非背景領域1504に比べて痩せている。図19に示される帯状領域1502および1503において、このように減色階調数を8(図20)から4(図21)に変化させたとき、8値減色時には非背景領域に属し、4値減色時には背景領域になる画素が多いときに、8階調の減色では劣化はそれほどないが、4階調では劣化が激しいとみなすのである。   FIG. 21 shows an example in which the same input image is binarized. In the example shown in FIG. 21, the non-background region 1505 having a pixel value other than 3 is thinner than the non-background region 1504 shown in FIG. In the belt-like areas 1502 and 1503 shown in FIG. 19, when the number of subtractive color gradations is changed from 8 (FIG. 20) to 4 (FIG. 21) in this way, it belongs to the non-background area at the time of 8-value color reduction, and the 4-value color reduction. Sometimes, when there are many pixels that become the background area, there is not much deterioration with 8 gradations of color reduction, but with 4 gradations, it is considered that the deterioration is severe.

再び図16を参照してコントローラ1101は、第2カウンタ1109の値jをv−1という値に初期化する(S1204)。現在の例ではj=4−1=3となる。   Referring to FIG. 16 again, the controller 1101 initializes the value j of the second counter 1109 to a value of v−1 (S1204). In the present example, j = 4-1 = 3.

続いてコントローラ1101は、第1減色テーブル1102、第2減色テーブル1103、可能階調数レジスタ1104、第2カウンタ1109、累積ヒストグラムバッファ1111を参照して、H[T[S[j]][S[j]−1]]の値を取出し、H[T[S[v]][S[v]−1]]と比較する(S1205)。両者の間に大きな差がなければ制御はS1206に進み、さもなければ第2カウンタ1109の値jをインクリメントし(S1208)、S1209に制御は進む。   Subsequently, the controller 1101 refers to the first subtractive color table 1102, the second subtractive color table 1103, the possible gradation number register 1104, the second counter 1109, and the cumulative histogram buffer 1111 to refer to H [T [S [j]] [S The value of [j] -1]] is taken out and compared with H [T [S [v]] [S [v] -1]] (S1205). If there is no significant difference between the two, the control proceeds to S1206, otherwise the value j of the second counter 1109 is incremented (S1208), and the control proceeds to S1209.

ここで行なわれる比較の物理的意味について説明する。T[S[v]][S[v]−1
]は、最大の減色後階調数S[v]の下での、背景領域となるような画素値の減色前の最小値を示す。S[v]は、最大の減色階調数、S[v]−1は、そのような減色の下での、減色後の最大画素値を示しているからである。同様に、T[S[j]][S[j]−1]は、j番目の減色階調数S[j]の下での、背景領域となるような画素値の減色前の最小値を示す。
The physical meaning of the comparison performed here will be described. T [S [v]] [S [v] -1
] Indicates the minimum value before color reduction of the pixel value that becomes the background area under the maximum gradation number S [v] after color reduction. This is because S [v] represents the maximum number of subtractive color gradations, and S [v] -1 represents the maximum pixel value after subtractive color under such subtractive color. Similarly, T [S [j]] [S [j] −1] is the minimum value before color reduction of the pixel value that becomes the background region under the jth subtractive color gradation number S [j]. Indicates.

一般にH[m]は、m未満の画素値を持つ画素値の数なので、H[T[S[v]][S[v]−1]]は、最大の階調数への減色の下では、背景領域にならない画素の数を示す。同様にH[T[S[j]][S[j]−1]]は、j番目の減色階調数での下で、背景領域にならない画素の数を示す。   In general, since H [m] is the number of pixel values having a pixel value less than m, H [T [S [v]] [S [v] -1]] is reduced under the maximum number of gradations. Here, the number of pixels that do not become the background region is shown. Similarly, H [T [S [j]] [S [j] −1]] indicates the number of pixels that do not become the background area under the jth subtractive color number.

この2つの数に大きな差があるということは、S[v]階調への減色では背景領域でなかったのに、j<vとなるようなあるjについて、S[j]階調への減色では背景領域になってしまう画素が多くあるということを意味する。このような判定を行なっている対象は、文字中の縦、横方向の直線の両側の帯領域である。したがってこれは、S[j]階調への減色は、S[v]階調への減色に比べて、文字を構成する線の劣化が著しいということを意味する。つまり、減色によるがたつきまたは痩せ細りが目立つということである。そこで、このような場合にはステップS1205において、その領域についてはこれ以上の減色はできないと判断し、それ以上の減色を止めるようにしたのである。   The large difference between the two numbers means that for a certain j such that j <v, although it was not a background area in the color reduction to S [v] gradation, This means that there are many pixels that will become the background area in color reduction. An object for which such a determination is made is a band area on both sides of a straight line in the vertical and horizontal directions in the character. Therefore, this means that the color reduction to the S [j] gradation has a significant deterioration of the lines constituting the character compared to the color reduction to the S [v] gradation. That is, rattling or thinning due to color reduction is conspicuous. In such a case, in step S1205, it is determined that no further color reduction can be performed for the area, and further color reduction is stopped.

再び図16を参照して、ステップS1206では、コントローラ1101は第2カウンタ1109の値jをデクリメントし、jと0とを比較する(S1207)。jが0より小さければ制御はS1208に進み、さもなければ制御はS1205に戻る。   Referring to FIG. 16 again, in step S1206, the controller 1101 decrements the value j of the second counter 1109, and compares j with 0 (S1207). If j is less than 0, control proceeds to S1208, otherwise control returns to S1205.

第2カウンタ1109の値jが0より小さい場合、コントローラ1101は、第2カウンタ1109の値jをインクリメントし(S1208)、さらにテンポラリー線階調数バッファ1112のi番目の要素(以下TLB[i])にS[j]を代入する(S1209)。   When the value j of the second counter 1109 is smaller than 0, the controller 1101 increments the value j of the second counter 1109 (S1208), and further the i-th element (hereinafter, TLB [i]) of the temporary line gradation number buffer 1112. ) Is substituted for S [j] (S1209).

続いてコントローラ1101は第1カウンタ1108の値iをインクリメントし(S1210)、第1カウンタ1108の値iと線本数レジスタ1106の値とを比較する(S1211)。両者が等しければ制御はS1212に進み、さもなければ制御はS1203に戻る。   Subsequently, the controller 1101 increments the value i of the first counter 1108 (S1210), and compares the value i of the first counter 1108 with the value of the line number register 1106 (S1211). If they are equal, control proceeds to S1212, otherwise control returns to S1203.

第1カウンタ1108の値iと線本数レジスタ1106の値とが等しい場合、次に行なわれる処理はテンポラリー線階調数バッファ1112の最小の要素を取出す処理である。そのためにコントローラ1101は第2カウンタ1109の値jに、TLB[0]の値を代入する(S1212)。コントローラ1101は、第1カウンタ1108の値iに1を代入する(S1213)。続いてコントローラ1101は、jとTLB[i](すなわちS[i])とを比較する(S1214)。jの方が大きければ制御はS1215に進み、さもなければ制御はS1216に進む。jの方が大きい場合には、第2カウンタ1109の値jにTLB[i]を代入する(S1215)。   When the value i of the first counter 1108 is equal to the value of the line number register 1106, the next process is a process for extracting the minimum element of the temporary line gradation number buffer 1112. For this purpose, the controller 1101 substitutes the value of TLB [0] for the value j of the second counter 1109 (S1212). The controller 1101 assigns 1 to the value i of the first counter 1108 (S1213). Subsequently, the controller 1101 compares j with TLB [i] (that is, S [i]) (S1214). If j is larger, control proceeds to S1215, otherwise control proceeds to S1216. If j is larger, TLB [i] is substituted for the value j of the second counter 1109 (S1215).

続いてコントローラ1101は、第1カウンタ1108の値iをインクリメントし(S1216)、第1カウンタ1108の値iと線本数レジスタ1106の値とを比較する(S1217)。両者が等しければ制御はS1218に進み、さもなければ制御はS1214に戻る。   Subsequently, the controller 1101 increments the value i of the first counter 1108 (S1216), and compares the value i of the first counter 1108 with the value of the line number register 1106 (S1217). If they are equal, control proceeds to S1218, otherwise control returns to S1214.

第1カウンタ1108の値iと線本数レジスタ1106の値とが等しければ、コントローラ1101は文字矩形減色器614の出力として第2カウンタ1109の値を出力し(
S1218)、処理を終了する。
If the value i of the first counter 1108 is equal to the value of the line number register 1106, the controller 1101 outputs the value of the second counter 1109 as the output of the character rectangular color reducer 614 (
S1218), the process is terminated.

次に、図8に示したS5202で行なわれる小領域iの階調数決定処理を行なう小領域減色器616について説明する。図22を参照して、小領域減色器616は、コントローラ1701と、可能階調数レジスタ1702と、減色テーブル1703と、第1カウンタ1704と、画素値変換器1705と、テンポラリー減色画像バッファ1706と、基準画素値テーブル1707とを含む。   Next, the small area color reducer 616 that performs the gradation number determination processing for the small area i performed in S5202 shown in FIG. 8 will be described. Referring to FIG. 22, the small area color reducer 616 includes a controller 1701, a possible gradation number register 1702, a color reduction table 1703, a first counter 1704, a pixel value converter 1705, and a temporary color reduction image buffer 1706. A reference pixel value table 1707.

コントローラ1701は、小領域減色器616の他の各構成要素の制御および他の各構成要素間または各構成要素と小領域減色器616の外部との間のデータ通信の制御を行なうためのものである。コントローラ1701は小領域減色器616の他の各構成要素の動作に常に関与している。しかし、説明の簡略化のために、理解に差し支えない範囲でコントローラ1701の動作については以下で言及しないことがある。   The controller 1701 controls the other components of the small area color reducer 616 and controls data communication between the other components or between each component and the outside of the small area color reducer 616. is there. The controller 1701 is always involved in the operation of the other components of the small area color reducer 616. However, for the sake of simplification of explanation, the operation of the controller 1701 may not be mentioned below as long as it is understandable.

減色テーブル1703は、図12に示す第2減色テーブル1103と同じ構造および内容を持っている。また、可能階調数レジスタ1702は、小領域減色器616の出力として可能な階調数を予め格納するためのものである。この階調数は予め決定されている。この例では、可能階調数レジスタ1702に格納されている値は、図12に示す可能階調数レジスタ1104に格納されているものと同じ値「4」である。なお以下の説明では、可能階調数レジスタ1104に4以外の値が格納されている場合についても一般化するために、可能階調数レジスタ1702の値としてvを用いる。   The color reduction table 1703 has the same structure and contents as the second color reduction table 1103 shown in FIG. The possible gradation number register 1702 is for storing in advance the number of gradations possible as an output of the small area color reducer 616. The number of gradations is determined in advance. In this example, the value stored in the possible gradation number register 1702 is the same value “4” as that stored in the possible gradation number register 1104 shown in FIG. In the following description, v is used as the value of the possible gradation number register 1702 in order to generalize the case where a value other than 4 is stored in the possible gradation number register 1104.

画素値変換器1705は、基準画素値テーブル1707に格納された基準画素値に基づいて、画素値を256階調からS[i]階調に変換する機能を有する。テンポラリー減色画像バッファ1706は、画素値変換器1705によって減色された後の画像を格納するためのものである。   The pixel value converter 1705 has a function of converting pixel values from 256 gradations to S [i] gradations based on the reference pixel values stored in the reference pixel value table 1707. The temporary color-reduced image buffer 1706 is for storing the image after color reduction by the pixel value converter 1705.

基準画素値テーブル1707は、図12に示す第2減色テーブル1103と似た2次元配列である。ただし、その値は基準画素値である。以下基準画素値テーブル1707の2次元テーブルの(ij)成分をU[i][j]と書く。   The reference pixel value table 1707 is a two-dimensional array similar to the second color reduction table 1103 shown in FIG. However, the value is a reference pixel value. Hereinafter, the (ij) component of the two-dimensional table of the reference pixel value table 1707 is written as U [i] [j].

コントローラ1701によって行なわれる処理の制御構造について図23を参照して説明する。まずコントローラ1701は、第1カウンタ1704の値iをv−1に初期化する(S1801)。以下iは第1カウンタ1704の値を意味するものとする。続いてコントローラ1701は、入力画像バッファ302に格納されている原画像の、iおよび小領域情報バッファ604によって特定される処理領域を、画素値変換器1705を用いてS[i]階調に減色し、テンポラリー減色画像バッファ1706に格納する(S1802)。   A control structure of processing performed by the controller 1701 will be described with reference to FIG. First, the controller 1701 initializes the value i of the first counter 1704 to v−1 (S1801). Hereinafter, i means the value of the first counter 1704. Subsequently, the controller 1701 uses the pixel value converter 1705 to reduce the processing area specified by the i and small area information buffer 604 of the original image stored in the input image buffer 302 to S [i] gradation. The temporary color-reduced image buffer 1706 is stored (S1802).

画素値変換器1705による、256階調からS[i]階調への変換方法として、ここでは図12に示す第2減色テーブル1103に関する説明で述べたものと同様の手法を用いる。すなわち、基準画素値を元の色空間に均等に配置し、原画像の画素値がどの基準画素値に近いかによって、減色後の画素値が決定される。このための基準画素値として基準画素値テーブル1707に格納されている値が使用される。   As a conversion method from 256 gradations to S [i] gradations by the pixel value converter 1705, here, the same technique as described in the explanation regarding the second color reduction table 1103 shown in FIG. 12 is used. That is, the reference pixel values are evenly arranged in the original color space, and the pixel value after color reduction is determined depending on which reference pixel value the pixel value of the original image is close to. A value stored in the reference pixel value table 1707 is used as the reference pixel value for this purpose.

原画像が256階調であるという条件の下で、4階調に対応する部分について基準画素値テーブル1707の値を示すと次のとおりである。すなわち、U[4][0]=0、U[4][1]=85、U[4][2]=170、U[4][3]=255である。   Under the condition that the original image has 256 gradations, the values in the reference pixel value table 1707 for the portion corresponding to 4 gradations are as follows. That is, U [4] [0] = 0, U [4] [1] = 85, U [4] [2] = 170, U [4] [3] = 255.

なお基準画素値テーブル1707は2次元配列ではあるが、不要な要素を多く含んでい
ること、および省略し得る要素を含んでいることについては、図12に示す第2減色テーブル1003について既に述べたのと同様である。
Although the reference pixel value table 1707 is a two-dimensional array, it has already been described for the second color reduction table 1003 shown in FIG. 12 that it includes many unnecessary elements and elements that can be omitted. It is the same as that.

後の説明に備えて、ここで8階調について同様に基準画素値テーブル1707の値を示しておく。すなわちこの場合U[8][0]〜U[8][7]はそれぞれ、0、36、73、109、146、182、219および255である。   In preparation for later explanation, here, the values of the reference pixel value table 1707 are similarly shown for the eight gradations. That is, in this case, U [8] [0] to U [8] [7] are 0, 36, 73, 109, 146, 182, 219, and 255, respectively.

再び図23を参照して、コントローラ1701は、現在処理中の小領域に対応する、入力画像バッファ301の小領域の画素と、テンポラリー減色画像バッファ1706の小領域の画素の値との比較を行なう(S1803)。両者の差が大きければ原画像に比べて減色後の画像が大きく劣化しているものと判断して制御はS1805に進む。そうでない場合は制御はS1804に進む。   Referring to FIG. 23 again, the controller 1701 compares the value of the pixel in the small area of the input image buffer 301 and the value of the pixel in the small area of the temporary color-reduced image buffer 1706 corresponding to the small area currently being processed. (S1803). If the difference between the two is large, it is determined that the image after color reduction is greatly deteriorated compared to the original image, and the control advances to S1805. Otherwise, control proceeds to S1804.

S1803で行なわれる処理は、基本的には、対応する各画素同士の差の平均値を算出して、予め定めておいたしきい値と比較する処理である。しかし、テンポラリー減色画像バッファ1706の内容は、S[i]階調に減色されている。そのため、このままでは256階調の原画像と意味のある比較が行なえない。そこで本実施の形態では、次のような方法を用いる。   The process performed in S1803 is basically a process of calculating an average value of differences between corresponding pixels and comparing it with a predetermined threshold value. However, the contents of the temporary color-reduced image buffer 1706 are reduced to S [i] gradation. For this reason, it is impossible to make a meaningful comparison with the original image having 256 gradations. Therefore, in the present embodiment, the following method is used.

テンポラリー減色画像バッファ1706から取出した1つの画素の画素値をwとする。この画素値wをU[S[i]][w]に変換する。つまり画素値wを、減色に用いられた基準画素値に変換する。このように変換された値を、テンポラリー減色画像バッファ1706に格納されている画像の対応する画素と比較するのである。   The pixel value of one pixel extracted from the temporary color-reduced image buffer 1706 is set as w. This pixel value w is converted into U [S [i]] [w]. That is, the pixel value w is converted into the reference pixel value used for color reduction. The converted value is compared with the corresponding pixel of the image stored in the temporary subtractive color buffer 1706.

S1803で行なわれる判定の結果、入力画像バッファ301の小領域の画素と、テンポラリー減色画像バッファ1706の小領域の画素の値との差が予め定めたしきい値より小さい場合、コントローラ1701は、第1カウンタ1704の値iをデクリメントする(S1804)。そしてこの第1カウンタ1704の値iと0とを比較し(S1805)、iが0より小さければ制御はS1806に進み、そうでなければ制御はS1802に戻る。   As a result of the determination performed in S1803, if the difference between the small area pixel of the input image buffer 301 and the small area pixel value of the temporary color-reduced image buffer 1706 is smaller than a predetermined threshold, the controller 1701 The value i of the 1 counter 1704 is decremented (S1804). Then, the value i of the first counter 1704 is compared with 0 (S1805). If i is smaller than 0, the control proceeds to S1806, and if not, the control returns to S1802.

S1803で画像が大きく劣化したと判定された場合、およびS1805で第1カウンタ1704の値iが0より小さいと判定された場合、コントローラ1701は、小領域減色器616の出力としてS[i+1]を出力して処理を終了する(S1806)。   If it is determined in S1803 that the image has greatly deteriorated, and if it is determined in S1805 that the value i of the first counter 1704 is smaller than 0, the controller 1701 outputs S [i + 1] as the output of the small area color reducer 616. Then, the process is terminated (S1806).

図24を参照して、図3に示す小領域階調数検証器619は、コントローラ2001と、基準階調数レジスタ2002と、画素値変換器2003と、基準画素値テーブル2004と、減色画像バッファ2005と、第1カウンタ2006と、第2カウンタ2007と、ラベルバッファ2008と、ラベル付替え器2009と、小領域ラベルバッファ2010と、第3カウンタ2011とを含む。   Referring to FIG. 24, the small region gradation number verifier 619 shown in FIG. 3 includes a controller 2001, a reference gradation number register 2002, a pixel value converter 2003, a reference pixel value table 2004, and a subtractive color image buffer. 2005, a first counter 2006, a second counter 2007, a label buffer 2008, a label changer 2009, a small area label buffer 2010, and a third counter 2011 are included.

コントローラ2001は、小領域階調数検証器619の他の各構成要素の制御および他の各構成要素相互間または各構成要素と小領域階調数検証器619の外部との間のデータ通信の制御を行なうためのものである。コントローラ2001は、小領域階調数検証器619の他の各構成要素の動作に常に関与している。しかしここでは、説明の簡略化のために、理解に差し支えないと思われる範囲でコントローラ2001の関与については言及しないことがある。   The controller 2001 controls the other components of the small region gradation number verifier 619 and performs data communication between the other components or between each component and the outside of the small region gradation number verifier 619. It is for performing control. The controller 2001 is always involved in the operation of the other components of the small area gradation number verifier 619. However, here, for simplification of description, the involvement of the controller 2001 may not be mentioned to the extent that it may be understood.

減色画像バッファ2005は、入力画像バッファ302(図1参照)と同じ横幅および縦幅を有し、かつ基準階調数レジスタ2002で与えられる階調数を持つ画像バッファで
ある。ラベルバッファ2008は、減色画像バッファ2005の各画素と1対1で対応する1次元整数配列である。ここで、減色画像バッファ2005の各画素は、ラスタスキャンに従った順序で、ラベルバッファ2008の各要素と対応するものとする。ラベルバッファ2008のi番目の要素をPB[i]と書く。
The subtractive color image buffer 2005 is an image buffer having the same horizontal width and vertical width as the input image buffer 302 (see FIG. 1) and having the number of gradations given by the reference gradation number register 2002. The label buffer 2008 is a one-dimensional integer array that has a one-to-one correspondence with each pixel of the subtractive color image buffer 2005. Here, each pixel of the subtractive color image buffer 2005 corresponds to each element of the label buffer 2008 in the order according to the raster scan. The i-th element of the label buffer 2008 is written as PB [i].

小領域ラベルバッファ2010は、以下の規則で小領域と1対1対応する1次元整数配列である。小領域ラベルバッファ2010のk番目の要素をALB[k]と書く。横方向にj番目、縦方向にi番目の小領域に対応する小領域ラベルバッファ2010の要素は次の式で与えられる。   The small area label buffer 2010 is a one-dimensional integer array that has a one-to-one correspondence with the small area according to the following rules. The k-th element of the small area label buffer 2010 is written as ALB [k]. Elements of the small area label buffer 2010 corresponding to the j-th small area in the horizontal direction and the i-th small area in the vertical direction are given by the following equations.

ALB[i×横方向の小領域数+j]
以下、小領域階調数検証器619の機能を実現するために、コントローラ2001が行なう処理を図25を参照して説明する。コントローラ2001は、入力画像バッファ302の各画素を、基準階調数レジスタ2002に格納されている階調数に画素値変換器2003を用いて減色し、減色画像バッファ2005に格納する(S2101)。ここでは、画素値変換器2003は、図22に示す画素値変換器1705と全く同一の動作を行なうものとする。また画素値変換器2003が参照する基準画素値テーブル2004も、図22に示す基準画素値テーブル1707と全く同内容であるものとする。基準階調数レジスタ2002に格納されている階調数は、予め定められた値であり、画質が良好となる階調数が想定されている。ここでは、基準階調数レジスタ2002には、図1に示す線領域階調数レジスタ618の格納内容と同様、「8」が格納されているものとする。
ALB [i × number of small areas in the horizontal direction + j]
Hereinafter, processing performed by the controller 2001 in order to realize the function of the small region gradation number verifier 619 will be described with reference to FIG. The controller 2001 reduces the color of each pixel of the input image buffer 302 to the number of gradations stored in the reference gradation number register 2002 using the pixel value converter 2003 and stores it in the reduced color image buffer 2005 (S2101). Here, it is assumed that the pixel value converter 2003 performs exactly the same operation as the pixel value converter 1705 shown in FIG. Further, it is assumed that the reference pixel value table 2004 referred to by the pixel value converter 2003 has exactly the same contents as the reference pixel value table 1707 shown in FIG. The number of gradations stored in the reference gradation number register 2002 is a predetermined value, and the number of gradations that provides good image quality is assumed. Here, it is assumed that “8” is stored in the reference gradation number register 2002 in the same manner as the contents stored in the line area gradation number register 618 shown in FIG.

続いてコントローラ2001は、ラベルバッファ2008を初期化する(S2102)。この初期化の方法については後述する。   Subsequently, the controller 2001 initializes the label buffer 2008 (S2102). This initialization method will be described later.

コントローラ2001はさらに、ラベルバッファ2000の値を生成する(S2103)。ラベルバッファ2008の値は、減色画像バッファ2005に格納された画像の、いわゆる8連結の意味で隣接した画素のうち、同じ画素値を持った画素は共通の値を持つように生成される。この方法の詳細については後述する。   The controller 2001 further generates a value of the label buffer 2000 (S2103). The value of the label buffer 2008 is generated so that pixels having the same pixel value among the adjacent pixels in the so-called 8-connected meaning of the image stored in the subtractive color image buffer 2005 have a common value. Details of this method will be described later.

続いてコントローラ2001は、小領域ラベルバッファ2010を初期化する(S2104)。この方法の詳細についても後述する。   Subsequently, the controller 2001 initializes the small area label buffer 2010 (S2104). Details of this method will also be described later.

さらにコントローラ2001は、小領域ラベルバッファ2010の値を生成する(S2105)。小領域ラベルバッファ2010の値は、ラベルバッファ2000の値が同じ画素を持つような2つの小領域には対応する小領域ラベルバッファ2010の要素に同じ値が入るように生成される。この方法の詳細については後述する。   Further, the controller 2001 generates a value of the small area label buffer 2010 (S2105). The value of the small area label buffer 2010 is generated so that two small areas having the same pixel in the label buffer 2000 have the same value in the corresponding elements of the small area label buffer 2010. Details of this method will be described later.

図25に示すS2102で行なわれる処理について図26を参照してより詳細に説明する。ラベルバッファの初期化処理ではコントローラ2001は、第1カウンタ2006の値iを0に初期化する(S2201)。以下第1カウンタ2006の値をiとする。   The process performed in S2102 shown in FIG. 25 will be described in detail with reference to FIG. In the label buffer initialization process, the controller 2001 initializes the value i of the first counter 2006 to 0 (S2201). Hereinafter, the value of the first counter 2006 is i.

続いてコントローラ2001は、ラベルバッファ2000のLB[i]の値をiと初期化する(S2202)。さらにコントローラ2001は、第1カウンタ2006の値iをインクリメントし(S2203)、この第1カウンタ2006の値iを、減色画像バッファ2005の画素数(=横幅×縦幅)と比較する(S2204)。両者が等しければ処理は終了し、さもなければ制御はS2202に戻る。   Subsequently, the controller 2001 initializes the value of LB [i] in the label buffer 2000 to i (S2202). Further, the controller 2001 increments the value i of the first counter 2006 (S2203), and compares the value i of the first counter 2006 with the number of pixels (= horizontal width × vertical width) of the reduced color image buffer 2005 (S2204). If they are equal, the process ends. Otherwise, the control returns to S2202.

図25のS2103において行なわれるラベルバッファの値を生成する処理の詳細につき図27を参照して説明する。図27を参照して、コントローラ2001は、第1カウン
タ2006の値iを0に初期化する(S2301)。以下第1カウンタ2006の値をiと呼ぶ。続いてコントローラ2001は、第2カウンタ2007の値jを0に初期化する(S2302)。以下、第2カウンタ2007の値をjとする。
Details of the process of generating the label buffer value performed in S2103 of FIG. 25 will be described with reference to FIG. Referring to FIG. 27, the controller 2001 initializes the value i of the first counter 2006 to 0 (S2301). Hereinafter, the value of the first counter 2006 is referred to as i. Subsequently, the controller 2001 initializes the value j of the second counter 2007 to 0 (S2302). Hereinafter, the value of the second counter 2007 is j.

以下の説明では、減色画像バッファ2005(図24参照)において座標(j,i)に対応する画素を「着目画素」と呼ぶ。コントローラ2001は、着目画素と、その左上の(j−1,i−1)という座標を持つ画素とが同じ画素値を持っているかどうかを検査する(S2303)。両者が同じ画素値を持っていれば制御はS2304に、そうでなければ制御はS2305に進む。   In the following description, a pixel corresponding to the coordinate (j, i) in the subtractive color image buffer 2005 (see FIG. 24) is referred to as a “target pixel”. The controller 2001 checks whether the pixel of interest and the pixel having the coordinates (j−1, i−1) at the upper left have the same pixel value (S2303). If both have the same pixel value, control proceeds to S2304, otherwise control proceeds to S2305.

S2304では、ラベル付け替え器2009(図24参照)を用いて、ラベルバッファ2008(図24参照)の書換を行なう(S2304)。ここでは、ラベルバッファ2008の書換は以下のようにして行なわれる。すなわち、着目画素と、その左上の画素それぞれに対応するラベルバッファ2008の要素LB[k],LB[m]と、それまでにその両者のいずれかと同じ値を持っていた代表パターンラベルバッファ2008のすべての要素とに、共通の値min(LB[k],LB[m])を代入する。ここでk、mはそれぞれ以下の式によって得られる整数である。   In step S2304, the label buffer 2008 (see FIG. 24) is rewritten using the label changer 2009 (see FIG. 24) (S2304). Here, rewriting of the label buffer 2008 is performed as follows. That is, the element LB [k], LB [m] of the label buffer 2008 corresponding to the pixel of interest and each of the upper left pixels, and the representative pattern label buffer 2008 having the same value as either of them until then. A common value min (LB [k], LB [m]) is substituted for all elements. Here, k and m are integers obtained by the following equations, respectively.

k=i×画像の横幅+j
m=(i−1)×画像の横幅+(j−1)
着目画素の左上の画素が存在しない場合には、S2303の条件は常に成り立たないものとする。すなわちj<1またはi<1の場合には、S2304の処理は行なわれない。
k = i × width of image + j
m = (i−1) × width of image + (j−1)
When there is no upper left pixel of the target pixel, the condition of S2303 is not always satisfied. That is, if j <1 or i <1, the process of S2304 is not performed.

次に、着目画素の左上の画素の代わりに、真上の画素についてS2305においてS2303と同じ判断を行なう。すなわち、コントローラ2001は、着目画素と、その真上の(j,i−1)という座標を持つ画素とが同じ画素値を持っているかどうかを検査する(S2305)。もし両者が同じ画素値を持っていれば制御はS2306に、さもなければ制御はS2307に進む。   Next, instead of the upper left pixel of the target pixel, the same determination as in S2303 is performed in S2305 for the pixel immediately above. That is, the controller 2001 checks whether the pixel of interest and the pixel having the coordinate (j, i−1) directly above have the same pixel value (S2305). If both have the same pixel value, control proceeds to S2306, otherwise control proceeds to S2307.

ステップS2306では、ラベル付け替え器2009を用いて、ラベルバッファ2008の書換が行なわれる。ここではラベルバッファ2008の書換は以下のようにして行なわれる。すなわち、着目画素と、その真上の画素それぞれに対応するラベルバッファ2008の要素LB[k]、LB[m]と、それまでにその両者のいずれかと同じ値を持っていた代表パターンラベルバッファ2008のすべての要素とに共通の値min(LB[k],LB[m])を代入する。ただし、k、mはそれぞれ以下の式によって得られる値である。   In step S <b> 2306, the label buffer 2008 is rewritten using the label changer 2009. Here, the rewriting of the label buffer 2008 is performed as follows. That is, the element LB [k] and LB [m] of the label buffer 2008 corresponding to the pixel of interest and the pixel immediately above the pixel, and the representative pattern label buffer 2008 that had the same value as either of them until then. A common value min (LB [k], LB [m]) is substituted for all the elements. However, k and m are values obtained by the following equations, respectively.

k=i×画像の横幅+j
m=(i−1)×画像の横幅+j
着目画素の真上の画素が存在しない場合、すなわちi<1の場合には、S2305における条件は常に成立しないと考える。
k = i × width of image + j
m = (i−1) × width of image + j
When there is no pixel directly above the target pixel, that is, when i <1, it is considered that the condition in S2305 is not always satisfied.

次に、S2307において、着目画素の真上の画素の代わりに、右上の画素についてS2303、S2305と同じ判断を行なう。すなわち、コントローラ2001は、着目画素と、その右上の(j+1,i−1)という座標を持つ画素とが同じ画素値を持っているかどうかを検査して(ステップS2307)、同じ画素値を持っていれば制御はS2308に、さもなければ制御はS2309に進む。   Next, in S2307, the same determination as in S2303 and S2305 is performed for the upper right pixel instead of the pixel immediately above the target pixel. That is, the controller 2001 checks whether the pixel of interest and the pixel having the coordinates (j + 1, i−1) at the upper right of the pixel have the same pixel value (step S2307) and have the same pixel value. If so, control proceeds to S2308; otherwise, control proceeds to S2309.

S2308では、ラベル付け替え器2009を用いて、ラベルバッファ2008の書換を行なう(S2308)。ここでは、ラベルバッファ2008の書換は以下のようにして
行なわれる。すなわち、着目画素と、その右上の画素それぞれに対応するラベルバッファ2008の要素LB[k]、LB[m]と、それまでにその両者のいずれかと同じ値を持っていた代表パターンラベルバッファ2008のすべての要素とに共通の値min(LB[k]、LB[m])を代入する。ただしここでk、mはそれぞれ以下の式に従って定められる整数である。
In S2308, the label buffer 2008 is rewritten using the label re-setter 2009 (S2308). Here, rewriting of the label buffer 2008 is performed as follows. That is, the elements LB [k] and LB [m] of the label buffer 2008 corresponding to the pixel of interest and the upper right pixel respectively, and the representative pattern label buffer 2008 having the same value as either of them until then. A common value min (LB [k], LB [m]) is substituted for all elements. Here, k and m are integers determined according to the following equations, respectively.

k=i×画像の横幅+j
m=(i−1)×画像の横幅+(j+1)
ここでも、着目画素の右上の画素が存在しない場合、すなわちj=画像の横幅−1またはi<1の場合には、ステップS2307の条件は常に成り立たないものとする。
k = i × width of image + j
m = (i−1) × width of image + (j + 1)
Again, if there is no upper right pixel of the target pixel, that is, if j = horizontal width of the image −1 or i <1, the condition of step S2307 is not always satisfied.

続いて、S2309において、着目画素の右上の画素の代わりに、左隣の画素についてS2307と同じ判断を行なう。すなわち、コントローラ2001は、着目画素と、その左隣の(j−1,i)という座標を持つ画素とが同じ画素値を持っているかどうかを検査する(S2309)。もし両者が同じ画素値を持っていれば制御はS2310に、さもなければ制御はS2311に進む。   Subsequently, in S2309, the same determination as that in S2307 is performed on the left adjacent pixel instead of the upper right pixel of the target pixel. In other words, the controller 2001 checks whether the pixel of interest and the pixel having the coordinates (j−1, i) adjacent to the left have the same pixel value (S2309). If both have the same pixel value, control proceeds to S2310, otherwise control proceeds to S2311.

S2310では、ラベル付け替え器2009を用いて、ラベルバッファ2008の書換処理を行なう(S2310)。ラベルバッファ2008の書換は次のようにして行なわれる。すなわち、着目画素と、その左隣の画素それぞれに対応するラベルバッファ2008の要素LB[k]、LB[m]と、それまでにその両者のいずれかと同じ値を持っていた代表パターンラベルバッファ2008のすべての要素とに、共通の値min(LB[k]、LB[m])を代入する。ただしk、mはそれぞれ以下の式に従って計算される整数である。   In S2310, the label rewriter 2009 is used to rewrite the label buffer 2008 (S2310). The rewriting of the label buffer 2008 is performed as follows. That is, the element LB [k] and LB [m] of the label buffer 2008 corresponding to the pixel of interest and each of the pixels adjacent to the left, and the representative pattern label buffer 2008 that had the same value as either of them until then. A common value min (LB [k], LB [m]) is assigned to all the elements. However, k and m are integers calculated according to the following equations, respectively.

k=i×画像の横幅+j
m=i×画像の横幅+(j−1)
ここでは、着目画素の左隣の画素が存在しない場合、すなわちj<1の場合には、S2113の条件は常に成り立たないものとする。
k = i × width of image + j
m = i × width of image + (j−1)
Here, when there is no pixel on the left of the target pixel, that is, when j <1, it is assumed that the condition of S2113 does not always hold.

S2310の処理の後、S2311ではコントローラ2001は、代入カウンタ2007の値jをインクリメントする。コントローラ2001はさらに代入カウンタ2007の値jを画像の横幅と比較し(S2312)、両者が等しければ制御はS2313に進み、さもなければ制御はS2303に戻る。   After the process of S2310, in S2311, the controller 2001 increments the value j of the substitution counter 2007. The controller 2001 further compares the value j of the substitution counter 2007 with the horizontal width of the image (S2312). If they are equal, the control proceeds to S2313, otherwise the control returns to S2303.

S2312における判断の結果がYESであれば、コントローラ2001は、第1カウンタ2006の値iをインクリメントする(S2313)。そして、この第1カウンタ2006の値iが画像の縦幅と等しいか否かについての判定を行なう(S2314)。両者が等しければ処理を終了し、さもなければ制御はS2302に戻る。   If the result of determination in S2312 is YES, the controller 2001 increments the value i of the first counter 2006 (S2313). Then, it is determined whether or not the value i of the first counter 2006 is equal to the vertical width of the image (S2314). If they are equal, the process is terminated; otherwise, the control returns to S2302.

以上の処理では、各着目画素についてその左上、真上、右上および左隣についてのみ連結関係が検査されている。右隣、左下、真下、右下についての連結関係は検査していない。しかしそれらに位置する画素との間の隣接関係については、そのそれぞれの隣接画素が着目画素となったときに処理されるので、図27に示される処理によって8連結の意味での隣接画素同士の連結関係はすべて検査されるのである。   In the above processing, the connection relation is inspected only for the upper left, right above, upper right, and left adjacent for each pixel of interest. The connection relations for the right side, lower left, right below, and lower right are not inspected. However, the adjacency relationship between the pixels located in them is processed when each of the adjacent pixels becomes the pixel of interest, and therefore the adjacent pixels in the sense of 8-connection are processed by the process shown in FIG. All connectivity is inspected.

この図27に示される処理が終了した時点では、ラベルバッファ2008(図24参照)には、減色画像バッファ2005(図24)に格納されている画像を、値が同じで、隣接した画素に同じラベルをつけるという規則でラベリングした結果が入っている。ラベルバッファ2008のこの時点での内容を、以下、「減色連結領域画像」と呼ぶ。またそれ
に含まれる連結領域をそれぞれ「減色連結領域」と呼ぶ。
When the processing shown in FIG. 27 ends, the image stored in the subtractive color image buffer 2005 (FIG. 24) is the same in the label buffer 2008 (see FIG. 24) and the same in the adjacent pixels. Contains the result of labeling with the rule of labeling. The contents of the label buffer 2008 at this point will be referred to as a “subtractive color connection area image” hereinafter. In addition, each of the connected areas included therein is referred to as a “subtractive color connected area”.

続いて、図25のS2104に示される小領域ラベルバッファを初期化する処理について図28を参照して詳細に説明する。まずコントローラ2001は、図24に示される第1カウンタ2006の値iを0に初期化する(S2401)。以下第1カウンタ2006の値をiと呼ぶ。続いてコントローラ2001は、小領域ラベルバッファ210の内容を、ALB[i]=iとなるように初期化する(S2402)。   Next, the process for initializing the small area label buffer shown in S2104 of FIG. 25 will be described in detail with reference to FIG. First, the controller 2001 initializes the value i of the first counter 2006 shown in FIG. 24 to 0 (S2401). Hereinafter, the value of the first counter 2006 is referred to as i. Subsequently, the controller 2001 initializes the contents of the small area label buffer 210 so that ALB [i] = i (S2402).

続いてコントローラ2001は、第1カウンタ2006の値iをインクリメントする(S2403)。そしてこの第1カウンタ2006の値iは、図3に示される小領域数レジスタ6003の値と比較され(S2404)、両者が等しければ処理は終了し等しくなければ制御はS2402に戻る。   Subsequently, the controller 2001 increments the value i of the first counter 2006 (S2403). Then, the value i of the first counter 2006 is compared with the value of the small area number register 6003 shown in FIG. 3 (S2404). If they are equal, the process is terminated, and if they are not equal, the control returns to S2402.

次に、図25のS2105において行なわれる小領域ラベルバッファの値を生成する処理の詳細につき図29を参照して説明する。ここで行なわれるのは、小領域階調数バッファ617(図3)の内容が、減色連結領域画像に対して整合性がとれているかどうかを判定するための処理である。   Next, details of the process of generating the value of the small area label buffer performed in S2105 of FIG. 25 will be described with reference to FIG. What is performed here is a process for determining whether or not the contents of the small area gradation number buffer 617 (FIG. 3) are consistent with the subtractive color connection area image.

ここでいう「整合性」とは以下のような意味である。ある減色連結領域が、複数の小領域にわたっている場合を考える。そのような小領域が小領域階調数バッファ617の内容によって異なる階調数に減色された場合を考える。そうした場合、この階調数の違いによって、小領域の境界に、本来なかった段差ができる可能性がある。これは既に発明が解決しようとする課題の項において図59および図60を用いて既に説明した。ここで注意すべきは、こうした現象がもとの画像自体から生じたものではなく、あくまでも画像をブロック状の小領域に分割したことと、各小領域の階調数が異なっていることとから生じたものである。   Here, “consistency” has the following meaning. Consider a case where a certain subtractive color connection region extends over a plurality of small regions. Consider a case where such a small area is reduced to a different number of gradations depending on the contents of the small area gradation number buffer 617. In such a case, the difference in the number of gradations may cause a step that was not originally present at the boundary of the small area. This has already been explained using FIG. 59 and FIG. 60 in the section of the problem to be solved by the invention. It should be noted here that this phenomenon is not caused by the original image itself, but because the image is divided into small blocks and the number of gradations in each small region is different. It has occurred.

小領域階調数バッファ617の内容に従って単純に減色すると、このような事態が起きる場合がある。そこでそうした場合に小領域階調数バッファ617の内容は整合性がとれていないとみなすのである。   If the color is simply reduced according to the contents of the small area gradation number buffer 617, such a situation may occur. Therefore, in such a case, the contents of the small area gradation number buffer 617 are regarded as being inconsistent.

このような事態は、すべての小領域の階調数を基準階調数レジスタ2002の値と揃えればもちろん回避することはできる。しかし、そのような方式をとると、情報量が少ない小領域、たとえば図59の右側で図形が存在しないような領域に、本来必要のない余分な階調数を割当てる必要が生じてしまう。したがってそうしたやり方をとることはできない。   Such a situation can, of course, be avoided if the number of gradations of all the small regions is made equal to the value of the reference gradation number register 2002. However, if such a method is adopted, it becomes necessary to allocate an unnecessary number of gradations to a small area with a small amount of information, for example, an area where no figure exists on the right side of FIG. So you can't do that.

ここでの処理の目的は、同じ連結領域に属する画素は、小領域ごとの減色後も、多くの場合に同じ画素値を持つようにすることである。なお、異なる連結領域に属する画素については、図59で示されるような減色画像バッファ2005に格納されている画像で同じ画素値を持っている場合でも、小領域ごとの減色後も常に同じ画素値を持たせるようなことは意図されていない。たとえば、図59では、同じ画素値を持っていた矢印状の領域102と星状の領域103とは、図60に示される例では異なる画素値を有している。   The purpose of the processing here is to make the pixels belonging to the same connected region have the same pixel value in many cases even after color reduction for each small region. Note that pixels belonging to different connected areas always have the same pixel value after color reduction for each small area, even if the image stored in the color-reduced image buffer 2005 as shown in FIG. 59 has the same pixel value. It is not intended to have For example, in FIG. 59, the arrow-shaped region 102 and the star-shaped region 103 having the same pixel value have different pixel values in the example shown in FIG.

以下の処理では、同じ減色連結領域を共有した小領域に共通のラベルがつけられるものとする。ただしここでは、減色画像バッファで0、7のいずれかの画素値を持つ連結領域については、共有されていても無視する。というのは、画素値変換器2003で使用した減色アルゴリズムのもとでは、このような両端の画素値は、256階調から4階調などのより低い階調数への減色では、やはり両端の画素値に移り、したがって256階調に復元して表示する際の画素値には影響がないためである。8階調に減色したときの0、7以外
の画素値についてはこのようなことはいえないのは上に述べたとおりである。
In the following processing, it is assumed that a common label is attached to small areas sharing the same subtractive color connection area. However, here, a connected area having a pixel value of 0 or 7 in the reduced color image buffer is ignored even if it is shared. This is because, under the color reduction algorithm used in the pixel value converter 2003, the pixel values at both ends are also reduced at both ends in the color reduction from 256 gradations to a lower gradation number such as 4 gradations. This is because the pixel value shifts to the pixel value, and therefore, the pixel value at the time of restoring and displaying 256 gradations is not affected. As described above, this cannot be said for pixel values other than 0 and 7 when the color is reduced to 8 gradations.

図29を参照して、まずコントローラ2001は、第1カウンタ2006の値iを0に初期化する(S2501)。以下第1カウンタ2006の値をiで表わすものとする。続いてS2502においてコントローラ2001は、第2カウンタ2007の値jを0に初期化する。以下第2カウンタ2007の値をjと呼ぶ。   Referring to FIG. 29, first, the controller 2001 initializes the value i of the first counter 2006 to 0 (S2501). Hereinafter, the value of the first counter 2006 is represented by i. In step S2502, the controller 2001 initializes the value j of the second counter 2007 to 0. Hereinafter, the value of the second counter 2007 is referred to as j.

このループでは、iは小領域の縦方向の番号を表わし、jは小領域の横方向の番号を表わす。以下の説明でX1およびY1を次のように定める。   In this loop, i represents the vertical number of the small area, and j represents the horizontal number of the small area. In the following description, X1 and Y1 are defined as follows.

X1=(画像の横幅+7)/8
Y1=(画像の縦幅+7)/8
容易にわかるように、X1、Y1はそれぞれ、横方向の小領域数および縦方向の小領域数を表わす。またkは次の式で与えられる整数である。
X1 = (width of image + 7) / 8
Y1 = (Vertical width of image + 7) / 8
As can be easily understood, X1 and Y1 respectively represent the number of small areas in the horizontal direction and the number of small areas in the vertical direction. K is an integer given by the following equation.

k=i×X1
以下の説明では、横から数えてj番目、縦から数えてi番目の小領域を小領域(j,i)と表わすものとする。コントローラ2001は、第2カウンタ2007の値jとX1−1とを比較する(S2503)。両者が等しければ制御はS2513に進み、さもなければ制御はS2504に進む。
k = i × X1
In the following description, the j-th small area counted from the horizontal and the i-th small area counted from the vertical are represented as a small area (j, i). The controller 2001 compares the value j of the second counter 2007 with X1-1 (S2503). If they are equal, control proceeds to S2513, otherwise control proceeds to S2504.

S2504ではコントローラ2001は、小領域(j,i)と、小領域(j+1,i)の境界のつながりを検査する(ステップS2504)。この2つの小領域が減色連結領域を共有していれば制御はS2505に、さもなければ制御はS2506に進む。ここでの判定方法については後述する。   In S2504, the controller 2001 checks the connection of the boundary between the small area (j, i) and the small area (j + 1, i) (Step S2504). If the two small areas share the subtractive color connection area, the control proceeds to S2505; otherwise, the control proceeds to S2506. The determination method here will be described later.

S2505では、ラベル付け替え器2009を用いて小領域ラベルバッファ2010の書換処理が行なわれる。ここでは書換えは以下のようにして行なわれる。すなわち、小領域(j,i)と小領域(j+1,i)とのそれぞれに対応する小領域ラベルバッファ2008の要素ALB[k]、ALB[k+1]と、それまでにその両者のいずれかと同じ値を持っていた代表パターンラベルバッファ2008のすべての要素に対して、共通の値min(ALB[k]、LB[k+1])が代入される。   In step S <b> 2505, the rewriting process of the small area label buffer 2010 is performed by using the label reassigner 2009. Here, rewriting is performed as follows. That is, the elements ALB [k] and ALB [k + 1] of the small area label buffer 2008 corresponding to the small area (j, i) and the small area (j + 1, i), respectively, and the same as either of them so far A common value min (ALB [k], LB [k + 1]) is assigned to all elements of the representative pattern label buffer 2008 having a value.

続いてコントローラ2001は、第1カウンタ2006の値iとY1−1とを比較し(S2506)、両者が等しければ制御はS2513に進み、さもなければ制御はS2507に進む。これは、小領域の縦方向の番号iが縦方向の小領域数Y1−1に等しいということは、それより下の小領域が存在しないということであるためである。   Subsequently, the controller 2001 compares the value i of the first counter 2006 with Y1-1 (S2506). If they are equal, the control proceeds to S2513, otherwise the control proceeds to S2507. This is because the fact that the number i in the vertical direction of the small area is equal to the number Y1-1 of the small areas in the vertical direction means that there is no small area below that.

S2507では、コントローラ2001は、小領域(j,i)と、小領域(j+1,i+1)との境界のつながりを検査する(S2507)。この2つの小領域が減色連結領域を共有していれば制御はS2508に進み、さもなければ制御はS2509に進む。この判定方法については後述する。   In S2507, the controller 2001 inspects the boundary connection between the small area (j, i) and the small area (j + 1, i + 1) (S2507). If the two small areas share the subtractive color connection area, the control proceeds to S2508; otherwise, the control proceeds to S2509. This determination method will be described later.

S2508では、ラベル付け替え器2009を用いて、小領域ラベルバッファ2010の書換処理が行なわれる。ここでの書換は以下のように行なわれる。すなわち、小領域(j,i)と、小領域(j+1,i+1)とのそれぞれに対応する小領域ラベルバッファ2010の要素ALB[k]、ALB[k+X1+1]と、それまでにその両者のいずれかと同じ値を持っていた小領域ラベルバッファ2010のすべての要素とに、共通の値min(ALB[k]、LB[k+X1+1])を代入する。   In step S <b> 2508, the rewriting process of the small area label buffer 2010 is performed using the label reordering unit 2009. The rewriting here is performed as follows. That is, the elements ALB [k] and ALB [k + X1 + 1] of the small area label buffer 2010 corresponding to the small area (j, i) and the small area (j + 1, i + 1), respectively, A common value min (ALB [k], LB [k + X1 + 1]) is substituted for all elements of the small area label buffer 2010 having the same value.

S2509ではコントローラ2001は、小領域(j,i)と、小領域(j,i+1)との境界のつながりを検査し、この2つの小領域が減色連結領域を共有していれば制御はS2508に進み、さもなければ制御はS2510に進む。この判定方法については後述する。   In S2509, the controller 2001 checks the connection of the boundary between the small area (j, i) and the small area (j, i + 1), and if the two small areas share the subtractive color connection area, the control proceeds to S2508. Otherwise, control continues to S2510. This determination method will be described later.

S2510ではラベル付け替え器2009を用いて、小領域ラベルバッファ2010のラベルの書換処理が行なわれる。ここでは、小領域(j,i)と小領域(j,i+1)とのそれぞれに対応する小領域ラベルバッファ2010のすべての要素とに、共通の値min(ALB[k]、LB[k+X1])を代入する。   In S2510, the label rewriting unit 2009 is used to rewrite the label in the small area label buffer 2010. Here, common values min (ALB [k], LB [k + X1] are assigned to all elements of the small area label buffer 2010 corresponding to the small area (j, i) and the small area (j, i + 1), respectively. ).

S2511では、コントローラ2001は第2カウンタ2007の値jをインクリメントする。さらにコントローラ2001は第2カウンタ2007の値jとX1とを比較し(S2512)、両者が等しければ制御はS2513に進み、さもなければ制御はS2503に戻る。   In step S2511, the controller 2001 increments the value j of the second counter 2007. Furthermore, the controller 2001 compares the value j of the second counter 2007 with X1 (S2512), and if both are equal, the control proceeds to S2513, otherwise the control returns to S2503.

S2513では、コントローラ2001は第1カウンタ2006の値iをインクリメントする。コントローラ2001はさらに、第1カウンタ2006の値iとY1とを比較し(S2514)、両者が等しければ処理を終了し、両者が等しくなければ制御はS2502に戻る。   In step S2513, the controller 2001 increments the value i of the first counter 2006. The controller 2001 further compares the value i of the first counter 2006 with Y1 (S2514). If both are equal, the process ends. If both are not equal, the control returns to S2502.

図29のS2504において行なわれる判定処理の詳細につき、図30を参照して説明する。まずコントローラ2001は、第3カウンタ2011の値mを0に初期化する(S2601)。以下mとは、第3カウンタ2011の値を意味するものとする。また以下の説明においては、小領域(j,i)の左右端の列の、上から数えてm番目の画素を着目画素と呼ぶ。   Details of the determination processing performed in S2504 of FIG. 29 will be described with reference to FIG. First, the controller 2001 initializes the value m of the third counter 2011 to 0 (S2601). Hereinafter, “m” means the value of the third counter 2011. In the following description, the mth pixel counted from the top in the left and right end columns of the small region (j, i) is referred to as a pixel of interest.

コントローラ2001は、着目画素が0と等しいか否かを検査し(S2602)、両者が等しければ制御はS2607に進み、さもなければ制御はS2603に進む。S2603ではコントローラ2001は、着目画素が7と等しいか否かを検査し、等しければ制御はS2607に進み、さもなければ制御はS2604に進む。   The controller 2001 checks whether or not the pixel of interest is equal to 0 (S2602). If the two are equal, the control proceeds to S2607, otherwise the control proceeds to S2603. In S2603, the controller 2001 checks whether or not the pixel of interest is equal to 7. If equal, the control proceeds to S2607, otherwise the control proceeds to S2604.

S2604ではコントローラ2001は、着目画素と、その右隣の画素のそれぞれに対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する。すなわちコントローラ2001は、着目画素と、小領域(j+1,i)の最左端の列の、上から数えてm番目の画素のそれぞれ対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する。両者が同じ値を持っていれば制御はS2609に進み、さもなければ制御はS2605に進む。   In step S2604, the controller 2001 determines whether the element of the label buffer 2008 corresponding to each of the pixel of interest and the pixel on the right side has the same value. That is, the controller 2001 determines whether the element of the label buffer 2008 corresponding to the pixel of interest and the m-th pixel counted from the top in the leftmost column of the small region (j + 1, i) have the same value. To do. If both have the same value, control proceeds to S2609, otherwise control proceeds to S2605.

S2605ではコントローラ2001は、着目画素と、その右上の画素、つまり小領域(j+1,i)の最左端の列の、上から数えてm−1番目の画素のそれぞれに対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する(S2605)。両者が同じ値を持っていれば制御はS2609に進み、さもなければ制御はS2606に進む。ただしm<1の場合は、S2605の条件は成り立たないものとする。   In step S2605, the controller 2001 controls the label buffer 2008 corresponding to each of the pixel of interest and the upper right pixel thereof, that is, the m−1th pixel counted from the top in the leftmost column of the small area (j + 1, i). It is determined whether the elements have the same value (S2605). If both have the same value, control proceeds to S2609, otherwise control proceeds to S2606. However, if m <1, the condition of S2605 is not satisfied.

S2606ではコントローラ2001は、着目画素と、その右下の画素、つまり小領域(j+1,i)の最左端の列の、上から数えてm+1番目の画素のそれぞれに対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する。両者が同じ値を持っていれば制御はS2609に進み、さもなければ制御はS2607に進む。ただしここでmが小領域の高さと等しいときには、S2606の条件は成立しないものとする。   In step S <b> 2606, the controller 2001 controls the elements of the label buffer 2008 corresponding to the pixel of interest and the lower right pixel, that is, the m + 1st pixel counted from the top in the leftmost column of the small region (j + 1, i). Determine whether have the same value. If both have the same value, control proceeds to S2609, otherwise control proceeds to S2607. However, when m is equal to the height of the small area, the condition of S2606 is not satisfied.

S2607ではコントローラ2001は、第3カウンタ2011の値mをインクリメントする。さらにコントローラ2001は、第3カウンタ2011の値mと小領域の縦幅とを比較し(S2608)、等しければ制御はS2610に進み、さもなければ制御はS2602に戻る。   In step S2607, the controller 2001 increments the value m of the third counter 2011. Further, the controller 2001 compares the value m of the third counter 2011 with the vertical width of the small area (S2608). If they are equal, the control proceeds to S2610, otherwise the control returns to S2602.

S2604、S2605およびS2606における判定結果がYESであればコントローラ2001は、2領域が減色連結領域を共有していると判断して(S2609)、処理は終了する。コントローラ2001は、S2608における判断結果がYESの場合には、2領域が減色連結領域を共有していないと判断し(S2610)、処理を終了する。   If the determination results in S2604, S2605, and S2606 are YES, the controller 2001 determines that the two areas share the reduced color connection area (S2609), and the process ends. If the determination result in S2608 is YES, the controller 2001 determines that the two areas do not share the reduced color connection area (S2610), and ends the process.

S2604〜S2606で用いられる条件の意味について以下に説明する。これらの判断では、2つの画素に対応するラベルバッファ2008の要素が同じ値を持っているかどうかについての判定が行なわれている。両方の要素が同じ値を持っているということは、2つの画素が、同じ減色連結領域に属していることを示す。さらに、そのような2つの画素が異なる小領域に属していることは、それぞれが属する小領域が1つの減色連結領域を共有していることを示すのである。したがってS2604〜S2606における判定結果がYESであればS2609のように、2領域が減色連結領域を共有していると判断することができるのである。   The meaning of the conditions used in S2604 to S2606 will be described below. In these determinations, it is determined whether or not the elements of the label buffer 2008 corresponding to the two pixels have the same value. The fact that both elements have the same value indicates that the two pixels belong to the same subtractive color connection region. Furthermore, the fact that such two pixels belong to different small areas indicates that the small areas to which they belong share one subtractive color connection area. Therefore, if the determination result in S2604 to S2606 is YES, it can be determined that the two areas share the subtractive color connection area as in S2609.

続いて、図29のS2507において行なわれる判定処理の詳細につき図31を参照して説明する。ここでの判定は、小領域(j,i)と、その右下の小領域(j+1,i+1)とが減色連結領域を共有しているか否か、ついてのものである。   Next, details of the determination process performed in S2507 of FIG. 29 will be described with reference to FIG. The determination here is whether or not the small area (j, i) and the lower right small area (j + 1, i + 1) share the subtractive color connection area.

これら2001はまず、着目画素が0と等しいか否かを検査する(S2701)。両者が等しければ制御はS2705に進み、さもなければ制御はS2702に進む。   These 2001 first check whether the target pixel is equal to 0 (S2701). If both are equal, control proceeds to S2705, otherwise control proceeds to S2702.

S2702ではコントローラ2001は、着目画素が7と等しいか否かを検査する(S2702)。両者が等しければ制御はS2705に進み、さもなければ制御はS2703に進む。   In S2702, the controller 2001 checks whether or not the target pixel is equal to 7 (S2702). If they are equal, control proceeds to S2705, otherwise control proceeds to S2703.

S2703ではコントローラ2001は、小領域(j,i)の右下角の画素2901(以下「着目画素」と呼ぶ。)と、小領域(j+1,i+1)の左上角の画素のそれぞれに対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する。もし両者が同じ値を持っていれば制御はS2704に進み、さもなければ制御はS2705に進む。   In step S2703, the controller 2001 labels the pixel 2901 in the lower right corner of the small area (j, i) (hereinafter referred to as “target pixel”) and the pixel in the upper left corner of the small area (j + 1, i + 1). It is determined whether the elements of the buffer 2008 have the same value. If both have the same value, control proceeds to S2704, otherwise control proceeds to S2705.

図32に、着目画素2901、小領域(j+1,i+1)の左上角の画素2902、ブロック境界2903および2904をそれぞれ図示した。なお、図32に示されているのが全体のごく一部であることはもちろんである。   FIG. 32 illustrates a pixel of interest 2901, a pixel 2902 in the upper left corner of the small region (j + 1, i + 1), and block boundaries 2903 and 2904, respectively. Of course, only a part of the whole is shown in FIG.

S2704ではコントローラ2001は、2領域が減色連結領域を共有していると判断して処理を終了する。一方S2705ではコントローラ2001は、2領域が減色連結領域を共有していないと判断して処理を終了する。   In step S2704, the controller 2001 determines that the two areas share the reduced color connection area, and ends the process. On the other hand, in step S2705, the controller 2001 determines that the two areas do not share the reduced color connection area, and ends the process.

S2703で用いられる条件は、S2604〜S2606で用いられた条件と同じであり、したがってそれらと同様の意味を有する。   The conditions used in S2703 are the same as the conditions used in S2604 to S2606, and therefore have the same meaning as those.

図29のS2510において行なわれる小領域ラベルの書換処理の詳細につき、図33を参照して説明する。まずコントローラ2001は、第3カウンタ2011の値mを0に初期化する(S2801)。以下mは第3カウンタ2011の値を意味するものとする。
また、以下の説明では小領域(j,i)の最下端のラインの、左から数えてm番目の画素を着目画素と呼ぶ。
Details of the small area label rewriting process performed in S2510 of FIG. 29 will be described with reference to FIG. First, the controller 2001 initializes the value m of the third counter 2011 to 0 (S2801). Hereinafter, m means the value of the third counter 2011.
In the following description, the mth pixel counted from the left in the lowermost line of the small region (j, i) is referred to as a pixel of interest.

コントローラ2001は、着目画素が0と等しいか否かを検査する(S2802)。両者が等しければ制御はS2807に進み、さもなければ制御はS2803に進む。同様にコントローラ2001は、S2803において、着目画素が7と等しいか否かを検査する(S2803)。両者が等しければ制御はS2807に進み、さもなければ制御はS2804に進む。   The controller 2001 checks whether the target pixel is equal to 0 (S2802). If the two are equal, control proceeds to S2807, otherwise control proceeds to S2803. Similarly, the controller 2001 checks in step S2803 whether or not the target pixel is equal to 7 (S2803). If the two are equal, control proceeds to S2807, otherwise control proceeds to S2804.

S2804ではコントローラ2001は、着目画素と、その真下の画素、つまり小領域(j,i+1)の最上端のラインの、左から数えてm番目の画素のそれぞれに対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する。もし両者が同じ値を持っていれば制御はS2809に進み、さもなければ制御はS2805に進む。   In step S2804, the controller 2001 determines whether the element of the label buffer 2008 corresponding to each pixel of interest and the m-th pixel from the left in the uppermost line of the small region (j, i + 1) is the pixel immediately below it. Determine whether they have the same value. If both have the same value, control proceeds to S2809, otherwise control proceeds to S2805.

S2805ではコントローラ2001は、着目画素と、その左下の画素、つまり小領域(j,i+1)の最上端のラインの、左から数えてm−1番目の画素それぞれに対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する。同じ値を持っていれば制御はS2809に進み、さもなければ制御はS2806に進む。このとき、m<1の場合は、S2805の条件は成立しないものとする。   In step S <b> 2805, the controller 2001 controls the elements of the label buffer 2008 corresponding to the pixel of interest and the lower left pixel, that is, the m−1th pixel counted from the left of the uppermost line of the small region (j, i + 1). Determine whether have the same value. If they have the same value, control proceeds to S2809, otherwise control proceeds to S2806. At this time, if m <1, the condition of S2805 is not satisfied.

S2806ではコントローラ2001は、着目画素と、その右下の画素、つまり小領域(j,i+1)の最上端のラインの、左から数えてm+1番目の画素それぞれに対応する、ラベルバッファ2008の要素が同じ値を持つかどうかを判定する。もし両者が同じ値を持っていれば制御はS2809に進み、さもなければ制御はS2807に進む。ただし、mが小領域の横幅と等しいときには、S2806の条件は成立しないものとする。   In step S <b> 2806, the controller 2001 determines that the element of the label buffer 2008 corresponding to each pixel of interest and the m + 1th pixel counted from the left in the upper rightmost line of the small region (j, i + 1) is the pixel of the label buffer 2008. Determine whether they have the same value. If both have the same value, control proceeds to S2809, otherwise control proceeds to S2807. However, when m is equal to the horizontal width of the small area, the condition of S2806 is not satisfied.

S2804〜S2806で用いられる条件の意味については、S2604〜S2606において用いられた条件と同様である。   The meanings of the conditions used in S2804 to S2806 are the same as the conditions used in S2604 to S2606.

S2807ではコントローラ2001は、第3カウンタ2011の値mをインクリメントする。さらにコントローラ2001は、第3カウンタ2011の値mと小領域の横幅とを比較し(S2808)、両者が等しければ制御はS2810に進み、さもなければ制御はS2802に戻る。   In step S2807, the controller 2001 increments the value m of the third counter 2011. Further, the controller 2001 compares the value m of the third counter 2011 with the horizontal width of the small area (S2808). If they are equal, the control proceeds to S2810, otherwise the control returns to S2802.

S2804、S2805またはS2806の判定結果がYESである場合には、コントローラ2001はS2809で2領域が減色連結領域を共有していると判定し、処理を終了する。一方S2808での判定がYESとなった場合にはコントローラ2001は、S2810で2領域が減色連結領域を共有していないと判定し処理を終了する。   If the determination result in S2804, S2805, or S2806 is YES, the controller 2001 determines in S2809 that the two areas share the reduced color connection area, and ends the process. On the other hand, if the determination in S2808 is YES, the controller 2001 determines in S2810 that the two areas do not share the reduced color connection area, and ends the process.

以上の第1の実施の形態の説明では、入力画像として256階調のグレイスケール画像を仮定し、1画素当たり1バイト(8ビット)を割当てるものとした。しかし本発明はそのような特定の値に限定されるわけではない。本実施の形態は他の階調数の画像に対しても実現可能であり、またグレイスケール画像に限らずカラー画像であってもよい。カラー画像の場合には、上に述べた減色をカラー成分ごとに行なうことができる。   In the above description of the first embodiment, it is assumed that a grayscale image of 256 gradations is assumed as an input image, and 1 byte (8 bits) is assigned per pixel. However, the present invention is not limited to such specific values. The present embodiment can be realized for an image having other gradation numbers, and is not limited to a gray scale image but may be a color image. In the case of a color image, the color reduction described above can be performed for each color component.

また上に述べた第1の実施の形態では、画像を小領域に分割する際に、横8ピクセル、縦8ピクセルのブロックに分割している。しかし小領域の分割例がこのようなものに限られるわけではないことはいうまでもない。この実施の形態と異なる分割方法をとった場合、図5に示されるような小領域情報バッファ604の構造も当然それに合わせて変わってくるものである。   In the first embodiment described above, when an image is divided into small areas, the image is divided into blocks each having 8 pixels in the horizontal direction and 8 pixels in the vertical direction. However, it goes without saying that the example of dividing the small area is not limited to this. When a division method different from this embodiment is adopted, the structure of the small area information buffer 604 as shown in FIG. 5 naturally changes accordingly.

第1の実施の形態で述べたように画像を一定の大きさの格子に分割して小領域とする場合、実は縦のブロックの大きさ、横のブロックの大きさ以外は小領域情報バッファ604に格納する必要はない。ただしこの場合、標準的なブロックの大きさを格納しておく必要がある。この場合には、左端、下端の半端な大きさのブロックの大きさの有無および存在した場合の縦方向および横方向のサイズは、縦のブロックの大きさ、横のブロックの大きさと、画像全体の横幅および縦幅から算出し得るからである。また格子状の分割の場合には、横方向の小領域数、縦方向の小領域数がそれぞれ定義できるのであるから、それらの情報を小領域情報バッファ604に格納することも考えられる。   As described in the first embodiment, when an image is divided into grids of a certain size to form small regions, the small region information buffer 604 is actually a size other than the vertical block size and the horizontal block size. There is no need to store it. In this case, however, it is necessary to store the standard block size. In this case, the presence or absence of the block size of the half-size at the left end and the lower end, and the vertical and horizontal sizes when present, the size of the vertical block, the size of the horizontal block, and the entire image This is because it can be calculated from the horizontal width and vertical width. In the case of grid-like division, the number of small areas in the horizontal direction and the number of small areas in the vertical direction can be defined, and it is also conceivable to store such information in the small area information buffer 604.

原画像を格子状に分割している場合について説明した上のものと同じアルゴリズムが、全く異なる形状の小領域に元画像を分割している場合にも若干の修正をすることだけで対応できるのは明らかである。したがってその詳細についてはここでは特に述べないこととする。   The same algorithm as described above for dividing the original image into a grid pattern can cope with the case where the original image is divided into small areas of completely different shapes with only a slight modification. Is clear. Therefore, details thereof will not be described here.

上で述べた第1の実施の形態において、画像2値化器605が画像を2値化する際のしきい値Tを求める方法として、「大津の方法」と呼ばれるものを用いている。このしきい値Tを求める方法としてはこれ以外の方法も種々存在している。それらの方法については、高木、下田監修「画像解析ハンドブック」、東京大学出版会、502〜504頁に解説されているのでそれらを参照されたい。   In the first embodiment described above, a method called “Otsu's method” is used as a method for obtaining the threshold T when the image binarizer 605 binarizes an image. There are various other methods for obtaining the threshold value T. These methods are described in “Image Analysis Handbook” supervised by Takagi and Shimoda, University of Tokyo Press, pages 502 to 504, so please refer to them.

なお、2値画像の格納方法として、ここでは、非背景領域と背景領域との値として0および255の組合せを用いた。しかし2値画像の格納方法がそのような値の組合せのみに限定されるわけではないことは明らかである。すなわち、2値画像の格納には、1画素当たり1ビットで足りることを利用して、2値画像バッファ606の容量を削減することも可能であるし、可逆圧縮技術を適用して2値画像バッファ606の容量を削減することも可能である。いずれにせよ上述した画像符号化装置の処理結果に何ら影響を及ぼすことではない。   As a binary image storage method, here, a combination of 0 and 255 is used as the value of the non-background region and the background region. However, it is clear that the binary image storage method is not limited to such combinations of values. In other words, it is possible to reduce the capacity of the binary image buffer 606 by using the fact that one bit per pixel is sufficient for storing the binary image, and applying the lossless compression technique to the binary image. It is also possible to reduce the capacity of the buffer 606. In any case, this does not affect the processing result of the above-described image encoding device.

また上に説明した第1の実施の形態の装置では、線抽出器607が抽出する直線を、横線または縦線に限っている。しかしそれ以外の線についても線抽出器607で抽出することにしても全く差し支えはない。そのような画像からの一般の線要素の抽出方法については、前掲の「画像解析ハンドブック」、564〜573頁に解説されているのでそちらを参照されたい。なお、これらの手法は一般に、2値画像ではなく多値画像をその処理対象としている。したがってそうした手法を採用する場合には、線抽出器607が2値画像バッファ606を参照する代わりに、画像データバッファ302を参照するように変更すればよい。   In the apparatus according to the first embodiment described above, the straight lines extracted by the line extractor 607 are limited to horizontal lines or vertical lines. However, other lines may be extracted by the line extractor 607 at all. A method for extracting a general line element from such an image is described in the above-mentioned “Image Analysis Handbook”, pages 564 to 573, so please refer to that. Note that these methods generally target multi-value images instead of binary images. Therefore, when such a method is adopted, the line extractor 607 may be changed to refer to the image data buffer 302 instead of referring to the binary image buffer 606.

また上で述べた第1の実施の形態においては、抽出される直線が横線または縦線に限られている。そのため線情報バッファ609のデータ構造も図5に示されるようなものとなっている。しかし直線として、斜め線まで許容した場合にも同様のデータ構造で線情報を格納することが可能である。ただしこの場合、斜めの曲線をその外接平行四辺形で近似することとする。この場合のデータ構造の一例を図34に示す。図34に示す例では、斜め線の外接平行四辺形の4つの頂点の座標がすべて線情報バッファに格納される。   In the first embodiment described above, the extracted straight line is limited to a horizontal line or a vertical line. Therefore, the data structure of the line information buffer 609 is also as shown in FIG. However, even when diagonal lines are allowed as straight lines, it is possible to store line information with the same data structure. In this case, however, an oblique curve is approximated by its circumscribed parallelogram. An example of the data structure in this case is shown in FIG. In the example shown in FIG. 34, the coordinates of the four vertices of the circumscribed parallelogram of the diagonal line are all stored in the line information buffer.

曲線の表わし方としてはこの他にも種々考えられる。たとえば(中心線の始点座標、中心の長さ情報または中心線の終点情報、および直線の太さ情報)の組合せ、または(中心線の始点座標、中心線の長さ情報、中心線の角度の情報および直線の太さ情報)の組合せで表わすことも考えられる。いずれにしても図5、図34に示したようなデータ構造と類似のデータ構造の必要な情報を格納することが可能である。   There are various other ways to represent the curve. For example, a combination of (center line start point coordinates, center length information or center line end point information, and line thickness information), or (center line start point coordinates, center line length information, center line angle It may be expressed by a combination of information and straight line thickness information). In any case, necessary information having a data structure similar to that shown in FIGS. 5 and 34 can be stored.

今まで述べてきた直線の表わし方は、いわゆる「ベクトルデータ」としての表わし方であった。しかし直線の表わし方はこのような「ベクトルデータ」としての表わし方に限定されるわけではない。抽出された直線を、画像情報として表わす方法もある。この場合の線情報バッファ609のデータ構造の例としては、画像データバッファ302の構造と同じものが使用できる。この場合線の領域に含まれる画像には1、それ以外の画素には0という画素値を持たせればよい。このような表わし方は、それが最終のデータとして用いられる場合には、必要となる記憶領域の観点から、ベクトル化に分類される手法に比して効率はよくない。しかし、中間的な情報として用いる必要がある場合には、曲線以外の形状の線の情報も表現しやすいという利点がある。   The method of representing a straight line described so far has been represented as so-called “vector data”. However, the way of representing a straight line is not limited to the way of representing such “vector data”. There is also a method of representing the extracted straight line as image information. As an example of the data structure of the line information buffer 609 in this case, the same structure as that of the image data buffer 302 can be used. In this case, the image included in the line area may have a pixel value of 1 and the other pixels may have a pixel value of 0. Such a representation is not as efficient as a method classified as vectorization from the viewpoint of a required storage area when it is used as final data. However, when it is necessary to use the information as intermediate information, there is an advantage that information of a line having a shape other than a curve can be easily expressed.

上に述べた説明では、たとえば第2減色テーブル1103の2次元配列が、不要な要素を多く含んでいることについて説明した。そしてその場合、不要な添え字の組合せに対応する第2減色テーブル1103の要素T[j]には0が格納されているものとした。しかしもちろん、不要な添え字の組合せに対応する要素には0以外の任意の値を用いてもよい。また、第2減色テーブル1103を単なる2次元配列とは異なるデータ構造で実現することにより、このような不要な添え字の組合せに対応する要素を排除することができる。その場合には必要なメモリ容量を小さくすることが可能となる。さらに、第1の実施の形態で第2減色テーブル1103の要素T[j][0]はjと無関係に必ず0となる。したがってこれら要素は最初から第2減色テーブル1103において省略することもできる。   In the above description, for example, it has been described that the two-dimensional array of the second color reduction table 1103 includes many unnecessary elements. In that case, it is assumed that 0 is stored in the element T [j] of the second color reduction table 1103 corresponding to the combination of unnecessary subscripts. However, of course, any value other than 0 may be used for an element corresponding to an unnecessary combination of subscripts. Also, by realizing the second color reduction table 1103 with a data structure different from a simple two-dimensional array, elements corresponding to such unnecessary combinations of subscripts can be eliminated. In that case, the required memory capacity can be reduced. Furthermore, in the first embodiment, the element T [j] [0] of the second color reduction table 1103 is always 0 regardless of j. Accordingly, these elements can be omitted in the second color reduction table 1103 from the beginning.

さらにまた上で述べた第1の実施の形態の装置では、図12に示す線情報バッファ1107のデータ構造として、図3に示した線情報バッファ609と同様のものを用いた。しかしもちろん、線情報バッファ1107のデータ構造を線情報バッファ609のデータ構造と異なるものにしてもよいことはもちろんである。   Furthermore, in the apparatus of the first embodiment described above, the data structure of the line information buffer 1107 shown in FIG. 12 is the same as that of the line information buffer 609 shown in FIG. However, of course, the data structure of the line information buffer 1107 may be different from the data structure of the line information buffer 609.

また上の第1の実施の形態の装置では、S1205の判定は、S[v]階調への減色に比べて、S[j−1]階調では背景領域になってしまう画素がしきい値以上あるか否か、ということを基準としてこれ以上の減色はできないと判断している。しかしこの判定の条件は上で説明したものに限定されるわけではない。たとえば、予め定められたしきい値で定まる範囲に2つの数の差の絶対値が収まっているか否かを判定の条件としてもよい。または、2つの数の比率が、1に近い予め定められた範囲内にあるか否かという条件を判定条件としてもよい。その他にも、さまざまなバリエーションを考えることができる。   Further, in the apparatus of the first embodiment, the determination in S1205 is that the pixel that becomes the background area in the S [j−1] gradation is the threshold compared to the color reduction to the S [v] gradation. It is determined that no further color reduction is possible based on whether or not the value is greater than or equal to the value. However, the conditions for this determination are not limited to those described above. For example, the determination condition may be whether or not the absolute value of the difference between the two numbers is within a range determined by a predetermined threshold value. Alternatively, a condition that the ratio of the two numbers is within a predetermined range close to 1 may be used as the determination condition. Various other variations can be considered.

なお上の第1の実施の形態の装置では、線情報バッファ609のデータ構造に関連して、各線の情報が個別に取出せるものとして説明をした。しかし、仮に線情報バッファ609がそのような構造となっていなくても、各画素がいずれかの線に含まれているか否かが判定できる限りにおいて、S5401〜S5409(図10)の処理を以下の処理に置き換えることで同じ目的を達成することができる。以下に述べる方法はたとえば、線情報バッファ609が画像データを格納するためのバッファとなっている場合に有効である。   In the above-described apparatus according to the first embodiment, it has been described that the information of each line can be individually extracted in relation to the data structure of the line information buffer 609. However, even if the line information buffer 609 does not have such a structure, as long as it can be determined whether or not each pixel is included in any line, the processing of S5401 to S5409 (FIG. 10) is performed as follows. The same purpose can be achieved by substituting this process. The method described below is effective, for example, when the line information buffer 609 is a buffer for storing image data.

以下の説明では、線情報バッファ609が、画像データバッファ302に格納されてれているのと同じサイズを持ち、線に含まれる画素は1、それ以外の画素は0という画素値を持った画像データを格納しているものとする。   In the following description, the line information buffer 609 has the same size as that stored in the image data buffer 302, an image having a pixel value of 1 for the pixels included in the line and 0 for the other pixels. Assume that data is stored.

図35を参照して、コントローラ601は、まず第1カウンタ613の値iを0で初期化する(S5601)。以下iは第1カウンタ613の値を意味するものとする。続いてコントローラ601は、第2カウンタ616の値jを0で初期化する(S5602)。以下jは第2のカウンタ616の値を意味するものとする。   Referring to FIG. 35, controller 601 first initializes value i of first counter 613 with 0 (S5601). Hereinafter, i means the value of the first counter 613. Subsequently, the controller 601 initializes the value j of the second counter 616 with 0 (S5602). Hereinafter, j means the value of the second counter 616.

続いてS5603ではコントローラ601は、線情報バッファ609の横方向にj番目、縦方向にi番目の要素が1であるか否かを判定する(S5603)。この画素の値が1であるときは制御S5604に進み、さもなければ制御はS5606に進む。   Subsequently, in S5603, the controller 601 determines whether the j-th element in the horizontal direction and the i-th element in the vertical direction are 1 in the line information buffer 609 (S5603). When the value of this pixel is 1, the process proceeds to control S5604, otherwise the process proceeds to S5606.

S5604ではコントローラ601は、第1カウンタ613の値i、第2カウンタ6016の値j、および小領域情報バッファ604の内容を参照して、現在処理中の画素が含まれる小領域に対応する小領域階調数バッファ617の要素を取出し(以下これをk番目の要素とする)、線領域階調数レジスタ618の値と比較する。そして後者の方が大きければ制御はS5605に、さもなければ制御はS5606に進む。   In S5604, the controller 601 refers to the value i of the first counter 613, the value j of the second counter 6016, and the contents of the small region information buffer 604, and the small region corresponding to the small region including the pixel currently being processed. The element of the gradation number buffer 617 is extracted (hereinafter referred to as the k-th element) and compared with the value of the line area gradation number register 618. If the latter is larger, the control proceeds to S5605; otherwise, the control proceeds to S5606.

S5605ではコントローラ601は、小領域階調数バッファ617のk番目の要素に、線領域階調数レジスタ618の値を代入する。続いてS5606ではコントローラ601は、第2カウンタ616の値jをインクリメントし、続いて第2カウンタ616の値jを画像の横幅と比較する(S5607)。両者が等しければ制御はS5608に進み、さもなければ制御はS5603に戻る。   In step S5605, the controller 601 substitutes the value of the line area gradation number register 618 for the kth element of the small area gradation number buffer 617. In step S5606, the controller 601 increments the value j of the second counter 616, and then compares the value j of the second counter 616 with the horizontal width of the image (S5607). If they are equal, control proceeds to S5608, otherwise control returns to S5603.

S5608ではコントローラ601は、第1カウンタ613の値iをインクリメントする。続いてS5609でコントローラ601は、第1カウンタ613の値iを画像の縦幅と比較する。そして両者が等しければ処理を終了し、さもなければ制御はS5602に戻る。   In step S5608, the controller 601 increments the value i of the first counter 613. In step S5609, the controller 601 compares the value i of the first counter 613 with the vertical width of the image. If they are equal, the process ends. Otherwise, the control returns to S5602.

以上のようにすることにより、線情報バッファ609の内容が画像データである場合にも線に関する情報を取出すことができる。   As described above, even when the content of the line information buffer 609 is image data, it is possible to extract information regarding the line.

これまでの説明では、線抽出器607、文字矩形情報抽出器610は、2値画像が必要な場合には、2値画像バッファ606を参照することとしていた。しかし本実施の形態の装置はそのような実現方法のみに限定されるわけではない。たとえば、画像2値化器605として、しきい値だけを求めるようなものを用いることもできる。この場合には、線抽出器607、文字矩形情報抽出器610では、画像2値化器605によって求められたしきい値と、画像データバッファ302とを参照することによって、必要があるたびに背景領域に属する画素と非背景領域に属する画素とを識別することができる。そのような処理をすることによって、上で述べた第1の実施の形態における処理の同等の処理が行なえることは明らかである。   In the description so far, the line extractor 607 and the character rectangle information extractor 610 refer to the binary image buffer 606 when a binary image is necessary. However, the apparatus according to the present embodiment is not limited to such an implementation method. For example, as the image binarizer 605, a device that obtains only a threshold value can be used. In this case, the line extractor 607 and the character rectangle information extractor 610 refer to the threshold obtained by the image binarizer 605 and the image data buffer 302, so that the background is obtained whenever necessary. A pixel belonging to the region and a pixel belonging to the non-background region can be identified. By performing such processing, it is obvious that processing equivalent to the processing in the first embodiment described above can be performed.

また上の第1の実施の形態の装置では、着目画素と隣接する画素との間の連結関係を検査する際に、いわゆる8連結の意味での隣接画素を検査している。しかし本発明は8連結の意味での隣接画素に限定されるわけではない。たとえば隣接画素の定義として4連結の意味での隣接画素を採用することもできる。この場合には、各着目画素について、真上および左隣の画素を検査すればよい。この場合の処理は8連結の意味で上に説明した処理を簡略化すればよいことは明らかである。   Further, in the apparatus of the first embodiment above, when inspecting the connection relationship between the pixel of interest and the adjacent pixel, the adjacent pixel in the meaning of so-called 8-connection is inspected. However, the present invention is not limited to adjacent pixels in the sense of eight connections. For example, an adjacent pixel in the sense of 4-connection can be adopted as the definition of the adjacent pixel. In this case, it is only necessary to inspect the pixels immediately above and to the left of each pixel of interest. It is obvious that the processing in this case may be simplified from the processing described above in the sense of 8-connection.

今、上で説明した第1の実施の形態では、たとえば図25のS2105では、小領域階調数バッファ617の内容が、減色連結領域画像に対して整合性がとれているかどうかを判定していた。そして上の実施の形態では、ある減色連結領域が複数の小領域にわたっている場合に、そのような小領域が、小領域階調数バッファ617の内容によって異なる階調数に減色される場合があるという事態を避けるためのものであった。もちろんこのような事態は、すべての小領域の階調数を基準階調数レジスタ2002の値と揃えれば回避することができる。しかし、そのような形をとると、情報量が少ない小領域、たとえば図59の右側で図形が存在しないような領域に、本来必要のない余分な階調数を割当てる必要が生じてしまうという弊害が生ずる。   In the first embodiment described above, for example, in S2105 of FIG. 25, it is determined whether or not the content of the small area gradation number buffer 617 is consistent with the subtractive color connected area image. It was. In the above embodiment, when a certain subtractive color connection region extends over a plurality of small regions, such a small region may be reduced to a different number of gradations depending on the contents of the small region gradation number buffer 617. It was to avoid the situation. Of course, such a situation can be avoided if the number of gradations of all the small regions is made equal to the value of the reference gradation number register 2002. However, if such a shape is adopted, it is necessary to allocate an unnecessary number of gradations to a small area with a small amount of information, for example, an area where no figure exists on the right side of FIG. Will occur.

また別の方法として、256階調への復元の際に、低い階調数を256階調に復元したときに得られる画素値は、高い階調数を256階調に復元したときに得られる画素値のサブセットにする、という方法も考えられる。これはたとえば、4階調を256階調に復元する際の画素値を0、73、182、255とする、あるいは逆に、8階調を256階調に復元する際の画素値を0、36、85、109、146、170、219、255とする、などの方法である。いずれの方法にせよ256階調に復元する際の画素値が不均等に分布することになり、好ましくない。   As another method, when restoring to 256 gradations, the pixel value obtained when the low gradation number is restored to 256 gradations is obtained when the high gradation number is restored to 256 gradations. A method of making a subset of pixel values is also conceivable. For example, pixel values when restoring 4 gradations to 256 gradations are set to 0, 73, 182, and 255. Conversely, pixel values when restoring 8 gradations to 256 gradations are set to 0, 36, 85, 109, 146, 170, 219, 255, and the like. Whichever method is used, pixel values when restoring to 256 gradations are unevenly distributed, which is not preferable.

こうした問題を回避するための別の方法として、1つの減色連結領域がまたがっている小領域はすべて同じ階調数になるように、小領域階調数バッファ617の各要素を調整する処理を行なうことが挙げられる。   As another method for avoiding such a problem, a process of adjusting each element of the small area gradation number buffer 617 is performed so that all the small areas over which one subtractive color connection area extends have the same gradation number. Can be mentioned.

なお、同じ減色連結領域に属する2つの画素も、減色連結領域を作成するのに用いた階調数と異なる階調数への減色を行なうと、2つの画素の減色後の画素値は一致しないことがある。   If two pixels belonging to the same subtractive color connection region are also subtracted from the number of gray levels used to create the subtractive color connection region, the pixel values after subtraction of the two pixels do not match. Sometimes.

たとえば、原画像で200〜236の画素値を持つ画素を考える。これら画素は、すべて8階調への減色では219という基準画素値に近いと判定され、6という画素値に減色されるであろう。したがって、原画像で、200〜236の範囲の画素値を持つ2つの画素は8階調への減色では、同一の減色連結領域に属することがあり得る。しかし、この2つの画素の一方が212以下の画素値を、もう一方が213以上の画素値を持つ場合には、4階調への減色では、前者は170という基準画素値に近いと判定されるために減色後の画素値は2、後者は255という基準画素値に近いと判定されるために減色後の画素値は3となる。したがって、4階調への減色後のこの2つの画素の画素値は一致しない。   For example, consider a pixel having a pixel value of 200 to 236 in the original image. These pixels will all be determined to be close to the reference pixel value of 219 for color reduction to 8 tones and will be reduced to a pixel value of 6. Accordingly, in the original image, two pixels having pixel values in the range of 200 to 236 may belong to the same subtractive color connection region when subtracting to eight gradations. However, if one of the two pixels has a pixel value of 212 or less and the other has a pixel value of 213 or more, the former is determined to be close to the reference pixel value of 170 in the color reduction to four gradations. Therefore, it is determined that the pixel value after color reduction is 2 and the latter is close to the reference pixel value of 255, so the pixel value after color reduction is 3. Therefore, the pixel values of these two pixels after color reduction to four gradations do not match.

しかしながら、このような結果は原画像にもともと存在した画素値の大小関係に起因するものである。つまり原画像に本来存在しない小領域の境界に沿った段差ができるような、図60に示されるような結果とは全く異なるものである。また、小領域に減色器616と組合せた形態では、小領域単位では原画像と大きく差があるような減色結果は起こり得ない。そのため各小領域の境界の問題以外では、減色によって視覚的に大きな問題が生じるおそれがないと考えられる。   However, such a result is due to the magnitude relationship between the pixel values originally present in the original image. That is, the result is completely different from the result shown in FIG. 60 in which a step along the boundary of a small area that does not originally exist in the original image is formed. Further, in the case where the small area is combined with the color reducer 616, a color reduction result that is largely different from the original image in a small area unit cannot occur. For this reason, it is considered that there is no possibility of causing a large visual problem due to the color reduction except for the problem of the boundaries between the small areas.

なお、図30に示したS2604の条件判定では、ラベルバッファ2008に格納された、減色連結領域の情報を用いた。しかしこの場合、ラベルバッファ2008を用いずに、原色画像バッファ2005の情報を用いて判定を行なっても同じことである。ただしこの場合、S2604の処理は以下のように変更される。   In the condition determination of S2604 shown in FIG. 30, the information on the subtractive color connection area stored in the label buffer 2008 is used. However, in this case, the determination is made using the information in the primary color image buffer 2005 without using the label buffer 2008. However, in this case, the process of S2604 is changed as follows.

すなわち、コントローラ2001は、減色画像バッファ2005の、着目画素と、その右隣の画素、つまり小領域(j,i)の最左端の列の、上から数えてm番目の画素が同じ値を持つかどうかを判定する。もし両者が同じ値を持っていれば制御はS2609に進み、さもなければ制御はS2605に進む。類似した処理を行なうステップS2605、S2703などについても同様である。   That is, the controller 2001 has the same value for the pixel of interest in the subtractive color image buffer 2005 and the pixel on the right side thereof, that is, the leftmost column of the small region (j, i), the mth pixel counted from the top. Determine whether or not. If both have the same value, control proceeds to S2609, otherwise control proceeds to S2605. The same applies to steps S2605 and S2703 that perform similar processing.

このような形態でも、ラベルバッファ2008を用いたのと同様の結果が得られるのは、次のような理由による。すなわち、減色画像バッファ2005上で、2つの隣接する画素が同じ画素値を持っているということは、ラベルバッファ2008の対応する要素が同じ値を持っているということを意味しているということであり、したがってS2604で行なわれている判定は、実は上に説明した代替案における判定方法と同じ効果を持つためである。   Even in this form, the same result as that obtained by using the label buffer 2008 can be obtained for the following reason. That is, on the subtractive color image buffer 2005, two adjacent pixels having the same pixel value means that corresponding elements of the label buffer 2008 have the same value. This is because the determination performed in S2604 actually has the same effect as the determination method in the alternative described above.

以上のように本実施の形態による画像減色装置は、小領域の間の繋がりを考慮して、小領域の減色後の階調数を決定する。そのため、色階調数の画素値の配置に制限を加えずに、視覚的に大きな影響を持つ小領域ごとの違いによる段差が起こりにくい画像の減色処理を行なうことができる。   As described above, the image color reduction apparatus according to the present embodiment determines the number of gradations after color reduction in a small area in consideration of the connection between the small areas. For this reason, it is possible to perform a color reduction process for an image in which a step due to a difference in each small area that has a large visual effect is unlikely to occur without limiting the arrangement of pixel values of the number of color gradations.

また本実施の形態に係る画像減色装置は、小領域中に線領域がある場合、小領域の減色階調数を大きくするような制御を行なう。そのため、がたつきなど線領域の劣化が目立たないように画像の減色処理を行なうことができる。   Further, the image color reduction apparatus according to the present embodiment performs control to increase the number of color reduction gradations in the small area when there is a line area in the small area. Therefore, it is possible to perform image color reduction processing so that deterioration of the line area such as rattling is not noticeable.

本実施の形態に係る画像減色装置は、小領域中に含まれる文字の縦線、横線の周囲の過度の減色による劣化を実際に検出し、その結果に応じて適切な階調数での減色を行なう。無理な減色は行なわないので、特に文字に含まれる線部分の劣化が目立たないように画像の減色処理を行なうことができる。   The image color reduction apparatus according to the present embodiment actually detects deterioration due to excessive color reduction around the vertical and horizontal lines of characters included in a small area, and performs color reduction with an appropriate number of gradations according to the result. To do. Since unreasonable color reduction is not performed, it is possible to perform image color reduction processing so that line portions included in characters are not particularly deteriorated.

[第2の実施の形態]
図36を参照して、本発明の第2の実施の形態に係る画像符号化装置は、画像入力装置3001、入力画像バッファ3002、適応的減色器3003、減色画像バッファ3004、画像符号化器3005、および符号化画像バッファ3006を含む。画像入力装置3001、入力画像バッファ3002、適応的減色器3003および減色画像バッファ3004はそれぞれ、第1の実施の形態で説明した画像入力装置301、入力画像バッファ3002、適応的減色器303および減色画像バッファ304と全く同じ構成および動作を持つ。したがってここではそれらについての詳細な説明は繰返さない。
[Second Embodiment]
Referring to FIG. 36, an image encoding device according to the second embodiment of the present invention includes an image input device 3001, an input image buffer 3002, an adaptive color reducer 3003, a reduced color image buffer 3004, and an image encoder 3005. , And an encoded image buffer 3006. The image input device 3001, the input image buffer 3002, the adaptive color reducer 3003, and the reduced color image buffer 3004 are the image input device 301, the input image buffer 3002, the adaptive color reducer 303, and the reduced color image described in the first embodiment, respectively. It has the same configuration and operation as the buffer 304. Therefore, detailed description thereof will not be repeated here.

画像符号化器3005は、減色画像バッファ3004、小領域階調数バッファ617および小領域数レジスタ603を参照しながら、画像を符号化して符号化画像バッファ3006に格納する機能を有する。   The image encoder 3005 has a function of encoding an image and storing it in the encoded image buffer 3006 while referring to the subtractive color image buffer 3004, the small region gradation number buffer 617 and the small region number register 603.

符号化画像バッファ3006に格納された符号化画像のフォーマットとしては、図37に示されたものを仮定する。なお、この第2の実施の形態の説明においても、具体的なデータ構造、数値例は説明のための例に過ぎず、本発明の技術的範囲を制限するようなものではない。   As the format of the encoded image stored in the encoded image buffer 3006, the format shown in FIG. 37 is assumed. In the description of the second embodiment, the specific data structure and numerical examples are merely examples for description, and do not limit the technical scope of the present invention.

図37を参照して、符号化画像バッファ3006に格納された符号化画像は、画像の横ピクセル数3101、画像の縦ピクセル数3102、小領域数(AC)3103、各小領域の階調数の圧縮データのサイズ(SAC)3104、各小領域の階調数の圧縮データのサイズ3105、各小領域左上隅X座標の圧縮データのサイズ(SASX)3106、各小領域の左上隅X座標の圧縮データ3007、各小領域左上隅Y座標の圧縮データのサイズ(SASY)3108、各小領域左上隅Y座標の圧縮データ3109、各小領域右下隅座標の圧縮データのサイズ(SAEX)3110、各小領域の右下隅X座標の圧縮データ3011、各小領域右下隅Y座標の圧縮データのサイズ(SAEY)3112、各小領域右下隅Y座標の圧縮データ3113、ビットプレーン数(NP)3114、0番目のビットプレーンの圧縮データのサイズSPS[0]3115、0番目のビットプレーンの圧縮データの3116、…、(NP−1)番目のビットプレーンの圧縮データのサイズSPS[NP−1]3117、および(NP−1)番目のビットプレーンの圧縮データ3118を含む。   With reference to FIG. 37, the encoded image stored in the encoded image buffer 3006 includes a horizontal pixel number 3101, a vertical pixel number 3102, a small area number (AC) 3103, and the number of gradations of each small area. Size of compressed data (SAC) 3104, compressed data size 3105 of the number of gradations of each small region, compressed data size (SASX) 3106 of each small region upper left corner X coordinate, and upper left corner X coordinate of each small region Compressed data 3007, compression data size (SASY) 3108 of each small region upper left corner Y coordinate, compressed data 3109 of each small region upper left corner Y coordinate, compressed data size (SAEX) 3110 of each small region lower right corner coordinate, Compressed data 3011 of the lower right corner X coordinate of the small area, compressed data size (SAEY) 3112 of the lower right corner Y coordinate of each small area, compressed data 31 of the lower right corner Y coordinate of each small area 3. Number of bit planes (NP) 3114, compressed data size SPS [0] 3115 of the 0th bit plane, compressed data 3116 of the 0th bit plane,..., Compression of the (NP-1) th bit plane The data size SPS [NP-1] 3117 and (NP-1) th bit plane compressed data 3118 are included.

図37に示されるデータのうちデータ3101〜3104、3106、3108、3110、3112、3114、3115、3117はいずれも4バイトの整数である。   Of the data shown in FIG. 37, data 3101 to 3104, 3106, 3108, 3110, 3112, 3114, 3115, and 3117 are all 4-byte integers.

図38を参照して、画像符号化器3005は、コントローラ3201、整数配列可逆圧縮器3102、テンポラリー整数配列バッファ3103、ビットプレーン分割器3204、ビットプレーンバッファ3205、ビットプレーン分割規則テーブル3206、画像可逆圧縮器3207、ビットプレーン数レジスタ3208、第1カウンタ3209およびテンポラリー小領域情報バッファ3210を含む。   38, an image encoder 3005 includes a controller 3201, an integer array lossless compressor 3102, a temporary integer array buffer 3103, a bitplane divider 3204, a bitplane buffer 3205, a bitplane division rule table 3206, and an image lossless. A compressor 3207, a bit plane number register 3208, a first counter 3209, and a temporary small area information buffer 3210 are included.

コントローラ3201は、画像符号化器3005の他の各構成要素の制御および他の各構成要素間の、または各構成要素と画像符号化器3005の外部との間のデータ通信の制御を行なうためのものである。コントローラ3201は画像符号化器3005内の他の各構成要素の動作に常に関与している。しかし、説明を簡略化するために、理解に差し支えない範囲でコントローラ3201の関与については以下の説明では言及しないことがある。   The controller 3201 controls the other components of the image encoder 3005 and controls data communication between the other components or between each component and the outside of the image encoder 3005. Is. The controller 3201 is always involved in the operation of each other component in the image encoder 3005. However, in order to simplify the description, the involvement of the controller 3201 may not be referred to in the following description to the extent that it may be understood.

コントローラ3201は、図39に示されるような制御構造を有する処理を行なうことにより上記した画像符号化器の機能を実現する。すなわち、コントローラ3201はまず、入力画像バッファ3001から画像の横幅を取出し、符号化画像バッファ3006の画像横幅のフィールド3101に書込む(S3301)。さらにコントローラ3201は、入力画像バッファ3001から画像の縦幅を取出し、符号化画像バッファ3006の、画像縦幅のフィールド3102に書込む(S3302)。さらにコントローラ3201は、小領域レジスタ603の内容を符号化画像バッファ3006の小領域数のフィールド3103に書込む(S3303)。   The controller 3201 realizes the above-described image encoder function by performing processing having a control structure as shown in FIG. That is, the controller 3201 first extracts the horizontal width of the image from the input image buffer 3001 and writes it in the image horizontal width field 3101 of the encoded image buffer 3006 (S3301). Further, the controller 3201 extracts the vertical length of the image from the input image buffer 3001, and writes it in the image vertical width field 3102 of the encoded image buffer 3006 (S3302). Further, the controller 3201 writes the contents of the small area register 603 in the small area number field 3103 of the encoded image buffer 3006 (S3303).

以後の説明では、小領域に対して、対応する小領域階調数バッファ617の要素が示している値を、その小領域階調数と呼ぶ。また、小領域階調数バッファ617のi番目の要素ALB[i]と表現する。   In the following description, the value indicated by the element of the small area gradation number buffer 617 corresponding to the small area is referred to as the small area gradation number. The i-th element ALB [i] of the small area gradation number buffer 617 is expressed.

コントローラ3201は、小領域階調数バッファ617の要素ALB[]がすべて等しいか否かを判定する(S3304)。これらがすべて等しければ制御はS3305に進み、さもなければ制御はS3307に進む。   The controller 3201 determines whether or not all the elements ALB [] of the small area gradation number buffer 617 are equal (S3304). If they are all equal, control proceeds to S3305, otherwise control proceeds to S3307.

S3305では、コントローラ3201は、小領域情報バッファ604の0番目の小領域の情報として、画像全体を1つの小領域とした小領域情報を書込む。続いてS3306ではコントローラ3201は、小領域数レジスタ603に1を設定する。   In step S <b> 3305, the controller 3201 writes small area information in which the entire image is one small area as information on the 0th small area in the small area information buffer 604. In step S <b> 3306, the controller 3201 sets 1 in the small area number register 603.

S3304〜S3306の処理の意味は以下のようなものである。小領域の階調数がどれも同じであるときは、画像を小領域に分割する意味がない。したがってそのような場合には、画像全体を1つの小領域とすることで、処理を高速化することができる。この際、特別なフラグなどを用いずに小領域数が1であるという特殊なケースとして符号化データ上に表現することで、復号時には例外処理が不要になるという利点もある。   The meaning of the processing in S3304 to S3306 is as follows. When the number of gradations in the small area is the same, there is no point in dividing the image into small areas. Therefore, in such a case, the processing can be speeded up by making the entire image one small region. At this time, there is an advantage that exception processing is not required at the time of decoding by expressing it on the encoded data as a special case in which the number of small areas is 1 without using a special flag.

S3307では整数配列可逆圧縮器3102が、小領域階調数バッファ617の、先頭から小領域数レジスタ603の値が示す個数の要素を可逆圧縮し、圧縮データの長さとともにそれぞれ符号化画像バッファ3006がフィールド3005、3004に格納する。   In S3307, the integer array reversible compressor 3102 reversibly compresses the number of elements indicated by the value of the small area number register 603 from the beginning of the small area gradation number buffer 617, and the encoded image buffer 3006 along with the length of the compressed data. Are stored in the fields 3005 and 3004.

ここでは、整数配列可逆圧縮器3102が整数配列を圧縮する際の圧縮方式としては、LZ77方式を想定する。LZ77方式については、たとえば植松、「文書データ圧縮アルゴリズム入門」(CQ出版社)131〜141頁に詳しく記載されている。LZ77方式については周知の方式であるので、ここではその詳細な説明は繰返さない。なおここで採用する可逆圧縮方式がLZ77に限定されるわけではないことはもちろんである。   Here, the LZ77 method is assumed as a compression method when the integer array reversible compressor 3102 compresses the integer array. The LZ77 system is described in detail, for example, in Uematsu, “Introduction to Document Data Compression Algorithm” (CQ Publishing Co.), pages 131-141. Since the LZ77 system is a known system, detailed description thereof will not be repeated here. Of course, the reversible compression method employed here is not limited to LZ77.

S3308では、コントローラ3201は、小領域情報バッファ604の、各小領域の右上隅X座標に対応する要素を先頭から小領域数レジスタ603が示す個数だけ読取り、テンポラリー整数配列バッファ3103に格納する。続いて整数配列可逆圧縮器3102はテンポラリー整数配列バッファ3103の内容を可逆圧縮し、その圧縮データの長さとともにそれぞれ符号化画像バッファ3006のフィールド3107、3106に格納する(S3309)。   In step S <b> 3308, the controller 3201 reads the element corresponding to the upper right corner X coordinate of each small area from the top in the small area information buffer 604 by the number indicated by the small area number register 603, and stores it in the temporary integer array buffer 3103. Subsequently, the integer array reversible compressor 3102 reversibly compresses the contents of the temporary integer array buffer 3103, and stores them in the fields 3107 and 3106 of the encoded image buffer 3006 together with the length of the compressed data (S3309).

さらにコントローラ3201は、小領域情報バッファ604の、各小領域の右上隅Y座標に対応する要素を先頭から小領域数レジスタ603が示す個数だけ読取り、テンポラリー整数配列バッファ3103に格納する(S3310)。続いてS3311で整数配列可逆圧縮器3102は、テンポラリー整数配列バッファ3103の内容を可逆圧縮し、その圧縮データの長さとともにそれぞれ符号化画像バッファ3006のフィールド3109、3108に格納する。   Further, the controller 3201 reads the element corresponding to the upper right corner Y coordinate of each small area in the small area information buffer 604 by the number indicated by the small area number register 603 from the top, and stores it in the temporary integer array buffer 3103 (S3310). In step S3311, the integer array lossless compressor 3102 performs lossless compression on the contents of the temporary integer array buffer 3103, and stores the contents in the fields 3109 and 3108 of the encoded image buffer 3006 together with the length of the compressed data.

S3312ではコントローラ3201は、小領域情報バッファ604の、各小領域左上隅X座標に対応する要素を先頭から小領域数レジスタ603が示す個数だけ読取り、テンポラリー整数配列バッファ3103に格納する。S3313では、整数配列可逆圧縮器3102は、テンポラリー整数配列バッファ3103の内容を、可逆圧縮し、その圧縮データの長さとともにそれぞれ符号化画像バッファ3006のフィールド3111、3110に格納する。   In step S <b> 3312, the controller 3201 reads the element corresponding to each small region upper left corner X coordinate of the small region information buffer 604 from the top by the number indicated by the small region number register 603, and stores it in the temporary integer array buffer 3103. In S3313, the integer array lossless compressor 3102 performs lossless compression on the contents of the temporary integer array buffer 3103, and stores the contents in the fields 3111 and 3110 of the encoded image buffer 3006 together with the length of the compressed data.

S3314では、コントローラ3201は、小領域情報バッファ604の、各小領域の左下隅Y座標に対応する要素を先頭から小領域数レジスタ603が示す個数だけ読取り、テンポラリー整数配列バッファ3103に格納する。S3315で整数配列可逆圧縮器3102は、テンポラリー整数配列バッファ3103の内容を可逆圧縮し、その圧縮データの長さとともにそれぞれ符号化画像バッファ3006のフィールド3113、3112に格納する。   In step S <b> 3314, the controller 3201 reads the element corresponding to the lower left corner Y coordinate of each small area in the small area information buffer 604 from the top by the number indicated by the small area number register 603, and stores it in the temporary integer array buffer 3103. In step S3315, the integer array lossless compressor 3102 performs lossless compression on the contents of the temporary integer array buffer 3103, and stores the contents in the fields 3113 and 3112 of the encoded image buffer 3006 together with the length of the compressed data.

S3316でビットプレーン分割器3204は、減色画像バッファ3004に格納された画像を各小領域ごとにビットプレーンに分割し、ビットプレーンバッファ3205に格納する。S3317では、コントローラ3201は、符号化されるビットプレーンの数を符号化画像バッファ3006のビットプレーン数のフィールド3113に書込む。この例の場合には、3がフィールド3113に書込まれる。この後画像可逆圧縮器3207が、ビットプレーンバッファ3205の内容をプレーンごとに圧縮し(S3318)処理を終了する。   In step S <b> 3316, the bit plane divider 3204 divides the image stored in the reduced-color image buffer 3004 into bit planes for each small area, and stores the bit plane in the bit plane buffer 3205. In step S3317, the controller 3201 writes the number of bit planes to be encoded in the bit plane number field 3113 of the encoded image buffer 3006. In this example, 3 is written in field 3113. Thereafter, the image reversible compressor 3207 compresses the contents of the bit plane buffer 3205 for each plane (S3318), and the process ends.

図39のS3304の処理の詳細について図40を参照して説明する。まずS3401でコントローラ3201は、第1カウンタ3209を1に初期化する。以下の説明ではiは第1カウンタ3209の値を意味する。続くS3402でコントローラ3201はALB[0]とALB[i]とを比較する(S3402)。両者が等しければ制御はS3403に、等しくなければ制御はS3406に進む。   Details of the processing of S3304 in FIG. 39 will be described with reference to FIG. First, in step S3401, the controller 3201 initializes the first counter 3209 to 1. In the following description, i means the value of the first counter 3209. In subsequent S3402, the controller 3201 compares ALB [0] with ALB [i] (S3402). If they are equal, control proceeds to S3403, and if not equal, control proceeds to S3406.

S3403では、コントローラ3201は、第1カウンタ3209の値iをインクリメントする。続いてS3404においてコントローラ3201は、第1カウンタ3209の値iを小領域数レジスタ603の内容と比較する(S3404)。両者が等しければ制御はS3405に進み、さもなければ制御はS3402に戻る。   In S3403, the controller 3201 increments the value i of the first counter 3209. Subsequently, in S3404, the controller 3201 compares the value i of the first counter 3209 with the contents of the small area number register 603 (S3404). If they are equal, control proceeds to S3405, otherwise control returns to S3402.

S3406ではコントローラ3201は、小領域階調数バッファ617の要素がすべて一致していないと判定して処理を終了する。一方S3405では、コントローラ3201は、小領域階調数バッファ617の要素がすべて等しいと判定して処理を終了する。   In step S3406, the controller 3201 determines that all the elements of the small area gradation number buffer 617 do not match, and ends the process. On the other hand, in S3405, the controller 3201 determines that all the elements of the small area gradation number buffer 617 are equal, and ends the processing.

図39に示したS3316の処理の詳細について図41を参照して説明する。S3501において、コントローラ3201は、第1カウンタ3209を0に初期化する(S3501)。   Details of the processing of S3316 shown in FIG. 39 will be described with reference to FIG. In S3501, the controller 3201 initializes the first counter 3209 to 0 (S3501).

S3502においてビットプレーン分割器3204は、小領域情報バッファ604から、i番目の小領域の位置情報を読出してテンポラリー小領域情報バッファ3210にコピーする。ここでは、テンポラリー小領域情報バッファ3210は、小領域の右上隅のX座標およびY座標、ならびに右上隅のX座標およびY座標を格納できる4つ組の整数とする。続いてS3503でビットプレーン分割器3204は、ビットプレーン分割規則テーブル3206、テンポラリー小領域情報バッファ3210を参照し、i番目の小領域をビットプレーンに分割し、ビットプレーンバッファ3205の対応する領域に書込む。ここで行なわれるビットプレーンへの分割の規則は、ビットプレーン分割規則テーブル3206で与えられる。その値の定め方については後述する。   In S3502, the bit plane divider 3204 reads the position information of the i-th small area from the small area information buffer 604 and copies it to the temporary small area information buffer 3210. Here, the temporary small area information buffer 3210 is a set of four integers that can store the X and Y coordinates of the upper right corner and the X and Y coordinates of the upper right corner of the small area. In step S3503, the bit plane divider 3204 refers to the bit plane division rule table 3206 and the temporary small area information buffer 3210, divides the i-th small area into bit planes, and writes them in the corresponding areas of the bit plane buffer 3205. Include. The rule of division into bit planes performed here is given by the bit plane division rule table 3206. How to determine the value will be described later.

S3504でコントローラ3201は第1カウンタ3209の値iをインクリメントする。続いてコントローラ3201は、S3505において第1カウンタ3209の値iと小領域数レジスタ603の値とを比較する。もし両者が等しければ処理は終了する。さもなければ制御はS3502に戻る。   In step S3504, the controller 3201 increments the value i of the first counter 3209. In step S <b> 3505, the controller 3201 compares the value i of the first counter 3209 with the value of the small area number register 603. If they are equal, the process ends. Otherwise, control returns to S3502.

図39のS3318の処理の詳細について図42を参照して説明する。コントローラ3201は、最初に第1カウンタ3209の値iを0に初期化する(S5001)。以下iは第1カウンタ3209の値を意味するものとする。   Details of the processing of S3318 in FIG. 39 will be described with reference to FIG. The controller 3201 first initializes the value i of the first counter 3209 to 0 (S5001). Hereinafter, i means the value of the first counter 3209.

続いて画像可逆圧縮器3207は、ビットプレーンバッファ3205のi番目のプレーンのデータを可逆圧縮し、圧縮データの長さとともに符号化画像バッファ3006に書込む(S5002)。2値画像の可逆圧縮の手法としては、ここではJBIG(Joint Bi-level Image Group)を仮定する。したがって画像可逆圧縮器3207の出力はJBIGデータとなる。なおJBIGについては、たとえば画像電子学会誌第20巻第1号に詳しい。またJBIG方式については既に広く使われている方式である。したがってここではその詳細な説明は行なわない。なおまたここで2値画像の圧縮方式としてどのような方法を用いるかは問題ではなく、JBIG以外の方法であってもよい。   Subsequently, the image lossless compressor 3207 losslessly compresses the data of the i-th plane of the bit plane buffer 3205, and writes it in the encoded image buffer 3006 together with the length of the compressed data (S5002). Here, JBIG (Joint Bi-level Image Group) is assumed as a technique for lossless compression of a binary image. Therefore, the output of the image reversible compressor 3207 is JBIG data. JBIG is detailed in, for example, Journal of the Institute of Image Electronics Engineers of Japan, Vol. 20, No. 1. The JBIG method is already widely used. Therefore, detailed description thereof will not be given here. Here, it does not matter what method is used as the binary image compression method, and a method other than JBIG may be used.

続いてS5003においてコントローラ3201は、第1カウンタ3209の値iをインクリメントする。さらにコントローラ3201は、第1カウンタ3209の値iをビットプレーン数レジスタ3208と比較する(S5004)。両者が等しければ処理は終了し、さもなければ制御はS5002に戻る。   In step S5003, the controller 3201 increments the value i of the first counter 3209. Further, the controller 3201 compares the value i of the first counter 3209 with the bit plane number register 3208 (S5004). If they are equal, the process ends. Otherwise, the control returns to S5002.

図38に示すビットプレーンバッファ3205は、出力画像バッファ3006と等しいデータ構造およびサイズを持つバッファを3プレーン分集めたものである。後に説明するように、ビットプレーンバッファ3205の各プレーンのデータは2値画像である。したがって通常行なわれているように、1画素あたり1ビットを格納することなどにより、さらに効率的にデータを格納するようにしてもよい。なおビットプレーンバッファ3205の各プレーンには、最上位プレーンから0、1、2と番号が付けられているものとする。   A bit plane buffer 3205 shown in FIG. 38 is a collection of three planes of buffers having the same data structure and size as the output image buffer 3006. As will be described later, the data of each plane of the bit plane buffer 3205 is a binary image. Therefore, as usual, data may be stored more efficiently by storing 1 bit per pixel. It is assumed that the planes of the bit plane buffer 3205 are numbered 0, 1, 2 from the most significant plane.

ビットプレーンバッファ3205が3プレーンからなるのは、小領域階調数バッファ617で示される小領域階調数の最大が8であり、8階調画像は3プレーンで表わされるためである。したがって小領域階調数バッファ617の内容によっては、プレーン数を変更する必要が生ずる。なおビットプレーン数レジスタ3208に、この最大のプレーン数の情報が予め格納されているものとする。   The bit plane buffer 3205 is composed of 3 planes because the maximum number of small area gradations indicated by the small area gradation number buffer 617 is 8, and an 8-gradation image is represented by 3 planes. Therefore, depending on the contents of the small area gradation number buffer 617, it is necessary to change the number of planes. It is assumed that information on the maximum number of planes is stored in the bit plane number register 3208 in advance.

図38に示すビットプレーン分割規則テーブル3206は、2次元整数配列となっている。そのインデックスは、小領域階調数0〜8と画素値0〜7とである。ビットプレーン分割規則テーブル3206によって、画素値は、小領域の階調数によって異なった変換を受けてから、2進表現の各桁の値によって適切なビットプレーンに転換される。   The bit plane division rule table 3206 shown in FIG. 38 is a two-dimensional integer array. The indexes are 0 to 8 for small area gradation and 0 to 7 for pixel values. According to the bit plane division rule table 3206, the pixel value is subjected to different conversion depending on the number of gradations of the small area, and then converted into an appropriate bit plane according to the value of each digit of the binary representation.

ビットプレーン分割規則テーブル3206のインデックスの1つである小領域階調数の範囲を0〜8としたのは、最大の階調数として8を仮定しているためである。また、画素値の範囲を0〜7としたのは、最大の画素値が最大の階調数−1となるためである。プレーン番号の範囲を0〜2としたのは、プレーン数が3であるためである。このような範囲は、ここに挙げたパラメータが変更されれば適宜変更されるべきものである。   The reason why the range of the small area gradation number, which is one of the indexes in the bit plane division rule table 3206, is set to 0 to 8 is that the maximum gradation number is assumed to be 8. The reason why the range of pixel values is set to 0 to 7 is that the maximum pixel value becomes the maximum number of gradations -1. The reason why the plane number range is 0 to 2 is that the number of planes is three. Such a range should be changed as appropriate if the parameters listed here are changed.

なおここで述べたビットプレーン分割規則テーブル3206のデータ構造は、説明をわかりやすくするためにある程度冗長な構造としたものである。たとえば、小領域階調数として2、4、8以外には、対応する要素は不要である。また、小領域階調数≦画素値となるような組合せは存在しない。さらに効率の高いデータ構造を考えることは当然可能であるが、ここでは理解を容易とするために上記したようなある程度の冗長さを含んだものを用いる。不要なビットプレーン分割規則テーブル3206の要素については、特に説明しない限り0が格納されているものとする。実際にはどのような値を設定してもそれらの値は使用されないので処理結果には影響しない。   Note that the data structure of the bit-plane division rule table 3206 described here is a structure that is somewhat redundant in order to make the explanation easy to understand. For example, elements other than 2, 4, and 8 as the number of small area gradations do not require corresponding elements. Further, there is no combination that satisfies the small area gradation number ≦ pixel value. Although it is naturally possible to consider a data structure with higher efficiency, a data structure including a certain degree of redundancy as described above is used here for easy understanding. For elements of the unnecessary bit-plane division rule table 3206, 0 is stored unless otherwise specified. Actually, no matter what values are set, these values are not used, so the processing result is not affected.

以下、ビットプレーン分割規則テーブル3206の各要素の値の定め方について説明する。最も簡単な方法は、図43に示すように、画素値を2進法で表わし、各桁の0/1をそのまま各プレーンに対応させる方法である。この方法に対応するビットプレーン分割規則テーブル3206の構造は以下のとおりである。すなわち、ビットプレーン分割規則テーブル3206は、図43に示す第1列をインデックスの1つである画素値としたとき、もう片方のインデックスの値にかかわらず、図43の第2列に示されている対応する値が読出せるような構造とする。たとえば小領域階調数にかかわらず、画素値5に対応するプレーン番号0、1、2それぞれに対応するビットプレーン分割規則テーブル3206の要素は5となり、同じく画素値6に対応する要素は6となる。   Hereinafter, how to determine the value of each element of the bit plane division rule table 3206 will be described. As shown in FIG. 43, the simplest method is a method in which pixel values are represented in binary and 0/1 of each digit is directly associated with each plane. The structure of the bit plane division rule table 3206 corresponding to this method is as follows. That is, when the first column shown in FIG. 43 is a pixel value that is one of the indexes, the bit plane division rule table 3206 is shown in the second column of FIG. 43 regardless of the value of the other index. The structure is such that the corresponding value can be read. For example, regardless of the number of small area gradations, the element of the bit plane division rule table 3206 corresponding to each of the plane numbers 0, 1, and 2 corresponding to the pixel value 5 is 5, and the element corresponding to the pixel value 6 is 6 as well. Become.

図43の3列目以降は、ビットプレーンバッファ3205への展開後の値を説明する目的で示したものである。したがってビットプレーン分割規則テーブル3206には実際にはこれらの値は現われない。これは後に説明する図44および図45についても同様である。   The third and subsequent columns in FIG. 43 are shown for the purpose of explaining the values after development into the bit plane buffer 3205. Therefore, these values do not actually appear in the bit plane division rule table 3206. The same applies to FIGS. 44 and 45 described later.

このようなビットプレーン分割規則テーブル3206の値の定め方を用いても、本発明の第2の実施の形態は動作する。しかしここでは、ビットプレーン分割規則テーブル3206の内容として以下の規則で定められるものを用いる。すなわち、小領域階調数が8である要素については図43で、小領域階調数が4である要素については図44で、小領域階調数が2である要素については図45で与えられるものを用いる。   The second embodiment of the present invention operates even when such a method of determining the value of the bit plane division rule table 3206 is used. However, here, the contents of the bit plane division rule table 3206 are determined by the following rules. That is, the element having the small area gradation number of 8 is given in FIG. 43, the element having the small area gradation number of 4 is given in FIG. 44, and the element having the small area gradation number of 2 is given in FIG. Use what you can.

このように定めるのは、特にテキスト画像またはそれに類する画像の効率的な符号化を目的としてのことである。テキスト画像の場合には、広い面積を背景領域が占めることが多い。その中でも、2値で表現できる小領域は特に背景領域が広い範囲を占める画像であると考えられる。すなわち、小領域階調数が異なっても、大半の小領域で、小領域階調数が2の小領域では1、小領域階調数が4の小領域では3、小領域階調数が8の領域では7と、画素が最も大きな値を持った領域、すなわち背景領域が大半を占めることが、少なくともテキスト画像では多いと考えられる。   This definition is especially for the purpose of efficient coding of text images or similar images. In the case of a text image, the background area often occupies a large area. Among them, the small area that can be expressed in binary is considered to be an image in which the background area occupies a wide range. That is, even if the number of small area gradations is different, in most small areas, the small area with the small area gradation number 2 is 1, the small area with the small gradation number 4 is 3, and the small area gradation number is It is considered that at least the text image has 7 in the area 8 and the area where the pixel has the largest value, that is, the background area occupies most of the area.

ところが、このように異なる小領域階調数を持つ小領域からなる画像を、図43に示されている方法で小領域階調数にかかわりなくビットプレーンに展開すると、同じ背景領域でも各ビットプレーンの値が異なることがある。たとえば背景領域は、小領域階調数が8の小領域ではすべてのビットプレーンが1、小領域階調数が4の小領域では第1ビットプレーンは0、その他のビットプレーンでは1、小領域階調数が2の小領域では第3ビットプレーンは1、その他のビットプレーンは0となる。   However, when such an image composed of small areas having different small area gradation numbers is developed on a bit plane by the method shown in FIG. 43 regardless of the small area gradation numbers, each bit plane can be obtained even in the same background area. May have different values. For example, the background area is a small area with 8 small area gradations, all bit planes are 1, a small area with 4 small area gradations is 0 in the first bit plane, and 1 in other bit planes. In a small area with 2 gradations, the third bit plane is 1 and the other bit planes are 0.

そのため、各ビットプレーンは、小領域階調数が異なる小領域ごとに、0と1とが混在したものになる。これは、第1の実施の形態で説明したような、表示時に起こる問題ではないが、第2の実施の形態のように、小領域ごとに適応的に階調数を変化させる技術を画像圧縮技術と組合せる場合に、圧縮効率を低下させるという問題として現われる。   Therefore, each bit plane is a mixture of 0 and 1 for each small area having a different number of small gradations. This is not a problem that occurs at the time of display as described in the first embodiment. However, as in the second embodiment, a technique for adaptively changing the number of gradations for each small area is image compression. When combined with technology, it appears as a problem of reducing compression efficiency.

このような状況を改善するために、画素値の復元には、減色後の画素値だけでなく、各小領域の小領域階調数を用いることができることを利用して圧縮効率を高める。そのために、上に述べたように小領域階調数によってビットプレーンへの展開規則を変更するのである。したがって、各小領域の階調数の異なるものに対してビットプレーン分割規則を別々に持たせ、階調数の情報を用いてビットプレーンの圧縮率を向上させるように、減色後のビットプレーンの値の連続性を高めることができる。これが本実施の形態の装置における技術的に重要な点の1つである。   In order to improve such a situation, in order to restore the pixel value, not only the pixel value after color reduction but also the fact that the number of small area gradations of each small area can be used increases the compression efficiency. For this purpose, as described above, the development rule for the bit plane is changed according to the number of small area gradations. Therefore, bit plane division rules are separately provided for the different gradation levels of each small area, and the bit plane after color reduction is used to improve the compression ratio of the bit plane using the gradation number information. The continuity of values can be increased. This is one of the technically important points in the apparatus of the present embodiment.

これを比較的単純な例を参考にして説明する。図46には、減色前の入力画像を示す。この画像は3901〜3906の小領域に分割されている。そして小領域3901、3902、3904、3905にまたがって文字画像3907が存在している。   This will be described with reference to a relatively simple example. FIG. 46 shows an input image before color reduction. This image is divided into 3901 to 3906 small areas. A character image 3907 exists across the small areas 3901, 3902, 3904, and 3905.

この例では、減色後に小領域3901、3902、3904、3905の階調数は8値と判定され、小領域3903、3906の階調数が2値と判定されているものとする。これは文字3907の存在から十分あり得ることである。また背景領域は8値領域では画素値が7、2値領域では画素値が1となっており、文字3907は画素値0を持っているものとする。   In this example, it is assumed that the gradation numbers of the small areas 3901, 3902, 3904, and 3905 are determined to be eight values after the color reduction, and the gradation numbers of the small areas 3903 and 3906 are determined to be binary. This is likely due to the presence of the character 3907. In the background area, the pixel value is 7 in the 8-level area, and the pixel value is 1 in the 2-level area, and the character 3907 has a pixel value of 0.

図46に示した例では、図43に示した分割方法を用いると、2値では0、1としてビットプレーンに展開される。そのために、2値領域の最上位プレーン(0番目のプレーン)は常に0となる。これを図47に示した。このため、最上位プレーンでは、小領域によって背景領域でも値が異なっており、値の分布の偏りを利用して圧縮を行なうエントロピー圧縮には不利である。   In the example shown in FIG. 46, when the division method shown in FIG. 43 is used, binary values are expanded to 0 and 1 as bit planes. Therefore, the most significant plane (0th plane) of the binary area is always 0. This is shown in FIG. For this reason, in the uppermost plane, the value differs in the background region depending on the small region, which is disadvantageous for entropy compression in which compression is performed by using a bias in the distribution of values.

このような場合に、図44に示された方法で2値領域の値を変換することが考えられる。この場合には画素値として0または7としてビットプレーンに展開される。そのために2値領域の最上位プレーン(0番目のプレーン)は、2値でも背景領域では1となる。これを図48に示した。このため、小領域ごとに異なる階調数が混在していたとしても、それによって圧縮効率を低下させることが少ない。   In such a case, it is conceivable to convert the value in the binary region by the method shown in FIG. In this case, the pixel value is expanded as 0 or 7 in the bit plane. Therefore, the uppermost plane (0th plane) in the binary area is 1 in the background area even in the binary area. This is shown in FIG. For this reason, even if different numbers of gradations are mixed in each small area, the compression efficiency is rarely lowered by that.

図36、図37で定められるビットプレーン分割規則テーブル3206とは別の例として、小領域階調数が4である小領域に対しては図49に示されるものを、小領域階調数が2である小領域に対しては図50に示されるものを、それぞれ用いることも考えられる。これは、特に小領域階調数が8であるような小領域の数が少ない画像において有効である。ビットプレーン分割規則テーブル3206として、図49および図50に示されているものを用いた場合には、上位2プレーンで大半の小領域の画像が表現されているからである。   As an example different from the bit plane division rule table 3206 defined in FIG. 36 and FIG. 37, the small area gradation number is 4 as shown in FIG. It is also conceivable to use those shown in FIG. This is particularly effective for an image with a small number of small areas where the number of small area gradations is eight. This is because when the bit plane division rule table 3206 shown in FIGS. 49 and 50 is used, most of the small area images are represented by the upper two planes.

これに対して、ビットプレーン分割規則テーブル3206として、図44、図45に示されているものを採用すると、利点もある。すなわち、小領域ごとに異なる階調数を持たせながら、最上位プレーンを復号するだけで画像の概略がわかるという機能を減色後の画像が持つことができるということである。これはこの場合、背景画像に対応する画素値については、小領域階調数に関係なく最上位プレーンに1が入っているためである。   On the other hand, if the bit plane division rule table 3206 shown in FIGS. 44 and 45 is adopted, there is an advantage. In other words, the subtracted color image can have a function of knowing the outline of the image only by decoding the uppermost plane while giving different gradation numbers for each small area. This is because in this case, the pixel value corresponding to the background image contains 1 in the uppermost plane regardless of the number of small area gradations.

なお本実施の形態では多値画像をビットプレーンに分割して複数の2値画像として圧縮しているが、多値画像のまま圧縮しても差し支えない。また、小領域階調数バッファ617の、横方向の小領域数を横幅、縦方向小領域数を縦幅とする画像としてビットプレーンに分割して圧縮することもできる。   In the present embodiment, the multi-valued image is divided into bit planes and compressed as a plurality of binary images. However, the multi-valued image may be compressed as it is. Further, the small area gradation number buffer 617 may be compressed by dividing it into bit planes as an image with the number of small areas in the horizontal direction as the horizontal width and the number of small areas in the vertical direction as the vertical width.

上の第2の実施の形態で説明した画像圧縮装置は、異なる階調数を持つ小領域を考慮して、減色後のビットプレーンの圧縮効果が高くなるように構成されている。そのため、より効率の高い画像圧縮を行なうことができる。   The image compression apparatus described in the second embodiment above is configured to increase the compression effect of the bit plane after color reduction in consideration of small areas having different numbers of gradations. Therefore, more efficient image compression can be performed.

[第3の実施の形態]
以下に述べる本発明の第3の実施の形態に係る装置は、第2の実施の形態による画像符号化装置に対応する画像復号装置である。なお今までの説明と同様、以下の説明において用いる具体的なデータ構造または数値例は、説明のための例に過ぎず、本発明の技術的範囲をこれらに制限するような性質のものではない。
[Third Embodiment]
The apparatus according to the third embodiment of the present invention described below is an image decoding apparatus corresponding to the image encoding apparatus according to the second embodiment. As in the description so far, the specific data structures or numerical examples used in the following description are merely examples for description, and are not of a nature that limits the technical scope of the present invention. .

図51を参照して、この第3の実施の形態に係る画像復号装置は、符号化画像バッファ4201、画像復号器4202、出力画像バッファ4203および画像出力装置4204を含む。   Referring to FIG. 51, the image decoding apparatus according to the third embodiment includes an encoded image buffer 4201, an image decoder 4202, an output image buffer 4203, and an image output apparatus 4204.

図52を参照して、画像復号器4202は、コントローラ4301、整数配列復号器4302、テンポラリー整数配列バッファ4303、圧縮画像復号器4304、ビットプレーンバッファ4305、ビットプレーン統合器4306、ビットプレーン統合規則テーブル4307、小領域情報バッファ4308、小領域階調数バッファ4309、小領域数レジスタ4310、ビットプレーン数レジスタ4311、画像横幅レジスタ4312、画像縦幅レジスタ4313、第1カウンタ4314、減色画像バッファ4315、表示画像作成器4316、基準画素値テーブル4317とを含む。以下の説明では、小領域階調数バッファ4309のi番目の要素をALB[i]と表わすものとする。   52, an image decoder 4202 includes a controller 4301, an integer array decoder 4302, a temporary integer array buffer 4303, a compressed image decoder 4304, a bit plane buffer 4305, a bit plane integrator 4306, and a bit plane integration rule table. 4307, small region information buffer 4308, small region gradation number buffer 4309, small region number register 4310, bit plane number register 4311, image horizontal width register 4312, image vertical width register 4313, first counter 4314, subtractive color image buffer 4315, display An image creator 4316 and a reference pixel value table 4317 are included. In the following description, the i-th element of the small area gradation number buffer 4309 is expressed as ALB [i].

符号化画像バッファ4201は、第2の実施の形態の画像符号化装置を構成する符号化画像バッファ3006と同一のデータ構造である。   The encoded image buffer 4201 has the same data structure as that of the encoded image buffer 3006 constituting the image encoding device according to the second embodiment.

コントローラ4301は、画像復号器4202の他の各構成要素の制御および他の各構成要素相互間または各構成要素と画像復号器4202の外部との間のデータ通信の制御を行なうためのものである。コントローラ4301は画像復号器4202内の他の各構成要素の動作には常に関与している。しかし、説明の簡略化のために、以下の記載では理解に差し支えない限りコントローラ4301の動作については言及しないことがある。   The controller 4301 is for controlling other components of the image decoder 4202 and controlling data communication between the other components or between each component and the outside of the image decoder 4202. . The controller 4301 is always involved in the operation of the other components in the image decoder 4202. However, for simplification of explanation, the following description may not refer to the operation of the controller 4301 unless it is understandable.

コントローラ4301が図52に示される各構成要素を制御することにより、画像復号器4202としての機能を実現するための処理の制御構造を図53以下を参照して説明する。まず、コントローラ4301は、符号化画像バッファ4201の画像横幅のフィールド3101の内容を画像横幅レジスタ4312にコピーする(S4501)。続いてコントローラ4301は、符号化画像バッファ4201の画像縦幅のフィールド3102の内容を画像縦幅レジスタ4313にコピーする(S4502)。さらにコントローラ4301は、符号化画像バッファ4201の小領域数のフィールド3103の内容を小領域数レ
ジスタ4312にコピーする(S4503)。
A control structure of processing for realizing the function as the image decoder 4202 by the controller 4301 controlling each component shown in FIG. 52 will be described with reference to FIG. First, the controller 4301 copies the contents of the image width field 3101 of the encoded image buffer 4201 to the image width register 4312 (S4501). Subsequently, the controller 4301 copies the contents of the image vertical width field 3102 of the encoded image buffer 4201 to the image vertical width register 4313 (S4502). Further, the controller 4301 copies the contents of the small area number field 3103 of the encoded image buffer 4201 to the small area number register 4312 (S4503).

整数配列復号器4302は、符号化画像バッファ4201のフィールド3204の値が示しているバイト数だけ、フィールド3105から符号化データを読込む。さらに整数配列復号器4302は、このように読込んだ符号化データを復号し、小領域階調数バッファ4309に書込む(S4504)。このとき整数配列復号器4302で行なわれるのは、第2の実施の形態の装置の整数配列可逆圧縮器3102による符号化に対する復号動作である。ここでは、第2の実施の形態で用いた例に従って圧縮アルゴリズムとしてはLZ77を想定しているものとする。   The integer array decoder 4302 reads encoded data from the field 3105 by the number of bytes indicated by the value of the field 3204 of the encoded image buffer 4201. Further, the integer array decoder 4302 decodes the encoded data read in this way and writes it into the small area gradation number buffer 4309 (S4504). At this time, the integer array decoder 4302 performs a decoding operation for encoding by the integer array lossless compressor 3102 of the apparatus of the second embodiment. Here, it is assumed that LZ77 is assumed as the compression algorithm in accordance with the example used in the second embodiment.

なお、ここに述べたとおり整数配列復号器4302が採用する復号動作のアルゴリズムは、第2の実施の形態の装置の整数配列可逆圧縮器3102において用いられた符号化アルゴリズムに対応するものである。したがって符号化アルゴリズムが変わればそれに従って整数配列復号器4302の採用する復号動作も変わる。   As described herein, the decoding operation algorithm employed by the integer array decoder 4302 corresponds to the encoding algorithm used in the integer array lossless compressor 3102 of the apparatus according to the second embodiment. Therefore, if the encoding algorithm changes, the decoding operation employed by the integer array decoder 4302 changes accordingly.

整数配列復号器4302は、符号化画像バッファ4201のフィールド3106の値が示しているバイト数だけフィールド3107から符号化データを読込む。さらに整数配列復号器4302は読込んだ符号化データを復号し、テンポラリー整数配列バッファ4303に書込む(S4505)。   The integer array decoder 4302 reads encoded data from the field 3107 by the number of bytes indicated by the value of the field 3106 of the encoded image buffer 4201. Further, the integer array decoder 4302 decodes the read encoded data, and writes it into the temporary integer array buffer 4303 (S4505).

コントローラ4301は、テンポラリー整数配列バッファ4303の内容を、小領域情報バッファ4308の、各小領域の左上X座標に対応する部分に書込む(S4506)。   The controller 4301 writes the contents of the temporary integer array buffer 4303 to the portion corresponding to the upper left X coordinate of each small area in the small area information buffer 4308 (S4506).

整数配列復号器4302は、符号化画像バッファ4201のフィールド3108の値が示しているバイト数だけ、フィールド3109から符号化データを読込む。整数配列復号器4302はこの符号化データを復号し、テンポラリー整数配列バッファ4303に書込む(S4507)。   The integer array decoder 4302 reads encoded data from the field 3109 by the number of bytes indicated by the value of the field 3108 of the encoded image buffer 4201. The integer array decoder 4302 decodes this encoded data and writes it into the temporary integer array buffer 4303 (S4507).

コントローラ4301は、テンポラリー整数配列バッファ4303の内容を、小領域情報バッファ4308の、各小領域の左上Y座標に対応する部分に書込む(S4508)。   The controller 4301 writes the contents of the temporary integer array buffer 4303 into the portion corresponding to the upper left Y coordinate of each small area in the small area information buffer 4308 (S4508).

整数配列復号器4302は、符号化画像バッファ4201のフィールド3110の値が示しているバイト数だけフィールド3111から符号化データを読込む。整数配列復号器4302は、この符号化データを復号し、テンポラリー整数配列バッファ4303に書込む(S4509)。   The integer array decoder 4302 reads encoded data from the field 3111 by the number of bytes indicated by the value of the field 3110 of the encoded image buffer 4201. The integer array decoder 4302 decodes this encoded data and writes it into the temporary integer array buffer 4303 (S4509).

コントローラ4301は、テンポラリー整数配列バッファ4303の内容を、小領域情報バッファ4308の各小領域の右下X座標に対応する部分に書込む(S4510)。整数配列復号器4302は、符号化画像バッファ4201のフィールド3112の値が示しているバイト数だけフィールド3113から符号化データを読込む。整数配列復号器4302は、読込んだ符号化データを復号し、テンポラリー整数配列バッファ4303に書込む(S4511)。   The controller 4301 writes the contents of the temporary integer array buffer 4303 into the portion corresponding to the lower right X coordinate of each small area of the small area information buffer 4308 (S4510). The integer array decoder 4302 reads encoded data from the field 3113 by the number of bytes indicated by the value of the field 3112 of the encoded image buffer 4201. The integer array decoder 4302 decodes the read encoded data, and writes it into the temporary integer array buffer 4303 (S4511).

コントローラ4301は、テンポラリー整数配列バッファ4303の内容を、小領域情報バッファ4308の、各小領域の右下Y座標に対応する部分に書込む(S4512)。コントローラ4301は、符号化画像バッファ4201のフィールド3114の内容をビットプレーン数レジスタ4311にコピーする(S4513)。   The controller 4301 writes the contents of the temporary integer array buffer 4303 to the portion corresponding to the lower right Y coordinate of each small area in the small area information buffer 4308 (S4512). The controller 4301 copies the contents of the field 3114 of the encoded image buffer 4201 to the bit plane number register 4311 (S4513).

圧縮画像復号器4304が、符号化画像バッファ4201の画像を復号してビットプレーンバッファ4305に書込む(S4514)。なお、圧縮画像復号器4304が採用す
る復号動作のアルゴリズムは、第2の実施の形態の装置の画像可逆圧縮器3207において用いられた符号化アルゴリズムに対応するものである。したがって符号化アルゴリズムが変わればそれにしたがって圧縮画像復号器4304の採用する復号動作も変わる。
The compressed image decoder 4304 decodes the image in the encoded image buffer 4201 and writes it in the bit plane buffer 4305 (S4514). Note that the algorithm of the decoding operation employed by the compressed image decoder 4304 corresponds to the encoding algorithm used in the image lossless compressor 3207 of the apparatus of the second embodiment. Therefore, if the encoding algorithm changes, the decoding operation employed by the compressed image decoder 4304 also changes accordingly.

ビットプレーン統合器4306は、ビットプレーンバッファ4305の画像を統合して8値画像に変換し、減色画像バッファ3521に格納する(S4515)。   The bit plane integrator 4306 integrates the images of the bit plane buffer 4305, converts them into an 8-level image, and stores them in the reduced color image buffer 3521 (S4515).

表示画像作成器4316は、小領域階調数バッファ617と基準画素値テーブル4317とを参照し、各小領域ごとに異なる階調数を持つ、減色画像バッファ4315の画像を256階調の画像に変換し、出力画像バッファ4203に出力する(S4516)。   The display image creator 4316 refers to the small area gradation number buffer 617 and the reference pixel value table 4317, and converts the image of the subtractive color image buffer 4315 having a different gradation number for each small area into an image of 256 gradations. The image is converted and output to the output image buffer 4203 (S4516).

図53に示すS4514で行なわれる処理についてその詳細を図54を参照して説明する。コントローラ4301は、第1カウンタ4314を0に初期化する(S4601)。以下iは第1カウンタ4314の値を意味するものとする。   Details of the processing performed in S4514 shown in FIG. 53 will be described with reference to FIG. The controller 4301 initializes the first counter 4314 to 0 (S4601). Hereinafter, i means the value of the first counter 4314.

圧縮画像復号器4304は、符号化画像バッファ4201のフィールド3115(または3117、3119、…)が示す長さだけ符号化データを読込んで復号し、ビットプレーンバッファ4305のi番目のプレーンに書込む(S4602)。   The compressed image decoder 4304 reads and decodes the encoded data by the length indicated by the field 3115 (or 3117, 3119,...) Of the encoded image buffer 4201 and writes it into the i-th plane of the bit plane buffer 4305 ( S4602).

コントローラ4301は第1カウンタ4314の値iをインクリメントする(S4603)。続いてコントローラ4301は、第1カウンタ4314の値iとビットプレーン数レジスタ4311とを比較し(S4604)、両者が等しければ処理は終了する。さもなければ制御はS4602に戻る。   The controller 4301 increments the value i of the first counter 4314 (S4603). Subsequently, the controller 4301 compares the value i of the first counter 4314 with the bit plane number register 4311 (S4604), and if both are equal, the process ends. Otherwise, control returns to S4602.

図53のS4515に示されるビットプレーン統合処理の詳細につき図55を参照して説明する。コントローラ4301は第1カウンタ4314の値を0に初期化する(S4605)。以下の説明ではiは第1カウンタ4314の値を意味するものとする。   Details of the bit plane integration processing shown in S4515 of FIG. 53 will be described with reference to FIG. The controller 4301 initializes the value of the first counter 4314 to 0 (S4605). In the following description, i means the value of the first counter 4314.

ビットプレーン統合器4306は、第1カウンタ4314、ビットプレーン統合規則テーブル4307、小領域情報バッファ4308およびALB[i]を参照して、i番目の小領域に対応するビットプレーンバッファ4305の内容を統合し、減色画像バッファ4315上の対応する小領域に格納する(S4606)。この場合のビットプレーン統合規則テーブル4307の内容については後述する。この各ビットプレーンの統合の規則を与えるのがビットプレーン統合規則テーブル4307である。   The bit plane integrator 4306 refers to the first counter 4314, the bit plane integration rule table 4307, the small area information buffer 4308, and ALB [i], and integrates the contents of the bit plane buffer 4305 corresponding to the i th small area. And stored in the corresponding small area on the reduced color image buffer 4315 (S4606). The contents of the bit plane integration rule table 4307 in this case will be described later. The bit plane integration rule table 4307 gives rules for integration of these bit planes.

ビットプレーン統合器4306は、S5102において、ビットプレーンの各画素を、画素値の2進表現と見なして多値画像に変換した後、画素値およびビットプレーン統合規則テーブル3507を参照して出力画素値に変換する。ビットプレーン統合規則テーブル4307の内容については後述する。   In step S5102, the bit plane integrator 4306 converts each pixel of the bit plane into a multi-valued image as a binary representation of the pixel value, and then refers to the pixel value and the bit plane integration rule table 3507 to output pixel values. Convert to The contents of the bit plane integration rule table 4307 will be described later.

コントローラ3501は、第1カウンタ4314の値iをインクリメントする(S4607)。続いてコントローラ3501は、第1カウンタ4314の値iと小領域数レジスタ3510の内容とを比較する(S4608)。両者が等しければ処理は終了し、等しくなければ制御はS4607に戻る。   The controller 3501 increments the value i of the first counter 4314 (S4607). Subsequently, the controller 3501 compares the value i of the first counter 4314 with the contents of the small area number register 3510 (S4608). If they are equal, the process ends. If they are not equal, control returns to S4607.

図52に示すビットプレーン統合規則テーブル4307の内容は以下のとおりである。ビットプレーン統合規則テーブル4307は2次元整数配列となっている。そのインデックスは、小領域階調数0〜8と画素値0〜7とである。ビットプレーン統合規則テーブル4307によって、画素値は、小領域の階調数によって異なった変換を受ける。   The contents of the bit plane integration rule table 4307 shown in FIG. 52 are as follows. The bit plane integration rule table 4307 is a two-dimensional integer array. The indexes are 0 to 8 for small area gradation and 0 to 7 for pixel values. According to the bit plane integration rule table 4307, the pixel value undergoes different conversion depending on the number of gradations of the small area.

ここで用いられるビットプレーン統合規則テーブル4307は、発明の第2の実施の形態で用いられ、図43〜図45で説明したビットプレーン分割規則テーブル3206の態様を逆にしたものである。   The bit plane integration rule table 4307 used here is used in the second embodiment of the invention and is obtained by reversing the aspect of the bit plane division rule table 3206 described with reference to FIGS.

小領域階調数が8、4、2の場合をそれぞれ図56、図57および図58に示す。図56〜図58の1列目〜3列目はそれぞれ、ビットプレーンバッファ4305の値と画素値との対応を説明する目的で示したものであり、ビットプレーン統合規則テーブル4307の一部をなすものではない。また図57および図58で、括弧の中に入れられた変換後画素値は、使われない入力画素値に対応するものであることを示す。   The cases where the number of small area gradations is 8, 4, and 2 are shown in FIGS. 56, 57, and 58, respectively. The first to third columns in FIGS. 56 to 58 are shown for the purpose of explaining the correspondence between the values of the bit plane buffer 4305 and the pixel values, and form part of the bit plane integration rule table 4307. It is not a thing. In FIGS. 57 and 58, the converted pixel value enclosed in parentheses corresponds to an input pixel value that is not used.

以上のように、第3の実施の形態に係る画像復号装置は、小領域の階調数がどれも等しいときには、一部の情報の復号をスキップするように構成した。そのため、従来と比較してさらに符号化効率の高い画像圧縮を行なうことができる。   As described above, the image decoding apparatus according to the third embodiment is configured to skip the decoding of a part of information when the number of gradations of the small areas is the same. Therefore, it is possible to perform image compression with higher encoding efficiency than in the past.

以上説明した実施の形態に開示されている発明の構成を以下に列挙する。
(1) 入力されたデジタル画像データの階調数を減少させて出力する画像減色装置であって、
入力画像を予め定められた手法により小領域に分割するための分割手段と、
各前記小領域ごとに、当該小領域に含まれる画像データに基づいて、当該小領域を適切に減色するための階調数を設定するための適応的減色手段とを含む、画像減色装置。
The configurations of the invention disclosed in the embodiments described above are listed below.
(1) An image color reduction device for reducing the number of gradations of input digital image data and outputting it,
Dividing means for dividing the input image into small regions by a predetermined method;
An image color reduction device including, for each small area, adaptive color reduction means for setting the number of gradations for appropriately reducing the color of the small area based on image data included in the small area.

(2) 前記適応的減色手段は、
前記入力画像中から予め定められた形状を抽出するための抽出手段と、
前記抽出手段による前記予め定められた形状の抽出結果に基づいて、前記入力画像中の前記予め定められた形状が存在する領域の階調数が、前記予め定められた形状の存在しない領域の階調数以上となるように、各前記小領域の階調数を設定するための手段とを含む、(1)に記載の画像減色装置。
(2) The adaptive color reduction means includes:
Extraction means for extracting a predetermined shape from the input image;
Based on the extraction result of the predetermined shape by the extracting means, the number of gradations of the region where the predetermined shape exists in the input image is the floor of the region where the predetermined shape does not exist. And an image color reduction apparatus according to (1), including means for setting the number of gradations of each of the small regions so as to be equal to or greater than the key number.

(3) 前記予め定められた形状は直線である、(2)に記載の画像減色装置。
(4) 前記適応的減色手段は、
異なる減色方法の下での、前記画像の少なくとも一部における背景画素および非背景画素のいずれか一方の分布を表わす指標を算出するための分布算出手段と、
前記分布算出手段により算出された分布の比較結果に基づいて減色方法の適否を決定するための適否決定手段とを含む、(1)に記載の画像減色装置。
(3) The image color reduction device according to (2), wherein the predetermined shape is a straight line.
(4) The adaptive color reduction means includes:
Distribution calculating means for calculating an index representing the distribution of either background pixels or non-background pixels in at least a part of the image under different color reduction methods;
The image color reduction apparatus according to (1), further including suitability determination means for determining suitability of a color reduction method based on a comparison result of distributions calculated by the distribution calculation means.

(5) 前記分布算出手段は、
前記入力画像中から予め定められた形状を抽出するための抽出手段と、
異なる減色方法の下での、前記予め定められた形状の近傍の背景画素および非背景画素のいずれか一方の分布を検出するための画素分布検出手段とを含み、
前記適否決定手段は、
前記前記画素分布検出手段により検出された、第1の減色階調数とそれより少ない第2の減色階調数との下での、背景画素および非背景画素の分布を比較し、その比較結果が予め定める条件を満足しているか否かに基づいて、前記第2の減色階調数の適否を判定するための手段を含む、(4)に記載の画像減色装置。
(5) The distribution calculation means includes:
Extraction means for extracting a predetermined shape from the input image;
Pixel distribution detection means for detecting a distribution of either background pixels or non-background pixels in the vicinity of the predetermined shape under different color reduction methods;
The suitability determining means includes
Comparing the distribution of background pixels and non-background pixels under the first subtractive color gradation number and the second subtractive color gradation number detected by the pixel distribution detecting means, and the comparison result (4) The image color reduction apparatus according to (4), further including means for determining whether the second number of color reduction gradations is appropriate based on whether or not satisfies a predetermined condition.

(6) 前記予め定める条件とは、前記第2の減色階調数の下での背景画素の数と、前記第1の減色階調回数の下での背景画素の数との差が一定以上であることである、(5)に記載の画像減色装置。     (6) The predetermined condition is that a difference between the number of background pixels under the second number of subtractive color gradations and the number of background pixels under the first number of subtractive color gradations is a certain value or more. The image color reduction device according to (5), wherein

(7) 前記予め定める条件とは、前記第1の減色階調数の下での非背景画素の数と
、前記第2の減色階調回数の下での非背景画素の数との差が一定以上であることである、(5)に記載の画像減色装置。
(7) The predetermined condition is a difference between the number of non-background pixels under the first number of subtractive color gradations and the number of non-background pixels under the second number of subtractive color gradations. The image color reduction device according to (5), wherein the image color reduction device is a certain value or more.

(8) 前記適応的減色手段は、
入力画像をラベリングするためのラベリング手段と、
前記ラベリング手段の出力に基づき、共通なラベルを含む小領域に共通のラベルを付与するための小領域ラベリング手段とを含み、
前記小領域ラベリング手段によって共通のラベルが付与された小領域には、共通の階調数を設定する、(1)に記載の画像減色装置。
(8) The adaptive color reduction means includes:
Labeling means for labeling the input image;
A small area labeling means for giving a common label to a small area including a common label based on the output of the labeling means,
The image color reduction device according to (1), wherein a common number of gradations is set in a small region to which a common label is assigned by the small region labeling unit.

(9) 前記適応的減色手段は、
入力画像の小領域の境界をはさんで隣接する二つの画素が共通の画素値を持つ場合に、当該二つの画素が属する二つの小領域に共通のラベルを付与する小領域ラベリング手段とを含み、
前記小領域ラベリング手段により共通のラベルが付与された小領域には、共通の階調数を設定する、(1)に記載の画像減色装置。
(9) The adaptive color reduction means includes:
A small area labeling unit that gives a common label to two small areas to which the two pixels belong when two adjacent pixels across the boundary of the small area of the input image have a common pixel value. ,
The image color reduction device according to (1), wherein a common number of gradations is set in a small region to which a common label is assigned by the small region labeling unit.

(10) 入力されたデジタル画像データの階調数を減少させるための、(1)〜(9)のいずれかに記載の画像減色装置と、
前記画像減色手段により減色された画像のエントロピー符号化を行なうための画像符号化手段とを含む、画像符号化装置。
(10) The image color reduction device according to any one of (1) to (9), for reducing the number of gradations of input digital image data;
And an image encoding means for entropy encoding the image reduced in color by the image reduction means.

(11) 小領域ごとに異なる階調数を持ち得る入力画像をビットプレーンに分割して圧縮する画像符号化装置であって、
上位プレーンにおいてより隣接画素間の連続性が高まるように、符号化対象の小領域の階調数に応じて異なる変換を各画素値に施しビットプレーンに分割するための画像変換手段と、
前記画像変換手段による変換によって得られるビットプレーンごとに所定のエントロピー符号化を行なうための画像符号化手段とを含む、画像符号化装置。
(11) An image encoding device that divides an input image that can have different gradation numbers for each small area into bit planes and compresses the input image.
Image conversion means for performing a different conversion on each pixel value according to the number of gradations of the small area to be encoded and dividing it into bit planes so that continuity between adjacent pixels is increased in the upper plane;
An image encoding device comprising: image encoding means for performing predetermined entropy encoding for each bit plane obtained by conversion by the image conversion means.

(12) 小領域ごとに異なる階調数を持ち得る入力画像をビットプレーンに分割して圧縮する画像符号化装置であって、
すべての小領域の階調数が等しいか否かを判定するための判定手段と、
前記判定手段によりすべての小領域の階調数が等しいと判定されたことに応答して、前記入力画像の全体を一つの小領域とみなし、小領域の数を1として画像を符号化するための第1の画像符号化手段と、
前記判定手段によりすべての小領域の階調数が等しいわけではないと判定されたことに応答して、前記入力画像の各小領域ごとに符号化するための第2の画像符号化手段とを含む、画像符号化装置。
(12) An image encoding device that divides an input image that may have different gradation numbers for each small area into bit planes and compresses the input image,
A determination means for determining whether or not the numbers of gradations of all the small areas are equal;
In response to determining that the number of gradations of all the small regions is equal by the determination means, the entire input image is regarded as one small region, and the image is encoded with the number of small regions being 1. First image encoding means;
A second image encoding means for encoding each small area of the input image in response to determining that the gradation numbers of all the small areas are not equal by the determining means; An image encoding device.

(13) (10)に記載の画像符号化装置によって符号化された画像データを入力するための入力手段と、
前記入力手段により入力された画像データに対して、前記(10)に記載のエントロピー符号化に対応した復号を行なう復号手段とを含む、画像復号装置。
(13) Input means for inputting image data encoded by the image encoding device according to (10);
An image decoding apparatus comprising: decoding means for performing decoding corresponding to the entropy encoding described in (10) above with respect to the image data input by the input means.

(14) (11)に記載の画像符号化装置によって符号化された画像データを入力するための入力手段と、
前記入力手段により入力された画像データに対して、前記(11)に記載のエントロピー符号化に対応した復号を行なう復号手段と、
前記復号手段により復号された画像データに対して、(11)に記載の画像変換手段に
対応した逆変換を行なうための画像逆変換手段とを含む、画像復号装置。
(14) Input means for inputting image data encoded by the image encoding device according to (11);
Decoding means for performing decoding corresponding to the entropy coding described in (11) for the image data input by the input means;
An image decoding apparatus comprising: an image reverse conversion unit configured to perform reverse conversion corresponding to the image conversion unit according to (11) with respect to the image data decoded by the decoding unit.

(15) (12)に記載の画像符号化装置によって符号化された画像データを復号するための画像復号装置であって、
前記画像符号化手段によって符号化された画像データに含まれる小領域の数がいくつかを判定するための判定手段と、
前記判定手段により判定された数の小領域に前記画像データを分割して復号するための復号手段とを含む、画像復号装置。
(15) An image decoding device for decoding image data encoded by the image encoding device according to (12),
Determination means for determining the number of small regions included in the image data encoded by the image encoding means;
An image decoding apparatus comprising: decoding means for dividing and decoding the image data into the number of small regions determined by the determination means.

今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は上記した実施の形態の説明ではなくて特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。   The embodiment disclosed this time should be considered as illustrative in all points and not restrictive. The scope of the present invention is shown not by the above description of the embodiment but by the scope of the claims, and is intended to include all modifications within the meaning and scope equivalent to the scope of the claims.

実施の形態1にかかる画像減色装置の概略構成を示す図である。1 is a diagram illustrating a schematic configuration of an image color reduction device according to a first embodiment. 実施の形態1にかかる画像減色装置の入力画像バッファ302に格納される画像データのデータ構造を示す図である。FIG. 3 is a diagram illustrating a data structure of image data stored in an input image buffer 302 of the image color reduction device according to the first embodiment. 実施の形態1にかかる画像減色装置の適応的減色器の構成を示す図である。FIG. 3 is a diagram illustrating a configuration of an adaptive color reducer of the image color reduction device according to the first embodiment. 画像減色装置で行なわれる処理の制御構造を示すフローチャートである。It is a flowchart which shows the control structure of the process performed with an image color reduction apparatus. 実施の形態1にかかる画像減色装置の小領域情報バッファ604の構成例を示す図である。FIG. 6 is a diagram illustrating a configuration example of a small area information buffer 604 of the image color reduction device according to the first embodiment. 実施の形態1にかかる画像減色装置の文字矩形情報バッファ612のデータ構造を示す図である。6 is a diagram illustrating a data structure of a character rectangle information buffer 612 of the image color reduction device according to the first embodiment. FIG. 図4に示すS705において行なわれる処理の制御構造を示す図である。FIG. 5 is a diagram showing a control structure of processing performed in S705 shown in FIG. 4. 図4に示されるS705Aにおいて行なわれる処理の制御構造を示す図である。FIG. 5 is a diagram showing a control structure of processing performed in S705A shown in FIG. 図4に示すS706において行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed in S706 shown in FIG. 図4のS707において行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed in S707 of FIG. 図4に示すS709において行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed in S709 shown in FIG. 実施の形態1にかかる画像減色装置の適応的減色器の文字矩形減色器614の構成を示す図である。FIG. 3 is a diagram illustrating a configuration of a character rectangular color reducer 614 of the adaptive color reducer of the image color reducing apparatus according to the first embodiment. 階調数が2値に対応する基準画素値の分布を示す図である。It is a figure which shows distribution of the reference pixel value in which the number of gradations corresponds to 2 values. 階調数が4値に対応する基準画素値の分布を示す図である。It is a figure which shows distribution of the reference pixel value corresponding to the number of gradations with 4 values. 階調数が8値に対応する基準画素値の分布を示す図である。It is a figure which shows distribution of the reference | standard pixel value corresponding to the number of gradations to 8 values. 文字矩形減色器614のコントローラ1101が各構成要素を制御する処理の制御構造を示す図である。It is a figure which shows the control structure of the process which the controller 1101 of the character rectangle color reducer 614 controls each component. 線抽出器1105で取出すことが意図されている文字の縦線を示す図である。It is a figure which shows the vertical line of the character with which the line extractor 1105 intends to take out. 線抽出器1105で取出すことが意図されている文字の横線を示す図である。It is a figure which shows the horizontal line of the character with which the line extractor 1105 intends to take out. 累積ヒストグラムを求める処理を説明するための、横線とその上下の帯状領域とを示す図である。It is a figure which shows a horizontal line and the strip | belt-shaped area | region of the upper and lower sides for demonstrating the process which calculates | requires a cumulative histogram. 図19に示す入力画像を8値化した後の例を示す図である。FIG. 20 is a diagram showing an example after the input image shown in FIG. 19 is converted into eight values. 図19に示す入力画像を4値化した後の例を示す図である。FIG. 20 is a diagram illustrating an example after the input image illustrated in FIG. 19 is binarized. 図8に示したS5202で行なわれる小領域iの階調数決定処理を行なう小領域減色器616の構成を示す図である。It is a figure which shows the structure of the small area color reducer 616 which performs the gradation number determination process of the small area i performed by S5202 shown in FIG. コントローラ1701によって行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed by the controller. 図3に示した小領域階調数検証器619の構成を示す図である。FIG. 4 is a diagram showing a configuration of a small area gradation number verifier 619 shown in FIG. 3. コントローラ2001が行なう処理の制御構造を示す図である。It is a figure which shows the control structure of the process which the controller 2001 performs. 図25に示すS2102で行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed by S2102 shown in FIG. 図25のS2103において行なわれるラベルバッファの値を生成する処理の制御構造を示す図である。It is a figure which shows the control structure of the process which produces | generates the value of the label buffer performed in S2103 of FIG. 図25のS2104に示される小領域ラベルバッファを初期化する処理の制御構造を示す図である。It is a figure which shows the control structure of the process which initializes the small area | region label buffer shown by S2104 of FIG. 図25のS2105において行なわれる小領域ラベルバッファの値を生成する処理の制御構造を示す図である。It is a figure which shows the control structure of the process which produces | generates the value of the small area | region label buffer performed in S2105 of FIG. 図29のS2504において行なわれる判定処理の制御構造を示す図である。It is a figure which shows the control structure of the determination process performed in S2504 of FIG. 図29のS2507において行なわれる判定処理の制御構造を示す図である。It is a figure which shows the control structure of the determination process performed in S2507 of FIG. 着目画素と隣接画素との間の関係を示す図である。It is a figure which shows the relationship between an attention pixel and an adjacent pixel. 図29のS2510において行なわれる小領域ラベルの書換処理の制御構造を示す図である。FIG. 30 is a diagram showing a control structure of a small region label rewriting process performed in S2510 of FIG. 29. 線情報バッファ609のデータ構造の他の一例を示す図である。It is a figure which shows another example of the data structure of the line information buffer 609. 線情報バッファ609が画像データを格納するためのバッファとなっている場合にコントローラ601が行なう処理の制御構造を示す図である。It is a figure which shows the control structure of the process which the controller 601 performs when the line information buffer 609 is a buffer for storing image data. 第2の実施の形態に係る画像符号化装置の概略構造を示す図である。It is a figure which shows schematic structure of the image coding apparatus which concerns on 2nd Embodiment. 第2の実施の形態において符号化画像バッファ3006に格納された符号化画像のフォーマットを示す図である。It is a figure which shows the format of the encoding image stored in the encoding image buffer 3006 in 2nd Embodiment. 第2の実施の形態に係る画像符号化器3005の概略構造を示す図である。It is a figure which shows schematic structure of the image encoder 3005 which concerns on 2nd Embodiment. 画像符号化器3005のコントローラ3201が行なう処理の制御構造を示す図である。It is a figure which shows the control structure of the process which the controller 3201 of the image encoder 3005 performs. 図39のS3304で行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed by S3304 of FIG. 図39に示したS3316で行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed by S3316 shown in FIG. 図39のS3318で行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed by S3318 of FIG. ビットプレーン分割規則テーブル3206の各要素の値の定め方の一例を示す図である。FIG. 10 is a diagram illustrating an example of how to determine the value of each element of a bit plane division rule table 3206. ビットプレーン分割規則テーブル3206の各要素の値の定め方の他の一例を示す図である。It is a figure which shows another example of the method of determining the value of each element of the bit plane division rule table. ビットプレーン分割規則テーブル3206の各要素の値の定め方のさらに他の一例を示す図である。It is a figure which shows another example of how to define the value of each element of the bit plane division rule table. 減色前の入力画像を示す図である。It is a figure which shows the input image before a color reduction. 図46に示された画像を、図43に示した分割方法でビットプレーンに展開したときの減色画像を示す図である。FIG. 47 is a diagram showing a reduced color image when the image shown in FIG. 46 is developed on a bit plane by the division method shown in FIG. 図46に示された画像を、図48に示した分割方法でビットプレーンに展開したときの減色画像を示す図である。FIG. 49 is a diagram showing a reduced color image when the image shown in FIG. 46 is developed on a bit plane by the division method shown in FIG. 48. 小領域階調数が4である小領域に対して適用されるビットプレーン分割規則テーブルの例を示す図である。It is a figure which shows the example of the bit plane division | segmentation rule table applied with respect to the small area | region whose number of small area gradations is 4. FIG. 小領域階調数が2である小領域に対して適用されるビットプレーン分割規則テーブルの例を示す図である。It is a figure which shows the example of the bit plane division | segmentation rule table applied with respect to the small area | region whose small area gradation number is 2. FIG. 第3の実施の形態にかかる画像復号装置の概略構造を示す図である。It is a figure which shows schematic structure of the image decoding apparatus concerning 3rd Embodiment. 図51に示す画像復号器の概略構造を示す図である。FIG. 52 is a diagram showing a schematic structure of the image decoder shown in FIG. 51. 第3の実施の形態にかかる装置のコントローラ4301が行なう処理の制御構造を示す図である。It is a figure which shows the control structure of the process which the controller 4301 of the apparatus concerning 3rd Embodiment performs. 図53に示すS4514で行なわれる処理の制御構造を示す図である。It is a figure which shows the control structure of the process performed by S4514 shown in FIG. 図53のS4515に示されるビットプレーン統合処理の制御構造を示す図である。It is a figure which shows the control structure of the bit plane integration process shown by S4515 of FIG. 小領域階調数が8の場合のビットプレーン統合規則テーブル4307の構成を示す図である。It is a figure which shows the structure of the bit plane integration rule table 4307 in case a small area | region gradation number is 8. FIG. 小領域階調数が4の場合のビットプレーン統合規則テーブル4307の構成を示す図である。It is a figure which shows the structure of the bit plane integration rule table 4307 in case the number of small area gradations is 4. FIG. 小領域階調数が2の場合のビットプレーン統合規則テーブル4307の構成を示す図である。It is a figure which shows the structure of the bit plane integration rule table 4307 in case the small area gradation number is two. 従来技術の問題点を説明するための、入力画像を示す図である。It is a figure which shows the input image for demonstrating the problem of a prior art. 従来技術による処理結果の一例を示す図である。It is a figure which shows an example of the processing result by a prior art.

符号の説明Explanation of symbols

301 画像入力装置、303 適応的減色器、304 減色画像バッファ、305 出力画像作成器、601 コントローラ、602 小領域情報生成器、605 画像2値化器、607 線抽出器、610 文字矩形情報抽出器、614 文字矩形減色器、616 小領域減色器、619 小領域階調数検証器、620 小領域減色器、621 画素器変換器。   301 image input device, 303 adaptive color reducer, 304 color-reduced image buffer, 305 output image creator, 601 controller, 602 small area information generator, 605 image binarizer, 607 line extractor, 610 character rectangle information extractor 614 character rectangle color reducer, 616 small area color reducer, 619 small area gradation number verifier, 620 small area color reducer, 621 pixel converter converter.

Claims (11)

入力されたデジタル画像データの階調数を減少させて出力する画像減色装置であって、
入力画像を予め定められた手法により小領域に分割するための分割手段と、
各前記小領域ごとに、当該小領域に含まれる画像データに基づいて、当該小領域の減色後の階調数を設定するための減色後階調数設定手段とを含み、
前記減色後階調数設定手段は、
前記入力画像中から予め定められた形状をベクトルデータとして抽出するための抽出手段と、
該抽出手段により抽出された形状が存在する小領域の減色後の階調数が、非背景画素領域であって前記予め定められた形状の存在しない小領域の減色後の階調数以上となるように、各前記小領域の減色後の階調数を設定するための階調数設定手段とを含む、画像減色装置。
An image color reduction device that outputs by reducing the number of gradations of input digital image data,
Dividing means for dividing the input image into small regions by a predetermined method;
For each small area, including after-color-reduction gradation number setting means for setting the number of gradations after color reduction of the small area based on the image data included in the small area,
The after-color-reduction gradation number setting means includes
Extraction means for extracting a predetermined shape as vector data from the input image;
The number of gradations after color reduction of the small area where the shape extracted by the extracting means exists is equal to or greater than the number of gradations after color reduction of the small area which is a non-background pixel area and does not have the predetermined shape. As described above, an image color reduction apparatus including gradation number setting means for setting the number of gradations after color reduction in each of the small areas.
前記予め定められた形状は直線である、請求項1に記載の画像減色装置。   The image color reduction device according to claim 1, wherein the predetermined shape is a straight line. 入力されたデジタル画像データの階調数を減少させて出力する画像減色装置であって、
入力画像を予め定められた手法により小領域に分割するための分割手段と、
各前記小領域ごとに、当該小領域に含まれる画像データに基づいて、当該小領域の減色後の階調数を設定するための減色後階調数設定手段とを含み、
前記減色後階調数設定手段は、
前記入力画像を減色した減色画像を生成するための減色画像生成手段と、
前記減色画像生成手段が同じ階調数で減色した場合の減色画像における隣接した画素のうち、同じ画素値を持った画素については共通の値を持たせ、該共通の値を持つ画素からなる減色連結領域を含んだ減色連結領域画像を生成するためのラベリング手段と、
前記ラベリング手段の出力に基づき、同じ前記減色連結領域を含む小領域に共通のラベルを付与するための小領域共通ラベリング手段とを含み、
前記小領域共通ラベリング手段によって共通のラベルが付与された小領域には、共通の階調数を設定する、画像減色装置。
An image color reduction device that outputs by reducing the number of gradations of input digital image data,
Dividing means for dividing the input image into small regions by a predetermined method;
For each small area, including after-color-reduction gradation number setting means for setting the number of gradations after color reduction of the small area based on the image data included in the small area,
The after-color-reduction gradation number setting means includes
A reduced color image generating means for generating a reduced color image obtained by reducing the color of the input image;
Of the adjacent pixels in the color-reduced image when the color-reduced image generation means performs color reduction with the same number of gradations, pixels having the same pixel value have a common value, and color reduction is made up of pixels having the common value. Labeling means for generating a reduced color connected area image including the connected area;
A small area common labeling means for applying a common label to the small areas including the same subtractive color connection area based on the output of the labeling means;
An image color reduction device that sets a common number of gradations in a small area to which a common label is assigned by the small area common labeling means.
入力されたデジタル画像データの階調数を減少させて出力する画像減色装置であって、
入力画像を予め定められた手法により小領域に分割するための分割手段と、
各前記小領域ごとに、当該小領域に含まれる画像データに基づいて、当該小領域の減色後の階調数を設定するための減色後階調数設定手段とを含み、
前記減色後階調数設定手段は、
前記入力画像を減色した減色画像を生成するための減色画像生成手段と、
前記減色画像生成手段が同じ階調数で減色した場合の減色画像において、隣接する小領域の境界をはさんで隣接する二つの画素が共通の画素値を持つか否かを判定する境界隣接画素値判定手段と、
前記境界隣接画素値判定手段が共通の画素値を持つと判定した場合に、該隣接する小領域に共通のラベルを付与する隣接小領域共通ラベリング手段を含み、
前記隣接小領域共通ラベリング手段によって共通のラベルが付与された小領域には、共通の階調数を設定する、画像減色装置。
An image color reduction device that outputs by reducing the number of gradations of input digital image data,
Dividing means for dividing the input image into small regions by a predetermined method;
For each small area, including after-color-reduction gradation number setting means for setting the number of gradations after color reduction of the small area based on the image data included in the small area,
The after-color-reduction gradation number setting means includes
A reduced color image generating means for generating a reduced color image obtained by reducing the color of the input image;
In the color-reduced image when the color-reduced image generation unit performs color reduction with the same number of gradations, a boundary adjacent pixel that determines whether two adjacent pixels across a boundary between adjacent small regions have a common pixel value Value judging means;
If the boundary neighboring pixel value determining means determines that have a common pixel value, and a neighbor subregion common labeling means for applying a common label to a small region in contact該隣,
An image color reduction device that sets a common number of gradations in a small area to which a common label is assigned by the adjacent small area common labeling means.
入力されたデジタル画像データの階調数を減少させるための、請求項1〜4のいずれかに記載の画像減色装置と、
該画像減色装置により減色された画像のエントロピー符号化を行なうための画像符号化手段とを含む、画像符号化装置。
An image color reduction device according to any one of claims 1 to 4, for reducing the number of gradations of input digital image data;
An image encoding device comprising: an image encoding means for performing entropy encoding of an image reduced by the image color reduction device.
請求項5に記載の画像符号化装置によって符号化された画像データを入力するための入力手段と、
前記入力手段により入力された画像データに対して、請求項9に記載のエントロピー符号化に対応した復号を行なう復号手段とを含む、画像復号装置。
Input means for inputting image data encoded by the image encoding device according to claim 5;
An image decoding apparatus comprising: decoding means for performing decoding corresponding to the entropy encoding according to claim 9 for the image data input by the input means.
入力されたデジタル画像データの階調数を減少させて出力する画像減色方法であって、
入力画像を予め定められた手法により小領域に分割するステップと、
各前記小領域ごとに、当該小領域に含まれる画像データに基づいて、当該小領域の減色後の階調数を設定するステップとを含み、
前記減色後の階調数を設定するステップは、
前記入力画像中から予め定められた形状をベクトルデータとして抽出するステップと、
該抽出するステップにより抽出された形状が存在する小領域の減色後の階調数が、非背景画素領域であって前記予め定められた形状の存在しない小領域の減色後の階調数以上となるように、各前記小領域の減色後の階調数を設定する階調数調節ステップとを含む、画像減色方法。
An image color reduction method for reducing the number of gradations of input digital image data and outputting the image,
Dividing the input image into small regions by a predetermined method;
For each of the small areas, setting the number of gradations after color reduction of the small area based on the image data included in the small area,
The step of setting the number of gradations after the color reduction is as follows:
Extracting a predetermined shape as vector data from the input image;
The number of gradations after color reduction of the small area where the shape extracted by the extracting step is not less than the number of gradations after color reduction of the small area which is a non-background pixel area and does not have the predetermined shape. An image color reduction method including a gradation number adjustment step for setting the number of gradations after color reduction in each of the small regions.
入力されたデジタル画像データの階調数を減少させて出力する画像減色方法であって、
入力画像を予め定められた手法により小領域に分割するステップと、
各前記小領域ごとに、当該小領域に含まれる画像データに基づいて、当該小領域の減色後の階調数を設定するステップとを含み、
前記減色後の階調数を設定するステップは、
前記入力画像を減色した減色画像を生成するステップと、
前記減色画像を生成するステップが同じ階調数で減色した場合の減色画像における隣接した画素のうち、同じ画素値を持った画素については共通の値を持たせ、該共通の値を持つ画素からなる減色連結領域を含んだ減色連結領域画像を生成するためのラベリングステップと、
前記ラベリングステップの出力に基づき、同じ前記減色連結領域を含む小領域に共通のラベルを付与するステップとを含み、
前記小領域に共通のラベルを付与するステップによって共通のラベルが付与された小領域には、共通の階調数を設定する、画像減色方法。
An image color reduction method for reducing the number of gradations of input digital image data and outputting the image,
Dividing the input image into small regions by a predetermined method;
For each of the small areas, setting the number of gradations after color reduction of the small area based on the image data included in the small area,
The step of setting the number of gradations after the color reduction is as follows:
Generating a reduced color image obtained by reducing the color of the input image;
Among the adjacent pixels in the color-reduced image when the step of generating the color-reduced image is reduced by the same number of gradations, pixels having the same pixel value have a common value, and the pixels having the common value are used. A labeling step for generating a reduced color connected area image including the reduced color connected area,
Applying a common label to the small areas including the same subtractive color connection area based on the output of the labeling step,
An image color reduction method in which a common number of gradations is set in a small area to which a common label is assigned in the step of assigning a common label to the small area.
入力されたデジタル画像データの階調数を減少させて出力する画像減色方法であって、
入力画像を予め定められた手法により小領域に分割するステップと、
各前記小領域ごとに、当該小領域に含まれる画像データに基づいて、当該小領域の減色後の階調数を設定するステップとを含み、
前記減色後の階調数を設定するステップは、
前記入力画像を減色した減色画像を生成するステップと、
前記減色画像を生成するステップが同じ階調数で減色した場合の減色画像において、隣接する小領域の境界をはさんで隣接する二つの画素が共通の画素値を持つか否かを判定する境界隣接画素値判定ステップと、
前記境界隣接画素値判定ステップが共通の画素値を持つと判定した場合に、該隣接する小領域に共通のラベルを付与するステップとを含み、
前記小領域に共通のラベルを付与するステップによって共通のラベルが付与された小領域には、共通の階調数を設定する、画像減色方法。
An image color reduction method for reducing the number of gradations of input digital image data and outputting the image,
Dividing the input image into small regions by a predetermined method;
For each of the small areas, setting the number of gradations after color reduction of the small area based on the image data included in the small area,
The step of setting the number of gradations after the color reduction is as follows:
Generating a reduced color image obtained by reducing the color of the input image;
In the color-reduced image when the step of generating the color-reduced image is reduced by the same number of gradations, a boundary for determining whether or not two adjacent pixels across a boundary of adjacent small regions have a common pixel value An adjacent pixel value determination step;
When it is determined that the boundary adjacent pixel value determination step has a common pixel value, a step of assigning a common label to the adjacent small regions,
An image color reduction method in which a common number of gradations is set in a small area to which a common label is assigned in the step of assigning a common label to the small area.
入力されたデジタル画像データの階調数を減少させるための、請求項7〜9のいずれかに記載の画像減色方法と、
該画像減色方法により減色された画像のエントロピー符号化を行なうステップとを含む、画像符号化方法。
An image color reduction method according to any one of claims 7 to 9, for reducing the number of gradations of input digital image data;
And entropy coding of the image reduced in color by the image color reduction method.
請求項10に記載の画像符号化方法によって符号化された画像データを入力するステップと、
前記入力するステップにより入力された画像データに対して、請求項10に記載のエントロピー符号化を行なうステップに対応した復号を行なうステップとを含む、画像復号方法。
Inputting image data encoded by the image encoding method according to claim 10;
An image decoding method comprising: decoding the image data input in the input step corresponding to the step of performing entropy encoding according to claim 10.
JP2006203339A 2006-07-26 2006-07-26 Image subtractive color processing device, image encoding device, image decoding device, image subtractive color processing method, image encoding method and image decoding method Pending JP2006323870A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006203339A JP2006323870A (en) 2006-07-26 2006-07-26 Image subtractive color processing device, image encoding device, image decoding device, image subtractive color processing method, image encoding method and image decoding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006203339A JP2006323870A (en) 2006-07-26 2006-07-26 Image subtractive color processing device, image encoding device, image decoding device, image subtractive color processing method, image encoding method and image decoding method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2001095351A Division JP3862511B2 (en) 2001-03-29 2001-03-29 Image color reduction device and image color reduction method

Publications (1)

Publication Number Publication Date
JP2006323870A true JP2006323870A (en) 2006-11-30

Family

ID=37543443

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006203339A Pending JP2006323870A (en) 2006-07-26 2006-07-26 Image subtractive color processing device, image encoding device, image decoding device, image subtractive color processing method, image encoding method and image decoding method

Country Status (1)

Country Link
JP (1) JP2006323870A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009027663A (en) * 2007-07-24 2009-02-05 Fuji Xerox Co Ltd Image processing unit and program
JP2009271679A (en) * 2008-05-02 2009-11-19 Canon Inc Image processor, image processing method, and image processing program
US8284451B2 (en) 2008-05-07 2012-10-09 Canon Kabushiki Kaisha Generating print data based on attributes of segmented regions of an input image

Citations (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6337776A (en) * 1986-07-31 1988-02-18 Fujitsu Ltd Compression system for image data
JPH04139960A (en) * 1990-09-30 1992-05-13 Canon Inc Picture coder
JPH04236574A (en) * 1991-01-18 1992-08-25 Ricoh Co Ltd Picture coding system
JPH05145768A (en) * 1991-11-15 1993-06-11 Ricoh Co Ltd Adaptive encoding system and decoding system for color document image
JPH06103371A (en) * 1992-09-18 1994-04-15 Daikin Ind Ltd Color image processing method/device
JPH06243244A (en) * 1993-02-15 1994-09-02 Oki Electric Ind Co Ltd Color image display method
JPH06301773A (en) * 1993-04-16 1994-10-28 C S K Sogo Kenkyusho:Kk Method and device for color reduction picture processing
JPH07334648A (en) * 1994-06-10 1995-12-22 Canon Inc Method and device for processing image
JPH096946A (en) * 1995-06-22 1997-01-10 Toshiba Corp Image processing method and image processor
JPH09130612A (en) * 1995-11-02 1997-05-16 Minolta Co Ltd Image processing unit
JPH09163154A (en) * 1995-12-11 1997-06-20 Fuji Xerox Co Ltd Picture processor
WO1997044956A1 (en) * 1996-05-17 1997-11-27 Matsushita Electric Industrial Co., Ltd. Picture encoder, picture decoder, picture encoding method, picture decoding method, picture encoding program recording medium, and picture decoding program recording medium
JPH1051642A (en) * 1996-07-31 1998-02-20 Fuji Xerox Co Ltd Image processor
JPH1169167A (en) * 1997-08-14 1999-03-09 Minolta Co Ltd Image processing unit
JPH1188700A (en) * 1997-09-04 1999-03-30 Hitachi Ltd Coding method of color image signal, and decoding method and color image processor thereof
JPH11134488A (en) * 1997-08-20 1999-05-21 Matsushita Electric Ind Co Ltd Gradation shared data generator and gradation shared data restoration device
JPH11259636A (en) * 1998-03-13 1999-09-24 Ricoh Co Ltd Image converting method
JP2000013611A (en) * 1998-06-18 2000-01-14 Minolta Co Ltd Device and method for image processing and recording medium recorded with image processing program
JP2001157207A (en) * 1999-11-29 2001-06-08 Mitsubishi Electric Corp Image encoder

Patent Citations (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6337776A (en) * 1986-07-31 1988-02-18 Fujitsu Ltd Compression system for image data
JPH04139960A (en) * 1990-09-30 1992-05-13 Canon Inc Picture coder
JPH04236574A (en) * 1991-01-18 1992-08-25 Ricoh Co Ltd Picture coding system
JPH05145768A (en) * 1991-11-15 1993-06-11 Ricoh Co Ltd Adaptive encoding system and decoding system for color document image
JPH06103371A (en) * 1992-09-18 1994-04-15 Daikin Ind Ltd Color image processing method/device
JPH06243244A (en) * 1993-02-15 1994-09-02 Oki Electric Ind Co Ltd Color image display method
JPH06301773A (en) * 1993-04-16 1994-10-28 C S K Sogo Kenkyusho:Kk Method and device for color reduction picture processing
JPH07334648A (en) * 1994-06-10 1995-12-22 Canon Inc Method and device for processing image
JPH096946A (en) * 1995-06-22 1997-01-10 Toshiba Corp Image processing method and image processor
JPH09130612A (en) * 1995-11-02 1997-05-16 Minolta Co Ltd Image processing unit
JPH09163154A (en) * 1995-12-11 1997-06-20 Fuji Xerox Co Ltd Picture processor
WO1997044956A1 (en) * 1996-05-17 1997-11-27 Matsushita Electric Industrial Co., Ltd. Picture encoder, picture decoder, picture encoding method, picture decoding method, picture encoding program recording medium, and picture decoding program recording medium
JPH1051642A (en) * 1996-07-31 1998-02-20 Fuji Xerox Co Ltd Image processor
JPH1169167A (en) * 1997-08-14 1999-03-09 Minolta Co Ltd Image processing unit
JPH11134488A (en) * 1997-08-20 1999-05-21 Matsushita Electric Ind Co Ltd Gradation shared data generator and gradation shared data restoration device
JPH1188700A (en) * 1997-09-04 1999-03-30 Hitachi Ltd Coding method of color image signal, and decoding method and color image processor thereof
JPH11259636A (en) * 1998-03-13 1999-09-24 Ricoh Co Ltd Image converting method
JP2000013611A (en) * 1998-06-18 2000-01-14 Minolta Co Ltd Device and method for image processing and recording medium recorded with image processing program
JP2001157207A (en) * 1999-11-29 2001-06-08 Mitsubishi Electric Corp Image encoder

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009027663A (en) * 2007-07-24 2009-02-05 Fuji Xerox Co Ltd Image processing unit and program
JP4687918B2 (en) * 2007-07-24 2011-05-25 富士ゼロックス株式会社 Image processing apparatus and program
US8369639B2 (en) 2007-07-24 2013-02-05 Fuji Xerox Co., Ltd. Image processing apparatus, computer readable medium storing program, method and computer data signal for partitioning and converting an image
JP2009271679A (en) * 2008-05-02 2009-11-19 Canon Inc Image processor, image processing method, and image processing program
US8620068B2 (en) 2008-05-02 2013-12-31 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and medium storing program thereof
US8284451B2 (en) 2008-05-07 2012-10-09 Canon Kabushiki Kaisha Generating print data based on attributes of segmented regions of an input image

Similar Documents

Publication Publication Date Title
US7489830B2 (en) Methods for generating anti-aliased text and line graphics in compressed document images
US6751356B2 (en) Image processing apparatus and method
US7706618B2 (en) Image coding apparatus, image coding method, and recording medium, capable of creating highly versatile data
US6731800B1 (en) Method for compressing scanned, colored and gray-scaled documents
JPH06223172A (en) Method and processor for image processing
CA2013232C (en) Image reduction system
JP3862511B2 (en) Image color reduction device and image color reduction method
US5461682A (en) Image filing apparatus providing image data suitable for several input/output devices
US8774511B2 (en) Image processing apparatus and image processing method
US5442459A (en) Process for encoding a half tone image considering similarity between blocks
US5271072A (en) Image reduction of binary images using filtering processing
US5583953A (en) Intelligent doubling for low-cost image buffers
JP3715905B2 (en) Image processing apparatus, image processing method, program, and storage medium
EP0388282A1 (en) Method and device for the acquisition and digital storage of coloured geographical maps and display of the maps
JP2006323870A (en) Image subtractive color processing device, image encoding device, image decoding device, image subtractive color processing method, image encoding method and image decoding method
JP4089905B2 (en) Image processing apparatus, image processing method, program, and information recording medium
JP2006287944A (en) Image encoding apparatus and image decoding apparatus
US6826309B2 (en) Prefiltering for segmented image compression
JPH04356873A (en) Adaptive encoding system for color document image
JPH09186858A (en) Method and device for image processing and computer controller
JP3062224B2 (en) Image coding method
JPH1098620A (en) Picture processor
JP2941288B2 (en) Image processing system
JPH08305835A (en) Equipment and method for image processing
JP7185451B2 (en) Image processing device, image processing method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20071026

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100603

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100608

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100806

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100914

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101102

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20101221

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110217

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20110426