JP2006229817A - Background detection method, program, recording medium, image processing apparatus, and image forming apparatus - Google Patents

Background detection method, program, recording medium, image processing apparatus, and image forming apparatus Download PDF

Info

Publication number
JP2006229817A
JP2006229817A JP2005043611A JP2005043611A JP2006229817A JP 2006229817 A JP2006229817 A JP 2006229817A JP 2005043611 A JP2005043611 A JP 2005043611A JP 2005043611 A JP2005043611 A JP 2005043611A JP 2006229817 A JP2006229817 A JP 2006229817A
Authority
JP
Japan
Prior art keywords
class
pixel
background
pixels
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2005043611A
Other languages
Japanese (ja)
Inventor
Teruhiko Matsuoka
輝彦 松岡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sharp Corp
Original Assignee
Sharp Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sharp Corp filed Critical Sharp Corp
Priority to JP2005043611A priority Critical patent/JP2006229817A/en
Publication of JP2006229817A publication Critical patent/JP2006229817A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a background detection method capable of properly and surely detecting only a background region without the need for using a histogram, and to provide an image processing apparatus or the like employing the method. <P>SOLUTION: The image processing apparatus 20 is provided with a background detection processor 24 or the like. The background detection processor 24 includes a classification means 24A, a discrimination means 24B, and a background detection means 24C. When a difference between an RGB value of a target pixel and an average of RGB values of class information of a class to which adjacent pixels belong is a first threshold or below, the classification means 24A classifies the target pixel to the class to which the adjacent pixels belong, and when the difference exceeds the first threshold, the classification means 24A classifies the target pixel to a newly setting class. The discrimination means 24B discriminates whether or not each class includes pixels located at edges of the whole image and discriminates whether or not each class includes pixels whose number is a first rate or over with respect to the number of all the pixels of the whole image. The background detection means 24C detects classes belonging to the background region on the basis of a result of the discrimination by the discrimination means 24B. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

この発明は、画像から下地を除去するために下地領域を検出する下地検出方法、同方法を実行するプログラム、同方法を実行するプログラムを格納した記録媒体、同方法を用いた画像処理装置及び画像形成装置に関する。   The present invention relates to a background detection method for detecting a background area for removing a background from an image, a program for executing the method, a recording medium storing a program for executing the method, an image processing apparatus and an image using the method The present invention relates to a forming apparatus.

従来から、画像の下地領域を検出するためにヒストグラムを作成する技術が知られている。   2. Description of the Related Art Conventionally, a technique for creating a histogram for detecting a background area of an image is known.

例えば、入力された画像データに基づいて、濃度とその度数とをあらわすヒストグラムを作成し、ヒストグラムから濃度最大値と濃度最小値とを求め、度数最大値の濃度と濃度最大値とから仮下地濃度を検出し、仮下地濃度と濃度最小値とから下地濃度を検出する技術が提案されている(例えば、特許文献1参照。)。   For example, based on the input image data, create a histogram showing the density and its frequency, find the maximum density value and minimum density value from the histogram, and calculate the temporary background density from the maximum frequency density and the maximum density value. A technique for detecting the background density from the temporary background density and the minimum density value has been proposed (for example, see Patent Document 1).

また、入力された画像データに基づいて、濃度とその度数とをあらわすヒストグラムを作成し、度数の最大値と度数が最大値である濃度とを検出し、それらの値から除去すべき下地の濃度範囲を決定し、その濃度範囲の最大値及び最小値と画像データとを比較して濃度範囲内か否かを判定し、その判定結果に基づいて画像データ又は下地除去したデータを出力する技術が提案されている(例えば、特許文献2参照。)。   Also, based on the input image data, create a histogram showing the density and its frequency, detect the maximum frequency and the density with the maximum frequency, and remove the background density to be removed from those values A technique for determining a range, comparing the maximum and minimum values of the density range with image data to determine whether the density range is within the range, and outputting image data or background-removed data based on the determination result It has been proposed (see, for example, Patent Document 2).

さらに、入力されたカラー画像情報に基づきカラー画像が文字画像であるか又は写真画像であるかを判定し、文字画像が含まれていると判定した場合は下地除去を行い、写真画像であると判定した場合は下地除去を行わないという技術が提案されている(例えば、特許文献3参照。)。
特開平1−196971号公報 特開平3−44268号公報 特許第2984280号公報
Further, based on the input color image information, it is determined whether the color image is a character image or a photographic image. If it is determined that the character image is included, the background is removed and the image is a photographic image. A technique has been proposed in which the background removal is not performed when the determination is made (see, for example, Patent Document 3).
JP-A-1-196971 Japanese Patent Laid-Open No. 3-44268 Japanese Patent No. 2984280

しかし、単にヒストグラムを作成し、度数が最大値となる濃度を下地濃度と判定するのでは、実際には下地ではない場所まで下地と判定されてしまう場合がある。例えば、グラデーションのような画像では、画像中のある場所までが画像領域と判定され、それ以降の実際には画像領域である場所が下地と判定されてしまう場合がある。   However, if a histogram is simply created and the density at which the frequency is the maximum value is determined as the background density, it may be determined that the background is not actually the background. For example, in an image such as a gradation, up to a certain place in the image may be determined as an image area, and a subsequent area that is actually an image area may be determined as a background.

また、上述の特許文献1の技術では、検出した下地濃度に基づく閾値で画像データ全体に対して一意に処理が施されるので、実際には下地ではない場所まで下地として除去されてしまう場合がある。   Further, in the technique of the above-mentioned Patent Document 1, since the entire image data is uniquely processed with a threshold value based on the detected background density, a portion that is not actually a background may be removed as a background. is there.

同様に、特許文献2の技術では、決定した下地濃度に基づく閾値で画像データ全体に対して一意に処理が施されるので、例えば決定した下地濃度と同じ濃度の画素が写真画像の一部に存在する場合は、写真画像の一部が下地として除去されてしまう場合がある。   Similarly, in the technique of Patent Document 2, since the entire image data is uniquely processed with a threshold based on the determined background density, for example, pixels having the same density as the determined background density are included in a part of the photographic image. If present, a part of the photographic image may be removed as a background.

さらに、特許文献3の技術では、写真画像であると判定された場合は下地除去しないとされているものの、文字画像内に下地と同じ濃度の画素が存在する場合は、下地として除去されてしまう課題は解決されていない。   Furthermore, in the technique of Patent Document 3, if it is determined that the image is a photographic image, the background is not removed, but if a pixel having the same density as the background exists in the character image, the background is removed. The problem has not been solved.

この発明の目的は、ヒストグラムを用いることなく下地領域のみを適正的確に検出できる下地検出方法及び同方法を用いた画像処理装置等を提供することにある。   An object of the present invention is to provide a background detection method and an image processing apparatus using the same, which can detect only a background area appropriately and accurately without using a histogram.

この発明の下地検出方法は、上述の課題を解決するために以下のように構成される。   The background detection method of the present invention is configured as follows to solve the above-described problems.

(1)処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出する第1ステップと、前記第1ステップにおいて算出された前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する第2ステップと、前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第3ステップと、前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された第1の割合以上の数の画素を含むか否かを判定する第4ステップと、前記第3ステップ及び前記第4ステップにおける判定結果に基づいて下地領域であるクラスを検出する第5ステップと、を備えることを特徴とする。   (1) A difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs. A first step of calculating, and when the difference value calculated in the first step is less than or equal to a preset first threshold, classifying the pixel of interest into a class to which the adjacent pixel belongs, and the difference value is A second step of classifying the pixel of interest into a newly set class when the first threshold is exceeded, and after classifying all the pixels of the entire image in the second step, A third step for determining whether or not to include a pixel located at an end, and after all the pixels of the whole image are classified in the second step, each class is a whole pixel of the whole image. A fourth step for determining whether or not the pixel includes a number of pixels equal to or greater than a preset first ratio, and a class that is a base region based on the determination results in the third step and the fourth step And a fifth step of detecting.

この構成においては、連続する位置にあり且つ画素値が近い画素同士が同じクラスに分類される。これによって、全体画像の全画素が、画素値が異なり又は位置が離間した複数のクラスに分類される。そして、各クラスが、全体画像の端に位置する画素を含むか否か、及び、全体画像の全画素数に対して第1の割合以上の数の画素を含むか否か、が判定される。判定結果において、クラスが全体画像の端に位置する場合、又は、クラスに属する画素数が所定値以上に大きい場合は、それらのクラスが下地領域であるとして検出される。   In this configuration, pixels at successive positions and close in pixel value are classified into the same class. Thereby, all the pixels of the entire image are classified into a plurality of classes having different pixel values or separated positions. Then, it is determined whether or not each class includes a pixel located at the end of the entire image, and whether or not each class includes a number of pixels equal to or greater than a first ratio with respect to the total number of pixels of the entire image. . In the determination result, when the class is located at the end of the entire image, or when the number of pixels belonging to the class is larger than a predetermined value, these classes are detected as the background area.

ここで、クラスとは、画素値が近く、画素同士が垂直方向又は水平方向に隣接している画素の集合をいう。   Here, the class refers to a set of pixels having pixel values close to each other and adjacent to each other in the vertical direction or the horizontal direction.

(2)前記第2ステップにおいて前記注目画素が属することになったクラスのクラス画素値は、前記注目画素の画素値に応じて更新されることを特徴とする。   (2) The class pixel value of the class to which the target pixel belongs in the second step is updated according to the pixel value of the target pixel.

この構成においては、クラス画素値は、新たに画素が分類される度に更新されるので、注目画素の画素値とクラス画素値とが正確に比較される。   In this configuration, since the class pixel value is updated every time a new pixel is classified, the pixel value of the target pixel and the class pixel value are accurately compared.

(3)前記第2ステップの後であって前記第3ステップ及び前記第4ステップの前に、互いに隣接する2個のクラスにおいて、各クラスに属する全ての画素の画素値のうちの最大値、最小値及び前記全ての画素の画素値の平均値のうち少なくとも1つを互いに比較した結果に基づいて、前記2個のクラスを単一のクラスに統合するステップを、さらに備えることを特徴とする。   (3) After the second step and before the third step and the fourth step, in two adjacent classes, the maximum value of the pixel values of all the pixels belonging to each class, The method further comprises the step of integrating the two classes into a single class based on a result of comparing at least one of a minimum value and an average value of pixel values of all the pixels with each other. .

この構成においては、画素をクラスに分類する過程において別のクラスに分かれてしまった互いに隣接する2個のクラスについて、各クラスに属する画素の画素値の最大値、最小値、平均値等を比較した結果に基づいて、2個のクラスが統合されて単一のクラスにされる。   In this configuration, the maximum value, minimum value, average value, etc. of pixel values of pixels belonging to each class are compared for two adjacent classes that have been divided into different classes in the process of classifying pixels into classes. Based on the result, the two classes are merged into a single class.

(4)前記第5ステップでは、前記第3ステップにおいて前記全体画像の端に位置する画素を含むと判定されたクラスを第1の下地クラスといい、前記第4ステップにおいて前記全体画像の全画素数に対して予め設定された第1の割合以上の数の画素を含むと判定されたクラスを第2の下地クラスという場合、第1の下地クラスにのみ該当するクラスからなる第1のグループ、第2の下地クラスにのみ該当するクラスからなる第2のグループ、及び、第1の下地クラスと第2の下地クラスとの両方に該当するクラスからなる第3のグループ、に各クラスを分類し、前記第1から第3のグループのうち、各グループに属するクラスのそれぞれに属する画素の数の合計が最も多いグループに属するクラスを下地領域として検出することを特徴とする。   (4) In the fifth step, a class determined to include a pixel located at an end of the whole image in the third step is referred to as a first background class, and in the fourth step, all the pixels of the whole image When a class determined to include a number of pixels equal to or greater than a first ratio set in advance for a number is referred to as a second background class, a first group consisting of classes corresponding only to the first background class, Each class is classified into a second group consisting of classes corresponding only to the second base class, and a third group consisting of classes corresponding to both the first base class and the second base class. The class belonging to the group having the largest total number of pixels belonging to each of the classes belonging to each of the first to third groups is detected as a background region. .

この構成においては、第3ステップ及び第4ステップで判定される下地領域の検出のための2つの条件によって下地領域の候補となるクラスが選択された(第1段階)後、選択されたクラスがさらに、上述の2つの条件に基づく3つのグループに分類され、属する画素の数が最も多いグループに属するクラスが下地領域として検出される(第2段階)。このように、2段階の判定を経て下地領域が検出される。   In this configuration, after a class that is a candidate for a base region is selected according to two conditions for detection of the base region determined in the third step and the fourth step (first stage), the selected class is Furthermore, classes that are classified into three groups based on the above two conditions and that belong to the group having the largest number of pixels are detected as background regions (second stage). In this way, the base region is detected through two stages of determination.

(5)前記第5ステップにおいて下地領域として検出された全てのクラスに属する画素の数の合計が、前記画像の全画素数に対して、予め設定された第2の割合未満である場合、前記画像に下地領域がないと判定する第6ステップを、さらに備えることを特徴とする。   (5) When the total number of pixels belonging to all classes detected as the background area in the fifth step is less than a preset second ratio with respect to the total number of pixels of the image, A sixth step of determining that there is no background area in the image is further provided.

この構成においては、第5ステップにおいて下地領域として検出された全てのクラスに属する画素の数の合計が、画像の全画素数に対して所定の割合以上ない場合は、その全体画像には下地領域がないと考えられるので、下地領域はないと判定する。   In this configuration, if the total number of pixels belonging to all classes detected as the background area in the fifth step does not exceed a predetermined ratio with respect to the total number of pixels of the image, the entire image includes the background area. Therefore, it is determined that there is no background area.

(6)前記第5ステップにおいて下地領域として検出された各クラスに属する全ての画素の画素値のうちの最大値から最小値を減算して得られる減算値が予め設定された第2の閾値を超え、または、下地領域として検出された各クラスに属する全ての画素の画素値の平均値が予め設定された第3の閾値未満である場合、前記クラスは下地領域ではないと判定する第7ステップを、さらに備えることを特徴とする。   (6) A second threshold value in which a subtraction value obtained by subtracting the minimum value from the maximum value among the pixel values of all the pixels belonging to each class detected as the background area in the fifth step is set in advance. A seventh step for determining that the class is not a background area when the average value of all the pixels belonging to each class detected as a background area exceeds or is less than a preset third threshold value. Is further provided.

この構成においては、下地領域として検出されたクラスであっても、クラスに属する画素の画素値の最大値と最小値との差が所定値より大きい場合、そのクラスは下地領域ではなく、画像領域であると考えられる。また、クラスに属する全ての画素の画素値の平均値が所定値未満である場合も、そのクラスは下地領域であるとは考えにくい。   In this configuration, even if a class is detected as a background area, if the difference between the maximum and minimum pixel values of pixels belonging to the class is greater than a predetermined value, the class is not a background area but an image area. It is thought that. In addition, when the average value of the pixel values of all the pixels belonging to the class is less than a predetermined value, the class is unlikely to be a background area.

(7)下地領域として検出されたクラスに属する画素について、下地がある場合に前記下地が画像として印刷されないように前記画素の画素値を補正する下地除去処理を施す第8ステップを、さらに備えることを特徴とする。   (7) For a pixel belonging to a class detected as a background area, an eighth step of performing a background removal process for correcting the pixel value of the pixel so that the background is not printed as an image when there is a background is further provided. It is characterized by.

この構成においては、上述の下地検出方法によって適正的確に下地領域であるとして検出されたクラスに属する画素のみに対して下地除去処理が施される。すなわち、文字画像及び写真画像等の中に下地領域の画素と同じ画素値を有する画素が存在する場合でも、文字画像及び写真画像等の中の画素の画素値は変更されることがなく、下地領域である画素の画素値のみが補正される。   In this configuration, the background removal process is performed only on the pixels belonging to the class detected as the background area appropriately and accurately by the above-described background detection method. That is, even if a pixel having the same pixel value as the pixel in the background region exists in the character image and the photographic image, the pixel value of the pixel in the character image and the photographic image is not changed. Only the pixel value of the pixel that is the region is corrected.

この発明のプログラムは、上述の課題を解決するために以下のように構成される。   The program of the present invention is configured as follows to solve the above-described problems.

(8)処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出する第1ステップと、前記第1ステップにおいて算出された前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する第2ステップと、前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第3ステップと、前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された割合以上の数の画素を含むか否かを判定する第4ステップと、前記第3ステップ及び前記第4ステップにおける判定結果に基づいて下地領域であるクラスを検出する第5ステップと、をコンピュータに実行させることを特徴とする。   (8) A difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs A first step of calculating, and when the difference value calculated in the first step is less than or equal to a preset first threshold, classifying the pixel of interest into a class to which the adjacent pixel belongs, and the difference value is A second step of classifying the pixel of interest into a newly set class when the first threshold is exceeded, and after classifying all the pixels of the entire image in the second step, A third step for determining whether or not to include a pixel located at an end, and after all the pixels of the whole image are classified in the second step, each class is a whole pixel of the whole image. A fourth step of determining whether or not the pixel includes a number of pixels greater than or equal to a preset ratio, and a class of detecting a class that is a base region based on the determination results in the third step and the fourth step 5 steps are made to perform by a computer.

この構成においては、連続する位置にあり且つ画素値が近い画素同士が同じクラスに分類される。これによって、全体画像の全画素が、画素値等が異なる複数のクラスに分類される。そして、各クラスが、全体画像の端に位置する画素を含むか否か、及び、全体画像の全画素数に対して第1の割合以上の数の画素を含むか否か、が判定される。判定結果において、クラスが全体画像の端に位置する場合、又は、同程度の画素値の画素の集まり(クラス)が所定の大きさ以上に大きい場合は、それらのクラスが下地領域であるとして検出される。   In this configuration, pixels at successive positions and close in pixel value are classified into the same class. Thereby, all the pixels of the entire image are classified into a plurality of classes having different pixel values and the like. Then, it is determined whether or not each class includes a pixel located at the end of the entire image, and whether or not each class includes a number of pixels equal to or greater than a first ratio with respect to the total number of pixels of the entire image. . If the class is located at the edge of the whole image in the judgment result, or if a group of pixels with the same pixel value (class) is larger than a predetermined size, the class is detected as a background area. Is done.

この発明の記録媒体は、上述の課題を解決するために以下のように構成される。   The recording medium of the present invention is configured as follows to solve the above-described problems.

(9)処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出する第1ステップと、前記第1ステップにおいて算出された前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する第2ステップと、前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第3ステップと、前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された割合以上の数の画素を含むか否かを判定する第4ステップと、前記第3ステップ及び前記第4ステップにおける判定結果に基づいて下地領域であるクラスを検出する第5ステップと、をコンピュータに実行させるプログラムをコンピュータが読み取り可能に格納したことを特徴とする。   (9) A difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs A first step of calculating, and when the difference value calculated in the first step is less than or equal to a preset first threshold, classifying the pixel of interest into a class to which the adjacent pixel belongs, and the difference value is A second step of classifying the pixel of interest into a newly set class when the first threshold is exceeded, and after classifying all the pixels of the entire image in the second step, A third step for determining whether or not to include a pixel located at an end, and after all the pixels of the whole image are classified in the second step, each class is a whole pixel of the whole image. A fourth step of determining whether or not the pixel includes a number of pixels greater than or equal to a preset ratio, and a class of detecting a class that is a base region based on the determination results in the third step and the fourth step The computer stores a program that causes the computer to execute the five steps.

この構成においては、連続する位置にあり且つ画素値が近い画素同士が同じクラスに分類される。これによって、画像の全画素が、画素値等が異なる複数のクラスに分類される。そして、各クラスが、全体画像の端に位置する画素を含むか否か、及び、全体画像の全画素数に対して第1の割合以上の数の画素を含むか否か、が判定される。判定結果において、クラスが全体画像の端に位置する場合、又は、同程度の画素値の画素の集まり(クラス)が所定の大きさ以上に大きい場合は、それらのクラスが下地領域であるとして検出される。   In this configuration, pixels at successive positions and close in pixel value are classified into the same class. Thereby, all the pixels of the image are classified into a plurality of classes having different pixel values and the like. Then, it is determined whether or not each class includes a pixel located at the end of the entire image, and whether or not each class includes a number of pixels equal to or greater than a first ratio with respect to the total number of pixels of the entire image. . If the class is located at the edge of the whole image in the judgment result, or if a group of pixels with the same pixel value (class) is larger than a predetermined size, the class is detected as a background area. Is done.

この発明の画像処理装置は、上述の課題を解決するために以下のように構成される。   The image processing apparatus of the present invention is configured as follows in order to solve the above-described problems.

(10)処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出し、前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する分類手段と、前記分類手段によって前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第1の判定手段と、前記分類手段によって前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された割合以上の数の画素を含むか否かを判定する第2の判定手段と、前記第1の判定手段及び前記第2の判定手段における判定結果に基づいて下地領域であるクラスを検出する下地検出手段と、を備えることを特徴とする。   (10) The difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs Calculating and classifying the pixel of interest into a class to which the adjacent pixel belongs when the difference value is equal to or less than a preset first threshold, and the pixel of interest when the difference value exceeds the first threshold And classifying means for classifying the pixels into a newly set class, and determining whether each class includes a pixel located at an end of the whole image after all the pixels of the whole image are classified by the classification means. Whether or not each class includes a number of pixels greater than or equal to a preset ratio with respect to the total number of pixels of the whole image after all the pixels of the whole image are classified by the determination unit of 1 and the classification unit The A second determination means for, characterized in that it comprises a base detection means for detecting a class is a background region based on the determination result of the first judging means and the second judging means.

この構成においては、連続する位置にあり且つ画素値が近い画素同士が同じクラスに分類される。これによって、全体画像の全画素が、画素値等が異なる複数のクラスに分類される。そして、各クラスが、全体画像の端に位置する画素を含むか否か、及び、全体画像の全画素数に対して第1の割合以上の数の画素を含むか否か、が判定される。判定結果において、クラスが全体画像の端に位置する場合、又は、同程度の画素値の画素の集まり(クラス)が所定の大きさ以上に大きい場合は、それらのクラスが下地領域であるとして検出される。   In this configuration, pixels at successive positions and close in pixel value are classified into the same class. Thereby, all the pixels of the entire image are classified into a plurality of classes having different pixel values and the like. Then, it is determined whether or not each class includes a pixel located at the end of the entire image, and whether or not each class includes a number of pixels equal to or greater than a first ratio with respect to the total number of pixels of the entire image. . If the class is located at the edge of the whole image in the judgment result, or if a group of pixels with the same pixel value (class) is larger than a predetermined size, the class is detected as a background area. Is done.

(11)前記下地検出手段によって下地領域として検出されたクラスに属する画素について、下地がある場合に前記下地が画像として印刷されないように前記画素の画素値を補正する下地除去処理を施す下地除去処理手段を、さらに備えることを特徴とする。   (11) For a pixel belonging to a class detected as a background area by the background detection means, a background removal process for performing a background removal process for correcting the pixel value of the pixel so that the background is not printed as an image when there is a background. A means is further provided.

この構成においては、適正的確に下地領域であるとして検出されたクラスに属する画素のみに対して下地除去処理が施される。すなわち、文字画像及び写真画像等の中に下地領域の画素と同じ画素値を有する画素が存在する場合でも、文字画像及び写真画像等の中の画素の画素値は変更されることがなく、下地領域である画素の画素値のみが補正される。   In this configuration, the background removal process is performed only on the pixels belonging to the class detected as being the background area appropriately and accurately. That is, even if a pixel having the same pixel value as the pixel in the background region exists in the character image and the photographic image, the pixel value of the pixel in the character image and the photographic image is not changed. Only the pixel value of the pixel that is the region is corrected.

この発明の画像形成装置は、上述の課題を解決するために以下のように構成される。   The image forming apparatus of the present invention is configured as follows in order to solve the above-described problems.

(12)前記請求項11に記載の画像処理装置と、前記画像処理装置における下地除去処理の対象となる画像データを入力する入力手段と、前記画像処理装置によって前記下地除去処理を含む画像処理が施された画像を出力する出力手段と、を備えることを特徴とする。   (12) The image processing apparatus according to claim 11, input means for inputting image data to be subjected to background removal processing in the image processing apparatus, and image processing including the background removal processing by the image processing apparatus. And an output means for outputting the applied image.

この構成においては、画像処理装置によって適正的確に下地のみが除去された高品位な画像が出力手段によって出力される。   In this configuration, the output means outputs a high-quality image from which only the background is properly and accurately removed by the image processing apparatus.

この発明によれば、以下の効果を奏することができる。   According to the present invention, the following effects can be obtained.

(1)全ての画素を画素値に基づいてそれぞれ連続する画素からなるクラスに分類した後で、画像に対するクラスの位置及びクラスの大きさ(クラスに属する画素数)に基づいて、クラス単位で下地領域であるか否かを判定するので、下地領域のみを適正的確に検出することができる。また、下地領域の画素と同程度の画素値を有する画像領域中の画素を誤って下地領域として検出することがない。さらに、ヒストグラムを作成する必要がないので、下地領域の検出に用いられるデバイスにかかる負荷が小さくて済む。   (1) After all the pixels are classified into classes each composed of continuous pixels based on the pixel values, the background in class units based on the position of the class and the size of the class (number of pixels belonging to the class) Since it is determined whether or not it is an area, it is possible to appropriately detect only the base area. Further, a pixel in the image area having a pixel value comparable to that of the pixel in the background area is not erroneously detected as the background area. Furthermore, since it is not necessary to create a histogram, the load on the device used for detecting the background area can be reduced.

(2)注目画素の画素値とクラス画素値とを正確に比較できるようにしたので、各画素を本来属すべきクラスに適正に分類することができる。これによって、下地領域のみを適正的確に検出することができる。   (2) Since the pixel value of the target pixel and the class pixel value can be accurately compared, each pixel can be properly classified into a class to which it originally belongs. As a result, only the base region can be detected appropriately and accurately.

(3)画素をクラスに分類する過程において別のクラスに分けてしまったが本来単一のクラスにしてよい2個の隣接するクラスを統合することで、以後の下地領域を検出する処理を容易にすることができる。   (3) In the process of classifying a pixel into a class, it is divided into different classes, but by integrating two adjacent classes that can be originally made into a single class, it is easy to detect the subsequent background area. Can be.

(4)2段階の判定を経て下地領域を検出するので、下地領域のみをさらに適正的確に検出することができる。   (4) Since the background area is detected through two stages of determination, only the background area can be detected more appropriately and accurately.

(5)下地領域は画像の全画素数に対して所定の割合以上の数の画素からなると考えられるので、下地領域であるとされたクラスに属する画素の数の合計が所定数に満たない場合、その画像には下地領域がないと判定することで、下地領域として誤った領域を検出することを防止することができる。したがって、さらに適正的確に下地領域のみを検出することができる。   (5) Since the background area is considered to be composed of a predetermined number or more of pixels with respect to the total number of pixels of the image, the total number of pixels belonging to the class determined to be the background area is less than the predetermined number. By determining that there is no background area in the image, it is possible to prevent an erroneous area from being detected as the background area. Therefore, it is possible to detect only the base region more appropriately and accurately.

(6)下地領域ではないと考えられるクラスを下地領域から除外することで、さらに適正的確に下地領域のみを検出することができる。   (6) By excluding a class that is not considered to be a base region from the base region, it is possible to detect only the base region more appropriately and accurately.

(7)適正的確に下地領域として検出されたクラスに属する画素のみに対して下地除去処理を施すので、文字画像及び写真画像等の画質を劣化させることなく、下地のみを高精度に除去することができる。   (7) Since the background removal process is performed only on the pixels belonging to the class detected as the background area appropriately and accurately, only the background is removed with high accuracy without degrading the image quality of the character image and the photographic image. Can do.

(8)適正的確に下地のみが除去された画像データに基づいて、高品位な画像を出力することができる。   (8) A high-quality image can be output based on image data from which only the background has been removed appropriately and accurately.

以下に、この発明の実施形態について図面に基づいて説明する。図1は、この発明の実施形態に係るカラー画像形成装置の概略の構成を示すブロック図である。   Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing a schematic configuration of a color image forming apparatus according to an embodiment of the present invention.

カラー画像形成装置(この発明の画像形成装置に相当する。)10は、カラー画像入力装置(この発明の入力手段に相当する。)11、カラー画像処理装置(この発明の画像処理装置に相当する。)20、及び、カラー画像出力装置(この発明の出力手段に相当する。)12を備えている。カラー画像入力装置11によって入力されたRGB(R:赤、G:緑、B:青)のアナログ信号の画像データは、カラー画像処理装置20内において後述する処理が施され、CMYK(C:シアン、M:マゼンタ、Y:イエロー、K:黒)のデジタルカラー信号として、カラー画像出力装置12へ出力される。   A color image forming apparatus (corresponding to the image forming apparatus of the present invention) 10 is a color image input apparatus (corresponding to the input means of the present invention) 11, a color image processing apparatus (corresponding to the image processing apparatus of the present invention). .) 20 and a color image output device (corresponding to the output means of the present invention) 12. The image data of RGB (R: red, G: green, B: blue) analog signals input by the color image input device 11 is subjected to processing described later in the color image processing device 20 to obtain CMYK (C: cyan). , M: magenta, Y: yellow, K: black) are output to the color image output device 12 as digital color signals.

カラー画像入力装置11は、この実施形態ではCCD(Charge Coupled Device )を備えたスキャナであり、原稿の画像からの反射光像を、RGBのアナログ信号として読み取り、カラー画像処理装置20に出力する。カラー画像処理装置20については後述する。カラー画像出力装置12は、原稿の画像の画像データを記録用紙上に出力する電子写真方式またはインクジェット方式などのプリンタである。なお、カラー画像出力装置12は、ディスプレイ等の表示装置であってもよい。   In this embodiment, the color image input device 11 is a scanner having a CCD (Charge Coupled Device), reads a reflected light image from an image of a document as an RGB analog signal, and outputs it to the color image processing device 20. The color image processing apparatus 20 will be described later. The color image output device 12 is a printer such as an electrophotographic system or an inkjet system that outputs image data of an image of a document onto a recording sheet. The color image output device 12 may be a display device such as a display.

カラー画像処理装置20は、A/D(アナログ/デジタル)変換部21を含む。A/D変換部21では、カラー画像入力装置11から入力されたRGBのアナログ信号が例えば8ビットのデジタル信号に変換される。A/D変換部21から出力されたRGBのデジタル信号はシェーディング補正部22に入力される。シェーディング補正部22では、入力されたRGBのデジタル信号に対して、カラー画像入力装置11の照明系、結像系、撮像系で生じた各種の歪みを取り除く処理が施される。シェーディング補正部22から出力されたRGB信号は入力階調補正部23に入力される。   The color image processing apparatus 20 includes an A / D (analog / digital) conversion unit 21. The A / D conversion unit 21 converts RGB analog signals input from the color image input device 11 into, for example, 8-bit digital signals. The RGB digital signals output from the A / D conversion unit 21 are input to the shading correction unit 22. The shading correction unit 22 performs processing for removing various distortions generated in the illumination system, the imaging system, and the imaging system of the color image input device 11 on the input RGB digital signal. The RGB signal output from the shading correction unit 22 is input to the input tone correction unit 23.

入力階調補正部23では、シェーディング補正部22において各種の歪みが取り除かれたRGB信号(RGBの反射率信号)に対して、カラーバランスを整えるとともに、濃度信号などカラー画像処理装置20に採用されている扱い易い信号に変換する処理が施される。入力階調補正部23から出力されたRGB信号は、図示しないメモリに一旦退避された後に、1画素分ずつ下地検出処理部24に入力される。   The input tone correction unit 23 adjusts the color balance of the RGB signal (RGB reflectance signal) from which various distortions have been removed by the shading correction unit 22 and is used in the color image processing apparatus 20 such as a density signal. The signal is converted into an easy-to-handle signal. The RGB signals output from the input tone correction unit 23 are temporarily saved in a memory (not shown) and then input to the background detection processing unit 24 pixel by pixel.

下地検出処理部24では、入力されたRGB信号に基づいて、全体画像中に下地領域があるか否か及び下地領域がある場合はその下地領域が検出される。ここで、1枚分の原稿の画像を全体画像といい、全体画像は、画像領域と下地領域とからなるものとする。画像領域とは、文字画像又は写真画像等がある領域をいう。下地領域とは、画像領域以外の領域であって下地が存在する領域をいう。下地検出処理部24で行われる処理の詳細については後述する。   Based on the input RGB signal, the background detection processing unit 24 detects whether or not there is a background area in the entire image, and if there is a background area, the background area is detected. Here, the image of one original is called an entire image, and the entire image is composed of an image area and a background area. The image area refers to an area where a character image or a photographic image is present. The background area refers to an area other than the image area where the background exists. Details of processing performed by the background detection processing unit 24 will be described later.

下地検出処理部24で下地領域が検出されると、その下地検出結果がRGB信号と同期して下地除去処理部25へ入力される。下地除去処理部25では、画像データ(RGB信号)に対して下地検出結果に基づいて下地除去処理が施される。下地除去処理部25から出力されたRGB信号は領域分離処理部26に入力される。   When the background detection processing unit 24 detects a background region, the background detection result is input to the background removal processing unit 25 in synchronization with the RGB signal. In the background removal processing unit 25, background removal processing is performed on the image data (RGB signal) based on the background detection result. The RGB signals output from the background removal processing unit 25 are input to the region separation processing unit 26.

領域分離処理部26では、RGB信号に基づき、画像領域中の各画素が文字領域、網点領域、写真領域の何れかに分離される。領域分離処理部26では、分離結果に基づいて、各画素がどの領域に属しているかを示す領域識別信号が、空間フィルタ処理部27、黒生成下色除去部30、および階調再現処理部32へと出力されるとともに、下地除去処理部25から入力されたRGB信号が領域識別信号に同期して空間フィルタ処理部27へ出力される。   The area separation processing unit 26 separates each pixel in the image area into one of a character area, a halftone dot area, and a photograph area based on the RGB signal. In the region separation processing unit 26, based on the separation result, a region identification signal indicating to which region each pixel belongs is sent to the spatial filter processing unit 27, the black generation and under color removal unit 30, and the gradation reproduction processing unit 32. And the RGB signal input from the background removal processing unit 25 is output to the spatial filter processing unit 27 in synchronization with the region identification signal.

空間フィルタ処理部27では、領域分離処理部26から入力されたRGB信号の画像データに対して、領域識別信号に基づきデジタルフィルタによる空間フィルタ処理が施される。これによって、空間周波数特性が補正され、カラー画像出力装置12における出力画像のぼやけや粒状性劣化が防止される。例えば、領域分離処理部26において文字領域に分離された領域は、特に黒文字または色文字の再現性を高めるために、空間フィルタ処理部27において、空間フィルタ処理の一つである鮮鋭強調処理が施され高周波成分が強調される。また、領域分離処理部26において網点領域に分離された領域は、空間フィルタ処理部27において、入力網点成分を除去するためのローパス・フィルタ処理が施される。空間フィルタ処理部27で処理が施された画像データは変倍処理部28へ入力される。   In the spatial filter processing unit 27, spatial filter processing using a digital filter is performed on the image data of the RGB signal input from the region separation processing unit 26 based on the region identification signal. As a result, the spatial frequency characteristic is corrected, and blurring and graininess deterioration of the output image in the color image output device 12 are prevented. For example, a region separated into character regions in the region separation processing unit 26 is subjected to sharp enhancement processing, which is one of spatial filter processing, in the spatial filter processing unit 27 in order to improve the reproducibility of black characters or color characters. The high frequency component is emphasized. The region separated into halftone dot regions by the region separation processing unit 26 is subjected to low-pass filter processing for removing the input halftone dot component by the spatial filter processing unit 27. The image data processed by the spatial filter processing unit 27 is input to the scaling processing unit 28.

変倍処理部28では、空間フィルタ処理が施された画像データに対し、所定倍率になるように拡大演算処理または縮小演算処理が施される。処理後のRGB信号は色補正部29へ入力される。   In the scaling processing unit 28, enlargement calculation processing or reduction calculation processing is performed on the image data on which the spatial filter processing has been performed so as to obtain a predetermined magnification. The processed RGB signal is input to the color correction unit 29.

色補正部29では、入力されたRGB信号の画像データがCMYの色空間に変換されるとともに、カラー画像出力装置12に合わせて色補正が施される。補正後のCMY信号の画像データは黒生成下色除去部30へ入力される。   In the color correction unit 29, the input RGB signal image data is converted into a CMY color space, and color correction is performed in accordance with the color image output device 12. The corrected CMY signal image data is input to the black generation and under color removal unit 30.

黒生成下色除去部30では、色補正後のCMYの3色信号から黒(K)信号を生成する黒生成処理、および元のCMY信号から黒生成処理で取得されたK信号を差し引いて新たなCMY信号を生成する処理が施され、CMYの3色信号はCMYKの4色信号に変換される。黒生成処理の一例を以下に示す。例えばスケルトンブラックによる黒生成を行う処理(一般的処理)では、スケルトンカーブの入出力特性をy=f(x)とし、入力されるデータをC、M、Yとし、出力されるデータをC’、M’、Y’、K’とし、UCR(Under Color Removal )率をα(0<α<1)とすると、黒生成下色除去処理は以下の[数1]の関係式で表わされる。   The black generation and under color removal unit 30 performs a black generation process for generating a black (K) signal from the CMY three-color signals after color correction, and newly subtracts the K signal acquired by the black generation process from the original CMY signal. The CMY three-color signal is converted into a CMYK four-color signal. An example of black generation processing is shown below. For example, in the process of generating black by skeleton black (general process), the input / output characteristic of the skeleton curve is y = f (x), the input data is C, M, Y, and the output data is C ′. , M ′, Y ′, and K ′, and the UCR (Under Color Removal) rate is α (0 <α <1), the black generation and under color removal processing is expressed by the following equation (1).

Figure 2006229817
Figure 2006229817

黒生成下色除去部30から出力されたCMYK信号は、出力階調補正部31を介して階調再現処理部32に入力される。   The CMYK signal output from the black generation and under color removal unit 30 is input to the gradation reproduction processing unit 32 via the output gradation correction unit 31.

階調再現処理部32では、空間フィルタ処理部27と同様に、CMYK信号の画像データに対して、領域分離処理部26から入力される領域識別信号に基づき所定の処理が施される。例えば、領域分離処理部26において文字領域に分離された領域は、特に黒文字または色文字の再現性を高めるために、階調再現処理部32において、カラー画像出力装置における高域周波数成分の再現に適するように二値化処理または多値化処理が選択されて施される。また、領域分離処理部26において網点領域に分離された領域は、出力階調補正部32において、濃度信号などの信号をカラー画像出力装置12の特性値である網点面積率に変換する出力階調補正処理が施された後、階調再現処理部32において、最終的に全体画像を画素に分離してそれぞれの階調を再現できるように処理する階調再現処理(中間調生成)が施される。更に、領域分離処理部において写真領域に分離された領域は、カラー画像出力装置における階調再現性に適するように二値化処理または多値化処理が施される。   Similar to the spatial filter processing unit 27, the gradation reproduction processing unit 32 performs predetermined processing on the image data of the CMYK signal based on the region identification signal input from the region separation processing unit 26. For example, the region separated into the character regions in the region separation processing unit 26 is used to reproduce high-frequency components in the color image output apparatus in the tone reproduction processing unit 32 in order to improve the reproducibility of black characters or color characters. A binarization process or a multi-value process is selected and applied as appropriate. The region separated into halftone dot regions by the region separation processing unit 26 is an output for converting a signal such as a density signal into a halftone dot area ratio that is a characteristic value of the color image output device 12 in the output tone correction unit 32. After the gradation correction processing is performed, the gradation reproduction processing unit 32 performs gradation reproduction processing (halftone generation) in which the entire image is finally separated into pixels and each gradation can be reproduced. Applied. Further, the region separated into the photographic regions in the region separation processing unit is subjected to binarization processing or multi-value processing so as to be suitable for gradation reproducibility in the color image output apparatus.

上述したカラー画像処理装置20における各処理が施された画像データは、図示しない記憶手段に一旦記憶され、所定のタイミングで読み出されてカラー画像出力装置12に入力される。また、以上の処理は図示しないCPU(Central Processing Unit )によって制御される。   The image data subjected to each process in the color image processing apparatus 20 described above is temporarily stored in a storage unit (not shown), read out at a predetermined timing, and input to the color image output apparatus 12. The above processing is controlled by a CPU (Central Processing Unit) (not shown).

なお、カラー画像処理装置20において、下地検出処理部24および下地除去処理部25は領域分離処理部26の直前に配置されているが、これに限定されるものではなく、領域分離処理部26や空間フィルタ処理部27の後などでもよく、入力階調補正部23以降であって色補正部29以前であればどこに配置されても構わない。また、下地検出処理部24と下地除去処理部25とが連続して配置されず、その間に領域分離処理部26や空間フィルタ処理部27などが配置されても構わない。   In the color image processing apparatus 20, the background detection processing unit 24 and the background removal processing unit 25 are arranged immediately before the region separation processing unit 26, but the present invention is not limited to this. It may be after the spatial filter processing unit 27 or the like, and may be arranged anywhere after the input tone correction unit 23 and before the color correction unit 29. In addition, the background detection processing unit 24 and the background removal processing unit 25 may not be consecutively disposed, and the region separation processing unit 26, the spatial filter processing unit 27, and the like may be disposed therebetween.

次に、この発明の特徴部分である下地検出処理部24及び下地除去処理部25の構成について説明する。   Next, the configurations of the background detection processing unit 24 and the background removal processing unit 25, which are features of the present invention, will be described.

図2は、下地検出処理部24及び下地除去処理部25の構成を示すブロック図である。   FIG. 2 is a block diagram illustrating the configuration of the background detection processing unit 24 and the background removal processing unit 25.

下地検出処理部24は、分類手段24A、判定手段24B、及び、下地検出手段24Cを含む。この実施形態では、判定手段24Bは、この発明の第1の判定手段及び第2の判定手段を兼ねている。   The background detection processing unit 24 includes a classification unit 24A, a determination unit 24B, and a background detection unit 24C. In this embodiment, the determination unit 24B also serves as the first determination unit and the second determination unit of the present invention.

入力階調補正部23から出力されたRGB信号からなる画像データは分類手段24Aに入力される。   Image data composed of RGB signals output from the input tone correction unit 23 is input to the classification unit 24A.

分類手段24Aは、処理すべき画像データに基づく全体画像における注目画素の画素値と、注目画素に隣接する隣接画素が属するクラスのクラス画素値と、の差分値を算出し、差分値に基づいて、注目画素を隣接画素が属するクラス又は新たに設定したクラスに分類する分類処理を行う。   The classification unit 24A calculates a difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value of the class to which the adjacent pixel adjacent to the target pixel belongs, and based on the difference value Then, a classification process for classifying the target pixel into a class to which the adjacent pixel belongs or a newly set class is performed.

ここで、この実施形態では、画素値は、その画素(ここでは注目画素)のRGB信号の値であり、クラス画素値は、そのクラスに属する全ての画素の画素値(RGB信号の値)の平均値である。   Here, in this embodiment, the pixel value is the value of the RGB signal of the pixel (here, the target pixel), and the class pixel value is the pixel value (RGB signal value) of all the pixels belonging to the class. Average value.

各クラスのクラス情報が、図示しないメモリに保持される。クラス情報は、そのクラスに属する画素のRGB信号の最大値・最小値・平均値(クラス画素値)、位置情報(図3に示すように、クラス40に属する画素のうち、最も上に存在する画素(上端画素)41、最も下に存在する画素(下端画素)42、最も左に存在する画素(左端画素)43、及び、最も右に存在する画素(右端画素)44の位置情報)、及び、そのクラスに属する画素の数(画素数)を含む。なお、クラス情報は、関連クラス情報をさらに含む場合がある。各クラスにはインデックス番号が割り振られ、各クラスに属する画素には、そのクラスのインデックス番号が付与される。   Class information of each class is held in a memory (not shown). The class information exists at the top of the pixels belonging to the class 40, as shown in FIG. 3, the maximum value / minimum value / average value (class pixel value) of RGB signals of the pixels belonging to the class. Pixel (top pixel) 41, bottommost pixel (bottom pixel) 42, leftmost pixel (leftmost pixel) 43, and rightmost pixel (rightmost pixel) 44). , Including the number of pixels belonging to the class (number of pixels). Note that the class information may further include related class information. Each class is assigned an index number, and an index number of the class is assigned to a pixel belonging to each class.

上述の分類手段24Aは、注目画素の隣接画素のうち既にいずれかのクラスに分類された画素のクラス情報を読み出し、隣接画素が属するクラスに属するか否かを判定する。分類手段24Aは、隣接画素が属するクラスに注目画素が属すると判定した場合は、注目画素に隣接画素が属するクラスのインデックス番号を付与するとともにクラス情報を更新する。分類手段24Aは、隣接画素が属するクラスに注目画素が属さないと判定した場合は、新たに設定したクラスに注目画素を分類するとともに、注目画素に既存のクラスに設定されていない新たなインデックス番号を付与し、そのクラスのクラス情報を生成する。   The above-described classification unit 24A reads out the class information of the pixels already classified into any class among the adjacent pixels of the target pixel, and determines whether or not the adjacent pixel belongs to the class to which the adjacent pixel belongs. If the classification unit 24A determines that the target pixel belongs to the class to which the adjacent pixel belongs, the classification unit 24A assigns the index number of the class to which the adjacent pixel belongs to the target pixel and updates the class information. If the classifying unit 24A determines that the target pixel does not belong to the class to which the adjacent pixel belongs, the classifying unit 24A classifies the target pixel into the newly set class and also sets a new index number that is not set in the existing class for the target pixel. And class information of the class is generated.

各画素が分類される毎に更新されたクラス情報は、上述の図示しないメモリに一時的に退避される。このとき、分類手段24Aによってクラスに分類された画素のインデックス番号も、その画素の画素値とともにメモリに一時的に退避される。なお、インデックス番号を含むクラス情報は、後述する下地除去処理が開始可能になるまでラッチしてもよい。   The class information updated every time each pixel is classified is temporarily saved in the memory (not shown). At this time, the index number of the pixel classified into the class by the classification unit 24A is also temporarily saved in the memory together with the pixel value of the pixel. The class information including the index number may be latched until the background removal process described later can be started.

処理すべき画像データに基づく全体画像の全画素について分類処理が終了した後、全てのクラス情報が判定手段24Bに入力される。   After the classification process is completed for all pixels of the entire image based on the image data to be processed, all class information is input to the determination unit 24B.

判定手段24Bは、クラス情報に含まれる位置情報及び画素数に基づいて、所定の条件を満たすか否かを判定する判定処理を行う。判定結果は、下地検出手段24Cに入力される。   The determination unit 24B performs determination processing for determining whether or not a predetermined condition is satisfied based on the position information and the number of pixels included in the class information. The determination result is input to the background detection means 24C.

下地検出手段24Cは、判定手段24Bから入力された判定結果に基づいて、クラスが下地領域に該当するクラスであるか否かを判定する(1次判定)。また、下地検出手段24Cは、1次判定において下地領域に該当すると判定したクラスのクラス情報の最大値・最小値・平均値に基づいて、そのクラスが本当に下地領域に該当するか否かをさらに判定する(2次判定)。   The background detection unit 24C determines whether the class is a class corresponding to the background region based on the determination result input from the determination unit 24B (primary determination). Further, the background detection unit 24C further determines whether or not the class really corresponds to the background area based on the maximum value / minimum value / average value of the class information of the class determined to correspond to the background area in the primary determination. Determine (secondary determination).

下地検出手段24Cによって下地領域に該当すると判定されたクラスのクラス情報、及び、そのクラスに属する全ての画素の画素値は、下地検出結果として下地検出処理部24から出力され下地除去処理部25に入力される。   The class information of the class determined to correspond to the background area by the background detection means 24C and the pixel values of all the pixels belonging to the class are output from the background detection processing unit 24 as the background detection result and are supplied to the background removal processing unit 25. Entered.

下地除去処理部25は、下地除去処理手段25Aを含む。下地除去処理手段25Aは、下地検出結果として出力されたクラス情報及び画素値に基づいて、下地領域であると判定された画素のRGB信号に対して所定の下地除去処理を施す。下地除去処理とは、例えば下地領域であると判定された画素のRGB信号の各値を上げる処理によって、その画素を白色にする処理をいう。下地除去処理が施された画像データは、領域分離処理部26に入力される。   The background removal processing unit 25 includes background removal processing means 25A. Based on the class information and the pixel value output as the background detection result, the background removal processing unit 25A performs a predetermined background removal process on the RGB signal of the pixel determined to be the background area. The background removal processing refers to processing for making a pixel white by increasing each value of the RGB signal of the pixel determined to be a background region, for example. The image data that has undergone the background removal processing is input to the region separation processing unit 26.

図4は、下地検出処理部24の分類手段24Aにおける処理手順を示すフローチャートである。   FIG. 4 is a flowchart showing a processing procedure in the classification means 24A of the background detection processing unit 24.

まず、分類手段24Aは、入力階調補正部23から出力されメモリに退避されているRGB信号の画像データを、1画素分読み出す(S1)。ここで、入力されたR、G、Bの各画像データは8ビットデータであり、0から255の値をとるものとする。   First, the classification unit 24A reads out image data of RGB signals output from the input tone correction unit 23 and saved in the memory for one pixel (S1). Here, the input R, G, and B image data are 8-bit data and take values from 0 to 255.

次に、分類手段24Aは、読み出した画素(注目画素)の位置が画像の最も左上の画素であるか否かを判定する(S2)。分類手段24Aは、注目画素が最も左上の画素であると判定した場合、新たにクラスを設定し、注目画素に新たなクラスのインデックス番号(例えば、インデックス番号としての最小値“0”)を付与し、注目画素が属することになったクラスの左端画素の位置情報として注目画素の位置情報(座標値)を設定し、クラスのR・G・B値のそれぞれの最大値・最小値・平均値として注目画素のR・G・B値をそれぞれ設定し、更に、クラスのカウント値に1を設定する(S3)。そして、分類手段24Aは、S1に戻って次の1画素の画像データを読み出す。   Next, the classification unit 24A determines whether or not the position of the read pixel (target pixel) is the upper left pixel of the image (S2). If the classifying unit 24A determines that the pixel of interest is the upper left pixel, it sets a new class and assigns a new class index number (for example, the minimum value “0” as the index number) to the pixel of interest. The position information (coordinate value) of the target pixel is set as the position information of the leftmost pixel of the class to which the target pixel belongs, and the maximum, minimum, and average values of the R, G, and B values of the class are set. Then, R, G, and B values of the pixel of interest are set, and 1 is set as the count value of the class (S3). Then, the classification unit 24A returns to S1 and reads the image data of the next one pixel.

分類手段24Aは、S2において注目画素が最も左上の画素でないと判定した場合、注目画素が全体画像の1ライン目の画素であるか否かを判定する(S4)。分類手段24Aは、注目画素が1ライン目の画素であると判定した場合、1画素分左側に存在する既にクラスに分類された隣接画素が属するクラス情報を取得する(S5)。   If the classifying unit 24A determines in S2 that the target pixel is not the upper leftmost pixel, it determines whether or not the target pixel is a pixel on the first line of the entire image (S4). If the classifying unit 24A determines that the pixel of interest is a pixel on the first line, the classifying unit 24A acquires class information to which an adjacent pixel already classified into the class that exists on the left side by one pixel belongs (S5).

分類手段24Aは、クラス情報のRGB値の各平均値と注目画素のRGB値との差分値の絶対値を算出して(この発明の第1ステップに相当する。)、その絶対値に基づいて、左側の隣接画素が属する既存のクラスに注目画素が属するか否かを判定する(S6)。具体的には、分類手段24Aは、RGB値のそれぞれの差分値の絶対値が予め設定した第1の閾値以下であると判定した場合、注目画素は左側の隣接画素が属しているクラスに属すると判定し、差分値の絶対値が第1の閾値を超えている場合、注目画素は左側の隣接画素が属しているクラスに属さないと判定する。   The classifying unit 24A calculates an absolute value of a difference value between each average value of the RGB values of the class information and the RGB value of the target pixel (corresponding to the first step of the present invention), and based on the absolute value. Then, it is determined whether or not the target pixel belongs to an existing class to which the left adjacent pixel belongs (S6). Specifically, when the classification unit 24A determines that the absolute value of each difference value of the RGB values is equal to or less than a first threshold value set in advance, the pixel of interest belongs to the class to which the left adjacent pixel belongs. If the absolute value of the difference value exceeds the first threshold value, it is determined that the target pixel does not belong to the class to which the left adjacent pixel belongs.

分類手段24Aは、左側の隣接画素が属しているクラスに注目画素が属すると判定した場合、注目画素に隣接画素と同じクラスのインデックス番号を付与し、そのクラスのクラス情報のうち右端画素の位置情報、最大値・最小値・平均値、及び、カウント値を更新する(S7)。そして、分類手段24Aは、S1に戻って次の1画素の画像データを読み出す。   If the classification unit 24A determines that the target pixel belongs to the class to which the left adjacent pixel belongs, the classification unit 24A assigns the index number of the same class as the adjacent pixel to the target pixel, and the position of the right end pixel in the class information of the class The information, maximum value / minimum value / average value, and count value are updated (S7). Then, the classification unit 24A returns to S1 and reads the image data of the next one pixel.

一方、分類手段24Aは、左側の隣接画素が属しているクラスに注目画素が属さないと判定した場合、新たにクラスを設定し、その新たに設定したクラスに注目画素を分類する(S8)。さらに、分類手段24Aは、S3の場合と同様に、注目画素が属することになったクラスの左端画素の位置情報として注目画素の位置情報(座標値)を設定し、クラスのR・G・B値のそれぞれの最大値・最小値・平均値として注目画素のR・G・B値をそれぞれ設定し、更に、クラスのカウント値に1を設定する。そして、分類手段24Aは、S1に戻って次の1画素の画像データを読み出す。   On the other hand, if the classifying unit 24A determines that the target pixel does not belong to the class to which the left adjacent pixel belongs, a new class is set, and the target pixel is classified into the newly set class (S8). Further, the classification means 24A sets the position information (coordinate value) of the target pixel as the position information of the leftmost pixel of the class to which the target pixel belongs, as in S3, and class R, G, B The R, G, and B values of the pixel of interest are set as the maximum value, minimum value, and average value of the values, respectively, and 1 is set as the class count value. Then, the classification unit 24A returns to S1 and reads the image data of the next one pixel.

S7及びS8の処理は、この発明の第2ステップに相当する。   The processes of S7 and S8 correspond to the second step of the present invention.

分類手段24Aは、S4において注目画素が1ライン目の画素でないと判定した場合、注目画素が全体画像のうちの左端の画素であるか否かを判定する(S9)。分類手段24Aは、注目画素が全体画像のうちの左端の画素であると判定した場合、注目画素の上側の隣接画素が属するクラスのクラス情報を取得する(S10)。そして、分類手段24Aは、S6と同様の処理によって、RGB値の差分値を算出し(この発明の第1ステップに相当する。)、差分値の絶対値に基づいて、上側の隣接画素が属するクラスに注目画素が属するか否かを判定する(S11)。   If the classifying unit 24A determines in S4 that the target pixel is not the pixel in the first line, it determines whether or not the target pixel is the leftmost pixel in the entire image (S9). If the classifying unit 24A determines that the target pixel is the leftmost pixel of the entire image, the classifying unit 24A acquires class information of a class to which the adjacent pixel above the target pixel belongs (S10). Then, the classification means 24A calculates the difference value of the RGB values by the same process as S6 (corresponding to the first step of the present invention), and the upper adjacent pixel belongs based on the absolute value of the difference value. It is determined whether or not the target pixel belongs to the class (S11).

分類手段24Aは、上側の隣接画素が属するクラスに注目画素が属すると判定した場合、S7と同様に、注目画素が属することになったクラスのクラス情報を更新する(S12)。そして、分類手段24AはS1に戻って次の1画素の画像データを読み出す。また、分類手段24Aは、上側の隣接画素が属するクラスに注目画素が属さないと判定した場合、S8と同様に、新たにクラスを設定し、その新たに設定したクラスに注目画素を分類する(S13)。そして、分類手段24AはS1に戻って次の1画素の画像データを読み出す。   If the classification unit 24A determines that the pixel of interest belongs to the class to which the upper adjacent pixel belongs, the classification unit 24A updates the class information of the class to which the pixel of interest belongs, similarly to S7 (S12). Then, the classification unit 24A returns to S1 and reads the image data of the next one pixel. If the classifying unit 24A determines that the target pixel does not belong to the class to which the upper adjacent pixel belongs, similarly to S8, the classifying unit 24A sets a new class and classifies the target pixel into the newly set class ( S13). Then, the classification unit 24A returns to S1 and reads the image data of the next one pixel.

S12及びS13の処理は、この発明の第2ステップに相当する。   The processes of S12 and S13 correspond to the second step of the present invention.

分類手段24Aは、S9において注目画素が全体画像のうちの左端の画素でないと判定した場合、注目画素の上側の隣接画素が属するクラスのクラス情報と、左側の隣接画素が属するクラスのクラス情報と、をメモリから読み出す(S14)。そして、分類手段24Aは、S6と同様の処理によって、RGB値の差分値を算出し(この発明の第1ステップに相当する。)、差分値の絶対値に基づいて、上側の隣接画素が属するクラス及び左側の隣接画素が属するクラスのうち少なくとも何れか一方のクラスに注目画素が属するか否かを判定する(S15)。   If the classifying unit 24A determines in S9 that the pixel of interest is not the leftmost pixel of the entire image, the class information of the class to which the adjacent pixel above the pixel of interest belongs, and the class information of the class to which the left adjacent pixel belongs Are read from the memory (S14). Then, the classification means 24A calculates the difference value of the RGB values by the same process as S6 (corresponding to the first step of the present invention), and the upper adjacent pixel belongs based on the absolute value of the difference value. It is determined whether the pixel of interest belongs to at least one of the class and the class to which the left adjacent pixel belongs (S15).

分類手段24Aは、S15において上側の隣接画素が属するクラス及び左側の隣接画素が属するクラスの何れにも注目画素が属さないと判定した場合、S8と同様に、新たにクラスを設定し、その新たに設定したクラスに注目画素を分類して(S16)、S22の処理に進む。   If the classification unit 24A determines in S15 that the pixel of interest does not belong to either the class to which the upper adjacent pixel belongs or the class to which the left adjacent pixel belongs, similarly to S8, the classification unit 24A sets a new class, The target pixel is classified into the class set to (S16), and the process proceeds to S22.

また、分類手段24Aは、S15において上側の隣接画素が属するクラス及び左側の隣接画素が属するクラスのうち少なくとも何れか一方のクラスに注目画素が属すると判定した場合、さらに、上側の隣接画素が属するクラス及び左側の隣接画素が属するクラスの両方に注目画素が属するか否かを判定する(S17)。   If the classification unit 24A determines in S15 that the pixel of interest belongs to at least one of the class to which the upper adjacent pixel belongs and the class to which the left adjacent pixel belongs, the upper adjacent pixel further belongs. It is determined whether or not the pixel of interest belongs to both the class and the class to which the left adjacent pixel belongs (S17).

分類手段24Aは、S17において、両方のクラスには属さない、即ち、上側の隣接画素が属するクラス及び左側の隣接画素が属するクラスのうち何れか一方のクラスのみに注目画素が属すると判定した場合、S7と同様に、注目画素が属することになったクラスのクラス情報を更新して(S18)、S22の処理に進む。   When the classification unit 24A determines in S17 that the pixel of interest does not belong to both classes, that is, the pixel of interest belongs to only one of the class to which the upper adjacent pixel belongs and the class to which the left adjacent pixel belongs As in S7, the class information of the class to which the target pixel belongs is updated (S18), and the process proceeds to S22.

S16及びS18の処理は、この発明の第2ステップに相当する。   The processes of S16 and S18 correspond to the second step of the present invention.

分類手段24Aは、上側の隣接画素が属するクラス及び左側の隣接画素が属するクラスの両方に注目画素が属すると判定した場合、注目画素に対して、2つのクラスのうちインデックス番号が若い方のクラスのインデックス番号を付与し、注目画素が属することになった一方のクラスのクラス情報を更新する(S19)。   When the classifying unit 24A determines that the target pixel belongs to both the class to which the upper adjacent pixel belongs and the class to which the left adjacent pixel belongs, the class having the smaller index number of the two classes with respect to the target pixel And the class information of one class to which the pixel of interest belongs is updated (S19).

そして、分類手段24Aは、2つのクラスのクラス情報の中から最大値・最小値・平均値のうち少なくとも1つを互いに比較して差分値を算出し、差分値と予め設定した所定の閾値とを比較した結果に基づいて、2つのクラスが関連クラスであるか否かを判定する(S20)。S20の処理は、この発明の2個のクラスを単一のクラスに統合するステップに相当する。   Then, the classifying unit 24A calculates a difference value by comparing at least one of the maximum value, the minimum value, and the average value from the class information of the two classes, and calculates the difference value and a predetermined threshold value set in advance. Based on the comparison result, it is determined whether or not the two classes are related classes (S20). The process of S20 corresponds to the step of integrating the two classes of the present invention into a single class.

分類手段24Aは、差分値が予め設定した所定の閾値以下である場合は、上述の2つのクラスは単一のクラスにすべき関係にある(関連クラスである)と判定する(S21)。そして、分類手段24Aは、2つのクラスのうち注目画素が属しないことになった方のクラスのクラス情報の中の関連クラス情報として、注目画素が属することになった方のクラスのインデックス番号を設定する。関連クラス情報を設定しておくことによって、後の処理において、2つのクラスが単一のクラスにすべき関係にあると判定できるようになる。分類手段24Aは、S21の処理の後、S22の処理に進む。   If the difference value is equal to or smaller than a predetermined threshold value, the classification unit 24A determines that the above two classes are in a relationship to be a single class (related classes) (S21). Then, the classification unit 24A uses the index number of the class to which the pixel of interest belongs as the related class information in the class information of the class to which the pixel of interest does not belong, of the two classes. Set. By setting the related class information, it becomes possible to determine that the two classes have a relationship to be a single class in later processing. The classification unit 24A proceeds to the process of S22 after the process of S21.

また、分類手段24Aは、S20において2つのクラスは関連クラスではないと判定した場合、S22の処理に進む。   If the classification unit 24A determines that the two classes are not related classes in S20, the classification unit 24A proceeds to the process of S22.

分類手段24Aは、全体画像の全画素について分類処理が終了したか否か、すなわち全画素がクラスに分類されたか否かを判定する(S22)。分類手段24Aは、全ての画素をクラスに分類したと判定した場合、図5に示す判定処理に進む。一方、分類手段24Aは、まだ全ての画素をクラスに分類していないと判定した場合、S1に戻って次の1画素の画像データを読み出す。   The classification unit 24A determines whether or not the classification process has been completed for all the pixels of the entire image, that is, whether or not all the pixels have been classified into classes (S22). If the classification unit 24A determines that all pixels have been classified into classes, the classification unit 24A proceeds to the determination process illustrated in FIG. On the other hand, when the classification unit 24A determines that all the pixels have not been classified into the class, the classification unit 24A returns to S1 and reads the image data of the next one pixel.

なお、各画素に付与されたインデックス番号及び各クラスのクラス情報は、上述のメモリに一時的に退避される。   The index number assigned to each pixel and the class information of each class are temporarily saved in the above memory.

図5は、下地検出処理部24の判定手段24Bにおける処理手順を示すフローチャートである。まず、判定手段24Bは、分類処理で作成されたクラス情報をインデックス番号が大きい方から順に、メモリから読み出す(S31)。   FIG. 5 is a flowchart illustrating a processing procedure in the determination unit 24B of the background detection processing unit 24. First, the determination unit 24B reads out the class information created by the classification process from the memory in order from the largest index number (S31).

判定手段24Bは、読み出したクラス情報の中の関連クラス情報にインデックス番号が設定されている場合は、関連クラス情報に設定されているインデックス番号のクラスのクラス情報と、現在注目しているクラスのクラス情報と、に基づいて、2つのクラスを単一のクラスに統合するように、関連クラス情報に設定されているインデックス番号のクラスのクラス情報を更新する(関連クラス統合処理)(S32)。なお、更新されたクラス情報は上述のメモリに退避される。   When the index number is set in the related class information in the read class information, the determination unit 24B determines the class information of the class of the index number set in the related class information and the class currently being focused on. Based on the class information, the class information of the class of the index number set in the related class information is updated so as to integrate the two classes into a single class (related class integration process) (S32). The updated class information is saved in the above memory.

この際、判定手段24Bは、位置情報のそれぞれについて、位置情報で示される領域が広がるように更新する。判定手段24Bは、RGB値の最大値及び最小値について、2つのクラスの最大値同士及び最小値同士をそれぞれ比較して適正な値に更新し、RGB値のそれぞれの平均値については、2つのクラスのそれぞれの平均値とカウント値とに基づいて、2つのクラスが統合された場合の平均値を算出し直し、更新する。判定手段24Bは、カウント値についても両クラスのカウント値を加算した値に更新する。   At this time, the determination unit 24B updates each position information so that the area indicated by the position information is expanded. The determination unit 24B compares the maximum values and the minimum values of the two classes with each other and updates them to appropriate values, and updates the average values of the RGB values with two values. Based on the average value and count value of each class, the average value when the two classes are integrated is recalculated and updated. The determination unit 24B also updates the count value to a value obtained by adding the count values of both classes.

その後、判定手段24Bは、現在注目しているクラスのクラス情報の位置情報を、関連クラスの位置情報と同じ値にし、RGB値の最大値・最小値・平均値を関連クラスのRGB値の最大値・最小値・平均値と同じ値にする。また、判定手段24Bは、現在注目しているクラスのカウント値を“0”に更新する。   After that, the determination unit 24B sets the position information of the class information of the currently focused class to the same value as the position information of the related class, and sets the maximum value / minimum value / average value of the RGB values to the maximum of the RGB values of the related class. Set to the same value as the value, minimum value, and average value. Further, the determination unit 24B updates the count value of the currently focused class to “0”.

次に、判定手段24Bは、全クラスについて、S31及びS32の処理が終了したか否かを判定し、全クラスについて終了するまでS31及びS32の処理を繰り返す(S33)。   Next, the determination unit 24B determines whether or not the processing of S31 and S32 is completed for all classes, and repeats the processing of S31 and S32 until the processing is completed for all classes (S33).

次に、判定手段24Bは、更新されたクラス情報をインデックス番号が小さい方から順にメモリから読み出す(S34)。そして、判定手段24Bは、更新されたクラス情報の位置情報に基づいて、全体画像の端に位置する画素を含むか否かを判定することで、クラスが全体画像の端に位置するか否かを判定する(S35)(この発明の第3ステップに相当する。)。判定手段24Bは、全体画像の端に位置するクラスであると判定した場合、クラス情報に第1の下地クラスに指定されたことを意味するフラグを付与する(S36)。判定手段24Bは、全体画像の端に位置するクラスではないと判定した場合、第1の下地クラスのフラグを付与することなくS37の処理に進む。   Next, the determination unit 24B reads the updated class information from the memory in order from the smallest index number (S34). Then, the determination unit 24B determines whether or not the class is positioned at the end of the entire image by determining whether or not the pixel includes the pixel positioned at the end of the entire image based on the updated position information of the class information. (S35) (corresponds to the third step of the present invention). If the determination unit 24B determines that the class is located at the end of the entire image, the determination unit 24B adds a flag indicating that it is designated as the first background class to the class information (S36). If the determination unit 24B determines that the class is not located at the end of the entire image, the determination unit 24B proceeds to the process of S37 without adding the flag of the first background class.

次に、判定手段24Bは、注目しているクラスが、全体画像の全画素数に対して、予め設定した第1の割合以上の数の画素を含むか否かを、クラス情報のカウント値に基づいて判定する(S37)(この発明の第4ステップに相当する。)。判定手段24Bは、注目しているクラスが全体画像の全画素数に対して予め設定した第1の割合以上の数の画素を含むと判定した場合、クラス情報に第2の下地クラスに指定されたことを意味するフラグを付与する(S38)。判定手段24Bは、注目しているクラスが全体画像の全画素数に対して予め設定した第1の割合以上の数の画素を含まないと判定した場合、第2の下地クラスのフラグを付与することなくS39の処理に進む。   Next, the determination unit 24B uses the count value of the class information to determine whether or not the class of interest includes a number of pixels that is equal to or greater than a preset first ratio with respect to the total number of pixels of the entire image. Determination based on (S37) (corresponds to the fourth step of the present invention). If the determination unit 24B determines that the class of interest includes a number of pixels that is equal to or greater than the first ratio set in advance with respect to the total number of pixels of the entire image, the determination unit 24B is designated as the second background class in the class information. A flag indicating that this is assigned (S38). If the determination unit 24B determines that the class of interest does not include a number of pixels equal to or greater than a preset first ratio with respect to the total number of pixels in the entire image, the determination unit 24B adds a flag for the second background class. Then, the process proceeds to S39.

判定手段24Bは、全クラスについて、S34からS37までの処理が終了したか否かを判定し、全クラスについて終了するまで、S34からS37までの処理を繰り返す(S39)。   The determination unit 24B determines whether or not the processing from S34 to S37 has been completed for all classes, and repeats the processing from S34 to S37 until it has been completed for all classes (S39).

判定手段24Bは、全クラスについてS34からS37までの処理が終了したと判定した場合、判定処理を終了して下地検出処理に進む。   If the determination unit 24B determines that the processing from S34 to S37 has been completed for all classes, the determination unit 24B ends the determination processing and proceeds to background detection processing.

図6は、下地検出処理部24の下地検出手段24Cにおける処理手順を示すフローチャートである。   FIG. 6 is a flowchart showing a processing procedure in the background detection means 24C of the background detection processing unit 24.

下地検出手段24Cは、第1の下地クラスのみに該当するクラスからなる第1のグループ、第2の下地クラスのみに該当するクラスからなる第2のグループ、及び、第1の下地クラスと第2の下地クラスとの両方に該当するクラスからなる第3のグループ、に各クラスを分類する(S41)。そして、下地検出手段24Cは、第1〜第3グループのうち、各グループに属するクラスのカウント値の合計が最も多いグループに属するクラスを下地領域として検出する(S42)。   The background detection means 24C includes a first group consisting of classes corresponding only to the first background class, a second group consisting of classes corresponding only to the second background class, and the first background class and the second group. Each class is classified into a third group consisting of classes corresponding to both of the base classes (S41). Then, the background detection unit 24C detects the class belonging to the group having the largest total count value of the classes belonging to each of the first to third groups as a background region (S42).

S41及びS42の処理は、この発明の第5ステップに相当する。   The processing of S41 and S42 corresponds to the fifth step of the present invention.

下地検出手段24Cは、下地領域であるとして検出した全てのクラスのカウント値の合計を算出する(S43)。そして、下地検出手段24Cは、カウント値の合計が全体画像の全画素数に対して予め設定した第2の割合以上あるか否かを判定する(S44)。   The background detection means 24C calculates the sum of the count values of all classes detected as being the background area (S43). Then, the background detection unit 24C determines whether or not the total of the count values is equal to or greater than a second ratio set in advance with respect to the total number of pixels of the entire image (S44).

下地検出手段24Cは、カウント値の合計が全体画像の全画素数に対して第2の割合未満であると判定した場合、その全体画像には下地領域はないと判定して(S45)、下地検出処理を終了する。   When it is determined that the total count value is less than the second ratio with respect to the total number of pixels of the entire image, the background detection unit 24C determines that there is no background area in the entire image (S45). The detection process ends.

S44及びS45の処理は、この発明の第6ステップに相当する。   The processes of S44 and S45 correspond to the sixth step of the present invention.

下地検出手段24Cは、カウント値の合計が全体画像の全画素数に対して予め設定した第2の割合以上あると判定した場合、下地領域として検出されたクラスのそれぞれのRGB値の最大値・最小値・平均値を読み出す(S46)。そして、下地検出手段24Cは、下地領域として検出された各クラスが、本当に下地領域であるか否かを再判定する(S47)。具体的には、下地検出手段24Cは、各クラスのRGB値の最大値から最小値を減算して得られる減算値が予め設定した第2の閾値以下であり、かつ、平均値が第3の閾値以上であるか否かを判定する。   If the background detection unit 24C determines that the sum of the count values is equal to or greater than the second preset ratio with respect to the total number of pixels of the entire image, the maximum RGB value of each class detected as the background region The minimum value and the average value are read (S46). Then, the background detection means 24C re-determines whether each class detected as the background area is really a background area (S47). Specifically, the background detection unit 24C has a subtraction value obtained by subtracting the minimum value from the maximum value of the RGB values of each class equal to or less than a preset second threshold value, and the average value is the third value. It is determined whether or not the threshold value is exceeded.

下地検出手段24Cは、減算値が第2の閾値以下であり、かつ、平均値が第3の閾値以上である場合、そのクラスを最終的に下地領域であると判定する(S48)。下地検出手段24Cは、減算値が第2の閾値を超え、又は、平均値が第3の閾値未満である場合、そのクラスは下地領域ではないと判定する(S49)。下地検出処理の結果は、メモリに退避される。   If the subtraction value is equal to or smaller than the second threshold value and the average value is equal to or greater than the third threshold value, the background detection unit 24C determines that the class is finally a background region (S48). If the subtraction value exceeds the second threshold value or the average value is less than the third threshold value, the background detection unit 24C determines that the class is not a background region (S49). The result of the background detection process is saved in the memory.

S47からS49までの処理は、この発明の第7ステップに相当する。   The processing from S47 to S49 corresponds to the seventh step of the present invention.

図7は、下地除去処理部25における処理手順を示すフローチャートである。下地除去処理部25は、下地検出処理のS47において最終的に下地領域であると判定されたクラスのクラス情報をメモリから読み出す(S51)。次に、下地除去処理部25は、1画素のRGB値を、分類処理において付与されたクラスを示すインデックス番号とともに読み出す(S52)。   FIG. 7 is a flowchart showing a processing procedure in the background removal processing unit 25. The background removal processing unit 25 reads from the memory the class information of the class finally determined to be the background area in S47 of the background detection process (S51). Next, the background removal processing unit 25 reads the RGB value of one pixel together with the index number indicating the class assigned in the classification process (S52).

下地除去処理部25は、注目している画素に付与されているインデックス番号が、最終的に下地領域であると判定されたクラスのインデックス番号の中にあるか否かを判定する(S53)。   The background removal processing unit 25 determines whether or not the index number assigned to the pixel of interest is in the index number of the class finally determined to be the background area (S53).

下地除去処理部25は、注目画素に付与されているインデックス番号が最終的に下地領域であると判定されたクラスのインデックス番号の中にある場合、その注目画素に対して所定の下地除去処理を施す(S54)。具体的には、例えば、下地除去処理部25は、注目画素のRGB値を全て255にすることによって、下地を除去する。   If the index number assigned to the pixel of interest is within the index number of the class that is finally determined to be the background region, the background removal processing unit 25 performs predetermined background removal processing on the pixel of interest. (S54). Specifically, for example, the background removal processing unit 25 removes the background by setting all the RGB values of the target pixel to 255.

S54の処理は、この発明の第8ステップに相当する。   The process of S54 corresponds to the eighth step of the present invention.

下地除去処理部25は、注目画素に付与されているインデックス番号が最終的に下地領域であると判定されたクラスのインデックス番号の中にない場合、その注目画素に対して下地除去処理を施こすことなく、S55の処理に進む。   If the index number assigned to the pixel of interest is not in the index number of the class that is finally determined to be the background region, the background removal processing unit 25 performs background removal processing on the pixel of interest. Instead, the process proceeds to S55.

下地除去処理部25は、全体画像の全画素についてS52〜S54の処理を終了したか否かを判定し(S55)、終了したと判定した場合は下地除去処理を終了し、結果的に得られたR・G・B値からなる画像データを領域分離処理部26に出力する。下地除去処理部25は、まだ全ての画素に対して終了していないと判定した場合は、S52〜S54の処理を繰り返す。   The background removal processing unit 25 determines whether or not the processing of S52 to S54 has been completed for all the pixels of the entire image (S55). If it is determined that the processing has been completed, the background removal processing ends, and the result is obtained as a result. The image data composed of the R, G, and B values is output to the region separation processing unit 26. If the background removal processing unit 25 determines that the processing has not been completed for all the pixels, the background removal processing unit 25 repeats the processing of S52 to S54.

次に、図8に示す全体画像のうちの一部の画像領域50に対して、上述の分類処理、判定処理、下地検出処理及び下地除去処理を施す場合を例にあげて、具体的に説明する。図8は、処理すべき画像データに基づく全体画像の一例を示す説明図である。図9は、図8に示す一部の画像領域50における各画素の画像データを示す説明図であり、図9(A)は、4画素目まで分類処理が終わった状態の各画素の画像データを示す説明図であり、図9(B)は、画像領域50の全ての画素について分類処理が終了した状態における各画素の画像データを示す説明図であり、図9(C)は、1画素分の画像データの記述例を示す説明図である。   Next, the case where the above-described classification process, determination process, background detection process, and background removal process are performed on a part of the image area 50 in the entire image shown in FIG. 8 will be described in detail. To do. FIG. 8 is an explanatory diagram illustrating an example of an entire image based on image data to be processed. FIG. 9 is an explanatory diagram showing the image data of each pixel in the partial image region 50 shown in FIG. 8, and FIG. 9A shows the image data of each pixel in a state where the classification process is finished up to the fourth pixel. FIG. 9B is an explanatory diagram illustrating image data of each pixel in a state where the classification process has been completed for all the pixels in the image region 50, and FIG. 9C illustrates one pixel. It is explanatory drawing which shows the example of description of the image data of a minute.

ここで、画素に対する処理は、上から1行目の行から開始し、1行目の次に2行目、2行目の次に3行目というように、順に下方に向けて進めていく。また、同じ行内においては、左端の画素から処理を開始し、右側へ向けて順に処理を進めていく。   Here, the processing for the pixels starts from the first line from the top, and proceeds downward in order, such as the first line, the second line, the second line, and the third line. . In the same row, the processing starts from the leftmost pixel and proceeds in order toward the right side.

また、図9は図8の一部を示す図であるため、本来であれば周辺に既にインデックス番号が付与された画素のクラス情報が存在するが、ここでは、説明の簡素化のため、画像領域50の周辺の画素が属するクラスのクラス情報を無視し、図9の画素のみが存在するものとして、3つの画素51〜53についての分類処理を例にあげて説明する。なお、左上の画素位置を{x,y}={0,0}として説明する。   FIG. 9 is a diagram showing a part of FIG. 8, and therefore there is normally class information of pixels to which index numbers have already been assigned in the vicinity, but here, in order to simplify the description, Assuming that the class information of the class to which the peripheral pixels of the region 50 belong is ignored and only the pixel of FIG. 9 exists, the classification process for the three pixels 51 to 53 will be described as an example. Note that the upper left pixel position will be described as {x, y} = {0, 0}.

画素51は、左側の隣接画素のみが、既に分類処理を施されており、クラスのインデックス番号を付与されている段階での分類処理を説明するための例である。この段階でのインデックス番号0のクラスのRGB値の最大値・最小値・平均値は、図9に記載の通りとなっている。画素51の左側の隣接画素はインデックス番号0のクラスに属している。画素51の分類処理においては、画素51のRGB値と、インデックス番号0のクラスのRGB値の平均値と、を比較する。具体的には、[数2]に示すように、RGB値のそれぞれの差分値の絶対値を算出し、その算出結果を第1の閾値と比較する。   The pixel 51 is an example for explaining the classification process at the stage where only the left adjacent pixel has already been subjected to the classification process and is given a class index number. The maximum value, minimum value, and average value of the RGB values of the class of index number 0 at this stage are as shown in FIG. The adjacent pixel on the left side of the pixel 51 belongs to the class with index number 0. In the classification process of the pixel 51, the RGB value of the pixel 51 is compared with the average value of the RGB values of the class of index number 0. Specifically, as shown in [Equation 2], the absolute value of each difference value of the RGB values is calculated, and the calculation result is compared with the first threshold value.

Figure 2006229817
Figure 2006229817

ここで、例えば第1の閾値として“5”を予め設定しておく。すると、この場合、R・G・B値の全ての差分値の絶対値が閾値以下であるので、画素51は左側の隣接画素が属するクラスに属すると判定される。このため、画素51のインデックス番号Idx=0と設定し、インデックス番号0のクラスのRGB値の最大値・最小値・平均値を、画素51のRGB値を考慮して更新する。   Here, for example, “5” is set in advance as the first threshold value. Then, in this case, since the absolute value of all the difference values of the R, G, and B values is equal to or smaller than the threshold value, the pixel 51 is determined to belong to the class to which the left adjacent pixel belongs. Therefore, the index number Idx = 0 of the pixel 51 is set, and the maximum value / minimum value / average value of the RGB value of the class of the index number 0 is updated in consideration of the RGB value of the pixel 51.

画素51の例の場合、最大値に変化はなく、R=247、G=244、B=242である。最小値は、R=240、G=240、B=238、に更新される。また、平均値は、R=(245×4+240)÷5=244、G=(242×4+240)÷5=242、B=(240×4+238)÷5=240、に更新される。また、カウント値は1加算されて5となる。位置情報は上下左右のうち右だけが更新され、{上,下,左,右}={0,0,0,4}となる。   In the example of the pixel 51, there is no change in the maximum value, and R = 247, G = 244, and B = 242. The minimum value is updated to R = 240, G = 240, and B = 238. The average value is updated to R = (245 × 4 + 240) ÷ 5 = 244, G = (242 × 4 + 240) ÷ 5 = 242, and B = (240 × 4 + 238) ÷ 5 = 240. Also, the count value is incremented by 1 and becomes 5. Only the right of the upper, lower, left and right position information is updated, and {Up, Down, Left, Right} = {0, 0, 0, 4}.

なお、注目する画素51のRGB値に対して、隣接画素が属するクラスのRGB値の平均値を比較することに限定されず、最大値又は最小値を比較することもできる。   Note that the average value of the RGB values of the class to which the adjacent pixel belongs is not limited to the RGB value of the pixel 51 of interest, and the maximum value or the minimum value can also be compared.

次に画素52の分類処理について説明する。画素52は、上側の隣接画素のみが、既に分類処理を施されておりクラスのインデックス番号を付与されている段階での分類処理を説明するための例である。画素52の上側の隣接画素が属するクラス、即ち、インデックス番号0のクラスのRGB値の最大値・最小値・平均値は、画素51についての処理で更新されている。画素52の分類処理においては、画素52のRGB値と、更新された後のインデックス番号0のクラスのRGB値の平均値と、を画素51についての分類処理時と同様に比較する。RGB値のそれぞれの差分値の絶対値は、[数3]に示すようになる。   Next, the classification process of the pixels 52 will be described. The pixel 52 is an example for explaining the classification process at the stage where only the upper adjacent pixel has already been subjected to the classification process and is assigned a class index number. The maximum value, the minimum value, and the average value of the RGB values of the class to which the adjacent pixel above the pixel 52 belongs, that is, the class having the index number 0, are updated in the process for the pixel 51. In the classification process of the pixel 52, the RGB value of the pixel 52 is compared with the average value of the updated RGB values of the class of index number 0 in the same manner as in the classification process for the pixel 51. The absolute values of the difference values of the RGB values are as shown in [Equation 3].

Figure 2006229817
Figure 2006229817

画素52の分類処理では、R値の差分値の絶対値が第1の閾値(ここでは5)より大きくなっている。このため、画素52は、上側の隣接画素が属するクラスとは異なるクラスに属すると判定される。このため、これまでのインデックス番号Idxの最大値(ここでは0)に1加算して、Idx=1と設定し、インデックス番号1のRGB値の最大値・最小値・平均値を設定する。ここでは、インデックス番号1のクラスに属する画素は1つだけなので、最大値=最小値=平均値であり、それぞれのRGB値として、R=250、G=239、B=245が設定される。また、カウント値として1が設定され、位置情報として、{上,下,左,右}={1,1,0,0}が設定される。   In the classification process of the pixel 52, the absolute value of the difference value of the R value is larger than the first threshold (here, 5). For this reason, it is determined that the pixel 52 belongs to a class different from the class to which the upper adjacent pixel belongs. Therefore, 1 is added to the maximum value (here, 0) of the index number Idx so far, and Idx = 1 is set, and the maximum value / minimum value / average value of the RGB values of index number 1 are set. Here, since there is only one pixel belonging to the class of index number 1, maximum value = minimum value = average value, and R = 250, G = 239, and B = 245 are set as the respective RGB values. Further, 1 is set as the count value, and {upper, lower, left, right} = {1, 1, 0, 0} is set as the position information.

次に画素53の分類処理について説明する。画素53は、上側の隣接画素及び左側の隣接画素が、既に分類処理を施されておりクラスのインデックス番号を付与されている段階での分類処理を説明するための例である。画素53の上側の隣接画素が属するクラス、即ち、インデックス番号0のクラスのRGB値の最大値・最小値・平均値は、画素51についての処理で更新されており、画素53の左側の隣接画素52が属するクラス、即ち、インデックス番号1のクラスのRGB値の最大値・最小値・平均値は、画素52の処理で設定された状態となっている。   Next, the classification process of the pixels 53 will be described. The pixel 53 is an example for explaining the classification process at the stage where the upper adjacent pixel and the left adjacent pixel have already been subjected to the classification process and have been assigned a class index number. The maximum value, the minimum value, and the average value of the RGB values of the class to which the adjacent pixel on the upper side of the pixel 53 belongs, that is, the class with the index number 0, are updated by the processing for the pixel 51, and the adjacent pixel on the left side of the pixel 53 The maximum value, the minimum value, and the average value of the RGB values of the class to which 52 belongs, that is, the class of index number 1, are in a state set by the processing of the pixel 52.

画素53の分類処理においては、画素53のRGB値と、更新された後のインデックス番号0のクラスのRGB値の平均値、及び、インデックス番号1のクラスのRGB値の平均値とをそれぞれ、画素51についての分類処理時と同様にして比較する。RGB値のそれぞれの差分値の絶対値は、[数4][数5]に示すようになる。 In the classification process of the pixel 53, the RGB value of the pixel 53, the average value of the updated RGB value of the class of index number 0, and the average value of the RGB value of the class of index number 1 are updated. The comparison is performed in the same manner as in the classification processing for 51. The absolute values of the difference values of the RGB values are as shown in [Equation 4] and [Equation 5].

Figure 2006229817
Figure 2006229817

Figure 2006229817
Figure 2006229817

[数4]では、RGB値のそれぞれの差分値の絶対値が第1の閾値以下であるのに対して、[数5]では、R値の差分値の絶対値が第1の閾値を超えていることより、画素53は、上側の隣接画素が属するクラスに属すると判定される。このため、画素53についてインデックス番号Idx=0と設定し、インデックス番号0のRGB値の最大値・最小値・平均値を更新する。最大値は変化がなく、R=247、G=244、B=242であり、最小値は、R=240、G=239、B=238、に更新される。また、平均値は、R=(244×5+243)÷6=244、G=(242×5+239)÷6=242、B=(240×5+242)÷6=240、に更新される。また、カウント値は、1加算されて6となる。位置情報は上下左右のうち下だけが更新され、{上,下,左,右}={0,1,0,4}となる。   In [Equation 4], the absolute value of each difference value of RGB values is equal to or less than the first threshold value, whereas in [Equation 5], the absolute value of the R value difference value exceeds the first threshold value. Therefore, it is determined that the pixel 53 belongs to the class to which the upper adjacent pixel belongs. Therefore, the index number Idx = 0 is set for the pixel 53, and the maximum value, the minimum value, and the average value of the RGB values of the index number 0 are updated. The maximum value is unchanged, R = 247, G = 244, B = 242, and the minimum value is updated to R = 240, G = 239, and B = 238. The average value is updated to R = (244 × 5 + 243) ÷ 6 = 244, G = (242 × 5 + 239) ÷ 6 = 242, and B = (240 × 5 + 242) ÷ 6 = 240. Also, the count value is incremented by 1 to 6. The position information is updated only in the top, bottom, left, and right, and {Up, Down, Left, Right} = {0, 1, 0, 4}.

上述のような分類処理を全画素に対して行うことで、図9(B)に示すような結果が得られる。そして、全ての画素について分類処理が終了したとき、各クラスのクラス情報は、図10に示すようになる。   By performing the classification process as described above for all the pixels, a result as shown in FIG. 9B is obtained. Then, when the classification process is completed for all the pixels, the class information of each class is as shown in FIG.

次に、判定処理について説明する。   Next, the determination process will be described.

図11(A)は、図8に示す一部の画像領域50の全ての画素について分類処理が終了した段階での各クラスのクラス情報を示す説明図であり、図11(B)は、関連クラス統合処理を含む判定処理が終了した段階での各クラスのクラス情報を示す説明図である。   FIG. 11A is an explanatory diagram showing class information of each class at the stage where the classification process has been completed for all the pixels in the partial image region 50 shown in FIG. 8, and FIG. It is explanatory drawing which shows the class information of each class in the stage which the determination process containing a class integration process was complete | finished.

まず、インデックス番号が大きなものから順に、各クラスのクラス情報を読み込む。ここでは、インデックス番号3が最も大きいので、インデックス番号3のクラスのクラス情報から読み込む。   First, class information of each class is read in descending order of index number. Here, since index number 3 is the largest, it is read from the class information of the class of index number 3.

次に、読み込んだクラス情報に関連クラスが設定されているか否かを確認する。ここではインデックス番号3のクラスのクラス情報に関連クラス=2が設定されている。関連クラスが設定されている場合は、設定されているインデックス番号2のクラスのクラス情報をインデックス番号3のクラスのクラス情報を用いて更新する。   Next, it is confirmed whether or not a related class is set in the read class information. Here, the related class = 2 is set in the class information of the class of index number 3. When the related class is set, the class information of the class with the index number 2 set is updated using the class information of the class with the index number 3.

まず、位置情報を更新する。インデックス番号2のクラスの位置情報とインデックス番号3のクラスの位置情報とを比較し、上及び左は小さい方の値、下及び右は大きい方の値を選択することで、領域が広がるように更新される。更新された位置情報を、図11(B)のインデックス番号2のクラスのクラス情報として示す。ここでは、位置情報の“左”が3から2に更新されている。   First, position information is updated. Compare the position information of the class with index number 2 and the position information of the class with index number 3, and select the smaller value for the upper and left, and the larger value for the lower and right so that the area is expanded. Updated. The updated position information is shown as class information of the class of index number 2 in FIG. Here, “left” of the position information is updated from 3 to 2.

次に、RGB値の最小値・最大値・平均値を更新する。最大値については、それぞれのクラス情報の最大値を比較して、RGB値のそれぞれ大きい方を選択する。最小値については、それぞれのクラス情報の最小値を比較して、RGB値のそれぞれ小さい方を選択する。また、平均値については、各クラス情報の平均値に各クラスのカウント値を乗算した値同士を加算して得られた値を、2つのクラスのカウント値の合計で除算することで、更新された平均値を算出することができる。更新されたRGB値の最大値・最小値・平均値を、図11(B)のインデックス番号2のクラスのクラス情報として示す。   Next, the minimum value / maximum value / average value of the RGB values are updated. For the maximum value, the maximum values of the respective class information are compared, and the larger RGB value is selected. For the minimum value, the minimum value of each class information is compared, and the smaller RGB value is selected. The average value is updated by dividing the value obtained by multiplying the average value of each class information by the count value of each class and dividing by the sum of the count values of the two classes. The average value can be calculated. The maximum value, minimum value, and average value of the updated RGB values are shown as class information of the class of index number 2 in FIG.

また、カウント値は、2つのクラスのカウント値を加算することで更新する。インデックス番号3のカウント値3をインデックス番号2のカウント値5に加算し、更新後のカウント値を8とする。   The count value is updated by adding the count values of the two classes. The count value 3 of the index number 3 is added to the count value 5 of the index number 2, and the updated count value is 8.

そして、インデックス番号3のクラスのクラス情報のRGB値の最大値・最小値・平均値及び位置情報をインデックス番号2のクラスのクラス情報と同じ値に更新し、インデックス番号3のクラス情報のカウント値を0に更新する。   Then, the maximum value, minimum value, average value, and position information of the RGB value of the class information of the class of index number 3 are updated to the same values as the class information of the class of index number 2, and the count value of the class information of index number 3 Is updated to 0.

次に、インデックス番号2のクラスのクラス情報に注目する。インデックス番号2のクラスには関連クラスが設定されていないので、インデックス番号2のクラスのクラス情報については、ここではデータの更新を行わない。   Next, attention is focused on the class information of the class with index number 2. Since the related class is not set for the class of index number 2, the class information of the class of index number 2 is not updated here.

次に、インデックス番号1のクラスのクラス情報に注目する。インデックス番号1のクラスのクラス情報には、関連クラス=0が設定されているので、インデックス番号3のクラスの場合と同様にして更新処理を行う。更新処理を行った結果を図11(B)のインデックス番号0及びインデックス番号1のクラスのクラス情報として示す。   Next, attention is focused on the class information of the class with index number 1. Since the related class = 0 is set in the class information of the class with index number 1, update processing is performed in the same manner as in the case of class with index number 3. The result of the update process is shown as class information of the classes of index number 0 and index number 1 in FIG.

最後に、インデックス番号0のクラスのクラス情報に注目する。インデックス番号0のクラスのクラス情報には、関連クラスが設定されていないので、インデックス番号0のクラスのクラス情報については、ここではデータの更新を行わずない。   Finally, attention is paid to the class information of the class with index number 0. Since the related class is not set in the class information of the class with index number 0, the class information of the class with index number 0 is not updated here.

次に、インデックス番号が小さいものから順に、更新された各クラスのクラス情報のうちカウント値が0でないもののみを読み込む。そして、クラス情報の位置情報に基づいて、全体画像の端に位置するクラスであるか否かを判定する。   Next, in order from the smallest index number, only the updated class information of each class whose count value is not 0 is read. Then, based on the position information of the class information, it is determined whether or not the class is located at the end of the entire image.

ここで説明している画像データは、図8に示す全体画像の一部の画像領域50の画像データであり、画像領域50は実際には全体画像の端に位置していないが、ここでは、インデックス番号0のクラスが、図8に示す全体画像の左端から画像領域50まで連続しているという仮定で説明を行う。   The image data described here is the image data of a part of the entire image area 50 shown in FIG. 8, and the image area 50 is not actually located at the end of the entire image. The description will be made on the assumption that the class with index number 0 is continuous from the left end of the entire image shown in FIG. 8 to the image region 50.

この場合、インデックス番号0は、全体画像の端に位置するクラスであるので、インデックス番号0のクラスのクラス情報に第1の下地クラスを意味するフラグを付与する。   In this case, since index number 0 is a class located at the end of the entire image, a flag indicating the first background class is added to the class information of the class of index number 0.

また、インデックス番号0のクラスのカウント値を、全体画像の画素数に対して予め設定した第1の割合に相当する数と比較する。実際には、全体画像の全体が処理の対象なので、大きい値が設定されるべきであるが、ここでは、説明の都合上、注目している画像領域50の大きさを考慮して、全体画像の画素数に対して第1の割合に相当する数を、仮に10と設定して説明する。すると、インデックス番号0のクラスのカウント値は12であり、第1の割合に相当する数より大きいので、第2の下地クラスを意味するフラグを付与する。   Further, the count value of the class with index number 0 is compared with a number corresponding to a first ratio set in advance with respect to the number of pixels of the entire image. Actually, since the entire entire image is a target of processing, a large value should be set. However, for convenience of explanation, the entire image is considered in consideration of the size of the image area 50 of interest. The number corresponding to the first ratio with respect to the number of pixels is set to 10 and will be described. Then, the count value of the class with index number 0 is 12, which is larger than the number corresponding to the first ratio, so a flag indicating the second background class is added.

次に、インデックス番号2のクラスのクラス情報を読み込み、位置情報を確認する。すると、インデックス番号2のクラスは端に位置していないので、第1の下地クラスではないと判定される。また、カウント値は、第1の割合に相当する数である10に満たない値なので、第2の下地クラスでもないと判定される。この他にカウント値が0でないクラスは存在しないので、判定処理を終了して、下地検出処理を行う。   Next, the class information of the class with index number 2 is read and the position information is confirmed. Then, since the class with index number 2 is not located at the end, it is determined that it is not the first base class. Further, since the count value is a value less than 10 which is a number corresponding to the first ratio, it is determined that the count value is not the second background class. In addition, since there is no class whose count value is not 0, the determination process is terminated and the background detection process is performed.

次に、下地検出処理について説明する。下地検出処理では、まず、第1の下地クラスのみに該当するクラスからなる第1のグループ、第2の下地クラスのみに該当するクラスからなる第2のグループ、第1の下地クラスと第2の下地クラスとの両方に該当するクラスからなる第3のグループ、に各クラスを分類する。次に、第1から第3の3つのグループに分類されたクラスのカウント値を、各グループ毎に合計し、カウント値の合計をグループ同士で比較する。そして、最もカウント値の合計が大きいグループに属するクラスを下地領域であると判定する。   Next, background detection processing will be described. In the background detection process, first, a first group consisting of classes corresponding only to the first background class, a second group consisting of classes corresponding only to the second background class, the first background class and the second group Each class is classified into a third group consisting of classes corresponding to both the base class. Next, the count values of the classes classified into the first to third groups are summed for each group, and the sum of the count values is compared between the groups. Then, the class belonging to the group having the largest total count value is determined to be the base area.

上述の例では、インデックス番号0のクラスのみが第1の下地クラスと第2の下地クラスとの両方に該当すると判定されるので、第3のグループのカウント値の合計は12である。第1の下地クラスのみに該当するクラスと、第2の下地クラスのみに該当する下地クラスと、は存在しないので、第1のグループ及び第2のグループのカウント値の合計は0である。したがって、第3のグループのカウント値の合計が最も大きいので、第3のグループに属するクラス、即ち、インデックス番号0のクラスが、下地領域であると判定される。   In the above example, it is determined that only the class with index number 0 corresponds to both the first base class and the second base class, so the total count value of the third group is 12. Since there is no class corresponding to only the first background class and no background class corresponding only to the second background class, the sum of the count values of the first group and the second group is zero. Accordingly, since the sum of the count values of the third group is the largest, it is determined that the class belonging to the third group, that is, the class having the index number 0 is the background area.

次に、下地領域であると判定された単一又は複数のクラスのカウント値の合計を算出する。図11(B)の例では、下地領域であると判定されたクラスはインデックス番号0のクラスのみであるので、カウント値の合計は12となる。   Next, the sum of the count values of a single class or a plurality of classes determined to be the background area is calculated. In the example of FIG. 11B, since the class determined to be the background area is only the class with index number 0, the total count value is 12.

次に、カウント値の合計が、全体画像の全画素数に対して予め設定した第2の割合以上あるか否かを判定する。ここでは説明の便宜上、領域50の全画素数に対応して、全体画像の全画素数に対して第2の割合に相当する数として10を設定する。なお、現実には、全体画像の全領域においてインデックス番号0のクラスに属する画素数は多いはずなので、10よりもさらに大きい数が設定される。   Next, it is determined whether or not the total count value is equal to or greater than a second ratio set in advance with respect to the total number of pixels of the entire image. Here, for convenience of explanation, 10 is set as a number corresponding to the second ratio with respect to the total number of pixels of the entire image, corresponding to the total number of pixels in the region 50. In reality, since the number of pixels belonging to the class of index number 0 should be large in the entire area of the entire image, a number larger than 10 is set.

この場合、カウント値の合計“12”は、全体画像の全画素数に対して第2の割合に相当する数“10”以上であるので、下地領域は存在すると判定される。この処理によって、誤った領域を下地領域として検出することが防止される。   In this case, since the total count value “12” is equal to or greater than the number “10” corresponding to the second ratio with respect to the total number of pixels of the entire image, it is determined that the background area exists. This process prevents an erroneous area from being detected as a base area.

次に、下地領域と判定されたクラス(ここではインデックス番号0のクラス)のRGB値の最大値・最小値・平均値を取得する。そして、RGB値のそれぞれの最大値から最小値を減算して得られる減算値を、予め設定された第2の閾値と比較する。ここでは、第2の閾値としてR・G・Bともに“30”を設定してあるものとする。   Next, the maximum value, the minimum value, and the average value of the RGB values of the class determined to be the background area (here, the class with index number 0) are acquired. Then, the subtraction value obtained by subtracting the minimum value from the maximum value of each of the RGB values is compared with a preset second threshold value. Here, it is assumed that R, G, and B are set to “30” as the second threshold value.

このとき、(Rの最大値)−(Rの最小値)=250−240=10、(Gの最大値)−(Gの最小値)=244−235=9、(Bの最大値)−(Bの最小値)=250−238=12となり、何れも閾値30より小さいということになる。   At this time, (maximum value of R) − (minimum value of R) = 250−240 = 10, (maximum value of G) − (minimum value of G) = 244−235 = 9, (maximum value of B) − (Minimum value of B) = 250−238 = 12, and both are smaller than the threshold value 30.

また、下地領域と判定されたクラスのRGB値のそれぞれの平均値を、予め設定した第3の閾値と比較する。ここでは、第3の閾値としてRGBともに“220”を設定してあるものとする。図11(B)に示す例では、インデックス番号0のクラスのRGB値のそれぞれの平均値は何れも第3の閾値220以上である。   Further, the average value of each of the RGB values of the class determined as the background area is compared with a preset third threshold value. Here, it is assumed that “220” is set as the third threshold value for both RGB. In the example shown in FIG. 11B, the average values of the RGB values of the class with index number 0 are all greater than or equal to the third threshold value 220.

減算値が第2の閾値以下であり、かつ、平均値が第3の閾値以上であるため、インデックス番号0のクラスを、最終的に下地領域であるとして検出し、下地検出処理を終了する。最終的に下地領域であると判定されたクラスのインデックス番号などは、メモリに退避される。   Since the subtraction value is less than or equal to the second threshold value and the average value is greater than or equal to the third threshold value, the class with index number 0 is finally detected as being a background region, and the background detection processing is terminated. The index number and the like of the class finally determined to be the background area are saved in the memory.

なお、この実施形態の下地検出処理で用いた閾値及び割合は、スキャナの特性、下地を除去したい範囲の濃度差及び濃度値などに応じて、RGBそれぞれ個別に設定してもよい。   Note that the threshold value and the ratio used in the background detection processing of this embodiment may be individually set for each of RGB in accordance with the characteristics of the scanner, the density difference and density value of the range where the background is desired to be removed.

次に、下地除去処理について説明する。図12(A)は、下地除去処理前の画像データの一例を示す説明図であり、図12(B)は、下地除去処理後の画像データの一例を示す説明図である。   Next, the background removal process will be described. FIG. 12A is an explanatory diagram illustrating an example of image data before the background removal process, and FIG. 12B is an explanatory diagram illustrating an example of image data after the background removal process.

下地除去処理では、1画素ずつRGB値及びインデックス番号が読み出される。1画素分の画像データは、インデックス番号に基づいて下地領域であるか否かが判定される。上述の例では、最終的に下地領域であるとしてインデックス番号“0”のクラスが検出された。また、インデックス番号1のクラスは、関連クラスとして0が設定されているので、実質的にインデックス番号0のクラスに統合されており、インデックス番号1のクラスについてもインデックス番号0のクラスと同様に処理する。すなわち、各画素に付与されたインデックス番号が0または1である場合、その画素は、下地領域の画素であると判定される。   In the background removal process, RGB values and index numbers are read out pixel by pixel. It is determined whether the image data for one pixel is a base area based on the index number. In the above-described example, the class having the index number “0” is finally detected as the base area. In addition, since the class of index number 1 is set to 0 as the related class, it is substantially integrated into the class of index number 0, and the class of index number 1 is processed in the same manner as the class of index number 0. To do. That is, when the index number assigned to each pixel is 0 or 1, the pixel is determined to be a pixel in the base area.

注目画素が下地領域であると判定された場合、RGB値のそれぞれをともに255に置き換える。これによって下地が除去される。なお、ここでは、255に置き換えているが、この値に限定するものではなく、エンジン性能などを考慮して、R・G・Bそれぞれに個別の最適な値を設定してもよい。   When it is determined that the pixel of interest is the background area, each of the RGB values is replaced with 255. As a result, the base is removed. In this example, the value is replaced with 255. However, the value is not limited to this value, and individual optimum values may be set for R, G, and B in consideration of engine performance and the like.

注目画素が下地領域でないと判定された場合、画像データのRGB値がそのまま出力される。そして、全ての画素について上述の処理が繰り返され、図11(B)に示すような画像データが得られる。全画素について下地除去処理が終了した場合、下地除去処理が終了する。結果的に得られたRGB信号の画像データは、領域分離処理部26に出力される。   If it is determined that the pixel of interest is not a background area, the RGB values of the image data are output as they are. Then, the above-described processing is repeated for all the pixels, and image data as shown in FIG. 11B is obtained. When the background removal process is completed for all pixels, the background removal process is completed. The resulting RGB signal image data is output to the region separation processing unit 26.

画像処理装置20によれば、濃度値(RGB値)が近く位置が連続する画素を1つのクラスとして分類し、全ての画素をクラスに分類した後で、全体画像に対するクラスの位置及びクラスの大きさ(クラスに属する画素数)に基づいて、クラス単位で下地領域であるか否かを判定するので、下地領域の画素と同程度の濃度値を有する画像領域中の画素を誤って下地領域として検出することがない。したがって、下地領域のみを適正的確に検出することができる。また、ヒストグラムを作成する必要がないので、下地領域の検出に用いられるデバイスにかかる負荷が小さくて済む。   According to the image processing apparatus 20, pixels whose density values (RGB values) are close to each other are classified as one class, and after all the pixels are classified into classes, the position of the class and the size of the class with respect to the entire image are classified. Based on the size (number of pixels belonging to the class), it is determined whether or not it is a background area in class units. Therefore, a pixel in an image area having a density value similar to that of a pixel in the background area is erroneously set as the background area. There is no detection. Therefore, it is possible to detect only the ground region appropriately and accurately. In addition, since it is not necessary to create a histogram, the load on the device used for detecting the base region can be reduced.

また、注目画素をクラスに分類する毎にそのクラスのクラス情報を更新するようにしたので、注目画素のRGB値とクラス情報のRGB値の平均値とを正確に比較できる。このため、各画素を本来属すべきクラスに適正に分類することができる。   In addition, since the class information of the class is updated every time the pixel of interest is classified into a class, the RGB value of the pixel of interest can be accurately compared with the average value of the RGB values of the class information. For this reason, each pixel can be appropriately classified into a class to which it originally belongs.

さらに、クラス情報に関連クラスが設定された場合に、関連クラスが設定されたクラスと関連クラスとして指定されたクラスとの互いに隣接する2個のクラスを統合することで、以後の下地検出処理を容易にすることができる。   In addition, when a related class is set in the class information, the two adjacent classes of the class set as the related class and the class specified as the related class are integrated to perform subsequent background detection processing. Can be easily.

また、全体画像におけるクラスの位置及びクラスに属する画素の数に基づいてグループ分けした後、最も画素数が多いグループを下地領域として検出するので、2段階の判定を経て下地領域を検出することになり、下地領域のみをさらに適正的確に検出することができる。   In addition, after grouping based on the position of the class in the entire image and the number of pixels belonging to the class, the group with the largest number of pixels is detected as the background region, so that the background region is detected through two stages of determination. Thus, only the base region can be detected more appropriately and accurately.

ところで、下地領域は全体画像の全画素数に対して所定の割合以上の数の画素からなると考えられる。そこで、下地領域であるとされたクラスに属する画素の数の合計が全体画像の全画素数に対して所定の割合に満たない場合、その画像には下地領域がないと判定することで、下地領域として誤った領域を検出することを防止することができる。したがって、さらに適正的確に下地領域のみを検出することができる。   By the way, it is considered that the base region is composed of a number of pixels equal to or larger than a predetermined ratio with respect to the total number of pixels of the entire image. Therefore, if the total number of pixels belonging to the class determined to be the background area is less than a predetermined ratio with respect to the total number of pixels of the entire image, it is determined that the image has no background area. It is possible to prevent an erroneous area from being detected as an area. Therefore, it is possible to detect only the base region more appropriately and accurately.

また、クラス情報のRGB値の最大値、最小値及び平均値に基づいて、下地領域ではないと考えられるクラスを下地領域から除外することで、さらに適正的確に下地領域のみを検出することができる。   Further, by excluding a class that is not a background area from the background area based on the maximum value, the minimum value, and the average value of the RGB values of the class information, it is possible to detect only the background area more appropriately and accurately. .

さらに、適正的確に下地領域として検出されたクラスに属する画素のみに対して下地除去処理を施すので、文字画像及び写真画像等の画質を劣化させることなく、下地のみを高精度に除去することができる。   Furthermore, since the background removal processing is performed only on pixels belonging to the class detected as the background area accurately and accurately, it is possible to remove only the background with high accuracy without degrading the image quality of character images and photographic images. it can.

画像形成装置10によれば、適正的確に下地のみが除去された画像データに基づいて、高品位な画像を出力することができる。   According to the image forming apparatus 10, it is possible to output a high-quality image based on image data from which only the background has been removed appropriately and accurately.

なお、上述の実施形態の分類処理、判定処理、下地検出処理及び下地除去処理を、コンピュータが実行可能なプログラムとして構成し、そのプログラムを図示しない記録媒体にコンピュータによって読み取り可能に格納することもできる。   The classification processing, determination processing, background detection processing, and background removal processing of the above-described embodiment can be configured as a computer-executable program, and the program can be stored in a recording medium (not shown) so as to be readable by the computer. .

記録媒体としては、コンピュータ本体に固定的に備えられるROM、RAM、又は、内蔵ハードディスクなどであってもよく、または、コンピュータ本体と分離可能に構成された記録媒体であってもよい。   The recording medium may be a ROM, RAM, a built-in hard disk, or the like that is fixedly provided in the computer main body, or may be a recording medium configured to be separable from the computer main body.

コンピュータ本体と分離可能に構成された記録媒体としては例えば、磁気テープ及びカセットテープ等のテープ系、フロッピー(登録商標)ディスク及び外付けハードディスク等の磁気ディスク、CD−ROM、MO、MD、DVD等の光ディスクを含むディスク系、ICカード(メモリカードを含む)及び光カード等のカード系などがある。また、コンピュータ本体と分離可能に構成された記録媒体は、マスクROM、EPROM(Erasable Programmable Read Only Memory)、EEPROM(Electrically ErasableProgrammable Read Only Memory )、フラッシュROM等の半導体メモリを含めた固定的にプログラムを担持する媒体であってもよい。これによって、上述の分類処理、判定処理、下地検出処理及び下地除去処理を含むこの発明の下地検出方法をコンピュータに実行させるプログラムを記録した記録媒体を、持ち運び自在に提供することができる。   Recording media configured to be separable from the computer main body include, for example, tape systems such as magnetic tapes and cassette tapes, magnetic disks such as floppy (registered trademark) disks and external hard disks, CD-ROMs, MOs, MDs, DVDs, etc. There are disk systems including optical disks, card systems such as IC cards (including memory cards) and optical cards. In addition, the recording medium configured to be separable from the computer main body is a fixed program including a semiconductor memory such as a mask ROM, an EPROM (Erasable Programmable Read Only Memory), an EEPROM (Electrically Erasable Programmable Read Only Memory), and a flash ROM. It may be a supported medium. Accordingly, a recording medium on which a program for causing a computer to execute the background detection method of the present invention including the above-described classification process, determination process, background detection process, and background removal process can be provided in a portable manner.

また、格納されているプログラムは、マイクロプロセッサがアクセスして実行させる構成であってもよく、又は、プログラムを読み出し、読み出したプログラムをコンピュータの中の図示しないプログラム記憶エリアにインストールして、そのプログラムを実行する構成であってもよい。   The stored program may be configured to be accessed and executed by a microprocessor, or the program is read and installed in a program storage area (not shown) in the computer. May be configured to execute.

さらに、画像処理装置20を、図示しないインターネットを含む通信ネットワークを接続可能なシステムに構成することも可能であり、記録媒体は、画像処理装置20が通信ネットワークを介してプログラムをダウンロードするように流動的にプログラムを担持する媒体であってもよい。なお、通信ネットワークを介してプログラムをダウンロードする場合は、ダウンロードを実行するプログラムを、予めコンピュータ本体内に格納しておくか、又は、別の記録媒体からインストールするようにしてもよい。   Furthermore, the image processing apparatus 20 can be configured as a system that can be connected to a communication network including the Internet (not shown), and the recording medium flows so that the image processing apparatus 20 downloads a program via the communication network. Alternatively, it may be a medium carrying a program. When downloading a program via a communication network, the program for executing the download may be stored in the computer main body in advance, or may be installed from another recording medium.

上述の、下地検出方法をコンピュータに実行させるプログラムは、上述の実施形態の分類処理、判定処理、下地検出処理及び下地除去処理のみを実行させるものではなく、図1に示す画像処理装置20において実行される他の処理も含めて統括的に実行させるように構成されたものであってもよい。   The program for causing a computer to execute the background detection method described above does not cause only the classification processing, determination processing, background detection processing, and background removal processing of the above-described embodiment to be executed, but is executed in the image processing apparatus 20 illustrated in FIG. It may be configured to be executed comprehensively including other processes.

また、カラー画像入力装置11としては例えば、フラットベッドスキャナ、フィルムスキャナ、デジタルカメラなどが用いられる。カラー画像出力装置12としては例えば、CRTディスプレイ、液晶ディスプレイなどの画像表示装置、または処理結果を紙などに出力する電子写真方式若しくはインクジェット方式のプリンタなどが用いられる。さらに、画像形成装置10には、ネットワークを介してサーバーなどに接続するための通信手段としてのモデムなどを備えることもできる。   As the color image input device 11, for example, a flat bed scanner, a film scanner, a digital camera, or the like is used. As the color image output device 12, for example, an image display device such as a CRT display or a liquid crystal display, or an electrophotographic or inkjet printer that outputs processing results to paper or the like is used. Further, the image forming apparatus 10 may include a modem as a communication unit for connecting to a server or the like via a network.

さらに、上述の実施形態ではRGB値で分類処理、判定処理及び下地検出処理を行ったが、これに限定されず、検出精度や画像処理構成などに応じて別の色空間(例えば、CMYKやCIELABなど)で行ってもよい。この場合、濃度と色情報が混在する色空間(CMYKなど)では、RGB値での処理と同様に行えばよく、輝度と色度とが分離された色空間(CIELABなど)では、輝度を中心とした処理にして、サポート情報として色度情報を用いるような構成にしてもよい。   Furthermore, in the above-described embodiment, classification processing, determination processing, and background detection processing are performed using RGB values. However, the present invention is not limited to this, and another color space (for example, CMYK or CIELAB) is used depending on detection accuracy, image processing configuration, and the like. Etc.). In this case, in a color space in which density and color information are mixed (such as CMYK), the processing may be performed in the same manner as in RGB values. In a color space in which luminance and chromaticity are separated (such as CIELAB), the luminance is centered. In this process, the chromaticity information may be used as the support information.

この発明の実施形態に係るカラー画像形成装置の概略の構成を示すブロック図である。1 is a block diagram showing a schematic configuration of a color image forming apparatus according to an embodiment of the present invention. 下地検出処理部及び下地除去処理部の構成を示すブロック図である。It is a block diagram which shows the structure of a background detection process part and a background removal process part. 1つのクラスを構成する画素の集まりの一例を示す説明図である。It is explanatory drawing which shows an example of the collection of the pixels which comprise one class. 下地検出処理部の分類手段における処理手順を示すフローチャートである。It is a flowchart which shows the process sequence in the classification | category means of a background detection process part. 下地検出処理部の判定手段における処理手順を示すフローチャートである。It is a flowchart which shows the process sequence in the determination means of a background detection process part. 下地検出処理部の下地検出手段における処理手順を示すフローチャートである。It is a flowchart which shows the process sequence in the background detection means of a background detection process part. 下地除去処理部における処理手順を示すフローチャートである。It is a flowchart which shows the process sequence in a background removal process part. 処理すべき画像データに基づく全体画像の一例を示す説明図である。It is explanatory drawing which shows an example of the whole image based on the image data which should be processed. 図8に示す一部の画像領域50における各画素の画像データを示す説明図であり、(A)は、4画素目まで分類処理が終わった状態の各画素の画像データを示す説明図であり、(B)は、画像領域50の全ての画素について分類処理が終了した状態における各画素の画像データを示す説明図であり、(C)は、1画素分の画像データの記述例を示す説明図である。It is explanatory drawing which shows the image data of each pixel in the one part image area | region 50 shown in FIG. 8, (A) is explanatory drawing which shows the image data of each pixel in the state which the classification process was completed to the 4th pixel. (B) is explanatory drawing which shows the image data of each pixel in the state which the classification process was complete | finished about all the pixels of the image area | region 50, (C) is description which shows the description example of the image data for one pixel FIG. 図8に示す一部の画像領域の全ての画素について分類処理が終了した段階での各クラスのクラス情報を示す説明図であり、(A)は、インデックス番号0のクラスのクラス情報を示し、(B)は、インデックス番号1のクラスのクラス情報を示し、(C)は、インデックス番号2のクラスのクラス情報を示し、(D)は、インデックス番号3のクラスのクラス情報を示す。It is explanatory drawing which shows the class information of each class in the stage which the classification process was complete | finished about all the pixels of the one part image area shown in FIG. 8, (A) shows the class information of the class of index number 0, (B) shows the class information of the class of index number 1, (C) shows the class information of the class of index number 2, and (D) shows the class information of the class of index number 3. (A)は、図8に示す一部の画像領域の全ての画素について分類処理が終了した段階での各クラスのクラス情報を示す説明図であり、(B)は、関連クラス統合処理を含む判定処理が終了した段階での各クラスのクラス情報を示す説明図である。(A) is explanatory drawing which shows the class information of each class in the stage which the classification process was complete | finished about all the pixels of the one part image area | region shown in FIG. 8, (B) includes a related class integration process. It is explanatory drawing which shows the class information of each class in the stage where the determination process was complete | finished. (A)は、下地除去処理前の画像データの一例を示す説明図であり、(B)は、下地除去処理後の画像データの一例を示す説明図である。(A) is explanatory drawing which shows an example of the image data before a background removal process, (B) is explanatory drawing which shows an example of the image data after a background removal process.

符号の説明Explanation of symbols

10 画像形成装置
11 カラー画像入力装置(入力手段)
12 カラー画像出力装置(出力手段)
20 画像処理装置
24 下地検出処理部
24A 分類手段
24B 判定手段(第1の判定手段、第2の判定手段)
24C 下地検出手段
25 下地除去処理部
25A 下地除去処理手段
40 クラス
DESCRIPTION OF SYMBOLS 10 Image forming apparatus 11 Color image input device (input means)
12 Color image output device (output means)
20 Image processing device 24 Background detection processing unit 24A Classification unit 24B Determination unit (first determination unit, second determination unit)
24C Background detection means 25 Background removal processing section 25A Background removal processing means 40 class

Claims (12)

処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出する第1ステップと、
前記第1ステップにおいて算出された前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する第2ステップと、
前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第3ステップと、
前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された第1の割合以上の数の画素を含むか否かを判定する第4ステップと、
前記第3ステップ及び前記第4ステップにおける判定結果に基づいて下地領域であるクラスを検出する第5ステップと、を備えることを特徴とする下地検出方法。
Calculating a difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs One step,
When the difference value calculated in the first step is less than or equal to a preset first threshold value, the pixel of interest is classified into a class to which the adjacent pixel belongs, and the difference value exceeds the first threshold value A second step of classifying the pixel of interest into a newly set class,
A third step of determining whether or not each class includes a pixel located at an end of the whole image after all the pixels of the whole image are classified in the second step;
After all the pixels of the whole image are classified in the second step, it is determined whether each class includes a number of pixels equal to or more than a first ratio set in advance with respect to the total number of pixels of the whole image. And a fourth step
And a fifth step of detecting a class which is a background region based on the determination results in the third step and the fourth step.
前記第2ステップにおいて前記注目画素が属することになったクラスのクラス画素値は、前記注目画素の画素値に応じて更新されることを特徴とする請求項1に記載の下地検出方法。   The background detection method according to claim 1, wherein the class pixel value of the class to which the target pixel belongs in the second step is updated according to the pixel value of the target pixel. 前記第2ステップの後であって前記第3ステップ及び前記第4ステップの前に、
互いに隣接する2個のクラスにおいて、各クラスに属する全ての画素の画素値のうちの最大値、最小値及び前記全ての画素の画素値の平均値のうち少なくとも1つを互いに比較した結果に基づいて、前記2個のクラスを単一のクラスに統合するステップを、さらに備えることを特徴とする請求項1または2に記載の下地検出方法。
After the second step and before the third step and the fourth step,
Based on a result of comparing at least one of the maximum value, the minimum value, and the average value of the pixel values of all the pixels in two adjacent classes to each other. The background detection method according to claim 1, further comprising a step of integrating the two classes into a single class.
前記第5ステップでは、前記第3ステップにおいて前記全体画像の端に位置する画素を含むと判定されたクラスを第1の下地クラスとし、前記第4ステップにおいて前記全体画像の全画素数に対して予め設定された第1の割合以上の数の画素を含むと判定されたクラスを第2の下地クラスとして、
第1の下地クラスにのみ該当するクラスからなる第1のグループ、第2の下地クラスにのみ該当するクラスからなる第2のグループ、及び、第1の下地クラスと第2の下地クラスとの両方に該当するクラスからなる第3のグループ、に各クラスを分類し、前記第1から第3のグループのうち、各グループに属するクラスのそれぞれに属する画素の数の合計が最も多いグループに属するクラスを下地領域として検出することを特徴とする請求項1から3のいずれかに記載の下地検出方法。
In the fifth step, the class determined to include pixels located at the end of the whole image in the third step is set as a first background class, and the total number of pixels of the whole image in the fourth step. A class determined to include a number of pixels equal to or higher than a preset first ratio is set as a second background class.
A first group consisting of classes corresponding only to the first base class, a second group consisting of classes corresponding only to the second base class, and both the first base class and the second base class A class belonging to a group having the largest total of the number of pixels belonging to each of the classes belonging to each group among the first to third groups. The background detection method according to claim 1, wherein the background detection area is detected as a background area.
前記第5ステップにおいて下地領域として検出された全てのクラスに属する画素の数の合計が、前記画像の全画素数に対して、予め設定された第2の割合未満である場合、前記画像に下地領域がないと判定する第6ステップを、さらに備えることを特徴とする請求項1から4のいずれかに記載の下地検出方法。   If the total number of pixels belonging to all classes detected as a background area in the fifth step is less than a preset second ratio with respect to the total number of pixels of the image, The background detection method according to claim 1, further comprising a sixth step of determining that there is no area. 前記第5ステップにおいて下地領域として検出された各クラスに属する全ての画素の画素値のうちの最大値から最小値を減算して得られる減算値が予め設定された第2の閾値を超え、または、下地領域として検出された各クラスに属する全ての画素の画素値の平均値が予め設定された第3の閾値未満である場合、前記クラスは下地領域ではないと判定する第7ステップを、さらに備えることを特徴とする請求項1から5のいずれかに記載の下地検出方法。   The subtraction value obtained by subtracting the minimum value from the maximum value of the pixel values of all the pixels belonging to each class detected as the background area in the fifth step exceeds a preset second threshold, or A seventh step of determining that the class is not a background area when the average value of the pixel values of all the pixels belonging to each class detected as the background area is less than a preset third threshold value; The ground surface detection method according to claim 1, further comprising: 下地領域として検出されたクラスに属する画素について、下地がある場合に前記下地が画像として印刷されないように前記画素の画素値を補正する下地除去処理を施す第8ステップを、さらに備えることを特徴とする請求項1から6のいずれかに記載の下地検出方法。   For a pixel belonging to a class detected as a background area, an eighth step of performing a background removal process for correcting a pixel value of the pixel so that the background is not printed as an image when there is a background is further provided. The background detection method according to any one of claims 1 to 6. 処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出する第1ステップと、
前記第1ステップにおいて算出された前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する第2ステップと、
前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第3ステップと、
前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された割合以上の数の画素を含むか否かを判定する第4ステップと、
前記第3ステップ及び前記第4ステップにおける判定結果に基づいて下地領域であるクラスを検出する第5ステップと、をコンピュータに実行させることを特徴とするプログラム。
Calculating a difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs One step,
When the difference value calculated in the first step is less than or equal to a preset first threshold value, the pixel of interest is classified into a class to which the adjacent pixel belongs, and the difference value exceeds the first threshold value A second step of classifying the pixel of interest into a newly set class,
A third step of determining whether or not each class includes a pixel located at an end of the whole image after all the pixels of the whole image are classified in the second step;
After all the pixels of the whole image are classified in the second step, it is determined whether each class includes a number of pixels equal to or larger than a preset ratio with respect to the total number of pixels of the whole image. Steps,
A program that causes a computer to execute a fifth step of detecting a class that is a base region based on the determination results in the third step and the fourth step.
処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出する第1ステップと、
前記第1ステップにおいて算出された前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する第2ステップと、
前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第3ステップと、
前記第2ステップにおいて前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された割合以上の数の画素を含むか否かを判定する第4ステップと、
前記第3ステップ及び前記第4ステップにおける判定結果に基づいて下地領域であるクラスを検出する第5ステップと、をコンピュータに実行させるプログラムをコンピュータが読み取り可能に格納したことを特徴とする記録媒体。
Calculating a difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs One step,
When the difference value calculated in the first step is less than or equal to a preset first threshold value, the pixel of interest is classified into a class to which the adjacent pixel belongs, and the difference value exceeds the first threshold value A second step of classifying the pixel of interest into a newly set class,
A third step of determining whether or not each class includes a pixel located at an end of the whole image after all the pixels of the whole image are classified in the second step;
After all the pixels of the whole image are classified in the second step, it is determined whether each class includes a number of pixels equal to or larger than a preset ratio with respect to the total number of pixels of the whole image. Steps,
A recording medium storing a computer-readable program for causing a computer to execute a fifth step of detecting a class as a base area based on the determination results in the third step and the fourth step.
処理すべき画像データに基づく全体画像における注目画素の画素値と、前記注目画素に隣接する隣接画素が属するクラスに属する全ての画素の画素値に基づくクラス画素値と、の差分値を算出し、前記差分値が予め設定された第1の閾値以下である場合に前記注目画素を前記隣接画素が属するクラスに分類し、前記差分値が前記第1の閾値を超える場合に前記注目画素を新たに設定したクラスに分類する分類手段と、
前記分類手段によって前記全体画像の全画素が分類された後に、各クラスが前記全体画像の端に位置する画素を含むか否かを判定する第1の判定手段と、
前記分類手段によって前記全体画像の全画素が分類された後に、各クラスが前記全体画像の全画素数に対して予め設定された割合以上の数の画素を含むか否かを判定する第2の判定手段と、
前記第1の判定手段及び前記第2の判定手段における判定結果に基づいて下地領域であるクラスを検出する下地検出手段と、を備えることを特徴とする画像処理装置。
Calculating a difference value between the pixel value of the target pixel in the entire image based on the image data to be processed and the class pixel value based on the pixel values of all the pixels belonging to the class to which the adjacent pixel adjacent to the target pixel belongs; When the difference value is less than or equal to a preset first threshold, the pixel of interest is classified into a class to which the adjacent pixel belongs, and when the difference value exceeds the first threshold, the pixel of interest is newly Classifying means for classifying into the set class,
First determination means for determining whether or not each class includes a pixel located at an end of the whole image after all the pixels of the whole image are classified by the classification means;
After classifying all the pixels of the whole image by the classification means, a second determination is made as to whether or not each class includes a number of pixels equal to or greater than a preset ratio with respect to the total number of pixels of the whole image. A determination means;
An image processing apparatus comprising: a background detection unit that detects a class that is a background region based on a determination result in the first determination unit and the second determination unit.
前記下地検出手段によって下地領域として検出されたクラスに属する画素について、下地がある場合に前記下地が画像として印刷されないように前記画素の画素値を補正する下地除去処理を施す下地除去処理手段を、さらに備えることを特徴とする請求項10に記載の画像処理装置。   For a pixel belonging to a class detected as a background area by the background detection means, when there is a background, a background removal processing means for performing a background removal process for correcting the pixel value of the pixel so that the background is not printed as an image, The image processing apparatus according to claim 10, further comprising: 前記請求項11に記載の画像処理装置と、
前記画像処理装置における下地除去処理の対象となる画像データを入力する入力手段と、
前記画像処理装置によって前記下地除去処理を含む画像処理が施された画像を出力する出力手段と、を備えることを特徴とする画像形成装置。
The image processing apparatus according to claim 11,
Input means for inputting image data to be subjected to background removal processing in the image processing apparatus;
An image forming apparatus comprising: an output unit configured to output an image subjected to image processing including the background removal processing by the image processing device.
JP2005043611A 2005-02-21 2005-02-21 Background detection method, program, recording medium, image processing apparatus, and image forming apparatus Pending JP2006229817A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005043611A JP2006229817A (en) 2005-02-21 2005-02-21 Background detection method, program, recording medium, image processing apparatus, and image forming apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005043611A JP2006229817A (en) 2005-02-21 2005-02-21 Background detection method, program, recording medium, image processing apparatus, and image forming apparatus

Publications (1)

Publication Number Publication Date
JP2006229817A true JP2006229817A (en) 2006-08-31

Family

ID=36990742

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005043611A Pending JP2006229817A (en) 2005-02-21 2005-02-21 Background detection method, program, recording medium, image processing apparatus, and image forming apparatus

Country Status (1)

Country Link
JP (1) JP2006229817A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008092541A (en) * 2006-09-06 2008-04-17 Sharp Corp Image processing method, image processor, image forming apparatus, computer program, and recording medium
US8280157B2 (en) * 2007-02-27 2012-10-02 Sharp Laboratories Of America, Inc. Methods and systems for refining text detection in a digital image
JP2017184160A (en) * 2016-03-31 2017-10-05 京セラドキュメントソリューションズ株式会社 Image forming apparatus, color conversion program and color conversion method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008092541A (en) * 2006-09-06 2008-04-17 Sharp Corp Image processing method, image processor, image forming apparatus, computer program, and recording medium
US8280157B2 (en) * 2007-02-27 2012-10-02 Sharp Laboratories Of America, Inc. Methods and systems for refining text detection in a digital image
JP2017184160A (en) * 2016-03-31 2017-10-05 京セラドキュメントソリューションズ株式会社 Image forming apparatus, color conversion program and color conversion method

Similar Documents

Publication Publication Date Title
JP4495197B2 (en) Image processing apparatus, image forming apparatus, image processing program, and recording medium for recording image processing program
JP4927122B2 (en) Image processing method, image processing apparatus, image forming apparatus, program, and recording medium
JP4361946B2 (en) Image processing apparatus, image processing method, image processing program, and recording medium storing the program
JP4105539B2 (en) Image processing apparatus, image forming apparatus including the same, image processing method, image processing program, and recording medium
JP2008205652A (en) Image processing method, image processing apparatus, image forming apparatus, program, and recording medium
JP2006229817A (en) Background detection method, program, recording medium, image processing apparatus, and image forming apparatus
JP6882083B2 (en) Image processing device, image forming device, image processing method and program
JP6262102B2 (en) Image processing apparatus, image processing system, computer program, and recording medium
JP4545766B2 (en) Image processing apparatus, image forming apparatus, image reading apparatus, image processing program, and recording medium
JP4260774B2 (en) Image processing apparatus, image forming apparatus, image processing method, image processing program, and recording medium
JP4545167B2 (en) Image processing method, image processing apparatus, image forming apparatus, computer program, and recording medium
JP4080252B2 (en) Image processing apparatus, image forming apparatus, image processing method, program, and recording medium
JP2011015172A (en) Device for processing image, device for forming image, method and program for processing image, and recording medium recording program for processing image
JP4808282B2 (en) Image processing apparatus, image forming apparatus, image processing method, image processing program, and recording medium for recording image processing program
JP2005191890A (en) Image processing device, image processing method, image processing program, recording medium stored with image processing program and image forming apparatus with image processor
JP4176053B2 (en) Image processing method, image processing apparatus, image forming apparatus, and computer program
JP3996564B2 (en) Background detection method, image processing method, program, recording medium, image processing apparatus, and image forming apparatus
JP2004214908A (en) Image processing apparatus and image forming apparatus provided with the same
JP2003234912A (en) Image processing method, image processing apparatus and image forming apparatus
JP2003224718A (en) Image processing method and image processor
JP4545134B2 (en) Image processing method, image processing apparatus, image forming apparatus, computer program, and recording medium
JP2003125198A (en) Image processing apparatus and image processing method, and image forming device provided with the same, program, and recording medium
JP6441772B2 (en) Image processing apparatus, image forming apparatus, and image processing method
JP6618307B2 (en) Image processing apparatus, image forming apparatus, and resolution determination method
JP2002218272A (en) Image processing method, image processor, image formation device provided with the same and recording medium