JP3826412B2 - Edge detection method and edge detection apparatus - Google Patents

Edge detection method and edge detection apparatus Download PDF

Info

Publication number
JP3826412B2
JP3826412B2 JP13441895A JP13441895A JP3826412B2 JP 3826412 B2 JP3826412 B2 JP 3826412B2 JP 13441895 A JP13441895 A JP 13441895A JP 13441895 A JP13441895 A JP 13441895A JP 3826412 B2 JP3826412 B2 JP 3826412B2
Authority
JP
Japan
Prior art keywords
edge
gradient
edge detection
estimated
strength
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
JP13441895A
Other languages
Japanese (ja)
Other versions
JPH08329252A (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.)
Sony Corp
Original Assignee
Sony Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sony Corp filed Critical Sony Corp
Priority to JP13441895A priority Critical patent/JP3826412B2/en
Publication of JPH08329252A publication Critical patent/JPH08329252A/en
Application granted granted Critical
Publication of JP3826412B2 publication Critical patent/JP3826412B2/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】
【産業上の利用分野】
本発明は、画像処理において基本的な役割を果たすエッジ検出方法及びエッジ検出装置に関するものであり、テレビジョンや映画等の映像制作における特殊効果処理、FA(Factory Automation)におけるカメラ画像からの部品認識等に適用して好適なエッジ検出方法及びエッジ検出装置に関するものである。
【0002】
【従来の技術】
画像から任意の部分画像を切り出す作業は、映像の編集合成やコンピュータグラフィックス等におけるテクスチャ及び構造データの生成の基本操作である。この切り出しという操作では、エッジ検出、領域抽出、及び既知物体との対応付け等の処理を必要とする。特に、画像中の背景や対象物体が複雑になると、対象物体の輪郭を構成するエッジを正確に求め、追跡することが必要となる。
【0003】
ここで、エッジ検出とは、濃淡画像内で画素値が急峻に変化している部分を見いだす処理である。通常、急峻な変化は、対象物体の輪郭で起きるため、エッジ検出の結果を基にして、対象物体の輪郭を画像から抽出することができる。したがって、エッジ検出は、画像からその中に存在する対象物体に関する情報を得るための最も基本的な処理として多方面で使用されている。特に、対象物体の輪郭の抽出は、例えば、画像に存在する対象物体の構成や位置等を計算機等によって判断する上での最も基本的な処理であり、エッジ検出の最も重要な用途である。
【0004】
上述のようなエッジ検出の方法は、公知の多くの方法があるが、何れの方法も局所的な画素の値の変化を調べ、その変化が大きい部分をエッジとして検出するものである。代表的なエッジ検出方法として、空間フィルタとして微分フィルタを使用するものがある。この微分フィルタを用いるエッジ検出方法は、画素の値の変化が大きい部分では、微係数も大きな値になるという原理に基いてエッジを検出する方法である。例えば、図10に示すような横(X)方向のソーベル(Sobel)フィルタは、横(X)方向の1次微分に相当する演算を行うものであり、このソーベルフィルタを用いた場合、縦(Y)方向のエッジが存在するところでは、ソーベルフィルタの出力が正又は負の大きな値となるため、縦(Y)方向のエッジを検出することができる。
【0005】
上述のようなソーベルフィルタの他にも、1次又は2次の微分に相当する演算を行う多種の空間フィルタがエッジ検出用に用いられている。これらのエッジ検出方法については、例えば、代表的な教科書であるジェイン(Jain)著「ファンダメンタルズ オブ デジタル イメージ プロセッシング(Fundamentals of Digital Image Processing)」、及びプラット(Pratt)著「デジタル イメージ プロセッシング(DigitalImage Processing)」に詳しく紹介されている。
【0006】
また、上述のようなエッジ検出方法を用いて対象物体の輪郭を検出する方法もいろいろ試みられている。例えば、エッジ検出の結果から画素値の変化の度合い、すなわちエッジ強度が大きい部分を「1」、それ以外の部分を「0」とする2値画像を生成し、その2値画像を細線化することにより対象物体の輪郭を得る領域抽出方法が「特願平5−233810号」に開示されている。ここで、細線化とは、生成した2値画像から値「1」のピクセルを順に取り除いていき、通常は1ピクセル幅になるまで値「1」のピクセルを順に取り除いて1ピクセル幅の中心線を抽出するという公知の手順である。
【0007】
一方、空間フィルタを用いずに統計的な方法でエッジを検出する方法もある。例えば、注目している画素の近傍での画素値の分散、すなわち色相の分散を算出し、その値が大きいところを領域の境界として検出するエッジ検出方法及び装置が「特願平5−181969号」に開示されている。
【0008】
また、文献「カラーエッジ ディテクション ユージング ベクトル オーダスタティスティックス(Trahanias,P.E.et.al.”Color edge detection using vector orderstatistics”,IEEE Transactions on image processing,Vo1.2,No.2,pp.259−264,1993)」では、画素値が各々他の画素値とどれだけ離れているかを表す尺度を基にエッジを検出する方法が述べられている。
【0009】
【発明が解決しようとする課題】
しかし、上述したような従来のエッジ検出方法では、画素値の急峻な変化がある部分を全て検出してしまうという問題があった。例えば、図11(a)に示すように、画像100の対象物体110において、対象物体110の内部に色の違いや背景と対象物体110の交差がある場合、従来のエッジ検出方法では、同図(b)に示すように、物体内部の境界112をも検出されてしまい、同図(c)に示すような本来求めたいエッジ111のみを得ることができなかった。
【0010】
通常、物体内部では、上記図11(a)に示したような色の違い、模様、影等様々な理由による画素値の急峻な変化が不可避である。また、通常は、背景にも様々な模様や色が存在する。これに対して従来のエッジ検出方法では、画素値の急峻な変化を一様に検出していたため、上述したような物体内部の境界や背景の模様等も誤ってエッジとして検出されてしまう可能性があった。
【0011】
そこで、上述のような問題を解決するために、画像の色情報、すなわち明度、彩度、及び色相に基いて明度に対して重み付け補正処理を施した後、重み付け補正処理が施された明度に基いてエッジを検出する自動切抜きシステムが「特願平1−173177号」に開示されている。この自動切抜きシステムは、輪郭付近の画素値の変化、例えば、明度の変化を強調するための重み付け補正処理により輪郭をより際だたせることにより、前景の物体や背景内の模様や色変化の誤った検出を減らしてエッジ検出を行うものである。
【0012】
しかし、上記自動切抜きシステムでは、輪郭上の個々の部分各々について最適な重み付け補正処理を行うことは考慮されていない。また、物体の輪郭に沿って模様や色等が一様であることは、むしろ希である。このため、上記自動切抜きシステムによっても、本来求めたいエッジ以外のエッジの混入を防ぐことができなかった。
【0013】
また、画像のヒストグラムを用いて前景と背景の境界におけるコントラストが上がるように画素値の変換を行うことにより、境界付近のエッジを際だたせてエッジを検出するエッジ抽出装置が「特願平1−76170号」に開示されている。しかし、上記エッジ抽出装置によっても、敏感なエッジの検出には有効であるが、本来求めたいエッジ以外のエッジの混入を防ぐことができなかった。
【0014】
一方、エッジ検出を行う場所を画像上で限定することにより、不必要な場所でのエッジ検出を省き、輪郭以外の場所におけるエッジの混入を最小限にとどめる領域抽出装置が「特願平3−176780号」に開示されている。この領域抽出装置では、人手により対象物体の輪郭の概略を入力し、その輪郭概略内部でのみエッジ検出を行うことにより、余分なエッジの発生を防いでエッジ検出を行うものである。また、人手により対象物体の輪郭の概略を入力し、その輪郭概略の情報に基いてエッジ検出を境界付近でのみ行う構成としたソフトキー生成装置が「特願平5−236347号」に開示されている。
【0015】
しかし、上記領域抽出装置及び上記ソフトキー生成装置では、単に誤ったエッジの検出が発生する領域を狭めるのみであり、輪郭以外のエッジの混入を防ぐことができなかった。
例えば、図12(a)に示すように、画像200において、オペレータが入力した対象物体210の輪郭の概略220を用いてエッジ検出を行った場合、エッジ検出を行う範囲を制限してもその制限には限界があり、上記図12(b)に示すように、不要なエッジ221a,221b,221cが誤って検出されてしまっていた。
【0016】
ここで、輪郭の概略220の精度を上げることにより、不要なエッジ221a,221b,221cの数や長さを次第に減少させることはできるが、このためには、輪郭の概略220を人手で高精度に与える必要があり、これは大変困難な作業である。この問題を解決するために、オペレータがタブレットやマウス等の入力手段をゆっくり動かしている場合には、輪郭の概略の太さが細くなるように制御し、速く動かしている場合には、輪郭の概略の太さが太くなるように制御することにより、エッジ検出を行う範囲を制限してエッジを検出する画像編集装置が「特願平1−180674号」に開示されているが、これにおいても、不要なエッジの混入を防ぐことはできなかった。
【0017】
上述のような問題を解決するために、例えば、エッジ方向を人手で入力した概略の輪郭から推定し、推定したエッジ方向と合致するエッジのみを選択的に検出することにより、上述したような不要なエッジを大幅に除去してエッジの検出を行うエッジ検出方法がある。
【0018】
上記エッジ検出方法では、図13の(a)〜(d)に示すようなロビンソン(Robinson)の3レベル(3−level)と呼ばれるフィルタ群を用いることにより、特定の方向のエッジのみを検出する。
上記図13の(a)〜(d)に示したフィルタ群は、上記図10に示したソーベルフィルタを拡張したものであり、水平及び垂直以外の方向のエッジを検出するものである。例えば、上記図13の(a)に示したフィルタは、画像右側の画素値が大きく、画像左側の画素値が小さい場合に大きな値を出力するものである。すなわち、上記図13の(a)に示したフィルタは、+0°方向のエッジを検出するものである。また、上記図13の(b),(c),(d)に示した各フィルタは、各々、45°、90°、135°方向のエッジを検出するものである。
【0019】
また、上記エッジ検出方法では、上記図13の(a)〜(d)に示したフィルタ群以外に、上記フィルタ群が検出するエッジの方向以外の方向において、45°きざみでエッジを検出するフィルタ群が用いられる。したがって、上記エッジ検出方法では、全部で8方向のエッジを検出するためのフィルタが用いられる。
【0020】
ここで、上記図13の(a)〜(d)に示したロビンソンの3レベルのフィルタの他に、特定の方向のエッジを検出するフィルタとして、上述したプラット(Pratt)著「デジタル イメージ プロセッシング(Digital Image Processing)」に述べられているプレウイット(Prewitt)のコンパス(compass)フィルタやキルシュ(Kirsch)のフィルタ等がある。
【0021】
しかし、上述したロビンソンの3レベルのフィルタ、プレウイットのコンパスフィルタ、及びキルシュのフィルタ等の特定の方向のエッジを検出するフィルタ(以下、方向選択的なフィルタと言う。)においては、方向選択性、すなわち指向性が弱いという欠点がある。
【0022】
具体的に説明すると、例えば、エッジの本来の強度をK、検出したいエッジの方向と実際のエッジの方向のなす角度をθとした場合、方向選択的なフィルタの出力、すなわちエッジ強度Eは、
E = Kcosθ
なる関係式で与えられる。
【0023】
この関係式は、不要なエッジの方向が本来検出したいエッジの方向と90゜異ならない限り、不要なエッジのエッジ強度Eは「0」にならない、すなわち不要なエッジの混入を完全に除去することはできないことを示している。したがって、図14に示すように、方向選択的なフィルタにおける指向性Aに対して、実用上必要となる指向性Bは、さらに強いものである必要があるが、このような強い指向性を方向選択的なフィルタに持たせることができなかったため、不要なエッジの混入を防ぐことができなかった。
【0024】
また、方向選択的なフィルタにおいて、エッジの検出方向を細かくしようとした場合、例えば、上述したような45°単位ではなく、15°単位でエッジの検出方向を細かくしようとした場合には、フィルタが大きくなってしまっていた。すなわち、フィルタの係数の正の部分と負の部分は、エッジの検出方向と直角に配置されなくてはならないが、エッジの検出方向が15°単位のように細かく指定されると、その検出方向の角度を表すためには、3×3程度の小さなフィルタでは不十分となり、フィルタが大きくなってしまっていた。このため、細かいエッジの検出能力が低下すると共に、多数のフィルタを用いなければ全方向のエッジに対応することができないという不便さが生じてしまっていた。
【0025】
そこで、本発明は、上述の如き従来の実情に鑑みてなされたものであり、次のような目的を有するものである。
即ち、本発明の目的は、不要なエッジの混入を防ぎ、エッジ検出精度を高めたエッジ検出方法及びエッジ検出装置を提供することにある。
【0026】
また、本発明の目的は、エッジ検出方向の指向性が強いエッジ検出方法及びエッジ検出装置を提供することにある。
また、本発明の目的は、良好なエッジ画像を容易に得るエッジ検出方法及びエッジ検出装置を提供することにある。
【0027】
また、本発明の目的は、良好なエッジ画像を高速に得るエッジ検出方法及びエッジ検出装置を提供することにある。
【0028】
【課題を解決するための手段】
上述した課題を解決するために、本発明は、濃淡データで構成される入力画像データの中から、画素値が周囲と比べて急峻に変化している画素群をエッジとして検出するエッジ検出方法であって、推定手段により、あらかじめ示されているエッジ抽出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定する推定工程とグラディエント算出手段により、入力画像データにおける各位置グラディエントを求めるグラディエント算出工程とエッジ強度算出手段により、上記推定工程で推定したエッジ方向と上記グラディエントのなす角度と、上記グラディエントの大きさと、上記推定したエッジ方向と上記グラディエントとのなす角度の絶対値が小さいほど大きい値をとる指向性を決定する指数と、からエッジ強度を算出してエッジを検出するエッジ強度算出工程とからなることを特徴とする。
【0029】
また、本発明に係るエッジ検出方法は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを求めてエッジ強度を算出することを特徴とする。
【0030】
また、本発明に係るエッジ検出方法は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求めることを特徴とする。
さらに、本発明は、上記曲線がスプライン曲線であることを特徴とする。
【0031】
本発明は、濃淡データで構成される入力画像データの中から、画素値が周囲と比べて急峻に変化している画素群をエッジとして検出するエッジ検出装置であって、あらかじめ示されているエッジ抽出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定する推定手段と、入力画像データにおける各位置のグラディエントを求めるグラディエント算出手段と、上記推定手段で推定したエッジ方向と、上記グラディエント算出手段で得られたグラディエントのなす角度と、上記グラディエントの大きさと、指向性を決定する指数から、エッジ強度を算出するエッジ強度算出手段と、上記エッジ強度算出手段で得られたエッジ強度からエッジを検出する検出手段とを備え、上記指数は、上記推定したエッジ方向と上記グラディエントのなす角度の絶対値が小さいほど、大きい値をとることを特徴とする。
【0032】
また、本発明に係るエッジ検出装置は、上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを求めてエッジ強度を算出することを特徴とする。
【0033】
また、本発明に係るエッジ検出装置は、上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求めることを特徴とする。
【0034】
また、本発明に係るエッジ検出装置は、上記曲線がスプライン曲線であることを特徴とする。
【0035】
【作用】
本発明に係るエッジ検出方法では、推定手段によりあらかじめ示されているエッジ抽出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定グラディエント算出手段により入力画像データにおける各位置グラディエントを求める。そして、エッジ強度算出手段により、上記推定したエッジ方向と上記グラディエントのなす角度と、上記グラディエントの大きさと、上記推定したエッジ方向と上記グラディエントとのなす角度の絶対値が小さいほど大きい値をとる指向性を決定する指数と、からエッジ強度を算出してエッジを検出する。
【0036】
また、本発明に係るエッジ検出方法では、上記推定したエッジ方向と上記グラディエントのなす角度と、上記グラディエントの大きさと、指向性を決定する指数から、エッジ強度を算出する。
【0037】
また、本発明に係るエッジ検出方法では、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求める。
【0038】
本発明に係るエッジ検出装置では、あらかじめ示されているエッジ抽出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定手段により推定するとともに、入力画像データにおける各位置のグラディエントをグラディエント算出手段により求める。そして、上記推定手段で推定したエッジ方向と、上記グラディエント算出手段で得られたグラディエントのなす角度と、上記グラディエントの大きさと、指向性を決定する指数から、エッジ強度算出手段によりエッジ強度を算出し、上記エッジ強度算出手段で得られたエッジ強度から検出手段によりエッジを検出する。上記指数は、上記推定したエッジ方向と上記グラディエントのなす角度の絶対値が小さいほど、大きい値をとる。
【0039】
また、本発明に係るエッジ検出装置では、上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを求めてエッジ強度を算出する。
【0040】
また、本発明に係るエッジ検出装置では、上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求める。
【0042】
【実施例】
以下、本発明の一実施例について図面を参照しながら説明する。
本発明に係るエッジ検出方法は、例えば、図1に示すようなエッジ検出装置10により実施される。また、エッジ検出装置10は、本発明に係るエッジ検出装置を適用したものである。
【0043】
すなわち、エッジ検出装置10は、上記図1に示すように、入力画像Finが供給されるグラディエント計算部11と、輪郭の概略Pが供給されるスプライン曲線発生部12と、助変数tをスプライン曲線発生部12に対して発生するパラメータ座標生成部13と、グラディエント計算部11からの出力とスプライン曲線発生部12からの出力からエッジ強度Eを算出するエッジ強度計算部14とを備えている。また、スプライン曲線発生部12からの出力は、グラディエント計算部11にも供給されるようになされている。
【0044】
また、グラディエント計算部11は、図2に示すように、入力画像Finが各々供給されるフィルタ演算器111とフィルタ演算器112を備えている。フィルタ演算器111は、X方向のソーベルフィルタSXを入力画像Finに対して施すものであり、フィルタ演算器112は、Y方向のソーベルフィルタSYを入力画像Finに対して施すものである。このようなフィルタ演算器111及びフィルタ演算器112からの各出力は、エッジ強度計算部14に供給されるようになされている。
【0045】
また、エッジ強度計算部14には、予め設定されている方向選択指数sが供給されるようになされており、エッジ強度計算部14は、図3に示すように、グラディエント計算部11からの出力を用いて参照するグラディエントテーブルTGと、スプライン曲線発生部12からの出力が供給される座標回転部412と、グラディエントテーブルTGで得られた結果と座標回転部412からの出力が供給される内積計算部141と、供給された方向選択指数sと内部演算部141からの出力を用いて参照するコサインテーブルTCと、コサインテーブルTCで得られた結果とグラディエントテーブルTGで得られた結果からエッジ強度Eを算出する乗算器143とを備えている。
【0046】
ここで、図4は、エッジ検出装置10におけるエッジ検出処理を示すフローチャートである。以下、上記図1〜図3及び図4を用いて具体的に説明する。
エッジ検出装置10には、濃淡データで構成された入力画像Finが入力される。一方、エッジ検出装置10には、例えば、オペレータが図示していないディスプレイ上に表示されている入力画像Finをみながらタブレットを使用することにより、輪郭の概略Pが入力される。
【0047】
グラディエント計算部11は、入力画像Finを取り込む(ステップS1)。尚、グラディエント計算部11における詳細な説明は後述する。
一方、スプライン曲線発生部12は、上述したようなオペレータの入力による輪郭の概略Pを座標列(x0,y0),(x1,y1),(x2,y2),・・・として順次取り込む(ステップS2)。そして、スプライン曲線発生部12は、順次取り込んだ座標列(x0,y0),(x1,y1),(x2,y2),・・・を通るような滑らかな曲線P(t)を生成する(ステップS3)。
【0048】
具体的に説明すると、まず、曲線P(t)は、3次スプライン形式で表現される。すなわち、曲線P(t)は、助変数t、助変数tの3次多項式x(t),y(t)を持って、
P(t) = (x(t),y(t))
なる式で表現される。そして、助変数tが「0」〜「1」まで変化する時、その軌跡である曲線P(t)、すなわちスプライン曲線P(t)は、座標列(x0,y0),(x1,y1),(x2,y2),・・・を滑らかに接続して輪郭を一周することとなる。このようなスプライン曲線は、CADをはじめとする広い分野で使用されている。
【0049】
そこで、スプライン曲線発生部12は、スプライン曲線P(t)が座標列(x0,y0),(x1,y1),(x2,y2),・・・を滑らかに接続するように、3次多項式x(t),y(t)の係数を順次取り込んだ座標列(x0,y0),(x1,y1),(x2,y2),・・・(以下、座標列(xn,yn)と言う。)に基いて決定する。この係数の決定方法は、例えば、代表的な文献であるファーリン(Farin)著の「カーブス アンド サーフェシズ フォーコンピュータ エイディッド ジオメトリック デザイン(Curves and surfaces for computer aided geometric design)」に述べられている係数の決定方法を適用する。この係数の決定方法は、点群を与えられた時、その点群を通過するような係数の決定方法であり、公知のものである。
【0050】
例えば、入力画像Finが図5(a)に示すような画像250であった場合、すなわち画像250の中心付近に円形の物体260が存在する場合、スプライン曲線発生部12は、円形の物体260の周囲に沿ってオペレータが指定した概略の輪郭上の点群271xyを座標列(xn,yn)として取り込む。そして、スプライン曲線発生部12は、点群271xyを補間する曲線270が点群271xyを通過するような係数を決定して、スプライン曲線P(t)を生成する。
【0051】
上述のようにしてスプライン曲線発生部12により生成されたスプライン曲線P(t)は、グラディエント計算部11に供給される。
また、スプライン曲線発生部12は、生成したスプライン曲線P(t)を輪郭の概略として用い、スプライン曲線P(t)上の各画素について以下の処理を行う(ステップS4)。この時、パラメータ座標生成部13は、曲線P(t)の助変数tを「0」〜「1」まで小さな刻み幅で変化させてスプライン曲線発生部12に対して発生する。
【0052】
尚、以下に述べるステップS4の処理は、パラメータ座標生成部13からの少しずつ変化した助変数tにより、スプライン曲線P(t)上の各画素を順にたどっていき、各画素(x,y)について繰り返すループ処理である。
先ず、スプライン曲線発生部12は、パラメータ座標生成部13からの助変数tを上述した「P(t)=(x(t),y(t))」の式に代入することにより、対象画素のX座標及びY座標(以下、対象画素(x,y)と言う。)を求める。そして、スプライン曲線発生部12は、求めた対象画素(x,y)をグラディエント計算部11に供給する。
【0053】
また、スプライン曲線発生部12は、上記図5(b)に示すように、求めた対象画素(x,y)におけるスプライン曲線P(t)の接線方向を求める。この接線方向を対象画素(x,y)における輪郭のおよその方向として使用する。すなわち、接線方向は、スプライン曲線P(t)を微分して得られる速度ベクトルV(t)の方向と等しいため、この速度ベクトルV(t)を接線方向として、
V(t) = d/dtP(t)
なる式で求める。そして、求めた速度ベクトルV(t)の長さを「1」に正規化し、接線ベクトルTを、
T = V(t)/|V(t)|
なる式で求め(ステップS4.1)、求めた接線ベクトルTをエッジ強度計算部14に供給する。
【0054】
次に、上述のようにしてスプライン曲線発生部12で得られた接線ベクトルTを補助情報とし、その補助情報を用いて以下に述べるエッジ検出処理を行う(ステップS4.2)。
先ず、エッジ強度計算部14は、スプライン曲線発生部12からの接線ベクトルTを90゜回転させた法線ベクトルNを求める(ステップS4.2.1)。この回転は、スプライン曲線P(t)の軌跡の進行方向に対して反時計回りを正の向きとする。
【0055】
すなわち、エッジ強度計算部14において、上記図3に示すように、座標回転部142は、スプライン曲線発生部12からの接線ベクトルTを反時計回りに回転した法線ベクトルNに変換する。この座標回転部142における処理は、1倍及び−1倍の係数をかけるのみのごく簡単なものである。
【0056】
上述のような法線ベクトルNを求める処理を演算式を用いて表すと、法線ベクトルNは、数1に示す行列Rを用いて、
【0057】
【数1】

Figure 0003826412
【0058】
N = RT
となる。このようにして求められた法線ベクトルNは、スプライン曲線P(t)の法線ベクトルであるため、エッジの向きと推定した輪郭の方向が平行であるならば、各々に垂直な後述するグラディエントとスプライン曲線P(t)の法線ベクトルNも平行となる。
【0059】
次に、上述したグラディエント計算部11は、スプライン曲線発生部12からの対象画素(x,y)の近傍3×3画素の領域について、ステップS1の処理において取り込んだ入力画像Finの画素値I(x,y)を読み込み、対象画素(x,y)における画像の勾配(以下、グラディエントと言う。)Gを求める。
【0060】
すなわち、グラディエント計算部11において、上記図2に示すように、フィルタ演算器111は、読み込んだ入力画像Finの画素値I(x,y)に対してX方向のソーベルフィルタSXを施す。また、フィルタ演算器112は、読み込んだ入力画像Finの画素値I(x,y)に対してY方向のソーベルフィルタSYを施す。そして、グラディエント計算部11は、フィルタ演算器111及びフィルタ演算器112の出力Dx,Dyを組み合わせて、対象画素(x,y)における画像のグラディエントG(=(Dx,Dy))としてエッジ強度計算部14に供給する(ステップS4.2.2)。
【0061】
上述のようにして得られたグラディエントGは、画像の濃淡を標高としてとらえた場合に、傾斜が最大の方向を示すベクトルであり、エッジの方向に垂直なものである。すなわち、グラディエントGは、入力画像Finの画素値I(x,y)に対して、G = grad I(x,y) = (Dx,Dy)
なる式で表すことができる。
【0062】
次に、エッジ強度計算部14は、グラディエント計算部11で得られたグラディエントGの長さlenGと、グラディエントGの長さlenGが「1」となるように正規化したnormGとを求める(ステップS4.2.3)。
ここで、エッジ強度計算部14は、上記図3に示すように、グラディエントテーブルTGを備えている。このグラディエントテーブルTGには、グラディエントGの長さlenGと、それを正規化したnormGとが[数2]に示す演算式を用いて予め計算された結果が格納されている。
【0063】
【数2】
Figure 0003826412
【0064】
具体的に説明すると、グラディエントテーブルTGは、グラディエント計算部11で得られたグラディエントG(=(Dx,Dy))を入力とし、グラディエントGの長さlenGと、それを正規化したnormGとを出力とするテーブルである。また、画素値の精度は、通常8ビットであり、X方向の出力Dx及びY方向の出力Dyも同じ精度が使用されるため、グラディエントテーブルTGには、X方向の出力DxとY方向の出力Dyの合わせて16ビットが入力されるようになされている。このため、任意のX方向の出力DxとY方向の出力Dyの組み合わせに対して、グラディエントテーブルTGの1要素が割り当てられる。したがって、グラディエントテーブルTGの各要素に各々、グラディエントGの長さlenGの値と、それを正規化したnormGの値とが格納されている。このようなグラディエントテーブルTGを用いることにより、平方根等の複雑な計算を行うこと無しに、容易に結果を得ることができる。また、グラディエントテーブルTGへの入力は、16ビットとしているため、テーブルサイズ、すなわち要素の数は、「65536」であり、現在の計算機に十分適用することができる。
【0065】
上述のようなグラディエントテーブルTGにより、グラディエント計算部11で得られたグラディエントG(=(Dx,Dy))のグラディエントGの長さlenGと、それを正規化したnormGが求められる。そして、求められたグラディエントGの長さlenGを正規化したnormGは、内積計算部141に供給されると共に、グラディエントGの長さlenGは、乗算器143に供給される。
【0066】
最後に、エッジ強度計算部14は、対象画素(x,y)における輪郭のエッジ強度E(x,y)を上述のようにして求めた法線ベクトルN、グラディエントテーブルTGからのグラディエントGの長さlenG、それを正規化したnormG、及び方向選択指数sを持って、
E(x,y) = lenG(normG・N)S
なる式により求める。
【0067】
すなわち、エッジ強度計算部14において、上記図3に示すように、先ず、内積計算部141は、法線ベクトルNと、グラディエントGの長さlenGを正規化したnormGとの内積「normG・N」を、乗算により求める。この結果がグラディエントGと法線ベクトルNのなす角度θのコサイン「cosθ」となる。
【0068】
次に、コサインテーブルTCを用いて、供給される方向選択指数sにより、
cosSθ
を求める。このコサインテーブルTCは、内積計算部141で得られたコサイン「cosθ」を入力とし、コサイン「cosθ」のS乗を出力とするテーブルであり、コサインテーブルTCから出力されるコサイン「cosθ」のS乗(=cosSθ)は、乗算器143に供給される。ここで、本実施例では、方向選択指数sは、予め設定されている固定値としているため、コサインテーブルTCへの入力は、内積計算部141で得られた内積の結果であり、コサインテーブルTCは、入力が8ビット程度の小さなテーブルである。このようなコサインテーブルTCを用いることにより、複雑な計算を行うこと無しに、コサインのS乗「cosSθ」を容易に求めることができる。
【0069】
そして、最後に、乗算器143は、グラディエントテーブルTGからのグラディエントGの長さlenGと、コサインテーブルTCからのコサインのS乗「cosSθ」とを掛け合わせ、掛け合わせた結果をエッジ強度Eとして出力する。ここで、エッジ強度計算部14に供給される方向選択指数sは、どの程度選択的に特定方向のエッジにだけ反応するかを決定する指数である。この方向選択指数sは、値が大きければその分指向性が強くなるため、不要なエッジの混入をより強く阻止することができるが、所望の方向、すなわち推定したエッジ方向と実際のエッジ方向が少しでもずれていた場合には、エッジ強度の減衰を引き起こす。そこで、方向選択指数sは、通常2〜8の間の値が設定されている。
【0070】
例えば、図6に示すように、方向選択指数sが大きくなると、グラディエントGと法線ベクトルNが同じ方向、すなわち内積「normG・N」の値が「1」に近い場合のみ、エッジ強度E(x,y)が大きい値となる。すなわち、高い指向性が得られる。また、方向選択指数sを「1」とした場合には、上述したロビンソンの3レベルのフィルタ、プレウイットのコンパスフィルタ、及びキルシュのフィルタにおける指向性と同じ指向性が得られる。
【0071】
上述のようなステップS4の処理を概略の輪郭を与えるスプライン曲線P(t)上の各画素(x,y)に対して行う。したがって、エッジ強度計算部14からは、図7に示すように、入力画像Finから得られたエッジ強度画像Foutが出力される(ステップS5)。
上述のように、本実施例では、エッジ強度Eを求める処理において、グラディエントGと法線ベクトルNのなす角度を直接求めずに、内積の計算により直接コサイン「cosθ」を求めているため、3角関数の計算等の複雑な処理を行う必要が無い。すなわち、グラディエントGと法線ベクトルNのなす角度の大きさと対応する量が、乗算2回と加算1回のみのはるかに少ない計算量で算出することができる。
【0072】
また、従来のエッジ検出方法及びエッジ検出装置では、上記図12の(b)に示した前景物体内の色の差や背景物体の交差による不要なエッジ221a〜221cの混入が不可避であり、例えば、推定したエッジ方向から45°ずれた方向のエッジの強度は29%の減衰、60°ずれた方向のエッジの強度は50%の減衰しか得られないのに対して、本実施例によると、上記図6に示すように、方向選択指数sを「4」とした場合、推定したエッジ方向から45°ずれた方向のエッジの強度は75%の減衰、60°ずれた方向のエッジの強度は94%の減衰を得ることができる。また、上述のような前景内の色変化や背景によって生じるうるエッジ221a〜221cの方向は、対象物体の輪郭の方向とは大きく異なる角度となるため、上述したような強い指向性を用いることにより、不要なエッジの混入をほぼ完全に除去することができる。
【0073】
また、概略の輪郭の方向の推定値である接線ベクトルT、及び入力画像FinのグラディエントGを輪郭上の各画素毎に求めるため、輪郭上の各点において輪郭に沿ったエッジを選択的に検出することができる。
例えば、上記図5(a)に示した画像250において、円形の物体260内の色の違いがある箇所A,Bでは、法線ベクトルNは、曲線270に垂直な方向となり、円形の物体260内の色の違いにより生じる水平な線上では、グラディエントGは、上記水平な線に対して垂直方向となる。このため、上記法線ベクトルNと上記グラディエントGの角度差は、90゜となり、上記図6に示すように、エッジ強度Eは、「0」となる。すなわち、円形の物体260内のエッジは、検出されない。一方、輪郭を表すエッジは、曲線270に沿うため、箇所A,BにおけるグラディエントGは、水平方向となる。これは法線ベクトルNと同じ方向であり、このため、輪郭を表すエッジは、強く検出される。したがって、上記図12(b)に示したような不要なエッジ221a,221b,221cを混入することなく、本来求めたいエッジのみを検出することができる。
【0074】
また、エッジ強度計算部14に対してエッジの方向を推定した情報である接線ベクトルTを補助情報として与え、エッジ強度計算部14を特定の方向に強く反応するものとすることにより、不要なエッジが混入することなく必要なエッジのみを高いS/N比で検出することができる。
【0075】
また、オペレータにより入力された輪郭の概略から各位置での対象物体のエッジの方向を算出できるため、オペレータの作業量を増やすこと無く、手間をかけずに必要なエッジのみを検出することができる。
尚、上述した実施例では、方向選択指数sの設定値を2〜8の間の値としたが、エッジの推定方向の精度をさらに高くし、方向選択指数sにさらに大きな値を設定してもよい。これにより、指向性をさらに強めることができる。
【0076】
また、方向選択指数sの値を外部から入力することにより、状況に応じて方向選択指数sの値を変化させてもよい。通常、方向選択指数sの値は、数通り選択できれば十分であるため、方向選択指数sを入力とするコサインテーブルTC追加ビット数は、4ビット程度でよい。また、方向選択指数sの値を整数に限定して、計算機が乗算の繰り返しとして冪乗を計算してもよい。
【0077】
また、上述した実施例では、コサイン「cosθ」の冪乗を使用してエッジ強度を求めることとしたが、上記図3に示した内積演算部141の出力をIP、指向性の分布関数をf(θ)として、
f(cos-1IP)
を計算し、その結果を使用してエッジ強度を求めてもよい。これにより、例えば、図8に示すように、推定したエッジ方向と実際のエッジ方向のなす角度θがしきい値K以下の場合には、エッジ強度を減衰させず、しきい値Kを超えた場合には、エッジ強度を急峻に減衰させる指向性を得ることができる。
【0078】
具体的に説明すると、先ず、所望の分布形状を定義し、上記図8に示したグラフの横軸の値をコサインに変換する。次に、コサインの値各々に対する減衰率、すなわち「f(cos-1IP)」の計算結果をテーブルに格納する。このテーブルを上述した実施例で用いたコサインテーブルTCの代わりに使用する。したがって、分布関数f(θ)を使用してエッジ強度を求めることができる。
【0079】
また、分布関数f(θ)が方向選択指数sをも変数として持つこととしてもよい。すなわち、分布関数f(θs)を使用してエッジ強度を求めてもよい。この場合には、方向選択指数sをも上記テーブルの入力とし、方向選択指数sを変化させながらエッジ強度を求める。
【0080】
また、上述した実施例では、輪郭の概略を3次スプライン形式で表現されるスプライン曲線P(t)としたが、異なる次数のスプライン形式で表現されるものとしてもよい。また、助変数tを用いずに、インプリサイトフォーム(implicit form)形式で表現される曲線
Q(x,y) = 0
としてもよい。
【0081】
また、オペレータが描画した概略の輪郭線の画像を細線化し、隣接する画素の位置関係からエッジの方向を推定してもよい。この場合には、上記図4に示したステップS3において、概略の輪郭線の画像を細線化し、上記図4に示したステップS4.1において、細線化した画像中の対象画素に隣接する複数の画素の並びからその位置における輪郭の方向を求めるようにする。
【0082】
また、上記図4に示したステップS4において、特定の方向のエッジに選択的に反応するような複数のフィルタ、例えば、コンパスオペレータ(compass operator)を用いて、エッジの推定した方向を基にしてその方向に対する検出能力の最も高いフィルタを上記複数のフィルタから選択してエッジ強度を求めるようにしてもよい。
【0083】
また、上述した実施例では、輪郭の概略を表す情報がオペレータにより入力されるものとしたが、複数枚の時間的に連続する画像、すなわち動画像から連続的にエッジを検出することとしてもよい。
この場合には、上記図4に示したフローチャートのステップS2の処理において、概略の輪郭を座標列(xn,yn)として取り込むのではなく、現在の処理対象の画像に対して直前の画像、直前の画像から得られたエッジ検出の結果、及び現在の処理対象の画像の3つの情報から現在の処理対象の画像における輪郭を推定する。
【0084】
すなわち、図9に示すように、先ず、現在の処理対象の画像FCの直前の画像FPに対するエッジ検出処理の結果得られたエッジ30上に一定間隔で画素(以下、マークと言う)311,312,313,・・・を結ぶ。次に、各マーク311,312,313,・・・に対して、各々マークを含む小ブロックを定める。例えば、マーク311に対しては、マーク311を含む小ブロック32を定める。このようにして定めた小ブロック内のデータと最も相関が高い部分を現在の処理対象の画像FC中からブロックマッチング処理により検出する。
【0085】
このブロックマッチング処理においては、先ず、例えば、小ブロック32内の画素値と、現在の処理対象の画像FC中の同じ大きさのブロック内の画素値とを比較し、その差の総和の大小により相関の高さを決定することにより、最も相関が高いブロック33を検出する。この時、ブロック33における画素34が小ブロック32のマーク311に対応する画素となる。マーク311以外のマーク312,313,・・・に対しても同様にして、対応する画素を現在の処理対象の画像FC中から検出する。
【0086】
したがって、上記図4に示したフローチャートのステップS3の処理において、上述のようにして得られた一連の対応する画素の座標列を用いて、スプライン曲線P(t)を生成する。
上述のように、現在の処理対象の画像と直前の画像からブロックマッチング処理により連続的に輪郭を抽出し、その輪郭を用いてエッジ検出を行うことにより、動画像に対してオペレータの介在なく自動的にエッジを検出することができる。また、この場合、ブロックマッチング処理に用いる画像を現在の処理対象の画像と直前の画像のみではなく、画像の枚数を増やしてブロックマッチング処理を行ってもよい。これにより、ブロックの移動量の算出精度を高めることができるため、より正確にエッジを検出することができる。
【0087】
また、時間的に離れた複数の画像において、上記図4に示したフローチャートのステップS2の処理にキーフレーム法を適用してもよい。すなわち、複数の画像についてオペレータが形状の指示を与え、中間の画像については計算機が補間によりオペレータの代替を行う手法を適用してもよい。この場合には、上記ステップS2の処理において、概略の輪郭をオペレータが設定し、中間の画像群については、概略の輪郭上の点群を補間し、自動的にその画像におけるスプライン曲線を生成する。
【0088】
上述のように複数枚の画像と過去のエッジ検出の結果を基にして現在の処理対象の画像におけるエッジを検出することにより、フレーム間の相関を用いてさらに精度良くエッジ方向又は色の変化の情報である補助情報を求めることができる。したがって、エッジ検出精度をさらに高めることができ、動画像におけるエッジ検出を手間をかけずに行うことができる。
【0089】
【発明の効果】
本発明に係るエッジ検出方法では、推定手段によりあらかじめ示されているエッジ抽出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定グラディエント算出手段により入力画像データにおける各位置グラディエントを求め、グラディエント強度算出手段により、上記推定したエッジ方向と上記グラディエントのなす角度と、上記グラディエントの大きさと、上記推定したエッジ方向と上記グラディエントとのなす角度の絶対値が小さいほど大きい値をとる指向性を決定する指数と、からエッジ強度を算出してエッジを検出する。
これにより、エッジ検出において強い指向性を得ることができ、不要なエッジが混入すること無く、対象物体の輪郭を構成するエッジのみを検出することができる。したがって、検出精度を高めることができる。
【0090】
また、本発明に係るエッジ検出方法では、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを求めてエッジ強度を算出する。これにより、少ない計算量でエッジ強度を算出することができる。したがって、良好なエッジ画像を容易に得ることができる。
【0091】
また、本発明に係るエッジ検出方法では、上記推定したエッジ方向と上記グラディエントのなす角度と、上記グラディエントの大きさと、指向性を決定する指数から、エッジ強度を算出するので、少ない計算量でエッジ強度を算出することができる。したがって、良好なエッジ画像を容易に得ることができる。
【0092】
また、本発明に係るエッジ検出方法では、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求める。これにより、さらに強い指向性を得ることができ、さらに少ない計算量でエッジ強度を算出することができる。したがって、良好なエッジ画像をさらに容易に得ることができる。
【0094】
本発明に係るエッジ検出装置では、あらかじめ示されているエッジ抽出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定手段により推定するとともに、入力画像データにおける各位置のグラディエントをグラディエント算出手段により求め、上記推定手段で推定したエッジ方向と、上記グラディエント算出手段で得られたグラディエントのなす角度と、上記グラディエントの大きさと、指向性を決定する指数から、エッジ強度算出手段によりエッジ強度を算出し、上記エッジ強度算出手段で得られたエッジ強度から検出手段によりエッジを検出する。上記指数は、上記推定したエッジ方向と上記グラディエントのなす角度の絶対値が小さいほど、大きい値をとる。
これにより、エッジ検出において強い指向性を得ることができ、不要なエッジが混入すること無く、対象物体の輪郭を構成するエッジのみを検出することができる。したがって、エッジ検出精度を高めることができる。
【0095】
また、本発明に係るエッジ検出装置では、上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを求めてエッジ強度を算出する。これにより、少ない計算量でエッジ強度を算出することができる。したがって、良好なエッジ画像を容易に得ることができる。
【0096】
また、本発明に係るエッジ検出装置では、上記エッジ強度算出手段により、上記推定したエッジ方向と上記グラディエントのなす角度と、上記グラディエントの大きさと、指向性を決定する指数から、エッジ強度を算出するので、少ない計算量でエッジ強度を算出することができる。したがって、良好なエッジ画像を容易に得ることができる。
【0097】
また、本発明に係るエッジ検出装置では、上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求める。これにより、さらに強い指向性を得ることができ、さらに少ない計算量でエッジ強度を算出することができる。したがって、良好なエッジ画像をさらに容易に得ることができる。
【図面の簡単な説明】
【図1】本発明に係るエッジ検出装置の構成を示すブロック図である。
【図2】上記エッジ検出装置のグラディエント計算部の構成を示すブロック図である。
【図3】上記エッジ検出装置のエッジ強度計算部の構成を示すブロック図である。
【図4】上記エッジ検出装置におけるエッジ検出処理を示すフローチャートである。
【図5】概略の輪郭を与える曲線を説明するための図である。
【図6】方向選択指数とエッジ強度の関係を示すグラフである。
【図7】入力画像とエッジ強度画像の関係を説明するための図である。
【図8】指向性分布関数を用いてエッジ強度を求める場合を説明するための図である。
【図9】ブロックマッチング処理を説明するための図である。
【図10】特定方向のエッジを検出するソーベルフィルタを示す略線図である。
【図11】従来のエッジ検出方法を用いて物体内部に色の違いがある画像のエッジ検出を行った場合の結果を説明するための図である。
【図12】オペレータにより入力される輪郭の概略を使用する従来のエッジ検出方法を用いて物体内部に色の違いがある画像のエッジ検出を行った場合の結果を説明するための図である。
【図13】特定方向のエッジを検出するロビンソン3レベルフィルタ群を示す略線図である。
【図14】従来のエッジ検出方法における指向性と実用上必要となる指向性の比較を説明するための図である。
【符号の説明】
10 エッジ検出装置
11 グラディエント計算部
12 スプライン曲線発生部
13 パラメータ座標生成部
14 エッジ強度計算部[0001]
[Industrial application fields]
The present invention relates to an edge detection method and an edge detection apparatus that play a fundamental role in image processing, and special effect processing in video production such as television and movies, and component recognition from camera images in FA (Factory Automation). The present invention relates to an edge detection method and an edge detection apparatus that are suitable for application to the above.
[0002]
[Prior art]
The operation of cutting out an arbitrary partial image from an image is a basic operation for generating texture and structure data in video editing and synthesis, computer graphics, and the like. This operation of cutting out requires processing such as edge detection, region extraction, and association with a known object. In particular, when the background or the target object in the image becomes complicated, it is necessary to accurately obtain and track the edges constituting the contour of the target object.
[0003]
Here, the edge detection is a process of finding a portion where the pixel value changes sharply in the grayscale image. Usually, since the steep change occurs in the contour of the target object, the contour of the target object can be extracted from the image based on the result of edge detection. Therefore, edge detection is used in various fields as the most basic processing for obtaining information about a target object existing therein from an image. In particular, the extraction of the contour of the target object is the most basic process for determining the configuration, position, and the like of the target object existing in the image by a computer or the like, and is the most important application for edge detection.
[0004]
There are many known methods for detecting an edge as described above. However, any of these methods examines a local change in the value of a pixel and detects a portion where the change is large as an edge. As a typical edge detection method, there is a method using a differential filter as a spatial filter. This edge detection method using a differential filter is a method for detecting an edge based on the principle that the differential coefficient also has a large value in a portion where the change in the pixel value is large. For example, a horizontal (X) direction Sobel filter as shown in FIG. 10 performs an operation corresponding to a first-order differentiation in the horizontal (X) direction. When this Sobel filter is used, Where there is an edge in the (Y) direction, the output of the Sobel filter has a large positive or negative value, so that the edge in the vertical (Y) direction can be detected.
[0005]
In addition to the Sobel filter as described above, various spatial filters that perform operations corresponding to first-order or second-order differentiation are used for edge detection. As for these edge detection methods, for example, “Basics of Digital Image Processing” written by Jain, which is a typical textbook, and “Digital Image Processing” written by Pratt, ) ”.
[0006]
In addition, various methods for detecting the contour of the target object using the edge detection method as described above have been tried. For example, from the result of edge detection, a binary image is generated in which the degree of change in pixel value, that is, a portion where the edge strength is high is “1” and the other portion is “0”, and the binary image is thinned. A region extraction method for obtaining the contour of the target object by this is disclosed in Japanese Patent Application No. 5-233810. Here, the thinning means that the pixel of value “1” is sequentially removed from the generated binary image, and the pixel of value “1” is usually removed in order until the pixel width becomes 1 pixel width. Is a known procedure of extracting.
[0007]
On the other hand, there is also a method for detecting edges by a statistical method without using a spatial filter. For example, an edge detection method and apparatus that calculates a variance of pixel values in the vicinity of a pixel of interest, that is, a variance of hue, and detects a region where the value is large as a boundary of a region is disclosed in Japanese Patent Application No. 5-181969. Is disclosed.
[0008]
Also, the document “Color edge detection using vector orderistics” (Trahias, PE et al. “Color edge detection using vector order statistics”, IEEE Transactions on image processing, Vo1.2, Po1.2. 259-264, 1993) ”describes a method of detecting an edge based on a scale representing how far each pixel value is apart from other pixel values.
[0009]
[Problems to be solved by the invention]
However, the conventional edge detection method as described above has a problem of detecting all the portions where the pixel value has a sharp change. For example, as shown in FIG. 11A, in the target object 110 of the image 100, when there is a color difference or an intersection between the background and the target object 110 inside the target object 110, the conventional edge detection method uses the same figure. As shown in (b), the boundary 112 inside the object was also detected, and it was not possible to obtain only the edge 111 originally desired as shown in FIG.
[0010]
Usually, in an object, a sharp change in pixel value due to various reasons such as a color difference, a pattern, and a shadow as shown in FIG. 11A is unavoidable. Also, there are usually various patterns and colors in the background. On the other hand, since the conventional edge detection method uniformly detects steep changes in the pixel value, the above-mentioned boundary inside the object, the background pattern, etc. may be erroneously detected as edges. was there.
[0011]
Therefore, in order to solve the above-described problem, after performing weighting correction processing on the lightness based on the color information of the image, that is, lightness, saturation, and hue, the lightness subjected to the weighting correction processing is used. An automatic clipping system for detecting an edge based on this is disclosed in Japanese Patent Application No. 1-173177. This automatic cropping system uses a weighting correction process to emphasize changes in pixel values near the contour, for example, changes in brightness, thereby making the foreground object, background pattern and color change false. Edge detection is performed by reducing detection.
[0012]
However, in the automatic clipping system, it is not considered to perform an optimum weighting correction process for each individual portion on the contour. Also, it is rare that the pattern, color, etc. are uniform along the contour of the object. For this reason, even with the automatic clipping system, it is not possible to prevent the mixing of edges other than the edge that is originally desired.
[0013]
Further, an edge extraction device that detects an edge by highlighting an edge near the boundary by converting the pixel value so as to increase the contrast at the boundary between the foreground and the background using the histogram of the image is disclosed in Japanese Patent Application No. Hei 1 76170 ". However, although the above-described edge extraction apparatus is effective for detecting sensitive edges, it has not been possible to prevent the mixing of edges other than those originally desired.
[0014]
On the other hand, an area extracting apparatus that limits edge detection locations on an image, eliminates edge detection at unnecessary locations, and minimizes the inclusion of edges at locations other than contours is disclosed in “ 176780 ”. In this region extracting apparatus, an outline of a target object is manually input and edge detection is performed only within the outline outline, thereby preventing edge generation and performing edge detection. Also, a Japanese patent application No. 5-236347 discloses a soft key generation device configured to manually input an outline of an outline of a target object and perform edge detection only near the boundary based on the outline outline information. ing.
[0015]
However, the region extraction device and the soft key generation device simply narrow the region where erroneous edge detection occurs, and cannot prevent mixing of edges other than the contour.
For example, as illustrated in FIG. 12A, when edge detection is performed using an outline 220 of the target object 210 input by an operator in an image 200, the limit is limited even if the range of edge detection is limited. However, as shown in FIG. 12B, unnecessary edges 221a, 221b, and 221c are erroneously detected.
[0016]
Here, by increasing the accuracy of the outline outline 220, the number and length of unnecessary edges 221a, 221b, and 221c can be gradually reduced. For this purpose, the outline outline 220 is manually and highly accurate. This is a very difficult task. In order to solve this problem, when the operator slowly moves the input means such as a tablet or a mouse, the outline thickness of the outline is controlled to be thin. An image editing apparatus that detects edges by limiting the range of edge detection by controlling the outline to be thick is disclosed in Japanese Patent Application No. 1-180674. It was not possible to prevent the mixing of unnecessary edges.
[0017]
In order to solve the above problems, for example, the edge direction is estimated from a rough outline manually input, and only the edges that match the estimated edge direction are selectively detected, so that the above-described unnecessary There is an edge detection method in which edge detection is performed by removing a significant edge.
[0018]
In the edge detection method described above, only the edges in a specific direction are detected by using a filter group called Robinson's three-level (3-level) as shown in FIGS. .
The filter group shown in FIGS. 13A to 13D is an extension of the Sobel filter shown in FIG. 10 and detects edges in directions other than horizontal and vertical. For example, the filter shown in FIG. 13A outputs a large value when the pixel value on the right side of the image is large and the pixel value on the left side of the image is small. That is, the filter shown in FIG. 13A detects an edge in the + 0 ° direction. Further, the filters shown in FIGS. 13B, 13C, and 13D detect edges in the 45 °, 90 °, and 135 ° directions, respectively.
[0019]
In the edge detection method, in addition to the filter groups shown in FIGS. 13A to 13D, filters that detect edges in 45 ° increments in directions other than the edge directions detected by the filter groups. Groups are used. Therefore, the edge detection method uses a filter for detecting edges in eight directions in total.
[0020]
Here, in addition to the Robinson three-level filter shown in FIGS. 13A to 13D, as a filter for detecting an edge in a specific direction, “Digital Image Processing” by Pratt described above can be used. There are a Prewitt compass filter, a Kirsch filter, and the like described in “Digital Image Processing”.
[0021]
However, in the filters for detecting edges in a specific direction (hereinafter referred to as direction-selective filters) such as the above-described Robinson 3-level filter, Prewit compass filter, and Kirsch filter, the direction selectivity, That is, there is a drawback that directivity is weak.
[0022]
More specifically, for example, when the original intensity of the edge is K and the angle between the direction of the edge to be detected and the actual edge direction is θ, the output of the direction-selective filter, that is, the edge intensity E is
E = Kcosθ
Is given by the following relational expression.
[0023]
This relational expression indicates that the edge strength E of the unnecessary edge does not become “0” unless the direction of the unnecessary edge is 90 ° different from the direction of the edge to be originally detected, that is, the contamination of the unnecessary edge is completely removed. Indicates that you cannot. Therefore, as shown in FIG. 14, the directivity B that is practically necessary for the directivity A in the direction-selective filter needs to be stronger, but this strong directivity is the direction. Since the selective filter could not be provided, it was not possible to prevent the mixing of unnecessary edges.
[0024]
Further, in the direction-selective filter, when trying to make the edge detection direction fine, for example, when trying to make the edge detection direction fine in units of 15 ° instead of 45 ° as described above, the filter Was getting bigger. That is, the positive part and the negative part of the coefficient of the filter must be arranged at right angles to the edge detection direction. However, when the edge detection direction is finely specified in units of 15 °, the detection direction In order to represent this angle, a filter as small as 3 × 3 is insufficient, and the filter is large. For this reason, the ability to detect fine edges has been reduced, and inconveniences have arisen that it is impossible to deal with edges in all directions unless a large number of filters are used.
[0025]
Accordingly, the present invention has been made in view of the above-described conventional situation and has the following objects.
That is, an object of the present invention is to provide an edge detection method and an edge detection device that prevent the mixing of unnecessary edges and improve the edge detection accuracy.
[0026]
Another object of the present invention is to provide an edge detection method and an edge detection device that have strong directivity in the edge detection direction.
It is another object of the present invention to provide an edge detection method and an edge detection device that can easily obtain a good edge image.
[0027]
It is another object of the present invention to provide an edge detection method and an edge detection apparatus that can obtain a good edge image at high speed.
[0028]
[Means for Solving the Problems]
  In order to solve the above-described problem, the present invention is an edge detection method for detecting, as an edge, a pixel group whose pixel value changes sharply compared with the surroundings from input image data composed of grayscale data. There,By estimation meansA curve is generated along the point group to be subjected to edge extraction processing shown in advance, and for the points existing on the generated curve,In input image dataEstimate edge direction at each positionEstimating process and,In the input image data by the gradient calculation meansEach positionofSeeking a gradientGradient calculation process,By edge strength calculation means,the aboveIn the estimation processThe estimated edge direction and,The angle formed by the gradient, the size of the gradient,The smaller the absolute value of the angle between the estimated edge direction and the gradient, the larger the value.Index that determines directivityWhen,Edge detection by calculating edge strength fromThe edge strength calculation stepIt is characterized by that.
[0029]
  The edge detection method according to the present invention is characterized in that an edge strength is calculated by obtaining a cosine of an angle formed by the estimated edge direction and the gradient.
[0030]
  Further, the edge detection method according to the present invention normalizes the estimated edge direction and the length to “1”, which is a vector obtained by normalizing the cosine of the angle formed by the estimated edge direction and the gradient. It is obtained as an inner product with the gradient.
  Furthermore, the present invention is characterized in that the curve is a spline curve.
[0031]
  The present invention is an edge detection device for detecting, as an edge, a pixel group in which pixel values change sharply compared to the surroundings from input image data composed of grayscale data, the edge being shown in advance An estimation means for generating a curve along a point group to be extracted, and estimating an edge direction of each position in the input image data with respect to a point existing on the generated curve, and each position in the input image data Gradient calculation means for determining the gradient of the edge, the edge direction estimated by the estimation means, the angle formed by the gradient obtained by the gradient calculation means, the magnitude of the gradient, and the index that determines the directivity are used to determine the edge strength. Edge strength calculating means for calculating, and detecting means for detecting an edge from the edge strength obtained by the edge strength calculating means The provided, the index is characterized by taking as the absolute value of the angle of the estimated edge direction and the gradient is small, a large value.
[0032]
  Further, the edge detection apparatus according to the present invention is characterized in that the edge intensity calculation means calculates an edge intensity by obtaining a cosine of an angle formed by the estimated edge direction and the gradient.
[0033]
Further, in the edge detection apparatus according to the present invention, the edge strength calculating means calculates the estimated edge direction, which is a vector obtained by normalizing the cosine of the angle formed by the estimated edge direction and the gradient, and the length. It is obtained as an inner product with the gradient normalized to “1”.
[0034]
  Moreover, the edge detection apparatus according to the present invention isThe above curve is a spline curveIt is characterized by that.
[0035]
[Action]
  In the edge detection method according to the present invention,By estimation meansA curve is generated along the point group to be subjected to edge extraction processing shown in advance, and for the points existing on the generated curve,In input image dataEstimate edge direction at each positionShi,In the input image data by the gradient calculation meansEach positionofFind the gradient. AndBy edge strength calculation means,The estimated edge direction and,The angle formed by the gradient, the size of the gradient,The smaller the absolute value of the angle between the estimated edge direction and the gradient, the larger the value.Index that determines directivityWhen,Edge strength is calculated from the edge to detect the edge.
[0036]
  In the edge detection method according to the present invention, the estimated edge direction and the gradient are formed.Angle andOf the above gradientFrom the size and index that determines directivity, the edge strength iscalculate.
[0037]
In the edge detection method according to the present invention, the estimated edge direction and the cosine of the angle formed by the gradient are normalized to a preliminarily normalized vector, and the length is normalized to “1”. Obtained as inner product with the gradient.
[0038]
  In the edge detection apparatus according to the present invention, a curve is generated along a point group to be subjected to edge extraction processing indicated in advance, and each position in the input image data is detected with respect to a point existing on the generated curve. The edge direction is estimated by the estimation means, and the gradient of each position in the input image data is obtained by the gradient calculation means. Then, the edge strength calculation means calculates the edge strength from the edge direction estimated by the estimation means, the angle formed by the gradient obtained by the gradient calculation means, the magnitude of the gradient, and an index for determining directivity. Then, the edge is detected by the detecting means from the edge intensity obtained by the edge intensity calculating means. The index takes a larger value as the absolute value of the angle formed by the estimated edge direction and the gradient is smaller.
[0039]
  In the edge detection apparatus according to the present invention, the edge strength calculation means calculates the edge strength by obtaining a cosine of an angle formed by the estimated edge direction and the gradient.
[0040]
In the edge detection apparatus according to the present invention, the edge strength calculating means calculates the estimated edge direction and the length, which is a vector obtained by normalizing a cosine of an angle formed by the estimated edge direction and the gradient in advance. Obtained as an inner product with the gradient normalized to “1”.
[0042]
【Example】
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
The edge detection method according to the present invention is implemented by, for example, an edge detection apparatus 10 as shown in FIG. The edge detection apparatus 10 is an application of the edge detection apparatus according to the present invention.
[0043]
That is, as shown in FIG.in, A spline curve generation unit 12 to which an outline P is supplied, a parameter coordinate generation unit 13 that generates an auxiliary variable t for the spline curve generation unit 12, and a gradient calculation unit 11 And an edge strength calculator 14 for calculating the edge strength E from the output from the spline curve generator 12. Further, the output from the spline curve generator 12 is also supplied to the gradient calculator 11.
[0044]
In addition, the gradient calculation unit 11 receives the input image F as shown in FIG.inAre provided with a filter computing unit 111 and a filter computing unit 112, respectively. The filter calculator 111 is a Sobel filter S in the X direction.XInput image FinThe filter computing unit 112 is provided with a Sobel filter S in the Y direction.YInput image FinIs to be applied. Each output from the filter calculator 111 and the filter calculator 112 is supplied to the edge strength calculator 14.
[0045]
The edge strength calculator 14 is supplied with a preset direction selection index s, and the edge strength calculator 14 outputs an output from the gradient calculator 11 as shown in FIG. Gradient table T to be referenced usingGA coordinate rotation unit 412 to which an output from the spline curve generation unit 12 is supplied, and a gradient table TGThe inner product calculation unit 141 to which the result obtained in step S3 and the output from the coordinate rotation unit 412 are supplied, and the cosine table T to be referred to using the supplied direction selection index s and the output from the internal calculation unit 141.CAnd cosine table TCAnd the gradient table TGAnd a multiplier 143 for calculating the edge strength E from the result obtained in (1).
[0046]
Here, FIG. 4 is a flowchart showing an edge detection process in the edge detection apparatus 10. Hereinafter, it demonstrates concretely using the said FIGS. 1-3 and FIG.
The edge detection device 10 includes an input image F composed of grayscale data.inIs entered. On the other hand, the edge detection device 10 includes, for example, an input image F displayed on a display (not shown) by the operator.inBy using the tablet while watching, the outline P of the contour is input.
[0047]
The gradient calculation unit 11 receives the input image Fin(Step S1). The detailed description of the gradient calculation unit 11 will be described later.
On the other hand, the spline curve generation unit 12 sequentially captures the outline P, which is input by the operator as described above, as a coordinate sequence (x0, y0), (x1, y1), (x2, y2),. S2). Then, the spline curve generator 12 generates a smooth curve P (t) that passes through the coordinate sequences (x0, y0), (x1, y1), (x2, y2),. Step S3).
[0048]
More specifically, first, the curve P (t) is expressed in a cubic spline format. That is, the curve P (t) has an auxiliary variable t and a cubic polynomial x (t), y (t) of the auxiliary variable t,
P (t) = (x (t), y (t))
It is expressed by the expression When the auxiliary variable t changes from “0” to “1”, the trajectory curve P (t), that is, the spline curve P (t), is represented by a coordinate sequence (x0, y0), (x1, y1). , (X2, y2),... Are smoothly connected to make a round of the contour. Such spline curves are used in a wide range of fields including CAD.
[0049]
Therefore, the spline curve generation unit 12 has a cubic polynomial so that the spline curve P (t) smoothly connects the coordinate sequences (x0, y0), (x1, y1), (x2, y2),. Coordinate sequence (x0, y0), (x1, y1), (x2, y2),... (hereinafter referred to as coordinate sequence (xn, yn)) that sequentially incorporates the coefficients of x (t) and y (t). )). This coefficient determination method is, for example, the determination of the coefficient described in “Curves and surfaces for computer aided geometric design” by Farin, a representative document. Apply the method. This coefficient determination method is a method for determining a coefficient that passes through a point group when a point group is given, and is known.
[0050]
For example, the input image Fin5 is an image 250 as shown in FIG. 5A, that is, when a circular object 260 exists in the vicinity of the center of the image 250, the spline curve generator 12 causes the operator to move along the periphery of the circular object 260. Point group 271 on the outline indicated byxyAs a coordinate sequence (xn, yn). Then, the spline curve generation unit 12 includes a point group 271.xyA curve 270 for interpolating the point group 271xyA coefficient that passes through is determined, and a spline curve P (t) is generated.
[0051]
The spline curve P (t) generated by the spline curve generation unit 12 as described above is supplied to the gradient calculation unit 11.
Further, the spline curve generation unit 12 uses the generated spline curve P (t) as an outline of the outline, and performs the following processing on each pixel on the spline curve P (t) (step S4). At this time, the parameter coordinate generation unit 13 changes the auxiliary variable t of the curve P (t) from “0” to “1” with a small step size, and generates it for the spline curve generation unit 12.
[0052]
In the process of step S4 described below, each pixel on the spline curve P (t) is sequentially traced by the auxiliary variable t which is gradually changed from the parameter coordinate generation unit 13, and each pixel (x, y) It is a loop process repeated about.
First, the spline curve generation unit 12 substitutes the auxiliary variable t from the parameter coordinate generation unit 13 into the above-described expression “P (t) = (x (t), y (t))”, thereby obtaining the target pixel. X coordinate and Y coordinate (hereinafter referred to as target pixel (x, y)). Then, the spline curve generation unit 12 supplies the obtained target pixel (x, y) to the gradient calculation unit 11.
[0053]
Further, the spline curve generation unit 12 obtains the tangential direction of the spline curve P (t) in the obtained target pixel (x, y) as shown in FIG. This tangential direction is used as the approximate direction of the contour in the target pixel (x, y). That is, since the tangential direction is equal to the direction of the velocity vector V (t) obtained by differentiating the spline curve P (t), this velocity vector V (t) is defined as the tangential direction.
V (t) = d / dtP (t)
The following formula is used. Then, the length of the obtained velocity vector V (t) is normalized to “1”, and the tangent vector T is
T = V (t) / | V (t) |
(Step S4.1) and the obtained tangent vector T is supplied to the edge strength calculator 14.
[0054]
Next, the tangent vector T obtained by the spline curve generation unit 12 as described above is used as auxiliary information, and edge detection processing described below is performed using the auxiliary information (step S4.2).
First, the edge strength calculation unit 14 obtains a normal vector N obtained by rotating the tangent vector T from the spline curve generation unit 12 by 90 ° (step S4.2.1). This rotation has a positive direction counterclockwise with respect to the traveling direction of the trajectory of the spline curve P (t).
[0055]
That is, in the edge strength calculation unit 14, as shown in FIG. 3, the coordinate rotation unit 142 converts the tangent vector T from the spline curve generation unit 12 into a normal vector N rotated counterclockwise. The processing in the coordinate rotation unit 142 is very simple by simply multiplying the coefficients by 1 and -1.
[0056]
When the processing for obtaining the normal vector N as described above is expressed using an arithmetic expression, the normal vector N is expressed by using the matrix R shown in Equation 1.
[0057]
[Expression 1]
Figure 0003826412
[0058]
N = RT
It becomes. Since the normal vector N obtained in this way is a normal vector of the spline curve P (t), if the direction of the edge is parallel to the estimated contour direction, the gradient described later is perpendicular to each. And the normal vector N of the spline curve P (t) are also parallel.
[0059]
Next, the gradient calculation unit 11 described above inputs the input image F captured in the process of step S1 for the 3 × 3 pixel region in the vicinity of the target pixel (x, y) from the spline curve generation unit 12.inThe pixel value I (x, y) is read, and an image gradient (hereinafter referred to as a gradient) G at the target pixel (x, y) is obtained.
[0060]
That is, in the gradient calculation unit 11, as shown in FIG.inSobel filter S in the X direction with respect to the pixel value I (x, y) ofXApply. The filter calculator 112 also reads the input image F that has been read.inSobel filter S in the Y direction with respect to the pixel value I (x, y) ofYApply. The gradient calculation unit 11 combines the outputs Dx and Dy of the filter calculator 111 and the filter calculator 112 to calculate the edge intensity as the gradient G (= (Dx, Dy)) of the image at the target pixel (x, y). It supplies to the part 14 (step S4.2.2).
[0061]
The gradient G obtained as described above is a vector indicating the direction of the maximum inclination when the shade of the image is regarded as the altitude, and is perpendicular to the direction of the edge. That is, the gradient G is G = grad I (x, y) = (Dx, Dy) with respect to the pixel value I (x, y) of the input image Fin.
It can be expressed by the following formula.
[0062]
Next, the edge strength calculation unit 14 obtains the length lenG of the gradient G obtained by the gradient calculation unit 11 and the normG normalized so that the length lenG of the gradient G becomes “1” (step S4). 2.3).
Here, as shown in FIG. 3, the edge strength calculation unit 14 performs the gradient table T.GIt has. This gradient table TGStores the result of pre-calculating the length lenG of the gradient G and the normalized normG using the arithmetic expression shown in [Equation 2].
[0063]
[Expression 2]
Figure 0003826412
[0064]
Specifically, the gradient table TGIs a table in which the gradient G (= (Dx, Dy)) obtained by the gradient calculation unit 11 is input, and the length lenG of the gradient G and normG obtained by normalizing the gradient G are output. Further, the accuracy of the pixel value is normally 8 bits, and the same accuracy is used for the output Dx in the X direction and the output Dy in the Y direction.G16 bits are input together with the output Dx in the X direction and the output Dy in the Y direction. Therefore, the gradient table T for any combination of the output Dx in the X direction and the output Dy in the Y directionG1 element is assigned. Therefore, the gradient table TGIn each element, the value of the length lenG of the gradient G and the value of normG obtained by normalizing it are stored. Such a gradient table TGBy using, a result can be easily obtained without performing a complicated calculation such as a square root. In addition, gradient table TGSince the input to is 16 bits, the table size, that is, the number of elements is “65536”, which can be sufficiently applied to the current computer.
[0065]
Gradient table T as described aboveGThus, the length lenG of the gradient G of the gradient G (= (Dx, Dy)) obtained by the gradient calculation unit 11 and the normG obtained by normalizing it are obtained. Then, normG obtained by normalizing the obtained length G of the gradient G is supplied to the inner product calculation unit 141, and the length lenG of the gradient G is supplied to the multiplier 143.
[0066]
Finally, the edge strength calculation unit 14 obtains the edge strength E (x, y) of the contour in the target pixel (x, y) as described above, the normal vector N, and the gradient table T.GWith a gradient G length lenG from, a normalized normG and a direction selection index s,
E (x, y) = lenG (normG · N)S
It is calculated by the following formula.
[0067]
That is, in the edge strength calculation unit 14, as shown in FIG. 3, first, the inner product calculation unit 141 first calculates the inner product “normG · N” of the normal vector N and the normG obtained by normalizing the length lenG of the gradient G. Is obtained by multiplication. This result is the cosine “cos θ” of the angle θ formed by the gradient G and the normal vector N.
[0068]
Next, cosine table TCUsing the supplied direction selection index s,
cosSθ
Ask for. This cosine table TCIs a table that takes the cosine “cos θ” obtained by the inner product calculation unit 141 as an input and outputs the c-th power of cosine “cos θ” as an output, and a cosine table TCCosine “cos θ” output from the S-th power (= cosSθ) is supplied to the multiplier 143. Here, in this embodiment, the direction selection index s is a fixed value set in advance, so that the cosine table TCThe input to is the result of the inner product obtained by the inner product calculation unit 141, and the cosine table TCIs a small table whose input is about 8 bits. Such a cosine table TCBy using the cosine of the cosine “cos” without performing a complicated calculationSθ ”can be easily obtained.
[0069]
Finally, the multiplier 143 performs the gradient table TGGradient G length lenG from Cosine table TCCosine raised to S-th power “cosSis multiplied by θ, and the result of multiplication is output as edge strength E. Here, the direction selection index s supplied to the edge strength calculation unit 14 is an index that determines how much it selectively reacts only to an edge in a specific direction. If the direction selection index s is larger, the directivity becomes stronger correspondingly, so that it is possible to more strongly prevent the mixing of unnecessary edges, but the desired direction, that is, the estimated edge direction and the actual edge direction are If there is a slight deviation, edge strength is attenuated. Therefore, the direction selection index s is usually set to a value between 2 and 8.
[0070]
For example, as shown in FIG. 6, when the direction selection index s increases, the edge strength E (only when the gradient G and the normal vector N are in the same direction, that is, the value of the inner product “normG · N” is close to “1”. x, y) is a large value. That is, high directivity can be obtained. When the direction selection index s is set to “1”, the same directivity as that of the above-described Robinson 3-level filter, pre-wits compass filter, and Kirsch filter can be obtained.
[0071]
The processing in step S4 as described above is performed for each pixel (x, y) on the spline curve P (t) that gives an outline. Therefore, as shown in FIG.inEdge strength image F obtained fromoutIs output (step S5).
As described above, in the present embodiment, in the process of obtaining the edge strength E, the cosine “cos θ” is obtained directly by calculating the inner product without directly obtaining the angle formed by the gradient G and the normal vector N. There is no need to perform complicated processing such as calculation of angular functions. In other words, the amount corresponding to the magnitude of the angle formed by the gradient G and the normal vector N can be calculated with a much smaller calculation amount of only two multiplications and one addition.
[0072]
Further, in the conventional edge detection method and edge detection apparatus, unnecessary mixing of the edges 221a to 221c due to the color difference in the foreground object and the intersection of the background objects shown in FIG. According to the present embodiment, the edge intensity in the direction deviated by 45 ° from the estimated edge direction can obtain 29% attenuation, and the edge intensity in the direction deviated by 60 ° can obtain only 50% attenuation. As shown in FIG. 6, when the direction selection index s is “4”, the edge strength in the direction shifted by 45 ° from the estimated edge direction is attenuated by 75%, and the strength of the edge in the direction shifted by 60 ° is 94% attenuation can be obtained. In addition, since the directions of the edges 221a to 221c that may be caused by the color change in the foreground and the background as described above are significantly different from the direction of the contour of the target object, the strong directivity as described above is used. Unnecessary edge contamination can be almost completely removed.
[0073]
Further, a tangent vector T that is an estimated value of the direction of the outline and an input image FinSince the gradient G is obtained for each pixel on the contour, an edge along the contour can be selectively detected at each point on the contour.
For example, in the image 250 shown in FIG. 5A, the normal vector N is in a direction perpendicular to the curve 270 at locations A and B where there is a color difference in the circular object 260. On the horizontal line generated by the difference in color, the gradient G is perpendicular to the horizontal line. Therefore, the angle difference between the normal vector N and the gradient G is 90 °, and the edge strength E is “0” as shown in FIG. That is, the edge in the circular object 260 is not detected. On the other hand, since the edge representing the contour is along the curve 270, the gradient G at the locations A and B is in the horizontal direction. This is in the same direction as the normal vector N. Therefore, the edge representing the contour is strongly detected. Therefore, it is possible to detect only the edge originally desired without mixing unnecessary edges 221a, 221b, and 221c as shown in FIG.
[0074]
Further, the tangent vector T, which is information for estimating the edge direction, is given as auxiliary information to the edge strength calculation unit 14 so that the edge strength calculation unit 14 reacts strongly in a specific direction, thereby eliminating unnecessary edges. Only necessary edges can be detected with a high S / N ratio without mixing.
[0075]
Further, since the direction of the edge of the target object at each position can be calculated from the outline of the contour input by the operator, only the necessary edge can be detected without increasing the amount of work for the operator. .
In the above-described embodiment, the setting value of the direction selection index s is set to a value between 2 and 8, but the accuracy of the estimated direction of the edge is further increased and a larger value is set for the direction selection index s. Also good. Thereby, directivity can be further strengthened.
[0076]
Further, the value of the direction selection index s may be changed according to the situation by inputting the value of the direction selection index s from the outside. Usually, the value of the direction selection index s suffices if it can be selected in several ways.CThe number of additional bits may be about 4 bits. Further, the value of the direction selection index s may be limited to an integer, and the calculator may calculate the power as repetition of multiplication.
[0077]
In the embodiment described above, the edge strength is obtained using the power of the cosine “cos θ”, but the output of the inner product calculation unit 141 shown in FIG. 3 is IP, and the directivity distribution function is f. (Θ)
f (cos-1IP)
And the result may be used to determine the edge strength. Thereby, for example, as shown in FIG. 8, when the angle θ between the estimated edge direction and the actual edge direction is equal to or smaller than the threshold value K, the edge strength is not attenuated and exceeds the threshold value K. In this case, directivity that sharply attenuates the edge strength can be obtained.
[0078]
More specifically, first, a desired distribution shape is defined, and the value on the horizontal axis of the graph shown in FIG. 8 is converted into cosine. Next, the decay rate for each cosine value, ie, “f (cos-1IP) "is stored in the table. This table is a cosine table T used in the above-described embodiment.CUse instead of. Therefore, the edge strength can be obtained using the distribution function f (θ).
[0079]
Further, the distribution function f (θ) may have the direction selection index s as a variable. That is, the edge strength may be obtained using the distribution function f (θs). In this case, the direction selection index s is also input to the table, and the edge strength is obtained while changing the direction selection index s.
[0080]
In the above-described embodiment, the outline of the outline is the spline curve P (t) expressed in the cubic spline format. However, the outline may be expressed in the spline format of different orders. Also, a curve expressed in an implicit form format without using the auxiliary variable t
Q (x, y) = 0
It is good.
[0081]
Alternatively, the outline image drawn by the operator may be thinned, and the edge direction may be estimated from the positional relationship between adjacent pixels. In this case, in step S3 shown in FIG. 4, the outline image is thinned, and in step S4.1 shown in FIG. 4, a plurality of pixels adjacent to the target pixel in the thinned image are displayed. The direction of the contour at that position is obtained from the pixel array.
[0082]
Further, in step S4 shown in FIG. 4, a plurality of filters that selectively react to edges in a specific direction, for example, a compass operator, are used based on the estimated direction of the edges. The edge strength may be obtained by selecting a filter having the highest detection capability in the direction from the plurality of filters.
[0083]
In the above-described embodiment, information representing the outline outline is input by the operator. However, it is also possible to detect edges continuously from a plurality of temporally continuous images, that is, moving images. .
In this case, in the process of step S2 in the flowchart shown in FIG. 4, the outline is not captured as the coordinate sequence (xn, yn), but the immediately preceding image, the immediately preceding image, The contour in the current processing target image is estimated from the edge detection result obtained from the current image and the three pieces of information on the current processing target image.
[0084]
That is, as shown in FIG. 9, first, the current processing target image FCImage F immediately beforePPixels (hereinafter referred to as marks) 31 at regular intervals on the edge 30 obtained as a result of the edge detection process for1, 312, 31Three, ... Next, each mark 311, 312, 31Three,... Are defined as small blocks each including a mark. For example, mark 311Is marked 311A small block 32 is defined. The portion having the highest correlation with the data in the small block thus determined is the image F to be processed at present.CDetect from inside by block matching process.
[0085]
In this block matching process, first, for example, the pixel value in the small block 32 and the current image F to be processed are processed.CThe block 33 having the highest correlation is detected by comparing the pixel values in the blocks having the same size and determining the height of the correlation based on the sum of the differences. At this time, the pixel 34 in the block 33 is changed to the mark 31 of the small block 32.1Is a pixel corresponding to. Mark 311Mark 31 other than2, 31Three,... In the same manner, the corresponding pixel is set as the current processing target image F.CDetect from inside.
[0086]
Therefore, in the process of step S3 of the flowchart shown in FIG. 4, the spline curve P (t) is generated using the series of corresponding pixel coordinate sequences obtained as described above.
As described above, the contour is continuously extracted from the current processing target image and the immediately preceding image by block matching processing, and edge detection is performed using the contour to automatically detect the moving image without operator intervention. The edge can be detected automatically. In this case, the block matching processing may be performed by increasing the number of images, not only the current processing target image and the previous image, but also the image used for the block matching processing. Thereby, since the calculation accuracy of the amount of movement of a block can be raised, an edge can be detected more correctly.
[0087]
Further, the key frame method may be applied to the process of step S2 in the flowchart shown in FIG. 4 for a plurality of images separated in time. That is, a method may be applied in which an operator gives an instruction of a shape for a plurality of images, and a computer substitutes an operator by interpolation for intermediate images. In this case, in the process of step S2, the operator sets a rough outline, and for an intermediate image group, a point group on the rough outline is interpolated to automatically generate a spline curve in the image. .
[0088]
As described above, by detecting edges in the current image to be processed based on a plurality of images and the result of past edge detection, the edge direction or color change can be more accurately performed using the correlation between frames. It is possible to obtain auxiliary information that is information. Therefore, the edge detection accuracy can be further improved, and the edge detection in the moving image can be performed without trouble.
[0089]
【The invention's effect】
  In the edge detection method according to the present invention,By estimation meansA curve is generated along the point group to be subjected to edge extraction processing shown in advance, and for the points existing on the generated curve,In input image dataEstimate edge direction at each positionShi,In the input image data by the gradient calculation meansEach positionofSeeking a gradient,By the gradient intensity calculation means,The estimated edge direction and,The angle formed by the gradient, the size of the gradient,The smaller the absolute value of the angle between the estimated edge direction and the gradient, the larger the value.Index that determines directivityWhen,Edge strength is calculated from the edge to detect the edge.
  Thereby, strong directivity can be obtained in edge detection, and only edges constituting the contour of the target object can be detected without mixing unnecessary edges. Therefore, the detection accuracy can be increased.
[0090]
In the edge detection method according to the present invention, the edge strength is calculated by obtaining the cosine of the angle formed by the estimated edge direction and the gradient. Thereby, the edge strength can be calculated with a small amount of calculation. Therefore, a good edge image can be easily obtained.
[0091]
  In the edge detection method according to the present invention, the edge strength is calculated from the angle between the estimated edge direction and the gradient, the magnitude of the gradient, and an index for determining the directivity. The intensity can be calculated. Therefore, a good edge image can be easily obtained.
[0092]
In the edge detection method according to the present invention, the estimated edge direction and the cosine of the angle formed by the gradient are normalized to a preliminarily normalized vector, and the length is normalized to “1”. Obtained as inner product with the gradient. Thereby, stronger directivity can be obtained, and the edge strength can be calculated with a smaller amount of calculation. Therefore, a good edge image can be obtained more easily.
[0094]
  In the edge detection apparatus according to the present invention, a curve is generated along a point group to be subjected to edge extraction processing indicated in advance, and each position in the input image data is detected with respect to a point existing on the generated curve. The edge direction is estimated by the estimation unit, and the gradient of each position in the input image data is obtained by the gradient calculation unit, the edge direction estimated by the estimation unit, the angle formed by the gradient obtained by the gradient calculation unit, and the above The edge strength is calculated by the edge strength calculation means from the gradient magnitude and the index for determining the directivity, and the edge is detected by the detection means from the edge strength obtained by the edge strength calculation means. The index takes a larger value as the absolute value of the angle formed by the estimated edge direction and the gradient is smaller.
  Thereby, strong directivity can be obtained in edge detection, and only edges constituting the contour of the target object can be detected without mixing unnecessary edges. Therefore, the edge detection accuracy can be increased.
[0095]
In the edge detection apparatus according to the present invention, the edge strength calculation means calculates the edge strength by obtaining a cosine of an angle formed by the estimated edge direction and the gradient. Thereby, the edge strength can be calculated with a small amount of calculation. Therefore, a good edge image can be easily obtained.
[0096]
  In the edge detection apparatus according to the present invention, the edge strength calculation means calculates the edge strength from the angle formed by the estimated edge direction and the gradient, the magnitude of the gradient, and an index for determining directivity. Therefore, the edge strength can be calculated with a small calculation amount. Therefore, a good edge image can be easily obtained.
[0097]
In the edge detection apparatus according to the present invention, the edge strength calculating means calculates the estimated edge direction and the length, which is a vector obtained by normalizing a cosine of an angle formed by the estimated edge direction and the gradient in advance. Obtained as an inner product with the gradient normalized to “1”. Thereby, stronger directivity can be obtained, and the edge strength can be calculated with a smaller amount of calculation. Therefore, a good edge image can be obtained more easily.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of an edge detection apparatus according to the present invention.
FIG. 2 is a block diagram illustrating a configuration of a gradient calculation unit of the edge detection apparatus.
FIG. 3 is a block diagram illustrating a configuration of an edge strength calculation unit of the edge detection device.
FIG. 4 is a flowchart showing edge detection processing in the edge detection apparatus.
FIG. 5 is a diagram for explaining a curve that gives a rough outline;
FIG. 6 is a graph showing a relationship between a direction selection index and edge strength.
FIG. 7 is a diagram for explaining a relationship between an input image and an edge strength image.
FIG. 8 is a diagram for explaining a case where edge strength is obtained using a directivity distribution function.
FIG. 9 is a diagram for explaining block matching processing;
FIG. 10 is a schematic diagram illustrating a Sobel filter for detecting an edge in a specific direction.
FIG. 11 is a diagram for explaining a result when edge detection is performed on an image having a color difference inside an object using a conventional edge detection method;
FIG. 12 is a diagram for explaining a result when edge detection is performed on an image having a color difference inside an object using a conventional edge detection method using an outline of an outline input by an operator.
FIG. 13 is a schematic diagram illustrating a Robinson 3-level filter group for detecting an edge in a specific direction.
FIG. 14 is a diagram for explaining a comparison between directivity in a conventional edge detection method and directivity necessary for practical use.
[Explanation of symbols]
10 Edge detection device
11 Gradient calculator
12 Spline curve generator
13 Parameter coordinate generator
14 Edge strength calculator

Claims (8)

濃淡データで構成される入力画像データの中から、画素値が周囲と比べて急峻に変化している画素群をエッジとして検出するエッジ検出方法であって、
推定手段により、あらかじめ示されているエッジ抽出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定する推定工程と
グラディエント算出手段により、入力画像データにおける各位置グラディエントを求めるグラディエント算出工程と
エッジ強度算出手段により、上記推定工程で推定したエッジ方向と上記グラディエント算出工程で得られたグラディエントのなす角度と、上記グラディエントの大きさと、上記推定したエッジ方向と上記グラディエントとのなす角度の絶対値が小さいほど大きい値をとる指向性を決定する指数と、からエッジ強度を算出してエッジを検出するエッジ強度算出工程とからなることを特徴とするエッジ検出方法。
An edge detection method for detecting, as an edge, a pixel group in which pixel values change sharply compared to surroundings from input image data composed of grayscale data,
The estimation means generates a curve along the point group to be subjected to edge extraction processing indicated in advance, and estimates the edge direction of each position in the input image data with respect to a point existing on the generated curve. An estimation process ;
The gradient calculation unit, a gradient calculation step asking you to gradient at each location in the input image data,
The edge strength calculating unit, the edge direction estimated by the estimation process, the angle of the gradient obtained in the gradient calculation step, the magnitude of the gradient, the absolute of the angle between the estimated edge direction and the gradient An edge detection method comprising: an index for determining directivity that takes a larger value as the value is smaller; and an edge strength calculation step of calculating an edge strength from the index and detecting an edge .
上記推定したエッジ方向と上記グラディエントのなす角度のコサインを求めてエッジ強度を算出することを特徴とする請求項1記載のエッジ検出方法。  2. The edge detection method according to claim 1, wherein an edge intensity is calculated by obtaining a cosine of an angle formed by the estimated edge direction and the gradient. 上記推定したエッジ方向と上記グラディエントのなす方向のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求めることを特徴とする請求項1記載のエッジ検出方法。  The cosine of the estimated edge direction and the direction formed by the gradient is obtained as an inner product of the estimated edge direction which is a vector normalized in advance and the gradient whose length is normalized to “1”. The edge detection method according to claim 1. 上記曲線は、スプライン曲線であることを特徴とする請求項1に記載のエッジ検出方法。  The edge detection method according to claim 1, wherein the curve is a spline curve. 濃淡データで構成される入力画像データの中から、画素値が周囲と比べて急峻に変化している画素群をエッジとして検出するエッジ検出装置であって、
あらかじめ示されているエッジ検出処理対象の点群に沿うように曲線を発生させ、発生させた曲線上に存在する点に対して、入力画像データにおける各位置のエッジ方向を推定する推定手段と、
入力画像データにおける各位置のグラディエントを求めるグラディエント算出手段と、
上記推定手段で推定したエッジ方向と、上記グラディエント算出手段で得られたグラディエントのなす角度と、上記グラディエントの大きさと、指向性を決定する指数から、エッジ強度を算出するエッジ強度算出手段と、
上記エッジ強度算出手段で得られたエッジ強度からエッジを検出する検出手段とを備え、
上記指数は、上記推定したエッジ方向と上記グラディエントのなす角度の絶対値が小さいほど、大きい値をとることを特徴とするエッジ検出装置。
An edge detection device that detects, as an edge, a pixel group in which pixel values change sharply compared to surroundings from input image data composed of grayscale data,
An estimation means for generating a curve along a point group to be subjected to edge detection processing shown in advance, and estimating an edge direction at each position in the input image data with respect to a point existing on the generated curve;
A gradient calculating means for obtaining a gradient of each position in the input image data;
Edge strength calculating means for calculating edge strength from an edge direction estimated by the estimating means, an angle formed by the gradient obtained by the gradient calculating means, a magnitude of the gradient, and an index for determining directivity;
Detecting means for detecting an edge from the edge strength obtained by the edge strength calculating means,
The edge detection apparatus according to claim 1, wherein the index takes a larger value as an absolute value of an angle formed by the estimated edge direction and the gradient is smaller.
上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを求めてエッジ強度を算出することを特徴とする請求項5記載のエッジ検出装置。  6. The edge detection apparatus according to claim 5, wherein the edge strength calculating means calculates an edge strength by obtaining a cosine of an angle formed by the estimated edge direction and the gradient. 上記エッジ強度算出手段は、上記推定したエッジ方向と上記グラディエントのなす角度のコサインを、予め正規化したベクトルである上記推定したエッジ方向と、長さを「1」に正規化した上記グラディエントとの内積として求めることを特徴とする請求項5記載のエッジ検出装置。  The edge intensity calculating means includes a vector obtained by normalizing a cosine of an angle formed by the estimated edge direction and the gradient in advance, and the estimated edge direction and the gradient having a length normalized to “1”. 6. The edge detection device according to claim 5, wherein the edge detection device is obtained as an inner product. 上記曲線は、スプライン曲線であることを特徴とする請求項5記載のエッジ検出装置。  6. The edge detection apparatus according to claim 5, wherein the curve is a spline curve.
JP13441895A 1995-05-31 1995-05-31 Edge detection method and edge detection apparatus Expired - Fee Related JP3826412B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13441895A JP3826412B2 (en) 1995-05-31 1995-05-31 Edge detection method and edge detection apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13441895A JP3826412B2 (en) 1995-05-31 1995-05-31 Edge detection method and edge detection apparatus

Publications (2)

Publication Number Publication Date
JPH08329252A JPH08329252A (en) 1996-12-13
JP3826412B2 true JP3826412B2 (en) 2006-09-27

Family

ID=15127930

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13441895A Expired - Fee Related JP3826412B2 (en) 1995-05-31 1995-05-31 Edge detection method and edge detection apparatus

Country Status (1)

Country Link
JP (1) JP3826412B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10311546B2 (en) * 2015-12-21 2019-06-04 Canon Kabushiki Kaisha Edge detection apparatus and edge detection method

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6647146B1 (en) 1997-08-05 2003-11-11 Canon Kabushiki Kaisha Image processing apparatus
GB2328355B (en) * 1997-08-05 2002-04-17 Canon Kk Image processing apparatus
US7400766B1 (en) * 2004-02-19 2008-07-15 The United States Of America As Represented By The Administrator Of The National Aeronautics And Space Administration Image edge extraction via fuzzy reasoning
JP4576358B2 (en) * 2006-06-27 2010-11-04 富士通株式会社 Character image processing apparatus and character image processing method
JP2009116464A (en) * 2007-11-02 2009-05-28 Hitachi Software Eng Co Ltd Outline information generation method, system, and program
JP5356728B2 (en) 2008-05-26 2013-12-04 株式会社トプコン Edge extraction device, surveying instrument, and program
JP6037791B2 (en) 2012-11-16 2016-12-07 三菱重工メカトロシステムズ株式会社 Image recognition apparatus, image recognition method, program, and recording medium
JP6230748B2 (en) 2015-02-26 2017-11-15 三菱電機株式会社 Image processing device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10311546B2 (en) * 2015-12-21 2019-06-04 Canon Kabushiki Kaisha Edge detection apparatus and edge detection method

Also Published As

Publication number Publication date
JPH08329252A (en) 1996-12-13

Similar Documents

Publication Publication Date Title
US7342572B2 (en) System and method for transforming an ordinary computer monitor into a touch screen
US6249285B1 (en) Computer assisted mark-up and parameterization for scene analysis
CN106251353A (en) Weak texture workpiece and the recognition detection method and system of three-dimensional pose thereof
CN109034017A (en) Head pose estimation method and machine readable storage medium
WO2001026050A2 (en) Improved image segmentation processing by user-guided image processing techniques
CN105894521A (en) Sub-pixel edge detection method based on Gaussian fitting
KR100326702B1 (en) Method for calculating road width of the alarm device for lane beyond
JPH0935061A (en) Image processing method
JP3826412B2 (en) Edge detection method and edge detection apparatus
CN115096206B (en) High-precision part size measurement method based on machine vision
CN114445482A (en) Method and system for detecting target in image based on Libra-RCNN and elliptical shape characteristics
US5621825A (en) Image processor, image processing method and apparatus applying same
CN109872343B (en) Weak texture object posture tracking method, system and device
JP3659426B2 (en) Edge detection method and edge detection apparatus
JPH08249471A (en) Moving picture processor
Dryanovski et al. Real-time pose estimation with RGB-D camera
JP2003143401A (en) Automatic real time recovering method of original image
JPH08329253A (en) Method and device for detecting edge
Trang et al. Irregular moving object detecting and tracking based on color and shape in real-time system
JP2981382B2 (en) Pattern matching method
JP4639044B2 (en) Contour shape extraction device
US7386169B2 (en) Method for edge detection and contour stroke generation
CN111951303A (en) Robot motion attitude visual estimation method
CN116309758B (en) OpenCV-based line laser image automatic alignment method and terminal equipment
CN112669337A (en) Self-iterative local green curtain image matting method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050128

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050201

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050404

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20051004

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051205

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060214

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060413

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060626

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

Free format text: PAYMENT UNTIL: 20090714

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20100714

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100714

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110714

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20120714

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees