JP2010186246A - Image processing apparatus, method, and program - Google Patents
Image processing apparatus, method, and program Download PDFInfo
- Publication number
- JP2010186246A JP2010186246A JP2009028750A JP2009028750A JP2010186246A JP 2010186246 A JP2010186246 A JP 2010186246A JP 2009028750 A JP2009028750 A JP 2009028750A JP 2009028750 A JP2009028750 A JP 2009028750A JP 2010186246 A JP2010186246 A JP 2010186246A
- Authority
- JP
- Japan
- Prior art keywords
- pixel
- image
- pixels
- character
- feature amount
- 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
Links
Images
Landscapes
- Character Input (AREA)
Abstract
Description
本発明は、画像処理装置、方法、及び、プログラムに関し、更に詳しくは、画像から文字領域を抽出する画像処理装置、方法、及び、プログラムに関する。 The present invention relates to an image processing apparatus, method, and program, and more particularly to an image processing apparatus, method, and program for extracting a character region from an image.
画像に含まれる文字を、スキャナ装置などを用いて光学的に読み取り、文字データを出力する光学式文字読み取り装置(OCR;Optical Character Reader)がある。OCRにて、文字データを得るためには、画像から背景領域と文字領域とを分類し、文字を構成する領域を抽出する必要がある。例えば、白色の背景に文字が黒色で記載されている白黒画像では、白色の領域を背景領域とし、黒色の領域を文字領域として切り出すことで、文字領域を抽出する。 There is an optical character reader (OCR) that optically reads characters included in an image using a scanner device or the like and outputs character data. In order to obtain character data by OCR, it is necessary to classify a background region and a character region from an image and extract a region constituting a character. For example, in a black and white image in which characters are written in black on a white background, a white region is extracted as a background region, and a black region is extracted as a character region, thereby extracting the character region.
ところで、広告やポスターなどの画像では、多様な文字の飾り付けがなされていることが多い。例えば、広告などでは、特定の文字を、周囲の文字よりも強調した表示とするために、反転文字とするケースも多い。反転文字とは、例えば、他の文字が白色の背景に黒色で書かれているときに、黒色の背景に白色の文字で書かれている文字を指す。つまり、文字を構成する色が、周囲とは反転している文字を指す。例えば、周辺の文字では、白色が背景で黒色が文字となるところ、反転文字では、黒色が背景で白色が文字となる。 By the way, various characters are often decorated in images such as advertisements and posters. For example, in an advertisement or the like, in many cases, a specific character is displayed as an inverted character in order to display the character more emphasized than surrounding characters. An inverted character refers to, for example, a character written in white characters on a black background when other characters are written in black on a white background. That is, the color which comprises a character points out the character reversed with respect to the circumference | surroundings. For example, in a surrounding character, white is a background and black is a character, and in an inverted character, black is a background and white is a character.
画像に反転文字が混在する場合、反転している領域を精度よく検出しなければ、誤って背景領域を文字領域として抽出することになる。反転文字の検出に関して、特許文献1〜4に記載の技術がある。特許文献1では、ラン長をあらかじめ設定された所定の長さと比較し、ラン長の長さの変化が所定条件を満たすか否かで反転画像判定を行う。ラン長は、画像情報を一方向に計測し、同一の濃度の画素が連続する長さで定義される。特許文献1では、抽出した行領域に対し、文字のエッジ数や黒ラン数のヒストグラムを生成する。その後、ヒストグラムの値が所定のしきい値を超えたか否かを判定し、反転領域か否かを判定している。 When reverse characters are mixed in the image, the background region is erroneously extracted as the character region unless the reverse region is accurately detected. Regarding detection of inverted characters, there are techniques described in Patent Documents 1 to 4. In Patent Document 1, the run length is compared with a predetermined length set in advance, and a reverse image determination is performed based on whether or not the change in the run length satisfies a predetermined condition. The run length is defined by a length of pixels having the same density measured by measuring image information in one direction. In Patent Document 1, a histogram of the number of character edges and the number of black runs is generated for the extracted line area. Thereafter, it is determined whether or not the value of the histogram exceeds a predetermined threshold value, and it is determined whether or not it is an inversion region.
特許文献2では、入力された2値画像の黒画素と白画素との割合を元に、画像の反転を判定する。特許文献2では、入力2値画像の黒画素と白画素の数をカウントし、黒画素の割合が、例えば70%を超える場合は、反転画像であると判定する。特許文献3でも、同様に、黒画素と白画素の数をカウントし、画素数の多い色を、背景領域としている。 In Patent Document 2, image inversion is determined based on the ratio of black pixels and white pixels in an input binary image. In Patent Document 2, the number of black pixels and white pixels in an input binary image is counted, and when the ratio of black pixels exceeds, for example, 70%, it is determined as an inverted image. Similarly in Patent Document 3, the number of black pixels and white pixels is counted, and a color having a large number of pixels is used as a background region.
特許文献4では、入力画像を2値化して2値画像を得ると共に、入力画像のエッジを検出してエッジ画像を生成する。2値画像とエッジ画像のそれぞれに対して領域識別処理を行い、双方の領域識別結果を統合する。その後、統合された領域識別結果に含まれる各文字領域に応じて、入力画像の部分2値化処理を行う。部分2値化では、特許文献2や特許文献3と同様に、白画素と黒画素との割合に応じて、反転文字であるか、非反転文字かを判断している。 In Patent Document 4, an input image is binarized to obtain a binary image, and an edge image is generated by detecting an edge of the input image. Region identification processing is performed on each of the binary image and the edge image, and the region identification results of both are integrated. Thereafter, partial binarization processing of the input image is performed in accordance with each character area included in the integrated area identification result. In partial binarization, similar to Patent Document 2 and Patent Document 3, it is determined whether the character is an inverted character or a non-inverted character according to the ratio of white pixels to black pixels.
特許文献1では、行数や各行の位置といった行情報がわかっていることを前提に、行ごとに白画素、黒画素のラン数を用いて反転領域を特定している。特許文献1では、あらかじめ、画像のどの位置に行が存在するかが分かっている必要がある。従って、特許文献1は、行の位置が固定された定型の文書にしか適用できない。また、入力画像に含まれる文字は、縦又は横に一列に並ぶとは限らない。例えば、斜め方向に文字が並ぶことや、湾曲した曲線上に文字が並ぶこともある。特に、広告など、装飾が多い画像では、こうした傾向が強い。特許文献1は、決まった位置にある行ごとの処理となるので、そうした画像から文字領域を抽出することはできない。 In Patent Document 1, on the assumption that line information such as the number of lines and the position of each line is known, the inversion area is specified using the number of runs of white pixels and black pixels for each line. In Patent Document 1, it is necessary to know in advance where a row exists in an image. Therefore, Patent Document 1 can be applied only to a standard document in which the position of a line is fixed. Further, the characters included in the input image are not necessarily arranged in a line vertically or horizontally. For example, characters may be arranged in an oblique direction, or characters may be arranged on a curved curve. This tendency is particularly strong in images with many decorations such as advertisements. Since Patent Document 1 performs processing for each line at a fixed position, a character region cannot be extracted from such an image.
また、特許文献2では、文字領域に外接している外接矩形内の白画素、黒画素の割合を元に反転領域か否かを判断している。特許文献2では、矩形領域の取り方が適切でないと、文字とは関係がない背景領域の画素が判定基準に大きく影響を与え、反転文字の判定を誤ることがある。このため、反転文字を精度よく抽出することはできない。特許文献3及び4も、同様に、外接矩形内の白黒の画素の割合から反転領域を抽出している。このため、矩形内の文字数や文字の書体に応じて、反転文字の抽出を誤る場合がある。 In Patent Document 2, it is determined whether or not the region is an inversion region based on the ratio of white pixels and black pixels in a circumscribed rectangle circumscribing the character region. In Patent Document 2, if the rectangular area is not properly taken, pixels in the background area that are not related to the character greatly affect the determination criterion, and the determination of the reversed character may be erroneous. For this reason, inverted characters cannot be extracted with high accuracy. Similarly, Patent Documents 3 and 4 also extract the inversion area from the ratio of black and white pixels in the circumscribed rectangle. For this reason, there is a case where reverse character extraction is erroneous depending on the number of characters in the rectangle and the typeface of the characters.
本発明は、行情報を用いなくても、精度よく入力画像に含まれる反転文字の文字領域を抽出可能な画像処理装置、方法、及び、プログラムを提供することを目的とする。 An object of the present invention is to provide an image processing apparatus, method, and program capable of accurately extracting a character region of inverted characters included in an input image without using line information.
上記目的を達成するために、本発明の画像処理装置は、入力画像から、隣接する画素間での特徴量の変化に基づいて、エッジを検出するエッジ検出手段と、前記検出されたエッジに対応する前記入力画像の画素の近傍の画素を前記特徴量に基づいて特徴量が高い画素と特徴量が低い画素とに区分し、前記特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出する領域抽出分離手段とを備えることを特徴とする。 In order to achieve the above object, an image processing apparatus of the present invention corresponds to an edge detection unit that detects an edge from an input image based on a change in a feature amount between adjacent pixels, and corresponds to the detected edge. A pixel in the vicinity of the pixel of the input image is divided into a pixel having a high feature amount and a pixel having a low feature amount based on the feature amount, and a pixel having a low feature amount surrounded by pixels having a high feature amount, and And an area extracting / separating means for extracting a pixel having a high feature quantity surrounded by pixels having a low feature quantity as a character area.
本発明の画像処理方法は、コンピュータが、入力画像から、隣接する画素間での特徴量の変化に基づいて、エッジを検出するステップと、前記コンピュータが、前記検出されたエッジに対応する前記入力画像の画素の近傍の画素を前記特徴量に基づいて特徴量が高い画素と特徴量が低い画素とに区分するステップと、前記コンピュータが、前記特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出するステップとを有することを特徴とする。 The image processing method of the present invention includes a step in which a computer detects an edge from an input image based on a change in a feature amount between adjacent pixels, and the computer inputs the input corresponding to the detected edge. Dividing a pixel in the vicinity of an image pixel into a pixel having a high feature value and a pixel having a low feature value based on the feature value; and the computer has a low feature value surrounded by the pixels having a high feature value. Extracting a pixel having a high feature amount surrounded by pixels and a pixel having a low feature amount as a character region.
本発明のプログラムは、コンピュータに、入力画像から、隣接する画素間での特徴量の変化に基づいて、エッジを検出する処理と、前記検出されたエッジに対応する前記入力画像の画素の近傍の画素を前記特徴量に基づいて特徴量が高い画素と特徴量が低い画素とに区分する処理と、前記特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出する処理とを実行させることを特徴とする。 The program according to the present invention allows a computer to detect an edge from an input image based on a feature amount change between adjacent pixels, and to detect the vicinity of the pixel of the input image corresponding to the detected edge. Based on the feature amount, the pixel is classified into a pixel having a high feature amount and a pixel having a low feature amount, a pixel surrounded by the pixels having a high feature amount, and a pixel having a low feature amount and a pixel having a low feature amount. It is characterized by executing a process of extracting a surrounded pixel having a high feature amount as a character region.
本発明の画像処理装置、方法、及び、プログラムは、行情報を用いなくても、精度よく入力画像に含まれる反転文字の文字領域を抽出することができる。 The image processing apparatus, method, and program of the present invention can accurately extract the character region of the inverted character included in the input image without using line information.
まず、本発明の概要について説明する。図1に、本発明の画像処理装置を示す。画像処理装置10は、エッジ検出手段11と、領域抽出分離手段12とを有する。エッジ検出手段11は、入力画像から、隣接する画素間での特徴量の変化に基づいて、エッジを検出する。領域抽出分離手段12は、エッジ検出手段11で検出されたエッジに対応する入力画像の画素の近傍の画素を、特徴量が高い画素と、特徴量が低い画素とに区分する。領域抽出分離手段12は、エッジ近傍で、特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出する。
First, an outline of the present invention will be described. FIG. 1 shows an image processing apparatus of the present invention. The
エッジ検出手段11が検出したエッジは、文字領域と背景領域との境界を示す。エッジ近傍にて、特徴量が高い画素に囲まれた、特徴量が低い画素を抽出することで、特徴量が高い画素を背景とし、特徴量が低い画素が文字を構成する文字の文字領域を抽出することができる。また、エッジ近傍にて、特徴量が低い画素に囲まれた、特徴量が高い画素を抽出することで、特徴量が低い画素を背景とし、特徴量が高い画素が文字を構成する文字の文字領域を抽出することができる。つまり、入力画像から、反転文字と非反転文字との双方の文字領域を抽出できる。 The edge detected by the edge detection means 11 indicates the boundary between the character area and the background area. By extracting pixels with low feature values that are surrounded by pixels with high feature values in the vicinity of the edge, the pixels with the high feature values are used as the background, and the character regions of the characters in which the low feature values make up the character Can be extracted. In addition, by extracting pixels with a high feature value that are surrounded by pixels with a low feature value in the vicinity of the edge, a character having a low feature value as a background and a pixel with a high feature value constituting a character Regions can be extracted. That is, it is possible to extract character regions of both inverted characters and non-inverted characters from the input image.
本発明では、入力画像からエッジを検出し、エッジ近傍から文字領域を抽出している。このため、反転文字の文字領域抽出に際して、あらかじめ行情報がわかっている必要はない。従って、定型の文書画像だけでなく、さまざまな画像から文字領域を抽出できる。また、エッジ近傍の画素の特徴量に応じて文字領域を抽出しているので、あらかじめ文字領域を判別しておき、入力画像を2値化した2値画像で、文字領域に外接する外接矩形内の白画素と黒画素との比を求める必要がない。外接矩形内で白画素と黒画素との比を求め反転領域か否かを判定する場合は、背景画素が反転領域の判定に影響を与えることがある。また、外接矩形内の文字数や文字の書体に応じて反転領域を正しく判定できないことがある。本発明では、そのような問題は生じず、精度よく反転文字の文字領域を抽出できる。 In the present invention, an edge is detected from an input image, and a character region is extracted from the vicinity of the edge. For this reason, it is not necessary to know line information in advance when extracting a character area of an inverted character. Therefore, character regions can be extracted from various images as well as standard document images. In addition, since the character area is extracted according to the feature amount of the pixel near the edge, the character area is discriminated in advance, and the input image is binarized in the circumscribed rectangle circumscribing the character area. There is no need to obtain the ratio of white pixels to black pixels. When determining the ratio of the white pixel to the black pixel in the circumscribed rectangle and determining whether or not it is an inversion region, the background pixel may affect the determination of the inversion region. In some cases, the inversion area cannot be correctly determined according to the number of characters in the circumscribed rectangle or the typeface of the characters. In the present invention, such a problem does not occur, and the character region of the reversed character can be extracted with high accuracy.
以下、図面を参照し、本発明の実施の形態を詳細に説明する。図2に、本発明の第1実施形態の画像処理装置を示す。画像処理装置100は、画像入力装置110、データ処理部120、データ記憶部130、及び、画像出力装置140を有する。画像入力装置110は、画像を入力する装置である。画像入力装置110は、典型的には、スチルカメラやビデオカメラ、スキャナといった撮像システムである。画像入力装置110は、画像データを、データ処理部120に入力する。入力画像の各画素は、画素値を有する。画素値は、白黒の階調画像であれば、黒(最低輝度)から白(最高輝度)までの輝度値で表される。画素値は、入力画像がカラー画像であれば、色空間に応じたベクトル値で表される。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. FIG. 2 shows an image processing apparatus according to the first embodiment of the present invention. The
データ処理部120は、電子計算機上で所定のプログラムを動作させることで動作する。データ処理部120は、エッジ検出手段121、領域抽出分離手段122、及び、文字領域統合手段125を有する。エッジ検出手段121は、入力画像から、隣接する画素間での特徴量の変化に基づいて、エッジを検出する。エッジ検出手段121は、隣接する画素間での特徴量の変化を求め、特徴量の変化(エッジ強度)がしきい値以上の画素を、エッジとして検出する。
The
エッジ検出手段121は、特徴量の変化の方向に応じて、第1のエッジと第2のエッジとを検出する。エッジ検出手段121は、特徴量が増加する方向のエッジを第1のエッジとして検出し、特徴量が減少する方向のエッジを第2のエッジとして検出する。言い換えれば、エッジ検出手段121は、特徴量の変化が大きい隣接する2つの画素のうち、特徴量が低い側の画素を第1のエッジとして検出し、特徴量が高い側の画素を第2のエッジとして検出する。
The
エッジ検出手段121は、例えば、入力画像の輝度成分を対象として、エッジ検出を行う。エッジ検出手段121は、入力画像から、隣接する画素間での輝度値の変化がしきい値以上で、かつ、明るい輝度値から暗い輝度値に変化する画素を第1のエッジとして検出する。また、エッジ検出手段121は、隣接する画素間での輝度値の変化がしきい値以上で、かつ、暗い輝度値から明るい輝度値に変化する画素を第2のエッジとして検出する。入力画像がカラー画像で、各画素の画素値がRGBの輝度値で表される場合、エッジ検出手段121は、RGBの各プレーンにエッジ検出処理を施し、3つのプレーンの同じ画素位置のエッジ強度のうち、最大のエッジ強度をしきい値処理することで、エッジを検出してもよい。
The
エッジ検出手段121は、入力画像がカラー画像の場合は、特徴量として色相や彩度を用い、これらの変化に基づいて、エッジを検出してもよい。エッジ検出手段121は、例えば、入力画像から、隣接する画素の色相の変化がしきい値以上で、かつ、彩度が大きい値から小さい値に変化する画素を第1のエッジとして検出する。また、エッジ検出手段121は、隣接する画素の色相の変化がしきい値以上で、かつ、彩度が大きい値から小さい値に変化する画素を第2のエッジとして検出する。なお、以下では、説明簡略化のため、主に、入力画像が白黒の階調画像である場合について説明する。
When the input image is a color image, the
領域抽出分離手段122は、エッジ検出手段121から、エッジの位置情報を受け取る。領域抽出分離手段122は、第1のエッジ近傍の入力画像の画素を、特徴量に基づいて、周囲よりも特徴量が高い画素と、周囲よりも特徴量が低い画素とに区分する。領域抽出分離手段122は、例えば特徴量をしきい値処理し、特徴量がしきい値より大きい画素を特徴量が高い画素に区分し、特徴量がしきい値よりも小さい画素を特徴量が低い画素に区分する。領域抽出分離手段122は、第1のエッジの位置に対応する入力画像の画素の近傍の画素のうち、周囲よりも特徴量が高い画素に囲まれた、周囲よりも特徴量が低い画素を、文字領域として抽出する。
The region extraction /
また、領域抽出分離手段122は、エッジ検出部121が検出した第2のエッジの位置に対応する入力画像の画素の近傍の画素を、周囲よりも特徴量が低い画素と、周囲よりも特徴量が高い画素とに区分する。この区分は、上記と同様に、特徴量をしきい値処理することで行うことができる。領域抽出分離手段122は、第2のエッジの位置に対応する入力画像の画素の近傍の画素のうち、周囲よりも特徴量が低い画素に囲まれた、周囲よりも特徴量が高い画素を、文字領域として抽出する。なお、ここで言う“囲まれている”とは、周囲を完全に囲まれていることまでは必要なく、周囲が覆われていれば足りる。
In addition, the region extraction /
本実施形態では、入力画像中で、特徴量が低い画素を背景とし、特徴量が高い画素で文字が構成される文字を反転文字とする。逆に、入力画像中で、特徴量が高い画素を背景とし、特徴量が低い画素で構成される文字を非反転文字とする。第1のエッジの位置に対応する画素の近傍の画素のうち、周囲よりも特徴量が高い画素に囲まれた、周囲よりも特徴量が低い画素で構成される文字領域は、非反転文字の文字領域に対応する。また、第2のエッジの位置に対応する画素の近傍の画素のうち、周囲よりも特徴量が低い画素に囲まれた、周囲よりも特徴量が高い画素で構成される文字領域は、反転文字の文字領域に対応する。 In the present embodiment, in the input image, a pixel having a low feature value is used as a background, and a character that is composed of a pixel having a high feature value is used as an inverted character. Conversely, in the input image, a pixel having a high feature value is set as a background, and a character composed of pixels having a low feature value is set as a non-inverted character. A character region composed of pixels having a feature amount lower than that of the surrounding pixels among pixels near the pixel corresponding to the position of the first edge is a non-inverted character. Corresponds to the character area. In addition, a character area composed of pixels having a feature amount higher than that of the surrounding pixels among the pixels in the vicinity of the pixel corresponding to the position of the second edge is a reversed character. Corresponds to the character area.
領域抽出分離手段122は、局所2値化手段123と、文字領域分離手段124とを有する。局所2値化手段123は、エッジ検出手段121が検出した第1のエッジに対応する入力画像の画素の近傍の画素を処理対象とし、第1のエッジ近傍の入力画像を2値化する。また、局所2値化手段123は、エッジ検出手段121が検出した第2のエッジに対応する入力画像の画素の近傍の画素を処理対象とし、第2のエッジ近傍の入力画像を2値化する。
The area extraction / separation means 122 includes a local binarization means 123 and a character area separation means 124. The
局所2値化手段123は、第1のエッジ近傍の画素では、特徴量が低い画素を黒とし特徴量が高い画素を白とする。この画像を第1の画像とする。また、局所2値化手段123は、第2のエッジ近傍の画素では、周囲よりも特徴量が高い画素を黒とし特徴量が低い画素を白とする。この画像を、第2の画像とする。白画素と黒画素とは(白画素と黒画素の役割りは)、逆でも構わない。
The
文字領域分離手段124は、第1の画像にて、白画素に囲まれた黒画素を抽出し、文字領域として出力する。この第1の画像から抽出された文字領域は、特徴量が高い画素に囲まれた特徴量が低い画素で構成される文字領域、つまり、非反転文字の文字領域に相当する。また、文字領域分離手段124は、第2の画像にて、白画素に囲まれた黒画素を抽出し、文字領域として出力する。この第2の画像から抽出された文字領域は、特徴量が低い画素に囲まれた特徴量が高い画素で構成される文字領域、つまり、反転文字の文字領域に相当する。
The character
ここで、非反転文字にて、文字のパーツの隙間などに背景が入り込むと、その部分は、第2の画像にて、白画素に囲まれた黒画素として現れる。また、反転文字にて、文字のパーツの隙間などに背景が入り込むと、その部分は、第1の画像にて、白画素に囲まれた黒画素として現れる。これらは、抽出された文字領域にて、ノイズ成分となる。そこで、1文字を構成する文字は、反転文字又は非反転文字の何れかであると仮定して、ノイズ成分を除去する。 Here, when a background enters a gap between character parts in a non-inverted character, the portion appears as a black pixel surrounded by white pixels in the second image. In addition, when a background enters a gap between character parts in an inverted character, the portion appears as a black pixel surrounded by white pixels in the first image. These become noise components in the extracted character area. Therefore, the noise component is removed assuming that the characters constituting one character are either inverted characters or non-inverted characters.
文字領域統合手段125は、第1の画像から抽出された文字領域と、第2の画像から抽出された文字領域と統合する。統合に際して、文字領域統合手段125は、第1の画像から抽出された文字領域と、第2の画像から抽出された文字領域とが重複する位置にあるとき、重複する位置の文字領域の何れか一方を文字領域として選択する。より詳細には、文字領域統合手段125は、第1の画像から抽出された文字領域と、第2の画像から抽出された文字領域とに対してラベリング処理を行う。文字領域統合手段125は、重複した位置にあるラベルに対して、ラベル面積に基づいて何れか一方を選択する。
The character
画像出力装置140は、文字領域統合手段125で統合処理が施された文字領域を、後段の文字認識装置などに出力する。或いは、画像出力装置140は、文字領域を、ディスプレイ等の表示画面に表示してもよい。画像出力装置140は、第1の画像から抽出された文字領域と第2の画像から抽出された文字領域とを、別々に出力してもよい。その際、画像出力装置140は、重複した位置にある文字領域のうち、文字領域統合手段125が選択しなかった文字領域を、第1の画像又は第2の画像から削除してもよい。データ記憶部130は、パラメータ記憶部131を含む。パラメータ記憶部131は、各種しきい値や、局所2値化手段123にて2値化処理方法を決定するパラメータなどを記憶する。
The
図3に、動作手順を示す。画像入力装置110は、撮像デバイスで撮影した画像を、データ処理部120に入力する(ステップS1)。入力画像は、撮影した画像には限られず、何らかの方法で生成した画像で構わない。エッジ検出手段121は、入力画像から、第1のエッジと第2のエッジとを検出する(ステップS2A、S2B)。エッジ検出手段121は、エッジの検出では、例えばラプラシアンフィルタのようなエッジ検出フィルタを適用し、特徴量が変化する位置(符号が反転する位置)を検出する。エッジ検出手段121は、特徴量が変化する位置、つまりは、特徴量が高い画素と特徴量が低い画素との境界で、特徴量が低い側の画素を第1のエッジとして検出し、特徴量が高い側の画素を第2のエッジとして検出する。
FIG. 3 shows an operation procedure. The
エッジ検出手段121は、各画素のエッジの強度を計算し、エッジ強度をしきい値処理することで、2値のエッジ画像を生成する。エッジ強度のしきい値は、パラメータ記憶部131に記憶されている固定値を用いることができる。或いは、判別分析法(非特許文献1)を用いて、小領域ごとにしきい値を変えてもよい。なお、ラプラシアンフィルタは、ノイズの影響を受けやすい。このため、エッジ検出手段121がエッジ検出を行う前の段階で、あらかじめ、メディアンフィルタやガウシアンフィルタなどを適用し、入力画像に対してノイズ除去処理や平滑化処理を行っておいてもよい。そのような処理を行っておく場合、ノイズに起因するエッジの誤検出を抑えることができる。
The
局所2値化手段123は、エッジ検出手段121から第1のエッジ及び第2のエッジの位置(座標)を受け取り、入力画像のエッジの近傍の画素に対し、局所的な2値化処理を行う(ステップS3A、S3B)。局所2値化手段123は、ステップS3Aでは、例えば、第1のエッジを構成する画素から所定範囲内の入力画像の画素をエッジ近傍の画素とし、そのエッジ近傍の画素に対して2値化処理を行う。局所2値化手段123は、処理対象の領域内の各画素の特徴量と、その周辺画素の特徴量とを比較し、周辺画素よりも特徴量が高い画素を白に、特徴量が低い画素を黒にした第1の画像を生成する。
The
局所2値化手段123は、ステップS3Bでは、上記と同様に、第2のエッジを構成する画素から所定範囲内の画素をエッジ近傍の画素とし、そのエッジ近傍の画素に対して2値化処理を行う。局所2値化手段123は、処理対象の領域内の各画素について、注目画素の特徴量と周辺画素の特徴量とを比較し、周辺画素に対して特徴量が低い画素を白に、特徴量が高い画素を黒にした第2の画像を生成する。局所2値化手段123は、第1の画像及び第2の画像の生成に際して、処理対象の画素の特徴量を、パラメータ記憶部131に格納されている固定値を用いてしきい値処理し、2値化してもよい。また、局所2値化手段123は、小領域ごとに、判別分析法(非特許文献1)を用いてしきい値を動的に決定してもよい。
In step S3B, the
文字領域分離手段124は、第1及び第2の画像にて、白画素で囲まれた黒画素を抽出し、これを文字領域とする(ステップS4A、S4B)。白画素で囲まれた黒画素の抽出は、以下の手順で行うことができる。文字領域分離手段124は、第1の画像にて、連結された白画素を検索する。文字領域分離手段124は、第1の画像にて、連結された白画素の中に、黒画素が存在するか否かを判断する。文字領域分離手段124は、白画素領域内に、黒画素領域が包含されているときは、その黒画素領域を、文字領域として抽出する。文字領域分離手段124は、上記と同様な手順で、第2の画像にて、連結された白画素領域内に包含されている黒画素領域を、文字領域として抽出する。
The character
文字領域統合手段125は、第1の画像から抽出された文字領域、及び、第2の画像から抽出された文字領域に対して、ラベリング処理を行う。ラベリング際しては、分離されている一文字を構成する複数のパーツ、又は、一連の文字列が1つのラベルとなるように、ラベリング前に画素膨張処理を行ってもよい。文字領域統合手段125は、両画像から抽出された文字領域のうち、ラベル位置が重なり合う領域のラベル面積を比較する(ステップS5)。文字領域統合手段125は、ラベル面積が大きい方の文字領域を残し、ラベル面積が小さい方の文字領域を消去して、両画像から抽出された文字領域を統合する(ステップS6)。この統合処理を行うことで、あるラベル画像では、第1の画像又は第2の画像の何れか一方から抽出された文字領域が、統合後の文字領域として残ることになる。
The character
以下、具体例を用いて説明する。図4に、入力画像例を示す。入力画像は、背景よりも輝度が高い画素で構成される白抜きの文字(反転文字)と、背景よりも輝度が低い画素で構成される黒色の文字(非反転文字)とを含む。エッジ検出手段121は、図4に示す入力画像から、第1のエッジと第2のエッジとを検出する。図5(a)に、第1のエッジで構成されるエッジ画像(エッジ画像A)示し、図5(b)に、第2のエッジで構成されるエッジ画像(エッジ画像B)を示す。図4に示す入力画像からエッジを検出し、エッジの位置の画素を黒、それ以外の画素を白とすると、エッジ画像は、図5(a)及び(b)に示すようになる。 Hereinafter, a specific example will be described. FIG. 4 shows an input image example. The input image includes white characters (inverted characters) composed of pixels with higher brightness than the background and black characters (non-inverted characters) composed of pixels with lower brightness than the background. The edge detection means 121 detects the first edge and the second edge from the input image shown in FIG. FIG. 5A shows an edge image (edge image A) composed of the first edge, and FIG. 5B shows an edge image (edge image B) composed of the second edge. If an edge is detected from the input image shown in FIG. 4 and the pixel at the edge position is black and the other pixels are white, the edge image is as shown in FIGS. 5 (a) and 5 (b).
図6(a)に、入力画像の一部を拡大して示し、(b)及び(c)に、エッジ画像を拡大して示す。図6(a)に示す画像は、“運”の文字のしんにゅう(しんにょう)の点の部分に相当する。点の部分は、高輝度、すなわち、白に近い色であり、背景部分は、グレー、つまり、中間階調の色である。エッジ検出手段121は、輝度が増加方向に変化する画素を第1のエッジとして検出する。つまり、エッジ検出手段121は、図6(a)に示す画像の暗い画素と明るい画素の境界で、暗い画素の位置を第1のエッジとして検出する(図6(b))。また、エッジ検出手段121は、輝度が減少方向に変化する画素を第2のエッジとして検出する。つまり、エッジ検出手段121は、図6(a)に示す画像の暗い画素と明るい画素との境界で、明るい画素の位置を第2のエッジとして検出する(図6(c))。第1のエッジと第2のエッジとは、隣接する関係にある。
FIG. 6A shows an enlarged part of the input image, and FIGS. 6B and 6C show the edge image in an enlarged manner. The image shown in FIG. 6A corresponds to a portion of a point of “luck” characters. The dot portion has a high brightness, that is, a color close to white, and the background portion is gray, that is, a color of intermediate gradation. The
局所2値化手段123は、第1のエッジの位置を用いて、第1のエッジ近傍の入力画像の画素のうち、輝度が低い画素を黒とし、輝度が高い画素を白とする白黒の2値画像(第1の画像)を生成する。また、局所2値化手段123は、第2のエッジの位置を用いて、第2のエッジ近傍の入力画像の画素のうち、輝度が高い画素を黒とし、輝度が低い画素を白とする白黒の2値画像(第2の画像)を生成する。図7(a)及び(b)に、第1の画像と第2の画像とを示す。図7(a)及び(b)において、グレーで示す領域は、2値化処理対象外の領域である。この領域は、背景領域に相当する。
The local binarization means 123 uses the position of the first edge to make black and white 2 pixels of the input image in the vicinity of the first edge where the low luminance pixel is black and the high luminance pixel is white. A value image (first image) is generated. Further, the
図8(a)及び(b)に、それぞれ、第1の画像及び第2の画像の一部を拡大して示す。図8に示す部分は、図6に示すしんにゅうの点の部分に相当する。局所2値化手段123は、図6(b)及び(c)に示すエッジ位置(黒画素の位置)の近傍で2値化処理を行う。エッジ近傍の画素の範囲は、エッジ位置を中心として、上下、左右、及び、斜めに隣接する3×3の領域と定義する。エッジ近傍の画素の範囲は、文字を構成する線の細さや、入力画像中での文字の大きさ、入力画像の解像度などを考慮して、適宜決めておけばよい。 FIGS. 8A and 8B are enlarged views of a part of the first image and the second image, respectively. The portion shown in FIG. 8 corresponds to the portion of the silver point shown in FIG. The local binarization means 123 performs binarization processing in the vicinity of the edge position (black pixel position) shown in FIGS. The range of pixels in the vicinity of the edge is defined as a 3 × 3 area that is vertically and horizontally, and diagonally adjacent to the edge position. The pixel range in the vicinity of the edge may be determined as appropriate in consideration of the fineness of the lines constituting the character, the size of the character in the input image, the resolution of the input image, and the like.
入力画像にて(図6(a))、第1のエッジよりも内側の部分(白に見える部分)は周囲よりも輝度が高く、第1のエッジとその外側の部分(グレーに見える部分)とは周囲よりも輝度が低い。局所2値化手段123は、輝度が高い部分、すなわち、第1のエッジよりも内側の部分を白とし、輝度が低い部分、すなわち、第1のエッジとその外側の部分とを黒とした第1の画像を生成する(図8(a))。また、入力画像にて、第2のエッジとその内側の部分とは周囲よりも輝度が高く、第2のエッジよりも外側の部分は周囲よりも輝度が低い。局所2値化手段123は、輝度が高い部分、すなわち、第2のエッジとその内側の部分とを黒とし、輝度が低い部分、すなわち、第2のエッジよりも外側の部分を白とした第2の画像を生成する(図8(b))。
In the input image (FIG. 6A), the inner portion (the portion that appears white) of the first edge has higher brightness than the surroundings, and the first edge and the outer portion (the portion that appears gray). The brightness is lower than the surroundings. The
文字領域分離手段124は、第1の画像及び第2の画像から、白画素に囲まれた黒画素を抽出し、双方の画像にて、文字領域を抽出する。図9(a)及び(b)に、文字領域分離手段124が抽出した文字領域を示す。図7(a)に示す第1の画像(第1のエッジ近傍の2値画像)にて、白画素に囲まれた黒画素を残し、白画素に囲まれていない黒画素を削除すると、図9(a)に示す画像が得られる。図9(a)に示す画像中の黒画素が、第1の画像から抽出された文字領域に相当する。また、図7(b)に示す第2の画像(第2のエッジ近傍の2値画像)にて、白画素に囲まれた黒画素を残し、白画素に囲まれていない黒画素を削除すると、図9(b)に示す画像が得られる。図9(b)に示す画像中の黒画素が、第2の画像から抽出された文字領域に相当する。
The character
図10(a)及び(b)に、それぞれ図8(a)及び(b)に示す第1の画像及び第2の画像から抽出される文字領域を示す。文字領域分離手段124は、図8(a)に示す第1の画像中で、縦、横、斜めに連続する白画素(白画素の塊)を探索する。文字領域分離手段124は、白画素の塊が見つかると、白画素の塊の中に黒画素が存在するか否かを調べる。入力画像(図4)にて、“運”の文字は反転文字であり、「しんにゅう」の点の部分は輝度が低い領域に囲まれた輝度が高い領域なので、図8(a)では、白画素の塊の中に黒画素は存在していない。従って、図8(a)に示す第1の画像から抽出される文字領域はない(図10(a))。
FIGS. 10A and 10B show character areas extracted from the first image and the second image shown in FIGS. 8A and 8B, respectively. The character
文字領域分離手段124は、図8(b)に示す第2画像中で、縦、横、斜めに連続する白画素の塊を探索する。文字領域分離手段124は、白画素の塊が見つかると、白画素の塊の中に黒画素が存在するか否かを調べる。図8(b)では、黒画素の周りを白画素が囲んでいるので、白画素の塊の中に存在する黒画素が見つかる。文字領域分離手段124は、図8(b)で白画素に囲まれた黒画素を、文字領域として抽出する(図10(b))。このように、「しんにゅう」の点の部分に対応する文字領域は、第1の画像からは抽出されず、第2の画像から抽出されることになる。
The character
非反転文字は、背景を構成する画素の輝度が高く、文字を構成する画素の輝度が低い。非反転文字のエッジ近傍を考えると、第1の画像では、第1のエッジ近傍で非反転文字を構成する画素は黒画素になり、非反転文字の背景の画素は白画素になる。また、第2の画像では、第2のエッジ近傍で非反転文字を構成する画素は白画素になり、非反転文字の背景の画素は黒画素になる。非反転文字は、輝度が高い画素に囲まれた輝度が低い画素で構成されるので、白画素に囲まれた黒画素を抽出することで、第1の画像から、非反転文字の文字領域を抽出できる。 The non-inverted character has high luminance of pixels constituting the background and low luminance of pixels constituting the character. Considering the vicinity of the edge of the non-inverted character, in the first image, the pixels constituting the non-inverted character in the vicinity of the first edge are black pixels, and the background pixel of the non-inverted character is the white pixel. Further, in the second image, the pixels constituting the non-inverted character near the second edge are white pixels, and the background pixel of the non-inverted character is a black pixel. Since the non-inverted characters are composed of pixels with low luminance surrounded by pixels with high luminance, by extracting black pixels surrounded with white pixels, the character region of the non-inverted characters is extracted from the first image. Can be extracted.
また、反転文字は、背景を構成する画素の輝度が低く、文字を構成する画素の輝度が高い。反転文字のエッジ近傍を考えると、第1の画像では、第1のエッジ近傍で反転文字を構成する画素は白画素になり、反転文字の背景の画素は黒画素になる。第2の画像では、第2のエッジ近傍で反転文字を構成する画素は黒画素になり、反転文字の背景の画素は白画素になる。反転文字は、輝度が低い画素に囲まれた輝度が高い画素で構成されるので、白画素に囲まれた黒画素を抽出することで、第2の画像から、反転文字の文字領域を抽出できる。つまり、第1の画像から、非反転文字の文字領域が抽出でき、第2の画像から、反転文字の文字領域が抽出できる。 In the inverted character, the luminance of the pixels constituting the background is low, and the luminance of the pixels constituting the character is high. When the vicinity of the edge of the inverted character is considered, in the first image, the pixels constituting the inverted character near the first edge are white pixels, and the background pixel of the inverted character is a black pixel. In the second image, the pixels constituting the reversed character near the second edge are black pixels, and the background pixels of the reversed character are white pixels. Since the reverse character is composed of pixels with high luminance surrounded by pixels with low luminance, the character region of the reverse character can be extracted from the second image by extracting the black pixels surrounded by white pixels. . That is, the character area of non-inverted characters can be extracted from the first image, and the character area of inverted characters can be extracted from the second image.
第1の画像から抽出された文字領域には、非反転文字を構成する画素に加えて、反転文字で文字を構成する画素に囲まれた背景部分の画素が含まれる。例えば、反転文字である“用”の文字では、文字の内側の背景画素が、文字を構成する画素に囲まれている(図4)。反転文字は、文字を構成する画素の輝度が高く、背景の画素の輝度が低いため、“用”の文字の内側の背景画素は、第1の画像にて白画素に囲まれた黒画素として現れ、文字領域として抽出される(図9(a))。第2の画像でも、同様に、非反転文字の内側の背景画素が、文字領域として抽出される(図9(b))。これら、文字領域として抽出された背景画素は、ノイズ成分となる。 The character region extracted from the first image includes pixels in the background portion surrounded by pixels that form characters with reversed characters, in addition to pixels that form non-inverted characters. For example, in the “for” character that is an inverted character, the background pixel inside the character is surrounded by the pixels constituting the character (FIG. 4). Inverted characters have high brightness in the pixels constituting the text and low brightness in the background pixels. Therefore, the background pixels inside the “use” characters are black pixels surrounded by white pixels in the first image. It appears and is extracted as a character area (FIG. 9A). Similarly, in the second image, the background pixel inside the non-inverted character is extracted as a character region (FIG. 9B). These background pixels extracted as the character area become noise components.
文字領域統合手段125は、同じ位置では、文字は、反転文字又は非反転文字の何れか一方で構成されると仮定し、第1の画像から抽出された文字領域に含まれる反転文字の内側の背景画素、及び、第2の画像から抽出された文字領域に含まれる非反転文字の内側の背景画素を取り除く。文字領域統合手段125は、背景画素を取り除いた双方の文字領域を統合する。言い換えれば、文字領域統合手段125は、双方の画像から抽出された文字領域が重複した位置にあるとき、第1の画像から抽出された文字領域と第2の画像から抽出された文字領域との何れか一方を、統合後の文字領域として選択する。
The character region integration means 125 assumes that, at the same position, the character is composed of either an inverted character or a non-inverted character, and the character region integrating means 125 is located inside the inverted character included in the character region extracted from the first image. The background pixel and the background pixel inside the non-inverted character included in the character region extracted from the second image are removed. The character
図11(a)〜(c)に、文字領域統合処理の様子を示す。文字領域統合手段125は、第1の画像から抽出された文字領域に対して画素膨張処理を行い、黒画素が連結する部分にラベル付けを行う(図11(a))。また、文字領域統合手段125は、第2の画像から抽出された文字領域についても、同様に、画素膨張処理とラベル付けとを行う(図11(b))。ラベル付けの前に、画素膨張処理を行っておくことで、第2の画像から抽出された文字領域で(図9(b))、1文字ずつ分離していた“先進の機能”の文字領域が隣接する文字と連結し、文字列に対して、同じラベルが付与されることになる。
FIGS. 11A to 11C show the character region integration process. The character
文字領域統合手段125は、第1の画像から抽出された文字領域のラベルと、第2の画像から抽出された文字領域のラベルとで、重複する位置にあるラベルが存在するか否かを調べる。文字領域統合手段125は、双方の文字領域で重複した位置にラベルが存在しないとき、つまり、何れか一方にのみラベルが存在する位置では、ラベルが存在する方の文字領域(第1の画像又は第2の画像からを抽出された黒画素)を、統合後の文字領域とする。文字領域統合手段125は、重複する位置にラベルが存在する場合は、ラベル領域の大きさ(面積)を比較し、ラベル面積が大きい方の文字領域を、統合後の文字領域とする(図11(c))。ラベル面積に代えて、ラベル内の画素数を比較してもよい。
The character
例えば、入力画像(図4)に含まれる“先進の機能”の部分を考える。この部分は反転文字なので、文字領域は、第2の画像から抽出される(図9(b))。しかし、第1の画像からも、輝度が低い画素に囲まれた輝度が高い画素が、文字領域として抽出される(図9(a))。文字領域統合手段125がラベル付けを行うと、第1の画像から抽出された文字領域では6つのラベルができ(図11(a))、第2の画像から抽出された文字領域では1つのラベルができる(図11(b))。文字領域統合手段125は、図11(a)に存在する6つのラベルのそれぞれと、図11(b)に存在するラベルとを比較する。図11(a)に存在する6つのラベルのラベル面積は、何れも、図11(b)に存在するラベルのラベル面積よりも小さい。従って、文字領域統合手段125は、“先進の機能”の部分については、第2の画像から抽出された文字列を選択する。最終的に、統合後の文字領域では、第2の画像から抽出された文字領域が残る(図11(c))。
For example, consider the “advanced function” part included in the input image (FIG. 4). Since this part is an inverted character, the character region is extracted from the second image (FIG. 9B). However, from the first image, pixels with high luminance surrounded by pixels with low luminance are extracted as character regions (FIG. 9A). When the character
本実施形態では、エッジ検出手段121は、入力画像から、隣接する画素間での特徴量の変化に基づいてエッジを検出する。領域抽出分離手段122は、検出されたエッジに対応する入力画像の画素の近傍の画素を、特徴量が高い画素と特徴量が低い画素とに区分する。領域抽出分離手段122は、特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出する。文字と背景との境界は、エッジとして検出され、エッジ近傍の画素は、特徴量が高い画素と特徴量が低い画素とを含んでいる。エッジ近傍の画素にて、特徴量が高い画素に囲まれた特徴量が低い画素を抽出することで、非反転文字の文字領域を抽出できる。また、エッジ近傍の画素にて、特徴量が低い画素に囲まれた特徴量が高い画素を抽出することで、反転文字の文字領域を抽出できる。
In the present embodiment, the
本実施形態では、エッジ近傍から、反転文字の文字領域と非反転文字の文字領域との双方を抽出しているので、文字領域の抽出に際して、あらかじめ行がどのように構成されているかという情報を用いる必要はない。従って、入力画像は、定型の文書画像に限定されず、種々の入力画像から、反転文字と非反転文字の文字領域を抽出することができる。また、文字が斜めに並ぶ場合や、湾曲した曲線上に配置される場合も、反転文字と非反転文字の文字領域を抽出できる。 In this embodiment, since both the character area of the inverted character and the character area of the non-inverted character are extracted from the vicinity of the edge, information on how the line is configured in advance when extracting the character area is obtained. There is no need to use it. Therefore, the input image is not limited to a standard document image, and character regions of inverted characters and non-inverted characters can be extracted from various input images. In addition, even when characters are arranged obliquely or arranged on a curved curve, the character regions of inverted characters and non-inverted characters can be extracted.
また、本実施形態では、エッジ近傍にて、特徴量が低い画素に囲まれた特徴量が高い画素を反転文字の文字領域としているので、反転文字の判定に際して、反転文字の領域に外接矩形を設定し、その外接矩形内の黒画素と白画素との比を計算する必要がない。黒画素と白画素との比に基づいて反転領域を判定する方式では、外接矩形の取り方や、文字のフォント、文字を構成する線の太さなどに応じて、反転文字を正しく判定できないことがある。これに対し、本実施形態では、外接矩形は必要なく、フォントや線の太さに依存せずに、反転文字の文字領域を抽出できる。従って、黒画素と白画素との比に基づいて反転領域を判定する方式に比して、反転文字の文字領域を精度よく抽出できる。 Further, in the present embodiment, pixels having a high feature amount surrounded by pixels having a low feature amount in the vicinity of the edge are used as the character region of the reversed character. There is no need to set and calculate the ratio of black pixels to white pixels in the circumscribed rectangle. In the method of judging the inversion area based on the ratio of black pixels to white pixels, the inversion characters cannot be judged correctly depending on how to draw the circumscribed rectangle, the font of the characters, the thickness of the lines constituting the characters, etc. There is. On the other hand, in the present embodiment, a circumscribed rectangle is not necessary, and the character area of the inverted character can be extracted without depending on the font or line thickness. Therefore, the character region of the reversed character can be extracted with higher accuracy than the method of determining the reversed region based on the ratio between the black pixel and the white pixel.
続いて、本発明の第2実施形態について説明する。図12は、本発明の第2実施形態の画像処理装置を示している。画像処理装置100Aは、画像入力装置110と、データ処理部120Aと、データ記憶部130と、画像出力装置140とを有する。データ処理部120Aは、エッジ検出手段121、領域抽出分離手段122、文字領域統合手段125、画像縮小手段126、及び、領域マッチング手段127を有する。第2実施形態におけるデータ処理部120Aの構成は、図2に示す第1実施形態のデータ処理部120の構成に、画像縮小手段126と領域マッチング手段127とが追加された構成である。
Subsequently, a second embodiment of the present invention will be described. FIG. 12 shows an image processing apparatus according to the second embodiment of the present invention. The
画像縮小手段126は、画像入力装置110が入力した画像を縮小して、エッジ検出手段121に渡す。画像縮小手段126は、入力画像を、所望の解像度の画像に縮小する。画像縮小手段126は、例えば、バイリニア方式やバイキュービック方式のような公知の縮小方式を用いて、入力画像を所望の解像度に縮小する。
The
画像の縮小率は、例えば、以下のように決定する。事前に、パラメータ記憶部131にテーブルを記憶しておく。そのテーブルには、画像から抽出したい文字の文字サイズと、その文字サイズの文字領域の抽出が可能となる画像の解像度との対応を記憶しておく。ユーザは、処理対象の文字サイズを指定する。画像縮小手段126は、テーブルを参照して、ユーザが指定した文字サイズに対応する解像度を得る。画像縮小手段126は、入力画像の解像度と、テーブルに記憶された解像度とから、画像の縮小率を決定する。或いは、テーブルに、処理対象の文字サイズと、縮小率との対応を記憶しておいてもよい。この場合、画像縮小手段126は、テーブルから、ユーザが指定した文字サイズに対応する縮小率を取得する。
The image reduction rate is determined as follows, for example. A table is stored in the
例えば、画像から、20ポイント以上の文字を抽出したい場合を考える。画像中には、20ポイント以上の文字加えて、10ポイントや16ポイントなどの20ポイントよりも小さいサイズの文字も含まれているとする。入力画像が、10ポイントや16ポイントの文字の抽出に対して十分な解像度を持っている場合、入力画像をそのまま用いて文字領域の抽出を行うと、入力画像から、必要がない20ポイントよりも小さい文字まで抽出されることになる。そこで、画像縮小手段126を用いて処理対象の画像の解像度を落とし、必要以上に小さいサイズの文字が抽出されないようにする。 For example, consider a case where it is desired to extract characters of 20 points or more from an image. In the image, it is assumed that characters having a size smaller than 20 points such as 10 points and 16 points are included in addition to characters of 20 points or more. If the input image has sufficient resolution for extracting 10-point or 16-point characters, extracting the character area using the input image as it is is more than the unnecessary 20 points from the input image. Even small characters will be extracted. Therefore, the image reduction means 126 is used to reduce the resolution of the image to be processed so that characters with a size smaller than necessary are not extracted.
エッジ検出手段121が行うエッジ検出、領域抽出分離手段122が行う文字領域の抽出、及び、文字領域統合手段125が行う文字領域の統合(反転文字と非反転文字との統合)は、第1実施形態と同様である。ただし、第2実施形態では、画像入力装置110が入力した画像(オリジナル画像)ではなく、画像縮小手段126が縮小した画像に対して、エッジ検出、文字領域抽出、及び、文字領域の統合を行う。文字領域統合手段125は、出縮小画像から抽出された文字領域を出力する。
Edge detection performed by the edge detection means 121, extraction of character areas performed by the area extraction / separation means 122, and integration of character areas performed by the character area integration means 125 (integration of inverted characters and non-inverted characters) are performed in the first embodiment. It is the same as the form. However, in the second embodiment, edge detection, character region extraction, and character region integration are performed not on the image (original image) input by the
領域マッチング手段127は、縮小画像から抽出された文字領域とオリジナル画像とのマッチングを行い、オリジナル画像から詳細な文字領域を抽出する。領域マッチング手段127は、縮小画像から抽出された文字領域が、第1の画像から抽出された文字領域(非反転文字)であるか、第2の画像から抽出された文字領域(反転文字)であるかに応じて、縮小画像で文字領域として抽出された画素に対応するオリジナル画像の領域から、特徴量が低い画素、又は、特徴量が高い画素を文字領域として抽出する。以下では、特徴量として、画素値の輝度成分を考える。特徴量は、色相など別の成分でもよい。
The
図13に、動作手順を示す。画像入力装置110は、画像を入力する(ステップS1)。画像縮小手段126は、入力画像を縮小する(ステップS7)。画像縮小手段126は、パラメータ記憶部131を参照し、縮小画像が、ユーザが指定した処理対象の文字サイズに応じた解像度になるように、画像の縮小率を決定する。或いは、縮小率は、ユーザが任意に設定してもよい。
FIG. 13 shows an operation procedure. The
ステップS2A、S2Bから、ステップS6までの動作は、第1実施形態における動作と同様である。すなわち、エッジ検出部121は、縮小画像から第1のエッジと第2のエッジとを検出する(ステップS2A、S2B)。局所2値化手段123は、第1のエッジ近傍で、縮小画像にて輝度が高い画素を白、輝度が低い画素を黒とする第1の画像を生成する(ステップS3A)。また、局所2値化手段123は、第2のエッジ近傍で、縮小画像にて輝度が低い画素を白、輝度が高い画素を黒とする第2の画像を生成する(ステップS3B)。文字領域分離手段124は、それぞれ、第1の画像及び第2の画像で、白画素に囲まれた黒画素を文字領域として抽出する(ステップS4A、S4B)。文字領域統合手段125は、重複する位置にある文字領域の面積同士を比較し(ステップS5)、文字領域を統合する(ステップS6)。
The operations from step S2A, S2B to step S6 are the same as the operations in the first embodiment. That is, the
文字領域統合手段125が統合した文字領域は、縮小画像から抽出された文字領域である。縮小画像の解像度は、オリジナル画像の解像度よりも低いので、抽出された文字領域は、粗く抽出された文字領域となる。領域マッチング手段127は、文字領域統合手段125が統合した文字領域と、ステップS1で入力された画像(オリジナル画像)とのマッチングを行い、オリジナル画像の解像度で、詳細な文字領域を抽出する(ステップS8)。
The character area integrated by the character
領域マッチング手段127は、文字領域統合手段125から、縮小画像中で文字領域を構成する画素の位置と、その画素が第1の画像から抽出された文字領域か第2の画像から抽出された文字領域かを示す情報とを受け取る。領域マッチング手段127は、第1の画像から抽出された文字領域については、対応するオリジナル画像の領域から、輝度が低い画素を文字領域として抽出する。領域マッチング手段127は、第2の画像から抽出された文字領域については、対応するオリジナル画像の領域から、輝度が高い画素を文字領域として抽出する。
The
図14(a)に、縮小画像から抽出された文字領域を示し、(b)に、オリジナル画像の対応する領域を示す。図14(a)にて、濃い色で表される画素が、文字領域として抽出された画素に対応する。また、文字領域として抽出された画素に記載された数値は、縮小画像の画素の特徴量(輝度値)を表している。画像の縮小率は、1/3とする。縮小画像の1画素は、オリジナル画像では、3×3の領域に対応する。図14(a)に示す縮小画像の2×2の領域は、図14(b)に示すオリジナル画像の6×6の領域に対応する。オリジナル画像にて、Aで示される画素は輝度値14の画素で、Bで示される画素は輝度値100の画素である。 FIG. 14A shows a character area extracted from the reduced image, and FIG. 14B shows a corresponding area of the original image. In FIG. 14A, a pixel represented by a dark color corresponds to a pixel extracted as a character area. The numerical value described in the pixel extracted as the character area represents the feature amount (luminance value) of the pixel of the reduced image. The image reduction ratio is 1/3. One pixel of the reduced image corresponds to a 3 × 3 area in the original image. The 2 × 2 area of the reduced image shown in FIG. 14A corresponds to the 6 × 6 area of the original image shown in FIG. In the original image, a pixel indicated by A is a pixel having a luminance value of 14, and a pixel indicated by B is a pixel having a luminance value of 100.
例えば、図14(a)に示す4つの画素のうちの紙面に向かって右上の画素(輝度値57)について考える。この画素に対応するオリジナル画像の領域(3×3の領域)は、輝度値14の画素(図14(b)に画素Aで示す画素)が4つあり、輝度値100の画素(図14(b)に画素Bで示す画素)が5つある。抽出された文字領域は、第1の画像から抽出された文字領域、つまり、輝度が高い画素を背景とし輝度が低い画素が文字を構成する非反転文字の文字領域であるとする。 For example, consider the upper right pixel (luminance value 57) of the four pixels shown in FIG. The area (3 × 3 area) of the original image corresponding to this pixel has four pixels with a luminance value of 14 (the pixel indicated by pixel A in FIG. 14B), and a pixel with a luminance value of 100 (FIG. 14 (FIG. 14 (b)). There are five pixels b). It is assumed that the extracted character region is a character region extracted from the first image, that is, a character region of non-inverted characters in which a pixel having a high luminance and a pixel having a low luminance constitute a character.
領域マッチング手段127は、縮小画像から文字領域として抽出された画素の輝度値(輝度値57)と、オリジナル画像の対応する領域内の各画素の輝度値とを比較する。領域マッチング手段127は、オリジナル画像の対応する領域内で、輝度値が57よりも低い画素を輝度が低い画素と判断し、その画素を文字領域として抽出する。領域マッチング手段127は、図14(b)では、画素Aを文字領域として抽出する。領域マッチング手段127は、その他の領域についても同様な処理を行う。領域マッチング手段127は、最終的に、オリジナル画像から、図14(b)で濃い色で示す画素を、文字領域として抽出する。
The
抽出された文字領域が、第2の画像から抽出された文字領域、つまり、輝度が低い画素を背景とし輝度が高い画素が文字を構成する反転文字の文字領域であれば、領域マッチング手段127は、上記とは逆の動作で、文字領域を抽出する。すなわち、領域マッチング手段127は、オリジナル画像の対応する領域で、縮小画像から文字領域として抽出された画素の輝度値よりも輝度が高い画素を文字領域として抽出する。
If the extracted character region is a character region extracted from the second image, that is, a character region of an inverted character in which a pixel with high luminance and a pixel with high luminance constitute a character, the
本実施形態では、画像縮小手段126は、入力画像を縮小する。領域マッチング手段127は、縮小画像から抽出された文字領域と縮小前のオリジナル画像とのマッチングを行い、オリジナル画像から文字領域を抽出する。オリジナル画像が、処理対象の文字サイズに対して過大な解像度を持っている場合、抽出する必要がないサイズが小さな文字の文字領域も抽出されることになる。解像度が高いほど、処理すべき画素の数が増えるため、処理に必要なメモリ量が増加し、文字領域の抽出に要する時間も長くなる。本実施形態では、縮小画像に対してエッジ検出、文字領域の抽出を行っているので、解像度が高いオリジナル画像を使用する場合に比して、使用するメモリ量を抑えることができ、また、処理速度を向上することができる。その他の効果は、第1実施形態と同様である。
In the present embodiment, the
なお、上記各実施形態では、エッジ検出手段121は、特徴量の変化の方向に応じて、第1のエッジと第2のエッジとを検出したが、検出するエッジは何れか一方でもよい。これは、第1のエッジと第2のエッジとは隣接するため、第1のエッジの近傍で、特徴量が低い画素に囲まれた特徴量が高い画素を抽出することでも、反転文字の文字領域を抽出することができ、第2のエッジの近傍で、特徴量が高い画素に囲まれた特徴量が低い画素を抽出することでも、非反転文字の文字領域を抽出することができるためである。ただし、特徴量の変化の方向に応じて第1のエッジと第2のエッジを検出する方が、より正確な文字領域の抽出が可能であると考えられる。その理由は、特徴量が高い画素と低い画素との境界で特徴量が低い画素が第1のエッジとなり、特徴量が高い画素と低い画素の境界で特徴量が高い画素が第2のエッジとなるので、第1のエッジは非反転文字を構成する画素の位置と重なり、第2のエッジは反転文字を構成する画素の位置と重なるためである。
In each of the above embodiments, the
上記各実施形態では、第1の画像と第2の画像とを生成したが、生成する2値画像は、何れか一方でもよい。非反転文字の文字領域と、反転文字の文字領域とは、特徴量が高い画素に囲まれた特徴量が低い画素と、特徴量が低い画素に囲まれた特徴量が高い画素とを抽出することで抽出できる。従って、第2の画像を生成せずに、第1の画像を用いて、白画素に囲まれた黒画素を非反転文字の文字領域として抽出し、黒画素に囲まれた白画素を反転文字の文字領域として抽出してもよい。逆に、第1の画像を生成せずに、第2の画像を用いて、黒画素に囲まれた白画素を非反転文字の文字領域として抽出し、白画素に囲まれた黒画素を反転文字の文字領域として抽出してもよい。 In each of the above embodiments, the first image and the second image are generated, but either one of the generated binary images may be used. The non-inverted character region and the inverted character region are extracted from pixels having a low feature amount surrounded by pixels having a high feature amount and pixels having a high feature amount surrounded by pixels having a low feature amount. Can be extracted. Therefore, without generating the second image, the first image is used to extract the black pixels surrounded by the white pixels as the character region of the non-inverted characters, and the white pixels surrounded by the black pixels are converted to the inverted characters. May be extracted as a character area. Conversely, without generating the first image, the second image is used to extract white pixels surrounded by black pixels as the character area of non-inverted characters, and the black pixels surrounded by white pixels are inverted. You may extract as a character area of a character.
画像入力装置110が読み取った画像に対して、何らかの画像処理を施し、データ処理部120に入力してもよい。例えば、エッジ検出手段121がエッジ検出を行う前の段階で、領域判別処理を行い、絵や写真の部分など、文字が存在しないことが明らかな領域を入力画像から削除してもよい。また、第2実施形態で、縮小画像から抽出された文字領域とオリジナル画像とのマッチングを行わない構成も可能である。すなわち、縮小画像が十分な解像度を持ち、縮小画像から抽出された文字領域を用いて文字認識などが可能であれば、マッチングを行わずに、画像出力装置140から、粗く抽出された文字領域を出力してもよい。
An image read by the
以上、本発明をその好適な実施形態に基づいて説明したが、本発明の画像処理装置、方法、及び、プログラムは、上記実施形態にのみ限定されるものではなく、上記実施形態の構成から種々の修正及び変更を施したものも、本発明の範囲に含まれる。 Although the present invention has been described based on the preferred embodiment, the image processing apparatus, method, and program of the present invention are not limited to the above embodiment, and various configurations are possible from the configuration of the above embodiment. Those modified and changed as described above are also included in the scope of the present invention.
本発明は、多様な文字飾りが成されている文書画像から文字領域を抽出する文字領域抽出装置や、文字領域抽出装置をコンピュータに実現するためのプログラムといった用途に適用できる。また、本発明は、光学式文字読み取り装置や、文字認識した結果をファイルに出力するファイル生成装置における文字領域の抽出に適用できる。 INDUSTRIAL APPLICABILITY The present invention can be applied to uses such as a character area extraction device that extracts a character area from a document image with various character decorations, and a program for realizing the character area extraction device in a computer. Further, the present invention can be applied to extraction of a character region in an optical character reading device or a file generation device that outputs a character recognition result to a file.
10:画像処理装置
11:エッジ検出手段
12:領域抽出分離手段
100:画像処理装置
110:画像入力装置
120:データ処理部
121:エッジ検出手段
122:領域抽出分離手段
123:局所2値化手段
124:文字領域分離手段
125:文字領域統合手段
126:画像縮小手段
127:領域マッチング手段
130:データ記憶部
131:パラメータ記憶部
140:画像出力装置
10: Image processing device 11: Edge detection unit 12: Region extraction / separation unit 100: Image processing device 110: Image input device 120: Data processing unit 121: Edge detection unit 122: Region extraction / separation unit 123: Local binarization unit 124 : Character region separation unit 125: Character region integration unit 126: Image reduction unit 127: Region matching unit 130: Data storage unit 131: Parameter storage unit 140: Image output device
Claims (24)
前記検出されたエッジに対応する前記入力画像の画素の近傍の画素を前記特徴量に基づいて特徴量が高い画素と特徴量が低い画素とに区分し、前記特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出する領域抽出分離手段とを備える画像処理装置。 An edge detection means for detecting an edge based on a change in a feature amount between adjacent pixels from an input image;
A pixel in the vicinity of the pixel of the input image corresponding to the detected edge is divided into a pixel having a high feature value and a pixel having a low feature value based on the feature value, and is surrounded by pixels having a high feature value. An image processing apparatus comprising: a pixel having a low feature amount; and a region extraction / separation unit that extracts a pixel having a high feature amount surrounded by pixels having a low feature amount as a character region.
前記エッジに対応する前記入力画像の画素の近傍の画素のうち、前記特徴量が低い画素を黒とし前記特徴量が高い画素を白とする第1の画像、及び、前記特徴量が高い画素を黒とし前記特徴量が低い画素を白とする第2の画像を生成する局所2値化手段と、前記第1の画像及び前記第2の画像にて、白画素に囲まれた黒画素を抽出し、文字領域として出力する文字領域分離手段とを備える、請求項1に記載の画像処理装置。 The region extraction / separation means includes
Of the pixels in the vicinity of the pixel of the input image corresponding to the edge, a first image in which the pixel having a low feature amount is black and the pixel having a high feature amount is white, and a pixel having a high feature amount A local binarization unit that generates a second image in which black is used and a pixel having a low feature amount is white, and black pixels surrounded by white pixels are extracted from the first image and the second image. The image processing apparatus according to claim 1, further comprising a character area separating unit that outputs the character area.
前記コンピュータが、前記検出されたエッジに対応する前記入力画像の画素の近傍の画素を前記特徴量に基づいて特徴量が高い画素と特徴量が低い画素とに区分するステップと、
前記コンピュータが、前記特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出するステップとを有する画像処理方法。 A computer detecting an edge from an input image based on a change in a feature amount between adjacent pixels;
The computer classifying a pixel in the vicinity of the pixel of the input image corresponding to the detected edge into a pixel having a high feature value and a pixel having a low feature value based on the feature value;
And a step of extracting, as a character region, a pixel having a low feature amount surrounded by pixels having a high feature amount and a pixel having a high feature amount surrounded by pixels having a low feature amount.
入力画像から、隣接する画素間での特徴量の変化に基づいて、エッジを検出する処理と、
前記検出されたエッジに対応する前記入力画像の画素の近傍の画素を前記特徴量に基づいて特徴量が高い画素と特徴量が低い画素とに区分する処理と、
前記特徴量が高い画素に囲まれた特徴量が低い画素、及び、特徴量が低い画素に囲まれた特徴量が高い画素を文字領域として抽出する処理とを実行させるプログラム。 On the computer,
From the input image, processing for detecting an edge based on a change in feature amount between adjacent pixels;
Processing to classify a pixel in the vicinity of the pixel of the input image corresponding to the detected edge into a pixel having a high feature value and a pixel having a low feature value based on the feature value;
A program for executing, as a character region, a pixel having a low feature amount surrounded by pixels having a high feature amount and a pixel having a high feature amount surrounded by pixels having a low feature amount.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009028750A JP2010186246A (en) | 2009-02-10 | 2009-02-10 | Image processing apparatus, method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009028750A JP2010186246A (en) | 2009-02-10 | 2009-02-10 | Image processing apparatus, method, and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2010186246A true JP2010186246A (en) | 2010-08-26 |
Family
ID=42766882
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009028750A Pending JP2010186246A (en) | 2009-02-10 | 2009-02-10 | Image processing apparatus, method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2010186246A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2735997A1 (en) * | 2012-11-27 | 2014-05-28 | Kyocera Document Solutions Inc. | Image processing apparatus |
JP2018500702A (en) * | 2015-10-30 | 2018-01-11 | 小米科技有限責任公司Xiaomi Inc. | Region recognition method and apparatus |
JP2018121226A (en) * | 2017-01-26 | 2018-08-02 | 株式会社リコー | Image processing device, image processing method, and program |
US10339657B2 (en) | 2014-06-19 | 2019-07-02 | Kabushiki Kaisha Toshiba | Character detection apparatus and method |
CN112784825A (en) * | 2019-11-01 | 2021-05-11 | 株式会社理光 | Method for identifying characters in picture, method, device and equipment for searching keywords |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01245673A (en) * | 1988-03-25 | 1989-09-29 | Canon Inc | Color image processor |
JPH05128309A (en) * | 1991-11-06 | 1993-05-25 | Glory Ltd | Edge detecting method for character recognition |
JP2007156741A (en) * | 2005-12-02 | 2007-06-21 | Koito Ind Ltd | Character extraction method, character extraction device, and program |
JP2007183742A (en) * | 2006-01-05 | 2007-07-19 | Canon Inc | Image processor, image processing method and computer program |
-
2009
- 2009-02-10 JP JP2009028750A patent/JP2010186246A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01245673A (en) * | 1988-03-25 | 1989-09-29 | Canon Inc | Color image processor |
JPH05128309A (en) * | 1991-11-06 | 1993-05-25 | Glory Ltd | Edge detecting method for character recognition |
JP2007156741A (en) * | 2005-12-02 | 2007-06-21 | Koito Ind Ltd | Character extraction method, character extraction device, and program |
JP2007183742A (en) * | 2006-01-05 | 2007-07-19 | Canon Inc | Image processor, image processing method and computer program |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2735997A1 (en) * | 2012-11-27 | 2014-05-28 | Kyocera Document Solutions Inc. | Image processing apparatus |
CN103841416A (en) * | 2012-11-27 | 2014-06-04 | 京瓷办公信息系统株式会社 | Image processing apparatus |
US9153057B2 (en) | 2012-11-27 | 2015-10-06 | Kyocera Document Solutions Inc. | Image processing apparatus that detects an ordinary character and a density reversed character |
CN103841416B (en) * | 2012-11-27 | 2017-03-01 | 京瓷办公信息系统株式会社 | Image processing apparatus |
US10339657B2 (en) | 2014-06-19 | 2019-07-02 | Kabushiki Kaisha Toshiba | Character detection apparatus and method |
JP2018500702A (en) * | 2015-10-30 | 2018-01-11 | 小米科技有限責任公司Xiaomi Inc. | Region recognition method and apparatus |
JP2018121226A (en) * | 2017-01-26 | 2018-08-02 | 株式会社リコー | Image processing device, image processing method, and program |
CN112784825A (en) * | 2019-11-01 | 2021-05-11 | 株式会社理光 | Method for identifying characters in picture, method, device and equipment for searching keywords |
CN112784825B (en) * | 2019-11-01 | 2024-04-30 | 株式会社理光 | Method for identifying characters in picture, method, device and equipment for retrieving keywords |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10455117B2 (en) | Image processing apparatus, method, and storage medium | |
US9171224B2 (en) | Method of improving contrast for text extraction and recognition applications | |
US8175380B2 (en) | Apparatus and method for improving text recognition capability | |
US9965695B1 (en) | Document image binarization method based on content type separation | |
US11151402B2 (en) | Method of character recognition in written document | |
JP2011139366A (en) | Image processing apparatus and method, and program | |
JP5337563B2 (en) | Form recognition method and apparatus | |
JP2011053953A (en) | Image processing apparatus and program | |
CN113688838B (en) | Red handwriting extraction method and system, readable storage medium and computer equipment | |
US11935314B2 (en) | Apparatus for generating a binary image into a white pixel, storage medium, and method | |
Zhang et al. | A combined algorithm for video text extraction | |
JP2010186246A (en) | Image processing apparatus, method, and program | |
CN116324911A (en) | Method for extracting characters from a vehicle license plate and license plate character extraction device for performing the method | |
US20140086473A1 (en) | Image processing device, an image processing method and a program to be used to implement the image processing | |
JP5796107B2 (en) | Method and apparatus for text detection | |
JP5887242B2 (en) | Image processing apparatus, image processing method, and program | |
JP5929282B2 (en) | Image processing apparatus and image processing program | |
Kumar et al. | Text detection using multilayer separation in real scene images | |
JP6643301B2 (en) | Defect inspection device and defect inspection method | |
JP5979008B2 (en) | Image processing apparatus, image processing method, and program | |
Bhaskar et al. | Implementing optical character recognition on the android operating system for business cards | |
KR20100011187A (en) | Method of an image preprocessing for recognizing scene-text | |
JP2005184787A (en) | Image processing method and device | |
JP4213357B2 (en) | Image processing apparatus, image processing method, and program for executing the method | |
CN112215783B (en) | Image noise point identification method, device, storage medium and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20120111 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20120614 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20120626 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20130205 |