JP2005301457A - Image processor, program, and recording medium - Google Patents

Image processor, program, and recording medium Download PDF

Info

Publication number
JP2005301457A
JP2005301457A JP2004113563A JP2004113563A JP2005301457A JP 2005301457 A JP2005301457 A JP 2005301457A JP 2004113563 A JP2004113563 A JP 2004113563A JP 2004113563 A JP2004113563 A JP 2004113563A JP 2005301457 A JP2005301457 A JP 2005301457A
Authority
JP
Japan
Prior art keywords
binary image
format
data
processing
image
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
JP2004113563A
Other languages
Japanese (ja)
Inventor
Takashi Nagao
隆 長尾
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.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuji Xerox Co Ltd filed Critical Fuji Xerox Co Ltd
Priority to JP2004113563A priority Critical patent/JP2005301457A/en
Publication of JP2005301457A publication Critical patent/JP2005301457A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To achieve an increased processing efficiency when executing image processing to a binarized image by selectively using a bit-map form and a run-length form. <P>SOLUTION: An image processor 1 compares a processing cost in the case of a bit-map form and a processing cost in the case of a run-length form concerning a binarized image to which image processing is to be executed, selects the data form of which processing cost is the lower and executes the image processing to the binarized image with it, and outputs the binarized image that has been processed. An image processing device 2 compares a processing cost in the case of the image processing in which entropy coded binarized image data are decoded to binarized image data of the bit-map form and a processing cost in the case of the image processing in which the entropy coded binarized image data are decoded to binarized image data of the run-length form, decodes the entropy coded binarized image data to the binarized image data of the data form of which processing cost is the lower, executes the image processing, and outputs the binarized image data that have been processed. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、2値画像に対して画像処理を施す技術に関する。   The present invention relates to a technique for performing image processing on a binary image.

白黒画像に代表される2値画像はビットマップ形式で扱われることが多いが、例えば、白黒画像内の白画素と黒画素の出現頻度に一定の格差がある場合は、白黒画像をランレングス形式で扱うと、データ量が低減できることに加え、拡大や縮小、回転等の画像処理をビットマップ形式の場合と比較して短時間で処理することができる。ランレングス形式の2値画像に対して、拡大や縮小、回転等の画像処理を施す技術については種々の提案がなされており、例えば、特許文献1〜3には拡大や縮小に関する技術が、特許文献4,5には回転に関する技術が提案されている。   A binary image typified by a monochrome image is often handled in a bitmap format. For example, if there is a certain difference in the appearance frequency of white pixels and black pixels in a monochrome image, the monochrome image is converted to a run-length format. In addition to being able to reduce the amount of data, image processing such as enlargement, reduction, and rotation can be processed in a shorter time than in the case of the bitmap format. Various proposals have been made for techniques for performing image processing such as enlargement, reduction, and rotation on binary images in the run length format. For example, Patent Documents 1 to 3 disclose techniques relating to enlargement and reduction. Documents 4 and 5 propose techniques relating to rotation.

特開平05−250468号公報Japanese Patent Laid-Open No. 05-250468 特開平06−044369号公報Japanese Patent Application Laid-Open No. 06-044369 特開平08−331288号公報JP 08-33288 A 特開平01−149185号公報JP-A-01-149185 特開平02−297679号公報Japanese Patent Laid-Open No. 02-297679

例えば、白黒画像にハッチや擬似中間調で表現された自然画が含まれており、かつ、このようなハッチや自然画の占める面積比率が大きいと、白黒画像に含まれる黒ランの数が著しく多くなってしまう。このような白黒画像をランレングス形式で扱うと、ビットマップ形式の場合と比較して白黒画像のデータ量が増えてしまい、拡大や縮小、回転等の画像処理に長い時間を要してしまう。   For example, if a black-and-white image contains a natural image expressed in hatches or pseudo-halftones, and the area ratio of such a hatch or natural image is large, the number of black runs contained in the black-and-white image is remarkably large. It will increase. When such a monochrome image is handled in the run length format, the data amount of the monochrome image increases as compared with the bitmap format, and a long time is required for image processing such as enlargement, reduction, and rotation.

例えば、白黒画像において全画素中の1%が黒画素で、黒ランの平均のラン長を4、黒ラン1個当たりのデータ量を16ビットと仮定し、このときのビットマップ形式での白黒画像のデータ量を100とした場合、ランレングス形式の場合のデータ量は僅かに8である。しかしながら、白黒画像において全画素中の16%が黒画素で、黒ランの平均のラン長を2、黒ラン1個当たりのデータ量を16ビットと仮定し、このときのビットマップ形式でのデータ量を100とした場合、ランレングス形式の場合のデータ量は256となり、ビットマップ形式の場合と比較してデータ量が著しく増えてしまう。このように2値画像の画像特性によっては、ランレングス形式で扱うとデータ量の増大を招き、拡大や縮小、回転等の画像処理に長い時間を要してしまう場合がある。   For example, assuming that 1% of all pixels in a black-and-white image are black pixels, the average run length of black runs is 4, and the amount of data per black run is 16 bits. When the image data amount is 100, the data amount in the run-length format is only 8. However, assuming that 16% of all pixels in a monochrome image are black pixels, the average run length of black runs is 2, and the amount of data per black run is 16 bits. When the amount is 100, the data amount in the run-length format is 256, and the data amount is significantly increased as compared with the bitmap format. As described above, depending on the image characteristics of the binary image, when it is handled in the run length format, the amount of data increases, and it may take a long time for image processing such as enlargement, reduction, and rotation.

本発明は、以上説明した事情に鑑みてなされたものであり、その目的は、ビットマップ形式とランレングス形式を使い分けることで2値画像に対して画像処理を施す場合の処理効率を高めることである。   The present invention has been made in view of the circumstances described above, and its purpose is to increase the processing efficiency when performing image processing on a binary image by properly using a bitmap format and a run-length format. is there.

上記課題を解決するために、本発明は、画像処理を施す2値画像のデータ形式を特定する特定手段と、前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をビットマップ形式とした場合とランレングス形式とした場合の各々について、前記2値画像から得られる情報を用いて算出する第1の算出手段と、前記第1の算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、前記特定手段により特定されたデータ形式が前記選択手段により選択されたデータ形式と異なる場合に、前記2値画像のデータ形式を前記選択手段により選択されたデータ形式に変換する変換手段と、前記選択手段により選択されたデータ形式の前記2値画像に対して画像処理を施す画像処理手段と、前記画像処理手段により処理された2値画像を出力する出力手段とを具備する画像処理装置を提供する。   In order to solve the above-described problems, the present invention provides a specifying means for specifying a data format of a binary image to be subjected to image processing, and a processing amount when image processing is performed on the binary image. First calculation means for calculating using the information obtained from the binary image for each of the case where the data format of the image is the bitmap format and the case of the run length format, and the first calculation means The selection means for comparing the processing amount in the case of the bitmap format and the run length format and selecting a data format with a small processing amount, and the data format specified by the specifying means are selected by the selection means Conversion means for converting the data format of the binary image to the data format selected by the selection means when the data format differs from the selected data format, and the data format selected by the selection means To provide an image processing apparatus comprising image processing means for performing image processing on the binary image, and output means for outputting the binary image processed by said image processing means.

また、本発明は、コンピュータを、画像処理を施す2値画像のデータ形式を特定する特定手段と、前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をビットマップ形式とした場合とランレングス形式とした場合の各々について、前記2値画像から得られる情報を用いて算出する算出手段と、前記算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、前記特定手段により特定されたデータ形式が前記選択手段により選択されたデータ形式と異なる場合に、前記2値画像のデータ形式を前記選択手段により選択されたデータ形式に変換する変換手段と、前記選択手段により選択されたデータ形式の前記2値画像に対して画像処理を施す画像処理手段と、前記画像処理手段により処理された2値画像を出力する出力手段として機能させるためのプログラムを提供する。また、本発明は、上記プログラムを記録したコンピュータ読み取り可能な記録媒体を提供する。   According to another aspect of the present invention, there is provided a specifying means for specifying a data format of a binary image to be subjected to image processing, and a processing amount when the image processing is performed on the binary image. For each of the case where the format is a bitmap format and the case where the run length format is used, a calculation means for calculating using information obtained from the binary image, and a case of the bitmap format calculated by the calculation means; The selection means for comparing the processing amount in the case of the run length format and selecting a data format with a small processing amount, and when the data format specified by the specifying means is different from the data format selected by the selection means, Conversion means for converting the data format of the binary image into the data format selected by the selection means; and the binary image of the data format selected by the selection means. It provides image processing means for performing image processing, a program for functioning as an output means for outputting the binary image processed by said image processing means and. The present invention also provides a computer-readable recording medium on which the program is recorded.

本発明によれば、画像処理装置(コンピュータ)は、画像処理を施す2値画像について、ビットマップ形式の場合の処理量と、ランレングス形式の場合の処理量とを比較し、処理量の少ないデータ形式を選択して2値画像に画像処理を施し、処理後の2値画像を出力する。   According to the present invention, the image processing apparatus (computer) compares the processing amount in the bitmap format with the processing amount in the run-length format for the binary image subjected to image processing, and the processing amount is small. A data format is selected, image processing is performed on the binary image, and the processed binary image is output.

また、本発明は、エントロピー符号化された2値画像データを復号して画像処理を施した場合の処理量を、前記2値画像データをビットマップ形式の2値画像データに復号した場合とランレングス形式の2値画像データに復号した場合の各々について算出する第1の算出手段と、前記第1の算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、前記エントロピー符号化された2値画像データを、前記選択手段により選択されたデータ形式の2値画像データに復号する復号手段と、前記復号手段により復号された2値画像データに対して画像処理を施す画像処理手段と、前記画像処理手段により処理された2値画像データを出力する出力手段とを具備する画像処理装置を提供する。   Further, the present invention relates to the amount of processing when the entropy-encoded binary image data is decoded and subjected to image processing, when the binary image data is decoded into bitmap-format binary image data. The first calculation means for calculating each of the decoded binary image data in the length format and the amount of processing in the bitmap format and the run length format calculated by the first calculation means are compared. Selection means for selecting a data format with a small amount of processing, decoding means for decoding the entropy-encoded binary image data into binary image data of the data format selected by the selection means, and the decoding Image processing means for performing image processing on the binary image data decoded by the means, and output means for outputting the binary image data processed by the image processing means. To provide an image processing apparatus for Bei.

また、本発明は、コンピュータを、エントロピー符号化された2値画像データを復号して画像処理を施した場合の処理量を、前記2値画像データをビットマップ形式の2値画像データに復号した場合とランレングス形式の2値画像データに復号した場合の各々について算出する算出手段と、前記算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、前記エントロピー符号化された2値画像データを、前記選択手段により選択されたデータ形式の2値画像データに復号する復号手段と、前記復号手段により復号された2値画像データに対して画像処理を施す画像処理手段と、前記画像処理手段により処理された2値画像データを出力する出力手段として機能させるためのプログラムを提供する。また、本発明は、上記プログラムを記録したコンピュータ読み取り可能な記録媒体を提供する。   According to the present invention, the amount of processing when the computer decodes entropy-encoded binary image data and performs image processing, the binary image data is decoded into bitmap-format binary image data. A calculation means for calculating each of the case and the case of decoding into binary image data in the run length format, and comparing the processing amount calculated in the bitmap format and the run length format calculated by the calculation means, Selecting means for selecting a data format with a small amount; decoding means for decoding the entropy-encoded binary image data into binary image data in the data format selected by the selecting means; and decoding by the decoding means Image processing means for performing image processing on the processed binary image data, and output means for outputting the binary image data processed by the image processing means To provide a program for which to function. The present invention also provides a computer-readable recording medium in which the program is recorded.

本発明によれば、画像処理装置(コンピュータ)は、エントロピー符号化された2値画像データについて、ビットマップ形式の2値画像データに復号して画像処理を施した場合の処理量と、ランレングス形式の2値画像データに復号して画像処理を施した場合の処理量とを比較し、処理量の少ないデータ形式の2値画像データに復号した後、画像処理を施して処理後の2値画像データを出力する。   According to the present invention, an image processing apparatus (computer) decodes entropy-encoded binary image data into bitmap-format binary image data and performs image processing, and a run length. Compare the amount of processing when image processing is performed after decoding binary image data in a format, and after decoding into binary image data in a data format with a small amount of processing, the binary after processing is subjected to image processing Output image data.

本発明によれば、2値画像に対して画像処理を施す場合の処理効率を高めることができる。   According to the present invention, it is possible to increase processing efficiency when image processing is performed on a binary image.

以下、図面を参照して本発明の実施形態について説明する。
[A.第1実施形態]
図1は、本発明の第1実施形態に係る画像処理装置1の主要部を示すブロック図である。同図に示すように画像処理装置1は、画像格納部11と、ランレングス変換部12と、ランレングス処理部13と、ビットマップ変換部14と、ビットマップ処理部15と、データ形式選択部16と、画像入出力部17と、制御部18とを有している。なお、画像処理装置1は、2値画像に対して、拡大、縮小、回転、反転等の画像処理を施す機能を有するCADシステムや複写機、ファクシミリ、パーソナルコンピュータ等である。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[A. First Embodiment]
FIG. 1 is a block diagram showing main parts of an image processing apparatus 1 according to the first embodiment of the present invention. As shown in FIG. 1, the image processing apparatus 1 includes an image storage unit 11, a run length conversion unit 12, a run length processing unit 13, a bitmap conversion unit 14, a bitmap processing unit 15, and a data format selection unit. 16, an image input / output unit 17, and a control unit 18. The image processing apparatus 1 is a CAD system, a copier, a facsimile, a personal computer, or the like having a function of performing image processing such as enlargement, reduction, rotation, and reversal on a binary image.

画像格納部11は、画素像処理を施す2値画像データや、画像処理の途中または処理後の2値画像データを格納するメモリである。ランレングス変換部12は、ビットマップ形式の2値画像データをランレングス形式の2値画像データに変換する。ランレングス処理部13は、ランレングス形式の2値画像データに対し、拡大、縮小、回転、反転等の画像処理を施す。ビットマップ変換部14は、ランレングス形式の2値画像データをビットマップ形式の2値画像データに変換する。ビットマップ処理部15は、ビットマップ形式の2値画像データに対し、拡大、縮小、回転、反転等の画像処理を施す。   The image storage unit 11 is a memory for storing binary image data to be subjected to pixel image processing and binary image data during or after image processing. The run-length conversion unit 12 converts binary image data in bitmap format into binary image data in run-length format. The run length processing unit 13 performs image processing such as enlargement, reduction, rotation, and reversal on the binary image data in the run length format. The bitmap converter 14 converts the run-length format binary image data into the bitmap format binary image data. The bitmap processing unit 15 performs image processing such as enlargement, reduction, rotation, and reversal on the binary image data in the bitmap format.

データ形式選択部16は、画像処理を施す2値画像データについて、ビットマップ形式で画像処理を施した場合の処理コスト(処理量)と、ランレングス形式で画像処理を施した場合の処理コストとを比較し、処理コストが小さいデータ形式を選択する。画像入出力部17は、画像処理装置1の外部から2値画像データを入力して画像格納部11に格納したり、画像処理を終えた2値画像データを画像処理装置1の外部に出力する。また、この画像入出力部17は、2値画像を取り込むためのスキャナ部や、画像処理を終えた2値画像を表示するための表示部等を含んでいる。制御部18は、画像処理装置1の各部11〜17を制御する。   The data format selection unit 16 performs processing cost (processing amount) when image processing is performed in a bitmap format on binary image data subjected to image processing, and processing cost when image processing is performed in a run length format. And select a data format with a low processing cost. The image input / output unit 17 inputs binary image data from the outside of the image processing apparatus 1 and stores the binary image data in the image storage unit 11, or outputs the binary image data after image processing to the outside of the image processing apparatus 1. . The image input / output unit 17 includes a scanner unit for capturing a binary image, a display unit for displaying the binary image after image processing, and the like. The control unit 18 controls the units 11 to 17 of the image processing apparatus 1.

次に、ビットマップ形式とランレングス形式の2値画像データについて説明する。図2は、2値画像(縦13画素×横16画素)と、この2値画像の白の部分の画素値を0、黒の部分の画素値を1とした場合の、ビットマップ形式の2値画像データと、ランレングス形式の2値画像データとを示す図である。ビットマップ形式の2値画像データは、走査ライン(図中、横方向)毎に、0画素目から7画素目までと8画素目から15画素目までの8ビット単位で、各画素の画素値(2進数)を16進数に変換したものである。例えば、同図に示す2値画像の上から2行目の走査ラインについてみてみると、0画素目から7画素目までの各画素値は“01111011”、8画素目から15画素目までの画素値は“11001100”となる。これを各々16進数に変換すると、“7b”、“cc”となる。なお、同図に示すビットマップ形式の2値画像データにおいて、先頭に記述された「0x」は、後続するデータが16進数であることを示す識別子である。   Next, binary image data in the bitmap format and the run length format will be described. FIG. 2 shows a binary image (13 vertical pixels × 16 horizontal pixels) and 2 in the bitmap format when the pixel value of the white portion of this binary image is 0 and the pixel value of the black portion is 1. It is a figure which shows value image data and binary image data of a run length format. Binary image data in bitmap format is the pixel value of each pixel in units of 8 bits from the 0th pixel to the 7th pixel and from the 8th pixel to the 15th pixel for each scanning line (horizontal direction in the figure). (Binary number) is converted to a hexadecimal number. For example, looking at the scanning line in the second row from the top of the binary image shown in the figure, the pixel values from the 0th pixel to the 7th pixel are “011111011” and the pixels from the 8th pixel to the 15th pixel. The value is “11001100”. When these are converted into hexadecimal numbers, “7b” and “cc” are obtained. In the bitmap format binary image data shown in the figure, “0x” described at the head is an identifier indicating that the subsequent data is a hexadecimal number.

また、ランレングス形式の2値画像データは、走査ライン毎に、走査ラインに含まれる黒ランの数と、各黒ランの開始位置およびラン長を示す情報により構成されている。例えば、同図に示す2値画像の上から2行目の走査ラインについてみてみると、この走査ラインに含まれる黒ランの数は“3”、最初の黒ランの開始位置は“1(画素目)”で、そのラン長は“4(画素分)”、次の黒ランの開始位置は“6”でラン長は“4”、最後の黒ランの開始位置は“12”でラン長は“2”である。なお、走査ライン毎に記述される黒ランの数の代わりに、例えば(開始位置,ラン長)=(0,0)のように、実際には存在しないランデータを走査ライン毎にデータの末尾に付加し、走査ラインの終了を示すようにしてもよい。   The run-length binary image data is composed of information indicating the number of black runs included in the scan line, the start position of each black run, and the run length for each scan line. For example, when looking at the second scanning line from the top of the binary image shown in the figure, the number of black runs included in this scanning line is “3”, and the start position of the first black run is “1 (pixels). ”), The run length is“ 4 (for pixels) ”, the start position of the next black run is“ 6 ”, the run length is“ 4 ”, and the start position of the last black run is“ 12 ”. Is “2”. Instead of the number of black runs described for each scan line, for example, (start position, run length) = (0, 0), run data that does not actually exist is changed to the end of the data for each scan line. May be added to indicate the end of the scan line.

以降、本明細書では、2値画像を白黒画像とし、白画素の画素値を0、黒画素の画素値を1とする。また、ランレングス形式の2値画像データについては、図2に示したデータ構成を用いるものとする。勿論、これらについてはあくまで例示に過ぎず、例えば、白画素の画素値を1、黒画素の画素値を0としてもよい。また、ランレングス形式の2値画像データは、走査ライン毎に、白ランの数と、各白ランの開始位置およびラン長を示す情報により構成されていてもよい。また、開始位置とラン長の代わりに、開始位置と終了位置、あるいは開始位置と画素値の変化位置を示す情報を用いてもよい。   Hereinafter, in this specification, the binary image is a monochrome image, the pixel value of a white pixel is 0, and the pixel value of a black pixel is 1. For the run-length format binary image data, the data structure shown in FIG. 2 is used. Of course, these are merely examples, and for example, the pixel value of a white pixel may be 1 and the pixel value of a black pixel may be 0. Further, the binary image data in the run length format may be composed of information indicating the number of white runs, the start position of each white run, and the run length for each scanning line. Further, instead of the start position and the run length, information indicating the start position and the end position or the start position and the change position of the pixel value may be used.

図3は、データ形式選択部16の構成について示すブロック図である。同図に示すように、データ形式選択部16は、ラン数/ラン長計数部61と、ランレングス変換コスト算出部62と、ランレングス処理コスト算出部63と、ビットマップ変換コスト算出部64と、ビットマップ処理コスト算出部65と、処理手順制御部66とを有している。   FIG. 3 is a block diagram showing the configuration of the data format selection unit 16. As shown in the figure, the data format selection unit 16 includes a run number / run length counting unit 61, a run length conversion cost calculation unit 62, a run length processing cost calculation unit 63, and a bitmap conversion cost calculation unit 64. A bitmap processing cost calculation unit 65 and a processing procedure control unit 66.

ラン数/ラン長計数部61は、2値画像に含まれる黒ランの総数やラン長の総和を計数する。ランレングス変換コスト算出部62は、ランレングス変換部12においてビットマップ形式の2値画像データをランレングス形式の2値画像データに変換した場合の処理コストを算出する。ランレングス処理コスト算出部63は、ランレングス処理部13においてランレングス形式の2値画像データに対し、拡大、縮小、回転、反転等の画像処理を施した場合の処理コストを算出する。ビットマップ変換コスト算出部64は、ビットマップ変換部14においてランレングス形式の2値画像データをビットマップ形式の2値画像データに変換した場合の処理コストを算出する。ビットマップ処理コスト算出部65は、ビットマップ処理部15においてビットマップ形式の2値画像データに対し、拡大、縮小、回転、反転等の画像処理を施した場合の処理コストを算出する。処理手順制御部66は、データ形式選択部16の各部61〜65を制御する。   The run number / run length counting unit 61 counts the total number of black runs included in the binary image and the total run length. The run-length conversion cost calculation unit 62 calculates a processing cost when the run-length conversion unit 12 converts binary image data in the bitmap format into binary image data in the run-length format. The run-length processing cost calculation unit 63 calculates a processing cost when the run-length processing unit 13 performs image processing such as enlargement, reduction, rotation, and reversal on binary image data in the run-length format. The bitmap conversion cost calculation unit 64 calculates the processing cost when the bitmap conversion unit 14 converts binary image data in run-length format into binary image data in bitmap format. The bitmap processing cost calculation unit 65 calculates a processing cost when the bitmap processing unit 15 performs image processing such as enlargement, reduction, rotation, and inversion on binary image data in the bitmap format. The processing procedure control unit 66 controls the units 61 to 65 of the data format selection unit 16.

なお、処理コスト(処理量)は、データ形式の変換処理や画像処理に要する演算量、演算時間、演算プロセッサに加わる負荷量等である。   The processing cost (processing amount) includes the amount of calculation required for data format conversion processing and image processing, the calculation time, the amount of load applied to the calculation processor, and the like.

図4は、第1実施形態に係る画像処理装置1の動作について示すフローチャートである。例えば、ユーザによって、2値画像データと、この2値画像データに対して施される画像処理の内容(拡大、縮小、回転、反転等)とが指定されると、まず、データ形式選択部16(処理手順制御部66)は、指定された2値画像データがビットマップ形式であるか否かを判別する(ステップS1)。その結果、ビットマップ形式ではなくランレングス形式であった場合は(ステップS1:NO)、ステップS8に移行する。一方、ビットマップ形式であった場合(ステップS1:YES)、データ形式選択部16は、2値画像データ(ビットマップ形式)に対し、指定された画像処理を施した場合のビットマップ処理部15の処理コストを、ビットマップ処理コスト算出部65を用いて算出する(ステップS2)。   FIG. 4 is a flowchart illustrating the operation of the image processing apparatus 1 according to the first embodiment. For example, when the user designates binary image data and the contents of image processing (enlargement, reduction, rotation, inversion, etc.) performed on the binary image data, first, the data format selection unit 16 (Processing procedure control unit 66) determines whether or not the designated binary image data is in a bitmap format (step S1). As a result, when the run length format is used instead of the bitmap format (step S1: NO), the process proceeds to step S8. On the other hand, in the case of the bitmap format (step S1: YES), the data format selection unit 16 performs the designated image processing on the binary image data (bitmap format) 15. Is calculated using the bitmap processing cost calculator 65 (step S2).

ここで、ビットマップ処理コスト算出部65は、ビットマップ処理部15の性能に応じて予め定められたコスト算出係数Pbと、画像処理を施す2値画像の画像サイズ(横幅W、縦幅H)とを用いて、以下に示す(式1)によりビットマップ処理コストを算出する。なお、横幅Wや縦幅Hのデータは、例えば、ヘッダ情報として2値画像データに付加されている。
ビットマップ処理コスト=Pb×W×H …(式1)
Here, the bitmap processing cost calculation unit 65 includes a cost calculation coefficient Pb determined in advance according to the performance of the bitmap processing unit 15 and the image size (horizontal width W, vertical width H) of the binary image to be subjected to image processing. Are used to calculate the bitmap processing cost according to (Equation 1) shown below. Note that the data of the horizontal width W and the vertical width H is added to the binary image data as header information, for example.
Bitmap processing cost = Pb × W × H (Formula 1)

なお、画像サイズ以外の要因(例えば、2値画像の全画素数や黒画素の占める割合等)を組み込んだコスト算出式を用いてビットマップ処理コストを算出してもよい。また、ビットマップ処理コストについて正確な値を算出しようとすると、コストの算出自体に時間を要してしまい、全体の性能を下げてしまうことになる。このため、上述したステップS2では、ある程度の精度を持ったビットマップ処理コストの値が簡易に算出できればよい。   Note that the bitmap processing cost may be calculated using a cost calculation formula that incorporates factors other than the image size (for example, the total number of pixels of the binary image and the proportion of black pixels). In addition, if it is attempted to calculate an accurate value for the bitmap processing cost, it takes time to calculate the cost itself, thereby reducing the overall performance. For this reason, in the above-described step S2, it is only necessary that the bitmap processing cost value having a certain degree of accuracy can be easily calculated.

次いで、データ形式選択部16は、画像処理を施す2値画像(ビットマップ形式)に含まれる黒ランの総数を、ラン数/ラン長計数部61を用いて計数する(ステップS3)。ここで、2値画像(ビットマップ形式)に含まれる黒ランの総数を計数する場合、2値画像データ内の各画素値を走査順序に従って1ビットずつチェックしながら黒ランの数を計数していかなければならないが、これでは黒ランの計数に長い時間を要してしまう。そこで、本実施形態に係る画像処理装置1では、以下に説明する方法を用いて、黒ランの総数を短時間のうちに計数できるようにしている。   Next, the data format selection unit 16 counts the total number of black runs included in the binary image (bitmap format) subjected to image processing using the run number / run length counting unit 61 (step S3). Here, when counting the total number of black runs included in a binary image (bitmap format), the number of black runs is counted while checking each pixel value in the binary image data bit by bit in accordance with the scanning order. However, this requires a long time to count black runs. Therefore, in the image processing apparatus 1 according to the present embodiment, the total number of black runs can be counted in a short time by using the method described below.

すなわち、まず、画像処理装置1において図示を省略したメモリには、ビットマップ形式の2値画像データから走査順序に従って8ビットずつ読み出される画素値について、“00000000”〜“11111111”までの計256通りの各パターン毎に、この8ビット内に含まれる黒ランの数を示したテーブル80a,80b(図5参照)が格納されている。このテーブル80a,80bは、前回読み出された8ビットの画素値における最後尾の画素値(以降、本明細書では「直前画素の値」と記載する)が0用のテーブル80aと、1用のテーブル80bとに分けられている。また、「id」の項目には、“00000000”〜“11111111”までの計256通りの各パターンについて、8ビットの画素値を十進数に変換した場合の値が、また「run」の項目には、黒ランの数が格納されている。   That is, first, in the memory not shown in the image processing apparatus 1, a total of 256 pixel values from “00000000” to “11111111” are read out from the binary image data in the bitmap format in units of 8 bits according to the scanning order. Tables 80a and 80b (see FIG. 5) indicating the number of black runs included in the 8 bits are stored for each pattern. The tables 80a and 80b are a table 80a in which the last pixel value (hereinafter referred to as “the value of the immediately preceding pixel” in the 8-bit pixel value read out last time) is 0 and 1 And the table 80b. In addition, the “id” item includes values obtained by converting 8-bit pixel values into decimal numbers for a total of 256 patterns from “00000000” to “11111111”. Stores the number of black runs.

画像処理装置1は、ビットマップ形式の2値画像データから走査順序に従って8ビットずつ画素値を読み出す。また、画像処理装置1は、直前画素の値が0であるのか1であるのかを判別し、テーブル80aまたはテーブル80bのどちらを参照するのかを決定する。なお、直前画素の値は、前回読み出した8ビットの画素値と“0x01”のAND演算によって判別され、直前画素の値が0ならばテーブル80aが、1ならばテーブル80bが参照される。そして、画像処理装置1は、読み出した8ビットの画素値を10進数に変換し、変換後の値を引数として直前画素の値に応じてテーブル80aまたはテーブル80bから黒ランの数を取得し、これを順次繰り返すことで、画像処理を施す2値画像(ビットマップ形式)に含まれる黒ランの総数を得る。   The image processing apparatus 1 reads out pixel values by 8 bits from the binary image data in the bitmap format according to the scanning order. Further, the image processing apparatus 1 determines whether the value of the immediately preceding pixel is 0 or 1 and determines whether to refer to the table 80a or the table 80b. Note that the value of the immediately preceding pixel is determined by an AND operation of “0x01” with the previously read 8-bit pixel value, and if the value of the immediately preceding pixel is 0, the table 80a is referenced. Then, the image processing apparatus 1 converts the read 8-bit pixel value into a decimal number, acquires the number of black runs from the table 80a or the table 80b according to the value of the immediately preceding pixel using the converted value as an argument, By repeating this sequentially, the total number of black runs included in the binary image (bitmap format) subjected to image processing is obtained.

具体的に説明すると、例えば、図6(a)に示すように、直前画素の値が0(白)で、かつ今回読み出された8ビットデータ(8ビットの画素値)が“11100100”である場合、画像処理装置1は、直前画素の値が0用のテーブル80aから、今回の8ビットデータ“11100100”を10進数に変換した値“229”を引数として黒ランの数“2”を得る。なお、図6(a)からも明らかなように、今回の8ビットデータ内における黒ランの数は2である。次に、図6(b)に示すように、直前画素の値が0で、かつ今回読み出された8ビットデータが“00111111”である場合、画像処理装置1は、直前画素の値が0用のテーブル80aから、今回の8ビットデータを10進数に変換した値“63”を引数として黒ランの数“0”を得る。なお、図6(b)においては、今回の8ビットデータ内に黒ランが1つ存在しているが、この黒ランは、今回の8ビットデータの最後尾まで続いているので、次に読み出される8ビットデータ内の黒ランと連続している可能性がある。このため、図6(b)に示すような場合、画像処理装置1は、今回の8ビットデータ内における黒ランの数を0とカウントするのである。   More specifically, for example, as shown in FIG. 6A, the value of the previous pixel is 0 (white), and the 8-bit data (8-bit pixel value) read this time is “11100100”. If there is, the image processing apparatus 1 uses the value “229” obtained by converting the current 8-bit data “11100100” into a decimal number from the table 80a where the value of the previous pixel is 0 and uses the black run number “2” as an argument. obtain. As is clear from FIG. 6A, the number of black runs in the current 8-bit data is two. Next, as illustrated in FIG. 6B, when the value of the previous pixel is 0 and the 8-bit data read this time is “00111111”, the image processing apparatus 1 sets the value of the previous pixel to 0. From the table 80a, the black run number “0” is obtained with the value “63” obtained by converting the current 8-bit data into a decimal number as an argument. In FIG. 6B, there is one black run in the current 8-bit data, but since this black run continues to the end of the current 8-bit data, it is read next. May be continuous with black runs in 8-bit data. Therefore, in the case shown in FIG. 6B, the image processing apparatus 1 counts the number of black runs in the current 8-bit data as zero.

また、図6(c)に示すように、直前画素の値が1(黒)で、かつ今回読み出された8ビットデータが“11100100”である場合、画像処理装置1は、直前画素の値が1用のテーブル80bから、今回の8ビットデータを10進数に変換した値“229”を引数として黒ランの数“2”を得る。なお、図6(c)においては、今回の8ビットデータ内に、前回の8ビットデータから続く1つの黒ランと、それ以外の1つの黒ランが存在しているので、画像処理装置1は、今回の8ビットデータ内における黒ランの数を2とカウントするのである。   Further, as shown in FIG. 6C, when the value of the immediately preceding pixel is 1 (black) and the 8-bit data read this time is “11100100”, the image processing apparatus 1 determines the value of the immediately preceding pixel. The number of black runs “2” is obtained from the table 80b for 1 with the value “229” obtained by converting the current 8-bit data into a decimal number as an argument. In FIG. 6C, since there is one black run following the previous 8-bit data and one other black run in the current 8-bit data, the image processing apparatus 1 The number of black runs in the current 8-bit data is counted as 2.

一方、図6(d)に示すように、直前画素の値が1(黒)で、かつ今回読み出された8ビットデータが“00111111”である場合、画像処理装置1は、直前画素の値が1用のテーブル80bから、今回の8ビットデータを10進数に変換した値“63”を引数として黒ランの数“1”を得る。なお、図6(d)においては、今回の8ビットデータ内に存在する1つの黒ランが8ビットデータの最後尾まで続いているため、今回の8ビットデータ内に黒ランは無いことになるが、直前画素が黒(1)で、かつ今回の8ビットデータ内における先頭の画素が白(0)であるため、前回の8ビットデータ内の最後尾にあった黒ランが終了していることがわかる。このため、図6(d)に示すような場合、画像処理装置1は、今回の8ビットデータ内における黒ランの数を1とカウントするのである。   On the other hand, as shown in FIG. 6D, when the value of the previous pixel is 1 (black) and the 8-bit data read this time is “00111111”, the image processing apparatus 1 determines the value of the previous pixel. The number of black runs “1” is obtained from the table 80b for 1 with the value “63” obtained by converting the current 8-bit data into a decimal number as an argument. In FIG. 6D, since one black run existing in the current 8-bit data continues to the end of the 8-bit data, there is no black run in the current 8-bit data. However, since the immediately preceding pixel is black (1) and the first pixel in the current 8-bit data is white (0), the black run at the end of the previous 8-bit data is completed. I understand that. For this reason, in the case shown in FIG. 6D, the image processing apparatus 1 counts the number of black runs in the current 8-bit data as 1.

なお、各走査ラインの先頭部分については、直前画素が存在しないので直前画素を白(0)とみなす。また、各走査ラインの最後の8ビットデータについては、最後尾の画素が黒(1)である場合、黒ランのカウント数を1加算する。   Note that the immediately preceding pixel is regarded as white (0) because the immediately preceding pixel does not exist for the head portion of each scanning line. For the last 8-bit data of each scanning line, when the last pixel is black (1), the black run count is incremented by one.

以上説明したように、図4に示したステップS3においてラン数/ラン長計数部61は、ビットマップ形式の2値画像データについて、8ビットずつ、テーブル80a,80bを参照しながら黒ランの数を求め、これを加算していくことで2値画像(ビットマップ形式)に含まれる黒ランの総数を得る。よって、2値画像データ内の各画素値を走査順序に従って1ビットずつチェックしながら黒ランの数を計数していく場合と比較して、2値画像に含まれる黒ランの総数を短時間のうちに計数できる。   As described above, in step S3 shown in FIG. 4, the run number / run length counting unit 61 makes the number of black runs 8 bits at a time for bitmap image binary image data with reference to the tables 80a and 80b. Are obtained and added together to obtain the total number of black runs included in the binary image (bitmap format). Therefore, compared with the case where the number of black runs is counted while checking each pixel value in the binary image data bit by bit according to the scanning order, the total number of black runs included in the binary image is reduced in a short time. You can count it out.

なお、ここでは、8ビット単位で黒ランの数を計数していく場合について説明したが、黒ランの数を計数していく1回当たりのビット数は、8に限定されず任意である。黒ランの数を計数していく1回当たりのビット数が大きい程、一度にチェックできる画素数が増えるので、黒ランの総数をより短時間のうちに計数できる。また、上述したステップS3においてラン数/ラン長計数部61は、2値画像データ(ビットマップ形式)内の各画素値を走査順序に従って1ビットずつチェックしながら黒ランの数を計数してもよい。   Here, the case where the number of black runs is counted in units of 8 bits has been described, but the number of bits per time for counting the number of black runs is not limited to 8 and is arbitrary. The larger the number of bits per time for counting the number of black runs, the greater the number of pixels that can be checked at a time, so the total number of black runs can be counted in a shorter time. In step S3, the run number / run length counting unit 61 may count the number of black runs while checking each pixel value in the binary image data (bitmap format) one bit at a time in accordance with the scanning order. Good.

また、画像処理装置1は、画像処理装置1に入力された2値画像データがビットマップ形式であった場合や、画像処理装置1において作成された2値画像データがビットマップ形式であった場合に、この2値画像に含まれる黒ランの総数を計数し、計数された黒ランの総数を2値画像データと対応付けて画像格納部11に記憶しておく構成であってもよい。この場合、上述したステップS3においてラン数/ラン長計数部61は、画像処理を施す2値画像と対応付けられて画像格納部11に記憶されている黒ランの総数を読み出すことで、この2値画像に含まれる黒ランの総数を得ることができる。   The image processing apparatus 1 also has a case where the binary image data input to the image processing apparatus 1 is in the bitmap format, or the binary image data created in the image processing apparatus 1 is in the bitmap format. Alternatively, the total number of black runs included in the binary image may be counted, and the total number of black runs counted may be stored in the image storage unit 11 in association with the binary image data. In this case, in step S3 described above, the run number / run length counting unit 61 reads out the total number of black runs stored in the image storage unit 11 in association with the binary image to be subjected to image processing. The total number of black runs included in the value image can be obtained.

さて、ステップS3において黒ランの総数を計数した後、次いで、データ形式選択部16は、画像処理を施す2値画像データ(ビットマップ形式)をランレングス形式の2値画像データに変換した場合のランレングス変換部12の処理コストを、ランレングス変換コスト算出部62を用いて算出する。また、データ形式選択部16は、ランレングス形式に変換した後の2値画像データに対し、指定された画像処理を施した場合のランレングス処理部13の処理コストを、ランレングス処理コスト算出部63を用いて算出する(ステップS4)。   Now, after counting the total number of black runs in step S3, the data format selection unit 16 then converts the binary image data (bitmap format) subjected to image processing into binary image data in the run length format. The processing cost of the run length conversion unit 12 is calculated using the run length conversion cost calculation unit 62. Further, the data format selection unit 16 calculates the processing cost of the run length processing unit 13 when the specified image processing is performed on the binary image data after being converted into the run length format, as a run length processing cost calculation unit. It calculates using 63 (step S4).

ここで、ランレングス変換コスト算出部62は、ランレングス変換部12の性能に応じて予め定められたコスト算出係数Trと、ステップS3において求められた黒ランの総数Rとを用いて、以下に示す(式2)によりランレングス変換コストを算出する。
ランレングス変換コスト=Tr×R …(式2)
Here, the run length conversion cost calculation unit 62 uses the cost calculation coefficient Tr determined in advance according to the performance of the run length conversion unit 12 and the total number R of black runs obtained in step S3 as follows. The run length conversion cost is calculated according to the following (Equation 2).
Run-length conversion cost = Tr × R (Formula 2)

なお、(式2)の代わりに以下に示す(式3)を用いてランレングス変換コストを算出してもよい。この(式3)は、2値画像データの読み込みやラン検出に要する処理のコスト(2値画像の全画素数に比例する)と、ラン検出を行う場合に必要となる走査ライン毎の初期処理のコスト(2値画像の縦幅Hに比例する)を考慮したものであり、Trs,Trhは、ランレングス変換部12の性能に応じて予め定められるコスト算出係数である。
ランレングス変換コスト=Tr×R+Trs×W×H+Trh×H …(式3)
Note that the run-length conversion cost may be calculated using (Expression 3) shown below instead of (Expression 2). This (Equation 3) is the processing cost required for reading binary image data and run detection (proportional to the total number of pixels of the binary image), and the initial processing for each scan line required for run detection. (Which is proportional to the vertical width H of the binary image), Trs and Trh are cost calculation coefficients determined in advance according to the performance of the run-length conversion unit 12.
Run-length conversion cost = Tr × R + Trs × W × H + Trh × H (Equation 3)

また、ランレングス処理コスト算出部63は、ランレングス処理部13の性能に応じて予め定められたコスト算出係数Prと、ステップS3において求められた黒ランの総数Rとを用いて、以下に示す(式4)によりランレングス処理コストを算出する。
ランレングス処理コスト=Pr×R …(式4)
The run length processing cost calculation unit 63 uses the cost calculation coefficient Pr determined in advance according to the performance of the run length processing unit 13 and the total number R of black runs obtained in step S3 as follows. The run length processing cost is calculated from (Equation 4).
Run-length processing cost = Pr × R (Formula 4)

なお、(式4)の代わりに以下に示す(式5)を用いてランレングス処理コストを算出してもよい。この(式5)は、走査ライン毎の初期処理のコスト(2値画像の縦幅Hに比例する)を考慮したものであり、Prhは、ランレングス処理部13の性能に応じて予め定められるコスト算出係数である。
ランレングス処理コスト=Pr×R+Prh×H …(式5)
Note that the run-length processing cost may be calculated using (Expression 5) shown below instead of (Expression 4). This (Equation 5) considers the cost of initial processing for each scanning line (proportional to the vertical width H of the binary image), and Prh is determined in advance according to the performance of the run length processing unit 13. This is a cost calculation coefficient.
Run-length processing cost = Pr × R + Prh × H (Formula 5)

また、ビットマップ処理コストの場合と同様に、ランレングス変換コストやランレングス処理コストについても正確な値を算出しようとすると、コストの算出自体に時間を要してしまい、全体の性能を下げてしまうことになる。このため、上述したステップS4では、ある程度の精度を持ったランレングス変換コストやランレングス処理コストの値が簡易に算出できればよい。   Also, as with bitmap processing costs, if you try to calculate accurate values for run-length conversion costs and run-length processing costs, the cost calculation itself will take time, reducing overall performance. Will end up. For this reason, in the above-described step S4, it is only necessary that the run-length conversion cost and the run-length processing cost with a certain degree of accuracy can be easily calculated.

次いで、データ形式選択部16は、ステップS4において算出されたランレングス変換コストとランレングス処理コストを加算し、加算されたコストと、ステップS2において算出されたビットマップ処理コストとを比較する(ステップS5)。その結果、ビットマップ処理コストの方が小さい場合(ステップS5:YES)、データ形式選択部16は、画像処理を施す2値画像データ(ビットマップ形式)を画像格納部11から読み出してビットマップ処理部15へ送信する。ビットマップ処理部15は、受信した2値画像データに対し、拡大、縮小、回転、反転等の指定された画像処理を施す(ステップS6)。そして、ビットマップ処理部15により処理された2値画像データが、画像入出力部17によって、例えば、表示されたり、印刷のために画像処理装置1の外部へ出力される。   Next, the data format selection unit 16 adds the run-length conversion cost calculated in step S4 and the run-length processing cost, and compares the added cost with the bitmap processing cost calculated in step S2 (step S2). S5). As a result, when the bitmap processing cost is smaller (step S5: YES), the data format selection unit 16 reads binary image data (bitmap format) to be subjected to image processing from the image storage unit 11 and performs bitmap processing. To the unit 15. The bitmap processing unit 15 performs designated image processing such as enlargement, reduction, rotation, and reversal on the received binary image data (step S6). Then, the binary image data processed by the bitmap processing unit 15 is displayed or output to the outside of the image processing apparatus 1 for printing, for example, by the image input / output unit 17.

一方、ビットマップ処理コストの方が大きい場合(ステップS5:NO)、データ形式選択部16は、画像処理を施す2値画像データ(ビットマップ形式)を画像格納部11から読み出してランレングス変換部12へ送信する。ランレングス変換部12は、受信した2値画像データをランレングス形式の2値画像データに変換し、ランレングス処理部13へ送信する。ランレングス処理部13は、受信した2値画像データ(ランレングス形式)に対し、指定された画像処理を施す(ステップS7)。そして、ランレングス処理部13により処理された2値画像データが画像入出力部17によって出力される。   On the other hand, when the bitmap processing cost is higher (step S5: NO), the data format selection unit 16 reads out binary image data (bitmap format) to be subjected to image processing from the image storage unit 11 and executes a run length conversion unit. 12 to send. The run-length conversion unit 12 converts the received binary image data into binary image data in the run-length format and transmits it to the run-length processing unit 13. The run-length processing unit 13 performs designated image processing on the received binary image data (run-length format) (step S7). Then, the binary image data processed by the run length processing unit 13 is output by the image input / output unit 17.

これに対し、ステップS1において、2値画像データがビットマップ形式ではなくランレングス形式であると判別された場合(ステップS1:NO)、まず、データ形式選択部16は、画像処理を施す2値画像(ランレングス形式)に含まれる黒ランの総数とラン長の総和を、ラン数/ラン長計数部61を用いて計数する(ステップS8)。   On the other hand, when it is determined in step S1 that the binary image data is not in the bitmap format but in the run length format (step S1: NO), first, the data format selection unit 16 performs binary processing for image processing. The total number of black runs included in the image (run length format) and the total run length are counted using the run number / run length counting unit 61 (step S8).

ここで、ランレングス形式の場合、2値画像に含まれる黒ランの総数は、図2に示したランレングス形式の2値画像データにおいて、各走査ライン毎に先頭に記述してあるラン数を全て加算すれば求めることができる。なお、前述したように、ラン数を各走査ライン毎にその先頭に記述する代わりに、終了コードとして(0,0)等のデータが走査ライン毎にデータの最後尾に付加されている場合は、(開始位置,ラン長)の総数から終了コードの総数を減算することで黒ランの総数を算出できる。また、ラン長の総和については、ランレングス形式の2値画像データであれば、各ラン長の値を全て加算すれば求めることができる。また、ランデータが(開始位置,ラン長)ではなく、例えば、(開始位置,終了位置)の場合は、終了位置−開始位置+1で各ラン長を求めることができるので、このようにして求めた各ラン長の値を全て加算してやればよい。   Here, in the case of the run length format, the total number of black runs included in the binary image is the number of runs described at the beginning of each scan line in the binary image data in the run length format shown in FIG. It can be obtained by adding all of them. As described above, instead of describing the number of runs at the head of each scan line, data such as (0, 0) is added as the end code to the end of the data for each scan line. The total number of black runs can be calculated by subtracting the total number of end codes from the total number of (start position, run length). The total run length can be obtained by adding all the run length values in the case of binary image data in the run length format. Further, when the run data is not (start position, run length) but, for example, (start position, end position), each run length can be obtained from end position-start position + 1. All the run length values may be added.

次いで、データ形式選択部16は、画像処理を施す2値画像データ(ランレングス形式)に対し、指定された画像処理を施した場合のランレングス処理部13の処理コストを、ランレングス処理コスト算出部63を用いて算出する(ステップS9)。このステップS9の処理は、前述したステップS4におけるランレングス処理コストの算出処理と同じであり、ランレングス処理コスト算出部63は、前述した(式4)または(式5)を用いてランレングス処理コストを算出する。   Next, the data format selection unit 16 calculates the run-length processing cost as the processing cost of the run-length processing unit 13 when the specified image processing is performed on the binary image data (run-length format) on which image processing is performed. It calculates using the part 63 (step S9). The process in step S9 is the same as the run length process cost calculation process in step S4 described above, and the run length process cost calculation unit 63 uses the above-described (expression 4) or (expression 5) to execute the run length process. Calculate the cost.

この後、データ形式選択部16は、画像処理を施す2値画像データ(ランレングス形式)をビットマップ形式の2値画像データに変換した場合のビットマップ変換部14の処理コストを、ビットマップ変換コスト算出部64を用いて算出する。また、データ形式選択部16は、ビットマップ形式に変換した後の2値画像データに対し、指定された画像処理を施した場合のビットマップ処理部15の処理コストを、ビットマップ処理コスト算出部65を用いて算出する(ステップS10)。   Thereafter, the data format selection unit 16 converts the processing cost of the bitmap conversion unit 14 when the binary image data (run-length format) subjected to image processing into bitmap format binary image data is converted into a bitmap. Calculation is performed using the cost calculation unit 64. Further, the data format selection unit 16 determines the processing cost of the bitmap processing unit 15 when the designated image processing is performed on the binary image data after being converted into the bitmap format, as a bitmap processing cost calculation unit. It calculates using 65 (step S10).

ここで、ランレングス形式からビットマップ形式への変換に要する処理コストは、2値画像に含まれる黒ランの総数とラン長の総和に依存するので、ビットマップ変換コスト算出部64は、ステップS8において求めた黒ランの総数Rおよびラン長の総和Nと、ビットマップ変換部14の性能に応じて予め定められたコスト算出係数Tbr,Tbnを用いて、以下に示す(式6)によりビットマップ変換コストを算出する。また、ビットマップ処理コストは、前述した(式1)により算出される。
ビットマップ変換コスト=Tbr×R+Tbn×N …(式6)
Here, since the processing cost required for conversion from the run-length format to the bitmap format depends on the total number of black runs and the total run length included in the binary image, the bitmap conversion cost calculation unit 64 performs step S8. Using the total number R of black runs R and the sum N of run lengths and cost calculation coefficients Tbr, Tbn determined in advance according to the performance of the bitmap conversion unit 14, the bitmap is expressed by the following (Equation 6): Calculate the conversion cost. Further, the bitmap processing cost is calculated by the above-described (Equation 1).
Bitmap conversion cost = Tbr × R + Tbn × N (Expression 6)

勿論、ステップS10においても、ある程度の精度を持ったビットマップ変換コストやビットマップ処理コストの値が簡易に算出できればよい。また、ラン長の総和Nは、2値画像に含まれる黒画素の総数と一致するから、ラン長の総和Nの代わりに2値画像に含まれる黒画素の総数を用いてもよい。   Of course, it is only necessary that the bitmap conversion cost and the bitmap processing cost with a certain degree of accuracy can be easily calculated in step S10. Further, since the total length N of run lengths matches the total number of black pixels included in the binary image, the total number of black pixels included in the binary image may be used instead of the total length N of run lengths.

次いで、データ形式選択部16は、ステップS10において算出されたビットマップ変換コストとビットマップ処理コストを加算し、加算されたコストと、ステップS9において算出されたランレングス処理コストとを比較する(ステップS11)。その結果、ランレングス処理コストの方が小さい場合(ステップS11:YES)、データ形式選択部16は、画像処理を施す2値画像データ(ランレングス形式)を画像格納部11から読み出してランレングス処理部13へ送信する。ランレングス処理部13は、受信した2値画像データに対し、拡大、縮小、回転、反転等の指定された画像処理を施す(ステップS12)。そして、ランレングス処理部13により処理された2値画像データが画像入出力部17によって出力される。   Next, the data format selection unit 16 adds the bitmap conversion cost calculated in Step S10 and the bitmap processing cost, and compares the added cost with the run length processing cost calculated in Step S9 (Step S9). S11). As a result, when the run-length processing cost is smaller (step S11: YES), the data format selection unit 16 reads binary image data (run-length format) to be subjected to image processing from the image storage unit 11 and executes the run-length processing. To the unit 13. The run length processing unit 13 performs designated image processing such as enlargement, reduction, rotation, and reversal on the received binary image data (step S12). Then, the binary image data processed by the run length processing unit 13 is output by the image input / output unit 17.

一方、ランレングス処理コストの方が大きい場合(ステップS11:NO)、データ形式選択部16は、画像処理を施す2値画像データ(ランレングス形式)を画像格納部11から読み出してビットマップ変換部14へ送信する。ビットマップ変換部14は、受信した2値画像データをビットマップ形式の2値画像データに変換し、ビットマップ処理部15へ送信する。ビットマップ処理部15は、受信した2値画像データ(ビットマップ形式)に対し、指定された画像処理を施す(ステップS13)。そして、ビットマップ処理部15により処理された2値画像データが画像入出力部17によって出力される。   On the other hand, when the run-length processing cost is higher (step S11: NO), the data format selection unit 16 reads binary image data (run-length format) to be subjected to image processing from the image storage unit 11 and performs a bitmap conversion unit. 14 to send. The bitmap conversion unit 14 converts the received binary image data into binary image data in the bitmap format, and transmits it to the bitmap processing unit 15. The bitmap processing unit 15 performs designated image processing on the received binary image data (bitmap format) (step S13). Then, the binary image data processed by the bitmap processing unit 15 is output by the image input / output unit 17.

以上説明したように本実施形態によれば、画像処理装置1は、画像処理を施す2値画像について、ビットマップ形式の場合の処理コストと、ランレングス形式の場合の処理コストとを比較し、処理コストの小さいデータ形式を選択して2値画像に画像処理を施し、処理後の2値画像を出力する。よって、ビットマップ形式とランレングス形式を使い分けることで2値画像に対して画像処理を施す場合の処理効率を高めることができる。   As described above, according to the present embodiment, the image processing apparatus 1 compares the processing cost in the case of the bitmap format with the processing cost in the case of the run length format for the binary image subjected to image processing, A data format with a low processing cost is selected, image processing is performed on the binary image, and the processed binary image is output. Therefore, by using the bitmap format and the run length format properly, it is possible to increase the processing efficiency when image processing is performed on the binary image.

[B.第2実施形態]
次に第2実施形態について説明する。なお、本実施形態において第1実施形態と共通する部分には同一の符号を使用し、その説明を省略する。
[B. Second Embodiment]
Next, a second embodiment will be described. In addition, in this embodiment, the same code | symbol is used for the part which is common in 1st Embodiment, and the description is abbreviate | omitted.

図7は、本発明の第2実施形態に係る画像処理装置2の主要部を示すブロック図である。同図に示す画像処理装置2が第1実施形態において説明した画像処理装置1と異なるのは、ランレングス変換部12の代わりにランレングス復号部19を、ビットマップ変換部14の代わりにビットマップ復号部20を、データ形式選択部16の代わりにデータ形式選択部21を備えている点である。また、本実施形態において、2値画像データは、例えば、MH(Modified Huffman)方式やLZ(Lampel-Ziv)方式等のエントロピー符号化方式を用いて符号化されている。ランレングス復号部19は、エントロピー符号化されている2値画像データをランレングス形式の2値画像データに復号する。また、ビットマップ復号部20は、エントロピー符号化されている2値画像データをビットマップ形式の2値画像データに復号する。   FIG. 7 is a block diagram showing a main part of the image processing apparatus 2 according to the second embodiment of the present invention. The image processing apparatus 2 shown in the figure is different from the image processing apparatus 1 described in the first embodiment in that a run length decoding unit 19 is used instead of the run length converting unit 12 and a bit map is used instead of the bitmap converting unit 14. The decoding unit 20 includes a data format selection unit 21 instead of the data format selection unit 16. In this embodiment, the binary image data is encoded using an entropy encoding method such as an MH (Modified Huffman) method or an LZ (Lampel-Ziv) method. The run-length decoding unit 19 decodes entropy-encoded binary image data into run-length format binary image data. In addition, the bitmap decoding unit 20 decodes the entropy-encoded binary image data into bitmap image binary image data.

また、図8に示すように本実施形態に係るデータ形式選択部21が第1実施形態において説明したデータ形式選択部16と異なるのは、ラン数/ラン長計数部61の代わりにラン数推定部67を、ランレングス変換コスト算出部62の代わりにランレングス復号コスト算出部68を、ビットマップ変換コスト算出部64の代わりにビットマップ復号コスト算出部69を備えている点である。   As shown in FIG. 8, the data format selection unit 21 according to the present embodiment is different from the data format selection unit 16 described in the first embodiment in that the run number estimation is performed instead of the run number / run length counting unit 61. The unit 67 includes a run length decoding cost calculation unit 68 instead of the run length conversion cost calculation unit 62 and a bitmap decoding cost calculation unit 69 instead of the bitmap conversion cost calculation unit 64.

ラン数推定部67は、エントロピー符号化された2値画像データを復号した後のデータサイズ(データ量)を、例えば、ヘッダ情報として付与されている画像サイズを示す情報(横幅W、縦幅H)を用いて2値画像データを復号せずに求め、その値とエントロピー符号化された2値画像データのデータサイズから2値画像データの圧縮率を算出する。また、ラン数推定部67は、算出した圧縮率から、この2値画像に含まれる黒ランの総数を推定する。ここで、エントロピー符号化では、一般的に2値画像内の画素値の変化が激しい程、すなわち、2値画像に含まれる黒ランの数が多く、かつ黒ランについて平均のラン長が短い程、圧縮率が低下する。そこで、例えば、図9に示すように、圧縮率と、2値画像の全画素数に対する黒ランの総数の割合との関係を示したテーブル81を画像処理装置2のメモリ(図示省略)に記憶しておき、ラン数推定部67は、このテーブル81を参照して、圧縮率から2値画像に含まれる黒ランの総数を推定する。   The run number estimation unit 67 uses the data size (data amount) after decoding the entropy-encoded binary image data, for example, information indicating the image size given as header information (horizontal width W, vertical width H). The binary image data is calculated without decoding, and the compression rate of the binary image data is calculated from the value and the data size of the entropy-encoded binary image data. In addition, the run number estimation unit 67 estimates the total number of black runs included in the binary image from the calculated compression rate. Here, in entropy coding, generally, the more drastic changes in pixel values in a binary image are, that is, the greater the number of black runs included in a binary image and the shorter the average run length for black runs. , The compression rate decreases. Therefore, for example, as shown in FIG. 9, a table 81 showing the relationship between the compression rate and the ratio of the total number of black runs to the total number of pixels of the binary image is stored in the memory (not shown) of the image processing apparatus 2. The run number estimation unit 67 refers to the table 81 and estimates the total number of black runs included in the binary image from the compression rate.

例えば、圧縮率が0.45であり、2値画像の全画素数が1000であった場合、ラン数推定部67は、図9に示したテーブル81を参照し、この2値画像に含まれる黒ランの総数を20と推定する。なお、テーブル81は、予め多数の2値画像(エントロピー符号化とビットマップ形式)を調査して得られた、圧縮率と全画素数に対する黒ランの総数の割合についての統計値に基づいて作成されている。   For example, when the compression rate is 0.45 and the total number of pixels of the binary image is 1000, the run number estimation unit 67 refers to the table 81 shown in FIG. 9 and is included in this binary image. Estimate the total number of black runs to 20. The table 81 is created based on a statistical value regarding the compression ratio and the ratio of the total number of black runs to the total number of pixels, which is obtained by investigating a large number of binary images (entropy coding and bitmap format) in advance. Has been.

また、ランレングス復号コスト算出部68は、エントロピー符号化された2値画像データをランレングス形式の2値画像データに復号した場合のランレングス復号部19の処理コストを算出する。このランレングス復号コスト算出部68は、ランレングス復号部19の性能に応じて予め定められた1ラン当りの復号コスト係数Drと、ラン数推定部67において求められた黒ランの総数Rとを用いて、以下に示す(式7)によりランレングス復号コストを算出する。
ランレングス復号コスト=Dr×R …(式7)
The run-length decoding cost calculation unit 68 calculates the processing cost of the run-length decoding unit 19 when entropy-encoded binary image data is decoded into run-length format binary image data. The run-length decoding cost calculation unit 68 calculates a decoding cost coefficient Dr per run determined in advance according to the performance of the run-length decoding unit 19 and the total number R of black runs obtained by the run number estimation unit 67. Then, the run-length decoding cost is calculated by (Equation 7) shown below.
Run-length decoding cost = Dr × R (Expression 7)

なお、符号データの読み込み処理を考慮し、符号データ量Dと、単位データ量当たりの読み出しコスト係数Ddを用いて、(式7)の代わりに以下に示す(式8)によりランレングス復号コストを算出してもよい。
ランレングス復号コスト=Dr×R+Dd×D …(式8)
In consideration of the code data reading process, the run-length decoding cost is calculated by (Expression 8) shown below instead of (Expression 7) using the encoded data amount D and the read cost coefficient Dd per unit data amount. It may be calculated.
Run-length decoding cost = Dr × R + Dd × D (Equation 8)

また、ランレングス変換コストの場合と同様に、ランレングス復号コストについても正確な値を算出しようとすると、コストの算出自体に時間を要してしまい、全体の性能を下げてしまうことになるので、ある程度の精度を持ったランレングス復号コストが簡易に算出できればよい。   Also, as with the run-length conversion cost, if an accurate value is calculated for the run-length decoding cost, it will take time to calculate the cost itself, and the overall performance will be reduced. It is only necessary that the run-length decoding cost with a certain degree of accuracy can be easily calculated.

一方、ビットマップ復号コスト算出部69は、エントロピー符号化された2値画像データをビットマップ形式の2値画像データに復号した場合のビットマップ復号部20の処理コストを算出する。このビットマップ復号コスト算出部69は、ビットマップ復号部20の性能に応じて予め定められた1ラン当りの復号コスト係数Dbと、ラン数推定部67において求められた黒ランの総数Rとを用いて、以下に示す(式9)によりビットマップ復号コストを算出する。勿論、上述した(式8)に示したように、符号データの読み込み処理等を考慮してビットマップ復号コストを算出するようにしてもよい。
ビットマップ復号コスト=Db×R …(式9)
On the other hand, the bitmap decoding cost calculation unit 69 calculates the processing cost of the bitmap decoding unit 20 when the entropy-encoded binary image data is decoded into the binary image data in the bitmap format. The bitmap decoding cost calculation unit 69 uses a decoding cost coefficient Db per run determined in advance according to the performance of the bitmap decoding unit 20 and the total number R of black runs obtained by the run number estimation unit 67. Then, the bitmap decoding cost is calculated by (Equation 9) shown below. Of course, as shown in (Equation 8) described above, the bitmap decoding cost may be calculated in consideration of the code data reading process and the like.
Bitmap decoding cost = Db × R (Equation 9)

なお、ビットマップ復号コストには、ラン長の総和(=2値画像に含まれる黒画素の総数)も関連すると考えられる。しかしながら、エントロピー符号化された2値画像データからラン長の総和を求めるためには、ビットマップ形式の2値画像データに復号する処理と略同等の処理コストが必要になる場合が多いので、(式9)において平均のラン長が略一定であるとして係数Dbにその分の処理コストを組み込むか、圧縮率に依存する関数を設定して(式9)に追加する等の方法が考えられる。   The bitmap decoding cost is considered to be related to the total run length (= total number of black pixels included in the binary image). However, in order to obtain the sum of the run lengths from the entropy-encoded binary image data, the processing cost almost equal to the processing for decoding into the binary image data in the bitmap format is often required. Assuming that the average run length is substantially constant in equation (9), the processing cost corresponding to the coefficient Db is incorporated, or a function depending on the compression rate is set and added to (equation 9).

そして、本実施形態に係る画像処理装置2では、例えば、ユーザによって、2値画像データ(エントロピー符号化)と、この2値画像データに対して施される画像処理の内容(拡大、縮小、回転、反転等)とが指定されると、まず、データ形式選択部21は、ランレングス復号コスト、ランレングス処理コスト、ビットマップ復号コスト、ビットマップ処理コストを算出する。次いで、データ形式選択部21は、ランレングス復号コスト+ランレングス処理コストと、ビットマップ復号コスト+ビットマップ処理コストとを比較し、処理コストの小さいデータ形式を選択する。これにより、ランレングス形式の2値画像データに復号して画像処理を施すのか、それともビットマップ形式の2値画像データに復号して画像処理を施すのかが決定される。この後、2値画像データ(エントロピー符号化)がデータ形式選択部21によって選択されたデータ形式の2値画像データに復号され、指定された画像処理が施される。そして、画像処理が施された後の2値画像データが画像入出力部17によって出力される。   In the image processing apparatus 2 according to the present embodiment, for example, the user performs binary image data (entropy coding) and contents of image processing (enlargement, reduction, rotation) performed on the binary image data. First, the data format selection unit 21 calculates a run length decoding cost, a run length processing cost, a bitmap decoding cost, and a bitmap processing cost. Next, the data format selection unit 21 compares the run length decoding cost + run length processing cost with the bitmap decoding cost + bitmap processing cost, and selects a data format with a low processing cost. As a result, it is determined whether the image processing is performed by decoding the binary image data in the run length format or the image processing is performed by decoding the binary image data in the bitmap format. Thereafter, binary image data (entropy coding) is decoded into binary image data in the data format selected by the data format selection unit 21 and subjected to designated image processing. Then, the binary image data after the image processing is output by the image input / output unit 17.

以上説明したように本実施形態によれば、画像処理装置2は、エントロピー符号化された2値画像データについて、ビットマップ形式の2値画像データに復号して画像処理を施した場合の処理コストと、ランレングス形式の2値画像データに復号して画像処理を施した場合の処理コストとを比較し、処理コストの小さいデータ形式の2値画像データに復号した後、画像処理を施して処理後の2値画像データを出力する。よって、ビットマップ形式とランレングス形式を使い分けることで2値画像に対して画像処理を施す場合の処理効率を高めることができる。   As described above, according to the present embodiment, the image processing apparatus 2 processes the entropy-encoded binary image data by decoding the binary image data in the bitmap format and performing image processing. Is compared with the processing cost when the image processing is performed by decoding the binary image data in the run length format, and the image processing is performed after the decoding to the binary image data in the data format having a low processing cost. The later binary image data is output. Therefore, by using the bitmap format and the run length format properly, it is possible to increase the processing efficiency when image processing is performed on the binary image.

[C.変形例]
(1)画像処理を施した後の2値画像のデータ形式がビットマップ形式またはランレングス形式に指定された場合は、指定されたデータ形式への変換コストをさらに加味して画像処理を施す際のデータ形式を選択する構成としてもよい。例えば、画像処理を施す前の2値画像データがビットマップ形式であり、画像処理を施した後のデータ形式もビットマップ形式が指定された場合、第1実施形態に係る画像処理装置1は、ビットマップ処理コストと、ランレングス変換コスト+ランレングス処理コスト+ビットマップ変換コストとを比較し、処理コストの小さいデータ形式を画像処理を施す際のデータ形式として選択する。また、画像処理を施す前の2値画像データがビットマップ形式であり、画像処理を施した後のデータ形式としてランレングス形式が指定された場合、画像処理装置1は、ビットマップ処理コスト+ランレングス変換コストと、ランレングス変換コスト+ランレングス処理コストとを比較し、画像処理を施す際のデータ形式を選択する。
[C. Modified example]
(1) When the data format of the binary image after the image processing is designated as the bitmap format or the run length format, the image processing is performed in consideration of the conversion cost to the designated data format. The data format may be selected. For example, when the binary image data before image processing is in the bitmap format and the data format after image processing is also designated as the bitmap format, the image processing apparatus 1 according to the first embodiment The bitmap processing cost is compared with the run length conversion cost + run length processing cost + bitmap conversion cost, and a data format with a low processing cost is selected as a data format for performing image processing. In addition, when the binary image data before image processing is in the bitmap format and the run length format is designated as the data format after the image processing, the image processing apparatus 1 performs the bitmap processing cost + run The length conversion cost is compared with the run length conversion cost + run length processing cost, and a data format for performing image processing is selected.

(2)拡大、縮小、回転、反転等の画像処理の種類に応じてビットマップ処理コストやランレングス処理コストの値が変わる場合には、例えば、画像処理の種類毎に用意された係数をコスト算出式に組み込む等してビットマップ処理コストやランレングス処理コストを算出する構成としてもよい。例えば、画像処理の種類として拡大が指定された場合、前述した(式2)における黒ランの総数Rに対して拡大倍率Zを乗算するとともに、画像サイズを示す横幅Wと縦幅Hのそれぞれに対して拡大倍率Zを乗算すればよい。 (2) When the value of the bitmap processing cost or the run length processing cost changes according to the type of image processing such as enlargement, reduction, rotation, inversion, etc., for example, a coefficient prepared for each type of image processing is used as the cost. A configuration may be adopted in which the bitmap processing cost and the run length processing cost are calculated by being incorporated in the calculation formula. For example, when enlargement is specified as the type of image processing, the total number R of black runs in (Equation 2) described above is multiplied by the enlargement magnification Z, and each of the horizontal width W and vertical width H indicating the image size is multiplied. What is necessary is just to multiply the enlargement magnification Z.

(3)エントロピー符号化された2値画像データをビットマップ形式の2値画像データに復号する場合、まず、ランレングス形式の2値画像データに復号した後に、これをビットマップ形式の2値画像データに変換する方法を採用することが多い。そこで、図10に示すようにビットマップ復号部20の代わりにビットマップ変換部14を備え、ビットマップ復号コストの算出も、ランレングス復号コスト+ビットマップ変換コストとして算出する構成としてもよい。 (3) When decoding entropy-encoded binary image data into binary image data in bitmap format, first, it is decoded into binary image data in run-length format, and then this is converted into a binary image in bitmap format. A method of converting to data is often adopted. Therefore, as shown in FIG. 10, a bitmap conversion unit 14 may be provided instead of the bitmap decoding unit 20, and the calculation of the bitmap decoding cost may also be calculated as the run length decoding cost + the bitmap conversion cost.

(4)画像処理装置1〜3(コンピュータ)は、図示を省略したメモリにインストールされているプログラムに従って本発明に係る処理(例えば、図4に示した処理)を実行するが、このようなプログラムを、通信によって画像処理装置1〜3に提供するようにしてもよい。あるいは、このようなプログラムを記録媒体に記録して提供するようにしてもよい。 (4) The image processing apparatuses 1 to 3 (computers) execute the processing according to the present invention (for example, the processing shown in FIG. 4) according to a program installed in a memory (not shown). May be provided to the image processing apparatuses 1 to 3 by communication. Alternatively, such a program may be provided by being recorded on a recording medium.

本発明の第1実施形態に係る画像処理装置1の主要部を示すブロック図である。1 is a block diagram illustrating a main part of an image processing apparatus 1 according to a first embodiment of the present invention. 同実施形態に係り、ビットマップ形式とランレングス形式の2値画像データについて説明するための図である。4 is a diagram for explaining binary image data in a bitmap format and a run-length format according to the embodiment. FIG. 同実施形態に係り、データ形式選択部16の構成を示すブロック図である。4 is a block diagram showing a configuration of a data format selection unit 16 according to the same embodiment. FIG. 同実施形態に係る画像処理装置1の動作について示すフローチャートである。4 is a flowchart illustrating an operation of the image processing apparatus 1 according to the embodiment. 同実施形態に係り、テーブル80a,80bのデータ構成を示す図である。It is a figure which concerns on the same embodiment and shows the data structure of tables 80a and 80b. 同実施形態に係り、黒ランの計数する動作について説明するための図である。It is a figure for demonstrating the operation | movement which counts a black run concerning the embodiment. 第2実施形態に係る画像処理装置2の主要部を示すブロック図である。It is a block diagram which shows the principal part of the image processing apparatus 2 which concerns on 2nd Embodiment. 同実施形態に係り、データ形式選択部21の構成を示すブロック図である。4 is a block diagram illustrating a configuration of a data format selection unit 21 according to the embodiment. FIG. 同実施形態に係り、圧縮率と、2値画像の全画素数に対する黒ランの総数の割合との関係を示したテーブル81のデータ構成を示す図である。It is a figure which shows the data structure of the table 81 which showed the relationship between the compression rate and the ratio of the total number of black runs with respect to the total number of pixels of a binary image concerning the embodiment. 変形例(3)係る画像処理装置3の主要部を示すブロック図である。It is a block diagram which shows the principal part of the image processing apparatus 3 which concerns on a modification (3).

符号の説明Explanation of symbols

1,2,3…画像処理装置、11…画像格納部、12…ランレングス変換部、13…ランレングス処理部、14…ビットマップ変換部、15…ビットマップ処理部、16,21…データ形式選択部、17…画像入出力部、18…制御部、19…ランレングス復号部、20…ビットマップ復号部、61…ラン数/ラン長計数部、62…ランレングス変換コスト算出部、63…ランレングス処理コスト算出部、64…ビットマップ変換コスト算出部、65…ビットマップ処理コスト算出部、66…処理手順制御部、67…ラン数推定部、68…ランレングス復号コスト算出部、69…ビットマップ復号コスト算出部、80a,80b,81…テーブル。   DESCRIPTION OF SYMBOLS 1, 2, 3 ... Image processing apparatus, 11 ... Image storage part, 12 ... Run length conversion part, 13 ... Run length processing part, 14 ... Bit map conversion part, 15 ... Bit map processing part, 16, 21 ... Data format Selection unit, 17 ... Image input / output unit, 18 ... Control unit, 19 ... Run length decoding unit, 20 ... Bitmap decoding unit, 61 ... Run number / run length counting unit, 62 ... Run length conversion cost calculation unit, 63 ... Run length processing cost calculation unit, 64 ... Bitmap conversion cost calculation unit, 65 ... Bitmap processing cost calculation unit, 66 ... Processing procedure control unit, 67 ... Run number estimation unit, 68 ... Run length decoding cost calculation unit, 69 ... Bitmap decoding cost calculation unit, 80a, 80b, 81... Table.

Claims (13)

画像処理を施す2値画像のデータ形式を特定する特定手段と、
前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をビットマップ形式とした場合とランレングス形式とした場合の各々について、前記2値画像から得られる情報を用いて算出する第1の算出手段と、
前記第1の算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、
前記特定手段により特定されたデータ形式が前記選択手段により選択されたデータ形式と異なる場合に、前記2値画像のデータ形式を前記選択手段により選択されたデータ形式に変換する変換手段と、
前記選択手段により選択されたデータ形式の前記2値画像に対して画像処理を施す画像処理手段と、
前記画像処理手段により処理された2値画像を出力する出力手段と
を具備することを特徴とする画像処理装置。
Specifying means for specifying the data format of a binary image to be subjected to image processing;
The amount of processing when image processing is performed on the binary image is obtained from the binary image when the data format of the binary image is a bitmap format and when it is a run-length format. First calculating means for calculating using information;
Selection means for comparing the processing amount calculated by the first calculation means in the case of the bitmap format and in the case of the run length format, and selecting a data format having a small processing amount;
Conversion means for converting the data format of the binary image into the data format selected by the selection means when the data format specified by the specification means is different from the data format selected by the selection means;
Image processing means for performing image processing on the binary image in the data format selected by the selection means;
An image processing apparatus comprising: output means for outputting a binary image processed by the image processing means.
ビットマップ形式とランレングス形式のうち、前記特定手段により特定されたデータ形式と異なるデータ形式に前記2値画像のデータ形式を変換した場合の処理量を、前記2値画像から得られる情報を用いて算出する第2の算出手段をさらに具備し、
前記第1の算出手段は、ビットマップ形式の場合とランレングス形式の場合の処理量のうち、前記特定手段により特定されたデータ形式と異なるデータ形式の処理量については、前記第2の算出手段により算出された処理量を加算する
ことを特徴とする請求項1に記載の画像処理装置。
Of the bitmap format and the run length format, the processing amount when the data format of the binary image is converted to a data format different from the data format specified by the specifying means is obtained using information obtained from the binary image. A second calculating means for calculating
The first calculation means uses the second calculation means for the processing amount of the data format different from the data format specified by the specifying means among the processing amounts in the case of the bitmap format and the run length format. The image processing apparatus according to claim 1, wherein the processing amount calculated by the step is added.
前記第1の算出手段は、前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をビットマップ形式とした場合については、前記2値画像の画像サイズを用いて算出する
ことを特徴とする請求項1に記載の画像処理装置。
The first calculation means sets the processing amount when image processing is performed on the binary image, and the image size of the binary image when the data format of the binary image is a bitmap format. The image processing apparatus according to claim 1, wherein the calculation is performed using
前記第1の算出手段は、前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をランレングス形式とした場合については、前記2値画像に含まれる、いずれか一方の画素値についてのランの数を用いて算出する
ことを特徴とする請求項1に記載の画像処理装置。
The first calculation means includes a processing amount when image processing is performed on the binary image, and a case where the data format of the binary image is a run-length format. The image processing apparatus according to claim 1, wherein the calculation is performed using the number of runs for one of the pixel values.
前記第2の算出手段は、前記2値画像のデータ形式をランレングス形式へ変換する場合の処理量を、前記2値画像に含まれる、いずれか一方の画素値についてのランの数を用いて算出する
ことを特徴とする請求項2に記載の画像処理装置。
The second calculation means uses the number of runs for any one of the pixel values included in the binary image to calculate the processing amount when converting the data format of the binary image to a run-length format. The image processing apparatus according to claim 2, wherein the image processing apparatus is calculated.
前記第2の算出手段は、前記2値画像のデータ形式をビットマップ形式へ変換する場合の処理量を、前記2値画像に含まれる、いずれか一方の画素値についてのランの数と前記画素値を有する画素の数を用いて算出する
ことを特徴とする請求項2に記載の画像処理装置。
The second calculation means determines the amount of processing when the data format of the binary image is converted to the bitmap format, the number of runs for any one of the pixel values included in the binary image, and the pixel The image processing apparatus according to claim 2, wherein calculation is performed using the number of pixels having a value.
当該画像処理装置に入力された2値画像または当該画像処理装置において作成された2値画像のデータ形式がビットマップ形式であった場合に、前記2値画像に含まれる、いずれか一方の画素値についてのランの数を計数する計数手段と、
前記計数手段により計数されたランの数を前記2値画像と対応付けて記憶する記憶手段とをさらに具備し、
前記第1の算出手段は、前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をランレングス形式とした場合については、前記記憶手段に記憶されているランの数を用いて算出する
ことを特徴とする請求項4に記載の画像処理装置。
One of the pixel values included in the binary image when the data format of the binary image input to the image processing device or the binary image created in the image processing device is a bitmap format Counting means for counting the number of runs for
Storage means for storing the number of runs counted by the counting means in association with the binary image;
The first calculating means stores the processing amount when image processing is performed on the binary image, and is stored in the storage means when the data format of the binary image is a run-length format. The image processing apparatus according to claim 4, wherein the calculation is performed using the number of runs.
ビットマップ形式の2値画像データから走査順序に従って画素値をnビット(nは2以上の整数)ずつ読み出す読出手段と、
前記読出手段により読み出されたnビットの画素値の直前の画素値を判別する判別手段と、
前記nビットの画素値毎に、当該nビットの画素値に含まれる、いずれか一方の画素値についてのランの数を前記直前の画素値に応じて2種類有するデータを記憶する記憶手段と、
前記読出手段により読み出されたnビットの画素値と、前記判別手段により判別された直前の画素値と、前記記憶手段に記憶されているデータとに基づいて、前記2値画像データに含まれるランの数を計数する計数手段とをさらに具備し、
前記第1の算出手段は、前記特定手段によりビットマップ形式であることが特定された場合、前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をランレングス形式とした場合については、前記計数手段により計数されたランの数を用いて算出する
ことを特徴とする請求項4に記載の画像処理装置。
Reading means for reading out pixel values n bits (n is an integer of 2 or more) from the binary image data in the bitmap format according to the scanning order;
Discrimination means for discriminating a pixel value immediately before the n-bit pixel value read by the reading means;
Storage means for storing, for each n-bit pixel value, data having two types of run numbers for any one of the pixel values included in the n-bit pixel value according to the immediately preceding pixel value;
Included in the binary image data based on the n-bit pixel value read by the reading means, the previous pixel value determined by the determining means, and the data stored in the storage means A counting means for counting the number of runs;
The first calculating means determines the processing amount when the binary image is subjected to image processing when the specifying means specifies the bitmap format, and the data format of the binary image. The image processing apparatus according to claim 4, wherein the run length format is calculated using the number of runs counted by the counting unit.
エントロピー符号化された2値画像データを復号して画像処理を施した場合の処理量を、前記2値画像データをビットマップ形式の2値画像データに復号した場合とランレングス形式の2値画像データに復号した場合の各々について算出する第1の算出手段と、
前記第1の算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、
前記エントロピー符号化された2値画像データを、前記選択手段により選択されたデータ形式の2値画像データに復号する復号手段と、
前記復号手段により復号された2値画像データに対して画像処理を施す画像処理手段と、
前記画像処理手段により処理された2値画像データを出力する出力手段と
を具備することを特徴とする画像処理装置。
The amount of processing when the entropy-encoded binary image data is decoded and subjected to image processing is the same as when the binary image data is decoded into the binary image data in the bitmap format and the binary image in the run length format. First calculating means for calculating each of the data when decrypted;
Selection means for comparing the processing amount calculated by the first calculation means in the case of the bitmap format and in the case of the run length format, and selecting a data format having a small processing amount;
Decoding means for decoding the entropy-encoded binary image data into binary image data in the data format selected by the selection means;
Image processing means for performing image processing on the binary image data decoded by the decoding means;
An image processing apparatus comprising: output means for outputting binary image data processed by the image processing means.
エントロピー符号化された2値画像データを復号した後のデータ量を特定する特定手段と、
前記エントロピー符号化された2値画像データのデータ量と、前記特定手段により特定されたデータ量とを用いて前記2値画像データの圧縮率を算出する第2の算出手段と、
圧縮率毎に、2値画像に含まれるいずれか一方の画素値についてのランの数を示す情報を記憶する記憶手段とをさらに具備し、
前記第1の算出手段は、ビットマップ形式の2値画像データに復号した場合とランレングス形式の2値画像データに復号した場合の各々の処理量を、前記第2の算出手段により算出された圧縮率と前記記憶手段に記憶されている情報とに基づいて特定されるランの数を用いて算出する
ことを特徴とする請求項9に記載の画像処理装置。
A specifying means for specifying a data amount after decoding entropy-encoded binary image data;
Second calculating means for calculating a compression rate of the binary image data using the data amount of the entropy-encoded binary image data and the data amount specified by the specifying means;
Storage means for storing information indicating the number of runs for one of the pixel values included in the binary image for each compression rate;
The first calculation means calculates the amount of processing when decoding into binary image data in bitmap format and when decoding into binary image data in run length format by the second calculation means. The image processing apparatus according to claim 9, wherein calculation is performed using a number of runs specified based on a compression rate and information stored in the storage unit.
コンピュータを、
画像処理を施す2値画像のデータ形式を特定する特定手段と、
前記2値画像に対して画像処理を施した場合の処理量を、前記2値画像のデータ形式をビットマップ形式とした場合とランレングス形式とした場合の各々について、前記2値画像から得られる情報を用いて算出する算出手段と、
前記算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、
前記特定手段により特定されたデータ形式が前記選択手段により選択されたデータ形式と異なる場合に、前記2値画像のデータ形式を前記選択手段により選択されたデータ形式に変換する変換手段と、
前記選択手段により選択されたデータ形式の前記2値画像に対して画像処理を施す画像処理手段と、
前記画像処理手段により処理された2値画像を出力する出力手段と
として機能させるためのプログラム。
Computer
Specifying means for specifying the data format of a binary image to be subjected to image processing;
The amount of processing when image processing is performed on the binary image is obtained from the binary image when the data format of the binary image is a bitmap format and when it is a run-length format. A calculation means for calculating using information;
Selection means for comparing the processing amount calculated in the case of the bitmap format and the run length format calculated by the calculation means, and selecting a data format with a small processing amount;
Conversion means for converting the data format of the binary image into the data format selected by the selection means when the data format specified by the specification means is different from the data format selected by the selection means;
Image processing means for performing image processing on the binary image in the data format selected by the selection means;
A program for functioning as output means for outputting a binary image processed by the image processing means.
コンピュータを、
エントロピー符号化された2値画像データを復号して画像処理を施した場合の処理量を、前記2値画像データをビットマップ形式の2値画像データに復号した場合とランレングス形式の2値画像データに復号した場合の各々について算出する算出手段と、
前記算出手段により算出された、ビットマップ形式の場合とランレングス形式の場合の処理量を比較し、処理量の少ないデータ形式を選択する選択手段と、
前記エントロピー符号化された2値画像データを、前記選択手段により選択されたデータ形式の2値画像データに復号する復号手段と、
前記復号手段により復号された2値画像データに対して画像処理を施す画像処理手段と、
前記画像処理手段により処理された2値画像データを出力する出力手段と
として機能させるためのプログラム。
Computer
The amount of processing when the entropy-encoded binary image data is decoded and subjected to image processing is the same as when the binary image data is decoded into the binary image data in the bitmap format and the binary image in the run length format. A calculation means for calculating each of the decrypted data,
Selection means for comparing the processing amount calculated in the case of the bitmap format and the run length format calculated by the calculation means, and selecting a data format with a small processing amount;
Decoding means for decoding the entropy-encoded binary image data into binary image data in the data format selected by the selection means;
Image processing means for performing image processing on the binary image data decoded by the decoding means;
A program for functioning as output means for outputting binary image data processed by the image processing means.
請求項11または12に記載のプログラムを記録したコンピュータ読み取り可能な記録媒体。   The computer-readable recording medium which recorded the program of Claim 11 or 12.
JP2004113563A 2004-04-07 2004-04-07 Image processor, program, and recording medium Pending JP2005301457A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004113563A JP2005301457A (en) 2004-04-07 2004-04-07 Image processor, program, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004113563A JP2005301457A (en) 2004-04-07 2004-04-07 Image processor, program, and recording medium

Publications (1)

Publication Number Publication Date
JP2005301457A true JP2005301457A (en) 2005-10-27

Family

ID=35332946

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004113563A Pending JP2005301457A (en) 2004-04-07 2004-04-07 Image processor, program, and recording medium

Country Status (1)

Country Link
JP (1) JP2005301457A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4865864B2 (en) * 2006-09-11 2012-02-01 アップル インコーポレイテッド Complexity recognition coding
JP2016506187A (en) * 2013-01-30 2016-02-25 インテル コーポレイション Content adaptive entropy coding of partition data for next generation video
US9875435B2 (en) 2016-03-10 2018-01-23 Fuji Xerox Co., Ltd. Drawing data generation apparatus
GB2561807A (en) * 2017-01-12 2018-10-31 Imagination Tech Ltd Computing systems and methods for processing graphics data using cost indications for sets of tiles of a rendering space

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4865864B2 (en) * 2006-09-11 2012-02-01 アップル インコーポレイテッド Complexity recognition coding
JP2016506187A (en) * 2013-01-30 2016-02-25 インテル コーポレイション Content adaptive entropy coding of partition data for next generation video
US9686551B2 (en) 2013-01-30 2017-06-20 Intel Corporation Content adaptive entropy coding of partitions data for next generation video
US9875435B2 (en) 2016-03-10 2018-01-23 Fuji Xerox Co., Ltd. Drawing data generation apparatus
GB2561807A (en) * 2017-01-12 2018-10-31 Imagination Tech Ltd Computing systems and methods for processing graphics data using cost indications for sets of tiles of a rendering space
US10395336B2 (en) 2017-01-12 2019-08-27 Imagination Technologies Limited Computing systems and methods for processing graphics data using cost indications for sets of tiles of a rendering space
GB2561807B (en) * 2017-01-12 2019-09-25 Imagination Tech Ltd Computing systems and methods for processing graphics data using cost indications for sets of tiles of a rendering space
US10902550B2 (en) 2017-01-12 2021-01-26 Imagination Technologies Limited Computing systems and methods for processing graphics data using cost indications for sets of tiles of a rendering space
US11348197B2 (en) 2017-01-12 2022-05-31 Imagination Technologies Limited Computing systems and methods for processing graphics data using cost indications for sets of tiles of a rendering space

Similar Documents

Publication Publication Date Title
JP3108479B2 (en) Encoding / decoding method and apparatus therefor
US8428395B2 (en) Image processing apparatus, image display apparatus, image forming apparatus, image processing method and storage medium
JP5132517B2 (en) Image processing apparatus and image processing method
US7689048B2 (en) Image encoding apparatus, method, and computer-readable storage medium for encoding a pixel value
JP4979323B2 (en) Image processing apparatus and control method thereof
JP4176114B2 (en) Image compression apparatus, image reading apparatus including the same, image processing apparatus including the image compression apparatus, image forming apparatus including the same, and image compression processing method
US20060210176A1 (en) Image encoding apparatus, image decoding apparatus, control method therefor, computer program, and computer-readable storage medium
JP2008042688A (en) Image processing apparatus and control method thereof, and computer program and computer readable storage medium
US7085379B1 (en) Image compression device and image decompressing device, and computer-readable recorded medium on which program for allowing computer to execute image compressing method and image decompressing method
JP5893379B2 (en) Image compression apparatus, image compression method, and computer program
US8548233B2 (en) Image processing apparatus and compression method therefor
EP0902398A2 (en) System for compressing and decompressing binary representations of dithered images
JP3051432B2 (en) Image processing method and apparatus
JP2005301457A (en) Image processor, program, and recording medium
US6577768B1 (en) Coding method, code converting method, code converting apparatus, and image forming apparatus
US8649051B2 (en) Image composition device, image forming apparatus and computer readable medium storing program
JP3139460B2 (en) Method and apparatus for encoding binary document image
JP2007151134A (en) Image compression apparatus and image decompression apparatus, and computer-readable recording medium recorded with program for making computer run image compression method and image decompression method
JP3085932B2 (en) Apparatus for generating predicted image using mask and apparatus for compressing, transmitting and restoring binary image using the same
US6301300B1 (en) Method and apparatus for efficiently coding and decoding sparse images
JP5757904B2 (en) Image compression device
JP2008078826A (en) Image processor and its control method
JP4743884B2 (en) Image coding apparatus and control method thereof
JP2891818B2 (en) Encoding device
JP4526069B2 (en) Image information arithmetic coding apparatus and image information arithmetic decoding apparatus