JP2755299B2 - Image processing method - Google Patents

Image processing method

Info

Publication number
JP2755299B2
JP2755299B2 JP61132846A JP13284686A JP2755299B2 JP 2755299 B2 JP2755299 B2 JP 2755299B2 JP 61132846 A JP61132846 A JP 61132846A JP 13284686 A JP13284686 A JP 13284686A JP 2755299 B2 JP2755299 B2 JP 2755299B2
Authority
JP
Japan
Prior art keywords
vector
line
image
vertical
horizontal
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
JP61132846A
Other languages
Japanese (ja)
Other versions
JPS62290979A (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 JP61132846A priority Critical patent/JP2755299B2/en
Publication of JPS62290979A publication Critical patent/JPS62290979A/en
Application granted granted Critical
Publication of JP2755299B2 publication Critical patent/JP2755299B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は、入力された画像情報を直線部分を認識し直
線を形成する画像処理方法に関し、特に、画像ノイズの
影響を受けずに美しい直線を生成することのできる画像
処理方法に関する。 [従来の技術] 従来、例えばワードプロセサ等の文書作成装置では、
表等の枠線を入力する際には、例えばカーソルキー、又
はマウス等のポインテイングデバイスを使用して、枠線
の長さ、位置を指示していた。このような従来の方法
は、ポインテイングデバイスの操作に時間がかかり、簡
単に入力出来るというものではない。また、枠入力は文
字入力と操作が性質上異なるため、使用者は繁雑な操作
を習得しなければならず、大変不便であつた。 [発明が解決しようとする問題点] 本発明は上記従来技術の問題点を解決するために提案
されたもので、その目的は、入力された画像情報に直線
部分を認識し直線を形成する画像処理方法であって、画
像ノイズの影響を受けずに美しい直線を生成することの
できる画像処理方法を提案する事を目的とする。 [問題点を解決するための手段] 上記課題を実現するための本発明の画像処理方法の構
成は、 画像情報を入力し、 前記画像情報に対して細線化処理を施し、 細線化された画像情報において連続する黒画素を追跡
し、 前記追跡された連続する黒画素を、連続する所定画素
数の黒画素集合に分割して、各黒画素集合の位置情報を
記憶し、 前記記憶した黒画素集合の位置情報に従って各黒画素
集合の傾きを求め、 前記求められた傾きに従って、前記分割された黒画素
集合を略同じ傾きのグループに分類し、 前記分類されて略同じ傾きのグループに属する複数の
黒画素集合から直線形成情報を生成することを特徴とす
る。 [作用] 上記構成の画像処理方法は、入力画像情報に細線化処
理を施し、細線化された画像情報を所定画素の黒画素集
合に分割し、それらの黒画素集合のうち、傾きが略同じ
複数の黒画素集合をグループ化し、同じグループ内の黒
画素集合内で直線を認識する。 [実施例] 以下、添付図面を参照しつつ本発明に係る実施例の枠
線構成装置を詳細に説明する。以下の実施例は手書き入
力された表を表わす画像から、表を形成する枠線を認識
し、枠線全体を直線からなる表に仕上げるものである。 第2図は実施例の枠線構成装置を含むグラフイツクシ
ステムの外観図で、1は制御部、2はCRT、3はキーボ
ード、4はマウスである。これらで所謂ワークステーシ
ヨンを構成している。又、5は文書を走査して画像を入
力するイメージイスキヤナ、6はワークステーシヨンで
処理された画像を用紙にハードコピーするイメージプリ
ンタである。本認識装置においては、手書きの原始画像
は原稿用紙等に書かれたものをイメージスキヤナ5で読
取るか、又はマウス4によりCRT2上に手書き画像を形成
するようにしてもよい。要は手書き画像を何等かの形
で、後述のイメージメモリ部10へ格納されればよい。 第1図は第2図の枠線構成装置のハードウエア構成を
示すブロツク図である。ワークステーシヨンの制御部1
は、全体を制御するCPU回路8、枠線認識するプログラ
ムを格納した例えばRAM等から成るプログラムメモリ部
9と、デジタル画像を格納するイメージメモリ部10から
構成される。 第3図は、枠線認識処理の流れの概念を示すフローチ
ヤートである。このフローチヤートに従つて、ステツプ
毎にその細部を順に説明する。 <イメージ入力>…ステツプS31 まず、使用者がノートあるいはシート紙等の用紙上
に、所望の枠線をラフスケツチする。第4図に、手書き
による枠線が描かれたシートの一例を示す。この原稿を
イメージスキヤナ5に乗せ、キーボード3あるいはマウ
ス4からイメージ入力命令を制御部1に与える。する
と、CPU回路8はプログラムメモリ部9に格納されたプ
ログラムに従い、イメージスキヤナ5に画像スキヤン命
令を送る。イメージスキヤナ5は原稿上の画像情報をCC
D等のセンサから読み取り、イメージメモリ部10に画像
を格納する。 <前処理>…ステツプS32 イメージスキヤナ5より入力されたデジタル画像は、
イメージメモリ部10上では第5図に示すマトリクス構造
を持つ。画像は、原稿の横方向(以後これをx方向とす
る)に最大m個、原稿の縦方向(以後これをy方向とす
る)に最大n個の画像から構成されており、原稿の白,
黒に対応して各画素はそれぞれ“0"、“1"の値を持つ。
即ち、画素の座標値を、横方向にx=1,2,…,m、横方向
にy=1,2,…nとした時、位置(x,y)の画素の値P
(x,y)は次の式で表すことができる。 手書きによつて描かれた表枠は、P(x,y)=1であ
る画素の集合として表現されるのであるが、P(x,y)
=1である画素の列を追跡するための前処理として、ノ
イズ除去及び細線書を行う。ノイズ除去は例えば周知の
平滑化等で可能である。又、細線化は例えば位数,連結
度等を考慮して黒画素の縮退を行う等の周知の技術を用
いる事ができる。このノイズ除去及び細線化が終了する
と、手書きの表枠は幅1の連続点の集合となる。例えば
第4図の手書き入力の枠線の内、枠線部分61の近傍の線
及びその周辺の白部分60を第6図(a)に示す。第6図
(a)で、論理値“0"の画素が白部で、“1"の画素が黒
部である。 <ベクトル化>…ステツプS33 こうして得られたデジタル画像のP(1,2)…,P(x,
y),…P(m,n)なる各画素について、枠線を追跡しベ
クトル化する。本実施例の線追跡/ベクトル化のアルゴ
リズムを第7図(a)に示す。線追跡とは黒画素を順次
追跡するものであるが、その追跡は白画素が現われる
か、若しくは一度辿つた黒画素に出会うまで続ける。
又、ベクトル化とは連続する黒画素を所定の長さで切
り、その始点と終点の座標で線分とし、その線分でその
間の黒画素の集合を代表させるものである。その所定の
長さとして、本実施例では10画素とする。 第8図(a)に線追跡とベクトル化の例を示す。図
中、矢印は追跡方向を、実線は分割されたベクトル(線
分)を、破線は手書き入力された原画像を、一点鎖線は
最終的な枠線を示す。第8図(a)の例ではベクトルI,
II,III…が横線(水平線)になるべきものであり、ベク
トルIV,V,VIが縦線(垂直線)となるべきものである。 本実施例では各ベクトルが垂直線を構成すべきもの
か、それとも水平線を構成すべきものかの区別を各ベク
トルの傾きから行なう。従つて、前記所定の長さは短く
すればする程、複数(細かい)な形状の表を認識する事
が可能となるが、その反面、第8図(b)の如く例えば
枠線の角部分のような場合に、表の垂直線と水平線とを
誤認識する可能性が高くなる。例えば、最低の長さとし
て、理論上2画素幅をとる事は可能であるが、その2画
素で表わされる線分の傾きは±45度をとる事があり、こ
の場合にその線分の属する枠線が縦線であるべきか横線
であるべきかの判断は、その線分の前後関係を判断しな
い限りは困難となる。 そこで、本実施例では、ベクトルの長さを一応10画素
と比較的短くとることにより細かい表の認識を可能と
し、その上で上記誤認識の防止を、ヒストグラムからの
最終値をもつて目的の枠線が存在する座標とするように
して、ノイズ処理するようにしている。この点について
は後に詳述する。 第9図に第7図(a)のアルゴリズムにより得られた
ベクトルの集合を格納するベクトルテーブルを示す。ベ
クトルテーブルは始点座標,終点座標及びそれら2つの
座標で定義される線分の傾きk等を格納するようになつ
ている。但し、第9図中、添字は始点を、は終点を
表わすものとする。 第7図(a)のフローチヤートに従つて説明するとス
テツプS100で最初の黒画素を捜す。これはラスタスキヤ
ン方式で左上端の画素P(1,1)から順に捜して行けば
よい。そのような画素が見付かると、ステツプS104でそ
の点を始点座標(xs,ys)として、第9図のベクトルテ
ーブルに格納する。ステツプS105で第6図(b)の追跡
マツプを「追跡済み」(例えば、“2")とマークする。
この追跡マツプはイメージメモリ部10の各画素に対応し
て1つづつあるもので、追跡の結果白画素であれば“1"
とマークし、黒画素であれば“2"とマークする。追跡マ
ツプは例えばRAMで構成されたプログラムメモリ部9内
の一部に設ける事ができる。 ステツプS106の黒点追跡は例えば第8図(c)の如
く、画素P(x,y)の隣接点を追跡するものである。画
素P(x,y)の8個の隣接点について、P(x+1,y−
1),P(x+1,y+1),P(x,y+1),P(x−1,y+
1),P(x−1,y),P(x−1,y−1),P(x,y−1)の
順に、黒点の存在を調べる。もし、8つの隣接点中のい
ずれかに黒点が存在すれば、ステツプS107からステツプ
S108へ進み、当該画素に対応する追跡マツプ上の点を、
追跡済みの黒点とマーク(“2")する。この黒点追跡を
10画素分のベクトルを切り取るまで繰返す(ステツプS1
06〜ステツプS109のループ)。 1つのベクトルを切出すと、ステツプS110へ進み、当
該黒点の座標を、ステツプS104(又は、ステツプS111)
で始点を格納したベクトルの対応する終点(xe,ye)と
してベクトルテーブルに格納する。更に、当該黒点の座
標をステツプS111で、次のベクトルの始点座標(xs,
ys)として格納する。 やがて、ステツプS107で、第8図(c)の領域に黒点
がなく、又はあつても追跡済みの点(第6図(b)のマ
ツプで“2"とマークされている画素)のみであるなら
ば、追跡してきた線は現在の画素で終わると考えられる
ので、ステツプS112でベクトルテーブルの終点座標
(xe,ye)を格納する。そして、ステツプS113でその点
が白点ならば白(“1")とマークし、追跡済みの黒点な
らばその旨マークする。こうして1つのベクトルの追跡
が完了した。 そこで次に、ステツプS114で未だ未追跡の画素を捜
し、ステツプS101に戻り、その点が黒点か白点かを判断
し、黒点なら、ステツプS104へ進み、前述のステツプを
繰返す。もしステツプS101で白点をみつけたら、ステツ
プS102で、追跡マツプを“1"とマークする。 ステツプS103では、全ての画素を追跡したかを判断す
る。これは、追跡マツプに“0"の点が残つているか否か
で判断できる。こうして、ベクトルテーブルには、水平
線,垂直線を構成する全てのベクトルが追跡された順で
混在して格納される。 <ベクトル分類>…ステツプS34 こうして、すべての画素についてベクトル化を行つた
後、ベクトルテーブルの座標値より、ベクトル毎の傾き
kを求め、ベクトルテーブルに記入する。ベクトルの傾
きkは次の式で表される。 この傾きはベクトルテーブル中に格納されているベク
トルが垂直ベクトルか水平ベクトルかの判断に使う。垂
直ベクトルとは第19図に示した如く枠の縦線を構成すべ
きベクトルであり、水平ベクトルとは枠の横線を構成す
べきベクトルである。ベクトル分類のアルゴリズムを第
7図(b)に示す。 同図のフローチヤートにおいて、ステツプS10→ステ
ツプS17→ステツプS10のループはベクトルテーブルから
順にベクトルを読出して、傾きkを算出し、そのkに応
じて水平ベクトル又は垂直ベクトルに分類するものであ
る。ステツプS10でベクトルを取出して、ステツプS11で
上述の式に基づいて傾きkを算出する。ステツプS12の
モードとは、枠線認識を精細モードで行うのか通常モー
ドを行うかの意味で、これら2つのモードはキーボード
3等により選択され、本装置はこのステツプに入るに先
立つていずれかのモードに設定されている。 ここで、通常モードはすべてのベクトルを垂直ベクト
ルか水平ベクトルかのいずれかに分類するもので、この
ような分類は単に|k|>1、又は|k|≦1であるかを判断
(ステツプS14)し、その判断に基づいて、水平ベクト
ルテーブル(ステップS15)又は垂直ベクトルテーブル
(ステツプS16)にベクトルを格納することによりなさ
れる。垂直ベクトルテーブルを第10図に、水平ベクトル
テーブルを第11図に示す。 精細モードとは第7図(c)に示したように、 であれば水平ベクトルと判断し、 であれば垂直ベクトルと判断する一方で、 の間にあるベクトルは認識対象から除外するモードであ
る。こうすることにより、後述のヒストグラムの最頻値
の精度を上げる事が可能となり、より所望の枠線に近い
表が得られるようになる。何故なら、 なる範囲は角度で言えば、30度〜60度、120度〜150度…
…であり、このような範囲にあるベクトルは斜め方向に
入力されたものでありノイズとすべきものであるからで
ある。このために、 のときは、ステツプS13からステツプS17に直接進み、垂
直ベクトルテーブル又は水平ベクトルテーブルに格納し
ない。尚、精細モードを画する は、当然の事ながらこれらの値に限られず、可変であつ
てよい。 さて、この垂直ベクトルテーブル、又は水平ベクトル
テーブルへの格納の際(ステツプS15,S16)、各ベクト
ルがx軸,又はy軸に平行でないであろう事を考慮し
て、そのバラツキを少なくするために、垂直ベクトルに
ついては、第12図(a)に示すように(xs+xe)/2をそ
の垂直ベクトルのx座標(そのような座標を便宜上、x
中点と呼ぶ)として代表させ、一方、水平ベクトルにつ
いては、第12図(b)に示すように(ys+ye)/2をその
座標(同じく、y中点と呼ぶ)として代表させるように
格納する。即ち、一本の垂直ベクトルはx中点及び始
点,終点のy座標で表現できる。もし枠線の1つの垂直
線を構成している垂直ベクトルが複数個あるならば、そ
のような複数個の垂直ベクトルは互いに近い値のx中点
をもつ筈である。これが後述のヒストグラムをとる根拠
となつている。又、水平ベクトルについても同様であ
る。 そこで、ベクトルの分類が終わると、ステツプS18
で、垂直ベクトルはx中点の座標の値で、水平ベクトル
はy中点の座標の値で、夫々昇順に並べ換え(ソーテイ
ング)を行う。この並べ換えにより、ベクトル化の追跡
順に依存したものであつた垂直,水平ベクトルテーブル
中の各ベクトルの順序が、1つの垂直線(又は、水平
線)を構成するベクトル毎に、並べ換えられる。この段
階では第20図に示した如く、最終的には一本の直線とな
るべき複数の垂直ベクトル(水平ベクトル)はバラバラ
で、いずれのx中点(y中点)を垂直線(水平線)の最
終的なx座標値(y座標値)とすべきか決定されていな
い。 その決定のために、ステツプS19で垂直ベクトル(水
平ベクトル)については、x中点(y中点)についての
ヒストグラムを求め、その最頻値をもつて、垂直線(水
平線)のx座標(y座標)とする。第13図に第4図の画
像の場合に得られる垂直ベクトルのヒストグラムの一例
を示す。最頻値を順にx1,x2,x3,x4,x5とする。同様のヒ
ストグラムを水平ベクトルテーブルについても求め、結
果として、水平線のy座標値y1,y2,y3,y4,y5を得る。次
に、ステツプS20で垂直ベクトルテーブル(水平ベクト
ルテーブル)中のx中点(y中点)を各垂直線(水平
線)毎に、前記求めた最頻値xi(yi)で置き換える。こ
の時点で、垂直ベクトルテーブル(水平ベクトルテーブ
ル)中においては、1つの垂直線(水平線)を構成する
ベクトルの始点座標と終点座標とは1つの直線で連な
る。尚、前述のベクトルの中点をベクトル位置に置き換
える操作はヒストグラムの拡がりを狭め、精度を増す効
果がある。 前述した精細モードの効果について説明する。通常モ
ードでは第13図のヒストグラムにおいて、各xの値に対
する頻度の幅が拡がつてしまう。この拡がりは最頻値を
求めるときの誤差要素になる。ところが、精細モードに
おいては、斜め方向(例えば、30度〜60度、120度〜150
度……)に入力されたベクトルは認識対象から除外さ
れ、従つてヒストグラム上には現われないので、前記拡
がりが少なくなる効果がある。 <プリンタ出力>……ステツプS35 ここで得られた垂直、水平ベクトルをプリンタ6に出
力すると、排紙トレイ7上に、第14図に示す清書された
表枠線が描かれた出力用線が得られる。 <出力の評価> さて上述した実施例では、一定の範囲内にあるベクト
ルを垂直ベクトル又は水平ベクトルに分類していた。こ
の分類は、ベクトルを縦線方向又は横線方向に揃うよう
に強制的に回転している事に相当する。このような回転
はベクトルが同じ縦線又は横線上にあれば問題無いが、
第8図(b)の枠線の角の部分のベクトル20のように、
このベクトルを垂直ベクトルか水平ベクトルのいずれか
にしてしまうと、その方のベクトルは「飛び出た」部分
ができ、他方には「空白」の部分ができる。又、前述し
た精細モードであつては、ベクトル20は斜めであるとし
て除外され、結果的に「空白」部分ができる。しかしこ
の「空白」部分は次の理由により問題にならないと考え
られる。即ち、ベクトル切出しは10画素単位で行なつて
いるので、「飛び出る」部分又は「空白」部分の最大長
は、そのベクトルの傾きが45度として、 であると考えられ、この程度であれば問題にならないか
らである。又、この程度であれば、削除,補間は容易で
ある。 ところで、前述の実施例は、入力された手書き画像を
第4図の如く線の切れ目がない状態で入力されたものと
して説明した。しかし、手書きであれば、例えば第15図
のように切れ目100,101が存在する事もあり得る。とこ
ろが、この切れ目はベクトル化の過程でベクトルの情報
そのものとしては消えてしまう。又、もしその切れ目が
10画素以上であれば、、ベクトルの個数が1つ減る事に
なる。そこで、上記実施例と同様に、垂直ベクトル及び
水平ベクトルについて、ヒストグラムをとり、更に並べ
変えを行う。そして、抜けた部分の画素数を数え、その
抜け部分の画素数と所定の閾値とを比べ、抜けの画素数
が小のときは、その抜けの部分を補間するようにする。
さて、上記閾値としては、通常考えられる表の升目の大
きさ、又は、1文字のフォントの大きさを目安にして決
定すればよい。 <実施例の効果> 以上説明した実施例によれば、 :手書きによる枠線を、イメージスキヤナから入力す
るという簡単な手順で、清書化された表枠線を文字作成
装置に入力出来るようになつた。 :任意の曲線を含む原始画像を加工して、高精度に、
直線からなる枠線を生成できる。 :精細モードにすれば、縦線又は横線とすべきでない
ベクトルをノイズとして除外でき、より正確な表が得ら
れる。 :フアクシミリで得られる走査線画像に画素の添加,
削除を行うような構成に比して、より高精度にできる。 :垂直ベクトル,水平ベクトルの夫々の、横線,縦線
に対する相対的位置をベクトルの中点で置き換えるの
で、ヒストグラムをとるときの誤差が極小化される。 :清書化された枠線をCRT2上に出力し、制御部1の持
つワードプロセツサ機能により文字、図形を加えるとい
つた文書編集も可能である。また、水平、垂直方向の枠
線をベクトル情報として格納しているので、文字追加の
際、文字の大きさに従つて簡単に枠線の位置を変更でき
る。 <他の変形例> 上述の実施例と異なり、ベクトルの傾きkの分類を、
水平,垂直の2種類だけでなく、水平,垂直,右斜線,
左斜線の4種類にし、斜め線の枠線も認識可能になる。
このときは、ヒストグラムも水平,垂直,右斜線,左斜
線の4種類について行えばよい。又、ベクトル化も単に
始点と終点の組合せで把握した方法に限られず、所定幅
毎に連続する黒点の集合において、例えば最小自乗法に
よるベクトルの抽出も可能である。 又、上述の実施例において、手書き画像による入力は
原稿をイメージスキヤナから入力するようにしていた
が、マウス4等のポインテイングデバイス等を用いてCR
T2画面上に描いて入力するようにしてもよい。 又、第16図の如く、表の升目が一部で他の部分と異な
る部分102があつても、つまり大きい升目を必要とする
ような場合は、前述した実施例に従つてヒストグラムを
とれば第17図の如く、前記異なる部分に対応するヒスト
グラムの度数が比較的大きく下がるので、手書きによる
抜けとの区別がつく。そして、102に対応する部分のベ
クトルは存在しないので、出力された表は第18図の如く
所期のものが得られる。 [発明の効果] 以上説明したように本発明の画像処理方法は、入力画
像情報に細線化処理を施し、細線化された画像情報を所
定画素数の黒画素集合に分割し、それらの黒画素集合の
うち、傾きが略同じ複数の黒画素集合をグループ化し、
同じグループ内の黒画素集合内で直線を認識するように
している。従って、生成された直線は画像全体を考慮し
た直線認識に基づく結果であるので、その生成直線は画
像ノイズの影響を受けたものではなく、ユーザにとって
は美しい直線となる。 また、前処理として細線化を行うので直線認識の精度
が向上する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an image processing method for recognizing a straight line portion of input image information and forming a straight line, and in particular, a beautiful straight line without being affected by image noise. The present invention relates to an image processing method capable of generating a. [Prior Art] Conventionally, for example, in a document creation device such as a word processor,
When a frame line such as a table is input, the length and the position of the frame line are designated by using a cursor key or a pointing device such as a mouse. In such a conventional method, it takes time to operate the pointing device, and input cannot be performed easily. In addition, the character input and the character input are different in operation from the character input, so that the user has to learn complicated operations, which is very inconvenient. [Problems to be Solved by the Invention] The present invention has been proposed to solve the above-mentioned problems of the prior art, and an object of the present invention is to provide an image forming a straight line by recognizing a straight line portion in input image information It is an object of the present invention to propose an image processing method capable of generating a beautiful straight line without being affected by image noise. [Means for Solving the Problems] A configuration of an image processing method according to the present invention for realizing the above-described object includes inputting image information, performing a thinning process on the image information, and forming a thinned image. Tracking continuous black pixels in the information; dividing the tracked continuous black pixels into a set of continuous predetermined number of black pixels; storing position information of each black pixel set; and storing the stored black pixels. The inclination of each set of black pixels is obtained according to the position information of the set, and the divided black pixel sets are classified into groups having substantially the same inclination according to the obtained inclination. Is characterized in that straight line formation information is generated from a set of black pixels. [Operation] The image processing method having the above configuration performs a thinning process on input image information, divides the thinned image information into a set of black pixels of predetermined pixels, and, among those black pixel sets, the slopes of which are substantially the same. A plurality of black pixel sets are grouped, and a straight line is recognized within the black pixel sets in the same group. [Embodiment] Hereinafter, a frame line configuration device according to an embodiment of the present invention will be described in detail with reference to the accompanying drawings. The following embodiment recognizes a frame forming a table from an image representing a table input by handwriting, and finishes the entire frame into a table composed of straight lines. FIG. 2 is an external view of a graphic system including a frame configuration device of the embodiment, wherein 1 is a control unit, 2 is a CRT, 3 is a keyboard, and 4 is a mouse. These constitute a so-called work station. Reference numeral 5 denotes an image scanner for scanning a document and inputting an image, and reference numeral 6 denotes an image printer for hard-copying an image processed by the work station onto a sheet. In the present recognition apparatus, a handwritten original image written on a document sheet or the like may be read by the image scanner 5 or a handwritten image may be formed on the CRT 2 by the mouse 4. The point is that the handwritten image may be stored in any form in the image memory unit 10 described later. FIG. 1 is a block diagram showing a hardware configuration of the frame configuration device shown in FIG. Control part 1 of work station
Is composed of a CPU circuit 8 for controlling the whole, a program memory unit 9 composed of, for example, a RAM or the like storing a program for recognizing a frame line, and an image memory unit 10 storing a digital image. FIG. 3 is a flowchart showing the concept of the flow of the frame line recognition processing. In accordance with this flowchart, the details will be described in order for each step. <Input Image> Step S31 First, the user rough sketches a desired frame line on a sheet such as a notebook or a sheet of paper. FIG. 4 shows an example of a sheet on which a frame line is drawn by hand. The original is placed on the image scanner 5, and an image input command is given to the control unit 1 from the keyboard 3 or the mouse 4. Then, the CPU circuit 8 sends an image scan command to the image scanner 5 according to the program stored in the program memory unit 9. Image Scanner 5 converts the image information on the document to CC
The image is read from a sensor such as D and stored in the image memory unit 10. <Pre-processing> Step S32 The digital image input from the image scanner 5 is
The image memory section 10 has a matrix structure shown in FIG. The image is composed of a maximum of m images in the horizontal direction (hereinafter referred to as x direction) of the document and a maximum of n images in the vertical direction (hereinafter referred to as y direction) of the document.
Each pixel has a value of “0” and “1” corresponding to black.
That is, when x = 1, 2,..., M in the horizontal direction and y = 1, 2,... N in the horizontal direction, the pixel value P at the position (x, y) is obtained.
(X, y) can be expressed by the following equation. The table frame drawn by hand is represented as a set of pixels with P (x, y) = 1, but P (x, y)
Noise removal and fine line drawing are performed as pre-processing for tracking the column of pixels where = 1. The noise can be removed by, for example, well-known smoothing. For thinning, a well-known technique such as degeneration of a black pixel in consideration of an order, connectivity, or the like can be used. When the noise removal and thinning are completed, the handwritten table frame becomes a set of continuous points of width 1. For example, among the frame lines of the handwritten input in FIG. 4, a line near the frame portion 61 and a white portion 60 around the line are shown in FIG. 6 (a). In FIG. 6A, a pixel having a logical value of “0” is a white portion, and a pixel having a logical value of “1” is a black portion. <Vectorization> ... Step S33 P (1,2) of the digital image thus obtained ..., P (x,
y),... For each pixel P (m, n), the frame is traced and vectorized. FIG. 7A shows an algorithm of line tracing / vectorization according to this embodiment. Line tracing is a method of sequentially tracing black pixels, and the tracing is continued until a white pixel appears or a black pixel that has been traced once is encountered.
In the vectorization, a continuous black pixel is cut at a predetermined length, a line segment is formed by the coordinates of the start point and the end point, and the line segment represents a set of black pixels therebetween. In this embodiment, the predetermined length is 10 pixels. FIG. 8 (a) shows an example of line tracking and vectorization. In the figure, the arrow indicates the tracking direction, the solid line indicates the divided vector (line segment), the broken line indicates the original image input by handwriting, and the dashed line indicates the final frame line. In the example of FIG. 8A, the vectors I,
.. Should be horizontal lines (horizontal lines), and the vectors IV, V, VI should be vertical lines (vertical lines). In this embodiment, whether each vector should form a vertical line or a horizontal line is determined based on the inclination of each vector. Therefore, the shorter the predetermined length is, the more it is possible to recognize a table having a plurality of (fine) shapes. On the other hand, as shown in FIG. In such a case, the possibility of erroneously recognizing a vertical line and a horizontal line in the table increases. For example, it is theoretically possible to take the width of two pixels as the minimum length, but the slope of the line segment represented by the two pixels may take ± 45 degrees, in which case the line segment belongs to It is difficult to determine whether a frame should be a vertical line or a horizontal line unless the context of the line is determined. Therefore, in the present embodiment, it is possible to recognize a detailed table by setting the length of the vector to be relatively short, for example, 10 pixels, and to prevent the above-described erroneous recognition by using the final value from the histogram with the objective value. The noise processing is performed by setting the coordinates at which the frame line exists. This will be described in detail later. FIG. 9 shows a vector table for storing a set of vectors obtained by the algorithm of FIG. 7 (a). The vector table stores a start point coordinate, an end point coordinate, a slope k of a line segment defined by these two coordinates, and the like. However, in FIG. 9, the subscript s represents the start point, and e represents the end point. Referring to the flowchart of FIG. 7A, the first black pixel is searched in step S100. This may be performed by sequentially searching from the pixel P (1,1) at the upper left corner in the raster scan method. If such a pixel is found, the point of the start point coordinates (x s, y s) as in step S104, and stores the vector table of Figure 9. In step S105, the tracking map shown in FIG. 6B is marked as "tracked" (for example, "2").
There is one tracking map corresponding to each pixel of the image memory unit 10. If the tracking result indicates a white pixel, "1" is displayed.
And if the pixel is a black pixel, "2". The tracking map can be provided in a part of the program memory unit 9 composed of, for example, a RAM. The black point tracking in step S106 tracks the adjacent point of the pixel P (x, y) as shown in FIG. 8 (c), for example. For eight adjacent points of the pixel P (x, y), P (x + 1, y−
1), P (x + 1, y + 1), P (x, y + 1), P (x−1, y +
1) Examine the existence of a black point in the order of P (x−1, y), P (x−1, y−1), P (x, y−1). If a black point exists at any of the eight adjacent points, the process proceeds from step S107 to step S107.
Proceeding to S108, a point on the tracking map corresponding to the pixel is
Mark (“2”) as a tracked black dot. Tracking this sunspot
Repeat until 10 pixel vectors are cut (Step S1
06 to loop of step S109). When one vector is cut out, the process proceeds to step S110, and the coordinates of the black point are set in step S104 (or step S111).
Is stored in the vector table as the corresponding end point (x e , y e ) of the vector storing the start point. Further, in step S111, the coordinates of the black point are set as the start point coordinates (x s ,
y s ). Eventually, in step S107, there is no black point in the area of FIG. 8 (c), or at least there are only tracked points (pixels marked "2" in the map of FIG. 6 (b)). Then, since the traced line is considered to end at the current pixel, the end point coordinates (x e , y e ) of the vector table are stored in step S112. Then, in step S113, if the point is a white point, it is marked as white ("1"), and if it is a tracked black point, it is marked as such. Thus, tracking of one vector is completed. Then, in step S114, a pixel which has not been tracked yet is searched for, and the process returns to step S101 to determine whether the point is a black point or a white point. If the point is a black point, the process proceeds to step S104 to repeat the above-described steps. If a white spot is found in step S101, the tracking map is marked as "1" in step S102. In step S103, it is determined whether all pixels have been tracked. This can be determined based on whether or not a “0” point remains in the tracking map. In this way, in the vector table, all the vectors constituting the horizontal line and the vertical line are stored together in the order of tracking. <Vector Classification> Step S34 After the vectorization is performed for all the pixels in this way, the inclination k of each vector is obtained from the coordinate values of the vector table, and is entered in the vector table. The slope k of the vector is represented by the following equation. This inclination is used to determine whether the vector stored in the vector table is a vertical vector or a horizontal vector. The vertical vector is a vector that forms the vertical line of the frame as shown in FIG. 19, and the horizontal vector is a vector that forms the horizontal line of the frame. FIG. 7 (b) shows an algorithm for vector classification. In the flowchart of FIG. 11, the loop of step S10 → step S17 → step S10 reads the vectors in order from the vector table, calculates the slope k, and classifies the vectors into horizontal vectors or vertical vectors according to the k. In step S10, the vector is extracted, and in step S11, the slope k is calculated based on the above equation. The mode of step S12 means whether the frame line recognition is performed in the fine mode or the normal mode. These two modes are selected by the keyboard 3 or the like. Mode is set. Here, the normal mode classifies all vectors into either vertical vectors or horizontal vectors, and such a classification simply determines whether | k |> 1 or | k | ≦ 1 (step S14), and based on the determination, the vector is stored in the horizontal vector table (step S15) or the vertical vector table (step S16). The vertical vector table is shown in FIG. 10, and the horizontal vector table is shown in FIG. The definition mode is, as shown in FIG. 7 (c), If so, judge it as a horizontal vector, Is determined as a vertical vector, Vectors between are modes to be excluded from recognition targets. By doing so, it becomes possible to increase the accuracy of the mode of the histogram described later, and a table closer to a desired frame line can be obtained. Because, The range is 30 to 60 degrees, 120 to 150 degrees ...
This is because vectors in such a range are input in an oblique direction and should be noise. For this, In the case of (1), the process directly proceeds from step S13 to step S17, and is not stored in the vertical vector table or the horizontal vector table. In addition, draw the fine mode Is naturally not limited to these values and may be variable. Now, at the time of storing in the vertical vector table or the horizontal vector table (steps S15 and S16), taking into account that each vector will not be parallel to the x axis or the y axis, As for the vertical vector, as shown in FIG. 12 (a), (x s + x e ) / 2 is represented by the x coordinate of the vertical vector (for convenience, such a coordinate is represented by x
On the other hand, as for the horizontal vector, (y s + y e ) / 2 is represented as its coordinates (also called the y middle point) as shown in FIG. 12 (b). To be stored. That is, one vertical vector can be represented by the y-coordinate of the x middle point and the start and end points. If there is more than one vertical vector that constitutes one vertical line of the frame, then such multiple vertical vectors should have values of x midpoint close to each other. This is the basis for taking a histogram described later. The same applies to the horizontal vector. Therefore, when the classification of the vectors is completed, step S18
The vertical vector is the value of the coordinate of the middle point x, and the horizontal vector is the value of the coordinate of the middle point y, and is sorted in ascending order. By this rearrangement, the order of each vector in the vertical and horizontal vector tables, which depends on the tracking order of vectorization, is rearranged for each vector constituting one vertical line (or horizontal line). At this stage, as shown in FIG. 20, a plurality of vertical vectors (horizontal vectors) that should eventually become one straight line are disjoint, and any x midpoint (y midpoint) is a vertical line (horizontal line). It is not determined whether the final x coordinate value (y coordinate value) should be used. For this determination, in step S19, for the vertical vector (horizontal vector), a histogram for the x midpoint (y midpoint) is obtained, and the mode is set to the x coordinate (y) of the vertical line (horizontal line). Coordinates). FIG. 13 shows an example of a vertical vector histogram obtained in the case of the image shown in FIG. The mode of sequentially with x 1, x 2, x 3 , x 4, x 5. A similar histogram is also obtained for the horizontal vector table, and as a result, y-coordinate values y 1 , y 2 , y 3 , y 4 , y 5 of the horizontal line are obtained. Next, in step S20, the x midpoint (y midpoint) in the vertical vector table (horizontal vector table) is replaced for each vertical line (horizontal line) by the mode value x i (y i ) obtained above. At this point, in the vertical vector table (horizontal vector table), the start point coordinates and the end point coordinates of the vector forming one vertical line (horizontal line) are connected by one straight line. Note that the above operation of replacing the midpoint of the vector with the vector position has the effect of narrowing the spread of the histogram and increasing the accuracy. The effect of the above-described fine mode will be described. In the normal mode, the frequency range for each value of x in the histogram of FIG. 13 is expanded. This spread becomes an error element when obtaining the mode. However, in the fine mode, the oblique direction (for example, 30 degrees to 60 degrees, 120 degrees to 150 degrees)
...) Are excluded from the recognition target and, therefore, do not appear on the histogram, which has the effect of reducing the spread. <Printer Output> Step S35 When the vertical and horizontal vectors obtained here are output to the printer 6, an output line on which the printed frame line shown in FIG. can get. <Evaluation of Output> In the above-described embodiment, vectors within a certain range are classified as vertical vectors or horizontal vectors. This classification corresponds to forcibly rotating the vectors so as to be aligned in the vertical line direction or the horizontal line direction. Such rotation is fine if the vectors are on the same vertical or horizontal line, but
Like the vector 20 at the corner of the frame line in FIG. 8B,
If this vector is made either a vertical vector or a horizontal vector, that vector will have a "protruding" portion and the other will have a "blank" portion. Also, in the fine mode described above, the vector 20 is excluded as being oblique, resulting in a "blank" portion. However, this "blank" portion is not considered to be a problem for the following reasons. That is, since the vector extraction is performed in units of 10 pixels, the maximum length of the "popping out" portion or the "blank" portion is, assuming that the inclination of the vector is 45 degrees, It is considered that this does not matter. Also, with this degree, deletion and interpolation are easy. By the way, in the above-described embodiment, the input handwritten image has been described as being input without any line break as shown in FIG. However, in the case of handwriting, breaks 100 and 101 may exist as shown in FIG. 15, for example. However, this break disappears as vector information itself during the vectorization process. Also, if the break
If the number of pixels is 10 or more, the number of vectors is reduced by one. Therefore, in the same manner as in the above embodiment, a histogram is obtained for the vertical vector and the horizontal vector, and further rearrangement is performed. Then, the number of pixels in the missing portion is counted, and the number of pixels in the missing portion is compared with a predetermined threshold. If the number of missing pixels is small, the missing portion is interpolated.
The threshold value may be determined by using the size of a cell in a normally conceivable table or the size of a font of one character as a guide. <Effects of Embodiment> According to the embodiment described above, it is possible to input a handwritten frame line from the image scanner in a simple procedure to input a fairly formatted table frame line to the character creation device. Natsuta : High-precision processing of source images including arbitrary curves
A frame line consisting of straight lines can be generated. : In the fine mode, vectors that should not be vertical or horizontal lines can be excluded as noise, and a more accurate table can be obtained. : Addition of pixel to scanning line image obtained by facsimile,
Higher precision can be achieved as compared to a configuration in which deletion is performed. : Since the relative positions of the vertical vector and the horizontal vector with respect to the horizontal and vertical lines are replaced by the midpoint of the vector, the error when taking the histogram is minimized. : Output of the copied frame on the CRT 2 and the addition of characters and graphics by the word processor function of the control unit 1 enables document editing at any time. Also, since the horizontal and vertical frame lines are stored as vector information, the position of the frame line can be easily changed according to the size of the character when adding a character. <Other Modifications> Unlike the above-described embodiment, the classification of the vector inclination k is
Horizontal, vertical, diagonal right,
With four types of left oblique lines, oblique frame lines can be recognized.
In this case, the histogram may be performed for four types of horizontal, vertical, right oblique lines, and left oblique lines. In addition, the vectorization is not limited to the method simply grasped by the combination of the start point and the end point, and it is also possible to extract a vector by, for example, the least square method from a set of continuous black points for each predetermined width. Further, in the above-described embodiment, the input by the handwritten image is performed by inputting the original from the image scanner.
You may draw and input on the T2 screen. Also, as shown in FIG. 16, even when there is a part 102 in which the cells in the table are partly different from other parts, that is, when a large cell is required, a histogram can be obtained according to the above-described embodiment. As shown in FIG. 17, the frequency of the histogram corresponding to the different portion is relatively greatly reduced, so that the histogram can be distinguished from handwritten omission. Since there is no vector corresponding to 102, the desired output table is obtained as shown in FIG. [Effects of the Invention] As described above, the image processing method of the present invention performs thinning processing on input image information, divides the thinned image information into a set of black pixels of a predetermined number of pixels, and Of the set, group a plurality of black pixel sets with approximately the same slope,
A straight line is recognized in a set of black pixels in the same group. Therefore, since the generated straight line is a result based on the straight line recognition in consideration of the entire image, the generated straight line is not affected by the image noise and is a beautiful straight line for the user. In addition, since thinning is performed as preprocessing, the accuracy of straight line recognition is improved.

【図面の簡単な説明】 第1図は本発明に係る一実施例のブロツク構成図、 第2図は実施例の枠線構成装置をグラフイツク処理シス
テムとしたときの外観図、 第3図は実施例における処理手順の概略を示すフローチ
ヤート、 第4図は手書き入力の一例を示す図、 第5図はイメージメモリ内の空間を示す図、 第6図(a)は第4図の入力の一部に対応するイメージ
メモリ内のデータを示す図、 第6図(b)はイメージメモリの各画素に対応した追跡
マツプの図、 第7図(a)は実施例に係る処理の制御手順を示すフロ
ーチヤート、 第7図(b)はベクトル分類の処理フローチヤート、 第7図(c)は精細モードを説明する図、 第8図(a),(b)はベクトル化処理を説明する図、 第8図(c)はベクトル化のための黒点追跡の手法を説
明する図、 第9図はベクトルテーブルを示す図、 第10図,第11図は夫々垂直ベクトル及び水平ベクトルテ
ーブルを示す図、 第12図(a),(b)はベクトルの最適化を説明する
図、 第13図はx方向に対するベクトルのヒストグラム、 第14図は実施例により清書化された表を示す図 第15図は手書入力の一部に抜けがある場合を説明する
図、 第16図,17図,18図は夫々、他の変形例における手書入力
図、ヒストグラム、清書化された表の図、 第19図は同一方向ではあるが、位置がバラバラである垂
直ベクトル及び水平ベクトルと最終的な枠線との対応を
示す図である。 図中、 1……制御部、2……CRTデイスプレイ、3……キーボ
ード、4……マウス、5……イメージスキヤナ、6……
プリンタ部、8……CPU回路、9……プログラムメモリ
部、10……イメージメモリ部、100,101……抜け(切れ
目)、I〜VI……ベクトルである。
BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram of an embodiment according to the present invention, FIG. 2 is an external view of a frame processing system of the embodiment, and FIG. 4 is a flowchart showing an outline of a processing procedure in the example, FIG. 4 is a diagram showing an example of handwriting input, FIG. 5 is a diagram showing a space in an image memory, and FIG. FIG. 6B shows a diagram of a tracking map corresponding to each pixel of the image memory, and FIG. 7A shows a control procedure of processing according to the embodiment. FIG. 7 (b) is a flowchart illustrating a vector classification process, FIG. 7 (c) is a diagram illustrating a fine mode, FIGS. 8 (a) and (b) are diagrams illustrating a vectorization process, FIG. 8 (c) illustrates the method of black spot tracking for vectorization. 9, FIG. 9 shows a vector table, FIGS. 10 and 11 show vertical and horizontal vector tables, respectively. FIGS. 12 (a) and 12 (b) explain vector optimization. FIG. 13, FIG. 13 is a histogram of the vector in the x direction, FIG. 14 is a diagram showing a table which has been copied in accordance with the embodiment, FIG. Figures 17, 17 and 18 are hand-written input diagrams, histograms, and tables of fairly formatted tables in other modifications, respectively.Figure 19 is a vertical vector and a horizontal vector in the same direction but at different positions. It is a figure which shows the correspondence of a final frame line. In the figure, 1 ... control unit, 2 ... CRT display, 3 ... keyboard, 4 ... mouse, 5 ... image scanner, 6 ...
Printer section, 8 CPU circuit, 9 Program memory section, 10 Image memory section, 100, 101...

Claims (1)

(57)【特許請求の範囲】 1.画像情報を入力し、 前記画像情報に対して細線化処理を施し、 細線化された画像情報において連続する黒画素を追跡
し、 前記追跡された連続する黒画素を、連続する所定画素数
の黒画素集合に分割して、各黒画素集合の位置情報を記
憶し、 前記記憶した黒画素集合の位置情報に従って各黒画素集
合の傾きを求め、 前記求められた傾きに従って、前記分割された黒画素集
合を略同じ傾きのグループに分類し、 前記分類されて略同じ傾きのグループに属する複数の黒
画素集合から直線形成情報を生成することを特徴とする
画像処理方法。
(57) [Claims] Inputting image information, performing thinning processing on the image information, tracking continuous black pixels in the thinned image information, and replacing the tracked continuous black pixels with a predetermined number of continuous black pixels. Divide into pixel sets, store the position information of each black pixel set, determine the slope of each black pixel set according to the stored position information of the black pixel set, and according to the determined slope, the divided black pixels An image processing method comprising: classifying a set into groups having substantially the same inclination; and generating straight line formation information from a plurality of black pixel sets classified and belonging to the group having substantially the same inclination.
JP61132846A 1986-06-10 1986-06-10 Image processing method Expired - Fee Related JP2755299B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP61132846A JP2755299B2 (en) 1986-06-10 1986-06-10 Image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP61132846A JP2755299B2 (en) 1986-06-10 1986-06-10 Image processing method

Publications (2)

Publication Number Publication Date
JPS62290979A JPS62290979A (en) 1987-12-17
JP2755299B2 true JP2755299B2 (en) 1998-05-20

Family

ID=15090883

Family Applications (1)

Application Number Title Priority Date Filing Date
JP61132846A Expired - Fee Related JP2755299B2 (en) 1986-06-10 1986-06-10 Image processing method

Country Status (1)

Country Link
JP (1) JP2755299B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01196657A (en) * 1988-02-01 1989-08-08 Nippon Telegr & Teleph Corp <Ntt> Method for recognizing document structure

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5556281A (en) * 1978-10-18 1980-04-24 Nippon Telegr & Teleph Corp <Ntt> Pattern input processing system

Also Published As

Publication number Publication date
JPS62290979A (en) 1987-12-17

Similar Documents

Publication Publication Date Title
US5465304A (en) Segmentation of text, picture and lines of a document image
JP3308032B2 (en) Skew correction method, skew angle detection method, skew correction device, and skew angle detection device
US6226402B1 (en) Ruled line extracting apparatus for extracting ruled line from normal document image and method thereof
JP2940960B2 (en) Image tilt detection method and correction method, and image information processing apparatus
JP3904840B2 (en) Ruled line extraction device for extracting ruled lines from multi-valued images
US6185341B1 (en) Image processing using vector data to reduce noise
US5075895A (en) Method and apparatus for recognizing table area formed in binary image of document
US5129012A (en) Detecting line segments and predetermined patterns in an optically scanned document
EP1017011A2 (en) Block selection of table features
US6947596B2 (en) Character recognition method, program and recording medium
JP2002015280A (en) Device and method for image recognition, and computer- readable recording medium with recorded image recognizing program
JPH03214378A (en) Character recognizing device
JP2755299B2 (en) Image processing method
JP3149221B2 (en) Image processing device
JP3172498B2 (en) Image recognition feature value extraction method and apparatus, storage medium for storing image analysis program
JP2846486B2 (en) Image input device
Ye et al. Document image matching and annotation lifting
JP2000076378A (en) Character recognizing method
JPH01129358A (en) Arithmetic unit for table numerical value
JP2937607B2 (en) Layout creation device
JP2954778B2 (en) Method for connecting line figure branch point of image input device
JP3182694B2 (en) Figure editing method and apparatus
JPH10222688A (en) Picture processing method
JP3276554B2 (en) Format recognition device and character reader
JP2762476B2 (en) Copy-writing device

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees