JP3046652B2 - How to correct the inclination of text documents - Google Patents

How to correct the inclination of text documents

Info

Publication number
JP3046652B2
JP3046652B2 JP3201244A JP20124491A JP3046652B2 JP 3046652 B2 JP3046652 B2 JP 3046652B2 JP 3201244 A JP3201244 A JP 3201244A JP 20124491 A JP20124491 A JP 20124491A JP 3046652 B2 JP3046652 B2 JP 3046652B2
Authority
JP
Japan
Prior art keywords
pattern
image
inclination
expansion
conceptual diagram
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
JP3201244A
Other languages
Japanese (ja)
Other versions
JPH05143774A (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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP3201244A priority Critical patent/JP3046652B2/en
Priority to DE69232345T priority patent/DE69232345T2/en
Priority to EP92112054A priority patent/EP0525513B1/en
Publication of JPH05143774A publication Critical patent/JPH05143774A/en
Priority to US08/535,322 priority patent/US5546479A/en
Application granted granted Critical
Publication of JP3046652B2 publication Critical patent/JP3046652B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Editing Of Facsimile Originals (AREA)
  • Character Input (AREA)
  • Image Processing (AREA)
  • Facsimile Scanning Arrangements (AREA)

Description

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

【0001】[0001]

【産業上の利用分野】この発明は文字原稿の傾き補正方
法に係り、特に、複写機、ファクシミリ、OCR等の、
セットされた原稿を画像として読み取る機器における、
原稿の不測の傾きを解消するための補正方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for correcting the inclination of a character document, and more particularly to a method for correcting the inclination of a character document, such as a copying machine, a facsimile, an OCR,
In a device that reads a set document as an image,
The present invention relates to a correction method for eliminating an unexpected inclination of a document.

【0002】[0002]

【従来の技術】文字原稿の傾きによって、ファクシミリ
においてはデータ圧縮率が低下し、OCRにおいては認
識率の低下を招く。また複写機では、複写品質の安定化
を図る上で、原稿の傾き補正を自動化する必要がある。
2. Description of the Related Art Due to the inclination of a character document, the data compression rate decreases in facsimile, and the recognition rate decreases in OCR. Further, in a copying machine, in order to stabilize the copy quality, it is necessary to automate the inclination correction of the original.

【0003】傾き検出方法として、従来、膨張、収縮、
細線化を用いた手法が知られていた(中村納、氏家誠、
岡村教佳、南敏、”ミックスモード通信のための文字領
域の抽出アルゴリズム”、電子通信学会論文誌 VO
L.J67-D,No。11、pp1277−1284、
1984年11月)。
[0003] Conventionally, as the inclination detecting method, expansion, contraction,
Known methods using thinning (Nori Nakamura, Makoto Ujiie,
Noriyoshi Okamura and Minatoshi Minami, "Character Region Extraction Algorithm for Mixed Mode Communication", IEICE Transactions VO
L. J67-D, No. 11, pp1277-1284,
November 1984).

【0004】この手法によれば、文字原稿を2値化し、
膨張によって文字相互を連結する。さらに、収縮、穴埋
めによって、文字列を比較的細い帯として表示し、これ
を細線化する。また細線化画像の両端不整部分を縮退に
よって消去する。このような細線化画像において、ラベ
リング後、所定値以上の長さのグループの傾きを求め、
この傾きを原稿の傾きとみなす。ここに前記膨張の回数
は経験則に基づいて決定され、文字原稿の取込みサイ
ズ、品質等を目視判断しなければ最適値は得られなかっ
た。
According to this method, a character document is binarized,
The letters are connected by expansion. Further, the character string is displayed as a relatively thin band by shrinking and filling, and this is thinned. Further, irregular portions at both ends of the thinned image are deleted by reduction. In such a thinned image, after labeling, the inclination of a group having a length equal to or more than a predetermined value is obtained,
This inclination is regarded as the inclination of the document. Here, the number of times of the expansion was determined based on an empirical rule, and an optimum value could not be obtained unless the taking-in size, quality, etc. of the character document were visually judged.

【0005】[0005]

【発明が解決すべき課題】この発明はこのような従来の
問題点を解消すべく創案されたもので、傾き検出に最適
な膨張の処理を実行でき、かつ検出精度の高い、文字原
稿の傾き補正方法を提供することを目的とする。
SUMMARY OF THE INVENTION The present invention has been made in order to solve such a conventional problem. The present invention is capable of executing an expansion process optimal for detecting tilt, and has high detection accuracy. It is intended to provide a correction method.

【0006】[0006]

【課題を解決するための手段】この発明に係る文字原稿
の傾き補正方法は、文字原稿の画像を逐次膨張させ、膨
張前後の図形面積の膨張量の鈍化を検出することにより
最適膨張回数を求め、この最適膨張回数に基づく所定回
数だけ原画像を膨張させた画像を生成し、生成された画
像において、図形輪郭各部の縦横成分を算出して縦横い
ずれの成分が多いかを求め、より多い成分の方向にの
み、前記最適膨張回数だけ原画像を膨張させ、この膨張
により得られた画像を細線化し、細線化後の画像の各部
の縦横成分を算出し、より多い成分の統計量に基づきそ
の傾きを算出し、補正を行うものである。この発明に係
る文字原稿の傾き補正方法によれば、文字原稿の各行を
略長方形の帯として処理でき、それを細線化することに
より高精度で傾き検出し、補正を行い得る。
According to a method for correcting the inclination of a character document according to the present invention, an image of a character document is sequentially expanded, and an optimum number of times of expansion is obtained by detecting a decrease in expansion of a figure area before and after expansion. An image is generated by expanding the original image by a predetermined number of times based on the optimal number of expansions, and in the generated image, the vertical and horizontal components of each part of the figure contour are calculated to determine which component in the vertical and horizontal directions is larger. Only in the direction of, the original image is expanded by the optimal number of times of expansion, the image obtained by this expansion is thinned, the vertical and horizontal components of each part of the image after the thinning are calculated, and based on the statistics of more components, The inclination is calculated and the correction is performed. According to the character document inclination correction method according to the present invention, each line of the character document can be processed as a substantially rectangular band, and by thinning the line, the inclination can be detected and corrected with high accuracy.

【0007】[0007]

【実施例】次にこの発明に係る文字原稿の傾き補正方法
の1実施例を図面に基づいて説明する。図1は同実施例
を示すフローチャートであり、まず原稿をスキャナー等
の入力手段から読取り(ステップ1−1)、以後の処理
に適合するように画像のサイズを調整する(ステップ1
−2)、例えば、スキャナの出力画像が4096×40
96画素であり、画像処理部の処理対象画素が1024
×1024であったとすれば、1/4の縮小が必要であ
る。この縮小の処理において、所定のコンボリューショ
ンの平均値を特定画素の濃度とする処理を行えば、原画
像の濃淡情報を最大限保存し得る。すなわち、1/4の
縮小では、4×4コンボリューションの平均値を特定画
素(例えば同コンボリューション内の左上の画素)の濃
度とする。デジタル画像の座標(x,y)における画素
値をf(x,y)、そのコンボリューション処理後の画
像をg(x,y)とすると、「所定のコンボリューショ
ン」とは、(x,y)を含むm×n画素領域のことであ
り、例えば、g(x,y)は、f(x,y)、f(x+
1,y)、...、f(x+m−1,y) f(x,y+1)、f(x+1,y+1)、...、f
(x+m−1,y+1) .........................
........f(x,y+n−1)、f(x+1,
y+n−1)、...、f(x+m−1,y+n−1)
の関数であることを意味する。ここに、f(x,y)に
関して、 0<=x<=M−1、0<=y<=N−1 とすると、g(x,y)に関しては、 0<=x<=M−m、0<=y<=N−n のように表現される。そして、g(x,y)がf(x,
y)と線形の関係にあるときは、
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, an embodiment of a method for correcting the inclination of a character document according to the present invention will be described with reference to the drawings. FIG. 1 is a flowchart showing the embodiment. First, a document is read from input means such as a scanner (step 1-1), and the size of an image is adjusted so as to conform to the subsequent processing (step 1).
-2) For example, if the output image of the scanner is 4096 × 40
96 pixels, and the processing target pixel of the image processing unit is 1024 pixels.
If it is × 1024, a reduction of 1 / is required. In this reduction process, if the process of setting the average value of the predetermined convolution to the density of the specific pixel is performed, the maximum density information of the original image can be preserved. That is, in the 1/4 reduction, the average value of the 4 × 4 convolution is set as the density of the specific pixel (for example, the upper left pixel in the convolution). Assuming that the pixel value at the coordinates (x, y) of the digital image is f (x, y) and the image after the convolution processing is g (x, y), the “predetermined convolution” is (x, y). ), Which includes an m × n pixel area, for example, g (x, y) is f (x, y), f (x +
1, y),. . . , F (x + m-1, y) f (x, y + 1), f (x + 1, y + 1),. . . , F
(X + m-1, y + 1). . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . f (x, y + n-1), f (x + 1,
y + n-1),. . . , F (x + m-1, y + n-1)
Is a function of Here, assuming that 0 <= x <= M−1 and 0 <= y <= N−1 for f (x, y), 0 <= x <= M− for g (x, y) m, 0 <= y <= N−n. Then, g (x, y) becomes f (x, y).
When there is a linear relationship with y),

【数1】 なる演算によりg(x,y)が算出される。ここに、k
(i、j)はf(x+i,y+j)の係数である。なお前
記「4×4コンボリューション」はm=n=4の処理を
意味し、m=n=3の場合「3×3コンボリューショ
ン」という。
(Equation 1) G (x, y) is calculated by the following calculation. Where k
(I, j) is a coefficient of f (x + i, y + j). Note that the “4 × 4 convolution” means a process of m = n = 4, and when m = n = 3, is referred to as “3 × 3 convolution”.

【0008】また前記「所定コンボリューションの平均
値を特定画素の濃度とする処理」とは、式(1)でk
(i,j)=1/(m×n)とする処理を意味し、「縮
小処理」とは、処理後の画像の画素値をh(x,y)と
するとき、 h(x,y)=g(m×x,n×y) とする処理である。ここにh(x,y)の(x、y)の
範囲は、 0<=x<=M/(m−1)、0<=y<=N/(n−
1) また、g(m×x,n×y)は「所定コンボリューショ
ンの平均値を特定画素の濃度とする処理」の処理結果の
画素である。
The above-mentioned “process for setting the average value of a predetermined convolution to the density of a specific pixel” is expressed by the following equation (1).
(I, j) = 1 / (m × n) means “reduction processing”. When the pixel value of the processed image is h (x, y), h (x, y) ) = G (m × x, n × y). Here, the range of (x, y) of h (x, y) is as follows: 0 <= x <= M / (m−1), 0 <= y <= N / (n−
1) Further, g (m × x, n × y) is a pixel obtained as a result of the “processing of setting the average value of the predetermined convolution to the density of the specific pixel”.

【0009】次に画像の濃度ヒストグラムを求め、最適
閾値による2値化を行い(ステップ1−3)、さらにノ
イズを除去する(ステップ1−4)。最適閾値の算出法
としては、濃度の中央値を閾値とする方法、モード法、
判別分析法、P−タイル法等が存在する。また、ノイズ
除去方法としては、孤立点除去、メディアンフィルタ等
が有効である。傾き検出に際しては文字原稿の画像を主
要成分方向、すなわち横書き原稿は横方向に、縦書原稿
は縦方向に最適膨張回数に基づく所定回数膨張させ、各
行を帯び状の図形に変換する。この図形を細線化するこ
とにより傾き検出が容易になる。ここで、最適膨張回数
Ndilの算出方法について説明する(ステップ1−5
〜1−13)。
Next, a density histogram of the image is obtained, binarized by an optimal threshold (step 1-3), and noise is further removed (step 1-4). As a method of calculating the optimum threshold, a method using the median of the density as a threshold, a mode method,
There are a discriminant analysis method, a P-tile method, and the like. As a noise removing method, an isolated point removal, a median filter, or the like is effective. In detecting the inclination, the image of the character document is expanded in the main component direction, that is, the horizontal writing document is expanded in the horizontal direction, and the vertical writing document is expanded in the vertical direction by a predetermined number of times based on the optimum number of expansions, and each line is converted into a striped figure. By thinning this figure, inclination detection becomes easy. Here, a method of calculating the optimum number of times of expansion Ndir will be described (step 1-5).
1−1-13).

【0010】ステップ1−5では、以後繰り返し膨張を
行うため、膨張回数をカウントするためのループカウン
タiを初期化(i=1)する。次いで、ステップ1−6
で、ノイズ除去後の非背景画素数(白画素数)Nw1
(i=1)をカウントし、非背景画素数の初期値を求め
る。次いで、ステップ1−7で、1回膨張を行い、ステ
ップ1−8でループカウンタiをインクリメントし(i
=2)、ステップ1−9で、非背景画素数Nw2(i=
2)をカウントする。次いで、ステップ1−10で、非
背景画素数の3次微分(Δ 3 Nwi)を求める。3次微
分は、以下の式で算出される。
In step 1-5, the expansion is repeated thereafter.
Loop count for counting the number of inflation
The parameter i is initialized (i = 1). Then, step 1-6
The number of non-background pixels (the number of white pixels) Nw1 after noise removal
(I = 1) is counted, and the initial value of the number of non-background pixels is obtained.
You. Next, in step 1-7, expansion is performed once, and
In step 1-8, the loop counter i is incremented (i
= 2), in step 1-9, the number of non-background pixels Nw2 (i =
2) is counted. Next, in step 1-10, the non-
The third derivative (Δ 3 Nwi) of the number of background pixels is obtained . The third derivative is calculated by the following equation.

【0011】3次微分 △3Nwi=△2Nw(i+1)
−△2Nwi 但し、△2Nwi=△Nw(i+1)−△Nwi △Nwi=Nw(i+1)−Nwiしたがって、△ 3 Nwi=Nw(i+3)−3・Nw
(i+2)+3・Nw(i+1)−Nwi
The third derivative Δ 3 Nwi = △ 2 Nw (i + 1)
− △ 2 Nwi However, △ 2 Nwi = △ Nw (i + 1) − △ Nwi ΔNwi = Nw (i + 1) −Nwi Therefore, △ 3 Nwi = Nw (i + 3) −3 · Nw
(I + 2) + 3 · Nw (i + 1) −Nwi

【0012】3次微分ΔNWiの値が負になったとき
は、すでに行間の融合が生じ、膨張による図形面積増大
の鈍化が検出されたことになる(ステップ1−10)。
従って、この段階で膨張のループからは抜け、最適膨張
回数として前回までの膨張回数、 Ndil=i−1 を採用する(ステップ1−13)。そして、前回の膨張
画像を以下の主要成分検出(ステップ1−14)に用い
る。このように、1層の膨張ごとに図形の面積変化をト
レースすれば確実に大局的な融合開始を検出でき、最適
膨張回数を求め得る。
When the value of the third derivative Δ 3 NWi becomes negative, it means that the inter-line fusion has already occurred, and that the increase in the figure area due to the expansion has been detected (step 1-10).
Therefore, at this stage, the process exits the expansion loop, and the number of expansions up to the previous time, Ndil = i-1, is adopted as the optimum number of expansions (step 1-13). Then, the previous dilated image is used for the following main component detection (step 1-14). In this way, if the area change of the figure is traced for each expansion of one layer, the global start of fusion can be reliably detected, and the optimum number of expansions can be obtained.

【0013】なお、前記ノイズ除去では除去しきれない
ノイズ等の影響により、融合開始が不明瞭な場合も考え
られる。そこで、膨張回数の上限Iをあらかじめ設定し
ておき、3次微分が負の値に到達する以前であっても、
膨張を終了する(ステップ1−11)。この場合、最適
膨張回数は(I−1)となる。3次微分が正であり、か
つ、ループカウンタiの内容が、膨張回数の上限I未満
であるときは、再び、ステップ1−6に戻り、以後、ス
テップ1−7、ステップ1−8、ステップ1−9を繰り
返して、再び、ステップ1−10で3次微分の正負を判
断する。 ステップ1−6〜1−11のループ内では、以
下の表1のようになる。
The start of fusion may be unclear due to the influence of noise or the like that cannot be completely removed by the noise removal. Therefore, the upper limit I of the number of times of expansion is set in advance, and even before the third derivative reaches a negative value,
The expansion is terminated (step 1-11). In this case, the optimal number of times of expansion is (I-1). If the third derivative is positive,
First, the content of the loop counter i is less than the upper limit I of the number of times of expansion.
, The process returns to step 1-6 again, and
Repeat Step 1-7, Step 1-8, Step 1-9
And again, at step 1-10, the sign of the third derivative is determined.
Refuse. In the loop of steps 1-6 to 1-11,
Table 1 below.

【表1】 なお、△ 3 Nwi<0を満足するか否かを判断するため
には、現在のiが4以上である必要があり、i=2また
は3の場合は、ステップ1−10の「△ 3 Nwi<0」
は判断できないため、満足しない場合と同じ分岐(Nへ
の分岐)が行われる。次に、原稿の主要成分、すなわち
横書き原稿か、縦書き原稿かの判断を行う。この判断は
画像各部のパターン傾き成分を総合することによって行
う(ステップ1−14)。
[Table 1] Note that in order to determine whether or not < 3 Nwi <0 is satisfied,
Requires that the current i be 4 or greater, i = 2 and
In the case of 3, “△ 3 Nwi <0” in step 1-10
Cannot be determined, so the same branch as when not satisfied (to N
Is performed). Next, the main component of the document, that is, whether the document is a horizontally written document or a vertically written document is determined. This determination is made by synthesizing the pattern inclination components of each part of the image (step 1-14).

【0014】傾き成分検出に際しては、3×3コンボリ
ューションにおいて図2(A)〜(L)のパターンを横成
分、図3(A)〜(L)のパターンを縦成分とし、いずれ
のパターンが多いかによって、画像全体についての主要
成分を求める。これらパターンは図形の輪郭部分であ
り、輪郭の傾きを2画素の画素列ごとに定義し、コンボ
リューション内の傾きの合計値が水平に近いものを横方
向のパターンとし、垂直に近いものを縦方向のパターン
としている。なお、コンボリューション周縁に背景画素
を1画素含むパターン(図2および図3の(K)、
(L))については、背景がそが左右周縁にある場合に
縦パターン、上下周縁にある場合に横パターンとしてお
り、斜め45度のパターンはいずれにも含めない。
When detecting the inclination component, in the 3 × 3 convolution, the patterns of FIGS. 2A to 2L are set as the horizontal component, and the patterns of FIGS. 3A to 3L are set as the vertical component. The main component of the entire image is obtained depending on whether the number is large. These patterns are the outlines of the figure. The inclination of the outline is defined for each two-pixel row, and those with the total inclination of the convolution near horizontal are considered as horizontal patterns, and those near vertical are considered as vertical patterns. It is a pattern of directions. Note that a pattern including one background pixel on the periphery of the convolution ((K) in FIGS. 2 and 3,
(L)) is a vertical pattern when the background is on the left and right peripheral edges, and a horizontal pattern when the background is on the upper and lower peripheral edges, and does not include any oblique 45-degree pattern.

【0015】縦方向パターンの数をNv、横方向パター
ンの数をNhとすると、 Nv<=Nh のときに主要成分を横方向と判断し、そうでないときに
縦方向と判断する(ステップ1−15〜1−17)。こ
こに主要成分の指標をhorvとし、縦方向のとき、h
orvに「v」を代入し、横方向のときに、horvに
「h」を代入する(ステップ1−16、1−17)。
Assuming that the number of vertical patterns is Nv and the number of horizontal patterns is Nh, if Nv <= Nh, the main component is determined to be horizontal, otherwise it is determined to be vertical (step 1-). 15-1-17). Here, the index of the main component is set to horv.
"v" is substituted for orv, and "h" is substituted for horv in the horizontal direction (steps 1-16 and 1-17).

【0016】ここで、膨張前の原画像について、主要成
分の方向に所定回数膨張を実行し、各行の文字を連結さ
せる。膨張回数は文字が確実に連結する最小限の回数と
すべきであり、経験的には、前記Ndilに基づいて、 9・Ndil/4 〔回〕 などの値が採用される。このような最適膨張回数に基づ
く所定回数の膨張で生成された画像においては、各行が
略長方形の図形となる。次にその略長方形の図形を細線
化する。細線化とは、図形のトポロジイを変えることな
く、図形周縁の画素を一層ずつ順次取り除くことによ
り、当該図形を画素幅1の線図形とすることである。な
お、細線化の画像処理手法として、例えばHILDIT
CHの手法、特開昭64−13680号等の手法が有効
である。この細線化により、略長方形図形のほぼ中心線
が求められることになり、図形の傾きを算出する有効な
要素を得ることができる。しかしながら、細線化を施し
た場合、図形端の文字の形あるいはノイズにより、図4
(C)のような細線化図形の端が分岐したり、湾曲する
ことがある。そこで、精度の高い傾き算出の障害となる
これらの不整部を除去するために、細線化を施した後に
端点の縮退化処理を施す(図4(D))。これにより、
両端不整部分が除去され、以後の傾き算出の制度が増
す。ここに、「縮退の処理」とは、線図形の両端を除去
する処理であり、除去すべき否かの判断は、近傍画素に
より決定する。例えば、特定画素に対し、図9の3×3
画素パターンを参照し、近傍画素がこれらのパターンに
合致したとき、中央画素を除去すべきと判断して、背景
画素に変換する。処理対象画像の全画素に対してこのよ
うな処理を施し、処理を終了する。
Here, the original image before expansion is expanded a predetermined number of times in the direction of the main component, and the characters on each line are connected. The number of times of expansion should be the minimum number of times that characters are surely connected, and empirically, a value such as 9 · Ndir / 4 [times] is used based on the Ndir. In an image generated by a predetermined number of dilations based on the optimum number of dilations, each row has a substantially rectangular shape. Next, the substantially rectangular figure is thinned. Thinning refers to making a graphic a line graphic having a pixel width of 1 by sequentially removing pixels on the periphery of the graphic without changing the topology of the graphic. As an image processing method of thinning, for example, HILDIT
The method of CH and the method of JP-A-64-13680 are effective. By this thinning, a substantially center line of the substantially rectangular figure is obtained, and an effective element for calculating the inclination of the figure can be obtained. However, when thinning is performed, the shape of the character at the end of the figure or the noise causes
The end of the thin figure as shown in FIG. 1C may be branched or curved. Therefore, in order to remove these irregularities that hinder the calculation of the inclination with high accuracy, the thinning is performed and then the end points are reduced (FIG. 4D). This allows
The irregularities at both ends are removed, and the accuracy of the subsequent inclination calculation increases. Here, the "degeneration process" is a process of removing both ends of a line figure, and the determination as to whether or not to remove the line figure is determined by neighboring pixels. For example, for a specific pixel, 3 × 3 in FIG.
Referring to the pixel pattern, when the neighboring pixels match these patterns, it is determined that the central pixel should be removed, and the pixel is converted to a background pixel. Such processing is performed on all the pixels of the processing target image, and the processing ends.

【0017】なお縮退の回数は不整部分を完全に消去し
得る最小限の回数とすべきであり、、経験てきには、前
記Ndilに基づいて、 15・Ndil/4+1 〔回〕 などの値が採用される。この経験式は略1文字〜1.5
文字に相当する長さの線の消去を意味する。
It should be noted that the number of times of degeneration should be the minimum number of times that the irregular part can be completely erased. According to experience, a value such as 15 · Ndir / 4 + 1 [times] is used based on the Ndir. Adopted. This empirical formula is approximately one letter to 1.5
This means deleting a line of a length corresponding to a character.

【0018】横成分を主体とする画像の傾きの算出に際
しては、図6(A)、(B)、(C)、(D)、
(E)、(F)、(G)、(H)、(I)の各パターン
の個数をカウントし、そのカウント値に係数を掛けつつ
合計する。ここに、各パターンの形状と、各パターン数
に乗ずるべき数値は以下のとおりである。
FIGS. 6A, 6B, 6C, 6D, and 6D show the calculation of the inclination of the image mainly composed of the horizontal component.
The number of each of the patterns (E), (F), (G), (H), and (I) is counted, and the counted values are multiplied by a coefficient and totaled. Here, the shape of each pattern and the numerical value to be multiplied by the number of each pattern are as follows.

【0019】横パターン形状および係数 (A)3画素の水平パターン 係数=0 (B)(2画素の右下りパターン)+(2画素の水平パターン) 係数=0.5 (C)(2画素の水平パターン)+(2画素の右下りパターン) 係数=0.5 (D)(2画素の水平パターン)+(2画素の右上りパターン) 係数=−0.5 (E)(2画素の右上りパターン)+(2画素の水平パターン) 係数=−0.5 (F)3画素の右下りパターン 係数=1 (G)3画素の右上りパターン 係数=−1 (H)(2画素の右下りパターン)+(2画素の右上りパターン) 係数=0 (I)(2画素の右上りパターン)+(2画素の右下りパターン) 係数=0Horizontal pattern shape and coefficient (A) Horizontal pattern coefficient of 3 pixels = 0 (B) (downward right pattern of 2 pixels) + (horizontal pattern of 2 pixels) Coefficient = 0.5 (C) (2 pixels) (Horizontal pattern) + (two pixel right down pattern) coefficient = 0.5 (D) (two pixel horizontal pattern) + (two pixel right upper pattern) coefficient = −0.5 (E) (two pixel right (Up pattern) + (horizontal pattern of 2 pixels) coefficient = −0.5 (F) right down pattern of 3 pixels coefficient = 1 (G) upper right pattern of 3 pixels coefficient = −1 (H) (right of 2 pixels) Downward pattern) + (upper right pattern of 2 pixels) coefficient = 0 (I) (upper right pattern of 2 pixels) + (downward right pattern of 2 pixels) coefficient = 0

【0020】これらの係数は各パターンの水平成分に対
する誤差成分であり、3画素の斜めのパターンに対して
絶対値「1」を与えている。これらパターン(A)〜
(I)の画像全体についてのトータル個数をNa〜Ni
とすると、傾き角度θは、以下の式で与えられる。
These coefficients are error components with respect to the horizontal component of each pattern, and give an absolute value "1" to a diagonal pattern of three pixels. These patterns (A) ~
The total number of the entire image of (I) is Na to Ni.
Then, the inclination angle θ is given by the following equation.

【0021】θ=tan−1〔{0.5(Nb+Nc)
−0.5(Nd+Ne)+Nf−Ng}/(Na+Nb
+Nc+Nd+Ne+Nf+Ng+Nh+Ni)〕
Θ = tan −1 [{0.5 (Nb + Nc)
−0.5 (Nd + Ne) + Nf−Ng} / (Na + Nb)
+ Nc + Nd + Ne + Nf + Ng + Nh + Ni)]

【0022】縦書きの文字原稿に対する処理も同様であ
り、図4(A)〜(D)に対する横書き原稿の処理内容
を図5(A)〜(D)に示す。そして、図6(A)〜
(I)に対応する縦パターンを図7(A)〜(I)に示
す。これらパターンの形状および係数は以下のとおりで
ある。
The same applies to the processing for a vertically written character document. FIGS. 5A to 5D show the processing contents of a horizontally written document for FIGS. 4A to 4D. Then, FIG.
FIGS. 7A to 7I show vertical patterns corresponding to (I). The shapes and coefficients of these patterns are as follows.

【0023】 (A)3画素の垂直パターン 係数=0 (B)(2画素の左下りパターン)+(2画素の垂直パターン) 係数=0.5 (C)(2画素の垂直パターン)+(2画素の左下りパターン) 係数=0.5 (D)(2画素の垂直パターン)+(2画素の右下りパターン) 係数=−0.5 (E)(2画素の右下りパターン)+(2画素の垂直パターン) 係数=−0.5 (F)3画素の右下りパターン 係数=−1 (G)3画素の右上りパターン 係数=1 (H)(2画素の左下りパターン)+(2画素の右下りパターン) 係数=0 (I)(2画素の右下りパターン)+(2画素の左下りパターン) 係数=0(A) 3 pixel vertical pattern coefficient = 0 (B) (2 pixel left-down pattern) + (2 pixel vertical pattern) coefficient = 0.5 (C) (2 pixel vertical pattern) + ( Coefficient = 0.5 (D) (vertical pattern of two pixels) + (right-down pattern of two pixels) Coefficient = -0.5 (E) (right-down pattern of two pixels) + ( (Vertical pattern of two pixels) Coefficient = −0.5 (F) Downward pattern of 3 pixels Coefficient = −1 (G) Upper right pattern of 3 pixels Coefficient = 1 (H) (2 pixels left down pattern) + ( (2 pixels right down pattern) coefficient = 0 (I) (2 pixels right down pattern) + (2 pixel left down pattern) coefficient = 0

【0024】これらパターン(A)〜(I)の画像全体
についてのトータル個数をNaからNiとすると、傾き
角度θは、以下の式で与えられる。 θ=tan−1〔{0.5(Nb+Nc)−0.5(N
d+Ne)−Nf+Ng}/(Na+Nb+Nc+Nd
+Ne+Nf+Ng+Nh+Ni)〕
Assuming that the total number of these patterns (A) to (I) for the entire image is from Na to Ni, the inclination angle θ is given by the following equation. θ = tan −1 [{0.5 (Nb + Nc) −0.5 (N
d + Ne) -Nf + Ng} / (Na + Nb + Nc + Nd)
+ Ne + Nf + Ng + Nh + Ni)]

【0025】このように、主要成分方向に最適回数の膨
張を行った膨張図形を生成し、その膨張画像っを細線化
し、この細線化画像の縦横成分を算出し、これら成分の
内、より多い方の成分について、統計量に基づいて傾き
を算出することにより、容易かつ高精度の傾き算出が可
能である。次に、傾き補正を行うためのに、傾き角度算
出後、この傾きを解消するように画像をアフィン変換す
る。アフィン変換はソフトウエアによるマトリックス演
算、あるいは専用ICによるアドレス変換処理により実
行し得る。
As described above, an expanded figure having the optimum number of expansions in the main component direction is generated, the expanded image is thinned, and the vertical and horizontal components of the thinned image are calculated. By calculating the inclination based on the statistics for the component, the inclination can be easily and accurately calculated. Next, in order to correct the inclination, after calculating the inclination angle, the image is subjected to affine transformation so as to eliminate the inclination. The affine transformation can be executed by a matrix operation by software or an address conversion process by a dedicated IC.

【0026】[0026]

【発明の効果】前述のとおり、この発明に係る文字原稿
の傾き補正方法は、文字原稿の画像を逐次膨張させ、膨
張前後の図形面積の膨張量の鈍化を検出することにより
最適膨張回数を求め、この最適膨張回数に基づく所定回
数だけ原画像を膨張させた画像を生成し、生成された画
像において、図形輪郭各部の縦横成分を算出して縦横い
ずれの成分が多いかを求め、より多い成分の方向にの
み、前記最適膨張回数だけ原画像を膨張させ、この膨張
により得られた画像を細線化し、細線化後の画像の各部
の縦横成分を算出し、より多い成分の統計量に基づきそ
の傾きを算出し、補正を行うので、傾き検出に最適な膨
張の処理を実行でき、かつ検出精度の高い、文字原稿の
傾き補正を実行し得るという優れた効果を有する。
As described above, the method of correcting the inclination of a character document according to the present invention sequentially expands the image of the character document, and detects the slowdown of the expansion amount of the graphic area before and after expansion, thereby obtaining the optimum number of expansions. An image is generated by expanding the original image by a predetermined number of times based on the optimal number of expansions, and in the generated image, the vertical and horizontal components of each part of the figure contour are calculated to determine which component in the vertical and horizontal directions is larger. Only in the direction of, the original image is expanded by the optimal number of times of expansion, the image obtained by this expansion is thinned, the vertical and horizontal components of each part of the image after the thinning are calculated, and based on the statistics of more components, Since the inclination is calculated and the correction is performed, there is an excellent effect that the expansion processing optimal for the inclination detection can be executed, and the inclination of the character document can be corrected with high detection accuracy.

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

【図1】 この発明に係る文字原稿の傾き補正方法の1
実施例を示すステップ1−1からステップ1−13のフ
ローチャートである。
FIG. 1 shows a method of correcting the inclination of a character document according to the present invention.
It is a flowchart of Example 1-1 to Example 1-13 which shows an Example.

【図2】 横成分パターンを説明するための概念図であ
る。 (A) 0.5の誤差成分を含む横成分パターンを示す
概念図である。 (B) 0.5の誤差成分を含む他の横成分パターンを
示す概念図である。 (C) 0.5の誤差成分を含む他の横成分パターンを
示す概念図である。 (D) 0.5の誤差成分を含む他の横成分パターンを
示す概念図である。 (E) 0.5の誤差成分を含む他の横成分パターンを
示す概念図である。 (F) 0.5の誤差成分を含む他の横成分パターンを
示す概念図である。 (G) 0.5の誤差成分を含む他の横成分パターンを
示す概念図である。 (H) 0.5の誤差成分を含む他の横成分パターンを
示す概念図である。 (I) 水平な横成分パターンを示す概念図である。 (J) 他の水平な横成分パターンを示す概念図であ
る。 (K) 1個の背景画素を含む横成分パターンを示す概
念図である。 (L) 1個の背景画素を含む他の横成分パターンを示
す概念図である。
FIG. 2 is a conceptual diagram for explaining a horizontal component pattern. (A) is a conceptual diagram showing a horizontal component pattern including an error component of 0.5. (B) is a conceptual diagram showing another horizontal component pattern including a 0.5 error component. (C) is a conceptual diagram showing another horizontal component pattern including an error component of 0.5. (D) is a conceptual diagram showing another horizontal component pattern including an error component of 0.5. (E) is a conceptual diagram showing another horizontal component pattern including an error component of 0.5. (F) is a conceptual diagram showing another horizontal component pattern including an error component of 0.5. (G) is a conceptual diagram showing another horizontal component pattern including an error component of 0.5. (H) is a conceptual diagram showing another horizontal component pattern including an error component of 0.5. (I) is a conceptual diagram showing a horizontal horizontal component pattern. (J) is a conceptual diagram showing another horizontal horizontal component pattern. (K) A conceptual diagram showing a horizontal component pattern including one background pixel. (L) It is a key map showing other horizontal component patterns containing one background pixel.

【図3】 縦成分パターンを説明するための概念図であ
る。 (A) 0.5の誤差成分を含む縦成分パターンを示す
概念図である。 (B) 0.5の誤差成分を含む他の縦成分パターンを
示す概念図である。 (C) 0.5の誤差成分を含む他の縦成分パターンを
示す概念図である。 (D) 0.5の誤差成分を含む他の縦成分パターンを
示す概念図である。 (E) 0.5の誤差成分を含む他の縦成分パターンを
示す概念図である。 (F) 0.5の誤差成分を含む他の縦成分パターンを
示す概念図である。 (G) 0.5の誤差成分を含む他の縦成分パターンを
示す概念図である。 (H) 0.5の誤差成分を含む他の縦成分パターンを
示す概念図である。 (I) 垂直な縦成分パターンを示す概念図である。 (J) 他の垂直な縦成分パターンを示す概念図であ
る。 (K) 1個の背景画素を含む縦成分パターンを示す概
念図である。 (L) 1個の背景画素を含む他の縦成分パターンを示
す概念図である。
FIG. 3 is a conceptual diagram for explaining a vertical component pattern. (A) is a conceptual diagram showing a vertical component pattern including an error component of 0.5. (B) is a conceptual diagram showing another vertical component pattern including an error component of 0.5. (C) It is a key map showing other longitudinal component patterns containing an error component of 0.5. (D) is a conceptual diagram showing another vertical component pattern including an error component of 0.5. (E) is a conceptual diagram showing another vertical component pattern including an error component of 0.5. (F) is a conceptual diagram showing another vertical component pattern including an error component of 0.5. (G) is a conceptual diagram showing another vertical component pattern including an error component of 0.5. (H) is a conceptual diagram showing another vertical component pattern including an error component of 0.5. (I) A conceptual diagram showing a vertical component pattern. (J) is a conceptual diagram showing another vertical component pattern. (K) A conceptual diagram showing a vertical component pattern including one background pixel. (L) It is a key map showing other longitudinal component patterns containing one background pixel.

【図4】 横書き原稿を説明するための概念図である。 (A) 横書き原稿の例を示す概念図である。 (B) 横書き原稿の横方向の膨張図形を示す概念図で
ある。 (C) 横書き原稿の横方向の膨張図形の細線化画像を
示す概念図である。 (D) 横書き原稿の横方向の膨張図形の細線化画像に
縮退化を施した状態を示す概念図である。
FIG. 4 is a conceptual diagram for explaining a horizontally written original. (A) is a conceptual diagram showing an example of a horizontally written original. FIG. 3B is a conceptual diagram illustrating a horizontally expanded figure of a horizontally written document. (C) is a conceptual diagram showing a thinned image of a horizontally expanded figure of a horizontally written document. FIG. 4D is a conceptual diagram showing a state in which a thinned image of a horizontally expanded figure of a horizontally written original is degenerated.

【図5】 縦書き原稿を説明するための概念図である。 (A) 縦書き原稿の例を示す概念図である。 (B) 縦書き原稿の縦方向の膨張図形を示す概念図で
ある。 (C) 縦書き原稿の縦方向の膨張図形の細線化画像を
示す概念図である。 (D) 縦書き原稿の縦方向の膨張図形の細線化画像に
縮退化を施した状態を示す概念図である。
FIG. 5 is a conceptual diagram for explaining a vertically written original. (A) is a conceptual diagram showing an example of a vertically written original. (B) is a conceptual diagram showing a vertically expanded figure of a vertically written document. (C) is a conceptual diagram showing a thinned image of a vertically expanded figure of a vertically written original. (D) is a conceptual diagram showing a state in which a thinned image of a vertically expanded figure of a vertically written original is degenerated.

【図6】 水平パターンを説明するための概念図であ
る。 (A) 水平パターンの例を示す概念図である。 (B) 水平パターンに対して0.5の誤差成分を含む
パターンを示す概念図である。 (C) 水平パターンに対して0.5の誤差成分を含む
他のパターンを示す概念図である。 (D) 水平パターンに対して0.5の誤差成分を含む
さらに他のパターンを示す概念図である。 (E) 水平パターンに対して0.5の誤差成分を含む
さらに他のパターンを示す概念図である。 (F) 右下りのパターンを示す概念図である。 (G) 右上りのパターンを示す概念図である。 (H) 右下りから右上りに変化するパターンを示す概
念図である。 (I) 右上りから右下りに変化するパターンを示す概
念図である。
FIG. 6 is a conceptual diagram for explaining a horizontal pattern. (A) is a conceptual diagram showing an example of a horizontal pattern. (B) is a conceptual diagram showing a pattern including an error component of 0.5 with respect to a horizontal pattern. (C) is a conceptual diagram showing another pattern including an error component of 0.5 with respect to the horizontal pattern. (D) is a conceptual diagram showing still another pattern that includes an error component of 0.5 with respect to the horizontal pattern. (E) is a conceptual diagram showing still another pattern that includes an error component of 0.5 with respect to the horizontal pattern. (F) It is a key map showing the pattern of a right descent. (G) is a conceptual diagram showing an upward-sloping pattern. (H) It is a key map showing the pattern which changes from right descent to right descent. (I) is a conceptual diagram showing a pattern that changes from rising right to falling right.

【図7】 垂直パターンを説明するための概念図であ
る。 (A) 垂直パターンの例を示す概念図である。 (B) 垂直パターンに対して0.5の誤差成分を含む
パターンを示す概念図である。 (C) 垂直パターンに対して0.5の誤差成分を含む
他のパターンを示す概念図である。 (D) 垂直パターンに対して0.5の誤差成分を含む
さらに他のパターンを示す概念図である。 (E) 垂直パターンに対して0.5の誤差成分を含む
さらに他のパターンを示す概念図である。 (F) 右下りのパターンを示す概念図である。 (G) 右上りのパターンを示す概念図である。 (H) 左下りから右下りに変化するパターンを示す概
念図である。 (I) 右下りから左下りに変化するパターンを示す概
念図である。
FIG. 7 is a conceptual diagram for explaining a vertical pattern. (A) is a conceptual diagram showing an example of a vertical pattern. (B) is a conceptual diagram showing a pattern including an error component of 0.5 with respect to a vertical pattern. (C) is a conceptual diagram showing another pattern including an error component of 0.5 with respect to the vertical pattern. (D) is a conceptual diagram showing still another pattern that includes an error component of 0.5 with respect to the vertical pattern. (E) is a conceptual diagram showing still another pattern that includes an error component of 0.5 with respect to the vertical pattern. (F) It is a key map showing the pattern of a right descent. (G) is a conceptual diagram showing an upward-sloping pattern. (H) It is a key map showing the pattern which changes from left descent to right descent. (I) It is a conceptual diagram showing the pattern which changes from right descent to left descent.

【図8】 ステップ1−14からステップ1−23のフ
ローチャートである。
FIG. 8 is a flowchart of steps 1-14 to 1-23.

【図9】 縮退の処理のためのパターンを示す概念図で
ある。
FIG. 9 is a conceptual diagram showing a pattern for degeneration processing.

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 文字原稿の原画像を逐次膨張させ、膨張
前後の図形面積の膨張量の鈍化を検出することにより最
適膨張回数を求め、この最適膨張回数だけ原画像を膨張
させた画像を生成し、生成された画像において、図形輪
郭各部の縦横成分を算出して縦横いずれの成分が多いか
を求め、より多い成分の方向にのみ、前記最適膨張回数
に基づく所定回数だけ原画像を膨張させ、この膨張によ
り得られた画像を細線化し、細線化後の画像の各部の縦
横成分を算出し、より多い成分の統計量に基づき、その
傾きを算出し、この傾きを解消するように原画像を回転
することを特徴とする文字原稿の傾き補正方法。
1. An original image of a character document is sequentially expanded, an optimum expansion number is obtained by detecting a decrease in expansion amount of a graphic area before and after expansion, and an image is generated by expanding the original image by the optimum expansion number. Then, in the generated image, the vertical and horizontal components of each part of the figure contour are calculated to determine which of the vertical and horizontal components is larger, and only in the direction of the larger component, the original image is expanded a predetermined number of times based on the optimal expansion number. The image obtained by this expansion is thinned, the vertical and horizontal components of each part of the image after the thinning are calculated, and the inclination is calculated based on the statistic of a larger number of components. A method for correcting the inclination of a character document, characterized by rotating a document.
【請求項2】 膨張量の鈍化は、原画像および各段階の
膨張後の画像における非背景画素数を段階ごとに3次微
分し、この3次微分値が負になったことにより検出し、
その直前の膨張回数を最適膨張回数とすることを特徴と
する、請求項1記載の文字原稿の傾き補正方法。
2. The dulling of the amount of expansion is performed by using the original image and each stage.
The number of non-background pixels in the expanded image is determined by the
Detected when this third derivative became negative,
The number of inflation immediately before that is the optimal number of inflation.
2. The method of correcting inclination of a character document according to claim 1, wherein:
JP3201244A 1991-07-16 1991-07-16 How to correct the inclination of text documents Expired - Fee Related JP3046652B2 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP3201244A JP3046652B2 (en) 1991-07-16 1991-07-16 How to correct the inclination of text documents
DE69232345T DE69232345T2 (en) 1991-07-16 1992-07-15 Method for determining the inclination of an image containing characters
EP92112054A EP0525513B1 (en) 1991-07-16 1992-07-15 Method for detecting inclination of an image of characters
US08/535,322 US5546479A (en) 1991-07-16 1995-09-27 Method for detecting inclination of an image of characters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3201244A JP3046652B2 (en) 1991-07-16 1991-07-16 How to correct the inclination of text documents

Publications (2)

Publication Number Publication Date
JPH05143774A JPH05143774A (en) 1993-06-11
JP3046652B2 true JP3046652B2 (en) 2000-05-29

Family

ID=16437730

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3201244A Expired - Fee Related JP3046652B2 (en) 1991-07-16 1991-07-16 How to correct the inclination of text documents

Country Status (1)

Country Link
JP (1) JP3046652B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ATE309583T1 (en) * 2002-08-27 2005-11-15 Oce Print Logic Technologies S DETERMINING THE SLOW POSITION OF DOCUMENT IMAGES
WO2004029867A1 (en) * 2002-09-30 2004-04-08 Matsushita Electric Industrial Co., Ltd. Image correction device and image correction method
JP2012256109A (en) 2011-06-07 2012-12-27 Sony Corp Information processor, program, and information processing method

Also Published As

Publication number Publication date
JPH05143774A (en) 1993-06-11

Similar Documents

Publication Publication Date Title
JP4189506B2 (en) Apparatus, method and recording medium for image processing
US7145694B2 (en) Image processing apparatus and method
JP3046652B2 (en) How to correct the inclination of text documents
JPH04270485A (en) Printing character recognition device
JP3046653B2 (en) How to correct the inclination of text documents
JP3378439B2 (en) Form image creation device
JP3046656B2 (en) How to correct the inclination of text documents
JP3046654B2 (en) Detecting inclination of text originals
JPH1125222A (en) Method and device for segmenting character
JP2871601B2 (en) Character string detecting apparatus and method
JP2002133424A (en) Detecting method of inclination angle and boundary of document
JP3845227B2 (en) Blur correction device, blur correction method, and recording medium
JP3122476B2 (en) Automatic document copy machine
JP3157860B2 (en) How to extract figure area of manuscript
JP2841942B2 (en) Image input device
JP3162414B2 (en) Ruled line recognition method and table processing method
JP3147246B2 (en) Image processing apparatus and method
JP2977259B2 (en) Skew detection method
JP4439054B2 (en) Character recognition device and character frame line detection method
JP2001331766A (en) Preparing method of pattern recognition dictionary, computer-readable recording medium, pattern recognition dictionary preparing device and character recognition device
JP3438484B2 (en) Image correction processing device
JP3190085B2 (en) Image processing apparatus and method
JP2898041B2 (en) Character pattern creation device
JP2966448B2 (en) Image processing device
JPH05211607A (en) Device and method for image processing

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080317

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20090317

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees