JP2019197444A - Image processing program, image processing method, and image processing device - Google Patents

Image processing program, image processing method, and image processing device Download PDF

Info

Publication number
JP2019197444A
JP2019197444A JP2018091876A JP2018091876A JP2019197444A JP 2019197444 A JP2019197444 A JP 2019197444A JP 2018091876 A JP2018091876 A JP 2018091876A JP 2018091876 A JP2018091876 A JP 2018091876A JP 2019197444 A JP2019197444 A JP 2019197444A
Authority
JP
Japan
Prior art keywords
image
pixels
date stamp
pixel
date
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
JP2018091876A
Other languages
Japanese (ja)
Other versions
JP7034823B2 (en
Inventor
武志 馬路
Takeshi Baji
武志 馬路
将平 長谷川
Shohei Hasegawa
将平 長谷川
渡辺 和人
Kazuto Watanabe
和人 渡辺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Frontech Ltd
Original Assignee
Fujitsu Frontech Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Frontech Ltd filed Critical Fujitsu Frontech Ltd
Priority to JP2018091876A priority Critical patent/JP7034823B2/en
Publication of JP2019197444A publication Critical patent/JP2019197444A/en
Application granted granted Critical
Publication of JP7034823B2 publication Critical patent/JP7034823B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Character Input (AREA)

Abstract

To automatically specify an area in the image of a business form correctly in which a date stamp is put.SOLUTION: Provided is an image processing program which causes a computer to execute the process of: extracting a pixel that indicates a portion, out of the pixels in the image of a business form indicating elements of the business form, where the angle formed by angles in the horizontal and vertical directions of the image of the business form in the elements of the business form; grouping a plurality of pixels, out of the extracted pixels, that are adjacent and contiguous as one group; extracting a group, out of the pixel groups, where the lengthwise and breadthwise lengths in the image are greater than or equal to a threshold and where two sets or more of other groups exist that are within the prescribed range of distance; and specifying an area in the image of the business form that includes all of the extracted groups as an area where a date stamp is put.SELECTED DRAWING: Figure 3

Description

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

帳票の画像に対する文字認識を行う画像処理装置の1つとして、帳票に押印された日付印に含まれる日付を文字認識により認識する処理を行う装置がある。この種の画像処理装置では、日付印に含まれる日付を正しく認識するために帳票の画像から日付印が押印された領域を切り出して日付印の向きを補正する。   As one of image processing apparatuses that perform character recognition on a form image, there is an apparatus that performs processing for recognizing a date included in a date stamp stamped on a form by character recognition. In this type of image processing apparatus, in order to correctly recognize the date included in the date stamp, an area where the date stamp is stamped is cut out from the image of the form and the orientation of the date stamp is corrected.

帳票の画像における日付印の日付を文字認識する際には、まず、帳票の画像における日付印が押印された位置を特定する。特許文献1には、帳票IDに基づき、帳票フォーマットデータ格納部より対応する日付押印部の領域を取り出し、帳票の画像における日付印が押印された位置を特定することが記載されている。また、特許文献2には、帳票における押印枠の位置を示す座標(xs,xe,ys,ye)をもとに帳票の画像における日付印が押印された領域を特定することが記載されている。   When character recognition is performed on the date of the date stamp in the form image, first, the position where the date stamp is stamped in the form image is specified. Patent Document 1 describes that, based on the form ID, a corresponding date stamped area is extracted from the form format data storage unit, and the position where the date stamp is stamped in the form image is specified. Japanese Patent Application Laid-Open No. 2004-228561 describes that an area in which a date stamp is stamped in a form image is specified based on coordinates (xs, xe, ys, ye) indicating the position of a stamp frame in the form. .

特開平8−190610号公報JP-A-8-190610 特開平6−111066号公報JP-A-6-111066

しかしながら、近年、私製の帳票の増加等に伴い、帳票内における日付印を押印する領域の位置が多様化している。このため、日付印を押印する領域が存在する多種の帳票の全てについて日付印を押印する領域の位置情報を含む帳票フォーマットデータを作成するには、非常に多くの手間と時間を要する。   However, in recent years, with the increase in private-made forms and the like, the positions of areas for imprinting date stamps in the forms have diversified. For this reason, it takes a lot of labor and time to create the form format data including the position information of the area for imprinting the date stamp for all of the various forms having the area for imprinting the date stamp.

更に、帳票に日付印を押印する作業は、人が行うため、押印された日付印の一部が押印する領域の外側にはみ出してしまうこともある。このように、日付の一部が押印する領域の外側にはみ出してしまった場合、押印する領域の位置に基づいて帳票の画像から切り出した領域内の日付印は一部が欠損した状態となるため、日付印の向きや日付を正しく認識することが困難となる。日付印の日付を正しく認識できなかった場合には、オペレータがもとの帳票(紙媒体)に押印された日付印を確認して正しい日付を入力する作業が発生するため、オペレータの手間が増える。   Furthermore, since the person stamps the date stamp on the form, a part of the stamped date stamp may protrude outside the area to be stamped. In this way, when a part of the date protrudes outside the area to be stamped, the date stamp in the area cut out from the form image based on the position of the area to be stamped is partially missing. This makes it difficult to correctly recognize the date stamp direction and date. If the date of the date stamp cannot be correctly recognized, the operator needs to confirm the date stamp stamped on the original form (paper medium) and enter the correct date, which increases the labor of the operator. .

本発明は、上述した問題点に鑑みてなされたものであり、帳票の画像における日付印が押印された領域を自動で正しく特定することが可能な技術を提供することを目的とする。   The present invention has been made in view of the above-described problems, and an object of the present invention is to provide a technique capable of automatically and correctly specifying a region where a date stamp is imprinted in a form image.

本発明に係る第1の側面である画像処理プログラムは、帳票の画像における前記帳票の要素を示す画素のうち、前記帳票の要素における前記帳票の画像の水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上となる部分を示す画素を抽出し、抽出した前記画素を、隣接して連続する複数の画素を1つのグループとしてグループ化し、前記画素のグループのうち、前記画像内における縦横の長さが閾値以上であり、かつ距離が所定の範囲内となる他のグループが2組以上存在するグループを抽出し、前記帳票の画像における抽出した前記グループの全てを内包する領域を、日付印が押印された領域とする処理をコンピュータに実行させる画像処理プログラムである。   The image processing program according to the first aspect of the present invention includes an angle formed between each of a horizontal direction and a vertical direction of the form image in the form element among pixels indicating the form element in the form image. Pixels indicating a portion where the angle is equal to or greater than a predetermined angle, the extracted pixels are grouped as a group of a plurality of adjacent continuous pixels, and the vertical and horizontal directions in the image are out of the group of pixels. A group in which two or more other groups whose length is equal to or greater than the threshold and whose distance is within a predetermined range is extracted, and an area including all of the extracted groups in the form image is represented by a date stamp. This is an image processing program for causing a computer to execute processing for making an area marked with.

本発明に係る第2の側面である画像処理方法は、コンピュータが、帳票の画像における前記帳票の要素を示す画素のうち、前記帳票の要素における前記帳票の画像の水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上となる部分を示す画素を抽出し、抽出した前記画素を、隣接して連続する複数の画素を1つのグループとしてグループ化し、前記画素のグループのうち、前記画像内における縦横の長さが閾値以上であり、かつ距離が所定の範囲内となる他のグループが2組以上存在するグループを抽出し、前記帳票の画像における抽出した前記グループの全てを内包する領域を、日付印が押印された領域とする処理を実行する画像処理方法である。   In the image processing method according to the second aspect of the present invention, among the pixels indicating the element of the form in the form image, the computer processes each of the horizontal and vertical directions of the form image in the form element. A pixel indicating a portion where the angle formed by is equal to or greater than a predetermined angle is extracted, and the extracted pixels are grouped as a group of a plurality of adjacent pixels that are adjacent to each other. Extract a group in which two or more other groups having a vertical and horizontal length equal to or greater than a threshold and a distance within a predetermined range exist, and include an area including all of the extracted groups in the form image This is an image processing method for executing a process for setting a date stamped area.

本発明に係る第3の側面である画像処理装置は、帳票の画像における前記帳票の要素を示す画素のうち、前記帳票の要素における前記帳票の画像の水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上となる部分を示す画素を抽出し、抽出した前記画素を、隣接して連続する複数の画素を1つのグループとしてグループ化した後、前記画素のグループのうちの、前記画像内における縦横の長さが閾値以上であり、かつ距離が所定の範囲内となる他のグループが2組以上存在するグループを抽出し、前記帳票の画像における抽出した前記グループの全てを内包する領域を日付印が押印された領域とする解析部を備える画像処理装置である。   An image processing apparatus according to a third aspect of the present invention provides an angle formed between each of a horizontal direction and a vertical direction of the form image in the form element among pixels indicating the form element in the form image. After extracting pixels indicating a portion where is equal to or greater than a predetermined angle, the extracted pixels are grouped as a group of a plurality of adjacent and continuous pixels, and then within the image of the group of pixels Extract a group in which two or more other groups having a vertical and horizontal length equal to or greater than a threshold and a distance within a predetermined range exist, and include an area including all of the extracted groups in the form image It is an image processing apparatus provided with the analysis part made into the area | region where the date stamp was impressed.

本発明によれば、帳票の画像における日付印が押印された領域を自動で正しく特定することが可能となる。   According to the present invention, it is possible to automatically and correctly specify a region where a date stamp is imprinted in a form image.

画像処理システムの構成を示す図である。It is a figure which shows the structure of an image processing system. 一実施形態に係る画像処理装置の機能的構成を示す図である。It is a figure which shows the functional structure of the image processing apparatus which concerns on one Embodiment. 一実施形態に係る画像処理を説明するフローチャートである。It is a flowchart explaining the image processing which concerns on one Embodiment. 斜度抽出処理の内容を説明するフローチャートである。It is a flowchart explaining the content of an inclination extraction process. ノイズ除去処理の内容を説明するフローチャートである。It is a flowchart explaining the content of a noise removal process. グループ化処理の内容を説明するフローチャートである。It is a flowchart explaining the content of a grouping process. 正立補正処理の内容を説明するフローチャートである。It is a flowchart explaining the content of an erecting correction process. 帳票の例を示す図である。It is a figure which shows the example of a form. 帳票に押印された日付印の例を示す図である。It is a figure which shows the example of the date stamp stamped on the form. 帳票に押印された日付印の別の例を示す図である。It is a figure which shows another example of the date stamp stamped on the form. 斜度の算出方法を説明する図である。It is a figure explaining the calculation method of an inclination. 斜度の算出結果を示す図である。It is a figure which shows the calculation result of an inclination. 斜度の抽出結果を示す図である。It is a figure which shows the extraction result of inclination. 画素をグループ化する方法を説明する図(その1)である。It is FIG. (1) explaining the method to group a pixel. 画素をグループ化する方法を説明する図(その2)である。It is FIG. (2) explaining the method to group a pixel. ノイズの除去方法を説明する図である。It is a figure explaining the removal method of noise. 日付印の傾きを算出する方法を説明する図である。It is a figure explaining the method of calculating the inclination of a date stamp. 日付印が正立補正される様子を説明する図である。It is a figure explaining a mode that a date stamp is rectified upright. コンピュータのハードウェア構成を示す図である。It is a figure which shows the hardware constitutions of a computer.

図1は、画像処理システムの構成を示す図である。
図1の画像処理システム1は、帳票に押印された日付印に含まれる日付を文字認識により認識する処理を自動で行うシステムである。画像処理システム1は、画像処理装置2と、スキャナ装置3と、入力装置4と、表示装置5と、サーバ装置6とを含む。
FIG. 1 is a diagram illustrating a configuration of an image processing system.
The image processing system 1 in FIG. 1 is a system that automatically performs processing for recognizing a date included in a date stamp stamped on a form by character recognition. The image processing system 1 includes an image processing device 2, a scanner device 3, an input device 4, a display device 5, and a server device 6.

画像処理装置2は、帳票の画像における日付印が押印された領域を特定し、該日付印に含まれる日付を文字認識により認識する。画像処理装置2は、例えば、スキャナ装置3から帳票の画像を取得する。スキャナ装置3は、帳票等の紙媒体をデジタルデータ(画像)に変換する装置である。   The image processing apparatus 2 identifies an area where a date stamp is impressed in a form image, and recognizes a date included in the date stamp by character recognition. For example, the image processing apparatus 2 acquires a form image from the scanner apparatus 3. The scanner device 3 is a device that converts a paper medium such as a form into digital data (image).

入力装置4は、画像処理装置2に各種情報を入力する装置である。入力装置4は、例えば、キーボード装置である。表示装置5は、画像処理装置2が行う処理の内容や処理の結果、入力装置4により入力された情報、帳票の画像等の、各種情報を表示する装置である。表示装置5は、例えば、液晶ディスプレイである。   The input device 4 is a device that inputs various types of information to the image processing device 2. The input device 4 is, for example, a keyboard device. The display device 5 is a device that displays various types of information such as the contents of processing performed by the image processing device 2 and the results of the processing, information input by the input device 4, images of forms, and the like. The display device 5 is, for example, a liquid crystal display.

サーバ装置6は、画像処理装置2が画像内の文字を認識する際に参照する文字認識辞書を保持する装置である。サーバ装置6は、ネットワーク7を介して画像処理装置2と通信可能に接続される。   The server device 6 is a device that holds a character recognition dictionary that the image processing device 2 refers to when recognizing characters in an image. The server device 6 is communicably connected to the image processing device 2 via the network 7.

画像処理装置2は、スキャナ装置3から帳票の画像を取得した後、まず、該画像内における日付印が押印された位置(領域)を特定する。その後、画像処理装置2は、画像内における日付印の傾きを算出し、該傾きが所定の角度以上である場合には日付印の向きが正立となるよう画像を補正する。そして、画像処理装置2は、画像内における日付印の向きが正立となった状態で文字認識を行い、日付印に含まれる日付を認識する。画像処理装置2は、帳票の画像及び認識した日付を表示装置5に表示させる。なお、画像処理システム1のオペレータは、例えば、表示装置5に表示された日付の認識結果と、帳票に押印された日付印の日付とが異なる場合には、入力装置4を操作して日付を修正することが可能である。   After acquiring the form image from the scanner device 3, the image processing apparatus 2 first specifies the position (area) where the date stamp is impressed in the image. Thereafter, the image processing apparatus 2 calculates the inclination of the date stamp in the image, and corrects the image so that the orientation of the date stamp is upright when the inclination is equal to or greater than a predetermined angle. Then, the image processing apparatus 2 performs character recognition in a state where the direction of the date stamp in the image is upright, and recognizes the date included in the date stamp. The image processing device 2 causes the display device 5 to display the form image and the recognized date. Note that the operator of the image processing system 1 operates the input device 4 to set the date when, for example, the date recognition result displayed on the display device 5 is different from the date stamped on the form. It is possible to correct.

図2は、一実施形態に係る画像処理装置の機能的構成を示す図である。
図2に示すように、本実施形態に係る画像処理装置2は、スキャナ制御部210と、解析部220と、認識処理部230と、表示制御部240と、主制御部250とを含む。また、画像処理装置2は、図示していない記憶部を含む。
FIG. 2 is a diagram illustrating a functional configuration of the image processing apparatus according to the embodiment.
As shown in FIG. 2, the image processing apparatus 2 according to the present embodiment includes a scanner control unit 210, an analysis unit 220, a recognition processing unit 230, a display control unit 240, and a main control unit 250. The image processing apparatus 2 includes a storage unit (not shown).

スキャナ制御部210は、スキャナ装置3から帳票の画像を取得する処理を制御する。
解析部220は、帳票の画像における日付印の位置及び傾きを解析し、画像内における日付印の向きが正立となるよう画像を補正する。解析部220は、変換部221と、斜度抽出部222と、ノイズ除去部223と、切出部224と、補正部225とを含む。
The scanner control unit 210 controls processing for acquiring a form image from the scanner device 3.
The analysis unit 220 analyzes the position and inclination of the date stamp in the form image, and corrects the image so that the orientation of the date stamp in the image is upright. The analysis unit 220 includes a conversion unit 221, a gradient extraction unit 222, a noise removal unit 223, a cutout unit 224, and a correction unit 225.

変換部221は、帳票の画像がカラー画像である場合に、該カラー画像をグレースケールの画像に変換する。   When the form image is a color image, the conversion unit 221 converts the color image into a grayscale image.

斜度抽出部222は、帳票の画像内における帳票の要素(線、文字、図形、及び日付印等)のそれぞれにおける、画像水平方向及び垂直方向となす角が所定の角度以上となる部分を抽出する。例えば、斜度抽出部222は、画像内に存在する帳票の要素のいずれかの一部を示す画素毎に、該画素の周囲の画素の濃度値と後述するフィルタとに基づいて斜度を算出し、算出した斜度が閾値以上となる画素を抽出する。斜度は、帳票の要素のうちの斜度を算出する画素及び周囲の画素が示す部分の延伸方向と画像水平方向及び画像垂直方向のそれぞれとのなす角の大きさに応じた値である。帳票の要素のうちの斜度を算出する画素及び周囲の画素が示す部分の延伸方向が画像水平方向及び画像垂直方向のいずれかと略平行である場合の斜度は、斜度を算出する画素及び周囲の画素が示す部分の延伸方向が画像水平方向及び画像垂直方向のそれぞれに対して斜め方向となる場合の斜度よりも小さな値となる。   The gradient extraction unit 222 extracts a portion of the form element (line, character, figure, date stamp, etc.) in the form image where the angle between the horizontal direction and the vertical direction of the image is a predetermined angle or more. To do. For example, the gradient extraction unit 222 calculates the gradient for each pixel indicating any part of the form element existing in the image based on the density value of the pixels around the pixel and a filter described later. Then, a pixel whose calculated inclination is equal to or greater than a threshold is extracted. The slope is a value corresponding to the size of the angle formed between the stretching direction of the pixel indicated by the slope and the surrounding pixels of the form elements and the horizontal and vertical directions of the image. Among the elements of the form, the inclination when the extending direction of the pixel indicated by the pixels and the surrounding pixels is substantially parallel to either the image horizontal direction or the image vertical direction is the pixel for calculating the inclination and This is a value smaller than the inclination when the extending direction of the portion indicated by the surrounding pixels is oblique with respect to the horizontal direction and the vertical direction of the image.

ノイズ除去部223は、斜度抽出部222で抽出した斜度が閾値以上となる画素のうちの日付印とは異なる要素を示す画素を、ノイズとして日付印の一部を示す画素の候補から除外する。ノイズ除去部223は、画像内における日付印の外形及び寸法の特徴に基づいて、日付印とは異なる要素を示す画素を特定する。例えば、ノイズ除去部223は、斜度抽出部222で抽出した斜度が閾値以上となる画素を隣接して連続する複数の画素毎にグループ化し、縦横の寸法が閾値よりも小さいグループに含まれる画素を、ノイズとして日付印の一部を示す画素の候補から除外する。また、例えば、ノイズ除去部223は、縦横の寸法が閾値以上であるグループのうちの、距離が所定の範囲内となる他のグループが2組以上存在するグループに含まれる画素を、日付印の一部を示す画素として抽出する。言い換えると、ノイズ除去部223は、縦横の寸法が閾値以上であるグループのうちの、距離が所定の範囲内となる他のグループが1組しか存在しないグループ、及び1組も存在しないグループに含まれる画素を、ノイズとして日付印の一部を示す画素の候補から除外する。   The noise removing unit 223 excludes pixels indicating an element different from the date stamp among pixels whose gradient extracted by the gradient extracting unit 222 is equal to or greater than a threshold from the pixel candidates indicating a part of the date stamp as noise. To do. The noise removing unit 223 identifies pixels indicating elements different from the date stamp based on the features of the date stamp's external shape and dimensions in the image. For example, the noise removing unit 223 groups pixels having the gradient extracted by the gradient extracting unit 222 with a threshold value equal to or greater than a threshold for each of a plurality of adjacent pixels, and the vertical and horizontal dimensions are included in a group smaller than the threshold. Pixels are excluded from pixel candidates that show part of a date stamp as noise. In addition, for example, the noise removing unit 223 selects pixels included in a group in which two or more other groups whose distances are within a predetermined range from among groups whose vertical and horizontal dimensions are equal to or larger than a threshold value, Extracted as a pixel indicating a part. In other words, the noise removal unit 223 is included in a group in which only one set of other groups whose distances are within a predetermined range and a group in which no set exists, among the groups whose vertical and horizontal dimensions are equal to or greater than the threshold value. Are excluded from candidate pixels that indicate part of the date stamp as noise.

切出部224は、斜度抽出部222で抽出した斜度が閾値以上となる画素のうちのノイズ除去部223により除外されなかったグループに含まれる画素の画像内での位置に基づいて、画像内の日付印が押印された領域を切り出す。切出部224は、例えば、画像内におけるノイズ除去部223により除外されなかったグループの全てを内包する矩形の領域を、日付印が押印された領域に特定し、該領域を切り出す。   Based on the position in the image of the pixel included in the group that is not excluded by the noise removal unit 223 among the pixels whose gradient extracted by the gradient extraction unit 222 is greater than or equal to the threshold, the cutout unit 224 The area with the date stamp inside is cut out. For example, the cutout unit 224 identifies a rectangular region including all of the groups that are not excluded by the noise removal unit 223 in the image as a region where the date stamp is stamped, and cuts out the region.

補正部225は、切り出した領域内における日付印の画像水平方向に対する傾きが閾値以上である場合に、日付印の向きが正立となるよう切り出した領域を回転補正する。補正部225は、例えば、ハフ変換により、日付印における日付の上側に位置する第1の直線部及び日付の下側に位置する第2の直線部の画像水平方向に対する傾きを推定し、該傾きの推定結果に基づいて、日付印の向きが成立となるよう切り出した領域内の画素の位置(座標)を変換する。   The correction unit 225 rotationally corrects the cutout region so that the orientation of the date stamp is upright when the inclination of the date stamp in the cutout region with respect to the horizontal direction of the image is equal to or greater than the threshold. The correction unit 225 estimates, for example, the inclination of the first straight line portion located above the date and the second straight line portion located below the date in the date stamp with respect to the image horizontal direction by Hough transform, Based on the estimation result, the position (coordinates) of the pixel in the cut out region is converted so that the direction of the date stamp is established.

認識処理部230は、解析部220の解析結果に基づいて、帳票の画像から切り出した日付印が押印された領域に含まれる日付を、文字認識により認識する。認識処理部230は、例えば、サーバ装置6が保持する文字認識辞書610を参照して、日付印が押印された領域(部分画像)における第1の直線部と第2の直線部との間となる領域に並んでいる数字や記号を認識する。なお、認識処理部230が参照する文字認識辞書610は、例えば、画像処理装置2が備える記憶部(図示せず)に記憶させておいてもよい。   Based on the analysis result of the analysis unit 220, the recognition processing unit 230 recognizes the date included in the area where the date stamp cut out from the form image is stamped by character recognition. The recognition processing unit 230 refers to, for example, the character recognition dictionary 610 held by the server device 6, and between the first straight line part and the second straight line part in the region (partial image) where the date stamp is stamped. Recognize numbers and symbols lined up in the area. Note that the character recognition dictionary 610 referred to by the recognition processing unit 230 may be stored in, for example, a storage unit (not shown) included in the image processing apparatus 2.

表示制御部240は、表示装置5の表示を制御する。例えば、表示制御部240は、帳票の画像及び日付印の日付の認識結果を含む画面データを生成し、該画面データを表示装置5に表示させる。   The display control unit 240 controls the display of the display device 5. For example, the display control unit 240 generates screen data including a form image and a date recognition result of the date stamp, and causes the display device 5 to display the screen data.

主制御部250は、スキャナ制御部210、解析部220、認識処理部230、及び表示制御部240が協働して行う一連の処理を制御する。   The main control unit 250 controls a series of processing performed in cooperation by the scanner control unit 210, the analysis unit 220, the recognition processing unit 230, and the display control unit 240.

このように、本実施形態の画像処理装置2は、帳票の画像における画像水平方向及び画像垂直方向のそれぞれとのなす角と対応した斜度と日付印の外形及び寸法の特徴とに基づいて帳票の画像における日付印が押印された位置を特定する解析部220を備える。このため、本実施形態の画像処理装置2では、帳票に押印された日付印の位置によらず、日付印全体を含む領域を特定することが可能となる。また、本実施形態の画像処理装置2における解析部220は、更に、帳票の画像内における日付印の傾きを算出し(推定し)、日付印の向きが正立となるよう補正する。このため、本実施形態の画像処理装置2では、日付印に含まれる日付の向きが正立となった状態で文字認識を行うことが可能となる。   As described above, the image processing apparatus 2 according to the present embodiment is based on the characteristics of the inclination and the external shape and size of the date stamp corresponding to the angles formed by the horizontal and vertical directions of the image of the form. The analysis unit 220 for specifying the position where the date stamp in the image is stamped. For this reason, in the image processing apparatus 2 of this embodiment, it is possible to specify an area including the entire date stamp regardless of the position of the date stamp stamped on the form. In addition, the analysis unit 220 in the image processing apparatus 2 according to the present embodiment further calculates (estimates) the inclination of the date stamp in the image of the form, and corrects the date stamp to be erect. For this reason, in the image processing apparatus 2 according to the present embodiment, it is possible to perform character recognition in a state where the direction of the date included in the date stamp is upright.

図3は、一実施形態に係る画像処理を説明するフローチャートである。
本実施形態の画像処理装置2は、画像処理を開始すると、図3に示すように、まず、帳票の画像を取得する(ステップS1)。ステップS1の処理は、画像処理装置2のスキャナ制御部210が行う。スキャナ制御部210は、例えば、帳票のRGBカラー画像をスキャナ装置3から取得する。
FIG. 3 is a flowchart illustrating image processing according to an embodiment.
When image processing is started, the image processing apparatus 2 according to the present embodiment first acquires an image of a form as shown in FIG. 3 (step S1). The process of step S1 is performed by the scanner control unit 210 of the image processing apparatus 2. For example, the scanner control unit 210 acquires an RGB color image of a form from the scanner device 3.

次に、画像処理装置2は、取得した帳票の画像をグレースケールの画像に変換する(ステップS2)。ステップS2の処理は、画像処理装置2の解析部220における変換部221が行う。変換部221は、既知の変換方法に従って、RGBカラー画像を所定の階調のグレースケール画像に変換する。例えば、変換部221は、RGBカラー画像における各画素のRGB輝度値に基づいて、紙媒体である帳票における下地の濃度(階調)が、帳票における罫線、文字、日付印等の要素の濃度(階調)よりも高くなるよう、RGBカラー画像をグレースケール画像に変換する。なお、ステップS1で取得した帳票の画像がグレースケール画像、或いは二値化されたモノクロ画像である場合には、ステップS2の処理を省略してもよい。   Next, the image processing apparatus 2 converts the acquired form image into a grayscale image (step S2). The processing in step S2 is performed by the conversion unit 221 in the analysis unit 220 of the image processing apparatus 2. The conversion unit 221 converts the RGB color image into a grayscale image having a predetermined gradation according to a known conversion method. For example, based on the RGB luminance value of each pixel in the RGB color image, the conversion unit 221 converts the background density (gradation) in the form that is a paper medium into the density of elements such as ruled lines, characters, and date stamps in the form ( The RGB color image is converted into a gray scale image so as to be higher than (gradation). If the form image acquired in step S1 is a grayscale image or a binarized monochrome image, the process in step S2 may be omitted.

次に、画像処理装置2は、帳票の画像内における日付印の位置の特定に用いる情報を取得する処理として、斜度抽出処理(ステップS3)及びノイズ除去処理(ステップS4)を行う。斜度抽出処理及びノイズ除去処理は、画像内の要素における画像水平方向及び画像垂直方向のそれぞれとなす角が閾値以上となる部分を日付印の候補として抽出する処理の一例である。   Next, the image processing apparatus 2 performs an inclination extraction process (step S3) and a noise removal process (step S4) as a process for acquiring information used for specifying the position of the date stamp in the form image. The slope extraction process and the noise removal process are an example of a process of extracting a part of an element in an image where the angle between the image horizontal direction and the image vertical direction is greater than or equal to a threshold value as a date stamp candidate.

ステップS3の斜度抽出処理は、画像処理装置2の解析部220における斜度抽出部222が行う。斜度抽出部222は、画像内における線、文字、日付印等と対応する濃度が閾値以下の画素毎に、画像水平方向及び垂直方向のそれぞれとなす角と対応する斜度を算出し、算出した斜度が閾値以上となる画素を抽出する。ここで、斜度は、該斜度を算出する注目画素と隣接する画素の濃度と所定のフィルタとにより算出される値である。フィルタは、例えば、画像内で斜め方向に連続している複数の濃度が閾値以下である画素のいずれかを注目画素とした場合の斜度が、画像内で水平方向又は垂直方向に連続している複数の濃度が閾値以下である画素のいずれかを注目画素とした場合の斜度よりも大きな値となるように設定された係数の組である。   The gradient extraction process in step S3 is performed by the gradient extraction unit 222 in the analysis unit 220 of the image processing apparatus 2. The inclination extraction unit 222 calculates an inclination corresponding to an angle formed between the horizontal direction and the vertical direction of the image for each pixel whose density corresponding to a line, character, date stamp, or the like in the image is a threshold value or less. Pixels for which the slope is equal to or greater than the threshold are extracted. Here, the slope is a value calculated by the density of a pixel adjacent to the target pixel for calculating the slope and a predetermined filter. For example, in the filter, the slope when the pixel of interest is one of a plurality of pixels having a density equal to or less than a threshold value that is continuous in the oblique direction in the image is continuously horizontal or vertical in the image. This is a set of coefficients set so as to have a value larger than the inclination when any one of the plurality of pixels whose density is equal to or less than the threshold value is the target pixel.

ステップS4のノイズ除去処理は、画像処理装置2の解析部220におけるノイズ除去部223が行う。ノイズ除去部223は、ステップS3で抽出した斜度が閾値以上である画素に含まれる、画像内における日付印に含まれる要素以外の要素(罫線や文字等)と対応する画素を、ノイズとして日付印の要素を示す画素の候補から除外する。ノイズ除去部223は、例えば、斜度が閾値以上である画素をグループ化し、画像内における日付印の外形の形状及び寸法の特徴に基づいて設定した条件を満たしていないグループに含まれる画素を、日付印の要素を示す画素の候補から除外する。   The noise removal processing in step S4 is performed by the noise removal unit 223 in the analysis unit 220 of the image processing apparatus 2. The noise removing unit 223 uses pixels corresponding to elements (ruled lines, characters, etc.) other than the elements included in the date stamp in the image, which are included in the pixels whose gradient extracted in step S3 is equal to or greater than the threshold value, as noise. It excludes from the pixel candidate which shows the element of a mark. For example, the noise removing unit 223 groups pixels having an inclination equal to or greater than a threshold value, and includes pixels included in a group that does not satisfy the conditions set based on the shape and size characteristics of the date stamp in the image. It excludes from the pixel candidate which shows the element of a date stamp.

ステップS3及びS4の処理を終えると、画像処理装置2は、次に、日付印の位置を特定し、日付印が押印された領域を切り出す(ステップS5)。ステップS5の処理は、画像処理装置2の解析部220における切出部224が行う。切出部224は、ステップS3及びS4の処理により得られた、日付印の要素を示す画素の候補(グループ)の全てを内包する矩形領域を算出し、該矩形領域を帳票の画像から切り出す。   When the processing of steps S3 and S4 is completed, the image processing apparatus 2 next specifies the position of the date stamp and cuts out the area where the date stamp is stamped (step S5). The processing in step S5 is performed by the cutout unit 224 in the analysis unit 220 of the image processing apparatus 2. The cutout unit 224 calculates a rectangular area including all the candidate pixels (groups) indicating the date stamp elements obtained by the processes in steps S3 and S4, and cuts out the rectangular area from the form image.

ステップS5の処理を終えると、画像処理装置2は、次に、切り出した画像に含まれる日付印の向きが正立となるよう補正する正立補正処理(ステップS6)を行う。ステップS6の正立補正処理は、画像処理装置2の解析部220における補正部225が行う。補正部225は、切り出した画像における日付印の傾きを算出し、該傾きが閾値以上である場合には傾き角に応じた角度だけ、切り出した画像を回転させる。補正部225は、既知の方法に従って日付印の傾き角θを算出した後、既知の方法に従って画像を−θだけ回転させる。例えば、補正部225は、ハフ変換により、日付印における日付の上側に位置する第1の直線部及び日付の下側に位置する第2の直線部を抽出し、該直線部の水平方向からの傾き角θを算出する。その後、補正部225は、切り出した画像全体を−θだけ回転させる。これにより、切り出し画像内の日付印における日付の上側に位置する第1の直線部及び日付の下側に位置する第2の直線部の延伸方向が水平方向と略一致し、日付の向きが正立した状態となる。   When the process of step S5 is completed, the image processing apparatus 2 next performs an erecting correction process (step S6) for correcting the date mark included in the cut-out image to be erect. The upright correction process in step S6 is performed by the correction unit 225 in the analysis unit 220 of the image processing apparatus 2. The correction unit 225 calculates the inclination of the date stamp in the cut-out image, and rotates the cut-out image by an angle corresponding to the inclination angle when the inclination is equal to or greater than the threshold value. The correction unit 225 calculates the inclination angle θ of the date stamp according to a known method, and then rotates the image by −θ according to the known method. For example, the correction unit 225 extracts the first straight line portion located above the date and the second straight line portion located below the date in the date stamp by the Hough transform, and the straight line portion from the horizontal direction is extracted. The inclination angle θ is calculated. Thereafter, the correction unit 225 rotates the entire cut image by −θ. As a result, the extending direction of the first straight line portion located above the date and the second straight line portion located below the date in the date stamp in the cutout image substantially coincides with the horizontal direction, and the date direction is correct. It becomes a standing state.

次に、画像処理装置2は、文字認識により日付印に含まれる日付を認識する(ステップS7)。ステップS7の処理は、画像処理装置2の認識処理部230が行う。認識処理部230は、日付印の向きが正立した状態となっている画像内の日付を示す領域を抽出し、該領域に対する文字認識を行って、日付を認識する。認識処理部230は、例えば、ステップS6で抽出した日付の上側に位置する第1の直線部及び日付の下側に位置する第2の直線部と、日付印の輪郭を示す線とで囲まれた領域を、日付を示す領域として抽出する。また、認識処理部230は、既知の認識方法に従って、日付を示す領域内に並んでいる数字及び記号を認識する。この際、認識処理部230は、例えば、サーバ装置6の文字認識辞書610を参照して、日付を示す領域内に並んでいる数字及び記号を認識する。なお、認識処理部230が参照する文字認識辞書610は、画像処理装置2が備える記憶部(図示せず)に記憶させておいてもよい。   Next, the image processing apparatus 2 recognizes the date included in the date stamp by character recognition (step S7). The recognition processing unit 230 of the image processing apparatus 2 performs the process in step S7. The recognition processing unit 230 extracts a region indicating the date in the image in which the direction of the date mark is in an upright state, performs character recognition on the region, and recognizes the date. For example, the recognition processing unit 230 is surrounded by a first straight line portion located above the date extracted in step S6, a second straight line portion located below the date, and a line indicating the outline of the date stamp. This area is extracted as an area indicating the date. Further, the recognition processing unit 230 recognizes numbers and symbols arranged in the area indicating the date according to a known recognition method. At this time, the recognition processing unit 230 refers to, for example, the character recognition dictionary 610 of the server device 6 and recognizes numbers and symbols arranged in the area indicating the date. Note that the character recognition dictionary 610 referred to by the recognition processing unit 230 may be stored in a storage unit (not shown) provided in the image processing apparatus 2.

ステップS7の処理を終えると、画像処理装置2は、認識結果を出力し(ステップS8)、一連の画像処理を終了する。ステップS8の処理は、画像処理装置2の表示制御部240が行う。表示制御部240は、例えば、ステップS1で取得した帳票の画像、ステップS6で補正した日付印の画像、及び日付の認識結果を含む画面データを作成し、表示装置5に表示させる。   When the process of step S7 is completed, the image processing apparatus 2 outputs a recognition result (step S8), and ends a series of image processing. The display control unit 240 of the image processing apparatus 2 performs the process in step S8. For example, the display control unit 240 creates screen data including the form image acquired in step S1, the date stamp image corrected in step S6, and the date recognition result, and causes the display device 5 to display the screen data.

このように、本実施形態に係る画像処理装置2は、斜度抽出処理及びノイズ除去処理を行って、画像内の日付印における画像水平方向及び画像垂直方向のそれぞれとなす角が閾値以上となる部分を抽出する。   As described above, the image processing apparatus 2 according to the present embodiment performs the gradient extraction process and the noise removal process, and the angle formed between the image horizontal direction and the image vertical direction in the date stamp in the image is greater than or equal to the threshold value. Extract the part.

図4は、斜度抽出処理の内容を説明するフローチャートである。
上記のように、斜度抽出処理(ステップS3)は、画像処理装置2の解析部220における斜度抽出部222が行う。斜度抽出部222は、斜度抽出処理として、図4に示したようなループ処理(ステップS301〜S306)を行う。ループ処理は、帳票の画像における画素毎に行われる。
FIG. 4 is a flowchart for explaining the content of the gradient extraction process.
As described above, the gradient extraction process (step S3) is performed by the gradient extraction unit 222 in the analysis unit 220 of the image processing apparatus 2. The gradient extraction unit 222 performs loop processing (steps S301 to S306) as shown in FIG. 4 as the gradient extraction processing. The loop processing is performed for each pixel in the form image.

ループ処理の開始端(ステップS301)では、斜度抽出部222は、画像内の画素のなかから処理の対象とする画素を選択する。例えば、斜度抽出部222は、ラスタスキャンにより処理の対象とする画素を選択する。一方、ループ処理の終了端(ステップS306)では、斜度抽出部222は、帳票の画像における全ての画素で処理を行ったか否かを判定する。処理を行っていない画素がある場合、斜度抽出部222は、ループ処理(ステップS301〜S306)を継続する。全ての画素で処理を行った場合、斜度抽出部222は、ループ処理(ステップS301〜S306)を終了し、斜度抽出処理を終了する。   At the start of the loop processing (step S301), the gradient extraction unit 222 selects a pixel to be processed from among pixels in the image. For example, the gradient extraction unit 222 selects pixels to be processed by raster scanning. On the other hand, at the end of the loop processing (step S306), the gradient extraction unit 222 determines whether or not processing has been performed on all the pixels in the form image. If there is a pixel that has not been processed, the gradient extraction unit 222 continues the loop processing (steps S301 to S306). When processing is performed for all pixels, the gradient extraction unit 222 ends the loop processing (steps S301 to S306) and ends the gradient extraction processing.

ステップS301で処理の対象とする画素を選択した後、斜度抽出部222は、選択した画素の濃度が閾値TH1以下であるか否かを判定する(ステップS302)。閾値TH1は、帳票のグレースケール画像における下地の濃度と、線、文字、日付印等の帳票の要素の濃度との間となる値に設定する。ステップS2において、帳票の画像を、帳票の下地の濃度が要素(線、文字、日付印等)の濃度よりも高いグレースケール画像に変換した場合、濃度が閾値TH1よりも高い画素は、帳票における下地を示す画素である。このため、選択した画素の濃度が閾値TH1よりも高い場合(ステップS302;YES)、斜度抽出部222は、ステップS303〜S305の処理を省略し、ループ処理の終了端(ステップS306)においてループ処理を継続するか否かを判定する。   After selecting the pixel to be processed in step S301, the gradient extraction unit 222 determines whether or not the density of the selected pixel is equal to or lower than the threshold value TH1 (step S302). The threshold value TH1 is set to a value between the density of the background in the grayscale image of the form and the density of the form elements such as lines, characters, and date stamps. In step S2, when the form image is converted into a grayscale image in which the background density of the form is higher than the density of the elements (lines, characters, date stamps, etc.), pixels whose density is higher than the threshold TH1 This is a pixel indicating the background. For this reason, when the density of the selected pixel is higher than the threshold value TH1 (step S302; YES), the gradient extraction unit 222 omits the processes of steps S303 to S305, and loops at the end of the loop process (step S306). It is determined whether or not to continue the process.

一方、選択した画素の濃度が閾値TH1以下である画素は、帳票における線、文字、及び日付印等を含む帳票の要素を示す画素である。このため、選択した画素の濃度が閾値TH1以下である場合(ステップS302;YES)、斜度抽出部222は、次に、該当画素の周囲の画素の濃度とフィルタとに基づいて該当画素の斜度を算出する(ステップS303)。ステップS303において、斜度抽出部222は、例えば、下記数式(1)により、画素Pu,vの斜度Su,vを算出する。 On the other hand, a pixel whose density of the selected pixel is equal to or lower than the threshold value TH1 is a pixel indicating a form element including lines, characters, date stamps, and the like in the form. For this reason, when the density of the selected pixel is equal to or lower than the threshold value TH1 (step S302; YES), the gradient extraction unit 222 next calculates the slope of the corresponding pixel based on the density of the pixels around the corresponding pixel and the filter. The degree is calculated (step S303). In step S303, the gradient extraction unit 222 calculates the gradient S u, v of the pixel P u, v by the following mathematical formula (1), for example.

u,v=a1・Du-1,v-1+a2・Du,v-1+a3・Du+1,v-1
+a4・Du-1,v+a5・Du+1,v
+a6・Du-1,v+1+a7・Du,v+1+a8・Du+1,v+1 ・・・(1)
S u, v = a 1 · D u-1, v-1 + a 2 · D u, v-1 + a 3 · D u + 1, v-1
+ A4 · D u-1, v + a5 · D u + 1, v
+ A6.Du -1, v + 1 + a7.Du , v + 1 + a8.Du + 1, v + 1 (1)

なお、画素Pu,vは、帳票の画像における左上角部の画素を原点(u=0,v=0)とし、右方向を+u方向、下方向を+v方向としたときに座標(u,v)で指定される画素である。また、数式(1)におけるDu-1,v-1、Du,v-1、Du+1,v-1、Du-1,v、Du+1,v、Du-1,v+1、Du,v+1、及びDu+1,v+1は、それぞれ、画素Pu-1,v-1、Pu,v-1、Pu+1,v-1、Pu-1,v、Pu+1,v、Pu-1,v+1、Pu,v+1、及びPu+1,v+1の濃度である。また、数式(1)におけるa1〜a8は、それぞれ、フィルタ係数である。本実施形態では、フィルタ係数a1〜a8を、例えば、a1=a8=1、a2=a4=a5=a7=0、及びa3=a6=−1とする。 The pixel P u, v has coordinates (u, v when the pixel at the upper left corner in the image of the form is the origin (u = 0, v = 0), the right direction is + u direction, and the lower direction is + v direction. It is a pixel specified in v). Also, D u−1, v−1 , D u, v−1 , D u + 1, v−1 , D u−1, v , D u + 1, v , D u−1 in equation (1) , v + 1 , D u, v + 1 , and D u + 1, v + 1 are pixels P u−1, v−1 , P u, v−1 , P u + 1, v−1, respectively. , P u−1, v , P u + 1, v , P u−1, v + 1 , P u, v + 1 , and P u + 1, v + 1 . In addition, a1 to a8 in Expression (1) are filter coefficients, respectively. In this embodiment, the filter coefficients a1 to a8 are, for example, a1 = a8 = 1, a2 = a4 = a5 = a7 = 0, and a3 = a6 = -1.

選択した画素の斜度を算出すると、斜度抽出部222は、次に、算出した斜度の絶対値が閾値TH2以上であるか否かを判定する(ステップS304)。閾値TH2は、帳票の要素(線、文字、日付印等)における水平方向及び垂直方向に対して斜めに延伸する部分を示す画素の平均的な斜度と、水平方向及び垂直方向に延伸する部分を示す画素の平均的な斜度との間となる値に設定する。数式(1)により算出される斜度Su,vは、選択した画素Pu,vが帳票の要素(線、文字、日付印等)における水平方向及び垂直方向に対して斜めに延伸する部分を示す画素である場合の絶対値が、水平方向及び垂直方向に延伸する部分を示す画素である場合の絶対値よりも大きくなる。すなわち、算出した斜度の絶対値が閾値TH2よりも小さい画素は、帳票の要素(線、文字、日付印等)における水平方向及び垂直方向に延伸する部分を示す画素である。このため、斜度が閾値TH2よりも小さい場合(ステップS304;NO)、斜度抽出部222は、ステップS305の処理を省略し、ループ処理の終了端(ステップS306)においてループ処理を継続するか否かを判定する。すなわち、斜度抽出部222は、濃度が閾値TH1以下である帳票の要素を示す画素のうちの、帳票の要素(線、文字、日付印等)における水平方向及び垂直方向に延伸する部分を示す画素を、斜度を抽出する画素から除外する。 After calculating the slope of the selected pixel, the slope extraction unit 222 next determines whether or not the calculated absolute value of the slope is equal to or greater than the threshold value TH2 (step S304). The threshold value TH2 is an average inclination of a pixel indicating a portion extending obliquely with respect to the horizontal direction and the vertical direction in a form element (line, character, date stamp, etc.) and a portion extending in the horizontal direction and the vertical direction. Is set to a value between the average inclination of the pixels indicating The slope S u, v calculated by Equation (1) is a portion where the selected pixel P u, v extends obliquely with respect to the horizontal and vertical directions in the form elements (lines, characters, date stamps, etc.). The absolute value in the case of a pixel that indicates is larger than the absolute value in the case of a pixel that indicates a portion extending in the horizontal direction and the vertical direction. That is, the pixel whose absolute value of the calculated inclination is smaller than the threshold value TH2 is a pixel indicating a portion extending in the horizontal direction and the vertical direction in the form element (line, character, date stamp, etc.). Therefore, if the slope is smaller than the threshold value TH2 (step S304; NO), the slope extraction unit 222 omits the process of step S305 and continues the loop process at the end of the loop process (step S306). Determine whether or not. That is, the gradient extraction unit 222 indicates a portion extending in the horizontal direction and the vertical direction in the form elements (lines, characters, date stamps, etc.) among the pixels indicating the form elements whose density is equal to or less than the threshold value TH1. The pixel is excluded from the pixels from which the slope is extracted.

一方、斜度が閾値TH2以上である画素は、帳票の要素(線、文字、日付印等)における水平方向及び垂直方向に対して斜め方向に延伸する部分を示す画素である。このため、斜度の絶対値が閾値TH2以上である場合(ステップS304;YES)、斜度抽出部222は、該当画素の斜度を保持する(ステップS305)。この後、斜度抽出部222は、ループ処理の終了端(ステップS306)においてループ処理を継続するか否かを判定する。   On the other hand, a pixel whose slope is equal to or greater than the threshold TH2 is a pixel that indicates a portion extending in an oblique direction with respect to a horizontal direction and a vertical direction in a form element (line, character, date stamp, etc.). For this reason, when the absolute value of the gradient is equal to or greater than the threshold value TH2 (step S304; YES), the gradient extraction unit 222 holds the gradient of the corresponding pixel (step S305). Thereafter, the gradient extraction unit 222 determines whether or not to continue the loop processing at the end of the loop processing (step S306).

このように、斜度抽出処理では、帳票の画像における帳票の要素(線、文字、日付印等)のうちの水平方向及び垂直方向に対して斜め方向に延伸する部分を示す画素の斜度のみを抽出する。すなわち、斜度抽出処理を行うことにより、帳票の画像における帳票の要素(線、文字、日付印等)のうちの水平方向及び垂直方向に対して斜め方向に延伸する部分を示す画素が特定される。帳票の画像における罫線は、一般に、画像水平方向に延伸する直線及び画像垂直方向に延伸する直線である。これに対し、日付印は、後述するように、円形又は多角形の輪郭部を含み、画像水平方向及び画像垂直方向のそれぞれに対して斜め方向に延伸する部分が存在する。このため、斜度抽出処理を行うことにより、帳票の画像における日付印が押印された位置(領域)を絞り込むことが可能となる。   As described above, in the gradient extraction process, only the gradient of the pixel indicating the portion extending in the oblique direction with respect to the horizontal direction and the vertical direction among the elements (lines, characters, date stamps, etc.) of the form in the form image. To extract. That is, by performing the gradient extraction process, pixels indicating a portion extending in an oblique direction with respect to the horizontal direction and the vertical direction in the form elements (lines, characters, date stamps, etc.) in the form image are specified. The The ruled lines in the form image are generally a straight line extending in the horizontal direction of the image and a straight line extending in the vertical direction of the image. On the other hand, as will be described later, the date stamp includes a circular or polygonal outline, and there are portions extending in an oblique direction with respect to each of the image horizontal direction and the image vertical direction. For this reason, it is possible to narrow down the position (area) where the date stamp is stamped in the image of the form by performing the gradient extraction process.

なお、帳票には、枠線の角部が円弧状であったり、画像水平方向及び画像垂直方向のそれぞれに対して斜め方向に延伸する部分を含む文字が記載されていたりするものがある。この種の帳票に対して斜度抽出処理を行うと、円弧状の角部を示す画素や文字の一部を示す画素の斜度が閾値TH2以上となり、該当画素の斜度が抽出される。このため、本実施形態に係る画像処理では、斜度抽出処理の後、ノイズ除去処理(ステップS4)を行い、斜度を抽出した画素のうちの、日付印の外形の形状及び寸法の特徴を示す条件を満たさない画素を、ノイズとして日付印を示す画像の候補から除外する。   In some forms, corners of the frame line are arc-shaped, or characters including a portion extending in an oblique direction with respect to each of the image horizontal direction and the image vertical direction are described. When the gradient extraction process is performed on this type of form, the gradient of the pixel indicating the arcuate corner or the pixel indicating a part of the character is equal to or greater than the threshold value TH2, and the gradient of the corresponding pixel is extracted. For this reason, in the image processing according to the present embodiment, after the gradient extraction process, the noise removal process (step S4) is performed, and the shape and size characteristics of the date stamp outline of the pixels from which the gradient is extracted are obtained. Pixels that do not satisfy the conditions shown are excluded from image candidates that show date stamps as noise.

図5は、ノイズ除去処理の内容を説明するフローチャートである。図6は、グループ化処理の内容を説明するフローチャートである。   FIG. 5 is a flowchart for explaining the contents of the noise removal processing. FIG. 6 is a flowchart for explaining the contents of the grouping process.

上記のように、ノイズ除去処理(ステップS4)は、画像処理装置2の解析部220におけるノイズ除去部223が行う。ノイズ除去部223は、ノイズ除去処理として、図5のフローチャートに沿った処理を行う。   As described above, the noise removal processing (step S4) is performed by the noise removal unit 223 in the analysis unit 220 of the image processing apparatus 2. The noise removal unit 223 performs processing according to the flowchart of FIG. 5 as noise removal processing.

ノイズ除去部223は、まず、斜度抽出処理において斜度を抽出した画素をグループ化するグループ化処理(ステップS401)を行う。ノイズ除去部223は、グループ化処理として、例えば、図6のフローチャートに沿った処理を行う。   First, the noise removing unit 223 performs a grouping process (step S401) for grouping pixels from which the slope has been extracted in the slope extraction process. For example, the noise removing unit 223 performs processing according to the flowchart of FIG. 6 as the grouping processing.

グループ化処理において、ノイズ除去部223は、まず、画素に付与するグループ番号GNを初期化する(ステップS401a)。ステップS401aでは、ノイズ除去部223は、GN=1とする。   In the grouping process, the noise removal unit 223 first initializes the group number GN to be assigned to the pixel (step S401a). In step S401a, the noise removing unit 223 sets GN = 1.

次に、ノイズ除去部223は、ループ処理(ステップS401b〜S401j)を行う。ループ処理は、帳票の画像における画素毎に行われる。   Next, the noise removal unit 223 performs a loop process (Steps S401b to S401j). The loop processing is performed for each pixel in the form image.

ループ処理の開始端(ステップS401b)では、ノイズ除去部223は、画像内の画素のなかから処理の対象とする画素を選択する。例えば、ノイズ除去部223は、ラスタスキャンにより処理の対象とする画素を選択する。一方、ループ処理の終了端(ステップS401j)では、ノイズ除去部223は、帳票の画像における全ての画素で処理を行ったか否かを判定する。処理を行っていない画素がある場合、ノイズ除去部223は、ループ処理(ステップS401b〜S401j)を継続する。全ての画素で処理を行った場合、ノイズ除去部223は、ループ処理(ステップS401b〜S401j)を終了し、グループ番号を更新する処理(ステップS401k)を行う。   At the start end of the loop processing (step S401b), the noise removal unit 223 selects a pixel to be processed from among the pixels in the image. For example, the noise removal unit 223 selects a pixel to be processed by raster scanning. On the other hand, at the end of the loop processing (step S401j), the noise removing unit 223 determines whether or not processing has been performed on all pixels in the form image. If there is a pixel that has not been processed, the noise removing unit 223 continues the loop processing (steps S401b to S401j). When the process is performed on all the pixels, the noise removing unit 223 ends the loop process (Steps S401b to S401j) and performs a process of updating the group number (Step S401k).

ステップS401bで処理の対象とする画素を選択した後、ノイズ除去部223は、該当画素の斜度を保持しているか否かを判定する(ステップS401c)。該当斜度を保持していない場合(ステップS401c;NO)、ノイズ除去部223は、ステップS401d以降の処理を省略し、ループ処理の終了端(ステップS401j)においてループ処理を継続するか否かを判定する。   After selecting a pixel to be processed in step S401b, the noise removal unit 223 determines whether or not the inclination of the pixel is held (step S401c). When the corresponding inclination is not held (step S401c; NO), the noise removing unit 223 omits the processing after step S401d and determines whether or not to continue the loop processing at the end of the loop processing (step S401j). judge.

一方、該当画素の斜度を保持している場合(ステップS401c;YES)、ノイズ除去部223は、次に、該当画素の左上、上、右上、及び左の画素にグループ番号が振られているか否かを判定する(ステップS401d)。該当画素の左上、上、右上、及び左の画素のなかにグループ番号が振られていない画素がある場合(ステップS401d;NO)、ノイズ除去部223は、該当画素(ステップS401bで選択した画素)にグループ番号GNを割り振る(ステップS401h)。ステップS401hの処理の後、ノイズ除去部223は、グループ番号GNをGN+1に更新し(ステップS401i)、ループ処理の終了端(ステップS401j)においてループ処理を継続するか否かを判定する。   On the other hand, when the inclination of the corresponding pixel is held (step S401c; YES), the noise removal unit 223 next assigns group numbers to the upper left, upper, upper right, and left pixels of the corresponding pixel. It is determined whether or not (step S401d). When there is a pixel that is not assigned a group number among the upper left, upper, upper right, and left pixels of the corresponding pixel (step S401d; NO), the noise removal unit 223 determines that the corresponding pixel (the pixel selected in step S401b) Is assigned a group number GN (step S401h). After the process of step S401h, the noise removing unit 223 updates the group number GN to GN + 1 (step S401i), and determines whether or not to continue the loop process at the end of the loop process (step S401j).

これに対し、該当画素の左上、上、右上、及び左の画素の全てにグループ番号が振られている場合(ステップS401d;YES)、ノイズ除去部223は、次に、各画素に振られたグループ番号のうちの最小の番号を該当画素(ステップS401bで選択した画素)に割り振る(ステップS401e)。   On the other hand, when the group number is assigned to all of the upper left, upper, upper right, and left pixels of the corresponding pixel (step S401d; YES), the noise removing unit 223 is then assigned to each pixel. The smallest group number is assigned to the corresponding pixel (the pixel selected in step S401b) (step S401e).

ステップS401eの処理を終えると、ノイズ除去部223は、次に、該当画素の左上、上、右上、及び左の画素のグループ番号が全て同じであるか否かを判定する(ステップS401f)。グループ番号が全て同じである場合(ステップS401d;YES)、ノイズ除去部223は、ステップS401gの処理を省略し、ループ処理の終了端(ステップS401j)においてループ処理を継続するか否かを判定する。   When the process of step S401e is completed, the noise removing unit 223 next determines whether or not the group numbers of the upper left, upper, upper right, and left pixels of the corresponding pixel are all the same (step S401f). When all the group numbers are the same (step S401d; YES), the noise removing unit 223 omits the process of step S401g and determines whether to continue the loop process at the end of the loop process (step S401j). .

一方、該当画素の左上、上、右上、及び左の画素に振られたグループ番号が2通り以上である場合(ステップS401f;NO)、ノイズ除去部223は、左上、上、右上、及び左の画素に振られたグループ番号のうちの最小のグループ番号を置換テーブルに登録する(ステップS401g)。ステップS401gの処理において、ノイズ除去部223は、左上、上、右上、及び左の画素に振られた2通り以上のグループ番号のうちの、最小ではないグループ番号と、最小のグループ番号とを対応付ける。ステップS401gの処理を終えると、ノイズ除去部223は、ループ処理の終了端(ステップS401j)においてループ処理を継続するか否かを判定する。ループ処理を継続する場合、ノイズ除去部223は、ループ処理の開始端(ステップS401b)において、次のループ処理の対象とする画素を選択する。そして、全ての画素に対してループ処理を行うと、ノイズ除去部223は、ループ処理を終了し、次に、置換テーブルに基づいてグループ番号を更新する(ステップS401k)。ステップS401kの処理では、ノイズ除去部223は、置換テーブルを参照し、画素に振られたグループ番号のうちの、ステップS401gの処理により最小のグループ番号が対応付けられた画素のグループ番号を、該最小のグループ番号に置き換える。例えば、置換テーブルにおいて、グループ番号「3」が割り振られた画素に、最小のグループ番号「1」が対応付けられている場合、ノイズ除去部223は、該当画素のグループ番号を「3」から「1」に更新する。   On the other hand, when there are two or more group numbers assigned to the upper left, upper, upper right, and left pixels of the corresponding pixel (step S401f; NO), the noise removing unit 223 performs the upper left, upper, upper right, and left The smallest group number among the group numbers assigned to the pixels is registered in the replacement table (step S401g). In the process of step S401g, the noise removing unit 223 associates a non-minimum group number and a minimum group number among two or more group numbers assigned to the upper left, upper, upper right, and left pixels. . When the process of step S401g is completed, the noise removing unit 223 determines whether or not to continue the loop process at the end of the loop process (step S401j). When continuing the loop processing, the noise removing unit 223 selects a pixel to be subjected to the next loop processing at the start end of the loop processing (step S401b). When the loop processing is performed on all the pixels, the noise removing unit 223 ends the loop processing, and then updates the group number based on the replacement table (step S401k). In the process of step S401k, the noise removing unit 223 refers to the replacement table, and among the group numbers assigned to the pixels, the group number of the pixel associated with the minimum group number by the process of step S401g is Replace with the lowest group number. For example, in the replacement table, when the minimum group number “1” is associated with the pixel assigned with the group number “3”, the noise removing unit 223 changes the group number of the corresponding pixel from “3” to “3”. Update to “1”.

ステップS401kの処理を終えると、ノイズ除去部223は、グループ化処理を終了する。すなわち、ステップS401kの処理を終えると、ノイズ除去部223は、図5のグループ化処理(ステップS401)を終了し、次に、第1のループ処理(ステップS402〜S405)を行う。第1のループ処理は、グループ化処理により決定したグループ毎に行われる。   When the process of step S401k is completed, the noise removing unit 223 ends the grouping process. That is, when the process of step S401k is completed, the noise removing unit 223 ends the grouping process (step S401) of FIG. 5, and then performs a first loop process (steps S402 to S405). The first loop process is performed for each group determined by the grouping process.

第1のループ処理の開始端(ステップS402)では、ノイズ除去部223は、グループ化処理により決定したグループのなかから処理の対象とするグループを選択する。例えば、図6のグループ化処理のようにグループ番号が1以上の整数となる場合、ノイズ除去部223は、グループ番号が小さいグループから順に選択する。一方、第1のループ処理の終了端(ステップS405)では、ノイズ除去部223は、全てのグループで処理を行ったか否かを判定する。処理を行っていないグループがある場合、ノイズ除去部223は、第1のループ処理(ステップS402〜S405)を継続する。全てのグループで処理を行った場合、ノイズ除去部223は、第1のループ処理(ステップS402〜S405)を終了し、第2のループ処理(ステップS406〜S409)を行う。   At the start end of the first loop process (step S402), the noise removing unit 223 selects a group to be processed from the groups determined by the grouping process. For example, when the group number is an integer equal to or greater than 1 as in the grouping process of FIG. 6, the noise removal unit 223 selects in order from the group with the smallest group number. On the other hand, at the end of the first loop processing (step S405), the noise removal unit 223 determines whether or not processing has been performed for all groups. If there is a group that has not been processed, the noise removal unit 223 continues the first loop processing (steps S402 to S405). When the process is performed for all the groups, the noise removing unit 223 ends the first loop process (Steps S402 to S405) and performs the second loop process (Steps S406 to S409).

ステップS402で処理の対象とするグループを選択した後、ノイズ除去部223は、該当グループの縦横の長さが閾値TH3以上であるか否かを判定する(ステップS403)。閾値TH3は、帳票の画像における各種日付印の輪郭部分を示す画素のうちの、グループ化処理(ステップS401)において1つのグループにグループ化される複数の画素の分布に基づいて、該当グループの縦横の長さよりも小さい値に設定される。また、閾値TH3は、上述した帳票の枠線における円弧状の角部や、文字における斜め方向に延伸する部分の縦横の長さとして考えられる値よりも大きい値に設定する。すなわち、縦横の長さが閾値TH3よりも短いグループに含まれる画素は、日付印の要素(輪郭や日付の上下に位置する直線部分)を示す画素ではない可能性が非常に高い。このため、該当グループの縦横の長さが閾値TH3よりも短い場合(ステップS403;NO)、ノイズ除去部223は、該当グループを無効なグループとして日付印の要素を示すグループの候補から除外する(ステップS404)。すなわち、ステップS404において、ノイズ除去部223は、斜め方向に延伸する部分の縦横の長さが閾値TH3よりも短いグループに含まれる画素を、ノイズとして、日付印の要素を示す画素の候補から除去する。ステップS404の処理を終えると、ノイズ除去部223は、第1のループ処理の終了端(ステップS405)において第1のループ処理を継続するか否かを判定する。   After selecting the group to be processed in step S402, the noise removal unit 223 determines whether the vertical and horizontal lengths of the group are equal to or greater than the threshold value TH3 (step S403). The threshold value TH3 is based on the distribution of a plurality of pixels grouped into one group in the grouping process (step S401) among the pixels indicating the outline portions of various date stamps in the form image. It is set to a value smaller than the length of. Further, the threshold value TH3 is set to a value larger than a value that can be considered as the length in the vertical and horizontal directions of the arcuate corners of the above-described form frame line and the diagonally extending portion of the characters. That is, it is very likely that a pixel included in a group whose vertical and horizontal lengths are shorter than the threshold value TH3 is not a pixel indicating a date stamp element (an outline or a linear portion positioned above and below the date). For this reason, when the vertical and horizontal lengths of the corresponding group are shorter than the threshold value TH3 (step S403; NO), the noise removal unit 223 excludes the corresponding group from the group candidates indicating date stamp elements as invalid groups ( Step S404). That is, in step S404, the noise removing unit 223 removes, as noise, pixels included in the group whose length and width of the portion extending in the oblique direction are shorter than the threshold value TH3 from the candidate pixels indicating the date stamp element. To do. When the process of step S404 is completed, the noise removing unit 223 determines whether or not to continue the first loop process at the end of the first loop process (step S405).

一方、該当グループの縦横の長さが閾値TH3以上である場合(ステップS403;YES)、ノイズ除去部223は、ステップS404の処理を省略し、第1のループ処理の終了端(ステップS405)において第1のループ処理を継続するか否かを判定する。   On the other hand, when the vertical and horizontal lengths of the group are greater than or equal to the threshold value TH3 (step S403; YES), the noise removing unit 223 omits the process of step S404 and at the end of the first loop process (step S405). It is determined whether or not to continue the first loop process.

第1のループ処理を行っていないグループがある場合、ノイズ除去部223は、第1のループ処理(ステップS402〜S405)を継続する。全てのグループで処理を行った場合、ノイズ除去部223は、第1のループ処理(ステップS402〜S405)を終了し、第2のループ処理(ステップS406〜S409)を行う。第2のループ処理は、グループ化処理により決定され、かつ第1のループ処理において除外(除去)されなかったグループ毎に行われる。   When there is a group that is not performing the first loop process, the noise removing unit 223 continues the first loop process (steps S402 to S405). When the process is performed for all the groups, the noise removing unit 223 ends the first loop process (Steps S402 to S405) and performs the second loop process (Steps S406 to S409). The second loop process is performed for each group determined by the grouping process and not excluded (removed) in the first loop process.

第2のループ処理の開始端(ステップS406)では、ノイズ除去部223は、第1のループ処理において除外されなかったグループ(有効なグループ)のなかから処理の対象とするグループを選択する。例えば、図6のグループ化処理のようにグループ番号が1以上の整数となる場合、ノイズ除去部223は、グループ番号が小さいグループから順に選択する。一方、第2のループ処理の終了端(ステップS409)では、ノイズ除去部223は、処理の対象となる全てのグループで処理を行ったか否かを判定する。処理を行っていないグループがある場合、ノイズ除去部223は、第2のループ処理(ステップS406〜S409)を継続する。全てのグループで処理を行った場合、ノイズ除去部223は、第2のループ処理(ステップS406〜S409)を終了し、ノイズ除去処理を終了する。   At the start end of the second loop process (step S406), the noise removal unit 223 selects a group to be processed from among the groups that are not excluded in the first loop process (effective groups). For example, when the group number is an integer equal to or greater than 1 as in the grouping process of FIG. 6, the noise removal unit 223 selects in order from the group with the smallest group number. On the other hand, at the end of the second loop processing (step S409), the noise removal unit 223 determines whether or not processing has been performed for all the groups to be processed. If there is a group that has not been processed, the noise removal unit 223 continues the second loop processing (steps S406 to S409). When the process is performed for all groups, the noise removal unit 223 ends the second loop process (steps S406 to S409) and ends the noise removal process.

ステップS406で処理の対象とするグループを選択した後、ノイズ除去部223は、該当グループの周囲に有効なグループが2組以上存在するか否かを判定する(ステップS407)。有効なグループは、グループ化処理により決定したグループのうちの、第1のループ処理において除外されなかったグループである。ステップS407の処理では、ノイズ除去部223は、例えば、現在処理の対象に選択されているグループにおける所定の位置を中心とする所定の範囲内(領域内)で有効なグループに含まれる画素の有無を探索し、一部又は全部が含まれる他の有効なグループが2組以上存在するか否かを判定する。このとき、有効なグループに含まれる画素の探索範囲は、例えば、帳票の画像における日付印の外形寸法の最大値よりもわずかに大きい範囲とする。   After selecting a group to be processed in step S406, the noise removal unit 223 determines whether there are two or more effective groups around the group (step S407). An effective group is a group that is not excluded in the first loop process among the groups determined by the grouping process. In the process of step S407, for example, the noise removing unit 223 determines whether or not there is a pixel included in an effective group within a predetermined range (within a region) centered on a predetermined position in the group currently selected for processing. And whether or not there are two or more other effective groups that partially or wholly are included is determined. At this time, the search range of the pixels included in the effective group is set to a range slightly larger than the maximum value of the outer dimensions of the date stamp in the form image, for example.

日付印の外形形状は円形や多角形であるものが多く、これらの日付印の輪郭は、上下対称、及び左右対称であり対称性が高い。このため、グループ化処理(ステップS401)では、日付印の輪郭を示す画素のグループが2組以上抽出され、日付印の輪郭を示す複数のグループ同士の距離は、日付印の外形寸法に応じた距離となる。従って、現在処理の対象として選択されているグループを中心とする所定の範囲内に他の有効なグループが1組しか存在しない、又は1組も存在しない場合、選択されているグループに含まれる画素は、日付印の要素以外の要素を示す画素である可能性が非常に高い。このため、現在処理の対象として選択されているグループの周囲に存在する有効なグループが1組であるか又は有効なグループが存在しない場合(ステップS407;NO)、ノイズ除去部223は、選択されているグループを無効なグループとして日付印の要素を示すグループの候補から除外する(ステップS408)。すなわち、ステップS408において、ノイズ除去部223は、周囲に他の有効なグループが2組以上存在していないグループに含まれる画素を、ノイズとして、日付印の要素を示す画素の候補から除去する。ステップS408の処理を終えると、ノイズ除去部223は、第2のループ処理の終了端(ステップS409)において第2のループ処理を継続するか否かを判定する。   Many of the outer shapes of date stamps are circular or polygonal, and the outlines of these date stamps are vertically symmetric and symmetric and have high symmetry. For this reason, in the grouping process (step S401), two or more groups of pixels indicating the outline of the date stamp are extracted, and the distance between the plurality of groups indicating the outline of the date stamp depends on the external dimensions of the date stamp. Distance. Therefore, if there is only one other effective group within the predetermined range centered on the group currently selected for processing, or if there is no other group, the pixels included in the selected group Is very likely to be a pixel indicating an element other than the date stamp element. For this reason, when the effective group which exists around the group currently selected as the object of processing is one set, or when there is no effective group (Step S407; NO), noise removal part 223 is selected. Are excluded from the group candidates indicating date stamp elements as invalid groups (step S408). That is, in step S408, the noise removing unit 223 removes, as noise, a pixel included in a group in which two or more other effective groups are not present from the candidate pixels indicating the date stamp element. When the process of step S408 is completed, the noise removing unit 223 determines whether or not to continue the second loop process at the end of the second loop process (step S409).

一方、周囲に他の有効なグループが2組以上存在している場合(ステップS407;YES)、ノイズ除去部223は、ステップS408の処理を省略し、第2のループ処理の終了端(ステップS409)において第2のループ処理を継続するか否かを判定する。   On the other hand, when two or more other effective groups exist in the surroundings (step S407; YES), the noise removing unit 223 omits the process of step S408 and ends the second loop process (step S409). ) To determine whether or not to continue the second loop process.

第2のループ処理を行っていないグループがある場合、ノイズ除去部223は、第2のループ処理(ステップS406〜S409)を継続する。全てのグループで処理を行った場合、ノイズ除去部223は、第2のループ処理(ステップS406〜S409)を終了し、ノイズ除去処理を終了する。   When there is a group that is not performing the second loop process, the noise removing unit 223 continues the second loop process (steps S406 to S409). When the process is performed for all groups, the noise removal unit 223 ends the second loop process (steps S406 to S409) and ends the noise removal process.

このように、本実施形態の画像処理装置2では、帳票の画像内における日付印の大部分は、輪郭部に画像水平方向及び画像垂直方向のそれぞれに対し斜め方向に延伸する部分が複数存在することを利用して、帳票の画像内における日付印の輪郭を示す画素を抽出する。また、本実施形態の画像処理装置2では、グレースケール画像における画素の濃度に基づいて算出した斜度を利用して、日付印の輪郭を示す画素を特定する。すなわち、本実施形態の画像処理装置2では、日付印の外形形状や色に基づくパターンマッチングとは異なる方法により、帳票の画像内における日付印の位置を特定する。このため、本実施形態の画像処理装置2では、輪郭が多角形(例えば、八角形)である日付印が押印された帳票の画像からも日付印の位置を容易に特定することが可能となる。また、本実施形態の画像処理装置2では、日付印の色によらず、日付印の位置を特定することが可能となる。更に、本実施形態の画像処理装置2では、日付印の位置が帳票上で指定されている領域からはみ出している場合のように日付印が押印された領域内に帳票の他の要素が存在する場合にも、日付印の位置を特定することが可能となる。よって、本実施形態の画像処理装置2では、オペレータによる操作を介さずに、自動的に帳票の画像から日付印の位置を特定することが可能となる。   As described above, in the image processing apparatus 2 of the present embodiment, most of the date stamps in the image of the form have a plurality of portions extending in an oblique direction with respect to the horizontal direction and the vertical direction of the image in the outline portion. By utilizing this, a pixel indicating the outline of the date stamp in the form image is extracted. Further, in the image processing apparatus 2 of the present embodiment, the pixel indicating the outline of the date stamp is specified using the slope calculated based on the density of the pixel in the grayscale image. That is, in the image processing apparatus 2 of the present embodiment, the position of the date stamp in the form image is specified by a method different from the pattern matching based on the outer shape and color of the date stamp. For this reason, in the image processing apparatus 2 of the present embodiment, the position of the date stamp can be easily specified from the image of the form on which the date stamp having a polygon (for example, an octagon) is imprinted. . Further, in the image processing apparatus 2 of the present embodiment, the position of the date stamp can be specified regardless of the color of the date stamp. Furthermore, in the image processing apparatus 2 according to the present embodiment, other elements of the form exist in the area where the date stamp is impressed, as in the case where the position of the date mark protrudes from the area designated on the form. Even in this case, the position of the date stamp can be specified. Therefore, in the image processing apparatus 2 according to the present embodiment, it is possible to automatically specify the position of the date stamp from the image of the form without the operation by the operator.

しかも、本実施形態の画像処理装置2が行う画像処理は、図3のフローチャートに示したように、帳票の画像における日付印の向きが正立となるよう補正する正立補正処理(ステップS6)を含む。   Moreover, the image processing performed by the image processing apparatus 2 according to the present embodiment is an erecting correction process (step S6) for correcting the direction of the date mark in the form image to be erect as shown in the flowchart of FIG. including.

図7は、正立補正処理の内容を説明するフローチャートである。
上記のように、正立補正処理(ステップS6)は、画像処理装置2の解析部220における補正部225が行う。補正部225は、正立補正処理として、図7のフローチャートに沿った処理を行う。
FIG. 7 is a flowchart for explaining the contents of the erecting correction process.
As described above, the upright correction process (step S6) is performed by the correction unit 225 in the analysis unit 220 of the image processing apparatus 2. The correction unit 225 performs processing according to the flowchart of FIG. 7 as the upright correction processing.

補正部225は、まず、帳票の画像から切り出した日付押印領域を二値化する(ステップS601)。日付押印領域は、図3のフローチャートにおけるステップS5の処理において、帳票の画像から切り出した日付印が押印された領域(部分画像)である。なお、日付押印領域を切り出す帳票の画像は、ステップS1で取得したカラー画像に限らず、ステップS2の変換処理により得たグレースケール画像であってもよい。ステップS601の処理では、補正部225は、日付押印領域内の画素のうちの下地(紙の色)を示す画素を「0」とし、帳票の要素(日付印、線、文字等)を示す画素を「1」とする。   First, the correction unit 225 binarizes the date stamp area cut out from the form image (step S601). The date stamp area is an area (partial image) in which the date stamp cut out from the form image is stamped in the process of step S5 in the flowchart of FIG. Note that the form image from which the date stamp area is cut out is not limited to the color image acquired in step S1, but may be a grayscale image obtained by the conversion process in step S2. In the processing of step S601, the correction unit 225 sets the pixel indicating the background (paper color) among the pixels in the date stamp area to “0”, and indicates the form element (date stamp, line, character, etc.) Is “1”.

次に、補正部225は、第1のループ処理(ステップS602〜S608)を行う。第1のループ処理は、日付押印領域内の画素毎に行われる。   Next, the correction unit 225 performs a first loop process (steps S602 to S608). The first loop process is performed for each pixel in the date stamp area.

第1のループ処理の開始端(ステップS602)では、補正部225は、日付押印領域内の画素のなかから処理の対象とする画素を選択する。例えば、補正部225は、ラスタスキャンにより処理の対象とする画素を選択する。一方、第1のループ処理の終了端(ステップS608)では、補正部225は、日付押印領域内の全ての画素で処理を行ったか否かを判定する。処理を行っていない画素がある場合、補正部225は、第1のループ処理(ステップS602〜S608)を継続する。全ての画素で処理を行った場合、補正部225は、第1のループ処理(ステップS602〜S608)を終了し、日付印の傾き角を算出して日付押印領域を回転させる処理(ステップS609〜S611)を行う。   At the start end of the first loop process (step S602), the correction unit 225 selects a pixel to be processed from among the pixels in the date stamp area. For example, the correction unit 225 selects a pixel to be processed by raster scanning. On the other hand, at the end of the first loop process (step S608), the correction unit 225 determines whether or not the process has been performed on all the pixels in the date stamp area. If there is a pixel that has not been processed, the correction unit 225 continues the first loop processing (steps S602 to S608). When processing has been performed for all pixels, the correction unit 225 ends the first loop processing (steps S602 to S608), calculates the inclination angle of the date stamp, and rotates the date stamp area (steps S609 to S609). S611) is performed.

ステップS602で処理の対象とする画素を選択した後、補正部225は、二値化する処理において該当画素に割り当てられた値が「0」であるか否かを判定する(ステップS603)。値が「0」である画素は、帳票の下地(紙の色)を示す画素である。このため、画素の値が「0」である場合(ステップS603;YES)、補正部225は、第2のループ処理(ステップS604〜S607)を省略し、第1のループ処理の終了端(ステップS608)において第1のループ処理を継続するか否かを判定する。   After selecting the pixel to be processed in step S602, the correction unit 225 determines whether or not the value assigned to the pixel in the binarization process is “0” (step S603). A pixel having a value of “0” is a pixel indicating the background (paper color) of the form. For this reason, when the value of the pixel is “0” (step S603; YES), the correction unit 225 omits the second loop processing (steps S604 to S607), and ends the first loop processing (step In S608), it is determined whether or not to continue the first loop process.

一方、画素の値が「0」以外である場合(ステップS603;NO)、補正部225は、次に、第2のループ処理(ステップS604〜S607)を行う。第2のループ処理は、0≦θ<2πの範囲内で選択された複数の角度θの組に含まれる角度θ毎に行われる。例えば、複数の角度θの組は、N通りの角度θ=(2π/100)・n{n=0,1,2,・・・,N−1}を含む。Nは任意の整数であり、例えば、N=100とする。 On the other hand, when the value of the pixel is other than “0” (step S603; NO), the correction unit 225 next performs a second loop process (steps S604 to S607). The second loop process is performed for each angle θ included in the set of a plurality of angles θ selected within the range of 0 ≦ θ <2π. For example, the set of a plurality of angles θ includes N kinds of angles θ n = (2π / 100) · n {n = 0, 1, 2,..., N−1}. N is an arbitrary integer, for example, N = 100.

第2のループ処理の開始端(ステップS604)では、補正部225は、上記の複数の角度θの組のなかから処理の対象とする角度θを選択する。例えば、補正部225は、値が小さい角度θから順に選択する。一方、第2のループ処理の終了端(ステップS607)では、補正部225は、全ての角度θで処理を行ったか否かを判定する。処理を行っていない角度θがある場合、補正部225は、第2のループ処理(ステップS604〜S607)を継続する。全ての角度θで処理を行った場合、補正部225は、第2のループ処理(ステップS604〜S607)を終了し、第1のループ処理の終了端(ステップS608)において第1のループ処理を継続するか否かを判定する。   At the start end of the second loop process (step S604), the correction unit 225 selects the angle θ to be processed from the set of the plurality of angles θ. For example, the correction unit 225 selects in order from the angle θ having the smallest value. On the other hand, at the end of the second loop process (step S607), the correction unit 225 determines whether or not the process has been performed at all angles θ. When there is an angle θ that has not been processed, the correction unit 225 continues the second loop processing (steps S604 to S607). When the processing is performed at all angles θ, the correction unit 225 ends the second loop processing (steps S604 to S607), and performs the first loop processing at the end of the first loop processing (step S608). Determine whether to continue.

ステップS604で処理の対象とする角度θを選択した後、補正部225は、現在処理の対象になっている画素の座標(x,y)に対するρ=x・cosθ+y・sinθを算出し(ステップS605)、θ-ρ座標系に(θ,ρ)をプロットする(ステップS606)。ステップS605及びS606の処理を終えると、補正部225は、第2のループ処理の終了端(ステップS607)において第2のループ処理を継続するか否かを判定する。ステップS605及びS606の処理を行っていない角度θがある場合、補正部225は、第2のループ処理を継続する。そして、全ての角度θでステップS605及びS606の処理を行うと、補正部225は、第2のループ処理を終了し、第1のループ処理の終了端(ステップS608)において第1のループ処理を継続するか否かを判定する。処理を行っていない画素がある場合、補正部225は、第1のループ処理(ステップS602〜S608)を継続する。全ての画素で処理を行った場合、補正部225は、第1のループ処理(ステップS602〜S608)を終了し、日付印の傾き角を算出して日付押印領域を回転させる処理(ステップS609〜S611)を行う。   After selecting the angle θ to be processed in step S604, the correction unit 225 calculates ρ = x · cos θ + y · sin θ with respect to the coordinates (x, y) of the pixel currently being processed (step S605). ), (Θ, ρ) is plotted in the θ-ρ coordinate system (step S606). When the processes of steps S605 and S606 are completed, the correction unit 225 determines whether or not to continue the second loop process at the end of the second loop process (step S607). If there is an angle θ for which the processes of steps S605 and S606 are not performed, the correction unit 225 continues the second loop process. When the processes of steps S605 and S606 are performed at all angles θ, the correction unit 225 ends the second loop process, and performs the first loop process at the end of the first loop process (step S608). Determine whether to continue. If there is a pixel that has not been processed, the correction unit 225 continues the first loop processing (steps S602 to S608). When processing has been performed for all pixels, the correction unit 225 ends the first loop processing (steps S602 to S608), calculates the inclination angle of the date stamp, and rotates the date stamp area (steps S609 to S609). S611) is performed.

第1のループ処理を終了すると、補正部225は、次に、第1のループ処理の結果に基づいて、θ-ρ座標系にプロットされた点(θ,ρ)のなかから、プロットされた頻度が高い順に点(θ1,ρ1)及び点(θ2,ρ2)を抽出する(ステップS609)。   When the first loop processing is finished, the correction unit 225 is then plotted from the points (θ, ρ) plotted in the θ-ρ coordinate system based on the result of the first loop processing. The point (θ1, ρ1) and the point (θ2, ρ2) are extracted in descending order of frequency (step S609).

次に、補正部225は、日付押印領域(部分画像)のx-y座標系においてρ1=x・cosθ1+y・sinθ1を満たす第1の直線上、及びρ2=x・cosθ2+y・sinθ2を満たす第2の直線上に、それぞれ、日付印における日付の上側に位置する第1の直線部、及び日付の下側に位置する第2の直線部があると認識する(ステップS610)。ステップS610において、補正部225は、例えば、第1の直線上に日付の上側に位置する第1の直線部があり、第2の直線上に日付の下側に位置する第2の直線部があると認識する。   Next, the correction unit 225 has a second straight line that satisfies ρ1 = x · cos θ1 + y · sin θ1 and ρ2 = x · cos θ2 + y · sin θ2 in the xy coordinate system of the date stamp area (partial image). It is recognized that there are a first straight line portion located above the date in the date stamp and a second straight line portion located below the date on the straight line (step S610). In step S610, the correction unit 225 includes, for example, a first straight line portion located above the date on the first straight line, and a second straight line portion located below the date on the second straight line. Recognize that there is.

次に、補正部225は、第1の直線部及び第2の直線部が画像内で水平となるよう、帳票の画像から切り出した日付押印領域全体を回転させる(ステップS611)。ステップS611の処理では、補正部225は、例えば、上記の角度θ1及びθ2の平均値θ=(θ1+θ2)/2を算出し、日付押印領域全体を角度−θだけ回転させる。ステップS611の処理を終えると、補正部225は、正立補正処理を終了する。   Next, the correction unit 225 rotates the entire date stamp area cut out from the form image so that the first straight line portion and the second straight line portion are horizontal in the image (step S611). In the process of step S611, for example, the correction unit 225 calculates the average value θ = (θ1 + θ2) / 2 of the angles θ1 and θ2, and rotates the entire date stamp area by the angle −θ. When the process of step S611 is completed, the correction unit 225 ends the upright correction process.

このように、本実施形態の画像処理装置2では、帳票の画像における日付印の位置を特定した後、画像内水平方向に対する日付印における直線部の傾きを算出し、当該傾きに基づいて画像内の日付印が押印された領域を回転させる。このため、本実施形態の画像処理装置2では、帳票に押印された日付印の向きが正立となっていない場合にも、オペレータの操作を介することなく、自動的に、日付印の向きを正立となる向きに補正して日付を認識する処理を行うことが可能となる。   As described above, in the image processing apparatus 2 according to the present embodiment, after specifying the position of the date stamp in the image of the form, the inclination of the straight line portion of the date stamp with respect to the horizontal direction in the image is calculated, and the inside of the image is based on the inclination. Rotate the area marked with the date stamp. For this reason, in the image processing apparatus 2 of the present embodiment, even when the orientation of the date stamp impressed on the form is not upright, the orientation of the date stamp is automatically changed without the operator's operation. It is possible to perform a process of recognizing the date by correcting it in an upright direction.

図8は、帳票の例を示す図である。
図8には、帳票8の一例である電気料金振込通知票を示している。帳票8の上辺部には、帳票の種別を示す「電気料金振込通知票」等の文字列801が印刷されている。文字列801の下方には、お客様番号、適用期間、氏名等の顧客情報802が印刷されている。顧客情報802の下方には、お客様番号や振込金額等の情報を含む振込情報803が印刷されている。振込情報803の下方左側には、帳票8を発行した電力会社の情報804や、顧客に対するメッセージ805が印刷されている。また、振り込み情報803の下方右側には、振込手続を受け付けた日付を示す日付印を押印する領域を示す枠線806が印刷されている。
FIG. 8 is a diagram illustrating an example of a form.
FIG. 8 shows an electricity bill transfer notification form which is an example of the form 8. On the upper side of the form 8, a character string 801 such as “Electricity transfer notification form” indicating the type of the form is printed. Below the character string 801, customer information 802 such as a customer number, application period, and name is printed. Below the customer information 802, transfer information 803 including information such as a customer number and a transfer amount is printed. On the lower left side of the transfer information 803, information 804 of the power company that issued the form 8 and a message 805 to the customer are printed. Further, a frame line 806 indicating a region for imprinting a date stamp indicating a date when the transfer procedure is accepted is printed on the lower right side of the transfer information 803.

図8の帳票8を利用して電気料金の振込手続を行った場合、振込を受け付けた係員は、振込を受け付けた日付を示す日付印を帳票の枠線806で囲まれた領域内に押印する。本実施形態の画像処理装置2は、枠線806で囲まれた領域内に日付印が押印された帳票8の画像を取得し、日付印に含まれる日付を認識する。しかしながら、帳票8に日付印を押印する作業は係員が手作業で行っており、しかも、係員は印面が見えない状態で日付印を押印する。このため、帳票8に押印された日付印の向きや位置は、帳票毎に異なることが多い。   When the transfer procedure for the electricity bill is performed using the form 8 in FIG. 8, the clerk who has received the transfer stamps the date stamp indicating the date of the transfer in the area surrounded by the frame 806 of the form. . The image processing apparatus 2 according to the present embodiment acquires an image of the form 8 in which the date stamp is stamped in the area surrounded by the frame line 806, and recognizes the date included in the date stamp. However, the staff member performs the work of stamping the date stamp on the form 8 manually, and the staff member stamps the date stamp in a state where the stamp face cannot be seen. For this reason, the direction and position of the date stamp stamped on the form 8 are often different for each form.

図9は、帳票に押印された日付印の例を示す図である。図10は、帳票に押印された日付印の別の例を示す図である。   FIG. 9 is a diagram illustrating an example of a date stamp stamped on a form. FIG. 10 is a diagram showing another example of date stamps stamped on a form.

図9の(a)には、帳票8の枠線806で囲まれた領域内の適切な位置に適切な向きで押印された日付印9の例を示している。日付印9は、一般に、輪郭部901で囲まれた領域が上下方向に並ぶ2本の直線部902,903により3つの領域に分割されており、該3つの領域のうちの上下方向中央の領域に日付904が表示される。また、日付904の上側に位置する領域には項目名905が表示され、日付904の下側に位置する領域には振込を受け付けた金融機関名906が表示される。   FIG. 9A shows an example of the date stamp 9 stamped in an appropriate direction at an appropriate position in the area surrounded by the frame line 806 of the form 8. The date stamp 9 is generally divided into three regions by two linear portions 902 and 903 arranged in the vertical direction in the region surrounded by the contour portion 901, and the central region in the vertical direction of the three regions. The date 904 is displayed. Further, an item name 905 is displayed in the area above the date 904, and the name of the financial institution that accepted the transfer 906 is displayed in the area below the date 904.

帳票8は、図8に示した向きが正立である。このため、帳票8に押印された日付印9は、図9の(a)に示したように、日付の上側に位置する第1の直線部902及び下側に位置する第2の直線部903の延伸方向が帳票8の上辺(及び下辺)と平行になる向きが正立となる。このように、帳票8に押印された日付印9の向きが正立となっていれば、帳票8の画像から日付印9の日付904を文字認識する際に、正しく認識することが可能である。   The form 8 is upright in the direction shown in FIG. For this reason, as shown in FIG. 9A, the date stamp 9 stamped on the form 8 includes a first straight line portion 902 located above the date and a second straight line portion 903 located below. The direction in which the stretching direction is parallel to the upper side (and the lower side) of the form 8 is upright. Thus, if the direction of the date stamp 9 stamped on the form 8 is upright, it is possible to correctly recognize the date 904 of the date stamp 9 from the image of the form 8. .

図9の(b)には、押印した位置は適切だが向きが正立ではない日付印9の例を示している。係員が手作業で日付印9を押印する場合、押印する位置は目視により調整可能であるが、印面の傾きを目視により調整することは困難である。このため、係員が手作業で日付印9を押印した場合、図9の(b)に示すように、日付の上側及び下側に位置する直線部902,903の延伸方向が、帳票8の上辺(及び下辺)に対して斜めになる場合がある。このように日付印の向きが斜めになっても、帳票8の上辺(及び下辺)と、日付の上側及び下側に位置する直線部902,903の延伸方向とのなす角が小さい場合には、文字認識により日付904を正しく認識することが可能である。しかしながら、図9の(b)に示したように、帳票8の上辺(及び下辺)と、日付の上側及び下側に位置する直線部902,903の延伸方向とのなす角が大きくなると、文字認識により日付904を正しく認識することは困難となる。   FIG. 9B shows an example of the date stamp 9 in which the stamped position is appropriate but the orientation is not upright. When a staff member manually stamps the date stamp 9, the stamping position can be visually adjusted, but it is difficult to visually adjust the inclination of the stamp surface. For this reason, when the clerk manually stamps the date stamp 9, as shown in FIG. 9B, the extending direction of the straight portions 902 and 903 located above and below the date is (And the lower side) may be inclined. In this way, even when the direction of the date mark is slanted, if the angle formed by the upper side (and the lower side) of the form 8 and the extending direction of the linear portions 902 and 903 located above and below the date is small, The date 904 can be correctly recognized by character recognition. However, as shown in FIG. 9B, when the angle formed between the upper side (and the lower side) of the form 8 and the extending direction of the linear portions 902 and 903 located above and below the date is increased, It becomes difficult to recognize the date 904 correctly by recognition.

図9の(c)には、向きは正立だが押印する領域からはみ出している日付印9の例を示している。係員が手作業で日付印9を押印する場合、日付印9を押印する係員の癖や押印する際の状況(緊急性の有無等)等に応じて、押印する位置にずれ(ばらつき)が生じる。このため、例えば、図9の(c)に示すように、日付印9の一部分が枠線806で囲まれた領域外にはみ出してしまい、日付印9の輪郭部901で囲まれた領域内に、帳票8に印刷された枠線806の一部が含まれることがある。このような場合、例えば、帳票8の見出しや定義型に基づいて日付印9の位置を特定しようとすると、枠線806と日付印9の直線部902等が近接する或いは重なるため、位置の特定に失敗する。   FIG. 9C shows an example of the date mark 9 that is upright but protrudes from the area to be stamped. When the clerk stamps the date stamp 9 manually, a shift (variation) occurs in the stamping position depending on the clerk of the clerk who stamps the date stamp 9 or the situation (emergency or not) of the stamp. . For this reason, for example, as shown in FIG. 9C, a part of the date stamp 9 protrudes outside the area surrounded by the frame line 806, and within the area surrounded by the outline portion 901 of the date stamp 9. , A part of the frame line 806 printed on the form 8 may be included. In such a case, for example, when trying to specify the position of the date stamp 9 based on the heading or definition type of the form 8, the frame line 806 and the straight line portion 902 of the date stamp 9 are close to each other or overlap each other. Fail.

また、図10には、日付印9の別の例として、輪郭部911で囲まれた領域が八角形となる日付印9を示している。日付印9における輪郭部901,911で囲まれた領域は、上下方向の中央部に日付904が表示されており、日付の上側又は下側に押印した係員(金融機関)を識別可能な情報が表示されていればよい。このため、日付印9における輪郭部で囲まれた領域の形状や外形形状等には自由度がある。すなわち、日付印9の外形形状に多様性があるため、パターンマッチングにより帳票8の画像から日付印9の位置を特定する場合、多数のパターン(定義)を用意する必要がある。   FIG. 10 shows the date stamp 9 in which the area surrounded by the outline portion 911 is an octagon as another example of the date stamp 9. In the area surrounded by the outlines 901 and 911 in the date stamp 9, the date 904 is displayed at the center in the vertical direction, and there is information that can identify the clerk (financial institution) stamped above or below the date. It only has to be displayed. For this reason, there is a degree of freedom in the shape, outer shape, and the like of the region surrounded by the contour portion of the date stamp 9. That is, since the outer shape of the date stamp 9 is diverse, when the position of the date stamp 9 is specified from the image of the form 8 by pattern matching, it is necessary to prepare a large number of patterns (definitions).

このような実状を鑑み、本実施形態の画像処理装置2では、外形形状や色が異なる多種の日付印に共通する特徴、すなわち日付印9の輪郭部901,911には画像水平方向及び画像垂直方向に対して斜め方向に延伸する部分が複数存在することを利用して、帳票8の画像内の日付印9の位置を特定する。このため、本実施形態の画像処理装置2は、図3のフローチャートに示した斜度抽出処理(ステップS3)及びノイズ除去処理(ステップS4)を行う。   In view of such a situation, in the image processing apparatus 2 of the present embodiment, the features common to various date stamps having different outer shapes and colors, that is, the contour portions 901 and 911 of the date stamp 9 have an image horizontal direction and an image vertical direction. The position of the date stamp 9 in the image of the form 8 is specified by using a plurality of portions extending obliquely with respect to the direction. For this reason, the image processing apparatus 2 of the present embodiment performs the gradient extraction process (step S3) and the noise removal process (step S4) shown in the flowchart of FIG.

図11は、斜度の算出方法を説明する図である。図12は、斜度の算出結果を示す図である。   FIG. 11 is a diagram for explaining a method of calculating the inclination. FIG. 12 is a diagram illustrating the calculation result of the inclination.

図11には、日付印9が押印された帳票の画像10と、該帳票の画像10における2つの部分領域Q1,Q2を拡大した図と、フィルタ11とを示している。帳票の画像10における部分領域Q1は、帳票における画面垂直方向に延伸する直線(線分)1001と下地とを含む4画素×5画素の領域である。また、帳票の画像10における部分領域Q2は、日付印9の輪郭部901のうちの、右肩上がりの部分であって画面水平方向及び画面垂直方向のそれぞれに対して斜め方向に延伸している部分と、下地とを含む4画素×5画素の領域である。   FIG. 11 shows a form image 10 on which the date stamp 9 is stamped, an enlarged view of two partial areas Q1 and Q2 in the form image 10, and a filter 11. A partial area Q1 in the image 10 of the form is an area of 4 pixels × 5 pixels including a straight line (line segment) 1001 extending in the screen vertical direction of the form and the background. Further, the partial area Q2 in the image 10 of the form is an upwardly rising portion of the outline 901 of the date stamp 9 and extends obliquely with respect to each of the screen horizontal direction and the screen vertical direction. This is an area of 4 pixels × 5 pixels including a portion and a base.

拡大した部分領域Q1及びQ2のそれぞれにおける各マスに記載した数値は、それぞれ、グレースケール化した帳票の画像10における該当画素の濃度を示している。例えば、256階調のグレースケールに変換した帳票の画像10では、下地を示す画素の濃度は256に近い大きな値となり、帳票の要素(線、文字、日付印等)を示す画素の濃度は0に近い小さな値となる。   The numerical value described in each square in each of the enlarged partial areas Q1 and Q2 indicates the density of the corresponding pixel in the image 10 of the gray scaled form. For example, in the form image 10 converted to a gray scale of 256 gradations, the density of the pixels indicating the background is a large value close to 256, and the density of the pixels indicating the form elements (lines, characters, date stamps, etc.) is 0. A small value close to.

帳票の画像10に対し斜度抽出処理(ステップS3)を行う場合、画像処理装置2では、上記のように、画像10内の画素のうちの濃度が閾値TH1以上である画素は、斜度の算出を省略する(ステップS302;NO)。すなわち、部分領域Q1における左端の5個の画素及び右端の5個の画素、部分領域Q2における左上側の白い下地の画素及び右下側の白い下地の画素のそれぞれが処理の対象として選択されている場合、画像処理装置2は、斜度の算出を省略する。   When the gradient extraction process (step S3) is performed on the image 10 of the form, the image processing apparatus 2 has a gradient of pixels having a density equal to or higher than the threshold TH1 among the pixels in the image 10 as described above. Calculation is omitted (step S302; NO). That is, the leftmost five pixels and the rightmost five pixels in the partial region Q1, and the upper left white background pixel and the lower right white background pixel in the partial region Q2 are selected as processing targets, respectively. If so, the image processing apparatus 2 omits the calculation of the inclination.

また、黒い下地の画素のそれぞれが処理の対象として選択されている場合、画像処理装置2は、該当画素の周囲の隣接する8画素の濃度とフィルタ11とに基づいて、該当画素の斜度を算出する(ステップS303)。このとき、画像処理装置2は、上記のように、数式(1)により該当画素の斜度を算出する。例えば、図11の部分領域Q1における画素Pu1,v1(濃度10)の斜度Su1,v1は、下記数式(2)により算出する。 When each of the black background pixels is selected as a processing target, the image processing apparatus 2 determines the inclination of the corresponding pixel based on the density of the adjacent eight pixels around the corresponding pixel and the filter 11. Calculate (step S303). At this time, as described above, the image processing apparatus 2 calculates the inclination of the corresponding pixel according to Equation (1). For example, the slope S u1, v1 of the pixel P u1, v1 (density 10) in the partial region Q1 in FIG. 11 is calculated by the following equation (2).

u1,v1=a1・Du1-1,v1-1+a2・Du1,v1-1+a3・Du1+1,v1-1
+a4・Du1-1,v1+a5・Du1+1,v1
+a6・Du1-1,v1+1+a7・Du1,v1+1+a8・Du1+1,v1+1
=a1・240+a2・16+a3・28
+a4・250+a5・15
+a6・240+a7・17+a8・20 ・・・(2)
S u1, v1 = a1 · D u1-1, v1-1 + a2 · D u1, v1-1 + a3 · D u1 + 1, v1-1
+ A4・ D u1-1, v1 + a5 ・ D u1 + 1, v1
+ A6 · D u1-1, v1 + 1 + a7 · D u1, v1 + 1 + a8 · D u1 + 1, v1 + 1
= A1 ・ 240 + a2 ・ 16 + a3 ・ 28
+ A4 ・ 250 + a5 ・ 15
+ A6 · 240 + a7 · 17 + a8 · 20 (2)

数式(2)における係数a1〜a8は、それぞれ、フィルタ11により与えられる。図11のフィルタ11は、3×3の9マスのうちの中央のマスが現在処理対象となっている画素と対応している。すなわち、図11のフィルタ11は、画素Pu1,v1の左上の画素Pu1-1,v1-1に対する係数a1、及び画素Pu1,v1の右下の画素Pu1+1,v1+1に対する係数a8を「1」とすることを示している。同様に、図11のフィルタ11は、画素Pu1,v1の右上の画素Pu1-1,v1+1に対する係数a3、及び画素Pu1,v1の左下の画素Pu1-1,v1+1に対する係数a6を「−1」とすることを示している。更に、図11のフィルタ11は、画素Pu1,v1の上下左右の各画素Pu1,v1-1、Pu1,v+1、Pu-1,v1、及びPu1,v1+1に対する係数a2、a7、a4、及びa5を「0」とすることを示している。従って、数式(2)のa1〜a8にフィルタ11で指定された値を入れて計算をすると、図11の部分領域Q1における画素Pu1,v1(濃度10)の斜度Su1,v1は、図12に示したように「−8」となる。 The coefficients a1 to a8 in the formula (2) are respectively given by the filter 11. In the filter 11 of FIG. 11, the central square among the 3 × 3 nine squares corresponds to the pixel currently being processed. That is, the filter 11 of FIG. 11, the pixel P u1 + 1, v1 + 1 at the lower right of the pixel P u1, upper left pixel P U1-1 of v1, coefficients for V1-1 a1, and the pixel P u1, v1 The coefficient a8 is set to “1”. Similarly, the filter 11 of FIG. 11, the pixel P u1, v1 of the upper right pixel P U1-1, coefficients for v1 + 1 a3, and the pixel P u1, v1 lower left of the pixel P U1-1, for v1 + 1 The coefficient a6 is set to “−1”. Furthermore, the filter 11 in FIG. 11 is a coefficient for the pixels P u1, v1-1 , P u1, v + 1 , P u-1, v1 , and P u1, v1 + 1 of the upper, lower, left, and right pixels of the pixel P u1, v1. This indicates that a2, a7, a4, and a5 are set to “0”. Therefore, when the calculated taking the value specified by the filter 11 to a1~a8 formula (2), inclination S u1, v1 pixel P u1, v1 (concentration 10) in the partial area Q1 in Fig. 11, As shown in FIG. 12, “−8” is obtained.

また、例えば、図11の部分領域Q2における画素Pu2,v2(濃度20)の斜度Su2,v2は、図12に示したように「440」となる。 Further, for example, the slope S u2, v2 of the pixel P u2, v2 (density 20) in the partial region Q2 in FIG. 11 is “440” as shown in FIG.

更に、詳細な説明は省略するが、部分領域Q1及びQ2における他の黒い下地の画素についての斜度は、それぞれ、図12に示したような値となる。なお、図12の部分領域Q1及びQ2における「*」は、具体的な数値を省略する。   Further, although detailed description is omitted, the inclinations of the other black background pixels in the partial areas Q1 and Q2 are values as shown in FIG. It should be noted that “*” in the partial areas Q1 and Q2 in FIG.

また、図11及び図12の部分領域Q2は、日付印9の輪郭部901における右上がりの部分を示す画素を含む領域である。このため、部分領域Q2内の画素に対して図11のフィルタ11を適用して算出される斜度は、正の値となっている。これに対し、詳細な説明は省略するが、日付印9の輪郭部901における右下がりの部分を示す画素に対して図11のフィルタ11を適用して斜度を算出した場合には、負の値となる。このため、斜度を算出する処理(ステップS303)の後に行うステップS304の判定処理では、算出した斜度の絶対値が閾値TH2以上であるか否かを判定する。   Further, the partial region Q2 in FIGS. 11 and 12 is a region including a pixel indicating a portion that rises to the right in the contour portion 901 of the date stamp 9. For this reason, the inclination calculated by applying the filter 11 of FIG. 11 to the pixels in the partial region Q2 is a positive value. On the other hand, although detailed explanation is omitted, when the slope is calculated by applying the filter 11 of FIG. 11 to the pixel indicating the downward-sloping part in the contour portion 901 of the date stamp 9, a negative value is obtained. Value. Therefore, in the determination process of step S304 performed after the process of calculating the inclination (step S303), it is determined whether or not the absolute value of the calculated inclination is equal to or greater than the threshold value TH2.

このように、帳票の画像10における帳票の要素(線、文字、日付印9等)を示す画素の斜度を算出した場合、帳票の要素のうちの延伸方向が画像10における水平方向又は垂直方向と略平行な部分を示す画素の斜度は、帳票の要素のうちの延伸方向が水平方向及び垂直方向のそれぞれとなす角が閾値以上となる部分を示す画素の斜度との間には明確な差が生じる。このため、本実施形態の画像処理装置2が行う斜度抽出処理(ステップS3)では、斜度を算出した画素のうちの、斜度の値が閾値TH2以上である画素のみを抽出し、該画素の情報を保持する(ステップS305)。従って、斜度抽出処理による斜度の抽出結果は、例えば、図13の抽出結果13のようになる。   As described above, when the inclination of the pixel indicating the form element (line, character, date stamp 9 or the like) in the form image 10 is calculated, the extending direction of the form elements is the horizontal direction or the vertical direction in the image 10. The inclination of the pixel indicating the portion substantially parallel to the pixel is clearly between the inclination of the pixel indicating the portion of the form element in which the extending direction between the horizontal direction and the vertical direction is greater than or equal to the threshold value. There is a big difference. For this reason, in the gradient extraction process (step S3) performed by the image processing apparatus 2 of the present embodiment, only pixels whose gradient value is greater than or equal to the threshold value TH2 are extracted from the pixels for which the gradient is calculated. The pixel information is held (step S305). Therefore, the gradient extraction result by the gradient extraction process is, for example, the extraction result 13 in FIG.

図13は、斜度の抽出結果を示す図である。
図13の抽出結果13は、帳票の画像10における各画素のうちの斜度を保持している画素を黒色で示している。抽出結果13における右下角部に位置する4本の円弧状の曲線1301,1302,1303,及び1304は、それぞれ、日付印9の輪郭部901における斜度が閾値TH2以上となる画素の分布を示している。また、抽出結果13における右下角部に位置する2本の右上がりの直線1305及び1306は、それぞれ、日付印9の日付904の上側に位置する直線部902及び下側に位置する直線部903を示す画素の分布を示している(図11を参照)。
FIG. 13 is a diagram showing the result of the gradient extraction.
The extraction result 13 in FIG. 13 indicates in black the pixels that hold the inclination among the pixels in the form image 10. The four arc-shaped curves 1301, 1302, 1303, and 1304 located at the lower right corner in the extraction result 13 indicate the distribution of pixels in which the inclination in the contour portion 901 of the date stamp 9 is equal to or greater than the threshold value TH2. ing. In addition, two straight lines 1305 and 1306 that are located at the lower right corner in the extraction result 13 are a straight line portion 902 that is located above the date 904 of the date stamp 9 and a straight line portion 903 that is located below. The pixel distribution shown is shown (see FIG. 11).

また、抽出結果13における下辺部に位置する4本の円弧状の曲線1307、1308、1309、及び1310は、それぞれ、帳票8の下辺部に位置するメッセージ804(図8を参照)を囲む枠線における角部を示す画素の分布を示している。更に、抽出結果13における他の部分に位置する4本の円弧状の曲線1311,1312,1313,及び1314、並びに他の円弧状の曲線は、それぞれ、帳票8における他の要素(枠線及び文字)のうちの、斜度が閾値TH2以上となる画素の分布を示している。すなわち、ステップS3の斜度抽出処理を行った場合、図13の抽出結果13のように、日付印9の輪郭部901や直線部902,903とは別の帳票の要素における、延伸方向が画像水平方向及び画像垂直方向に対して斜め方向となる部分を示す画素の斜度も抽出される。このため、本実施形態の画像処理装置2が行う画像処理では、上記のように、斜度抽出処理の後にノイズ除去処理(ステップS4)を行い、日付印9の要素(輪郭部901や直線部902,903等)以外の要素を示す画素を除外する。ノイズ除去処理では、上記のように、まず、抽出結果13において斜度を保持している複数の画素を連続する画素毎のグループにグループ化するグループ化処理(ステップS401)を行う。ここで、グループ化処理の具体例として、図13の抽出結果13における領域1320内の画素に対するグループ化について、図14A及び図14Bを参照しながら説明する。   Further, the four arc-shaped curves 1307, 1308, 1309, and 1310 located at the lower side in the extraction result 13 are frame lines surrounding the message 804 (see FIG. 8) located at the lower side of the form 8, respectively. 2 shows the distribution of pixels indicating the corners in FIG. Further, the four arc-shaped curves 1311, 1312, 1313, and 1314 located in other parts of the extraction result 13 and the other arc-shaped curves are the other elements (frame line and character) in the form 8, respectively. ) In FIG. 6 shows a distribution of pixels having an inclination equal to or higher than a threshold value TH2. That is, when the gradient extraction process of step S3 is performed, the stretching direction in the form element different from the outline portion 901 and the straight line portions 902 and 903 of the date stamp 9 is the image as shown in the extraction result 13 of FIG. The inclination of the pixel indicating the portion that is oblique with respect to the horizontal direction and the image vertical direction is also extracted. For this reason, in the image processing performed by the image processing apparatus 2 of the present embodiment, as described above, the noise extraction processing (step S4) is performed after the gradient extraction processing, and the elements of the date stamp 9 (the contour portion 901 and the straight portion) are processed. Pixels indicating elements other than (902, 903, etc.) are excluded. In the noise removal process, as described above, first, a grouping process (step S401) is performed to group a plurality of pixels having the inclination in the extraction result 13 into groups for each successive pixel. Here, as a specific example of the grouping process, grouping for pixels in the region 1320 in the extraction result 13 of FIG. 13 will be described with reference to FIGS. 14A and 14B.

図14Aは、画素をグループ化する方法を説明する図(その1)である。図14Bは、画素をグループ化する方法を説明する図(その2)である。   FIG. 14A is a diagram (part 1) illustrating a method for grouping pixels. FIG. 14B is a diagram (part 2) illustrating a method for grouping pixels.

画像処理装置2は、グループ化処理として、例えば、図6のフローチャートに沿った処理を行う。このとき、画像処理装置2は、帳票の画像10における左上角部の画素から順にラスタスキャンをし、斜度を保持している画素にグループ番号を付与する。   For example, the image processing apparatus 2 performs processing according to the flowchart of FIG. 6 as the grouping processing. At this time, the image processing apparatus 2 performs raster scan in order from the pixel at the upper left corner in the image 10 of the form, and assigns a group number to the pixel holding the inclination.

図14Aの(a)には、帳票の画像10における図13の領域1320と対応する部分領域1320’内の画素Pu1,v1を処理の対象に選択した時点での、グループ番号の付与状況を示している。なお、図14Aの(a)では、白い下地のマスが斜度を保持している画素であり、網掛けを付したマスが斜度を保持していない画素である。処理の対象となる画素をラスタスキャンにより選択する場合、画素Pu1,v1の左側に位置する画素及び、画素Pu1,v1を含む画素列よりも上側の画素列に含まれる画素は、選択済みである。従って、画素Pu1,v1を選択した時点では、図14Aの(a)に示すように、画素Pu1,v1を含む画素列よりも上側の画素列に含まれる、斜度を保持している画素にはグループ番号が割り振られている。そして、画素Pu1,v1にグループ番号を割り振る際には、まず、画素Pu1,v1の左上、上、右上、及び左のいずれかにグループ番号が割り振られた画素が隣接しているか否かを判定する(ステップS401d)。図14Aの(a)に示した例では、画素Pu1,v1の左上の隣接する画素、及び右上の隣接する画素に、グループ番号が割り振られている。また、画素Pu1,v1の左上の隣接する画素のグループ番号は「1」であり、右上の隣接する画素のグループ番号は「3」である。このため、画像処理装置2は、図14Aの(b)に示すように、画素Pu1,v1に対し、最小のグループ番号である「1」を割り振る(ステップS401e)。 14A shows the group number assignment status at the time when the pixel Pu1, v1 in the partial area 1320 ′ corresponding to the area 1320 in FIG. 13 in the form image 10 is selected as a processing target. Show. In FIG. 14A (a), the white background square is a pixel holding the slope, and the shaded square is a pixel not holding the slope. When selecting that the pixel of the processing by the raster scan, and the pixel located on the left side of the pixel P u1, v1, the pixels included in the upper side of pixel columns than the pixel row including the pixel P u1, v1, selected It is. Therefore, when the pixel P u1, v1 is selected, as shown in FIG. 14A (a), the inclination included in the pixel column above the pixel column including the pixel P u1, v1 is maintained. A group number is assigned to each pixel. Then, in allocating a group number to the pixel P u1, v1, first, the upper left pixel P u1, v1, on, whether the upper right, and the pixel group number allocated to either the left adjacent Is determined (step S401d). In the example shown in (a) of FIG. 14A, group numbers are assigned to the upper left adjacent pixel and the upper right adjacent pixel of the pixel Pu1, v1 . Further, the group number of the upper left adjacent pixel of the pixel Pu1, v1 is “1”, and the group number of the upper right adjacent pixel is “3”. Therefore, the image processing apparatus 2 assigns “1”, which is the smallest group number, to the pixels Pu1, v1 as shown in FIG. 14A (b) (step S401e).

画素Pu1,v1に対してグループ番号を割り振った後、画像処理装置2は、画素Pu1,v1の左上の隣接する画素のグループ番号と、及び右上の隣接する画素のグループ番号とが同一であるか否かを判定する(ステップS401f)。図14Aの(b)に示した例では、2つの画素のグループ番号が異なる。このため、画像処理装置2は、図14Aの(c)に示すように、置換テーブル14に、グループ番号「3」に対する置換番号として「1」を登録する(ステップS401g)。 After assigning group numbers to the pixels P u1, v1 , the image processing apparatus 2 has the same group number for the upper left adjacent pixel of the pixel P u1, v1 and the group number of the upper right adjacent pixel. It is determined whether or not there is (step S401f). In the example shown in (b) of FIG. 14A, the group numbers of the two pixels are different. Therefore, the image processing apparatus 2 registers “1” as the replacement number for the group number “3” in the replacement table 14 as shown in FIG. 14A (c) (step S401g).

その後、詳細な説明は省略するが、グループ化処理におけるループ処理(図6のステップS401b〜S401j)が終了すると、図14Bの(d)に示すように、斜度を保持している全ての画素に対しグループ番号が割り振られる。ループ処理(図6のステップS401b〜S401j)を終了した後、画像処理装置2は、置換テーブル14に基づいて、画素に割り振ったグループ番号を更新する(ステップS401k)。置換テーブル14には、グループ番号「3」を「1」に置換する情報が含まれるため、画像処理装置1は、グループ番号が「3」である画素のグループ番号を「1」に更新する(図14Bの(e)を参照)。   After that, although detailed description is omitted, when the loop processing in the grouping processing (steps S401b to S401j in FIG. 6) is finished, as shown in FIG. Is assigned a group number. After completing the loop processing (steps S401b to S401j in FIG. 6), the image processing apparatus 2 updates the group number allocated to the pixel based on the replacement table 14 (step S401k). Since the replacement table 14 includes information for replacing the group number “3” with “1”, the image processing apparatus 1 updates the group number of the pixel with the group number “3” to “1” ( (See (e) of FIG. 14B).

斜度を保持している画素をグループ化するグループ化処理(ステップS401)を終了すると、画像処理装置2は、図5のフローチャートにおける第1のループ処理及び第2のループ処理を行って、グループ化処理により得られたグループのうちの、日付印の輪郭部が持つ条件を満たしていないグループを、日付印の輪郭部を示すグループの候補から除外する。   When the grouping process (step S401) for grouping pixels having the inclination is finished, the image processing apparatus 2 performs the first loop process and the second loop process in the flowchart of FIG. Among the groups obtained by the conversion process, a group that does not satisfy the condition of the outline part of the date stamp is excluded from the group candidates indicating the outline part of the date stamp.

図15は、ノイズの除去方法を説明する図である。
図15の(a)には、斜度の抽出結果13に基づいてグループ化処理を行った場合の処理結果15を示している。処理結果15における右下角部に位置する4本の円弧状の曲線1501,1502,1503,及び1504は、それぞれ、日付印9の輪郭部901における斜度が閾値TH2以上となる画素のグループを示している。また、処理結果15における右下角部に位置する2本の右上がりの直線1505及び1506は、それぞれ、日付印9の日付904の上側に位置する直線部902及び下側に位置する直線部903を示す画素のグループを示している(図11を参照)。
FIG. 15 is a diagram for explaining a noise removal method.
FIG. 15A shows a processing result 15 when the grouping process is performed based on the gradient extraction result 13. Four arc-shaped curves 1501, 1502, 1503, and 1504 located at the lower right corner in the processing result 15 indicate groups of pixels in which the inclination in the contour portion 901 of the date stamp 9 is equal to or greater than the threshold value TH2. ing. In addition, two straight lines 1505 and 1506 that are located at the lower right corner in the processing result 15 are a straight line portion 902 that is located above the date 904 of the date stamp 9 and a straight line portion 903 that is located below. The group of pixels shown is shown (see FIG. 11).

また、処理結果15における下辺部に位置する4本の円弧状の曲線1507、1508、1509、及び1510は、それぞれ、帳票8の下辺部に位置するメッセージ804(図8を参照)を囲む枠線における角部を示す画素のグループを示している。更に、処理結果15における他の部分に位置する4本の円弧状の曲線1511,1512,1513,及び1514、並びに他の円弧状の曲線は、それぞれ、帳票8における他の要素(枠線及び文字)のうちの、斜度が閾値TH2以上となる画素のグループを示している。このような処理結果15に対し第1のループ処理(図5のステップS402〜S405)を行うと、縦横の長さが閾値TH3よりも短いグループは、日付印の輪郭部を示すグループの候補から除外される。閾値TH3は、日付印の輪郭を示すグループにおける縦横の長さよりも短い値とする。このため、第1のループ処理を行うと、例えば、図15の(b)に示すように、帳票における枠線の角部を示す画素のグループ1511、1512、1513、及び1514が、日付印の輪郭を示すグループの候補から除外される。   In addition, the four arc-shaped curves 1507, 1508, 1509, and 1510 located at the lower side in the processing result 15 are frame lines surrounding the message 804 (see FIG. 8) located at the lower side of the form 8, respectively. The pixel group which shows the corner | angular part in is shown. Further, the four arc-shaped curves 1511, 1512, 1513, and 1514 located in other parts of the processing result 15 and the other arc-shaped curves are the other elements (frame line and character) in the form 8, respectively. ) Of the pixels having an inclination equal to or greater than the threshold value TH2. When the first loop process (steps S402 to S405 in FIG. 5) is performed on the processing result 15 as described above, a group whose vertical and horizontal lengths are shorter than the threshold value TH3 is selected from a group candidate indicating a date stamp outline. Excluded. The threshold value TH3 is a value shorter than the vertical and horizontal lengths in the group indicating the outline of the date stamp. Therefore, when the first loop processing is performed, for example, as shown in FIG. 15B, pixel groups 1511, 1512, 1513, and 1514 indicating the corners of the frame line in the form are displayed with date stamps. It is excluded from the group candidate showing the outline.

第1のループ処理が終了すると、画像処理装置2は、第2のループ処理(図5のステップS406〜S409)を行う。第2のループ処理では、グループ毎に、周囲に有効なグループが2組以上存在するか判定し(ステップS407)、有効なグループが1組しか存在しないグループ或いは存在しないグループを、日付印の輪郭部を示すグループの候補から除外する(ステップS408)。ステップS407の判定処理では、上記のように、日付印の輪郭部を示す複数のグループ同士の距離に基づいて設定される探索領域内に一部又は全部が含まれる他の有効なグループを探索する。従って、例えば、図15の(b)における帳票の枠線と対応するグループ1507の周囲に存在する他の有効なグループは、グループ1510の1組のみとなる。同様に、帳票の枠線と対応するグループ1508、1509、及び1510の周囲に存在する他の有効なグループは、それぞれ、1組となる。これに対し、日付印の輪郭部と対応するグループ1501,1502,1503,及び1504、並びに直線部と対応するグループ1505及び1506は、それぞれ、周囲に存在する他の有効なグループが2組以上となる。従って、第2のループ処理を行うことにより、帳票の枠線と対応するグループ1507、1508、1509、及び1510が、日付印の輪郭部を示すグループの候補から除外される。すなわち、ノイズ除去処理が終了すると、図15の(b)における日付印の輪郭部と対応するグループ1501,1502,1503,及び1504、並びに直線部と対応するグループ1505及び1506のみが、日付印の輪郭を示すグループの候補として残る。よって、本実施形態の画像処理装置2では、斜度抽出処理及びノイズ除去処理を行うことにより得られたグループの画像内における位置に基づいて、自動的に、帳票に押印された日付印の位置を特定することが可能となる。   When the first loop process ends, the image processing apparatus 2 performs a second loop process (steps S406 to S409 in FIG. 5). In the second loop processing, for each group, it is determined whether there are two or more valid groups around (step S407), and a group having only one valid group or a group having no valid group is defined as a date stamp outline. Are excluded from the group candidates indicating the part (step S408). In the determination processing in step S407, as described above, another effective group that partially or entirely is included in the search region that is set based on the distance between the plurality of groups that indicate the outline of the date stamp is searched. . Therefore, for example, there is only one set of the group 1510 that exists around the group 1507 corresponding to the form frame line in FIG. Similarly, each of the other effective groups existing around the groups 1508, 1509, and 1510 corresponding to the form frame line is one set. On the other hand, the groups 1501, 1502, 1503, and 1504 corresponding to the outline portion of the date stamp, and the groups 1505 and 1506 corresponding to the straight line portion, respectively, have two or more other valid groups existing around. Become. Therefore, by performing the second loop processing, the groups 1507, 1508, 1509, and 1510 corresponding to the form border are excluded from the group candidates indicating the date stamp outline. That is, when the noise removal processing is completed, only the groups 1501, 1502, 1503, and 1504 corresponding to the outline portion of the date mark in FIG. 15B and the groups 1505 and 1506 corresponding to the straight line portion are displayed. It remains as a candidate for a group that represents an outline. Therefore, in the image processing apparatus 2 of the present embodiment, the position of the date stamp automatically stamped on the form is automatically based on the position in the image of the group obtained by performing the gradient extraction process and the noise removal process. Can be specified.

更に、本実施形態の画像処理装置2では、帳票の画像10における日付印の位置を特定した後、日付印の向きが正立となるよう日付印の傾きを補正する。   Furthermore, in the image processing apparatus 2 of the present embodiment, after specifying the position of the date stamp in the image 10 of the form, the inclination of the date stamp is corrected so that the direction of the date stamp is upright.

図16は、日付印の傾きを算出する方法を説明する図である。
図16の(a)には、帳票の画像10から切り出した日付印9における第1の直線部902を示す複数の画素のうちの3つの画素r1、r2、及びr3のx-y座標系での座標を示している。x-y座標系におけるx方向は、画像内におけるu方向と平行であり、かつ正の方向がu方向と同一である。一方、x-y座標系におけるy方向は、画像内におけるv方向と平行であり、かつ正の方向がv方向とは反対の方向である。
FIG. 16 is a diagram for explaining a method for calculating the inclination of the date stamp.
FIG. 16A shows an xy coordinate system of three pixels r1, r2, and r3 among a plurality of pixels indicating the first straight line portion 902 in the date stamp 9 cut out from the image 10 of the form. The coordinates of are shown. The x direction in the xy coordinate system is parallel to the u direction in the image, and the positive direction is the same as the u direction. On the other hand, the y direction in the xy coordinate system is parallel to the v direction in the image, and the positive direction is the direction opposite to the v direction.

日付印の傾きを算出する際には、上記のように、帳票の画像10から切り出した領域(部分画像)内における日付印9の要素を示す画素に対する、ハフ変換を行う。ハフ変換では、日付印9の要素を示す画素毎に、0≦θ<2πの範囲内において下記数式(3)を満たすρの分布を算出する。   When calculating the inclination of the date stamp, as described above, the Hough transform is performed on the pixel indicating the element of the date stamp 9 in the region (partial image) cut out from the image 10 of the form. In the Hough transform, a distribution of ρ that satisfies the following formula (3) is calculated for each pixel indicating the element of the date stamp 9 within the range of 0 ≦ θ <2π.

ρ=x・cosθ+y・sinθ (3)     ρ = x · cosθ + y · sinθ (3)

数式(3)におけるx及びyは、それぞれ、処理の対象に選択された画素のx-y座標系におけるx座標及びy座標である。例えば、図16の(a)における座標(x1,y1)の画素r1を処理の対象に選択した場合、画像処理装置2は、0≦θ<2πの範囲内において下記数式(4)を満たすρの分布を算出する。   In the equation (3), x and y are the x coordinate and y coordinate in the xy coordinate system of the pixel selected as the processing target, respectively. For example, when the pixel r1 at the coordinates (x1, y1) in FIG. 16A is selected as the processing target, the image processing apparatus 2 satisfies the following formula (4) within the range of 0 ≦ θ <2π. The distribution of is calculated.

ρ=x1・cosθ+y1・sinθ (4)     ρ = x1 · cosθ + y1 · sinθ (4)

数式(4)により算出される画素r1の座標(x1,y1)についてのθとρとの関係をθ-ρ座標系にプロットすると、例えば、図16の(b)に示したような曲線となる。また、詳細な説明は省略するが、画素r2の座標(x2,y2)についてのθとρとの関係、及び画素r3の座標(x3,y3)についてのθとρとの関係を、θ-ρ座標系にプロットすると、それぞれ、例えば、図16の(b)に示したような曲線となる。ここで、θ-ρ座標系における3本の曲線の交点となる点(θ1,ρ1)を抽出し、下記数式(5)を生成すると、x-y座標系において数式(5)を満たす直線は、3つの画素r1、r2、及びr3を通る直線となる。   When the relationship between θ and ρ with respect to the coordinates (x1, y1) of the pixel r1 calculated by the equation (4) is plotted in the θ-ρ coordinate system, for example, a curve as shown in FIG. Become. Although not described in detail, the relationship between θ and ρ with respect to the coordinates (x2, y2) of the pixel r2 and the relationship between θ and ρ with respect to the coordinates (x3, y3) of the pixel r3 are expressed as θ− When plotted in the ρ coordinate system, for example, the curves shown in FIG. Here, when the point (θ1, ρ1) that is the intersection of the three curves in the θ-ρ coordinate system is extracted and the following equation (5) is generated, the straight line that satisfies the equation (5) in the xy coordinate system is This is a straight line passing through the three pixels r1, r2, and r3.

ρ1=x・cosθ1+y・sinθ1 (5)     ρ1 = x · cos θ1 + y · sin θ1 (5)

また、数式(5)は、数式(6)のように書き換えられる。   Also, Equation (5) can be rewritten as Equation (6).

y=(−cosθ1/sinθ1)・x+(ρ1/sinθ1)     y = (− cos θ1 / sin θ1) · x + (ρ1 / sin θ1)

すなわち、ハフ変換により数式(5)を導出することにより、図16の(b)に示したように、日付印9における日付904の上側に位置する第1の直線部902の、x方向に対する傾き角を算出することが可能となる。   That is, by deriving Equation (5) by the Hough transform, as shown in FIG. 16B, the inclination of the first linear portion 902 located above the date 904 in the date stamp 9 with respect to the x direction. The corner can be calculated.

また、同様の手順により、日付印9における日付904の下側に位置する第2の直線部903上の各点を含む直線を示す式ρ2=x・cosθ2+y・sinθ2を導出することにより、第2の直線部の、x方向に対する傾き角を算出することが可能となる。なお、日付印9における第1の直線部902と第2の直線部903とは略平行であるため、ハフ変換を利用した算出した2つの数式における傾きを示す値は、略同一となる。   Further, the same procedure is used to derive the expression ρ2 = x · cos θ2 + y · sin θ2 indicating a straight line including each point on the second straight line portion 903 located below the date 904 in the date stamp 9 to obtain the second It is possible to calculate the inclination angle of the straight line portion with respect to the x direction. Since the first straight line portion 902 and the second straight line portion 903 in the date stamp 9 are substantially parallel, the values indicating the slopes in the two mathematical expressions calculated using the Hough transform are substantially the same.

このように、ハフ変換に基づいて、日付印9の向きが正立である場合に水平方向に延伸する第1の直線部902及び第2の直線部903の傾き角を算出することにより、日付印9の傾き角θがわかる。よって、帳票の画像10から切り出した日付印を−θだけ回転させることにより、第1の直線部902及び第2の直線部903の傾き角が0度となり、日付印の向きが正立となる。   Thus, by calculating the inclination angles of the first straight line portion 902 and the second straight line portion 903 that extend in the horizontal direction when the date stamp 9 is upright, based on the Hough transform, the date The inclination angle θ of the mark 9 is known. Therefore, by rotating the date stamp cut out from the image 10 of the form by −θ, the inclination angle of the first straight line portion 902 and the second straight line portion 903 becomes 0 degrees, and the direction of the date mark becomes erect. .

図17は、日付印が正立補正される様子を説明する図である。
図17の(a)には、帳票の画像10から日付印9が押印された領域を切り出す際の領域Q3の例を示している。領域Q3は、例えば、斜度抽出処理及びノイズ除去処理により得られた、日付印の輪郭部を示す画素を含むグループの全てを内包する寸法の矩形領域とする。
FIG. 17 is a diagram for explaining how the date stamp is corrected upright.
FIG. 17A shows an example of a region Q3 when the region where the date stamp 9 is stamped is cut out from the image 10 of the form. For example, the region Q3 is a rectangular region having a size including all of the groups including the pixels indicating the outline portion of the date stamp obtained by the gradient extraction processing and the noise removal processing.

帳票の画像10から領域Q3を切り出した後、画像処理装置2は、ハフ変換を利用し、日付印9における第1の直線部902を含む直線を示す数式ρ1=x・cosθ1+y・sinθ1、及び第2の直線部903を含む直線を示す数式ρ2=x・cosθ2+y・sinθ2を導出する。その後、画像処理装置2は、図17の(b)に示すように、導出した2つの数式に基づいて、切り出した領域Q3における日付印の傾き角θを算出する。   After cutting out the region Q3 from the image 10 of the form, the image processing apparatus 2 uses the Hough transform to express the equation ρ1 = x · cos θ1 + y · sin θ1 indicating the straight line including the first straight line part 902 in the date stamp 9, and A mathematical expression ρ2 = x · cos θ2 + y · sin θ2 representing a straight line including two straight line portions 903 is derived. Thereafter, as shown in FIG. 17B, the image processing apparatus 2 calculates the inclination angle θ of the date stamp in the clipped region Q3 based on the derived two mathematical expressions.

傾き角θを算出した後、画像処理装置2は、図17の(c)に示すように、切り出した領域Q3を角度−θだけ回転させる変換処理を行う。これにより、日付印9の向きが正立となる。従って、日付印9における第1の直線部902、第2の直線部903、及び輪郭部901により囲まれた領域に対する文字認識を行うことにより、日付印9の日付904を正しく認識することが可能となる。   After calculating the inclination angle θ, the image processing apparatus 2 performs a conversion process of rotating the cut-out region Q3 by an angle −θ as shown in FIG. Thereby, the direction of the date stamp 9 becomes erect. Therefore, the date 904 of the date stamp 9 can be correctly recognized by performing character recognition on the area surrounded by the first straight line portion 902, the second straight line portion 903, and the contour portion 901 in the date stamp 9. It becomes.

以上説明したように、本実施形態に係る画像処理装置2は、帳票の画像10における日付印9には画像水平方向及び画像垂直方向のそれぞれとなす角が閾値以上となる部分が複数存在することを利用して、画像10における日付印9の位置を特定する。このため、本実施形態の画像処理装置2では、帳票の画像10における日付印9の輪郭(外形形状)、寸法、及び色等の組み合わせによらず、自動的に日付印9の位置を特定することが可能となる。すなわち、本実施形態の画像処理装置2によれば、日付印の多様化に迅速かつ柔軟に対応することが可能となる。従って、例えば、画像処理装置2(画像処理システム1)のオペレータは、多様化する日付印のパターンを定義する作業や、帳票の画像10における日付印が押印された領域を選択する作業から解放される。   As described above, in the image processing apparatus 2 according to the present embodiment, the date stamp 9 in the form image 10 includes a plurality of portions in which the angle formed between the horizontal direction and the vertical direction of the image is equal to or greater than the threshold value. Is used to specify the position of the date stamp 9 in the image 10. Therefore, in the image processing apparatus 2 of the present embodiment, the position of the date stamp 9 is automatically specified regardless of the combination of the outline (outer shape), size, color, and the like of the date stamp 9 in the form image 10. It becomes possible. That is, according to the image processing apparatus 2 of the present embodiment, it is possible to quickly and flexibly cope with diversification of date stamps. Therefore, for example, the operator of the image processing apparatus 2 (image processing system 1) is freed from the task of defining diversified date stamp patterns and the task of selecting the area where the date stamp is imprinted in the image 10 of the form. The

更に、本実施形態に係る画像処理装置2は、帳票の画像10における日付印の傾き角θを算出し、該傾き角θに基づいて日付印の向きが正立となるよう日付印の向きを補正する。このため、画像処理装置2では、文字認識により日付印に含まれる日付を認識する際の、日付印の傾きによる誤認識を低減することが可能となる。従って、例えば、画像処理装置2(画像処理システム1)のオペレータは、日付印の向きを補正する作業や誤認識された日付を修正する作業から解放される。   Furthermore, the image processing apparatus 2 according to the present embodiment calculates the inclination angle θ of the date stamp in the image 10 of the form, and sets the orientation of the date stamp so that the orientation of the date stamp is upright based on the inclination angle θ. to correct. For this reason, the image processing apparatus 2 can reduce erroneous recognition due to the inclination of the date stamp when the date included in the date stamp is recognized by character recognition. Therefore, for example, the operator of the image processing apparatus 2 (image processing system 1) is freed from the work of correcting the direction of the date stamp and the work of correcting the erroneously recognized date.

なお、図3のフローチャートは、本実施形態に係る画像処理装置2が行う画像処理の一例に過ぎない。本実施形態の画像処理装置2が行う画像処理は、本実施形態で説明した要旨を逸脱しない範囲において、適宜変更可能である。例えば、本実施形態の画像処理装置2が行う画像処理は、日付印の日付を文字認識するだけでなく、帳票8における文字列の一部又は全部を文字認識する処理を含むものであってもよい。また、本実施形態の画像処理装置2が行う画像処理は、例えば、日付印の傾きを補正した場合には補正後の日付印を帳票の画像10に合成した画像を生成して保持する処理を含むものであってもよい。   Note that the flowchart of FIG. 3 is merely an example of image processing performed by the image processing apparatus 2 according to the present embodiment. The image processing performed by the image processing apparatus 2 of the present embodiment can be appropriately changed without departing from the gist described in the present embodiment. For example, the image processing performed by the image processing apparatus 2 of the present embodiment may include not only character recognition of the date stamp date but also character recognition of part or all of the character string in the form 8. Good. The image processing performed by the image processing apparatus 2 according to the present embodiment includes, for example, a process of generating and holding an image in which the corrected date stamp is combined with the form image 10 when the inclination of the date stamp is corrected. It may be included.

また、図4のフローチャートは、斜度抽出処理の一例に過ぎない。斜度抽出処理は、図4のフローチャートに沿った処理に限らず、本実施形態で説明した要旨を逸脱しない範囲において、適宜変更可能である。例えば、斜度抽出処理は、帳票における直線のうち水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上(例えば15度以上)となる部分と、帳票における曲線のうち接線の方向と水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上となる部分とを抽出する処理であってもよい。   Further, the flowchart of FIG. 4 is only an example of the gradient extraction process. The gradient extraction process is not limited to the process according to the flowchart of FIG. 4 and can be changed as appropriate without departing from the gist described in the present embodiment. For example, the gradient extraction process is performed by using a horizontal line and a vertical direction of a straight line in a form where the angle is greater than or equal to a predetermined angle (for example, 15 degrees or greater), and a tangential direction of the curve in the form is horizontal. A process of extracting a portion where the angle formed by each of the direction and the vertical direction is equal to or larger than a predetermined angle may be used.

また、図5及び図6のフローチャートは、ノイズ除去処理の一例に過ぎない。ノイズ除去処理は、図5及び図6のフローチャートに沿った処理に限らず、本実施形態で説明した要旨を逸脱しない範囲において、適宜変更可能である。更に、図7のフローチャートは、正立補正処理の一例に過ぎない。正立補正処理は、図7のフローチャートに沿った処理に限らず、本実施形態で説明した要旨を逸脱しない範囲において、適宜変更可能である。   The flowcharts of FIGS. 5 and 6 are only examples of noise removal processing. The noise removal processing is not limited to the processing according to the flowcharts of FIGS. 5 and 6, and can be appropriately changed without departing from the gist described in the present embodiment. Furthermore, the flowchart of FIG. 7 is only an example of an upright correction process. The erecting correction process is not limited to the process according to the flowchart of FIG. 7, and can be appropriately changed without departing from the gist described in the present embodiment.

また、本実施形態に係る画像処理装置2の機能構成は、図2に示した構成に限らず、適宜変更可能である。例えば、認識処理部230が参照する文字認識辞書601は、画像処理装置2が備える記憶部(図示せず)に記憶させておいてもよい。また、例えば、スキャナ装置3が出力する帳票の画像10がグレースケールの画像或いは二値画像である場合には、解析部220における変換部221を省略することが可能である。また、例えば、解析部220における斜度抽出部222及びノイズ除去部223は、斜度抽出処理(ステップS3)及びノイズ除去処理(ステップS4)を一連の1つの処理として行う1つの処理部であってもよい。更に、本実施形態に係る画像処理装置2は、例えば、メモリカードや光ディスク等の可搬型記録媒体、或いはネットワークを介して提供される帳票の画像10を取得して上記の画像処理を行えるようにしてもよい。   In addition, the functional configuration of the image processing apparatus 2 according to the present embodiment is not limited to the configuration illustrated in FIG. For example, the character recognition dictionary 601 referred to by the recognition processing unit 230 may be stored in a storage unit (not shown) provided in the image processing apparatus 2. For example, when the form image 10 output by the scanner device 3 is a grayscale image or a binary image, the conversion unit 221 in the analysis unit 220 can be omitted. Further, for example, the gradient extraction unit 222 and the noise removal unit 223 in the analysis unit 220 are one processing unit that performs the gradient extraction process (step S3) and the noise removal process (step S4) as a series of processes. May be. Furthermore, the image processing apparatus 2 according to the present embodiment acquires a form image 10 provided via a portable recording medium such as a memory card or an optical disk or a network, and performs the above-described image processing. May be.

加えて、本実施形態に係る画像処理装置2は、コンピュータと、該コンピュータに実行させるプログラムとにより実現可能である。以下、コンピュータとプログラムとにより実現される画像処理装置2について、図18を参照して説明する。   In addition, the image processing apparatus 2 according to the present embodiment can be realized by a computer and a program executed by the computer. Hereinafter, the image processing apparatus 2 realized by a computer and a program will be described with reference to FIG.

図18は、コンピュータのハードウェア構成を示す図である。
図18に示すように、コンピュータ20は、CPU(Central Processing Unit)2001と、メモリ2002と、補助記憶装置2003と、入力装置2004と、表示装置2005とを備える。また、コンピュータ20は、入出力インタフェース2006と、通信制御装置2007と、媒体駆動装置2008とを備える。コンピュータ20におけるこれらの要素2001〜2008は、バス2010により相互に接続されており、要素間でのデータの受け渡しが可能になっている。
FIG. 18 is a diagram illustrating a hardware configuration of a computer.
As illustrated in FIG. 18, the computer 20 includes a CPU (Central Processing Unit) 2001, a memory 2002, an auxiliary storage device 2003, an input device 2004, and a display device 2005. The computer 20 includes an input / output interface 2006, a communication control device 2007, and a medium driving device 2008. These elements 2001 to 2008 in the computer 20 are connected to each other by a bus 2010 so that data can be exchanged between the elements.

CPU 2001は、オペレーティングシステムを含む各種のプログラムを実行することによりコンピュータ20の全体の動作を制御する。例えば、CPU 2001は、図3に示したステップS1〜S8の各ステップの処理を含む画像処理プログラムを実行する。CPU 2001が実行する画像処理プログラムにおける斜度抽出処理は、例えば、図4のフローチャートに示した各ステップの処理を含む処理としてサブルーチン化されている。また、CPU 2001が実行する画像処理プログラムにおけるノイズ抽出処理は、例えば、図5及び図6のフローチャートに示した各ステップの処理を含む処理としてサブルーチン化されている。更に、CPU 2001が実行する画像処理プログラムにおける正立補正処理は、例えば、図7のフローチャートに示した各ステップの処理を含む処理としてサブルーチン化されている。   The CPU 2001 controls the overall operation of the computer 20 by executing various programs including an operating system. For example, the CPU 2001 executes an image processing program including the processes of steps S1 to S8 illustrated in FIG. The gradient extraction process in the image processing program executed by the CPU 2001 is made into a subroutine as a process including the process of each step shown in the flowchart of FIG. Further, the noise extraction process in the image processing program executed by the CPU 2001 is made into a subroutine as a process including the process of each step shown in the flowcharts of FIGS. Further, the erecting correction process in the image processing program executed by the CPU 2001 is made into a subroutine as a process including the process of each step shown in the flowchart of FIG.

メモリ2002は、図示しないROM(Read Only Memory)及びRAM(Random Access Memory)を含む。メモリ2002のROMには、例えば、コンピュータ20の起動時にCPU 2001が読み出す所定の基本制御プログラム等が予め記録されている。また、メモリ2002のRAMは、CPU 2001が、各種のプログラムを実行する際に必要に応じて作業用記憶領域として使用する。メモリ2002のRAMは、例えば、帳票の画像、斜度、グループ番号、正立補正処理で算出する(θ,ρ)等の一時的な記憶に利用可能である。   The memory 2002 includes a ROM (Read Only Memory) and a RAM (Random Access Memory) not shown. In the ROM of the memory 2002, for example, a predetermined basic control program read by the CPU 2001 when the computer 20 is started is recorded in advance. The RAM of the memory 2002 is used as a working storage area as necessary when the CPU 2001 executes various programs. The RAM of the memory 2002 can be used for temporary storage of, for example, a form image, an inclination, a group number, and (θ, ρ) calculated by an upright correction process.

補助記憶装置2003は、例えば、HDD(Hard Disk Drive)等の磁気ディスク、及びフラッシュメモリ等の不揮発性メモリである。補助記憶装置2003には、CPU 2001によって実行される各種のプログラムや各種のデータ等を記憶させることができる。補助記憶装置2003は、例えば、図3に示したステップS1〜S8の各ステップの処理を含む画像処理プログラム等の記憶に利用可能である。また、補助記憶装置2003は、例えば、帳票の画像10、日付印の日付の認識結果等の記憶に利用可能である。   The auxiliary storage device 2003 is, for example, a magnetic disk such as an HDD (Hard Disk Drive) and a nonvolatile memory such as a flash memory. The auxiliary storage device 2003 can store various programs executed by the CPU 2001, various data, and the like. The auxiliary storage device 2003 can be used for storing, for example, an image processing program including the processes of steps S1 to S8 shown in FIG. Further, the auxiliary storage device 2003 can be used for storing, for example, the form image 10 and the date recognition result of the date stamp.

入力装置2004は、例えば、キーボード装置、マウス装置、及びタッチパネル装置等である。コンピュータ20のオペレータが入力装置2004に対し所定の操作を行うと、入力装置2004は、その操作内容に対応付けられている入力情報をCPU 2001に送信する。入力装置2004には、図1の画像処理システム1における入力装置4に相当する。   The input device 2004 is, for example, a keyboard device, a mouse device, a touch panel device, or the like. When the operator of the computer 20 performs a predetermined operation on the input device 2004, the input device 2004 transmits input information associated with the operation content to the CPU 2001. The input device 2004 corresponds to the input device 4 in the image processing system 1 of FIG.

表示装置2005は、例えば、液晶表示装置である。表示装置2005は、例えば、コンピュータ20の動作状態や、帳票の画像10、日付印の日付の認識結果等の表示に利用可能である。表示装置2005は、図1の画像処理システム1における表示装置5に相当する。   The display device 2005 is, for example, a liquid crystal display device. The display device 2005 can be used, for example, to display the operating state of the computer 20, the form image 10, the date recognition result of the date stamp, and the like. The display device 2005 corresponds to the display device 5 in the image processing system 1 of FIG.

入出力インタフェース2006は、コンピュータ20と、電子部品や他の電子装置(例えばスキャナ装置3)等とを接続する。入出力インタフェース2006は、例えば、USB(Universal Serial Bus)規格のコネクタを備えたフラッシュメモリの接続にも利用可能である。   The input / output interface 2006 connects the computer 20 to electronic components and other electronic devices (for example, the scanner device 3). The input / output interface 2006 can also be used to connect a flash memory having a USB (Universal Serial Bus) standard connector, for example.

通信制御装置2007は、コンピュータ20をネットワークに接続し、ネットワークを介したコンピュータ20と他の電子機器との各種通信を制御する装置である。通信制御装置2008は、例えば、図1の画像処理システム1におけるサーバ装置6が保持している文字認識辞書を参照することに利用可能である。   The communication control device 2007 is a device that connects the computer 20 to a network and controls various communications between the computer 20 and other electronic devices via the network. The communication control device 2008 can be used, for example, to refer to a character recognition dictionary held by the server device 6 in the image processing system 1 of FIG.

媒体駆動装置2008は、可搬型記憶媒体21に記録されているプログラムやデータの読み出し、補助記憶装置2003に記憶されたデータ等の可搬型記憶媒体21への書き込みを行う。可搬型記憶媒体21としては、例えば、Secure Digital(SD)規格のメモリカード(フラッシュメモリ)がある。可搬型記録媒体21は、上記の画像処理プログラム、帳票の画像10、日付の認識結果等の記憶に利用可能である。また、コンピュータ20が媒体駆動装置2008として利用可能な光ディスクドライブを搭載している場合、当該光ディスクドライブで認識可能な各種の光ディスクを可搬型記録媒体21として利用可能である。可搬型記録媒体21として利用可能な光ディスクには、例えば、Compact Disc(CD)、Digital Versatile Disc(DVD)、Blu-ray Disc(Blu-rayは登録商標)等がある。   The medium driving device 2008 reads programs and data recorded in the portable storage medium 21 and writes data stored in the auxiliary storage device 2003 to the portable storage medium 21. As the portable storage medium 21, there is, for example, a Secure Digital (SD) standard memory card (flash memory). The portable recording medium 21 can be used for storing the image processing program, the form image 10, the date recognition result, and the like. When the computer 20 includes an optical disk drive that can be used as the medium drive device 2008, various optical disks that can be recognized by the optical disk drive can be used as the portable recording medium 21. Examples of the optical disc that can be used as the portable recording medium 21 include a Compact Disc (CD), a Digital Versatile Disc (DVD), and a Blu-ray Disc (Blu-ray is a registered trademark).

コンピュータ20は、オペレータが入力装置2004を操作して画像処理プログラムの開始命令を入力すると、CPU 2001が補助記憶装置2003等から図3のステップS1〜S8の各ステップの処理を含む画像処理プログラムを読み出して実行する。画像処理プログラムを実行している間、CPU 2001は、図2に示した画像処理装置2における解析部220、認識処理部230、及び表示制御部240として機能(動作)する。また、帳票の画像10をスキャナ装置3から取得する場合、CPU 2001及び入出力インタフェース2006は、図2に示した画像処理装置2におけるスキャナ制御部210として機能する。更に、コンピュータ20とは別のサーバ装置6等が保持している文字認識辞書610を参照して文字認識を行う場合、通信制御装置2007が認識処理部230の持つ機能の一部を担う。   When the operator operates the input device 2004 to input an image processing program start command, the computer 20 stores an image processing program including processing in steps S1 to S8 in FIG. 3 from the auxiliary storage device 2003 or the like. Read and execute. While executing the image processing program, the CPU 2001 functions (operates) as the analysis unit 220, the recognition processing unit 230, and the display control unit 240 in the image processing apparatus 2 illustrated in FIG. When acquiring the form image 10 from the scanner device 3, the CPU 2001 and the input / output interface 2006 function as the scanner control unit 210 in the image processing device 2 shown in FIG. Furthermore, when performing character recognition with reference to the character recognition dictionary 610 held by the server device 6 or the like different from the computer 20, the communication control device 2007 bears a part of the functions of the recognition processing unit 230.

なお、画像処理装置2として動作させるコンピュータ20は、図18に示した要素2001〜2008の全てを含む必要はなく、用途や条件に応じて一部の要素を省略することも可能である。例えば、コンピュータ20は、媒体駆動装置2008や通信制御装置2007が省略されたものであってもよい。   Note that the computer 20 operated as the image processing apparatus 2 does not have to include all of the elements 2001 to 2008 shown in FIG. 18, and some elements can be omitted depending on the application and conditions. For example, the computer 20 may be one in which the medium driving device 2008 and the communication control device 2007 are omitted.

1 画像処理システム
2 画像処理装置
210 スキャナ制御部
220 解析部
221 変換部
222 斜度抽出部
223 ノイズ除去部
224 切出部
225 補正部
230 認識処理部
240 表示制御部
250 主制御部
3 スキャナ装置
4 入力装置
5 表示装置
6 サーバ装置
601 文字認識辞書
7 ネットワーク
8 帳票
9 日付印
10 帳票の画像
11 フィルタ
13 抽出結果
14 置換テーブル
15 処理結果
20 コンピュータ
2001 CPU
2002 メモリ
2003 補助記憶装置
2004 入力装置
2005 表示装置
2006 入出力インタフェース
2007 通信制御装置
2008 媒体駆動装置
2010 バス
21 可搬型記録媒体
DESCRIPTION OF SYMBOLS 1 Image processing system 2 Image processing apparatus 210 Scanner control part 220 Analysis part 221 Conversion part 222 Inclination extraction part 223 Noise removal part 224 Cutting-out part 225 Correction | amendment part 230 Recognition processing part 240 Display control part 250 Main control part 3 Scanner apparatus 4 Input device 5 Display device 6 Server device 601 Character recognition dictionary 7 Network 8 Form 9 Date stamp 10 Form image 11 Filter 13 Extraction result 14 Replacement table 15 Processing result 20 Computer 2001 CPU
2002 Memory 2003 Auxiliary storage device 2004 Input device 2005 Display device 2006 Input / output interface 2007 Communication control device 2008 Medium drive device 2010 Bus 21 Portable recording medium

Claims (6)

帳票の画像における前記帳票の要素を示す画素のうち、前記帳票の要素における前記帳票の画像の水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上となる部分を示す画素を抽出し、
抽出した前記画素のうち、隣接して連続する複数の画素を1つのグループとしてグループ化し、
前記画素のグループのうち、前記画像内における縦横の長さが所定の閾値以上であり、かつ距離が所定の範囲内となる他のグループが2組以上存在するグループを抽出し、
前記帳票の画像における抽出した前記グループの全てを内包する領域を、日付印が押印された領域に特定する
処理をコンピュータに実行させることを特徴とする画像処理プログラム。
Out of the pixels indicating the element of the form in the form image, extract a pixel indicating a portion where the angle between the horizontal direction and the vertical direction of the form image in the element of the form is a predetermined angle or more,
Among the extracted pixels, a plurality of adjacent continuous pixels are grouped as one group,
From the group of pixels, extract a group in which the length and width in the image are equal to or greater than a predetermined threshold and there are two or more other groups whose distance is within a predetermined range,
An image processing program for causing a computer to execute a process of specifying an area including all of the extracted groups in an image of the form as an area having a date stamp.
前記画素を抽出する処理は、前記帳票の要素を示す画素毎に、該画素の周囲に位置する複数の画素のそれぞれにおける濃度と、当該複数の画素の濃度のそれぞれに対して適用する係数を定めたフィルタとに基づいて、前記画素の濃度と前記係数との積の和を算出し、
算出した前記和の絶対値が所定の閾値以上となる画素を抽出する
処理を含むことを特徴とする請求項1に記載の画像処理プログラム。
In the process of extracting the pixels, for each pixel indicating the element of the form, a density to be applied to each of a plurality of pixels located around the pixel and a coefficient to be applied to each of the densities of the plurality of pixels are determined. And calculating the sum of the product of the pixel density and the coefficient based on the filter
The image processing program according to claim 1, further comprising a process of extracting a pixel whose absolute value of the calculated sum is equal to or greater than a predetermined threshold.
前記日付印が押印された領域を特定した後、更に、
前記帳票の画像における前記日付印が押印された領域を切り出し、
切り出した前記領域における水平方向に対する、該領域に含まれる前記日付印における直線部の傾き角を算出し、
算出した前記傾き角に基づいて、前記日付印における前記直線部の延伸方向が水平方向となるよう前記切り出した領域を回転させる
処理をコンピュータに実行させることを特徴とする請求項1又は2に記載の画像処理プログラム。
After identifying the area where the date stamp is stamped,
Cut out the area where the date stamp is stamped in the image of the form,
Calculate the inclination angle of the straight line portion in the date stamp included in the region with respect to the horizontal direction in the cut out region,
3. The computer according to claim 1, further comprising: causing the computer to execute a process of rotating the cut-out area so that the extending direction of the linear portion in the date stamp is a horizontal direction based on the calculated inclination angle. Image processing program.
前記日付印が押印された領域を特定した後、更に、
前記日付印が押印された領域内の前記日付印に含まれる日付を文字認識により認識する
処理をコンピュータに実行させることを特徴とする請求項1に記載の画像処理プログラム。
After identifying the area where the date stamp is stamped,
The image processing program according to claim 1, further comprising: causing a computer to execute processing for recognizing a date included in the date stamp in an area where the date stamp is stamped by character recognition.
コンピュータが、帳票の画像における前記帳票の要素を示す画素のうち、前記帳票の要素における前記帳票の画像の水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上となる部分を示す画素を抽出し、
抽出した前記画素のうち、隣接して連続する複数の画素を1つのグループとしてグループ化し、
前記画素のグループのうち、前記画像内における縦横の長さが所定の閾値以上であり、かつ距離が所定の範囲内となる他のグループが2組以上存在するグループを抽出し、
前記帳票の画像における抽出した前記グループの全てを内包する領域を、日付印が押印された領域に特定する
処理を実行することを特徴とする画像処理方法。
Among the pixels indicating the element of the form in the form image, the computer indicates a pixel indicating a portion where the angle between the horizontal direction and the vertical direction of the form image in the form element is equal to or larger than a predetermined angle. Extract and
Among the extracted pixels, a plurality of adjacent continuous pixels are grouped as one group,
From the group of pixels, extract a group in which the length and width in the image are equal to or greater than a predetermined threshold and there are two or more other groups whose distance is within a predetermined range,
An image processing method comprising: executing a process of specifying an area including all of the extracted groups in the form image as an area having a date stamp.
帳票の画像における前記帳票の要素を示す画素のうち、前記帳票の要素における前記帳票の画像の水平方向及び垂直方向のそれぞれとのなす角が所定の角度以上となる部分を示す画素を抽出し、抽出した前記画素のうち、隣接して連続する複数の画素を1つのグループとしてグループ化した後、前記画素のグループのうち、前記画像内における縦横の長さが所定の閾値以上であり、かつ距離が所定の範囲内となる他のグループが2組以上存在するグループを抽出し、前記帳票の画像における抽出した前記グループの全てを内包する領域を日付印が押印された領域に特定する解析部
を備えることを特徴とする画像処理装置。
Out of the pixels indicating the element of the form in the form image, extract a pixel indicating a portion where the angle between the horizontal direction and the vertical direction of the form image in the element of the form is a predetermined angle or more, Among the extracted pixels, a plurality of adjacent continuous pixels are grouped as one group, and then the vertical and horizontal lengths in the image are equal to or greater than a predetermined threshold in the group of pixels, and the distance An analysis unit that extracts a group in which two or more other groups within a predetermined range exist, and identifies a region including all of the extracted groups in the image of the form as a region stamped with a date stamp An image processing apparatus comprising:
JP2018091876A 2018-05-11 2018-05-11 Image processing program, image processing method, and image processing device Active JP7034823B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018091876A JP7034823B2 (en) 2018-05-11 2018-05-11 Image processing program, image processing method, and image processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018091876A JP7034823B2 (en) 2018-05-11 2018-05-11 Image processing program, image processing method, and image processing device

Publications (2)

Publication Number Publication Date
JP2019197444A true JP2019197444A (en) 2019-11-14
JP7034823B2 JP7034823B2 (en) 2022-03-14

Family

ID=68537996

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018091876A Active JP7034823B2 (en) 2018-05-11 2018-05-11 Image processing program, image processing method, and image processing device

Country Status (1)

Country Link
JP (1) JP7034823B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08190610A (en) * 1995-01-12 1996-07-23 Oki Electric Ind Co Ltd Optical character reader
JP2017054386A (en) * 2015-09-10 2017-03-16 富士重工業株式会社 Vehicle exterior environment recognition device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08190610A (en) * 1995-01-12 1996-07-23 Oki Electric Ind Co Ltd Optical character reader
JP2017054386A (en) * 2015-09-10 2017-03-16 富士重工業株式会社 Vehicle exterior environment recognition device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
永崎 健,外3名: "文書画像の輪郭演算によるスタンプ検知手法", 電子情報通信学会技術研究報告 VOL.109 NO.418, vol. 第109巻, JPN6021027928, 2010, JP, ISSN: 0004553705 *

Also Published As

Publication number Publication date
JP7034823B2 (en) 2022-03-14

Similar Documents

Publication Publication Date Title
JP4694613B2 (en) Document orientation determination apparatus, document orientation determination method, program, and recording medium therefor
Biswas et al. Construction of isothetic covers of a digital object: A combinatorial approach
JP2017516204A (en) Generation and decoding of machine-readable optical codes with aesthetic elements
US8615129B2 (en) Pattern separating extraction device, and pattern separating extraction method
JP2007279828A (en) Business form processor, business form format preparation device, business form, program for processing business form and program for preparing business form format
JP2008146496A (en) Image processor, its control method, program
CN113139445A (en) Table recognition method, apparatus and computer-readable storage medium
JP2012199901A (en) Document modification detecting method by character comparison using character shape feature
KR19990036622A (en) A storage medium storing a method and processing apparatus for bitmap images, and an image processing program for processing bitmap images
CN111126266B (en) Text processing method, text processing system, equipment and medium
US11906441B2 (en) Inspection apparatus, control method, and program
US8249364B2 (en) Method for resolving contradicting output data from an optical character recognition (OCR) system, wherein the output data comprises more than one recognition alternative for an image of a character
JP7034823B2 (en) Image processing program, image processing method, and image processing device
CN111079745A (en) Formula identification method, device, equipment and storage medium
JP4873554B2 (en) Image distribution apparatus and image distribution method
JP2007041832A (en) Difference image extraction apparatus
CN115147858A (en) Method, device, equipment and medium for generating image data of handwritten form
JP2016009395A (en) Document file generation device and document file generation method
JP7365835B2 (en) Structure recognition system, structure recognition device, structure recognition method, and program
JP2015061157A (en) Information display device, input information correction program, and input information correction method
JP2004094427A (en) Slip image processor and program for realizing the same device
JPH07230526A (en) Character reader
JP2008269131A (en) Image processor and image processing program
JP5619111B2 (en) Image determination apparatus and program
JP4792117B2 (en) Document image processing apparatus, document image processing method, and document image processing program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200617

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20200617

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210709

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210720

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210914

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220302

R150 Certificate of patent or registration of utility model

Ref document number: 7034823

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150