JP2016115088A - Document definition device, document definition method, and document definition program - Google Patents

Document definition device, document definition method, and document definition program Download PDF

Info

Publication number
JP2016115088A
JP2016115088A JP2014252479A JP2014252479A JP2016115088A JP 2016115088 A JP2016115088 A JP 2016115088A JP 2014252479 A JP2014252479 A JP 2014252479A JP 2014252479 A JP2014252479 A JP 2014252479A JP 2016115088 A JP2016115088 A JP 2016115088A
Authority
JP
Japan
Prior art keywords
keyword
rectangle
field
image data
character
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
JP2014252479A
Other languages
Japanese (ja)
Other versions
JP6220770B2 (en
Inventor
龍二 中村
Ryuji Nakamura
龍二 中村
加藤 光輝
Mitsuteru Kato
光輝 加藤
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.)
Ntt Data System Technologies Inc
NTT Data System Technologies Inc
NTT Data Group Corp
Original Assignee
Ntt Data System Technologies Inc
NTT Data Corp
NTT Data System Technologies Inc
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 Ntt Data System Technologies Inc, NTT Data Corp, NTT Data System Technologies Inc filed Critical Ntt Data System Technologies Inc
Priority to JP2014252479A priority Critical patent/JP6220770B2/en
Publication of JP2016115088A publication Critical patent/JP2016115088A/en
Application granted granted Critical
Publication of JP6220770B2 publication Critical patent/JP6220770B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

PROBLEM TO BE SOLVED: To generate definition information for associating a keyword to be associated with attributes of characters to be entered in a character frame of a document to be optionally selected with the character frame for the document.SOLUTION: Image data of a document is generated by optically reading the document, document image data is generated by binarizing the image data, corrected document image data is generated by performing correction for compensating a defect generated by binarization to the document image data, rectangular or approximate rectangular shapes are detected as squares from the corrected document image data, whether or not the squares are character frame square is determined, the character frame squares are classified based on adjacent relation of the character frame squares, each of classified categories is detected as a field, characters included in the document image data are detected, a keyword with which attributes of the characters to be entered in the field is preliminarily associated is detected from the characters, the field corresponding to the keyword is detected based on position relation between the keyword and the field, the detected field is stored by associating it with the keyword.SELECTED DRAWING: Figure 1

Description

本発明は、帳票定義装置、帳票定義方法、及び帳票定義プログラムに関する。   The present invention relates to a form definition device, a form definition method, and a form definition program.

紙媒体に印刷された文字等を光学的に読み取るスキャナを用いて帳票に手書きで記入された文字を読み取る前に、未記入の帳票に印刷された文字及び文字枠を検出するための画像を生成し、当該画像から印刷された文字及び文字枠の情報だけを読み取って記憶させておく。その後に、文字枠に手書きで文字が記入された帳票を読み取り、読み取った画像から手書き文字だけを抽出して記憶させておく。そして、手書き記入された文字の内容を確認したい場合に、記憶させてある文字及び文字枠の情報と、手書き文字の情報とを重ねあわせて画面に表示するといった帳票に表示されている内容を分離して処理を行う技術が存在する(例えば、特許文献1参照)。   Generate an image to detect characters and character frames printed on blank forms before reading the characters handwritten on the form using a scanner that optically reads characters printed on paper media. Then, only information on characters and character frames printed from the image is read and stored. Thereafter, a form in which characters are handwritten in a character frame is read, and only handwritten characters are extracted from the read image and stored. Then, when you want to check the contents of the handwritten characters, separate the contents displayed in the form such as displaying the information of the stored characters and character frames and the information of the handwritten characters on the screen. Thus, there is a technique for performing processing (see, for example, Patent Document 1).

ところで、帳票においては、文字枠の周辺に「氏名」、「口座番号」などの印刷文字をキーワードとして示すことにより、帳票の各々の文字枠にどのような文字を記入するかを記入者に示すようにしている。このような、キーワードを、コンピュータによる帳票処理において利用することができれば、文字枠に手書きで記入された内容が、明らかに間違っていないか等をチェックすることが可能となる。例えば、「氏名」というキーワードが存在するにも関わらず、キーワードに対応する文字枠に数値が記載されていた場合には、明らかに誤っているものとしてコンピュータによる文字の認識処理の際にチェックすることができる。   By the way, in the form, by showing the print characters such as “name” and “account number” as keywords around the character frame, the character who fills in each character frame of the form is shown to the writer. I am doing so. If such a keyword can be used in a form processing by a computer, it is possible to check whether or not the contents handwritten in the character frame are clearly wrong. For example, if a numerical value is written in the character box corresponding to the keyword even though the keyword "name" exists, it is checked that the character is clearly mistaken during character recognition processing by the computer. be able to.

特許第4269059号公報Japanese Patent No. 4269059

従来、コンピュータを用いた帳票処理において、上記のような帳票に印刷されるキーワードを利用するためには、帳票の作成の段階から、コンピュータを用いて、ユーザが手作業で、キーワードや文字枠を配置する位置を定義し、さらに、文字枠に記載される文字の種類などを示す属性を定義していく必要があった。
しかしながら、上記のような定義を行う作業は、ユーザの手作業によるものであるため、様々な様式が存在する帳票の各々に対応するためには、多大な労力を要する作業であるという問題がある。また、上述したような従来技術によっても、帳票を読み取った画像から、キーワードと文字枠とを対応付けるような定義情報を生成することができない問題がある。
Conventionally, in order to use a keyword printed on a form as described above in a form processing using a computer, a user can manually enter a keyword and a character frame from the stage of form creation using a computer. It was necessary to define the position to be arranged and to further define attributes indicating the type of character described in the character frame.
However, since the work for defining as described above is based on the manual work of the user, there is a problem that it is a work that requires a great deal of labor in order to deal with each form having various styles. . Further, even with the above-described conventional technology, there is a problem that definition information that associates a keyword with a character frame cannot be generated from an image obtained by reading a form.

本発明は、上記問題を解決すべくなされたもので、その目的は、任意に選択される帳票について、当該帳票の文字枠に記入される文字の属性に関連付けられるキーワードと当該文字枠とを対応付ける定義情報を生成していくことを可能とする帳票定義装置、帳票定義方法、及び帳票定義プログラムを提供することにある。   The present invention has been made to solve the above-described problem, and an object of the present invention is to associate a keyword associated with an attribute of a character written in a character frame of the form with the character frame for an arbitrarily selected form. The object is to provide a form definition device, a form definition method, and a form definition program capable of generating definition information.

上記問題を解決するために、本発明の一態様は、帳票を光学的に読み取り帳票の画像データを生成する画像読取部と、前記画像データを2値化して帳票画像データを生成する2値化部と、前記帳票画像データに対して前記2値化により生じた欠損を埋める補正をして補正帳票画像データを生成する補正部と、前記補正帳票画像データから長方形または略長方形の形状を矩形として検出する矩形検出部と、前記矩形が文字枠矩形であるか否かを判定する矩形判定部と、前記文字枠矩形の隣接関係に基づいて、前記文字枠矩形を分類し、分類した区分の各々をフィールドとして検出するフィールド検出部と、前記帳票画像データに含まれる文字を検出する文字検出部と、前記フィールドに記入される文字の属性が予め対応付けられるキーワードを前記文字から検出するキーワード検出部と、前記キーワードに対応する前記フィールドを、前記キーワードと前記フィールドの位置関係に基づいて検出し、検出した前記フィールドを前記キーワードに対応付けて帳票定義情報記憶部に書き込むフィールド探索部と、を備えることを特徴とする帳票定義装置である。   In order to solve the above problem, an aspect of the present invention includes an image reading unit that optically reads a form and generates image data of the form, and binarization that generates form image data by binarizing the image data. A correction unit that generates correction form image data by correcting a defect generated by the binarization with respect to the form image data, and a rectangular or substantially rectangular shape from the correction form image data as a rectangle A rectangle detection unit to detect, a rectangle determination unit that determines whether or not the rectangle is a character frame rectangle, and classifies the character frame rectangles based on the adjacent relationship of the character frame rectangles, and each of the classified categories A field detection unit for detecting a character as a field, a character detection unit for detecting a character included in the form image data, and a keyword associated with a character attribute to be written in the field in advance. A keyword detection unit that detects from a written character; and the field corresponding to the keyword is detected based on a positional relationship between the keyword and the field, and the detected field is associated with the keyword in a form definition information storage unit. A form definition device comprising a field search unit for writing.

また、本発明の一態様は、上記に記載の発明において、前記キーワードとして検出対象とする文字列または文字が予め定められており、前記キーワード検出部は、前記文字から前記キーワードを検出する際、前記予め定められている前記検出対象とする文字列または文字に完全一致、または、部分一致する前記キーワードのみを検出するようにしてもよい。   Further, according to one aspect of the present invention, in the above-described invention, a character string or a character to be detected is predetermined as the keyword, and the keyword detecting unit detects the keyword from the character. Only the keyword that completely matches or partially matches the predetermined character string or character to be detected may be detected.

また、本発明の一態様は、上記に記載の発明において、前記キーワードに対応する前記属性を示す属性情報を予め記憶する辞書属性情報記憶部を備え、前記キーワード検出部は、
前記文字から前記キーワードを検出すると、前記キーワードに対応する前記属性情報を前記辞書属性情報記憶部から読み出し、読み出した前記属性情報を前記キーワードに対応付けて前記帳票定義情報記憶部に書き込むようにしてもよい。
One aspect of the present invention is the above-described invention, further comprising a dictionary attribute information storage unit that stores in advance attribute information indicating the attribute corresponding to the keyword, and the keyword detection unit includes:
When the keyword is detected from the characters, the attribute information corresponding to the keyword is read from the dictionary attribute information storage unit, and the read attribute information is written in the form definition information storage unit in association with the keyword. Also good.

また、本発明の一態様は、上記に記載の発明において、前記キーワードと前記フィールドの位置関係とは、前記キーワードが縦書きの場合に予め定められる前記フィールドが存在する方向の傾向、または、前記キーワードが横書きの場合に予め定められる前記フィールドが存在する方向の傾向によって示され、前記フィールド探索部は、前記フィールドが前記傾向を満たす場合に、当該フィールドを前記キーワードに対応する前記フィールドとして検出するようにしてもよい。   Further, according to one aspect of the present invention, in the above-described invention, the positional relationship between the keyword and the field is a tendency in a direction in which the field exists in advance when the keyword is vertically written, or When a keyword is written horizontally, it is indicated by a tendency in a direction in which the predetermined field exists, and when the field satisfies the tendency, the field search unit detects the field as the field corresponding to the keyword. You may do it.

また、本発明の一態様は、上記に記載の発明において、前記矩形判定部が前記文字枠矩形でないと判定した前記矩形から、前記キーワードを囲む前記矩形を検出するキーワード対応矩形検出部を備え、前記フィールド探索部は、前記キーワードを囲む前記矩形が存在する場合、前記キーワードを囲む前記矩形と前記フィールドの位置関係を、前記キーワードと前記フィールドの位置関係として、前記キーワードに対応する前記フィールドを検出するようにしてもよい。   Further, according to one aspect of the present invention, in the above-described invention, the rectangle determination unit includes a keyword corresponding rectangle detection unit that detects the rectangle surrounding the keyword from the rectangle that is determined not to be the character frame rectangle. When the rectangle surrounding the keyword exists, the field search unit detects the field corresponding to the keyword by using the positional relationship between the rectangle surrounding the keyword and the field as the positional relationship between the keyword and the field. You may make it do.

また、本発明の一態様は、上記に記載の発明において、前記帳票画像データを分割する罫線消去対応画像分割部と、分割された前記帳票画像データの各々から罫線を消去する罫線消去部と、前記罫線消去後の分割された前記帳票画像データを合成する罫線消去対応画像合成部と、を備え、前記罫線消去対応画像分割部は、前記帳票画像データを分割する際に、分割の境界に存在する前記罫線が、前記罫線消去部によって消去されるように、分割後の前記帳票画像データの各々の境界において重複領域が存在するように拡張領域を設けて分割し、前記罫線消去対応画像合成部は、前記分割された前記帳票画像データの各々の前記拡張領域を削除してから合成し、前記文字検出部は、前記罫線消去対応画像合成部が出力する前記罫線が消去された前記帳票画像データから前記文字を検出するようにしてもよい。   Further, according to one aspect of the present invention, in the invention described above, a ruled line erasure corresponding image dividing unit that divides the form image data, a ruled line erasing unit that erases ruled lines from each of the divided form image data, A ruled line erasure-compatible image composition unit that synthesizes the divided form image data after the ruled line erasure, and the ruled line erasure-compatible image division unit exists at the boundary of the division when dividing the form image data The ruled line erasure corresponding image synthesizer is configured such that the ruled line is erased by the ruled line erasure unit and divided so that there is an overlapping region so that there is an overlapping region at each boundary of the divided form image data. Deletes the extended area of each of the divided form image data and combines them, and the character detection unit erases the ruled lines output from the ruled line erasure corresponding image combining unit From bookkeeping form image data may be detected and the character.

また、本発明の一態様は、上記に記載の発明において、前記フィールド探索部は、前記フィールドに複数のキーワードを対応付けるようにしてもよい。   According to another aspect of the present invention, in the invention described above, the field search unit may associate a plurality of keywords with the field.

上記問題を解決するために、本発明の一態様は、帳票を光学的に読み取り帳票の画像データを生成し、前記画像データを2値化して帳票画像データを生成し、前記帳票画像データに対して前記2値化により生じた欠損を埋める補正をして補正帳票画像データを生成し、前記補正帳票画像データから長方形または略長方形の形状を矩形として検出し、前記矩形が文字枠矩形であるか否かを判定し、前記文字枠矩形の隣接関係に基づいて、前記文字枠矩形を分類し、分類した区分の各々をフィールドとして検出し、前記帳票画像データに含まれる文字を検出し、前記フィールドに記入される文字の属性が予め対応付けられるキーワードを前記文字から検出し、前記キーワードに対応する前記フィールドを、前記キーワードと前記フィールドの位置関係に基づいて検出し、検出した前記フィールドを前記キーワードに対応付けて記憶することを特徴とする帳票定義方法である。   In order to solve the above problem, according to one aspect of the present invention, a form is optically read to generate form image data, the image data is binarized to generate form image data, and the form image data is Whether or not a rectangle or a substantially rectangular shape is detected as a rectangle from the corrected form image data by correcting the gap generated by the binarization to generate a corrected form image data. Determining whether or not to classify the character frame rectangle based on the adjacency relationship of the character frame rectangle, detecting each of the classified sections as a field, detecting a character included in the form image data, A keyword associated with a character attribute to be entered in advance is detected from the character, and the field corresponding to the keyword is defined as the position of the keyword and the field. Detected on the basis of the engagement, a form definition method characterized in that in association with the field detected in the keyword.

上記問題を解決するために、本発明の一態様は、コンピュータに、帳票を光学的に読み取り帳票の画像データを生成する手順、前記画像データを2値化して帳票画像データを生成する手順、前記帳票画像データに対して前記2値化により生じた欠損を埋める補正をして補正帳票画像データを生成する手順、前記補正帳票画像データから長方形または略長方形の形状を矩形として検出する手順、前記矩形が文字枠矩形であるか否かを判定する手順、前記文字枠矩形の隣接関係に基づいて、前記文字枠矩形を分類し、分類した区分の各々をフィールドとして検出する手順、前記帳票画像データに含まれる文字を検出する手順、前記フィールドに記入される文字の属性が予め対応付けられるキーワードを前記文字から検出する手順、前記キーワードに対応する前記フィールドを、前記キーワードと前記フィールドの位置関係に基づいて検出する手順、検出した前記フィールドを前記キーワードに対応付けて記憶する手順、を実行させるための帳票定義プログラムである。   In order to solve the above-described problem, an aspect of the present invention provides a computer with a procedure for optically reading a form to generate image data of the form, a procedure for generating the form image data by binarizing the image data, A procedure for generating correction form image data by correcting the form image data to fill in the defects generated by the binarization, a procedure for detecting a rectangle or a substantially rectangular shape from the correction form image data as a rectangle, the rectangle A procedure for determining whether or not a character frame rectangle, a procedure for classifying the character frame rectangle based on the adjacency relationship of the character frame rectangle, and detecting each of the classified segments as a field, the form image data A procedure for detecting included characters, a procedure for detecting a keyword associated with an attribute of a character entered in the field in advance from the characters, the keyword The corresponding field, the procedure for detecting based on the positional relationship between the keyword and the field, the procedure in association with the field detected in the keyword, a form definition program for executing.

この発明によれば、任意に選択される帳票について、当該帳票の文字枠に記入される文字の属性に関連付けられるキーワードと当該文字枠とを対応付ける定義情報を生成していくことが可能となる。   According to the present invention, it is possible to generate definition information for associating a keyword associated with the attribute of a character entered in a character frame of the form with the character frame for an arbitrarily selected form.

本発明の第1実施形態による帳票定義装置の構成を示すブロック図である。It is a block diagram which shows the structure of the form definition apparatus by 1st Embodiment of this invention. 同実施形態における矩形情報記憶部のデータ構成を示す図である。It is a figure which shows the data structure of the rectangular information storage part in the embodiment. 同実施形態におけるフィールド情報記憶部のデータ構成を示す図である。It is a figure which shows the data structure of the field information storage part in the embodiment. 同実施形態における文字情報記憶部のデータ構成を示す図である。It is a figure which shows the data structure of the character information storage part in the embodiment. 同実施形態における辞書属性情報記憶部のデータ構成を示す図である。It is a figure which shows the data structure of the dictionary attribute information storage part in the embodiment. 同実施形態における帳票定義情報記憶部のデータ構成を示す図である。It is a figure which shows the data structure of the form definition information storage part in the embodiment. 同実施形態における帳票定義処理を示すフローチャート(その1)である。It is a flowchart (the 1) which shows the form definition process in the embodiment. 同実施形態における帳票定義処理を示すフローチャート(その2)である。It is a flowchart (the 2) which shows the form definition process in the embodiment. 同実施形態の画像読取部が読み取った帳票の画像を示す図である。It is a figure which shows the image of the form which the image reading part of the embodiment read. 同実施形態の2値化部及び補正部のスレッドによる処理を示す図である。It is a figure which shows the process by the thread | sled of the binarization part and correction | amendment part of the embodiment. 同実施形態の補正部による膨張処理を説明する図(その1)である。It is FIG. (1) explaining the expansion process by the correction | amendment part of the embodiment. 同実施形態の補正部による膨張処理を説明する図(その2)である。It is FIG. (2) explaining the expansion process by the correction | amendment part of the embodiment. 同実施形態の補正部による膨張処理を説明する図(その3)である。It is FIG. (3) explaining the expansion process by the correction | amendment part of the embodiment. 同実施形態の補正部による膨張処理を説明する図(その4)である。It is FIG. (4) explaining the expansion process by the correction | amendment part of the embodiment. 同実施形態の補正部による膨張処理を説明する図(その5)である。It is FIG. (5) explaining the expansion process by the correction | amendment part of the embodiment. 同実施形態の補正部による膨張処理を説明する図(その6)である。It is FIG. (6) explaining the expansion process by the correction | amendment part of the embodiment. 同実施形態の補正部による膨張処理を説明する図(その7)である。It is FIG. (7) explaining the expansion process by the correction | amendment part of the embodiment. 同実施形態におけるフィールド検出処理を示すフローチャート(その1)である。It is a flowchart (the 1) which shows the field detection process in the embodiment. 同実施形態におけるフィールド検出処理を示すフローチャート(その2)である。It is a flowchart (the 2) which shows the field detection process in the embodiment. 同実施形態におけるフィールド検出処理を説明する図(その1)である。It is FIG. (1) explaining the field detection process in the embodiment. 同実施形態におけるフィールド検出処理を説明する図(その2)である。It is FIG. (2) explaining the field detection process in the embodiment. 同実施形態におけるフィールド検出処理を説明する図(その3)である。It is FIG. (3) explaining the field detection process in the embodiment. 同実施形態におけるフィールド検出処理を説明する図(その4)である。It is FIG. (4) explaining the field detection process in the embodiment. 同実施形態の罫線消去対応画像分割部による画像分割を説明する図(その1)である。It is FIG. (1) explaining the image division | segmentation by the ruled line deletion corresponding | compatible image division part of the embodiment. 同実施形態の罫線消去対応画像分割部による画像分割を説明する図(その2)である。It is FIG. (2) explaining the image division | segmentation by the ruled line deletion corresponding | compatible image division part of the embodiment. 同実施形態の罫線消去部のスレッドによる処理を示す図である。It is a figure which shows the process by the thread | sled of the ruled line deletion part of the embodiment. 同実施形態におけるキーワード外接矩形を説明する図である。It is a figure explaining the keyword circumscribed rectangle in the embodiment. 同実施形態におけるキーワードを囲む矩形を説明する図である。It is a figure explaining the rectangle which encloses the keyword in the embodiment. 同実施形態におけるフィールド探索処理を示すフローチャートである。It is a flowchart which shows the field search process in the embodiment. 同実施形態によるフィールド探索処理を説明する図(その1)である。It is FIG. (1) explaining the field search process by the embodiment. 同実施形態によるフィールド探索処理を説明する図(その2)である。It is FIG. (2) explaining the field search process by the embodiment. 同実施形態によるフィールド探索処理を説明する図(その3)である。It is FIG. (3) explaining the field search process by the embodiment. 同実施形態によるフィールド探索処理を説明する図(その4)である。It is FIG. (4) explaining the field search process by the embodiment. 同実施形態によるフィールド探索処理を説明する図(その5)である。It is FIG. (5) explaining the field search process by the embodiment. 同実施形態によるフィールド探索処理を説明する図(その6)である。It is FIG. (6) explaining the field search process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その1)である。It is FIG. (1) explaining the difference of the expansion process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その2)である。It is FIG. (2) explaining the difference of the expansion process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その3)である。It is a figure (the 3) explaining the difference of the expansion process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その4)である。It is a figure (the 4) explaining the difference of the expansion process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その5)である。It is FIG. (5) explaining the difference of the expansion process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その6)である。It is FIG. (6) explaining the difference of the expansion process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その7)である。It is FIG. (7) explaining the difference of the expansion process by the embodiment. 同実施形態による膨張処理の違いを説明する図(その8)である。It is FIG. (8) explaining the difference of the expansion process by the embodiment. 同実施形態の罫線消去対応画像分割部の効果を説明する図(その1)である。It is FIG. (1) explaining the effect of the ruled line deletion corresponding | compatible image division part of the embodiment. 同実施形態の罫線消去対応画像分割部の効果を説明する図(その2)である。It is FIG. (2) explaining the effect of the ruled line deletion corresponding | compatible image division part of the embodiment. 同実施形態の罫線消去対応画像分割部の効果を説明する図(その3)である。It is FIG. (3) explaining the effect of the ruled line deletion corresponding | compatible image division part of the embodiment. 本発明の第2実施形態の構成を示すブロック図である。It is a block diagram which shows the structure of 2nd Embodiment of this invention. 同実施形態のリファレンス情報記憶部のデータ構成を示す図である。It is a figure which shows the data structure of the reference information storage part of the embodiment.

(第1実施形態)
以下、本発明の第1実施形態について図面を参照して説明する。図1は、本発明の第1実施形態による帳票定義装置1の構成を示す概略ブロック図である。帳票定義装置1において、画像読取部10は、例えば、スキャナが適用され、光学的に紙媒体などに印刷、または手書きで記入された線図、図形、文字などのカラー画像として読み取り、読み取ったカラー画像をカラー帳票画像データとして出力する。ここでは、一例として、読み取ったカラー帳票画像データの各画素が24ビットの色情報を有する場合について説明する。画像分割部11は、画像読取部10が出力するカラー帳票画像データを上下辺の中点を結んだ線分と左右辺の中点を結んだ線分とにより4等分する。
(First embodiment)
Hereinafter, a first embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a schematic block diagram showing the configuration of a form definition device 1 according to the first embodiment of the present invention. In the form definition device 1, the image reading unit 10 is applied with, for example, a scanner, and is read as a color image such as a diagram, figure, or character that is optically printed on a paper medium or written by handwriting. The image is output as color form image data. Here, as an example, a case will be described in which each pixel of the read color form image data has 24-bit color information. The image dividing unit 11 divides the color form image data output from the image reading unit 10 into four equal parts by a line segment connecting the midpoints of the upper and lower sides and a line segment connecting the midpoints of the left and right sides.

2値化部12は、画像分割部11によって分割された分割カラー帳票画像データに対して、各々のピクセルを24ビットから1ビットに変換、すなわちカラーから白黒に変換して分割帳票画像データを生成する。ここで、2値化部12が行う2値化処理は、文字検出部24における文字の検出率を高めるために、文字の線が細くくっきりと残るような2値化を行うものとする。補正部13は、2値化部12が出力する分割帳票画像データに対して、線を膨張させる補正を行う。前述したように2値化部12によって行われる2値化処理は、各ピクセルを白黒の1ビットで表すように変換するとともに、文字の線が細くくっきりと残るようにする処理である。この処理を行うと、連続した線分で構成される矩形などの形状に欠損、すなわち、不連続な部分が生じてしまうことがある。線分に欠損が生じている場合でも欠損を補間して矩形として検出するアルゴリズムは存在するが、欠損が生じていない方が、矩形検出部15による矩形の検出率を高めることができるため、補正部13による補正処理により、線を膨張させて欠損を埋める補正を行う。   The binarization unit 12 converts the divided color form image data divided by the image dividing unit 11 from 24 bits to 1 bit, that is, converts from color to black and white to generate divided form image data. To do. Here, the binarization processing performed by the binarization unit 12 performs binarization so that the character lines remain thin and clear in order to increase the character detection rate in the character detection unit 24. The correction unit 13 performs correction for expanding the line on the divided form image data output from the binarization unit 12. As described above, the binarization processing performed by the binarization unit 12 is a process for converting each pixel to be represented by 1 bit of black and white and making the character line remain thin and clear. When this processing is performed, a defect, that is, a discontinuous portion may occur in a shape such as a rectangle formed by continuous line segments. There is an algorithm for detecting a rectangle by interpolating the defect even when the line segment has a defect. However, if the defect is not generated, the rectangle detection rate by the rectangle detector 15 can be increased. By the correction process by the unit 13, the line is expanded to correct the defect.

画像合成部14は、画像分割部11によって4等分され、2値化部12によって2値化された分割帳票画像データを合成して2値化された帳票画像データ(以下、2値化された帳票画像データを、帳票画像データという)を生成する。また、画像合成部14は、画像分割部11によって4等分され、2値化部12によって2値化され、補正部13によって補正された分割帳票画像データを合成して補正帳票画像データを生成する。また、画像合成部14は、生成した帳票画像データを文字検出用の画像データとして矩形消去部20に出力し、生成した補正帳票画像データを矩形検出用の画像データとして矩形検出部15に出力する。   The image composition unit 14 divides the divided form image data into four equal parts by the image division unit 11 and binarized by the binarization unit 12 and binarized form image data (hereinafter binarized). Generated form image data is referred to as form image data). Further, the image composition unit 14 divides the image into four equal parts by the image division unit 11, binarization by the binarization unit 12, and corrects the divided form image data corrected by the correction unit 13 to generate corrected form image data. To do. The image composition unit 14 outputs the generated form image data to the rectangle erasing unit 20 as image data for character detection, and outputs the generated corrected form image data to the rectangle detection unit 15 as image data for rectangle detection. .

矩形検出部15は、補正帳票画像データに含まれる長方形の形状、または略長方形の形状を矩形として画像処理により検出し、検出した矩形の左上のX軸とY軸の座標情報と、右下のX軸とY軸の座標情報とを出力する。ここで、略長方形には、4つの内角の全てが必ずしも直角ではなく、一部、または全ての角において、曲線になっているような形状も含まれる。なお、画像読取部10が読み取った画像データにおけるXY座標の原点は、左上を原点とし、X軸方向については、右方向が正、及びY軸方向については、下方向が正になる座標系となっており、以下の説明においても同様とする。矩形判定部16は、矩形検出部15が検出した矩形が、文字を記入する文字枠矩形か、それ以外の矩形であるかを、予め定められる文字枠矩形の大きさに基づいて判定する。   The rectangle detection unit 15 detects, by image processing, a rectangular shape or a substantially rectangular shape included in the corrected form image data as a rectangle, and coordinates information on the upper left X axis and Y axis of the detected rectangle, and a lower right The coordinate information of the X axis and the Y axis is output. Here, the substantially rectangular shape includes a shape in which all four inner corners are not necessarily a right angle but are curved at some or all corners. The origin of the XY coordinates in the image data read by the image reading unit 10 is a coordinate system in which the upper left is the origin, the right direction is positive in the X axis direction, and the lower direction is positive in the Y axis direction. The same applies to the following description. The rectangle determination unit 16 determines whether the rectangle detected by the rectangle detection unit 15 is a character frame rectangle in which a character is to be entered or other rectangles based on a predetermined size of the character frame rectangle.

矩形情報記憶部50は、図2に示すデータ構成の矩形情報を記憶しており、矩形情報は、「矩形ID(Identification)」、「左上のX,Y座標」、「右下のX,Y座標」、「矩形種別」「処理状態」の項目を有している。矩形IDは、1つの帳票画像データにおいて各矩形を一意に識別可能なIDであり、矩形検出部15が矩形を検出するごとに生成する。「矩形ID」の項目には、矩形検出部15より矩形IDを受けた矩形判定部16により書き込まれる。「左上のX,Y座標」及び「右下のX,Y座標」の項目には、矩形検出部15が検出した矩形の左上のX,Yの座標情報と、右下のX,Yの座標情報とが、これらの情報を矩形検出部15から受けた矩形判定部16によって書き込まれる。「矩形種別」の項目には、矩形判定部16が判定した種別、すなわち、文字枠矩形であることを示す「文字枠」か、それ以外の矩形であることを示す「その他」が、矩形判定部16によって書き込まれる。「処理状態」の項目は、フィールド検出部17によって利用され、フィールド検出部17によるフィールド検出処理によって、基準文字枠矩形として選択された場合、または、いずれかのフィールドに分類された場合、処理済みの矩形として、フィールド検出部17によって「済み」が書き込まれる。なお、「処理状態」の項目には、矩形判定部16が、矩形IDを書き込んでレコードを生成した際、初期値として矩形判定部16によって空欄「−」が書き込まれる。   The rectangular information storage unit 50 stores rectangular information having the data configuration shown in FIG. 2. The rectangular information includes “rectangular ID (Identification)”, “upper left X and Y coordinates”, and “lower right X, Y”. It has items of “Coordinate”, “Rectangle type” and “Processing state”. The rectangle ID is an ID that can uniquely identify each rectangle in one form image data, and is generated every time the rectangle detector 15 detects a rectangle. The item “rectangle ID” is written by the rectangle determination unit 16 that has received the rectangle ID from the rectangle detection unit 15. The items of “upper left X, Y coordinates” and “lower right X, Y coordinates” include the upper left X, Y coordinate information of the rectangle detected by the rectangle detector 15 and the lower right X, Y coordinates. The information is written by the rectangle determination unit 16 that has received the information from the rectangle detection unit 15. In the item of “rectangle type”, the type determined by the rectangle determining unit 16, that is, “character frame” indicating that the character is a character frame rectangle, or “other” indicating that the rectangle is other than that is a rectangle determination. Written by unit 16. The item “processing state” is used by the field detection unit 17 and processed when it is selected as a reference character frame rectangle by the field detection processing by the field detection unit 17 or when it is classified into any of the fields. As the rectangle, “completed” is written by the field detection unit 17. In the “processing state” item, when the rectangle determination unit 16 writes a rectangle ID and generates a record, a blank “-” is written by the rectangle determination unit 16 as an initial value.

フィールド検出部17は、矩形情報記憶部50から「矩形種別」の項目が「文字枠」となっている矩形情報を読み出し、読み出した文字枠矩形の隣接関係に基づいて、文字枠矩形を分類し、分類した際の区分の各々をフィールドとして検出する。ここで、フィールドとは、文字枠矩形の集合である。例えば、帳票において、氏名をカタカナ等で記入させる場合、同じ大きさの矩形を、同じ高さで、かつ同じ間隔で並べて、当該複数の矩形に氏名をカタカナ1文字ずつで記入させることが一般的である。この氏名が記入される一組の文字枠矩形の集合をフィールドという。なお、フィールドを構成する文字枠矩形の集合には、文字枠矩形が、1つの場合も含まれる。また、上記の隣接関係とは、隣接する文字枠矩形の左上のY座標の値が同じであるか否か、隣接する文字枠矩形がX軸方向に所定の範囲以内に存在するか否か、隣接する文字枠矩形の各々が、同じ又はほぼ同じ間隔で並んでいるか否か、文字枠矩形の縦方向の長さ、すなわち文字枠矩形の高さが同じであるか否かなどの隣接文字枠矩形との関係を示すものである。また、フィールド検出部17は、検出したフィールドの左上のX,Yの座標情報及び右下のX,Yの座標情報を検出する。また、フィールド検出部17は、検出したフィールドに対応付けて、検出した左上のX,Yの座標情報と右下のX,Yの座標情報、及びフィールドに含まれる矩形の矩形IDの情報をフィールド情報記憶部51に書き込む。   The field detection unit 17 reads out the rectangle information in which the item of “rectangle type” is “character frame” from the rectangle information storage unit 50, and classifies the character frame rectangles based on the adjacent relationship of the read character frame rectangles. Each of the classifications when classified is detected as a field. Here, the field is a set of character frame rectangles. For example, when entering a name in katakana etc. on a form, it is common to arrange rectangles of the same size at the same height and at the same interval, and enter the names in the rectangles one by one in katakana. It is. A set of character frame rectangles in which the name is written is called a field. Note that the set of character frame rectangles constituting the field includes the case where there is one character frame rectangle. In addition, the above-mentioned adjacency relationship is whether or not the value of the upper left Y coordinate of the adjacent character frame rectangle is the same, whether or not the adjacent character frame rectangle exists within a predetermined range in the X-axis direction, Adjacent character frames such as whether or not the adjacent character frame rectangles are arranged at the same or substantially the same interval, the length of the character frame rectangles in the vertical direction, that is, whether the heights of the character frame rectangles are the same, etc. It shows the relationship with the rectangle. The field detection unit 17 detects the upper left X and Y coordinate information and the lower right X and Y coordinate information of the detected field. Further, the field detection unit 17 associates the detected upper left X and Y coordinate information, the lower right X and Y coordinate information, and the information of the rectangular rectangle ID included in the field in association with the detected field. Write to the information storage unit 51.

フィールド情報記憶部51は、図3に示すデータ構成のフィールド情報を記憶しており、フィールド情報は、「フィールドID」、「左上のX,Y座標」、「右下のX,Y座標」、「構成矩形」の項目を有している。フィールドIDは、1つの帳票画像データにおいて各フィールドを一意に識別可能なIDであり、フィールド検出部17がフィールドを検出するごとに生成する。「フィールドID」の項目には、当該フィールドIDが、フィールド検出部17によって書き込まれる。「左上のX,Y座標」の項目には、フィールドを構成する左端の矩形の左上のX,Y座標情報がフィールド検出部17によって書き込まれ、「右下のX,Y座標」の項目には、フィールドを構成する右端の矩形の右下のX,Y座標情報がフィールド検出部17によって書き込まれる。「構成矩形」の項目には、フィールドを構成する矩形を示す矩形IDがフィールド検出部17によって書き込まれる。   The field information storage unit 51 stores field information having the data configuration shown in FIG. 3. The field information includes “field ID”, “upper left X and Y coordinates”, “lower right X and Y coordinates”, It has an item “configuration rectangle”. The field ID is an ID that can uniquely identify each field in one form image data, and is generated every time the field detection unit 17 detects a field. In the item “Field ID”, the field ID is written by the field detection unit 17. In the “upper left X, Y coordinates” item, the upper left X, Y coordinate information of the leftmost rectangle constituting the field is written by the field detection unit 17, and in the “lower right X, Y coordinates” item. The X and Y coordinate information at the lower right of the rightmost rectangle constituting the field is written by the field detector 17. In the item “configuration rectangle”, the field detection unit 17 writes a rectangle ID indicating the rectangle forming the field.

矩形消去部20は、矩形情報記憶部50に記憶されている矩形情報を用いて、画像合成部14が出力する帳票画像データに含まれる矩形を消去する。罫線消去対応画像分割部21は、矩形消去部20によって矩形が消去された帳票画像データを4分割して、罫線消去部22に出力する。ここで、罫線消去対応画像分割部21による帳票画像データの4分割は、上述した画像分割部11が行う上下辺の中点を結ぶ線分と、左右辺の中点を結ぶ線分とによる4等分とは異なる。罫線消去対応画像分割部21による4分割は、罫線消去部22が線分を罫線として検出する黒色画素の長さ分、分割の境界領域を拡張する拡張領域を含んだ分割となる。罫線消去部22は、罫線消去用に分割された帳票画像データの各々から画像処理により罫線を消去する。罫線消去対応画像合成部23は、罫線消去部22による罫線消去後の分割された帳票画像データの各々から上記の拡張領域を削除して合成を行う。   The rectangle erasure unit 20 uses the rectangle information stored in the rectangle information storage unit 50 to erase the rectangle included in the form image data output by the image composition unit 14. The ruled line erasure corresponding image dividing unit 21 divides the form image data from which the rectangle has been erased by the rectangle erasing unit 20 into four, and outputs it to the ruled line erasing unit 22. Here, the four divisions of the form image data by the ruled line erasure corresponding image dividing unit 21 are performed by the line segment connecting the midpoints of the upper and lower sides and the line segment connecting the midpoints of the left and right sides performed by the image dividing unit 11 described above. It is different from equal division. The four divisions by the ruled line erasure corresponding image dividing unit 21 are divisions including an extended region that extends the boundary region of the division by the length of the black pixel that the ruled line erasing unit 22 detects as a ruled line. The ruled line erasing unit 22 erases the ruled lines from each of the form image data divided for ruled line erasing by image processing. The ruled line erasure corresponding image composition unit 23 deletes the extended area from each of the divided form image data after the ruled line erasure by the ruled line erasure unit 22 and performs composition.

文字検出部24は、罫線消去対応画像合成部23が合成した、矩形と罫線が消去された帳票画像データから画像処理により1文字ずつ文字認識を行い、文字を検出する。文字検出部24が、最終的に検出する文字を示す情報は、例えば、文字コードなどの文字情報である。なお、認識した文字から文字コードへの変換は、文字検出部24が、予め内部に記憶してある変換テーブルにより変換してもよいし、文字検出部24が、外部のデータベース等を参照して、認識した文字から文字コードへの変換を行うようにしてもよい。また、文字検出部24は、検出した文字に外接する外接矩形を検出し、検出した外接矩形の左上のX,Y座標情報と右下のX,Y座標情報とを検出する。また、文字検出部24は、検出した文字の文字情報と、文字の外接矩形の左上のX,Y座標情報と右下のX,Y座標情報とを文字情報記憶部52に書き込む。   The character detection unit 24 recognizes characters one by one by image processing from the form image data from which the rectangle and the ruled line have been deleted, which is synthesized by the ruled line erasure corresponding image synthesis unit 23, and detects a character. The information indicating the character finally detected by the character detection unit 24 is character information such as a character code, for example. Note that the conversion from the recognized character to the character code may be performed by the character detection unit 24 using a conversion table stored in advance, or the character detection unit 24 may refer to an external database or the like. Alternatively, conversion from a recognized character to a character code may be performed. The character detection unit 24 detects a circumscribed rectangle circumscribing the detected character, and detects upper left X and Y coordinate information and lower right X and Y coordinate information of the detected circumscribed rectangle. Further, the character detection unit 24 writes the character information of the detected character, the upper left X and Y coordinate information of the circumscribed rectangle of the character, and the lower right X and Y coordinate information in the character information storage unit 52.

文字情報記憶部52は、図4に示すデータ構成の文字情報を記憶し、文字情報は、「文字ID」、「認識文字」、「左上のX,Y座標」、「右下のX,Y座標」の項目を有する。文字IDは、1つの帳票画像データにおいて認識した各文字を一意に識別可能なIDであり、文字検出部24が文字を検出するごとに生成する。「文字ID」の項目には、当該文字IDが、文字検出部24によって書き込まれる。「認識文字」の項目には、文字検出部24が画像処理により認識して検出した文字の文字情報が文字検出部24によって書き込まれる。「左上のX,Y座標」と「右下のX,Y座標」の項目には、文字検出部24が検出した、文字の外接矩形の左上のX,Y座標情報と右下のX,Y座標情報とが文字検出部24によって書き込まれる。   The character information storage unit 52 stores character information having the data structure shown in FIG. 4. The character information includes “character ID”, “recognized character”, “upper left X and Y coordinates”, and “lower right X, Y”. "Coordinate" item. The character ID is an ID that can uniquely identify each character recognized in one form image data, and is generated every time the character detection unit 24 detects a character. In the item “character ID”, the character ID is written by the character detection unit 24. In the item “recognized character”, character information of a character recognized and detected by the character detection unit 24 through image processing is written by the character detection unit 24. The items of “upper left X, Y coordinates” and “lower right X, Y coordinates” include the upper left X, Y coordinate information of the circumscribed rectangle of the character and the lower right X, Y detected by the character detection unit 24. Coordinate information is written by the character detection unit 24.

辞書属性情報記憶部53には、図5に示す辞書属性情報が予め記憶されている。辞書属性情報は、「キーワード」と「属性情報」の項目を有しており、「キーワード」の項目には、検出対象としている帳票に予め印刷される文字、または文字列からなる文字情報が予め記憶される。また、「キーワード」の項目の情報は、キーワード検出部25が、文字情報記憶部52に記憶されている文字からキーワードを検出する際に、辞書情報としても用いられる。「属性情報」の項目には、キーワードに対応付けられる属性を示す情報が予め書き込まれる。属性を示す情報とは、例えば、文字枠に記入される文字の種類などを示す情報であり、「依頼日」というキーワードであれば、年月日が書き込まれるため、数値という属性が書き込まれる。また、「依頼日」のキーワードに対するフィールドにおいて、より詳細に、西暦の下2桁を示す2つの文字枠、月を示す2つの文字枠、日を示す2つの文字枠の合計6つの文字枠から構成されることが予め定められている場合、それぞれの文字枠に記入される数字の範囲、例えば、日を示す2つの文字枠については、1つめ文字枠には、0〜3のいずれか、2つめの文字枠には0〜9のいずれかが記入されるという属性が予め書き込まれるようになっていてもよい。   The dictionary attribute information storage unit 53 stores dictionary attribute information shown in FIG. The dictionary attribute information has items of “keyword” and “attribute information”. In the “keyword” item, characters printed in advance on a form to be detected or character information made up of character strings are stored in advance. Remembered. The information on the item “keyword” is also used as dictionary information when the keyword detection unit 25 detects a keyword from characters stored in the character information storage unit 52. In the “attribute information” item, information indicating an attribute associated with the keyword is written in advance. The information indicating the attribute is, for example, information indicating the type of character to be entered in the character frame. If the keyword is “request date”, the date is written, so the attribute of numerical value is written. Further, in the field for the keyword “request date”, in more detail, from a total of six character frames including two character frames indicating the last two digits of the year, two character frames indicating the month, and two character frames indicating the day. If it is predetermined, the range of numbers entered in each character frame, for example, for two character frames indicating the day, the first character frame is one of 0-3, An attribute that any one of 0 to 9 is written in the second character frame may be written in advance.

「月」というキーワードであれば、2つの文字枠について、1つめの文字枠には、0か1、2つめの文字枠には、1〜9の数字が書き込まれることが属性情報として予め書き込まれるようになっていてもよいし、2つの文字枠に書き込まれる数値が、1〜12の整数であることが属性情報として予め書き込まれるようになっていてもよい。この場合、例えば、「属性情報」の項目に、「数値(範囲指定有り)」という属性が書き込まれ、「範囲指定有り」の部分には、具体的には「1〜12のいずれかの整数」といった内容が書き込まれることになる。
また、「都道府県」というキーワードの場合には、都道府県名のいずれかを示す漢字が書き込まれる場合もあるが、いくつかの都道府県を選択するようになっている場合、選択肢となっている所定の都道府県名が属性情報として予め書き込まれることになる。
In the case of the keyword “month”, it is pre-written as attribute information that 0 or 1 and 9 are written in the first character frame in two character frames. The numerical value written in the two character frames may be written in advance as attribute information that the numerical value written in the two character frames is an integer of 1 to 12. In this case, for example, an attribute of “numerical value (with range specification)” is written in the item of “attribute information”, and in the “with range specification” portion, specifically, any integer from 1 to 12 "Is written.
In addition, in the case of the keyword “prefecture”, a kanji indicating one of the prefectural names may be written, but it is an option when several prefectures are selected. A predetermined prefecture name is written in advance as attribute information.

キーワード検出部25は、文字情報記憶部52に記憶されている文字情報に基づいて、キーワードを構成している文字を検出し、検出したキーワードのうち辞書属性情報記憶部53の「キーワード」の項目に予め書き込まれている文字列または文字に完全一致、または、部分一致するものをキーワードとして検出する。また、キーワード検出部25は、キーワードを検出すると、当該キーワードに対応付けられている属性情報を辞書属性情報記憶部53から読み出す。また、キーワード検出部25は、検出したキーワードの外接矩形を検出し、検出した外接矩形の左上のX,Y座標情報と右下のX,Y座標情報を検出する。また、キーワード検出部25は、1つの帳票画像データでキーワード検出部25が検出したキーワードを一意に識別可能なIDであるキーワードIDを生成し、検出したキーワードと、対応する属性情報と、検出した外接矩形の左上のX,Y座標情報と右下のX,Y座標情報とを、生成したキーワードIDに対応付けて帳票定義情報記憶部54に書き込む。また、キーワード検出部25は、キーワードIDとキーワード外接矩形の情報、すなわち外接矩形の左上のX,Y座標情報と右下のX,Y座標情報をキーワード対応矩形検出部26に出力する。   The keyword detection unit 25 detects characters constituting the keyword based on the character information stored in the character information storage unit 52, and among the detected keywords, the item “keyword” in the dictionary attribute information storage unit 53 A character string or a character that is written in advance in the character string or a character that completely matches or partially matches is detected as a keyword. Further, when the keyword detection unit 25 detects a keyword, the keyword detection unit 25 reads attribute information associated with the keyword from the dictionary attribute information storage unit 53. The keyword detection unit 25 detects a circumscribed rectangle of the detected keyword, and detects upper left X and Y coordinate information and lower right X and Y coordinate information of the detected circumscribed rectangle. In addition, the keyword detection unit 25 generates a keyword ID that is an ID that can uniquely identify the keyword detected by the keyword detection unit 25 in one form image data, and detects the detected keyword and corresponding attribute information. The upper left X and Y coordinate information and the lower right X and Y coordinate information of the circumscribed rectangle are written in the form definition information storage unit 54 in association with the generated keyword ID. Further, the keyword detection unit 25 outputs the keyword ID and the information of the circumscribed rectangle of the keyword, that is, the upper left X and Y coordinate information and the lower right X and Y coordinate information of the circumscribed rectangle to the keyword corresponding rectangle detection unit 26.

帳票定義情報記憶部54は、図6に示すデータ構成の帳票定義情報を記憶し、帳票定義情報は、「キーワードID」、「内容」、「属性情報」、「左上のX,Y座標」、「右下のX,Y座標」、「対応矩形」、「対応フィールド」の項目を有する。「キーワードID」の項目には、キーワード検出部25によって、キーワード検出部25が生成したキーワードIDが書き込まれる。「内容」の項目には、キーワード検出部25が検出したキーワードの内容を示す文字列または文字が書き込まれる。「属性情報」の項目には、キーワード検出部25が、検出したキーワードに基づいて、辞書属性情報記憶部53から読み出した属性情報が書き込まれる。「左上のX,Y座標」と「右下のX,Y座標」の項目には、キーワード検出部25が検出したキーワードの外接矩形の左上のX,Y座標情報と右下のX,Y座標情報がキーワード検出部25によって書き込まれる。「対応矩形」の項目には、キーワード対応矩形検出部26が検出したキーワードを囲む矩形の矩形IDがキーワード対応矩形検出部26によって書き込まれる。「対応フィールド」の項目には、フィールド探索部27が検出したキーワードに対応するフィールドのフィールドIDが、フィールド探索部27によって書き込まれる。なお、「対応矩形」及び「対応フィールド」の項目は、キーワード検出部25がキーワードIDを書き込んでレコードを生成した際に、初期値としてキーワード検出部25によって空欄「−」が書き込まれる。   The form definition information storage unit 54 stores form definition information having the data structure shown in FIG. 6, and the form definition information includes “keyword ID”, “content”, “attribute information”, “X and Y coordinates at the upper left”, It has items of “lower right X and Y coordinates”, “corresponding rectangle”, and “corresponding field”. In the “keyword ID” item, the keyword ID generated by the keyword detection unit 25 by the keyword detection unit 25 is written. In the “content” item, a character string or a character indicating the content of the keyword detected by the keyword detection unit 25 is written. In the “attribute information” item, the attribute information read from the dictionary attribute information storage unit 53 by the keyword detection unit 25 based on the detected keyword is written. The items of “upper left X, Y coordinates” and “lower right X, Y coordinates” include the upper left X, Y coordinate information and the lower right X, Y coordinates of the circumscribed rectangle of the keyword detected by the keyword detection unit 25. Information is written by the keyword detection unit 25. In the item “corresponding rectangle”, a rectangle ID of a rectangle surrounding the keyword detected by the keyword corresponding rectangle detection unit 26 is written by the keyword corresponding rectangle detection unit 26. In the item “corresponding field”, the field search unit 27 writes the field ID of the field corresponding to the keyword detected by the field search unit 27. For the items “corresponding rectangle” and “corresponding field”, when the keyword detection unit 25 writes a keyword ID and generates a record, a blank “-” is written by the keyword detection unit 25 as an initial value.

キーワード対応矩形検出部26は、キーワード検出部25が出力するキーワードの外接矩形の左上のX,Y座標情報及び右下のX,Y座標情報と、矩形情報記憶部50に記憶されている文字枠以外の矩形の左上のX,Y座標情報及び右下のX,Y座標情報とに基づいて、キーワードを囲む矩形を検出する。また、キーワード対応矩形検出部26は、検出した矩形を示す矩形IDをキーワードIDに対応付けて帳票定義情報記憶部54の「対応矩形」の項目に書き込む。なお、キーワードを囲む矩形が検出できなかった場合、キーワード対応矩形検出部26は、当該項目に「なし」を書き込む。   The keyword-corresponding rectangle detection unit 26 includes the upper left X and Y coordinate information and the lower right X and Y coordinate information of the circumscribed rectangle of the keyword output by the keyword detection unit 25 and the character frame stored in the rectangle information storage unit 50. The rectangle surrounding the keyword is detected based on the upper left X and Y coordinate information and the lower right X and Y coordinate information of the other rectangles. In addition, the keyword-corresponding rectangle detection unit 26 associates the rectangle ID indicating the detected rectangle with the keyword ID and writes it in the item “corresponding rectangle” of the form definition information storage unit 54. If the rectangle surrounding the keyword cannot be detected, the keyword corresponding rectangle detection unit 26 writes “none” in the item.

フィールド探索部27は、帳票定義情報記憶部54に記憶されているキーワード外接矩形の座標情報と、フィールド情報記憶部51に記憶されているフィールドの座標情報とを参照し、キーワードとフィールドの位置関係に基づいてキーワードに対応するフィールドを検出する。また、フィールド探索部27は、帳票定義情報記憶部54の「対応矩形」の項目に矩形のIDが記憶されている場合、キーワード外接矩形の座標情報に代えて、矩形の座標情報を矩形情報記憶部50から読み出す。また、フィールド探索部27は、読み出した矩形の座標情報と、フィールド情報記憶部51に記憶されている座標情報とを参照し、キーワードを囲む矩形とフィールドの位置関係に基づいてキーワードに対応するフィールドを検出する。また、フィールド探索部27は、検出したフィールドを示すフィールドIDを、当該キーワードを示すキーワードIDに対応付けて帳票定義情報記憶部54の「対応フィールド」の項目に書き込む。   The field search unit 27 refers to the coordinate information of the keyword circumscribing rectangle stored in the form definition information storage unit 54 and the field coordinate information stored in the field information storage unit 51, and the positional relationship between the keyword and the field Based on, the field corresponding to the keyword is detected. In addition, when a rectangle ID is stored in the item “corresponding rectangle” of the form definition information storage unit 54, the field search unit 27 stores the rectangular coordinate information instead of the keyword circumscribed rectangle coordinate information. Read from unit 50. Further, the field search unit 27 refers to the coordinate information of the read rectangle and the coordinate information stored in the field information storage unit 51, and the field corresponding to the keyword based on the positional relationship between the rectangle surrounding the keyword and the field. Is detected. The field search unit 27 writes the field ID indicating the detected field in the item “corresponding field” of the form definition information storage unit 54 in association with the keyword ID indicating the keyword.

(帳票定義処理)
第1実施形態の帳票定義装置1による帳票定義の処理について説明する。図7及び図8は、帳票定義処理の流れを示すフローチャートである。画像読取部10が、帳票を光学的に読み取り、例えば、図9に示す24ビットで構成されるカラー帳票画像データFを出力する(ステップSa1)。画像分割部11は、画像読取部10から出力されるカラー帳票画像データFを4等分する(ステップSa2)。ここで、4等分とは、カラー帳票画像データFの上下辺の中点を結ぶ線分と、左右辺の中点を結ぶ線分によって分割することであり、図10に、4等分した左上の分割カラー帳票画像データF−D1を示す。2値化部12と補正部13は、図10に示すようにスレッド1,2,3,4の4つのスレッドから構成され、各々のスレッド1,2,3,4は、それぞれ、画像分割部11によって分割された分割カラー帳票画像データF−D1,F−D2,F−D3,F−D4に対して処理を行う。4つのスレッド1,2,3,4によりマルチスレッド処理を行うことで、分割カラー帳票画像データF−D1,F−D2,F−D3,F−D4の2値化の処理及び補正の処理が並行に行われ、画像処理の速度が向上するとともに、2値化品質の向上等を図ることができる。
(Form definition processing)
A form definition process performed by the form definition apparatus 1 according to the first embodiment will be described. 7 and 8 are flowcharts showing the flow of the form definition process. The image reading unit 10 optically reads a form and outputs, for example, color form image data F composed of 24 bits shown in FIG. 9 (step Sa1). The image dividing unit 11 divides the color form image data F output from the image reading unit 10 into four equal parts (step Sa2). Here, the quarter is divided into a line segment connecting the midpoints of the upper and lower sides of the color form image data F and a line segment connecting the midpoints of the left and right sides. The upper left divided color form image data F-D1 is shown. As shown in FIG. 10, the binarizing unit 12 and the correcting unit 13 are composed of four threads, threads 1, 2, 3, and 4, and each of the threads 1, 2, 3, and 4 is an image dividing unit. 11 is performed on the divided color form image data F-D1, F-D2, F-D3, and F-D4 divided by 11. By performing multi-thread processing with four threads 1, 2, 3, and 4, binarization processing and correction processing of divided color form image data F-D1, F-D2, F-D3, and F-D4 can be performed. Performed in parallel, the speed of image processing can be improved, and binarization quality can be improved.

画像分割部11は、スレッド1,2,3,4の4つのスレッドの各々に分割した分割カラー帳票画像データF−D1,F−D2,F−D3,F−D4を出力する。2値化部12のスレッド1は、画像分割部11によって分割された左上の分割カラー帳票画像データF−D1を受けて、2値化を行い、分割帳票画像データBF−D1を生成する(ステップSa3−1)。補正部13のスレッド1は、分割帳票画像データBF−D1が生成されると、矩形検出用の補正を行い、補正後の補正分割帳票画像データBF−D1−Cを出力する(ステップSa4−1)。   The image dividing unit 11 outputs divided color form image data F-D1, F-D2, F-D3, and F-D4 divided into each of four threads of threads 1, 2, 3, and 4. The thread 1 of the binarizing unit 12 receives the upper left divided color form image data F-D1 divided by the image dividing unit 11, performs binarization, and generates divided form image data BF-D1 (step S1). Sa3-1). When the divided form image data BF-D1 is generated, the thread 1 of the correction unit 13 performs correction for rectangle detection and outputs corrected corrected divided form image data BF-D1-C (step Sa4-1). ).

矩形検出部15による矩形の検出の処理は、長方形の形状、または略長方形の形状を矩形として検出する処理であり、矩形として検出するためには、矩形を構成する線において欠損がないことが条件となる。一方で、2値化部12による2値化は、文字検出部24によって文字が検出できるよう、文字の線が細くくっきりと残るような2値化を行う必要があり、この2値化の際に、矩形を構成する線に欠損が生じてしまう場合がある。したがって、補正部13による補正処理は、線を膨張させて、2値化処理により生じた欠損を埋める画像処理となる。図11から図17は、補正部13による補正処理を示す図である。補正部13が行う膨張処理としては、以下に説明する、膨張処理A、膨張処理B、膨張処理Cから、いずれかが予め選択されるものとする。   The process of detecting a rectangle by the rectangle detection unit 15 is a process of detecting a rectangular shape or a substantially rectangular shape as a rectangle. In order to detect a rectangle, it is necessary that there is no defect in the lines constituting the rectangle. It becomes. On the other hand, the binarization by the binarization unit 12 needs to perform binarization so that the character line remains thin and clear so that the character detection unit 24 can detect the character. In addition, a defect may occur in a line constituting the rectangle. Therefore, the correction process by the correction unit 13 is an image process in which a line is expanded to fill a defect generated by the binarization process. 11 to 17 are diagrams illustrating correction processing by the correction unit 13. As the expansion process performed by the correction unit 13, any one of the expansion process A, the expansion process B, and the expansion process C described below is selected in advance.

(膨張処理A)
膨張処理Aは、線を膨張させる際の一般的なアルゴリズムである。膨張処理Aは、補正部13が、1つずつの画素を選択していき、例えば、図11に示すように、中央の「×」を注目画素として選択した場合に、注目画素の周辺に1つでも黒色の画素があれば、注目画素を黒色に置き換える処理である。具体的には、補正部13は、注目画素が白色の画素であるとき、当該画素を膨張、すなわち黒色に変換させるか否かの判定を行う。そのために、まず、注目画素の周辺の画素、すなわち図11に示す「○」のマークが付された画素に黒色があるか否かを判定する。図11の例では、右下の画素が黒色であるため、補正部13は、図12のように注目画素を黒色に置き換える。これにより、膨張が行われる。補正部13は、この処理を全ての画素について行うことにより、2値化された分割帳票画像データに含まれる線を膨張させていく。なお、図11、12の例では、指定周辺範囲を1としているため、注目画素の周辺は8近傍の画素となっているが、指定周辺範囲を2以上として周辺の画素を増やして、より多くの場合に膨張させるようにしてもよい。
(Expansion treatment A)
The expansion process A is a general algorithm for expanding a line. In the expansion process A, when the correction unit 13 selects pixels one by one and, for example, selects “x” at the center as the target pixel as shown in FIG. If there is any black pixel, the target pixel is replaced with black. Specifically, when the target pixel is a white pixel, the correction unit 13 determines whether or not the pixel is expanded, that is, converted into black. For this purpose, first, it is determined whether or not there is black in the pixels around the pixel of interest, that is, the pixels marked with “◯” shown in FIG. In the example of FIG. 11, since the lower right pixel is black, the correction unit 13 replaces the target pixel with black as shown in FIG. Thereby, expansion is performed. The correction unit 13 performs this process on all the pixels to expand the lines included in the binarized divided form image data. In the examples of FIGS. 11 and 12, since the designated peripheral range is 1, the periphery of the target pixel is 8 neighboring pixels. However, the designated peripheral range is set to 2 or more to increase the number of peripheral pixels, and more. In this case, it may be inflated.

(膨張処理B)
膨張処理Bは、注目画素の指定周辺範囲に存在する黒色画素の割合に基づいて、注目画素を黒色に置き換える処理である。上記の膨張処理Aにおいて説明したように、指定周辺範囲を1とすると、指定周辺範囲は「○」で示される8近傍の画素となる。補正部13に予め定められる割合を25%とし、25%以上の場合に補正部13が注目画素を黒色に置き換えるとする。図11の場合、周辺に1つの黒色画素が存在する。8個のうちの25%は、2個となるため、図11の場合、補正部13は、注目画素を黒色に置き換えない。これに対して図13のような場合、周辺に2つの黒色画素が存在する。したがって、補正部13は、図14に示すように注目画素を黒色に置き換える。補正部13は、この処理を全ての画素について行うことにより、2値化された分割帳票画像データに含まれる線を膨張させることができる。なお、指定周辺範囲は、1に限られず、指定周辺範囲を2以上として周辺の画素を増やすようにしてもよい。
(Expansion treatment B)
The expansion process B is a process of replacing the target pixel with black based on the ratio of black pixels existing in the designated peripheral range of the target pixel. As described in the expansion process A above, if the designated peripheral range is 1, the designated peripheral range is eight neighboring pixels indicated by “◯”. Assume that the ratio predetermined in the correction unit 13 is 25%, and the correction unit 13 replaces the target pixel with black when the ratio is 25% or more. In the case of FIG. 11, there is one black pixel around. Since 25% of the eight is two, in the case of FIG. 11, the correction unit 13 does not replace the target pixel with black. On the other hand, in the case of FIG. 13, there are two black pixels in the vicinity. Therefore, the correction unit 13 replaces the target pixel with black as shown in FIG. The correction unit 13 can expand the lines included in the binarized divided form image data by performing this process for all the pixels. The designated peripheral range is not limited to 1, and the designated peripheral range may be set to 2 or more to increase the number of peripheral pixels.

(膨張処理C)
膨張処理Cは、上記の膨張処理Bの手法に対してさらに黒色画素の分布の重みを膨張の判定要素に加えることで、より矩形の補正に特化させた膨張処理である。補正部13は、図15に示すように、「×」で示される中央の画素を注目画素として選択した場合、左右指定範囲画素に存在する黒色画素の数をカウントする。指定範囲を2とした場合、「○」で示される画素が左右指定範囲画素となる。補正部13は、黒色画素をカウントする際に、黒色画素が注目画素から左に存在する場合、重みを「−1」し、右に存在する場合、重みを「+1」する。なお、重みの初期値は0である。図15の場合、左に黒色画素が1つ、右に黒色画素が2つ存在するため、黒色画素の個数としては3となる。膨張処理Bでは、指定周辺範囲の黒色画素の割合に基づいて注目画素を黒色に置き換えるか否かを判定していた。これに対して、膨張処理Cでは、予め定められる閾値を用いる。ここで、例えば、閾値を2とする。黒色画素の個数3は、閾値2以上の場合に該当するため、補正部13は、注目画素について黒色への置き換えを行うと判定する。次に、補正部13は、重みについて算出を行う。図15の例では、左に1つ、右に2つ黒色画素が存在するため、補正部13は、−1+1+1=+1として重みを算出する。重みが+1の場合、注目画素から右に1画素ずらし、図16において矢印によって示される画素を膨張させる起点とする。そして、起点となる画素の両側の画素を黒色に置き換える。置き換えると、図17のようになり、結果として、白色であった注目画素「×」が黒色に置き換えられることになる。補正部13は、上記の処理を注目画素の上下指定範囲の画素についても行い、この左右上下指定範囲の画素についての処理を全画素について行う。
(Expansion treatment C)
The expansion process C is an expansion process that is more specialized for rectangular correction by adding the weight of the black pixel distribution to the expansion determination element in addition to the method of the expansion process B described above. As illustrated in FIG. 15, when the center pixel indicated by “x” is selected as the target pixel, the correction unit 13 counts the number of black pixels existing in the left and right designated range pixels. When the designated range is 2, the pixel indicated by “◯” is the left and right designated range pixel. When the black pixel is counted to the left of the target pixel, the correction unit 13 increments the weight by “−1”, and when the black pixel exists to the right, the correction unit 13 increments the weight by “+1”. Note that the initial value of the weight is 0. In the case of FIG. 15, there are one black pixel on the left and two black pixels on the right, so the number of black pixels is three. In the expansion process B, it is determined whether or not to replace the pixel of interest with black based on the ratio of black pixels in the designated peripheral range. On the other hand, in the expansion process C, a predetermined threshold value is used. Here, for example, the threshold value is 2. Since the number 3 of black pixels corresponds to a case where the threshold value is 2 or more, the correction unit 13 determines to replace the target pixel with black. Next, the correction unit 13 calculates the weight. In the example of FIG. 15, since there are one black pixel on the left and two black pixels on the right, the correction unit 13 calculates the weight as −1 + 1 + 1 = + 1. When the weight is +1, the pixel is shifted to the right by one pixel from the target pixel, and the pixel indicated by the arrow in FIG. Then, the pixels on both sides of the starting pixel are replaced with black. When replaced, the result is as shown in FIG. 17, and as a result, the pixel of interest “x” that was white is replaced with black. The correction unit 13 performs the above-described process also on the pixels in the upper and lower specified range of the target pixel, and performs the process on the pixels in the left and right upper and lower specified range for all the pixels.

図10に戻り、スレッド2、3、4において、ステップSa3−1と同様に、分割カラー帳票画像データF−D2、F−D3、F−D4に対して、2値化部12による2値化の処理が行われ、これにより2値化部12による2値化の処理が完了する(ステップSa3)。また、スレッド2、3、4において、ステップSa4−1と同様に、補正部13による上記の線を膨張させる補正の処理が行われ、これにより補正部13による補正の処理が完了する(ステップSa4)。   Returning to FIG. 10, in the threads 2, 3, and 4, the binarization unit 12 binarizes the divided color form image data F-D2, F-D3, and F-D4 as in step Sa3-1. Thus, the binarization processing by the binarization unit 12 is completed (step Sa3). Further, in the threads 2, 3, and 4, similarly to step Sa4-1, a correction process for expanding the above-described line by the correction unit 13 is performed, thereby completing the correction process by the correction unit 13 (step Sa4). ).

2値化部12及び補正部13のスレッド1,2,3,4は、それぞれ補正されていない2値化された分割帳票画像データBF−D1,BF−D2,BF−D3,BF−D4と、補正されている2値化された分割帳票画像データBF−D1−C,BF−D2−C,BF−D3−C,BF−D4−Cの2種類の画像データを出力する。このとき、補正部13による補正処理に要した時間について遅延が生じるため、処理の同期が行われ、これら2種類の画像データは、同じタイミングで画像合成部14に対して2値化部12と補正部13とが出力する。画像合成部14は、分割帳票画像データBF−D1,BF−D2,BF−D3,BF−D4が、スレッド1,2,3,4から出力されると、これらを合成してキーワード検出用の帳票画像データBFを出力して、接続点Bに進む(ステップSa20)。
また、画像合成部14は、補正分割帳票画像データBF−D1−C,BF−D2−C,BF−D3−C,BF−D4−Cが、スレッド1,2,3,4から出力されると、これらを合成して矩形検出用の補正帳票画像データBF−Cを出力する(ステップSa5)。
Threads 1, 2, 3, and 4 of the binarizing unit 12 and the correcting unit 13 are binarized divided form image data BF-D1, BF-D2, BF-D3, and BF-D4, respectively, which are not corrected. Then, two types of image data of corrected binary document image data BF-D1-C, BF-D2-C, BF-D3-C, and BF-D4-C are output. At this time, a delay occurs with respect to the time required for the correction processing by the correction unit 13, so that the processing is synchronized, and these two types of image data are transmitted to the image synthesis unit 14 and the binarization unit 12 at the same timing. The correction unit 13 outputs. When the divided form image data BF-D1, BF-D2, BF-D3, and BF-D4 are output from the threads 1, 2, 3, and 4, the image composition unit 14 synthesizes them to detect keywords. The form image data BF is output, and the process proceeds to the connection point B (step Sa20).
In addition, the image composition unit 14 outputs corrected divided form image data BF-D1-C, BF-D2-C, BF-D3-C, and BF-D4-C from the threads 1, 2, 3, and 4. Then, these are combined and the corrected form image data BF-C for rectangle detection is output (step Sa5).

矩形検出部15は、補正帳票画像データBF−Cに含まれる矩形を画像処理によって検出し、検出した矩形ごとに、左上のX,Yの座標情報と、右下のX,Yの座標情報を検出する。矩形検出部15は、矩形を一意に識別可能な矩形IDを生成し、生成した矩形IDと、検出した左上のX,Yの座標情報と、右下のX,Yの座標情報とを対応付けて矩形判定部16に出力する(ステップSa6)。矩形判定部16は、矩形検出部15が出力する左上のX,Yの座標情報と、右下のX,Yの座標情報と、予め内部に定められている文字枠矩形の大きさの情報とを比較して、矩形検出部15が出力する矩形が文字枠矩形であるか否かを判定する(ステップSa7)。なお、矩形検出部15が検出する矩形は、上述したように必ずしも長方形ではなく、略長方形も含まれるため、大きさの比較は、一致するか否かではなく、予め定められる文字枠矩形の大きさを基準として、大きすぎないか、または、小さすぎないかという一定の範囲に存在するか否かを判定することになる。したがって、文字枠矩形の大きさの条件に加えて、当該範囲の条件についても矩形判定部16の内部に予め定められることになる。矩形判定部16は、文字枠矩形であると判定した場合、矩形IDと、左上のX,Yの座標情報と、右下のX,Yの座標情報と、「文字枠」を示す情報とを対応付けて矩形情報記憶部50に書き込む。一方、矩形判定部16は、文字枠矩形でないと判定した場合、矩形IDと、左上のX,Yの座標情報と、右下のX,Yの座標情報と、「その他」を示す情報とを対応付けて矩形情報記憶部50に書き込む(ステップSa8)。   The rectangle detection unit 15 detects a rectangle included in the corrected form image data BF-C by image processing, and for each detected rectangle, obtains the upper left X and Y coordinate information and the lower right X and Y coordinate information. To detect. The rectangle detection unit 15 generates a rectangle ID that can uniquely identify the rectangle, and associates the generated rectangle ID with the detected upper left X and Y coordinate information and the lower right X and Y coordinate information. Is output to the rectangle determination unit 16 (step Sa6). The rectangle determination unit 16 outputs the upper left X and Y coordinate information, the lower right X and Y coordinate information output from the rectangle detection unit 15, and information on the size of the character frame rectangle determined in advance inside Are compared to determine whether the rectangle output by the rectangle detector 15 is a character frame rectangle (step Sa7). Note that the rectangle detected by the rectangle detection unit 15 is not necessarily a rectangle as described above, and includes a substantially rectangular shape. Therefore, the size comparison is not based on whether or not they match, but the size of a predetermined character frame rectangle. On the basis of the thickness, it is determined whether it is within a certain range of whether it is not too large or not too small. Therefore, in addition to the condition of the size of the character frame rectangle, the condition of the range is also determined in advance inside the rectangle determination unit 16. If the rectangle determination unit 16 determines that the character frame is a rectangle, the rectangle ID, the upper left X and Y coordinate information, the lower right X and Y coordinate information, and the information indicating “character frame” are obtained. Corresponding data is written in the rectangular information storage unit 50. On the other hand, if the rectangle determination unit 16 determines that the character frame is not a rectangle, the rectangle ID, the upper left X and Y coordinate information, the lower right X and Y coordinate information, and the information indicating “other” are obtained. Corresponding data are written in the rectangular information storage unit 50 (step Sa8).

矩形判定部16による矩形情報記憶部50への矩形情報の書き込みが終了すると、接続点Aを通じて、図8に示すように、フィールド検出部17によるフィールド検出処理が開始される(ステップSa9)。フィールド検出部17に対して処理の開始を通知する構成としては、例えば、矩形検出部15から、1つの補正帳票画像データについての矩形検出の処理の完了の通知を受けた矩形判定部16が、最後の矩形情報を矩形情報記憶部50に書き込んだ際に、処理完了の通知を、フィールド検出部17に対する処理開始の通知として出力する構成が適用される。   When the rectangle determination unit 16 finishes writing the rectangle information to the rectangle information storage unit 50, the field detection process by the field detection unit 17 is started through the connection point A as shown in FIG. 8 (step Sa9). As a configuration for notifying the field detection unit 17 of the start of processing, for example, the rectangle determination unit 16 that has received notification from the rectangle detection unit 15 of completion of rectangle detection processing for one correction form image data, A configuration is employed in which when the last rectangular information is written in the rectangular information storage unit 50, a notification of processing completion is output as a processing start notification to the field detection unit 17.

(フィールド検出処理)
図18、19は、フィールド検出部17によるフィールド検出処理を示すフローチャートである。フィールド検出部17は、矩形情報記憶部50において「矩形種別」の項目が「文字枠」であって、「処理状態」の項目が、「済み」となっていない矩形を参照し、参照した文字枠矩形のうち左上の頂点のX軸の座標値が最も小さい文字枠矩形を基準文字枠矩形として選択する(ステップSb1)。フィールド検出部17は、選択した基準文字枠矩形の左上の頂点のY軸の座標値を参照し、当該座標値と、左上の頂点のY軸の座標値が概ね等しい他の文字枠矩形を抽出する(ステップSb2)。図20は、ステップSb2の処理を示す図である。基準文字枠矩形として文字枠矩形R1を選択した場合、フィールド検出部17は、左上のY軸の座標値が等しいか、ほぼ等しい文字枠矩形R3、R5を他の文字枠矩形として抽出し、文字枠矩形R2、R4は、抽出しない。この処理は、フィールドを構成する文字枠は、横書きの場合には、上辺がY軸において同じ位置、またはほぼ同じ位置になっていることから、この条件を満たす他の文字枠矩形を抽出することを目的としている。フィールド検出部17は、ステップSb2において、他の文字枠矩形を抽出したかを判定し、抽出していない場合、接続点Cを通じてステップSb14に進む。一方、フィールド検出部17は、他の文字枠矩形を抽出した場合、ステップSb4に進む。
(Field detection processing)
18 and 19 are flowcharts showing the field detection processing by the field detection unit 17. The field detection unit 17 refers to a rectangle in which the item “rectangle type” is “character frame” and the item “processing state” is not “completed” in the rectangle information storage unit 50, Among the frame rectangles, the character frame rectangle having the smallest X-axis coordinate value at the upper left vertex is selected as the reference character frame rectangle (step Sb1). The field detection unit 17 refers to the coordinate value of the upper left vertex of the selected reference character frame rectangle on the Y axis, and extracts another character frame rectangle whose coordinate value is approximately equal to the coordinate value of the upper left vertex of the Y axis. (Step Sb2). FIG. 20 is a diagram illustrating the process of step Sb2. When the character frame rectangle R1 is selected as the reference character frame rectangle, the field detection unit 17 extracts character frame rectangles R3 and R5 whose coordinate values on the upper left Y axis are the same or substantially equal as other character frame rectangles, The frame rectangles R2 and R4 are not extracted. In this process, the character frames that make up the field are horizontally written, and the top side is at the same or almost the same position on the Y axis. It is an object. In step Sb2, the field detection unit 17 determines whether another character frame rectangle has been extracted. If not, the field detection unit 17 proceeds to step Sb14 through the connection point C. On the other hand, if the field detection unit 17 has extracted another character frame rectangle, the process proceeds to step Sb4.

フィールド検出部17は、他の文字枠矩形を抽出した場合、基準文字枠矩形として選択した矩形の左上のX軸の座標値と、抽出した他の文字枠矩形の左上のX軸の座標値との差、すなわち、隣接する文字枠矩形との間の距離が、予め定められる所定値以下である他の文字枠矩形を隣接文字枠矩形として選択する。このとき、所定値以下の条件を満たす他の文字枠矩形が複数存在する場合、基準文字枠矩形との距離が最も近い他の文字枠矩形を隣接文字枠矩形として選択する(ステップSb4)。フィールド検出部17は、選択した隣接文字枠矩形にさらに隣接文字枠矩形が存在するか否かを判定する(ステップSb5)。選択した隣接文字枠矩形にさらに隣接文字枠矩形が存在すると判定した場合、フィールド検出部17は、選択した隣接文字枠矩形を基準文字枠矩形に置き換えてステップSb4からの処理を繰り返す(ステップSb6)。   When the field detection unit 17 extracts another character frame rectangle, the coordinate value of the upper left X axis of the rectangle selected as the reference character frame rectangle, the coordinate value of the upper left X axis of the extracted other character frame rectangle, Other character frame rectangles whose distance between the adjacent character frame rectangles is equal to or smaller than a predetermined value are selected as adjacent character frame rectangles. At this time, if there are a plurality of other character frame rectangles that satisfy the condition equal to or less than the predetermined value, the other character frame rectangle that is closest to the reference character frame rectangle is selected as the adjacent character frame rectangle (step Sb4). The field detection unit 17 determines whether there is an adjacent character frame rectangle in addition to the selected adjacent character frame rectangle (step Sb5). If it is determined that there is another adjacent character frame rectangle in the selected adjacent character frame rectangle, the field detection unit 17 replaces the selected adjacent character frame rectangle with the reference character frame rectangle and repeats the processing from step Sb4 (step Sb6). .

図21は、ステップSb4〜Sb6の処理を示す図である。同図において、例えば、文字枠矩形R1〜R4は、同じ大きさであり、文字枠矩形R1〜R4のX軸方向の幅は、全て8ピクセルであり、予め定められる所定値の範囲が12ピクセルであるとする。最初に基準文字枠矩形として選択された文字枠矩形R1の左上のX軸の座標値と、文字枠矩形R2〜R4の左上のX軸の文字枠矩形の差を算出する。基準文字枠矩形R1と、文字枠矩形R2,R3,R4との差は、それぞれ、(8+2=10)ピクセル、(10+8+3=21)ピクセル、(21+8+10=39)ピクセルとなり、3ピクセル範囲内に存在するのは、文字枠矩形R2となる。フィールド検出部17は、文字枠矩形R2を隣接文字枠矩形として選択し、さらに、文字枠矩形R2を基準文字枠矩形として、ステップSb4以降の処理を繰り返す。文字枠矩形R3も、文字枠矩形R2との関係では、ステップSb4の条件を満たすことから、フィールド検出部17は、隣接文字枠矩形として選択する。文字枠矩形R4については、文字枠矩形R3との関係では、ステップSb4の条件を満たさないことから、フィールド検出部17は、隣接文字枠矩形として選択しない。したがって、図21の場合、隣接文字枠矩形としてフィールド検出部17が選択するのは文字枠矩形R2,R3となる。   FIG. 21 is a diagram illustrating the processing of steps Sb4 to Sb6. In the figure, for example, the character frame rectangles R1 to R4 have the same size, the widths of the character frame rectangles R1 to R4 in the X-axis direction are all 8 pixels, and the predetermined value range is 12 pixels. Suppose that First, the difference between the upper left X-axis coordinate value of the character frame rectangle R1 selected as the reference character frame rectangle and the upper left X-axis character frame rectangle of the character frame rectangles R2 to R4 is calculated. Differences between the reference character frame rectangle R1 and the character frame rectangles R2, R3, and R4 are (8 + 2 = 10) pixels, (10 + 8 + 3 = 21) pixels, and (21 + 8 + 10 = 39) pixels, respectively, and exist within a three-pixel range. What is to be done is the character frame rectangle R2. The field detection unit 17 selects the character frame rectangle R2 as the adjacent character frame rectangle, and further repeats the processing after step Sb4 with the character frame rectangle R2 as the reference character frame rectangle. Since the character frame rectangle R3 also satisfies the condition of step Sb4 in relation to the character frame rectangle R2, the field detection unit 17 selects it as the adjacent character frame rectangle. Regarding the character frame rectangle R4, the field detection unit 17 does not select the adjacent character frame rectangle because the condition of step Sb4 is not satisfied in relation to the character frame rectangle R3. Accordingly, in the case of FIG. 21, the field detection unit 17 selects the character frame rectangles R2 and R3 as the adjacent character frame rectangles.

一方、ステップSb5において、選択した隣接文字枠矩形にさらに隣接文字枠矩形が存在しないと判定した場合、フィールド検出部17は、隣接文字枠矩形として選択した文字枠矩形の個数を判定する。選択した隣接文字枠矩形の個数が0個の場合、フィールド検出部17は、接続点Cを通じてステップSb14に進む。選択した隣接文字枠矩形の個数が1個の場合、フィールド検出部17は、接続点Eを通じてステップSb10に進む。選択した隣接文字枠矩形の個数が複数個の場合、フィールド検出部17は、接続点Dを通じてステップSb8に進む(ステップSb7)。図19に示すステップSb8において、フィールド検出部17は、ステップSb1で最初に基準文字枠矩形として選択した文字枠矩形を基準文字枠矩形として再設定する(ステップSb8)。   On the other hand, if it is determined in step Sb5 that there are no more adjacent character frame rectangles in the selected adjacent character frame rectangle, the field detection unit 17 determines the number of character frame rectangles selected as the adjacent character frame rectangles. If the number of selected adjacent character frame rectangles is 0, the field detection unit 17 proceeds to step Sb14 through the connection point C. If the number of selected adjacent character frame rectangles is 1, the field detection unit 17 proceeds to step Sb10 through the connection point E. When the number of selected adjacent character frame rectangles is plural, the field detection unit 17 proceeds to step Sb8 through the connection point D (step Sb7). In step Sb8 shown in FIG. 19, the field detection unit 17 resets the character frame rectangle initially selected as the reference character frame rectangle in step Sb1 as the reference character frame rectangle (step Sb8).

フィールド検出部17は、基準文字枠矩形を基準として、選択した複数の文字枠矩形のうち概ね等間隔に並んでいる文字枠矩形を抽出する(ステップSb9)。図22は、ステップSb9の処理を示す図であり、例えば、文字枠矩形R1が、基準文字枠矩形として選択されている場合、フィールド検出部17は、2ピクセルの等間隔で並んでいる文字枠矩形R2,R3を抽出する。これに対して、文字枠矩形R3と文字枠矩形R4との距離は、5ピクセルになっており、等間隔ではないため、フィールド検出部17は、文字枠矩形R4を抽出しない。   The field detection unit 17 extracts character frame rectangles arranged at approximately equal intervals from the selected plurality of character frame rectangles with reference to the reference character frame rectangle (step Sb9). FIG. 22 is a diagram illustrating the processing in step Sb9. For example, when the character frame rectangle R1 is selected as the reference character frame rectangle, the field detection unit 17 sets the character frames arranged at equal intervals of 2 pixels. Rectangles R2 and R3 are extracted. On the other hand, since the distance between the character frame rectangle R3 and the character frame rectangle R4 is 5 pixels and is not equally spaced, the field detection unit 17 does not extract the character frame rectangle R4.

フィールド検出部17は、基準文字枠矩形を基準として、左上のX軸の座標値が基準文字枠矩形の次に小さい隣接文字枠矩形、すなわち基準文字枠矩形に隣接する文字枠矩形を選択する。そして、フィールド検出部17は、選択した隣接文字枠矩形の高さ、すなわち左上のY軸の座標値と左下のY軸の座標値の差と、基準文字枠矩形の高さとが概ね等しいか否かを判定する(ステップSb10)。フィールド検出部17は、基準文字枠矩形の高さと、選択した隣接文字枠矩形の高さが概ね等しいと判定した場合、ステップSb11に進む。一方、フィールド検出部17は、基準文字枠矩形の高さと、選択した隣接文字枠矩形の高さが概ね等しくないと判定した場合、ステップSb14に進む。   The field detection unit 17 selects an adjacent character frame rectangle whose X-axis coordinate value at the upper left is the second smallest after the reference character frame rectangle based on the reference character frame rectangle, that is, a character frame rectangle adjacent to the reference character frame rectangle. Then, the field detection unit 17 determines whether or not the height of the selected adjacent character frame rectangle, that is, the difference between the upper left Y axis coordinate value and the lower left Y axis coordinate value is substantially equal to the height of the reference character frame rectangle. Is determined (step Sb10). If the field detection unit 17 determines that the height of the reference character frame rectangle is substantially equal to the height of the selected adjacent character frame rectangle, the process proceeds to step Sb11. On the other hand, if the field detection unit 17 determines that the height of the reference character frame rectangle is not substantially equal to the height of the selected adjacent character frame rectangle, the process proceeds to step Sb14.

フィールド検出部17は、基準文字枠矩形の高さと、選択した隣接文字枠矩形の高さが概ね等しいと判定した場合、選択した隣接文字枠矩形をフィールドを構成する文字枠矩形として選択する(ステップSb11)。フィールド検出部17は、フィールドを構成する文字枠矩形として選択した隣接文字枠矩形にさらに隣接文字枠矩形が存在するか否かを判定する(ステップSb12)。フィールドを構成する文字枠矩形として選択した隣接文字枠矩形にさらに隣接文字枠矩形が存在すると判定した場合、フィールド検出部17は、フィールドを構成する文字枠矩形として選択した隣接文字枠矩形を基準文字枠矩形に置き換えてステップSb10からの処理を繰り返す(ステップSb13)。図23は、ステップSb10〜Sb13の処理を示す図であり、フィールド検出部17は、文字枠矩形R1と、文字枠矩形R2とは、高さが概ね等しいため文字枠矩形R2をフィールドを構成する文字枠矩形として選択する。これに対して、フィールド検出部17は、文字枠矩形R2と文字枠矩形R3との高さが異なるため、文字枠矩形R3をフィールドを構成する文字枠矩形として選択しない。   If the field detection unit 17 determines that the height of the reference character frame rectangle is substantially equal to the height of the selected adjacent character frame rectangle, the field detection unit 17 selects the selected adjacent character frame rectangle as a character frame rectangle constituting the field (step Sb11). The field detection unit 17 determines whether or not there is an adjacent character frame rectangle in the adjacent character frame rectangle selected as the character frame rectangle constituting the field (step Sb12). If it is determined that there is an adjacent character frame rectangle in the adjacent character frame rectangle selected as the character frame rectangle constituting the field, the field detection unit 17 uses the adjacent character frame rectangle selected as the character frame rectangle constituting the field as the reference character. It replaces with a frame rectangle and repeats the process from step Sb10 (step Sb13). FIG. 23 is a diagram illustrating the processing of steps Sb10 to Sb13. The field detection unit 17 forms the field of the character frame rectangle R2 because the character frame rectangle R1 and the character frame rectangle R2 are substantially equal in height. Select as a character frame rectangle. On the other hand, the field detection unit 17 does not select the character frame rectangle R3 as the character frame rectangle constituting the field because the character frame rectangle R2 and the character frame rectangle R3 have different heights.

ここまでの文字枠矩形の分類処理で、ステップSb1で基準文字枠矩形として選択した文字枠矩形を1つだけ含む区分か、または、ステップSb1で基準文字枠矩形として選択した文字枠矩形及び1つまたは複数のフィールドを構成する隣接文字枠矩形を含む区分への分類が完了する。フィールド検出部17は、フィールドIDを生成し、生成したフィールドIDに対応付けて、分類した区分に含まれる文字枠矩形の矩形IDを1つのフィールドとしてフィールド情報記憶部51に書き込む(ステップSb14)。フィールド検出部17は、フィールドを構成する全ての矩形の矩形IDに対応する矩形情報記憶部50の「処理状態」の項目に「済み」の項目を書き込む(ステップSb15)。フィールド検出部17は、矩形情報記憶部50を参照し、「矩形種別」が「文字枠」であって「処理状態」の項目に「済み」が書き込まれていない矩形が存在するか否かを判定する(ステップSb16)。フィールド検出部17は、「矩形種別」が「文字枠」であって「処理状態」の項目に「済み」が書き込まれていない矩形が存在する場合、ステップSb1からの処理を繰り返し、「矩形種別」が「文字枠」であって「処理状態」の項目に「済み」が書き込まれていない文字枠矩形が存在しない場合、フィールド検出処理を終了する。   In the classification processing of the character frame rectangles so far, the classification including only one character frame rectangle selected as the reference character frame rectangle in step Sb1, or the character frame rectangle selected as the reference character frame rectangle and one in step Sb1 Alternatively, classification into a section including adjacent character frame rectangles forming a plurality of fields is completed. The field detection unit 17 generates a field ID, writes the rectangle ID of the character frame rectangle included in the classified section as one field in the field information storage unit 51 in association with the generated field ID (step Sb14). The field detection unit 17 writes the “completed” item in the “processing state” item of the rectangle information storage unit 50 corresponding to the rectangle IDs of all the rectangles constituting the field (step Sb15). The field detection unit 17 refers to the rectangular information storage unit 50 and determines whether or not there is a rectangle in which “rectangle type” is “character frame” and “processing” is not written in the item “processing state”. Determination is made (step Sb16). If the “rectangular type” is “character frame” and there is a rectangle in which “completed” is not written in the item of “processing state”, the field detection unit 17 repeats the processing from step Sb1 to obtain “rectangular type”. "Is a" character frame ", and if there is no character frame rectangle in which" completed "is not written in the item of" processing state ", the field detection process ends.

(矩形と罫線の消去)
図8の接続点Bに戻り、矩形消去部20は、矩形情報記憶部50に記憶されている矩形情報を用いて、帳票画像データBFから矩形を消去する(ステップSa21)。矩形消去部20に対して処理の開始を通知する構成としては、例えば、矩形検出部15から、1つの補正帳票画像データについての矩形検出の処理の完了の通知を受けた矩形判定部16が、最後の矩形情報を矩形情報記憶部50に書き込んだ際に、その処理完了の通知を、矩形消去部20に対する処理開始の通知として出力する構成が適用される。罫線消去対応画像分割部21は、矩形消去部20が出力する矩形が消去された帳票画像データBF−Rを受けて、罫線消去用の画像の分割を行う(ステップSa22)。
(Erase rectangles and ruled lines)
Returning to the connection point B in FIG. 8, the rectangle erasure unit 20 erases the rectangle from the form image data BF using the rectangle information stored in the rectangle information storage unit 50 (step Sa21). As a configuration for notifying the rectangle erasing unit 20 of the start of processing, for example, the rectangle determination unit 16 that has received a notification of completion of the rectangle detection processing for one correction form image data from the rectangle detection unit 15, A configuration is adopted in which, when the last rectangular information is written in the rectangular information storage unit 50, a notification of the completion of the processing is output as a processing start notification to the rectangular erasing unit 20. The ruled line erasure corresponding image dividing unit 21 receives the form image data BF-R from which the rectangle output from the rectangular erasing unit 20 is erased, and divides the image for ruled line erasure (step Sa22).

ここで、図24、25を参照しつつ、罫線消去用の画像の分割について説明する。罫線を消去する画像処理としては、例えば、30ピクセル以上の黒色画素が連続している部分を罫線と判定して白色のピクセルに置き換えて罫線を消去していく画像処理などが適用される。なお、罫線は、直線に限られるものではなく曲線なども含み、罫線であるか否かの判定は、黒色画素の連続数の変わりに、黒色画素の密度などであってもよい。罫線消去用の画像分割とは、罫線消去部22における罫線であるか否かの判定処理を考慮して、境界領域において罫線の判定処理が上手く行われるように境界を少し拡張し、少し大きめの領域に分割する処理である。具体的には、図25に示すように、帳票画像データBF−Rの上下辺の中点を結ぶ線分、すなわちDL1の線分と、左右辺の中点を結ぶ線分、すなわちDL2の線分によって区切られる領域よりも、拡張領域EX1と拡張領域EX2を加えた少し大きめの領域(1)となるように画像分割を行う。   Here, with reference to FIGS. 24 and 25, division of an image for erasing ruled lines will be described. As image processing for erasing ruled lines, for example, image processing in which a portion where black pixels of 30 pixels or more are continuous is determined as a ruled line and replaced with white pixels to erase the ruled line is applied. Note that the ruled line is not limited to a straight line but includes a curved line, and whether or not it is a ruled line may be determined based on the density of black pixels instead of the number of continuous black pixels. The image division for ruled line erasing is a slightly larger and slightly larger boundary so that the ruled line judgment process is performed well in the boundary area in consideration of the judgment process of the ruled line erasing unit 22 as to whether or not the ruled line is a ruled line. This is a process of dividing into areas. Specifically, as shown in FIG. 25, a line segment connecting the midpoints of the upper and lower sides of the form image data BF-R, ie, a line segment connecting DL1 and a midpoint of the left and right sides, ie, DL2 line. The image is divided so as to be a slightly larger area (1) obtained by adding the extension area EX1 and the extension area EX2 than the area divided by minutes.

例えば、連続する30ピクセルで罫線と判定する場合、線分DL1の左側に1ピクセルだけ存在し、残りの29ピクセルが線分D1と垂直方向に直線で線分DL1の右側に存在する場合であっても線分DL1の左側の1ピクセルを罫線として消去する必要がある。そのため、拡張する拡張領域EX1の幅を29ピクセルとすることにより、線分DL1の左側の1ピクセルは、罫線消去部22による罫線の消去処理において、連続して存在する30ピクセルの左端のピクセルとなり、消去されることになる。縦方向の拡張領域EX2についても同様に29ピクセルとなる。なお、拡張領域EX1,EX2の大きさは、どれだけのピクセルを罫線として判定するかという画像処理の構成に依存するとともに、画像読取部10が読み取った画像の解像度によっても適宜変更されるものである。   For example, when determining a ruled line with 30 consecutive pixels, there is only one pixel on the left side of the line segment DL1, and the remaining 29 pixels are straight lines perpendicular to the line segment D1 and on the right side of the line segment DL1. However, it is necessary to erase one pixel on the left side of the line segment DL1 as a ruled line. Therefore, by setting the width of the extended area EX1 to be expanded to 29 pixels, one pixel on the left side of the line segment DL1 becomes the leftmost pixel of the 30 pixels continuously present in the ruled line erasing process by the ruled line erasing unit 22. Will be erased. Similarly, the vertical extension area EX2 has 29 pixels. The sizes of the extended areas EX1 and EX2 depend on the image processing configuration of how many pixels are determined as ruled lines, and are appropriately changed depending on the resolution of the image read by the image reading unit 10. is there.

図25のように分割した場合、少し大きめの領域に分割することから、図24に示すように領域(1)、(2)、(3)、(4)は、境界領域においてお互い重なった部分が存在することになる。なお、図24において、領域(1)と領域(4)は、太線で境界線を表し、領域(2)と領域(3)は、境界線を破線で示している。罫線消去対応画像合成部23において画像を合成する場合には、それぞれ、線分DL1及び線分DL2によって区切られる領域、すなわち領域(1)については、罫線消去後に、拡張領域EX1,EX2の部分を削除した領域を合成する。   When dividing as shown in FIG. 25, the area (1), (2), (3), (4) overlaps each other in the boundary area as shown in FIG. Will exist. In FIG. 24, the area (1) and the area (4) are indicated by bold lines, and the areas (2) and (3) are indicated by broken lines. When the image is synthesized by the ruled line erasure corresponding image synthesizing unit 23, for the area delimited by the line segment DL1 and the line segment DL2, that is, the area (1), after the ruled line erase, Synthesize the deleted area.

図26に示すように、罫線消去対応画像分割部21は、矩形が消去された帳票画像データBF−Rを4つの領域に分割すると、各々を、罫線消去部22を構成するスレッド1,2,3,4に出力する。スレッド1における処理について説明すると、分割された分割帳票画像データBF−RD1W(上記の領域(1)に対応)は、罫線消去部22のスレッド1によって画像処理により罫線の消去が行われる(ステップSa23−1)。罫線消去部22のスレッド1は、罫線を消去した分割帳票画像データBF−RLD1Wを出力する。スレッド1と同様の処理がスレッド2,3,4においても行われ、これにより、罫線消去の処理が完了し、スレッド1,2,3,4の各々が罫線を消去した分割帳票画像データBF−RLD2W,BF−RLD3W,BF−RLD4Wを出力する(ステップSa23)。4つのスレッド1,2,3,4によりマルチスレッド処理を行うことで、分割帳票画像データBF−RD1W,BF−RD2W,BF−RD3W,BF−RD4Wに対する罫線消去の処理が並行に行われるため、計算量が多い罫線消去の処理の処理負荷を軽減して画像処理の速度を向上させることができる。   As shown in FIG. 26, the ruled line erasure corresponding image dividing unit 21 divides the form image data BF-R from which the rectangle has been erased into four areas, and each of them is converted into threads 1, 2,. Output to 3 and 4. The process in the thread 1 will be described. The divided form image data BF-RD1W (corresponding to the area (1) described above) is erased by image processing by the thread 1 of the ruled line erasing unit 22 (step Sa23). -1). The thread 1 of the ruled line erasing unit 22 outputs the divided form image data BF-RLD1W from which the ruled lines have been erased. The same processing as that of the thread 1 is performed in the threads 2, 3, 4, whereby the ruled line erasing process is completed, and the divided form image data BF− in which each of the threads 1, 2, 3, 4 has erased the ruled line RLD2W, BF-RLD3W, and BF-RLD4W are output (step Sa23). By performing multi-thread processing with four threads 1, 2, 3, and 4, ruled line erasure processing is performed in parallel on the divided form image data BF-RD1W, BF-RD2W, BF-RD3W, and BF-RD4W. It is possible to reduce the processing load of the ruled line erasing process with a large amount of calculation and improve the image processing speed.

罫線消去対応画像合成部23は、分割帳票画像データBF−RLD1Wの中から、図25に示す拡張領域EX1,EX2を含まない画像領域の画像を抽出する。換言すると、罫線消去対応画像合成部23は、分割帳票画像データBF−RLD1Wについて、拡張領域EX1,EX2を除いた画像を取得する。また、罫線消去対応画像合成部23は、分割帳票画像データBF−RLD2W,BF−RLD3W,BF−RLD4Wにおいても同様に、それぞれの拡張領域EX1,EX2に相当する拡張領域を含まない画像領域を抽出する。罫線消去対応画像合成部23は、抽出した分割帳票画像データBF−RLD1W,BF−RLD2W,BF−RLD3W,BF−RLD4Wを合成し、罫線と矩形が消去された帳票画像データBF−RLWを出力する(ステップSa24)。   The ruled line erasure corresponding image composition unit 23 extracts an image of an image area that does not include the extended areas EX1 and EX2 shown in FIG. 25 from the divided form image data BF-RLD1W. In other words, the ruled line erasure corresponding image composition unit 23 acquires an image excluding the extended areas EX1 and EX2 for the divided form image data BF-RLD1W. Similarly, the ruled line erasure corresponding image composition unit 23 extracts image areas that do not include extended areas corresponding to the extended areas EX1 and EX2 in the divided form image data BF-RLD2W, BF-RLD3W, and BF-RLD4W. To do. The ruled line erasure corresponding image composition unit 23 synthesizes the extracted divided form image data BF-RLD1W, BF-RLD2W, BF-RLD3W, and BF-RLD4W, and outputs the form image data BF-RLW from which the ruled lines and the rectangle are erased. (Step Sa24).

(文字の検出)
文字検出部24は、罫線と矩形が消去された帳票画像データBF−RLWから画像処理により文字を1文字ずつ検出し、検出した文字を文字コードなどの文字情報へ変換する。また、文字検出部24は、検出した文字の座標情報、すなわち、左上のX,Y座標と右下のX,Y座標を検出する。文字検出部24は、文字を検出するごとに文字IDを生成し、生成した文字IDと、検出した文字の文字コードなどの文字情報と、検出した文字の座標情報とを文字情報記憶部52に書き込む(ステップSa25)。
(Character detection)
The character detection unit 24 detects characters one by one by image processing from the form image data BF-RLW from which the ruled lines and rectangles have been deleted, and converts the detected characters into character information such as a character code. The character detection unit 24 detects the coordinate information of the detected character, that is, the upper left X and Y coordinates and the lower right X and Y coordinates. The character detection unit 24 generates a character ID every time a character is detected, and stores the generated character ID, character information such as the character code of the detected character, and coordinate information of the detected character in the character information storage unit 52. Writing is performed (step Sa25).

(キーワードの検出)
キーワード検出部25は、1つの帳票画像データにおいて文字検出部24による文字検出の処理が全て完了すると、検出された文字からキーワードを検出する。なお、キーワード検出部25に対して処理の開始を通知する構成としては、例えば、文字検出部24が、1つの帳票画像データにおいて、全ての文字の検出処理を完了すると、処理完了の通知をキーワード検出部25に対する処理開始の通知として出力する構成が適用される。
(Keyword detection)
The keyword detection unit 25 detects a keyword from the detected characters when all the character detection processing by the character detection unit 24 is completed in one form image data. As a configuration for notifying the keyword detection unit 25 of the start of processing, for example, when the character detection unit 24 completes the detection processing of all characters in one form image data, the process completion notification is sent to the keyword. A configuration in which the detection unit 25 outputs a process start notification is applied.

キーワード検出部25によるキーワードの検出は、まず、文字情報記憶部52に記憶されている文字の位置関係、大きさ、文字同士の並びの間隔などの情報に基づいて可能性のあるキーワードを全て検出していく。そして、検出したキーワードのなかで、辞書属性情報記憶部53の「キーワード」の項目に記憶されている文字列または文字に完全一致、または部分一致するキーワードを検出する(ステップSa26)。ここで、キーワード検出部25が、検出したキーワードが、例えば「振込み手数料」である場合、キーワード検出部25は、辞書属性情報記憶部53の「キーワード」の項目に完全一致、または、部分一致するキーワードが存在するか否かを判定する。ここでは、検出したキーワードに完全一致する「振込み手数料」が「キーワード」の項目に存在するため、キーワード検出部25は、「振込み手数料」をキーワードとして検出する。キーワード検出部25は、キーワードを検出すると、検出したキーワードに対応する属性情報を辞書属性情報記憶部53から読み出す。図5の例では、「振込み手数料」のキーワードに属性情報として「数値」が記憶されているため、「数値」を属性情報として読み出す(ステップSa27)。   In the keyword detection by the keyword detection unit 25, first, all possible keywords are detected based on information such as the positional relationship, size, and spacing between characters stored in the character information storage unit 52. I will do it. From the detected keywords, a keyword that completely or partially matches the character string or character stored in the “keyword” item of the dictionary attribute information storage unit 53 is detected (step Sa26). Here, when the keyword detected by the keyword detection unit 25 is, for example, “transfer fee”, the keyword detection unit 25 completely or partially matches the item “keyword” in the dictionary attribute information storage unit 53. Determine whether a keyword exists. Here, since the “transfer fee” that completely matches the detected keyword exists in the “keyword” item, the keyword detection unit 25 detects “transfer fee” as a keyword. When the keyword detection unit 25 detects a keyword, the keyword detection unit 25 reads attribute information corresponding to the detected keyword from the dictionary attribute information storage unit 53. In the example of FIG. 5, since “numeric value” is stored as attribute information in the keyword “transfer fee”, “numeric value” is read as attribute information (step Sa27).

例えば、キーワード検出部25が、文字情報記憶部52に記憶されている文字から「ご依頼日」のようなキーワードを検出したとする。この場合、「ご依頼日」のキーワードは、辞書属性情報記憶部53の「キーワード」の項目に記憶されている「依頼日」と「日」の双方に部分一致する。したがって、キーワード検出部25は、部分一致するものがあるため、キーワードとして「ご依頼日」を検出することになるが、これに対する「属性情報」を正しく読み出すことができない。そのため、部分一致するものが複数存在する場合には、最も多くの文字数で一致したものに対応すると判定し、それに対応する属性情報を読み出すことになる。   For example, it is assumed that the keyword detection unit 25 detects a keyword such as “request date” from characters stored in the character information storage unit 52. In this case, the keyword “request date” partially matches both “request date” and “date” stored in the “keyword” item of the dictionary attribute information storage unit 53. Therefore, the keyword detection unit 25 detects “request date” as a keyword because there is a partial match, but it cannot correctly read “attribute information” for this. For this reason, when there are a plurality of partial matches, it is determined that the match is the largest number of characters, and attribute information corresponding to the match is read out.

キーワード検出部25は、キーワード外接矩形の座標情報を検出する。図27は、キーワード外接矩形KCRを示す図であり、例えば、「氏名」というキーワードを検出した場合、キーワード外接矩形は、「氏名」というキーワードのX軸における最小と最大の座標、及びY軸における最小と最大の座標によって囲まれる矩形となる。したがって、キーワード検出部25は、「氏名」というキーワードの場合、文字情報記憶部52に記憶されている「氏」と「名」のそれぞれの左上のX,Y座標情報と、右下のX、Y座標情報から、Y軸については、最小と最大の座標情報をそれぞれyとyとして選択する。また、キーワード検出部25は、X軸については、左に配置されている「氏」の左上のX軸の座標情報を、最小の座標値xとし、右に配置されている「名」の右下のX軸の座標情報を、最大の座標値xとして選択する。これにより、キーワード検出部25は、キーワード「氏名」のキーワード外接矩形の座標情報として、左上のX,Y座標情報(x,y)、及び右下のX,Y座標情報(x,y)を検出する(ステップSa28)。キーワード検出部25は、新たなキーワードを検出するごとに、キーワードIDを生成し、生成したキーワードIDと、検出したキーワードと、キーワードに対応する属性情報と、キーワード外接矩形の左上のX,Yの座標情報及び右下のX,Yの座標情報とを対応付けて帳票定義情報記憶部54に書き込む(ステップSa29)。 The keyword detection unit 25 detects the coordinate information of the keyword circumscribed rectangle. FIG. 27 is a diagram showing a keyword circumscribing rectangle KCR. For example, when the keyword “name” is detected, the keyword circumscribing rectangle is the minimum and maximum coordinates of the keyword “name” on the X axis and the Y axis. A rectangle surrounded by the minimum and maximum coordinates. Therefore, in the case of the keyword “name”, the keyword detection unit 25 stores the upper left X and Y coordinate information of “M” and “Name” stored in the character information storage unit 52, the lower right X, from Y coordinate information for the Y axis, to select the minimum and maximum coordinate information as y 1 and y 2, respectively. Also, the keyword detector 25 for X-axis, the coordinate information of the upper left X-axis of "Mr." arranged on the left, and the minimum coordinate values x 1, it is located to the right of the "Name" the coordinate information of the X-axis of the lower right is selected as the maximum coordinate value x 2. As a result, the keyword detection unit 25 uses the upper-left X and Y coordinate information (x 1 , y 1 ) and the lower right X and Y coordinate information (x 2 , y 2) detecting the (step SA28). Each time a new keyword is detected, the keyword detection unit 25 generates a keyword ID. The generated keyword ID, the detected keyword, attribute information corresponding to the keyword, and X and Y at the upper left of the keyword circumscribed rectangle The coordinate information and the lower right X, Y coordinate information are associated and written to the form definition information storage unit 54 (step Sa29).

また、キーワード検出部25は、キーワードID、左上のX,Yの座標情報、右下のX,Yの座標情報をキーワード対応矩形検出部26に出力する。キーワード対応矩形検出部26は、キーワード検出部25から左上のX,Yの座標情報、右下のX,Yの座標情報を受けて、2つの座標によって定められるキーワード外接矩形を囲む適切な大きさの矩形が存在するか否かを、矩形情報記憶部50に記憶されている「矩形種別」が「その他」の矩形の中から検出する。適切な大きさの矩形とは、例えば、キーワードを囲む矩形として大きすぎない矩形を意味する。具体的には、図28に示すように、キーワード対応矩形検出部26は、予め定められるX軸方向の閾値と、Y軸方向の閾値を内部に記憶しており、キーワード外接矩形KCRの左上のX、Y座標(x,y)及び右下のX,Y座標(x,y)と、矩形KRの左上のX、Y座標(X,Y)及び右下のX,Y座標(X,Y)とに基づいて、x−X,X−x,y−Y,Y−yを算出する。上述したように座標系は、左上を原点とし、X軸については、右方向、Y軸については、下方向を正としていることから、「氏名」というキーワードが、矩形KRに囲まれている場合、上記の4つの式により得られる値は、全て正の値となる。また、キーワード対応矩形検出部26は、x−Xの差及びX−xの差のそれぞれが、上記のX軸方向の閾値以内であり、y−Yの差及びY−yの差のそれぞれが、上記のY軸方向の閾値以内である場合、キーワード外接矩形を囲む適切な大きさの矩形であると判定する。キーワード対応矩形検出部26は、この判定処理により、キーワード外接矩形を囲む矩形を検出した場合、検出した矩形の矩形IDを矩形情報記憶部50から読み出し、キーワードIDと、読み出した矩形IDとを対応付けて帳票定義情報記憶部54の「対応矩形」の項目に書き込む。なお、キーワードを囲む矩形が検出できなかった場合、キーワード対応矩形検出部26は、「対応矩形」の項目に「なし」を書き込む(ステップSa30)。 The keyword detection unit 25 outputs the keyword ID, the upper left X and Y coordinate information, and the lower right X and Y coordinate information to the keyword corresponding rectangle detection unit 26. The keyword-corresponding rectangle detection unit 26 receives the upper left X and Y coordinate information and the lower right X and Y coordinate information from the keyword detection unit 25, and has an appropriate size surrounding the keyword circumscribed rectangle defined by the two coordinates. Is detected from the rectangles whose “rectangle type” stored in the rectangle information storage unit 50 is “other”. An appropriately sized rectangle means, for example, a rectangle that is not too large as a rectangle surrounding the keyword. Specifically, as shown in FIG. 28, the keyword-corresponding rectangle detection unit 26 stores therein a predetermined threshold value in the X-axis direction and a threshold value in the Y-axis direction, and an upper left corner of the keyword circumscribed rectangle KCR. X, Y coordinates (x 1 , y 1 ), lower right X, Y coordinates (x 2 , y 2 ), upper left X, Y coordinates (X 1 , Y 1 ), and lower right X, rectangle KR Based on the Y coordinate (X 2 , Y 2 ), x 1 −X 1 , X 2 −x 2 , y 1 −Y 1 , Y 2 −y 2 are calculated. As described above, the coordinate system has the upper left as the origin, the right direction for the X-axis and the downward direction for the Y-axis, and the keyword “name” is surrounded by the rectangle KR. The values obtained by the above four formulas are all positive values. In addition, the keyword-corresponding rectangle detection unit 26 determines that the difference of x 1 −X 1 and the difference of X 2 −x 2 are within the threshold in the X-axis direction, and the difference of y 1 −Y 1 and Y 2 If each of the differences in −y 2 is within the threshold value in the Y-axis direction, it is determined that the rectangle is an appropriately sized rectangle surrounding the keyword circumscribed rectangle. When the keyword-corresponding rectangle detection unit 26 detects a rectangle surrounding the keyword circumscribing rectangle by this determination process, the keyword-corresponding rectangle detection unit 26 reads the rectangle ID of the detected rectangle from the rectangle information storage unit 50, and associates the keyword ID with the read rectangle ID. At the same time, it is written in the item “corresponding rectangle” in the form definition information storage 54. When the rectangle surrounding the keyword cannot be detected, the keyword corresponding rectangle detection unit 26 writes “none” in the item “corresponding rectangle” (step Sa30).

(フィールド探索処理)
フィールド探索部27は、帳票定義情報記憶部54に書き込まれたキーワードに対応して帳票に印刷されているフィールドをフィールド情報記憶部51から検出し、キーワードとフィールドの対応付けを行うフィールド探索処理を行う(ステップSa31)。このとき、フィールド検出部17によるステップSa9のフィールド検出処理が完了している必要があるため、フィールド検出処理が完了していない場合、フィールド探索部27は、完了するまで待機して処理の同期を行う。
(Field search process)
The field search unit 27 detects a field printed on the form corresponding to the keyword written in the form definition information storage unit 54 from the field information storage unit 51, and performs field search processing for associating the keyword with the field. This is performed (step Sa31). At this time, since the field detection process in step Sa9 by the field detection unit 17 needs to be completed, if the field detection process is not completed, the field search unit 27 waits until completion and synchronizes the processes. Do.

図29は、フィールド探索処理の流れを示すフローチャートである。フィールド探索部27は、帳票定義情報記憶部54の「対応フィールド」の項目が、「−」で示される空欄となっているレコードを選択する(ステップSc1)。フィールド探索部27は、選択したレコードの「対応矩形」の項目に矩形IDが記憶されているか否かを判定する(ステップSc2)。フィールド探索部27は、「対応矩形」の項目に矩形IDが記憶されていない、すなわち「なし」となっている場合、帳票定義情報記憶部54の「左上のX,Y座標」と「右下のX,Y座標」の座標情報、すなわちキーワード外接矩形の座標情報を読み出して基準矩形情報とする(ステップSc3)。一方、フィールド探索部27は、「対応矩形」の項目に矩形IDが記憶されていると判定した場合、当該矩形IDを読み出し、矩形情報記憶部50から当該矩形IDに対応する「左上のX,Y座標」と「右下のX,Y座標」の座標情報を読み出して基準矩形情報とする(ステップSc4)。これにより、フィールド探索部27は、矩形IDが存在する場合は、図30に示すようにキーワードを囲む矩形KR1の座標情報を、矩形IDがない場合は、図31に示すようにキーワード外接矩形KCR1の座標情報を取得する。   FIG. 29 is a flowchart showing the flow of the field search process. The field search unit 27 selects a record in which the item “corresponding field” in the form definition information storage unit 54 is a blank column indicated by “−” (step Sc1). The field search unit 27 determines whether or not a rectangle ID is stored in the “corresponding rectangle” item of the selected record (step Sc2). When the rectangle ID is not stored in the item “corresponding rectangle”, that is, “none”, the field search unit 27 displays “X and Y coordinates on upper left” and “lower right” in the form definition information storage unit 54. The coordinate information of “X, Y coordinates”, that is, the coordinate information of the keyword circumscribed rectangle is read out as reference rectangle information (step Sc3). On the other hand, if the field search unit 27 determines that the rectangle ID is stored in the item “corresponding rectangle”, the field search unit 27 reads the rectangle ID and reads “X, The coordinate information of “Y coordinate” and “X, Y coordinates in the lower right” is read out and used as reference rectangle information (step Sc4). Thereby, the field search unit 27 displays the coordinate information of the rectangle KR1 surrounding the keyword as shown in FIG. 30 when the rectangle ID exists, and the keyword circumscribed rectangle KCR1 as shown in FIG. 31 when there is no rectangle ID. Get coordinate information of.

フィールド探索部27は、基準矩形情報に基づいて、基準矩形の形状が、縦長であるか、または横長であるかを判定する。縦長とは、キーワードが縦書きになっていることを示し、横長とは、キーワードが横書きになっていることを示す(ステップSc5)。なお、キーワードの内容が1文字である場合などで、縦と横の辺の長さが同じ場合、縦長、横長のいずれを選択してもよい。   The field search unit 27 determines whether the shape of the reference rectangle is vertically long or horizontally long based on the reference rectangle information. Longitudinal indicates that the keyword is vertically written, and horizontally long indicates that the keyword is horizontally written (step Sc5). In addition, when the content of the keyword is one character and the lengths of the vertical and horizontal sides are the same, either vertical or horizontal may be selected.

フィールド探索部27は、基準矩形の形状が縦長であると判定した場合、図30に示すように、横書きの帳票では、対応するフィールドは、右方向に存在する傾向がある。そこで、基準矩形の形状が縦長の場合、矩形KR1を基準矩形とし、以下の3つのパラメータを設定する(ステップSc6)。3つのパラメータとは、すなわち、1)基準頂点:基準矩形の右上の座標、2)高さ:基準矩形の高さ±予め定められる誤差、3)横幅:X軸方向についての標準探索範囲±誤差、である。この3つのパラメータにより、図32に示すようなフィールド探索範囲VSA1を定める。ここで、1)の基準頂点とは、フィールド探索範囲VSA1の座標位置を定める基準座標である。2)の高さとは、基準頂点にY軸方向の正方向に基準矩形の高さを加え、さらに予め定められる誤差をY軸の正負の方向に加えた値となる。3)の横幅とは、基準頂点にX軸方向の正方向に、予め定められるX軸方向についての標準探索範囲を加え、さらに予め定められる誤差をX軸の正負の方向に加えた値となる。3)のパラメータにおけるX軸方向についての標準探索範囲とは、経験的に定められるフィールドが存在すると想定される範囲であり、画像の解像度によって変化する値である。また、誤差についても同様に、経験的に定められる値であり、画像の解像度によって変化する値であり、高さと横幅の誤差の値は、同じ値であってもよいし、異なる値であってもよい。   When the field search unit 27 determines that the shape of the reference rectangle is vertically long, as shown in FIG. 30, in the horizontally written form, the corresponding field tends to exist in the right direction. Accordingly, when the reference rectangle is vertically long, the rectangle KR1 is set as the reference rectangle, and the following three parameters are set (step Sc6). The three parameters are: 1) reference vertex: upper right coordinate of the reference rectangle, 2) height: height of the reference rectangle ± predetermined error, 3) width: standard search range in the X-axis direction ± error . A field search range VSA1 as shown in FIG. 32 is defined by these three parameters. Here, the reference vertex 1) is a reference coordinate that determines the coordinate position of the field search range VSA1. The height of 2) is a value obtained by adding the height of the reference rectangle to the reference vertex in the positive direction of the Y axis and further adding a predetermined error in the positive and negative directions of the Y axis. The horizontal width of 3) is a value obtained by adding a standard search range in a predetermined X-axis direction to the reference vertex in the positive direction in the X-axis direction and further adding a predetermined error in the positive and negative directions of the X-axis. . The standard search range in the X-axis direction in the parameter 3) is a range in which a field that is determined empirically exists and is a value that varies depending on the resolution of the image. Similarly, the error is a value determined empirically, and is a value that varies depending on the resolution of the image. The value of the error in height and width may be the same or different. Also good.

一方、フィールド探索部27は、基準矩形の形状が横長であると判定した場合、図31に示すように、横書きの帳票では、対応するフィールドは、右、左下、または下方向に存在する傾向がある。そこで、基準矩形の形状が横長の場合、キーワード外接矩形KCR1を基準矩形として、図33に示すように3つのフィールド探索範囲HSA1,HSB1,HSC1を設定する(ステップSc7)。基準矩形の右に存在するフィールド探索範囲HSA1は、1)基準頂点:基準矩形の右上の座標、2)高さ:基準矩形の高さ±誤差、3)横幅:X軸方向についての標準探索範囲±誤差の3つのパラメータにより設定される。基準矩形の左下に存在するフィールド探索範囲HSB1は、1)基準頂点:基準矩形の左下の座標、2)高さ:Y軸方向についての標準探索範囲±誤差、3)横幅:基準矩形の横幅/2の3つのパラメータにより設定される。基準矩形の下方向に存在するフィールド探索範囲HSC1は、1)基準頂点:基準矩形の左下の座標、2)高さ:Y軸方向についての標準探索範囲±誤差、3)横幅:基準矩形の横幅の3つのパラメータにより設定される。ここで、X軸方向についての標準探索範囲及びY軸方向についての標準探索範囲とは、経験的に定められるフィールドが存在すると想定される範囲であり、画像の解像度によって変化する値である。なお、Y軸方向についての標準探索範囲は、フィールド探索範囲HSB1,HSC1について同じ値であってもよいし、異なる値であってもよい。また、誤差についても同様に、経験的に定められる値であり、画像の解像度によって変化する値であり、フィールド探索範囲HSA1,HSB1,HSC1のそれぞれについて、同じ値であってもよいし、異なる値であってもよい。また、フィールド探索範囲HSA1の高さと横幅の誤差の値は、同じ値であってもよいし、異なる値であってもよい。   On the other hand, when the field search unit 27 determines that the shape of the reference rectangle is horizontally long, as shown in FIG. 31, in the horizontally written form, the corresponding field tends to exist in the right, lower left, or downward direction. is there. Therefore, if the reference rectangle is horizontally long, the keyword circumscribed rectangle KCR1 is set as the reference rectangle, and three field search ranges HSA1, HSB1, and HSC1 are set as shown in FIG. 33 (step Sc7). The field search range HSA1 existing to the right of the reference rectangle is 1) reference vertex: upper right coordinates of the reference rectangle, 2) height: reference rectangle height ± error, 3) width: standard search range in the X-axis direction. It is set by three parameters of ± error. The field search range HSB1 existing at the lower left of the reference rectangle is 1) reference vertex: lower left coordinates of the reference rectangle, 2) height: standard search range ± error in the Y-axis direction, 3) width: width of the reference rectangle / 2 is set by three parameters. The field search range HSC1 existing in the downward direction of the reference rectangle is as follows: 1) Reference vertex: lower left coordinates of the reference rectangle, 2) Height: standard search range ± error in the Y-axis direction, 3) Width: width of the reference rectangle These three parameters are set. Here, the standard search range in the X-axis direction and the standard search range in the Y-axis direction are ranges in which fields that are determined empirically exist, and are values that vary depending on the resolution of the image. The standard search range in the Y-axis direction may be the same value or a different value for the field search ranges HSB1 and HSC1. Similarly, the error is a value determined empirically and is a value that varies depending on the resolution of the image. The field search ranges HSA1, HSB1, and HSC1 may be the same value or different values. It may be. Further, the height and width error values of the field search range HSA1 may be the same value or different values.

フィールド探索部27は、設定したフィールド探索範囲にフィールドが存在するか否かを判定する(ステップSc8)。具体的には、フィールド探索部27は、フィールド情報記憶部51に記憶されている各フィールドの「左上のX,Y座標」と「右下のX,Y座標」の項目の座標値を参照し、これら2つの座標値によって囲まれる領域が、設定したフィールド探索範囲と重複するか否かによって判定を行う。例えば、図32のフィールド探索範囲VSA1の場合、図34に示すようにフィールドFE1の左側の部分がフィールド探索範囲VSA1と重複しているので、フィールド探索部27は、フィールドが存在するとして判定する。また、図33のフィールド探索範囲HSA1,HSB1,HSC1の場合、フィールドFE2は、フィールド探索範囲HSB1とは左側の部分で、フィールド探索範囲HSC1とは中央の部分で重複しており、フィールド探索範囲HSA1とは、右側の上方の一部が重複している。したがって、フィールド探索部27は、フィールドが存在するとして判定する。   The field search unit 27 determines whether a field exists in the set field search range (step Sc8). Specifically, the field search unit 27 refers to the coordinate values of the items “upper left X, Y coordinates” and “lower right X, Y coordinates” of each field stored in the field information storage unit 51. The determination is made based on whether or not the region surrounded by these two coordinate values overlaps the set field search range. For example, in the case of the field search range VSA1 in FIG. 32, since the left portion of the field FE1 overlaps with the field search range VSA1 as shown in FIG. 34, the field search unit 27 determines that a field exists. In the case of the field search ranges HSA1, HSB1, and HSC1 in FIG. 33, the field FE2 overlaps the field search range HSB1 on the left side and the field search range HSC1 in the center, and the field search range HSA1. And the upper part of the right side overlaps. Therefore, the field search unit 27 determines that a field exists.

フィールド探索部27は、フィールドが存在する判定した場合、当該フィールドのフィールドIDをフィールド情報記憶部51から読み出す。そして、フィールド探索部27は、処理対象のキーワードのキーワードIDに対応付けて、読み出したフィールドIDを帳票定義情報記憶部54の「対応フィールド」の項目に書き込んで、キーワードとフィールドとを対応付ける(ステップSc9)。なお、フィールド探索部27は、あるキーワードについて、複数のフィールドを検出した場合、フィールドの左上の頂点と基準頂点の距離が最も短いフィールドを、当該キーワードに対するフィールドとして検出する。一方、フィールド探索部27は、フィールドが存在しないと判定した場合、処理対象のキーワードのキーワードIDに対応付けて、帳票定義情報記憶部54の「対応フィールド」の項目に「処理済み」と書き込む(ステップSc10)。   When the field search unit 27 determines that a field exists, the field search unit 27 reads the field ID of the field from the field information storage unit 51. Then, the field search unit 27 writes the read field ID in the “corresponding field” item of the form definition information storage unit 54 in association with the keyword ID of the keyword to be processed, and associates the keyword with the field (step) Sc9). When the field search unit 27 detects a plurality of fields for a certain keyword, the field search unit 27 detects the field having the shortest distance between the upper left vertex of the field and the reference vertex as the field for the keyword. On the other hand, if the field search unit 27 determines that the field does not exist, the field search unit 27 writes “processed” in the “corresponding field” item of the form definition information storage unit 54 in association with the keyword ID of the keyword to be processed ( Step Sc10).

フィールド探索部27は、帳票定義情報記憶部54の「対応フィールド」の項目が空欄を示す「−」となっているレコードが存在するか否かを判定する(ステップSc11)。空欄になっているレコードが存在する場合、フィールド探索部27は、ステップSc1からの処理を繰り返す。一方、空欄になっているレコードが存在しない場合、フィールド探索部27は、フィールド探索処理を終了する。   The field search unit 27 determines whether or not there is a record in which the item “corresponding field” in the form definition information storage unit 54 is “−” indicating a blank (Step Sc11). If there is a blank record, the field search unit 27 repeats the process from step Sc1. On the other hand, if there is no blank record, the field search unit 27 ends the field search process.

上記の第1実施形態の構成により、画像読取部10が、帳票を光学的に読み取って帳票の画像データを生成し、2値化部12によって、2値化された帳票画像データが生成される。補正部13は、帳票画像データに対して2値化処理によって生じた欠損を埋める補正を行い補正帳票画像データを生成する。矩形検出部15は、補正帳票画像データから矩形を検出し、フィールド検出部17は、検出された矩形に基づいて、フィールドを検出する。一方、矩形消去部20と罫線消去部22によって矩形と罫線が消去された帳票画像データから、文字検出部24は、文字を検出し、キーワード検出部25は、検出された文字に基づいてキーワードを検出し、辞書属性情報記憶部53に記憶されているキーワードに対応付けられている属性情報を読み出す。フィールド探索部27は、フィールド検出部17が検出したフィールドとキーワード検出部25が検出したキーワードを対応付け、帳票定義情報記憶部54に、帳票の定義情報として、キーワードとフィールドと属性情報とを関連付けて記憶させる。これにより、帳票を光学的に読み取って生成した帳票画像データから、手書き文字を記入させるフィールドと、当該フィールドに記入させる文字の種類等を示す属性情報が関連付けられるキーワードとを抽出して、関係のあるフィールドとキーワードとを対応付けることが可能となる。したがって、その後に、手書き記入された帳票を読み取った際に、フィールドとキーワードと属性情報とを対応付けた定義情報に基づいて、フィールドに記入された手書き文字の文字種が正しいものであるかといった判定処理が可能となり、誤っている場合、記入者に修正を促すことで、帳票に手書きで記入される情報の精度を高めることが可能となる。   With the configuration of the first embodiment, the image reading unit 10 optically reads a form to generate form image data, and the binarization unit 12 generates binarized form image data. . The correcting unit 13 corrects the form image data so as to fill in the defects generated by the binarization process, and generates corrected form image data. The rectangle detection unit 15 detects a rectangle from the corrected form image data, and the field detection unit 17 detects a field based on the detected rectangle. On the other hand, the character detection unit 24 detects characters from the form image data from which the rectangles and ruled lines have been deleted by the rectangle erasing unit 20 and the ruled line erasing unit 22, and the keyword detection unit 25 selects a keyword based on the detected characters. The attribute information associated with the keyword detected and stored in the dictionary attribute information storage unit 53 is read out. The field search unit 27 associates the field detected by the field detection unit 17 with the keyword detected by the keyword detection unit 25, and associates the keyword, the field, and the attribute information as the form definition information in the form definition information storage unit 54. To remember. As a result, from the form image data generated by optically reading the form, a field for entering handwritten characters and a keyword associated with attribute information indicating the type of characters to be entered in the field are extracted, and the relationship is extracted. A certain field can be associated with a keyword. Therefore, when a handwritten form is subsequently read, it is determined whether the character type of the handwritten character entered in the field is correct based on the definition information in which the field, the keyword, and the attribute information are associated with each other. Processing is possible, and if it is wrong, it is possible to improve the accuracy of information handwritten on the form by prompting the writer to correct it.

また、上記の第1実施形態では、文字の検出率を高めるために細い線になるような2値化をした帳票画像データと、当該2値化された帳票画像データに対して、2値化処理によって生じた欠損を埋めるため線を膨張させる補正をして、矩形検出用の補正帳票画像データとの2種類の画像データを生成する構成にしている。この構成より、文字の検出率と、矩形の検出率の双方の精度を高めることが可能となる。一般に、矩形検出用に画像データを補正すると全体的に黒の割合が増えてしまい、特に、黒が多く分布している箇所ほど黒に補正される傾向があり、「番」や「麗」などの文字はつぶれやすい。この場合、文字の認識が難しくなるため、検出した文字列と辞書情報とのマッチングの精度が低下する。これを避けるため、文字の線が細くくっきりとなるような文字検出用の2値化と、線を太くする矩形検出用の2値化を行う2つの2値化の構成が必要となる。これに対して、第1実施形態では、2値化処理の際にまず、文字検出用の線を細くした画像データを生成し、その後に、矩形検出用に2値化によって生じた欠損を埋めるため線を膨張させる補正処理を行う構成となっている。そのため、二重に2値化処理の構成を備えなくてもよい構成となっている。そして、この構成により、文字が潰れにくい補正が可能となるため、より精度良く項目名を特定することができる。   In the first embodiment, the binarization is performed on the form image data binarized so as to form a thin line in order to increase the detection rate of characters and the binarized form image data. In order to fill in the defects generated by the processing, the line is expanded and corrected to generate two types of image data including corrected form image data for rectangle detection. With this configuration, it is possible to improve the accuracy of both the character detection rate and the rectangle detection rate. In general, when image data is corrected for rectangle detection, the ratio of black increases as a whole. In particular, there is a tendency for black areas to be corrected to black, such as “No.” and “Rei”. The characters of are easy to collapse. In this case, since it becomes difficult to recognize characters, the accuracy of matching between the detected character string and dictionary information is lowered. In order to avoid this, two binarization configurations are required to perform binarization for character detection such that the character line is thin and sharp and binarization for rectangle detection that thickens the line. On the other hand, in the first embodiment, in the binarization process, first, image data in which a line for character detection is thinned is generated, and thereafter, a defect caused by binarization is filled for rectangle detection. Therefore, the correction processing for expanding the line is performed. Therefore, it is a configuration that does not need to have a double binarization processing configuration. This configuration makes it possible to make corrections that prevent characters from being crushed, so that item names can be specified with higher accuracy.

補正部13では、矩形の検出率を高める補正、すなわち、上述した膨張処理A,B,Cのいずれかによる補正が行われている。これら膨張処理A,B,Cの処理は、いずれも線を膨張させる処理であるが、大きく膨張させすぎると、付近の矩形と接触してしまい、矩形として正しく検出できなくなり、また、付近の矩形、文字、ノイズと接触して本来存在しない新たな矩形、すなわちノイズ矩形を生成してしまうことがある。したがって、他の矩形と接触させず、また、ノイズ矩形を生じさせないようにするためには、指定周辺範囲、指定範囲、閾値などのパラメータをどのように設定するかが重要となる。このパラメータの設定の違いによる効果の相違について図36から図43を参照して説明する。   In the correction unit 13, correction that increases the detection rate of the rectangle, that is, correction by any of the expansion processes A, B, and C described above is performed. These expansion processes A, B, and C are processes for expanding a line. However, if the line is expanded too much, it will come into contact with a nearby rectangle and cannot be correctly detected as a rectangle. In some cases, a new rectangle that does not originally exist, that is, a noise rectangle, is generated in contact with characters or noise. Therefore, how to set parameters such as the designated peripheral range, the designated range, and the threshold value is important in order not to make contact with other rectangles and to generate a noise rectangle. Differences in effects due to differences in parameter settings will be described with reference to FIGS.

図36は、画像読取部10によって光学的に読み取られたカラーの画像データであり、図37は、2値化部12による2値化処理によって、矩形を構成する連続線分に欠損が生じている状態を示す図である。図中において、斜線で塗りつぶされた箇所は、2値化された後の黒色のピクセルを示しており、黒色で塗りつぶされた箇所は、膨張処理による膨張によって黒色に塗りかえられたピクセルを示す。図38から図40は、図37に示す画像データに対して、膨張処理Bを、それぞれ、指定周辺範囲1で、閾値を1、2、3と段階的に増加させていった場合の処理結果と、3つの指標についての判定結果を示す図である。ここで、3つの指標とは、矩形の補正、矩形の接触、ノイズ矩形であり、矩形の補正については、矩形の欠損が埋められている場合は、「○」を示し、矩形の欠損が残っている場合は、「×」を示す。矩形の接触については、2つの矩形が接触していない場合は、「○」を示し、接触している場合は、「×」を示す。ノイズ矩形については、膨張処理を行うことによって生じた線分により囲まれてしまった白色領域の有無を示し、そのような白色領域が有る場合には「○」、無い場合には「×」を示す。   FIG. 36 shows color image data optically read by the image reading unit 10, and FIG. 37 shows a case where a defect occurs in a continuous line segment forming a rectangle by the binarization processing by the binarization unit 12. FIG. In the drawing, a portion painted with diagonal lines indicates a black pixel after binarization, and a portion painted with black indicates a pixel that has been painted black by expansion by expansion processing. FIGS. 38 to 40 show the processing results when the expansion process B is increased in stages in the designated peripheral range 1 and the threshold values are increased in stages 1, 2, and 3 for the image data shown in FIG. It is a figure which shows the determination result about three parameters | indexes. Here, the three indicators are rectangle correction, rectangle contact, and noise rectangle. For rectangle correction, when a rectangle defect is filled, “◯” is indicated, and the rectangle defect remains. When it is, “x” is shown. Regarding the contact of rectangles, “o” is shown when two rectangles are not in contact, and “x” is shown when they are in contact. The noise rectangle indicates the presence or absence of a white area surrounded by the line segment generated by performing the dilation process. If there is such a white area, “○” is indicated. Show.

図38に示す指定周辺範囲1で、閾値1の場合には、矩形の欠損はなくなっており、膨張処理によって生じた白色部分はないため、「矩形の補正」と「ノイズ矩形」の指標については「○」となっているが、膨張させることで隣接する矩形同士が接触してしまっているため、矩形の接触の指標については「×」となる。図39に示す指定周辺範囲1で、閾値2の場合には、矩形の欠損はなくなっておらず、また、膨張させることで隣接する矩形同士が接触してしまっており、線分で囲まれた白色の領域が新たに生じてしまっている。したがって、図39では、「矩形の補正」、「矩形の接触」、「ノイズ矩形」の3つの指標について、いずれも「×」となっている。図40に示す指定周辺範囲1で、閾値3の場合には、矩形の欠損はなくなっておらず、また、膨張させることで隣接する矩形同士が接触してしまっているため「矩形の補正」、「矩形の接触」、の指標については、「×」である。これに対して、線分で囲まれた白色領域が新たに生じていないため「ノイズ矩形」については、「○」となっている。   In the designated peripheral range 1 shown in FIG. 38, in the case of the threshold value 1, there is no rectangular defect, and there is no white portion generated by the expansion process, so the indices of “rectangle correction” and “noise rectangle” are Although it is “◯”, since the adjacent rectangles are in contact with each other by being inflated, the index of the rectangular contact is “x”. In the designated peripheral range 1 shown in FIG. 39, in the case of the threshold value 2, the rectangular defect is not lost, and the adjacent rectangles are in contact with each other by being expanded, and are surrounded by line segments. A white area has newly occurred. Therefore, in FIG. 39, all of the three indicators “rectangular correction”, “rectangular contact”, and “noise rectangle” are “x”. In the designated peripheral range 1 shown in FIG. 40, in the case of the threshold 3, the rectangular defect is not lost, and the adjacent rectangles are in contact with each other by being expanded, so that “rectangular correction”, The index “rectangular contact” is “x”. On the other hand, since the white region surrounded by the line segment is not newly generated, the “noise rectangle” is “◯”.

図41から図43は、膨張処理Cを、それぞれ、指定範囲2で、閾値を1、2、3と段階的に増加させていった場合の処理結果と、3つの指標についての判定結果を示す図である。図40に示す指定範囲2、閾値1の場合、矩形の欠損はなくなっておらず、また、膨張させることで隣接する矩形同士が接触してしまっており、線分で囲まれた白色の領域が新たに生じてしまっている。したがって、図41では、「矩形の補正」、「矩形の接触」、「ノイズ矩形」の3つの指標について、いずれも「×」となっている。図42は、指定範囲2、閾値2の場合であり、矩形の欠損はなくなっており、また、膨張させることで隣接する矩形同士が接触することもなく、線分で囲まれた白色の領域が新たに生じていない。したがって、図42では、「矩形の補正」、「矩形の接触」、「ノイズ矩形」の3つの指標について、いずれも「○」となっている。図43は、指定範囲2、閾値2の場合であり、矩形の欠損はなくなっていない。ただし、膨張させることで隣接する矩形同士が接触することはなく、線分で囲まれた白色の領域も新たに生じていない。したがって、図43では、「矩形の補正」の指標については、「×」であるが、「矩形の接触」、「ノイズ矩形」の指標については、「○」となっている。
したがって、図37のような帳票画像データに対する図38から図43の処理の例は、図42の指定範囲2及び閾値2とした膨張処理Cが最も良い膨張処理であることが分かる。この結果は、処理の対象となる矩形の欠損状態にもよるため、矩形の欠損状態が、異なる場合には、異なる結果が得られる場合もある。
FIG. 41 to FIG. 43 show the processing results when the expansion processing C is increased in stages in the designated range 2 and the threshold values 1, 2, and 3, respectively, and the determination results for the three indexes. FIG. In the case of the designated range 2 and the threshold value 1 shown in FIG. 40, the missing rectangle is not lost, and the adjacent rectangles are in contact with each other by being expanded, and the white region surrounded by the line segment is It has newly occurred. Therefore, in FIG. 41, all of the three indicators “rectangular correction”, “rectangular contact”, and “noise rectangle” are “x”. FIG. 42 shows the case of the designated range 2 and the threshold value 2, where the rectangular defect has disappeared, and the adjacent rectangles do not come into contact with each other by being expanded, and the white region surrounded by the line segment is It has not occurred anew. Therefore, in FIG. 42, all three indicators “rectangular correction”, “rectangular contact”, and “noise rectangle” are “◯”. FIG. 43 shows a case where the specified range is 2 and the threshold value is 2, and a rectangular defect is not lost. However, the adjacent rectangles do not come into contact with each other by being expanded, and a white region surrounded by a line segment is not newly generated. Therefore, in FIG. 43, the “rectangular correction” index is “x”, but the “rectangular contact” and “noise rectangle” indices are “◯”.
Therefore, it can be seen that in the example of the processing of FIGS. 38 to 43 for the form image data as shown in FIG. 37, the expansion processing C with the designated range 2 and the threshold 2 of FIG. 42 is the best expansion processing. Since this result also depends on the missing state of the rectangle to be processed, different results may be obtained if the missing state of the rectangle is different.

また、上記の第1実施形態では、罫線消去部22による罫線の消去をスレッド処理により行うために、罫線消去対応画像分割部21により、画像データが4分割される。そして、その際に、境界領域の罫線が消えるように、分割する領域を4等分する場合よりも少し広い領域となるように4分割するようにしている。この効果を図44から図46を用いて示す。なお、図44から図46に示す例では、罫線消去の性能を示すため、矩形消去部20による矩形の消去を行わず、矩形も含めた罫線の全てを消去する構成としている。図44は、画像合成部14が出力する2値化された帳票画像データBFを示す図である。図44において、線分DL1と線分DL2は、帳票画像データBFを4等分する線分である。4等分した分割帳票画像データに対して罫線消去部22による罫線処理を行って画像を合成すると、図45に示すように、線分DL1,線分DL2による分割の境界である境界領域WA1,WA2で囲まれた領域の罫線を消去することができない。これに対して、図24、図25を参照して説明した拡張領域をともなう分割を行って罫線消去を行うと、図46に示すように境界領域WA1,WA2における罫線を消去できていることがわかる。   In the first embodiment, the ruled line erasure corresponding image dividing unit 21 divides the image data into four parts in order to erase the ruled lines by the ruled line erasing unit 22 by thread processing. At this time, the area to be divided is divided into four so that the area is slightly wider than when the area is divided into four equal parts so that the ruled lines in the boundary area disappear. This effect is shown using FIG. 44 to FIG. In the example shown in FIGS. 44 to 46, in order to show ruled line erasing performance, the rectangle erasing unit 20 does not erase the rectangle, but erases all the ruled lines including the rectangle. FIG. 44 is a diagram illustrating the binarized form image data BF output from the image composition unit 14. In FIG. 44, a line segment DL1 and a line segment DL2 are line segments that divide the form image data BF into four equal parts. When ruled line processing is performed by the ruled line erasing unit 22 on the divided divided form image data, the image is synthesized, as shown in FIG. 45, boundary areas WA1, which are division boundaries by the line segment DL1 and the line segment DL2, as shown in FIG. The ruled line in the area surrounded by WA2 cannot be erased. On the other hand, when the ruled line erasure is performed by performing the division with the extension area described with reference to FIGS. 24 and 25, the ruled lines in the boundary areas WA1 and WA2 can be erased as shown in FIG. Recognize.

なお、上記の第1実施形態において、画像分割部11や、罫線消去対応画像分割部21における帳票画像データの分割数を4分割とし、スレッドの数を4としているが、本発明の構成は、当該実施の形態には限られない。分割数は、2分割でもよく、また、4分割以上であってもよい。スレッドについては、分割数に応じた個数を配置することになるが、分割数や分割のサイズによってスレッドによる2値化や罫線消去の処理結果に影響を及ぼすため、その影響度合いを考慮して分割数及び分割サイズは定められることになる。また、帳票画像データを分割せず、スレッドによる処理をしない構成であってもよい。
また、分割の形状についても、図44に示すような線分DL1,DL2によって4分割する形状に限られず、縦線のみでの4分割、または、横線のみでの4分割などであってもよい。また、画像分割部11は、罫線消去対応画像分割部21と同様に、拡張領域を設けて画像データを4分割してもよい。これにより、画像分割部11による画像分割後の画像データが2値化されるときに、各画像データは重複する領域を有するため、各画像データの2値化の品質が極端に異なることを抑制することができる。
In the first embodiment described above, the number of divisions of the form image data in the image dividing unit 11 and the ruled line erasure corresponding image dividing unit 21 is four and the number of threads is four. However, the configuration of the present invention is as follows. It is not limited to the embodiment. The number of divisions may be two divisions or four or more divisions. The number of threads will be arranged according to the number of divisions. However, since the number of divisions and the size of the divisions affect the processing of binarization and ruled line erasing by the threads, division is performed in consideration of the degree of influence. The number and division size will be determined. Further, the form image data may not be divided and the processing by the thread may not be performed.
Also, the shape of the division is not limited to the shape divided into four by the line segments DL1 and DL2 as shown in FIG. 44, and may be four divisions with only vertical lines or four divisions with only horizontal lines. . Further, the image dividing unit 11 may divide the image data into four by providing an extended area, like the ruled line erasure corresponding image dividing unit 21. As a result, when the image data after the image division by the image dividing unit 11 is binarized, each image data has an overlapping area, so that the binarization quality of each image data is prevented from being extremely different. can do.

また、上記の第1実施形態において、画像分割部11による画像データの分割をした後で2値化部12による2値化処理をしているが、本発明の構成は、当該実施の形態に限られない。例えば、分割前のカラーの帳票画像データに対して2値化処理をした後に、画像データの分割を行って補正部13による補正処理のみをスレッドで行うようにしてもよい。   In the first embodiment, the binarization unit 12 performs the binarization process after the image data is divided by the image division unit 11, but the configuration of the present invention is the same as that of the embodiment. Not limited. For example, after performing binarization processing on the color form image data before division, the image data may be divided and only the correction processing by the correction unit 13 may be performed by the thread.

また、上記の第1実施形態において、補正部13は、上述した膨張処理A,B,Cのいずれかにより黒色画素の部分を膨張させて、矩形の欠損を埋めるようにしているが、これらの処理に限られることなく、連続線の欠損を埋める手法であればどのような手法であってもよい。   In the first embodiment, the correction unit 13 expands the black pixel portion by any of the expansion processes A, B, and C described above, and fills the rectangular defect. Without being limited to the processing, any method may be used as long as it is a method of filling a continuous line defect.

また、上記の第1実施形態において、矩形IDは、矩形検出部15が生成するものとしているが、矩形判定部16が生成するようになっていてもよい。
また、上記の第1実施形態において、矩形消去部20に、矩形検出部15が検出した矩形を消去させることで矩形の消去の精度を高めているが、矩形は線で構成されていることから、矩形消去部20を備えず、罫線消去部22により、罫線とともに矩形も消去させるようにしてもよい。
Further, in the first embodiment, the rectangle ID is generated by the rectangle detection unit 15, but may be generated by the rectangle determination unit 16.
In the first embodiment, the rectangle erasure unit 20 erases the rectangle detected by the rectangle detection unit 15 to improve the accuracy of erasing the rectangle. However, the rectangle is composed of lines. The rectangle erasing unit 20 may not be provided, and the ruled line erasing unit 22 may erase the rectangle together with the ruled line.

また、上記の第1実施形態において、文字検出部24は、検出した文字の座標データ、すなわち、左上のX,Y座標と右下のX,Y座標を検出し、これにより、文字の位置やサイズが特定されるようになっているが、本発明の構成は、当該実施の形態に限られない。例えば、文字検出部24は、左上のX,Y座標と右下のX,Y座標を検出する代わりに、検出した文字の中心、または、重心の位置と、フォントサイズのような文字サイズを検出して、文字情報記憶部52に書き込むようにしてもよい。   In the first embodiment, the character detection unit 24 detects the coordinate data of the detected character, that is, the upper left X and Y coordinates and the lower right X and Y coordinates. Although the size is specified, the configuration of the present invention is not limited to the embodiment. For example, instead of detecting the upper left X and Y coordinates and the lower right X and Y coordinates, the character detection unit 24 detects the position of the detected character or the center of gravity and the character size such as the font size. Then, it may be written in the character information storage unit 52.

また、上記の第1実施形態において、キーワード検出部25は、辞書属性情報記憶部53の「キーワード」の項目に記憶されている文字列または文字に完全一致、または、部分が一致するキーワードを検出するようにしているが、本発明の構成は、当該実施の形態に限られない。また、帳票定義装置1に接続される外部の辞書情報を参照して、日本語として意味を成しているキーワードを検出するといった手法や、日本語の文法から構文を解析してキーワードを検出するような手法が適用されてもよい。また、キーワードは、通常、体言止めで帳票に印刷されていることから、「振り込み手数料」などをキーワードとして検出する一方、「カタカナでご記入ください。」などの文章はキーワードとして検出しないといった手法であってもよい。これらの場合において、辞書属性情報記憶部53の「キーワード」の項目に記憶されている文字列または文字と完全一致、または、部分一致しないキーワードを検出する場合もあるが、その場合、帳票定義情報記憶部54の「属性情報」は、空欄を示す「−」が書き込まれることになる。   In the first embodiment, the keyword detection unit 25 detects a keyword that completely matches or matches a character string or character stored in the “keyword” item of the dictionary attribute information storage unit 53. However, the configuration of the present invention is not limited to the embodiment. In addition, by referring to external dictionary information connected to the form definition device 1, a keyword that detects meaning as Japanese is detected, or a keyword is detected by analyzing syntax from Japanese grammar. Such a technique may be applied. In addition, since keywords are usually printed on forms with no wording, “transfer fees” etc. are detected as keywords, while sentences such as “Please enter in katakana” are not detected as keywords. There may be. In these cases, there is a case where a keyword that does not completely match or partially matches a character string or a character stored in the “keyword” item of the dictionary attribute information storage unit 53 may be detected. In the “attribute information” in the storage unit 54, “-” indicating a blank is written.

また、上記の第1実施形態において、キーワード検出部25は、「ご依頼日」などのキーワードを検出した場合、辞書属性情報記憶部53の「キーワード」の項目の文字列または文字のうち部分一致したものの中で最も一致する文字数の多いものに対応付けられている属性情報を読み出すようにしているが、本発明の構成は、当該実施の形態に限られない。例えば、「ご依頼日」のように丁寧語の接頭辞が付与されているものについては、接頭辞を除いた上で、完全一致するものだけを検索するようにしてもよい。また、辞書属性情報記憶部53の「キーワード」と「属性情報」の項目に、予め想定される接頭辞などが付与された全ての文字列(例えば、「ご依頼日」や「御依頼日」)を、対応する属性情報とともに予め記憶させて、完全一致するものだけを検索するようにしてもよい。また、キーワード検出部25に検出させるキーワードを限定させたい場合、辞書属性情報記憶部53の「キーワード」の項目に記憶されている文字列または文字と一致する部分のみをキーワードとして検出させるようにしてもよい。例えば、キーワード検出部25が「カタカナでご記入ください。」という文字列をキーワードとして検出した場合、当該キーワードは、辞書属性情報記憶部53の「キーワード」の項目の「カタカナ」と部分一致するため、一致する部分である、「カタカナ」をキーワードとして検出する。この場合、キーワード検出部25は、キーワード外接矩形の座標情報についても、「カタカナ」の部分についての座標情報を検出することになる。   Further, in the first embodiment, when the keyword detection unit 25 detects a keyword such as “request date”, it partially matches the character string or character of the item “keyword” in the dictionary attribute information storage unit 53. The attribute information associated with the character with the largest number of matching characters is read out, but the configuration of the present invention is not limited to this embodiment. For example, with respect to a thing with a polite prefix such as “request date”, only the exact match may be searched after removing the prefix. In addition, all character strings (for example, “request date” and “request date”) in which prefixes assumed in advance are added to the “keyword” and “attribute information” items in the dictionary attribute information storage unit 53. ) May be stored in advance together with the corresponding attribute information, and only those that completely match may be searched. Further, when it is desired to limit the keywords to be detected by the keyword detection unit 25, only a character string or a part matching the character stored in the “keyword” item of the dictionary attribute information storage unit 53 is detected as a keyword. Also good. For example, when the keyword detection unit 25 detects a character string “Please enter in katakana” as a keyword, the keyword partially matches “Katakana” in the “Keyword” item of the dictionary attribute information storage unit 53. , “Katakana”, which is a matching part, is detected as a keyword. In this case, the keyword detection unit 25 also detects the coordinate information about the “Katakana” portion for the coordinate information of the keyword circumscribed rectangle.

なお、上記の第1実施形態の構成では、フィールド検出部17が行うフィールド検出処理は、帳票が横書きであることを前提としているが、帳票が縦書きの場合であっても、縦横の関係を入れ替えてフィールドの検出処理を行うことが可能である。   In the configuration of the first embodiment described above, the field detection processing performed by the field detection unit 17 is based on the premise that the form is horizontally written, but the vertical / horizontal relationship is maintained even when the form is vertically written. It is possible to replace the field detection process.

また、上記の第1実施形態の構成において、フィールド探索部27は、キーワードを囲む矩形が存在する場合は、キーワード外接矩形を用いずに、キーワードを囲む矩形を用いて、キーワードに対応するフィールドを検出している。これは、フィールドが、キーワードを囲む矩形を縦、または横に拡張した領域に存在する可能性が高いことから、キーワード外接矩形を用いるよりも、より高い確率でフィールドを検出することを目的とする処理であるが、本発明の構成は、当該実施の形態に限られない。例えば、フィールド探索部27による処理をすべてキーワード外接矩形を用いて行ってもよく、その場合、帳票定義装置1は、キーワード対応矩形検出部26を備える必要がない。   In the configuration of the first embodiment described above, the field search unit 27 uses the rectangle surrounding the keyword instead of the keyword circumscribing rectangle when the rectangle surrounding the keyword exists, and searches the field corresponding to the keyword. Detected. The purpose of this is to detect the field with a higher probability than using the circumscribed rectangle of the keyword because the field is likely to exist in a region extending the rectangle surrounding the keyword vertically or horizontally. Although it is a process, the structure of this invention is not restricted to the said embodiment. For example, all the processes by the field search unit 27 may be performed using the keyword circumscribed rectangle. In this case, the form definition device 1 does not need to include the keyword corresponding rectangle detection unit 26.

また、第1実施形態において、1つのキーワードには、1つのフィールドを対応付けるという限定を設ける場合、フィールド探索部27は、キーワードに対応するとして検出したフィールドのフィールドIDが既に帳票定義情報記憶部54の「対応フィールド」の項目に記憶されているか否かを判定し、既に他のキーワードに対応付けられている場合、処理対象のキーワードの「対応フィールド」の項目には「処理済み」を書き込む。さらに、フィールド探索部27が、1つのキーワードに対して、複数の対応するフィールドを検出した場合、最初に、他のキーワードに対応付けられているフィールドを除き、残ったフィールドのなかでフィールドの左上の頂点と基準頂点の距離が最も短いフィールドを当該キーワードに対応するフィールドとして検出するようにしてもよい。   Further, in the first embodiment, when a limitation is made such that one field is associated with one keyword, the field search unit 27 has already detected that the field ID of the field detected as corresponding to the keyword is the form definition information storage unit 54. Is stored in the “corresponding field” item, and if already associated with another keyword, “processed” is written in the “corresponding field” item of the keyword to be processed. Further, when the field search unit 27 detects a plurality of corresponding fields for one keyword, first, except for the fields associated with other keywords, the upper left of the field among the remaining fields The field having the shortest distance between the vertex and the reference vertex may be detected as the field corresponding to the keyword.

(第2実施形態)
図47は、本発明の第2実施形態による、帳票定義装置1aの構成を示すブロック図である。第1実施形態と同一の構成については、同一の符号を付し、以下、異なる構成について説明する。第2実施形態では、フィールド探索部27aと、リファレンス情報記憶部55とを備える。
帳票の形式によっては、1つのフィールドに対して複数のキーワードが対応することがある。例えば、「氏名」及び「カタカナでご記入ください。」という2つのキーワードが、氏名をカタカナで記入するフィールドの近くに印刷されていることがある。このとき、1つのフィールドに2つ以上のキーワードを対応付けることで、フィールドに記入される文字を複数の属性情報で特定することが可能となり、手書き記入される文字の文字種等についての精度をさらに高めることができる。
(Second Embodiment)
FIG. 47 is a block diagram showing the configuration of the form definition device 1a according to the second embodiment of the present invention. The same configurations as those in the first embodiment are denoted by the same reference numerals, and different configurations will be described below. In the second embodiment, a field search unit 27a and a reference information storage unit 55 are provided.
Depending on the form format, a plurality of keywords may correspond to one field. For example, two keywords “name” and “please enter in katakana” may be printed near the field for entering the name in katakana. At this time, by associating two or more keywords with one field, it is possible to specify characters to be entered in the field by a plurality of attribute information, and further improve the accuracy of the character type of the characters to be handwritten. be able to.

帳票定義装置1aにおいて、リファレンス情報記憶部55は、図48に示すデータ構成を有しており、「フィールドID」と「対応キーワード」と「属性情報」の項目を有する。「フィールドID」の項目には、フィールド探索部27aが、フィールド探索処理によって、キーワードに対応するフィールドを検出した場合、検出したフィールドのフィールドIDがフィールド探索部27aによって書き込まれる。「対応キーワード」の項目には、当該フィールドIDに対応するキーワードIDがフィールド探索部27aによって書き込まれる。「属性情報」の項目には、キーワードIDに対応するキーワードの属性情報がフィールド探索部27aによって書き込まれる。   In the form definition device 1a, the reference information storage unit 55 has a data configuration shown in FIG. 48, and includes items of “field ID”, “corresponding keyword”, and “attribute information”. When the field search unit 27a detects a field corresponding to the keyword by the field search process, the field search unit 27a writes the field ID of the detected field in the item “field ID”. In the “corresponding keyword” item, a keyword ID corresponding to the field ID is written by the field search unit 27a. In the item “attribute information”, the attribute information of the keyword corresponding to the keyword ID is written by the field search unit 27a.

フィールド探索部27aは、図29に示した第1実施形態のフィールド探索処理において、キーワードに対応するフィールドを検出し、ステップSc9において、帳票定義情報記憶部54の「対応フィールド」の項目に検出したフィールドのフィールドIDを書き込む。このとき、フィールド探索部27aは、処理対象のキーワードIDに対応付けられている属性情報を帳票定義情報記憶部54から読み出し、検出したフィールドのフィールドIDに対応付けて、処理対象のキーワードIDと、読み出した属性情報とをリファレンス情報記憶部55に書き込む。リファレンス情報記憶部55において、既に、当該フィールドIDのレコードが存在する場合、キーワードIDと属性情報を当該レコードに追記していく。例えば、図48のフィールド2の例に示すように、既に、「対応キーワード」に「キーワード4」が書き込まれており、「属性情報」に「文字」が書き込まれている場合に、フィールド探索部27aが、キーワード5に対応するフィールドとしてフィールド2を検出した場合、「キーワード5」と「カタカナ文字」をフィールド2のレコードに追加して書き込む。   The field search unit 27a detects a field corresponding to the keyword in the field search process of the first embodiment shown in FIG. 29, and detects it in the item “corresponding field” in the form definition information storage unit 54 in step Sc9. Write the field ID of the field. At this time, the field search unit 27a reads the attribute information associated with the processing target keyword ID from the form definition information storage unit 54, associates it with the field ID of the detected field, The read attribute information is written in the reference information storage unit 55. In the reference information storage unit 55, when the record of the field ID already exists, the keyword ID and the attribute information are added to the record. For example, as shown in the example of field 2 in FIG. 48, when “keyword 4” is already written in “corresponding keyword” and “character” is written in “attribute information”, the field search unit When the field 27 is detected as a field corresponding to the keyword 5, the 27a adds “keyword 5” and “katakana character” to the record in the field 2 and writes them.

上記の第2実施形態の構成により、リファレンス情報記憶部55を備えることにより、フィールドに対応付けられている複数のキーワードIDと、当該キーワードIDに対応する属性情報とを検出することが可能となり、手書き記入される文字の文字種等についての精度をさらに高めることができる。
なお、第2実施形態のような構成を備えなくとも、第1実施形態における帳票定義情報記憶部54の「対応フィールド」の項目に記憶されている情報に基づいて、1つのフィールドに対応付けられているキーワードと属性情報を全て検索することで、第2実施形態の目的を達成することもできる。
With the configuration of the second embodiment described above, by providing the reference information storage unit 55, it is possible to detect a plurality of keyword IDs associated with a field and attribute information corresponding to the keyword ID, It is possible to further improve the accuracy of the character type and the like of the handwritten characters.
Even if the configuration as in the second embodiment is not provided, it is associated with one field based on the information stored in the “corresponding field” item of the form definition information storage unit 54 in the first embodiment. The purpose of the second embodiment can also be achieved by searching for all the keyword and attribute information.

なお、上記の第1及び第2実施形態における帳票定義情報記憶部54、及び第2実施形態におけるリファレンス情報記憶部55は、帳票定義装置1の外部、例えば、手書き記入された帳票を読み取って、手書き記入された文字の分析や蓄積を行う装置側に備えられていてもよい。その場合、キーワード検出部25、キーワード対応矩形検出部26、フィールド探索部27,27aは、通信線などを経由して帳票定義情報記憶部54やリファレンス情報記憶部55にデータを書き込んだり読み出したりすることになる。   The form definition information storage unit 54 in the first and second embodiments and the reference information storage unit 55 in the second embodiment read outside the form definition device 1, for example, a handwritten form, It may be provided on the device side that performs analysis and accumulation of handwritten characters. In that case, the keyword detection unit 25, the keyword-corresponding rectangle detection unit 26, and the field search units 27 and 27a write and read data to and from the form definition information storage unit 54 and the reference information storage unit 55 via a communication line or the like. It will be.

上述した実施形態における帳票定義装置1、1aをコンピュータで実現するようにしてもよい。その場合、この機能を実現するためのプログラムをコンピュータ読み取り可能な記録媒体に記録して、この記録媒体に記録されたプログラムをコンピュータシステムに読み込ませ、実行することによって実現してもよい。なお、ここでいう「コンピュータシステム」とは、OSや周辺機器等のハードウェアを含むものとする。また、「コンピュータ読み取り可能な記録媒体」とは、フレキシブルディスク、光磁気ディスク、ROM、CD−ROM等の可搬媒体、コンピュータシステムに内蔵されるハードディスク等の記憶装置のことをいう。さらに「コンピュータ読み取り可能な記録媒体」とは、インターネット等のネットワークや電話回線等の通信回線を介してプログラムを送信する場合の通信線のように、短時間の間、動的にプログラムを保持するもの、その場合のサーバやクライアントとなるコンピュータシステム内部の揮発性メモリのように、一定時間プログラムを保持しているものも含んでもよい。また上記プログラムは、前述した機能の一部を実現するためのものであってもよく、さらに前述した機能をコンピュータシステムにすでに記録されているプログラムとの組み合わせで実現できるものであってもよく、FPGA(Field Programmable Gate Array)等のプログラマブルロジックデバイスを用いて実現されるものであってもよい。   You may make it implement | achieve the form definition apparatuses 1 and 1a in embodiment mentioned above with a computer. In that case, a program for realizing this function may be recorded on a computer-readable recording medium, and the program recorded on this recording medium may be read into a computer system and executed. Here, the “computer system” includes an OS and hardware such as peripheral devices. The “computer-readable recording medium” refers to a storage device such as a flexible medium, a magneto-optical disk, a portable medium such as a ROM and a CD-ROM, and a hard disk incorporated in a computer system. Furthermore, the “computer-readable recording medium” dynamically holds a program for a short time like a communication line when transmitting a program via a network such as the Internet or a communication line such as a telephone line. In this case, a volatile memory inside a computer system serving as a server or a client in that case may be included and a program held for a certain period of time. Further, the program may be a program for realizing a part of the above-described functions, and may be a program capable of realizing the functions described above in combination with a program already recorded in a computer system. You may implement | achieve using programmable logic devices, such as FPGA (Field Programmable Gate Array).

以上、この発明の実施形態について図面を参照して詳述してきたが、具体的な構成はこの実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の設計等も含まれる。   The embodiment of the present invention has been described in detail with reference to the drawings. However, the specific configuration is not limited to this embodiment, and includes designs and the like that do not depart from the gist of the present invention.

1 帳票定義装置
10 画像読取部
11 画像分割部
12 2値化部
13 補正部
14 画像合成部
15 矩形検出部
16 矩形判定部
17 フィールド検出部
20 矩形消去部
21 罫線消去対応画像分割部
22 罫線消去部
23 罫線消去対応画像合成部
24 文字検出部
25 キーワード検出部
26 キーワード対応矩形検出部
27 フィールド探索部
50 矩形情報記憶部
51 フィールド情報記憶部
52 文字情報記憶部
53 辞書属性情報記憶部
54 帳票定義情報記憶部
DESCRIPTION OF SYMBOLS 1 Form definition apparatus 10 Image reading part 11 Image division part 12 Binarization part 13 Correction part 14 Image composition part 15 Rectangle detection part 16 Rectangle determination part 17 Field detection part 20 Rectangle deletion part 21 Ruled line deletion corresponding image division part 22 Ruled line deletion Unit 23 Ruled Line Erasing Corresponding Image Composition Unit 24 Character Detection Unit 25 Keyword Detection Unit 26 Keyword Corresponding Rectangle Detection Unit 27 Field Search Unit 50 Rectangular Information Storage Unit 51 Field Information Storage Unit 52 Character Information Storage Unit 53 Dictionary Attribute Information Storage Unit 54 Form Definition Information storage unit

Claims (9)

帳票を光学的に読み取り帳票の画像データを生成する画像読取部と、
前記画像データを2値化して帳票画像データを生成する2値化部と、
前記帳票画像データに対して前記2値化により生じた欠損を埋める補正をして補正帳票画像データを生成する補正部と、
前記補正帳票画像データから長方形または略長方形の形状を矩形として検出する矩形検出部と、
前記矩形が文字枠矩形であるか否かを判定する矩形判定部と、
前記文字枠矩形の隣接関係に基づいて、前記文字枠矩形を分類し、分類した区分の各々をフィールドとして検出するフィールド検出部と、
前記帳票画像データに含まれる文字を検出する文字検出部と、
前記フィールドに記入される文字の属性が予め対応付けられるキーワードを前記文字から検出するキーワード検出部と、
前記キーワードに対応する前記フィールドを、前記キーワードと前記フィールドの位置関係に基づいて検出し、検出した前記フィールドを前記キーワードに対応付けて帳票定義情報記憶部に書き込むフィールド探索部と、
を備えることを特徴とする帳票定義装置。
An image reading unit that optically reads a form and generates image data of the form;
A binarization unit that binarizes the image data to generate form image data;
A correction unit that generates correction form image data by correcting the form image data to fill in the defects generated by the binarization;
A rectangle detector for detecting a rectangular or substantially rectangular shape as a rectangle from the corrected form image data;
A rectangle determination unit for determining whether or not the rectangle is a character frame rectangle;
A field detection unit that classifies the character frame rectangles based on the adjacent relationship of the character frame rectangles, and detects each of the classified sections as a field;
A character detection unit for detecting characters included in the form image data;
A keyword detection unit that detects, from the characters, a keyword that is preliminarily associated with the attributes of the characters entered in the field;
A field search unit that detects the field corresponding to the keyword based on a positional relationship between the keyword and the field, and writes the detected field in the form definition information storage unit in association with the keyword;
A form definition device comprising:
前記キーワードとして検出対象とする文字列または文字が予め定められており、
前記キーワード検出部は、
前記文字から前記キーワードを検出する際、前記予め定められている前記検出対象とする文字列または文字に完全一致、または、部分一致する前記キーワードのみを検出する
ことを特徴とする請求項1に記載の帳票定義装置。
A character string or a character to be detected as the keyword is predetermined,
The keyword detection unit
2. When detecting the keyword from the character, only the keyword that completely or partially matches the predetermined character string or character to be detected is detected. Form definition device.
前記キーワードに対応する前記属性を示す属性情報を予め記憶する辞書属性情報記憶部を備え、
前記キーワード検出部は、
前記文字から前記キーワードを検出すると、前記キーワードに対応する前記属性情報を前記辞書属性情報記憶部から読み出し、読み出した前記属性情報を前記キーワードに対応付けて前記帳票定義情報記憶部に書き込む
ことを特徴とする請求項1または請求項2に記載の帳票定義装置。
A dictionary attribute information storage unit that stores in advance attribute information indicating the attribute corresponding to the keyword;
The keyword detection unit
When the keyword is detected from the character, the attribute information corresponding to the keyword is read from the dictionary attribute information storage unit, and the read attribute information is associated with the keyword and written to the form definition information storage unit. The form definition device according to claim 1 or 2.
前記キーワードと前記フィールドの位置関係とは、前記キーワードが縦書きの場合に予め定められる前記フィールドが存在する方向の傾向、または、前記キーワードが横書きの場合に予め定められる前記フィールドが存在する方向の傾向によって示され、
前記フィールド探索部は、
前記フィールドが前記傾向を満たす場合に、当該フィールドを前記キーワードに対応する前記フィールドとして検出する
ことを特徴とする請求項1から請求項3のいずれか一項に記載の帳票定義装置。
The positional relationship between the keyword and the field is a tendency in a direction in which the field is predetermined when the keyword is vertically written, or a direction in which the field is predetermined when the keyword is horizontally written. Indicated by the trend,
The field search unit
The form definition device according to any one of claims 1 to 3, wherein, when the field satisfies the tendency, the field is detected as the field corresponding to the keyword.
前記矩形判定部が前記文字枠矩形でないと判定した前記矩形から、前記キーワードを囲む前記矩形を検出するキーワード対応矩形検出部を備え、
前記フィールド探索部は、
前記キーワードを囲む前記矩形が存在する場合、前記キーワードを囲む前記矩形と前記フィールドの位置関係を、前記キーワードと前記フィールドの位置関係として、前記キーワードに対応する前記フィールドを検出する
ことを特徴とする請求項1から請求項4のいずれか一項に記載の帳票定義装置。
A keyword-corresponding rectangle detection unit that detects the rectangle surrounding the keyword from the rectangle that the rectangle determination unit determines is not the character frame rectangle;
The field search unit
When the rectangle surrounding the keyword exists, the positional relationship between the rectangle surrounding the keyword and the field is set as the positional relationship between the keyword and the field, and the field corresponding to the keyword is detected. The form definition device according to any one of claims 1 to 4.
前記帳票画像データを分割する罫線消去対応画像分割部と、
分割された前記帳票画像データの各々から罫線を消去する罫線消去部と、
前記罫線消去後の分割された前記帳票画像データを合成する罫線消去対応画像合成部と、を備え、
前記罫線消去対応画像分割部は、
前記帳票画像データを分割する際に、分割の境界に存在する前記罫線が、前記罫線消去部によって消去されるように、分割後の前記帳票画像データの各々の境界において重複領域が存在するように拡張領域を設けて分割し、
前記罫線消去対応画像合成部は、
前記分割された前記帳票画像データの各々の前記拡張領域を削除してから合成し、
前記文字検出部は、
前記罫線消去対応画像合成部が出力する前記罫線が消去された前記帳票画像データから前記文字を検出する
ことを特徴とする請求項1から請求項5のいずれか一項に記載の帳票定義装置。
A ruled line erasable image dividing unit for dividing the form image data;
A ruled line erasing unit for erasing ruled lines from each of the divided form image data;
A ruled line erasure-compatible image composition unit that synthesizes the divided form image data after the ruled line erasure,
The ruled line erasure compatible image dividing unit
When dividing the form image data, there is an overlapping region at each boundary of the divided form image data so that the ruled lines existing at the division boundaries are erased by the ruled line erasing unit. Set up an extended area and divide it,
The ruled line erasure compatible image composition unit
Combining after deleting the extended area of each of the divided form image data,
The character detection unit
The form definition device according to any one of claims 1 to 5, wherein the character is detected from the form image data from which the ruled line is output which is output by the ruled line erasure corresponding image composition unit.
前記フィールド探索部は、
前記フィールドに複数のキーワードを対応付ける
ことを特徴とする請求項1から請求項6のいずれか一項に記載の帳票定義装置。
The field search unit
The form definition device according to any one of claims 1 to 6, wherein a plurality of keywords are associated with the field.
帳票を光学的に読み取り帳票の画像データを生成し、
前記画像データを2値化して帳票画像データを生成し、
前記帳票画像データに対して前記2値化により生じた欠損を埋める補正をして補正帳票画像データを生成し、
前記補正帳票画像データから長方形または略長方形の形状を矩形として検出し、
前記矩形が文字枠矩形であるか否かを判定し、
前記文字枠矩形の隣接関係に基づいて、前記文字枠矩形を分類し、分類した区分の各々をフィールドとして検出し、
前記帳票画像データに含まれる文字を検出し、
前記フィールドに記入される文字の属性が予め対応付けられるキーワードを前記文字から検出し、
前記キーワードに対応する前記フィールドを、前記キーワードと前記フィールドの位置関係に基づいて検出し、
検出した前記フィールドを前記キーワードに対応付けて記憶する
ことを特徴とする帳票定義方法。
Optically read the form and generate image data of the form,
The image data is binarized to generate form image data,
A correction form image data is generated by correcting the form image data so as to fill a deficiency caused by the binarization,
A rectangular or substantially rectangular shape is detected as a rectangle from the corrected form image data,
Determining whether the rectangle is a character frame rectangle;
Based on the adjacent relationship of the character frame rectangles, classify the character frame rectangles, detect each of the classified division as a field,
Detecting characters included in the form image data,
Detecting a keyword associated with the attribute of the character entered in the field in advance from the character;
Detecting the field corresponding to the keyword based on a positional relationship between the keyword and the field;
A form definition method characterized by storing the detected field in association with the keyword.
コンピュータに、
帳票を光学的に読み取り帳票の画像データを生成する手順、
前記画像データを2値化して帳票画像データを生成する手順、
前記帳票画像データに対して前記2値化により生じた欠損を埋める補正をして補正帳票画像データを生成する手順、
前記補正帳票画像データから長方形または略長方形の形状を矩形として検出する手順、
前記矩形が文字枠矩形であるか否かを判定する手順、
前記文字枠矩形の隣接関係に基づいて、前記文字枠矩形を分類し、分類した区分の各々をフィールドとして検出する手順、
前記帳票画像データに含まれる文字を検出する手順、
前記フィールドに記入される文字の属性が予め対応付けられるキーワードを前記文字から検出する手順、
前記キーワードに対応する前記フィールドを、前記キーワードと前記フィールドの位置関係に基づいて検出する手順、
検出した前記フィールドを前記キーワードに対応付けて記憶する手順、
を実行させるための帳票定義プログラム。
On the computer,
A procedure for optically reading a form and generating image data of the form,
A procedure for binarizing the image data to generate form image data;
A procedure for generating corrected form image data by correcting the form image data so as to fill in the defects generated by the binarization;
A procedure for detecting a rectangular or substantially rectangular shape as a rectangle from the corrected form image data,
A procedure for determining whether or not the rectangle is a character frame rectangle;
A procedure for classifying the character frame rectangle based on the adjacency relationship of the character frame rectangle and detecting each of the classified sections as a field;
A procedure for detecting characters included in the form image data;
A procedure for detecting a keyword associated with a character attribute to be written in the field in advance from the character;
Detecting the field corresponding to the keyword based on the positional relationship between the keyword and the field;
A procedure for storing the detected field in association with the keyword;
Form definition program to execute.
JP2014252479A 2014-12-12 2014-12-12 Form definition device, form definition method, and form definition program Active JP6220770B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014252479A JP6220770B2 (en) 2014-12-12 2014-12-12 Form definition device, form definition method, and form definition program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014252479A JP6220770B2 (en) 2014-12-12 2014-12-12 Form definition device, form definition method, and form definition program

Publications (2)

Publication Number Publication Date
JP2016115088A true JP2016115088A (en) 2016-06-23
JP6220770B2 JP6220770B2 (en) 2017-10-25

Family

ID=56141924

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014252479A Active JP6220770B2 (en) 2014-12-12 2014-12-12 Form definition device, form definition method, and form definition program

Country Status (1)

Country Link
JP (1) JP6220770B2 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018016552A1 (en) * 2016-07-21 2018-01-25 株式会社ミラボ Ledger input form generation device, ledger input form generation method, and program
JP2018092459A (en) * 2016-12-06 2018-06-14 株式会社アイリックコーポレーション Image analyzing device, image analyzing method, and image analyzing program
CN108763952A (en) * 2018-05-03 2018-11-06 阿里巴巴集团控股有限公司 A kind of data classification method, device and electronic equipment
JP2019041150A (en) * 2017-08-22 2019-03-14 キヤノン株式会社 Device for setting file name or the like to scan image, control method therefor and program
CN111325194A (en) * 2018-12-13 2020-06-23 杭州海康威视数字技术股份有限公司 Character recognition method, device and equipment and storage medium
JP2021193610A (en) * 2020-09-29 2021-12-23 ベイジン バイドゥ ネットコム サイエンス テクノロジー カンパニー リミテッド Information processing method, information processing device, electronic apparatus and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110059572B (en) * 2019-03-22 2021-08-10 中国科学院自动化研究所 Document image Chinese keyword detection method and system based on single character matching

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01266682A (en) * 1988-04-19 1989-10-24 Ricoh Co Ltd Original reader
JPH1011531A (en) * 1996-06-21 1998-01-16 Mitsubishi Electric Corp Slip reader
JP2002024761A (en) * 2000-07-05 2002-01-25 Canon Inc Image processing device, image processing method, and storage medium
JP2005044256A (en) * 2003-07-25 2005-02-17 Casio Comput Co Ltd Slip field attribute preparation system, method, and program
JP2007058882A (en) * 1996-09-27 2007-03-08 Fujitsu Ltd Pattern-recognition apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01266682A (en) * 1988-04-19 1989-10-24 Ricoh Co Ltd Original reader
JPH1011531A (en) * 1996-06-21 1998-01-16 Mitsubishi Electric Corp Slip reader
JP2007058882A (en) * 1996-09-27 2007-03-08 Fujitsu Ltd Pattern-recognition apparatus
JP2002024761A (en) * 2000-07-05 2002-01-25 Canon Inc Image processing device, image processing method, and storage medium
JP2005044256A (en) * 2003-07-25 2005-02-17 Casio Comput Co Ltd Slip field attribute preparation system, method, and program

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7072304B2 (en) 2016-07-21 2022-05-20 株式会社ミラボ Form input form generation device, form input form generation method and program
JPWO2018016552A1 (en) * 2016-07-21 2019-05-16 株式会社ミラボ Form input form generation device, form input form generation method and program
JP2021152924A (en) * 2016-07-21 2021-09-30 株式会社ミラボ Business form input form creation device, business form input form creation method, and program
JP2022003579A (en) * 2016-07-21 2022-01-11 株式会社ミラボ Business form input form creation device, business form input form creation method, and program
WO2018016552A1 (en) * 2016-07-21 2018-01-25 株式会社ミラボ Ledger input form generation device, ledger input form generation method, and program
JP2018092459A (en) * 2016-12-06 2018-06-14 株式会社アイリックコーポレーション Image analyzing device, image analyzing method, and image analyzing program
JP2019041150A (en) * 2017-08-22 2019-03-14 キヤノン株式会社 Device for setting file name or the like to scan image, control method therefor and program
CN108763952A (en) * 2018-05-03 2018-11-06 阿里巴巴集团控股有限公司 A kind of data classification method, device and electronic equipment
CN111325194A (en) * 2018-12-13 2020-06-23 杭州海康威视数字技术股份有限公司 Character recognition method, device and equipment and storage medium
CN111325194B (en) * 2018-12-13 2023-12-29 杭州海康威视数字技术股份有限公司 Character recognition method, device and equipment and storage medium
JP2021193610A (en) * 2020-09-29 2021-12-23 ベイジン バイドゥ ネットコム サイエンス テクノロジー カンパニー リミテッド Information processing method, information processing device, electronic apparatus and storage medium
JP7270013B2 (en) 2020-09-29 2023-05-09 ベイジン バイドゥ ネットコム サイエンス テクノロジー カンパニー リミテッド Information processing method, information processing device, electronic device and storage medium
US11908219B2 (en) 2020-09-29 2024-02-20 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and device for processing information, electronic device, and storage medium

Also Published As

Publication number Publication date
JP6220770B2 (en) 2017-10-25

Similar Documents

Publication Publication Date Title
JP6220770B2 (en) Form definition device, form definition method, and form definition program
KR100383372B1 (en) Pattern extraction apparatus and method thereof, and a computer-readable storage medium
JP6554193B1 (en) Entry area extraction apparatus and entry area extraction program
JPH0652354A (en) Skew correcting method, skew angle detecting method, document segmentation system and skew angle detector
JP2005173730A (en) Business form ocr program, method, and device
KR20090109047A (en) Image processor and image processing method and recording medium
JP2010250425A (en) Underline removal apparatus
KR101793184B1 (en) Apparatus of Fast lyric area extraction from images of printed music scores and method therefor
JP6030917B2 (en) Character cutting device, character cutting method, and character recognition device
US9049400B2 (en) Image processing apparatus, and image processing method and program
JP2015005100A (en) Information processor, template generation method, and program
KR20160053544A (en) Method for extracting candidate character
CN105512100B (en) A kind of printed page analysis method and device
CN115050025A (en) Knowledge point extraction method and device based on formula recognition
US9400926B2 (en) Image processing apparatus, image processing method, and non-transitory computer readable medium
JP2001094760A (en) Information processing device
JP7031465B2 (en) Information processing equipment and programs
JP2003046746A (en) Method and apparatus for processing image
JP7019963B2 (en) Character string area / character rectangle extraction device, character string area / character rectangle extraction method, and program
JP2021152696A (en) Information processor and program
JP4117648B2 (en) Form, form processing method, form processing program, recording medium recording form processing program, and form processing apparatus
JP2007213255A (en) Table recognition device and computer program
JP2002262093A (en) Method, device and program for processing picture and recording medium
JP4381455B2 (en) Character size estimation method, apparatus, and recording medium
JP2003030585A (en) Image processor and image processing method, and program and storage medium therefor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20161027

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170822

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20171002

R150 Certificate of patent or registration of utility model

Ref document number: 6220770

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313115

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313117

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350