JPH10232939A - Device and method for ruled-line for extracting ruled line from general document image - Google Patents

Device and method for ruled-line for extracting ruled line from general document image

Info

Publication number
JPH10232939A
JPH10232939A JP9346850A JP34685097A JPH10232939A JP H10232939 A JPH10232939 A JP H10232939A JP 9346850 A JP9346850 A JP 9346850A JP 34685097 A JP34685097 A JP 34685097A JP H10232939 A JPH10232939 A JP H10232939A
Authority
JP
Japan
Prior art keywords
straight line
patterns
line
pattern
information
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.)
Granted
Application number
JP9346850A
Other languages
Japanese (ja)
Other versions
JP3565310B2 (en
Inventor
Yutaka Katsuyama
裕 勝山
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP34685097A priority Critical patent/JP3565310B2/en
Publication of JPH10232939A publication Critical patent/JPH10232939A/en
Application granted granted Critical
Publication of JP3565310B2 publication Critical patent/JP3565310B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)
  • Image Processing (AREA)
  • Document Processing Apparatus (AREA)
  • Image Analysis (AREA)

Abstract

PROBLEM TO BE SOLVED: To correctly extract a ruled line from a general document image whose ruled-line structure can not be predicted in advance. SOLUTION: A threshold is set according to the size of a specified standard pattern and a straight-line pattern is extracted. A ruled-line extracting device finds the circumscribed rectangle of a pixel connection area in an input pattern and calculates its height of the highest frequency (P1). Segments are integrated (P4, P9) while wild-card segments are ignored and the height and width of an extracted straight line and the most frequent values of the height and width of the segments constituting the straight line are calculated (P12 to P15). Those most frequent values and various thresholds are used to perform integrating and removing processes for the straight line (P16 to P21), the black pixel distribution of the circumference of the straight line is checked and removed (P22, P23), and the left straight line is decided as a ruled-line candidate (P24).

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、光電変換装置等に
より読み込まれた任意の文書画像から罫線部分を抽出す
る罫線抽出装置および方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a ruled line extracting apparatus and method for extracting a ruled line portion from an arbitrary document image read by a photoelectric conversion device or the like.

【0002】[0002]

【従来の技術】近年、オフィス作業の効率化のために、
紙文書を電子化して光ディスク等に保存する電子ファイ
リングシステムの需要が増加している。従来の電子ファ
イリングシステムにおいては、紙文書がイメージスキャ
ナ等の光電変換装置で画像に変換され、それに検索のた
めのキーワードが付与されて、光ディスクやハードディ
スクに保存される。しかし、これらのキーワード等はキ
ー入力する必要があり、その入力作業が煩雑であった。
2. Description of the Related Art In recent years, in order to make office work more efficient,
There is an increasing demand for an electronic filing system that digitizes paper documents and stores them on an optical disk or the like. In a conventional electronic filing system, a paper document is converted into an image by a photoelectric conversion device such as an image scanner, a keyword for search is given to the image, and the image is stored on an optical disk or a hard disk. However, these keywords and the like have to be keyed, and the input operation is complicated.

【0003】この不便さを解消するための、本出願人に
よる先願の技術として、「文書画像からのタイトル抽出
装置および方法」(特願平07−341983)があ
る。この方法によれば、画像に含まれる文書タイトル
が、キーワードとして自動的に抽出/登録される。ま
た、表形式文書を含む様々な文書の画像から、タイト
ル、宛先、発信元情報等の管理情報を自動抽出すること
ができ、例えば、表外にあるタイトルは、約90%の精
度で抽出できることが分かっている。
[0003] As a prior application technique by the present applicant to solve this inconvenience, there is "Apparatus and method for extracting title from document image" (Japanese Patent Application No. 07-341983). According to this method, a document title included in an image is automatically extracted / registered as a keyword. In addition, management information such as title, destination, and transmission source information can be automatically extracted from images of various documents including a table format document. For example, a title outside a table can be extracted with approximately 90% accuracy. I know.

【0004】しかし、表内のタイトルについては抽出精
度が約55%に過ぎず、実用化するには精度が不十分で
ある。表内のタイトル等のキーワードを高精度で抽出す
るには、表を構成する罫線を正確に抽出する必要があ
る。罫線抽出技術は、主として、文字等が規則的に並ん
でいる帳票を対象に開発されてきた。
However, the extraction accuracy of titles in the table is only about 55%, which is insufficient for practical use. To extract keywords such as titles in a table with high accuracy, it is necessary to accurately extract ruled lines constituting the table. Ruled line extraction technology has been developed mainly for forms in which characters and the like are regularly arranged.

【0005】従来の罫線抽出技術としては、「画像抽出
方式」(特開平6−309498)と「画像抽出装置」
(特開平7−28937)がある。これらの技術によれ
ば、帳票内の枠の位置等の情報入力を必要とせずに、枠
の抽出や除去を行うことが可能である。処理可能な帳票
は、一文字枠、ブロック枠(横一行枠またはフリーフォ
ーマット枠)、または枠の外形が矩形状になっており横
枠線が規則的に配置されている構造を持つ表を有するも
のである。
[0005] As the conventional ruled line extraction technology, there are an "image extraction method" (Japanese Patent Laid-Open No. 6-309498) and an "image extraction device".
(JP-A-7-28937). According to these techniques, it is possible to extract or remove a frame without having to input information such as the position of the frame in the form. A form that can be processed has a single character frame, a block frame (horizontal one line frame or free format frame), or a table having a structure in which the outline of the frame is rectangular and the horizontal frame lines are arranged regularly. It is.

【0006】また、本出願人による先願の罫線抽出技術
としては、「枠抽出装置及び矩形抽出装置」(特願平7
−203259)、「パターン領域切り出し方式及びパ
ターン抽出装置」(特願平7−282171)、および
「パターン抽出装置及びパターン領域の切り出し方法」
(特願平8−107568)がある。
[0006] As a prior art ruled line extraction technology by the present applicant, a "frame extraction device and a rectangle extraction device" (Japanese Patent Application No. Hei.
-203259), “Pattern region extraction method and pattern extraction device” (Japanese Patent Application No. 7-282171), and “Pattern extraction device and pattern region extraction method”
(Japanese Patent Application No. 8-107568).

【0007】これらの技術によれば、図48に示すよう
に枠の外形が矩形であっても、また、図49に示すよう
に枠の外形が矩形でなくても、枠の抽出および除去を行
うことができる。さらに、図49の網掛け部分のよう
に、枠で囲まれた矩形の中にさらに細かい構造を持つ表
形式枠についても、枠の抽出および除去を行うことが可
能である。以下に、処理の概要を示す。
According to these techniques, even if the outline of the frame is rectangular as shown in FIG. 48, or even if the outline of the frame is not rectangular as shown in FIG. It can be carried out. Further, it is possible to extract and remove a frame in a tabular form having a finer structure in a rectangle surrounded by the frame as shown by a shaded portion in FIG. The outline of the process is shown below.

【0008】(1)細線化:マスク処理によって、縦横
の線分を細線化し、文字と枠の太さの差をなくす。 (2)線分抽出:「画像抽出方式」(特開平6−309
498)における隣接投影法を用いて、比較的長い直線
の抽出を行う。隣接投影とは、注目する行または列に含
まれる画素の投影値に、その周囲の行または列の投影値
を足し合せた結果を、注目する行または列の最終的な投
影値とする方法である。この投影法によれば、特定の行
または列の周囲の画素分布を大局的に捉えることができ
る。
(1) Thinning: Vertical and horizontal line segments are thinned by mask processing to eliminate the difference in thickness between characters and frames. (2) Line segment extraction: "Image extraction method" (Japanese Patent Laid-Open No. 6-309)
498), a relatively long straight line is extracted using the adjacent projection method. The adjacent projection is a method of adding the projection value of a pixel included in a row or column of interest to the projection value of a surrounding row or column as the final projection value of the row or column of interest. is there. According to this projection method, a pixel distribution around a specific row or column can be grasped globally.

【0009】(3)直線抽出:抽出された線分を順に探
索し、線分と線分の間に一定長さ以上の途切れがないか
どうかを検査する。間にそのような途切れがない線分同
士を順に統合していき、長い直線を抽出する。
(3) Straight line extraction: The extracted line segments are searched in order, and it is checked whether there is a break of a certain length or more between the line segments. Line segments without such a break are integrated in order, and a long straight line is extracted.

【0010】(4)直線統合:抽出された直線同士を再
度統合する。かすれにより2つ以上の部分に分離された
直線を、1つの直線に統合する。 (5)直線伸張:規則的な帳票であると分かっていると
きに限り、かすれにより短くなった直線の伸張処理を行
い、本来の長さに修復する。
(4) Straight line integration: The extracted straight lines are integrated again. Straight lines separated into two or more parts by blurring are integrated into one straight line. (5) Straight line extension: Only when it is known that the document is a regular form, the straight line shortened due to blurring is extended and restored to its original length.

【0011】[0011]

【発明が解決しようとする課題】しかしながら、上述し
た罫線抽出技術には次のような問題がある。先願の技術
において、帳票の枠の形状に関しては、規則的な構造で
あっても不規則な構造であっても、矩形領域で構成され
ている表形式枠であれば、処理可能である。また、対象
としていた罫線は、実線、点線の場合とも、かすれのあ
るなしに関わらず処理可能である。また、規則的な表で
あると分かっている場合にのみ、極度のかすれにより短
くなった直線を伸ばす処理を行っている。
However, the above-described ruled line extraction technique has the following problems. In the technology of the prior application, the form of a form can be processed as long as it has a regular or irregular structure as long as it is a tabular frame composed of rectangular areas. Also, the ruled line that is the target can be processed regardless of whether it is a solid line or a dotted line, regardless of whether it is blurred or not. Further, only when it is known that the table is a regular table, a process of extending a straight line shortened by extreme blurring is performed.

【0012】しかし、一般的な入力画像には、図50に
示すように、文字が太いフォントで記載されていたり、
表内に網掛け部分があったりするものも含まれる。この
ような場合、文字同士が接触して潰れた文字列上から誤
って罫線が抽出され、正しい罫線と誤抽出された罫線が
誤って統合されることがある。
However, in a general input image, characters are described in a bold font as shown in FIG.
Some of the tables have shaded areas. In such a case, a ruled line may be erroneously extracted from a character string crushed by contact between characters, and a correct ruled line and an erroneously extracted ruled line may be erroneously integrated.

【0013】また、網掛けの部分のような黒画素の固ま
りに接触した罫線や、文字に接触している罫線は、抽出
することができない。こうした不具合をなくすために
は、あらかじめ罫線構造が分かっている帳票のような表
形式文書のみを、処理対象とすることが望ましい。
A ruled line contacting a cluster of black pixels, such as a shaded portion, or a ruled line contacting a character cannot be extracted. In order to eliminate such inconveniences, it is desirable that only a tabular document such as a form having a known ruled line structure be processed.

【0014】しかし、電子ファイリングで扱われる一般
文書にはどのような形式の表が含まれるか、あらかじめ
分かっておらず、潰れた文字等を含む様々な画像が入力
される可能性が高い。したがって、先願の技術のままで
は、必ずしも正しい罫線抽出ができないという問題があ
る。
However, it is not known in advance what kind of table is included in a general document handled by electronic filing, and there is a high possibility that various images including crushed characters and the like are input. Therefore, there is a problem that the ruled line cannot always be correctly extracted using the technique of the prior application.

【0015】本発明の課題は、あらかじめ罫線構造が予
測できない一般の文書画像から、罫線部分を正しく抽出
することのできる罫線抽出装置および方法を提供するこ
とである。
It is an object of the present invention to provide a ruled line extracting apparatus and method capable of correctly extracting a ruled line portion from a general document image whose ruled line structure cannot be predicted in advance.

【0016】[0016]

【課題を解決するための手段】図1は、本発明の罫線抽
出装置の原理図である。図1の罫線抽出装置は、本発明
の第1、第2、第3、第4、第5、第6、第7、第8、
第9、第10、および第11の原理を含み、推定手段
1、格納手段2、線分抽出手段3、計算手段4、直線抽
出手段5、グラフ生成手段6、直線処理手段7、直線統
合手段8、および直線除去手段9を備える。
FIG. 1 is a diagram showing the principle of a ruled line extracting apparatus according to the present invention. The ruled line extraction device of FIG. 1 is the first, second, third, fourth, fifth, sixth, seventh, eighth, and eighth embodiments of the present invention.
Including the ninth, tenth, and eleventh principles, estimating means 1, storage means 2, line segment extracting means 3, calculating means 4, straight line extracting means 5, graph generating means 6, straight line processing means 7, straight line integrating means 8 and a straight line removing means 9.

【0017】第1の原理において、推定手段1は、入力
画像に含まれる標準パターンの大きさを推定する。直線
抽出手段5は、上記標準パターンの大きさの情報に基づ
いてしきい値を設定し、そのしきい値を用いて、上記入
力画像から1つ以上の直線パターンの情報を抽出する。
In the first principle, the estimating means 1 estimates the size of a standard pattern included in an input image. The straight line extracting means 5 sets a threshold value based on the information on the size of the standard pattern, and extracts information of one or more straight line patterns from the input image using the threshold value.

【0018】標準パターンとは、入力画像に最も多く含
まれる標準的な大きさの文字等のパターンに相当する。
この標準パターンとしては、例えば、文字を表す画素連
結領域が用いられ、その大きさの情報としては、例え
ば、その領域の外接矩形の高さまたは幅が用いられる。
The standard pattern corresponds to a pattern such as a character having a standard size most often included in an input image.
As the standard pattern, for example, a pixel connection region representing a character is used, and as the size information, for example, the height or width of a circumscribed rectangle of the region is used.

【0019】また、直線パターンとは、横長または縦長
のマスクを用いたマスク処理および線分統合処理によ
り、入力画像から抽出された横長または縦長のパターン
に相当する。直線パターンの情報としては、例えば、そ
のパターンを構成する複数の線分パターンの外接矩形の
座標値等が含まれる。線分パターンとは、マスク処理に
より画像から切り取られた線分状の画素領域に相当す
る。
The linear pattern corresponds to a horizontal or vertical pattern extracted from an input image by mask processing using a horizontal or vertical mask and line segment integration processing. The information on the straight line pattern includes, for example, coordinate values of a circumscribed rectangle of a plurality of line segment patterns constituting the pattern. The line segment pattern corresponds to a line-shaped pixel region cut out from the image by the mask processing.

【0020】直線抽出手段5は、標準パターンの大きさ
に基づいて各種しきい値を決定し、画像中の直線パター
ンをそれらのしきい値によって分別する。これにより、
網掛け部分や接触文字等に由来する直線パターンを罫線
候補から除外し、正しい罫線候補を抽出することができ
る。
The straight line extracting means 5 determines various threshold values based on the size of the standard pattern, and classifies the straight line patterns in the image based on the threshold values. This allows
A straight line pattern derived from a shaded portion or a contact character can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.

【0021】第2の原理において、直線抽出手段5は、
入力画像から1つ以上の直線パターンの情報を抽出す
る。計算手段4は、上記1つ以上の直線パターンの大き
さの代表値を求める。直線処理手段7は、上記代表値に
基づいてしきい値を設定し、そのしきい値を用いて、上
記1つ以上の直線パターンの情報を処理する。
In the second principle, the straight line extracting means 5
The information of one or more linear patterns is extracted from the input image. The calculating means 4 calculates a representative value of the size of the one or more linear patterns. The straight line processing means 7 sets a threshold value based on the representative value, and processes the information of the one or more linear patterns using the threshold value.

【0022】計算手段4は、例えば、複数の直線パター
ンの高さまたは幅のヒストグラムから、直線パターンの
代表的な大きさを求める。直線処理手段7は、この代表
値付近にしきい値を設定し、それ以上の大きさの直線パ
ターンを罫線候補から除外する等の処理を行って、正し
い罫線候補を抽出することができる。
The calculating means 4 obtains a representative size of a straight line pattern from a histogram of the heights or widths of a plurality of straight line patterns, for example. The straight line processing means 7 can set a threshold value around this representative value and perform processing such as excluding a straight line pattern having a larger size from the ruled line candidates, thereby extracting a correct ruled line candidate.

【0023】第3の原理において、直線抽出手段5は、
入力画像から1つ以上の直線パターンの情報を抽出す
る。計算手段4は、上記1つ以上の直線パターンを構成
する1つ以上の線分パターンの大きさの代表値を求め
る。直線処理手段7は、上記代表値に基づいてしきい値
を設定し、そのしきい値を用いて、上記1つ以上の直線
パターンの情報を処理する。
In the third principle, the straight line extracting means 5
The information of one or more linear patterns is extracted from the input image. The calculating means 4 calculates a representative value of the size of one or more line segment patterns constituting the one or more linear patterns. The straight line processing means 7 sets a threshold value based on the representative value, and processes the information of the one or more linear patterns using the threshold value.

【0024】線分パターンは、上述したように、マスク
処理により画像から切り取られた線分状の画素領域に相
当する。計算手段4は、例えば、複数の線分パターンの
高さまたは幅のヒストグラムから、線分パターンの代表
的な大きさを求める。直線処理手段7は、この代表値に
基づくしきい値より大きい線分パターンのみから構成さ
れる直線パターンを罫線候補から除外する等の処理を行
って、正しい罫線候補を抽出することができる。
As described above, the line segment pattern corresponds to a line-shaped pixel region cut out from the image by the mask processing. The calculating means 4 obtains a representative size of the line segment pattern from a histogram of the heights or widths of the plurality of line segment patterns, for example. The straight line processing means 7 can perform processing such as excluding a straight line pattern composed of only line segment patterns larger than the threshold value based on the representative value from the ruled line candidates, and can extract correct ruled line candidates.

【0025】第4の原理において、線分抽出手段3は、
入力画像から1つ以上の線分パターンの情報を抽出す
る。格納手段2は、上記1つ以上の線分パターンの情報
を、大きな線分パターンの情報と小さな線分パターンの
情報とに区別して格納する。直線抽出手段5は、上記1
つ以上の線分パターンの接続状態を調べ、途中に上記大
きな線分パターンが存在するとき、その大きな線分パタ
ーンの大きさに関わらず、他の複数の線分パターンが構
成する直線パターンを抽出する。
In the fourth principle, the line segment extraction means 3
Information of one or more line segment patterns is extracted from the input image. The storage means 2 stores the information of the one or more line segment patterns separately into information of a large line segment pattern and information of a small line segment pattern. The straight line extracting means 5 is used for the above 1
Examine the connection state of one or more line segment patterns and, when the above-mentioned large line segment pattern exists in the middle, regardless of the size of the large line segment pattern, extract a straight line pattern constituted by other plural line segment patterns I do.

【0026】線分パターンの情報としては、例えば、そ
の外接矩形の座標値等が含まれる。格納手段2は、例え
ば、適当なしきい値より大きな線分パターンの情報に特
定の属性情報を付加し、それ以外の小さな線分パターン
の情報と区別して格納する。直線抽出手段5は、例え
ば、互いに重複する複数の線分パターンを統合して、そ
れらの外接矩形を直線パターンとして抽出する際に、大
きな線分パターンを無視して、その両側の小さな線分パ
ターン同士を適当に接続する処理を行う。
The information on the line segment pattern includes, for example, coordinate values of the circumscribed rectangle. For example, the storage unit 2 adds specific attribute information to information of a line segment pattern larger than an appropriate threshold value and stores the information separately from information of other small line segment patterns. The straight line extracting means 5 ignores a large line segment pattern and extracts a small line segment pattern on both sides when integrating a plurality of overlapping line segment patterns and extracting a circumscribed rectangle as a straight line pattern. A process for appropriately connecting each other is performed.

【0027】これにより、網掛け部分や文字等の大きな
画素領域に接触した罫線の画像から、その領域の大きさ
に影響されない直線パターンを、正しい罫線候補として
抽出することができる。
As a result, a straight line pattern which is not affected by the size of a large pixel area such as a shaded portion or a character can be extracted as a correct rule line candidate from the image of the ruled line.

【0028】第5の原理において、直線抽出手段5は、
入力画像から1つ以上の直線パターンの情報を抽出す
る。直線統合手段8は、上記1つ以上の直線パターンに
含まれる2つの直線パターンがほとんど重複する場合
に、それらの2つの直線パターンを1つに統合する。
According to the fifth principle, the straight line extracting means 5
The information of one or more linear patterns is extracted from the input image. When the two linear patterns included in the one or more linear patterns almost overlap, the straight line integrating unit 8 integrates the two linear patterns into one.

【0029】直線統合手段8が、ほとんど重複する2つ
の直線パターンを統合することで、冗長な直線情報を削
減し、正しい罫線候補を抽出することができる。第6の
原理において、直線抽出手段5は、入力画像から1つ以
上の直線パターンの情報を抽出する。直線除去手段9
は、上記1つ以上の直線パターンのうちの1つの形に関
する情報と、それらの1つ以上の直線パターンに含まれ
る2つの直線パターンの間の距離に関する情報のうち、
少なくとも一方の情報を用いて、それらの1つ以上の直
線パターンのうちの1つを除去するかどうかを判定す
る。
The straight line integrating means 8 integrates two almost overlapping linear patterns, thereby reducing redundant straight line information and extracting correct ruled line candidates. According to the sixth principle, the straight line extracting means 5 extracts information of one or more straight line patterns from the input image. Straight line removing means 9
Is information regarding one form of the one or more linear patterns and information regarding a distance between two linear patterns included in the one or more linear patterns.
At least one piece of information is used to determine whether to remove one of the one or more linear patterns.

【0030】直線除去手段9が、例えば、直線パターン
の縦横比や隣の直線パターンまでの距離に基づいて、そ
の直線パターンの罫線らしさを判定し、罫線らしくない
直線パターンを除去する。これにより、網掛け部分や潰
れた文字列等に由来する直線パターンを罫線候補から除
外し、正しい罫線候補を抽出することができる。
The straight line removing means 9 determines the likelihood of a ruled line of the straight line pattern based on, for example, the aspect ratio of the straight line pattern and the distance to the next straight line pattern, and removes a straight line pattern that is not considered to be a ruled line. As a result, a straight line pattern derived from a shaded portion, a crushed character string, or the like can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.

【0031】第7の原理において、直線抽出手段5は、
入力画像から1つ以上の直線パターンの情報を抽出す
る。直線除去手段9は、上記1つ以上の直線パターンに
含まれる横直線パターンと縦直線パターンの接続関係に
基づき、それらの横直線パターンと縦直線パターンのう
ちの一方を除去するかどうかを判定する。
In the seventh principle, the straight line extracting means 5
The information of one or more linear patterns is extracted from the input image. The straight line removing means 9 determines whether to remove one of the horizontal straight line pattern and the vertical straight line pattern based on the connection relationship between the horizontal straight line pattern and the vertical straight line pattern included in the one or more straight line patterns. .

【0032】直線除去手段9が、例えば、いずれの横直
線パターンとも接触しない縦直線パターンや、いずれの
縦直線パターンとも接触しない横直線パターンを、罫線
候補から除外する。これにより、潰れた文字列等に由来
する直線パターンを罫線候補から除外し、正しい罫線候
補を抽出することができる。
The straight line removing means 9 excludes, for example, a vertical straight line pattern that does not contact any horizontal straight line pattern or a horizontal straight line pattern that does not contact any vertical straight line pattern from ruled line candidates. Thus, a straight line pattern derived from a crushed character string or the like can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.

【0033】第8の原理において、直線抽出手段5は、
入力画像から1つ以上の直線パターンの情報を抽出す
る。直線除去手段9は、上記1つ以上の直線パターンに
含まれ、ほとんど重複する2つの直線パターンのうち
の、短い方を除去する。
According to the eighth principle, the straight line extraction means 5
The information of one or more linear patterns is extracted from the input image. The straight line removing unit 9 removes the shorter one of the two line patterns that are included in the one or more straight line patterns and almost overlap with each other.

【0034】直線除去手段9が、ほとんど重複する2つ
の直線パターンのうち短い方を除去することで、冗長な
直線情報を削減し、正しい罫線候補を抽出することがで
きる。
The straight line removing means 9 removes the shorter one of the two almost overlapping straight line patterns, so that redundant straight line information can be reduced and correct ruled line candidates can be extracted.

【0035】第9の原理において、直線抽出手段5は、
入力画像から1つ以上の直線パターンの情報を抽出す
る。直線統合手段8は、上記1つ以上の直線パターンの
うち部分的に重複する2つの直線パターンを統合してで
きる直線パターンの大きさが所定値程度になる場合に、
統合後の直線パターンを罫線候補とする。
In the ninth principle, the straight line extracting means 5
The information of one or more linear patterns is extracted from the input image. When the size of a straight line pattern obtained by integrating two partially overlapping straight line patterns of the one or more straight line patterns becomes approximately a predetermined value,
The straight line pattern after integration is set as a ruled line candidate.

【0036】直線統合手段8は、例えば、2つの直線パ
ターンを統合してできる直線パターンの太さが直線パタ
ーンの代表的な太さ程度であれば、その統合処理を実行
する。これにより、冗長な直線情報を削減し、正しい罫
線候補を抽出することができる。
For example, if the thickness of a straight line pattern obtained by integrating two straight line patterns is about the typical thickness of a straight line pattern, the straight line integrating means 8 executes the integration process. As a result, redundant straight line information can be reduced, and correct ruled line candidates can be extracted.

【0037】第10の原理において、直線抽出手段5
は、入力画像から1つ以上の直線パターンの情報を抽出
する。直線除去手段9は、上記1つ以上の直線パターン
のうち、しきい値より大きな線分パターンだけで構成さ
れている直線パターンを除去する。
In the tenth principle, the straight line extracting means 5
Extracts information of one or more linear patterns from an input image. The straight line removing means 9 removes a straight line pattern composed of only line segment patterns larger than the threshold value from the one or more straight line patterns.

【0038】直線除去手段9は、例えば、線分パターン
の代表的な太さに比べてかなり太い線分パターンだけか
ら構成される直線パターンを、罫線候補から除外する。
これにより、潰れた文字列等に由来する直線パターンを
罫線候補から除外し、正しい罫線候補を抽出することが
できる。
The straight line removing means 9 removes, from the ruled line candidates, straight line patterns composed of only line segment patterns that are considerably thicker than the typical line segment patterns, for example.
Thus, a straight line pattern derived from a crushed character string or the like can be excluded from ruled line candidates, and a correct ruled line candidate can be extracted.

【0039】第11の原理において、直線抽出手段5
は、入力画像から直線パターンの情報を抽出する。グラ
フ生成手段6は、上記直線パターンを構成する1つ以上
の線分パターンのうち、標準的な大きさの線分パターン
の内部の画素数を求めて、その直線パターンの周囲にお
ける画素数のグラフを生成する。直線除去手段9は、上
記グラフの形状に基づいて、上記直線パターンを除去す
るかどうかを判定する。
In the eleventh principle, the straight line extracting means 5
Extracts linear pattern information from an input image. The graph generating means 6 obtains the number of pixels inside a line segment pattern of a standard size from among one or more line segment patterns constituting the straight line pattern, and obtains a graph of the number of pixels around the straight line pattern. Generate The straight line removing unit 9 determines whether to remove the straight line pattern based on the shape of the graph.

【0040】グラフ生成手段6は、例えば、直線パター
ンを構成する線分パターンの集合から大きな線分パター
ンを除いて、標準的な大きさの線分パターンの集合を生
成する。そして、それらを直線パターンの周囲の領域に
シフトさせて、シフト量と画素数との関係を表すグラフ
を生成する。また、直線除去手段9は、例えば、そのグ
ラフの形状がなだらかで極大値がはっきりしない場合
に、直線パターンを罫線候補から除外する。
The graph generation means 6 generates a set of line segment patterns of a standard size, for example, excluding a large line segment pattern from a set of line segment patterns forming a straight line pattern. Then, they are shifted to the area around the linear pattern, and a graph representing the relationship between the shift amount and the number of pixels is generated. Further, for example, when the shape of the graph is gentle and the maximum value is not clear, the straight line removing unit 9 removes the straight line pattern from the ruled line candidates.

【0041】網掛け部分や潰れた文字列等の内部より抽
出された直線パターンの場合、その周囲に画素がまんべ
んなく分布していることが多い。このような場合に、グ
ラフの形状がなだらかとなり、その直線パターンが罫線
候補から除外されるので、正しい罫線候補を抽出するこ
とができる。
In the case of a straight line pattern extracted from the inside of a shaded portion, a crushed character string, or the like, pixels are often distributed evenly around the straight line pattern. In such a case, the shape of the graph becomes gentle and the straight line pattern is excluded from the ruled line candidates, so that a correct ruled line candidate can be extracted.

【0042】例えば、図1の格納手段2は、後述する図
3におけるメモリ32に対応し、推定手段1、線分抽出
手段3、計算手段4、直線抽出手段5、グラフ生成手段
6、直線処理手段7、直線統合手段8、および直線除去
手段9は、CPU(中央処理装置)31およびメモリ3
2に対応する。
For example, the storage means 2 in FIG. 1 corresponds to the memory 32 in FIG. 3, which will be described later, and the estimating means 1, the line segment extracting means 3, the calculating means 4, the straight line extracting means 5, the graph generating means 6, the straight line processing The means 7, the straight line integrating means 8, and the straight line removing means 9 include a CPU (central processing unit) 31 and a memory 3
Corresponds to 2.

【0043】[0043]

【発明の実施の形態】以下、図面を参照しながら、本発
明の実施の形態を詳細に説明する。現在、表内のタイト
ル等のキーワードを高精度に自動抽出するために、表形
式文書のフォーム学習システムが開発されつつある。こ
のシステムでは、あらかじめ表を含む文書を登録してお
いて、登録文書については後で高い精度で正しいキーワ
ードを抽出することが可能になる。本発明は、表形式文
書のフォーム学習時において、文書画像から罫線を正し
く抽出するために用いることができる。
Embodiments of the present invention will be described below in detail with reference to the drawings. At present, a form learning system for tabular documents is being developed in order to automatically extract keywords such as titles in a table with high accuracy. In this system, a document including a table is registered in advance, and a correct keyword can be extracted later with high accuracy from the registered document. INDUSTRIAL APPLICABILITY The present invention can be used to correctly extract ruled lines from a document image when learning the form of a tabular document.

【0044】本発明では、従来および先願の帳票用の罫
線抽出技術を改良し、罫線を構成する小線分の情報を活
用して、本来の罫線から抽出された直線と文字列上から
誤抽出された直線とを区別する。これにより、文字が罫
線に接触している場合でも、正しく罫線を抽出すること
ができる。
According to the present invention, the conventional and prior application ruled line extraction technology for forms is improved, and information on small lines constituting the ruled line is utilized to detect incorrect lines and characters extracted from the original ruled line. Distinguish from the extracted straight line. Thus, even when a character is in contact with a ruled line, a ruled line can be correctly extracted.

【0045】また、表内の潰れ部分から抽出された線分
があっても、本来の罫線から抽出された線分のみに注目
して、罫線候補を求める。そして、罫線の形状、位置関
係、罫線内部の線分の黒画素の分布状況から、正しい罫
線だけを抽出する。
Further, even if there is a line segment extracted from a crushed portion in the table, ruled line candidates are obtained by paying attention to only the line segment extracted from the original ruled line. Then, only the correct ruled line is extracted from the shape and positional relationship of the ruled line and the distribution of black pixels of the line segment inside the ruled line.

【0046】以下の実施形態においては、サイズや位置
や傾きが分からない枠が単数または複数個あり、それら
の枠に対して、枠に接触した文字、枠からはみ出した文
字を含む多様な文字が書かれているような文書を対象と
する。そして、そのような文書の画像から枠を抽出する
場合を考える。
In the following embodiment, there is one or more frames whose size, position, and inclination are unknown, and various characters including characters that touch the frame and characters that protrude from the frame are added to those frames. The target is a written document. Then, consider a case where a frame is extracted from an image of such a document.

【0047】図2は、実施形態の罫線抽出装置の機能ブ
ロック図である。図2において、対象となる入力パター
ン11は、極端な傾きや回転を補正した後の2値画像で
ある。また、網掛けされた処理ブロックが、主として、
「パターン抽出装置及びパターン領域の切り出し方法」
(特願平8−107568)等の先願とは異なる処理を
表す。
FIG. 2 is a functional block diagram of the ruled line extracting device according to the embodiment. In FIG. 2, a target input pattern 11 is a binary image after correcting an extreme inclination or rotation. The shaded processing blocks are mainly
"Pattern extraction device and method of extracting pattern area"
(Processing different from the prior application such as Japanese Patent Application No. 8-107568).

【0048】まず、縮小処理部12が画像を縮小し、連
結パターン抽出部13が連結パターンを抽出した後、罫
線抽出装置は矩形高さの最頻値を計算し(処理P1)、
マスク処理部14が細線化を行う。
First, after the reduction processing section 12 reduces the image and the connection pattern extraction section 13 extracts the connection pattern, the ruled line extraction device calculates the mode of the height of the rectangle (processing P1),
The mask processing unit 14 performs thinning.

【0049】次に、横直線抽出部15が、横隣接投影
(処理P2)、横線分検出(処理P3)、横線分統合
(処理P4)、および横直線探索(処理P5)を行った
後、罫線抽出装置は横点線検出(処理P6)を行う。次
に、縦直線抽出部16が、縦隣接投影(処理P7)、縦
線分検出(処理P8)、縦線分統合(処理P9)、およ
び縦直線探索(処理P10)を行った後、罫線抽出装置
は縦点線検出(処理P11)を行う。
Next, after the horizontal straight line extraction unit 15 performs horizontal adjacent projection (process P2), horizontal line segment detection (process P3), horizontal line segment integration (process P4), and horizontal line search (process P5), The ruled line extraction device performs horizontal dotted line detection (process P6). Next, the vertical straight line extraction unit 16 performs vertical adjacent projection (process P7), vertical line segment detection (process P8), vertical line segment integration (process P9), and vertical line search (process P10). The extraction device performs vertical dotted line detection (process P11).

【0050】次に、罫線抽出装置は、横直線の高さの最
頻値を計算し(処理P12)、縦直線の幅の最頻値を計
算し(処理P13)、横線分の高さの最頻値を計算し
(処理P14)、縦線分の幅の最頻値を計算する(処理
P15)。次に、完全に重複する直線同士を統合し(処
理P16)、直線矩形の形や隣の直線矩形までの距離を
元に不要な直線を除去する(処理P17)。次に、縦横
の直線間の接続関係を元に不要な直線を除去し(処理P
18)、部分的に重複する直線同士を統合する(処理P
19)。
Next, the ruled line extraction device calculates the mode of the height of the horizontal line (process P12), calculates the mode of the width of the vertical line (process P13), and calculates the height of the height of the horizontal line. The mode is calculated (process P14), and the mode of the width of the vertical line is calculated (process P15). Next, completely overlapping straight lines are integrated (process P16), and unnecessary straight lines are removed based on the shape of the straight rectangle or the distance to an adjacent straight rectangle (process P17). Next, unnecessary straight lines are removed based on the connection relationship between the vertical and horizontal straight lines (processing P
18) Integrate partially overlapping straight lines (Process P
19).

【0051】次に、罫線抽出装置は、他の直線とほぼ完
全に重複する直線を除去し(処理P20)、所定のしき
い値より大きな線分だけから成る直線を除去する(処理
P21)。そして、別のしきい値より大きな線分にマー
クを付け(処理P22)、対象とする線分をシフトしな
がら直線をチェックし、不要な直線を除去して(処理P
23)、残された直線を出力する。
Next, the ruled line extracting device removes a straight line that almost completely overlaps with another straight line (process P20), and removes a straight line consisting only of a line segment larger than a predetermined threshold (process P21). Then, a mark is added to a line segment larger than another threshold value (process P22), and a straight line is checked while shifting the target line segment, and unnecessary straight lines are removed (process P22).
23) Output the remaining straight line.

【0052】本実施形態の罫線抽出装置は、例えば図3
に示すような情報処理装置(コンピュータ)により実現
される。図3の情報処理装置は、CPU31、メモリ3
2、入力装置33、出力装置34、外部記憶装置35、
媒体駆動装置36、ネットワーク接続装置37、光電変
換装置38を備え、それらの各装置はバス39により互
いに結合されている。
The ruled line extracting apparatus of this embodiment is, for example, shown in FIG.
The information processing device (computer) as shown in FIG. The information processing apparatus of FIG.
2, input device 33, output device 34, external storage device 35,
A medium drive device 36, a network connection device 37, and a photoelectric conversion device 38 are provided, and these devices are connected to each other by a bus 39.

【0053】CPU31は、メモリ32に格納されたプ
ログラムを実行して、図2に示した各処理を行う。メモ
リ32としては、例えばROM(read only memory)、
RAM(random access memory)等が用いられる。メモ
リ32には、上述のプログラムと処理に必要なデータが
格納される。
The CPU 31 executes a program stored in the memory 32 to perform each processing shown in FIG. As the memory 32, for example, a ROM (read only memory),
A RAM (random access memory) or the like is used. The memory 32 stores the above-described programs and data necessary for processing.

【0054】入力装置32は、例えばキーボード、ポイ
ンティングデバイス等に相当し、ユーザからの要求や指
示の入力に用いられる。また、出力装置34は、表示装
置やプリンタ等に相当し、処理結果等の出力に用いられ
る。
The input device 32 corresponds to, for example, a keyboard, a pointing device or the like, and is used for inputting a request or instruction from a user. The output device 34 corresponds to a display device, a printer, or the like, and is used for outputting a processing result or the like.

【0055】外部記憶装置35は、例えば、磁気ディス
ク装置、光ディスク装置、光磁気ディスク装置等であ
る。この外部記憶装置35に、上述のプログラムとデー
タを保存しておき、必要に応じて、それらをメモリ32
にロードして使用することができる。また、外部記憶装
置35は、画像やキーワード等を保存する、電子ファイ
リングシステムのデータベースとしても使用される。
The external storage device 35 is, for example, a magnetic disk device, an optical disk device, a magneto-optical disk device, or the like. The above-mentioned program and data are stored in the external storage device 35 and, if necessary, stored in the memory 32.
Can be loaded and used. The external storage device 35 is also used as a database of an electronic filing system for storing images, keywords, and the like.

【0056】媒体駆動装置36は、可搬記録媒体40を
駆動し、その記憶内容にアクセスすることができる。可
搬記録媒体40としては、メモリカード、フロッピーデ
ィスク、CD−ROM(compact disk read only memor
y )、光ディスク、光磁気ディスク等、任意のコンピュ
ータ読み取り可能な記録媒体を使用することができる。
この可搬記録媒体40に、上述のプログラムとデータを
格納しておき、必要に応じて、それらをメモリ32にロ
ードして使用することができる。
The medium driving device 36 drives the portable recording medium 40 and can access the stored contents. Examples of the portable recording medium 40 include a memory card, a floppy disk, and a CD-ROM (compact disk read only memory).
y), any computer-readable recording medium such as an optical disk and a magneto-optical disk can be used.
The above-described program and data are stored in the portable recording medium 40, and can be used by loading them into the memory 32 as needed.

【0057】ネットワーク接続装置37は、LAN(lo
cal area network)等の任意の通信ネットワークに接続
され、通信に伴うデータ変換等を行って、外部の情報提
供者のデータベース40′等と通信する。これにより、
罫線抽出装置は、必要に応じて、上述のプログラムとデ
ータをデータベース40′からネットワークを介して受
け取り、それらをメモリ32にロードして使用すること
ができる。
The network connection device 37 is a LAN (lo
It is connected to an arbitrary communication network such as a cal area network, performs data conversion and the like accompanying the communication, and communicates with an external information provider database 40 'and the like. This allows
The ruled line extracting apparatus can receive the above-mentioned programs and data from the database 40 'via a network as needed, and load them into the memory 32 for use.

【0058】また、光電変換装置38は、例えばイメー
ジスキャナであり、処理対象となる一般の文書画像を入
力する。メモリ32内では、処理に必要なデータが、例
えば図4に示すような構造で管理される。図4におい
て、1つの入力画像の情報41は、画像に含まれる表
(表形式枠)の数と各表毎の情報42から成る。
The photoelectric conversion device 38 is, for example, an image scanner, and inputs a general document image to be processed. In the memory 32, data necessary for processing is managed in a structure as shown in FIG. 4, for example. In FIG. 4, the information 41 of one input image includes the number of tables (table type frames) included in the image and information 42 for each table.

【0059】各表情報42は、表の外接矩形の座標値、
表に含まれるセルの数、各セル毎の情報43、表に含ま
れる水平直線(横直線)の数、各水平直線毎の情報4
4、表に含まれる垂直直線(縦直線)の数、および各垂
直直線毎の情報44から成る。ここで、セルとは、上下
左右を罫線で囲まれた領域を表す。
Each table information 42 includes coordinate values of a circumscribed rectangle of the table,
Number of cells included in table, information 43 for each cell, number of horizontal straight lines (horizontal straight lines) included in table, information 4 for each horizontal straight line
4. The number of vertical straight lines (vertical straight lines) included in the table, and information 44 for each vertical straight line. Here, a cell represents an area surrounded by ruled lines at the top, bottom, left, and right.

【0060】また、各セル情報43はセルの座標値を含
み、各直線情報44は、直線を表す矩形の座標値、直線
の属性情報、直線に含まれる小線分の数、各小線分毎の
情報45、および画像全体における直線の通し番号から
成る。そして、各小線分情報45は、小線分の属性情報
と小線分を表す矩形の座標値を含む。直線および小線分
の属性情報は、例えば実線と破線を区別したり、高さま
たは幅が一定値を越えるワイルドカード(wildca
rd)線分と他の線分を区別したりするのに用いられ
る。次に、図5から図24までを参照しながら、図2の
各処理を順に説明する。
Each cell information 43 includes a coordinate value of a cell, and each straight line information 44 includes coordinate values of a rectangle representing a straight line, attribute information of the straight line, the number of small line segments included in the straight line, and each small line segment. Information 45 and serial numbers of straight lines in the entire image. Each piece of line segment information 45 includes attribute information of the line segment and coordinate values of a rectangle representing the line segment. The attribute information of the straight line and the small line segment may be, for example, distinguishing between a solid line and a broken line, or a wild card (wildca) whose height or width exceeds a certain value.
rd) Used to distinguish a line segment from other line segments. Next, each process of FIG. 2 will be described in order with reference to FIGS.

【0061】縮小処理部12は、入力パターン11の画
像がある一定以上の解像度を持ち、その画像の大きさが
比較的大きい場合に、処理の効率化のため、画像の縮小
処理を行う。入力された原画像はそのまま記憶してお
く。
When the image of the input pattern 11 has a certain resolution or higher and the size of the image is relatively large, the reduction processing section 12 reduces the size of the image to increase the processing efficiency. The input original image is stored as it is.

【0062】連結パターン抽出部13は、複数の表が配
置される位置の相対的な関係に依存することなく、各パ
ターンを安定にピックアップするために、上下左右8連
結で繋がっている黒画素連結領域を部分パターンとし
て、ラベリングにより抽出する。そして、これらの部分
パターンを判別して、画像に含まれる表のパターンを抽
出する。
The connected pattern extracting unit 13 connects the black pixels connected in eight vertical, horizontal, and right connections in order to stably pick up each pattern without depending on the relative relationship between the positions where a plurality of tables are arranged. The region is extracted as a partial pattern by labeling. Then, these partial patterns are determined, and a table pattern included in the image is extracted.

【0063】ラベリングで得られた部分パターンのサイ
ズが後に必要になるので、連結パターン抽出部13は、
部分パターンを近似する外接矩形の角の座標をラベリン
グの処理中に算出しておく。そして、抽出された部分パ
ターンの中で、一定以上の大きさのあるパターンを表の
候補であるとして抽出する。
Since the size of the partial pattern obtained by labeling is required later, the connection pattern extraction unit 13
The coordinates of the corners of the circumscribed rectangle approximating the partial pattern are calculated during the labeling process. Then, among the extracted partial patterns, a pattern having a certain size or more is extracted as a table candidate.

【0064】大きな連結パターンを抽出する際、大きな
連結パターンの内側にあり、かつ一定以上の大きさのあ
るパターンも同時に抽出し、それらの大小のパターンを
同じラベルを持つパターンとして扱う。こうすること
で、本来1つの表を表すパターンが、かすれにより2つ
以上のパターンに分離してしまったような場合に、これ
らを同じラベルに属するパターンとして処理することが
可能になる。なお、これ以降、対象とするパターンの大
きさを元に、許容できるかすれの長さを算出することに
する。
When a large connection pattern is extracted, patterns that are inside the large connection pattern and have a certain size or more are also extracted at the same time, and those large and small patterns are treated as patterns having the same label. In this way, when a pattern that originally represents one table is separated into two or more patterns due to blurring, it becomes possible to process these as patterns belonging to the same label. Hereinafter, an allowable blur length will be calculated based on the size of the target pattern.

【0065】図5は、上述のようなラベリング処理の例
を示している。図5(a)のような画像において、連結
パターン抽出部13は、始めに一番大きな外接矩形を持
つパターン51を抽出し、それにラベルを付加する。次
に、パターン52とパターン57の間にある横線パター
ン56は一定以上の横幅があるため、これを大きいパタ
ーン51の一部であるとみなし、図5(b)に示すよう
に、以下の処理ではこれらを同じラベルのパターンとし
て扱う。したがって、パターン56には、パターン51
と同じラベルが付加される。
FIG. 5 shows an example of the labeling process as described above. In the image as shown in FIG. 5A, the connection pattern extraction unit 13 first extracts the pattern 51 having the largest circumscribed rectangle, and adds a label to it. Next, since the horizontal line pattern 56 between the pattern 52 and the pattern 57 has a certain width or more, it is regarded as a part of the large pattern 51, and the following processing is performed as shown in FIG. Now treat these as patterns with the same label. Therefore, the pattern 56 includes the pattern 51
The same label as is added.

【0066】次に、罫線抽出装置は、処理P1におい
て、先願の「文書画像からのタイトル抽出装置および方
法」(特願平07−341983)の方法を用いて、連
結パターン抽出部13により抽出された矩形の高さの頻
度分布を表すヒストグラムを求める。そして、その最頻
値most freq heightを求め、これを文
書に含まれる標準的な文字の大きさと推定する。求めら
れた最頻値は、以下の処理において各種しきい値を設定
するために用いられる。この最頻値の計算処理は、次の
ようにして行われる。
Next, in the process P1, the ruled line extracting apparatus extracts the data by the connection pattern extracting unit 13 by using the method of "Title extracting apparatus and method from document image" (Japanese Patent Application No. 07-341983). A histogram representing the frequency distribution of the heights of the obtained rectangles is obtained. And the mode value most freq height is obtained, and this is estimated as the size of a standard character included in the document. The obtained mode value is used for setting various threshold values in the following processing. This mode calculation process is performed as follows.

【0067】まず、ラベリング結果の外接矩形の集合か
ら、図6に示すような矩形高さのヒストグラムを作成す
る。図6において、横軸が各外接矩形の高さを表し、縦
軸がその高さを持つ矩形の数(頻度値)を表す。ここで
は、外接矩形の高さは、1画素の高さを単位高さとして
求められる。
First, a rectangle height histogram as shown in FIG. 6 is created from a set of circumscribed rectangles as a result of labeling. In FIG. 6, the horizontal axis represents the height of each circumscribed rectangle, and the vertical axis represents the number (frequency value) of rectangles having that height. Here, the height of the circumscribed rectangle is determined using the height of one pixel as a unit height.

【0068】次に、頻度値と、その頻度値を持つ矩形高
さの内で最大の高さとの対応関係を求め、メモリ32内
に矩形高さテーブルとして保存する。そして、そのテー
ブルの中を頻度値0から順に調査していき、高さの変化
が1以内で頻度値の変化するものが連続し、それらの頻
度値の変化の合計が所定値以上の場合に、それらの連続
する高さのうちで最も高いものを矩形高さの最頻値mo
st freq heightとする。
Next, the correspondence between the frequency value and the maximum height among the rectangular heights having the frequency value is determined, and is stored in the memory 32 as a rectangular height table. Then, the table is examined in order from the frequency value 0, and when the change in the frequency value is continuous within 1 and the total of the change in the frequency value is equal to or more than the predetermined value, , The highest of these consecutive heights is the mode value of the rectangular height mo
st freq height.

【0069】図7は、図6のヒストグラムに対応する矩
形高さテーブルの内容を表すヒストグラムを示してい
る。図7において、頻度値が急激に変化する高さが最頻
値となっていることがわかる。このようにして最頻値を
求めれば、1文字よりも小さなノイズの影響を排除する
ことができ、文書に含まれる標準的な大きさの文字の高
さが得られる。
FIG. 7 shows a histogram representing the contents of the rectangular height table corresponding to the histogram of FIG. In FIG. 7, it can be seen that the height at which the frequency value changes rapidly is the mode value. By obtaining the mode value in this manner, the influence of noise smaller than one character can be eliminated, and the height of a character having a standard size included in the document can be obtained.

【0070】図8は、矩形高さテーブルの簡単な例を示
している。図8においては、4つの頻度値と、各頻度値
を持つ矩形高さの内で最大の高さとが、それぞれペアで
格納されている。最頻値を求めるために、この矩形高さ
テーブルの内容をヒストグラムにすると図9のようにな
る。
FIG. 8 shows a simple example of a rectangular height table. In FIG. 8, four frequency values and the maximum height among rectangular heights having each frequency value are stored in pairs. FIG. 9 shows a histogram of the contents of the rectangular height table in order to obtain the mode.

【0071】図9のヒストグラムを、頻度値の低いとこ
ろから、つまり高さの高いところから順に見ていくと、
高さが10、9、8の位置で、頻度値がそれぞれ5、
5、7だけ変化していることが分かる。これらの連続す
る高さの差は1であり、頻度値の変化の合計は17であ
る。頻度値の変化のしきい値を9とすると、高さ10、
9、8において頻度値の変化の合計がそれ以上となって
いるので、それらの中で最初に現れた高さ10をmos
freq heightとする。
When the histogram of FIG. 9 is viewed in order from a low frequency value, that is, from a high height value,
Heights 10, 9, and 8 with frequency values of 5,
It can be seen that only 5 and 7 have changed. The difference between these successive heights is 1, and the total change in frequency value is 17. Assuming that the threshold value of the change in the frequency value is 9, the height is 10,
Since the sum of the changes of the frequency values is larger in 9 and 8, the height 10 first appearing in them is mos
t freq height.

【0072】次に、マスク処理部14は、連結パターン
抽出部13により抽出された、ある一定以上の大きさを
持つ連結パターンと、その内部に存在する一定以上の大
きさを持つ連結パターン(前者と同じラベルを持つパタ
ーン)とを表の候補とする。そして、先願の「枠抽出装
置及び矩形抽出装置」(特願平7−203259)の方
法を用いて、マスク処理を行う。
Next, the mask processing unit 14 extracts the connection pattern having a certain size or more extracted by the connection pattern extraction unit 13 and the connection pattern having a certain size or more existing inside (the former). Is a table candidate). Then, a mask process is performed by using the method of “frame extraction device and rectangle extraction device” of the prior application (Japanese Patent Application No. 7-203259).

【0073】このマスク処理は、画像から極端な斜め成
分を省き、表だけに存在する長い直線を抽出しやすくす
るために行われる。具体的には、マスク処理部14は、
画像全体に対して、大きさの決められた横長、縦長の2
種類のマスク矩形による走査を行う。マスク内での黒画
素のパターンの占める割合を算出し、それがある一定値
以上であれば、そのマスク内の領域全体を黒画素で埋め
てパターンとして残し、また一定値以下であれば、マス
ク内のパターンを削除する。こうして、縦横成分の抽出
を行う。
This mask processing is performed in order to eliminate an extremely oblique component from the image and to easily extract a long straight line existing only in the table. Specifically, the mask processing unit 14
For the entire image, a fixed horizontal and vertical
Scanning is performed using different types of mask rectangles. Calculate the proportion of the pattern of black pixels in the mask, and if it is above a certain value, fill the entire area in the mask with black pixels and leave it as a pattern. Delete the pattern in. Thus, the vertical and horizontal components are extracted.

【0074】ここで、複数の行または列が続いて、上記
割合が所定のしきい値以上に達した場合、それらの連続
するパターンをまとめて大きな矩形範囲をつくり、その
中心線を処理結果とする。これにより、太いパターンが
細線化される。また、処理結果の線分パターン同士の隙
間が開かないようにするため、マスクの適用範囲を、お
互いに重なりを持つように設定する。マスク処理前の原
画像は、マスク処理後の画像とは別に記憶しておく。
Here, when a plurality of rows or columns continue and the above-mentioned ratio reaches a predetermined threshold value or more, the continuous patterns are put together to form a large rectangular range, and the center line is defined as the processing result. I do. Thereby, a thick pattern is thinned. Further, in order to prevent a gap between the line segment patterns of the processing result from being opened, the application range of the mask is set so as to overlap each other. The original image before the mask processing is stored separately from the image after the mask processing.

【0075】図10は、図5(b)に示した2つのパタ
ーン51、56を対象としてマスク処理を行った結果を
示している。この場合、図10(a)に示す処理前の画
像は、図10(b)に示すように変換される。図10
(b)では、パターン51、56の縦横成分のみが抽出
され、パターン全体が細線化されている。また、マスク
処理において一部のパターンが補足された結果、パター
ン51とパターン56が繋がっていることが分かる。
FIG. 10 shows the result of masking the two patterns 51 and 56 shown in FIG. 5B. In this case, the image before processing shown in FIG. 10A is converted as shown in FIG. FIG.
In (b), only the vertical and horizontal components of the patterns 51 and 56 are extracted, and the entire pattern is thinned. Further, as a result of supplementing some patterns in the mask processing, it can be seen that the patterns 51 and 56 are connected.

【0076】次に、横直線抽出部15は、処理P2にお
いて、図10(b)のような、部分パターンのマスク処
理画像に対して、従来の隣接投影法を用いて投影値を算
出する。そして、処理P3において、ある一定長さの横
線分あるいは横直線の一部を、図11に示すように矩形
近似して検出する。これらの処理ではマスク処理画像を
使用しているが、以下の処理では原画像を使用する。
Next, in process P2, the horizontal straight line extraction unit 15 calculates a projection value for the mask processing image of the partial pattern as shown in FIG. 10B by using the conventional adjacent projection method. Then, in the process P3, a horizontal line segment or a part of the horizontal straight line having a certain length is approximated by a rectangle as shown in FIG. 11 and detected. In these processes, a mask processed image is used, but in the following processes, an original image is used.

【0077】次に、横直線抽出部15は、処理P4にお
いて、線分同士の接続状態を調査して、いくつかの線分
が構成する直線を罫線候補として抽出する。この処理で
は、図12に示すように、検出された矩形線分のうち近
隣の矩形線分同士を統合して長い直線を検出し、検出さ
れた直線をその外接矩形で近似する。
Next, in process P4, the horizontal straight line extraction unit 15 checks the connection state between the line segments, and extracts straight lines formed by some line segments as ruled line candidates. In this process, as shown in FIG. 12, neighboring rectangular line segments among the detected rectangular line segments are integrated to detect a long straight line, and the detected straight line is approximated by its circumscribed rectangle.

【0078】線分を統合する際、図13に示すように、
途中に一定以上の太い線分(ワイルドカード)61があ
った場合には、それらを無視し、太い線分を除いた細い
線分だけを対象として統合を行う。ある線分がワイルド
カードであるかどうかは、図4の線分情報45に記述さ
れた属性情報により区別される。このように、大きな線
分があるとき、それを含んだ直線を出力するのではな
く、その大きな線分を直線に反映しないような統合処理
を行う。
When integrating the line segments, as shown in FIG.
If there is a certain or more thick line segment (wild card) 61 on the way, it is ignored, and integration is performed only on the thin line segment excluding the thick line segment. Whether or not a certain line segment is a wild card is distinguished by the attribute information described in the line segment information 45 of FIG. As described above, when there is a large line segment, a straight line including the large line segment is not output, but an integration process is performed so that the large line segment is not reflected on the straight line.

【0079】これにより、網掛け部分や、罫線に接触し
た文字や図形等のパターンがあっても、それらを除いて
罫線だけを抽出することができる。このような統合処理
の詳細については後述することにする。統合の結果抽出
された直線の情報には、図4に示したように、それを構
成する各線分の情報が含まれている。
As a result, even if there is a pattern such as a shaded portion or a character or a figure which is in contact with the ruled line, it is possible to extract only the ruled line excluding the pattern. The details of such integration processing will be described later. As shown in FIG. 4, the information on the straight line extracted as a result of the integration includes information on each line segment constituting the straight line.

【0080】次に、横直線抽出部15は、処理P5にお
いて、矩形近似された横直線の左右端を正確に検出する
ために、図14に示すように、その直線内のパターン
(画素)の探索を行う。探索の途中で、進行方向に画素
のない部分(空白)が存在した場合、一定の画素数まで
は画素があるものと仮定して、進行方向に探索を続行す
る。一定画素数を越えて空白が存在した場合には、その
位置を端点として探索を終了する。以下の処理では、探
索によって検出された端点が、直線の端点として用いら
れる。
Next, in process P5, the horizontal straight line extraction unit 15 determines the right and left ends of the horizontal straight line approximated by a rectangle as shown in FIG. Perform a search. If there is a portion (blank) without pixels in the traveling direction during the search, the search is continued in the traveling direction on the assumption that there are pixels up to a certain number of pixels. If a blank exists beyond a certain number of pixels, the search is terminated with that position as an end point. In the following processing, the end point detected by the search is used as the end point of the straight line.

【0081】次に、罫線抽出装置は、処理P6におい
て、先願の「枠抽出装置及び矩形抽出装置」(特願平7
−203259)の方法を用いて、横点線を抽出する。
この処理では、一定の大きさを持ち、かつ規則正しく並
んでいる部分パターンを探し、それらのパターンを矩形
で囲んで、点線の位置を表現する。
Next, in the process P6, the ruled line extraction device executes the “frame extraction device and rectangle extraction device” (Japanese Patent Application No.
−203259), the horizontal dotted line is extracted.
In this process, partial patterns having a certain size and regularly arranged are searched for, and the positions of the dotted lines are represented by surrounding these patterns with rectangles.

【0082】以下の処理では、点線の位置を示す矩形
を、既に検出されている直線の位置を示す矩形と同様に
扱う。ただし、点線に対応する直線の属性情報には破線
属性が設定され、実線に対応する直線の属性情報には実
線属性が設定されて、両者は区別される。
In the following processing, the rectangle indicating the position of the dotted line is treated in the same manner as the rectangle indicating the position of the already detected straight line. However, the attribute information of the straight line corresponding to the dotted line is set with the dashed line attribute, and the attribute information of the straight line corresponding to the solid line is set with the solid line attribute, so that the two are distinguished.

【0083】また、縦直線抽出部16の処理P7、P
8、P9、およびP10と、縦点線検出処理P11につ
いては、上述の横直線および横点線の場合と同様であ
る。次に、罫線抽出装置は、処理P12において、横直
線高さの代表値を計算する。この処理では、抽出された
横直線の高さのヒストグラムを作成し、最も頻度の大き
な高さを、横直線高さの最頻値mfheightとし、
これを横直線高さの代表値として用いる。また、同様に
して、処理P13において、縦直線幅の代表値(最頻
値)mfwidthを計算する。
The processing P7, P
8, P9, and P10, and the vertical dotted line detection processing P11 are the same as those of the horizontal straight line and the horizontal dotted line described above. Next, in process P12, the ruled line extraction device calculates a representative value of the horizontal straight line height. In this process, a histogram of the height of the extracted horizontal straight line is created, and the most frequent height is set as the mode value mfheight of the horizontal straight line height,
This is used as a representative value of the horizontal straight line height. Similarly, in process P13, a representative value (mode value) mfwidth of the vertical straight line width is calculated.

【0084】これらの代表値は、以下の処理において、
各種しきい値を設定するために用いられる。また、横直
線高さ/縦直線幅の代表値として、上記最頻値以外の適
当な値を代わりに用いてもよい。
These representative values are used in the following processing.
Used to set various thresholds. As a representative value of the horizontal straight line height / the vertical straight line width, an appropriate value other than the above-described mode may be used instead.

【0085】次に、罫線抽出装置は、処理P14におい
て、横線分高さの代表値を計算する。この処理では、画
像内のすべての横直線を構成しているすべての横線分の
高さのヒストグラムを作成し、最も頻度の大きな高さ
を、横線分高さの最頻値mfheight small
とし、これを横線分高さの代表値として用いる。また、
同様にして、処理P15において、すべての縦直線を構
成しているすべての縦線分の幅の最頻値mfwidth
smallを計算する。
Next, in process P14, the ruled line extracting device calculates a representative value of the horizontal line segment height. In this processing, a histogram of the heights of all the horizontal line segments constituting all the horizontal straight lines in the image is created, and the most frequent height is determined as the mode value mfheight of the horizontal line segment height. small
This is used as a representative value of the horizontal line segment height. Also,
Similarly, in process P15, the mode mfwidth of the width of all the vertical line segments constituting all the vertical straight lines
Calculate small.

【0086】これらの代表値もまた、以下の処理におい
て、各種しきい値を設定するために用いられる。また、
横線分高さ/縦線分幅の代表値として、上記最頻値以外
の適当な値を代わりに用いてもよい。
These representative values are also used for setting various threshold values in the following processing. Also,
As a representative value of the horizontal line segment height / the vertical line segment width, an appropriate value other than the above-described mode may be used instead.

【0087】次に、罫線抽出装置は、処理P16におい
て、完全に重複する直線同士を統合する。この処理で
は、1つの直線が別の直線とほぼ完全に重複している場
合に、それらを1つに統合する。例えば、図15に示す
ような重複する2つの直線62、63において、重複し
ない部分の高さH1が一定の許容画素数INTEGDO
T以内であれば、これらは完全に重複するものとみな
し、1つの直線矩形64に統合する。INTEGDOT
の値は、例えば2に設定される。
Next, in the process P16, the ruled line extracting device integrates completely overlapping straight lines. In this processing, when one straight line almost completely overlaps another straight line, they are integrated into one. For example, in two overlapping straight lines 62 and 63 as shown in FIG. 15, the height H1 of the non-overlapping portion is a fixed allowable pixel number INTEGDO.
If they are within T, they are regarded as completely overlapping and integrated into one straight rectangle 64. INTEGDOT
Is set to 2, for example.

【0088】次に、罫線抽出装置は、処理P17におい
て、直線矩形の形や隣り合う直線矩形間の距離に基づい
て、不要な直線を除去する。横直線の処理に関しては、
まず、高さのしきい値th heiと長さのしきい値t
lenを、それぞれ次式により計算する。 th hei=most freq height*2/3 (1) th len=most freq height*5 (2) そして、以下の4つの場合において、該当する横直線を
削除する。 (a)横直線矩形の縦横比(高さ/幅)がしきい値FT
H(=0.11)以上の場合。 (b)横直線矩形の縦横比がしきい値FTH2(=0.
04)以上で、かつ、横直線矩形の高さが高さのしきい
値th hei以上の場合。 (c)横直線矩形の幅が長さのしきい値th lenよ
りも小さい場合。 (d)カレント横直線よりも下にあり、それに最も近い
横直線の幅が、長さのしきい値th lenよりも小さ
い場合。
Next, in process P17, the ruled line extraction device removes unnecessary straight lines based on the shape of the straight rectangles and the distance between the adjacent straight rectangles. Regarding the processing of the horizontal straight line,
First, the height threshold th hei and length threshold t
h len is calculated by the following equations. th hei = most freq height * 2/3 (1) th len = most freq height * 5 (2) Then, in the following four cases, the corresponding horizontal straight line is deleted. (A) Aspect ratio (height / width) of horizontal straight rectangle is threshold value FT
H (= 0.11) or more. (B) When the aspect ratio of the horizontal straight rectangle is equal to the threshold value FTH2 (= 0.
04) is greater than or equal to, and the height of the horizontal straight rectangle is the height threshold th hei or more. (C) Width th of horizontal straight rectangle is threshold th of length If less than len. (D) The width of the nearest horizontal line below the current horizontal line is the length threshold th If less than len.

【0089】例えば、図16においては、直線67は
(a)の場合に該当するため削除され、直線68は
(b)の場合に該当するため削除され、直線69は
(c)の場合に該当するため削除される。また、直線6
5をカレント横直線とすると、直線66は(d)の場合
に該当するため削除される。
For example, in FIG. 16, the straight line 67 is deleted because it corresponds to the case (a), the straight line 68 is deleted because it corresponds to the case (b), and the straight line 69 is corresponding to the case (c). To be deleted. Also, a straight line 6
If 5 is a current horizontal straight line, the straight line 66 is deleted because it corresponds to the case of (d).

【0090】さらに、2つの隣り合う直線間の距離が、
most freq heightから求めたしきい値
よりも小さい場合、それらの直線の一方(例えば長さの
短い方)を除去する。縦直線の処理に関しても同様であ
る。
Further, the distance between two adjacent straight lines is
most freq If it is smaller than the threshold value obtained from the height, one of the straight lines (for example, the shorter one) is removed. The same applies to the processing of the vertical straight line.

【0091】次に、罫線抽出装置は、処理P18におい
て、縦横直線の接続関係に基づき、一部の不要な直線を
除去する。横直線の処理に関しては、まず、注目する横
直線矩形の端点がいずれの縦直線矩形とも接しない場
合、その横直線矩形を削除する。これにより、表の枠を
構成しない直線、例えば潰れて繋がった文字列上から抽
出されたような孤立した直線が除去される。
Next, in process P18, the ruled line extraction device removes some unnecessary straight lines based on the connection relationship between the vertical and horizontal straight lines. Regarding the processing of the horizontal straight line, first, when the end point of the horizontal straight line rectangle of interest does not touch any vertical straight line rectangle, the horizontal straight line rectangle is deleted. This removes straight lines that do not form a table frame, for example, isolated straight lines extracted from crushed and connected character strings.

【0092】例えば図17においては、横直線70の2
つの端点74、75はそれぞれ縦直線71、72に接し
ているため、この直線70は削除されず、横直線73は
いずれの縦直線とも接していないので削除される。縦直
線の処理に関しても同様である。
For example, in FIG.
Since the two end points 74 and 75 are in contact with the vertical straight lines 71 and 72, the straight line 70 is not deleted, and the horizontal straight line 73 is deleted because it does not touch any of the vertical straight lines. The same applies to the processing of the vertical straight line.

【0093】しかし、このような除去処理では、画像の
文字パターン等の影響で、本来残しておくべき直線が除
去されてしまうことがある。例えば、図18のような画
像において、縦直線76の端点77、78はいずれの横
直線とも接していないので、縦直線76は、表の枠を構
成しているにもかかわらず、削除されてしまう。
However, in such a removal process, a straight line that should be left may be removed due to a character pattern of an image or the like. For example, in the image as shown in FIG. 18, the end points 77 and 78 of the vertical straight line 76 are not in contact with any horizontal straight line, so the vertical straight line 76 is deleted even though it constitutes a table frame. I will.

【0094】そこで、必要な直線を残すために、除去処
理の対象を互いに近接している2本の直線に限定するこ
とにする。この場合、まず、カレント横直線矩形iより
も下にあり、その矩形iとの距離が矩形高さの最頻値m
ost freq heightよりも小さい横直線矩
形jを求める。
Therefore, in order to leave a necessary straight line, the object of the removal processing is limited to two straight lines that are close to each other. In this case, first, the rectangle is located below the current horizontal straight line rectangle i, and the distance from the rectangle i is the mode value m of the rectangle height.
ost freq A horizontal straight-line rectangle j smaller than height is obtained.

【0095】そして、これらの横直線矩形i、jのそれ
ぞれについて、その矩形の端点がいずれの縦直線矩形と
も接しなく、かつ、いずれの縦直線矩形の端点もその矩
形と接しない場合に、その横直線矩形を削除する。縦直
線の処理に関しても同様である。このような除去処理を
行えば、図18の縦直線76は処理対象にならないの
で、削除されずに残る。
For each of these horizontal straight-line rectangles i and j, if the end points of the rectangles do not touch any of the vertical straight-line rectangles, and if the end points of any of the vertical straight-line rectangles do not touch the rectangles, Delete the horizontal straight rectangle. The same applies to the processing of the vertical straight line. If such a removal process is performed, the vertical straight line 76 in FIG. 18 does not become a processing target, and thus remains without being deleted.

【0096】また、図19においては、まず、近接する
横直線79、80が対象となるが、これらの横直線7
9、80の端点は縦直線82に接しているので、横直線
79、80は削除されない。次に、横直線80に近接す
る横直線81が対象となり、この横直線81はいずれの
縦直線とも接していないので削除される。また、近接す
る縦直線83、84のうち、縦直線83は、端点が横直
線79と接しているので残され、縦直線84はいずれの
横直線とも接していないので削除される。
In FIG. 19, first, adjacent horizontal straight lines 79 and 80 are targeted.
Since the end points 9 and 80 are in contact with the vertical straight line 82, the horizontal straight lines 79 and 80 are not deleted. Next, a horizontal straight line 81 adjacent to the horizontal straight line 80 is targeted, and this horizontal straight line 81 is deleted because it is not in contact with any vertical straight line. Further, of the adjacent vertical straight lines 83 and 84, the vertical straight line 83 is left because the end point is in contact with the horizontal straight line 79, and the vertical straight line 84 is deleted since it is not in contact with any horizontal straight line.

【0097】次に、罫線抽出装置は、処理P19におい
て、部分的に重複する直線同士を統合する。この処理で
は、横直線に関しては、まず、幅(長さ)の長い順に並
び替える。次に、長さの長い順に、1つの直線iに注目
して、その直線と部分的に重複する1つ以上の直線を求
める。
Next, in the process P19, the ruled line extracting apparatus integrates partially overlapping straight lines. In this process, the horizontal straight lines are first sorted in ascending order of width (length). Next, one or more straight lines partially overlapping the straight line i are obtained by focusing on one straight line i in order of the length.

【0098】そして、部分的に重複する直線を直線iと
仮想的に統合して1つの直線矩形とした場合に、その高
さがしきい値(mfheight+THDOT)以下と
なるのであれば、その統合を実行する。THDOTの値
は、例えば2に設定される。これにより、直線同士を統
合した結果が高さの最頻値mfheight程度になる
場合に、それらが1つに統合される。縦直線の処理に関
しても同様である。
When a partially overlapping straight line is virtually merged with the straight line i to form one straight rectangle, if the height is equal to or less than a threshold value (mfheight + THDOT), the merging is executed. . The value of THDOT is set to 2, for example. Accordingly, when the result of integrating the straight lines is about the most frequent value mfheight of the heights, they are integrated into one. The same applies to the processing of the vertical straight line.

【0099】図20においては、直線85と直線86が
部分的に重複し、直線86と直線87が部分的に重複し
ている。これらのうち、直線85と直線86を統合する
と、統合された矩形の高さがしきい値を越えるため、直
線86と直線87のみを統合して、それらの外接矩形8
8で近似する。縦直線の処理に関しても同様である。
In FIG. 20, the straight line 85 and the straight line 86 partially overlap, and the straight line 86 and the straight line 87 partially overlap. Among these, when the straight line 85 and the straight line 86 are integrated, the height of the integrated rectangle exceeds the threshold value. Therefore, only the straight line 86 and the straight line 87 are integrated and the circumscribed rectangle 8
Approximate by 8. The same applies to the processing of the vertical straight line.

【0100】ここで、このような直線同士の統合処理を
行うのは、本来1つの直線のパターンから抽出された複
数の線分矩形が、処理P4、P9だけでは、完全に統合
されない場合があるからである。例えば、図21に示す
ような重複する2つの横直線89、90の場合、それぞ
れに含まれる線分矩形(斜線部分)同士は離れているの
で、処理P4では、直線89と直線90は統合されな
い。このような場合でも、処理P19によれば、両者を
統合することが可能である。
Here, such straight line integration processing is performed. In some cases, a plurality of line segment rectangles originally extracted from a single straight line pattern may not be completely integrated only by the processes P4 and P9. Because. For example, in the case of two overlapping horizontal straight lines 89 and 90 as shown in FIG. 21, the line segment rectangles (hatched portions) included in the two are separated from each other, and therefore, in the process P4, the straight line 89 and the straight line 90 are not integrated. . Even in such a case, both can be integrated according to the process P19.

【0101】次に、罫線抽出装置は、処理P20におい
て、ほぼ完全に重複する2つの直線のうちの短い方を除
去する。この処理では、横直線に関しては、まず、1つ
の横直線矩形を長さの長い順にソートする。次に、長い
順に1つずつ横直線矩形iを取り出し、その横直線矩形
iに部分的に重複する他の横直線矩形jに注目する。こ
の時、直線iと直線jの上下関係が、図22に示すよう
な関係にあるものを処理対象とする。図22において、
直線91を直線iとすると、直線92、93が直線jに
相当する。
Next, in the process P20, the ruled line extracting apparatus removes the shorter one of the two lines that almost completely overlap. In this process, regarding the horizontal straight line, first, one horizontal straight line rectangle is sorted in the order of the length. Next, one horizontal straight-line rectangle i is extracted one by one in the longest order, and attention is paid to another horizontal straight-line rectangle j that partially overlaps the horizontal straight-line rectangle i. At this time, a line having a vertical relationship between the straight line i and the straight line j as shown in FIG. In FIG.
If the straight line 91 is a straight line i, the straight lines 92 and 93 correspond to the straight line j.

【0102】次に、直線iと直線jの間で横方向に重複
している範囲を求め、その長さlen3と直線jの横幅
len2の比len3/len2が、しきい値OVER
RATEよりも大きい時、直線jを削除候補として、以
下の処理を行う。ただし、OVERRATEの値は、1
より小さいものとする。
Next, a range where the line i and the line j overlap in the horizontal direction is determined, and the ratio len3 / len2 of the length len3 and the width len2 of the line j is determined by the threshold OVER.
When it is larger than RATE, the following processing is performed with the straight line j as a deletion candidate. However, the value of OVERRATE is 1
Shall be smaller.

【0103】まず、直線iと直線jの間の縦方向の距離
を求める。この場合、直線iと直線jの座標値の差を距
離としてもよいが、直線が傾いた場合を考慮して、これ
らの直線内の小線分矩形間の距離を、直線間の距離と定
義することにする。このような距離値の求め方を、図2
3を参照しながら説明する。
First, the vertical distance between the straight line i and the straight line j is determined. In this case, the difference between the coordinate values of the straight line i and the straight line j may be used as the distance. In consideration of the case where the straight line is inclined, the distance between the small line segment rectangles in these straight lines is defined as the distance between the straight lines. I will do it. FIG. 2 shows how to obtain such a distance value.
3 will be described.

【0104】図23において、横方向をx軸とし、縦方
向をy軸とすると、直線iと直線jは、x=xmink
ukanの位置から、x=xmaxkukanの位置ま
での長さlen3の区間で横方向に重複しており、それ
ぞれ内部に複数の線分を持っている。
In FIG. 23, if the horizontal direction is the x-axis and the vertical direction is the y-axis, the straight line i and the straight line j are x = xmink
A section of length len3 from the position of ukan to the position of x = xmaxkukan overlaps in the horizontal direction, and each has a plurality of line segments inside.

【0105】まず、罫線抽出装置は、直線i内の線分の
集合から、線分統合処理P4でワイルドカードではない
と判断された線分であって、最初に重複部分にかかるも
のを取り出し、それを基準線分とする。ここでは、線分
94が基準線分となる。そして、基準線分94のx座標
(xmin1,xmax1)を求める。
First, the ruled line extracting device extracts, from the set of line segments in the straight line i, those line segments determined to be not wildcards in the line segment integration process P4, which first overlap the overlapping portion, This is used as a reference line segment. Here, the line segment 94 is the reference line segment. Then, the x coordinate (xmin1, xmax1) of the reference line segment 94 is obtained.

【0106】次に、直線j内の線分の集合を対象にし
て、x座標がxmin1からxmax1までの範囲にか
かる線分をすべて抽出する。そして、抽出された線分と
直線i内の基準線分94とのy方向の距離の平均値を求
め、それを直線iと直線jの間の距離値とする。
Next, with respect to a set of line segments within the straight line j, all the line segments whose x coordinate ranges from xmin1 to xmax1 are extracted. Then, the average value of the distance in the y direction between the extracted line segment and the reference line segment 94 in the straight line i is obtained, and the average value is set as the distance value between the straight line i and the straight line j.

【0107】ここでは、直線j内の対応する線分は線分
95だけなので、これと基準線分94との距離dが、そ
のまま直線iと直線jの間の距離値となる。このような
計算方法により、直線が傾いた場合でも、正しい直線間
の距離が求められる。
Here, since the corresponding line segment in the straight line j is only the line segment 95, the distance d between the straight line j and the reference line segment 94 is the distance value between the straight line i and the straight line j. By such a calculation method, a correct distance between straight lines can be obtained even when the straight lines are inclined.

【0108】罫線抽出装置は、こうして得られた直線i
と直線jの距離を元にして、直線jを削除するかどうか
を決定する。まず、図22の直線92のように、直線j
が直線iより上にある場合は、それらの距離がしきい値
OVERDOT以内であれば、直線jを削除する。OV
ERDOTの値は、例えば1に設定される。また、直線
93のように、直線jが直線iより下にある場合は、そ
れらの距離がしきい値most freq heigh
tよりも小さければ、直線jを削除する。
The ruled line extracting device calculates the straight line i thus obtained.
It is determined whether or not the straight line j is to be deleted based on the distance between the straight line j and the straight line j. First, as shown by a straight line 92 in FIG.
Are above the straight line i, the straight line j is deleted if their distance is within the threshold OVERDOT. OV
The value of ERDOT is set to 1, for example. When the straight line j is below the straight line i as in the straight line 93, the distance between them is equal to the threshold most. freq height
If it is smaller than t, the straight line j is deleted.

【0109】このように、ほぼ完全に重複する2つの横
直線の短い方を削除することで、不要な横直線が除去さ
れる。縦直線の処理に関しても同様である。次に、罫線
抽出装置は、処理P21において、一定のしきい値より
大きい線分だけで構成されている直線を除去する。この
処理では、横直線内のすべて線分の高さがしきい値(m
fheight small*2−1)よりも大きい場
合に、その直線を文字列上から誤って抽出された直線と
みなして、削除する。縦直線の処理に関しても同様であ
る。
As described above, unnecessary horizontal straight lines are removed by deleting the shorter one of the two horizontal straight lines that almost completely overlap with each other. The same applies to the processing of the vertical straight line. Next, in the process P21, the ruled line extraction device removes a straight line composed of only line segments larger than a certain threshold value. In this processing, the height of all line segments in the horizontal straight line is set to the threshold value (m
feight If the line is larger than (small * 2-1), the line is regarded as a line erroneously extracted from the character string and deleted. The same applies to the processing of the vertical straight line.

【0110】次に、罫線抽出装置は、処理P22、23
において、直線矩形を構成する線分矩形がしきい値より
大きな場合、その線分矩形の情報にマークを付けて、マ
ークが付いていない線分矩形の内部の黒画素の総和を求
める。このとき、マークが付いていない線分矩形の集合
を、直線矩形の長さ方向と垂直な方向に動かして、シフ
ト量と黒画素総数の関係を表すグラフを作成する。そし
て、グラフの形状がなだらかな場合に、その直線矩形を
罫線候補から除外する。
Next, the ruled line extracting device performs the processing P22, P23
In the case where the line segment rectangle forming the straight line rectangle is larger than the threshold value, the information of the line segment rectangle is marked, and the sum of the black pixels inside the unmarked line segment rectangle is obtained. At this time, a set of line segment rectangles with no mark is moved in a direction perpendicular to the length direction of the straight rectangle, and a graph representing the relationship between the shift amount and the total number of black pixels is created. Then, when the shape of the graph is gentle, the straight rectangle is excluded from the ruled line candidates.

【0111】罫線抽出装置は、まず、処理P22におい
て、処理P23のための前処理を行う。この処理では、
横直線内の線分の高さが、しきい値mfheight
smallより大きな場合、その線分の属性情報をワイ
ルドカードに設定して、処理P23で使用しないように
する。縦直線の処理に関しても同様である。
The ruled line extracting apparatus first performs preprocessing for processing P23 in processing P22. In this process,
The height of the line segment in the horizontal straight line is the threshold value mfheight
If it is larger than small, the attribute information of the line segment is set as a wild card so as not to be used in the process P23. The same applies to the processing of the vertical straight line.

【0112】次に、処理P23において、線分シフトに
よる直線のチェック/除去処理を行う。この処理では、
まず、1つの横直線矩形を構成する複数の横線分矩形内
の黒画素数の総和を求め、それをシフト量0の位置(中
心位置)における黒画素総数とする。次に、線分矩形を
横直線矩形の長さ方向と垂直な方向(縦方向)に、横直
線矩形の高さ分だけ上下にシフトして、各位置での黒画
素総数を求め、シフト量に対する黒画素総数のグラフを
作成する。
Next, in process P23, a straight line check / removal process by line segment shift is performed. In this process,
First, the sum of the numbers of black pixels in a plurality of horizontal line segment rectangles forming one horizontal straight line rectangle is obtained, and the sum is set as the total number of black pixels at the position of the shift amount 0 (center position). Next, the line segment rectangle is shifted up and down in the direction (vertical direction) perpendicular to the length direction of the horizontal straight line rectangle by the height of the horizontal straight line rectangle, and the total number of black pixels at each position is obtained. Create a graph of the total number of black pixels for.

【0113】そして、中心位置付近の黒画素総数の極大
値を基準とし、上下の両方向に離れた位置の黒画素総数
の分布が一定比率未満になる場合に、その直線矩形は罫
線であるとみなして出力する。それ以外の場合は、その
直線矩形は文字列等から誤って抽出された直線であり、
罫線ではないものとみなして、削除する。縦直線の処理
についても同様である。
If the distribution of the total number of black pixels at positions separated in both the upper and lower directions is less than a certain ratio with reference to the maximum value of the total number of black pixels near the center position, the straight-line rectangle is regarded as a ruled line. Output. Otherwise, the straight line rectangle is a straight line that is incorrectly extracted from a character string or the like,
Assuming that it is not a ruled line, delete it. The same applies to the processing of the vertical straight line.

【0114】例えば図50に示した画像の場合、図24
に示すようなグラフが作成される。図24において、グ
ラフ96、97は、それぞれ対応する横直線の周囲の黒
画素の分布を表している。このとき、横直線の高さをh
eightとすると、横直線内の各線分は、y方向に+
/−heightの区間で1画素ずつシフトされ、各シ
フト位置における線分内の黒画素の総数がプロットされ
ている。
For example, in the case of the image shown in FIG.
A graph as shown in FIG. In FIG. 24, graphs 96 and 97 represent the distribution of black pixels around the corresponding horizontal straight line. At this time, the height of the horizontal straight line is h
Assuming that each of the line segments in the horizontal straight line is +
The pixel is shifted one pixel at a time in the section of-/ height, and the total number of black pixels in the line segment at each shift position is plotted.

【0115】グラフ96の場合は、シフト量0の位置に
黒画素総数の極大値Peakがあり、その上下におい
て、黒画素総数の分布はPeakのTHSHIFT倍の
値を下回っている。ここでは、THSHIFTの値は、
例えば0.44に設定される。このような分布は、シフ
ト量0の位置に黒画素が集中していることを表してお
り、その位置に対応する横直線が罫線であるとみなされ
る。
In the case of the graph 96, the maximum value Peak of the total number of black pixels is located at the position of the shift amount 0, and the distribution of the total number of black pixels is lower than the value of THISHFT times Peak. Here, the value of THSHIFT is
For example, it is set to 0.44. Such a distribution indicates that black pixels are concentrated at the position of the shift amount 0, and the horizontal straight line corresponding to the position is regarded as a ruled line.

【0116】これに対して、グラフ97の場合は、+/
−heightの区間の黒画素総数の分布がなだらか
で、シフト量0の位置の上下においても、PeakのT
HSHIFT倍の値を下回らない。このような分布は、
シフト量0の位置の上下に黒画素が分散していることを
表しており、その位置に対応する横直線は罫線ではない
ものとみなされ、削除される。
On the other hand, in the case of the graph 97, + /
The distribution of the total number of black pixels in the section of −height is gentle, and Peak T
It does not fall below the value of HSHIFT times. Such a distribution is
This indicates that black pixels are scattered above and below the position of the shift amount 0, and the horizontal straight line corresponding to that position is regarded as not a ruled line and is deleted.

【0117】このような直線のチェック/除去処理を行
えば、表内の網掛け部分や潰れた文字列上から抽出され
た直線が除去され、本来の罫線のみが処理結果として出
力される。このチェック/除去処理の詳細については後
述することにする。
When such a straight line check / removal process is performed, straight lines extracted from the shaded portion in the table or the crushed character string are removed, and only the original ruled lines are output as the processing result. The details of this check / removal process will be described later.

【0118】次に、図25から図36までを参照しなが
ら、上述の各処理の具体例について述べる。図25は、
処理P4における横線分統合後の画像データを示してお
り、図26は、図25の画像の一部を示している。図2
6の状態は、処理P16における完全重複直線の統合前
の画像データに対応し、図27は、その統合後の画像デ
ータを示している。
Next, specific examples of each of the above processes will be described with reference to FIGS. FIG.
FIG. 26 shows image data after horizontal line segment integration in process P4, and FIG. 26 shows a part of the image in FIG. FIG.
The state of No. 6 corresponds to the image data before the integration of the completely overlapped straight lines in the process P16, and FIG. 27 shows the image data after the integration.

【0119】図26において、ラベル66を持つ直線矩
形101とラベル3を持つ直線矩形106は、図27に
おいては1つに統合されていることが分かる。同様に、
ラベル67、68、69、70を持つ直線矩形102、
103、104、105は、それぞれ、ラベル4、5、
6、7を持つ直線矩形107、108、109、110
と統合されている。
In FIG. 26, it can be seen that the straight rectangle 101 having the label 66 and the straight rectangle 106 having the label 3 are integrated into one in FIG. Similarly,
A straight rectangle 102 with labels 67, 68, 69, 70,
103, 104, 105 are labels 4, 5,
Straight rectangles 107, 108, 109, 110 having 6, 7
And has been integrated.

【0120】また、図28は、図27の画像に対して処
理P17、18を施し、直線の形、位置および接続関係
を元に直線を除去した後の画像データを示している。図
27においてラベル35、37、38を持つ直線矩形1
11、112、113は、図28においては削除されて
いることが分かる。
FIG. 28 shows image data after processing P17 and P18 have been performed on the image of FIG. 27 and straight lines have been removed based on the shape, position and connection relationship of the straight lines. In FIG. 27, a straight rectangle 1 having labels 35, 37, 38
It can be seen that 11, 112, and 113 are deleted in FIG.

【0121】また、図29は、処理P19における部分
重複直線の統合前の画像データを示しており、図30
は、その統合後の画像データを示している。図29にお
いて、ラベル25を持つ直線矩形121とラベル20を
持つ直線矩形124は、図30においては1つに統合さ
れていることが分かる。同様に、ラベル26、27を持
つ直線矩形122、123は、それぞれ、ラベル21、
22を持つ直線矩形125、126と統合されている。
FIG. 29 shows the image data before the integration of the partially overlapping straight lines in the process P19.
Indicates image data after the integration. 29, the straight rectangle 121 having the label 25 and the straight rectangle 124 having the label 20 are integrated into one in FIG. Similarly, straight rectangles 122 and 123 having labels 26 and 27 respectively correspond to labels 21 and
22 are integrated with straight rectangles 125, 126.

【0122】また、図31は、処理P20におけるほぼ
完全に重複する直線の除去前の画像データを示してお
り、図32は、その除去後の画像データを示している。
図31における直線矩形131が、図32においては削
除されていることが分かる。
FIG. 31 shows the image data before removal of the almost completely overlapping straight line in the process P20, and FIG. 32 shows the image data after the removal.
It can be seen that the straight rectangle 131 in FIG. 31 has been deleted in FIG.

【0123】また、図33は、処理P21における大き
な線分だけから成る直線の除去前の画像データを示して
おり、図34は、その除去後の画像データを示してい
る。図33における直線矩形141が、図34において
は削除されていることが分かる。
FIG. 33 shows image data before removal of a straight line consisting only of a large line segment in the process P21, and FIG. 34 shows image data after the removal. It can be seen that the straight rectangle 141 in FIG. 33 has been deleted in FIG.

【0124】さらに、図35は、処理P23における線
分シフトによる直線のチェック/除去前の画像データを
示しており、図36は、そのチェック/除去後の画像デ
ータを示している。図35における直線矩形151、1
52、153が、図36においては削除されていること
が分かる。
FIG. 35 shows the image data before the check / removal of the straight line by the line segment shift in the process P23, and FIG. 36 shows the image data after the check / removal. The straight rectangles 151 and 1 in FIG.
It can be seen that 52 and 153 have been deleted in FIG.

【0125】次に、図37から図41までを参照しなが
ら、線分統合処理について詳細に説明する。図37、3
8、39、40、41は、図2における横線分統合処理
P4のフローチャートである。
Next, the line segment integration processing will be described in detail with reference to FIGS. FIG. 37, FIG.
8, 39, 40, and 41 are flowcharts of the horizontal line segment integration process P4 in FIG.

【0126】この処理においては、横直線抽出部15
は、大きな黒画素塊をワイルドカード矩形として扱い、
その前後に8連結で接続される横長の線分矩形に注目す
る。そして、ワイルドカード矩形を挟んでお互いに8連
結の関係にある線分矩形を統合していき、1つの横に長
い統合矩形を横直線として求める。
In this processing, the horizontal straight line extraction unit 15
Treats a large block of black pixels as a wildcard rectangle,
Attention is paid to a horizontally long line segment rectangle connected by eight connections before and after that. Then, line segment rectangles having an 8-connected relationship with each other are integrated with the wild card rectangle interposed therebetween, and one horizontally long integrated rectangle is obtained as a horizontal straight line.

【0127】処理が開始されると、横直線抽出部15
は、まず、横線分の高さの最頻値mfheight
mallを用いて次式の各しきい値を計算し、直線数を
0とおく(図37、ステップS1)。 th height= mfheight small+TH HEIGHTDOT (3) standard h=mfheight small+1 (4) ここで、TH HEIGHTDOTの値は、例えば2に
設定される。次に、互いに連結する複数の線分矩形のう
ちの1つの高さを調べ(ステップS2)、それがしきい
値th heightより大きければ、それをワイルド
カード矩形としてマークする(ステップS3)。このと
き、その線分矩形の属性情報の識別変数useを9とお
くことにより、ワイルドカード属性を設定する。
When the processing is started, the horizontal straight line extraction unit 15
Is the mode value of the height of the horizontal line, mfheight s
Each threshold value of the following equation is calculated using mall, and the number of straight lines is set to 0 (FIG. 37, step S1). th height = mfheight small + TH HEIGHTDOT (3) standard h = mfheight small + 1 (4) where TH The value of HEIGHTDOT is set to 2, for example. Next, the height of one of the plurality of line segment rectangles connected to each other is checked (step S2), and the height is determined as the threshold value th. If it is larger than height, it is marked as a wildcard rectangle (step S3). At this time, the wildcard attribute is set by setting the identification variable use of the attribute information of the line segment rectangle to 9.

【0128】それ以外の線分矩形は通常の矩形(スタン
ダード矩形)として、use=0とおく(ステップS
4)。そして、連結するすべての線分矩形をマークした
かどうかを判定し(ステップS5)、まだ線分矩形が残
っていれば、ステップS2以降の処理を繰り返す。
For other line segment rectangles, use = 0 is set as a normal rectangle (standard rectangle) (step S).
4). Then, it is determined whether or not all the line segment rectangles to be connected have been marked (step S5). If the line segment rectangle still remains, the processing from step S2 is repeated.

【0129】すべての線分矩形をマークし終えると、1
つの矩形をカレント矩形iとして取り出し、xlf=カ
レント矩形iの左端座標、xr=カレント矩形iの右端
座標、yup=カレント矩形iの上端座標、ybl=カ
レント矩形iの下端座標、line start=yu
p、line end=yblとおく(ステップS
6)。そして、カレント矩形iのuseが0または9で
あるかどうか調べる(ステップS7)。
When all line segment rectangles have been marked, 1
Two rectangles are taken out as a current rectangle i, xlf = the left end coordinates of the current rectangle i, xr = the right end coordinates of the current rectangle i, yup = the top coordinates of the current rectangle i, ybl = the bottom coordinates of the current rectangle i, line start = yu
p, line end = ybl (step S
6). Then, it is checked whether the use of the current rectangle i is 0 or 9 (step S7).

【0130】カレント矩形iのuseが0または9であ
れば、startxlf=xlf、startxr=x
r、startyup=yup、startybl=y
blとおき(ステップS8)、次に、use=0かどう
かを判定する(図38、ステップS9)。use=0で
あれば、standard st=yup、stand
ard en=ybl、b use=0、use=1、
height=ybl−yup+1とおく(ステップS
10)。
If the use of the current rectangle i is 0 or 9, startxlf = xlf, startxr = x
r, startup = yup, startybl = y
bl (step S8), and it is determined whether use = 0 (FIG. 38, step S9). If use = 0, standard st = yup, stand
ard en = ybl, b use = 0, use = 1,
height = ybl-yup + 1 (step S
10).

【0131】b use=0は、カレント矩形iがワイ
ルドカードではなく、スタンダードとして設定されてい
ることを意味し、use=1はカレント矩形iが使用済
みであることを意味する。ステップS9でuse=0で
なければ、standard st=0、standar
en=0、b use=9、height2=yb
l−yup+1とおく(ステップS11)。b use
=9は、カレント矩形iがワイルドカードであるため、
スタンダードとして設定されないことを意味する。
B use = 0 indicates that the current rectangle i is
Is set as a standard, not a card
Use = 1 means that the current rectangle i has been used
Means that In step S9, use = 0
If not, standard st = 0, standard
d en = 0, b use = 9, height2 = yb
1-yup + 1 is set (step S11). b use
= 9 because the current rectangle i is a wildcard,
It means that it is not set as a standard.

【0132】次に、他の線分矩形をカレント矩形kとし
て取り出し、rxlf=カレント矩形kの左端座標、r
xr=カレント矩形kの右端座標、ryup=カレント
矩形kの上端座標、rybl=カレント矩形kの下端座
標とおく(ステップS12)。
Next, another line segment rectangle is extracted as the current rectangle k, and rxlf = the left end coordinate of the current rectangle k, r
xr = the right end coordinate of the current rectangle k, ryup = the upper end coordinate of the current rectangle k, and rybl = the lower end coordinate of the current rectangle k (step S12).

【0133】そして、カレント矩形iがスタンダードと
して設定されているかどうか、すなわち、b use=
0であるかどうかを調べる(ステップS13)。b
se=0であれば、次に、カレント矩形kのuseが9
であるかどうかを調べる(ステップS14)。ここで、
use=9の場合は、カレント矩形iがスタンダード
で、カレント矩形kがワイルドカードであることを意味
する。
Whether the current rectangle i is set as the standard, ie, whether b use =
It is checked whether it is 0 (step S13). b u
If se = 0, then use of the current rectangle k is 9
Is checked (step S14). here,
When use = 9, it means that the current rectangle i is a standard and the current rectangle k is a wild card.

【0134】use=9のとき、xr+1≧rxlf、
xr<rxr、ybl+1≧ryup、およびyup−
1≦ryblが成り立つかどうかを判定する(ステップ
S15)。これらの条件が成り立つ時、カレント矩形k
がカレント矩形iの右側にあり、両者が横と縦に1画素
(1ドット)以上の重なりを有することを意味する。そ
こで、xr=rxrとおいて、カレント矩形iの右端を
カレント矩形kの右端まで延長する(ステップS1
6)。
When use = 9, xr + 1 ≧ rxlf,
xr <rxr, ybl + 1 ≧ ryup, and yup−
It is determined whether 1 ≦ rybl is satisfied (step S15). When these conditions hold, the current rectangle k
Is on the right side of the current rectangle i, which means that they overlap one pixel (one dot) horizontally and vertically. Therefore, with xr = rxr, the right end of the current rectangle i is extended to the right end of the current rectangle k (step S1).
6).

【0135】ステップS14でuse=9でないとき、
次に、use=0であるかどうかを調べる(図39、ス
テップS17)。ここで、use=0の場合は、カレン
ト矩形iがスタンダードで、カレント矩形kがワイルド
カードでないことを意味する。そこで、次に、xr+1
≧rxlf、xr<rxr、ybl+1≧ryup、お
よびyup−1≦ryblが成り立ち、かつ、カレント
矩形kの高さがstandard h+/−4以内かど
うかを判定する(ステップS18)。
If use = 9 is not satisfied in step S14,
Next, it is checked whether or not use = 0 (FIG. 39, step S17). Here, when use = 0, it means that the current rectangle i is a standard and the current rectangle k is not a wild card. Therefore, next, xr + 1
≧ rxlf, xr <rxr, ybl + 1 ≧ ryup, and yup−1 ≦ rybl, and the height of the current rectangle k is standard. It is determined whether it is within h +/− 4 (step S18).

【0136】これらの条件が成り立つ時、xr=rx
r、yup=ryup、ybl=rybl、use=
2、hei=rybl−ryup+1とおく(ステップ
S19)。これは、カレント矩形iの右端をカレント矩
形kの右端まで延長し、上下端の座標をカレント矩形k
のものに置き換えることを意味する。また、use=2
はカレント矩形kが使用済みであることを意味する。
When these conditions hold, xr = rx
r, yup = ryup, ybl = rybl, use =
2, hei = rybl-ryup + 1 is set (step S19). That is, the right end of the current rectangle i is extended to the right end of the current rectangle k, and the coordinates of the upper and lower ends are set to the current rectangle k.
Means to replace it with Use = 2
Means that the current rectangle k has been used.

【0137】次に、hei>heightが成り立つか
どうかを判定し(ステップS20)、成り立てばhei
ght=heiとおく(ステップS21)。次に、ry
up<line startが成り立つかどうかを判定
し(ステップS22)、成り立てばline star
t=ryupとおく(ステップS23)。さらに、ry
bl>line endが成り立つかどうかを判定し
(ステップS24)、成り立てばline end=r
yblとおく(ステップS25)。
Next, it is determined whether or not hei> height is satisfied (step S20).
gh = hei (step S21). Next, ry
up <line It is determined whether or not start is satisfied (step S22). star
t = ryup is set (step S23). Furthermore, ry
bl> line It is determined whether or not end is satisfied (step S24). end = r
ybl (step S25).

【0138】これらの処理の後、次にb use=9か
どうかを判定する(図40、ステップS26)。図38
のステップS13、S15、図39のステップS18、
S20、S22、S24で判定結果がNoのときは、直
ちにステップS26以降の処理に移る。
After these processes, b It is determined whether use = 9 (FIG. 40, step S26). FIG.
Steps S13 and S15, step S18 in FIG.
If the determination result is No in S20, S22, and S24, the process immediately proceeds to step S26 and subsequent steps.

【0139】ここで、b use=9であれば、次に、
カレント矩形kのuseが9であるかどうかを調べる
(ステップS27)。use=9の場合は、カレント矩
形iとカレント矩形kの両方がワイルドカードであるこ
とを意味をする。そこで、xr+1≧rxlf、xr<
rxr、ybl+1≧ryup、およびyup−1≦r
yblが成り立つかどうかを判定する(ステップS2
8)。
Here, b If use = 9, then
It is checked whether the use of the current rectangle k is 9 (step S27). When use = 9, it means that both the current rectangle i and the current rectangle k are wildcards. Therefore, xr + 1 ≧ rxlf, xr <
rxr, ybl + 1 ≧ ryup, and yup−1 ≦ r
ybl is determined (step S2)
8).

【0140】これらの条件が成り立つ時、カレント矩形
kがカレント矩形iの右側にあり、両者が横と縦に1ド
ット以上の重なりを有するので、xr=rxrとおい
て、カレント矩形iの右端をカレント矩形kの右端まで
延長する(ステップS29)。
When these conditions are satisfied, the current rectangle k is on the right side of the current rectangle i, and both have an overlap of one or more dots in the horizontal and vertical directions. Therefore, with xr = rxr, the right end of the current rectangle i is The rectangle k is extended to the right end (step S29).

【0141】ステップS27でuse=9でないとき、
次に、use=0であるかどうかを調べる(ステップS
30)。ここで、use=0の場合は、カレント矩形i
がワイルドカードで、カレント矩形kがワイルドカード
でないことを意味をする。そこで、xr+1≧rxl
f、xr<rxr、line end≧ryup、およ
びline start<ryblが成り立つかどうか
を判定する(ステップS31)。
If use = 9 is not satisfied in step S27,
Next, it is checked whether use = 0 (step S
30). Here, if use = 0, the current rectangle i
Is a wildcard, meaning that the current rectangle k is not a wildcard. Therefore, xr + 1 ≧ rxl
f, xr <rxr, line end ≧ ryup, and line It is determined whether start <rybl is satisfied (step S31).

【0142】これらの条件が成り立つ時、xr=rx
r、yup=ryup、ybl=rybl、use=
2、line start=ryup、line en
d=rybl、hei=rybl−ryup+1、st
andard st=ryup、standard
n=ryblとおく(ステップS32)。
When these conditions are satisfied, xr = rx
r, yup = ryup, ybl = rybl, use =
2, line start = ryup, line en
d = rybl, hei = rybl-ryup + 1, st
andard st = ryup, standard e
n = rybl is set (step S32).

【0143】これは、カレント矩形iの右端をカレント
矩形kの右端まで延長し、上下端の座標をカレント矩形
kのものに置き換えることを意味する。また、use=
2はカレント矩形kが使用済みであることを意味する。
そして、hei>heightが成り立つかどうかを判
定し(ステップS33)、成り立てばheight=h
eiとおく(ステップS34)。
This means that the right end of the current rectangle i is extended to the right end of the current rectangle k, and the coordinates of the upper and lower ends are replaced with those of the current rectangle k. Also, use =
2 means that the current rectangle k has been used.
Then, it is determined whether or not “hei> height” is satisfied (step S33).
ei (step S34).

【0144】次に、カレント矩形kとして、連結するす
べての線分矩形を取り出したかどうかを判定する(図4
1、ステップS35)。図40のステップS26、S2
8、S30、S31、S33で判定結果がNoのとき
は、直ちにステップS35以降の処理に移る。ここで、
残っている線分矩形があれば、図38のステップS13
以降の処理を繰り返す。
Next, it is determined whether all the connected line segment rectangles have been extracted as the current rectangle k (FIG. 4).
1. Step S35). Steps S26 and S2 in FIG.
8. If the determination result is No in S30, S31, and S33, the process immediately proceeds to step S35 and thereafter. here,
If there is any remaining line segment rectangle, step S13 in FIG.
The subsequent processing is repeated.

【0145】すべての線分矩形について処理が終われ
ば、b use=9であるかどうかを判定する(ステッ
プS36)。ここで、b use=9でなければ、xl
f、xr、line start、line end
を、それぞれ抽出した直線矩形の左端、右端、上端、下
端の座標として保存し、直線数を1だけインクリメント
する(ステップS37)。
When the processing is completed for all the line segment rectangles, b It is determined whether use = 9 (step S36). Where b If use = 9, xl
f, xr, line start, line end
Are stored as the coordinates of the left end, the right end, the upper end, and the lower end of the extracted straight rectangle, and the number of straight lines is incremented by 1 (step S37).

【0146】ステップS36でb use=9となるの
は、カレント矩形iとそれに連結するすべての矩形がワ
イルドカードであった場合なので、この場合は直線とし
て保存しない。
At step S36, b Use = 9 is when the current rectangle i and all the rectangles connected to it are wildcards. In this case, the current rectangle i is not stored as a straight line.

【0147】次に、カレント矩形iとしてすべての線分
矩形を取り出したかどうかを判定し(ステップS3
8)、残っている線分矩形があれば、図37のステップ
S6以降の処理を繰り返す。ステップS7でカレント矩
形iのuseが0または9でない場合は、取り出した線
分矩形が既に使用済みであることを意味するので、直ち
にステップS38の処理に移り、次の線分矩形を取り出
す。そして、すべての線分矩形が取り出されると、処理
を終了する。
Next, it is determined whether or not all the line segment rectangles have been extracted as the current rectangle i (step S3).
8) If there are any remaining line segment rectangles, the processing from step S6 in FIG. 37 is repeated. If the use of the current rectangle i is not 0 or 9 in step S7, it means that the extracted line segment rectangle has already been used, so the process immediately proceeds to step S38, and the next line segment rectangle is extracted. Then, when all the line segment rectangles have been extracted, the process ends.

【0148】このようにして、ワイルドカードを飛び越
して、その両側の横線分矩形を統合し、標準的な線分だ
けを含む横直線を抽出することができる。図2における
縦線分統合処理P9も、同様のフローに従って行われ
る。次に、図42から図47までを参照しながら、線分
シフトによる直線のチェック/除去処理のフローを詳細
に説明する。図42、43、44、45、46、47
は、図2の処理P23における横直線のチェック/除去
処理のフローチャートである。この処理においては、罫
線抽出装置は、各横直線の周囲の黒画素の分布を元にし
て、その直線が正しい罫線かどうかを判別し、正しい罫
線のみを残して、他のものを除去する。
In this way, it is possible to jump over the wild card, integrate the horizontal line segment rectangles on both sides thereof, and extract a horizontal line including only standard line segments. The vertical line segment integration process P9 in FIG. 2 is also performed according to a similar flow. Next, the flow of a straight line check / removal process by line segment shift will be described in detail with reference to FIGS. 42, 43, 44, 45, 46, 47
5 is a flowchart of a process of checking / removing a horizontal straight line in a process P23 of FIG. In this processing, the ruled line extraction device determines whether or not the straight line is a correct ruled line based on the distribution of black pixels around each horizontal straight line, and removes other lines while leaving only the correct ruled line.

【0149】処理が開始されると、罫線抽出装置は、ま
ず、処理済の横直線数を表す変数cntと、正しい罫線
と判定された横直線数を表す変数newcountを、
ともに0とおく(図42、ステップS41)。ただし、
cntとnewcountは、0を起点にしてカウント
される。
When the process is started, the ruled line extraction device firstly stores a variable cnt representing the number of processed horizontal straight lines and a variable newcount representing the number of horizontal straight lines determined to be correct ruled lines.
Both are set to 0 (FIG. 42, step S41). However,
cnt and newcount are counted starting from 0.

【0150】次に、cnt番目の横直線の属性が破線を
表すかどうかを調べる(ステップS42)。それが破線
属性であれば、その横直線の直線情報をすべてnewc
ount番目の罫線情報としてコピーし、cntとne
wcountを1ずつインクリメントして(ステップS
43)、ステップS42で次の横直線の判定を行う。
Next, it is checked whether or not the attribute of the cnt-th horizontal straight line represents a broken line (step S42). If it is a dashed line attribute, all the straight line information of the horizontal straight line is newc
copy as the rule information of the "out" th, cnt and ne
wcount is incremented by 1 (step S
43), the next horizontal straight line is determined in step S42.

【0151】cnt番目の横直線の属性が破線属性でな
ければ、それは実線に対応するものとみなし、その横直
線矩形の高さをheightとおき(ステップS4
4)、heightが2以下かどうかを判定する(ステ
ップS45)。heightが2より大きければ、その
値を変更せず、heightが2以下であれば、それを
3に変更する(ステップS46)。
If the attribute of the cnt-th horizontal straight line is not the broken line attribute, it is regarded as corresponding to the solid line, and the height of the horizontal straight line rectangle is set to height (step S4).
4) It is determined whether height is 2 or less (step S45). If height is greater than 2, the value is not changed, and if height is 2 or less, it is changed to 3 (step S46).

【0152】そして、pos=height、maxs
um=0、top bound=0、bottom
ound=0、shift=−1*height、su
m=0、j=0とおく(ステップS47)。変数pos
は、画像内での上下方向の位置を指定するために用いら
れ、変数maxsumは、黒画素総数のグラフにおける
極大値を表す。
Then, pos = height, maxs
um = 0, top bound = 0, bottom b
sound = 0, shift = -1 * height, su
It is assumed that m = 0 and j = 0 (step S47). Variable pos
Is used to specify the position in the vertical direction in the image, and the variable maxsum represents the maximum value in the graph of the total number of black pixels.

【0153】また、変数top boundは、グラフ
の区間が画像の上端に達したかどうかを表すフラグとし
て用いられ、変数bottom boundは、グラフ
の区間が画像の下端に達したかどうかを表すフラグとし
て用いられる。変数shiftの値は、横直線内の線分
矩形の上下方向のシフト量を表し、変数sumは、複数
の線分矩形内の黒画素の総数を表す。
The variable top “bound” is used as a flag indicating whether or not the section of the graph has reached the upper end of the image, and a variable “bottom” is used. The bound is used as a flag indicating whether the section of the graph has reached the lower end of the image. The value of the variable shift represents the amount of vertical shift of the line segment rectangle in the horizontal straight line, and the variable sum represents the total number of black pixels in a plurality of line segment rectangles.

【0154】次に、cnt番目の横直線内のj番目の小
線分(線分矩形)の属性がワイルドカードかどうかを調
べる(図43、ステップS48)。それがワイルドカー
ド属性であれば、jを1だけインクリメントして(ステ
ップS49)、ステップS48で次の小線分を判定す
る。
Next, it is checked whether or not the attribute of the j-th small line segment (line segment rectangle) in the cnt-th horizontal straight line is a wild card (FIG. 43, step S48). If it is the wild card attribute, j is incremented by 1 (step S49), and the next small line segment is determined in step S48.

【0155】j番目の小線分の属性がワイルドカードで
なければ、それは通常の線分矩形に対応するとみなし、
xmin=j番目の小線分の左端座標、xmax=j番
目の小線分の右端座標、ymin=j番目の小線分の上
端座標+shift、ymax=j番目の小線分の下端
座標+shiftとおく(ステップS50)。ただし、
こうして決められたyminまたはymaxの位置が画
像座標内にない場合は、最も近い画像端のy座標をym
inまたはymaxとする。
If the attribute of the j-th small line segment is not a wild card, it is regarded as corresponding to a normal line segment rectangle,
xmin = the left end coordinate of the jth small line, xmax = the right end coordinate of the jth small line, ymin = the upper end coordinate of the jth small line + shift, and ymax = the lower end coordinate of the jth small line + shift. (Step S50). However,
If the position of ymin or ymax determined in this manner is not within the image coordinates, the y coordinate of the nearest image end is set to ym.
in or ymax.

【0156】そして、変数xmin、xmax、ymi
n、ymaxの各値で区切られる矩形領域内の黒画素の
数を計算して、それをblack dotとおき、su
m=sum+black dotとする。
The variables xmin, xmax, ymi
Calculate the number of black pixels in the rectangular area delimited by each value of n and ymax, and Dot and su
m = sum + black dot.

【0157】次に、yminが画像の上端に対応するか
どうかを判定し(ステップS51)、上端であればto
bound=1とおく(ステップS52)。また、
ymaxが画像の下端に対応するかどうかを判定し(ス
テップS53)、下端であればbottom boun
d=1とおく(ステップS54)。
Next, it is determined whether or not ymin corresponds to the upper end of the image (step S51).
p Bound = 1 is set (step S52). Also,
It is determined whether or not ymax corresponds to the lower end of the image (step S53). boun
d = 1 is set (step S54).

【0158】次に、変数jの値がcnt番目の横直線内
の最後の小線分に対応するかどうかを判定する(ステッ
プS55)。それが最後の小線分に対応しなければ、j
を1だけインクリメントして(ステップS56)、ステ
ップS48以降の処理を繰り返す。それが最後の小線分
に対応すれば、histo[pos+shift]=s
umとおく(図44、ステップS57)。
Next, it is determined whether or not the value of the variable j corresponds to the last small line segment in the cnt-th horizontal straight line (step S55). If it does not correspond to the last line segment, j
Is incremented by 1 (step S56), and the processing from step S48 is repeated. If it corresponds to the last small line segment, histo [pos + shift] = s
um (FIG. 44, step S57).

【0159】ここで、histo[p]は、y方向の位
置パラメータpの値に対応するグラフの値(黒画素の総
数)を表す。例えば、pos=height、shif
t=−heightの場合は、histo[pos+s
hift]=histo[0]となり、パラメータ値0
の位置に対応するグラフの値を表す。
Here, histo [p] represents the value of the graph (total number of black pixels) corresponding to the value of the position parameter p in the y direction. For example, pos = height, shif
If t = -height, histo [pos + s
shift] = histo [0], and the parameter value 0
Represents the value of the graph corresponding to the position of.

【0160】次に、sumとmaxsumを比較し(ス
テップS58)、sumがmaxsumより大きけれ
ば、maxsum=sumとおく(ステップS59)。
次に、shiftとheightを比較する(ステップ
S60)。shiftがheight以下であれば、s
hift=shift+1とおいて、sumとjを初期
値0に戻し(ステップS61)、ステップS48以降の
処理を繰り返す。これにより、シフト量が1画素分変化
した位置に対応するグラフの値が計算される。
Next, sum and maxsum are compared (step S58), and if sum is larger than maxsum, maxsum = sum is set (step S59).
Next, shift and height are compared (step S60). If shift is equal to or less than height, s
Assuming that shift = shift + 1, sum and j are returned to the initial values 0 (step S61), and the processing from step S48 is repeated. Thereby, the value of the graph corresponding to the position where the shift amount has changed by one pixel is calculated.

【0161】そして、shiftの値がheightを
越えると、次に、histo[pos−1]とhist
o[pos]とを比較する(ステップS62)。ここ
で、histo[pos]は、シフト量0の位置に対応
するグラフの値を表す。histo[pos−1]がh
isto[pos]より大きければ、次に、histo
[pos−1]とhisto[pos+1]とを比較す
る(ステップS63)。
When the value of shift exceeds height, next, histo [pos-1] and histogram
o [pos] is compared (step S62). Here, histo [pos] represents the value of the graph corresponding to the position of the shift amount 0. histo [pos-1] is h
If it is greater than isto [pos], then histo
[Pos-1] is compared with histo [pos + 1] (step S63).

【0162】そして、histo[pos−1]がhi
sto[pos+1]より大きければ、maxpos=
pos−1、maxsum=histo[pos−1]
とおく(ステップS64)。また、histo[pos
−1]がhisto[pos+1]以下であれば、ma
xpos=pos+1、maxsum=histo[p
os+1]とおく(ステップS65)。
Then, histo [pos-1] becomes hi
If greater than sto [pos + 1], maxpos =
pos-1, maxsum = histo [pos-1]
(Step S64). In addition, histo [pos
-1] is less than histo [pos + 1], ma
xpos = pos + 1, maxsum = histo [p
os + 1] (step S65).

【0163】ステップS62において、histo[p
os−1]がhisto[pos]以下であれば、次
に、histo[pos]とhisto[pos+1]
とを比較する(ステップS66)。
In step S62, histo [p
If os-1] is less than or equal to histo [pos], then histo [pos] and histo [pos + 1]
Are compared (step S66).

【0164】そして、histo[pos]がhist
o[pos+1]以上であれば、maxpos=po
s、maxsum=histo[pos]とおく(ステ
ップS67)。また、histo[pos]がhist
o[pos+1]より小さければ、maxpos=po
s+1、maxsum=histo[pos+1]とお
く(ステップS68)。
Then, histo [pos] is changed to "hist".
If o [pos + 1] or more, maxpos = po
s, maxsum = histo [pos] are set (step S67). Also, histo [pos] is histo
If less than o [pos + 1], then maxpos = po
s + 1, maxsum = histo [pos + 1] are set (step S68).

【0165】このような処理により、histo[po
s−1]、histo[pos]、およびhisto
[pos+1]のうちの最大値が、maxsumに設定
され、それに対応するパラメータ値がmaxposに設
定される。したがって、このmaxsumは、シフト量
0の位置付近におけるグラフの極大値を表し、図24の
Peakに対応する。
By such processing, histo [po]
s-1], histo [pos], and histo
The maximum value of [pos + 1] is set to maxsum, and the corresponding parameter value is set to maxpos. Accordingly, this maxsum represents the maximum value of the graph near the position of the shift amount 0, and corresponds to Peak in FIG.

【0166】次に、得られたmaxsum(=hist
o[maxpos])の値を用いて、次式により、しき
い値thを計算する(図45、ステップS69)。 th=maxsum*THSHIFT (5) ここで、パラメータTHSHIFTは、極大値maxs
umに対するしきい値thの比率を表し、0〜1.0の
間で適当に設定される。
Next, the obtained maxsum (= hist)
Using the value of [o [maxpos]), the threshold th is calculated by the following equation (FIG. 45, step S69). th = maxsum * THSHIFT (5) where the parameter THSHIFT is the maximum value maxs
It represents the ratio of the threshold value th to um, and is appropriately set between 0 and 1.0.

【0167】そして、lineokflag1=0、l
ineokflag2=0、minval=0xfff
f、shift=−1*heightとおく。変数li
neokflag1およびlineokflag2は、
極大値に対応する位置の上下両側におけるチェック結果
を表すフラグとして用いられ、変数minvalは、グ
ラフの最小値を表す。
Then, lineokflag1 = 0, l
ineokflag2 = 0, minval = 0xffff
f, shift = −1 * height. Variable li
neokflag1 and lineokflag2 are
The variable minval represents a minimum value of the graph, which is used as a flag indicating a check result on both upper and lower sides of the position corresponding to the local maximum value.

【0168】次に、histo[pos+shift]
とthを比較する(ステップS70)。そして、his
to[pos+shift]がthより小さければ、極
大値に対応する位置の上側では黒画素の数が減少してい
るとみなし、lineokflag1=1とおく(ステ
ップS71)。したがって、lineokflag1=
1は、上側におけるチェック結果がOKであることを表
す。
Next, histo [pos + shift]
And th (Step S70). And his
If to [pos + shift] is smaller than th, it is considered that the number of black pixels has decreased above the position corresponding to the local maximum, and lineokflag1 = 1 is set (step S71). Therefore, lineokflag1 =
1 indicates that the check result on the upper side is OK.

【0169】次に、histo[pos+shift]
とminvalを比較する(ステップS72)。そし
て、histo[pos+shift]がminval
より小さければ、minval=histo[pos+
shift]とおく(ステップS73)。
Next, histo [pos + shift]
And minval are compared (step S72). And histo [pos + shift] is minval
If smaller, minval = histo [pos +
shift] (step S73).

【0170】次に、(pos+shift)とmaxp
osを比較し(ステップS74)、(pos+shif
t)がmaxpos以下であれば、shift=shi
ft+1とおいて(ステップS75)、ステップS70
以降の処理を繰り返す。これにより、シフト量が1画素
分変化した位置で、再びグラフの値が調べられる。
Next, (pos + shift) and maxp
os (step S74), and (pos + sif
If t) is less than or equal to maxpos, then shift = shi
ft + 1 (step S75), step S70
The subsequent processing is repeated. Thus, the value of the graph is checked again at the position where the shift amount has changed by one pixel.

【0171】(pos+shift)がmaxposを
越えれば、次に、histo[pos+shift]と
thを比較する(図46、ステップS76)。そして、
histo[pos+shift]がth以上であれ
ば、次に、histo[pos+shift]とmin
valを比較する(ステップS77)。そして、his
to[pos+shift]がminvalより小さけ
れば、minval=histo[pos+shif
t]とおく(ステップS78)。
If (pos + shift) exceeds maxpos, then histo [pos + shift] is compared with th (FIG. 46, step S76). And
If histo [pos + shift] is greater than or equal to th, then histo [pos + shift] and min
val is compared (step S77). And his
If to [pos + shift] is smaller than minval, then minval = histo [pos + shift]
t] (step S78).

【0172】次に、shiftとheightを比較し
(ステップS79)、shiftがheight以下で
あれば、shift=shift+1とおいて(ステッ
プS80)、ステップS76以降の処理を繰り返す。こ
れにより、シフト量が1画素分変化した位置で、再びグ
ラフの値が調べられる。
Next, shift and height are compared (step S79). If shift is equal to or less than height, shift = shift + 1 is set (step S80), and the processing from step S76 is repeated. Thus, the value of the graph is checked again at the position where the shift amount has changed by one pixel.

【0173】ステップS76において、histo[p
os+shift]がthより小さければ、極大値に対
応する位置の下側では黒画素の数が減少しているとみな
し、lineokflag2=1とおく(ステップS8
1)。したがって、lineokflag2=1は、下
側におけるチェック結果がOKであることを表す。
In step S76, histo [p
If [os + shift] is smaller than th, it is assumed that the number of black pixels is reduced below the position corresponding to the local maximum, and lineokflag2 = 1 is set (step S8).
1). Therefore, lineokflag2 = 1 indicates that the check result on the lower side is OK.

【0174】次に、lineokflag1とtop
boundの値を調べる(図47、ステップS82)。
そして、lineokflag1=0かつtop bo
und=1であれば、対象とするcnt番目の横直線は
画像の上端部付近の横罫線に対応するとみなして、li
neokflag1=1とおく(ステップS83)。
Next, lineokflag1 and top
The value of bound is checked (FIG. 47, step S82).
And lineokflag1 = 0 and top bo
If und = 1, the target cnt-th horizontal straight line is considered to correspond to the horizontal ruled line near the upper end of the image, and li
neoflag1 = 1 is set (step S83).

【0175】次に、lineokflag2とbott
om boundの値を調べる(ステップS84)。そ
して、lineokflag2=0かつbottom
bound=1であれば、cnt番目の横直線は画像の
下端部付近の横罫線に対応するとみなして、lineo
kflag2=1とおく(ステップS85)。
Next, lineokflag2 and bottom
om The value of bound is checked (step S84). Then, lineokflag2 = 0 and bottom
If bound = 1, it is assumed that the cnt-th horizontal straight line corresponds to the horizontal ruled line near the lower end of the image, and lineo
kflag2 = 1 is set (step S85).

【0176】次に、lineokflag1およびli
neokflag2の最終的な値を調べる(ステップS
86)。lineokflag1=lineokfla
g2=1であれば、cnt番目の横直線は正しい横罫線
であると判定し、その直線情報をnewcount番目
の罫線情報としてコピーし、newcountを1だけ
インクリメントする(ステップS87)。
Next, lineokflag1 and li
Check the final value of neoflag2 (step S
86). lineokflag1 = lineokfla
If g2 = 1, it is determined that the cnt-th horizontal straight line is a correct horizontal ruled line, the line information is copied as newcount-th ruled line information, and newcount is incremented by 1 (step S87).

【0177】また、lineokflag1=0または
lineokflag2=0であれば、cnt番目の横
直線は正しい横罫線ではないと判定し、その直線情報は
罫線情報として保存しない。
If lineokflag1 = 0 or lineokflag2 = 0, it is determined that the cnt-th horizontal straight line is not a correct horizontal ruled line, and the line information is not stored as ruled line information.

【0178】次に、cntが画像内の最後の横直線に対
応するかどうかを調べ(ステップS88)、まだ横直線
が残っていれば、cntを1だけインクリメントして
(ステップS89)、次の横直線についてステップS4
2以降の処理を繰り返す。そして、cntが最後の横直
線に対応する値になれば、処理を終了する。
Next, it is checked whether or not cnt corresponds to the last horizontal straight line in the image (step S88). If a horizontal straight line still remains, cnt is incremented by 1 (step S89), and the next Step S4 for horizontal straight line
The processing after step 2 is repeated. When cnt becomes a value corresponding to the last horizontal straight line, the processing is terminated.

【0179】このような処理を行えば、直線上の黒画素
数とその周囲の黒画素数との比較に基づいて罫線らしさ
がチェックされるので、網掛け部分や潰れた文字列等か
ら誤って抽出された直線が効率よく除去される。縦方向
の直線についても、同様のチェック/除去処理が行われ
る。
By performing such a process, the ruled line likelihood is checked based on the comparison between the number of black pixels on a straight line and the number of black pixels around the straight line. The extracted straight line is efficiently removed. The same check / removal process is performed on the vertical straight line.

【0180】以上説明したように、本実施形態によれ
ば、画像のかすれの有無にかかわらず、実線と点線の混
在する表の画像であっても、また、網掛け部分や、文字
と罫線が接触した部分があっても、正確に罫線を抽出す
ることが可能になる。
As described above, according to the present embodiment, regardless of whether the image is blurred or not, even if the image is a table image in which solid lines and dotted lines are mixed, a shaded portion, a character and a ruled line are not included. Even if there is a contact portion, a ruled line can be accurately extracted.

【0181】本発明の罫線抽出技術は、電子ファイリン
グだけでなく、記号や文字を含む広い意味での図形と直
線が重なったパターンから、その図形だけを切り出す技
術に適用される。例えば、手書き文字認識装置、印刷文
字認識装置、図面認識における文字、記号等のパターン
の切り出し、および画像中の罫線と物体、図形、文字等
の接触部分の分離に適用可能である。
The ruled line extraction technique of the present invention is applied not only to electronic filing but also to a technique of cutting out only a graphic from a pattern in which a straight line overlaps a graphic in a broad sense including symbols and characters. For example, the present invention can be applied to a handwritten character recognition device, a printed character recognition device, cutout of patterns such as characters and symbols in drawing recognition, and separation of a ruled line in an image and a contact portion between an object, a figure, and a character.

【0182】また、直線や線分を表す領域の形状は必ず
しも矩形でなくてもよく、直線または曲線により囲まれ
た任意の形状の領域を用いることができる。この場合、
用いる形状に応じて、直線や線分の位置、高さ、および
幅、それらの間の距離等を適当に定義すれば、図2と同
様の処理を行うことができる。
The shape of the area representing a straight line or a line segment is not necessarily rectangular, and an area of any shape surrounded by a straight line or a curve can be used. in this case,
If the position, height, and width of a straight line or a line segment, the distance between them, and the like are appropriately defined according to the shape to be used, processing similar to that in FIG.

【0183】[0183]

【発明の効果】本発明によれば、あらかじめ罫線構造が
予測できない一般の文書画像から、罫線部分を正しく抽
出することができる。
According to the present invention, a ruled line portion can be correctly extracted from a general document image whose ruled line structure cannot be predicted in advance.

【0184】例えば、表の中に網掛け部分がある場合で
も、その画像から正しく罫線を抽出することが可能とな
る。また、文字と罫線が接触している場合で、表の構造
情報があらかじめ分かっていなくても、正しく罫線を抽
出することが可能である。さらに、文字列が潰れ気味に
印刷されている場合、または文字同士が高密度に印刷さ
れている場合でも、文字列上から誤って罫線を抽出する
確率が低くなる。
For example, even when a table has a shaded portion, it is possible to correctly extract ruled lines from the image. Also, when a character and a ruled line are in contact with each other, it is possible to correctly extract the ruled line even if the table structure information is not known in advance. Furthermore, even when the character string is printed with a slight collapse or when characters are printed at a high density, the probability of erroneously extracting ruled lines from the character string is reduced.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の罫線抽出装置の原理図である。FIG. 1 is a diagram illustrating the principle of a ruled line extraction device according to the present invention.

【図2】罫線抽出装置の機能ブロック図である。FIG. 2 is a functional block diagram of the ruled line extraction device.

【図3】情報処理装置の構成図である。FIG. 3 is a configuration diagram of an information processing apparatus.

【図4】データ構造を示す図である。FIG. 4 is a diagram showing a data structure.

【図5】ラベリング処理を示す図である。FIG. 5 is a diagram showing a labeling process.

【図6】高さのヒストグラムを示す図である。FIG. 6 is a diagram showing a height histogram.

【図7】高さの最頻値を求めるためのヒストグラムを示
す図である。
FIG. 7 is a diagram showing a histogram for obtaining a mode value of height.

【図8】矩形高さテーブルを示す図である。FIG. 8 is a diagram showing a rectangular height table.

【図9】矩形高さテーブルの内容に対応するヒストグラ
ムを示す図である。
FIG. 9 is a diagram showing a histogram corresponding to the contents of a rectangular height table.

【図10】マスク処理を示す図である。FIG. 10 is a diagram showing a mask process.

【図11】線分検出処理を示す図である。FIG. 11 is a diagram showing a line segment detection process.

【図12】第1の線分統合処理を示す図である。FIG. 12 is a diagram showing a first line segment integration process.

【図13】第2の線分統合処理を示す図である。FIG. 13 is a diagram showing a second line segment integration process.

【図14】直線探索処理を示す図である。FIG. 14 is a diagram showing a straight line search process.

【図15】完全重複直線の統合処理を示す図である。FIG. 15 is a diagram showing a process of integrating completely overlapped straight lines.

【図16】第1の直線除去処理を示す図である。FIG. 16 is a diagram illustrating a first straight line removal process.

【図17】第2の直線除去処理を示す図である。FIG. 17 is a diagram illustrating a second straight line removal process.

【図18】除去すべきではない直線を示す図である。FIG. 18 illustrates a straight line that should not be removed.

【図19】第3の直線除去処理を示す図である。FIG. 19 is a diagram illustrating a third straight line removal process.

【図20】部分重複直線の統合処理を示す図である。FIG. 20 is a diagram showing a process of integrating partially overlapping straight lines.

【図21】部分重複直線の内部を示す図である。FIG. 21 is a diagram showing the inside of a partially overlapping straight line.

【図22】第4の直線除去処理を示す図である。FIG. 22 is a diagram illustrating a fourth straight line removal process.

【図23】2本の直線間の距離値の求め方を示す図であ
る。
FIG. 23 is a diagram showing how to obtain a distance value between two straight lines.

【図24】第5の直線除去処理を示す図である。FIG. 24 is a diagram illustrating a fifth straight line removal process.

【図25】横線分の統合処理後の画像を示す図である。FIG. 25 is a diagram showing an image after horizontal line integration processing;

【図26】完全重複直線の統合処理前の画像を示す図で
ある。
FIG. 26 is a diagram showing an image of a completely overlapping straight line before integration processing.

【図27】完全重複直線の統合処理後の画像を示す図で
ある。
FIG. 27 is a diagram showing an image after a completely overlapping straight line is integrated.

【図28】直線の形、位置と縦横直線の接続関係による
除去処理後の画像を示す図である。
FIG. 28 is a diagram showing an image after removal processing based on the connection relationship between the shape and position of the straight line and the vertical and horizontal straight lines.

【図29】部分重複直線の統合処理前の画像を示す図で
ある。
FIG. 29 is a diagram showing an image before a partial overlapping straight line integration process.

【図30】部分重複直線の統合処理後の画像を示す図で
ある。
FIG. 30 is a diagram showing an image after a process of integrating partially overlapping straight lines;

【図31】ほぼ完全に重複する直線の除去処理前の画像
を示す図である。
FIG. 31 is a diagram showing an image before a straight line that is almost completely overlapped is removed.

【図32】ほぼ完全に重複する直線の除去処理後の画像
を示す図である。
FIG. 32 is a diagram showing an image after a process of removing almost completely overlapping straight lines.

【図33】大きな線分だけからなる直線の除去処理前の
画像を示す図である。
FIG. 33 is a diagram showing an image before a process of removing a straight line composed of only large line segments;

【図34】大きな線分だけからなる直線の除去処理後の
画像を示す図である。
FIG. 34 is a diagram showing an image after the removal processing of a straight line consisting only of a large line segment.

【図35】線分シフトによる直線チェック/除去処理前
の画像を示す図である。
FIG. 35 is a diagram showing an image before straight line check / removal processing by line segment shift.

【図36】線分シフトによる直線チェック/除去処理後
の画像を示す図である。
FIG. 36 is a diagram showing an image after a straight line check / removal process by line segment shift.

【図37】線分統合処理のフローチャート(その1)で
ある。
FIG. 37 is a flowchart (part 1) of a line segment integration process.

【図38】線分統合処理のフローチャート(その2)で
ある。
FIG. 38 is a flowchart (part 2) of a line segment integration process.

【図39】線分統合処理のフローチャート(その3)で
ある。
FIG. 39 is a flowchart (part 3) of the line segment integration process.

【図40】線分統合処理のフローチャート(その4)で
ある。
FIG. 40 is a flowchart (part 4) of a line segment integration process.

【図41】線分統合処理のフローチャート(その5)で
ある。
FIG. 41 is a flowchart (part 5) of the line segment integration process.

【図42】直線のチェック/除去処理のフローチャート
(その1)である。
FIG. 42 is a flowchart (part 1) of a straight line check / removal process;

【図43】直線のチェック/除去処理のフローチャート
(その2)である。
FIG. 43 is a flowchart (part 2) of a straight line check / removal process;

【図44】直線のチェック/除去処理のフローチャート
(その3)である。
FIG. 44 is a flowchart (part 3) of a straight line check / removal process;

【図45】直線のチェック/除去処理のフローチャート
(その4)である。
FIG. 45 is a flowchart (part 4) of a straight line check / removal process;

【図46】直線のチェック/除去処理のフローチャート
(その5)である。
FIG. 46 is a flowchart (part 5) of a straight line check / removal process;

【図47】直線のチェック/除去処理のフローチャート
(その6)である。
FIG. 47 is a flowchart (part 6) of a straight line check / removal process;

【図48】単純な表形式枠を示す図である。FIG. 48 is a diagram showing a simple tabular frame.

【図49】複雑な表形式枠を示す図である。FIG. 49 is a diagram showing a complicated tabular frame.

【図50】罫線抽出の困難な表形式枠を示す図である。FIG. 50 is a diagram showing a tabular frame in which it is difficult to extract ruled lines.

【符号の説明】[Explanation of symbols]

1 推定手段 2 格納手段 3 線分抽出手段 4 計算手段 5 直線抽出手段 6 グラフ生成手段 7 直線処理手段 8 直線統合手段 9 直線除去手段 11 入力パターン 12 縮小処理部 13 連結パターン抽出部 14 マスク処理部 15 横直線抽出部 16 縦直線抽出部 31 CPU 32 メモリ 33 入力装置 34 出力装置 35 外部記憶装置 36 媒体駆動装置 37 ネットワーク接続装置 38 光電変換装置 39 バス 40 可搬記録媒体 40′ データベース 41 画像情報 42 表情報 43 セル情報 44 直線情報 45 線分情報 51、52、53、54、55、56、57、58 パ
ターン 61 ワイルドカード 62、63、64、65、66、67、68、69、7
0、71、72、73、76、79、80、81、8
2、83、84、85、86、87、88、89、9
0、91、92、93、101、102、103、10
4、105、106、107、108、109、11
0、111、112、113、121、122、12
3、124、125、126、131、141、15
1、152、153直線矩形 74、75、77、78 端点 94、95 線分矩形 96、97 グラフ
DESCRIPTION OF SYMBOLS 1 Estimation means 2 Storage means 3 Line extraction means 4 Calculation means 5 Straight line extraction means 6 Graph generation means 7 Straight line processing means 8 Straight line integration means 9 Straight line removal means 11 Input pattern 12 Reduction processing unit 13 Connection pattern extraction unit 14 Mask processing unit Reference Signs List 15 horizontal straight line extraction unit 16 vertical straight line extraction unit 31 CPU 32 memory 33 input device 34 output device 35 external storage device 36 medium drive device 37 network connection device 38 photoelectric conversion device 39 bus 40 portable recording medium 40 'database 41 image information 42 Table information 43 Cell information 44 Straight line information 45 Line segment information 51, 52, 53, 54, 55, 56, 57, 58 Pattern 61 Wild card 62, 63, 64, 65, 66, 67, 68, 69, 7
0, 71, 72, 73, 76, 79, 80, 81, 8
2, 83, 84, 85, 86, 87, 88, 89, 9
0, 91, 92, 93, 101, 102, 103, 10
4, 105, 106, 107, 108, 109, 11
0, 111, 112, 113, 121, 122, 12
3, 124, 125, 126, 131, 141, 15
1, 152, 153 Straight rectangles 74, 75, 77, 78 Endpoints 94, 95 Segment rectangles 96, 97 Graph

Claims (44)

【特許請求の範囲】[Claims] 【請求項1】 入力画像に含まれる標準パターンの大き
さを推定する推定手段と、 前記標準パターンの大きさの情報に基づいてしきい値を
設定し、該しきい値を用いて、前記入力画像から1つ以
上の直線パターンの情報を抽出する直線抽出手段とを備
えることを特徴とする罫線抽出装置。
An estimating means for estimating a size of a standard pattern included in an input image; a threshold value being set based on information on the size of the standard pattern; A line extracting unit for extracting information of one or more linear patterns from an image.
【請求項2】 前記推定手段は、前記入力画像に含まれ
る文字パターンの大きさを前記標準パターンの大きさと
して推定することを特徴とする請求項1記載の罫線抽出
装置。
2. The ruled line extraction device according to claim 1, wherein the estimating unit estimates a size of a character pattern included in the input image as a size of the standard pattern.
【請求項3】 前記推定手段は、前記入力画像に含まれ
る画素連結領域の大きさのヒストグラムから、前記標準
パターンの大きさを推定することを特徴とする請求項1
記載の罫線抽出装置。
3. The method according to claim 1, wherein the estimating unit estimates the size of the standard pattern from a histogram of the size of the pixel connection region included in the input image.
Ruled line extraction device as described.
【請求項4】 前記直線抽出手段は、前記1つ以上の直
線パターンのうちの1つの形に関する情報と、該1つ以
上の直線パターンに含まれる2つの直線パターンの間の
距離に関する情報のうち、少なくとも一方の情報と、前
記しきい値とを用いて、該1つ以上の直線パターンのう
ちの1つを除去するかどうかを判定する直線除去手段を
さらに備えることを特徴とする請求項1記載の罫線抽出
装置。
4. The information processing apparatus according to claim 1, wherein said straight line extracting means includes information on one of said one or more straight line patterns and information on a distance between two straight line patterns included in said one or more straight line patterns. And a straight line removing unit that determines whether to remove one of the one or more straight line patterns using at least one of the information and the threshold value. Ruled line extraction device as described.
【請求項5】 前記直線抽出手段は、前記1つ以上の直
線パターンに含まれる横直線パターンと縦直線パターン
の接続関係と前記しきい値に基づき、該横直線パターン
と縦直線パターンのうちの一方を除去するかどうかを判
定する直線除去手段をさらに備えることを特徴とする請
求項1記載の罫線抽出装置。
5. The straight line extracting means, based on a connection relationship between a horizontal straight line pattern and a vertical straight line pattern included in the one or more straight line patterns and the threshold value, of the horizontal straight line pattern and the vertical straight line pattern. 2. The ruled line extracting device according to claim 1, further comprising a straight line removing unit that determines whether to remove one of the ruled lines.
【請求項6】 前記直線抽出手段は、前記しきい値を用
いて、前記1つ以上の直線パターンに含まれ、ほとんど
重複する2つの直線パターンのうちの、短い方を除去す
るかどうかを判定する直線除去手段をさらに備えること
を特徴とする請求項1記載の罫線抽出装置。
6. The straight line extracting means determines, using the threshold value, whether to remove a shorter one of two almost overlapping straight line patterns included in the one or more straight line patterns. 2. The ruled line extracting apparatus according to claim 1, further comprising a straight line removing means for performing the rule.
【請求項7】 入力画像から1つ以上の直線パターンの
情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンの大きさの代表値を求める
計算手段と、 前記代表値に基づいてしきい値を設定し、該しきい値を
用いて、前記1つ以上の直線パターンの情報を処理する
直線処理手段とを備えることを特徴とする罫線抽出装
置。
7. A straight line extracting means for extracting information of one or more straight line patterns from an input image; a calculating means for calculating a representative value of the size of the one or more straight line patterns; A rule processing unit for setting a threshold value and processing the information of the one or more linear patterns using the threshold value.
【請求項8】 前記計算手段は、前記1つ以上の直線パ
ターンに含まれる横直線パターンの高さのヒストグラム
と縦直線パターンの幅のヒストグラムのうちの1つか
ら、前記代表値を求めることを特徴とする請求項7記載
の罫線抽出装置。
8. The method according to claim 1, wherein the calculating unit calculates the representative value from one of a histogram of the height of the horizontal linear pattern and a histogram of the width of the vertical linear pattern included in the one or more linear patterns. The ruled line extraction device according to claim 7, wherein
【請求項9】 前記直線処理手段は、前記1つ以上の直
線パターンのうち部分的に重複する2つの直線パターン
を統合してできる直線パターンの大きさが、前記代表値
程度になる場合に、統合後の直線パターンを罫線候補と
する直線統合手段を備えることを特徴とする請求項7記
載の罫線抽出装置。
9. The method according to claim 1, wherein the linear processing unit is configured such that when a linear pattern formed by integrating two partially overlapping linear patterns of the one or more linear patterns is approximately the representative value, 8. The ruled line extracting device according to claim 7, further comprising a straight line integrating unit that uses the straight line pattern after integration as a ruled line candidate.
【請求項10】 入力画像から1つ以上の直線パターン
の情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンを構成する1つ以上の線分
パターンの大きさの代表値を求める計算手段と、 前記代表値に基づいてしきい値を設定し、該しきい値を
用いて、前記1つ以上の直線パターンの情報を処理する
直線処理手段とを備えることを特徴とする罫線抽出装
置。
10. A straight line extracting means for extracting information of one or more straight line patterns from an input image, and a calculation for obtaining a representative value of a size of one or more line segment patterns constituting said one or more straight line patterns. Means for setting a threshold value based on the representative value, and using the threshold value to process the information of the one or more linear patterns. .
【請求項11】 前記計算手段は、前記1つ以上の線分
パターンに含まれる横線分パターンの高さのヒストグラ
ムと縦直線パターンの幅のヒストグラムのうちの1つか
ら、前記代表値を求めることを特徴とする請求項10記
載の罫線抽出装置。
11. The calculating means obtains the representative value from one of a histogram of a height of a horizontal line segment pattern and a histogram of a width of a vertical line pattern included in the one or more line segment patterns. The ruled line extraction device according to claim 10, wherein:
【請求項12】 前記直線処理手段は、前記1つ以上の
直線パターンのうち、前記しきい値より大きな線分パタ
ーンだけで構成されている直線パターンを除去する直線
除去手段を備えることを特徴とする請求項10記載の罫
線抽出装置。
12. The straight line processing unit includes a straight line removing unit that removes a straight line pattern formed of only line segment patterns larger than the threshold value from the one or more straight line patterns. 11. The ruled line extraction device according to claim 10.
【請求項13】 入力画像から1つ以上の線分パターン
の情報を抽出する線分抽出手段と、 前記1つ以上の線分パターンの情報を、大きな線分パタ
ーンの情報と小さな線分パターンの情報とに区別して格
納する格納手段と、 前記1つ以上の線分パターンの接続状態を調べ、途中に
前記大きな線分パターンが存在するとき、該大きな線分
パターンの大きさに関わらず、他の複数の線分パターン
が構成する直線パターンを抽出する直線抽出手段とを備
えることを特徴とする罫線抽出装置。
13. A line segment extraction unit for extracting information of one or more line segment patterns from an input image, and combining the information of the one or more line segment patterns with information of a large line segment pattern and a small line segment pattern. A storage unit for storing information separately from the information; and checking a connection state of the one or more line segment patterns. When the large line segment pattern exists in the middle, regardless of the size of the large line segment pattern, And a straight line extracting means for extracting a straight line pattern formed by the plurality of line segment patterns.
【請求項14】 入力画像から1つ以上の直線パターン
の情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンに含まれる2つの直線パタ
ーンがほとんど重複する場合に、該2つの直線パターン
を1つに統合する直線統合手段とを備えることを特徴と
する罫線抽出装置。
14. A straight line extracting means for extracting information of one or more straight line patterns from an input image, and wherein the two straight line patterns included in the one or more straight line patterns substantially overlap each other. And a straight line integrating means for integrating the ruled lines into one.
【請求項15】 入力画像から1つ以上の直線パターン
の情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンのうちの1つの形に関する
情報と、該1つ以上の直線パターンに含まれる2つの直
線パターンの間の距離に関する情報のうち、少なくとも
一方の情報を用いて、該1つ以上の直線パターンのうち
の1つを除去するかどうかを判定する直線除去手段とを
備えることを特徴とする罫線抽出装置。
15. A straight line extracting means for extracting information of one or more straight line patterns from an input image, information on a shape of one of the one or more straight line patterns, and information included in the one or more straight line patterns. Line removing means for determining whether to remove one of the one or more linear patterns by using at least one of the information on the distance between the two linear patterns to be removed. Ruled line extraction device.
【請求項16】 入力画像から1つ以上の直線パターン
の情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンに含まれる横直線パターン
と縦直線パターンの接続関係に基づき、該横直線パター
ンと縦直線パターンのうちの一方を除去するかどうかを
判定する直線除去手段とを備えることを特徴とする罫線
抽出装置。
16. A straight line extracting means for extracting information of one or more straight line patterns from an input image; A ruled line extracting apparatus comprising: a straight line removing unit that determines whether to remove one of a pattern and a vertical straight line pattern.
【請求項17】 入力画像から1つ以上の直線パターン
の情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンに含まれ、ほとんど重複す
る2つの直線パターンのうちの、短い方を除去する直線
除去手段とを備えることを特徴とする罫線抽出装置。
17. A straight line extracting means for extracting information of one or more straight line patterns from an input image, and removing a shorter one of two almost straight line patterns included in the one or more straight line patterns. A ruler line extracting device, comprising:
【請求項18】 入力画像から1つ以上の直線パターン
の情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンのうち部分的に重複する2
つの直線パターンを統合してできる直線パターンの大き
さが所定値程度になる場合に、統合後の直線パターンを
罫線候補とする直線統合手段とを備えることを特徴とす
る罫線抽出装置。
18. A straight line extracting means for extracting information of one or more straight line patterns from an input image, wherein the one or more straight line patterns partially overlap each other.
A ruled line extracting device, comprising: a line integrating unit that sets the line pattern after integration to a ruled line candidate when the size of a linear pattern formed by integrating two linear patterns is approximately a predetermined value.
【請求項19】 入力画像から1つ以上の直線パターン
の情報を抽出する直線抽出手段と、 前記1つ以上の直線パターンのうち、しきい値より大き
な線分パターンだけで構成されている直線パターンを除
去する直線除去手段とを備えることを特徴とする罫線抽
出装置。
19. A straight line extracting means for extracting information of one or more straight line patterns from an input image, and a straight line pattern comprising only a line segment pattern larger than a threshold value among the one or more straight line patterns. And a straight line removing unit for removing a ruled line.
【請求項20】 入力画像から直線パターンの情報を抽
出する直線抽出手段と、 前記直線パターンを構成する1つ以上の線分パターンの
うち、標準的な大きさの線分パターンの内部の画素数を
求めて、該直線パターンの周囲における画素数のグラフ
を生成するグラフ生成手段と、 前記グラフの形状に基づいて、前記直線パターンを除去
するかどうかを判定する直線除去手段とを備えることを
特徴とする罫線抽出装置。
20. A straight line extracting means for extracting information on a straight line pattern from an input image, and the number of pixels inside a standard size line segment pattern among one or more line segment patterns constituting the straight line pattern. And a graph generation means for generating a graph of the number of pixels around the straight line pattern, and a straight line removing means for determining whether to remove the straight line pattern based on the shape of the graph. Ruled line extraction device.
【請求項21】 前記1つ以上の線分パターンのうちの
大きな線分パターンの情報にマークを付けて、該1つ以
上の線分パターンの情報を格納する格納手段をさらに備
え、前記グラフ生成手段は、前記1つ以上の線分パター
ンのうちマークが付いていない線分パターンを、前記標
準的な大きさの線分パターンとみなすことを特徴とする
請求項20記載の罫線抽出装置。
21. The apparatus according to claim 21, further comprising a storage unit for marking information on a large line segment pattern among the one or more line segment patterns and storing the information on the one or more line segment patterns. 21. The ruled line extracting apparatus according to claim 20, wherein the means regards a line segment pattern having no mark among the one or more line segment patterns as the standard-sized line segment pattern.
【請求項22】 前記グラフ生成手段は、前記標準的な
大きさの線分パターンを前記直線パターンの長さ方向と
垂直にシフトさせて、シフト量と画素数との関係を表す
前記グラフを生成し、前記直線除去手段は、該グラフの
形状がなだらかな場合に該直線パターンを除去すること
を特徴とする請求項20記載の罫線抽出装置。
22. The graph generating means generates the graph representing the relationship between the shift amount and the number of pixels by shifting the standard size line segment pattern perpendicular to the length direction of the linear pattern. 21. The ruled line extraction device according to claim 20, wherein the straight line removing unit removes the straight line pattern when the shape of the graph is gentle.
【請求項23】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像に含まれる標準パターンの大きさを推定する機
能と、 前記標準パターンの大きさの情報に基づいてしきい値を
設定する機能と、前記しきい値を用いて、前記入力画像
から1つ以上の直線パターンの情報を抽出する機能とを
前記コンピュータに実現させるためのプログラムを記録
したコンピュータ読み取り可能な記録媒体。
23. A recording medium recording a program for a computer, comprising: a function of estimating the size of a standard pattern included in an input image; and a threshold value based on information on the size of the standard pattern. A computer-readable recording medium recording a program for causing the computer to realize a function of setting and a function of extracting information of one or more linear patterns from the input image using the threshold value.
【請求項24】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンの大きさの代表値を求める
機能と、 前記代表値に基づいてしきい値を設定する機能と、 前記しきい値を用いて、前記1つ以上の直線パターンの
情報を処理する機能とを前記コンピュータに実現させる
ためのプログラムを記録したコンピュータ読み取り可能
な記録媒体。
24. A recording medium on which a program for a computer is recorded, wherein a function of extracting information of one or more linear patterns from an input image, and a representative value of a size of the one or more linear patterns is provided. A program for causing the computer to realize a function to determine, a function to set a threshold value based on the representative value, and a function to process information of the one or more linear patterns using the threshold value A computer-readable recording medium on which is recorded.
【請求項25】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンを構成する1つ以上の線分
パターンの大きさの代表値を求める機能と、 前記代表値に基づいてしきい値を設定する機能と、 前記しきい値を用いて、前記1つ以上の直線パターンの
情報を処理する機能とを前記コンピュータに実現させる
ためのプログラムを記録したコンピュータ読み取り可能
な記録媒体。
25. A recording medium recording a program for a computer, comprising: a function of extracting information of one or more linear patterns from an input image; A function of obtaining a representative value of the size of the line segment pattern; a function of setting a threshold based on the representative value; and a function of processing information of the one or more linear patterns using the threshold. And a computer-readable recording medium recording a program for causing the computer to realize the above.
【請求項26】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の線分パターンの情報を抽出する
機能と、 前記1つ以上の線分パターンの情報を、大きな線分パタ
ーンの情報と小さな線分パターンの情報とに区別する機
能と、 前記1つ以上の線分パターンの接続状態を調べ、途中に
前記大きな線分パターンが存在するとき、該大きな線分
パターンの大きさに関わらず、他の複数の線分パターン
が構成する直線パターンを抽出する機能とを前記コンピ
ュータに実現させるためのプログラムを記録したコンピ
ュータ読み取り可能な記録媒体。
26. A recording medium recording a program for a computer, comprising: a function of extracting information of one or more line segment patterns from an input image; A function for distinguishing between line segment pattern information and small line segment pattern information; and checking a connection state of the one or more line segment patterns, and when the large line segment pattern exists in the middle, the large line segment pattern A computer-readable recording medium storing a program for causing the computer to realize a function of extracting a straight line pattern formed by a plurality of other line segment patterns regardless of the size of the line segment pattern.
【請求項27】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンに含まれる2つの直線パタ
ーンがほとんど重複する場合に、該2つの直線パターン
を1つに統合する機能とを前記コンピュータに実現させ
るためのプログラムを記録したコンピュータ読み取り可
能な記録媒体。
27. A recording medium storing a program for a computer, comprising: a function of extracting information of one or more linear patterns from an input image; and two linear patterns included in the one or more linear patterns. A computer-readable recording medium on which a program for causing the computer to realize the function of integrating the two linear patterns into one when almost overlaps is recorded.
【請求項28】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンのうちの1つの形に関する
情報と、該1つ以上の直線パターンに含まれる2つの直
線パターンの間の距離に関する情報のうち、少なくとも
一方の情報を用いて、該1つ以上の直線パターンのうち
の1つを除去するかどうかを判定する機能とを前記コン
ピュータに実現させるためのプログラムを記録したコン
ピュータ読み取り可能な記録媒体。
28. A recording medium on which a program for a computer is recorded, comprising: a function of extracting information of one or more linear patterns from an input image; and a form relating to one of the one or more linear patterns. Whether one of the one or more linear patterns is removed using at least one of information and information on a distance between two linear patterns included in the one or more linear patterns. A computer-readable recording medium that stores a program for causing the computer to realize the function of determining whether the program is executed.
【請求項29】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンに含まれる横直線パターン
と縦直線パターンの接続関係に基づき、該横直線パター
ンと縦直線パターンのうちの一方を除去するかどうかを
判定する機能とを前記コンピュータに実現させるための
プログラムを記録したコンピュータ読み取り可能な記録
媒体。
29. A recording medium storing a program for a computer, comprising: a function of extracting information of one or more linear patterns from an input image; and a horizontal linear pattern included in the one or more linear patterns. A computer-readable storage medium storing a program for causing the computer to realize a function of determining whether to remove one of the horizontal linear pattern and the vertical linear pattern based on a connection relationship between the vertical linear patterns.
【請求項30】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンに含まれ、ほとんど重複す
る2つの直線パターンのうちの、短い方を除去する機能
とを前記コンピュータに実現させるためのプログラムを
記録したコンピュータ読み取り可能な記録媒体。
30. A recording medium on which a program for a computer is recorded, wherein a function of extracting information of one or more linear patterns from an input image is included in the one or more linear patterns, and substantially overlaps the function. A computer-readable storage medium storing a program for causing the computer to realize a function of removing a shorter one of two linear patterns.
【請求項31】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンのうち部分的に重複する2
つの直線パターンを統合してできる直線パターンの大き
さが所定値程度になる場合に、統合後の直線パターンを
罫線候補とする機能とを前記コンピュータに実現させる
ためのプログラムを記録したコンピュータ読み取り可能
な記録媒体。
31. A recording medium on which a program for a computer is recorded, wherein a function of extracting information of one or more linear patterns from an input image partially overlaps the one or more linear patterns. 2
When the size of a straight line pattern formed by integrating two straight line patterns is about a predetermined value, a computer-readable program that records a program for causing the computer to realize the function of using the straight line pattern after integration as ruled line candidates is provided. recoding media.
【請求項32】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から1つ以上の直線パターンの情報を抽出する
機能と、 前記1つ以上の直線パターンのうち、しきい値より大き
な線分パターンだけで構成されている直線パターンを除
去する機能とを前記コンピュータに実現させるためのプ
ログラムを記録したコンピュータ読み取り可能な記録媒
体。
32. A recording medium on which a program for a computer is recorded, comprising: a function of extracting information of one or more linear patterns from an input image; A computer-readable storage medium storing a program for causing the computer to realize a function of removing a straight line pattern composed only of a large line segment pattern.
【請求項33】 コンピュータのためのプログラムを記
録した記録媒体であって、 入力画像から直線パターンの情報を抽出する機能と、 前記直線パターンを構成する1つ以上の線分パターンの
うち、標準的な大きさの線分パターンの内部の画素数を
求めて、該直線パターンの周囲における画素数のグラフ
を生成する機能と、 前記グラフの形状に基づいて、前記直線パターンを除去
するかどうかを判定する機能とを前記コンピュータに実
現させるためのプログラムを記録したコンピュータ読み
取り可能な記録媒体。
33. A recording medium recording a program for a computer, comprising: a function of extracting information of a linear pattern from an input image; and a standard one or more of line segment patterns constituting the linear pattern. A function of obtaining the number of pixels inside a line segment pattern having a large size and generating a graph of the number of pixels around the linear pattern; and determining whether to remove the linear pattern based on the shape of the graph. And a computer-readable recording medium on which a program for causing the computer to perform the functions described above is recorded.
【請求項34】 入力画像に含まれる標準パターンの大
きさを推定し、 前記標準パターンの大きさの情報に基づいてしきい値を
設定し、 前記しきい値を用いて、前記入力画像から1つ以上の直
線パターンの情報を抽出することを特徴とする罫線抽出
方法。
34. Estimating the size of a standard pattern included in an input image, setting a threshold value based on the information on the size of the standard pattern, and using the threshold value to calculate 1 from the input image. A method for extracting ruled lines, comprising extracting information of one or more linear patterns.
【請求項35】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンの大きさの代表値を求め、 前記代表値に基づいてしきい値を設定し、 前記しきい値を用いて、前記1つ以上の直線パターンの
情報を処理することを特徴とする罫線抽出方法。
35. extracting information of one or more linear patterns from an input image, obtaining a representative value of the size of the one or more linear patterns, setting a threshold based on the representative value, A method for extracting ruled lines, comprising processing information of the one or more linear patterns using a threshold value.
【請求項36】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンを構成する1つ以上の線分
パターンの大きさの代表値を求め、 前記代表値に基づいてしきい値を設定し、 前記しきい値を用いて、前記1つ以上の直線パターンの
情報を処理することを特徴とする罫線抽出方法。
36. Extracting information of one or more linear patterns from an input image, obtaining a representative value of one or more line segment patterns constituting the one or more linear patterns, Setting a threshold value based on the threshold value, and processing the information of the one or more linear patterns using the threshold value.
【請求項37】 入力画像から1つ以上の線分パターン
の情報を抽出し、 前記1つ以上の線分パターンの情報を、大きな線分パタ
ーンの情報と小さな線分パターンの情報とに区別し、 前記1つ以上の線分パターンの接続状態を調べ、途中に
前記大きな線分パターンが存在するとき、該大きな線分
パターンの大きさに関わらず、他の複数の線分パターン
が構成する直線パターンを抽出することを特徴とする罫
線抽出方法。
37. Extracting information of one or more line segment patterns from an input image, distinguishing the information of the one or more line segment patterns into information of a large line segment pattern and information of a small line segment pattern. Checking the connection state of the one or more line segment patterns and, when the large line segment pattern is present in the middle, regardless of the size of the large line segment pattern, a straight line formed by the other plurality of line segment patterns; A method for extracting a ruled line, comprising extracting a pattern.
【請求項38】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンに含まれる2つの直線パタ
ーンがほとんど重複する場合に、該2つの直線パターン
を1つに統合することを特徴とする罫線抽出方法。
38. Extracting information of one or more linear patterns from an input image, and, when two linear patterns included in the one or more linear patterns almost overlap, combining the two linear patterns into one A ruled line extraction method characterized by integrating.
【請求項39】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンのうちの1つの形に関する
情報と、該1つ以上の直線パターンに含まれる2つの直
線パターンの間の距離に関する情報のうち、少なくとも
一方の情報を用いて、該1つ以上の直線パターンのうち
の1つを除去するかどうかを判定することを特徴とする
罫線抽出方法。
39. Extracting information of one or more straight line patterns from an input image, information on one of the one or more straight line patterns, and two straight lines included in the one or more straight line patterns. A method for extracting ruled lines, comprising determining whether to remove one of the one or more linear patterns using at least one of information on a distance between patterns.
【請求項40】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンに含まれる横直線パターン
と縦直線パターンの接続関係に基づき、該横直線パター
ンと縦直線パターンのうちの一方を除去するかどうかを
判定することを特徴とする罫線抽出方法。
40. Extracting information of one or more linear patterns from an input image, and extracting the horizontal linear pattern and the vertical linear pattern based on a connection relationship between the horizontal linear pattern and the vertical linear pattern included in the one or more linear patterns. A method for extracting a ruled line, comprising determining whether to remove one of the patterns.
【請求項41】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンに含まれ、ほとんど重複す
る2つの直線パターンのうちの、短い方を除去すること
を特徴とする罫線抽出方法。
41. A method for extracting information of one or more linear patterns from an input image, and removing a shorter one of two linear patterns which are included in the one or more linear patterns and almost overlap with each other. Ruled line extraction method.
【請求項42】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンのうち部分的に重複する2
つの直線パターンを統合してできる直線パターンの大き
さが所定値程度になる場合に、統合後の直線パターンを
罫線候補とすることを特徴とする罫線抽出方法。
42. Extracting information of one or more linear patterns from an input image, and extracting at least one of
A ruled line extraction method characterized in that when the size of a straight line pattern formed by integrating two straight line patterns is about a predetermined value, the straight line pattern after integration is used as a ruled line candidate.
【請求項43】 入力画像から1つ以上の直線パターン
の情報を抽出し、 前記1つ以上の直線パターンのうち、しきい値より大き
な線分パターンだけで構成されている直線パターンを除
去することを特徴とする罫線抽出方法。
43. Extracting information of one or more linear patterns from an input image, and removing a linear pattern composed of only line segment patterns larger than a threshold value from the one or more linear patterns. A ruled line extraction method characterized by the following.
【請求項44】 入力画像から直線パターンの情報を抽
出し、 前記直線パターンを構成する1つ以上の線分パターンの
うち、標準的な大きさの線分パターンの内部の画素数を
求めて、該直線パターンの周囲における画素数のグラフ
を生成し、 前記グラフの形状に基づいて、前記直線パターンを除去
するかどうかを判定することを特徴とする罫線抽出方
法。
44. Extracting information of a straight line pattern from an input image, and calculating the number of pixels inside a standard size line segment pattern among one or more line segment patterns constituting the straight line pattern, A ruled line extraction method, comprising: generating a graph of the number of pixels around the linear pattern, and determining whether to remove the linear pattern based on the shape of the graph.
JP34685097A 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images Expired - Fee Related JP3565310B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP34685097A JP3565310B2 (en) 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8-342185 1996-12-20
JP34218596 1996-12-20
JP34685097A JP3565310B2 (en) 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images

Publications (2)

Publication Number Publication Date
JPH10232939A true JPH10232939A (en) 1998-09-02
JP3565310B2 JP3565310B2 (en) 2004-09-15

Family

ID=26577181

Family Applications (1)

Application Number Title Priority Date Filing Date
JP34685097A Expired - Fee Related JP3565310B2 (en) 1996-12-20 1997-12-16 Ruled line extracting apparatus and method for extracting ruled lines from general document images

Country Status (1)

Country Link
JP (1) JP3565310B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008061163A (en) * 2006-09-04 2008-03-13 Samsung Techwin Co Ltd Imaging apparatus and imaging method
JP2015145069A (en) * 2014-01-31 2015-08-13 キヤノン株式会社 Image formation apparatus, control method therefor, and program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008061163A (en) * 2006-09-04 2008-03-13 Samsung Techwin Co Ltd Imaging apparatus and imaging method
JP4588000B2 (en) * 2006-09-04 2010-11-24 三星デジタルイメージング株式会社 Imaging apparatus and imaging method
JP2015145069A (en) * 2014-01-31 2015-08-13 キヤノン株式会社 Image formation apparatus, control method therefor, and program

Also Published As

Publication number Publication date
JP3565310B2 (en) 2004-09-15

Similar Documents

Publication Publication Date Title
EP0854434B1 (en) Ruled line extracting apparatus for extracting ruled line from normal document image and method thereof
JP3904840B2 (en) Ruled line extraction device for extracting ruled lines from multi-valued images
EP1310912A2 (en) Image processing method, apparatus and system
JP3393098B2 (en) Apparatus and method for extracting user-enclosed area
US7796817B2 (en) Character recognition method, character recognition device, and computer product
US10423851B2 (en) Method, apparatus, and computer-readable medium for processing an image with horizontal and vertical text
JP2002042143A (en) Frame recognition device and recording medium
JP3411472B2 (en) Pattern extraction device
US20090316219A1 (en) Image processing apparatus, image processing method and computer-readable storage medium
JP2006085665A (en) Image processing device, image processing program, storage medium, image processing method, and image forming apparatus
JP4275973B2 (en) Retouched image extraction apparatus, program, storage medium, and retouched image extraction method
JP4049560B2 (en) Halftone dot removal method and system
JP2006253842A (en) Image processor, image forming apparatus, program, storage medium and image processing method
JP3565310B2 (en) Ruled line extracting apparatus and method for extracting ruled lines from general document images
JP4420440B2 (en) Image processing apparatus, image processing method, character recognition apparatus, program, and recording medium
JP2868134B2 (en) Image processing method and apparatus
JP2000090194A (en) Image processing method and image processor
US7103220B2 (en) Image processing apparatus, method and program, and storage medium
JPH11191135A (en) Japanese/english discriminating method for document image, document recognizing method and recording medium
JP3517077B2 (en) Pattern extraction device and method for extracting pattern area
JP3106080B2 (en) Image processing apparatus and method
JP4040231B2 (en) Character extraction method and apparatus, and storage medium
JP3406942B2 (en) Image processing apparatus and method
JP3534997B2 (en) Ruled line extraction device and method
JP2003317107A (en) Method and device for ruled-line detection

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040330

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040506

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040601

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040602

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20090618

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100618

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110618

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120618

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20120618

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130618

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20140618

Year of fee payment: 10

LAPS Cancellation because of no payment of annual fees