JP2022019445A - Image processing apparatus, method, and program - Google Patents

Image processing apparatus, method, and program Download PDF

Info

Publication number
JP2022019445A
JP2022019445A JP2020123283A JP2020123283A JP2022019445A JP 2022019445 A JP2022019445 A JP 2022019445A JP 2020123283 A JP2020123283 A JP 2020123283A JP 2020123283 A JP2020123283 A JP 2020123283A JP 2022019445 A JP2022019445 A JP 2022019445A
Authority
JP
Japan
Prior art keywords
character
character string
regular expression
space
search
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2020123283A
Other languages
Japanese (ja)
Inventor
誠 榎本
Makoto Enomoto
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.)
Canon Inc
Original Assignee
Canon 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 Canon Inc filed Critical Canon Inc
Priority to JP2020123283A priority Critical patent/JP2022019445A/en
Publication of JP2022019445A publication Critical patent/JP2022019445A/en
Pending legal-status Critical Current

Links

Images

Abstract

To extract character strings of a character recognition result while dividing the character strings at an appropriate position.SOLUTION: An image processing apparatus stores in advance regular expression definition in which a regular expression formula describing a character string to be extracted and a parameter related to a space character defined in advance for every regular expression formula are associated with each other. The image processing apparatus inserts the space character into a character string obtained by executing character recognition processing on a document image based on a parameter related to the space character to create a character string for searching, searches for a portion matching the regular expression formula in the created character string for searching, and divides a character string resulting from the character recognition based on the portion searched for.SELECTED DRAWING: Figure 5

Description

本発明は、画像処理装置、方法及びプログラムに関する。 The present invention relates to image processing devices, methods and programs.

紙の文書をスキャンし、電子化して保管する業務がある。従来、電子化する際に、文字認識を実施してファイル名に利用するシステムがあった。例えば、文書画像上から文字認識結果をユーザが選択して、その文字認識結果をファイル名として任意のストレージに保存するシステムがあった。しかしながら、文字認識結果を使用しているため、文字認識結果の揺れ、例えばファイル名として設定したい文字列に余分な空白文字が存在したときに、ファイル名にも空白文字が含まれてしまい、好ましくない。そこで、特許文献1では、文字認識結果をファイル名に利用する際に、先頭の空白文字を除去するなどファイル名として好適な文字列に変換する方法が開示されている。 There is a business of scanning paper documents and storing them electronically. Conventionally, there has been a system that recognizes characters and uses them for file names when digitizing. For example, there is a system in which a user selects a character recognition result from a document image and saves the character recognition result as a file name in an arbitrary storage. However, since the character recognition result is used, when the character recognition result fluctuates, for example, when an extra blank character exists in the character string to be set as the file name, the file name also contains the blank character, which is preferable. do not have. Therefore, Patent Document 1 discloses a method of converting a character recognition result into a character string suitable for a file name, such as removing a leading blank character when using the file name.

特開2013-74609号公報Japanese Unexamined Patent Publication No. 2013-74609

特許文献1の方法では、選択された文字認識結果に空白が入っていた場合に、ファイル名として好適な文字列に変換できるが、そもそもファイル名として選択した文字認識結果の文字列の範囲が好ましくないことがある。例えば、日付をファイル名として選択したい場合であっても、その日付の左右に付随する文字も含めて1つの文字列を形成しており、それら全体の文字列を選択しまうことがある。例えば、日付の項目名称として“支払期日”が記載されており、その項目名称と日付とを分離できない場合は、1つの文字列として選択されてしまう。この場合、ユーザは、当該選択された文字列の文字錦結果から、余分な部分を手動で選択して削除する必要がある。 In the method of Patent Document 1, when a blank is included in the selected character recognition result, it can be converted into a character string suitable as a file name, but the range of the character string of the character recognition result selected as the file name is preferable in the first place. Sometimes not. For example, even if you want to select a date as a file name, one character string may be formed including the characters attached to the left and right of the date, and the entire character string may be selected. For example, if "payment date" is described as the item name of the date and the item name and the date cannot be separated, they are selected as one character string. In this case, the user needs to manually select and delete an extra part from the character brocade result of the selected character string.

本発明の画像処理装置は、抽出対象にすべき文字列を正規表現式と、正規表現式ごとに予め定義したスペース文字に関するパラメータとを関連づけた正規表現定義を記憶する記憶手段と、
文書画像に対して文字認識処理を実行する文字認識手段と、前記スペース文字に関するパラメータに基づいて、前記文字認識手段による文字認識結果の文字列に対してスペース文字を挿入することにより、検索用文字列を生成する生成手段と、前記生成手段で生成された前記検索用文字列から、前記正規表現式に一致する箇所を検索する検索手段と、前記検索手段で検索された箇所に基づいて、前記文字認識結果の文字列を分割する分割手段と、を有することを特徴とする。
The image processing apparatus of the present invention has a storage means for storing a regular expression definition in which a character string to be extracted is associated with a regular expression expression and a parameter related to a space character defined in advance for each regular expression expression.
Search characters by inserting space characters into the character string of the character recognition result by the character recognition means based on the character recognition means that executes character recognition processing for the document image and the parameters related to the space characters. Based on the generation means for generating a column, the search means for searching for a part matching the regular expression from the search character string generated by the generation means, and the part searched by the search means. It is characterized by having a dividing means for dividing a character string of a character recognition result.

本発明によれば、文字認識結果の文字列を適切な位置で分割して抽出することができる。 According to the present invention, the character string of the character recognition result can be divided and extracted at an appropriate position.

画像処理システムのシステム構成を示す図である。It is a figure which shows the system configuration of an image processing system. 画像形成装置101のハードウェア構成を説明する図である。It is a figure explaining the hardware composition of the image forming apparatus 101. 画像処理サーバ102、ユーザ端末103のハードウェア構成を説明する図である。It is a figure explaining the hardware configuration of the image processing server 102, and the user terminal 103. 帳票画像400とその文字認識結果の例を示す図である。It is a figure which shows the example of the form image 400 and the character recognition result. 第1の実施形態の処理フローを示す図である。It is a figure which shows the processing flow of 1st Embodiment. 第1の実施形態における、正規表現定義のリストを示す図である。It is a figure which shows the list of the regular expression definition in 1st Embodiment. 文字認識結果の例を示す表である。It is a table which shows an example of a character recognition result. 第1の実施形態における、分割処理後の結果の例である。It is an example of the result after the division process in the 1st embodiment. 第2の実施形態における、正規表現定義のリストを示す図である。It is a figure which shows the list of the regular expression definition in the 2nd Embodiment. 第2の実施形態における、文字認識結果の例であるThis is an example of the character recognition result in the second embodiment. 第3の実施形態における、正規表現定義のリストを示す図である。It is a figure which shows the list of the regular expression definition in 3rd Embodiment. 第3の実施形態における、文字認識結果の例である。This is an example of the character recognition result in the third embodiment.

以下、本発明の実施形態について図面に基づいて説明する。なお、実施形態は本発明を限定するものではなく、また、実施形態で説明されている全ての構成が本発明の課題を解決するため必須の手段であるとは限らない。 Hereinafter, embodiments of the present invention will be described with reference to the drawings. It should be noted that the embodiments do not limit the present invention, and not all the configurations described in the embodiments are indispensable means for solving the problems of the present invention.

<第1の実施形態>
図1は、第1の実施形態に係る画像処理システム100の構成例を示す図である。この画像処理システム100は、画像形成装置101と、画像処理サーバ102と、ユーザ端末103とを有する。画像形成装置101、画像処理サーバ102と、ユーザ端末103は、ネットワーク104により相互に接続され、通信可能である。
<First Embodiment>
FIG. 1 is a diagram showing a configuration example of the image processing system 100 according to the first embodiment. The image processing system 100 includes an image forming apparatus 101, an image processing server 102, and a user terminal 103. The image forming apparatus 101, the image processing server 102, and the user terminal 103 are connected to each other by the network 104 and can communicate with each other.

画像形成装置101は、ユーザ端末103から画像データの印刷依頼(印刷データ)を受信して印刷することや、画像形成装置101に備わるスキャナで画像データを読み取ることや、スキャナで読み取られた画像データを印刷することなどが可能な複合機である。また、画像処理サーバ102は、画像形成装置101のスキャナで読み取られた画像データに対して後述の画像処理を実行し、その画像処理結果を、ユーザ端末103に送信することが可能な画像処理装置である。なお、画像処理サーバ102は、クラウド、すなわちインターネット上に配置される仮想サーバであってもよい。ユーザ端末103は、画像処理サーバ102から受信した画像処理結果を、ユーザインターフェイスを備えたアプリケーションでユーザと対話的に追加処理をすることが可能である。なお、本実施形態では、ユーザ端末103は、ディスプレイとキーボードやマウスを備えた一般的なPCを想定するが、例えばタッチパネルを備えたモバイル端末であってもよい。 The image forming apparatus 101 receives and prints a print request (printing data) for image data from the user terminal 103, reads the image data with the scanner provided in the image forming apparatus 101, and the image data read by the scanner. It is a multifunction device that can print images. Further, the image processing server 102 is an image processing device capable of executing image processing described later on the image data read by the scanner of the image forming apparatus 101 and transmitting the image processing result to the user terminal 103. Is. The image processing server 102 may be a cloud, that is, a virtual server located on the Internet. The user terminal 103 can perform additional processing interactively with the user by an application provided with a user interface on the image processing result received from the image processing server 102. In the present embodiment, the user terminal 103 is assumed to be a general PC provided with a display, a keyboard, and a mouse, but may be, for example, a mobile terminal provided with a touch panel.

本実施形態では、画像形成装置101が請求書などの紙の帳票をスキャンし、画像処理サーバ102がそこから必要となる情報を抽出して電子的に格納し、ユーザ端末103が抽出結果の確認と修正が可能なユーザインターフェイスを提供する、一連のデータ入力支援処理の説明を行う。 In the present embodiment, the image forming apparatus 101 scans a paper form such as an invoice, the image processing server 102 extracts necessary information from the form and stores it electronically, and the user terminal 103 confirms the extraction result. A series of data input support processes that provide a user interface that can be modified will be described.

図2は、画像形成装置101の構成の一例を示す図である。画像形成装置101は、コントローラ201、プリンタ202、スキャナ203、及び操作部204を有する。コントローラ201は、CPU211、RAM212、HDD213、ネットワークI/F214、プリンタI/F215、スキャナI/F216、操作部I/F217、及び拡張I/F218を有する。 FIG. 2 is a diagram showing an example of the configuration of the image forming apparatus 101. The image forming apparatus 101 includes a controller 201, a printer 202, a scanner 203, and an operation unit 204. The controller 201 includes a CPU 211, a RAM 212, an HDD 213, a network I / F 214, a printer I / F 215, a scanner I / F 216, an operation unit I / F 217, and an extended I / F 218.

CPU211は、画像形成装置101の全体を制御する。CPU211は、RAM212、HDD213、ネットワークI/F214、プリンタI/F215、スキャナI/F216、操作部I/F217、及び拡張I/F218とのデータの授受を制御可能である。また、CPU211は、HDD213から読み出した制御プログラム(命令)をRAM212に展開し、RAM212に展開した命令を実行する。HDD213は、CPU211で実行可能な制御プログラム、画像形成装置101で使用する設定値、及びユーザから依頼された処理に関するデータ等を記憶する。RAM212は、CPU211がHDD213から読み出した命令を一時的に格納するための領域を有する。また、RAM212は、命令の実行に必要な各種のデータを記憶しておくことも可能である。例えば画像処理では、CPU211は入力されたデータをRAM212に展開することで処理を行うことが可能である。 The CPU 211 controls the entire image forming apparatus 101. The CPU 211 can control the exchange of data with the RAM 212, HDD 213, network I / F 214, printer I / F 215, scanner I / F 216, operation unit I / F 217, and extended I / F 218. Further, the CPU 211 expands the control program (instruction) read from the HDD 213 into the RAM 212, and executes the expanded instruction in the RAM 212. The HDD 213 stores a control program that can be executed by the CPU 211, set values used by the image forming apparatus 101, data related to processing requested by the user, and the like. The RAM 212 has an area for temporarily storing an instruction read from the HDD 213 by the CPU 211. Further, the RAM 212 can also store various data necessary for executing an instruction. For example, in image processing, the CPU 211 can perform processing by expanding the input data to the RAM 212.

ネットワークI/F214は、画像処理システム100内の装置とネットワーク通信を行うためのインターフェイスである。ネットワークI/F214は、データ受信を行ったことをCPU211に伝達することや、RAM212上のデータをネットワーク104に送信することが可能である。プリンタI/F215は、CPU211から送信された印刷データをプリンタ202に送信することや、プリンタ202から受信したプリンタの状態をCPU211に伝達することが可能である。スキャナI/F216は、CPU211から送信された画像読み取り指示をスキャナ203に送信し、スキャナ203から受信した画像データをCPU211に伝達することや、スキャナ203から受信した状態をCPU211に伝達することが可能である。操作部I/F217は、操作部204から入力されたユーザからの指示をCPU211に伝達することや、ユーザが操作するための画面情報を操作部204に伝達することが可能である。拡張I/F218は、画像形成装置101に外部機器を接続することを可能とするインターフェイスである。拡張I/F218は、例えば、USB(Universal Serial Bus)形式のインターフェイスを具備する。画像形成装置101は、USBメモリ等の外部記憶装置が拡張I/F218に接続されることにより、当該外部記憶装置に記憶されているデータの読み取り及び当該外部記憶装置に対するデータの書き込みを行うことが可能である。 The network I / F 214 is an interface for performing network communication with the device in the image processing system 100. The network I / F 214 can transmit the data reception to the CPU 211 and can transmit the data on the RAM 212 to the network 104. The printer I / F 215 can transmit the print data transmitted from the CPU 211 to the printer 202, and can transmit the state of the printer received from the printer 202 to the CPU 211. The scanner I / F 216 can transmit the image reading instruction transmitted from the CPU 211 to the scanner 203, transmit the image data received from the scanner 203 to the CPU 211, and transmit the state received from the scanner 203 to the CPU 211. Is. The operation unit I / F 217 can transmit an instruction from the user input from the operation unit 204 to the CPU 211, and can transmit screen information for the user to operate to the operation unit 204. The extended I / F 218 is an interface that enables an external device to be connected to the image forming apparatus 101. The extended I / F 218 includes, for example, a USB (Universal Serial Bus) type interface. The image forming apparatus 101 can read data stored in the external storage device and write data to the external storage device by connecting an external storage device such as a USB memory to the extended I / F 218. It is possible.

プリンタ202は、プリンタI/F215から受信した画像データを用紙に印刷することや、プリンタ202の状態をプリンタI/F215に伝達することが可能である。 The printer 202 can print the image data received from the printer I / F 215 on paper and transmit the state of the printer 202 to the printer I / F 215.

スキャナ203は、スキャナI/F216から受信した画像読み取り指示に従って、読み取り部に置かれた用紙に表示されている情報を読み取ってデジタル化してスキャナI/F216に伝達することが可能である。また、スキャナ203は、自身の状態をスキャナI/F216に伝達することが可能である。 The scanner 203 can read the information displayed on the paper placed on the reading unit, digitize it, and transmit it to the scanner I / F 216 according to the image reading instruction received from the scanner I / F 216. Further, the scanner 203 can transmit its own state to the scanner I / F 216.

操作部204は、画像形成装置101に対して各種の指示を行うための操作をユーザに行わせるためのインターフェイスである。例えば、操作部204は、タッチパネルを有する液晶画面を具備し、画像形成装置101のユーザに操作画面を提供するとともに、ユーザからの操作を受け付ける。 The operation unit 204 is an interface for causing the user to perform an operation for giving various instructions to the image forming apparatus 101. For example, the operation unit 204 includes a liquid crystal screen having a touch panel, provides an operation screen to the user of the image forming apparatus 101, and accepts an operation from the user.

図3(a)は、画像処理サーバ102の構成の一例を示す図である。画像処理サーバ102は、CPU301、RAM302、HDD303、及びネットワークI/F304を有する。CPU301は、画像処理サーバ102の全体を制御する。CPU301は、RAM302、HDD303、及びネットワークI/F304とのデータの授受を制御可能である。また、CPU301は、HDD303から読み出した制御プログラム(命令)をRAM302に展開し、RAM302に展開した命令を実行する。 FIG. 3A is a diagram showing an example of the configuration of the image processing server 102. The image processing server 102 has a CPU 301, a RAM 302, an HDD 303, and a network I / F 304. The CPU 301 controls the entire image processing server 102. The CPU 301 can control the exchange of data with the RAM 302, the HDD 303, and the network I / F 304. Further, the CPU 301 expands the control program (instruction) read from the HDD 303 into the RAM 302, and executes the expanded instruction in the RAM 302.

図3(b)は、ユーザ端末103の構成の一例を示す図である。ユーザ端末103は、CPU311、RAM312、HDD313、ネットワークI/F314、入出力I/F315を有する。CPU311は、ユーザ端末103の全体を制御する。CPU311は、RAM312、HDD313、ネットワークI/F314、及び入出力I/F315とのデータの授受を制御可能である。ディスプレイ320は、液晶などの表示デバイスによって構成され、入出力I/F315から受信した表示情報を表示する。入力装置330は、マウス、あるいはタッチパネルといったポインティングデバイス、およびキーボードによって構成され、ユーザからの操作を受け付けて、入出力I/F315に操作情報を送信する。HDD313には、画像処理サーバ102からネットワークI/F314を介して受信した画像処理結果を格納することが可能である。本実施形態では、CPU311は、HDD313から読み出したアプリケーションプログラムをRAM312に展開し、操作部I/F315にて表示情報の表示とユーザ操作の受け付けを行う。 FIG. 3B is a diagram showing an example of the configuration of the user terminal 103. The user terminal 103 has a CPU 311, a RAM 312, an HDD 313, a network I / F 314, and an input / output I / F 315. The CPU 311 controls the entire user terminal 103. The CPU 311 can control the exchange of data with the RAM 312, the HDD 313, the network I / F 314, and the input / output I / F 315. The display 320 is composed of a display device such as a liquid crystal display, and displays display information received from the input / output I / F 315. The input device 330 is composed of a pointing device such as a mouse or a touch panel, and a keyboard, receives an operation from a user, and transmits operation information to the input / output I / F 315. The HDD 313 can store the image processing result received from the image processing server 102 via the network I / F 314. In the present embodiment, the CPU 311 expands the application program read from the HDD 313 into the RAM 312, and the operation unit I / F 315 displays the display information and accepts the user operation.

図4(a)は、本実施形態において想定する帳票画像400の一例を示す図である。帳票画像400は、画像形成装置101のスキャナで紙文書(例えば請求書)を読み取ることにより取得した画像である。項目値401乃至403は、画像処理システム100で抽出対象にしたい項目文字列の例である。図4(a)の項目値401は、この文書の内容を示すタイトルの値であり、項目値402は、発行日を示す日付の値であり、項目値403は請求金額の値である。なお、説明のために、項目値401~403の位置を矩形枠で示しているが、実際の帳票画像に矩形枠は記載されていないものとする。 FIG. 4A is a diagram showing an example of a form image 400 assumed in the present embodiment. The form image 400 is an image acquired by reading a paper document (for example, an invoice) with a scanner of the image forming apparatus 101. The item values 401 to 403 are examples of item character strings to be extracted by the image processing system 100. The item value 401 in FIG. 4A is the value of the title indicating the content of this document, the item value 402 is the value of the date indicating the issue date, and the item value 403 is the value of the billing amount. For the sake of explanation, the positions of the item values 401 to 403 are shown by a rectangular frame, but it is assumed that the rectangular frame is not described in the actual form image.

図4(b)は、帳票画像400に対して、汎用の領域解析処理と光学文字認識(OCR)処理とを実行した場合に得られる文字認識結果の文字列(OCR文字列)の例である。文字列410乃至417の8個の文字領域が特定され、各文字領域からOCR文字列が抽出されている。領域解析処理およびOCR処理の結果に基づき抽出された各文字領域の位置を矩形枠で示す。文字列410は、項目値401の文字列とその左側にある文字列とを包含する1つの文字領域に対応する文字列として得られている。また、文字列411は、項目値402とその左側の文字列とを包含する1つの文字領域に対応する文字列として抽出されている。また、文字列413も、項目値403とその左側の文字列とを包含する領域に対応する文字列として抽出されている。 FIG. 4B is an example of a character string (OCR character string) of the character recognition result obtained when the general-purpose area analysis process and the optical character recognition (OCR) process are executed on the form image 400. .. Eight character areas of character strings 410 to 417 are specified, and an OCR character string is extracted from each character area. The position of each character area extracted based on the results of the area analysis process and the OCR process is shown by a rectangular frame. The character string 410 is obtained as a character string corresponding to one character area including the character string of the item value 401 and the character string on the left side thereof. Further, the character string 411 is extracted as a character string corresponding to one character area including the item value 402 and the character string on the left side thereof. Further, the character string 413 is also extracted as a character string corresponding to the area including the item value 403 and the character string on the left side thereof.

この文字列をユーザによるファイル名作成のUIに用いるユースケースを説明する。例えば、ユーザが帳票画像上の所望の位置をクリックした場合に、当該クリックした位置に対応する、図4(b)の領域解析結果に基づく文字領域が選択されるようなUI(ユーザインタフェース)について説明する。このようなUIでは、ユーザが“請求書”の文字列上をクリックすると、領域解析結果に基づく文字領域の文字列(すなわち、文字領域410の“ABC(株)様請求書”という文字列)が選択されることになる。したがって、ユーザが“請求書”の文書タイトル部分のみをファイル名として選択したかった場合は、当該選択された文字列の中から、余分な“ABC(株)”の文字列を削除する必要がある。 A use case for using this character string in the UI for creating a file name by the user will be described. For example, regarding a UI (user interface) in which when a user clicks a desired position on a form image, a character area corresponding to the clicked position is selected based on the area analysis result of FIG. 4 (b). explain. In such a UI, when the user clicks on the character string of "invoice", the character string of the character area based on the area analysis result (that is, the character string "ABC Co., Ltd. invoice" of the character area 410). Will be selected. Therefore, if the user wants to select only the document title part of the "invoice" as the file name, it is necessary to delete the extra "ABC Co., Ltd." character string from the selected character string. be.

そこで、本実施形態では、ユーザがファイル名として使用したい文字列を選択する際に、、図4(b)のようなOCR文字列から、項目値401~403のような文字列を適切に抽出する画像処理について説明する。 Therefore, in the present embodiment, when the user selects a character string to be used as a file name, a character string such as item values 401 to 403 is appropriately extracted from the OCR character string as shown in FIG. 4 (b). The image processing to be performed will be described.

本実施形態における項目値の抽出とは、目的とする値が、余分な文字が付随していない独立した文字列となっている状態を示す。例えば、帳票画像400に対して、項目値401の“請求書”という一つの文字列が独立している状態である。 Extraction of the item value in the present embodiment indicates a state in which the target value is an independent character string to which no extra character is attached. For example, one character string "invoice" having an item value of 401 is independent of the form image 400.

図6の正規表現定義リスト600は、複数の正規表現定義をテーブル形式で示した例である。本実施形態における正規表現定義は、各定義IDに対して、正規表現式と、正規表現パラメータとの組み合わせを関連付けることにより定義してる。この予め定義された複数の正規表現定義は、画像処理サーバ102のHDD303に格納されている。正規表現式は、抽出したい項目、例えば日付や、電話番号、金額、文書タイトルに含まれる文字など、抽出対象にしたい文字列を一つの正規表現式で記述したものである。正規表現パラメータとは、正規表現式ごとに定義した、正規表現検索を実施する際に対象となるOCR文字列をどのように解釈するかのパラメータである。例えば、隣接する文字と文字の間の距離がどの程度離れていればスペース文字(空白文字)として扱うか、などをパラメータで記述したものである。 The regular expression definition list 600 in FIG. 6 is an example showing a plurality of regular expression definitions in a table format. The regular expression definition in the present embodiment is defined by associating a combination of a regular expression expression and a regular expression parameter with each definition ID. The plurality of predefined regular expression definitions are stored in the HDD 303 of the image processing server 102. The regular expression expression describes the item to be extracted, for example, a character string to be extracted, such as a date, a telephone number, an amount of money, and a character included in a document title, in one regular expression expression. The regular expression parameter is a parameter defined for each regular expression expression and how to interpret the target OCR character string when performing a regular expression search. For example, a parameter describes how far the adjacent characters should be to be treated as a space character (blank character).

図6の正規表現定義リスト600の例では、3個の正規表現定義610、620、630が定義されている。 In the example of the regular expression definition list 600 of FIG. 6, three regular expression definitions 610, 620, and 630 are defined.

正規表現定義ID610は、“¥S*書”の正規表現パターンと、“スぺース=2h”の正規表現パラメータからなる。“¥S*書”の正規表現パターンは、スペース文字以外(¥S)の複数の文字と“書”という文字とを組み合わせたパターンを表しており、例えば“請求書”、“見積書”などの文字列が該当するパターンとして検索可能である。正規表現パラメータの“スペース=2h”は、OCR文字列を検索文字列に変換する際に、隣接する文字同士の距離が、文字高さ(h)に対して2倍以上空いてれば、スペース文字を挿入して扱うことを示している。なお、本実施形態では、正規表現パラメータとして、スペース文字と扱うための閾値に文字高さを用いて規定しているが、例えば画像のピクセルサイズや、紙面上の物理的な距離、平均文字幅などを基準として用いてもよい。 The regular expression definition ID 610 includes a regular expression pattern of "¥ S * book" and a regular expression parameter of "space = 2h". The regular expression pattern of "\ S * book" represents a pattern that combines multiple characters other than space characters (\ S) and the character "book", for example, "invoice", "quote", etc. The character string of can be searched as the corresponding pattern. The regular expression parameter "space = 2h" is a space if the distance between adjacent characters is at least twice the character height (h) when converting the OCR character string to the search character string. Indicates that characters are inserted and handled. In this embodiment, as a regular expression parameter, the character height is specified as a threshold value for treating as a space character. For example, the pixel size of an image, the physical distance on a paper surface, and the average character width are specified. Etc. may be used as a reference.

正規表現定義ID620は、日付に関する正規表現定義であり、“¥d{2,4}年¥d{1,2}月¥d{1,2}日”の正規表現式と、“スペース削除”の正規表現パラメータからなる。“¥d{2,4}年¥d{1,2}月¥d{1,2}日”の正規表現式は、2~4桁の数字と、“年”と、1~2桁の数字と、“月”と、1~2桁の数字と、“日”と、を組み合わせたパターンを表しており、このパターンに一致する日付の文字列が検索可能である。正規表現パラメータの“スペース削除”とは、OCR文字列を検索文字列に変換する際に、隣り合った文字の間の距離によらず、スペース文字を挿入しないことを示している。 The regular expression definition ID 620 is a regular expression definition related to a date, and is a regular expression expression of "\ d {2,4} year \ d {1,2} month \ d {1,2} day" and "space deletion". Consists of regular expression parameters of. The regular expression of "\ d {2,4} year \ d {1,2} month \ d {1,2} day" is a 2-4 digit number, a "year", and a 1-2 digit number. It represents a pattern that combines a number, a "month", a one- or two-digit number, and a "day", and a character string of a date that matches this pattern can be searched. The regular expression parameter "delete space" indicates that no space character is inserted when converting an OCR string to a search string, regardless of the distance between adjacent characters.

正規表現定義ID630は、“[1-9][¥d,]*円”の正規表現式と、“スぺース=1h”の正規表現パラメータからなる。“[1-9][¥d,]*円”の正規表現式は、1~9のいずれかの数字で始まり、1桁以上のカンマを含む数字と、“円”と、を組み合わせたパターンを表しており、このパターンに一致する金額を表す文字列が検索可能である。正規表現パラメータの“スペース=1h”とは、OCR文字列を検索文字列に変換する際に、隣接する文字同士の距離が、文字高さ(h)を基準として、文字高さ1個分以上空いていればスペース文字を挿入して扱うことを示している。 The regular expression definition ID 630 includes a regular expression expression of "[1-9] [\ d,] * circle" and a regular expression parameter of "space = 1h". The regular expression of "[1-9] [¥ d,] * yen" starts with any number from 1 to 9, and is a pattern that combines a number including a comma with one or more digits and a "yen". , And a character string representing the amount of money that matches this pattern can be searched. The regular expression parameter "space = 1h" means that when converting an OCR character string to a search character string, the distance between adjacent characters is one or more character heights based on the character height (h). If it is free, it indicates that a space character is inserted and handled.

図4の帳票画像400と、図6の正規表現定義リスト600とを例として用いて、本実施形態の画像処理を図5のフローチャートを用いて説明する。 Using the form image 400 of FIG. 4 and the regular expression definition list 600 of FIG. 6 as examples, the image processing of the present embodiment will be described with reference to the flowchart of FIG.

まずS501において、画像形成装置101のCPU211は、スキャナ203で読み取った帳票画像400を、画像処理サーバ102へ送信する。画像処理サーバ102は、その画像形成装置101から送信された帳票画像400を取得する。 First, in S501, the CPU 211 of the image forming apparatus 101 transmits the form image 400 read by the scanner 203 to the image processing server 102. The image processing server 102 acquires the form image 400 transmitted from the image forming apparatus 101.

次にS502において、画像処理サーバ102のCPU301は、帳票画像400に治して領域解析処理を行うことにより文字領域を特定し、文字領域に対して文字認識処理を実行する。文字認識処理の結果、CPU301は、文字領域(文字ブロック)の座標と、文字領域中の各文字の座標と、当該文字認識結果の文字コードとを得る。ここで得た文字領域単位の文字コードの配列をOCR文字列と呼ぶ。帳票画像400に文字認識処理を実施した結果、文字列410乃至417がOCR文字列として取得されたものとする。 Next, in S502, the CPU 301 of the image processing server 102 identifies the character area by performing the area analysis processing on the form image 400, and executes the character recognition processing on the character area. As a result of the character recognition process, the CPU 301 obtains the coordinates of the character area (character block), the coordinates of each character in the character area, and the character code of the character recognition result. The array of character codes for each character area obtained here is called an OCR character string. As a result of performing character recognition processing on the form image 400, it is assumed that the character strings 410 to 417 are acquired as OCR character strings.

次にS503において、画像処理サーバ102のCPU301は、HDD303に格納された正規表現定義リスト600から、正規表現定義の1つ(例えば正規表現定義610)を処理対象とする。 Next, in S503, the CPU 301 of the image processing server 102 processes one of the regular expression definitions (for example, the regular expression definition 610) from the regular expression definition list 600 stored in the HDD 303.

次にS504において、画像処理サーバ102のCPU301は、S503で処理対象とした正規表現定義の正規表現パラメータに基づいて、S502で得た文字列の認識結果を解釈し、検索用文字列として正規化する。 Next, in S504, the CPU 301 of the image processing server 102 interprets the recognition result of the character string obtained in S502 based on the regular expression parameter of the regular expression definition targeted for processing in S503, and normalizes it as a search character string. do.

図7は文字認識結果の例である。文字認識結果701は、文字列410の文字認識結果である。文字認識結果702は、項目値402を含むOCR文字列411の文字認識結果である。文字認識結果703は、項目値403を含むOCR文字列413の文字認識結果である。文字認識結果701乃至703の表における文字の行は各認識文字を表し、距離の行は、次の文字までの距離として、文字高さを相対基準とした距離を表している。正規表現定義610の正規表現パラメータは、“スペース=2h”であり、これは文字同士の距離が文字高さを相対基準として文字高さ2個分以上であればスペース文字とみなすことを示している。 FIG. 7 is an example of the character recognition result. The character recognition result 701 is a character recognition result of the character string 410. The character recognition result 702 is a character recognition result of the OCR character string 411 including the item value 402. The character recognition result 703 is a character recognition result of the OCR character string 413 including the item value 403. The character line in the table of character recognition results 701 to 703 represents each recognized character, and the distance line represents the distance based on the character height as the distance to the next character. The regular expression parameter of the regular expression definition 610 is "space = 2h", which indicates that if the distance between characters is two or more character heights with respect to the character height, it is regarded as a space character. There is.

CPU301は、文字列410の文字認識結果701に対して、各文字と隣の文字までの距離を走査しスペース挿入条件に合致する文字を検出する。検出の結果、“様”の文字が、隣の“請”の文字まで2.1文字高さに相当する距離ぶん離れているため、ここにスペース文字を挿入して検索用文字列“ABC(株)様 請求書”を生成する。 The CPU 301 scans the distance between each character and the adjacent character with respect to the character recognition result 701 of the character string 410, and detects a character that matches the space insertion condition. As a result of the detection, the character "sama" is separated from the adjacent character "contract" by a distance equivalent to 2.1 character height, so a space character is inserted here and the search character string "ABC (ABC) ( Co., Ltd. Generates an invoice.

なお、正規表現パラメータごとに、検索用の文字列は変わるので、例えば“スペース=1h”と定義していた場合は、さらに“請”と“求”、“求”と“書”の間にスペース文字を挿入し、“ABC(株) 様 請 求 書”となるし、“スペース削除”と定義していた場合は“ABC(株)様請求書”となる。 Since the character string for searching changes for each regular expression parameter, for example, if "space = 1h" is defined, it is further between "request" and "request", and "request" and "book". Insert a space character and it will be "ABC Co., Ltd. request", and if it is defined as "space deletion", it will be "ABC Co., Ltd. invoice".

次にCPU301は、文字列411の文字認識結果702に対して、各文字と隣の文字までの距離を走査しスペース挿入条件に合致する文字を検出する。検出の結果、“年”と“月”の文字が隣の文字まで2文字高さ以上離れているため、ここにスペース文字を挿入して検索用文字列“発行日:2020年 5月 15日”を形成する。 Next, the CPU 301 scans the distance between each character and the adjacent character with respect to the character recognition result 702 of the character string 411 to detect a character that matches the space insertion condition. As a result of the detection, the characters "year" and "month" are separated by two or more characters from the next character, so insert a space character here and search the character string "Issue date: May 15, 2020". Form.

残りの文字列412乃至417に対しても同様の処理を実行し、すべての文字列に対する検索用文字列を形成する。 The same processing is executed for the remaining character strings 412 to 417 to form a search character string for all the character strings.

次に、S505において、画像処理サーバ102のCPU301は、S504で得たすべての検索用文字列に対して、S503で処理対象とした正規表現定義の正規表現式にマッチするかどうか判定するための正規表現検索処理を実施する。 Next, in S505, the CPU 301 of the image processing server 102 determines whether or not all the search character strings obtained in S504 match the regular expression expression of the regular expression definition to be processed in S503. Perform regular expression search processing.

文字列410の検索用文字列“ABC(株)様 請求書”に対して正規表現定義610の正規表現式の検索を行った場合、“請求書”の部分が一致する。続いて、文字列411の検索用文字列“発行日:2020年 5月 15日”に対して正規表現定義610の正規表現式の検索を行った場合、一致する箇所は得られない。同様に、残りの文字列412乃至417の検索用文字列に対しても正規表現定義610の正規表現式を用いて同様の処理を実施し、その結果、他の文字列には正規表現式は一致しない。 When the regular expression expression of the regular expression definition 610 is searched for the search character string "ABC Co., Ltd. invoice" of the character string 410, the "invoice" part matches. Subsequently, when the regular expression expression of the regular expression definition 610 is searched for the search character string "issue date: May 15, 2020" of the character string 411, no matching part is obtained. Similarly, the same processing is performed for the search character strings of the remaining character strings 412 to 417 using the regular expression expression of the regular expression definition 610, and as a result, the regular expression expression is added to the other character strings. It does not match.

S506において、画像処理サーバ102のCPU301は、S505の検索結果で得られた“請求書”の一致情報をRAM302へと格納する。 In S506, the CPU 301 of the image processing server 102 stores the matching information of the "invoice" obtained from the search result of S505 in the RAM 302.

次に、S507において、画像処理サーバ102のCPU301は、未処理の正規表現定義が残っているか判別し、未処理の正規表現定義が残っている場合は、S503へ戻って、未処理の正規表現定義の1つを次の処理対象として、同様にS504乃至S507の処理を実施する。 Next, in S507, the CPU 301 of the image processing server 102 determines whether or not the unprocessed regular expression definition remains, and if the unprocessed regular expression definition remains, returns to S503 and returns to the unprocessed regular expression. The processing of S504 to S507 is similarly carried out with one of the definitions as the next processing target.

例えば、正規表現定義610を最初の処理対象としていた場合は、正規表現定義620を次の処理対象とする。この場合、S504において、文字認識結果702に対して、正規表現定義620のパラメータに基づいて、検索文字列を生成する。正規表現定義620のパラメータは“スペース削除”であるため、文字間の距離にかかわらず、スペース文字を挿入しないので、文字認識結果702からは、検索用文字列として“発行日:2020年5月15日”が得られる。そして、正規表現定義620の正規表現式に一致する箇所として、“2020年5月15日”の検索結果が得られる。 For example, when the regular expression definition 610 is the first processing target, the regular expression definition 620 is the next processing target. In this case, in S504, a search character string is generated for the character recognition result 702 based on the parameters of the regular expression definition 620. Since the parameter of the regular expression definition 620 is "delete space", space characters are not inserted regardless of the distance between characters. Therefore, from the character recognition result 702, "issue date: May 2020" as a search character string. 15 days "is obtained. Then, the search result of "May 15, 2020" is obtained as a part that matches the regular expression expression of the regular expression definition 620.

同様に、正規表現定義630を処理対象とした場合は、S504において、文字認識結果703に対して、正規表現定義630のパラメータ“スペース=1h”に基づいて、“合計金額: 11,286円”の検索文字列を形成する。そして、正規表現定義630の正規表現式に一致する箇所として、S505において、“11,286円”が検索される。 Similarly, when the regular expression definition 630 is processed, in S504, for the character recognition result 703, "total amount: 11,286 yen" based on the parameter "space = 1h" of the regular expression definition 630. Form a search string for. Then, "11,286 yen" is searched for in S505 as a place that matches the regular expression expression of the regular expression definition 630.

S507において、正規表現定義のすべてを処理済みと判断した場合は、S508に進む。 If it is determined in S507 that all the regular expression definitions have been processed, the process proceeds to S508.

S508において、画像処理サーバ102のCPU301は、S506の処理でRAMに格納された検索結果をもとに文字列の分割処理を実施する。分割処理とは、OCR文字列中において、正規表現式で一致した範囲の両端で、OCR文字列を分割する処理のことである。例えば、OCR文字列410の“ABC(株)様請求書”において、“請求書”の左右を文字列の区切りとして分割する。ただし、“請求書”の右側は、OCR文字列の右端であるため分割は発生せず、“請求書”の左側の位置(すなわち、“様”と“請”の間)で分割することにより、OCR文字列410を二つのOCR文字列に分割する。同様に、“2020年5月15日”、“11,286円”についても処理を行い、フローチャートの処理を終了する。 In S508, the CPU 301 of the image processing server 102 executes the character string division processing based on the search result stored in the RAM in the processing of S506. The division process is a process of dividing the OCR character string at both ends of the range matched by the regular expression expression in the OCR character string. For example, in the "ABC Co., Ltd. invoice" of the OCR character string 410, the left and right sides of the "invoice" are divided as a character string delimiter. However, since the right side of the "invoice" is the right end of the OCR character string, no division occurs, and by dividing it at the position on the left side of the "invoice" (that is, between "sama" and "contract"). , The OCR string 410 is split into two OCR strings. Similarly, processing is performed for "May 15, 2020" and "11,286 yen", and the processing of the flowchart is completed.

図8は、帳票画像400に対して、図5のフローチャートを適用した後のOCR文字列の位置を矩形枠で示した図である。OCR文字列410がOCR文字列800と801に分割され、OCR文字列411がOCR文字列802と803に分割され、OCR文字列413がOCR文字列804と805に分割されている。なお、OCR文字列412、414乃至417は元のままとなっている。 FIG. 8 is a diagram showing the positions of the OCR character strings after applying the flowchart of FIG. 5 to the form image 400 with a rectangular frame. The OCR character string 410 is divided into OCR character strings 800 and 801, the OCR character string 411 is divided into OCR character strings 802 and 803, and the OCR character string 413 is divided into OCR character strings 804 and 805. The OCR character strings 412, 414 to 417 are unchanged.

本画像処理を適用した結果、ユーザが、帳票画像400に対してファイル名付けをする際に、文書タイトルである“請求書”の上の位置でユーザがクリック操作で指定した場合、図4の文字列410の代わりに、図8のOCR文字列801が選択されることになる。すなわち、正規表現定義に合致する文字列を抽出して選択することが可能となる。 As a result of applying this image processing, when the user names the form image 400 as a file, when the user specifies it by a click operation at the position above the document title "invoice", the character in FIG. 4 is displayed. Instead of column 410, the OCR string 801 of FIG. 8 will be selected. That is, it is possible to extract and select a character string that matches the regular expression definition.

もし、本実施形態で説明した正規表現定義のパラメータに基づく検索用文字列を利用しなかった場合は、以下のような処理になってしまう。例えば、S502の文字認識処理によって、OCR文字列“ABC(株)様 請 求 書”が得られた場合、正規表現定義610の正規表現式では、“書”の前にスペース文字が存在するために一致せず、即ち“請求書”の文字列を抽出することができない。このように、一般の文字認識処理では、文字間の距離に基づきスペース文字を挿入する処理が文書画像全体に対して一律で適用されてしまうので、認識結果において、本来の文書作成者の意図通りになっているとは限らない。そのため、正規表現式でスペースをどう表現するかが難しい。 If the search character string based on the parameters of the regular expression definition described in this embodiment is not used, the processing will be as follows. For example, when the OCR character string "ABC Co., Ltd. request" is obtained by the character recognition process of S502, the space character exists before the "book" in the regular expression expression of the regular expression definition 610. That is, the character string of "invoice" cannot be extracted. In this way, in the general character recognition process, the process of inserting space characters based on the distance between characters is applied uniformly to the entire document image, so the recognition result is as the original intention of the document creator. It is not always the case. Therefore, it is difficult to express a space with a regular expression expression.

一方、本実施形態では、正規表現定義ごとに、正規表現のパラメータとして、スペースをどう扱うかを定義しているため、正規表現ごとに適切なスペース文字を扱えるようになる。例えば、“請求書”などの文書タイトルでは、スペース以外の文字列が連続する文字列を項目値抽出の手がかりにした上で、タイトルの文字間は一定以上の文字間があることを勘案して、“スペース=2h”とスペースの条件を定義することができる。また、例えば、日付など書式で明確に抽出することができる場合は“スペース削除”としてスペースを無視ができる。 On the other hand, in the present embodiment, since how to handle the space is defined as a parameter of the regular expression for each regular expression definition, an appropriate space character can be handled for each regular expression. For example, in a document title such as "Invoice", the character string other than the space is used as a clue for extracting the item value, and the space between the characters in the title is taken into consideration that there is a certain amount of space between characters. , "Space = 2h" and the condition of the space can be defined. Also, for example, if the format can be clearly extracted such as a date, the space can be ignored as "space deletion".

このように、本実施形態では、ファイル名などによく使用する文字列を正規表現式で予め定義するとともに、文書内で各文字列の文字がどのような間隔で記載されているか(スペース文字を入れるべきかどうか)を文字列ごとに定義することができる。これにより、分割したい文字列の位置をより正確に特定することができる。 As described above, in the present embodiment, character strings often used for file names and the like are defined in advance by regular expression expressions, and at what intervals the characters of each character string are described in the document (space characters are used). Whether or not it should be included) can be defined for each character string. This makes it possible to more accurately specify the position of the character string to be divided.

なお、文字認識処理で出力されるスペース文字が信頼できる場合は、認識結果をそのまま用いるパラメータを設定してもよい。例えば、英語文書の英文の文字認識処理などで、単語辞書によって単語を認識し、単語間に轍書きのスペース文字を挿入している場合などが想定される。 If the space character output by the character recognition process is reliable, a parameter that uses the recognition result as it is may be set. For example, in the character recognition processing of an English sentence of an English document, it is assumed that a word is recognized by a word dictionary and a rutted space character is inserted between the words.

その他、本実施形態では項目値の抽出をファイル名付けの例で説明したが、帳票保存のメタデータや、文書転記システムへの値の自動入力などに用いてもよい。 In addition, although the extraction of item values has been described in the example of file naming in this embodiment, it may be used for metadata for saving forms, automatic input of values to a document transcription system, and the like.

以上説明した通り、本実施形態を適用することによって、ユーザが項目値をファイル名付けなどに好適なOCR文字列に分割することができる。 As described above, by applying the present embodiment, the user can divide the item value into an OCR character string suitable for file naming and the like.

<第2の実施形態>
第1の実施形態では、項目値ごとに1つの正規表現定義を用いているが、その限りではなく、複数の正規表現定義を用いてもよい。
<Second embodiment>
In the first embodiment, one regular expression definition is used for each item value, but the present invention is not limited to this, and a plurality of regular expression definitions may be used.

図9の正規表現定義リスト800は電話番号に対する正規表現定義の例である。正規表現定義910は、“¥d{2,4}[¥-¥(]¥d{2,4}[¥-¥)]¥d{4}”の正規表現式のみで正規表現パラメータなし、正規表現定義911は910と同じ正規表現式で、“スペース削除”の正規表現パラメータからなる。正規表現定義910,911の正規表現式は、2~4桁の数字と、“-”あるいは“(”と、2~4桁の数字と、“-”あるいは“)”と、4桁の数字と、で構成される日本の電話番号が検索可能である。 The regular expression definition list 800 in FIG. 9 is an example of a regular expression definition for a telephone number. The regular expression definition 910 is only a regular expression expression of "\ d {2,4} [\-\ (] \ d {2,4} [\-\)] \ d {4}" and has no regular expression parameter. The regular expression definition 911 is the same regular expression expression as 910, and consists of the regular expression parameter of "space deletion". Regular expression definitions The regular expression expressions of 910 and 911 are 2- to 4-digit numbers, "-" or "(", 2- to 4-digit numbers, "-" or ")", and 4-digit numbers. You can search for Japanese phone numbers that consist of.

正規表現定義920は、“¥d{2,4}¥s¥d{2,4}¥s¥d{4}”の正規表現式のみで正規表現パラメータなし、正規表現定義921は920と同じ正規表現式と、“スペース=1h”の正規表現パラメータからなる。正規表現定義920,921は、2~4桁の数字と、スペース文字と、2~4桁の数字と、スペース文字と、4桁の数字と、で構成される日本の電話番号が検索可能である。 The regular expression definition 920 is only a regular expression expression of "\ d {2,4} \ s \ d {2,4} \ s \ d {4}" and has no regular expression parameter, and the regular expression definition 921 is the same as 920. It consists of a regular expression expression and a regular expression parameter of "space = 1h". The regular expression definitions 920 and 921 can search for Japanese telephone numbers consisting of 2 to 4 digit numbers, space characters, 2 to 4 digit numbers, space characters, and 4 digit numbers. be.

図10は、帳票中の電話番号の文字認識結果の例である。OCR文字列1010では、“1”の文字の前後の文字間が大きいため、S502の文字認識の結果、1の前後にスペース文字が挿入され“TEL: 0 1 23-456-7890”という文字列になっている。正規表現定義910では、正規表現パラメータがないため、このOCR文字列をそのまま検索用文字列として扱うことになり、正規表現式“¥d{2,4}[¥-¥(]¥d{2,4}[¥-¥)]¥d{4}”で検索しても一致しない。正規表現定義911では、“スペース削除”のパラメータがあるため、検索用文字列“TEL:0123-456-7890”となり、電話番号の部分を抽出することができる。 FIG. 10 is an example of the character recognition result of the telephone number in the form. In the OCR character string 1010, since the space between the characters before and after the character "1" is large, a space character is inserted before and after the 1 as a result of character recognition of S502, and the character string "TEL: 0 1 23-456-7890" is inserted. It has become. In the regular expression definition 910, since there is no regular expression parameter, this OCR character string is treated as a search character string as it is, and the regular expression expression "\ d {2,4} [\-\ (] \ d {2" , 4} [\-\)] \ d {4} ”does not match. In the regular expression definition 911, since there is a parameter of "space deletion", the search character string is "TEL: 0123-456-7890", and the telephone number part can be extracted.

OCR文字列1020は、電話番号の区切りとしてハイフンが存在せずにスペース文字が存在する例である。OCR文字列1020の“1”の文字の前後の文字間が大きいため、S502の文字認識の結果、1の前後にスペース文字が挿入され“TEL: 0 1 23 456 7890”という文字列になっている。正規表現定義920では、正規表現パラメータがないため、このOCR文字列をそのまま検索用文字列として扱うことになり、正規表現式“¥d{2,4}¥s¥d{2,4}¥s¥d{4}”で検索しても一致しない。正規表現定義921では、“スペース=1h”のパラメータがあるため、検索用文字列“TEL:0123-456-7890”となり、電話番号の部分を抽出することができる。 The OCR character string 1020 is an example in which a space character exists without a hyphen as a telephone number delimiter. Since the space between the characters before and after the character "1" in the OCR character string 1020 is large, a space character is inserted before and after the 1 as a result of character recognition in S502, resulting in the character string "TEL: 0 1 23 456 7890". There is. In the regular expression definition 920, since there is no regular expression parameter, this OCR character string is treated as a search character string as it is, and the regular expression expression "\ d {2,4} \ s \ d {2,4} \ Searching for "s \ d {4}" does not match. In the regular expression definition 921, since there is a parameter of "space = 1h", the search character string is "TEL: 0123-456-7890", and the telephone number part can be extracted.

このような、文字認識結果の出力するスペース文字に対して正規表現式のみで一致させようとすると、先頭の2~4桁の数字という正規表現式“¥d{2,4}”に対して“[¥d¥s]{2,7}”という記述にせざるを得なくなる。すなわち、スペースの数が不定のため、最大のスペースを想定して桁数の定義も2~7桁と定義することになってしまうが、このような正規表現では、多くの文字列が合致してしまい、本来抽出したい項目値以外のノイズが増えることになる。 When trying to match such a space character output as a character recognition result only with a regular expression expression, for the regular expression expression "\ d {2,4}" of the first 2 to 4 digits. There is no choice but to write "[\ d \ s] {2,7}". That is, since the number of spaces is indefinite, the definition of the number of digits is also defined as 2 to 7 digits assuming the maximum space, but in such a regular expression, many character strings match. This will increase noise other than the item values that you originally want to extract.

以上説明した通り、本実施形態を適用することによって、文字認識結果の出力するスペース文字の影響を軽減し、正規表現式をシンプルに定義することが可能である。 As described above, by applying this embodiment, it is possible to reduce the influence of the space character output as the character recognition result and simply define the regular expression expression.

<第3の実施形態>
第1の実施形態では、抽出したいパターンを正規表現定義により定義し、その一致した左右端で分割したが、分割以外の動作を正規表現パラメータにより規定してもよい。
<Third embodiment>
In the first embodiment, the pattern to be extracted is defined by the regular expression definition and divided at the matching left and right ends, but the operation other than the division may be specified by the regular expression parameter.

図11の正規表現定義リスト1100は正規表現パラメータ2として、正規表現式に一致した時の動作を規定している。正規表現定義1111は、正規表現式は“.*no”で、例えばいずれかの文字の連続と“no”の組み合わせを表しており、正規表現パラメータは“スペース削除”、動作定義で分割を定義している。分割は、第一の実施形態で説明した、検索結果の左右端で分割する動作である。正規表現定義1112は、“nov”の文字列を表し、正規表現パラメータは“スペース削除”、動作定義でプロテクトを定義している。プロテクトは、検索結果に一致した範囲を分割しないという動作の定義である。 The regular expression definition list 1100 of FIG. 11 defines the operation when the regular expression expression is matched as the regular expression parameter 2. In the regular expression definition 1111, the regular expression expression is ". * No", for example, it represents a combination of a sequence of any characters and "no", the regular expression parameter is "space deletion", and the division is defined by the action definition. is doing. The division is the operation of dividing at the left and right ends of the search result described in the first embodiment. The regular expression definition 1112 represents a character string of "nov", the regular expression parameter is "space deletion", and protection is defined in the action definition. Protect is a definition of the operation that does not divide the range that matches the search result.

図12の文字列1201“Invoice No 10123”はインボイス番号を表しており、正規表現定義1111のみを正規表現定義リストとして用いた場合に、図5のフローチャートの処理の結果、“Invoice No”に一致する。その結果、“Invoice No”と“10123”に分割される。 The character string 1201 “Invoice No 10123” in FIG. 12 represents an invoice number, and when only the regular expression definition 1111 is used as the regular expression definition list, as a result of the processing of the flowchart of FIG. 5, it becomes “Invoice No”. Match. As a result, it is divided into "Invoice No" and "10123".

図12の文字列1202“12 Nov 2019”は日付を表しており、正規表現定義1111だけを正規表現定義リストに用いた場合に、検索の結果、“12 No”と一致する。その結果、“12 No”と“v 2019”に分割されてしまい、日付を抽出したいユーザにとっては、好ましくない結果となる。正規表現定義リストに正規表現定義1112も加えて検索することにより、文字列1202の“Nov”と一致し、その範囲内では分割を実施しないという検索結果が、S506により格納され、S508で、分割情報がプロテクトされ、分割が実施されず、意図しない分割を防ぐことができる。 The character string 1202 “12 Nov 2019” in FIG. 12 represents a date, and when only the regular expression definition 1111 is used in the regular expression definition list, the result of the search matches “12 No”. As a result, it is divided into "12 No" and "v 2019", which is not preferable for the user who wants to extract the date. By searching by adding the regular expression definition 1112 to the regular expression definition list, the search result that matches "Nov" of the character string 1202 and does not perform division within that range is stored by S506 and divided by S508. Information is protected, division is not performed, and unintended division can be prevented.

また、それ以外の動作の規定をしてもよい。正規表現定義1120ではサブマッチ分割として、正規表現式のグループ化を用いて、サブマッチによる一致箇所の左右でも分割するという定義を行うことができる。正規表現定義1120の正規表現式“(.*no)(¥d*)”を文字列1201に対して正規表現検索した結果、サブマッチ1で“Invoice No”、サブマッチ2で“10123”が一致し、その間で分割を実施する。 In addition, other operations may be specified. In the regular expression definition 1120, as a submatch division, it is possible to define that the grouping of regular expression expressions is used to divide the match on the left and right of the submatch. As a result of searching the regular expression "(. * No) (\ d *)" of the regular expression definition 1120 for the character string 1201, "Invoice No" is matched in submatch 1 and "10123" is matched in submatch 2. , In the meantime, carry out the division.

以上説明した通り、本実施形態を適用することによって、意図しない分割を防ぐ、あるいはより複雑な分割を実施することができる。 As described above, by applying the present embodiment, it is possible to prevent unintended division or to carry out more complicated division.

<第4の実施形態>
第1の実施形態では、項目値の抽出の方法は、OCR文字列を分割することで実現したが、結合してもよい。例えば、帳票画像400のOCR文字列411が、文字認識の結果、“発行日:2020年”と、“5月”、“15日”の3のOCR文字列に分割されているケースでは、S503の検索用文字列生成処理において、同じ文字高さの近傍にあるOCR文字列を結合してから、S504の正規表現式によって検索を行い、一致した場合は一致範囲を結合する。
<Fourth Embodiment>
In the first embodiment, the method of extracting the item value is realized by dividing the OCR character string, but it may be combined. For example, in the case where the OCR character string 411 of the form image 400 is divided into three OCR character strings of "issue date: 2020" and "May" and "15th" as a result of character recognition, S503 In the search character string generation process of, after combining the OCR character strings in the vicinity of the same character height, the search is performed by the regular expression expression of S504, and if they match, the matching range is combined.

以上説明した通り、本実施形態を適用することによって、文字認識結果の出力するOCR文字列の粒度に影響されることなく、正規表現式で抽出することが可能である。 As described above, by applying the present embodiment, it is possible to extract by a regular expression expression without being affected by the particle size of the OCR character string output as the character recognition result.

<その他の実施形態>
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワークまたは記憶媒体を介してシステムまたは装置に供給し、そのシステムまたは装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
<Other embodiments>
INDUSTRIAL APPLICABILITY The present invention supplies a program that realizes one or more functions of the above-described embodiment to a system or device via a network or storage medium, and one or more processors in the computer of the system or device reads and executes the program. It can also be realized by the processing to be performed. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.

以上、本発明の好ましい実施形態について説明したが、本発明は、これらの実施形態に限定されず、その要旨の範囲内で種々の変形及び変更が可能である。 Although the preferred embodiments of the present invention have been described above, the present invention is not limited to these embodiments, and various modifications and modifications can be made within the scope of the gist thereof.

100 画像処理システム
101 画像形成装置
102 画像処理サーバ(画像処理装置)
103 ユーザ端末
104 ネットワーク
100 Image processing system 101 Image forming device 102 Image processing server (image processing device)
103 User terminal 104 Network

Claims (7)

抽出対象にすべき文字列を正規表現式と、正規表現式ごとに予め定義したスペース文字に関するパラメータとを関連づけた正規表現定義を記憶する記憶手段と、
文書画像に対して文字認識処理を実行する文字認識手段と、
前記スペース文字に関するパラメータに基づいて、前記文字認識手段による文字認識結果の文字列に対してスペース文字を挿入することにより、検索用文字列を生成する生成手段と、
前記生成手段で生成された前記検索用文字列から、前記正規表現式に一致する箇所を検索する検索手段と、
前記検索手段で検索された箇所に基づいて、前記文字認識結果の文字列を分割する分割手段と、
を有することを特徴とする画像処理装置。
A storage means for storing a regular expression definition in which a character string to be extracted is associated with a regular expression expression and a parameter related to a space character defined in advance for each regular expression expression.
A character recognition means that executes character recognition processing on a document image,
A generation means for generating a search character string by inserting a space character into the character string of the character recognition result by the character recognition means based on the parameters related to the space character.
A search means for searching a part matching the regular expression expression from the search character string generated by the generation means, and a search means.
A division means for dividing the character string of the character recognition result based on the portion searched by the search means, and a division means.
An image processing apparatus characterized by having.
前記生成手段は、前記スペース文字に関するパラメータとして規定された間隔より、前記文字認識結果の文字列の隣り合う文字間の距離が大きい箇所に前記スペース文字を挿入することにより、前記検索用文字列を生成する、ことを特徴とする請求項1に記載の画像処理装置。 The generation means inserts the space character at a position where the distance between adjacent characters in the character string of the character recognition result is larger than the interval defined as a parameter for the space character, thereby producing the search character string. The image processing apparatus according to claim 1, wherein the image processing apparatus is generated. 前記スペース文字に関するパラメータとして、文字高さを用いて規定されたパラメータが定義されている正規表現定義に対して、前記生成手段は、前記文字認識結果の文字列における文字高さに対する前記文字認識結果の文字列の隣り合う文字間の距離が、前記スペース文字に関するパラメータより大きい箇所に前記スペース文字を挿入することにより、前記検索用文字列を生成する、ことを特徴とする請求項2に記載の画像処理装置。 The generation means has the character recognition result for the character height in the character string of the character recognition result, as opposed to the regular expression definition in which the parameter defined by using the character height is defined as the parameter for the space character. The second aspect of claim 2, wherein the search character string is generated by inserting the space character at a position where the distance between adjacent characters of the character string is larger than the parameter related to the space character. Image processing device. 前記スペース文字に関するパラメータとして、スペースを削除することが定義されている正規表現定義に対して、前記生成手段は、前記文字認識結果の文字列に対してスペース文字を挿入せずに前記検索用文字列を生成する、ことを特徴とする請求項1乃至3のいずれか1項に記載の画像処理装置。 For the regular expression definition in which the space is deleted as a parameter related to the space character, the generation means does not insert the space character in the character string of the character recognition result, and the search character is used. The image processing apparatus according to any one of claims 1 to 3, wherein a column is generated. 前記文書画像においてユーザが指定した位置が、前記分割手段で分割された文字列に対応する位置であった場合、当該分割した後の文字列を選択する選択手段を、更に有することを特徴とする請求項1乃至4のいずれか1項に記載の画像処理装置。 When the position specified by the user in the document image is a position corresponding to the character string divided by the dividing means, the document image is further provided with a selection means for selecting the character string after the division. The image processing apparatus according to any one of claims 1 to 4. 抽出対象にすべき文字列を正規表現式と、正規表現式ごとに予め定義したスペース文字に関するパラメータとを関連づけた正規表現定義に基づいて、文字認識結果の文字列を分割する画像処理方法であって、
文書画像に対して文字認識処理を実行する文字認識ステップと、
前記スペース文字に関するパラメータに基づいて、前記文字認識ステップで得た文字認識結果の文字列に対してスペース文字を挿入することにより、検索用文字列を生成する生成ステップと、
前記生成ステップで生成された前記検索用文字列から、前記正規表現式に一致する箇所を検索する検索ステップと、
前記検索ステップで検索された箇所に基づいて、前記文字認識結果の文字列を分割する分割ステップと、
を有することを特徴とする画像処理方法。
It is an image processing method that divides the character string of the character recognition result based on the regular expression definition that associates the character string to be extracted with the regular expression expression and the parameter related to the space character defined in advance for each regular expression expression. hand,
A character recognition step that executes character recognition processing on a document image,
A generation step of generating a search character string by inserting a space character into the character string of the character recognition result obtained in the character recognition step based on the parameters related to the space character.
A search step for searching a part matching the regular expression expression from the search character string generated in the generation step, and a search step.
A division step for dividing the character string of the character recognition result based on the location searched in the search step, and a division step.
An image processing method characterized by having.
コンピュータを、請求項1乃至5のいずれか1項に記載の画像処理装置の各手段として機能させるためのプログラム。 A program for making a computer function as each means of the image processing apparatus according to any one of claims 1 to 5.
JP2020123283A 2020-07-17 2020-07-17 Image processing apparatus, method, and program Pending JP2022019445A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020123283A JP2022019445A (en) 2020-07-17 2020-07-17 Image processing apparatus, method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2020123283A JP2022019445A (en) 2020-07-17 2020-07-17 Image processing apparatus, method, and program

Publications (1)

Publication Number Publication Date
JP2022019445A true JP2022019445A (en) 2022-01-27

Family

ID=80204103

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020123283A Pending JP2022019445A (en) 2020-07-17 2020-07-17 Image processing apparatus, method, and program

Country Status (1)

Country Link
JP (1) JP2022019445A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7430219B2 (en) 2022-06-21 2024-02-09 エヌ・ティ・ティ・アドバンステクノロジ株式会社 Document information structuring device, document information structuring method and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7430219B2 (en) 2022-06-21 2024-02-09 エヌ・ティ・ティ・アドバンステクノロジ株式会社 Document information structuring device, document information structuring method and program

Similar Documents

Publication Publication Date Title
WO2018196661A1 (en) Image processing device and method
JP4780169B2 (en) Data generation device, scanner, and computer program
JP2008071050A (en) Information processing terminal device, information processor, file management server, information processing system, method for automatically creating file name, program, and recording medium
US20120030234A1 (en) Method and system for generating a search query
CN106326332B (en) Search device and search method
EP2884425B1 (en) Method and system of extracting structured data from a document
US20130339002A1 (en) Image processing device, image processing method and non-transitory computer readable recording medium
JP6262708B2 (en) Document detection method for detecting original electronic files from hard copy and objectification with deep searchability
JP2022019445A (en) Image processing apparatus, method, and program
US20160188612A1 (en) Objectification with deep searchability
JP5098614B2 (en) Method for controlling sentence processing apparatus and sentence processing apparatus
JP4903078B2 (en) Electronic device, Web page generation method, and Web page generation program
JP2022019446A (en) Image processing system, apparatus, method, and program
JP2005100079A (en) Form data inputting device and program
JP2017182195A (en) Document correction method, document correction apparatus, document printer, image for error detection, and computer program
JP6190549B1 (en) Document processing system
JP5310206B2 (en) Document processing apparatus, document processing method, and document processing program
JP7302175B2 (en) Information processing device and information processing program
US9286531B2 (en) Log-image extracting apparatus for high security
JP7383882B2 (en) Information processing device and information processing program
US9075878B2 (en) Information processing apparatus, content item management system, non-transitory computer readable medium, and information processing method
JP6869394B1 (en) Verification device, verification method, and verification program
JP7377565B2 (en) Drawing search device, drawing database construction device, drawing search system, drawing search method, and program
KR20070034343A (en) Electronic document conversion device that can search contents of image file
JP6175414B2 (en) Document processing apparatus and document processing program

Legal Events

Date Code Title Description
RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20200731

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230704

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20231213

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20240411

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20240423