JP4743884B2 - Image coding apparatus and control method thereof - Google Patents

Image coding apparatus and control method thereof Download PDF

Info

Publication number
JP4743884B2
JP4743884B2 JP2006286885A JP2006286885A JP4743884B2 JP 4743884 B2 JP4743884 B2 JP 4743884B2 JP 2006286885 A JP2006286885 A JP 2006286885A JP 2006286885 A JP2006286885 A JP 2006286885A JP 4743884 B2 JP4743884 B2 JP 4743884B2
Authority
JP
Japan
Prior art keywords
block
value
encoding
sub
replacement
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2006286885A
Other languages
Japanese (ja)
Other versions
JP2008104121A5 (en
JP2008104121A (en
Inventor
健太 寳▲崎▼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2006286885A priority Critical patent/JP4743884B2/en
Priority to US11/862,804 priority patent/US8041135B2/en
Publication of JP2008104121A publication Critical patent/JP2008104121A/en
Publication of JP2008104121A5 publication Critical patent/JP2008104121A5/ja
Application granted granted Critical
Publication of JP4743884B2 publication Critical patent/JP4743884B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、画像データを圧縮符号化する技術に関するものである。   The present invention relates to a technique for compressing and encoding image data.

従来、画像を符号化する方法として知られているものとしてJPEGが挙げられる。このJPEG符号化は、画像データ中の8×8画素のブロックを単位に符号化するものである。以下に説明する処理は全てこのブロックを単位として実行するものである。   Conventionally, JPEG is known as a method for encoding an image. This JPEG encoding is performed in units of 8 × 8 pixel blocks in image data. All processes described below are executed in units of this block.

先ず、入力したブロックに対し、直交変換(DCT;Discrete Cosine Transform)を行い、8×8個の直交変換係数を得る。次に、この直交変換係数に対して、量子化テーブルを用いて量子化を行う。ここで、量子化テーブルの要素の値を量子化ステップ幅と呼ぶ。量子化ステップ幅は、高周波成分の直交変換係数ほど大きい。量子化は、各直交変換係数をそれぞれに対応する量子化ステップ幅で除算し、小数点以下を四捨五入して丸めを行うものである。それ故、量子化後の値は高周波成分ほど小さな値になり、0の発生頻度が高くなる。次に、量子化後の値に対してDC成分(1つ)とAC成分(63個)で別々の符号化を行う。   First, orthogonal transform (DCT) is performed on the input block to obtain 8 × 8 orthogonal transform coefficients. Next, the orthogonal transform coefficient is quantized using a quantization table. Here, the value of the element of the quantization table is called a quantization step width. The quantization step width is larger as the orthogonal transform coefficient of the high frequency component. In the quantization, each orthogonal transform coefficient is divided by the corresponding quantization step width, and rounded off by rounding off after the decimal point. Therefore, the value after quantization becomes smaller as the high-frequency component, and the occurrence frequency of 0 becomes higher. Next, separate encoding is performed on the quantized values using one DC component (one) and one AC component (63).

DC成分に関しては、ブロック間の相関が強いため差分予測符号化を行った後、ハフマン符号化される。差分予測符号化は直前の値との差を符号化する方式である。ハフマン符号化は、発生頻度の高い値には短い符号を、発生頻度の低い値には長い符号を与えることで結果的に全体の符号長を短くする符号化方法である。   As for the DC component, since the correlation between the blocks is strong, the differential prediction coding is performed, and then the Huffman coding is performed. Differential prediction encoding is a method for encoding a difference from the immediately preceding value. Huffman coding is a coding method that shortens the overall code length by giving short codes to values with high occurrence frequency and long codes to values with low occurrence frequency.

AC成分に対しては、ランレングス符号化を行った後、ハフマン符号化を行う。ランレングス符号化は、同一の値が長く続くほど符号化率が向上する符号化方法である。量子化後の値に対してジグザグスキャンを行うことにより、高周波成分の0の値を連続させることで符号化効率を向上させている。   The AC component is subjected to Huffman coding after run-length coding. Run-length coding is a coding method in which the coding rate increases as the same value continues for a long time. By performing zigzag scanning on the quantized values, the encoding efficiency is improved by continuing the zero value of the high frequency component.

JPEG符号化は、デジタルカメラ等のデバイスに搭載されていることもからもわかるように、自然画像に対しては良好な圧縮方法である。他方、文字や線画などの含まれる画像に対しては、画像の高周波成分が失われることを原因とするモスキートノイズや、直流成分の量子化誤差や高周波成分が失われることを原因とするブロック歪が起こりやすいという問題がある。そのため文字や線画などの解像度が保持したまま圧縮する方法として、画像を直交変換の単位となるブロックに分割する。そして、ブロック単位で予め指定された色若しくは濃度値の文字や線画などの解像情報を抽出し、その抽出した領域に対して適当な値で置換処理を行った階調情報を直交変換等で符号化する。一方、ブロック単位の色情報に対しては予測符号化等で符号化するといった方法が提案されている。   JPEG encoding is a good compression method for natural images, as can be seen from the fact that it is installed in devices such as digital cameras. On the other hand, for images containing text, line drawings, etc., mosquito noise caused by the loss of high-frequency components of the image, block distortion caused by loss of quantization error of DC components and high-frequency components There is a problem that is likely to occur. Therefore, as a method of compressing while maintaining the resolution of characters and line drawings, the image is divided into blocks that are units of orthogonal transformation. Then, resolution information such as characters or line drawings of a color or density value specified in advance in block units is extracted, and gradation information obtained by performing replacement processing with appropriate values for the extracted area is subjected to orthogonal transformation or the like. Encode. On the other hand, a method has been proposed in which color information in block units is encoded by predictive encoding or the like.

これは、画像を高周波成分の比較的少ない自然画像と、局所的に同一の濃度値を有する2値的な情報である文字や線画を合成したものとして仮定するものである。そして、その画像に対して直交変換符号化を用いて圧縮・伸長する際に発生する信号歪から文字や線画の情報を保護するために、文字・線画の2値情報を予め抽出しておき、2値情報に対しては劣化の生じない可逆符号化を行う。   This assumes that the image is a combination of a natural image with relatively few high-frequency components and a character or line image that is binary information having the same density value locally. Then, in order to protect the character and line drawing information from signal distortion that occurs when the image is compressed / decompressed using orthogonal transform coding, binary information of the character / line drawing is extracted in advance, Lossless encoding is performed on binary information without causing deterioration.

例えば特許文献1においては、抽出領域への置換処理にて、ブロック内の抽出領域以外の領域を参照して置換処理を行う。具体的には、平均値演算部において抽出領域以外の領域の平均値を算出し、得られた平均値で抽出領域に対して置換処理を行う。あるいは、入力された画素を1サイクル遅延させ、抽出領域の画素に対して、その遅延させた画素で置換を行うという方法が示されている。このような方法で直交変換後のスペクトルを低周波領域に集中させ、圧縮・伸張後の画質劣化を抑える効果を得られる。
特開平4−326669号公報
For example, in Patent Document 1, the replacement process is performed with reference to an area other than the extraction area in the block in the replacement process for the extraction area. Specifically, the average value calculation unit calculates an average value of regions other than the extraction region, and performs a replacement process on the extraction region with the obtained average value. Alternatively, a method is shown in which the input pixel is delayed by one cycle, and the pixel in the extraction region is replaced with the delayed pixel. With such a method, it is possible to obtain an effect of concentrating the spectrum after orthogonal transformation in the low frequency region and suppressing deterioration in image quality after compression / decompression.
JP-A-4-326669

しかしながら、上記従来の画像処理方法では、直交変換後の量子化の際に用いる量子化ステップ幅が粗いと、量子化誤差が発生する可能性が高く、その量子化誤差が画像のブロック歪を引き起こす原因の一つになっているという問題が残る。   However, in the above-described conventional image processing method, if the quantization step width used for quantization after orthogonal transformation is coarse, there is a high possibility that a quantization error will occur, and this quantization error causes block distortion of the image. The problem of being one of the causes remains.

また、直交変換後の係数のうち直流成分値を符号化する場合、注目ブロックの直流成分と、前のブロックの直流成分値との差分を符号化することが行われる。文字線画を含まない階調画像中の2つのブロックの直流成分はほぼ同じ値となるので、その差分は小さなものとなり、符号化効率は高いと言える。   Further, when the DC component value of the coefficient after orthogonal transformation is encoded, the difference between the DC component value of the block of interest and the DC component value of the previous block is encoded. Since the DC components of the two blocks in the gradation image not including the character / line image have substantially the same value, the difference between them is small and it can be said that the encoding efficiency is high.

しかしながら、階調画像上に文字線画が含まれる領域内の2つ隣接ブロックに着目する。このようなケースの場合、それぞれのブロックに含まれる文字線画の画素数が同じとなることはむしろ希であり、必然、2つのブロックの直流成分の差はゼロになる可能性は低い。つまり、直流成分の符号化データ長は最小とはならず、まだまだ改善の余地が残る。   However, attention is paid to two adjacent blocks in a region in which the character line drawing is included on the gradation image. In such a case, it is rather rare that the number of pixels of the character line drawing included in each block is the same, and the difference between the DC components of the two blocks is inevitably low. That is, the encoded data length of the DC component is not minimized, and there is still room for improvement.

本発明はかかる問題点に鑑みなされたものであり、ブロック歪みの発生を抑制し、階調画像と文字/線画とが混在した画像を効率良く符号化する技術を提供しようとするものである。   The present invention has been made in view of such problems, and an object of the present invention is to provide a technique for efficiently encoding an image in which a gradation image and a character / line image are mixed while suppressing occurrence of block distortion.

かかる課題を解決するため、例えば本発明の画像符号化装置は以下の構成を備える。すなわち、
文字線画と階調画像が混在した画像データを符号化する画像符号化装置であって、
符号化対象の画像データを、複数の画素で構成されるブロックを単位に入力する入力手段と、
入力した注目ブロックから、文字線画の画素データと、当該注目ブロック内の各画素が文字線画の画素データであるか階調属性の画素データであるかを識別するための識別情報を抽出する抽出手段と、
該抽出手段で抽出した前記文字線画の画素データを符号化する第1の符号化手段と、
前記抽出手段で抽出した前記識別情報を符号化する第2の符号化手段と、
前記注目ブロックに含まれる、直交変換を行なう単位であるサブブロックの各々に対し、当該サブブロック中の文字線画として抽出した画素データを、階調属性を持つ画素データに基づいて決定される置換値で置換する置換手段と、
該置換手段で置換された後の各サブブロックの画像データを直交変換し、符号化する第3の符号化手段と、
前記第1乃至第3の符号化手段で生成された符号化データを合成し、前記注目ブロックの符号化データを生成する符号列生成手段とを備え、
前記置換手段は、
前記注目ブロック内の注目サブブロックが階調属性を持つ画素のみで構成されると仮定した場合の直流成分を算出する直流成分算出手段と、
前記注目サブブロックの直前のサブブロックの直流成分値に基づいて決定される置換候補値が、前記注目サブブロック内の階調属性を持つ画素群の値の範囲内にあるか否かを判断する判断手段と、
該判断手段で、前記置換候補値が前記範囲内にあると判断した場合、前記直前のサブブロックの直流成分値と近似する値を前記注目サブブロックの前記置換値として決定し、
前記判断手段で、前記置換候補値が前記範囲外にあると判断した場合、注目サブブロックが階調属性の画素のみを持つと仮定した場合の前記注目サブブロックの直流成分値に近似させる値を、前記置換値とする決定手段とを備え
前記第1、第2の符号化手段は可逆符号化手段であり、前記第3の符号化手段は非可逆のJPEG符号化手段であって、
前記注目サブブロックが8×8画素で構成され、その内の文字線画の属性を持つ画素の個数をN、階調属性を持つ画素データの総和、及び、その平均値をD,Daveとし、1画素が8ビットで表わされるとしたとき、
前記直流成分算出手段は、DCT変換時に算出される直流成分DCを、次式によって求め、
DC=(D+Dave×N−128×64)/8
前記決定手段は、前記直前のサブブロックの直流成分をDC -1 、前記注目サブブロックの直流成分をDC 0 としたとき、注目サブブロックにおける前記置換値であるZを次式のいずれかに従って決定する
Z=(8×DC -1 −D+128×64)/N
又は、
Z=(8×DC 0 −D+128×64)/N
ことを特徴とする。
In order to solve this problem, for example, an image encoding device of the present invention has the following configuration. That is,
An image encoding device for encoding image data in which a character line image and a gradation image are mixed,
Input means for inputting image data to be encoded in units of blocks composed of a plurality of pixels;
Extraction means for extracting character line drawing pixel data and identification information for identifying whether each pixel in the target block is character line drawing pixel data or gradation attribute pixel data from the inputted target block When,
First encoding means for encoding the pixel data of the character line drawing extracted by the extraction means;
Second encoding means for encoding the identification information extracted by the extraction means;
For each sub-block, which is a unit for performing orthogonal transform, included in the block of interest, pixel value extracted as a character line drawing in the sub-block is determined based on pixel data having a gradation attribute Replacing means for replacing with,
Third encoding means for orthogonally transforming and encoding the image data of each sub-block after being replaced by the replacement means;
Code string generation means for combining the encoded data generated by the first to third encoding means and generating encoded data of the block of interest;
The replacement means includes
DC component calculation means for calculating a DC component when it is assumed that the target sub-block in the target block is composed only of pixels having a gradation attribute;
It is determined whether or not a replacement candidate value determined based on a DC component value of a sub-block immediately before the target sub-block is within a value range of a pixel group having a gradation attribute in the target sub-block. Judgment means,
When the determination means determines that the replacement candidate value is within the range, a value that approximates the DC component value of the immediately preceding sub-block is determined as the replacement value of the target sub-block,
When the determination unit determines that the replacement candidate value is outside the range, a value approximated to the direct current component value of the target sub-block when it is assumed that the target sub-block has only gradation attribute pixels. , And a determining means for setting the replacement value ,
The first and second encoding means are lossless encoding means, and the third encoding means is an irreversible JPEG encoding means,
The target sub-block is composed of 8 × 8 pixels, and the number of pixels having a character / line drawing attribute is N, the sum of pixel data having gradation attributes, and the average values thereof are D and Dave. If a pixel is represented by 8 bits,
The direct current component calculation means obtains a direct current component DC calculated at the time of DCT conversion by the following equation:
DC = (D + Dave × N−128 × 64) / 8
The determining means determines the replacement value Z in the target sub-block according to any of the following equations, where DC −1 is the DC component of the immediately preceding sub-block and DC DC of the target sub-block is DC 0 Do
Z = (8 × DC −1 −D + 128 × 64) / N
Or
Z = (8 × DC 0 −D + 128 × 64) / N
It is characterized by that.

本発明によれば、階調画像と文字/線画とが混在した画像をブロック単位に符号する場合に、文字/線画の画素が存在した画素を置き換える置換値を、周波数変換後の直流成分の発生をほぼゼロする値にするブロック歪を最小化することができる。また、隣接するブロックの階調画像の性質がほぼ等しい限りにおいては、隣接するブロックの直流成分が同じなる確率を高めることで、高い圧縮率を得ることが可能になる。   According to the present invention, when an image in which a gradation image and a character / line drawing are mixed is encoded in a block unit, a replacement value for replacing a pixel in which a character / line drawing pixel exists is generated as a DC component after frequency conversion. The block distortion that makes the value almost zero can be minimized. Further, as long as the properties of the gradation images of adjacent blocks are substantially equal, it is possible to obtain a high compression ratio by increasing the probability that the DC components of adjacent blocks are the same.

以下、添付図面に従って本発明に係る実施形態を詳細に説明する。   Hereinafter, embodiments according to the present invention will be described in detail with reference to the accompanying drawings.

図5は実施形態における画像圧縮装置のブロック構成図である。   FIG. 5 is a block diagram of the image compression apparatus according to the embodiment.

ブロック化部501は、符号化対象の画像データからn×m画素で構成されるブロックを単位に入力し、それを8×8画素のサブブロック単位に分割し、そのサブブロックの画像データを出力する。ここで、n、mは8の整数倍である。説明を簡単なものとするため、ここでは、n=m=16として説明する。すなわち、ブロック化部501は、図6に示すように、16×16画素のブロックを入力し、4つの8×8画素のサブブロックの画像データを出力する。出力順は、図6に示すようにサブブロック0、1、2、3の順であるとする。   The blocking unit 501 inputs a block composed of n × m pixels from the image data to be encoded in units, divides it into 8 × 8 pixel sub-block units, and outputs the image data of the sub-blocks To do. Here, n and m are integer multiples of 8. In order to simplify the description, here, it is assumed that n = m = 16. That is, as shown in FIG. 6, the blocking unit 501 inputs a block of 16 × 16 pixels and outputs image data of four 8 × 8 pixel sub-blocks. Assume that the output order is the order of sub-blocks 0, 1, 2, and 3 as shown in FIG.

抽出部501は、ブロックの画像(4つのサブブロックの画像)から、予め定められた方法により抽出色を決定し、出力する。また、抽出部501はブロック内に存在する抽出色の位置を示した情報を、位置情報として出力する。この位置情報は、ブロック内の各画素が、抽出色領域内の画素であるか、非抽出色領域内の画素であるかを示す識別情報とも言える。それ故、この位置情報は16×16個の2値データ、すなわち、16×16ビットのデータである。   The extraction unit 501 determines an extraction color from a block image (images of four sub-blocks) by a predetermined method and outputs it. Further, the extraction unit 501 outputs information indicating the position of the extracted color existing in the block as position information. This position information can also be said to be identification information indicating whether each pixel in the block is a pixel in the extracted color region or a pixel in the non-extracted color region. Therefore, this position information is 16 × 16 binary data, that is, 16 × 16 bit data.

置換部503は、入力された位置情報より、サブブロック単位に抽出色領域の画素に対して置換処理を行い、階調情報として出力する。   The replacement unit 503 performs replacement processing on the pixels in the extracted color area in units of sub-blocks based on the input position information, and outputs the result as gradation information.

第1の符号化部504は、入力されたブロックの抽出色情報を可逆圧縮して出力する。第2の符号化部505は、入力されたブロックの位置情報を可逆圧縮して出力する。第3の符号化部506は、入力されたブロックに含まれる4つのサブブロックの階調情報を非可逆圧縮(実施形態ではJPEG符号化)して出力する。そして、符号列生成部507は、各符号化部で生成された符号化データを結合し、ブロック単位の符号化データ列を生成し、出力する。   The first encoding unit 504 performs lossless compression on the extracted color information of the input block and outputs it. The second encoding unit 505 performs lossless compression on the position information of the input block and outputs it. The third encoding unit 506 performs irreversible compression (JPEG encoding in the embodiment) and outputs the gradation information of the four sub-blocks included in the input block. Then, the code string generation unit 507 combines the encoded data generated by each encoding unit to generate and output an encoded data string in block units.

説明を簡単なものとするため、本実施形態での符号化対象の画像データは1画素1成分であり、1画素が8ビット(256階調)の画像(グレースケール画像)とする。また、値255は黒、値0は白として説明する。つまり、画素値は濃度を示すとして説明する。ただし、これは一例であって、これに限るものではない。   In order to simplify the description, it is assumed that the image data to be encoded in this embodiment is one pixel and one component, and one pixel is an 8-bit (256 gradation) image (grayscale image). Further, the value 255 is described as black and the value 0 is described as white. That is, description will be made assuming that the pixel value indicates the density. However, this is an example, and the present invention is not limited to this.

実施形態における抽出部502について先ず、説明する。   First, the extraction unit 502 in the embodiment will be described.

自然画もしくはCGグラデーション画像中に、黒もしくは黒に近い文字線画が存在するとき、そのブロックの濃度のヒストグラムは図7(a)、(b)のようになる。図7(a)は文字線画の濃度が、背景(自然画、CGグラデーション画像)の濃度に対して、十分に異なる値を持っている場合を示している。この状況はちょうど、文字線画が背景画像とはっきりと区別して視認できる状況である。同図(b)は、同図(a)ほどではないが、文字線画と背景とは一応区別できる状況を示している。いずれの場合でも、頻度のピークは2つ現れるので、2つのピーク間の極小値の位置(図10(a)の場合には、2つのピーク間の無頻度の位置でも良い)を閾値として決定する。   When black or a character line drawing close to black exists in a natural image or a CG gradation image, the density histograms of the blocks are as shown in FIGS. FIG. 7A shows a case where the density of the character / line image has a value sufficiently different from the density of the background (natural image, CG gradation image). This situation is just a situation in which the character line drawing can be visually distinguished from the background image. FIG. 5B shows a situation where the character line drawing and the background can be distinguished from each other, though not as much as FIG. In any case, since two frequency peaks appear, the position of the minimum value between the two peaks (in the case of FIG. 10 (a), an infrequent position between the two peaks may be used) is determined as a threshold value. To do.

抽出部502は、上記のようにして閾値を決定し、閾値を越える値を持つ画素を抽出色を持つ画素として決定する。そして、抽出色を持つ画素位置を特定するため、入力したブロックの16×16画素を、決定した閾値で2値化し、これを位置情報として符号化部505、置換部503に出力する。なお、2値化は、閾値を越える画素値は“1”、閾値以下の画素値は“0”とする。図8(a)は、この位置情報を示している。また、置換部503は、8×8画素のサブブロック単位に置換処理を行なう。従って、抽出部502は、抽出した16×16ビットの位置情報のうち、置換部503の置換処理で利用されるサブブロックに相当する位置の8×8ビットの位置情報を置換部503に供給する。なお、置換部503内に、1ブロック分の位置情報を記憶保持するバッファを備える場合には、この限りではない。   The extraction unit 502 determines the threshold value as described above, and determines a pixel having a value exceeding the threshold value as a pixel having the extracted color. Then, in order to specify the pixel position having the extracted color, the 16 × 16 pixels of the input block are binarized with the determined threshold value, and this is output as position information to the encoding unit 505 and the replacement unit 503. In the binarization, the pixel value exceeding the threshold is “1”, and the pixel value below the threshold is “0”. FIG. 8A shows this position information. The replacement unit 503 performs replacement processing in units of 8 × 8 pixel sub-blocks. Therefore, the extraction unit 502 supplies the replacement unit 503 with 8 × 8-bit position information of the position corresponding to the sub-block used in the replacement processing of the replacement unit 503 among the extracted 16 × 16-bit position information. . Note that this is not the case when the replacement unit 503 includes a buffer that stores and holds position information for one block.

抽出部502は、1ブロック分の16×16をラスタースキャンし、位置情報が“1”である入力画素値を順番に抽出して、図8(b)のように一次元に並べ、その画素値を抽出色情報として符号化部504に出力する。   The extraction unit 502 performs a raster scan of 16 × 16 for one block, sequentially extracts input pixel values whose position information is “1”, and arranges them in a one-dimensional manner as shown in FIG. The value is output to the encoding unit 504 as extracted color information.

符号化対象の画像データは、イメージスキャナ等で光学的に読取った画像データである場合、読取り精度等に起因して、文字線画の各画素は単一色となるとは限らない。従って、図8(b)に示すように、ある程度ばらついた値となるが、その分散は小さい。従って、本実施形態における符号化部504は、例えば予測符号化を利用した可逆符号化を採用する。   When the image data to be encoded is image data optically read by an image scanner or the like, each pixel of the character line drawing does not always have a single color due to reading accuracy and the like. Therefore, as shown in FIG. 8B, the value varies to some extent, but the variance is small. Accordingly, the encoding unit 504 in the present embodiment employs lossless encoding using, for example, predictive encoding.

なお、イメージスキャナを介在せず、コンピュータからダイレクトに出力された画像データ、或いは、コンピュータからの印刷データに従ってレンダリングした画像を符号化する場合、誤差は発生しないので、文字線画は単一の色(濃度)となる。従って、このような場合には、閾値を越える画素は全て同じ値を持つので、抽出色情報は1個のデータとなる。この場合、符号化部504はその1個のデータを符号化すればよい。   Note that when encoding image data directly output from a computer or an image rendered in accordance with print data from a computer without an image scanner, no error occurs, so a character line drawing has a single color ( Density). Accordingly, in such a case, all the pixels exceeding the threshold value have the same value, so the extracted color information is one piece of data. In this case, the encoding unit 504 may encode the one piece of data.

また、位置情報は、図8(a)に示すように16×16個の2値データであるので、符号化部505は、2値データに特化した可逆符号化(予測符号化、ランレングス符号化等)を行なえばよい。   Also, since the position information is 16 × 16 binary data as shown in FIG. 8A, the encoding unit 505 performs lossless encoding (predictive encoding, run length) specialized for binary data. Encoding etc. may be performed.

また、抽出部502は、ブロック内の濃度に対する頻度のピークが1つしか存在しなかった場合、言い替えれば、ブロック内に抽出色の領域が存在しない場合、位置情報の全ビットを“0”として出力する。このとき、抽出部502は、注目ブロック内に抽出色情報無しを示す信号を符号列生成部507に出力する。また、ブロック内に抽出色領域が存在する場合には、抽出色情報有りを示す信号を符号列生成部507に出力する。   Further, the extraction unit 502 sets all the bits of the position information to “0” when there is only one frequency peak for the density in the block, in other words, when there is no extracted color area in the block. Output. At this time, the extraction unit 502 outputs a signal indicating that there is no extracted color information in the block of interest to the code string generation unit 507. If the extracted color area exists in the block, a signal indicating the presence of extracted color information is output to the code string generation unit 507.

一方、実施形態における符号化部506は、JPEG(非可逆)符号化を行なう。JPEG符号化は、デジタルカメラ等に搭載された符号化技術であり、自然画に対して高い圧縮率を有することで知られている。このJPEGは、人間の視覚が高周波成分に対して鈍感であることを利用し、その高周波成分をある程度除去して情報量を少なくしてから、符号化するものである。しかしながら、文字線画等は、そのエッジが鮮明であることが望ましい。言い方を変えれば、文字線画は高周波成分が維持されることが望ましいと言える。   On the other hand, the encoding unit 506 in the embodiment performs JPEG (lossy) encoding. JPEG encoding is an encoding technique mounted on a digital camera or the like, and is known to have a high compression rate for natural images. JPEG uses the fact that human vision is insensitive to high-frequency components, and removes the high-frequency components to some extent to reduce the amount of information before encoding. However, it is desirable that the edge of a character / line image or the like is clear. In other words, it can be said that the high-frequency component is desirably maintained in the character line drawing.

かかる点、本実施形態では、文字線画部分は、符号化部505、504にて可逆符号化されることになり、理論上、完全に元の値に復元できる。   In this respect, in this embodiment, the character / line drawing portion is losslessly encoded by the encoding units 505 and 504, and can be completely restored to the original value theoretically.

JPEG符号化は、8×8画素のサブブロックのDCT変換(直交変換)、量子化、エントロピー符号化の処理を経て、符号化データを生成する。文字線画を含むサブブロックをDCT変換すると、その文字線画の存在によって得られる変換係数に影響が現れる。また、量子化処理では、高周波成分の変換係数ほど大きな量子化ステップで量子化するが、それでも完全に高周波成分をカットするわけにはいかない。もし、高周波成分を完全にカットするほど大きな量子化ステップを用いてしまうと、自然画と言えども画質が劣化したものとなってしまうからである。   In JPEG encoding, encoded data is generated through DCT transform (orthogonal transform), quantization, and entropy encoding of an 8 × 8 pixel sub-block. When a DCT transform is performed on a sub-block including a character / line image, the conversion coefficient obtained by the presence of the character / line image is affected. Further, in the quantization process, quantization is performed with a larger quantization step as the conversion coefficient of the high frequency component, but still the high frequency component cannot be completely cut. This is because if a quantization step that is large enough to completely cut off the high-frequency component is used, the image quality will deteriorate even if it is a natural image.

そこで、本実施形態では、文字線画が存在するサブブロックをJPEG符号化する際、そのサブブロックには文字線画が存在していないのと等価のブロックを生成し、符号化部506でJPEG符号化を行なうようにする。これを実現するのが、図5の置換部503である。   Therefore, in this embodiment, when JPEG encoding is performed on a sub-block in which a character / line image exists, a block equivalent to that in which no character / line image exists is generated in the sub-block, and the encoding unit 506 performs JPEG encoding. To do. This is realized by the replacement unit 503 in FIG.

以下、実施形態における置換部503について説明する。   Hereinafter, the replacement unit 503 in the embodiment will be described.

図1は、実施形態における置換部503の詳細ブロック図である。置換部503は、目標値算出部101、係数値算出部102、代表値生成部103、2つの置換候補値算出部104及び107、置換値生成部105、代表値選択部106、及び、候補値選択部108で構成される。以下、実施形態における置換部503を構成する各構成要素について説明する。   FIG. 1 is a detailed block diagram of the replacement unit 503 in the embodiment. The replacement unit 503 includes a target value calculation unit 101, a coefficient value calculation unit 102, a representative value generation unit 103, two replacement candidate value calculation units 104 and 107, a replacement value generation unit 105, a representative value selection unit 106, and a candidate value. The selection unit 108 is configured. Hereinafter, each component which comprises the replacement part 503 in embodiment is demonstrated.

目標値算出部101は、1サブブロック分の8×8画素データと、該当するサブブロックの8×8ビットの位置情報をもとに、抽出色を持つ画素を除く画素の値の合計値D、抽出色を持つ画素を除く画素(非抽出色領域の画素)の値の平均値Dave、及び、抽出色として判定された画素の個数Nを算出する。また、目標値算出部101は、非抽出色領域内の画素値の最大値Max、最小値Minを求める。   The target value calculation unit 101 is based on 8 × 8 pixel data for one subblock and 8 × 8 bit position information of the corresponding subblock, and the total value D of the pixels excluding pixels having the extracted color Then, the average value Dave of the values of pixels excluding the pixels having the extracted color (pixels in the non-extracted color region) and the number N of pixels determined as the extracted color are calculated. Further, the target value calculation unit 101 obtains the maximum value Max and the minimum value Min of the pixel value in the non-extracted color region.

ここで予め説明しておくが、抽出色と判定された画素の個数Nが0の場合、以下に説明する処理は行なわず、置換生成部105は、入力した画素値をそのまま符号化部906に出力するものである。以下では、Nが0以外である場合の説明である点に注意されたい。また、抽出色と判定された画素数ではなく、非抽出色と判定された画素数でも構わない。「抽出色と判定された画素数=64−非抽出色と判定された画素数」の関係を有し、一方を算出することは、他方を算出することと等価であるからである。   As will be described in advance, when the number N of pixels determined to be the extracted color is 0, the processing described below is not performed, and the replacement generation unit 105 directly inputs the input pixel value to the encoding unit 906. Output. In the following, it should be noted that this is an explanation when N is other than 0. Further, the number of pixels determined as the non-extracted color may be used instead of the number of pixels determined as the extracted color. This is because there is a relationship of “the number of pixels determined to be an extracted color = 64−the number of pixels determined to be a non-extracted color”, and calculating one is equivalent to calculating the other.

サブブロックの8×8画素内の座標(i,j)の画素の値をXi,jと表わし、8×8個の位置情報をTi,jとする。ここで、Ti,jは、“0”、“1”のいずれかの値である。Ti,j=1の場合、画素Xi,jは抽出色を持つ画素、すなわち、文字線画として判定された画素を意味する。Ti,j=0の場合、画素Xi,jは非抽出色を持つ画素、すなわち、自然画(or背景画像)として判定された画素を意味する(図8(a)参照)。従って、合計値D、平均値Dave、個数Nは次のように算出される。また、i,jは0以上7以下の整数である。
N=ΣΣTi,j
D=ΣΣXi,j×(1−Ti,j
Dave=D/(64−N)
ここでΣΣはi,j=0,1,2,…7の合算を示す。
The value of the pixel at coordinates (i, j) in the 8 × 8 pixels of the sub-block is represented as X i, j, and 8 × 8 pieces of position information is represented as T i, j . Here, T i, j is a value of “0” or “1”. When T i, j = 1, the pixel X i, j means a pixel having an extracted color, that is, a pixel determined as a character line drawing. When T i, j = 0, the pixel X i, j means a pixel having a non-extracted color, that is, a pixel determined as a natural image (or background image) (see FIG. 8A). Accordingly, the total value D, the average value Dave, and the number N are calculated as follows. I and j are integers of 0 or more and 7 or less.
N = ΣΣT i, j
D = ΣΣX i, j × (1−T i, j )
Dave = D / (64-N)
Here, ΣΣ indicates the sum of i, j = 0, 1, 2,...

図2は、目標値算出部101の具体的な処理手順を示すフローチャートである。以下、同図にしたがってその処理手順を説明する。   FIG. 2 is a flowchart showing a specific processing procedure of the target value calculation unit 101. The processing procedure will be described below with reference to FIG.

先ず、ステップS201では、合計値を求める変数Dと個数を求める変数Nをそれぞれ0に初期化する。また、最小値MINに初期値として“255”、最大値MAXに初期値として“0”を代入する。   First, in step S201, a variable D for obtaining the total value and a variable N for obtaining the number are each initialized to 0. Further, “255” is substituted for the minimum value MIN as an initial value, and “0” is substituted for the maximum value MAX as an initial value.

次いで、ステップS202において、注目画素が抽出色領域内の画素か否か、すなわち、注目画素が抽出色を持つ画素であるか否かを、位置情報に基づき判定する。注目画素が非抽出色領域の画素であると判定した場合、処理はステップS203に進み、変数Dに注目画素データの値を加算する。そして、ステップS209に処理を進める。   Next, in step S202, it is determined based on the position information whether or not the target pixel is a pixel in the extracted color region, that is, whether or not the target pixel is a pixel having the extracted color. If it is determined that the target pixel is a pixel in the non-extracted color region, the process proceeds to step S203, and the value of the target pixel data is added to the variable D. Then, the process proceeds to step S209.

一方、注目画素が抽出色領域内の画素であると判定した場合、処理はステップS204にすすみ、変数Nを“1”だけ増加する。   On the other hand, if it is determined that the target pixel is a pixel in the extracted color area, the process proceeds to step S204, and the variable N is increased by “1”.

この後、処理はステップS205に進み、注目画素の値が変数MINの値より小さいか否かを判断する。注目画素値が変数MINの値より小さいと判断した場合、ステップS206にて、変数MINに注目画素の値を代入することで、変数MINを更新する。   Thereafter, the process proceeds to step S205, and it is determined whether or not the value of the target pixel is smaller than the value of the variable MIN. If it is determined that the target pixel value is smaller than the value of the variable MIN, the variable MIN is updated by substituting the value of the target pixel for the variable MIN in step S206.

また、ステップS207では、注目画素の値が変数MAXの値より大きいか否かを判断する。注目画素値が変数MAXの値より大きいと判断した場合、ステップS208にて、変数MAXに注目画素の値を代入することで、変数MAXを更新する。   In step S207, it is determined whether the value of the target pixel is larger than the value of the variable MAX. If it is determined that the target pixel value is larger than the value of the variable MAX, the variable MAX is updated by substituting the value of the target pixel for the variable MAX in step S208.

ステップS209では、サブブロック内の全画素(64画素)分の処理を行なったか否かを判断する。否の場合には、次の画素の処理を行なうため、ステップS202以降の処理を繰り返す。   In step S209, it is determined whether processing for all pixels (64 pixels) in the sub-block has been performed. If not, the process from step S202 is repeated to process the next pixel.

また、ステップS209にて、サブブロック内の全画素分の処理が行なったと判断した場合、処理はステップS210に進み、上記のようにして求めたD、Nに基づき、非抽出色領域内の画素の平均値Daveを求める。   If it is determined in step S209 that the processing for all the pixels in the sub-block has been performed, the process proceeds to step S210, and the pixels in the non-extracted color area are based on D and N obtained as described above. The average value Dave is obtained.

以上の結果、目標値算出部101は、サブブロック単位に、非抽出色領域の画素値の合計値D及びその平均値Dave、抽出色領域内の画素数N、及び、非抽出領域内の最大値MAX及び最小値MINを得ることができる。   As a result of the above, the target value calculation unit 101, for each subblock, the total value D and the average value Dave of the pixel values in the non-extracted color area, the number N of pixels in the extracted color area, and the maximum in the non-extracted area The value MAX and the minimum value MIN can be obtained.

次に、係数値算出部102について説明する。この係数値算出部102は、目標値算出部101より出力された合計値D、平均値Dave、個数Nに基づき、DCT変換で得られる直流成分であるDC係数を算出する。   Next, the coefficient value calculation unit 102 will be described. The coefficient value calculation unit 102 calculates a DC coefficient, which is a direct current component obtained by DCT conversion, based on the total value D, average value Dave, and number N output from the target value calculation unit 101.

一般に、DCT変換は、画素値をXi,j、変換して得られる係数をYu,vとするとき、次の演算を行なう。
u,v=(1/4)α(u)α(v)ΣΣ(Xi,j-128)cos((2i+1)uπ/16)cos((2j+1)vπ/16)
In general, in the DCT transformation, when the pixel value is X i, j and the coefficient obtained by the transformation is Yu , v , the following calculation is performed.
Y u, v = (1/4) α (u) α (v) ΣΣ (X i, j -128) cos ((2i + 1) uπ / 16) cos ((2j + 1) vπ / 16)

ここで、直流成分DCを求める場合に限ると、u、vは共に“0”となり、α(0)は1/√2である。従って、DCT変換後の直流成分DCは次式(1)となる。
DC=Y0,0=(1/8)ΣΣ(xi,j-128) …(1)
Here, only when obtaining the DC component DC, u and v are both “0”, and α (0) is 1 / √2. Therefore, the DC component DC after DCT conversion is expressed by the following equation (1).
DC = Y 0,0 = (1/8) ΣΣ (x i, j −128) (1)

本実施形態の置換部903は、基本的には、サブブロック内の抽出色を持つと判定された画素の値を、非抽出色と判定された画素の平均値Daveを持つように置換する。このため、係数値算出部102は、上記式(1)を、目標値算出部101で算出されたD、Dave、Nを用いて次式(2)のように変形し、仮のDC成分を算出し、代表値生成部103に出力する。
DC={非抽出色領域の画素の合計値+(非抽出色領域の画素の平均値*抽出色領域内の画素数)−128×64}/8
=(D+Dave×N−128×64)/8 …(2)
Basically, the replacement unit 903 of the present embodiment replaces the pixel value determined to have the extracted color in the sub-block so as to have the average value Dave of the pixels determined to be the non-extracted color. Therefore, the coefficient value calculation unit 102 transforms the above equation (1) into the following equation (2) using D, Dave, and N calculated by the target value calculation unit 101, and converts the temporary DC component to Calculate and output to the representative value generation unit 103.
DC = {total value of pixels in non-extracted color area + (average value of pixels in non-extracted color area * number of pixels in extracted color area) −128 × 64} / 8
= (D + Dave × N−128 × 64) / 8 (2)

次に、実施形態における代表値生成部103について説明する。   Next, the representative value generation unit 103 in the embodiment will be described.

JPEGでは、先に説明したように、DCT変換して得られた各係数を量子化する。ここで、実施形態における符号化部506で行なうDC成分の量子化ステップ値は「16」であるとして説明する。通常、量子化した際、小数点以下の値が発生するので、小数点以下を四捨五入することが行われる。   In JPEG, as described above, each coefficient obtained by DCT conversion is quantized. Here, it is assumed that the quantization step value of the DC component performed by the encoding unit 506 in the embodiment is “16”. Usually, when quantization is performed, a value after the decimal point is generated, so that the value after the decimal point is rounded off.

そこで、本実施形態の代表値生成部103は、係数値算出部102で算出されたDC成分値に「8」(量子化ステップの半分の値)を加算した後、下位4ビットを0にする。この結果、係数値算出部102で算出されたDC成分値を、量子化ステップの整数倍にでき、符号化部506で行われる量子化処理で発生する誤差を実質的に0にする。つまり、代表値生成部103は、係数算出部102で算出されたDC成分値を、量子化ステップの整数倍で、そのDC成分値に近似する値に変換し、その結果を量子化代表値Dpとして代表値選択部106に出力する。   Therefore, the representative value generation unit 103 of the present embodiment adds “8” (half the value of the quantization step) to the DC component value calculated by the coefficient value calculation unit 102, and then sets the lower 4 bits to 0. . As a result, the DC component value calculated by the coefficient value calculation unit 102 can be an integral multiple of the quantization step, and errors generated in the quantization process performed by the encoding unit 506 are substantially reduced to zero. That is, the representative value generation unit 103 converts the DC component value calculated by the coefficient calculation unit 102 into a value that approximates the DC component value by an integer multiple of the quantization step, and the result is the quantized representative value Dp. To the representative value selection unit 106.

次に、一方の置換候補値算出部104について説明する。   Next, one replacement candidate value calculation unit 104 will be described.

ここで、注目サブブロックの量子化代表値を仮にDpと表わす。抽出色領域内の画素の値Zをすると、DpとZは、式(2)を参照すると、次式(3)を満たす必要がある。
Dp=(D+Z×N−128×64)/8 …(3)
Here, the quantization representative value of the target sub-block is temporarily represented as Dp. When the value Z of the pixel in the extraction color region is taken, Dp and Z need to satisfy the following equation (3) with reference to equation (2).
Dp = (D + Z × N−128 × 64) / 8 (3)

ここで、注目サブブロックの直前のサブブロックの量子化代表値Dp-1と表わす。注目サブブロックの量子化代表値Dpが直前のサブブロックの量子化代表値Dpと等しくするためには、式(3)は次式(3’)のようになる。
Dp-1=(D+Z×N−128×64)/8 …(3’)
置換候補値算出部104は、目標値算出部101からの注目サブブロックの抽出色領域内の画素数N、非抽出色領域の画素の合計値Dと、後述する代表値選択部106によって選択した直前のサブブロックの代表値Dp-1を入力し、候補値Zと剰余値Rを生成する。
Z=(8×Dp-1−D+128×64)/N …(4)
=(8×(直前のサブブロックの量子化代表値)−(非抽出色領域の画素の合計値)−128×64}/(抽出色領域と判定された画素数)
R=(8×Dp-1−D+128×64)%N …(5)
ここで、「A % B」は整数Aを整数Bで除算した際の余りを返す関数である。
Here, it is expressed as a quantization representative value Dp −1 of the sub-block immediately before the target sub-block. In order to make the quantized representative value Dp of the target sub-block equal to the quantized representative value Dp of the immediately preceding sub-block, Expression (3) becomes the following Expression (3 ′).
Dp −1 = (D + Z × N−128 × 64) / 8 (3 ′)
The replacement candidate value calculation unit 104 selects the number N of pixels in the extracted color region of the target sub-block from the target value calculation unit 101, the total value D of the pixels in the non-extracted color region, and the representative value selection unit 106 described later. A representative value Dp −1 of the immediately preceding sub-block is input, and a candidate value Z and a remainder value R are generated.
Z = (8 × Dp −1 −D + 128 × 64) / N (4)
= (8 × (quantization representative value of immediately preceding sub-block) − (total value of pixels in non-extracted color area) −128 × 64} / (number of pixels determined as extracted color area)
R = (8 × Dp −1 −D + 128 × 64)% N (5)
Here, “A% B” is a function that returns the remainder when the integer A is divided by the integer B.

つまり、抽出色を持つと判定された各画素の値を、式(4)で求めた値にすれば、後段の符号化部506で量子化した際のDC成分に誤差は発生しないことになる。ただし、画素値は整数でなければならない。つまり、このままでは、式(4)による剰余値(余り)が無視されてしまう。それ故、置換候補値算出部104は、式(5)で剰余値Rを算出する。詳細は後述するが、この剰余値Rは抽出色領域の画素群に分配されるものである。   That is, if the value of each pixel determined to have the extracted color is set to the value obtained by Expression (4), no error occurs in the DC component when quantized by the encoding unit 506 in the subsequent stage. . However, the pixel value must be an integer. That is, in this state, the remainder value (remainder) according to the equation (4) is ignored. Therefore, the replacement candidate value calculation unit 104 calculates the remainder value R using Equation (5). Although the details will be described later, the remainder value R is distributed to the pixel group of the extracted color area.

置換候補値算出部104は、上記のようにして算出した候補値Zを量子化代表値として代表値選択部106に出力すると共に、剰余値Rを候補値選択部108に出力する。   The replacement candidate value calculation unit 104 outputs the candidate value Z calculated as described above to the representative value selection unit 106 as a quantized representative value, and outputs the remainder value R to the candidate value selection unit 108.

なお、実施形態では、1つのブロックには、4つのサブブロックが存在するものとして説明している。従って、最初のサブブロック0を注目サブブロックとしたとき、その直前のサブブロックは存在しない。つまり、注目サブブロックが最初のサブブロック0であるとき、置換候補値算出部104は意味のない処理を行なうことになる。しかし、以下に説明する代表値選択部106は、最初のサブブロック0に対する代表値を選択するときには、代表値生成部103からの代表値Dpを選択するので、問題は発生しない。   In the embodiment, it is assumed that one block includes four sub blocks. Therefore, when the first sub-block 0 is the target sub-block, there is no sub-block immediately before that. That is, when the target sub-block is the first sub-block 0, the replacement candidate value calculation unit 104 performs a meaningless process. However, since the representative value selection unit 106 described below selects the representative value Dp from the representative value generation unit 103 when selecting the representative value for the first sub-block 0, no problem occurs.

以下、この代表値選択部106について説明する。代表値選択部106は、代表値生成部103、置換候補値算出部104から出力される量子化代表値のいずれか一方を選択し、出力する。その選択の条件は次の通りである。
i)サブブロック0用の量子化代表値を選択するとき
代表値選択部106は、代表値生成部103で生成した量子化代表値Dpを選択し、置換候補値算出部107、及び、置換候補値104に出力する。このとき、選択した量子化代表値を内部のメモリ(不図示)に保存し、代表値生成部103からの量子化代表値を選択した旨の制御信号を候補値選択部108に通知する。
Hereinafter, the representative value selection unit 106 will be described. The representative value selection unit 106 selects and outputs one of the quantized representative values output from the representative value generation unit 103 and the replacement candidate value calculation unit 104. The selection conditions are as follows.
i) When selecting a quantized representative value for sub-block 0 The representative value selecting unit 106 selects the quantized representative value Dp generated by the representative value generating unit 103, the replacement candidate value calculating unit 107, and the replacement candidate Output to value 104. At this time, the selected quantized representative value is stored in an internal memory (not shown), and a control signal indicating that the quantized representative value is selected from the representative value generating unit 103 is notified to the candidate value selecting unit 108.

なお、代表値選択部106から置換候補値算出部104に出力される量子化代表値Dpは、置換候補値算出部104が次のサブブロックの処理を行なう際の、直前のサブブロックの量子化代表値となる。
ii)サブブロック0以外のサブブロック1、2、3の量子化代表値を選択するとき
代表値選択部106は、置換候補値算出部104から出力された候補値Zと、目標値算出部101で算出されたMIN、MAXとの関係が次の条件を満たすか否かを判定する。
Note that the quantized representative value Dp output from the representative value selection unit 106 to the replacement candidate value calculation unit 104 is the quantization of the immediately preceding subblock when the replacement candidate value calculation unit 104 processes the next subblock. It is a representative value.
ii) When selecting quantized representative values of sub-blocks 1, 2, and 3 other than sub-block 0 The representative value selector 106 outputs the candidate value Z output from the replacement candidate value calculator 104 and the target value calculator 101. It is determined whether the relationship between MIN and MAX calculated in step 1 satisfies the following condition.

MIN≦Z<MAX …(6)
上記の不等式(6)を満たさないのは、注目サブブロック内に含まれる非抽出色領域内の各画素の色が、直前のサブブロックのそれとは異なっていることを意味する。従って、注目サブブロックの量子化代表値として、置換候補値算出部104で算出された候補値を選択してしまうと、置換後のサブブロック内の階調値の取り得るレンジが大きくなる。この結果、符号化部506内でのDCT変換後の高周波成分ACには、0以外の値が多く含まれる可能性高くなり、符号化効率が悪くなる。それ故、代表値選択部106は、不等式(6)を満たさないと判定した場合には、代表値生成部103で生成した量子化代表値Dpを選択し、置換候補値算出部107、及び、置換候補値104に出力する。
MIN ≦ Z <MAX (6)
The fact that the above inequality (6) is not satisfied means that the color of each pixel in the non-extracted color area included in the target sub-block is different from that of the immediately preceding sub-block. Therefore, if the candidate value calculated by the replacement candidate value calculation unit 104 is selected as the quantized representative value of the target sub-block, the range of gradation values that can be taken in the sub-block after replacement increases. As a result, the high frequency component AC after DCT conversion in the encoding unit 506 is likely to contain many values other than 0, and the encoding efficiency deteriorates. Therefore, if the representative value selection unit 106 determines that the inequality (6) is not satisfied, the representative value selection unit 106 selects the quantized representative value Dp generated by the representative value generation unit 103, and the replacement candidate value calculation unit 107, Output to the replacement candidate value 104.

一方、不等式(6)を満たすと判定した場合には、代表値選択部106は置換候補値算出部104からの候補値を量子化代表値Dpとして選択し、置換候補値算出部107、及び、置換候補値104に出力する。この結果、注目サブブロックの量子化代表値と直前のサブブロックの量子化代表値が同じ値となるので、差分DC成分を符号化した際の符号長は最小とすることもできる。   On the other hand, when it is determined that the inequality (6) is satisfied, the representative value selecting unit 106 selects the candidate value from the replacement candidate value calculating unit 104 as the quantized representative value Dp, the replacement candidate value calculating unit 107, and Output to the replacement candidate value 104. As a result, since the quantization representative value of the target subblock and the quantization representative value of the immediately preceding subblock are the same value, the code length when the differential DC component is encoded can be minimized.

なお、いずれを選択、出力した場合であっても、代表値選択部106は選択した量子化代表値を内部のメモリに格納し、いずれを選択したのかを示す制御信号を候補値選択部108に通知する。   Regardless of which is selected and output, the representative value selection unit 106 stores the selected quantized representative value in the internal memory, and sends a control signal indicating which is selected to the candidate value selection unit 108. Notice.

もう一つの置換候補値算出部107は、置換候補値算出部104の処理と実質的に同じである。ただし、置換候補値算出部107が、参照するのは代表値選択部106から出力された量子化代表値である。   Another replacement candidate value calculation unit 107 is substantially the same as the processing of the replacement candidate value calculation unit 104. However, the replacement candidate value calculation unit 107 refers to the quantized representative value output from the representative value selection unit 106.

次に、候補値選択部108について説明する。この候補値選択部108は、代表値選択部106からの制御信号に従い、置換値候補算出部104で算出された候補値及び剰余値の組と、置換値候補算出部107で算出された候補値及び剰余値の組のいずれか一方を選択し、置換値生成部105に出力する。   Next, the candidate value selection unit 108 will be described. The candidate value selection unit 108, in accordance with a control signal from the representative value selection unit 106, sets of candidate values and remainder values calculated by the replacement value candidate calculation unit 104 and candidate values calculated by the replacement value candidate calculation unit 107. And one of the set of remainder values is selected and output to the replacement value generation unit 105.

具体的には、代表値選択部106からの制御信号が、代表値生成部103からの量子化代表値を選択したことを示す場合、注目サブブロックのDC成分を量子化代表値生成部103の量子化代表値に一致させることを意味する。従って、この場合、代表値選択部106は、置換候補値算出部107の候補値と置換値を選択し、出力する。一方、代表値選択部106からの制御信号が直前サブブロックの量子化代表値を選択したことを示している場合、注目サブブロックのDC成分を直前サブブロックの量子化代表値に一致させる。このため、代表値選択部106は、置換候補値算出部104からの候補値と置換値を選択し、出力する。   Specifically, when the control signal from the representative value selection unit 106 indicates that the quantized representative value from the representative value generation unit 103 has been selected, the DC component of the target sub-block is converted to the quantized representative value generation unit 103. It means to match the quantized representative value. Therefore, in this case, the representative value selection unit 106 selects and outputs the candidate value and replacement value of the replacement candidate value calculation unit 107. On the other hand, when the control signal from the representative value selection unit 106 indicates that the quantized representative value of the immediately preceding subblock has been selected, the DC component of the target subblock is matched with the quantized representative value of the immediately preceding subblock. Therefore, the representative value selection unit 106 selects and outputs the candidate value and replacement value from the replacement candidate value calculation unit 104.

次に、置換値生成部105について説明する。この置換値生成部105は、先に説明したように、注目サブブロックにおける位置情報が全て“0”、すなわち、注目サブブロック内に抽出色領域が存在しない場合には、入力したサブブロックの画素値をそのまま符号化部506に出力する。   Next, the replacement value generation unit 105 will be described. As described above, the replacement value generation unit 105, when the position information in the target subblock is all “0”, that is, when the extracted color area does not exist in the target subblock, the pixel of the input subblock The value is output to the encoding unit 506 as it is.

ここでは、注目サブブロック内に抽出色領域が存在するものとして説明する。この場合の置換値生成部105の処理を図3のフローチャートに従って説明する。この処理は、注目サブブロック内の抽出色領域内の画素値を、候補値選択部108より出力された候補値Zで置換すると共に、置換対象となったR個の画素に「1」を更に加算することで、剰余値Rを分配するものである。   Here, a description will be given assuming that an extracted color region exists in the target sub-block. The processing of the replacement value generation unit 105 in this case will be described with reference to the flowchart of FIG. This process replaces the pixel value in the extracted color area in the target sub-block with the candidate value Z output from the candidate value selection unit 108, and further adds “1” to the R pixels to be replaced. By adding, the remainder value R is distributed.

図3のフローチャートにおいて、注目画素の位置の更新方向は、ラスタースキャン方向として説明する。   In the flowchart of FIG. 3, the update direction of the position of the target pixel will be described as a raster scan direction.

先ず、ステップS301に、カウンタCに初期値として剰余値Rをセットする。   First, in step S301, the remainder value R is set as an initial value in the counter C.

次いで、ステップS302において、注目画素は抽出色領域内にあるか否かを判断する。注目画素が非抽出領域内にあると判定した場合には、ステップS306に進み、入力した画素データをそのまま出力する。   Next, in step S302, it is determined whether or not the target pixel is in the extracted color area. If it is determined that the target pixel is in the non-extraction area, the process proceeds to step S306, and the input pixel data is output as it is.

また、ステップS302にて、注目画素は抽出色領域内にあると判断した場合、処理はステップS303に進み、カウンタCが“0”となったか否かを判断する。否の場合には、ステップS304に進む。このステップS305では、入力した注目画素値の代わりに、「Z+1」を出力する。そして、カウンタCを“1”だけ減じる。   If it is determined in step S302 that the target pixel is in the extracted color area, the process proceeds to step S303, and it is determined whether or not the counter C is “0”. If not, the process proceeds to step S304. In step S305, “Z + 1” is output instead of the input target pixel value. Then, the counter C is decremented by “1”.

ステップS307では、64個の画素データの出力を終えたか否かを判断する。否の場合には、ステップS302に戻る。   In step S307, it is determined whether the output of 64 pieces of pixel data has been completed. If not, the process returns to step S302.

上記の処理の結果、抽出色領域内にあると判断し、尚且つ、カウンタCが“0”以外である場合には、ステップS304の処理が行われるが、カウンタCが“0”となった場合、処理はステップS305に進む。このステップS305では、入力した注目画素値の代わりに、候補値Zを出力する。   As a result of the above processing, when it is determined that the pixel is within the extracted color area and the counter C is other than “0”, the processing of step S304 is performed, but the counter C becomes “0”. If so, the process proceeds to step S305. In step S305, the candidate value Z is output instead of the input target pixel value.

置換値生成部105による処理内容を、図4(a)乃至(d)を参照して説明する。   The processing content by the replacement value generation unit 105 will be described with reference to FIGS.

同図(a)乃至(d)は1ブロックに含まれる4つのサブブロックの置換処理後の階調画像データを示している。図中、斜線で示される領域が各サブブロックの抽出色領域を示している。図示の場合、各々のサブブロックのDC成分は全て「−800」となる。この結果、符号化部506における先頭のサブブロック0に後続するサブブロック1、2、3の量子化後のDC成分の差分値は0が連続する。また、量子化ステップ幅を16とすると、量子化の際に量子化誤差も発生していない。   FIGS. 4A to 4D show gradation image data after replacement processing of four sub-blocks included in one block. In the drawing, the shaded area indicates the extracted color area of each sub-block. In the case shown in the figure, the DC components of each sub-block are all “−800”. As a result, the difference values of the DC components after quantization of the sub-blocks 1, 2, and 3 subsequent to the first sub-block 0 in the encoding unit 506 are 0. If the quantization step width is 16, no quantization error has occurred during quantization.

符号列生成部507は、抽出部502から、抽出色情報有りを示す信号を受信した場合、抽出色領域有りを示す識別ビット(例えば“1”)を有するヘッダを生成する。そして符号列生成部507は、そのヘッダと、符号化部504乃至506から出力された抽出色情報符号化データ、位置情報符号化データ、及び、4つのサブブロックの階調符号化データとを結合し、出力する。図9(a)はこの場合の1つのブロックの符号化データの構造を示している。   When receiving a signal indicating the presence of extracted color information from the extraction unit 502, the code string generation unit 507 generates a header having an identification bit (for example, “1”) indicating the presence of the extracted color area. The code string generation unit 507 combines the header and the extracted color information encoded data, the position information encoded data, and the gradation encoded data of the four sub-blocks output from the encoding units 504 to 506. And output. FIG. 9A shows the structure of the encoded data of one block in this case.

また、符号列生成部507は、抽出部902から、抽出色情報無しを示す信号を受信した場合、抽出色領域無しを示す識別ビット(例えば“0”)を有するヘッダを生成する。そして符号列生成部507は、そのヘッダと、符号化部506から出力された4つのサブブロックの階調符号化データとを結合し、出力する。つまり、位置情報、抽出色情報の符号化データは無視する。図9(b)はこの場合の1つのブロックの符号化データの構造を示している。   In addition, when receiving a signal indicating that there is no extracted color information from the extraction unit 902, the code string generation unit 507 generates a header having an identification bit (eg, “0”) indicating that there is no extracted color area. Then, the code string generation unit 507 combines the header and the gradation encoded data of the four sub-blocks output from the encoding unit 506 and outputs the combined data. That is, the encoded data of position information and extracted color information is ignored. FIG. 9B shows the structure of the encoded data of one block in this case.

なお、上記の符号化データを復号する装置のブロック構成図を図10に示し、その復号処理の流れを一応説明する。図示に示すように、装置は、符号化用データバッファ601、解析・分離部602、抽出色情報復号部603、位置情報復号部604、階調画像復号部605、及び、画像ブロック生成部606で構成される。   FIG. 10 shows a block configuration diagram of an apparatus that decodes the encoded data, and the flow of the decoding process will be described for the time being. As illustrated, the apparatus includes an encoding data buffer 601, an analysis / separation unit 602, an extraction color information decoding unit 603, a position information decoding unit 604, a gradation image decoding unit 605, and an image block generation unit 606. Composed.

1ブロック分の符号化データが符号化データバッファ601に格納されると、解析・分離部602は、その符号化データのヘッダを解析し、その中の識別ビットを判定する。識別ビットが“1”である場合、符号化データは図9(a)の構造であることを意味するので、解析・分離部602は、符号化データ用バッファ601に格納された各符号化データを復号部604乃至606それぞれに分配する。また、このとき、解析・分離部602は識別ビットの情報を画像ブロック生成部606に出力する。階調画像復号部605は入力した4つのサブブロックの符号化データを復号し、1ブロック分、すなわち、16×16画素の画像データを生成し、画像ブロック生成部607に出力する。   When the encoded data for one block is stored in the encoded data buffer 601, the analysis / separation unit 602 analyzes the header of the encoded data and determines an identification bit therein. When the identification bit is “1”, it means that the encoded data has the structure shown in FIG. 9A. Therefore, the analysis / separation unit 602 stores each encoded data stored in the encoded data buffer 601. Is distributed to each of the decoding units 604 to 606. At this time, the analysis / separation unit 602 outputs identification bit information to the image block generation unit 606. The gradation image decoding unit 605 decodes the input encoded data of the four sub-blocks, generates image data for one block, that is, 16 × 16 pixels, and outputs the image data to the image block generation unit 607.

また、識別ビット“0”である場合、ブロックの符号化データは図9(b)の構造であることを意味する。従って、解析・分離部602は、符号化データ用バッファ601に格納された符号化データを階調画像復号部606のみに分配する。また、このとき、解析・分離部602は識別ビットの情報を画像ブロック生成部606に出力することも行なう。階調画像復号部606は、4つのサブブロックの符号化データを復号し、1ブロック分、すなわち、16×16画素の画像データを生成し、画像ブロック生成部607に出力する。   When the identification bit is “0”, it means that the encoded data of the block has the structure of FIG. 9B. Therefore, the analysis / separation unit 602 distributes the encoded data stored in the encoded data buffer 601 only to the gradation image decoding unit 606. At this time, the analysis / separation unit 602 also outputs the identification bit information to the image block generation unit 606. The gradation image decoding unit 606 decodes the encoded data of the four sub-blocks, generates image data for one block, that is, 16 × 16 pixels, and outputs the image data to the image block generation unit 607.

画像ブロック生成部607は、解析・分離部602からの識別ビットが“0”である場合、階調画像復号部605から出力された16×16画素のブロックの画像データを、そのまま出力する。   When the identification bit from the analysis / separation unit 602 is “0”, the image block generation unit 607 outputs the image data of the 16 × 16 pixel block output from the gradation image decoding unit 605 as it is.

また、画像ブロック生成部607は、解析・分離部602からの識別ビットが“1”である場合、位置情報が“0”となっている画素については、階調画像復号部605から出力された画素データを出力する。また、位置情報が“1”である画素については、抽出色情報生成部603で復号された画素データを順番に出力する。   Further, when the identification bit from the analysis / separation unit 602 is “1”, the image block generation unit 607 outputs the pixel whose position information is “0” from the gradation image decoding unit 605. Output pixel data. For the pixels whose position information is “1”, the pixel data decoded by the extracted color information generation unit 603 is output in order.

以上説明したように本実施形態によれば、ブロック中に含まれる各サブブロック内に抽出色領域が含まれ、且つ、着目サブブロック内の非抽出色領域の最大値と最小値との間に、直前のサブブロックのDC成分があったとする。この場合、本実施形態によれば、注目サブブロックの量子化代表値をその直前の量子化代表値と一致させるように、注目サブブロック内の抽出色領域内の画素値の置換値を決定する。この結果、各サブブロック内の階調画素値には高周波成分が少なくなり、尚且つ、注目サブブロックと直前のサブブロックの直流成分の差をゼロにすることが可能になる。すなわち、サブブロックの歪みの発生を抑制し、生成される符号量も少なくできる。   As described above, according to the present embodiment, the extracted color area is included in each sub-block included in the block, and between the maximum value and the minimum value of the non-extracted color area in the target sub-block. Suppose that there is a DC component of the immediately preceding sub-block. In this case, according to the present embodiment, the replacement value of the pixel value in the extracted color region in the target subblock is determined so that the quantized representative value of the target subblock matches the previous quantized representative value. . As a result, the high-frequency component is reduced in the gradation pixel value in each sub-block, and the difference between the DC components of the target sub-block and the immediately preceding sub-block can be made zero. That is, the occurrence of sub-block distortion can be suppressed and the amount of generated codes can be reduced.

一方、着目サブブロック内の非抽出色領域の最大値と最小値との間に、直前のサブブロックのDC成分がない場合には、注目サブブロック自身の量子化代表値と一致するように、注目サブブロック内の抽出色領域内の画素値の置換値を決定する。この結果、サブブロック間の直流成分の差はゼロにはならないものの、注目サブブロック内の階調画素値には高周波成分が少なくなり、サブブロック歪みの発生が抑制され、尚且つ、生成される符号量も少なくできる。   On the other hand, when there is no DC component of the immediately preceding sub-block between the maximum value and the minimum value of the non-extracted color region in the target sub-block, so that it matches the quantization representative value of the target sub-block itself, A replacement value for the pixel value in the extracted color area in the target sub-block is determined. As a result, although the DC component difference between the sub-blocks does not become zero, the high-frequency component is reduced in the gradation pixel value in the target sub-block, and the occurrence of sub-block distortion is suppressed and generated. The amount of code can also be reduced.

なお、上記実施形態では連続するサブ・ブロックのDC成分の量子化後の値を可能な限り一致させると説明したが、これに限らず、連続するサブ・ブロックのDC成分の量子化後の差分値を可能な限り小さくさせる構成でも良い。この場合、置換候補値算出部104は、直前サブ・ブロックの量子化代表値と量子化代表値生成部103にて生成される量子化代表値の間に位置する量子化代表値から複数の候補値と剰余値のセットを生成する。そして、不等式(6)を満足する候補値の中で、最も直前サブ・ブロックの量子化代表値に近くなる値を選択する。この構成により、AC成分の符号量を抑えつつ、DC成分の符号量を最小化することが可能となる。   In the above-described embodiment, it has been described that the quantized values of the DC components of consecutive sub blocks are matched as much as possible. However, the present invention is not limited to this. A configuration in which the value is made as small as possible may be used. In this case, the replacement candidate value calculation unit 104 selects a plurality of candidates from the quantized representative value located between the quantized representative value of the immediately preceding sub-block and the quantized representative value generated by the quantized representative value generating unit 103. Generate a set of values and remainder values. Then, among the candidate values satisfying the inequality (6), a value close to the quantization representative value of the immediately preceding sub-block is selected. With this configuration, it is possible to minimize the code amount of the DC component while suppressing the code amount of the AC component.

以上、本発明に係る実施形態を説明したが、CPUやMPU等のプロセッサがコンピュータプログラムを実行することで、図5に係る構成の機能を実現しても構わない。すなわち、本発明は、コンピュータプログラムをもその範疇とする。また、通常、コンピュータプログラムは、CD−ROM等のコンピュータ可読記憶媒体に格納されている。そして、そのコンピュータ可読記憶媒体を、読取り装置(CD−ROMドライブ)にセットし、システムにコピーもしくはインストールすることで実行可能となる。従って、このようなコンピュータ可読記憶媒体も本発明の範疇にあることも明らかである。   Although the embodiment according to the present invention has been described above, the functions of the configuration illustrated in FIG. 5 may be realized by a processor such as a CPU or MPU executing a computer program. That is, the present invention also includes computer programs. In general, the computer program is stored in a computer-readable storage medium such as a CD-ROM. The computer-readable storage medium is set in a reading device (CD-ROM drive), and can be executed by copying or installing in the system. Therefore, it is obvious that such a computer-readable storage medium is also within the scope of the present invention.

実施形態の置換部のブロック構成図である。It is a block block diagram of the replacement part of embodiment. 実施形態の目標値算出部の処理内容を説明するためのフローチャートである。It is a flowchart for demonstrating the processing content of the target value calculation part of embodiment. 実施形態の置換値生成部の処理内容を説明するためのフローチャートである。It is a flowchart for demonstrating the processing content of the replacement value production | generation part of embodiment. 置換値生成部の処理結果の一例を示す図である。It is a figure which shows an example of the process result of a substitution value production | generation part. 実施形態の画像符号化装置のブロック構成図である。It is a block block diagram of the image coding apparatus of embodiment. 符号化単位のブロックとサブブロックとの対応関係を示す図である。It is a figure which shows the correspondence of the block of an encoding unit, and a subblock. 抽出部の処理内容を説明するための図である。It is a figure for demonstrating the processing content of an extraction part. 抽出部が生成する位置情報、及び、抽出色情報の一例を示す図である。It is a figure which shows an example of the positional information and extraction color information which an extraction part produces | generates. 符号列生成部が生成する1ブロック分の符号化データの構造を示す図である。It is a figure which shows the structure of the coding data for 1 block which a code sequence production | generation part produces | generates. 実施形態における画像復号装置のブロック構成図である。It is a block block diagram of the image decoding apparatus in embodiment.

Claims (6)

文字線画と階調画像が混在した画像データを符号化する画像符号化装置であって、
符号化対象の画像データを、複数の画素で構成されるブロックを単位に入力する入力手段と、
入力した注目ブロックから、文字線画の画素データと、当該注目ブロック内の各画素が文字線画の画素データであるか階調属性の画素データであるかを識別するための識別情報を抽出する抽出手段と、
該抽出手段で抽出した前記文字線画の画素データを符号化する第1の符号化手段と、
前記抽出手段で抽出した前記識別情報を符号化する第2の符号化手段と、
前記注目ブロックに含まれる、直交変換を行なう単位であるサブブロックの各々に対し、当該サブブロック中の文字線画として抽出した画素データを、階調属性を持つ画素データに基づいて決定される置換値で置換する置換手段と、
該置換手段で置換された後の各サブブロックの画像データを直交変換し、符号化する第3の符号化手段と、
前記第1乃至第3の符号化手段で生成された符号化データを合成し、前記注目ブロックの符号化データを生成する符号列生成手段とを備え、
前記置換手段は、
前記注目ブロック内の注目サブブロックが階調属性を持つ画素のみで構成されると仮定した場合の直流成分を算出する直流成分算出手段と、
前記注目サブブロックの直前のサブブロックの直流成分値に基づいて決定される置換候補値が、前記注目サブブロック内の階調属性を持つ画素群の値の範囲内にあるか否かを判断する判断手段と、
該判断手段で、前記置換候補値が前記範囲内にあると判断した場合、前記直前のサブブロックの直流成分値と近似する値を前記注目サブブロックの前記置換値として決定し、
前記判断手段で、前記置換候補値が前記範囲外にあると判断した場合、注目サブブロックが階調属性の画素のみを持つと仮定した場合の前記注目サブブロックの直流成分値に近似させる値を、前記置換値とする決定手段とを備え
前記第1、第2の符号化手段は可逆符号化手段であり、前記第3の符号化手段は非可逆のJPEG符号化手段であって、
前記注目サブブロックが8×8画素で構成され、その内の文字線画の属性を持つ画素の個数をN、階調属性を持つ画素データの総和、及び、その平均値をD,Daveとし、1画素が8ビットで表わされるとしたとき、
前記直流成分算出手段は、DCT変換時に算出される直流成分DCを、次式によって求め、
DC=(D+Dave×N−128×64)/8
前記決定手段は、前記直前のサブブロックの直流成分をDC -1 、前記注目サブブロックの直流成分をDC 0 としたとき、注目サブブロックにおける前記置換値であるZを次式のいずれかに従って決定する
Z=(8×DC -1 −D+128×64)/N
又は、
Z=(8×DC 0 −D+128×64)/N
ことを特徴とする画像符号化装置。
An image encoding device for encoding image data in which a character line image and a gradation image are mixed,
Input means for inputting image data to be encoded in units of blocks composed of a plurality of pixels;
Extraction means for extracting character line drawing pixel data and identification information for identifying whether each pixel in the target block is character line drawing pixel data or gradation attribute pixel data from the inputted target block When,
First encoding means for encoding the pixel data of the character line drawing extracted by the extraction means;
Second encoding means for encoding the identification information extracted by the extraction means;
For each sub-block, which is a unit for performing orthogonal transform, included in the block of interest, pixel value extracted as a character line drawing in the sub-block is determined based on pixel data having a gradation attribute Replacing means for replacing with,
Third encoding means for orthogonally transforming and encoding the image data of each sub-block after being replaced by the replacement means;
Code string generation means for combining the encoded data generated by the first to third encoding means and generating encoded data of the block of interest;
The replacement means includes
DC component calculation means for calculating a DC component when it is assumed that the target sub-block in the target block is composed only of pixels having a gradation attribute;
It is determined whether or not a replacement candidate value determined based on a DC component value of a sub-block immediately before the target sub-block is within a value range of a pixel group having a gradation attribute in the target sub-block. Judgment means,
When the determination means determines that the replacement candidate value is within the range, a value that approximates the DC component value of the immediately preceding sub-block is determined as the replacement value of the target sub-block,
When the determination unit determines that the replacement candidate value is outside the range, a value approximated to the direct current component value of the target sub-block when it is assumed that the target sub-block has only gradation attribute pixels. , And a determining means for setting the replacement value ,
The first and second encoding means are lossless encoding means, and the third encoding means is an irreversible JPEG encoding means,
The target sub-block is composed of 8 × 8 pixels, and the number of pixels having a character / line drawing attribute is N, the sum of pixel data having gradation attributes, and the average values thereof are D and Dave. If a pixel is represented by 8 bits,
The direct current component calculation means obtains a direct current component DC calculated at the time of DCT conversion by the following equation:
DC = (D + Dave × N−128 × 64) / 8
The determining means determines the replacement value Z in the target sub-block according to any of the following equations, where DC −1 is the DC component of the immediately preceding sub-block and DC DC of the target sub-block is DC 0 Do
Z = (8 × DC −1 −D + 128 × 64) / N
Or
Z = (8 × DC 0 −D + 128 × 64) / N
An image encoding apparatus characterized by that.
更に、前記置換手段は、前記置換値Zを求める際に発生した剰余値Rを次式に従って求め、
R=(8×DC-1−D+128×64) % N
又は、
R=(8×DC0−D+128×64) % N
(A%Bは整数Aを整数Bで除算した際の余りを返す関数)
前記文字線画として判定された「N−R」個の画素のデータを置換値Zで置換し、
前記文字線画として判定されたR個の画素のデータを「Z+1」で置換する
ことを特徴とする請求項1に記載の画像符号化装置。
Further, the replacement means determines the remainder value R generated when determining the replacement value Z according to the following equation:
R = (8 × DC −1 −D + 128 × 64)% N
Or
R = (8 × DC 0 −D + 128 × 64)% N
(A% B is a function that returns the remainder when integer A is divided by integer B)
The data of “N−R” pixels determined as the character / line image is replaced with a replacement value Z,
The image encoding apparatus according to claim 1, wherein data of R pixels determined as the character / line image is replaced with “Z + 1”.
前記注目サブブロックが1ブロックの先頭のサブブロックである場合、前記決定手段は、前記注目サブブロックが階調属性の画素のみを持つと仮定した場合の直流成分値に近似する値を前記置換値とすることを特徴とする請求項1に記載の画像符号化装置。   When the target sub-block is the first sub-block of one block, the determining means sets a value that approximates a direct current component value when it is assumed that the target sub-block has only pixels with gradation attributes to the replacement value The image encoding apparatus according to claim 1, wherein: 文字線画と階調画像が混在した画像データを符号化する画像符号化装置の制御方法であって、
符号化対象の画像データを、複数の画素で構成されるブロックを単位に入力する入力工程と、
入力した注目ブロックから、文字線画の画素データと、当該注目ブロック内の各画素が文字線画の画素データであるか階調属性の画素データであるかを識別するための識別情報を抽出する抽出工程と、
該抽出工程で抽出した前記文字線画の画素データを符号化する第1の符号化工程と、
前記抽出工程で抽出した前記識別情報を符号化する第2の符号化工程と、
前記注目ブロックに含まれる、直交変換を行なう単位であるサブブロックの各々に対し、当該サブブロック中の文字線画として抽出した画素データを、階調属性を持つ画素データに基づいて決定される置換値で置換する置換工程と、
該置換工程で置換された後の各サブブロックの画像データを直交変換し、符号化する第3の符号化工程と、
前記第1乃至第3の符号化工程で生成された符号化データを合成し、前記注目ブロックの符号化データを生成する符号列生成工程とを備え、
前記置換工程は、
前記注目ブロック内の注目サブブロックが階調属性を持つ画素のみで構成されると仮定した場合の直流成分を算出する直流成分算出工程と、
前記注目サブブロックの直前のサブブロックの直流成分値に基づいて決定される置換候補値が、前記注目サブブロック内の階調属性を持つ画素群の値の範囲内にあるか否かを判断する判断工程と、
該判断工程で、前記置換候補値が前記範囲内にあると判断した場合、前記直前のサブブロックの直流成分値と近似する値を前記注目サブブロックの前記置換値として決定し、
前記判断工程で、前記置換候補値が前記範囲外にあると判断した場合、注目サブブロックが階調属性の画素のみを持つと仮定した場合の前記注目サブブロックの直流成分値に近似させる値を、前記置換値とする決定工程とを備え
前記第1、第2の符号化工程は可逆符号化工程であり、前記第3の符号化工程は非可逆のJPEG符号化工程であって、
前記注目サブブロックが8×8画素で構成され、その内の文字線画の属性を持つ画素の個数をN、階調属性を持つ画素データの総和、及び、その平均値をD,Daveとし、1画素が8ビットで表わされるとしたとき、
前記直流成分算出工程は、DCT変換時に算出される直流成分DCを、次式によって求め、
DC=(D+Dave×N−128×64)/8
前記決定工程は、前記直前のサブブロックの直流成分をDC -1 、前記注目サブブロックの直流成分をDC 0 としたとき、注目サブブロックにおける前記置換値であるZを次式のいずれかに従って決定する
Z=(8×DC -1 −D+128×64)/N
又は、
Z=(8×DC 0 −D+128×64)/N
ことを特徴とする画像符号化装置の制御方法。
A control method of an image encoding device that encodes image data in which a character line image and a gradation image are mixed,
An input process for inputting image data to be encoded in units of blocks each composed of a plurality of pixels;
Extraction step of extracting character line drawing pixel data and identification information for identifying whether each pixel in the target block is character line drawing pixel data or gradation attribute pixel data from the inputted attention block When,
A first encoding step for encoding the pixel data of the character line drawing extracted in the extraction step;
A second encoding step for encoding the identification information extracted in the extraction step;
For each sub-block, which is a unit for performing orthogonal transform, included in the block of interest, pixel value extracted as a character line drawing in the sub-block is determined based on pixel data having a gradation attribute A replacement step of replacing with,
A third encoding step of orthogonally transforming and encoding the image data of each sub-block after being replaced in the replacement step;
A code string generation step of combining the encoded data generated in the first to third encoding steps and generating encoded data of the block of interest,
The replacement step includes
A direct current component calculation step for calculating a direct current component when it is assumed that the target sub-block in the target block includes only pixels having a gradation attribute;
It is determined whether or not a replacement candidate value determined based on a DC component value of a sub-block immediately before the target sub-block is within a value range of a pixel group having a gradation attribute in the target sub-block. A decision process;
In the determination step, when it is determined that the replacement candidate value is within the range, a value that approximates the DC component value of the immediately preceding sub-block is determined as the replacement value of the target sub-block,
In the determination step, when it is determined that the replacement candidate value is outside the range, a value approximated to the DC component value of the target sub-block when it is assumed that the target sub-block has only gradation attribute pixels And a determination step for setting the replacement value ,
The first and second encoding steps are lossless encoding steps, and the third encoding step is an irreversible JPEG encoding step,
The target sub-block is composed of 8 × 8 pixels, and the number of pixels having a character / line drawing attribute is N, the sum of pixel data having gradation attributes, and the average values thereof are D and Dave. If a pixel is represented by 8 bits,
In the direct current component calculation step, the direct current component DC calculated at the time of DCT conversion is obtained by the following equation:
DC = (D + Dave × N−128 × 64) / 8
In the determining step, when the DC component of the immediately preceding sub-block is DC −1 and the DC component of the target sub-block is DC 0 , the replacement value Z in the target sub-block is determined according to any of the following equations Do
Z = (8 × DC −1 −D + 128 × 64) / N
Or
Z = (8 × DC 0 −D + 128 × 64) / N
A control method for an image encoding device.
コンピュータが読込み実行することで、前記コンピュータを、請求項1乃至のいずれか1項に記載の画像符号化装置として機能させることを特徴とするコンピュータプログラム。 Computer by executing reading, computer program characterized the computer function as an image encoding apparatus according to any one of claims 1 to 3. 請求項に記載のコンピュータプログラムを格納したことを特徴とするコンピュータ可読記憶媒体。 A computer-readable storage medium storing the computer program according to claim 5 .
JP2006286885A 2006-10-20 2006-10-20 Image coding apparatus and control method thereof Expired - Fee Related JP4743884B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2006286885A JP4743884B2 (en) 2006-10-20 2006-10-20 Image coding apparatus and control method thereof
US11/862,804 US8041135B2 (en) 2006-10-20 2007-09-27 Image encoding apparatus and control method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006286885A JP4743884B2 (en) 2006-10-20 2006-10-20 Image coding apparatus and control method thereof

Publications (3)

Publication Number Publication Date
JP2008104121A JP2008104121A (en) 2008-05-01
JP2008104121A5 JP2008104121A5 (en) 2009-11-19
JP4743884B2 true JP4743884B2 (en) 2011-08-10

Family

ID=39438078

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006286885A Expired - Fee Related JP4743884B2 (en) 2006-10-20 2006-10-20 Image coding apparatus and control method thereof

Country Status (1)

Country Link
JP (1) JP4743884B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117819160A (en) * 2024-03-04 2024-04-05 宝鸡杭叉工程机械有限责任公司 Automatic monitoring method and system for coal flow of belt conveyor based on image processing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3231800B2 (en) * 1991-04-26 2001-11-26 キヤノン株式会社 Image encoding apparatus and image encoding method

Also Published As

Publication number Publication date
JP2008104121A (en) 2008-05-01

Similar Documents

Publication Publication Date Title
US7613345B2 (en) Image coding apparatus and image decoding apparatus and their control methods, and computer program and computer-readable storage medium
Celik et al. Reversible data hiding
JP4365957B2 (en) Image processing method and apparatus and storage medium
US6711295B2 (en) Encoding apparatus and method, and storage medium
US8213727B2 (en) Image encoding apparatus and image decoding apparatus, and control method thereof
US8285062B2 (en) Method for improving the performance of embedded graphics coding
US20060262982A1 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP2000069292A (en) Image processing unit, its method and storage medium
US6337929B1 (en) Image processing apparatus and method and storing medium
JP2002325170A (en) Image processing unit and its method, and program code, storage medium
JP4956304B2 (en) Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium
US8041135B2 (en) Image encoding apparatus and control method thereof
JP5101962B2 (en) Image coding apparatus, control method therefor, and computer program
JP4743884B2 (en) Image coding apparatus and control method thereof
US8463057B2 (en) Image encoding apparatus and control method therefor
KR20130062108A (en) Method and apparatus for encoding and decoding binary image using an adaptive template
KR100412176B1 (en) Document segmentation compression, reconstruction system and method
JP5086777B2 (en) Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium
JP4743883B2 (en) Image coding apparatus and control method thereof
JP4054430B2 (en) Image processing apparatus and method, and storage medium
JP4971881B2 (en) Image encoding apparatus, image decoding apparatus, and control method thereof
JP2009260747A (en) Image encoding device, and control method thereof
JP2010074444A (en) Image compression apparatus and method, image decoding apparatus and method, and computer program
JPH05235778A (en) High efficiency coding method
JP4944833B2 (en) Image coding apparatus and control method thereof

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20091002

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20091002

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110314

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110411

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20110428

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110509

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

Free format text: PAYMENT UNTIL: 20140520

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees