JP3679619B2 - Image contour extraction method, apparatus, and recording medium - Google Patents

Image contour extraction method, apparatus, and recording medium Download PDF

Info

Publication number
JP3679619B2
JP3679619B2 JP24975698A JP24975698A JP3679619B2 JP 3679619 B2 JP3679619 B2 JP 3679619B2 JP 24975698 A JP24975698 A JP 24975698A JP 24975698 A JP24975698 A JP 24975698A JP 3679619 B2 JP3679619 B2 JP 3679619B2
Authority
JP
Japan
Prior art keywords
contour
pixel
contour line
density value
line
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
JP24975698A
Other languages
Japanese (ja)
Other versions
JP2000076468A (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.)
Screen Holdings Co Ltd
Dainippon Screen Manufacturing Co Ltd
Original Assignee
Screen Holdings Co Ltd
Dainippon Screen Manufacturing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Screen Holdings Co Ltd, Dainippon Screen Manufacturing Co Ltd filed Critical Screen Holdings Co Ltd
Priority to JP24975698A priority Critical patent/JP3679619B2/en
Publication of JP2000076468A publication Critical patent/JP2000076468A/en
Application granted granted Critical
Publication of JP3679619B2 publication Critical patent/JP3679619B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Analysis (AREA)

Description

【0001】
【発明の属する技術分野】
この発明は、画像の輪郭抽出方法およびその装置並びにコンピュータによって画像の輪郭を抽出するためのプログラムを記録した記録媒体に関する。
【0002】
【従来の技術】
コンピュータで画像を処理する際に、画像の輪郭を抽出することがある。抽出した画像の輪郭は、輪郭内の画像に回転、拡大、縮小などの変換処理を施したり、輪郭内の画像を所望の色で塗りつぶしたり、輪郭内の画像を他の画像と合成したり下降したりする処理に利用される。
【0003】
ここで、画像の輪郭を抽出する方法としては、特開平5−242246号公報に開示された方法がある。この方法では、画像を主走査方向に沿った1ラインごとに走査していき、各走査において主走査方向に沿った輪郭線を抽出していくように構成されている。そして、主走査方向に検出された2本の輪郭線の端点が一致すれば、それらを副走査方向に連結して1本の輪郭線を形成していく。このような処理を全画像についての各ラインごとに行うことによって所望の輪郭を抽出する。
【0004】
【発明が解決しようとする課題】
ところが、上記のような従来の画像の輪郭抽出方法では、異なる濃度値についての輪郭線をいくつか抽出する際に、全画像領域を1ラインごとに走査していき1本の輪郭線を抽出する処理を各濃度値について行わなければならず、輪郭抽出に要する時間が長いという問題があった。
【0005】
この発明は、上記課題に鑑みてなされたものであって、任意の濃度値についての輪郭抽出の処理を効率的に行い、処理時間を短縮する画像の輪郭抽出方法、装置、およびそのプログラムを記録した記録媒体を提供することを目的とする。
【0006】
【課題を解決するための手段】
上記目的を達成するために、請求項1に記載の発明は、画像の輪郭を抽出する方法であって、(a) 前記画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出する工程と、(b) 前記注目画素の周囲の複数の輪郭辺が既成輪郭線に包含されていない場合には、前記複数の輪郭辺からなる輪郭線を新規輪郭線として設定し、当該新規輪郭線の接続状態を示す輪郭線接続情報を生成するとともに、前記注目画素の前記複数の輪郭辺のうちのいずれか1つを選択した当該新規輪郭線の開始辺と、前記注目画素の濃度値を当該新規輪郭線の有効濃度範囲の開始濃度とした開始濃度値とを含む輪郭線管理情報を生成する工程と、(c) 前記注目画素の前記複数の輪郭辺のうちのいずれかが既成輪郭線に包含されている場合には、当該既成輪郭線についての前記輪郭線接続情報を更新する工程と、(d) 前記更新によって前記注目画素のいずれかの前記輪郭辺が包含されていた少なくとも1つの既成輪郭線が消滅する場合には、消滅する前記既成輪郭線についての前記輪郭線管理情報に対して前記注目画素の濃度値を前記既成輪郭線の有効濃度範囲の終了濃度を示す終了濃度値として追加する工程とを有している。
【0007】
請求項2に記載の発明は、請求項1に記載の画像の輪郭抽出方法において、前記画像における同一の濃度値を示す画素を前記注目画素として、前記(a)ないし(d)工程を繰り返し行うことによって生成/更新された前記輪郭線接続情報を出力することを特徴としている。
【0008】
請求項3に記載の発明は、請求項1に記載の画像の輪郭抽出方法において、(e) 前記(a)ないし(d)工程を繰り返し行うことによって生成された前記輪郭線管理情報を記憶する工程と、所定の濃度値の輪郭線を抽出する際に、(f) 前記輪郭線管理情報に含まれる前記開始濃度値と前記終了濃度値とによって示される前記有効濃度範囲に基づいて前記所定の濃度値の輪郭線を特定し、当該輪郭線についての前記輪郭線管理情報から前記開始辺を取得する工程と、(g) 前記開始辺から所定の規則に従って輪郭辺を順次抽出していく工程とを有することを特徴としている。
【0009】
請求項4に記載の発明は、請求項1ないし請求項3のいずれかに記載の画像の輪郭抽出方法において、前記(a)ないし(d)工程に先立って行う工程として、(h) 前記画像を構成する全ての画素についての画素情報を記録する記録領域を確保する工程と、(i) 前記画像を構成する全ての画素を検索し、濃度値ごとの画素数をカウントする工程と、(j) 前記カウントの結果に基づいて、各濃度値ごとに当該濃度値未満の累積画素数を求める工程と、(k) 前記画像を構成する画素を1画素ずつ抽出する工程と、(l) 前記(k)工程において抽出された画素の濃度値を検出し、当該濃度値に対応する前記累積画素数を取得し、当該累積画素数の値に対応する前記記録領域の位置に前記抽出された画素を特定する前記画素情報を記録するとともに、当該累積画素数の値を更新する工程とを有し、前記(k)から(l)工程を前記画像を構成する全ての画素について行うまで繰り返し行うことを特徴としている。
【0010】
請求項5に記載の発明は、画像の輪郭を抽出する装置であって、(a) 前記画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出する注目画素抽出手段と、(b) 前記注目画素の周囲の複数の輪郭辺が既成輪郭線に包含されていない場合には、前記複数の輪郭辺からなる輪郭線を新規輪郭線とし、当該新規輪郭線の接続状態を示す輪郭線接続情報を生成するとともに、前記注目画素の前記複数の輪郭辺のうちのいずれか1つを選択した当該新規輪郭線の開始辺と、前記注目画素の濃度値を当該新規輪郭線の有効濃度範囲の開始濃度とした開始濃度値とを含む輪郭線管理情報を生成する輪郭線情報生成手段と、(c) 前記輪郭線接続情報と前記輪郭線管理情報とを記憶する記憶手段と、(d) 前記注目画素の前記複数の輪郭辺のうちのいずれかが既成輪郭線に包含されている場合には、当該既成輪郭線について前記記憶手段に記憶されている前記輪郭線接続情報を更新するとともに、当該更新によって前記注目画素のいずれかの前記輪郭辺が包含されていた少なくとも1つの既成輪郭線が消滅する場合には、消滅する前記既成輪郭線についての前記記憶手段に記憶されている前記輪郭線管理情報に対して前記注目画素の濃度値を前記既成輪郭線の有効濃度範囲の終了濃度を示す終了濃度値として追加更新する更新手段とを備えている。
【0011】
請求項6に記載の発明は、コンピュータによって画像の輪郭を抽出するためのプログラムを記録した記録媒体であって、コンピュータに、(a) 前記画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出する手順、(b) 前記注目画素の周囲の複数の輪郭辺が既成輪郭線に包含されていない場合には、前記複数の輪郭辺からなる輪郭線を新規輪郭線として設定し、当該新規輪郭線の接続状態を示す輪郭線接続情報を生成するとともに、前記注目画素の前記複数の輪郭辺のうちのいずれか1つを選択した当該新規輪郭線の開始辺と、前記注目画素の濃度値を当該新規輪郭線の有効濃度範囲の開始濃度とした開始濃度値とを含む輪郭線管理情報を生成する手順、(c) 前記注目画素の前記複数の輪郭辺のうちのいずれかが既成輪郭線に包含されている場合には、当該既成輪郭線についての前記輪郭線接続情報を更新する手順、(d) 前記更新によって前記注目画素のいずれかの前記輪郭辺が包含されていた少なくとも1つの既成輪郭線が消滅する場合には、消滅する前記既成輪郭線についての前記輪郭線管理情報に対して前記注目画素の濃度値を前記既成輪郭線の有効濃度範囲の終了濃度を示す終了濃度値として追加する手順を実行させるための画像の輪郭抽出プログラムが記録されている。
【0012】
【発明の実施の形態】
<1.発明の概要>
上述した従来の画像の輪郭抽出方法は、主走査方向と副走査方向とからなる画像平面において主走査方向に沿った1ラインごとの輪郭抽出処理を副走査方向に走査するものであった。
【0013】
これに対して、この発明における画像の輪郭抽出方法は、画像を構成する画素のうち最大の濃度値を示すものから順次に1画素ずつ抽出し、新規に輪郭線を生成したり、既成の輪郭線を更新したりするものである。
【0014】
ここで、1つの画素とその隣接する画素との境界となる線を輪郭辺と呼ぶことにすると、一般に1つの画素は4つの輪郭辺を有している。
【0015】
そこで、最大の濃度値から順次抽出された画素(以下、「注目画素」という。)の4つの輪郭辺のうちのいずれもかが既に生成された既成輪郭線に含まれているか否かを判定し、いずれの輪郭辺も既成輪郭線に含まれていない場合には注目画素の4つの輪郭辺からなる輪郭線を新たに生成する一方、いずれかの輪郭辺が既成輪郭線に含まれている場合にはその輪郭内に当該注目画素が含まれるように既成輪郭線を更新する。
【0016】
図1は、このような輪郭線の生成/更新の概念を示す図である。図1では、2×2の4画素PA〜PDを例示しており、画素PAの濃度値はLV4であり、画素PBの濃度値はLV3であり、画素PCの濃度値はLV2であり、画素PDの濃度値はLV1である。ここで、各濃度値の関係は、LV1<LV2<LV3<LV4である。まず、最大の濃度値であるLV4を抽出すると画素PAが抽出される。そして、図1(a)に示すように画素PAの4つの輪郭辺が新規輪郭線Eaとして生成される。次に、図1(b)に示すように濃度値LV3の画素PBが抽出される。画素PBの4つの輪郭辺のうち画素PAに接する輪郭辺は既に輪郭線Eaに含まれているので、輪郭線Eaを更新して輪郭線Ebを生成する。次に、図1(c)に示すように濃度値LV2の画素PCが抽出される。画素PCの4つの輪郭辺のうち画素PAに接する輪郭辺は既に輪郭線Ebに含まれているので、輪郭線Ebを更新して輪郭線Ecを生成する。最後に、図1(d)に示すように濃度値LV1の画素PDが抽出される。画素PDの4つの輪郭辺のうち画素PBとPCとに接する2つの輪郭辺は既に輪郭線Ecに含まれているので、輪郭線Ecを更新して輪郭線Edを生成する。
【0017】
この処理過程においては、4つの画素PA〜PDを1画素ずつ処理する間に、濃度値ごとに存在する全ての輪郭線Ea〜Edが抽出されている。従って、各濃度値ごとの輪郭線が抽出された際にその輪郭線を出力するようにすれば、全画像領域についての画素ごとの処理を1回だけ行えば全ての濃度値についての輪郭線を得ることができる。
【0018】
また、このような処理過程において新規輪郭線が生成される際には、その輪郭線を後に追跡することができるように、新規輪郭線を構成する輪郭辺のうちから1つの輪郭辺を開始辺として設定しておく。このため、上記の処理が進むにつれて輪郭線が更新されたとしても、開始辺より所定のルール(規則)に基づいて輪郭を追跡することにより所定の濃度値の輪郭線を容易に抽出することができる。
【0019】
以下、このような処理を実現するための詳細な構成について説明する。
【0020】
<2.装置の構成>
図2は、この発明の一実施例としての画像の輪郭抽出装置100の構成を示すブロック図である。図2に示すように、この輪郭抽出装置100は、前処理部10と注目画素抽出部20と輪郭辺判定部30と輪郭線形成部40とメモリ50と輪郭抽出部60と記憶部70とを備えている。
【0021】
記憶部70は画像をデータとして保存しておくためのものであり、前処理部10は記憶部70から画像を読み出し、その画像に対して前処理を施す部分である。なお、前処理では、枠付き画像の生成と輪郭辺番号の割付と濃度値に基づく画素のソーティングとが行われるがこれらの処理の詳細については後述する。
【0022】
注目画素抽出部20は、画像を構成する複数の画素のうちから濃度値の最も高い画素から順に注目画素を1画素ずつ順次抽出する。
【0023】
そして、輪郭辺判定部30においては、注目画素の4つの輪郭辺のうちのいずれかが既に生成されている輪郭線に含まれているか否かを判定し、その結果を輪郭線形成部40に伝える。輪郭辺の判定にあたっては、メモリ50に格納されている輪郭線接続情報DCを参照する。輪郭線は複数の輪郭辺が連続的に接続されたものであり、輪郭線接続情報DCには輪郭線を形成する複数の輪郭辺の接続状態が既述されているため、この輪郭線接続情報DCを参照することにより注目画素の4つの輪郭辺のうちのいずれかが既に生成されている輪郭線に含まれているか否かを判定することができる。
【0024】
図3は、輪郭線接続情報DCを説明する図である。例えば、図3(a)に示すように画素PAが注目画素として抽出された場合であって画素PAの周囲にある4つの輪郭辺a,b,c,dによって新規輪郭線が形成されたとき、輪郭線接続情報DCは図3(b)に示すような状態に記述される。図3(b)の輪郭線接続情報DCより、輪郭辺aは輪郭辺bに、輪郭辺bは輪郭辺cに、輪郭辺cは輪郭辺dに、輪郭辺dは輪郭辺aにそれぞれ接続していることが判る。そして、これら輪郭辺a,b,c,dによって形成される輪郭線の輪郭線番号は「1」である。
【0025】
そして、図3(a)に示す画素PBが注目画素として抽出されたとき、図3(b)の輪郭線接続情報DCを参照すれば画素PBの周囲にある4つの輪郭辺b,e,f,gのうち輪郭辺bは既に輪郭線番号「1」の輪郭線に含まれていることが判る。従って、輪郭線接続情報DCを参照すれば注目画素の各輪郭辺の使用状態を判定することができる。なお、1つの輪郭辺が同時に複数の輪郭線に含まれるということはあり得ない。
【0026】
輪郭線形成部40は輪郭線情報生成部40aと輪郭線情報更新部40bとを備えており、輪郭辺判定部30において注目画素の4つの輪郭辺のうちのいずれもが既に生成されている輪郭線に含まれていないと判定されたときは、輪郭線情報生成部40aが動作して新規輪郭線の生成処理を行う一方、注目画素の4つの輪郭辺のうちのいずれかが既に生成されている輪郭線に含まれていると判定されたときは、輪郭線情報更新部40bが動作して既成輪郭線の更新処理を行う。この更新処理には、後述するように輪郭線の分離と統合と消滅との処理がある。
【0027】
輪郭線情報生成部40aは、新規輪郭線を生成すると、その輪郭線の接続状態を輪郭線接続情報DCに記述するとともに、輪郭線管理情報DMを生成し、メモリ50に格納する。
【0028】
輪郭線情報更新部40bは、既成輪郭線を更新した際に、輪郭線接続情報DCに記述されている輪郭線の接続状態を更新する。
【0029】
また、輪郭線情報更新部40bは、更新によって既成輪郭線の少なくとも1つが消滅したときに、その消滅した輪郭線についての輪郭線管理情報DMの終了濃度値の欄に現在の注目画素の濃度値より1つ高い濃度値を格納する。ここで、更新によって既成輪郭線の少なくとも1つが消滅する場合は、輪郭線管理情報DMに登録されている開始辺が注目画素を追加したことにより有効でなくなってしまう場合と2以上の輪郭線の統合によって1つの輪郭線のみが残り、他の輪郭線が消滅する場合とを含んでいる。また、さらに、輪郭線情報更新部40bは、次に抽出すべき注目画素が無くなったときには、輪郭線管理情報DMにおいて終了濃度値が未だ格納されていないものについて終了濃度値として「0」を格納する。なお、このように終了濃度値を格納する処理を終了処理という。
【0030】
上述の輪郭線接続情報DCは輪郭線そのものであるので、輪郭線情報生成部40aと輪郭線情報更新部40bとにおいて輪郭線接続情報DCに新規接続状態を記述した際又は輪郭線接続情報DCを更新した際にその輪郭線接続情報DCを出力すれば、輪郭線出力となる。
【0031】
例えば、画像の濃度値が0〜255の256階調である場合であって濃度値が126の輪郭線を抽出したい場合は、濃度値255の画素から順次注目画素を抽出していき、それぞれの濃度値についての輪郭線を形成させていく。そして濃度値が126である画素の全てについての処理が終了すると、輪郭線接続情報DCに所望の輪郭線が形成されたこととなるため、それを出力すればよい。そして、この場合は、濃度値が125以下である画素の抽出処理は行わなくてもよいので効率的な輪郭抽出となっている。
【0032】
しかしながら、この実施の形態では、一度全画像について1画素ごとの輪郭線形成を行っておけば、再度輪郭線を抽出しようとする際には全画像について1画素ごとの輪郭線形成を行う必要がないようにするために、輪郭線管理情報DMをメモリ50に格納する。
【0033】
ここで、輪郭線管理情報DMについて説明する。図4は、輪郭線管理情報DMを説明する図である。なお、図4(a)に示す各画素内の数字は各画素の濃度値を示している。
【0034】
例えば、図4(a)に示すように画素PAが注目画素として抽出された場合であって画素PAの周囲にある4つの輪郭辺a,b,c,dによって新規輪郭線が形成されたとき、輪郭線管理情報DMは図4(b)に示すような状態に記述される。輪郭線管理情報DMの輪郭線番号には、既存の輪郭線番号と重複しない番号が付与される。また、開始辺番号には、新規に生成された輪郭線を後に抽出する際に抽出開始点となる輪郭辺(すなわち、開始辺)の番号が格納される。
【0035】
開始辺としては、注目画素に隣接する画素のうち最小の濃度値を示す画素と共有している輪郭辺、若しくは、注目画素に隣接する画素のうち注目画素の濃度値と最も差の大きい濃度値を有する画素と共有している輪郭辺を選択することが好ましい。この理由は、開始辺の有効となる有効濃度範囲を最も大きくすることができるからである。従って、図4(a)のような濃度値の場合、開始辺として輪郭辺aが決定される。
【0036】
開始濃度値には、注目画素PAの濃度値「9」が格納される。また、終了濃度値には、輪郭線番号「1」の輪郭線が更新されて消滅するとき、すなわち開始辺が無効となるときの注目画素の濃度値よりも1つ高い濃度値が格納される。
【0037】
輪郭辺の数には、輪郭線番号「1」の輪郭線を構成する輪郭辺の数が格納される。図4(a)の例の場合であると、輪郭線は4つの輪郭辺a,b,c,dによって構成されているので、輪郭辺の数は「4」となっている。
【0038】
このような輪郭線管理情報DMをメモリ50に保持しておくことにより、後に任意の濃度値の輪郭線を抽出する場合は、輪郭抽出部60が輪郭線管理情報DMの開始濃度値と終了濃度値とによって輪郭線の開始辺が有効な有効濃度範囲を知ることができ、輪郭線抽出の対象となる濃度値が有効濃度範囲内に存在する開始辺を全て取得することができる。そして輪郭抽出部60が、それらの開始辺から所定のルールに基づいて輪郭抽出を行っていけば適切に画像の輪郭抽出を行うことができる。
【0039】
すなわち、図2の装置において、メモリ50内に輪郭線管理情報DMが未だ格納されていないときは、前処理部10と注目画素抽出部20と輪郭辺判定部30と輪郭線形成部40とが機能して、各濃度値ごとの輪郭線を形成していくに伴って輪郭線管理情報DMと輪郭線接続情報DCとをメモリ50に逐次格納していくように構成されている。また、輪郭線形成部40は輪郭線接続情報DCを生成/更新する際にそれを出力すれば輪郭線出力を行うことができる。
【0040】
一方、メモリ50内に輪郭線管理情報DMが既に格納されているときは、輪郭抽出部60が機能して、メモリ50内の輪郭線管理情報DMを読み出して輪郭線ごとに登録されている開始辺より所定のルールに基づいて輪郭抽出を行うように構成されており、輪郭抽出部60が抽出した輪郭線を出力する。
【0041】
<3.前処理>
前処理部10において行われる前処理について説明する。
【0042】
まず、第1の前処理として枠付き画像の生成が行われる。図5は、枠付き画像の生成を説明する図である。図5(a)は輪郭抽出の対象となる原画像を示しており、図5(b)は枠付き画像を生成する際の中間段階を示しており、図5(c)は原画像に対して生成される枠付き画像を示している。図5においては、原画像は、5×4の20画素によって構成される例を示しており、各画素内の数字はその画素の濃度値を示している。なお、以下においては、図5(a)に示すような原画像についての処理を一例として説明することとする。
【0043】
前処理部10は、図5(a)の原画像に対してその周囲を1画素分だけ広げた画像領域を確保する(図5(b))。その結果、原画像の周囲に分布することとなる全ての画素に対して濃度値0を格納する。このようにして図5(c)に示すように7×6の42画素からなる枠付き画像を生成する。
【0044】
このような枠付き画像を生成する理由は、原画像の全ての輪郭辺について同一の処理を施すことができるようにし、処理効率を向上させるためである。図5(a)に示す原画像の外周部に位置する各輪郭辺は、他の画素と接していないため、濃度値比較を行うことができない。従って、原画像に含まれる全ての輪郭辺について濃度値比較を行うことができるようにするために枠付き画像を生成する。なお、図5(a)に示す原画像の外周部に位置する各輪郭辺については他の輪郭辺とは異なる例外処理を行うようにする場合、枠付き画像を生成することは不要である。
【0045】
次に、第2の前処理として枠付き画像の含まれる各輪郭辺に対して輪郭辺番号の割付処理が行われる。図6は、輪郭辺番号の割付を説明する図である。枠付き画像において主走査方向Xにn個の画素が存在するとすると、1ライン目の左端の画素の下辺には0番を付与し、右辺には1番を付与する。そして、1ライン目の2番目の画素の下辺、右辺、3番目の画素の下辺、右辺というように順次番号を付与していく。主走査方向Xにはn個の画素が存在するため、2ライン目の左端の画素の下辺には(2n)番を付与することとなり、右辺には(2n+1)番を付与することとなる。以下同様に、そして、2ライン目の2番目の画素の下辺、右辺、3番目の画素の下辺、右辺というように順次番号を付与していき、全てのラインについて輪郭辺番号を付与する。
【0046】
このようにして図5(c)のような7×6の枠付き画像について輪郭辺番号を割り付けると図7のようになる。なお、図7において太線は原画像部分を示している。従って、この輪郭辺番号の割付によって、原画像の輪郭抽出に必要な全ての輪郭辺に固有の番号が付与されたこととなる。ここで、図7に示すように枠付き画像の上端に位置する各輪郭辺と、左端に位置する各輪郭辺とには輪郭辺番号は割り付けられないがこれらの輪郭辺が原画像の輪郭となることはあり得ないので問題ない。
【0047】
また、原画像に対してのみ輪郭辺番号の割付を行う場合は、原画像の上端および左端に位置する輪郭辺に対して輪郭辺番号を付与するために例外処理を行わなければならないので時間がかかるが、上記のように枠付き画像に対して輪郭辺番号の割付を行う場合は、例外処理を行わずとも原画像に含まれる全ての輪郭辺に対して番号が付与されるため、効率的に輪郭辺番号を付与することができ、処理時間を短縮することができる。
【0048】
次に、第3の前処理として原画像を構成する画素を濃度値に基づいてソートする処理が行われる。濃度値に基づいたソートを行うのは、注目画素抽出部20が濃度値の高い画素から順次注目画素を抽出することができるようにするためである。従って、原画像を構成する画素のうちから濃度値の高い順に1つの画素を抽出することができるようにソートすることができる手法であればよいため、公知となっている種々のソート方法を適用することができる。
【0049】
しかしながら、公知となっている種々のソート方法は、判断処理やデータの入れ替え処理が多用されるためソートに時間がかかる。
【0050】
そこで、この実施の形態では、効率的にソートを行うために以下に示すようなソート方法を適用することが好ましい。
【0051】
まず、ソート処理を行うに先立って、枠付き画像の各画素に対して座標値を設定する。一般に画像平面内の各画素に座標値を設定する場合は、主走査方向Xの位置と副走査方向Yの位置とによって現すXY座標系が使用されるが、この場合はX座標とY座標との2つの値を管理しなければならない。そこで、この実施の形態では、枠付き画像が主走査方向Xにn個の画素を有するとすると、「(Y座標)×(n個)+(X座標)」によって導かれる1つの値を座標値とする。すなわち、枠付き画像の主走査方向Xに沿って順次1つの番号を付与していくことにより各画素に対して座標値を設定する。このようにして図5(c)に示す枠付き画像について座標値を設定すると、各画素の座標値は図8に示すようになる。なお、図8において各画素の数字は座標値であり、濃度値の表示は省略している。また、図8における太線は原画像部分を示している。
【0052】
次に、実際のソート処理に移る。はじめに、原画像に含まれる全ての画素を検索し、濃度値ごとの画素数をカウントする。図5に示す原画像について濃度値ごとの画素数をカウントすると、図9に示すようなカウント結果が得られる。このカウント結果を前処理部10は内部に設けられている図示しないメモリなどに一時的に格納する。
【0053】
そして、図9に示すカウント結果に基づいて、各濃度値ごとに、当該濃度値未満の濃度値を示す累積画素数を導く。例えば、図9のカウント結果より、濃度値1の累積画素数は濃度値0の画素数であるため0個となり、濃度値2の累積画素数は濃度値0〜1の画素数の和であるため2個となり、濃度値3の累積画素数は濃度値0〜2の画素数の和であるため5個となる。このようにして各濃度値について累積画素数を求ると、図10のようになる。
【0054】
そして、次に、ソートデータを格納するバッファ領域を原画像を構成する画素数分だけ確保する。図5に示す原画像の場合は20個の画素を有するので、20個分のバッファ領域を確保する。そして、原画像を構成する画素のうちから座標値順に1画素抽出し、その濃度値を検出する。
【0055】
図5の原画像の場合、図11に示すように濃度値2の画素が最初に抽出される。この抽出した画素の濃度値2に対応する累積画素数は2であるため、バッファ領域の2に対応する格納位置、すなわちメモリアドレス2の位置に抽出した画素の座標値を格納する。図11の場合、抽出した濃度値2の画素の座標値は8であるため(図8参照)、メモリアドレス2の位置に座標値8が格納される。そして、バッファ領域に座標値を格納すると、濃度値2の累積画素数2に対して1を加算することにより、濃度値2の累積画素数を3に変更する。
【0056】
次に、図12に示すように濃度値9の画素が抽出される。この抽出した画素の濃度値9に対応する累積画素数は19であるため、バッファ領域の19に対応する格納位置、すなわちメモリアドレス19の位置に抽出した画素の座標値を格納する。図12の場合、抽出した濃度値9の画素の座標値は9であるため(図8参照)、メモリアドレス19の位置に座標値9が格納される。そして、バッファ領域に座標値を格納すると、濃度値9の累積画素数19に対して1を加算することにより、濃度値9の累積画素数を20に変更する。
【0057】
以下、原画像を構成する画素のうちから座標値順に1画素する毎に同様の処理を繰り返し行う。そして、原画像を構成する全ての画素についての処理が終了すると、各濃度値ごとの累積画素数とバッファ領域とは、図13に示すような状態となる。
【0058】
図13(b)に示すバッファ領域には、メモリアドレスの小さい方から順に、濃度値の小さい画素の座標値が格納されている。例えば、メモリアドレス0,1には濃度値1の画素の座標値が格納されており、メモリアドレス2〜4には濃度値2の画素の座標値が格納されている。従って、上記のような処理を行うことにより、バッファ領域内に原画像を構成する画素を濃度値に基づいてソートされた結果が格納されていることとなる。
【0059】
上記のようなソート方法を適用すると、2つの画素の濃度値を比較する判断処理やデータの入れ替え処理を行うことなくソートすることができるのでソートに要する時間を短縮することができる。
【0060】
このようにバッファ領域内に濃度値に基づいたソート結果を格納しておくと注目画素抽出部20が濃度値の高い画素から順次注目画素を抽出する際には、バッファ領域の最大のメモリアドレスの位置から順次座標値を取得してその座標値の画素を抽出していけばよく、効率的な処理ができる。
【0061】
<4.輪郭線管理情報などの生成と更新>
次に、注目画素抽出部20が濃度値の高い画素から順次注目画素を抽出していき、輪郭線管理情報と輪郭線接続情報とを生成したり、更新したりする処理について説明する。
【0062】
注目画素抽出部20は、図13(b)のようなソート結果に基づいて濃度値の高い画素から順次注目画素を抽出する。そして、注目画素の周囲にある4つの輪郭辺の輪郭辺番号を求める。図13(b)に示すように、ソート結果には画素の座標値が格納されているため、この座標値より注目画素の4つの輪郭辺の番号を求める。例えば、注目画素の座標値をPとし、枠付き画像の主走査方向Xにn個の画素が存在するとし、注目画素の上側、右側、下側、左側にあるそれぞれの輪郭辺番号をNU、NR、ND、NLとすると、
上側の輪郭辺番号:NU=(P−n)×2
右側の輪郭辺番号:NR=(P×2)+1
下側の輪郭辺番号:ND=(P×2)
左側の輪郭辺番号:NL=(P×2)−1
で求めることができる。そして、注目画素抽出部20は、注目画素についての4つの輪郭辺番号を輪郭辺判定部30に送る。
【0063】
輪郭辺判定部30は、メモり50内の輪郭線接続情報DCを参照し、注目画素の輪郭辺番号が既に生成されている輪郭線に含まれているか否かを判定する。
【0064】
そして、メモリ50内に輪郭線接続情報DCが未だ格納されていない場合、又は輪郭線接続情報DCを参照した結果、注目画素の4つの輪郭辺のいずれもが既成輪郭線に含まれていないと判定した場合は、輪郭線情報生成部40aに注目画素の4つの輪郭辺からなる輪郭線を生成するように指令する。これにより、輪郭線情報生成部40aは、注目画素の周囲にある4つの輪郭辺からなる新規輪郭線を生成し、メモリ50の輪郭線接続情報DCにその新規輪郭線の接続状態を記述するとともに、新規輪郭線の開始辺などを求めて輪郭線管理情報DMに記述する。
【0065】
一方、輪郭線接続情報DCを参照した結果、注目画素の4つの輪郭辺のいずれかが既成輪郭線に含まれていると判定した場合は、輪郭線情報更新部40bに輪郭線接続情報DCと輪郭線管理情報DMとを更新するよう指令する。
【0066】
輪郭線情報更新部40bが輪郭線接続情報DCと輪郭線管理情報DMとを更新する処理について説明する。図14は、注目画素の4つの輪郭辺が1つの既成輪郭線に含まれている場合を示す図である。なお、図14において斜線を施した画素は注目画素であり、細線は各輪郭辺であり、太線は輪郭線に含まれている輪郭辺を示している。図14(a)に示すように注目画素の4つの輪郭辺a,b,c,dのうち、輪郭辺dは既成輪郭線E1に含まれている。このような状態で注目画素を追加すると、図14(b)の太線に示すように既成輪郭線E1が更新される。
【0067】
図15は、図14(a)の輪郭線E1を図14(b)の輪郭線E1に更新する過程を示す図である。なお、図15(a)〜(e)において左図はメモリ50に格納される輪郭線接続情報DCであり、右図は注目画素の4つの輪郭辺から輪郭線が形成されると仮想した場合にメモリ50に一時的に格納される注目画素の輪郭辺の仮想接続状態である。
【0068】
まず、図14(a)に示す注目画素が抽出されたときは、輪郭線E1の輪郭線接続情報DCと仮想接続情報とは図15(a)となる。すなわち、輪郭線E1の接続状態は「e→d→f→g」となっている。また、注目画素の4つの輪郭辺のつながりは、「a→b→c→d→a」となっている。
【0069】
そして、今回注目画素を追加することによって輪郭辺dは輪郭線E1に含まれないようになる。そのため、輪郭線接続情報DCにおいて輪郭辺dを次の輪郭辺(接続先)としている輪郭辺eについての次の輪郭辺番号を更新することとなる。つまり、仮想接続状態を参照すると、輪郭辺dは輪郭辺aに接続するため、輪郭辺eについての次の輪郭辺番号はaに書き換えられる。この結果、輪郭線E1の輪郭線接続情報DCと仮想接続情報とは図15(b)となる。
【0070】
また、今回注目画素を追加することによって輪郭辺dは輪郭線E1に含まれないようになるため、仮想接続情報において輪郭辺dを次の輪郭辺(接続先)としている輪郭辺cについての次の輪郭辺番号を更新することとなる。つまり、輪郭線接続情報DCを参照すると、輪郭辺dは輪郭辺fに接続するため、輪郭辺cについての次の輪郭辺番号はfに書き換えられる。この結果、輪郭線E1の輪郭線接続情報DCと仮想接続情報とは図15(c)となる。
【0071】
そして、今回注目画素を追加することによって輪郭辺dは輪郭線E1に含まれないようになるため、輪郭辺接続情報DCから輪郭辺dについての接続状態を消去する。この結果、輪郭線E1の輪郭線接続情報DCと仮想接続情報とは図15(d)となる。
【0072】
そして、仮想接続情報うちから輪郭辺dを除く輪郭辺a,b,cについての接続状態を輪郭線接続情報DCに書き写すことにより、輪郭線E1の輪郭線接続情報DCと仮想接続情報とは図15(e)のようになる。図15(e)の輪郭線接続情報DCでは、図14(b)の太線に示すような輪郭線E1の接続状態が記述されていることとなる。従って、ここまでの処理が行われると、仮想接続情報はメモリ50から消去されてもよい。
【0073】
次に、注目画素の4つの輪郭辺が2以上の既成輪郭線に含まれている場合は、上記の処理とほぼ同様であるが、異なる部分もある。例えば、図16は、注目画素の4つの輪郭辺が3つの既成輪郭線に含まれている場合を示す図である。なお、図15において斜線を施した画素は注目画素であり、細線は各輪郭辺であり、太線は輪郭線に含まれている輪郭辺を示している。図14(a)では、輪郭辺e,d,f,gは輪郭線E1に含まれており、輪郭辺t,a,sは輪郭線E2に含まれており、輪郭辺m,c,nは輪郭線E3に含まれている。また、輪郭線E1において各輪郭辺は「e→d→f→g」の順で接続されており、輪郭線E2において各輪郭辺は「t→a→s」の順で接続されており、輪郭線E3において各輪郭辺は「m→c→n」の順で接続されている。このような状態で斜線で示した注目画素を追加すると、図14(b)の太線に示すように輪郭線E2,E3が輪郭線E1に統合されて消滅する。
【0074】
輪郭線を統合する際に、輪郭線情報更新部40bは各輪郭線E1,E2,E3の輪郭線管理情報DMを参照し、各輪郭線を構成する輪郭辺の数を取得する(図4(b)参照)。そして、最も輪郭辺の数が大きい輪郭線のみを残し、他の輪郭線は消滅させる。例えば、図16(a)において最も輪郭辺の数が大きい輪郭線がE1であったとすると、輪郭線の更新の結果、図16(b)に示すように輪郭線E1のみが残り、他の輪郭線E2,E3については消滅している。
【0075】
図17は、図16(a)の状態における輪郭線接続情報などを示している。なお、図17(a)は輪郭線接続情報DCであり、図17(b)は注目画素の4つの輪郭辺から輪郭線が形成されると仮想した場合にメモリ50に一時的に格納される注目画素の輪郭辺の仮想接続状態であり、図17(c)は輪郭線管理情報DMである。図17(c)において、開始辺番号と開始濃度値との欄には各輪郭線E1〜E3が生成された際にそれぞれ輪郭辺の番号と注目画素の濃度値とが格納されているが、ここでは便宜上これらの値を「−」で表示している。
【0076】
図16(a)において斜線で示した注目画素を追加することによって輪郭辺a,c,dは輪郭線に含まれないこととなる。このため、図17(a)の輪郭線接続情報DCにおいて輪郭辺aを次の輪郭辺(接続先)としている輪郭辺tについての次の輪郭辺番号を更新することとなる。つまり、図17(b)の仮想接続状態を参照すると、輪郭辺aは輪郭辺bに接続するため、輪郭辺tについての次の輪郭辺番号はbに書き換えられる。
【0077】
次に、図17(c)より輪郭線E1の輪郭辺の数が最も大きいため、輪郭線E2,E3は消滅する。従って、図17(a)の輪郭線接続情報DCにおける所属輪郭線番号E2,E3は全てE1に書き換えられる。
【0078】
次に、輪郭辺aは輪郭線に含まれないこととなるため、図17(b)の仮想接続状態において輪郭辺aを次の輪郭辺(接続先)としている輪郭辺dについての次の輪郭辺番号を更新することとなる。つまり、輪郭線接続情報DCを参照すると、輪郭辺aは輪郭辺sに接続するため、輪郭辺dについての次の輪郭辺番号はaからsに書き換えられる。そして、輪郭辺dも輪郭線に含まれないこととなるため、図17(a)の輪郭線接続情報DCにおいて輪郭辺dを次の輪郭辺(接続先)としている輪郭辺eについての次の輪郭辺番号を更新することとなる。つまり、仮想接続状態を参照すると、先程、輪郭辺dは輪郭辺sに接続するようにかきえられているため、輪郭辺eについての次の輪郭辺番号はdからsに書き換えられる。
【0079】
次に、輪郭辺cは輪郭線に含まれないこととなるため、図17(a)の輪郭線接続情報DCにおいて輪郭辺cを次の輪郭辺(接続先)としている輪郭辺mについての次の輪郭辺番号を更新することとなる。つまり、仮想接続状態を参照すると、輪郭辺cは輪郭辺dに接続するため、輪郭辺mについての次の輪郭辺番号はcからdに書き換えられる。しかし、輪郭辺dも輪郭線に含まれないこととなるため、輪郭線接続情報DCにおいて輪郭辺dが接続する輪郭辺fを輪郭辺mについての次の輪郭辺番号とする。
【0080】
次に、輪郭辺cは輪郭線に含まれないこととなるため、図17(b)の仮想接続状態において輪郭辺cを次の輪郭辺としている輪郭辺bについての次の輪郭辺番号を更新することとなる。つまり、輪郭線接続情報DCを参照すると、輪郭辺cは輪郭辺nに接続するため、仮想接続状態の輪郭辺bについての次の輪郭辺番号はcからnに書き換えられる。
【0081】
次に、輪郭辺dは輪郭線に含まれないこととなるため、図17(a)の輪郭線接続情報DCにおいて輪郭辺dを次の輪郭辺(接続先)としている輪郭辺eについての次の輪郭辺番号を仮想接続状態を参照してdからsに更新する。また、輪郭辺cは輪郭線に含まれないこととなるため、図17(a)の輪郭線接続情報DCにおいて輪郭辺cを次の輪郭辺としている輪郭辺mについての次の輪郭辺番号をcからfに更新する。なお、この処理は既に一度行われているが、ここでもう一度同様の処理を行うことにより、注目画素の4つの輪郭辺a,b,c,dの接続状態を書き換える処理がどの輪郭辺から開始されてても同様の結果が得られるようになっている。
【0082】
そして次に、輪郭辺a,c,dは輪郭線に含まれないこととなるため、図17(a)の輪郭線接続情報DCにおいて輪郭辺a,c,dについての接続情報を消去する。そして、仮想接続状態の輪郭辺bのみについての接続状態を輪郭線接続情報DCに書き込む。また、この処理により輪郭線E2,E3は消滅するため、輪郭線管理情報DMにおいて輪郭線E2,E3についての終了濃度値の欄に注目画素の濃度値よりも1つ高い濃度値を書き込むとともに、これらの輪郭線についての輪郭辺の数を0にして、輪郭線E2,E3についての有効濃度範囲を確定させ、輪郭線E2,E3について終了処理を行う。また、輪郭線管理情報DMにおいて輪郭線E1についての輪郭辺の数を更新する。なお、この処理が行われると、注目画素の仮想接続状態はメモリ50から消去される。
【0083】
このような処理の結果、メモリ50に格納されている輪郭線接続情報DCは図18(a)に示すようになり、輪郭線管理情報DMは図18(b)に示すようになる。すなわち、これらの情報は、図16(b)に示したような輪郭線E1が生成された状態を示している。上記のような処理の結果、輪郭線E1は輪郭辺16個よりなる輪郭線に更新され、輪郭線E2,E3は終了処理が行われて消滅している。
【0084】
次に、注目画素の4つの輪郭辺のうちの2以上の輪郭辺が同一の輪郭線に含まれている場合について説明する。まず、上記のような処理を行う前に、注目画素の4つの輪郭辺が所属している輪郭線番号を取得し、注目画素の4つの輪郭辺のうち同一の輪郭線に含まれている輪郭辺番号を取得する。そして、注目画素の輪郭辺のうち同一の輪郭線に含まれている輪郭辺の接続状態が連続しているか否かを判定する。同一の輪郭線に含まれている輪郭辺の接続状態が連続していれば、上記のような通常の処理を行えば輪郭線は適切に更新される。しかし、同一の輪郭線に含まれている輪郭辺の接続状態が連続していない場合は、輪郭線の内部にホールが形成されるため、そのホールについて新たに輪郭線が生成されることとなる。
【0085】
例えば、図19(a)〜(d)の左図に示すような輪郭線が形成されているときに斜線で示した画素を注目画素として抽出すると、右図に示すような輪郭線が生成される。なお、図19(a)〜(d)において丸印は各輪郭線の開始辺を示している。上述したような輪郭線接続情報DCの更新処理を行った結果、既成輪郭線の内側に新たに閉ループを形成するホール状の輪郭線が生成されている場合は、その輪郭線に対して開始辺と開始濃度値と輪郭線個数とを求めて輪郭線管理情報DMに登録することが行われる。このような処理を行うことにより、輪郭線が分離して新たな輪郭線が生成された場合であっても適切に対応することができる。
【0086】
次に、注目画素の4つの輪郭辺のうち既成輪郭線の開始辺として設定されている輪郭辺が存在する場合について説明する。まず、注目画素の4つの輪郭辺のうち既成輪郭線E1の開始辺として設定されている輪郭辺が存在すると判断すると、輪郭線管理情報DMに新規輪郭線E2の情報を書き込む領域を確保し、その領域に既成輪郭線E1の内容をコピーする。そして輪郭線E2についての輪郭線管理情報DMに対して注目画素の濃度値よりも1つ高い濃度値を終了濃度値に書き込み、輪郭辺の数を0にすることにより、輪郭線E2について終了処理を施す。そして、既成輪郭線E1についての輪郭線管理情報DMの開始濃度値の欄に注目画素の濃度値を上書きするとともに、開始辺を注目画素の4つの輪郭辺以外の輪郭辺から抽出して上書きする。このような処理を行うことにより、注目画素の4つの輪郭辺のうち既成輪郭線の開始辺として設定されている輪郭辺が存在する場合であっても良好に輪郭線情報を更新することができる。
【0087】
ただし、図20の左図に示すように注目画素の4つの輪郭辺の全てが同一の既成輪郭線に含まれている場合は、注目画素の4つの輪郭辺のうち既成輪郭線の開始辺として設定されている輪郭辺が存在する場合であっても上記のような処理を行う必要がなく、単にその既成輪郭線について終了処理を施せばよい。これにより、図20の右図に示すような適切な輪郭線に更新される。
【0088】
以上の説明では、輪郭線情報更新部40bが輪郭線接続情報DCと輪郭線管理情報DMとを更新する処理を概念的に示した。ここで、上記の処理内容をさらに判りやすくするために、図5に示した原画像と枠付き画像とに対して上記の処理を施した場合の処理過程をみていくこととする。図21〜図30は、各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報DMと輪郭線接続情報DCとを示す図である。なお、図21〜図30の(a)において、各画素の数字は原画像部分の画素ごとの濃度値を示しており、枠部分の濃度値0については濃度値を省略している。また、以下の説明においては、各画素の輪郭辺を参照するのに図7に示した輪郭辺番号を用い、各画素を参照するのに図8に示した座標値を用いることとする。
【0089】
まず、注目画素抽出部20は、図13(b)のようにソートされたバッファ領域から濃度値の最大の画素であるメモリアドレス19の座標値9を取得する。図8の座標値を参照すると、図21(a)のように濃度値9の画素が注目画素として抽出されたこととなる。図21(a)に示すように注目画素の4つの輪郭辺は既成輪郭線に含まれていないため、注目画素の4つの輪郭辺からなる輪郭線を生成し、輪郭線管理情報DMと輪郭線接続情報DCにその情報が記述される。
【0090】
輪郭線管理情報DMにおいて、注目画素の4つの輪郭辺によって新規に生成された輪郭線は最初に生成された輪郭線であるため、輪郭線番号は1となる。また、注目画素の4つの輪郭辺を介して存在する隣接画素のうち座標値2(注目画素の上側)の画素の濃度値が0であるため注目画素の上側の輪郭辺が開始辺となる。この輪郭辺の輪郭辺番号は4であるため、開始辺番号には4が格納される。また、このときの注目画素の濃度値は9であるため開始濃度値には9が格納され、輪郭辺の数には4が格納される。
【0091】
輪郭線接続情報DCにおいては、注目画素の4つの輪郭辺によって形成される輪郭線の接続状態が記述され、各輪郭辺の所属輪郭線番号には1が格納される。
【0092】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス18,17の座標値22,18を取得してこれらの画素を注目画素とし、濃度値8についての輪郭線形成を行うと、図22に示すようになる。図22(a)に示すように、濃度値8の2つの画素の各輪郭辺は既に生成された濃度値9の輪郭線に含まれていないため、それぞれの画素について新規輪郭線が形成される。そして、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図22(b),(c)に示すようになる。なお、座標値22の画素が先に注目画素として処理されるため、座標値22の画素の4つの輪郭辺によって形成される輪郭線の輪郭線番号が2となり、座標値18の画素の4つの輪郭辺によって形成される輪郭線の輪郭線番号が3となっている。
【0093】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス16〜13に格納されている各座標値を順次取得してこれらの画素を注目画素とし、濃度値7についての輪郭線形成を行うと、図23に示すようになる。図23(a)に示すように、濃度値7の4画素のうち座標値16の画素の上側の輪郭辺は既に生成された濃度値9の輪郭線(輪郭線番号1)に含まれているため、輪郭線番号1についての輪郭線接続情報DCと輪郭線管理情報DMとが更新される。また、それ以外の画素についての各輪郭辺は既成輪郭線に含まれていないため、それぞれの画素について新規輪郭線が形成される。この結果、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図23(b),(c)に示すようになる。
【0094】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス12に格納されている座標値30を取得してこの画素を注目画素とし、濃度値6についての輪郭線形成を行うと、図24に示すようになる。図24(a)に示すように、濃度値6の画素の4つの輪郭辺のうち右側の輪郭辺は既に生成された濃度値7の輪郭線(輪郭線番号5)に含まれているため、輪郭線番号5についての輪郭線接続情報DCと輪郭線管理情報DMとが更新される。この結果、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図24(b),(c)に示すようになる。
【0095】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス11,10に格納されている座標値32,24を取得してこれらの画素を注目画素とし、濃度値5についての輪郭線形成を行うと、図25に示すようになる。図25(a)に示すように、濃度値5の2画素のうち座標値24の画素の下側の輪郭辺は既に生成された輪郭線(輪郭線番号5)に含まれている。また、座標値32の画素については、左側の輪郭辺が既に生成された輪郭線(輪郭線番号5)に含まれているとともに、右側の輪郭辺が既に生成された輪郭線(輪郭線番号4)に含まれている。ここで、輪郭線番号4と5との輪郭辺の数を比較すると輪郭線番号4の方が小さいので、輪郭線番号4の輪郭線は輪郭線番号5の輪郭線に統合される。この結果、輪郭線番号4についての輪郭線管理情報DMには終了処理が施されて終了濃度値の欄に濃度値6が記入されるとともに、輪郭辺の数が0に更新される。また、輪郭線番号5についての輪郭線管理情報DMと輪郭線接続情報DCとが更新される。この結果、濃度値5の2画素は輪郭線番号5の輪郭線内に含まれることとなり、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図25(b),(c)に示すようになる。
【0096】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス9〜7に格納されている座標値29,17,11を取得してこれらの画素を順次注目画素とし、濃度値4についての輪郭線形成を行うと、図26に示すようになる。図26(a)に示すように、座標値29の画素の右側の輪郭辺は輪郭線番号5の輪郭線に含まれており、上側の輪郭辺は輪郭線番号2の輪郭線に含まれている。従って、輪郭線番号2の輪郭線は輪郭線番号5の輪郭線に統合されて消滅する。また、座標値17の画素の右側の輪郭辺は輪郭線番号3の輪郭線に含まれており、下側の輪郭辺は輪郭線番号5の輪郭線に含まれており、左側の輪郭辺は輪郭線番号1の輪郭線に含まれている。従って、輪郭線番号1と3の輪郭線は輪郭線番号5の輪郭線に統合されて消滅する。また、座標値11の画素の右側の輪郭辺は輪郭線番号6の輪郭線に含まれており、下側の輪郭辺は先に統合されて生成された輪郭線番号5の輪郭線に含まれている。従って、輪郭線番号6の輪郭線は輪郭線番号5の輪郭線に統合されて消滅する。このようにして濃度値4の3画素が注目画素として処理されると、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図26(b),(c)に示すようになる。
【0097】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス6,5に格納されている座標値25,15を取得してこれらの画素を順次注目画素とし、濃度値3についての輪郭線形成を行うと、図27に示すようになる。図27(a)に示すように、座標値25の画素の上側、下側、左側の輪郭辺は輪郭線番号5の輪郭線に含まれている。従って、座標値25の画素が輪郭線番号5の輪郭線に含まれるように輪郭線番号5の輪郭線が更新される。また、座標値15の画素の右側、下側の輪郭辺は輪郭線番号5の輪郭線に含まれているが、その接続状態は連続していない。このため、座標値15の画素を輪郭線番号5の輪郭線内に含まれるように更新する処理は、分離処理となって輪郭線番号5の輪郭線の内側に新規輪郭線(輪郭線番号7)が形成される。このようにして濃度値3の2画素が注目画素として処理されると、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図27(b),(c)に示すようになる。
【0098】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス4〜2に格納されている座標値23,19,8を取得してこれらの画素を順次注目画素とし、濃度値2についての輪郭線形成を行うと、図28に示すようになる。図28(a)に示すように、座標値23の画素の全ての輪郭辺は輪郭線番号7の輪郭線に含まれているとともに、その輪郭線の開始辺が含まれている。従って、輪郭線番号7の輪郭線に対して終了処理を行う。また、座標値19の画素の上側、左側の輪郭辺は輪郭線番号5の輪郭線に含まれているため、輪郭線番号5についての輪郭線接続情報DCと輪郭線管理情報DMとが更新される。また、座標値8の画素の右側、下側の輪郭辺は輪郭線番号5の輪郭線に含まれているため、輪郭線番号5についての輪郭線接続情報DCと輪郭線管理情報DMとが更新される。この結果、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図28(b),(c)に示すようになる。
【0099】
次に、注目画素抽出部20は、図13(b)のバッファ領域のメモリアドレス1,0に格納されている座標値26,10を取得してこれらの画素を順次注目画素とし、濃度値1についての輪郭線形成を行うと、図29に示すようになる。図29(a)に示すように、座標値26の画素の右側を除く輪郭辺は輪郭線番号5の輪郭線に含まれているため、輪郭線番号5についての輪郭線接続情報DCと輪郭線管理情報DMとが更新される。また、座標値10の画素の上側を除く輪郭辺は輪郭線番号5の輪郭線に含まれているため、輪郭線番号5についての輪郭線接続情報DCと輪郭線管理情報DMとが更新される。この結果、輪郭線管理情報DMと輪郭線接続情報DCとは、それぞれ図29(b),(c)に示すようになる。
【0100】
最後に、濃度値0についての処理であるが、濃度値0を輪郭抽出する際の閾値とする場合、抽出される輪郭線は原画像の外周部となる。従って、濃度値0については特に注目画素を抽出して1画素ごとに輪郭線を形成する処理を行わずとも原画像の外周部を接続した輪郭線を出力すればよい。そして、濃度値0については各輪郭線についての輪郭線管理情報DMに対して終了処理を施すこととなる。この終了処理が施された結果を、図30に示している。
【0101】
以上説明した処理を簡単に説明すると次のようになる。画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出していく。そして、注目画素の周囲の4つの輪郭辺が既成輪郭線に包含されていない場合には、4つの輪郭辺からなる輪郭線を新規輪郭線として設定し、当該新規輪郭線の接続状態を示す輪郭線接続情報を生成する。また、このとき、新規輪郭線の開始辺と、注目画素の濃度値を新規輪郭線の有効濃度範囲の開始濃度とした開始濃度値とを含む輪郭線管理情報を生成する。一方、注目画素の4つの輪郭辺のうちのいずれかが既成輪郭線に包含されている場合には、その既成輪郭線についての輪郭線接続情報と輪郭線管理情報とを更新する。そして、その更新によって注目画素のいずれかの輪郭辺が包含されていた少なくとも1つの既成輪郭線が消滅する場合には、消滅する既成輪郭線についての輪郭線管理情報に対して注目画素の濃度値を既成輪郭線の有効濃度範囲の終了濃度を示す終了濃度値として格納することによって終了処理を行う。
【0102】
このような処理を行うことにより、同一の濃度値を示す画素が全て注目画素として処理された際、輪郭線接続情報DCにはその濃度値の輪郭線が格納されていることとなる。従って、例えば、濃度値8についての輪郭線を出力したい場合には、濃度値8を示す全ての画素が注目画素として処理された際に、輪郭線接続情報DCを出力すれば所望する濃度値8の輪郭線が得られ、濃度値7以下の画素については処理することを要しない。また、全ての濃度値についての輪郭線を出力したい場合には、各濃度値を示す全ての画素の処理が行われる度に輪郭線接続情報DCを出力していけば原画像を構成する全ての画素を1回ずつ抽出して処理するだけで全ての濃度値の輪郭線を得ることができる。
【0103】
なお、この実施の形態では、各濃度値ごとに輪郭線を形成していく際に、輪郭線管理情報DMを生成/更新していくため、最終的に濃度値1までの上記処理が終了した場合は、輪郭線接続情報DCをメモリ50から消去したとしても、輪郭線管理情報DMを記憶しておけば、後に任意の濃度値についての輪郭線を抽出することができる。
【0104】
<5.輪郭線抽出>
次に、上記のような注目画素を1画素ずつ抽出しつつ、輪郭線を形成させていく処理を行った後に、輪郭線管理情報DMに基づいて各濃度値ごとの輪郭線を抽出する処理について説明する。この処理は、図2の輪郭抽出部60において行われる。
【0105】
輪郭抽出部60では、メモリ50に格納されている輪郭線管理情報DMを参照し、抽出すべき濃度値において有効な輪郭線の開始辺を求め、その開始辺より所定のルール(規則)に基づいて輪郭を追跡することにより所定の濃度値の輪郭線を抽出する。
【0106】
ここで、輪郭線を抽出する際のルールについて説明する。図31は、開始辺の進行方向を特定するルールを示す図である。開始辺は主走査方向X(すなわち、横方向)に沿って位置する場合と副走査方向Y(すなわち、縦方向)に沿って位置する場合とがある。そして、1つの開始辺が特定されると、その開始辺の進行方向を決定する。例えば、開始辺を挟んで存在する2つの画素の濃度値をa,bとすると、開始辺が縦方向に位置する場合であって右側の画素の濃度値aが左側の画素の濃度値bより小さい場合、又は開始辺が横方向に位置する場合であって上側の画素の濃度値aが下側の画素の濃度値bより小さい場合は、図31(a)に示すように、上方向又は右方向に開始辺の進行方向が設定される。これに対し、開始辺が縦方向に位置する場合であって右側の画素の濃度値aが左側の画素の濃度値bより大きい場合、又は開始辺が横方向に位置する場合であって上側の画素の濃度値aが下側の画素の濃度値bより大きい場合は、図31(b)に示すように、下方向又は左方向に開始辺の進行方向が設定される。
【0107】
次に、図32は、輪郭線を追跡形成する際に進行方向を特定するルールを示す図である。図32(a)には既に進行方向が確定した矢印を示している。ここで、抽出すべき濃度値をaとし、矢印前方の左側の画素の濃度値をbとし、矢印前方の右側の画素の濃度値をcとすると、「a≦bかつa≦c」であれば図32(b)に示すように進路を左方向にとり、「a>bかつa≦c」であれば図32(c)に示すように進路を直進方向にとり、「a>c」であれば図32(d)に示すように進路を右方向にとる。このようなルールを設定すると、輪郭抽出の際の進行方向に対して右側には抽出すべき濃度値よりも大きい又は等しい画素が常に得られるとともに、左側には抽出すべき濃度値よりも小さい画素が常に得られる。従って、上記のようなルールに基づいて輪郭辺を辿っていけば、所望の濃度値の輪郭線を抽出することができる。
【0108】
実際に、図5の原画像について得られた輪郭線管理情報DMに基づいて濃度値3の輪郭線を抽出する例を以下に示す。まず、図5の原画像について得られた図30(b)の輪郭線管理情報DMにおいて各輪郭線ごとの有効濃度範囲を示すと図33に示すようになる。図33において有効濃度範囲に濃度値3を含んでいるものは輪郭線番号5と7である。従って、輪郭線番号5,7について図30(b)の輪郭線管理情報DMを参照すると、それぞれの開始辺番号は62,45である。この開始辺を図7のように割り付けられた輪郭辺番号から特定し、開始辺より上記ルールに基づいて輪郭辺を辿っていくと、図34に示すようになる。図34(a)は輪郭辺番号62の開始辺から抽出される輪郭線であり、図34(b)は輪郭辺番号45の開始辺から抽出される輪郭線である。そして、図34(a)と(b)とに示す2つの輪郭線を合わせると、所望の濃度値3の輪郭線が得られることとなる。
【0109】
輪郭抽出部60は、このようにして開始辺より輪郭線の抽出を行って輪郭線出力を行う。従って、輪郭抽出部60が輪郭線出力を行う場合は、画素ごとに画像を走査する必要がなく、効率的に輪郭線の出力を行うことができる。すなわち、輪郭線管理情報DMを一度生成しておけば、それを利用することにより、任意の濃度値についての輪郭抽出の処理を効率的に行うことができ、処理時間を短縮することができる。
【0110】
<6.処理シーケンス>
次に、上述した輪郭線接続情報DCと輪郭線管理情報DMとを生成/更新する処理をコンピュータなどによって行う場合の処理シーケンスについて説明する。図35ないし図38は、コンピュータなどによって濃度値ごとの輪郭線形成を行う処理シーケンスを示すフローチャートである。
【0111】
まず、ステップS10において、原画像に対する前処理を行う。すなわち、この前処理においては上述のような枠付き画像の生成と輪郭辺番号の割付と濃度値に基づく画素のソーティングとが行われる。
【0112】
次に、ステップS11において注目画素の抽出が行われる。注目画素の抽出は、ステップS10のソート結果に基づいて最大の濃度値を示す画素から順次濃度値の降順に1画素ずつ行われる。
【0113】
そして、ステップS12では、ステップS11において抽出された注目画素の4つの輪郭辺が既成輪郭線に含まれているか否かを判定する。この判定は、既に生成されている輪郭線接続情報DCを参照することによって行われる。そして、注目画素の4つの輪郭辺のうちいずれもが既成輪郭線に含まれていない場合は「NO」と判断されてステップS13に進み、注目画素の4つの輪郭辺のうちいずれかが既成輪郭線に含まれている場合は「YES」と判断されてステップS14に進む。
【0114】
ステップS13に進んだ場合は、注目画素の4つの輪郭辺で構成される新規輪郭線を生成し、この新規輪郭線について輪郭線接続情報DCと輪郭線管理情報DMとを生成する。そして、ステップS13の処理が行われると後述するステップS41に進むこととなる(接続子A)。
【0115】
また、ステップS14に進んだ場合は、輪郭線接続情報DCに基づいて注目画素の輪郭辺が含まれている輪郭線を示す所属輪郭線番号を取得する。このとき、注目画素の4つの輪郭辺のうち2以上の輪郭辺が既成輪郭線に含まれている場合は、それぞれの所属輪郭線番号を取得する。そして、ステップS14の処理が行われるとステップS15に進む。
【0116】
そして、ステップS15では、ステップS14において取得された所属輪郭線番号を検証し、注目画素の4つの輪郭辺のうち同一の輪郭線に含まれる輪郭辺が存在するか否かを判定する。すなわち、注目画素の4つの輪郭辺のうち既成輪郭線に含まれている2以上の輪郭辺のそれぞれについて所属輪郭線番号を取得した際に、同一の所属輪郭線番号を示す輪郭辺が存在する場合は「YES」と判断され、それ以外の場合は「NO」と判断される。「YES」と判断された場合は、ステップS16に進み、既成輪郭線に含まれている輪郭辺の接続状態をメモリなどに記憶保存し、ステップS17に進む。また、「NO」と判断された場合は、そのままステップS17に進む。
【0117】
ステップS17では、注目画素の4つの輪郭辺のうちに既成輪郭線の開始辺として登録されている輪郭辺が存在するか否かを判定する。この判定は、既に生成されている輪郭線管理情報DMを参照し、注目画素の4つの輪郭辺の輪郭辺番号が既成輪郭線の開始辺番号として登録されているか否かを検証することによって行われる。そして、既成輪郭線の開始辺として登録されている輪郭辺が存在する場合は「YES」と判断されてステップS18に進み、既成輪郭線の開始辺として登録されている輪郭辺が存在する場合は「NO」と判断されてステップS21に進む(接続子C)。
【0118】
ステップS18では、注目画素の輪郭辺を含む既成輪郭線が注目画素の4つの輪郭辺のみから構成されているか否かを判断する。ここで「NO」と判断された場合はステップS19に進み、「YES」と判断された場合はステップS20に進む。
【0119】
開始辺が注目画素の輪郭辺に含まれている場合は、その輪郭線の開始辺を更新することが必要となる。この理由は、注目画素を処理することによって注目画素の輪郭辺に含まれる開始辺は無効となるからである。このため、開始辺が注目画素の輪郭辺に含まれている場合は、新規輪郭線を生成し、その新規輪郭線がそれ以前の輪郭線の輪郭線接続情報DCを引き継ぐ。新規輪郭線についての輪郭線管理情報DMには、開始辺が登録されていないので新規輪郭線上の1つの輪郭辺(但し、注目画素に接していない輪郭辺)を選択して開始辺とする。また、新規輪郭線についての開始濃度値を注目画素の濃度値とする。そして、それ以前の輪郭線に対しては終了処理を施すこととなる。ところが、実際には、引き継いだ新規輪郭線の情報を変更することは効率が悪いので、この実施の形態では、ステップS19において、つぎのような処理が行われる。
【0120】
輪郭線管理情報DMに新規輪郭線の情報を書き込む領域を確保し、その領域に無効となる開始辺が登録されているそれ以前の輪郭線の内容をコピーする(ただし、輪郭線番号は異なる)。そしてコピーされた輪郭線管理情報DMに対して注目画素の濃度値よりも1つ高い濃度値を終了濃度値に書き込むとともに輪郭辺の数を0にすることにより、生成した新規輪郭線について終了処理を施す。一方、無効となる開始辺が登録されている既成輪郭線についての輪郭線管理情報DMの開始濃度値の欄に現在の注目画素の濃度値を上書きするとともに、開始辺を注目画素の4つの輪郭辺以外の輪郭辺から抽出して上書きする。このような処理を行うことにより、無効となる開始辺が登録されている輪郭線の内容を引き継いで、効率的に新たに有効となる開始辺を設定することができる。そして、この結果、注目画素の4つの輪郭辺のうち既成輪郭線の開始辺として設定されている輪郭辺が存在する場合であっても良好に輪郭線情報を更新することができる。そして、ステップS19の処理が行われると、次に、ステップS21に進む(接続子C)。
【0121】
また、開始辺が注目画素の輪郭辺に含まれている場合であって、その輪郭線が注目画素の4つの輪郭辺のみから構成されている場合は、例えば、図20に示すような場合である。この場合は、注目画素の4つの輪郭辺のみからなる輪郭線に対して終了処理を施せばよい。従って、ステップS20においては、注目画素の輪郭辺を含んでいる輪郭線に対して終了処理を施す。そして、ステップS20の処理が行われると、後述するステップS41に進む(接続子A)。
【0122】
次に、ステップS21において、輪郭線管理情報DMを参照し、注目画素の輪郭辺が含まれている輪郭線のうちで輪郭辺の数が最も大きいものを求め、その輪郭線の輪郭線番号を取得する。
【0123】
そして、ステップS22で、輪郭線接続情報DCにおいて注目画素の輪郭辺を含んでいる輪郭線の所属輪郭線番号を、ステップS21で取得した輪郭線番号に書き換える。次に、ステップS23において、注目画素の4つの輪郭辺の仮想接続状態を生成し、それを保持しておく。
【0124】
そして、ステップS24において注目画素の4つの輪郭辺のうち既成輪郭線に含まれている輪郭辺を1つ選出し、ステップS25において輪郭線接続情報DCを参照して選出した輪郭辺を次の輪郭辺番号に登録している輪郭辺を検出する。そして、ステップS26において仮想接続状態からステップS24で選出された輪郭辺の接続先となつ次の輪郭辺を検出する。そして、ステップS27では、ステップS26で検出された輪郭辺が既成輪郭線に含まれているか否かを判定し、含まれていない場合は「NO」となってステップS28に進み、含まれている場合は「YES」となってステップS29に進む。
【0125】
ステップS28では、ステップS25で検出された輪郭辺の次の輪郭辺番号にステップS26で検出された輪郭辺番号を格納する。一方、ステップS29では、輪郭線接続情報DCを参照し、ステップS26で検出された輪郭辺の接続先となる次の輪郭辺を検出し、この輪郭辺をステップS25で検出された輪郭辺の次の輪郭辺とする。
【0126】
そして、ステップS30においては、輪郭線接続情報DCを参照し、ステップS24で選出した輪郭辺の接続先となっている輪郭辺を検出する。また、ステップS31においては、仮想接続状態を参照し、ステップS24で選出した輪郭辺を次の輪郭辺として登録している輪郭辺を検出する。
【0127】
そして、ステップS32においては、ステップS31で検出した輪郭辺が既成輪郭辺に含まれているか否かを判定し、含まれていない場合は「NO」となってステップS33に進み、含まれている場合は「YES」となってステップS34に進む。
【0128】
ステップS33では、ステップS31で検出された輪郭辺の次の輪郭辺番号にステップS30で検出された輪郭辺番号を格納する。一方、ステップS34では、輪郭線接続情報DCを参照し、ステップS31で検出された輪郭辺を次の輪郭辺としている輪郭辺を検出し、この輪郭辺の次の輪郭辺として登録されている輪郭辺をステップS30で検出された輪郭辺とする。
【0129】
上記のステップS24〜S34の処理で既成輪郭線に含まれている注目画素の1つの輪郭辺について輪郭辺の接続状態の更新処理が終了したこととなる。そして、ステップS35において注目画素の4つの輪郭辺のうち他に既成輪郭線に含まれている輪郭辺があるか否かを判定し、「YES」の場合はその輪郭辺について再び同様の処理を行うべくステップS24に戻り(接続子E)、「NO」の場合はステップS36に進む(接続子F)。
【0130】
そして、ステップS36においては、上記ステップS16において記憶した輪郭辺の接続状態があるか否かを判定する。記憶した接続状態がある場合は「YES」となってステップS37に進み、記憶した接続状態がない場合は「NO」となってステップS41に進む。
【0131】
ステップS37では、記憶している接続状態を読み出して、同一輪郭線に含まれている2つの輪郭辺を抽出する。そして、ステップS38でこれら2つの輪郭辺の接続状態が連続しているか否かを判定する。連続していない場合は、例えば、図19に示したように既成輪郭線の内側にホール状の輪郭線が形成されるので、ステップS39に進む。一方、連続している場合はホール状の輪郭線は形成されないのでステップS40に進む。
【0132】
ステップS39では、既成輪郭線の内側に形成されるホール状の輪郭線に対して開始辺を登録し、新規輪郭線として設定する。そして、ステップS40に進む。
【0133】
ステップS40では、同一輪郭線に含まれている2つの輪郭辺を抽出する際に他の組み合わせがあるか否かを判定し、他の組み合わせがある場合はそれらの輪郭辺についてホール状輪郭線が形成されるか否かを検査するために、再びステップS37に戻る。また、他の組み合わせがない場合は、「NO」となってステップS41に進む。
【0134】
上記ステップS11〜S40の処理によって抽出された注目画素についての処理が終了したこととなり、ステップS41においては次に注目画素として処理すべき画素が存在するか否かを、ソート結果のメモリアドレスに基づいて判定し、次の画素がある場合には「YES」となってステップS11に戻る(接続子G)。また、全ての画素についての処理が終了したときは「NO」となってステップS42に進む。
【0135】
ステップS42では、抽出すべき注目画素が無くなったので、この時点で輪郭線管理情報DMにおいて終了濃度値が格納されていない全ての輪郭線に対して終了濃度値「0」を格納する。つまり、終了処理が施されていない全ての輪郭線に対して終了処理を施す。この終了処理が行われるとステップS43に進む。
【0136】
そして、ステップS43において上記の処理によって生成/更新された輪郭線管理情報DMを保存することにより処理シーケンスが終了する。
【0137】
上記のような処理を行うことにより、各濃度値ごとの輪郭線を抽出することができる輪郭線管理情報DMが得られる。また、上記のような処理過程において各濃度値ごとの輪郭線を出力させる場合は、ステップS11において注目画素を抽出したときに、その注目画素の濃度値を調べて前回の濃度値と異なっていれば、その時点の輪郭線接続情報DCを出力するように構成すればよい。
【0138】
以上、この実施の形態で説明したような処理形態で画像の輪郭抽出を行えば、任意の濃度値についての輪郭抽出の処理を効率的に行うことができ、処理時間を短縮することができることはもはや明らかである。
【0139】
<7.変形例>
上記の処理においては、主として濃度値が0〜9の10階調の画像に対する処理を例示して説明したが、これに限定するものではなく、この発明は任意の階調数の画像に対して適用可能であることは言うまでもない。
【0140】
次に、上記の説明においては、既成輪郭線の内側にホール状輪郭線が新たに形成されることを検出するために、輪郭辺の接続状態が連続するか否かを検出していた。しかし、これ以外に単に画像のパターン検出からホール状輪郭線が新たに形成されるか否かを検出することもできる。
【0141】
次に、上記実施の形態で説明した図2の画像の輪郭抽出装置100を構成する各処理部を、表示部、キーボード、CPU、メモリ等を備える一般的なコンピュータが所定のプログラムを実行することによって実現するものであってもよい。この場合、原画像は磁気ディスクなどに格納しておき、コンピュータ内部のCPUが図35ないし図38に示した各手順を行う画像の輪郭抽出プログラムを実行することによって、各濃度値ごとの輪郭線が順次形成されていくとともに、メモリ内には輪郭線接続情報DCと輪郭線管理情報DMとが順次生成/更新されていく。そして、コンピュータが上述のような処理を行うことによって、コンピュータによる輪郭抽出処理の時間が短縮される。なお、コンピュータが実行する輪郭抽出プログラムは、CD−ROMやフレキシブルディスクなどの可搬性の記録媒体若しくはコンピュータ内設の磁気ディスクなどの固定の記録媒体に記録保存されており、コンピュータのCPUがこれらの記録媒体から輪郭抽出プログラムを読み取って実行するものであってもよい。
【0142】
【発明の効果】
以上説明したように、請求項1に記載の発明によれば、画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出して、輪郭線接続情報と輪郭線管理情報とを更新していく過程において各濃度値ごとの輪郭線が形成されていく。このため、異なる濃度値についての輪郭線をいくつか抽出する際にも、画像を構成する全ての画素を注目画素として抽出して行う処理を1回だけ行えばよい。従って、任意の濃度値についての輪郭抽出の処理を効率的に行うことができ、処理時間を短縮することができる。また、輪郭線管理情報に開始辺を含ませるため、後に任意の濃度値の輪郭抽出を行う場合に輪郭線管理情報を用いることができる。
【0143】
請求項2に記載の発明によれば、画像における同一の濃度値を示す画素が注目画素として処理されれば、その濃度値の輪郭線が得られるため、輪郭抽出の処理を効率的に行うことができ、処理時間を短縮することができる。
【0144】
請求項3に記載の発明によれば、記憶された輪郭線管理情報に基づいて所定の濃度値の輪郭線を抽出することができるため、改めて注目画素を抽出しつつ輪郭線接続情報を生成する必要はない。従って、輪郭抽出の処理を効率的に行うことができ、処理時間を短縮することができる。
【0145】
請求項4に記載の発明によれば、効率的に画像を構成する画素を濃度値の降順若しくは昇順に並べ換えることができる。この結果、輪郭抽出の処理を効率的に行うことができ、処理時間を短縮することができる。
【0146】
請求項5に記載の発明によれば、画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出して、輪郭線接続情報と輪郭線管理情報とを更新していく過程において各濃度値ごとの輪郭線が形成されていく。このため、異なる濃度値についての輪郭線をいくつか抽出する際にも、画像を構成する全ての画素を注目画素として抽出して行う処理を1回だけ行えばよい。従って、任意の濃度値についての輪郭抽出の処理を効率的に行うことができ、処理時間を短縮することができる。
【0147】
請求項6に記載の発明によれば、コンピュータが、所定の画像の輪郭抽出プログラムを実行することにより、画像の輪郭抽出をコンピュータが効率的に行うことができ、処理時間を短縮することができる。
【図面の簡単な説明】
【図1】この発明における輪郭線の生成/更新の概念を示す図である。
【図2】この発明の一実施例としての画像の輪郭抽出装置の構成を示すブロック図である。
【図3】輪郭線接続情報を説明する図である。
【図4】輪郭線管理情報を説明する図である。
【図5】枠付き画像の生成を説明する図である。
【図6】輪郭辺番号の割付を説明する図である。
【図7】7×6の枠付き画像について輪郭辺番号を示す図である。
【図8】7×6の枠付き画像における各画素の座標値を示す図である。
【図9】原画像について濃度値ごとの画素数をカウントした結果を示す図である。
【図10】各濃度値ごとの累積画素数を示す図である。
【図11】濃度値に基づくソート処理を示す図である。
【図12】濃度値に基づくソート処理を示す図である。
【図13】ソート処理が行われた各濃度値ごとの累積画素数とバッファ領域とを示す図である。
【図14】注目画素の4つの輪郭辺が1つの既成輪郭線に含まれている場合を示す図である。
【図15】図14(a)の輪郭線E1を図14(b)の輪郭線E1に更新する過程を示す図である。
【図16】注目画素の4つの輪郭辺が3つの既成輪郭線に含まれている場合を示す図である。
【図17】図16(a)の状態における輪郭線接続情報などを示している図である。
【図18】輪郭線接続情報の一例を示す図である。
【図19】ホール状の輪郭線が形成される場合の一例を示す図である。
【図20】輪郭線が消滅する場合の一例を示す図である。
【図21】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図22】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図23】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図24】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図25】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図26】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図27】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図28】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図29】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図30】各濃度値ごとの輪郭線を抽出していく際の輪郭線管理情報と輪郭線接続情報とを示す図である。
【図31】開始辺の進行方向を特定するルールを示す図である。
【図32】輪郭線を追跡形成する際に進行方向を特定するルールを示す図である。
【図33】輪郭線管理情報において各輪郭線ごとの有効濃度範囲を示す図である。
【図34】開始辺よりルールに基づいて輪郭辺を辿っていく過程を示す図である。
【図35】コンピュータなどによって濃度値ごとの輪郭線形成を行う処理シーケンスを示すフローチャートである。
【図36】コンピュータなどによって濃度値ごとの輪郭線形成を行う処理シーケンスを示すフローチャートである。
【図37】コンピュータなどによって濃度値ごとの輪郭線形成を行う処理シーケンスを示すフローチャートである。
【図38】コンピュータなどによって濃度値ごとの輪郭線形成を行う処理シーケンスを示すフローチャートである。
【符号の説明】
10 前処理部
20 注目画素抽出部
30 輪郭辺判定部
40 輪郭線形成部
40a 輪郭線情報生成部
40b 輪郭線情報更新部
50 メモリ
60 輪郭抽出部
70 記憶部
DM 輪郭線管理情報
DC 輪郭線接続情報
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image contour extraction method and apparatus, and a recording medium on which a program for extracting an image contour by a computer is recorded.
[0002]
[Prior art]
When an image is processed by a computer, an outline of the image may be extracted. The contour of the extracted image is subjected to conversion processing such as rotation, enlargement, reduction, etc. on the image in the contour, the image in the contour is filled with a desired color, the image in the contour is combined with other images, or descending It is used for processing.
[0003]
Here, as a method for extracting the contour of an image, there is a method disclosed in Japanese Patent Laid-Open No. 5-242246. In this method, the image is scanned line by line along the main scanning direction, and a contour line along the main scanning direction is extracted in each scanning. If the end points of the two contour lines detected in the main scanning direction match, they are connected in the sub scanning direction to form one contour line. A desired contour is extracted by performing such processing for each line of all images.
[0004]
[Problems to be solved by the invention]
However, in the conventional image contour extraction method as described above, when several contour lines with different density values are extracted, the entire image region is scanned line by line to extract one contour line. Processing had to be performed for each density value, and there was a problem that the time required for contour extraction was long.
[0005]
The present invention has been made in view of the above problem, and records an image contour extraction method, apparatus, and program for efficiently performing contour extraction processing for an arbitrary density value and reducing processing time. An object of the present invention is to provide a recording medium.
[0006]
[Means for Solving the Problems]
In order to achieve the above object, the invention according to claim 1 is a method for extracting an outline of an image, wherein: (a) a pixel of interest one by one in descending order from a pixel indicating the maximum density value in the image And (b) when a plurality of contour sides around the target pixel are not included in the existing contour line, a contour line composed of the plurality of contour sides is set as a new contour line, and Contour line connection information indicating a connection state of a new contour line is generated, and the start side of the new contour line selected from any one of the plurality of contour sides of the target pixel, and the density of the target pixel Generating contour management information including a starting density value whose value is a starting density of the effective density range of the new contour, and (c) any one of the plurality of contour sides of the target pixel is already formed. If included in the contour line, Updating the outline connection information for a line; and (d) extinguishing if at least one existing outline that includes any of the outline sides of the pixel of interest disappears due to the updating. Adding a density value of the pixel of interest as an end density value indicating an end density of an effective density range of the existing contour line to the contour management information for the existing contour line.
[0007]
According to a second aspect of the present invention, in the image contour extracting method according to the first aspect, the steps (a) to (d) are repeatedly performed by using a pixel having the same density value in the image as the target pixel. The contour line connection information generated / updated by this is output.
[0008]
According to a third aspect of the present invention, in the image contour extracting method according to the first aspect, (e) storing the contour management information generated by repeatedly performing the steps (a) to (d). And when extracting a contour line of a predetermined density value, (f) the predetermined density based on the effective density range indicated by the start density value and the end density value included in the contour management information Specifying a contour line of density value, obtaining the start side from the contour management information for the contour line, and (g) sequentially extracting contour sides from the start side according to a predetermined rule; It is characterized by having.
[0009]
According to a fourth aspect of the present invention, in the image contour extracting method according to any one of the first to third aspects, the step performed prior to the steps (a) to (d) includes: (h) the image (I) a step of securing a recording area for recording pixel information for all the pixels constituting the image, and (i) searching for all the pixels constituting the image and counting the number of pixels for each density value, and (j ) Obtaining a cumulative number of pixels less than the density value for each density value based on the count result; (k) extracting the pixels constituting the image pixel by pixel; and (l) the ( k) detecting the density value of the pixel extracted in the step, obtaining the cumulative pixel number corresponding to the density value, and extracting the extracted pixel at the position of the recording area corresponding to the cumulative pixel number value. The pixel information to be specified is recorded, and the value of the cumulative number of pixels And a step of updating is characterized repetition by performing said (l) step from (k) until all of the pixels constituting the image.
[0010]
The invention according to claim 5 is an apparatus for extracting a contour of an image, and (a) a target pixel extracting unit that extracts a target pixel one by one in descending order from a pixel indicating a maximum density value in the image; (B) When a plurality of contour sides around the target pixel are not included in the existing contour line, the contour line composed of the plurality of contour sides is set as a new contour line, and the connection state of the new contour line is And generating a contour connection information to indicate the start side of the new contour line selected from any one of the plurality of contour sides of the target pixel and the density value of the target pixel of the new contour line. Contour line information generating means for generating contour line management information including a start density value as the start density of the effective density range; (c) storage means for storing the contour line connection information and the contour line management information; (d) Of the plurality of contour sides of the target pixel If any of the contours is included in the existing contour, the contour connection information stored in the storage unit is updated for the existing contour, and the contour of any of the target pixels is updated by the update. In a case where at least one existing contour line that includes an edge disappears, the density value of the target pixel is set with respect to the contour management information stored in the storage unit for the existing contour line that disappears. Updating means for additionally updating as an end density value indicating the end density of the effective density range of the existing contour line.
[0011]
The invention according to claim 6 is a recording medium on which a program for extracting the contour of an image is recorded by a computer, and (a) 1 in descending order from a pixel indicating the maximum density value in the image. A procedure for extracting a pixel of interest for each pixel; (b) when a plurality of contour sides around the pixel of interest are not included in the existing contour line, a contour line composed of the plurality of contour sides is set as a new contour line And generating the contour connection information indicating the connection state of the new contour, and selecting the start side of the new contour that selects any one of the plurality of contour sides of the pixel of interest, and the attention (C) any one of the plurality of contour sides of the target pixel; and (c) a procedure for generating contour management information including a density value of a pixel and a start density value that is a start density of an effective density range of the new contour line. Is an existing outline If included, a procedure for updating the contour connection information for the ready contour, (d) at least one ready contour in which any of the contour sides of the target pixel is included by the update When the line disappears, the density value of the target pixel is added as the end density value indicating the end density of the effective density range of the ready contour line to the contour management information regarding the ready contour line that disappears. An image contour extraction program for executing the procedure is recorded.
[0012]
DETAILED DESCRIPTION OF THE INVENTION
<1. Summary of Invention>
The above-described conventional image contour extraction method scans the contour extraction process for each line in the sub-scanning direction along the main scanning direction on the image plane composed of the main scanning direction and the sub-scanning direction.
[0013]
On the other hand, the image contour extraction method according to the present invention sequentially extracts one pixel at a time from the pixel showing the maximum density value out of the pixels constituting the image, and generates a new contour line, Or update the line.
[0014]
Here, if a line that is a boundary between one pixel and its adjacent pixels is called a contour side, one pixel generally has four contour sides.
[0015]
Therefore, it is determined whether or not any of the four contour sides of the pixel sequentially extracted from the maximum density value (hereinafter referred to as “target pixel”) is included in the already generated contour line. If none of the contour sides is included in the existing contour line, a new contour line consisting of the four contour sides of the target pixel is newly generated, while one of the contour sides is included in the existing contour line. In this case, the existing contour line is updated so that the target pixel is included in the contour.
[0016]
FIG. 1 is a diagram showing the concept of such contour generation / update. 1 exemplifies 2 × 2 four pixels PA to PD, the density value of the pixel PA is LV4, the density value of the pixel PB is LV3, and the density value of the pixel PC is LV2. The density value of PD is LV1. Here, the relationship between the density values is LV1 <LV2 <LV3 <LV4. First, when the maximum density value LV4 is extracted, the pixel PA is extracted. Then, as shown in FIG. 1A, the four contour sides of the pixel PA are generated as the new contour line Ea. Next, as shown in FIG. 1B, a pixel PB having a density value LV3 is extracted. Of the four contour sides of the pixel PB, the contour side in contact with the pixel PA is already included in the contour line Ea, so the contour line Ea is updated to generate the contour line Eb. Next, as shown in FIG. 1C, the pixel PC having the density value LV2 is extracted. Of the four contour sides of the pixel PC, the contour side in contact with the pixel PA is already included in the contour line Eb, so the contour line Eb is updated to generate the contour line Ec. Finally, as shown in FIG. 1D, the pixel PD having the density value LV1 is extracted. Of the four contour sides of the pixel PD, two contour sides in contact with the pixels PB and PC are already included in the contour line Ec, so the contour line Ec is updated to generate the contour line Ed.
[0017]
In this process, all the contour lines Ea to Ed existing for each density value are extracted while the four pixels PA to PD are processed one by one. Therefore, if the contour line is output when the contour line for each density value is extracted, the contour line for all density values can be obtained by performing the process for each pixel for the entire image region only once. Can be obtained.
[0018]
Further, when a new contour line is generated in such a process, one of the contour sides constituting the new contour line is set as a start side so that the contour line can be traced later. Set as. For this reason, even if the contour line is updated as the above process proceeds, it is possible to easily extract a contour line having a predetermined density value by tracking the contour based on a predetermined rule (rule) from the start side. it can.
[0019]
Hereinafter, a detailed configuration for realizing such processing will be described.
[0020]
<2. Configuration of device>
FIG. 2 is a block diagram showing a configuration of an image contour extracting apparatus 100 as an embodiment of the present invention. As shown in FIG. 2, the contour extracting apparatus 100 includes a preprocessing unit 10, a target pixel extracting unit 20, a contour side determining unit 30, a contour line forming unit 40, a memory 50, a contour extracting unit 60, and a storage unit 70. I have.
[0021]
The storage unit 70 is for storing an image as data, and the preprocessing unit 10 is a part that reads an image from the storage unit 70 and performs preprocessing on the image. In the preprocessing, the generation of an image with a frame, the assignment of contour edge numbers, and the sorting of pixels based on density values are performed. Details of these processes will be described later.
[0022]
The pixel-of-interest extraction unit 20 sequentially extracts pixels of interest one pixel at a time in order from the pixel having the highest density value among a plurality of pixels constituting the image.
[0023]
Then, the contour edge determination unit 30 determines whether or not any of the four contour edges of the target pixel is included in the already generated contour line, and the result is sent to the contour line formation unit 40. Tell. In determining the contour side, the contour connection information DC stored in the memory 50 is referred to. The contour line is formed by continuously connecting a plurality of contour sides. Since the connection state of the plurality of contour sides forming the contour line has already been described in the contour line connection information DC, the contour line connection information By referring to DC, it can be determined whether or not any of the four contour sides of the target pixel is included in the already generated contour line.
[0024]
FIG. 3 is a diagram for explaining the outline connection information DC. For example, as shown in FIG. 3A, when a pixel PA is extracted as a target pixel and a new contour line is formed by four contour sides a, b, c, d around the pixel PA. The outline connection information DC is described in a state as shown in FIG. 3B, the contour side a is connected to the contour side b, the contour side b is connected to the contour side c, the contour side c is connected to the contour side d, and the contour side d is connected to the contour side a. You can see that The outline number of the outline formed by these outline sides a, b, c, and d is “1”.
[0025]
Then, when the pixel PB shown in FIG. 3A is extracted as the target pixel, if the contour line connection information DC in FIG. 3B is referred to, the four contour sides b, e, f around the pixel PB will be described. , G, the contour side b is already included in the contour line with the contour number “1”. Therefore, the use state of each contour side of the target pixel can be determined by referring to the contour line connection information DC. One contour side cannot be included in a plurality of contour lines at the same time.
[0026]
The contour line forming unit 40 includes a contour line information generating unit 40a and a contour line information updating unit 40b, and the contour side determining unit 30 has already generated all of the four contour sides of the target pixel. When it is determined that the line is not included in the line, the outline information generation unit 40a operates to generate a new outline, while one of the four outline sides of the target pixel has already been generated. When it is determined that it is included in the existing contour line, the contour line information update unit 40b operates to update the existing contour line. This update processing includes processing of contour separation, integration, and disappearance as will be described later.
[0027]
When the contour information generation unit 40 a generates a new contour, the contour connection state is described in the contour connection information DC, and the contour management information DM is generated and stored in the memory 50.
[0028]
The outline information update unit 40b updates the connection state of the outline described in the outline connection information DC when the existing outline is updated.
[0029]
Further, when at least one of the existing contour lines disappears due to the update, the contour line information update unit 40b stores the density value of the current target pixel in the end density value column of the contour line management information DM for the disappeared contour line. One higher density value is stored. Here, when at least one of the existing contour lines disappears due to the update, the start side registered in the contour management information DM becomes invalid due to the addition of the pixel of interest, and two or more contour lines This includes the case where only one contour line remains due to the integration and the other contour line disappears. Further, when there is no pixel of interest to be extracted next, the contour line information update unit 40b stores “0” as the end density value for those for which the end density value is not yet stored in the contour line management information DM. To do. Note that processing for storing the end density value in this way is referred to as end processing.
[0030]
Since the above-mentioned contour line connection information DC is the contour line itself, the contour line information generation unit 40a and the contour line information update unit 40b describe the new connection state in the contour line connection information DC or the contour line connection information DC. If the contour line connection information DC is output when updated, the contour line is output.
[0031]
For example, when the density value of the image is 256 gradations from 0 to 255 and it is desired to extract a contour line having a density value of 126, the pixel of interest is extracted sequentially from the pixel of the density value 255, and each of them is extracted. Contour lines for density values are formed. When the processing for all the pixels having a density value of 126 is completed, a desired contour line has been formed in the contour line connection information DC. In this case, extraction of pixels having a density value of 125 or less need not be performed, so efficient contour extraction is performed.
[0032]
However, in this embodiment, once the contour line for each pixel is formed for all the images, it is necessary to form the contour line for each pixel for all the images when trying to extract the contour line again. In order to avoid this, the contour management information DM is stored in the memory 50.
[0033]
Here, the outline management information DM will be described. FIG. 4 is a diagram for explaining the outline management information DM. The numbers in each pixel shown in FIG. 4A indicate the density value of each pixel.
[0034]
For example, as shown in FIG. 4A, when a pixel PA is extracted as a target pixel and a new contour line is formed by four contour sides a, b, c, and d around the pixel PA. The outline management information DM is described in a state as shown in FIG. A number that does not overlap with an existing contour number is assigned to the contour number of the contour management information DM. The start side number stores the number of the contour side (that is, the start side) that becomes the extraction start point when a newly generated contour line is extracted later.
[0035]
As a start side, a contour side shared with a pixel indicating the minimum density value among pixels adjacent to the target pixel, or a density value having the largest difference from the density value of the target pixel among pixels adjacent to the target pixel It is preferable to select a contour side shared with a pixel having. This is because the effective density range in which the start side is effective can be maximized. Therefore, in the case of the density value as shown in FIG. 4A, the contour side a is determined as the start side.
[0036]
In the start density value, the density value “9” of the target pixel PA is stored. The end density value stores a density value that is one higher than the density value of the pixel of interest when the outline with the outline number “1” is updated and disappears, that is, when the start side becomes invalid. .
[0037]
In the number of contour sides, the number of contour sides constituting the contour line of the contour number “1” is stored. In the case of the example of FIG. 4A, the contour line is composed of four contour sides a, b, c, and d, so the number of contour sides is “4”.
[0038]
By storing such contour management information DM in the memory 50, when a contour line having an arbitrary density value is extracted later, the contour extraction unit 60 starts and ends the density values of the contour management information DM. The effective density range in which the start side of the contour line is effective can be known from the value, and all the start sides in which the density value to be subjected to the contour extraction is within the effective density range can be acquired. Then, if the contour extraction unit 60 performs contour extraction based on a predetermined rule from those start sides, it is possible to appropriately extract the contour of the image.
[0039]
That is, in the apparatus of FIG. 2, when the contour management information DM is not yet stored in the memory 50, the pre-processing unit 10, the target pixel extracting unit 20, the contour side determining unit 30, and the contour forming unit 40 are included. It functions so that the contour line management information DM and the contour line connection information DC are sequentially stored in the memory 50 as the contour line for each density value is formed. Further, the contour line forming unit 40 can perform contour line output by outputting the contour line connection information DC when it is generated / updated.
[0040]
On the other hand, when the outline management information DM is already stored in the memory 50, the outline extraction unit 60 functions to read out the outline management information DM in the memory 50 and register it for each outline. Contour extraction is performed from the side based on a predetermined rule, and the contour line extracted by the contour extraction unit 60 is output.
[0041]
<3. Pretreatment>
The preprocessing performed in the preprocessing unit 10 will be described.
[0042]
First, a framed image is generated as first preprocessing. FIG. 5 is a diagram illustrating generation of a framed image. FIG. 5A shows an original image to be subjected to contour extraction, FIG. 5B shows an intermediate stage when generating a framed image, and FIG. 5C shows the original image. The image with a frame produced | generated is shown. FIG. 5 shows an example in which the original image is composed of 5 × 4 20 pixels, and the number in each pixel indicates the density value of that pixel. In the following, the process for the original image as shown in FIG. 5A will be described as an example.
[0043]
The preprocessing unit 10 secures an image area in which the periphery of the original image in FIG. 5A is expanded by one pixel (FIG. 5B). As a result, the density value 0 is stored for all the pixels distributed around the original image. In this way, a framed image made up of 42 pixels of 7 × 6 is generated as shown in FIG.
[0044]
The reason for generating such a framed image is to make it possible to perform the same processing on all the contour sides of the original image and improve the processing efficiency. Since each contour side located at the outer periphery of the original image shown in FIG. 5A is not in contact with other pixels, the density value comparison cannot be performed. Therefore, a framed image is generated so that density value comparison can be performed for all contour sides included in the original image. Note that it is not necessary to generate a framed image when exception processing different from other contour sides is performed for each contour side located on the outer periphery of the original image shown in FIG.
[0045]
Next, as a second preprocessing, a contour side number assignment process is performed for each contour side including the framed image. FIG. 6 is a diagram illustrating the assignment of contour side numbers. If there are n pixels in the main scanning direction X in the framed image, 0 is assigned to the lower side of the leftmost pixel of the first line, and 1 is assigned to the right side. Then, numbers are sequentially assigned to the lower side, the right side, the lower side of the third pixel, and the right side of the second pixel in the first line. Since there are n pixels in the main scanning direction X, the number (2n) is assigned to the lower side of the leftmost pixel of the second line, and the number (2n + 1) is assigned to the right side. In the same manner, numbers are sequentially assigned to the lower side, the right side, the lower side, and the right side of the second pixel in the second line of the second line, and contour side numbers are assigned to all lines.
[0046]
In this manner, when the contour side numbers are assigned to the 7 × 6 framed image as shown in FIG. 5C, the result is as shown in FIG. In FIG. 7, the thick line indicates the original image portion. Therefore, by assigning the contour side number, a unique number is assigned to all the contour sides necessary for the contour extraction of the original image. Here, as shown in FIG. 7, no contour side number is assigned to each contour side located at the upper end of the framed image and each contour side located at the left end, but these contour sides are the contours of the original image. There is no problem because it is impossible.
[0047]
Also, when assigning contour edge numbers only to the original image, time must be taken because exception processing must be performed to assign contour edge numbers to the contour edges located at the top and left edges of the original image. However, when assigning contour edge numbers to an image with a frame as described above, numbers are assigned to all contour edges included in the original image without performing exception processing. The contour side number can be given to the processing time, and the processing time can be shortened.
[0048]
Next, as a third preprocess, a process of sorting the pixels constituting the original image based on the density value is performed. The sorting based on the density value is performed so that the target pixel extraction unit 20 can sequentially extract the target pixels from the pixels having the higher density values. Accordingly, any known sorting method can be applied as long as it can be sorted so that one pixel can be extracted in descending order of density value from the pixels constituting the original image. can do.
[0049]
However, the various sort methods known in the art require a lot of time for sorting because judgment processing and data replacement processing are frequently used.
[0050]
Therefore, in this embodiment, it is preferable to apply a sorting method as described below in order to perform sorting efficiently.
[0051]
First, prior to performing the sorting process, a coordinate value is set for each pixel of the framed image. In general, when coordinate values are set for each pixel in the image plane, an XY coordinate system expressed by a position in the main scanning direction X and a position in the sub-scanning direction Y is used. In this case, the X coordinate and the Y coordinate are used. The two values of must be managed. Therefore, in this embodiment, if the framed image has n pixels in the main scanning direction X, one value derived by “(Y coordinate) × (n) + (X coordinate)” is expressed as coordinates. Value. That is, a coordinate value is set for each pixel by sequentially assigning one number along the main scanning direction X of the framed image. When the coordinate values are set for the framed image shown in FIG. 5C in this way, the coordinate values of each pixel are as shown in FIG. In FIG. 8, the number of each pixel is a coordinate value, and the display of the density value is omitted. Further, the thick line in FIG. 8 indicates the original image portion.
[0052]
Next, the actual sorting process is performed. First, all pixels included in the original image are searched, and the number of pixels for each density value is counted. When the number of pixels for each density value is counted for the original image shown in FIG. 5, a count result as shown in FIG. 9 is obtained. The preprocessing unit 10 temporarily stores the count result in a memory (not shown) provided therein.
[0053]
Then, based on the count result shown in FIG. 9, for each density value, the cumulative number of pixels indicating a density value less than the density value is derived. For example, from the count result of FIG. 9, the cumulative number of pixels with density value 1 is 0 because it is the number of pixels with density value 0, and the cumulative number of pixels with density value 2 is the sum of the number of pixels with density values 0 to 1. Therefore, the number of accumulated pixels having a density value of 3 is 5 because it is the sum of the number of pixels having density values of 0 to 2. When the cumulative number of pixels is obtained for each density value in this way, it is as shown in FIG.
[0054]
Next, buffer areas for storing sort data are secured for the number of pixels constituting the original image. Since the original image shown in FIG. 5 has 20 pixels, 20 buffer areas are secured. Then, one pixel is extracted from the pixels constituting the original image in the order of coordinate values, and the density value is detected.
[0055]
In the case of the original image in FIG. 5, pixels with a density value of 2 are first extracted as shown in FIG. 11. Since the cumulative number of pixels corresponding to the extracted pixel density value 2 is 2, the coordinate value of the extracted pixel is stored in the storage position corresponding to 2 in the buffer area, that is, the memory address 2 position. In the case of FIG. 11, since the coordinate value of the pixel having the extracted density value 2 is 8 (see FIG. 8), the coordinate value 8 is stored at the position of the memory address 2. When the coordinate value is stored in the buffer area, the cumulative number of pixels of density value 2 is changed to 3 by adding 1 to the cumulative number of pixels 2 of density value 2.
[0056]
Next, as shown in FIG. 12, a pixel having a density value of 9 is extracted. Since the cumulative number of pixels corresponding to the extracted pixel density value 9 is 19, the coordinate value of the extracted pixel is stored in the storage position corresponding to 19 in the buffer area, that is, the memory address 19 position. In the case of FIG. 12, since the coordinate value of the pixel of the extracted density value 9 is 9 (see FIG. 8), the coordinate value 9 is stored at the memory address 19 position. When the coordinate value is stored in the buffer area, 1 is added to the accumulated pixel number 19 of the density value 9 to change the accumulated pixel number of the density value 9 to 20.
[0057]
Thereafter, the same processing is repeated every time one pixel is arranged in the coordinate value order from the pixels constituting the original image. When the processing for all the pixels constituting the original image is completed, the cumulative number of pixels for each density value and the buffer area are in a state as shown in FIG.
[0058]
In the buffer area shown in FIG. 13B, the coordinate values of the pixels having the smaller density values are stored in order from the smallest memory address. For example, the memory addresses 0 and 1 store the coordinate value of the pixel having the density value 1, and the memory addresses 2 to 4 store the coordinate value of the pixel having the density value 2. Therefore, by performing the processing as described above, the result of sorting the pixels constituting the original image based on the density value is stored in the buffer area.
[0059]
When the sorting method as described above is applied, the sorting time can be reduced without performing the determination process for comparing the density values of the two pixels or the data replacement process, thereby reducing the time required for sorting.
[0060]
If the sort result based on the density value is stored in the buffer area in this way, when the target pixel extracting unit 20 sequentially extracts the target pixel from the pixels having the higher density value, the maximum memory address of the buffer area is stored. It is only necessary to acquire coordinate values sequentially from the positions and extract pixels having the coordinate values, and efficient processing can be performed.
[0061]
<4. Generation and update of contour management information>
Next, a description will be given of processing in which the target pixel extraction unit 20 sequentially extracts target pixels from pixels having a high density value, and generates or updates the contour management information and the contour connection information.
[0062]
The target pixel extraction unit 20 sequentially extracts target pixels from pixels having a high density value based on the sort result as shown in FIG. Then, the contour side numbers of the four contour sides around the target pixel are obtained. As shown in FIG. 13B, since the coordinate value of the pixel is stored in the sort result, the numbers of the four contour sides of the target pixel are obtained from this coordinate value. For example, if the coordinate value of the pixel of interest is P, and n pixels exist in the main scanning direction X of the framed image, the contour edge numbers on the upper side, the right side, the lower side, and the left side of the pixel of interest are NU, If NR, ND, NL,
Upper contour side number: NU = (P−n) × 2
Contour side number on the right side: NR = (P × 2) +1
Lower contour side number: ND = (P × 2)
Contour side number on the left side: NL = (P × 2) −1
Can be obtained. Then, the target pixel extraction unit 20 sends the four contour side numbers for the target pixel to the contour side determination unit 30.
[0063]
The contour side determination unit 30 refers to the contour line connection information DC in the memory 50 and determines whether or not the contour side number of the target pixel is included in the already generated contour line.
[0064]
Then, when the outline connection information DC is not yet stored in the memory 50, or as a result of referring to the outline connection information DC, any of the four outline sides of the target pixel is not included in the existing outline. If determined, the contour information generation unit 40a is instructed to generate a contour line composed of four contour sides of the target pixel. Thereby, the contour line information generation unit 40a generates a new contour line including four contour sides around the target pixel, and describes the connection state of the new contour line in the contour line connection information DC of the memory 50. The start edge of the new contour line is obtained and described in the contour management information DM.
[0065]
On the other hand, as a result of referring to the contour line connection information DC, when it is determined that any of the four contour sides of the target pixel is included in the existing contour line, the contour line information update unit 40b receives the contour line connection information DC and Command to update the contour management information DM.
[0066]
A process in which the contour line information update unit 40b updates the contour line connection information DC and the contour line management information DM will be described. FIG. 14 is a diagram illustrating a case where four contour sides of a target pixel are included in one existing contour line. In FIG. 14, the hatched pixel is the target pixel, the thin line is each contour side, and the bold line indicates the contour side included in the contour line. As shown in FIG. 14A, among the four contour sides a, b, c, and d of the target pixel, the contour side d is included in the existing contour line E1. When the target pixel is added in such a state, the existing outline E1 is updated as shown by the thick line in FIG.
[0067]
FIG. 15 is a diagram illustrating a process of updating the contour line E1 of FIG. 14A to the contour line E1 of FIG. 14B. 15A to 15E, the left diagram is the contour connection information DC stored in the memory 50, and the right diagram is a hypothesis that the contour is formed from the four contour sides of the target pixel. This is a virtual connection state of the contour side of the target pixel temporarily stored in the memory 50.
[0068]
First, when the target pixel shown in FIG. 14A is extracted, the outline connection information DC and the virtual connection information of the outline E1 are as shown in FIG. That is, the connection state of the contour line E1 is “e → d → f → g”. Further, the connection of the four contour sides of the target pixel is “a → b → c → d → a”.
[0069]
Then, by adding the pixel of interest this time, the contour side d is not included in the contour line E1. Therefore, the next contour side number for the contour side e having the contour side d as the next contour side (connection destination) in the contour line connection information DC is updated. That is, referring to the virtual connection state, the contour side d is connected to the contour side a, so that the next contour side number for the contour side e is rewritten to a. As a result, the outline connection information DC and the virtual connection information of the outline E1 are as shown in FIG.
[0070]
In addition, since the contour side d is not included in the contour line E1 by adding the pixel of interest this time, the next for the contour side c having the contour side d as the next contour side (connection destination) in the virtual connection information. Will update the contour side number. That is, referring to the contour line connection information DC, the contour side d is connected to the contour side f, so the next contour side number for the contour side c is rewritten to f. As a result, the outline connection information DC and the virtual connection information of the outline E1 are as shown in FIG.
[0071]
Since the contour side d is not included in the contour line E1 by adding the pixel of interest this time, the connection state for the contour side d is deleted from the contour side connection information DC. As a result, the outline connection information DC and the virtual connection information of the outline E1 are as shown in FIG.
[0072]
Then, the outline connection information DC and the virtual connection information of the outline E1 are represented by copying the connection states of the outline sides a, b, and c excluding the outline side d from the virtual connection information to the outline connection information DC. 15 (e). In the contour line connection information DC in FIG. 15E, the connection state of the contour line E1 as shown by the thick line in FIG. 14B is described. Accordingly, the virtual connection information may be deleted from the memory 50 when the processing so far is performed.
[0073]
Next, when the four contour sides of the target pixel are included in two or more pre-formed contour lines, the processing is almost the same as above, but there are also different portions. For example, FIG. 16 is a diagram illustrating a case where four contour sides of a target pixel are included in three existing contour lines. In FIG. 15, the hatched pixels are the target pixels, the thin lines are the respective contour sides, and the thick lines indicate the contour sides included in the contour lines. In FIG. 14A, the contour sides e, d, f, and g are included in the contour line E1, and the contour sides t, a, and s are included in the contour line E2, and the contour sides m, c, and n are included. Is included in the contour line E3. In the contour line E1, the contour sides are connected in the order of “e → d → f → g”, and in the contour line E2, the contour sides are connected in the order of “t → a → s”. In the contour line E3, the contour sides are connected in the order of “m → c → n”. When a pixel of interest indicated by diagonal lines is added in such a state, the contour lines E2 and E3 are integrated with the contour line E1 and disappear as shown by the thick lines in FIG.
[0074]
When the contour lines are integrated, the contour line information update unit 40b refers to the contour line management information DM of each of the contour lines E1, E2, and E3, and acquires the number of contour sides constituting each contour line (FIG. 4 ( b)). Then, only the contour line having the largest number of contour sides is left, and the other contour lines are eliminated. For example, if the contour line having the largest number of contour sides in FIG. 16A is E1, only the contour line E1 remains as shown in FIG. The lines E2 and E3 have disappeared.
[0075]
FIG. 17 shows contour connection information and the like in the state of FIG. 17A shows the outline connection information DC, and FIG. 17B is temporarily stored in the memory 50 when an outline is formed from the four outline sides of the pixel of interest. This is a virtual connection state of the contour side of the target pixel, and FIG. 17C shows the contour management information DM. In FIG. 17C, the column of the start side number and the start density value stores the number of the contour side and the density value of the target pixel when the respective contour lines E1 to E3 are generated. Here, these values are indicated by “−” for convenience.
[0076]
By adding the pixel of interest indicated by diagonal lines in FIG. 16A, the contour sides a, c, and d are not included in the contour line. Therefore, the next contour side number for the contour side t having the contour side a as the next contour side (connection destination) in the contour line connection information DC of FIG. 17A is updated. That is, referring to the virtual connection state in FIG. 17B, the contour side a is connected to the contour side b, so the next contour side number for the contour side t is rewritten to b.
[0077]
Next, since the number of contour sides of the contour E1 is the largest from FIG. 17C, the contours E2 and E3 disappear. Accordingly, all belonging contour numbers E2 and E3 in the contour connection information DC in FIG. 17A are rewritten to E1.
[0078]
Next, since the contour side a is not included in the contour line, the next contour for the contour side d having the contour side a as the next contour side (connection destination) in the virtual connection state of FIG. The edge number will be updated. That is, referring to the contour line connection information DC, the contour side a is connected to the contour side s, so the next contour side number for the contour side d is rewritten from a to s. Then, since the contour side d is not included in the contour line, the next contour side e with the contour side d as the next contour side (connection destination) in the contour line connection information DC in FIG. The contour side number will be updated. In other words, referring to the virtual connection state, since the contour side d is previously connected to the contour side s, the next contour side number for the contour side e is rewritten from d to s.
[0079]
Next, since the contour side c is not included in the contour line, the next for the contour side m having the contour side c as the next contour side (connection destination) in the contour line connection information DC in FIG. Will update the contour side number. That is, referring to the virtual connection state, the contour side c is connected to the contour side d, so the next contour side number for the contour side m is rewritten from c to d. However, since the contour side d is not included in the contour line, the contour side f connected to the contour side d in the contour line connection information DC is set as the next contour side number for the contour side m.
[0080]
Next, since the contour side c is not included in the contour line, the next contour side number for the contour side b having the contour side c as the next contour side in the virtual connection state of FIG. 17B is updated. Will be. That is, referring to the contour line connection information DC, the contour side c is connected to the contour side n, so the next contour side number for the contour side b in the virtual connection state is rewritten from c to n.
[0081]
Next, since the contour side d is not included in the contour line, the next for the contour side e having the contour side d as the next contour side (connection destination) in the contour line connection information DC in FIG. Is updated from d to s with reference to the virtual connection state. Further, since the contour side c is not included in the contour line, the next contour side number for the contour side m having the contour side c as the next contour side in the contour line connection information DC in FIG. Update from c to f. This process has already been performed once, but by performing the same process once again, the process of rewriting the connection state of the four contour sides a, b, c, d of the target pixel starts from which contour side. Even if it is done, the same result is obtained.
[0082]
Next, since the contour sides a, c, and d are not included in the contour line, the connection information for the contour sides a, c, and d is deleted in the contour line connection information DC in FIG. Then, the connection state for only the contour side b in the virtual connection state is written in the contour line connection information DC. In addition, since the contour lines E2 and E3 disappear due to this processing, a density value one higher than the density value of the target pixel is written in the end density value column for the contour lines E2 and E3 in the contour management information DM. The number of contour sides for these contour lines is set to 0, the effective density range for the contour lines E2 and E3 is determined, and end processing is performed for the contour lines E2 and E3. In addition, the number of contour sides for the contour E1 is updated in the contour management information DM. Note that when this process is performed, the virtual connection state of the target pixel is deleted from the memory 50.
[0083]
As a result of such processing, the outline connection information DC stored in the memory 50 is as shown in FIG. 18A, and the outline management information DM is as shown in FIG. 18B. That is, these pieces of information indicate a state in which the contour line E1 as shown in FIG. As a result of the processing as described above, the contour line E1 is updated to a contour line composed of 16 contour sides, and the contour lines E2 and E3 have been finished and disappeared.
[0084]
Next, a case where two or more contour sides of the four contour sides of the target pixel are included in the same contour line will be described. First, before performing the processing as described above, the contour line number to which the four contour sides of the target pixel belong is acquired, and the contours included in the same contour line among the four contour sides of the target pixel Get the edge number. Then, it is determined whether or not the connection states of the contour sides included in the same contour line among the contour sides of the target pixel are continuous. If the connection states of the contour sides included in the same contour line are continuous, the contour line is appropriately updated by performing the normal processing as described above. However, when the connection states of the contour sides included in the same contour line are not continuous, a hole is formed inside the contour line, and a new contour line is generated for the hole. .
[0085]
For example, when a pixel indicated by diagonal lines is extracted as a target pixel when a contour as shown in the left diagram of FIGS. 19A to 19D is formed, a contour as shown in the right diagram is generated. The In FIGS. 19A to 19D, circles indicate the start sides of the contour lines. As a result of performing the update processing of the contour line connection information DC as described above, when a hole-like contour line that newly forms a closed loop is generated inside the existing contour line, the start side with respect to the contour line Then, the start density value and the number of contour lines are obtained and registered in the contour management information DM. By performing such processing, it is possible to appropriately cope with the case where the contour line is separated and a new contour line is generated.
[0086]
Next, a case will be described in which there is a contour side set as the start side of the existing contour line among the four contour sides of the target pixel. First, when it is determined that there is a contour side set as the start side of the existing contour E1 among the four contour sides of the target pixel, an area for writing information of the new contour E2 in the contour management information DM is secured, The contents of the existing outline E1 are copied to the area. Then, a density value that is one higher than the density value of the pixel of interest with respect to the outline management information DM for the outline E2 is written to the end density value, and the number of outline sides is set to 0, thereby completing the end process for the outline E2. Apply. Then, the density value of the target pixel is overwritten in the column of the start density value of the outline management information DM for the existing contour E1, and the start side is extracted from the outline sides other than the four outline sides of the target pixel and overwritten. . By performing such processing, the contour line information can be satisfactorily updated even when the contour side set as the start side of the existing contour line is present among the four contour sides of the target pixel. .
[0087]
However, as shown in the left diagram of FIG. 20, when all of the four contour sides of the target pixel are included in the same pre-formed contour line, as the start side of the pre-made contour line among the four contour sides of the target pixel Even if there is a set contour side, it is not necessary to perform the processing as described above, and it is only necessary to perform the end processing for the existing contour line. Thereby, it updates to the appropriate outline as shown in the right figure of FIG.
[0088]
In the above description, the outline information update unit 40b conceptually shows the process of updating the outline connection information DC and the outline management information DM. Here, in order to make the above-described processing contents easier to understand, let us look at the processing process when the above processing is performed on the original image and the framed image shown in FIG. 21 to 30 are diagrams showing the contour management information DM and the contour connection information DC when the contour for each density value is extracted. In FIG. 21 to FIG. 30A, the number of each pixel indicates the density value for each pixel of the original image portion, and the density value is omitted for the density value 0 of the frame portion. In the following description, the contour side number shown in FIG. 7 is used to refer to the contour side of each pixel, and the coordinate value shown in FIG. 8 is used to refer to each pixel.
[0089]
First, the pixel-of-interest extraction unit 20 acquires the coordinate value 9 of the memory address 19 that is the pixel having the maximum density value from the buffer area sorted as shown in FIG. Referring to the coordinate values in FIG. 8, a pixel having a density value of 9 is extracted as a target pixel as shown in FIG. Since the four contour sides of the target pixel are not included in the existing contour lines as shown in FIG. 21A, a contour line composed of the four contour sides of the target pixel is generated, and the contour management information DM and the contour line are generated. The information is described in the connection information DC.
[0090]
In the contour management information DM, the contour line newly generated by the four contour sides of the pixel of interest is the contour line generated first, so the contour number is 1. Further, since the density value of the pixel having the coordinate value 2 (above the pixel of interest) among the adjacent pixels existing through the four contour sides of the pixel of interest is 0, the contour side above the pixel of interest is the start side. Since the contour side number of this contour side is 4, 4 is stored as the start side number. Further, since the density value of the target pixel at this time is 9, 9 is stored as the start density value, and 4 is stored as the number of contour sides.
[0091]
In the contour connection information DC, the connection state of the contour formed by the four contour sides of the target pixel is described, and 1 is stored in the associated contour number of each contour side.
[0092]
Next, the pixel-of-interest extraction unit 20 acquires the coordinate values 22 and 18 of the memory addresses 18 and 17 in the buffer area in FIG. 13B, sets these pixels as the pixel of interest, and forms an outline for the density value 8 As shown in FIG. As shown in FIG. 22A, since the contour sides of the two pixels having the density value 8 are not included in the contour line of the density value 9 that has already been generated, a new contour line is formed for each pixel. . The outline management information DM and the outline connection information DC are as shown in FIGS. 22B and 22C, respectively. Since the pixel having the coordinate value 22 is first processed as the target pixel, the contour line number of the contour line formed by the four contour sides of the pixel having the coordinate value 22 becomes 2, and the four pixels having the coordinate value 18 The outline number of the outline formed by the outline sides is 3.
[0093]
Next, the pixel-of-interest extraction unit 20 sequentially acquires the coordinate values stored in the memory addresses 16 to 13 in the buffer area in FIG. When the contour line is formed, it becomes as shown in FIG. As shown in FIG. 23A, the contour side above the pixel with the coordinate value 16 out of the four pixels with the density value 7 is included in the contour line (contour number 1) of the density value 9 already generated. Therefore, the outline connection information DC and the outline management information DM for the outline number 1 are updated. In addition, since each contour side for the other pixels is not included in the existing contour line, a new contour line is formed for each pixel. As a result, the contour management information DM and the contour connection information DC are as shown in FIGS. 23B and 23C, respectively.
[0094]
Next, the pixel-of-interest extraction unit 20 acquires the coordinate value 30 stored in the memory address 12 of the buffer area in FIG. 13B, makes this pixel the pixel of interest, and forms a contour line for the density value 6 When this is done, the result is as shown in FIG. As shown in FIG. 24 (a), the right contour side among the four contour sides of the pixel having the density value 6 is included in the contour line (contour number 5) of the density value 7 already generated. The outline connection information DC and the outline management information DM for the outline number 5 are updated. As a result, the contour management information DM and the contour connection information DC are as shown in FIGS. 24B and 24C, respectively.
[0095]
Next, the target pixel extraction unit 20 acquires the coordinate values 32 and 24 stored in the memory addresses 11 and 10 in the buffer area of FIG. When the contour line is formed, the result is as shown in FIG. As shown in FIG. 25A, the lower contour side of the pixel having the coordinate value 24 out of the two pixels having the density value 5 is included in the already generated contour line (contour line number 5). For the pixel having the coordinate value 32, the left contour side is included in the already generated contour (contour number 5), and the right contour side is already generated (contour number 4). ). Here, when the number of contour sides of contour numbers 4 and 5 is compared, contour number 4 is smaller, so that the contour line of contour number 4 is integrated with the contour line of contour number 5. As a result, the contour line management information DM for the contour line number 4 is subjected to end processing, the density value 6 is entered in the end density value column, and the number of contour sides is updated to zero. Further, the outline management information DM and the outline connection information DC for the outline No. 5 are updated. As a result, two pixels with density value 5 are included in the contour line of contour number 5, and contour management information DM and contour connection information DC are shown in FIGS. 25B and 25C, respectively. It becomes like this.
[0096]
Next, the pixel-of-interest extraction unit 20 acquires coordinate values 29, 17, and 11 stored in the memory addresses 9 to 7 of the buffer area in FIG. When the contour line is formed for the value 4, it is as shown in FIG. As shown in FIG. 26A, the right contour side of the pixel having the coordinate value 29 is included in the contour line of contour number 5, and the upper contour side is included in the contour line of contour number 2. Yes. Therefore, the contour line of contour number 2 is integrated with the contour line of contour number 5 and disappears. Further, the right contour side of the pixel having the coordinate value 17 is included in the contour line of contour number 3, the lower contour side is included in the contour line of contour number 5, and the left contour side is It is included in the contour line of contour number 1. Therefore, the contour lines of contour numbers 1 and 3 are integrated with the contour line of contour number 5 and disappear. Further, the right contour side of the pixel having the coordinate value 11 is included in the contour line of contour number 6, and the lower contour side is included in the contour line of contour number 5 generated by the previous integration. ing. Therefore, the contour line of contour number 6 is integrated with the contour line of contour number 5 and disappears. When three pixels having the density value 4 are processed as the target pixel in this way, the contour management information DM and the contour connection information DC are as shown in FIGS. 26B and 26C, respectively.
[0097]
Next, the target pixel extraction unit 20 acquires the coordinate values 25 and 15 stored in the memory addresses 6 and 5 of the buffer area in FIG. When the contour line is formed, the result is as shown in FIG. As shown in FIG. 27A, the upper, lower, and left contour sides of the pixel having the coordinate value 25 are included in the contour number 5. Accordingly, the contour line of contour number 5 is updated so that the pixel having the coordinate value 25 is included in the contour line of contour number 5. The right and lower contour sides of the pixel having the coordinate value 15 are included in the contour line of contour number 5, but the connection state is not continuous. For this reason, the process of updating the pixel having the coordinate value 15 to be included in the contour line of the contour line number 5 is a separation process, and a new contour line (contour line number 7) is placed inside the contour line of the contour line number 5. ) Is formed. When two pixels having the density value 3 are processed as the target pixel in this manner, the contour management information DM and the contour connection information DC are as shown in FIGS. 27B and 27C, respectively.
[0098]
Next, the target pixel extraction unit 20 acquires the coordinate values 23, 19, and 8 stored in the memory addresses 4 to 2 of the buffer area in FIG. When the contour line is formed for the value 2, it is as shown in FIG. As shown in FIG. 28A, all the contour sides of the pixel having the coordinate value 23 are included in the contour line of contour number 7 and the start side of the contour line is included. Therefore, an end process is performed on the contour line of contour number 7. In addition, since the upper and left contour sides of the pixel of the coordinate value 19 are included in the contour line of the contour line number 5, the contour line connection information DC and the contour line management information DM for the contour line number 5 are updated. The Further, since the right and lower contour sides of the pixel with the coordinate value 8 are included in the contour line of the contour number 5, the contour line connection information DC and the contour management information DM for the contour number 5 are updated. Is done. As a result, the contour management information DM and the contour connection information DC are as shown in FIGS. 28B and 28C, respectively.
[0099]
Next, the target pixel extraction unit 20 acquires the coordinate values 26 and 10 stored in the memory addresses 1 and 0 of the buffer area in FIG. When the contour line is formed, the result is as shown in FIG. As shown in FIG. 29A, since the contour side excluding the right side of the pixel having the coordinate value 26 is included in the contour line of contour number 5, the contour line connection information DC and contour line for contour number 5 The management information DM is updated. Further, since the contour side excluding the upper side of the pixel having the coordinate value 10 is included in the contour line of the contour number 5, the contour connection information DC and the contour management information DM for the contour number 5 are updated. . As a result, the outline management information DM and the outline connection information DC are as shown in FIGS. 29B and 29C, respectively.
[0100]
Finally, regarding the density value 0, when the density value 0 is used as a threshold value for contour extraction, the extracted contour line is the outer peripheral portion of the original image. Therefore, for the density value 0, it is only necessary to output a contour line connecting the outer peripheral portions of the original image without performing a process of extracting a pixel of interest and forming a contour line for each pixel. For the density value 0, end processing is performed on the contour management information DM for each contour line. The result of the termination process is shown in FIG.
[0101]
The process described above will be briefly described as follows. The target pixel is extracted pixel by pixel in descending order from the pixel indicating the maximum density value in the image. Then, when the four contour sides around the pixel of interest are not included in the existing contour line, the contour line including the four contour sides is set as a new contour line, and the contour indicating the connection state of the new contour line Generate line connection information. At this time, contour management information including the start side of the new contour line and the start density value having the density value of the target pixel as the start density of the effective density range of the new contour line is generated. On the other hand, when any of the four contour sides of the target pixel is included in the existing contour line, the contour line connection information and the contour line management information for the existing contour line are updated. Then, when at least one existing contour line that includes any contour side of the target pixel disappears due to the update, the density value of the target pixel with respect to the contour management information about the existing contour line that disappears Is stored as an end density value indicating the end density of the effective density range of the existing contour line.
[0102]
By performing such processing, when all pixels having the same density value are processed as the target pixel, the contour line of the density value is stored in the contour line connection information DC. Therefore, for example, when it is desired to output a contour line with respect to the density value 8, the desired density value 8 can be obtained by outputting the contour line connection information DC when all pixels indicating the density value 8 are processed as the target pixel. It is not necessary to process pixels having a density value of 7 or less. Further, when it is desired to output contour lines for all density values, if the contour line connection information DC is output every time processing of all pixels indicating the respective density values is performed, all the contours constituting the original image are output. The contour lines of all density values can be obtained by extracting and processing the pixels once.
[0103]
In this embodiment, when the contour line is formed for each density value, the contour line management information DM is generated / updated. Therefore, the processing up to the density value 1 is finally completed. In this case, even if the contour line connection information DC is deleted from the memory 50, if the contour line management information DM is stored, a contour line for an arbitrary density value can be extracted later.
[0104]
<5. Outline extraction>
Next, a process for extracting a contour line for each density value based on the contour management information DM after performing a process of forming a contour line while extracting the target pixel as described above one by one. explain. This process is performed in the contour extraction unit 60 of FIG.
[0105]
The contour extraction unit 60 refers to the contour line management information DM stored in the memory 50, finds the effective start side of the contour line at the density value to be extracted, and based on the predetermined rule (rule) from the start side. By tracing the contour, a contour line having a predetermined density value is extracted.
[0106]
Here, a rule for extracting a contour line will be described. FIG. 31 is a diagram illustrating a rule for specifying the traveling direction of the start side. The start side may be located along the main scanning direction X (ie, the horizontal direction) or may be located along the sub-scanning direction Y (ie, the vertical direction). When one start side is specified, the traveling direction of the start side is determined. For example, if the density values of two pixels existing across the start side are a and b, the start side is located in the vertical direction, and the density value a of the right pixel is greater than the density value b of the left pixel. If it is small, or if the start side is located in the horizontal direction and the density value a of the upper pixel is smaller than the density value b of the lower pixel, as shown in FIG. The traveling direction of the start side is set in the right direction. On the other hand, when the start side is located in the vertical direction and the density value a of the right pixel is larger than the density value b of the left pixel, or when the start side is located in the horizontal direction and the upper side When the density value a of the pixel is larger than the density value b of the lower pixel, as shown in FIG. 31B, the traveling direction of the start side is set downward or leftward.
[0107]
Next, FIG. 32 is a diagram showing a rule for specifying a traveling direction when tracing and forming a contour line. FIG. 32A shows an arrow whose traveling direction has already been determined. Here, if the density value to be extracted is a, the density value of the left pixel in front of the arrow is b, and the density value of the right pixel in front of the arrow is c, “a ≦ b and a ≦ c”. For example, if the path is in the left direction as shown in FIG. 32 (b) and “a> b and a ≦ c”, the path is in the straight direction as shown in FIG. 32 (c), and “a> c”. For example, as shown in FIG. When such a rule is set, a pixel larger than or equal to the density value to be extracted is always obtained on the right side with respect to the traveling direction at the time of contour extraction, and a pixel smaller than the density value to be extracted on the left side Is always obtained. Therefore, if the contour side is traced based on the above rule, a contour line having a desired density value can be extracted.
[0108]
An example in which a contour line having a density value of 3 is actually extracted based on the contour management information DM obtained for the original image in FIG. First, the effective density range for each contour line in the contour line management information DM of FIG. 30B obtained for the original image of FIG. 5 is as shown in FIG. In FIG. 33, contour numbers 5 and 7 include the density value 3 in the effective density range. Therefore, referring to the contour management information DM in FIG. 30B for the contour numbers 5 and 7, the start side numbers are 62 and 45, respectively. When the start side is specified from the contour side number assigned as shown in FIG. 7 and the contour side is traced from the start side based on the above rule, the result is as shown in FIG. FIG. 34A shows a contour line extracted from the start side of the contour side number 62, and FIG. 34B shows a contour line extracted from the start side of the contour side number 45. Then, by combining the two contour lines shown in FIGS. 34A and 34B, a contour line having a desired density value 3 can be obtained.
[0109]
In this way, the contour extraction unit 60 extracts the contour line from the start side and outputs the contour line. Therefore, when the contour extraction unit 60 outputs the contour line, it is not necessary to scan the image for each pixel, and the contour line can be output efficiently. That is, once the contour line management information DM is generated, by using it, the contour extraction process for an arbitrary density value can be performed efficiently, and the processing time can be shortened.
[0110]
<6. Processing sequence>
Next, a processing sequence in the case where the processing for generating / updating the above-described contour connection information DC and contour management information DM is performed by a computer or the like will be described. 35 to 38 are flowcharts showing a processing sequence for forming a contour line for each density value by a computer or the like.
[0111]
First, in step S10, preprocessing for the original image is performed. That is, in this pre-processing, the generation of the framed image as described above, the assignment of the contour side number, and the pixel sorting based on the density value are performed.
[0112]
Next, in step S11, the target pixel is extracted. The pixel of interest is extracted one pixel at a time in descending order of the density value from the pixel showing the maximum density value based on the sorting result in step S10.
[0113]
In step S12, it is determined whether or not the four contour sides of the target pixel extracted in step S11 are included in the existing contour line. This determination is performed by referring to the already generated outline connection information DC. If none of the four contour sides of the target pixel is included in the existing contour line, it is determined as “NO”, and the process proceeds to step S13. If it is included in the line, “YES” is determined, and the process proceeds to step S14.
[0114]
When the process proceeds to step S13, a new contour line composed of the four contour sides of the target pixel is generated, and contour connection information DC and contour management information DM are generated for the new contour line. And if the process of step S13 is performed, it will progress to step S41 mentioned later (connector A).
[0115]
When the process proceeds to step S14, the affiliated contour line number indicating the contour line including the contour side of the target pixel is acquired based on the contour line connection information DC. At this time, when two or more contour sides among the four contour sides of the pixel of interest are included in the existing contour line, the associated contour line numbers are acquired. And if the process of step S14 is performed, it will progress to step S15.
[0116]
In step S15, the belonging contour line number acquired in step S14 is verified, and it is determined whether or not there are contour sides included in the same contour line among the four contour sides of the target pixel. That is, when the belonging contour number is acquired for each of two or more contour sides included in the existing contour line among the four contour sides of the target pixel, there are contour sides indicating the same belonging contour number. In this case, “YES” is determined. In other cases, “NO” is determined. If "YES" is determined, the process proceeds to step S16, the connection state of the contour sides included in the existing contour line is stored in a memory or the like, and the process proceeds to step S17. If “NO” is determined, the process directly proceeds to step S17.
[0117]
In step S <b> 17, it is determined whether or not there is a contour side registered as the start side of the existing contour line among the four contour sides of the target pixel. This determination is performed by referring to the already generated contour management information DM and verifying whether the contour side numbers of the four contour sides of the target pixel are registered as the start side numbers of the existing contour lines. Is called. If there is a contour side registered as the start side of the existing contour line, “YES” is determined, and the process proceeds to step S18. If there is a contour side registered as the start side of the existing contour line, It is determined as “NO” and the process proceeds to step S21 (connector C).
[0118]
In step S18, it is determined whether or not the existing contour line including the contour side of the target pixel is composed of only the four contour sides of the target pixel. If "NO" is determined here, the process proceeds to step S19. If "YES" is determined, the process proceeds to step S20.
[0119]
When the start side is included in the contour side of the target pixel, it is necessary to update the start side of the contour line. This is because the start side included in the contour side of the target pixel becomes invalid by processing the target pixel. For this reason, when the start side is included in the contour side of the target pixel, a new contour line is generated, and the new contour line takes over the contour line connection information DC of the previous contour line. Since no start side is registered in the outline management information DM for the new outline, one outline side on the new outline (however, an outline side that is not in contact with the target pixel) is selected as the start side. Further, the start density value for the new contour line is set as the density value of the target pixel. Then, an end process is performed on the previous contour line. However, in practice, it is inefficient to change the information of the inherited new contour line. In this embodiment, the following processing is performed in step S19.
[0120]
An area for writing new outline information is secured in the outline management information DM, and the contents of the previous outline in which the invalid start side is registered in the area are copied (however, the outline numbers are different). . Then, with respect to the copied contour management information DM, a density value that is one higher than the density value of the target pixel is written in the end density value, and the number of contour sides is set to 0, whereby the end process is performed on the generated new contour line. Apply. On the other hand, the density value of the current target pixel is overwritten in the start density value field of the contour management information DM for the existing contour line in which the invalid start side is registered, and the four contours of the target pixel are used as the start side. Extract and overwrite from contour edges other than edges. By performing such a process, it is possible to set the newly valid starting edge by taking over the contents of the contour line in which the invalid starting edge is registered. As a result, the contour line information can be satisfactorily updated even when there is a contour side set as the start side of the existing contour line among the four contour sides of the target pixel. And if the process of step S19 is performed, it will progress to step S21 next (connector C).
[0121]
Further, when the start side is included in the contour side of the target pixel and the contour line is composed of only four contour sides of the target pixel, for example, as shown in FIG. is there. In this case, an end process may be performed on a contour line including only four contour sides of the target pixel. Accordingly, in step S20, an end process is performed on the contour line including the contour side of the target pixel. And if the process of step S20 is performed, it will progress to step S41 mentioned later (connector A).
[0122]
Next, in step S21, the contour management information DM is referred to, the contour having the largest number of contour sides among the contours including the contour side of the target pixel is obtained, and the contour number of the contour line is determined. get.
[0123]
In step S22, the affiliated outline number of the outline including the outline side of the target pixel in the outline connection information DC is rewritten to the outline number acquired in step S21. Next, in step S23, virtual connection states of the four contour sides of the target pixel are generated and held.
[0124]
In step S24, one of the four contour sides of the pixel of interest is included in the existing contour line, and in step S25, the contour side selected with reference to the contour connection information DC is selected as the next contour. The contour edge registered in the edge number is detected. In step S26, the next contour side which is the connection destination of the contour side selected in step S24 from the virtual connection state is detected. In step S27, it is determined whether or not the contour edge detected in step S26 is included in the existing contour line. If not included, the determination is “NO” and the process proceeds to step S28. In this case, “YES” is determined, and the process proceeds to step S29.
[0125]
In step S28, the contour side number detected in step S26 is stored in the contour side number next to the contour side detected in step S25. On the other hand, in step S29, the next contour side that is the connection destination of the contour side detected in step S26 is detected with reference to the contour line connection information DC, and this contour side is next to the contour side detected in step S25. The contour side of.
[0126]
In step S30, the contour connection information DC is referred to, and the contour side that is the connection destination of the contour side selected in step S24 is detected. In step S31, the virtual connection state is referred to, and the contour side registered as the next contour side is detected as the contour side selected in step S24.
[0127]
Then, in step S32, it is determined whether or not the contour side detected in step S31 is included in the existing contour side. If it is not included, “NO” is determined, and the process proceeds to step S33. In this case, “YES” is determined, and the process proceeds to step S34.
[0128]
In step S33, the contour side number detected in step S30 is stored in the contour side number next to the contour side detected in step S31. On the other hand, in step S34, the contour connection information DC is referred to, a contour side having the contour side detected in step S31 as the next contour side is detected, and the contour registered as the next contour side of the contour side is detected. Let the side be the contour side detected in step S30.
[0129]
The processing for updating the connection state of the contour sides for one contour side of the target pixel included in the existing contour line is completed in the processes of steps S24 to S34 described above. In step S35, it is determined whether or not there are other contour sides included in the existing contour line among the four contour sides of the target pixel. If “YES”, the same processing is again performed on the contour side. Return to step S24 to perform (connector E), and if “NO”, proceed to step S36 (connector F).
[0130]
In step S36, it is determined whether or not there is a connection state of the contour side stored in step S16. If there is a stored connection state, “YES” is determined and the process proceeds to step S37, and if there is no stored connection state, “NO” is determined and the process proceeds to step S41.
[0131]
In step S37, the stored connection state is read, and two contour sides included in the same contour line are extracted. In step S38, it is determined whether or not the connection state of these two contour sides is continuous. If not continuous, for example, as shown in FIG. 19, a hole-shaped contour line is formed inside the existing contour line, and the process proceeds to step S39. On the other hand, if it is continuous, a hole-shaped outline is not formed, and the process proceeds to step S40.
[0132]
In step S39, a start side is registered for a hole-shaped contour line formed inside the existing contour line, and set as a new contour line. Then, the process proceeds to step S40.
[0133]
In step S40, it is determined whether or not there are other combinations when extracting two contour sides included in the same contour line. If there are other combinations, a hole-shaped contour line is formed for those contour sides. In order to check whether or not it is formed, the process returns to step S37 again. If there is no other combination, “NO” is determined, and the process proceeds to step S41.
[0134]
The processing for the target pixel extracted by the processing in steps S11 to S40 is completed. In step S41, whether there is a pixel to be processed next as the target pixel is determined based on the memory address of the sorting result. If there is a next pixel, “YES” is returned to Step S11 (connector G). Further, when the processing for all the pixels is completed, “NO” is determined, and the process proceeds to step S42.
[0135]
In step S42, since there are no pixels of interest to be extracted, the end density value “0” is stored for all contour lines for which no end density value is stored in the contour management information DM at this time. That is, end processing is performed on all contour lines that have not been subjected to end processing. When this termination process is performed, the process proceeds to step S43.
[0136]
In step S43, the contour management information DM generated / updated by the above processing is saved, and the processing sequence ends.
[0137]
By performing the processing as described above, contour management information DM that can extract a contour for each density value is obtained. Further, when outputting a contour line for each density value in the process as described above, when the target pixel is extracted in step S11, the density value of the target pixel is examined to be different from the previous density value. For example, it may be configured to output the outline connection information DC at that time.
[0138]
As described above, if the contour extraction of an image is performed in the processing mode as described in this embodiment, the contour extraction processing for an arbitrary density value can be performed efficiently, and the processing time can be shortened. It is no longer obvious.
[0139]
<7. Modification>
In the above processing, the description has been given mainly on the processing for the 10-gradation image having the density value of 0 to 9, but the present invention is not limited to this, and the present invention can be applied to an image having an arbitrary gradation number Needless to say, it is applicable.
[0140]
Next, in the above description, in order to detect that a hole-like contour line is newly formed inside the existing contour line, it is detected whether or not the connection state of the contour sides continues. However, in addition to this, it is also possible to detect whether or not a hole-like contour line is newly formed by simply detecting an image pattern.
[0141]
Next, a general computer including a display unit, a keyboard, a CPU, a memory, etc., executes a predetermined program for each processing unit constituting the image contour extraction apparatus 100 in FIG. 2 described in the above embodiment. It may be realized by. In this case, the original image is stored in a magnetic disk or the like, and the contour line for each density value is executed by the CPU in the computer executing the image contour extraction program for performing each procedure shown in FIGS. Are sequentially formed, and the contour connection information DC and the contour management information DM are sequentially generated / updated in the memory. Then, when the computer performs the processing as described above, the time for the contour extraction processing by the computer is shortened. Note that the contour extraction program executed by the computer is recorded and stored in a portable recording medium such as a CD-ROM or a flexible disk, or a fixed recording medium such as a magnetic disk installed in the computer. The contour extraction program may be read from the recording medium and executed.
[0142]
【The invention's effect】
As described above, according to the first aspect of the present invention, the pixel of interest is extracted one by one in descending order from the pixel indicating the maximum density value in the image, and the contour line connection information, the contour line management information, In the process of updating, the contour line for each density value is formed. For this reason, when several contour lines for different density values are extracted, it is only necessary to perform the process of extracting all the pixels constituting the image as the target pixel and performing the process once. Therefore, the contour extraction process for an arbitrary density value can be performed efficiently, and the processing time can be shortened. Further, since the start side is included in the contour management information, the contour management information can be used when contour extraction of an arbitrary density value is performed later.
[0143]
According to the second aspect of the present invention, if pixels having the same density value in the image are processed as the target pixel, a contour line of the density value is obtained, and therefore the contour extraction process is efficiently performed. And the processing time can be shortened.
[0144]
According to the third aspect of the present invention, since a contour line having a predetermined density value can be extracted based on the stored contour line management information, contour line connection information is generated while extracting a target pixel again. There is no need. Accordingly, the contour extraction process can be performed efficiently, and the processing time can be shortened.
[0145]
According to the fourth aspect of the present invention, the pixels constituting the image can be efficiently rearranged in descending order or descending order of the density value. As a result, contour extraction processing can be performed efficiently, and processing time can be shortened.
[0146]
According to the fifth aspect of the present invention, the process of extracting the target pixel one pixel at a time in descending order from the pixel indicating the maximum density value in the image and updating the contour line connection information and the contour line management information. In FIG. 5, a contour line for each density value is formed. For this reason, when several contour lines for different density values are extracted, it is only necessary to perform the process of extracting all the pixels constituting the image as the target pixel and performing the process once. Therefore, the contour extraction process for an arbitrary density value can be performed efficiently, and the processing time can be shortened.
[0147]
According to the sixth aspect of the present invention, when the computer executes a predetermined image contour extraction program, the computer can efficiently extract the contour of the image, and the processing time can be shortened. .
[Brief description of the drawings]
FIG. 1 is a diagram showing the concept of outline generation / update in the present invention.
FIG. 2 is a block diagram showing a configuration of an image contour extracting apparatus as an embodiment of the present invention.
FIG. 3 is a diagram for explaining contour line connection information;
FIG. 4 is a diagram illustrating contour management information.
FIG. 5 is a diagram illustrating generation of a framed image.
FIG. 6 is a diagram illustrating assignment of contour side numbers.
FIG. 7 is a diagram showing outline side numbers for a 7 × 6 framed image.
FIG. 8 is a diagram illustrating coordinate values of each pixel in a 7 × 6 framed image.
FIG. 9 is a diagram illustrating a result of counting the number of pixels for each density value for an original image.
FIG. 10 is a diagram illustrating the cumulative number of pixels for each density value.
FIG. 11 is a diagram illustrating a sorting process based on density values.
FIG. 12 is a diagram illustrating a sorting process based on density values.
FIG. 13 is a diagram illustrating a cumulative pixel number and a buffer area for each density value subjected to sorting processing.
FIG. 14 is a diagram illustrating a case where four contour sides of a target pixel are included in one existing contour line.
FIG. 15 is a diagram showing a process of updating the contour line E1 in FIG. 14A to the contour line E1 in FIG. 14B;
FIG. 16 is a diagram illustrating a case where four contour sides of a target pixel are included in three existing contour lines;
FIG. 17 is a diagram showing contour line connection information and the like in the state of FIG.
FIG. 18 is a diagram illustrating an example of contour line connection information.
FIG. 19 is a diagram illustrating an example where a hole-shaped contour line is formed.
FIG. 20 is a diagram illustrating an example when a contour line disappears;
FIG. 21 is a diagram showing contour management information and contour connection information when contours for each density value are extracted.
FIG. 22 is a diagram showing contour management information and contour connection information when a contour is extracted for each density value.
FIG. 23 is a diagram showing contour management information and contour connection information when contours for each density value are extracted.
FIG. 24 is a diagram showing contour management information and contour connection information when contours for each density value are extracted.
FIG. 25 is a diagram showing contour management information and contour connection information when a contour is extracted for each density value.
FIG. 26 is a diagram showing contour management information and contour connection information when contours for each density value are extracted.
FIG. 27 is a diagram showing contour management information and contour connection information when contours are extracted for each density value.
FIG. 28 is a diagram showing contour management information and contour connection information when contours for each density value are extracted.
FIG. 29 is a diagram showing contour management information and contour connection information when contours for each density value are extracted.
FIG. 30 is a diagram showing contour management information and contour connection information when contours for each density value are extracted.
FIG. 31 is a diagram illustrating a rule for specifying a traveling direction of a start side.
FIG. 32 is a diagram illustrating a rule for specifying a traveling direction when tracing and forming an outline.
FIG. 33 is a diagram showing an effective density range for each contour line in the contour management information.
FIG. 34 is a diagram illustrating a process of tracing a contour side based on a rule from a start side.
FIG. 35 is a flowchart showing a processing sequence for forming a contour line for each density value by a computer or the like.
FIG. 36 is a flowchart showing a processing sequence for forming a contour line for each density value by a computer or the like.
FIG. 37 is a flowchart showing a processing sequence for forming a contour line for each density value by a computer or the like.
FIG. 38 is a flowchart showing a processing sequence for forming a contour line for each density value by a computer or the like.
[Explanation of symbols]
10 Preprocessing section
20 attention pixel extraction part
30 Contour edge determination unit
40 Contour line forming part
40a Outline information generation unit
40b Outline information update unit
50 memory
60 Contour extraction unit
70 storage unit
DM Outline management information
DC contour connection information

Claims (6)

画像の輪郭を抽出する方法であって、
(a) 前記画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出する工程と、
(b) 前記注目画素の周囲の複数の輪郭辺が既成輪郭線に包含されていない場合には、前記複数の輪郭辺からなる輪郭線を新規輪郭線として設定し、当該新規輪郭線の接続状態を示す輪郭線接続情報を生成するとともに、前記注目画素の前記複数の輪郭辺のうちのいずれか1つを選択した当該新規輪郭線の開始辺と、前記注目画素の濃度値を当該新規輪郭線の有効濃度範囲の開始濃度とした開始濃度値とを含む輪郭線管理情報を生成する工程と、
(c) 前記注目画素の前記複数の輪郭辺のうちのいずれかが既成輪郭線に包含されている場合には、当該既成輪郭線についての前記輪郭線接続情報を更新する工程と、
(d) 前記更新によって前記注目画素のいずれかの前記輪郭辺が包含されていた少なくとも1つの既成輪郭線が消滅する場合、又は抽出すべき注目画素が無くなった場合には、前記既成輪郭線についての前記輪郭線管理情報に対して前記注目画素の濃度値を前記既成輪郭線の有効濃度範囲の終了濃度を示す終了濃度値として追加する工程と、
を有することを特徴とする画像の輪郭抽出方法。
A method for extracting the contour of an image,
(a) extracting a pixel of interest one pixel at a time in descending order from the pixel indicating the maximum density value in the image;
(b) When a plurality of contour sides around the pixel of interest are not included in the existing contour line, a contour line composed of the plurality of contour sides is set as a new contour line, and the connection state of the new contour line Is generated, and the start side of the new contour line selected from any one of the plurality of contour sides of the pixel of interest and the density value of the pixel of interest are used as the new contour line. Generating contour management information including a starting density value as a starting density of the effective density range of
(c) when any of the plurality of contour sides of the pixel of interest is included in a pre-formed contour, the step of updating the contour connection information about the pre-formed contour;
(d) When at least one pre-formed contour that includes any of the contour sides of the target pixel disappears due to the update, or when there is no target pixel to be extracted, Adding a density value of the target pixel to the contour management information as an end density value indicating an end density of an effective density range of the existing contour line;
A method for extracting an outline of an image, comprising:
請求項1に記載の画像の輪郭抽出方法において、
前記画像における同一の濃度値を示す画素を前記注目画素として、前記(a)ないし(d)工程を繰り返し行うことによって生成/更新された前記輪郭線接続情報を出力することを特徴とする画像の輪郭抽出方法。
The image contour extracting method according to claim 1,
The contour line connection information generated / updated by repeatedly performing the steps (a) to (d), with the pixel having the same density value in the image as the target pixel, is output. Outline extraction method.
請求項1に記載の画像の輪郭抽出方法において、
(e) 前記(a)ないし(d)工程を繰り返し行うことによって生成された前記輪郭線管理情報を記憶する工程と、
所定の濃度値の輪郭線を抽出する際に、
(f) 前記輪郭線管理情報に含まれる前記開始濃度値と前記終了濃度値とによって示される前記有効濃度範囲に基づいて前記所定の濃度値の輪郭線を特定し、当該輪郭線についての前記輪郭線管理情報から前記開始辺を取得する工程と、
(g) 前記開始辺から所定の規則に従って輪郭辺を順次抽出していく工程と、
を有することを特徴とする画像の輪郭抽出方法。
The image contour extracting method according to claim 1,
(e) storing the outline management information generated by repeatedly performing the steps (a) to (d);
When extracting the contour line of the predetermined density value,
(f) identifying a contour line of the predetermined density value based on the effective density range indicated by the start density value and the end density value included in the contour line management information, and the contour for the contour line Obtaining the start side from line management information;
(g) sequentially extracting contour edges according to a predetermined rule from the start edge;
A method for extracting an outline of an image, comprising:
請求項1ないし請求項3のいずれかに記載の画像の輪郭抽出方法において、
前記(a)ないし(d)工程に先立って行う工程として、
(h) 前記画像を構成する全ての画素についての画素情報を記録する記録領域を確保する工程と、
(i) 前記画像を構成する全ての画素を検索し、濃度値ごとの画素数をカウントする工程と、
(j) 前記カウントの結果に基づいて、各濃度値ごとに当該濃度値未満の累積画素数を求める工程と、
(k) 前記画像を構成する画素を1画素ずつ抽出する工程と、
(l) 前記(k)工程において抽出された画素の濃度値を検出し、当該濃度値に対応する前記累積画素数を取得し、当該累積画素数の値に対応する前記記録領域の位置に前記抽出された画素を特定する前記画素情報を記録するとともに、当該累積画素数の値を更新する工程と、
を有し、
前記(k)から(l)工程を前記画像を構成する全ての画素について行うまで繰り返し行うことを特徴とする画像の輪郭抽出方法。
The image contour extraction method according to any one of claims 1 to 3,
As a step performed prior to the steps (a) to (d),
(h) securing a recording area for recording pixel information for all the pixels constituting the image;
(i) searching for all the pixels constituting the image and counting the number of pixels for each density value;
(j) obtaining a cumulative number of pixels less than the density value for each density value based on the result of the counting;
(k) extracting pixels constituting the image one pixel at a time;
(l) Detecting the density value of the pixel extracted in the step (k), obtaining the cumulative pixel number corresponding to the density value, and at the position of the recording area corresponding to the cumulative pixel number value Recording the pixel information identifying the extracted pixels and updating the value of the cumulative pixel number;
Have
An image contour extracting method, wherein the steps (k) to (l) are repeatedly performed until all the pixels constituting the image are performed.
画像の輪郭を抽出する装置であって、
(a) 前記画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出する注目画素抽出手段と、
(b) 前記注目画素の周囲の複数の輪郭辺が既成輪郭線に包含されていない場合には、前記複数の輪郭辺からなる輪郭線を新規輪郭線とし、当該新規輪郭線の接続状態を示す輪郭線接続情報を生成するとともに、前記注目画素の前記複数の輪郭辺のうちのいずれか1つを選択した当該新規輪郭線の開始辺と、前記注目画素の濃度値を当該新規輪郭線の有効濃度範囲の開始濃度とした開始濃度値とを含む輪郭線管理情報を生成する輪郭線情報生成手段と、
(c) 前記輪郭線接続情報と前記輪郭線管理情報とを記憶する記憶手段と、
(d) 前記注目画素の前記複数の輪郭辺のうちのいずれかが既成輪郭線に包含されている場合には、当該既成輪郭線について前記記憶手段に記憶されている前記輪郭線接続情報を更新するとともに、当該更新によって前記注目画素のいずれかの前記輪郭辺が包含されていた少なくとも1つの既成輪郭線が消滅する場合、又は抽出すべき注目画素が無くなった場合には、前記既成輪郭線についての前記記憶手段に記憶されている前記輪郭線管理情報に対して前記注目画素の濃度値を前記既成輪郭線の有効濃度範囲の終了濃度を示す終了濃度値として追加更新する更新手段と、
を備えることを特徴とする画像の輪郭抽出装置。
An apparatus for extracting the contour of an image,
(a) pixel-of-interest extracting means for extracting a pixel of interest one pixel at a time in descending order from the pixel indicating the maximum density value in the image;
(b) When a plurality of contour sides around the target pixel are not included in the existing contour line, the contour line composed of the plurality of contour sides is set as a new contour line, and the connection state of the new contour line is indicated. The contour connection information is generated, and the start side of the new contour line selected from any one of the plurality of contour sides of the pixel of interest and the density value of the pixel of interest are used to determine whether the new contour line is valid. Contour information generating means for generating contour management information including a starting density value as a starting density of a density range;
(c) storage means for storing the contour line connection information and the contour line management information;
(d) When any one of the plurality of contour sides of the target pixel is included in the existing contour line, the contour line connection information stored in the storage unit is updated for the existing contour line In addition, when at least one existing contour line that includes any of the contour sides of the target pixel disappears due to the update, or when there is no target pixel to be extracted, Updating means for additionally updating the density value of the target pixel as an end density value indicating an end density of the effective density range of the existing contour line with respect to the outline management information stored in the storage means;
An image contour extraction apparatus comprising:
コンピュータによって画像の輪郭を抽出するためのプログラムを記録した記録媒体であって、
コンピュータに、
(a) 前記画像において濃度値の最大値を示す画素から降順に1画素ずつ注目画素を抽出する手順、
(b) 前記注目画素の周囲の複数の輪郭辺が既成輪郭線に包含されていない場合には、前記複数の輪郭辺からなる輪郭線を新規輪郭線として設定し、当該新規輪郭線の接続状態を示す輪郭線接続情報を生成するとともに、前記注目画素の前記複数の輪郭辺のうちのいずれか1つを選択した当該新規輪郭線の開始辺と、前記注目画素の濃度値を当該新規輪郭線の有効濃度範囲の開始濃度とした開始濃度値とを含む輪郭線管理情報を生成する手順、
(c) 前記注目画素の前記複数の輪郭辺のうちのいずれかが既成輪郭線に包含されている場合には、当該既成輪郭線についての前記輪郭線接続情報を更新する手順、
(d) 前記更新によって前記注目画素のいずれかの前記輪郭辺が包含されていた少なくとも1つの既成輪郭線が消滅する場合、又は抽出すべき注目画素が無くなった場合には、前記既成輪郭線についての前記輪郭線管理情報に対して前記注目画素の濃度値を前記既成輪郭線の有効濃度範囲の終了濃度を示す終了濃度値として追加する手順、
を実行させるための画像の輪郭抽出プログラムを記録したコンピュータ読み取り可能な記録媒体。
A recording medium on which a program for extracting the contour of an image is recorded by a computer,
On the computer,
(a) a procedure for extracting a pixel of interest one pixel at a time in descending order from a pixel indicating the maximum density value in the image;
(b) When a plurality of contour sides around the pixel of interest are not included in the existing contour line, a contour line composed of the plurality of contour sides is set as a new contour line, and the connection state of the new contour line Is generated, and the start side of the new contour line selected from any one of the plurality of contour sides of the pixel of interest and the density value of the pixel of interest are used as the new contour line. A procedure for generating contour management information including a start density value as a start density of the effective density range of
(c) if any of the plurality of contour sides of the pixel of interest is included in a pre-formed contour, a procedure for updating the contour connection information for the pre-formed contour;
(d) When at least one pre-formed contour that includes any of the contour sides of the target pixel disappears due to the update, or when there is no target pixel to be extracted, A step of adding a density value of the target pixel to the contour management information as an end density value indicating an end density of an effective density range of the existing contour line;
The computer-readable recording medium which recorded the outline extraction program of the image for performing this.
JP24975698A 1998-09-03 1998-09-03 Image contour extraction method, apparatus, and recording medium Expired - Fee Related JP3679619B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP24975698A JP3679619B2 (en) 1998-09-03 1998-09-03 Image contour extraction method, apparatus, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP24975698A JP3679619B2 (en) 1998-09-03 1998-09-03 Image contour extraction method, apparatus, and recording medium

Publications (2)

Publication Number Publication Date
JP2000076468A JP2000076468A (en) 2000-03-14
JP3679619B2 true JP3679619B2 (en) 2005-08-03

Family

ID=17197769

Family Applications (1)

Application Number Title Priority Date Filing Date
JP24975698A Expired - Fee Related JP3679619B2 (en) 1998-09-03 1998-09-03 Image contour extraction method, apparatus, and recording medium

Country Status (1)

Country Link
JP (1) JP3679619B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6015267B2 (en) 2012-09-13 2016-10-26 オムロン株式会社 Image processing apparatus, image processing program, computer-readable recording medium recording the same, and image processing method

Also Published As

Publication number Publication date
JP2000076468A (en) 2000-03-14

Similar Documents

Publication Publication Date Title
JP5854802B2 (en) Image processing apparatus, image processing method, and computer program
JP3748164B2 (en) Pattern extraction device
JP4803493B2 (en) Label image generation method and image processing system
JP2918383B2 (en) Image contour extraction method and apparatus
EP1569170A1 (en) Characteristic region extraction device, characteristic region extraction method, and characteristic region extraction program
JP2001109895A (en) Processing method for digital images
JP2001101426A (en) Digital image processing method
JPH07184040A (en) Detection device of region encircled by marker by means of singe optical path scanning for photograph copying machine and its method
JP4398533B2 (en) Image tracking device and recording medium
JP2904671B2 (en) Multi-tone image correction device
JP3796478B2 (en) Path processing method and apparatus
JP3679619B2 (en) Image contour extraction method, apparatus, and recording medium
JP2000331156A (en) Method for automatically deciding tracker set along outline and storage medium storing program for execution of the method
Yang et al. A novel line scan clustering algorithm for identifying connected components in digital images
CN108876701B (en) Run-length-based single-scanning connected domain marking method and hardware structure thereof
JP4756436B2 (en) Pattern recognition apparatus, pattern recognition method, and pattern recognition program
JP2625612B2 (en) Image processing method and image processing apparatus
JP6786973B2 (en) Image analyzer
CN114550062A (en) Method and device for determining moving object in image, electronic equipment and storage medium
JPH0364909B2 (en)
JPH0927028A (en) Correcting device for multiple-gradation image
JP2773127B2 (en) Image editing method
Marchand-Maillet et al. A minimum spanning tree approach to line image analysis
JP4351620B2 (en) Image search system
JP2838556B2 (en) Image processing device

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050502

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050513

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20090520

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees