JP4434803B2 - Image processing apparatus, image processing method, program, and storage medium - Google Patents

Image processing apparatus, image processing method, program, and storage medium Download PDF

Info

Publication number
JP4434803B2
JP4434803B2 JP2004090065A JP2004090065A JP4434803B2 JP 4434803 B2 JP4434803 B2 JP 4434803B2 JP 2004090065 A JP2004090065 A JP 2004090065A JP 2004090065 A JP2004090065 A JP 2004090065A JP 4434803 B2 JP4434803 B2 JP 4434803B2
Authority
JP
Japan
Prior art keywords
projection
partial image
line
character line
character
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2004090065A
Other languages
Japanese (ja)
Other versions
JP2005275952A (en
Inventor
裕章 池田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2004090065A priority Critical patent/JP4434803B2/en
Publication of JP2005275952A publication Critical patent/JP2005275952A/en
Application granted granted Critical
Publication of JP4434803B2 publication Critical patent/JP4434803B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Character Input (AREA)
  • Image Analysis (AREA)

Description

本発明は、文書画像等の傾きを自動的に検出して補正する画像処理装置、画像処理方法、プログラム及び記憶媒体に関する。   The present invention relates to an image processing apparatus, an image processing method, a program, and a storage medium that automatically detect and correct a tilt of a document image or the like.

スキャナ等から読み取った文書画像の傾きを自動的に補正することで、領域分割や文字認識等の文書画像解析処理の精度を向上させることができる。例えば、文書方向を自動的に検知し、その行方向に沿って配置された2つの探索用の窓において行方向の射影をそれぞれ求め、一方の窓を固定し、他方の窓を行方向と垂直方向にずらしながら、射影の相関が最大となる時の2つの窓の垂直方向のずれ量と行方向の距離から文書画像の傾き量を求める技術が開示されている(例えば、特許文献1参照。)。   By automatically correcting the inclination of the document image read from the scanner or the like, it is possible to improve the accuracy of document image analysis processing such as area division and character recognition. For example, the document direction is automatically detected, the projections in the row direction are obtained in two search windows arranged along the row direction, one window is fixed, and the other window is perpendicular to the row direction. A technique is disclosed in which the tilt amount of a document image is obtained from the amount of shift in the vertical direction of two windows and the distance in the row direction when the correlation between projections is maximized while shifting in the direction (see, for example, Patent Document 1). ).

特許文献1に記載の発明によれば、射影は窓の内部にある文字行の存在位置を示すものであり、相関が最大となる場合とは行の位置が一致した状態である。そして、文字行の傾きから文書画像の傾きを決定することができる。   According to the invention described in Patent Document 1, the projection indicates the position of the character line in the window, and the case where the correlation is maximized is the state where the line position matches. Then, the inclination of the document image can be determined from the inclination of the character line.

また、窓の組を文書画像全体に行き渡るように複数組を設定し、複数箇所から得られた傾きの大きさを使用して文書画像としての傾きを求めている。このように、特許文献1に記載の発明によれば、文字画像上の設定した窓における行方向の射影を用いることにより、速い処理速度で、かつ、記憶領域が少なくて済むような文字画像の傾き検出方法が開示されている。
特開平9−6914号公報
Further, a plurality of sets are set so that the set of windows extends over the entire document image, and the inclination as the document image is obtained using the magnitude of the inclination obtained from the plurality of positions. As described above, according to the invention described in Patent Document 1, by using the projection in the row direction in the set window on the character image, the character image can be processed at a high processing speed and with a small storage area. A tilt detection method is disclosed.
Japanese Patent Laid-Open No. 9-6914

しかしながら、上記特許文献1に記載の発明では、設定された窓内に例えば表等の行方向に垂直な罫線が存在すると、当該罫線による射影によって窓の高さ全体に渡って射影が取得され、文字の行方向の射影が適切に抽出することができないという欠点があった。   However, in the invention described in Patent Document 1, when there is a ruled line perpendicular to the row direction of a table or the like in the set window, a projection is acquired over the entire height of the window by projection by the ruled line, There was a drawback that the projection in the line direction of the characters could not be extracted properly.

本発明は、このような事情を考慮してなされたものであり、罫線を含む文書画像に対しても、当該文書画像の傾きを好適に求めることができる画像処理装置、画像処理方法、プログラム及び記憶媒体を提供することを目的とする。   The present invention has been made in view of such circumstances, and an image processing apparatus, an image processing method, a program, and a program that can suitably determine the inclination of a document image including a ruled line. An object is to provide a storage medium.

上記課題を解決するために、本発明は、入力された文書画像の傾きを決定する画像処理装置であって、横方向に所定距離離れた位置に並んだ2つの部分画像領域を対として、複数の前記対を前記文書画像内の複数箇所それぞれに設定する設定手段と、前記設定手段で設定された部分画像領域ごとに、当該部分画像領域内で黒画素が存在する画素行を示す射影を検出する検出手段と、前記複数箇所に設定された対それぞれに対して、前記検出手段により検出された射影の長さが所定の長さより短いか或いは当該部分画像領域の高さ全体に及ぶ長さである場合は、文字行の射影を特定できないと判定する文字行射影判定手段と、前記文字行射影判定手段で前記文字行の射影が特定できないと判定された部分画像領域に対して、該部分画像領域内の各画素行で黒画素の数をカウントすることによりヒストグラムを取得する取得手段と、前記取得手段で取得したヒストグラムに基づいて、前記部分画像領域内に文字行方向の罫線が含まれるか否かを判定する罫線判定手段と、前記罫線判定手段で前記部分画像領域内に文字行方向の罫線が含まれると判定された場合、前記取得手段で取得したヒストグラムの度数が所定の閾値以上である画素行を罫線の射影として特定する特定手段と、前記文字行射影判定手段で前記文字行の射影が特定できたと判定された場合の部分画像領域の対に関しては前記検出手段で検出した前記2つの部分画像領域それぞれの射影の相関関係を求め、前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれると判定された場合の部分画像領域の対に関しては前記特定手段で特定した前記2つの部分領域それぞれの射影の相関関係を求め、当該求めた相関関係と当該2つの部分領域間の間隔とに基づいて傾き角度を求める局所的傾き角度算出手段と、前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれないと判定された場合の部分画像領域の対に関しては、前記局所的傾き角度算出手段での処理を行わないように制御する制御手段と、前記局所的傾き角度算出手段で算出された傾き角度に基づいて、前記文書画像の傾きを決定する決定手段とを備えることを特徴とする。 In order to solve the above-described problem, the present invention is an image processing apparatus that determines the inclination of an input document image , and includes a plurality of pairs of two partial image regions that are arranged at a predetermined distance in the horizontal direction. A setting unit that sets the pair of images at a plurality of locations in the document image and, for each partial image area set by the setting unit, detects a projection indicating a pixel row in which the black pixel exists in the partial image region The length of the projection detected by the detecting means is shorter than a predetermined length or the length extending over the entire height of the partial image area for each of the detecting means and the pairs set at the plurality of locations. If there is a character line projection determining unit that determines that the projection of the character line cannot be specified, and the partial image region that is determined by the character line projection determining unit that the projection of the character line cannot be specified. In the area Determining an acquiring means for acquiring a histogram by counting the number of black pixels in a pixel row, based on the histogram obtained by the acquisition unit, whether or not include the partial image areas character row direction of the ruled line in If the ruled line determining means and the ruled line determining means determine that a ruled line in the character line direction is included in the partial image area , a pixel row whose histogram frequency acquired by the acquiring means is equal to or greater than a predetermined threshold is selected. The two partial image areas detected by the detection means with respect to a pair of partial image areas when it is determined that the projection of the character line can be specified by the specifying means for specifying the projection of the ruled line and the character line projection determining means A correlation between the respective projections is obtained, and it is determined that the projection of the character line cannot be specified by the character line projection determining unit, and a ruled line in the character line direction is determined by the ruled line determining unit. For a pair of partial image areas when determined to be rare, a correlation between the projections of the two partial areas specified by the specifying unit is obtained, and the obtained correlation and an interval between the two partial areas are determined. A local inclination angle calculating means for obtaining an inclination angle based on the character line, and determining that the projection of the character line cannot be specified by the character line projection determining means and determining that the ruled line determination means does not include a ruled line in the character line direction With respect to the pair of partial image areas in the case of being performed, based on the control unit for controlling not to perform the processing in the local tilt angle calculation unit, and the tilt angle calculated by the local tilt angle calculation unit, Determining means for determining the inclination of the document image.

また、本発明は、文書画像の傾きを決定する画像処理装置の画像処理方法であって、前記画像処理装置の設定手段が、横方向に所定距離離れた位置に並んだ2つの部分画像領域を対として、複数の前記対を前記文書画像内の複数箇所それぞれに設定する設定工程と、前記画像処理装置の検出手段が、前記設定工程で設定された部分画像領域ごとに、当該部分領域内で黒画素が存在する画素行を示す射影を検出する検出工程と、前記画像処理装置の文字行射影判定手段が、前記複数箇所に設定された対それぞれに対して、前記検出工程で検出された射影の長さが所定の長さより短いか或いは当該部分画像領域の高さ全体に及ぶ長さである場合は、文字行の射影を特定できないと判定する文字行射影判定工程と、前記画像処理装置の取得手段が、前記文字行射影判定工程で前記文字行の射影が特定できないと判定された部分画像領域に対して、該部分画像領域内の各画素行で黒画素の数をカウントすることによりヒストグラムを取得する取得工程と、前記画像処理装置の罫線判定手段が、前記取得工程で取得したヒストグラムに基づいて、前記部分画像領域内に文字行方向の罫線が含まれるか否かを判定する罫線判定工程と、前記画像処理装置の特定手段が、前記罫線判定工程で前記部分画像領域内に文字行方向の罫線が含まれると判定された場合、前記取得工程で取得したヒストグラムの度数が所定の閾値以上である画素行を罫線の射影として特定する特定工程と、前記画像処理装置の局所的傾き角度算出手段が、前記文字行射影判定工程で前記文字行の射影が特定できたと判定された場合の部分画像領域の対に関しては前記検出工程で検出した前記2つの部分画像領域それぞれの射影の相関関係を求め、前記文字行射影判定工程で前記文字行の射影が特定できないと判定され且つ前記罫線判定工程で文字行方向の罫線が含まれると判定された場合の部分画像領域の対に関しては前記特定工程で特定した前記2つの部分領域それぞれの射影の相関関係を求め、当該求めた相関関係と当該2つの部分領域間の間隔とに基づいて傾き角度を求める局所的傾き角度算出工程と、前記画像処理装置の制御手段が、前記文字行射影判定工程で前記文字行の射影が特定できないと判定され且つ前記罫線判定工程で文字行方向の罫線が含まれないと判定された場合の部分画像領域の対に関しては、前記局所的傾き角度算出工程での処理を行わないように制御する制御工程と、前記画像処理装置の決定手段が、前記局所的傾き角度算出工程で算出された傾き角度に基づいて、前記文書画像の傾きを決定する決定工程とを有することを特徴とする。 The present invention is also an image processing method of an image processing apparatus for determining the inclination of a document image, wherein the setting means of the image processing apparatus extracts two partial image areas arranged at a predetermined distance in the horizontal direction. As a pair, a setting step for setting a plurality of pairs in each of a plurality of locations in the document image, and a detection unit of the image processing apparatus, for each partial image region set in the setting step, in the partial region A detection step of detecting a projection indicating a pixel row in which a black pixel is present, and a projection detected by the character row projection determination unit of the image processing device in the detection step for each of the pairs set in the plurality of locations. A character line projection determining step for determining that the projection of the character line cannot be specified, if the length of the image processing unit is shorter than a predetermined length or is a length extending over the entire height of the partial image region; Acquisition means Acquisition for obtaining a histogram by counting the number of black pixels in each pixel row in the partial image area for which the projection of the character line is determined not to be specified in the character line projection determination step a step, line determination unit of the image processing apparatus, based on the histogram obtained by the obtaining step, a line determination step of determining whether or not include the partial image areas character row direction of the ruled line in the When the specifying unit of the image processing apparatus determines that the ruled line determination step includes a ruled line in the character line direction in the partial image area , a pixel whose histogram frequency acquired in the acquisition step is equal to or greater than a predetermined threshold value a specifying step of specifying the row as the projection borders, local tilt angle calculation means of the image processing apparatus, it is determined that the projection of the character line can be identified by the character line projection determination step For the pair of partial image areas, a correlation between the projections of the two partial image areas detected in the detection step is obtained, and it is determined in the character line projection determination step that the projection of the character line cannot be specified and For the pair of partial image areas when it is determined that the ruled line determination process includes a ruled line in the character line direction, the correlation between the projections of the two partial areas specified in the specific process is obtained, and the obtained correlation And a local inclination angle calculation step for obtaining an inclination angle based on the interval between the two partial areas, and the control means of the image processing apparatus cannot identify the projection of the character line in the character line projection determination step. For the pair of partial image areas when it is determined and the ruled line determining step determines that the ruled line in the character line direction is not included, the processing in the local inclination angle calculating step is performed. And a determination step of determining the inclination of the document image based on the inclination angle calculated in the local inclination angle calculation step. Features.

さらに、本発明は、コンピュータを、横方向に所定距離離れた位置に並んだ2つの部分画像領域を対として、複数の前記対を前記文書画像内の複数箇所それぞれに設定する設定手段と、前記設定手段で設定された部分画像領域ごとに、当該部分画像領域内で黒画素が存在する画素行を示す射影を検出する検出手段と、前記複数箇所に設定された対それぞれに対して、前記検出手段により検出された射影の長さが所定の長さより短いか或いは当該部分画像領域の高さ全体に及ぶ長さである場合は、文字行の射影を特定できないと判定する文字行射影判定手段と、前記文字行射影判定手段で前記文字行の射影が特定できないと判定された部分画像領域に対して、該部分画像領域内の各画素行で黒画素の数をカウントすることによりヒストグラムを取得する取得手段と、前記取得手段で取得したヒストグラムに基づいて、前記部分画像領域内に文字行方向の罫線が含まれるか否かを判定する罫線判定手段と、前記罫線判定手段で前記部分画像領域内に文字行方向の罫線が含まれると判定された場合、前記取得手段で取得したヒストグラムの度数が所定の閾値以上である画素行を罫線の射影として特定する特定手段と、前記文字行射影判定手段で前記文字行の射影が特定できたと判定された場合の部分画像領域の対に関しては前記検出手段で検出した前記2つの部分画像領域それぞれの射影の相関関係を求め、前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれると判定された場合の部分画像領域の対に関しては前記特定手段で特定した前記2つの部分領域それぞれの射影の相関関係を求め、当該求めた相関関係と当該2つの部分領域間の間隔とに基づいて傾き角度を求める局所的傾き角度算出手段と、前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれないと判定された場合の部分画像領域の対に関しては、前記局所的傾き角度算出手段での処理を行わないように制御する制御手段と、前記局所的傾き角度算出手段で算出された傾き角度に基づいて、前記文書画像の傾きを決定する決定手段として機能させるためのプログラムであることを特徴とする。 Further, according to the present invention, there is provided a setting means for setting a plurality of the pairs at a plurality of locations in the document image, with the computer as a pair of two partial image regions arranged at a predetermined distance in the horizontal direction, For each partial image area set by the setting means, detection means for detecting a projection indicating a pixel row in which the black pixel exists in the partial image area, and the detection for each of the pairs set in the plurality of locations A character line projection determining means for determining that the projection of the character line cannot be specified when the length of the projection detected by the means is shorter than a predetermined length or is a length extending over the entire height of the partial image area; A histogram is obtained by counting the number of black pixels in each pixel row in the partial image area for which the projection of the character line is determined not to be specified by the character line projection determining means. Obtaining means, ruled line judging means for judging whether or not a ruled line in the character line direction is included in the partial image area based on the histogram obtained by the obtaining means, and the partial image area by the ruled line judging means If it is determined that a ruled line in the character line direction is included therein, a specifying unit that specifies a pixel line whose histogram frequency acquired by the acquiring unit is equal to or greater than a predetermined threshold as a ruled line projection, and the character line projection determination A correlation between the projections of the two partial image areas detected by the detection means for a pair of partial image areas when it is determined that the projection of the character line can be specified by the means, and the character line projection determination means The partial image area pair when the projection of the character line is determined to be unidentifiable and the ruled line determination means determines that the ruled line in the character line direction is included. A local inclination angle calculating means for obtaining a correlation between the projections of the two partial areas specified by the means and obtaining an inclination angle based on the obtained correlation and an interval between the two partial areas; and the character With respect to the pair of partial image areas when it is determined that the projection of the character line cannot be specified by the line projection determination unit and the ruled line determination unit determines that the ruled line in the character line direction is not included, the local inclination angle A program for causing the processing to be performed as a determination unit that determines the inclination of the document image based on the inclination angle calculated by the local inclination angle calculation unit ; It is characterized by being.

さらにまた、本発明は、上記プログラムを格納したコンピュータ読み取り可能な記憶媒体であることを特徴とする。   Furthermore, the present invention is a computer-readable storage medium storing the above program.

本発明によれば、罫線を含む文書画像に対しても、当該文書画像の傾きを好適に求めることができる。   According to the present invention, it is possible to suitably obtain the inclination of a document image including a ruled line.

以下、図面を参照して、本発明の一実施形態について説明する。   Hereinafter, an embodiment of the present invention will be described with reference to the drawings.

<第1の実施形態>
図1は、本発明の第1の実施形態に係る画像処理装置の構成を示すブロック図である。図1において、101は、ROM102に格納されている制御プログラムに従って本画像処理装置全体の制御を行うCPUである。また、102は、後述するフローチャートに示す処理手順に従ってCPU101が実行する本画像処理装置の制御プログラム等を格納するROMである。さらに、103は、文書画像等を記憶するRAM、104は磁気ディスク等の外部記憶装置である。さらにまた、105はディスプレイ、106はキーボード、107はマウス等のポインティングデバイス、108は紙原稿等から文書画像を読み取るためのスキャナである。
<First Embodiment>
FIG. 1 is a block diagram showing a configuration of an image processing apparatus according to the first embodiment of the present invention. In FIG. 1, reference numeral 101 denotes a CPU that controls the entire image processing apparatus according to a control program stored in the ROM 102. Reference numeral 102 denotes a ROM that stores a control program of the image processing apparatus executed by the CPU 101 in accordance with a processing procedure shown in a flowchart to be described later. Reference numeral 103 denotes a RAM for storing document images and the like, and 104 denotes an external storage device such as a magnetic disk. Furthermore, 105 is a display, 106 is a keyboard, 107 is a pointing device such as a mouse, and 108 is a scanner for reading a document image from a paper document or the like.

さらにまた、上述したCPU101、ROM102、RAM103、外部記憶装置104、ディスプレイ105、スキャナ108は互いにバス110を介して接続されている。   Furthermore, the CPU 101, ROM 102, RAM 103, external storage device 104, display 105, and scanner 108 described above are connected to each other via a bus 110.

尚、上記本実施形態に係る画像処理装置が行う画像処理は、汎用的なコンピュータでも実施可能であり、その場合、記憶媒体等で提供される制御プログラムを外部記憶装置104に記憶させ、オペレータの指示等によりCPU101で実行するように構成してもよい。また、109はネットワークインタフェース(I/F)であり、遠隔地等に存在する情報処理装置等と通信し、プログラムやデータ等を読み込んだり、書き込んだりするためのインタフェースであって、バス110に接続されている。   Note that the image processing performed by the image processing apparatus according to the present embodiment can also be performed by a general-purpose computer. In this case, a control program provided on a storage medium or the like is stored in the external storage device 104 and the operator's It may be configured to be executed by the CPU 101 according to an instruction or the like. Reference numeral 109 denotes a network interface (I / F) that communicates with an information processing apparatus or the like that exists in a remote place, and that reads and writes programs and data, and is connected to the bus 110. Has been.

尚、スキャナ108やディスプレイ105等の装置はバス110に直接接続される構成ではなく、ネットワークI/F109を介して接続されるような構成であってもよい。   The devices such as the scanner 108 and the display 105 may not be directly connected to the bus 110 but may be connected via the network I / F 109.

また、本画像処理装置で処理される画像は、スキャナ108で紙原稿等から光学的に読み取られたもの、或いは外部記憶装置104に保存されているもの、或いは、他の画像入力装置等からネットワークI/F109を介して受信されたもの等を使用することができる。また、そのようにして得られた画像に対して、本実施形態では、公知の技術を用いて、傾きを検出するための検査領域及び検査領域内の文書方向が決定される。例えば、検査領域は、入力された文書画像の余白を除去して決定したり、或いは、文書に関するレイアウト情報からテキスト領域を抽出して決定したりすることができる。   The image processed by the image processing apparatus is an image optically read from a paper document or the like by the scanner 108, an image stored in the external storage device 104, or a network from another image input device or the like. What was received via I / F109 can be used. Further, in the present embodiment, the inspection area for detecting the tilt and the document direction in the inspection area are determined for the image obtained in this manner using a known technique. For example, the inspection area can be determined by removing margins of the input document image, or can be determined by extracting a text area from layout information about the document.

図2は、第1の実施形態に係る画像処理装置による検査領域内から入力画像の傾きを検出するための処理手順を説明するためのフローチャートである。まず、公知の技術を用いて決定された文書画像内の検査領域に対して、当該検査領域内に存在する文字行等の局所的傾きを検知するための検知位置を決定する(ステップS201)。例えば、検知位置は、検査領域全体に等間隔に分布させたり、乱数を用いて全体にばらつくようにする。   FIG. 2 is a flowchart for explaining a processing procedure for detecting the inclination of the input image from the inspection area by the image processing apparatus according to the first embodiment. First, a detection position for detecting a local inclination of a character line or the like existing in the inspection area is determined for the inspection area in the document image determined using a known technique (step S201). For example, the detection positions are distributed at equal intervals over the entire inspection region, or are varied using random numbers.

次に、ステップS201で決定した検知位置に、あらかじめ大きさの決まった検知窓を設定する(ステップS202)。尚、本実施形態では、一例として、矩形状の部分画像領域を検知窓として使用する。設定される検知窓は、文書方向に応じて向きが決められる。   Next, a detection window having a predetermined size is set at the detection position determined in step S201 (step S202). In this embodiment, as an example, a rectangular partial image region is used as a detection window. The direction of the detection window to be set is determined according to the document direction.

また、ステップS202で設定された検知窓と対になる検知窓を当該文書画像上の行方向の所定距離だけ離れた位置に設定する(ステップS203)。そして、検査領域内に設定されたそれぞれの検知窓について行方向の射影をそれぞれ取得する(ステップS204)。ここで、射影とは、検知窓内の各画素を行方向にスキャンし、黒画素(文字部分を構成する画素)が存在すればその行は射影ありと判断するものである。その結果、検知窓内に存在する文字行の高さが射影として得られる。   In addition, the detection window that is paired with the detection window set in step S202 is set to a position that is separated by a predetermined distance in the row direction on the document image (step S203). Then, projections in the row direction are obtained for the respective detection windows set in the inspection area (step S204). Here, the projection means that each pixel in the detection window is scanned in the row direction, and if there is a black pixel (a pixel constituting the character portion), it is determined that the row is projected. As a result, the height of the character line existing in the detection window is obtained as a projection.

図4は、検知窓内の文字から得られる行方向の射影を説明するための図である。図4において、401はステップS202で検査領域内に設定された検知窓の初期状態であり、402は取得された射影の一例を示している。ここで、検知窓内の各画素を行方向にスキャンし、文字を構成する画素(例えば、黒画素)が存在する画素行は射影があるとすることにより、検知窓内に存在する文字行の高さが射影として得られる。   FIG. 4 is a diagram for explaining projection in the row direction obtained from characters in the detection window. In FIG. 4, 401 is an initial state of the detection window set in the inspection area in step S202, and 402 shows an example of the acquired projection. Here, each pixel in the detection window is scanned in the row direction, and a pixel row in which a pixel (for example, a black pixel) constituting the character exists is projected, so that the character row existing in the detection window Height is obtained as a projection.

そして、取得された射影から検知窓内に行射影が特定可能なように含まれているか否かを判定する(ステップS205)。ここで、検知窓内に文字行が適切に(特定可能なように)含まれている場合には、当該文字行の高さ分のみの射影が検知される。しかし、射影が当該検知窓内に存在しなかったり、その長さが短かったり、或いは文字行に垂直な方向の罫線の存在によって検知窓の高さ全体に及ぶ長さだったりして、文字行の高さ分の射影の特定ができないような場合がある。そこで、本実施形態では、そのような不適切な射影が検知された場合には、行射影を含まない(すなわち、特定することができない)と判定することとする。   Then, it is determined whether or not a line projection is included in the detection window so as to be specified from the acquired projection (step S205). Here, when a character line is appropriately included in the detection window (so that it can be specified), a projection corresponding to the height of the character line is detected. However, if the projection does not exist in the detection window, its length is short, or the length of the detection window extends to the entire height of the detection window due to the presence of ruled lines in the direction perpendicular to the character line, In some cases, it is not possible to specify the projection of the height of. Therefore, in the present embodiment, when such an inappropriate projection is detected, it is determined that the line projection is not included (that is, cannot be specified).

その結果、ステップS205において検知窓内に行射影が含まれると判定された場合(Yes)はステップS209に進む。そして、一方の検知窓を固定し、もう一方の検知窓を行方向と垂直方向にずらしていき、それぞれの検知窓について取得された文字行の行方向の射影の相関が最大となるずれ量を求める(ステップS209)。その結果、最大相関時のずれ量と2つの検知窓の間隔から局所的傾き角を求める(ステップS210)。そして、求めた角度を記憶する(ステップS211)。   As a result, when it is determined in step S205 that the line projection is included in the detection window (Yes), the process proceeds to step S209. Then, one detection window is fixed, the other detection window is shifted in the vertical direction with respect to the line direction, and the amount of deviation that maximizes the correlation between the projections in the line direction of the character lines acquired for each detection window is determined. Obtained (step S209). As a result, the local inclination angle is obtained from the amount of deviation at the time of maximum correlation and the interval between the two detection windows (step S210). Then, the obtained angle is stored (step S211).

図6は、第1の実施形態に係る画像処理装置における検知窓の射影の相関を説明するための図である。図6(a)において、601aは設定された1つ目の検知窓、602aは検知窓601a内の射影である。同様に、601bは検知窓601aの対として設定された2つ目の検知窓、602bは検知窓601b内の射影である。また、図6(b)は、固定した検知窓607に対して、上下にずらす検知窓604とその相関の大きさをグラフ605に示したものである。ここで、相関が最大の時のずれ量tと、検知窓の距離dとを用いて、傾斜角θは、tanθ=t/dの関係になる。尚、tの上へのずれを正、下へのずれを負とすると、符号でどちらに傾いているかを判別することができる。   FIG. 6 is a diagram for explaining the correlation of the projection of the detection window in the image processing apparatus according to the first embodiment. In FIG. 6A, 601a is a set first detection window, and 602a is a projection in the detection window 601a. Similarly, 601b is a second detection window set as a pair of detection windows 601a, and 602b is a projection in the detection window 601b. FIG. 6B is a graph 605 showing the detection window 604 shifted up and down with respect to the fixed detection window 607 and the magnitude of the correlation. Here, the inclination angle θ has a relationship of tan θ = t / d using the shift amount t when the correlation is maximum and the distance d of the detection window. Note that if the shift upward to t is positive and the shift downward is negative, it is possible to determine which is inclined by the sign.

一方、ステップS205において検知窓内に行射影が含まれないと判定された場合(No)は、検知窓内の行方向の文字や罫線等を構成する画素(すなわち、背景画素ではない画素)をカウントしたヒストグラムを取得する(ステップS206)。そして、取得されたヒストグラムから当該検知窓内に表等による文字行方向の罫線が含まれるか否かを判定する(ステップS207)。尚、検知窓内に罫線が含まれるか否かについては、例えば、検知窓の横方向の全体或いは大部分について黒画素(すなわち、文書画像中において罫線を構成する画素)が検出された場合は文字行方向の罫線が含まれると判定するようにする。   On the other hand, if it is determined in step S205 that the line projection is not included in the detection window (No), the pixels constituting the line-direction characters and ruled lines in the detection window (that is, pixels that are not background pixels) are displayed. The counted histogram is acquired (step S206). Then, it is determined from the acquired histogram whether or not a ruled line in the character line direction such as a table is included in the detection window (step S207). Whether or not a ruled line is included in the detection window is determined when, for example, black pixels (that is, pixels constituting the ruled line in the document image) are detected for all or most of the horizontal direction of the detection window. It is determined that a ruled line in the character line direction is included.

その結果、文字行方向の罫線が含まれていないと判定された場合(No)は、当該検知窓を用いての傾き検出処理を終了し、ステップS212に進む。一方、文字行方向の罫線が含まれていると判定された場合(Yes)は、次のような処理を行って文字行方向の罫線部分のみの射影部分を取得する(ステップS208)。   As a result, when it is determined that the ruled line in the character line direction is not included (No), the inclination detection process using the detection window ends, and the process proceeds to step S212. On the other hand, if it is determined that the ruled line in the character line direction is included (Yes), the following processing is performed to obtain a projected part of only the ruled line part in the character line direction (step S208).

図5は、検知窓内の行方向のヒストグラムから取得した射影情報を説明するための図である。図5において、501は文書画像上の罫線部分に設定された検知窓、502は検知窓501内の行方向のヒストグラムである。また、503は検知窓501の幅から決定されたヒストグラム502に対して文字行方向の罫線部分を判定するためのしきい値であり、本実施形態ではしきい値503以上の度数を有する部分に文字行方向の罫線が存在するものとする。   FIG. 5 is a diagram for explaining the projection information acquired from the histogram in the row direction in the detection window. In FIG. 5, reference numeral 501 denotes a detection window set in a ruled line portion on the document image, and 502 denotes a histogram in the row direction in the detection window 501. Reference numeral 503 denotes a threshold value for determining a ruled line portion in the character line direction with respect to the histogram 502 determined from the width of the detection window 501. In this embodiment, the threshold value 503 is a portion having a frequency equal to or higher than the threshold value 503. It is assumed that there is a ruled line in the character line direction.

一方、504は検知窓501の幅や当該検知窓501内のヒストグラムの度数から決定された文字行方向の罫線についての射影のしきい値であり、しきい値504以上の度数のある部分を文字行方向の罫線による射影部分として取得する。例えば、しきい値504は、検知窓内における文字行方向の射影のうち、しきい値503とヒストグラムの度数とから定められる。そして、当該ヒストグラムのうちしきい値504以上の度数を有する文字行方向の射影部分を、文字行方向の罫線の射影として特定する。或いは、しきい値503の値に係数を乗算して決定したり、しきい値503以上の部分の射影を上下に所定長だけ延長することによって射影を決定するようにしてもよい。このように、本実施形態では、検知窓内の射影及びヒストグラムから求めた射影情報を使用して文字行や文書画像の傾きを算出するものである。   On the other hand, reference numeral 504 denotes a projection threshold for the ruled line in the character line direction determined from the width of the detection window 501 and the frequency of the histogram in the detection window 501, and a portion having a frequency equal to or higher than the threshold 504 Acquired as a projection part by ruled lines in the row direction. For example, the threshold value 504 is determined from the threshold value 503 and the histogram frequency in the projection in the character line direction within the detection window. Then, a projected portion in the character line direction having a frequency equal to or higher than the threshold value 504 in the histogram is specified as a ruled line projection in the character line direction. Alternatively, the projection may be determined by multiplying the value of the threshold value 503 by a coefficient, or by extending the projection of the portion above the threshold value 503 by a predetermined length. As described above, in this embodiment, the inclination of the character line and the document image is calculated using the projection information in the detection window and the projection information obtained from the histogram.

そして、一方の検知窓を固定し、もう一方の検知窓を行方向と垂直方向にずらしていき、それぞれの検知窓について取得された文字行方向の罫線による射影の相関が最大となるずれ量を求める(ステップS209)。その結果、最大相関時のずれ量と2つの検知窓の間隔から局所的傾き角を求める(ステップS210)。そして、求めた角度を記憶する(ステップS211)。尚、両検知窓から求めた文字行方向の罫線による射影の相関からの文書画像の傾きの算出容量については、図6を用いて上述した文字行の射影の相関からの文書画像の傾きの算出容量と同様である。   Then, one detection window is fixed, and the other detection window is shifted in the vertical direction with respect to the line direction, and the amount of deviation that maximizes the correlation of projections with the ruled lines in the line direction obtained for each detection window is determined. Obtained (step S209). As a result, the local inclination angle is obtained from the amount of deviation at the time of maximum correlation and the interval between the two detection windows (step S210). Then, the obtained angle is stored (step S211). The calculation capacity of the inclination of the document image from the correlation of the projection by the ruled line in the character line direction obtained from both detection windows is calculated from the correlation of the projection of the character line described above with reference to FIG. It is the same as the capacity.

そして、全ての検知位置での傾斜角を求めたか否かを判定する(ステップS212)。その結果、まだ傾斜角を求めていない検出位置が残っている場合(No)は、ステップS201に再び戻って、次の検出位置について上述したステップS201〜S211の処理を繰り返す。一方、全て検出された場合(Yes)は、記憶された局所的傾斜角から入力画像の傾き角度を決定する(ステップS213)。例えば、全ての傾斜角の平均値や中央値等を用いることによって、それらを決定することができる。   Then, it is determined whether or not the inclination angles at all detection positions have been obtained (step S212). As a result, when the detection position for which the inclination angle has not yet been obtained remains (No), the process returns to step S201 again, and the processes of steps S201 to S211 described above are repeated for the next detection position. On the other hand, when all are detected (Yes), the inclination angle of the input image is determined from the stored local inclination angle (step S213). For example, they can be determined by using the average value or median value of all inclination angles.

尚、上記各ステップの処理において傾きを得ることができなくなった場合、例えば、適切な射影が得られなかったり、相関が不十分だったりした場合は、その検知窓での局所的傾斜角は求めないで、次の検知位置を使用するようにすればよい。また、ステップS213で記憶された局所的傾斜角が少ない場合は、精度が期待できないとし、入力画像の傾き角度が求まらなかったと判断するようにしてもよい。   In addition, when it becomes impossible to obtain an inclination in the processing of each step described above, for example, when an appropriate projection cannot be obtained or the correlation is insufficient, the local inclination angle in the detection window is obtained. Instead, the next detection position may be used. Further, when the local tilt angle stored in step S213 is small, it may be determined that the accuracy cannot be expected and the tilt angle of the input image has not been obtained.

以上説明したように、本実施形態に係る画像処理装置による画像処理によって、表等の縦方向及び横方向に罫線を含むような文書画像に対しても、文字行の射影及び罫線の射影を用いてその傾きを適切かつ高精度で求めることができる。   As described above, the projection of the character line and the projection of the ruled line are used for the document image including the ruled line in the vertical direction and the horizontal direction of the table or the like by the image processing by the image processing apparatus according to the present embodiment. The inclination can be obtained with appropriate and high accuracy.

尚、上記実施形態では、本発明の技術的思想を実施するための最小限の構成要件で説明を行っているが、例えば汎用コンピュータに対して、本発明を実施する処理を行う画像処理プログラム等のデータを外部から提供し、或いは、あらかじめ外部記憶装置107に記憶しておき、RAM103に格納するように構成されてもよい。また、あらかじめ外部記憶装置107に記憶した入力画像を処理するように構成されてもよい。   In the above-described embodiment, the description is given with the minimum configuration requirements for implementing the technical idea of the present invention. However, for example, an image processing program for performing processing for implementing the present invention on a general-purpose computer, etc. The data may be provided from the outside, or may be stored in advance in the external storage device 107 and stored in the RAM 103. Further, an input image stored in advance in the external storage device 107 may be processed.

<第2の実施形態>
次に、図1に示す画像処理装置と同様の画像処理装置が実行する別の実施形態について説明する。図3は、第2の実施形態に係る画像処理装置による検査領域内から文書画像の傾きを検出するための処理手順を説明するためのフローチャートである。
<Second Embodiment>
Next, another embodiment executed by an image processing apparatus similar to the image processing apparatus shown in FIG. 1 will be described. FIG. 3 is a flowchart for explaining a processing procedure for detecting the inclination of the document image from the inspection area by the image processing apparatus according to the second embodiment.

まず、文書画像内の公知の技術を用いて決定された検査領域に対して、第1の実施形態と同様に、当該検査領域内に存在する文字行等の局所的傾きを検知するための検知位置を決定する(ステップS301)。例えば、検知位置は、検査領域全体に等間隔に分布させたり、乱数を用いて全体にばらつくようにする。   First, for the inspection area determined using a known technique in the document image, detection for detecting a local inclination of a character line or the like existing in the inspection area as in the first embodiment. The position is determined (step S301). For example, the detection positions are distributed at equal intervals over the entire inspection region, or are varied using random numbers.

次に、ステップS301で決定した検知位置に、あらかじめ大きさの決まった検知窓を設定する(ステップS302)。尚、本実施形態では、一例として、矩形状の部分画像領域を検知窓として使用する。そして、第1の実施形態と同様に、ステップS302で設定された検知窓と対になる検知窓を文書画像上の行方向の所定距離だけ離れた位置に設定する(ステップS303)。   Next, a detection window having a predetermined size is set at the detection position determined in step S301 (step S302). In this embodiment, as an example, a rectangular partial image region is used as a detection window. Then, as in the first embodiment, the detection window that is paired with the detection window set in step S302 is set at a position separated by a predetermined distance in the row direction on the document image (step S303).

次いで、設置された検知窓について、第1の実施形態と同様に、行方向のヒストグラムを取得する(ステップS304)。そして、第1の実施形態と同様に、そのヒストグラムから当該検知窓内に文字行方向の罫線が含まれるか否かを判定する(ステップS305)。その結果、文字行方向の罫線が含まれていると判定された場合(Yes)は、第1の実施形態と同様に、当該文字行方向の罫線部分の射影を取得し(ステップS306)、それぞれの検知窓について取得された文字行方向の罫線による射影の相関が最大となるずれ量を求める(ステップS308)。   Next, as in the first embodiment, a histogram in the row direction is acquired for the installed detection window (step S304). Then, similarly to the first embodiment, it is determined from the histogram whether or not a ruled line in the character line direction is included in the detection window (step S305). As a result, when it is determined that the ruled line in the character line direction is included (Yes), the projection of the ruled line part in the character line direction is acquired (step S306), respectively, as in the first embodiment. The amount of deviation that maximizes the correlation of projections with the ruled lines in the character line direction obtained for the detection window is obtained (step S308).

一方、ステップS305において、文字行方向の罫線が含まれていないと判定された場合は、ステップS204と同様に、それぞれの検知窓内の行方向の射影を取得し(ステップS307)、それぞれの検知窓について取得された文字行の行方向の射影の相関が最大となるずれ量を求める(ステップS308)。   On the other hand, if it is determined in step S305 that the ruled line in the character line direction is not included, the projection in the line direction in each detection window is acquired (step S307), as in step S204. A deviation amount that maximizes the correlation of the projection in the line direction of the character line acquired for the window is obtained (step S308).

ステップS308で両検知窓の射影の相関が最大となるずれ量を求めた後、第1の実施形態と同様にして、最大相関時のずれ量と2つの検知窓の間隔から局所的傾き角を求める(ステップS309)。そして、ステップS211と同様に、求めた角度を記憶する(ステップS310)。   In step S308, after obtaining the deviation amount that maximizes the correlation between the projections of both detection windows, the local inclination angle is calculated from the deviation amount at the time of the maximum correlation and the interval between the two detection windows in the same manner as in the first embodiment. Obtained (step S309). Then, as with step S211, the obtained angle is stored (step S310).

そして、全ての検知位置での傾斜角を求めたか否かを判定する(ステップS311)。その結果、まだ傾斜角を求めていない検出位置が残っている場合(No)はステップS301に再び戻って、次の検出位置について上述したステップS301〜S310の処理を繰り返す。一方、全て検出された場合(Yes)は、記憶された局所的傾斜角から入力画像の傾き角度を決定する(ステップS312)。例えば、全ての傾斜角の平均値や中央値等を用いることによって、それらを決定することができる。   Then, it is determined whether or not the inclination angles at all detection positions have been obtained (step S311). As a result, when the detection position for which the inclination angle has not yet been obtained remains (No), the process returns to step S301 again, and the processes of steps S301 to S310 described above are repeated for the next detection position. On the other hand, if all are detected (Yes), the inclination angle of the input image is determined from the stored local inclination angle (step S312). For example, they can be determined by using the average value or median value of all inclination angles.

以上説明したように、第2の実施形態に係る画像処理装置を用いた場合であっても、第1の実施形態と同様に、表等の縦方向及び横方向に罫線を含むような文書画像に対しても、文字行の射影及び罫線の射影を用いてその傾きを適切かつ高精度で求めることができる。   As described above, even when the image processing apparatus according to the second embodiment is used, a document image including ruled lines in the vertical direction and the horizontal direction of a table or the like as in the first embodiment. Also, the inclination can be determined appropriately and with high accuracy using the projection of the character line and the projection of the ruled line.

<その他の実施形態>
図7は、本発明に係る画像処理装置で読み出し可能な各種データ処理プログラムを格納する記憶媒体のメモリマップの一例を説明するための図である。すなわち、図1に示す画像処理装置に対して図7に示すようなプログラムを記憶させ、当該装置を使用するユーザ等によって選択的に、第1の実施形態で説明した処理を行うようにしてもよいし、第2の実施形態で説明した処理を行うようにしてもよい。
<Other embodiments>
FIG. 7 is a diagram for explaining an example of a memory map of a storage medium that stores various data processing programs that can be read by the image processing apparatus according to the present invention. That is, a program as shown in FIG. 7 is stored in the image processing apparatus shown in FIG. 1, and the process described in the first embodiment is selectively performed by a user who uses the apparatus. Alternatively, the processing described in the second embodiment may be performed.

また、上述した各実施形態においては、どちらの検知窓を固定してどちらの検知窓をずらすようにしてもよい。   Moreover, in each embodiment mentioned above, which detection window may be fixed and which detection window may be shifted.

尚、上述した実施形態において、罫線の幅が細いような場合、文書画像の傾斜の度合いによっては行方向に十分な画素の累積値(ヒストグラム)がとれない可能性がある。そこで、上述したヒストグラムをとる処理の前に検知窓内の文字や罫線を構成する各画素の膨張処理を行うようにしてもよい。この処理は、たとえ文字部分に膨張処理を行っても、それによってヒストグラムの形状に与える影響は、罫線部分がより高い累積値で得られる効果に比べて低いと考えられるため、効果的である。   In the embodiment described above, when the width of the ruled line is small, there is a possibility that a sufficient accumulated value (histogram) of pixels in the row direction cannot be obtained depending on the degree of inclination of the document image. Therefore, the dilation processing of each pixel constituting the character or ruled line in the detection window may be performed before the above-described processing of taking the histogram. This process is effective even if the expansion process is performed on the character portion, because the influence on the shape of the histogram is considered to be lower than the effect obtained by the ruled line portion with a higher cumulative value.

以上、実施形態例を詳述したが、本発明は、例えば、システム、装置、方法、プログラム若しくは記憶媒体等としての実施態様をとることが可能であり、具体的には、複数の機器から構成されるシステムに適用しても良いし、また、一つの機器からなる装置に適用しても良い。   As described above, the embodiment has been described in detail. However, the present invention can take an embodiment as a system, apparatus, method, program, storage medium, or the like, and specifically includes a plurality of devices. The present invention may be applied to a system that is configured, or may be applied to an apparatus that includes a single device.

尚、本発明は、前述した実施形態の機能を実現するソフトウェアのプログラム(実施形態では図に示すフローチャートに対応したプログラム)を、システムあるいは装置に直接あるいは遠隔から供給し、そのシステムあるいは装置のコンピュータが該供給されたプログラムコードを読み出して実行することによっても達成される場合を含む。   In the present invention, a software program (in the embodiment, a program corresponding to the flowchart shown in the drawing) that realizes the functions of the above-described embodiment is directly or remotely supplied to the system or apparatus, and the computer of the system or apparatus Is also achieved by reading and executing the supplied program code.

従って、本発明の機能処理をコンピュータで実現するために、該コンピュータにインストールされるプログラムコード自体も本発明を実現するものである。つまり、本発明は、本発明の機能処理を実現するためのコンピュータプログラム自体も含まれる。   Accordingly, since the functions of the present invention are implemented by computer, the program code installed in the computer also implements the present invention. In other words, the present invention includes a computer program itself for realizing the functional processing of the present invention.

その場合、プログラムの機能を有していれば、オブジェクトコード、インタプリタにより実行されるプログラム、OSに供給するスクリプトデータ等の形態であっても良い。   In that case, as long as it has the function of a program, it may be in the form of object code, a program executed by an interpreter, script data supplied to the OS, or the like.

プログラムを供給するための記録媒体としては、例えば、フロッピー(登録商標)ディスク、ハードディスク、光ディスク、光磁気ディスク、MO、CD−ROM、CD−R、CD−RW、磁気テープ、不揮発性のメモリカード、ROM、DVD(DVD−ROM,DVD−R)などがある。   As a recording medium for supplying the program, for example, floppy (registered trademark) disk, hard disk, optical disk, magneto-optical disk, MO, CD-ROM, CD-R, CD-RW, magnetic tape, nonvolatile memory card ROM, DVD (DVD-ROM, DVD-R) and the like.

その他、プログラムの供給方法としては、クライアントコンピュータのブラウザを用いてインターネットのホームページに接続し、該ホームページから本発明のコンピュータプログラムそのもの、もしくは圧縮され自動インストール機能を含むファイルをハードディスク等の記録媒体にダウンロードすることによっても供給できる。また、本発明のプログラムを構成するプログラムコードを複数のファイルに分割し、それぞれのファイルを異なるホームページからダウンロードすることによっても実現可能である。つまり、本発明の機能処理をコンピュータで実現するためのプログラムファイルを複数のユーザに対してダウンロードさせるWWWサーバも、本発明に含まれるものである。   As another program supply method, a client computer browser is used to connect to an Internet homepage, and the computer program of the present invention itself or a compressed file including an automatic installation function is downloaded from the homepage to a recording medium such as a hard disk. Can also be supplied. It can also be realized by dividing the program code constituting the program of the present invention into a plurality of files and downloading each file from a different homepage. That is, the present invention includes a WWW server that allows a plurality of users to download a program file for realizing the functional processing of the present invention on a computer.

また、本発明のプログラムを暗号化してCD−ROM等の記憶媒体に格納してユーザに配布し、所定の条件をクリアしたユーザに対し、インターネットを介してホームページから暗号化を解く鍵情報をダウンロードさせ、その鍵情報を使用することにより暗号化されたプログラムを実行してコンピュータにインストールさせて実現することも可能である。   In addition, the program of the present invention is encrypted, stored in a storage medium such as a CD-ROM, distributed to users, and key information for decryption is downloaded from a homepage via the Internet to users who have cleared predetermined conditions. It is also possible to execute the encrypted program by using the key information and install the program on a computer.

また、コンピュータが、読み出したプログラムを実行することによって、前述した実施形態の機能が実現される他、そのプログラムの指示に基づき、コンピュータ上で稼動しているOSなどが、実際の処理の一部または全部を行い、その処理によっても前述した実施形態の機能が実現され得る。   In addition to the functions of the above-described embodiments being realized by the computer executing the read program, the OS running on the computer based on the instruction of the program is a part of the actual processing. Alternatively, the functions of the above-described embodiment can be realized by performing all of the processes.

さらに、記録媒体から読み出されたプログラムが、コンピュータに挿入された機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに書き込まれた後、そのプログラムの指示に基づき、その機能拡張ボードや機能拡張ユニットに備わるCPUなどが実際の処理の一部または全部を行い、その処理によっても前述した実施形態の機能が実現される。   Furthermore, after the program read from the recording medium is written in a memory provided in a function expansion board inserted into the computer or a function expansion unit connected to the computer, the function expansion board or The CPU or the like provided in the function expansion unit performs part or all of the actual processing, and the functions of the above-described embodiments are realized by the processing.

本発明の第1の実施形態に係る画像処理装置の構成を示すブロック図である。1 is a block diagram illustrating a configuration of an image processing apparatus according to a first embodiment of the present invention. 第1の実施形態に係る画像処理装置による検査領域内から入力画像の傾きを検出するための処理手順を説明するためのフローチャートである。It is a flowchart for demonstrating the process sequence for detecting the inclination of an input image from the test | inspection area | region by the image processing apparatus which concerns on 1st Embodiment. 第2の実施形態に係る画像処理装置による検査領域内から文書画像の傾きを検出するための処理手順を説明するためのフローチャートである。10 is a flowchart for explaining a processing procedure for detecting a tilt of a document image from within an inspection area by an image processing apparatus according to a second embodiment. 検知窓内の文字から得られる行方向の射影を説明するための図である。It is a figure for demonstrating the projection of the line direction obtained from the character in a detection window. 検知窓内の行方向のヒストグラムから取得した射影情報を説明するための図である。It is a figure for demonstrating the projection information acquired from the histogram of the row direction in a detection window. 第1の実施形態に係る画像処理装置における検知窓の射影の相関を説明するための図である。It is a figure for demonstrating the correlation of the projection of the detection window in the image processing apparatus which concerns on 1st Embodiment. 本発明に係る画像処理装置で読み出し可能な各種データ処理プログラムを格納する記憶媒体のメモリマップの一例を説明するための図である。It is a figure for demonstrating an example of the memory map of the storage medium which stores the various data processing program which can be read with the image processing apparatus which concerns on this invention.

符号の説明Explanation of symbols

101 CPU
102 ROM
103 RAM
104 外部記憶装置
105 ディスプレイ
106 キーボード
107 ポインティングデバイス
108 スキャナ
109 ネットワークインタフェース
110 バス
101 CPU
102 ROM
103 RAM
104 External storage device 105 Display 106 Keyboard 107 Pointing device 108 Scanner 109 Network interface 110 Bus

Claims (8)

入力された文書画像の傾きを決定する画像処理装置であって、
横方向に所定距離離れた位置に並んだ2つの部分画像領域を対として、複数の前記対を前記文書画像内の複数箇所それぞれに設定する設定手段と、
前記設定手段で設定された部分画像領域ごとに、当該部分画像領域内で黒画素が存在する画素行を示す射影を検出する検出手段と、
前記複数箇所に設定された対それぞれに対して、前記検出手段により検出された射影の長さが所定の長さより短いか或いは当該部分画像領域の高さ全体に及ぶ長さである場合は、文字行の射影を特定できないと判定する文字行射影判定手段と、
前記文字行射影判定手段で前記文字行の射影が特定できないと判定された部分画像領域に対して、該部分画像領域内の各画素行で黒画素の数をカウントすることによりヒストグラムを取得する取得手段と、
前記取得手段で取得したヒストグラムに基づいて、前記部分画像領域内に文字行方向の罫線が含まれるか否かを判定する罫線判定手段と、
前記罫線判定手段で前記部分画像領域内に文字行方向の罫線が含まれると判定された場合、前記取得手段で取得したヒストグラムの度数が所定の閾値以上である画素行を罫線の射影として特定する特定手段と、
前記文字行射影判定手段で前記文字行の射影が特定できたと判定された場合の部分画像領域の対に関しては前記検出手段で検出した前記2つの部分画像領域それぞれの射影の相関関係を求め、前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれると判定された場合の部分画像領域の対に関しては前記特定手段で特定した前記2つの部分領域それぞれの射影の相関関係を求め、当該求めた相関関係と当該2つの部分領域間の間隔とに基づいて傾き角度を求める局所的傾き角度算出手段と、
前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれないと判定された場合の部分画像領域の対に関しては、前記局所的傾き角度算出手段での処理を行わないように制御する制御手段と、
前記局所的傾き角度算出手段で算出された傾き角度に基づいて、前記文書画像の傾きを決定する決定手段と
を備えることを特徴とする画像処理装置。
An image processing apparatus for determining an inclination of an input document image,
A setting means for setting a plurality of the pairs in each of a plurality of locations in the document image, with two partial image areas arranged at a predetermined distance in the horizontal direction as a pair ;
For each partial image area set by the setting means, detecting means for detecting a projection indicating a pixel row in which black pixels exist in the partial image area ;
For each of the pairs set in the plurality of places, if the length of the projection detected by the detection means is shorter than a predetermined length or the length extending over the entire height of the partial image area, A character line projection judging means for judging that the projection of the line cannot be specified;
Acquisition for obtaining a histogram by counting the number of black pixels in each pixel row in the partial image area for which the projection of the character line is determined not to be specified by the character line projection determining means Means,
Based on the histogram obtained by the obtaining unit, a line determination means for determining whether or not include the partial image area in the character line direction of the ruled line,
When it is determined by the ruled line determination means that a ruled line in the character line direction is included in the partial image area , a pixel line whose histogram frequency acquired by the acquisition means is equal to or greater than a predetermined threshold is specified as a ruled line projection . Specific means,
For the pair of partial image areas when it is determined that the projection of the character line can be specified by the character line projection determination means, the correlation between the projections of the two partial image areas detected by the detection means is obtained, A pair of partial image areas when the projection of the character line is determined not to be specified by the character line projection determination unit and the ruled line determination unit determines that the ruled line in the character line direction is included is specified by the specification unit. A local inclination angle calculation means for obtaining a correlation between the projections of the two partial areas and obtaining an inclination angle based on the obtained correlation and an interval between the two partial areas;
Regarding the pair of partial image areas when it is determined by the character line projection determining means that the projection of the character line cannot be specified and the ruled line determining means determines that the ruled line in the character line direction is not included, Control means for controlling so as not to perform processing in the tilt angle calculation means;
An image processing apparatus comprising: a determination unit that determines the inclination of the document image based on the inclination angle calculated by the local inclination angle calculation unit .
前記罫線判定手段、前記部分画像領域の幅に基づいて定められたしきい値と前記取得手段で取得したヒストグラムの度数とを比較することにより、該部分画像領域内に文字行方向の罫線が含まれるか否かを判定することを特徴とする請求項に記載の画像処理装置。 The line determination unit, by comparing the frequency of the histogram obtained by the partial image area threshold and the acquisition means is determined based on the width of the character row direction of the ruled line to the partial image area The image processing apparatus according to claim 1 , wherein it is determined whether or not it is included. 前記局所的傾き角度算出手段は、前記2つの部分画像領域の一方を固定し他方を垂直移動させて、それぞれの部分画像領域から検出された射影の相関を取得し、該相関が最大となるときのそれぞれの部分画像領域の位置関係と、前記間隔とに基づいて、前記傾き角度を求めることを特徴とする請求項1又は2に記載の画像処理装置。 When the local inclination angle calculation means acquires one of the two partial image areas and vertically moves the other to obtain a correlation of projections detected from the respective partial image areas, and the correlation is maximized. of the positional relationship between the respective partial image region, on the basis of said distance, the image processing apparatus according to claim 1 or 2, characterized in that determining said tilt angle. 文書画像の傾きを決定する画像処理装置の画像処理方法であって、
前記画像処理装置の設定手段が、横方向に所定距離離れた位置に並んだ2つの部分画像領域を対として、複数の前記対を前記文書画像内の複数箇所それぞれに設定する設定工程と、
前記画像処理装置の検出手段が、前記設定工程で設定された部分画像領域ごとに、当該部分領域内で黒画素が存在する画素行を示す射影を検出する検出工程と、
前記画像処理装置の文字行射影判定手段が、前記複数箇所に設定された対それぞれに対して、前記検出工程で検出された射影の長さが所定の長さより短いか或いは当該部分画像領域の高さ全体に及ぶ長さである場合は、文字行の射影を特定できないと判定する文字行射影判定工程と、
前記画像処理装置の取得手段が、前記文字行射影判定工程で前記文字行の射影が特定できないと判定された部分画像領域に対して、該部分画像領域内の各画素行で黒画素の数をカウントすることによりヒストグラムを取得する取得工程と、
前記画像処理装置の罫線判定手段が、前記取得工程で取得したヒストグラムに基づいて、前記部分画像領域内に文字行方向の罫線が含まれるか否かを判定する罫線判定工程と、
前記画像処理装置の特定手段が、前記罫線判定工程で前記部分画像領域内に文字行方向の罫線が含まれると判定された場合、前記取得工程で取得したヒストグラムの度数が所定の閾値以上である画素行を罫線の射影として特定する特定工程と、
前記画像処理装置の局所的傾き角度算出手段が、前記文字行射影判定工程で前記文字行の射影が特定できたと判定された場合の部分画像領域の対に関しては前記検出工程で検出した前記2つの部分画像領域それぞれの射影の相関関係を求め、前記文字行射影判定工程で前記文字行の射影が特定できないと判定され且つ前記罫線判定工程で文字行方向の罫線が含まれると判定された場合の部分画像領域の対に関しては前記特定工程で特定した前記2つの部分領域それぞれの射影の相関関係を求め、当該求めた相関関係と当該2つの部分領域間の間隔とに基づいて傾き角度を求める局所的傾き角度算出工程と、
前記画像処理装置の制御手段が、前記文字行射影判定工程で前記文字行の射影が特定できないと判定され且つ前記罫線判定工程で文字行方向の罫線が含まれないと判定された場合の部分画像領域の対に関しては、前記局所的傾き角度算出工程での処理を行わないように制御する制御工程と、
前記画像処理装置の決定手段が、前記局所的傾き角度算出工程で算出された傾き角度に基づいて、前記文書画像の傾きを決定する決定工程と
を有することを特徴とする画像処理方法。
An image processing method of an image processing apparatus for determining the inclination of a document image,
A setting step in which the setting unit of the image processing apparatus sets a plurality of the pairs in each of a plurality of locations in the document image, with two partial image regions arranged at a predetermined distance in the horizontal direction as a pair ;
A detecting step for detecting, for each partial image region set in the setting step, a projection indicating a pixel row in which the black pixel exists in the partial region ;
The character line projection determining means of the image processing apparatus may detect that the length of the projection detected in the detection step is shorter than a predetermined length or the height of the partial image region for each of the pairs set at the plurality of locations. If the length extends over the entire length, the character line projection determination step for determining that the projection of the character line cannot be specified,
The acquisition unit of the image processing device calculates the number of black pixels in each pixel row in the partial image area for the partial image area determined in the character line projection determination step that the projection of the character line cannot be specified. An acquisition step of acquiring a histogram by counting;
Line determination means of the image processing apparatus, based on the histogram obtained by the obtaining step, a line determination step of determining whether or not include the partial image areas character row direction of the ruled line in,
When the specifying unit of the image processing apparatus determines that the ruled line determination step includes a ruled line in the character line direction in the partial image area, the frequency of the histogram acquired in the acquisition step is equal to or greater than a predetermined threshold. A specific step of identifying a pixel row as a ruled line projection ;
When the local inclination angle calculation means of the image processing apparatus determines that the projection of the character line can be specified in the character line projection determination step, the pair of partial image areas detected in the detection step A correlation between the projections of each partial image region is obtained, and it is determined that the projection of the character line cannot be specified in the character line projection determination step and the ruled line determination step determines that a ruled line in the character line direction is included. For a pair of partial image areas, a local correlation is obtained by calculating a correlation between the projections of the two partial areas specified in the specifying step and calculating an inclination angle based on the calculated correlation and an interval between the two partial areas. The step of calculating the tilt angle,
A partial image when the control means of the image processing device determines that the projection of the character line cannot be specified in the character line projection determination step and that the ruled line determination step does not include a ruled line in the character line direction For the pair of regions, a control step for controlling not to perform the processing in the local tilt angle calculation step;
An image processing method comprising: a determining step in which the determining means of the image processing apparatus determines the tilt of the document image based on the tilt angle calculated in the local tilt angle calculating step .
前記罫線判定工程では、前記部分画像領域の幅に基づいて定められたしきい値と前記取得手段にて取得したヒストグラムの度数とを比較することにより、該部分画像領域内に文字行方向の罫線が含まれるか否かを判定することを特徴とする請求項に記載の画像処理方法。 Wherein the line determination step, said part by comparing the frequency of the histogram obtained by the image region width threshold defined based on the said acquisition means, character row direction of the ruled line to the partial image area The image processing method according to claim 4 , wherein it is determined whether or not an image is included. 前記局所的傾き角度算出工程では、前記2つの部分画像領域の一方を固定し他方を垂直移動させて、それぞれの部分画像領域から検出された射影の相関を取得し、該相関が最大となるときのそれぞれの部分画像領域の位置関係と、前記間隔とに基づいて、前記傾き角度を求めることを特徴とする請求項4または5に記載の画像処理方法。 In the local tilt angle calculation step, when one of the two partial image areas is fixed and the other is vertically moved to obtain a correlation of projections detected from the respective partial image areas, the correlation is maximized. 6. The image processing method according to claim 4 , wherein the inclination angle is obtained based on a positional relationship between the partial image areas and the interval . コンピュータを、
横方向に所定距離離れた位置に並んだ2つの部分画像領域を対として、複数の前記対を前記文書画像内の複数箇所それぞれに設定する設定手段と、
前記設定手段で設定された部分画像領域ごとに、当該部分画像領域内で黒画素が存在する画素行を示す射影を検出する検出手段と、
前記複数箇所に設定された対それぞれに対して、前記検出手段により検出された射影の長さが所定の長さより短いか或いは当該部分画像領域の高さ全体に及ぶ長さである場合は、文字行の射影を特定できないと判定する文字行射影判定手段と、
前記文字行射影判定手段で前記文字行の射影が特定できないと判定された部分画像領域に対して、該部分画像領域内の各画素行で黒画素の数をカウントすることによりヒストグラムを取得する取得手段と、
前記取得手段で取得したヒストグラムに基づいて、前記部分画像領域内に文字行方向の罫線が含まれるか否かを判定する罫線判定手段と、
前記罫線判定手段で前記部分画像領域内に文字行方向の罫線が含まれると判定された場合、前記取得手段で取得したヒストグラムの度数が所定の閾値以上である画素行を罫線の射影として特定する特定手段と、
前記文字行射影判定手段で前記文字行の射影が特定できたと判定された場合の部分画像領域の対に関しては前記検出手段で検出した前記2つの部分画像領域それぞれの射影の相関関係を求め、前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれると判定された場合の部分画像領域の対に関しては前記特定手段で特定した前記2つの部分領域それぞれの射影の相関関係を求め、当該求めた相関関係と当該2つの部分領域間の間隔とに基づいて傾き角度を求める局所的傾き角度算出手段と、
前記文字行射影判定手段で前記文字行の射影が特定できないと判定され且つ前記罫線判定手段で文字行方向の罫線が含まれないと判定された場合の部分画像領域の対に関しては、前記局所的傾き角度算出手段での処理を行わないように制御する制御手段と、
前記局所的傾き角度算出手段で算出された傾き角度に基づいて、前記文書画像の傾きを決定する決定手段と
して機能させるためのプログラム。
Computer
A setting means for setting a plurality of the pairs in each of a plurality of locations in the document image, with two partial image areas arranged at a predetermined distance in the horizontal direction as a pair;
For each partial image area set by the setting means, detecting means for detecting a projection indicating a pixel row in which black pixels exist in the partial image area;
For each of the pairs set in the plurality of places, if the length of the projection detected by the detection means is shorter than a predetermined length or the length extending over the entire height of the partial image area, A character line projection judging means for judging that the projection of the line cannot be specified;
Acquisition for obtaining a histogram by counting the number of black pixels in each pixel row in the partial image area for which the projection of the character line is determined not to be specified by the character line projection determining means Means,
Based on the histogram obtained by the obtaining unit, a line determination means for determining whether or not include the partial image area in the character line direction of the ruled line,
When it is determined by the ruled line determination means that a ruled line in the character line direction is included in the partial image area , a pixel line whose histogram frequency acquired by the acquisition means is equal to or greater than a predetermined threshold is specified as a ruled line projection . Specific means,
For the pair of partial image areas when it is determined that the projection of the character line can be specified by the character line projection determination means, the correlation between the projections of the two partial image areas detected by the detection means is obtained, A pair of partial image areas when the projection of the character line is determined not to be specified by the character line projection determination unit and the ruled line determination unit determines that the ruled line in the character line direction is included is specified by the specification unit. A local inclination angle calculation means for obtaining a correlation between the projections of the two partial areas and obtaining an inclination angle based on the obtained correlation and an interval between the two partial areas;
Regarding the pair of partial image areas when it is determined by the character line projection determining means that the projection of the character line cannot be specified and the ruled line determining means determines that the ruled line in the character line direction is not included, Control means for controlling so as not to perform processing in the tilt angle calculation means;
Determining means for determining the inclination of the document image based on the inclination angle calculated by the local inclination angle calculating means;
Program to make it function .
請求項に記載のプログラムを格納したことを特徴とするコンピュータ読み取り可能な記憶媒体。 A computer-readable storage medium storing the program according to claim 7 .
JP2004090065A 2004-03-25 2004-03-25 Image processing apparatus, image processing method, program, and storage medium Expired - Fee Related JP4434803B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004090065A JP4434803B2 (en) 2004-03-25 2004-03-25 Image processing apparatus, image processing method, program, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004090065A JP4434803B2 (en) 2004-03-25 2004-03-25 Image processing apparatus, image processing method, program, and storage medium

Publications (2)

Publication Number Publication Date
JP2005275952A JP2005275952A (en) 2005-10-06
JP4434803B2 true JP4434803B2 (en) 2010-03-17

Family

ID=35175542

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004090065A Expired - Fee Related JP4434803B2 (en) 2004-03-25 2004-03-25 Image processing apparatus, image processing method, program, and storage medium

Country Status (1)

Country Link
JP (1) JP4434803B2 (en)

Also Published As

Publication number Publication date
JP2005275952A (en) 2005-10-06

Similar Documents

Publication Publication Date Title
US8452133B2 (en) Underline removal apparatus
CN111695540B (en) Video frame identification method, video frame clipping method, video frame identification device, electronic equipment and medium
CN103714338A (en) Image processing device and image processing method
JP2006228232A (en) Character dividing program, character dividing device and character dividing method
JP2008167009A (en) Image processing device and method, and program
US9710945B2 (en) Method for cutting out character, character recognition apparatus using this method, and program
KR101535435B1 (en) System, method and apparatus for providing electronic music
JP4434803B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP4434802B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP4804433B2 (en) Image processing apparatus, image processing method, and image processing program
JP2006343960A (en) Image processor, image processing method, program and storage medium
CN108629786B (en) Image edge detection method and device
JP4497974B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP3516541B2 (en) Method and apparatus for recognizing dimension information of construction drawings
JP2022056219A (en) Information processor, method for processing information, and program
KR100954137B1 (en) Edge-based text localization and segmentation algorithms for automatic slab information recognition
JP2007323440A (en) Image processing method, image processing program, storage medium recording the image processing program, and image processor
JPH1153539A (en) Circular pattern discriminating method and storage medium
JP2006338368A (en) Image processor and image processing method
JPH10254991A (en) Ruled line erasing method and mechanically readable medium
JP2010258627A (en) Image processor, image processing method, program, and storage medium
JP4738645B2 (en) SHADED AREA DETECTING DEVICE, SHATTERED AREA DETECTING METHOD, PROGRAM, AND STORAGE MEDIUM
JP2006072524A (en) Information processing apparatus and method
JP5556504B2 (en) Image processing apparatus and program
JP5277750B2 (en) Image processing program, image processing apparatus, and image processing system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070316

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090904

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20091104

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20091222

R150 Certificate of patent or registration of utility model

Ref document number: 4434803

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20130108

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20140108

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees