Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP4867903B2 - Image processing program and image processing apparatus - Google Patents
[go: Go Back, main page]

JP4867903B2 - Image processing program and image processing apparatus - Google Patents

Image processing program and image processing apparatus Download PDF

Info

Publication number
JP4867903B2
JP4867903B2 JP2007316117A JP2007316117A JP4867903B2 JP 4867903 B2 JP4867903 B2 JP 4867903B2 JP 2007316117 A JP2007316117 A JP 2007316117A JP 2007316117 A JP2007316117 A JP 2007316117A JP 4867903 B2 JP4867903 B2 JP 4867903B2
Authority
JP
Japan
Prior art keywords
value
threshold
gradation value
binarization
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.)
Expired - Fee Related
Application number
JP2007316117A
Other languages
Japanese (ja)
Other versions
JP2009140244A (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.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2007316117A priority Critical patent/JP4867903B2/en
Publication of JP2009140244A publication Critical patent/JP2009140244A/en
Application granted granted Critical
Publication of JP4867903B2 publication Critical patent/JP4867903B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Description

本発明は、入力されたディジタル画像を二値化するための画像処理プログラム等に関し、特に、二値化のために不要な下地や背景を適切に除去することのできる画像処理プログラム等に関する。   The present invention relates to an image processing program or the like for binarizing an input digital image, and more particularly to an image processing program or the like that can appropriately remove an unnecessary background or background for binarization.

従来、各画素が多値の濃度階調値を有する画像データを二値化することが行なわれている。当該処理では、所定の閾値が設定されて、当該閾値より大きい濃度階調値を有する画素は白画素に、当該閾値より小さい濃度階調値を有する画素は黒画素に変換される。かかる画像の二値化処理は、画像をOCRで読み取る際に、帳票などを判別する際に、また、データ量を小さくして保存する際などに用いられる。   Conventionally, binarization is performed on image data in which each pixel has multi-value density gradation values. In this process, a predetermined threshold is set, and pixels having a density gradation value larger than the threshold are converted to white pixels, and pixels having a density gradation value smaller than the threshold are converted to black pixels. Such binarization processing of an image is used when an image is read by OCR, when a form or the like is discriminated, and when a data amount is reduced and stored.

下記特許文献1には、帳票の濃度画像を安定して二値化するための装置が記載され、対象画像の濃度ヒストグラムにおいて所定の濃度値付近に位置する複数の極小値を検出し、この検出された極小値の中から最小値となる極小値の濃度値を二値化しきい値として選択する、ことが示されている。
特開2002−150276号公報
The following Patent Document 1 describes an apparatus for stably binarizing a density image of a form, and detects a plurality of local minimum values located in the vicinity of a predetermined density value in a density histogram of a target image. It is shown that the density value of the minimum value, which is the minimum value, is selected as the binarization threshold value from the set minimum values.
JP 2002-150276 A

上述した画像の二値化処理では、対象画像において二値化後に黒色として残したい文字などが色の付いた背景の上に記載されている場合などがあり、文字等を明確に残すためには背景を的確に除去する(白画素とする)ことが必要となる。   In the binarization processing of the image described above, there are cases where characters etc. that are to be left as black after binarization in the target image are described on a colored background, etc., in order to leave the characters etc. clearly It is necessary to accurately remove the background (use white pixels).

上記特許文献1に記載の方法では、この背景除去のみを目的としていないので、二値化後に黒色として残しておきたい部分についても背景として除去されてしまう可能性がある。   Since the method described in Patent Document 1 is not intended to remove only the background, there is a possibility that a portion that should be left as black after binarization may be removed as the background.

そこで、本発明の目的は、入力されたディジタル画像を二値化するための画像処理プログラムであって、二値化のために不要な下地や背景を適切に除去することのできる画像処理プログラム、等を提供することである。   Accordingly, an object of the present invention is an image processing program for binarizing an input digital image, and an image processing program capable of appropriately removing an unnecessary background and background for binarization, Etc. is to provide.

上記の目的を達成するために、本発明の一つの側面は、多値の画像データを二値のデータとする二値化処理をコンピュータに実行させる画像処理プログラムにおいて、前記画像データは、各画素が、白色で最高値となり黒色で最低値となる階調値を有するデータであり、前記階調値の所定値から、前記階調値の高い順番に前記画素を所定個数ずつグルーピングし、グループ内における最高階調値と最低階調値の差が所定値よりも大きくなる各グループにおいて、同じ階調値を有している前記画素の個数が最も少ない当該階調値を閾値候補として検出する、処理を前記コンピュータに実行させ、前記検出された閾値候補の中から、前記二値化処理のための閾値が選択される、ことである。   In order to achieve the above object, according to one aspect of the present invention, there is provided an image processing program for causing a computer to execute binarization processing using multi-value image data as binary data. Is data having gradation values that are the highest value in white and the lowest value in black, and a predetermined number of pixels are grouped in descending order of the gradation value from the predetermined value of the gradation value. In each group in which the difference between the highest gradation value and the lowest gradation value is greater than a predetermined value, the gradation value having the smallest number of pixels having the same gradation value is detected as a threshold candidate. Processing is executed by the computer, and a threshold for the binarization processing is selected from the detected threshold candidates.

更に、上記の発明において、一つの態様は、前記選択された閾値は、当該閾値以上の前記階調値を有する画素を白色とする処理に用いられる、ことを特徴とする。   Furthermore, in the above-described invention, one aspect is characterized in that the selected threshold value is used for processing of whitening a pixel having the gradation value equal to or higher than the threshold value.

更に、上記の発明において、好ましい態様は、前記検出された閾値候補の中から、最も階調値の高い閾値候補が前記閾値として選択される、ことを特徴とする。   Furthermore, in the above invention, a preferred aspect is characterized in that a threshold candidate with the highest gradation value is selected as the threshold value from the detected threshold candidates.

更にまた、上記の発明において、好ましい態様は、前記検出された閾値候補の中で最も階調値の高い閾値候補の階調値が予め定められた所定値以上である場合には、前記階調値の低い画素の個数に応じて、2番目に階調値の高い前記閾値候補が前記閾値として選択される、ことを特徴とする。   Furthermore, in the above invention, a preferable aspect is that the gradation value of the threshold candidate having the highest gradation value among the detected threshold candidates is equal to or greater than a predetermined value. According to the number of pixels having a low value, the threshold candidate having the second highest gradation value is selected as the threshold value.

更に、上記の発明において、好ましい態様は、前記階調値が予め定められた最低値よりも小さい前記閾値候補は前記閾値として選択されない、ことを特徴とする。   Furthermore, in the above-mentioned invention, a preferred aspect is characterized in that the threshold candidate whose gradation value is smaller than a predetermined minimum value is not selected as the threshold value.

上記の目的を達成するために、本発明の別の側面は、多値の画像データを二値のデータとする二値化処理を実行する画像処理装置において、前記画像データは、各画素が、白色で最高値となり黒色で最低値となる階調値を有するデータであり、前記階調値の所定値から、前記階調値の高い順番に前記画素を所定個数ずつグルーピングし、グループ内における最高階調値と最低階調値の差が所定値よりも大きくなる各グループにおいて、同じ階調値を有している前記画素の個数が最も少ない当該階調値を閾値候補として検出し、前記検出された閾値候補の中から、前記二値化処理のための閾値が選択される、ことである。   In order to achieve the above object, according to another aspect of the present invention, there is provided an image processing apparatus that executes binarization processing using multi-value image data as binary data, wherein each pixel includes: This is data having a gradation value that is the highest value in white and the lowest value in black. The predetermined number of pixels are grouped in descending order of the gradation value from the predetermined value of the gradation value to obtain the highest value in the group. In each group in which the difference between the gradation value and the minimum gradation value is greater than a predetermined value, the gradation value with the smallest number of pixels having the same gradation value is detected as a threshold candidate, and the detection is performed. A threshold for the binarization process is selected from the threshold candidates that have been set.

本発明の更なる目的及び、特徴は、以下に説明する発明の実施の形態から明らかになる。   Further objects and features of the present invention will become apparent from the embodiments of the invention described below.

以下、図面を参照して本発明の実施の形態例を説明する。しかしながら、かかる実施の形態例が、本発明の技術的範囲を限定するものではない。なお、図において、同一又は類似のものには同一の参照番号又は参照記号を付して説明する。   Embodiments of the present invention will be described below with reference to the drawings. However, such an embodiment does not limit the technical scope of the present invention. In the drawings, the same or similar elements are denoted by the same reference numerals or reference symbols.

図1は、本発明を適用した画像処理装置の実施の形態例に係る機能構成図である。図1に示す二値化装置2が本発明を適用した画像処理装置であり、二値化対象画像の輝度(濃度)ヒストグラムにおいて、所定割合の度数を規定する輝度幅が所定幅以上になる部分から二値化のための閾値候補を検出して、当該候補の中から最も輝度の高い閾値候補または2番目に輝度の高い閾値候補を閾値として選択し、当該閾値よりも値の大きい画素については白画素とする処理を実行して、二値化における下地、背景除去の処理を適切に行なおうとするものである。   FIG. 1 is a functional configuration diagram according to an embodiment of an image processing apparatus to which the present invention is applied. A binarization device 2 shown in FIG. 1 is an image processing device to which the present invention is applied, and a portion of a luminance (density) histogram of a binarization target image in which a luminance width that defines a frequency of a predetermined ratio is a predetermined width or more Threshold value candidates for binarization are detected from the candidates, and the threshold candidate with the highest luminance or the second highest luminance candidate is selected as the threshold value from among the candidates, and pixels having a value larger than the threshold value are selected. By executing the processing for white pixels, the background and background removal processing in binarization is appropriately performed.

図1に示す本実施の形態例に係るシステムは、二値化対象画像の原稿を読み取る、いわゆるスキャナである画像読み取り装置1と、そのホスト装置であるホストコンピュータ等に備えられる上記二値化装置2とから構成される。   The system according to the present embodiment shown in FIG. 1 includes an image reading apparatus 1 that is a so-called scanner that reads a document of an image to be binarized, and the binarization apparatus provided in a host computer that is the host apparatus. 2 is comprised.

画像読み取り装置1は、ユーザ操作などに従って上記原稿の画像を光学的な方法により読み取り、読み取った画像をディジタル画像として出力する。このディジタル画像は、各画素が各色の濃度階調値を有する画像データとなっており、カラー画像として読み取った場合には、例えば、各画素がRGB各色の濃度階調値(例えば、0〜255の256階調)で表現される。また、グレースケールで読み取った場合には、1次元の濃度階調値(例えば、0〜255の256階調)で表現される。画像読み取り装置1では、このような画像データを二値化装置2に供給する。   The image reading device 1 reads the image of the original by an optical method according to a user operation or the like, and outputs the read image as a digital image. This digital image is image data in which each pixel has a density gradation value of each color, and when read as a color image, for example, each pixel has a density gradation value of each color of RGB (for example, 0 to 255). 256 gradations). When read in gray scale, it is expressed by a one-dimensional density gradation value (for example, 256 gradations from 0 to 255). The image reading device 1 supplies such image data to the binarization device 2.

次に、二値化装置2は、上述の通り、前記画像読み取り装置1のホストコンピュータ内に構築される。当該ホストコンピュータは、いわゆるパーソナルコンピュータなどで構成することができ、図示していないが、CPU、ROM、RAM、ハードディスク、他装置とのインターフェースなどを備える。   Next, the binarization apparatus 2 is constructed in the host computer of the image reading apparatus 1 as described above. The host computer can be constituted by a so-called personal computer and includes a CPU, a ROM, a RAM, a hard disk, an interface with other devices, etc. (not shown).

図1に示すとおり、二値化装置2は、機能的には、ヒストグラム作成部21、閾値候補検出部22、閾値択一部23、及び二値化処理部24を有し、前記画像読み取り装置1から供給される画像データに対して、ユーザ指示等に基づき、二値化処理を実行し、その結果の出力画像を出力する。これら各部21〜24は、上記ホストコンピュータのROMに格納される各種プログラム、当該プログラムに従って処理を実行する上記CPU、及び上記RAM等で構成される。なお、当該プログラムが本発明を適用した画像処理プログラムに相当し、例えば、上記画像読み取り装置1のドライバプログラムとして備えられる。また、当該プログラムは、CDなどの記憶媒体に格納されているものをホストコンピュータにインストールする、あるいは、所定のサイトからインターネットなどを介してホストコンピュータにダウンロードする、ことによってホストコンピュータに備えることができる。   As shown in FIG. 1, the binarization device 2 functionally includes a histogram creation unit 21, a threshold candidate detection unit 22, a threshold selection part 23, and a binarization processing unit 24, and the image reading device The binarization process is executed on the image data supplied from 1 based on a user instruction or the like, and the resulting output image is output. Each of these units 21 to 24 includes various programs stored in the ROM of the host computer, the CPU that executes processing according to the programs, the RAM, and the like. The program corresponds to an image processing program to which the present invention is applied. For example, the program is provided as a driver program for the image reading apparatus 1. Further, the program can be provided in the host computer by installing the program stored in a storage medium such as a CD in the host computer or by downloading the program from a predetermined site to the host computer via the Internet or the like. .

ヒストグラム作成部21は、上記画像読み取り装置1から供給され、上記RAMに格納される画像データについて、上記プログラムに従ったCPUの処理で、輝度値のヒストグラムを作成する部分である。具体的な処理については後述する。   The histogram creation unit 21 is a part that creates a histogram of luminance values for the image data supplied from the image reading apparatus 1 and stored in the RAM by the CPU processing according to the program. Specific processing will be described later.

閾値候補検出部22は、上記作成されたヒストグラムを用いて、上記プログラムに従ったCPUの処理により、閾値候補を検出し、当該検出した候補値を記憶する部分である。   The threshold candidate detection unit 22 is a part that detects a threshold candidate by the CPU processing according to the program using the created histogram and stores the detected candidate value.

また、閾値択一部23は、上記プログラムに従ったCPUの処理により、上記検出された閾値候補の中から一つの閾値を選択する部分である。上記閾値候補検出部22及び当該閾値択一部23による処理に特徴があり、その具体的な内容については後述する。   The threshold selection part 23 is a part for selecting one threshold from the detected threshold candidates by the processing of the CPU according to the program. The processing by the threshold candidate detection unit 22 and the threshold selection part 23 is characteristic, and specific contents thereof will be described later.

二値化処理部24は、上記プログラムに従ったCPUの処理により、前記閾値択一部23により選択された閾値を利用して、二値化対象画像から、黒画素として残す必要のない下地や背景の部分を除去する処理を実行し、その後、除去されなかった部分について、適宜、二値化の処理を実行して、二値化された対象画像を出力する部分である。   The binarization processing unit 24 uses the threshold value selected by the threshold selection part 23 by the processing of the CPU according to the above-described program, and from the binarization target image, the background or the like that does not need to be left as a black pixel. This is a part that executes a process of removing the background part, and then appropriately performs a binarization process on the part that has not been removed, and outputs a binarized target image.

以上説明したような構成を有する本実施の形態例に係る二値化装置2では、以下に示すような内容で各処理が実行される。   In the binarization apparatus 2 according to the present embodiment having the configuration described above, each process is executed with the following contents.

まず、ヒストグラム作成部21が、画像読み取り装置1から受け取ってRAM等に格納している画像データにつき、輝度値Yについてのヒストグラムを作成する。当該画像データがRGB色空間で表現されたデータである場合には、すなわち、前述したように各画素がRGBの各濃度階調値を有するデータである場合には、下記(1)式に従って、各画素の輝度値Yを求め、対象画像全体について、輝度値Y毎の画素数(度数)を求める。   First, the histogram creation unit 21 creates a histogram for the luminance value Y for the image data received from the image reading device 1 and stored in the RAM or the like. When the image data is data expressed in the RGB color space, that is, when each pixel has RGB density gradation values as described above, the following equation (1) is used. The luminance value Y of each pixel is obtained, and the number of pixels (frequency) for each luminance value Y is obtained for the entire target image.

Y=a×R+b×G+c×B (1)
但し、a、b、cは、3つの合計が1となる値であればよい係数であって、例えば、a=1/3、b=1/3、c=1/3とすることができる。また、R、G、Bは、各画素が有する上記各色の濃度階調値であり、例えば、それぞれ、0〜255のいずれかの値をとる。
Y = a * R + b * G + c * B (1)
However, a, b, and c are coefficients that have only to be a value in which the total of the three is 1. For example, a = 1/3, b = 1/3, and c = 1/3. . R, G, and B are density gradation values of the respective colors that each pixel has. For example, R, G, and B each take any value from 0 to 255.

また、前記画像データが、グレースケールで表現されたグレーデータである場合には、各画素の有する濃度階調値を、白側が大きい値となるようにして、そのまま輝度値Yとすることができる。この場合にも、同様に、輝度値Y毎の画素数(度数)を求めてヒストグラムを作成する。   Further, when the image data is gray data expressed in gray scale, the density gradation value of each pixel can be set to the luminance value Y as it is so that the white side becomes a large value. . Also in this case, similarly, the number of pixels (frequency) for each luminance value Y is obtained and a histogram is created.

図2は、生成されるヒストグラムを例示した図である。図2では、輝度が0〜255の256階調で表現されており、輝度が0(黒色)に近い側(黒色側)と輝度が255(白色)に近い側(白色側)にそれぞれヒストグラムの山が現れる例となっている。   FIG. 2 is a diagram illustrating a generated histogram. In FIG. 2, the luminance is expressed in 256 gradations from 0 to 255, and the histogram is shown on the side close to 0 (black) (black side) and on the side close to 255 (white) (white side). This is an example of a mountain appearing.

このようにして作成されたヒストグラム(のデータ)は、RAM等に記憶される。   The histogram (data) created in this way is stored in a RAM or the like.

次に、閾値候補検出部22による処理が実行される。ここでは、前述の通り、作成した輝度ヒストグラムにおいて、所定割合の度数を規定する輝度幅が所定幅以上になる部分から閾値候補を検出する処理を実行するが、具体的には、以下のような手順で処理が行われる。   Next, processing by the threshold candidate detection unit 22 is executed. Here, as described above, in the created luminance histogram, the threshold value candidate is detected from a portion where the luminance width that defines the frequency of the predetermined ratio is equal to or larger than the predetermined width. Specifically, the following processing is performed. Processing is performed according to the procedure.

まず、予め定められた白色側の輝度値Zから、上記作成されたヒストグラムの度数(画素数)を、輝度値が低くなる方向へ順番に積算していき、その積算値が、当該ヒストグラムの輝度値が0〜Zに入る全画素数に対して、予め定められた割合N%になった時点で、そこまでのヒストグラムの輝度幅を求める。すなわち、輝度値Zを始点としてその時点までに積算された画素を1グループとし、そのグループの最大輝度値(この場合にはZ)と最小輝度値との差である輝度幅を求める。   First, the frequency (number of pixels) of the created histogram is sequentially accumulated in the direction in which the luminance value decreases from a predetermined white-side luminance value Z, and the integrated value is the luminance of the histogram. When the value reaches a predetermined ratio N% with respect to the total number of pixels whose values fall within the range of 0 to Z, the luminance width of the histogram up to that point is obtained. In other words, the pixels accumulated from the luminance value Z as the starting point to one group are regarded as one group, and a luminance width that is a difference between the maximum luminance value (in this case, Z) and the minimum luminance value of the group is obtained.

図2に示す例では、ヒストグラムの右側に設定されているZの位置から上記積算が開始され、上記N%となった時点で輝度幅yが求められる。輝度幅yのグループにおいてその右端の輝度値Zが上記最大輝度値であり、左端の輝度値が上記最小輝度値である。 In the example shown in FIG. 2, the cumulative from the position of the Z that is set on the right side of the histogram begins, luminance width y 1 is obtained at the time when a said N%. In the group having the luminance width y 1 , the rightmost luminance value Z is the maximum luminance value, and the leftmost luminance value is the minimum luminance value.

その後、上記積算が終了した画素の次の画素、すなわち、ヒストグラムで輝度値が低くなる方向へ次の画素、を始点として、上記と同様の積算(グルーピング)及び輝度幅の算出を行う。図2に示す例では、当該処理の結果、yが求められる。 After that, the integration (grouping) and the calculation of the luminance width are performed in the same manner as described above, starting from the pixel next to the pixel after the integration, that is, the next pixel in the direction in which the luminance value decreases in the histogram. In the example shown in FIG. 2, y 2 is obtained as a result of the processing.

その後も同様の処理をヒストグラムの最後まで繰り返し実行し、その結果、各輝度幅を有する複数のグループ(ヒストグラムの範囲)が形成される。図2に示す例では、輝度幅Y、Y、・・・を有する各範囲が順次形成されていくことになる。 Thereafter, the same processing is repeated until the end of the histogram, and as a result, a plurality of groups (histogram ranges) having respective luminance widths are formed. In the example shown in FIG. 2, each range having luminance widths Y 1 , Y 2 ,... Is sequentially formed.

次に、上記形成された各範囲の輝度幅を予め定めた固定値Aと比較し、輝度幅が固定値Aよりも広くなっている範囲を選出する。そして、その選出された各範囲について、その範囲内の最小頻度(度数)の輝度値を求め、この輝度値を閾値候補として検出する。すなわち、各範囲でヒストグラムの高さが一番低い位置の輝度値を閾値候補とする。ここでは、上記固定値Aよりも広い輝度幅をY(輝度の高いほうから順番にn=1,2,3・・・とする)、上記検出された閾値候補をt(輝度の高いほうから順番にn=1,2,3・・・とする)とする。なお、輝度値0を含む上記範囲について閾値候補を検出しない。 Next, the brightness width of each of the formed ranges is compared with a predetermined fixed value A, and a range in which the brightness width is wider than the fixed value A is selected. Then, for each selected range, the luminance value of the minimum frequency (frequency) within the range is obtained, and this luminance value is detected as a threshold candidate. That is, the luminance value at the lowest position of the histogram in each range is set as a threshold candidate. Here, the brightness range wider than the fixed value A is Y n (n = 1, 2, 3,... In order from the highest brightness), and the detected threshold value candidate is t n (high brightness). In this order, n = 1, 2, 3,... Note that threshold candidates are not detected for the range including the luminance value 0.

図2に示す例では、矢印で示される固定幅Aと各輝度幅が比較され、Aより広い幅としてYとYが選出され、それらに対応する範囲から、それぞれ、閾値候補1としてtと閾値候補2としてtとが検出される。 In the example illustrated in FIG. 2, the fixed width A indicated by the arrow is compared with each luminance width, Y 1 and Y 2 are selected as widths wider than A, and t 1 is selected as a threshold candidate 1 from the corresponding range. t 2 and is detected as 1 and the threshold candidate 2.

このように閾値候補が検出されるが、上述の処理により、ヒストグラムにおいて輝度幅が狭い範囲、すなわち、度数が高い山となっている範囲、からは閾値候補が検出されず、輝度幅が広い範囲、すなわち、度数が低く谷や山の裾野となっている範囲、から閾値候補が検出さることになる。従って、画像を二つのグループに分けて表現するための二値化において、その閾値をヒストグラムの谷や山の裾野付近で選択することが相応しいことから、上述の処理により二値化処理において有効な閾値候補を検出することができ、また、画像の下地部分や背景部分を除去する(白画素とする)処理においても、これらの部分はヒストグラム上で山を形成するので、当該処理に対しても有効な閾値候補が検出されるといえる。   In this way, the threshold candidates are detected, but the threshold value is not detected from the range where the luminance width is narrow in the histogram, that is, the mountain where the frequency is high by the above-described processing, and the luminance width is wide. That is, the threshold candidate is detected from the range where the frequency is low and the bottom of the valley or mountain. Therefore, in the binarization for expressing the image divided into two groups, it is appropriate to select the threshold value in the vicinity of the valley of the histogram or the bottom of the mountain. Threshold candidates can be detected, and also in the process of removing the background part and background part of the image (making them white pixels), these parts form peaks on the histogram, so that It can be said that an effective threshold candidate is detected.

また、前述した処理の起点となる輝度値Zは、その値よりも輝度が高い部分の処理を行わないために設定されるものである。この輝度値Zが設定されず、最高輝度値(255)から上述の処理を行うと、殆ど下地の画像であるなど、輝度値の高い部分に殆どの画素が集中している画像の場合に、上述した画素数N%の区間が当該輝度値の高い部分に集中して複数形成され、それ以降、黒色側が殆ど形成されないという状態となって、上述した閾値候補を適切に検出できないことになってしまう。そこで、この輝度値Zが予め設定され、適切なN%の区間が形成されるようにしている。   In addition, the luminance value Z that is the starting point of the above-described processing is set in order not to perform processing of a portion whose luminance is higher than that value. If the luminance value Z is not set and the above-described processing is performed from the highest luminance value (255), the image has almost all pixels concentrated on a portion with a high luminance value, such as an almost background image. A plurality of the above-mentioned sections with the number of pixels N% are formed in a concentrated manner in the portion with the high luminance value, and the black side is hardly formed thereafter, and the above-described threshold candidates cannot be detected properly. End up. Therefore, the luminance value Z is set in advance so that an appropriate N% section is formed.

このようにして検出した閾値候補tは、RAM等に記憶されて次工程で使用される。なお、上述した輝度値Z、固定幅A、画素数割合N%は、それぞれ、各種原稿を用いた実験等により予め相応しい値が求められて設定される。 The threshold candidate t n detected in this way is stored in a RAM or the like and used in the next step. It should be noted that the above-described luminance value Z, fixed width A, and pixel number ratio N% are set by obtaining appropriate values in advance through experiments using various originals.

次に、閾値択一部23による処理が実行される。当該処理では、前記検出された閾値候補の中から実際に処理に用いる閾値を選択する処理を行うが、ここでは、二値化後に不要な、対象画像の下地部分や文字などの背景部分を除去する処理のための閾値を選択する。以下、そのための選択方法について説明する。   Next, processing by the threshold selection part 23 is executed. In this process, a threshold value that is actually used for the process is selected from the detected threshold candidates, but here, background parts such as background parts and characters that are unnecessary after binarization are removed. The threshold value for the processing to be performed is selected. Hereinafter, a selection method for that purpose will be described.

図3は、典型的なヒストグラム形状を例示した図である。各種原稿の画像データについて前記輝度ヒストグラムを作成すると、その形状は、概ね図3に示されるような4つのパターンに分けることができる。上記閾値の選択では、これら各パターンにおいて、上記目的に対して適切な閾値が選択されるようにする必要がある。   FIG. 3 is a diagram illustrating a typical histogram shape. When the luminance histogram is created for image data of various documents, the shape can be roughly divided into four patterns as shown in FIG. In selecting the threshold value, it is necessary to select an appropriate threshold value for the purpose in each of these patterns.

まず、図3の(a)に示すパターンは、二値化後に黒色として残す必要のある文字等の部分と原稿の下地部分とからなる原稿の場合である。すなわち、上記文字等に所定の色を有する背景がない場合である。このパターンでは、前述した閾値候補の検出処理において、図に示すように、下地からなる山の裾野に位置する閾値候補tと、谷(極小値)に位置するtが検出されることが予想される。 First, the pattern shown in FIG. 3A is a case of an original composed of a portion of characters and the like that need to remain black after binarization and a background portion of the original. That is, the character or the like does not have a background having a predetermined color. In this pattern, in the threshold value candidate detection process described above, as shown in the figure, the threshold value candidate t 1 located at the base of the mountain that is the background and the t 2 located in the valley (minimum value) are detected. is expected.

ここで、図中のA1で示す点線の範囲は、下地等の二値化後に不要な画素が存在すると考えられる範囲を示し、A2で示す破線の範囲は、文字等の二値化後に必要な画素が存在すると考えられる範囲を示している。従って、このパターンにおいて、上述した下地や背景を除去する目的の閾値としてtを選択すると、二値化後に必要な部分も除去してしまう危険性があり、当該パターンでは、tを選択するのが相応しい。 Here, the dotted line range indicated by A1 in the figure indicates a range where unnecessary pixels are considered to exist after binarization such as the background, and the broken line range indicated by A2 is necessary after binarization of characters and the like. The range in which the pixel is considered to be present is shown. Accordingly, in this pattern, if t 2 is selected as the target threshold value for removing the background or background described above, there is a risk that a necessary part will be removed after binarization. In this pattern, t 1 is selected. Is appropriate.

次に、図3の(b)に示すパターンは、二値化後に残す必要のある文字等に対して比較的濃い色の背景がある原稿の場合である。このパターンでは、前述した閾値候補の検出処理において、図に示すように、原稿の下地からなる山と上記背景からなる山の間の谷(極小値)に位置するtと、背景からなる山の裾野に位置するtが検出されることが予想される。 Next, the pattern shown in FIG. 3B is a case of a document having a relatively dark background for characters and the like that need to be left after binarization. In this pattern, in the threshold value candidate detection process described above, as shown in the figure, t 1 located in the valley (minimum value) between the mountain that is the background of the document and the mountain that is the background, and the mountain that is the background t 2 is located in the foot is expected to be detected.

ここで、図中のA1及びA2は、図3の(a)と同様の範囲を示しており、従って、このパターンにおいて、上述した下地や背景を除去する目的の閾値としてtを選択すると、二値化後に必要な部分も除去してしまう危険性があり、当該パターンでも、tを選択するのが相応しい。 Here, A1 and A2 in the figure shows the same range as (a) in FIG. 3, therefore, in this pattern, selecting t 2 as a threshold value for the purpose of removing a base and the above background, There is a risk of removing necessary parts after binarization, and it is appropriate to select t 1 even in this pattern.

次に、図3の(c)に示すパターンは、二値化後に残す必要のある文字等に対して比較的薄い色の背景がある原稿の場合である。このパターンでは、前述した閾値候補の検出処理において、図に示すように、原稿の下地からなる山と上記背景からなる山の間の谷(極小値)に位置するtと、背景からなる山の裾野に位置するtが検出されることが予想される。 Next, the pattern shown in (c) of FIG. 3 is a case of a document having a relatively light background for characters and the like that need to be left after binarization. In this pattern, in the threshold value candidate detection process described above, as shown in the figure, t 1 located in the valley (minimum value) between the mountain that is the background of the document and the mountain that is the background, and the mountain that is the background t 2 is located in the foot is expected to be detected.

ここで、図中のA1及びA2は、図3の(a)と同様の範囲を示している。このパターンでは、A2の範囲に対して背景の山(tとtの間の山)の輝度が十分に高くなっており、この背景を除去しても残す必要のある部分を除去してしまう危険性が殆どないので、すなわち、上述した下地や背景を除去する目的の閾値としてtを選択しても二値化後に必要な部分を除去してしまう危険性が少ないので、当該パターンでは、下地と共に背景も除去できるtを選択するのが相応しい。 Here, A1 and A2 in the figure indicate the same range as in FIG. In this pattern, the brightness of the background of the mountain for a range of A2 (mountain between t 1 and t 2) has become sufficiently high, the part that needs to leave be removed this background removed because there is little risk of put away, i.e., the less danger of removing the necessary parts after binarization be selected t 2 as a threshold value for the purpose of removing the above-mentioned base or background in the pattern , it is suitable to select the t 2 that background can be removed together with the base.

次に、図3の(d)に示すパターンは、二値化後に残す必要のある文字等に対して背景があり、黒い部分が少ない原稿の場合である。このパターンでは、前述した閾値候補の検出処理において、図に示すように、原稿の下地からなる山と上記背景からなる山の間の谷(極小値)に位置するtと、背景からなる山の裾野に位置するtが検出されることが予想される。 Next, the pattern shown in (d) of FIG. 3 is a case of a document having a background with respect to characters and the like that need to be left after binarization and few black portions. In this pattern, in the threshold value candidate detection process described above, as shown in the figure, t 1 located in the valley (minimum value) between the mountain that is the background of the document and the mountain that is the background, and the mountain that is the background t 2 is located in the foot is expected to be detected.

ここで、図中のA1及びA2は、図3の(a)と同様の範囲を示している。このパターンでは、黒側の画素数が少なく全体的に白っぽい画像であるため、文字等の必要な範囲A2の輝度と背景(tとtの間の山)の輝度にあまり差がなく、上述した下地や背景を除去する目的の閾値としてtを選択すると、二値化後に必要な部分も除去してしまう危険性があり、当該パターンでは、あえて背景は除去せずに下地のみを除去するようにtを選択するのが相応しい。 Here, A1 and A2 in the figure indicate the same range as in FIG. This pattern, since the number of pixels of the black side is generally whitish image small, no much difference in the luminance of the background of the required range A2 of characters and the like (mountain between t 1 and t 2), selecting t 2 as a threshold value for the purpose of removing the above-mentioned base or background, there is a risk of also removing portions necessary after binarization, in the pattern, dare background removing only the base without removing It is suitable to select the t 1 to.

以上説明した各パターンに対する相応しい閾値が適確に選択されるように、閾値択一部23では、以下の条件で前記閾値候補から閾値を選択する。   In the threshold selection part 23, a threshold is selected from the threshold candidates under the following conditions so that an appropriate threshold for each pattern described above is appropriately selected.

まず、基本的にはtを閾値として選択するようにし、図3の(c)、(d)に示した場合のように、tが高い輝度値である場合には、すなわち、tが下地と背景の山の間の谷に位置すると考えられる場合には、tを選択できるか否かを判断する。当該判断では、黒側の状態を参照して原稿全体が白っぽい画像であるか否かを判定し、白っぽい画像であると判定した場合にはtを選択できないと判断してtを選択し、白っぽい画像でないと判定した場合にはtを選択できると判断してtを選択する。 First, t 1 is basically selected as a threshold value, and when t 1 is a high luminance value as shown in FIGS. 3C and 3D, that is, t 1 There where considered to be located in the valley between the mountains of the base and the background determines whether it is possible to select a t 2. In this determination, it determines whether the entire original is a whitish image with reference to the state of the black side, and select the t 1 and determines that it can not select t 2 when it is determined that the whitish image selects t 2 determines that can be selected t 2 when it is determined not to be a whitish image.

なお、文字等の残す必要のある情報は概ね輝度の低い方に存在していることから、閾値が低くなりすぎて必要な情報を除去してしまうことを回避するために、一般的な条件として閾値の下限値(Tmin)を上記選択条件に加えて設けることが必要である。また、極めて白紙に近い原稿の場合など例外的なヒストグラム形状になって、上述した処理が有効に機能しない場合を考慮した条件も必要となる。 In addition, since the information that needs to be left, such as characters, is generally present in the lower luminance, in order to avoid removing the necessary information because the threshold is too low, as a general condition It is necessary to provide a lower limit value (T min ) of the threshold in addition to the above selection conditions. Also, a condition that takes into account the case where the above-described processing does not function effectively due to an exceptional histogram shape, such as in the case of a document that is very close to a blank sheet, is required.

以上説明した条件で閾値が選択されるよう、閾値択一部23では、以下のような処理手順で選択処理を行う。図4は、閾値の選択処理の手順を例示したフローチャートである。   In the threshold selection part 23, the selection process is performed according to the following processing procedure so that the threshold is selected under the conditions described above. FIG. 4 is a flowchart illustrating the procedure of threshold selection processing.

まず、閾値択一部23は、前工程で、すなわち、前述した閾値候補検出部22の処理で閾値候補tが検出されているか否かをチェックする(ステップS1)。その結果、閾値候補tが検出されていない場合には(ステップS1のNo)、前述した輝度値Zの値が、(予め定められた閾値Tの下限値Tmin+5)以下であるか否かをチェックし(ステップS2)、そうでなければ(ステップS2のNo)、輝度値Zを所定値(例えば、5)下げて(ステップS3)、再度、閾値候補検出部22における候補検出の処理を実行させる(ステップS4)。一方、輝度値Zの値が(閾値Tの下限値Tmin+5)以下である場合には(ステップS2のYes)、閾値Tを下限値Tminとする(ステップS10)。 First, the threshold selection part 23 checks whether or not the threshold candidate t n has been detected in the previous step, that is, the processing of the threshold candidate detection unit 22 described above (step S1). As a result, when the threshold value candidate t n is not detected (No in step S1), whether or not the above-described luminance value Z is equal to or less than (a predetermined lower limit value T min +5 of the threshold value T). (Step S2), otherwise (No in step S2), the brightness value Z is lowered by a predetermined value (for example, 5) (step S3), and candidate detection processing in the threshold candidate detection unit 22 is performed again. Is executed (step S4). On the other hand, when the value of the luminance value Z is equal to or less than (the lower limit value T min +5 of the threshold value T) (Yes in step S2), the threshold value T is set to the lower limit value T min (step S10).

一方、ステップS1において、閾値候補tが検出されている場合には(ステップS1のYes)、最も輝度値の高い閾値候補tが予め定めたTmaxよりも小さいか否かをチェックする(ステップS5)。このTmaxは、閾値候補tが高すぎるか否かを判定する定数であり、前述したt選択の判断を行うか否かを判定するために用いられる。当該チェックの結果、tがTmaxよりも小さい場合には(ステップS5のYes)、tが前記Tmin以上であるか否かをチェックする(ステップS6)。 On the other hand, if the threshold candidate t n is detected in step S1 (Yes in step S1), it is checked whether or not the threshold candidate t 1 having the highest luminance value is smaller than a predetermined T max ( Step S5). This T max is a constant that determines whether or not the threshold candidate t 1 is too high, and is used to determine whether or not to perform the above-described t 2 selection determination. As a result of the check, if t 1 is smaller than T max (Yes in step S5), it is checked whether t 1 is equal to or greater than T min (step S6).

その結果、tがTmin以上である場合には(ステップS6のYes)、閾値Tをtとする(ステップS7)。すなわち、閾値候補tの中から、下地除去用の閾値としてtを選択する。一方、tがTmin以上でない場合には(ステップS6のNo)、閾値TをTminとする(ステップS10)。すなわち、下地除去用の閾値をTminとする。 As a result, when t 1 is equal to or greater than T min (Yes in step S6), the threshold T is set to t 1 (step S7). That is, from among the threshold candidate t n, selects t 1 as the threshold value for background removal. On the other hand, when t 1 is not equal to or greater than T min (No in step S6), the threshold T is set to T min (step S10). That is, the threshold for background removal is T min .

また、ステップS5において、tがTmaxよりも小さくない場合には(ステップS5のNo)、前述した、tを閾値として選択できるか否かの判断を行う。具体的には、まず、全体が白っぽい画像であるか否かを判定すべく、画像の黒成分の量を示すYminを前記ヒストグラムから求め、この値が予め定められた判定値Yよりも大きいか否かをチェックする(ステップS8)。 Further, in step S5, if t 1 is not less than T max (No in step S5), and performs the determination whether the above-described, the t 2 can be selected as the threshold. Specifically, first, in order to determine whether or not the whole is a whitish image, Y min indicating the amount of the black component of the image is obtained from the histogram, and this value is larger than a predetermined determination value Y W. It is checked whether it is larger (step S8).

図5は、画像の黒成分の量を示すYmin等を説明するための図である。Yminは、図5に示すように、前記作成したヒストグラムにおいて、輝度0側から順番に画素を積算していき、その積算値の全画素数に対する割合が予め定めた一定値に達した時点の輝度値であり、この値が高ければ高いほど白っぽい画像であると判断する。また、上記判定値Yは、画像の白っぽさを判定するための値であり、例えば、図5に示すような位置の値であり、Yminがこの値よりも大きければ画像が白っぽいと判定する。なお、前述した定数Tmax、Tminは、例えば、図5に示すような位置の値である。 FIG. 5 is a diagram for explaining Y min or the like indicating the amount of the black component of the image. As shown in FIG. 5, Y min is obtained by integrating pixels in order from the luminance 0 side in the created histogram, and the ratio of the integrated value to the total number of pixels reaches a predetermined constant value. It is a luminance value, and the higher this value is, the more the image is judged to be whitish. Also, the determination value Y W is a value for determining the whitishness image, for example, a value of position as shown in FIG. 5, Y min is the image whitish greater than this value Is determined. The constants T max and T min described above are position values as shown in FIG. 5, for example.

ステップS8のチェックにおいて、YminがYよりも大きければ(ステップS8のYes)、閾値Tをtとする(ステップS7)。すなわち、画像が白っぽいと判定し、tを閾値として選択するのは危険であるとして、下地除去用の閾値としてtを選択する。一方、YminがYよりも大きくなければ(ステップS8のNo)、2番目に輝度値の高い閾値候補tが前記下限値Tmin以下であるか否かをチェックする(ステップS9)。 In the check in step S8, if Y min is greater than Y W (Yes in step S8), and the threshold value T and t 1 (step S7). That is, determination image is whitish, as it is dangerous to select a t 2 as a threshold, selecting the t 1 as the threshold value for background removal. On the other hand, be greater than Y min is Y W (No in step S8), and a high threshold candidate t 2 luminance values in the second to check to or less than the lower limit value T min (step S9).

が下限値Tmin以下である場合には(ステップS9のYes)、閾値TをTminとする(ステップS10)。すなわち、下地除去用の閾値をTminとする。一方、tが下限値Tmin以下でない場合には(ステップS9のNo)、閾値Tをtとする(ステップS11)。すなわち、閾値候補tの中から、下地除去用の閾値としてtを選択する。 If t 2 is equal to or less than the lower limit value T min (Yes in step S9), and the threshold value T and T min (step S10). That is, the threshold for background removal is T min . On the other hand, when t 2 is not less than the lower limit value T min (No in step S9), and the threshold value T and t 2 (step S11). That is, from among the threshold candidate t n, selects t 2 as a threshold value for background removal.

以上のように使用する閾値Tとしていずれかの値が選択されると、最後に、選択された閾値Tが前述したYminよりも大きい値となっているか否かをチェックする(ステップS12)。ここで、一般的なヒストグラム形状の原稿の場合には、閾値TがYminよりも大きい値となるので(ステップS12のYes)、そのまま、当該閾値の選択処理を終了する。 When any value is selected as the threshold value T to be used as described above, it is finally checked whether or not the selected threshold value T is larger than Y min described above (step S12). Here, in the case of a document having a general histogram shape, the threshold value T is larger than Y min (Yes in step S12), and the threshold value selection process is terminated as it is.

一方、閾値TがYminよりも大きい値とならない場合には(ステップS12のNo)、例外的なヒストグラム形状の原稿であると判断し、例外処理を実行する(ステップS13)。具体的には、例えば、その時点で設定されている、前述した各種定数の値では、適切な閾値が選択されない旨のエラーメッセージを、ホストコンピュータの表示装置に表示させるなどの処理を実行する。その場合、ユーザによって各種定数の値を変更できるインターフェースを用意するようにしても良い。また、各種定数の値を自動的に変更させて、再度、閾値候補の検出から処理をやり直すようにしてもよい。 On the other hand, if the threshold value T is not larger than Y min (No in step S12), it is determined that the document has an exceptional histogram shape, and exception processing is executed (step S13). Specifically, for example, processing such as displaying on the display device of the host computer an error message indicating that an appropriate threshold value is not selected with the values of the various constants set at that time is executed. In that case, an interface that allows the user to change various constant values may be prepared. Further, the values of various constants may be automatically changed, and the processing may be performed again from detection of threshold candidates.

なお、上述した各定数、Tmin、Tmax、Y、Yminを求める画素数割合は、それぞれ、各種原稿を用いた実験等により予め相応しい値が求められて設定される。 It should be noted that the ratio of the number of pixels for obtaining the above-described constants, T min , T max , Y W , and Y min is set by obtaining appropriate values in advance through experiments using various documents.

以上のようにして、閾値が選択されると、当該閾値が二値化処理部24に渡されて、対象とする画像データの輝度値が当該閾値以上の画素については、二値化後に不要な下地や背景であるとみなし、除去する処理を行う。具体的には、当該画素を白画素とする。より具体的には、当該画素の輝度値を最高値の255にしてその後の二値化処理にかけてもよいし、この時点で当該画素の値を、二値化後の白を表す値、例えば、「0」に変換しても良い。   As described above, when a threshold value is selected, the threshold value is passed to the binarization processing unit 24, and pixels whose luminance value of the target image data is equal to or higher than the threshold value are unnecessary after binarization. It is considered to be a background or background, and a process for removing it is performed. Specifically, the pixel is a white pixel. More specifically, the luminance value of the pixel may be set to a maximum value of 255 and subjected to the subsequent binarization process. At this time, the value of the pixel is changed to a value representing white after binarization, for example, It may be converted to “0”.

一方、輝度値が当該閾値以上でない画素の範囲については、二値化後に黒画素として残すべき文字等の画像が含まれており、また、さらに不要な画像も含まれている可能性があるので、この時点では全てを黒画素又は白画素とする処理は実行せず、二値化後に残すべき部分が黒画素となり、その他の更に不要な部分が白画素となるような、さらなる二値化処理を実行する。具体的な処理内容は、対象画像に応じて適宜決定される。   On the other hand, the range of pixels whose luminance value is not equal to or greater than the threshold value includes images such as characters that should be left as black pixels after binarization, and may also include unnecessary images. At this point, the process of making all of the pixels black or white is not executed, and the binarization process is such that the portion to be left after binarization is a black pixel and the other unnecessary portions are white pixels. Execute. Specific processing contents are appropriately determined according to the target image.

このようにして二値化処理部24での二値化が終了すると、対象原稿についての二値画像が生成され、当該二値化装置2から出力される。その後、出力画像は、ホストコンピュータのRAM、ハードディスク等に記憶され、適宜、目的とする用途に使用される。   When the binarization in the binarization processing unit 24 is thus completed, a binary image for the target document is generated and output from the binarization apparatus 2. Thereafter, the output image is stored in a RAM, a hard disk or the like of the host computer, and is used for the intended purpose as appropriate.

なお、上述の説明では、閾値候補tの全てを検出後にその中から採用する閾値Tを選出したが、上述の場合に様に、下地、背景除去の目的で閾値を決定する場合には、まず、閾値候補tのみを求めて、その値がTmax以上である場合に閾値候補tを求めるようにしても良い。そうすることにより、処理時間を短縮することが可能である。 In the above description, the threshold T to be adopted is selected from all the threshold candidates t n after detection. However, as described above, when the threshold is determined for the purpose of background and background removal, first, seeking only the threshold candidate t 1, the value may be calculated threshold candidate t 2 when it is T max or more. By doing so, the processing time can be shortened.

以上説明したように、本実施の形態例に係る二値化装置2では、二値化対象画像の輝度(濃度)ヒストグラムにおいて、所定割合の度数を規定する輝度幅が所定幅以上になる部分から当該部分の最小頻度の輝度値を閾値候補として検出するので、ヒストグラムにおける谷部や山の裾野部を閾値候補として検出でき、二値化に有効な閾値を自動的に決定することが可能となる。   As described above, in the binarization apparatus 2 according to the present embodiment, from the portion of the luminance (density) histogram of the binarization target image, the luminance width that defines the frequency of the predetermined ratio is greater than or equal to the predetermined width. Since the luminance value of the minimum frequency of the part is detected as a threshold candidate, a valley or a mountain skirt in the histogram can be detected as a threshold candidate, and a threshold effective for binarization can be automatically determined. .

また、当該閾値候補を、二値化処理の下地除去処理のための閾値に用いることにより、ヒストグラムにおいて山を形成する、二値化後に不要な下地部分や背景部分を、適切に白画素化することが可能となる。   Further, by using the threshold candidate as a threshold value for the background removal process of the binarization process, the background part and the background part that form a mountain in the histogram and are unnecessary after binarization are appropriately converted into white pixels. It becomes possible.

また、下地除去処理において、基本的に最も輝度値の高い閾値候補を閾値として採用し、画像の輝度ヒストグラムが輝度の高い側に偏っていないなど所定条件を満たしている場合に、さらに輝度値の低い閾値候補を閾値として採用するので、二値化後に必要な画像部分を除去してしまう危険を冒すことなく有効な下地除去を実行することができる。   Also, in the background removal process, the threshold value candidate with the highest luminance value is basically adopted as the threshold value, and if the luminance histogram of the image satisfies a predetermined condition such as not biased toward the higher luminance side, the luminance value is further increased. Since a low threshold candidate is adopted as a threshold, effective background removal can be executed without taking the risk of removing a necessary image portion after binarization.

また、下地除去処理において、予め適切な最低閾値Tminを設けてこれ以下の閾値を設定しないようにすることにより、二値化後に必要な部分を除去してしまう危険性を回避している。 Further, in the background removal process, by setting an appropriate minimum threshold value T min in advance so as not to set a threshold value lower than this, the risk of removing a necessary part after binarization is avoided.

また、画像全体の二値化処理を実行する前に、上記下地除去処理を実行して、選択した閾値以上の画素については白画素化し、それ以外の部分については、通常、処理時間を要する更なる二値化処理を実行するようにしたので、高品質な二値化の処理を高速で行なうことが可能となる。   Also, before executing the binarization process for the entire image, the background removal process is executed to convert pixels above the selected threshold value to white pixels, and for other parts, it usually takes more processing time. Since this binarization processing is executed, high-quality binarization processing can be performed at high speed.

なお、上述の実施の形態例では、閾値候補検出部22で検出した複数の候補の中から、閾値択一部23が下地除去処理の目的に適した条件で閾値を選択したが、閾値候補検出部22で検出される閾値候補は、前述の通り、ヒストグラムにおける谷部や山の裾野部に位置するものであり、下地除去処理の目的だけでなく、二値化処理において他の目的にも使用可能である。従って、閾値択一部23において他の使用目的に応じた条件を設定して閾値を選択し処理を実行するようにすることも可能である。   In the above-described embodiment, the threshold selection part 23 selects a threshold from among a plurality of candidates detected by the threshold candidate detection unit 22 under conditions suitable for the purpose of the background removal process. As described above, the threshold candidates detected by the unit 22 are located at valleys and ridges in the histogram, and are used not only for the purpose of the background removal process but also for other purposes in the binarization process. Is possible. Accordingly, it is possible to set a condition according to another purpose of use in the threshold selection part 23, select the threshold, and execute the process.

また、上記実施の形態例では、画像読み取り装置1と二値化装置2を含むホストコンピュータからなるシステム構成としたが、本発明に係る画像処理プログラム及び画像処理装置は、当該システム構成に限定されることなく適用することができる。   In the above embodiment, the system configuration includes the host computer including the image reading device 1 and the binarization device 2. However, the image processing program and the image processing device according to the present invention are limited to the system configuration. It can be applied without

本発明の保護範囲は、上記の実施の形態に限定されず、特許請求の範囲に記載された発明とその均等物に及ぶものである。   The protection scope of the present invention is not limited to the above-described embodiment, but covers the invention described in the claims and equivalents thereof.

本発明を適用した画像処理装置の実施の形態例に係る機能構成図である。It is a functional block diagram concerning the example of an embodiment of the image processing device to which the present invention is applied. 生成されるヒストグラムを例示した図である。It is the figure which illustrated the histogram generated. 典型的なヒストグラム形状を例示した図である。It is the figure which illustrated typical histogram shape. 閾値の選択処理の手順を例示したフローチャートである。It is the flowchart which illustrated the procedure of the selection process of a threshold value. 画像の黒成分の量を示すYmin等を説明するための図である。It is a figure for demonstrating Ymin etc. which show the quantity of the black component of an image.

符号の説明Explanation of symbols

1 画像読み取り装置、 2 二値化装置、 21 ヒストグラム作成部、 22 閾値候補検出部、 23 閾値択一部、 24 二値化処理部   DESCRIPTION OF SYMBOLS 1 Image reading apparatus, 2 Binarization apparatus, 21 Histogram preparation part, 22 Threshold value candidate detection part, 23 Threshold selection part, 24 Binary process part

Claims (6)

多値の画像データを二値のデータとする二値化処理をコンピュータに実行させる画像処理プログラムであって、
前記画像データは、各画素が、白色で最高値となり黒色で最低値となる階調値を有するデータであり、
前記階調値の所定値から、前記階調値の高い順番に前記画素を所定個数ずつグルーピングし、グループ内における最高階調値と最低階調値の差が所定値よりも大きくなる各グループにおいて、同じ階調値を有している前記画素の個数が最も少ない当該階調値を閾値候補として検出する、処理を前記コンピュータに実行させ、
前記検出された閾値候補の中から、前記二値化処理のための閾値が選択される
ことを特徴とする画像処理プログラム。
An image processing program for causing a computer to execute binarization processing using multi-value image data as binary data,
The image data is data in which each pixel has a gradation value in which white is the highest value and black is the lowest value,
In each group in which a predetermined number of pixels are grouped in descending order of the gradation value from a predetermined value of the gradation value, and the difference between the highest gradation value and the lowest gradation value in the group is larger than the predetermined value. Detecting the gradation value with the smallest number of pixels having the same gradation value as a threshold candidate, causing the computer to execute a process,
An image processing program, wherein a threshold for the binarization process is selected from the detected threshold candidates.
請求項1において、
前記選択された閾値は、当該閾値以上の前記階調値を有する画素を白色とする処理に用いられる
ことを特徴とする画像処理プログラム。
In claim 1,
The image processing program, wherein the selected threshold value is used for processing of whitening a pixel having the gradation value equal to or higher than the threshold value.
請求項2において、
前記検出された閾値候補の中から、最も階調値の高い閾値候補が前記閾値として選択される
ことを特徴とする画像処理プログラム。
In claim 2,
An image processing program characterized in that a threshold candidate having the highest gradation value is selected as the threshold value from the detected threshold candidates.
請求項2において、
前記検出された閾値候補の中で最も階調値の高い閾値候補の階調値が予め定められた所定値以上である場合には、前記階調値の低い画素の個数に応じて、2番目に階調値の高い前記閾値候補が前記閾値として選択される
ことを特徴とする画像処理プログラム。
In claim 2,
When the gradation value of the threshold candidate having the highest gradation value among the detected threshold candidates is equal to or greater than a predetermined value, the second value is selected according to the number of pixels having the low gradation value. The image processing program, wherein the threshold candidate having a high gradation value is selected as the threshold value.
請求項2乃至請求項4のいずれかにおいて、
前記階調値が予め定められた最低値よりも小さい前記閾値候補は前記閾値として選択されない
ことを特徴とする画像処理プログラム。
In any one of Claims 2 thru | or 4,
The image processing program, wherein the threshold value candidate whose gradation value is smaller than a predetermined minimum value is not selected as the threshold value.
多値の画像データを二値のデータとする二値化処理を実行する画像処理装置であって、
前記画像データは、各画素が、白色で最高値となり黒色で最低値となる階調値を有するデータであり、
前記階調値の所定値から、前記階調値の高い順番に前記画素を所定個数ずつグルーピングし、グループ内における最高階調値と最低階調値の差が所定値よりも大きくなる各グループにおいて、同じ階調値を有している前記画素の個数が最も少ない当該階調値を閾値候補として検出し、
前記検出された閾値候補の中から、前記二値化処理のための閾値が選択される
ことを特徴とする画像処理装置。
An image processing apparatus that executes binarization processing using multi-value image data as binary data,
The image data is data in which each pixel has a gradation value in which white is the highest value and black is the lowest value,
In each group in which a predetermined number of pixels are grouped in descending order of the gradation value from a predetermined value of the gradation value, and the difference between the highest gradation value and the lowest gradation value in the group is larger than the predetermined value. , Detecting the gradation value with the smallest number of pixels having the same gradation value as a threshold candidate,
An image processing apparatus, wherein a threshold value for the binarization process is selected from the detected threshold value candidates.
JP2007316117A 2007-12-06 2007-12-06 Image processing program and image processing apparatus Expired - Fee Related JP4867903B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007316117A JP4867903B2 (en) 2007-12-06 2007-12-06 Image processing program and image processing apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007316117A JP4867903B2 (en) 2007-12-06 2007-12-06 Image processing program and image processing apparatus

Publications (2)

Publication Number Publication Date
JP2009140244A JP2009140244A (en) 2009-06-25
JP4867903B2 true JP4867903B2 (en) 2012-02-01

Family

ID=40870786

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007316117A Expired - Fee Related JP4867903B2 (en) 2007-12-06 2007-12-06 Image processing program and image processing apparatus

Country Status (1)

Country Link
JP (1) JP4867903B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5251100B2 (en) * 2007-12-07 2013-07-31 セイコーエプソン株式会社 Image processing program and image processing apparatus
JP5531464B2 (en) 2009-06-29 2014-06-25 セイコーエプソン株式会社 Image processing program, image processing apparatus, and image processing method
JP5128563B2 (en) * 2009-09-17 2013-01-23 株式会社日立製作所 Document verification system, document verification method, document verification program, and recording medium
JP6711051B2 (en) 2016-03-18 2020-06-17 ブラザー工業株式会社 Image processing apparatus and image processing method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0661113B2 (en) * 1984-09-05 1994-08-10 株式会社日立製作所 Image input method
JP3871876B2 (en) * 2000-11-08 2007-01-24 グローリー株式会社 Binarization apparatus, binarization method, and computer-readable recording medium recording a program for causing computer to execute the method
JP2002319021A (en) * 2001-04-19 2002-10-31 Murata Mfg Co Ltd Binarization processing method, appearance inspection method and appearance inspection device

Also Published As

Publication number Publication date
JP2009140244A (en) 2009-06-25

Similar Documents

Publication Publication Date Title
JP4960897B2 (en) Image processing apparatus, image processing method, program, and storage medium
CN110189349B (en) Image processing method and device
US20120120453A1 (en) Method for binarizing scanned document images containing gray or light colored text printed with halftone pattern
JP5337563B2 (en) Form recognition method and apparatus
US11935314B2 (en) Apparatus for generating a binary image into a white pixel, storage medium, and method
KR20120132314A (en) Image processing apparatus, image processing method, and computer readable medium
JP6021665B2 (en) Image processing apparatus, image processing method, and computer program
JP4867903B2 (en) Image processing program and image processing apparatus
JP4764903B2 (en) Method and image processing apparatus for detecting line structure from text map
JP4853560B2 (en) Image processing method, image processing apparatus, and computer program
KR20120132315A (en) Image processing apparatus, image processing method, and computer readable medium
JP4979956B2 (en) Digital watermark embedding apparatus and digital watermark embedding method
US9277074B2 (en) Image processing apparatus, method, and medium determining whether image data of a page to be processed is blank and contains a foreground object and transmitting the foreground object obtained by removing a background object
JP4502001B2 (en) Image processing apparatus and image processing method
JP2010074342A (en) Image processing apparatus, image forming apparatus, and program
EP3096294A2 (en) Computer program, image processing apparatus, and method
JP5929282B2 (en) Image processing apparatus and image processing program
JP2010225047A (en) Noise component removal apparatus and medium on which noise component removal program is recorded
JP2010186246A (en) Image processing apparatus, method, and program
JP4749382B2 (en) Two-dimensional code reading apparatus and method
JP5251100B2 (en) Image processing program and image processing apparatus
JP2012222581A (en) Image processing device, image processing method, program, and storage medium
JP4471202B2 (en) Image processing apparatus, image processing method, and program used therefor
JP6111796B2 (en) Image processing apparatus and computer program
JP6358146B2 (en) Image processing program, image processing apparatus, and image processing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20101015

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20111011

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: 20111018

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: 20111031

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 4867903

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20141125

Year of fee payment: 3

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees