JP2014102712A - Contour detection device, contour detection method, and contour detection program - Google Patents
Contour detection device, contour detection method, and contour detection program Download PDFInfo
- Publication number
- JP2014102712A JP2014102712A JP2012254804A JP2012254804A JP2014102712A JP 2014102712 A JP2014102712 A JP 2014102712A JP 2012254804 A JP2012254804 A JP 2012254804A JP 2012254804 A JP2012254804 A JP 2012254804A JP 2014102712 A JP2014102712 A JP 2014102712A
- Authority
- JP
- Japan
- Prior art keywords
- pixel
- area
- search
- edge
- region
- 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.)
- Granted
Links
Images
Landscapes
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
Description
本発明は、輪郭検出装置、輪郭検出方法および輪郭検出プログラムに関する。 The present invention relates to a contour detection device, a contour detection method, and a contour detection program.
写真などの画像から画像処理によって特定の物体の輪郭を検出する技術が知られている。このような技術は、例えば、人の輪郭を検出して、輪郭外の背景画像を消去する、あるいは差し替えることなどに利用されている。 A technique for detecting the contour of a specific object from an image such as a photograph by image processing is known. Such a technique is used, for example, for detecting the contour of a person and erasing or replacing a background image outside the contour.
また、人などの所望の物体の輪郭を正確に検出するための技術として、輪郭を検出させる領域をマウスなどの入力デバイスを用いてユーザに指定させ、輪郭の検出範囲を指定された領域またはその近傍領域に限定する技術がある。例えば、ユーザ操作によって指定された始点と終点との間において、終点に向かってエッジ検出強度の大きい画素を探索していく方法がある。また、ユーザ操作によって指定された帯状領域において、その中心線と交差する幅方向に画素を走査することで輪郭点を探索する方法もある。 In addition, as a technique for accurately detecting the contour of a desired object such as a person, the user can specify an area for detecting the contour using an input device such as a mouse, There is a technique for limiting to a nearby region. For example, there is a method of searching for a pixel having a high edge detection intensity toward the end point between the start point and the end point specified by the user operation. There is also a method for searching for a contour point by scanning a pixel in a width direction intersecting with the center line in a belt-like region designated by a user operation.
輪郭を検出させる領域をユーザに指定させ、指定された領域を始点側から終点側にエッジを探索する方法でも、人の輪郭を正確に検出できない場合がある。例えば、顔が正面を向いた状態での耳の近傍では、耳より顔の内側の領域に髪がかかっていることがある。この場合、耳の外縁部よりも髪の領域の外縁部の方が強いエッジと判断されて、耳より内側にある髪の領域の外縁部が輪郭として誤検出されることがある。 There are cases where the contour of a person cannot be accurately detected even by a method in which the user designates a region for detecting the contour and searches for the edge in the designated region from the start point side to the end point side. For example, in the vicinity of the ear with the face facing forward, hair may be applied to the area inside the face from the ear. In this case, the outer edge of the hair region is determined to be stronger than the outer edge of the ear, and the outer edge of the hair region inside the ear may be erroneously detected as a contour.
1つの側面では、本発明は、人の輪郭を高精度で検出可能な輪郭検出装置、輪郭検出方法および輪郭検出プログラムを提供することを目的とする。 In one aspect, an object of the present invention is to provide a contour detection device, a contour detection method, and a contour detection program capable of detecting a human contour with high accuracy.
1つの案では、次のような輪郭検出装置が提供される。この輪郭検出装置は、入力受付手段および探索手段を有する。入力受付手段は、入力操作に応じて、開始領域から終了領域に向かって延伸された、一定以上の幅を有する探索領域を、入力画像上に設定する。探索手段は、探索領域において開始領域側から終了領域側に向かってエッジを探索する。また、探索手段は、探索領域内の画素のうち、肌色領域と肌色領域とに挟まれた領域に位置すると判定された画素を、エッジと判定する画素から除外する。 In one proposal, the following contour detection apparatus is provided. This contour detection apparatus has an input reception unit and a search unit. The input receiving unit sets a search area having a certain width or more on the input image that is extended from the start area to the end area in response to an input operation. The search means searches for an edge in the search area from the start area side to the end area side. Further, the search means excludes pixels determined to be located in an area sandwiched between the skin color area and the skin color area from the pixels determined to be edges among the pixels in the search area.
また、1つの案では、上記の輪郭検出装置と同様の処理が実行される輪郭検出方法、および、上記の輪郭検出装置と同様の処理をコンピュータに実行させる輪郭検出プログラムが提供される。 Further, in one proposal, there are provided a contour detection method in which processing similar to that in the above contour detection device is executed, and a contour detection program for causing a computer to execute processing similar to that in the above contour detection device.
1態様によれば、人の輪郭を高精度で検出できる。 According to one aspect, the contour of a person can be detected with high accuracy.
以下、本発明の実施の形態について図面を参照して説明する。
〔第1の実施の形態〕
図1は、第1の実施の形態に係る輪郭検出装置の構成例および処理例を示す図である。図1の輪郭検出装置1は、入力画像から物体の輪郭線を検出する処理を実行する装置であり、入力受付手段2および探索手段3を有する。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[First Embodiment]
FIG. 1 is a diagram illustrating a configuration example and a processing example of the contour detection apparatus according to the first embodiment. The
なお、入力受付手段2および探索手段3の各処理は、例えば、輪郭検出装置1が備えるプロセッサが所定のプログラムを実行することで実現される。あるいは、入力受付手段2および探索手段3の処理の少なくとも一部は、専用回路によって実現されてもよい。
Each process of the
入力受付手段2は、ユーザの入力操作に応じて、エッジを探索するための探索領域を入力画像上に設定する。探索領域は、開始領域から終了領域に向かって延伸された、一定以上の幅を有する領域である。図1では、開始領域11から終了領域12に向かって緩やかに湾曲した探索領域10の例を示している。
The
探索領域は、できるだけ簡易な操作によって設定できることが望ましい。探索領域の設定方法の例としては、ユーザが画面上の指示位置を連続的に移動させる操作を行うと、その移動軌跡に沿って一定の幅の探索領域が設定されるという方法が考えられる。この場合の指示位置とは、例えば、マウスカーソルの位置や、タッチパネルに対する接触位置とすることができる。また、類似する例として、ユーザが一定の大きさのアイコン画像を移動させる操作を行うと、アイコン画像が移動した領域が探索領域に設定されるという方法も考えられる。 It is desirable that the search area can be set by a simple operation as much as possible. As an example of the search area setting method, a method in which a search area having a certain width is set along the movement locus when the user performs an operation of continuously moving the designated position on the screen may be considered. In this case, the designated position can be, for example, the position of the mouse cursor or the touch position on the touch panel. As a similar example, a method in which when the user performs an operation of moving an icon image having a certain size, a region where the icon image has moved can be set as a search region.
探索手段3は、設定された探索領域において開始領域側から終了領域側に向かってエッジを探索する。
例えば、探索手段3は、探索領域において、その開始領域のいずれかの画素を起点として着目画素を設定し、着目画素の周囲画素のうち、着目画素の位置での探索領域の延伸方向を含む所定のエッジ探索範囲に含まれる画素をエッジ候補画素とする。探索手段3は、エッジ候補画素からエッジである可能性が高い画素を判定して次の着目画素に設定し、同様の処理を行う。探索手段3は、このようなエッジ探索処理を、着目画素が終了領域に達するまで繰り返す。これにより、設定された着目画素群が輪郭線として検出される。
The search means 3 searches for an edge from the start area side to the end area side in the set search area.
For example, the
図1には、画素21を着目画素に設定した場合が例示されており、このとき、画素21の位置での探索領域10の延伸方向A1を含むエッジ探索範囲B1が設定される。探索手段3は、例えば、画素21の周囲画素のうちエッジ探索範囲B1に含まれる画素をエッジ候補画素とする。エッジ探索範囲B1は、例えば、延伸方向A1の角度を略中心とした所定角度の範囲として設定される。探索手段3は、エッジ候補画素の中でエッジである可能性が最も高い画素を画素22と判定した場合には、画素22を次の着目画素に設定する。
FIG. 1 illustrates the case where the
このように、探索領域において開始領域側から終了領域側に向かってエッジが探索されることにより、探索領域の延伸方向から大きく外れた方向に伸びる輪郭線が検出されにくくなる。このため、所望の輪郭線に沿って探索領域が設定されるようにユーザが操作することで、探索領域に沿って伸びている輪郭線、すなわちユーザが意図する輪郭線を精度よく検出できるようになる。 Thus, by searching for an edge from the start area side to the end area side in the search area, it is difficult to detect a contour line extending in a direction greatly deviating from the extending direction of the search area. For this reason, it is possible to accurately detect the contour line extending along the search region, that is, the contour line intended by the user, by the user's operation so that the search region is set along the desired contour line. Become.
ところで、人の輪郭線、特に人の頭部の輪郭線が、肌色領域と肌色領域とに挟まれた領域に位置することは、通常は考えられない。そこで、探索手段3は、探索領域内の画素のうち、肌色領域と肌色領域とに挟まれた領域に位置すると判定された画素を、エッジと判定する画素から除外する。これにより、人の輪郭線が誤検出される可能性が低減され、検出精度が向上する。 By the way, it is not usually considered that the contour line of a person, particularly the contour line of the human head, is located in a region sandwiched between the skin color region and the skin color region. Therefore, the search means 3 excludes pixels determined to be located in an area sandwiched between the skin color area and the skin color area from the pixels determined to be edges from among the pixels in the search area. Thereby, the possibility that a human outline is erroneously detected is reduced, and the detection accuracy is improved.
例えば、探索手段3が、図1の画素23を着目画素に設定したものとする。また、画素23に対応するエッジ探索範囲B2が、画素23での探索領域10の延伸方向A2を含むように設定され、このエッジ探索範囲B2に位置する画素の1つである画素24が、肌色領域31と肌色領域32とに挟まれた領域33に位置するものとする。この場合、探索手段3は、たとえ画素24がエッジ探索画素のうちエッジである可能性が最も高いとしても、この画素24をエッジ探索候補から除外する。すなわち、画素24は、次の着目画素として設定されなくなる。
For example, it is assumed that the
前述のように、人の輪郭線が肌色領域と肌色領域とに挟まれた領域に位置することは、通常は考えられない。このため、仮に、探索手段3が肌色領域と肌色領域とに挟まれた領域を次の着目画素に設定した場合、設定した着目画素は人の輪郭線に沿っているとは考えにくく、誤検出が発生した可能性が高い。従って、探索手段3は、このような領域に位置する画素をエッジ候補画素から除外することで、人の輪郭線の誤検出が発生する可能性を低減でき、人の輪郭線の検出精度を向上させることができる。 As described above, it is not normally considered that a person's outline is located in a region sandwiched between a skin color region and a skin color region. For this reason, if the search means 3 sets a region sandwiched between the skin color region and the skin color region as the next pixel of interest, it is unlikely that the set pixel of interest is along the contour of the person. Is likely to have occurred. Therefore, the search means 3 can reduce the possibility of erroneous detection of the human outline by excluding the pixels located in such a region from the edge candidate pixels, and improve the detection accuracy of the human outline. Can be made.
肌色領域と肌色領域との間の領域が次の着目画素として誤って設定されるケースとしては、例えば、顔が正面を向いた状態において、耳が露出しており、耳と顔との間の領域に頭髪がかかっているケースがある。あるいは、頭髪の一部が顔の外縁部より内側にかかっているケースも考えられる。上記の輪郭検出装置1によれば、このようなケースにおける人の輪郭線の誤検出の発生可能性を低減できる。
As a case where the area between the flesh color area and the flesh color area is erroneously set as the next pixel of interest, for example, when the face is facing the front, the ear is exposed and the area between the ear and the face is There are cases where the area is covered with hair. Alternatively, there may be a case where a part of the hair is on the inner side of the outer edge of the face. According to the
また、上記のように画素をエッジと判定する画素から除外する代わりに、人の輪郭線の形状に正確に沿って探索領域が設定されるようにユーザが操作することで、エッジの検出精度は向上する。しかしながら、例えば耳の外縁部の形状に沿って探索領域が設定されるようにユーザが操作することは、大きな手間を必要とし、ユーザの作業効率を低下させる。 Also, instead of excluding the pixel from the pixel that is determined to be an edge as described above, the user can operate the search area so that the search area is set along the shape of the outline of the person, so that the edge detection accuracy is improves. However, for example, if the user operates the search area so as to be set along the shape of the outer edge of the ear, a large amount of labor is required and the user's work efficiency is reduced.
本実施の形態の輪郭検出装置1によれば、耳の近傍領域においても、耳の外縁部の形状に正確に沿わせずに、頭部全体についての大まかな輪郭線に沿うように探索領域が設定されることで、耳の外縁部が輪郭線として検出されるようになる。すなわち、人の輪郭検出を高精度かつ高効率で実行可能になる。
According to the
なお、探索手段3は、画素が肌色領域と肌色領域とに挟まれた領域に位置するかの判定処理を、例えば、その画素を挟む両側の領域の色情報を基に行ってもよいが、他の方法として例えば、入力画像からの顔の検出結果を基に次のように行ってもよい。探索手段3は、検出された顔の位置と、判定対象とする画素との位置関係に基づいて、判定対象の画素よりも検出された顔の外側方向に肌色領域が存在するかを判定する。探索手段3は、外側方向に肌色領域が存在すると判定した場合に、判定対象画素は肌色領域と肌色領域とに挟まれた領域に位置するとみなし、その画素をエッジ候補画素から除外する。
Note that the
〔第2の実施の形態〕
次に、入力画像から人の顔を検出する機能を備えた輪郭検出装置の例について説明する。図2は、第2の実施の形態に係る輪郭検出装置のハードウェア構成例を示す図である。輪郭検出装置100は、例えば、図2に示すようなコンピュータとして実現される。
[Second Embodiment]
Next, an example of a contour detection apparatus having a function of detecting a human face from an input image will be described. FIG. 2 is a diagram illustrating a hardware configuration example of the contour detection apparatus according to the second embodiment. The contour detection apparatus 100 is realized as a computer as shown in FIG. 2, for example.
輪郭検出装置100は、プロセッサ101によって装置全体が制御されている。プロセッサ101には、バス109を介してRAM(Random Access Memory)102と複数の周辺機器が接続されている。プロセッサ101は、マルチプロセッサであってもよい。プロセッサ101は、例えばCPU(Central Processing Unit)、MPU(Micro Processing Unit)、DSP(Digital Signal Processor)、ASIC(Application Specific Integrated Circuit)、またはPLD(Programmable Logic Device)である。またプロセッサ101は、CPU、MPU、DSP、ASIC、PLDのうちの2以上の要素の組み合わせであってもよい。
The entire contour detection apparatus 100 is controlled by a
RAM102は、輪郭検出装置100の主記憶装置として使用される。RAM102には、プロセッサ101に実行させるOS(Operating System)のプログラムやアプリケーションプログラムの少なくとも一部が一時的に格納される。また、RAM102には、プロセッサ101による処理に必要な各種データが格納される。
The
バス109に接続されている周辺機器としては、例えば、HDD(Hard Disk Drive)103、グラフィック処理装置104、入力インタフェース105、光学ドライブ装置106、機器接続インタフェース107およびネットワークインタフェース108がある。
Examples of peripheral devices connected to the
HDD103は、内蔵したディスクに対して磁気的にデータの書き込みおよび読み出しを行う。HDD103は、輪郭検出装置100の補助記憶装置として使用される。HDD103には、OSのプログラム、アプリケーションプログラム、および各種データが格納される。なお、補助記憶装置としては、SSD(Solid State Drive)などの他の種類の不揮発性記憶装置を使用することもできる。
The
グラフィック処理装置104には、モニタ104aが接続されている。グラフィック処理装置104は、プロセッサ101からの命令に従って、画像をモニタ104aの画面に表示させる。モニタ104aとしては、CRT(Cathode Ray Tube)を用いた表示装置や液晶表示装置などがある。
A monitor 104 a is connected to the
入力インタフェース105には、キーボード105aとマウス105bとが接続されている。入力インタフェース105は、キーボード105aやマウス105bから送られてくる信号をプロセッサ101に送信する。なお、マウス105bは、ポインティングデバイスの一例であり、他のポインティングデバイスを使用することもできる。他のポインティングデバイスとしては、タッチパネル、タブレット、タッチパッド、トラックボールなどがある。
A keyboard 105 a and a mouse 105 b are connected to the
光学ドライブ装置106は、レーザ光などを利用して、光ディスク106aに記録されたデータの読み取りを行う。光ディスク106aは、光の反射によって読み取り可能なようにデータが記録された可搬型の記録媒体である。光ディスク106aには、DVD(Digital Versatile Disc)、DVD−RAM、CD−ROM(Compact Disc Read Only Memory)、CD−R(Recordable)/RW(ReWritable)などがある。
The
機器接続インタフェース107は、輪郭検出装置100に周辺機器を接続するための通信インタフェースである。例えば機器接続インタフェース107には、メモリ装置107aやメモリリーダライタ107bを接続することができる。メモリ装置107aは、機器接続インタフェース107との通信機能を搭載した記録媒体である。メモリリーダライタ107bは、メモリカード107cへのデータの書き込み、またはメモリカード107cからのデータの読み出しを行う装置である。メモリカード107cは、カード型の記録媒体である。
The
ネットワークインタフェース108は、ネットワーク108aに接続されている。ネットワークインタフェース108は、ネットワーク108aを介して、他のコンピュータまたは通信機器との間でデータの送受信を行う。
The
以上のようなハードウェア構成によって、第2の実施の形態の処理機能を実現することができる。なお、第1の実施の形態に示した輪郭検出装置1も、図2に示した輪郭検出装置100と同様のハードウェアにより実現することができる。
With the hardware configuration described above, the processing functions of the second embodiment can be realized. Note that the
図3は、輪郭検出装置が備える処理機能の構成例を示すブロック図である。輪郭検出装置100は、ユーザの入力操作に応じて入力画像上に設定された、一定以上の幅を有する探索領域において、その探索領域の延伸方向に対してエッジ強度が大きい画素を順次探索していくことで、入力画像上の人の輪郭線を検出する。特に、輪郭検出装置100は、顔が正面を向いた人の頭部近傍の輪郭線を高精度に検出可能とするものである。また、探索領域は、所定の大きさのアイコン画像をユーザがドラッグ操作により移動させる操作を行ったときに、アイコン画像が移動した領域として設定されるものとする。 FIG. 3 is a block diagram illustrating a configuration example of processing functions included in the contour detection apparatus. The contour detection apparatus 100 sequentially searches for pixels having a large edge strength with respect to the extending direction of the search region in a search region set on the input image in accordance with the input operation of the user and having a certain width or more. As a result, the outline of the person on the input image is detected. In particular, the contour detection apparatus 100 is capable of detecting a contour line near the head of a person whose face is facing the front with high accuracy. The search area is set as an area where the icon image has moved when the user performs an operation of moving an icon image of a predetermined size by a drag operation.
輪郭検出装置100は、画像読み込み部111、顔検出部112、トレース入力部113および輪郭検出部114を有する。画像読み込み部111、顔検出部112、トレース入力部113および輪郭検出部114の各処理は、プロセッサ101が所定のプログラムを実行することで実現される。ただし、これらの処理の少なくとも一部が、例えばグラフィック処理装置104内の回路などの専用回路によって実現されてもよい。
The contour detection apparatus 100 includes an
また、輪郭検出装置100の記憶装置には、顔位置情報121、トレース領域情報122、探索範囲情報123および座標リスト124が記憶される。これらの情報のうち、探索範囲情報123は、HDD103などの不揮発性記憶装置にあらかじめ記憶される。一方、顔位置情報121、トレース領域情報122および座標リスト124は、少なくとも、RAM102などの揮発性記憶装置に一時的に記憶される。
The storage device of the contour detection apparatus 100 stores face
画像読み込み部111は、人が映った入力画像を、HDD103などの輪郭検出装置100に接続された不揮発性記憶装置や、ネットワーク108a上の情報処理装置などからRAM102へ読み込む。本実施の形態では、入力画像には、少なくとも、顔が略正面を向いた人の頭部が映っているものとする。
The
顔検出部112は、入力画像から人の顔を検出し、検出された顔の位置を示す顔位置情報121を設定する。顔位置情報121は、着目画素が顔の右側または左側のどちらに位置するかを判定するための情報であり、例えば、水平方向(y方向)に対する顔の中心を示す座標が設定される。
The
トレース入力部113は、所定の大きさのアイコン画像をユーザがドラッグ操作により移動させる「トレース操作」を行ったとき、アイコン画像が移動した領域を探索領域に設定する。以下、アイコン画像が移動した領域を「トレース領域」と呼ぶ。トレース領域を示す情報は、トレース領域情報122としてRAM102に記憶される。
When the user performs a “trace operation” in which an icon image of a predetermined size is moved by a drag operation, the
トレース入力部113は、設定したトレース領域内の画素のそれぞれについて、「トレース方向角度」を算出し、算出したトレース方向角度を各画素に対応付けてトレース領域情報122に登録する。トレース方向角度は、画素ごとにエッジ探索のための進行可能方向を判定するための基準角度である。トレース方向角度の詳細については後述する。
The
探索範囲情報123には、トレース方向角度ごとに、エッジ探索を行う範囲を示すエッジ探索範囲が対応付けて記憶されている。
輪郭検出部114は、トレース領域における開始領域から終了領域に向かって、エッジ強度が大きい画素を順次辿っていくことで、輪郭線を検出する。このようなエッジ探索処理において、輪郭検出部114は、顔位置情報121、トレース領域情報122および探索範囲情報123を参照する。輪郭検出部114は、着目画素を設定するたびに、その着目画素の座標を座標リスト124に登録する。そして、エッジ探索処理が終了すると、座標リスト124は検出された輪郭線を示す情報として出力される。
The
The
また、輪郭検出部114は、着目画素の周囲画素からエッジ強度が最も大きい画素を選択したとき、選択した画素の位置でのトレース方向と、選択した画素と顔との位置関係とに基づいて、選択した画素について、本来あるべきでない方向に肌色領域があるかを判定する。輪郭検出部114は、あるべきでない方向に肌色領域がある場合には、選択した画素を次の着目画素に設定せずに、エッジと判定する画素から除外する。これにより、耳の近傍領域や頭髪を含む領域でも、人の輪郭線を正確に検出できるようにする。
In addition, when the
次に、輪郭検出装置100の基本的な輪郭検出処理手順について説明する。基本的な輪郭検出処理は、次のような処理ステップを含む。
(1)トレース操作に応じてトレース領域を設定する。
Next, a basic contour detection processing procedure of the contour detection apparatus 100 will be described. The basic contour detection process includes the following processing steps.
(1) Set the trace area according to the trace operation.
(2)トレース領域の各画素について、トレース方向角度を算出する。
(3)トレース領域の開始領域内のいずれかの画素を着目画素に設定し、着目画素がトレース領域の終了領域に達するまで、次の(3−1)〜(3−3)を繰り返す。
(2) The trace direction angle is calculated for each pixel in the trace area.
(3) Any pixel in the start area of the trace area is set as the target pixel, and the following (3-1) to (3-3) are repeated until the target pixel reaches the end area of the trace area.
(3−1)着目画素についてのトレース方向角度に対応するエッジ探索範囲を、探索範囲情報123を基に判別する。
(3−2)着目画素の周囲画素のうちエッジ探索範囲に含まれる画素をエッジ候補画素とし、各エッジ候補画素のエッジ強度を算出する。
(3-1) The edge search range corresponding to the trace direction angle for the target pixel is determined based on the
(3-2) The pixels included in the edge search range among the surrounding pixels of the target pixel are set as edge candidate pixels, and the edge strength of each edge candidate pixel is calculated.
(3−3)エッジ強度が最も大きいエッジ候補画素を次の着目画素に設定する。
なお、トレース方向角度の算出は、(2)の時点でトレース領域内の全画素について行われるのではなく、(3−1)の時点で、設定された着目画素について行われてもよい。
(3-3) The edge candidate pixel having the highest edge strength is set as the next pixel of interest.
The calculation of the trace direction angle is not performed for all the pixels in the trace area at the time (2), but may be performed for the set target pixel at the time (3-1).
以下、図4〜図9を用いて、上記の(1)〜(3)の処理について説明する。
まず、図4は、トレース操作実行時における状態遷移の例を示す図である。この図4を用いて、トレース操作およびトレース領域について説明する。
Hereinafter, the processes (1) to (3) will be described with reference to FIGS.
First, FIG. 4 is a diagram illustrating an example of state transition at the time of executing a trace operation. The trace operation and the trace area will be described with reference to FIG.
本実施の形態では例として、ユーザは、トレース領域を指定するためのトレース操作を、マウスを用いて行うものとする。そして、ユーザが、矩形のアイコン画像201をドラッグ操作により移動させることで、トレース領域210が設定されるものとする。
In this embodiment, as an example, it is assumed that the user performs a trace operation for designating a trace area using a mouse. Then, it is assumed that the
図4において、トレース領域210は、破線によって囲まれた領域である。また、図4中の点線矢印は、アイコン画像201の中心点が移動した軌跡を示し、以下、この軌跡を「トレース領域の中心線」と呼ぶ。
In FIG. 4, a
図4の状態1のように、ユーザが、マウスカーソルを入力画像200上の所望の位置に配した状態でマウスボタンを押下すると、マウスカーソルの位置にアイコン画像201が表示される。なお、アイコン画像201は、マウスボタン押下の前からマウスカーソルの位置に表示されていてもよい。
When the user presses the mouse button with the mouse cursor placed at a desired position on the
ユーザが、マウスボタンを押下したままでマウスを動かして画面上の指示位置を移動させると、その移動に伴ってアイコン画像201も移動する。このとき、図4の状態2のように、アイコン画像201が移動した領域がトレース領域210に設定されるとともに、設定されたトレース領域210が画面上に識別可能な状態で表示される。その後、ユーザが所望の位置でマウスボタンの押下を終了すると、図4の状態3に示すように、トレース領域210の設定が完了する。
When the user moves the designated position on the screen by moving the mouse while holding down the mouse button, the
人の頭部の輪郭線を検出させる場合、ユーザは、アイコン画像201の内部に常に入力画像200上の人の頭部の輪郭が含まれるように、アイコン画像201を移動させればよい。
When detecting the outline of the human head, the user may move the
なお、タッチパネルが用いられる場合、ユーザは例えば、入力画像200上の所望の位置に指を接触させ、指が接触された状態を保ったまま接触位置を移動させ、その後、所望の位置で指を離す、という操作により、トレース領域210を指定することができる。
When the touch panel is used, for example, the user touches the finger at a desired position on the
また、図4の例では、アイコン画像201が移動した領域がトレース領域210に設定されているが、その他に例えば、マウスカーソルの軌跡または指の接触位置の軌跡を中心とした一定幅の領域が、トレース領域210に設定されてもよい。
In the example of FIG. 4, the area where the
また、アイコン画像201の形状は、図4のような矩形に限らない。
ところで、後述するように、エッジ探索の始点および終点を判別するために、トレース領域210の開始領域および終了領域が設定される。開始領域としては、トレース領域210の始点側の端部に隣接する複数画素が設定され、終了領域としては、トレース領域210の終点側の端部に隣接する複数画素が設定される。
Further, the shape of the
By the way, as will be described later, a start area and an end area of the
図4のように矩形のアイコン画像201が用いられる場合、例えば、開始領域としては、トレース領域210においてアイコン画像201が最初に配置された領域のうち、端部に面する1辺または2辺の画素が設定される。アイコン画像201が初期位置から左右方向(x軸方向)または上下方向(y軸方向)に移動した場合、開始領域としては、端部に面する1辺の画素が設定される。一方、アイコン画像201が初期位置から斜めに移動した場合、開始領域としては、端部に面する2辺の画素が設定される。図4は後者の例を示しており、辺211,212に隣接する画素が開始領域に設定される。
When the
また、終了領域についても同様であり、トレース領域210においてアイコン画像201が最後に配置された領域のうち、端部に面する1辺または2辺の画素が設定される。アイコン画像201が最終位置に対して左右方向(x軸方向)または上下方向(y軸方向)に移動した場合、終了領域としては、端部に面する1辺の画素が設定される。一方、アイコン画像201が最終位置に対して斜めに移動した場合、終了領域としては、端部に面する2辺の画素が設定される。図4は後者の例を示しており、辺213,214に隣接する画素が終了領域に設定される。
The same applies to the end region. Among the regions where the
図5は、トレース方向角度の算出方法について説明するための図である。なお、図5では、図4と同様に、破線によって囲まれた領域がトレース領域210を示し、点線矢印はトレース領域210の中心線を示している。
FIG. 5 is a diagram for explaining a method of calculating the trace direction angle. In FIG. 5, as in FIG. 4, the area surrounded by the broken line indicates the
図4に示したようにトレース領域210が設定されると、トレース入力部113は、トレース領域210内の各画素に対してトレース方向角度を算出し、トレース領域情報122に登録する。トレース方向角度は、各画素の位置におけるトレース領域210の延伸方向の角度を示す。トレース方向角度は、対応する画素に着目したとき、その周囲画素のうちどの画素を探索対象とするかを決定するための基準角度となる。
When the
具体的な算出方法の例を、図5における画素221を例に挙げて説明する。トレース方向角度θ1は、画面上の所定の基準方向(本実施の形態では垂直方向)に対する角度として設定される。画素221についてのトレース方向角度θ1は、画素221から中心線に対して下ろした垂線と中心線との交点222における、中心線の接線223の傾きθ2として算出することができる。
An example of a specific calculation method will be described using the
なお、上記の接線223の傾きθ2は、演算負荷の軽減や処理速度の向上を目的として、より簡易な計算方法によって近似的に算出されてもよい。例えば、交点222の座標と、交点222を起点として終点側に所定距離だけ離れた中心線上の座標とを結ぶ直線の角度が、接線223の傾きθ2の近似値として算出されてもよい。
The slope θ2 of the tangent 223 may be approximately calculated by a simpler calculation method for the purpose of reducing the calculation load and improving the processing speed. For example, the angle of a straight line connecting the coordinates of the
図6は、トレース領域情報に登録される情報の例を示す図である。トレース入力部113は、ユーザの操作入力によってトレース領域210が設定されると、トレース領域情報122に、トレース領域210に含まれる画素ごとにレコードを作成する。各レコードには、例えば、座標、トレース方向角度、開始領域フラグおよび終了領域フラグの欄が設けられる。
FIG. 6 is a diagram illustrating an example of information registered in the trace area information. When the
座標の欄には、各画素の座標が登録される。トレース方向角度の欄には、図5で説明した画素ごとのトレース方向角度が登録される。開始領域フラグは、該当の画素が図4で説明した開始領域に属するか否かを示すフラグであり、開始領域に属する場合は「1」が登録され、属さない場合は「0」が登録される。終了領域フラグは、該当の画素が図4で説明した終了領域に属するか否かを示すフラグであり、終了領域に属する場合は「1」が登録され、属さない場合は「0」が登録される。なお、終了領域に属する画素は、その画素が着目画素に設定されたときにそれ以上のエッジ探索が行われないので、その画素についてはトレース方向角度が登録されていなくてよい。 The coordinates of each pixel are registered in the coordinate column. In the column of the trace direction angle, the trace direction angle for each pixel described in FIG. 5 is registered. The start area flag is a flag indicating whether or not the corresponding pixel belongs to the start area described with reference to FIG. 4. If the start area flag belongs to the start area, “1” is registered, and if not, “0” is registered. The The end region flag is a flag indicating whether or not the corresponding pixel belongs to the end region described with reference to FIG. 4. If the end region flag belongs to the end region, “1” is registered, and if not, “0” is registered. The It should be noted that for the pixel belonging to the end region, no further edge search is performed when the pixel is set as the pixel of interest, and therefore the trace direction angle need not be registered for that pixel.
図7は、トレース方向角度の分類の例を示す図である。前述のように、探索範囲情報123には、トレース方向角度ごとに、エッジ探索を行う範囲を示すエッジ探索範囲が対応付けて記憶されている。本実施の形態では、トレース方向角度が図7に示す8つの角度範囲D0〜D7に分類され、分類された角度範囲ごとにエッジ探索範囲が対応付けられる。
FIG. 7 is a diagram illustrating an example of classification of trace direction angles. As described above, the
ここで、トレース方向角度が8つの角度範囲D0〜D7に分類される理由は、トレース領域内の着目画素の周囲に8つの画素が存在することと関係する。角度範囲D0〜D7は、それぞれ着目画素の上側、右上側、右側、右下側、下側、左下側、左側、左上側に対して、それぞれ略均等の角度を有するように設定されればよい。 Here, the reason why the trace direction angle is classified into the eight angle ranges D0 to D7 is related to the presence of eight pixels around the pixel of interest in the trace region. The angle ranges D0 to D7 may be set so as to have substantially equal angles with respect to the upper side, upper right side, right side, lower right side, lower side, lower left side, left side, and upper left side of the target pixel, respectively. .
図7の例では、表示画面の上側を角度の基準方向として、338°以上360°未満および0°以上24°未満の範囲を角度範囲D0に、24°以上68°未満の範囲を角度範囲D1に、68°以上114°未満の範囲を角度範囲D2に、114°以上158°未満の範囲を角度範囲D3に、158°以上204°未満の範囲を角度範囲D4に、204°以上248°未満の範囲を角度範囲D5に、248°以上294°未満の範囲を角度範囲D6に、294°以上338°未満の範囲を角度範囲D7に、それぞれ設定している。 In the example of FIG. 7, the upper side of the display screen is the angle reference direction, the range of 338 ° to less than 360 ° and the range of 0 ° to less than 24 ° is the angle range D0, and the range of 24 ° to less than 68 ° is the angle range D1. The range from 68 ° to less than 114 ° is the angle range D2, the range from 114 ° to less than 158 ° is the angle range D3, the range from 158 ° to less than 204 ° is the angle range D4, and the range is from 204 ° to less than 248 °. Is set to an angle range D5, a range of 248 ° to less than 294 ° is set to an angle range D6, and a range of 294 ° to less than 338 ° is set to an angle range D7.
図8は、角度範囲とエッジ探索範囲との関係の例について示す図である。なお、図8では、着目画素の周囲画素について、上側、右上側、右側、右下側、下側、左下側、左側、左上側の順にN0,N1,N2,N3,N4,N5,N6,N7という符号を付して示している。 FIG. 8 is a diagram illustrating an example of the relationship between the angle range and the edge search range. In FIG. 8, with respect to the surrounding pixels of the pixel of interest, N0, N1, N2, N3, N4, N5, N6, N0, N1, N2, N3, N4, N5, N6 in the order of upper side, upper right side, right side, lower right side, lower side, lower left side, left side, upper left side. The reference numeral N7 is attached.
図8に示す「エッジ候補画素」とは、エッジ探索の対象とする画素、より具体的には、エッジ強度の計算を行う対象の画素を示す。エッジ探索範囲とは、着目画素の周囲画素のうちエッジ候補画素が含まれる範囲を示す。輪郭検出部114によるエッジ探索範囲は、着目画素について算出されたトレース方向角度が示す方向の近傍範囲に限定される。換言すると、次の着目画素として設定可能な画素は、現在の着目画素の周囲画素のうちエッジ探索範囲に含まれる画素に限定される。これにより、トレース領域の延伸方向から大きく外れた方向に位置するエッジが検出されなくなり、ユーザが意図する輪郭線が検出されやすくなる。
The “edge candidate pixel” shown in FIG. 8 indicates a pixel to be subjected to edge search, more specifically, a pixel to be subjected to edge strength calculation. The edge search range indicates a range in which edge candidate pixels are included among the surrounding pixels of the target pixel. The edge search range by the
本実施の形態では例として、図8に示すように、エッジ探索範囲は図7に示した角度範囲ごとに設定される。トレース方向角度が角度範囲D0に含まれる場合、エッジ探索範囲は着目画素の上方向の近傍に設定され、画素N7,N0,N1がエッジ候補画素となる。トレース方向角度が角度範囲D1に含まれる場合、エッジ探索範囲は着目画素の右上方向の近傍に設定され、画素N0,N1,N2がエッジ候補画素となる。トレース方向角度が角度範囲D2に含まれる場合、エッジ探索範囲は着目画素の右方向の近傍に設定され、画素N1,N2,N3がエッジ候補画素となる。トレース方向角度が角度範囲D3に含まれる場合、エッジ探索範囲は着目画素の右下方向の近傍に設定され、画素N2,N3,N4がエッジ候補画素となる。 In the present embodiment, as an example, as shown in FIG. 8, the edge search range is set for each angle range shown in FIG. When the trace direction angle is included in the angle range D0, the edge search range is set in the vicinity of the upward direction of the pixel of interest, and the pixels N7, N0, and N1 are edge candidate pixels. When the trace direction angle is included in the angle range D1, the edge search range is set near the upper right direction of the pixel of interest, and the pixels N0, N1, and N2 are edge candidate pixels. When the trace direction angle is included in the angle range D2, the edge search range is set near the right direction of the target pixel, and the pixels N1, N2, and N3 are edge candidate pixels. When the trace direction angle is included in the angle range D3, the edge search range is set in the vicinity of the lower right direction of the pixel of interest, and the pixels N2, N3, and N4 are edge candidate pixels.
トレース方向角度が角度範囲D4に含まれる場合、エッジ探索範囲は着目画素の下方向の近傍に設定され、画素N3,N4,N5がエッジ候補画素となる。トレース方向角度が角度範囲D5に含まれる場合、エッジ探索範囲は着目画素の左下方向の近傍に設定され、画素N4,N5,N6がエッジ候補画素となる。トレース方向角度が角度範囲D6に含まれる場合、エッジ探索範囲は着目画素の左方向の近傍に設定され、画素N5,N6,N7がエッジ候補画素となる。トレース方向角度が角度範囲D7に含まれる場合、エッジ探索範囲は着目画素の左上方向の近傍に設定され、画素N6,N7,N0がエッジ候補画素となる。 When the trace direction angle is included in the angle range D4, the edge search range is set near the lower direction of the pixel of interest, and the pixels N3, N4, and N5 are edge candidate pixels. When the trace direction angle is included in the angle range D5, the edge search range is set near the lower left direction of the target pixel, and the pixels N4, N5, and N6 are edge candidate pixels. When the trace direction angle is included in the angle range D6, the edge search range is set in the vicinity of the target pixel in the left direction, and the pixels N5, N6, and N7 are edge candidate pixels. When the trace direction angle is included in the angle range D7, the edge search range is set near the upper left direction of the target pixel, and the pixels N6, N7, and N0 are edge candidate pixels.
なお、図8の例ではエッジ候補画素を着目画素の周囲1画素の範囲に設定したが、エッジ候補画素を着目画素の周囲複数画素の範囲に設定してもよい。
探索範囲情報123には、角度範囲ごとに、エッジ候補画素の位置を示す情報(例えば、図8に示すN0〜N7)があらかじめ登録される。輪郭検出部114は、着目画素を設定すると、着目画素についてのトレース角度範囲に対応するエッジ候補画素を、探索範囲情報123に基づいて判別する。輪郭検出部114は、判別したエッジ候補画素のそれぞれについてエッジ強度を算出し、エッジ強度が最も大きい画素を次の着目画素に設定する。
In the example of FIG. 8, the edge candidate pixel is set in the range of one pixel around the target pixel, but the edge candidate pixel may be set in the range of a plurality of pixels around the target pixel.
In the
図9は、エッジ強度の算出例を示す図である。エッジ強度は、対象の画素がエッジである可能性の高さを示す指標である。この図9では、Sobelフィルタを用いてエッジ候補画素のエッジ強度を算出する例について示す。 FIG. 9 is a diagram illustrating an example of calculating the edge strength. The edge strength is an index indicating the high possibility that the target pixel is an edge. FIG. 9 shows an example in which edge strength of edge candidate pixels is calculated using a Sobel filter.
Sobelフィルタを用いた方法では、x方向およびy方向のそれぞれについてのフィルタ係数が用意される。それぞれのフィルタ係数を用いて、エッジ強度のx成分、y成分が算出される。そして、x成分およびy成分を合成することでエッジ強度が算出される。 In the method using the Sobel filter, filter coefficients are prepared for each of the x direction and the y direction. Using each filter coefficient, the x component and the y component of the edge strength are calculated. Then, the edge strength is calculated by combining the x component and the y component.
x,yの各方向のフィルタ演算では、エッジ候補画素およびその周囲画素の合計9個の画素にそれぞれフィルタ係数が設定される。図9の例では、エッジ候補画素についてのx方向のフィルタ演算は、「左上画素の輝度値×(−1)+上側画素の輝度値×0+右上側画素の輝度値×1+左側画素の輝度値×(−2)+エッジ候補画素の輝度値×0+右側画素の輝度値×2+左下側画素の輝度値×(−1)+下側画素の輝度値×0+右下側画素の輝度値×1」なる式によって行われ、これによりエッジ強度のx成分が算出される。 In the filter operation in each of the x and y directions, filter coefficients are set for a total of nine pixels including the edge candidate pixel and its surrounding pixels. In the example of FIG. 9, the filter calculation in the x direction for the edge candidate pixel is “brightness value of upper left pixel × (−1) + brightness value of upper pixel × 0 + brightness value of upper right pixel × 1 + brightness value of left pixel”. × (−2) + Brightness value of edge candidate pixel × 0 + Brightness value of right pixel × 2 + Brightness value of lower left pixel × (−1) + Brightness value of lower pixel × 0 + Brightness value of lower right pixel × 1 The x-component of the edge strength is thereby calculated.
また、図9の例では、エッジ候補画素についてのy方向のフィルタ演算は、「左上画素の輝度値×(−1)+上側画素の輝度値×(−2)+右上側画素の輝度値×(−1)+左側画素の輝度値×0+エッジ候補画素の輝度値×0+右側画素の輝度値×0+左下側画素の輝度値×1+下側画素の輝度値×2+右下側画素の輝度値×1」なる式によって行われ、これによりエッジ強度のy成分が算出される。 In the example of FIG. 9, the y-direction filter operation for the edge candidate pixel is “brightness value of upper left pixel × (−1) + brightness value of upper pixel × (−2) + brightness value of upper right side pixel × (-1) + Luminance value of left pixel × 0 + Luminance value of edge candidate pixel × 0 + Brightness value of right pixel × 0 + Luminance value of lower left pixel × 1 + Luminance value of lower pixel × 2 + Luminance value of lower right pixel This is performed by the formula “× 1”, and thereby the y component of the edge strength is calculated.
そして、x成分の二乗値とy成分の二乗値とを加算した値の平方根をとることで、エッジ強度Eが算出される。
図10は、トレース領域の設定例を示す図である。ユーザは、図10に示すように、アイコン画像の内部に常に人の輪郭線が包含されるように、アイコン画像を移動させる。これにより、人の輪郭線を含む領域にトレース領域210が設定される。上記の図4〜図9において説明した輪郭検出手順によれば、トレース領域210の延伸方向(すなわち、アイコン画像の移動方向)から大きく外れた方向に位置する輪郭線が検出されなくなり、ユーザが意図する輪郭線が検出されやすくなる。
Then, the edge strength E is calculated by taking the square root of the value obtained by adding the square value of the x component and the square value of the y component.
FIG. 10 is a diagram illustrating an example of setting a trace area. As shown in FIG. 10, the user moves the icon image so that the outline of the person is always included in the icon image. Thereby, the
また、アイコン画像をある程度の大きさ以上に設定することで、ユーザは、頭部の輪郭線に大まかに沿うようにアイコン画像を移動させるだけで、頭部の輪郭線を正確に検出させることができるようになる。例えば、アイコン画像の左右の幅を、耳の水平方向の範囲より大きく設定する。この場合、ユーザは、図10に示すように、頭部の輪郭線に大まかに沿ってアイコン画像を移動させる。このとき、耳の形状に沿ってアイコン画像の移動方向を変化させる必要はなく、耳の水平方向の範囲がアイコン画像の内部に包含されるようにアイコン画像が移動されればよい。このような簡単な操作により、耳の近傍領域についても輪郭線を正確に検出できる。 In addition, by setting the icon image to a certain size or more, the user can accurately detect the outline of the head simply by moving the icon image so as to roughly follow the outline of the head. become able to. For example, the left and right widths of the icon image are set larger than the horizontal range of the ear. In this case, the user moves the icon image roughly along the outline of the head as shown in FIG. At this time, it is not necessary to change the moving direction of the icon image along the shape of the ear, and the icon image may be moved so that the horizontal range of the ear is included in the icon image. With such a simple operation, a contour line can be accurately detected even in the vicinity of the ear.
しかしながら、例えば、耳の近傍領域において頭髪が存在する場合には、次のように誤った輪郭線が検出される場合がある。図11は、輪郭線が誤検出されるケースについて示す図である。 However, for example, when hair is present in a region near the ear, an erroneous contour line may be detected as follows. FIG. 11 is a diagram illustrating a case where a contour line is erroneously detected.
図11の領域301においては、耳の領域と顔の領域との間に頭髪の領域が存在する。頭髪の領域と耳や顔の肌色領域との境界部では、エッジ強度が比較的大きくなる。このため、輪郭検出部114は、耳の外縁部ではなく、耳より顔の内側方向に存在する頭髪の領域の外縁部を、人の輪郭として誤検出する場合がある。また、図10のようにトレース領域が頭部の輪郭線に大まかに沿うように設定された場合、耳の近傍領域の画素についてのトレース方向角度は概ね上下方向と一致する。このことから、輪郭検出部114は、頭髪の領域の外縁部を一旦人の輪郭線として誤検出すると、誤検出の状態のまま上下方向へのエッジ探索を続行して、耳の領域の他端まで進行してしまう可能性もある。
In the
また、上記のような誤検出は、耳の近傍領域に限らず、例えば、顔の外縁部より内側に頭髪が流れているような領域でも発生し得る。
そこで、輪郭検出部114は、エッジ候補画素の中からエッジ強度が最も大きい画素を選択したとき、選択した画素が肌色領域と肌色領域との間の領域に位置する場合には、選択した画素を次の着目画素に設定せずに、エッジ候補画素から除外する。この方法の具体例として、輪郭検出部114は、選択した画素の位置でのトレース方向と、選択した画素と顔との位置関係とに基づいて、選択した画素について、本来あるべきでない方向に肌色領域があるかを判定する。輪郭検出部114は、あるべきでない方向に肌色領域がある場合には、選択した画素を次の着目画素に設定せずに、エッジと判定する画素から除外する。これにより、耳の近傍領域や頭髪を含む領域でも、人の輪郭線を正確に検出できるようになる。
Further, the erroneous detection as described above may occur not only in the vicinity of the ear, but also in an area where the hair is flowing inside the outer edge of the face.
Accordingly, when the
次に、輪郭検出装置100の処理手順について、フローチャートを用いて説明する。まず、図12は、第2の実施の形態に係る輪郭検出装置の全体処理手順の例を示すフローチャートである。 Next, the processing procedure of the contour detection apparatus 100 will be described using a flowchart. First, FIG. 12 is a flowchart illustrating an example of the entire processing procedure of the contour detection apparatus according to the second embodiment.
[ステップS11]画像読み込み部111は、入力画像の画像データをRAM102に読み込む。
[ステップS12]顔検出部112は、入力画像から顔検出を行い、検出された顔の位置を示す情報を顔位置情報121としてRAM102に保存する。
[Step S <b> 11] The
[Step S12] The
[ステップS13]トレース入力部113は、ユーザによるトレース操作を受け付ける。
[ステップS14]トレース入力部113は、トレース操作に基づいて、トレース領域を設定する。トレース入力部113は、トレース領域内の各画素に対応するレコードをトレース領域情報122に作成し、各画素の座標を登録する。また、トレース入力部113は、各画素についてのトレース方向角度を算出して、トレース領域情報122に登録する。さらに、トレース入力部113は、トレース領域における開始領域および終了領域を判別して、その判別結果を基にトレース領域情報122の開始領域フラグおよび終了領域フラグを設定する。
[Step S13] The
[Step S14] The
[ステップS15]輪郭検出部114は、トレース領域における開始領域の各画素のエッジ強度を算出し、エッジ強度が最も大きい画素を最初の着目画素に設定する。また、輪郭検出部114は、設定した着目画素の座標を座標リスト124に登録する。
[Step S15] The
[ステップS16]輪郭検出部114は、トレース領域情報122から、現在の着目画素に対応付けられたトレース方向角度を読み出す。輪郭検出部114は、探索範囲情報123を参照し、読み出したトレース方向角度が属する角度範囲に対応するエッジ候補画素の位置を判別する。
[Step S16] The
[ステップS17]輪郭検出部114は、エッジ候補画素のそれぞれについて、エッジ強度を算出する。
[ステップS18]輪郭検出部114は、未選択のエッジ候補画素の中から、エッジ強度が最大の画素を選択する。
[Step S17] The
[Step S18] The
[ステップS19]輪郭検出部114は、ステップS18で選択した画素についてのトレース方向、および、選択した画素と顔位置情報121に登録された顔の位置との関係に基づいて、選択した画素について、本来あるべきでない方向に肌色領域があるかを判定する。あるべきでない方向に肌色領域がある場合には、誤検出と判定されて、ステップS20の処理が実行される。一方、あるべきでない方向に肌色領域がない場合には、誤検出でないと判定されて、ステップS21の処理が実行される。
[Step S19] The
[ステップS20]輪郭検出部114は、ステップS18で選択した画素をエッジ候補画素から除外する。輪郭検出部114は、例えば、ステップS18で選択した画素の位置をRAM102に一時的に記憶する。
[Step S20] The
この後、ステップS18の処理が再実行されるが、ステップS20の処理によってエッジ候補画素から除外された画素は、次のステップS18において選択済みの画素となって、エッジ強度が最大の画素として選択されない。 Thereafter, the process of step S18 is re-executed, but the pixels excluded from the edge candidate pixels by the process of step S20 are selected pixels in the next step S18 and are selected as the pixels having the maximum edge strength. Not.
[ステップS21]輪郭検出部114は、トレース領域情報122に登録された、ステップS18で選択画素についての終了領域フラグに基づき、選択した画素が終了領域に含まれるかを判定する。選択した画素が終了領域に含まれない場合には、ステップS22の処理が実行され、含まれる場合には、ステップS23の処理が実行される。
[Step S21] The
[ステップS22]輪郭検出部114は、着目画素を、ステップS18で選択した画素に更新し、この画素の座標を座標リスト124に登録する。この後、ステップS16が実行されて、更新された着目画素についての処理が行われる。
[Step S22] The
[ステップS23]輪郭検出部114は、ステップS18で選択した画素の座標を座標リスト124に登録した後、座標リスト124を、検出された輪郭線を示す情報として出力する。
[Step S23] The
以上の図12の処理によれば、耳の近傍領域や頭髪を含む領域でも、人の頭部の輪郭線を正確に検出できるようになる。また、ユーザが、耳の外縁部や頭髪の領域の外縁部の形状に沿って忠実にアイコン画像を移動させなくても、これらの領域において頭部の輪郭線が精度よく検出される。従って、簡単な操作によって輪郭線を効率よく検出することができる。例えば、輪郭線の検出対象とする入力画像が多数ある場合でも、輪郭線の検出精度を維持しつつ、作業時間を短縮することができる。 According to the processing in FIG. 12 described above, the contour of the human head can be accurately detected even in the vicinity of the ear and the region including the hair. Moreover, even if the user does not faithfully move the icon image along the shape of the outer edge of the ear or the outer edge of the hair region, the outline of the head is accurately detected in these regions. Therefore, the contour line can be efficiently detected by a simple operation. For example, even when there are a large number of input images to be detected as contour lines, the work time can be shortened while maintaining the contour line detection accuracy.
なお、上記の図12の処理では、エッジ探索処理を開始する前のステップS14において、事前にトレース領域内の全画素のトレース方向角度を算出した。しかし、他の例として、ステップS14の時点ではトレース方向角度を算出せずに、ステップS16の時点で着目画素のトレース方向角度を算出してもよい。 In the process of FIG. 12, the trace direction angles of all the pixels in the trace area are calculated in advance in step S14 before the edge search process is started. However, as another example, the trace direction angle of the pixel of interest may be calculated at the time of step S16 without calculating the trace direction angle at the time of step S14.
また、図12の処理では、ステップS15およびステップS17の時点でエッジ強度の計算を行った。しかし、他の例として、ステップS14でトレース領域を設定した後、ステップS15の処理を実行する前の段階で、トレース方向角度と同様に、トレース領域内の全画素のエッジ強度をあらかじめ計算し、トレース領域情報122に登録しておいてもよい。この場合、ステップS15およびステップS17では、該当する画素のエッジ強度がトレース領域情報122から読み出される。
In the process of FIG. 12, the edge strength is calculated at the time of step S15 and step S17. However, as another example, after setting the trace area in step S14 and before executing the process of step S15, the edge strengths of all the pixels in the trace area are calculated in advance, similarly to the trace direction angle, It may be registered in the
また、入力画像上の全画素についてのトレース方向角度とエッジ強度のいずれか、または両方が、ステップS13でトレース操作を受け付けるより前の時点で計算されて、記憶装置に一時的に記憶されてもよい。 Further, either or both of the trace direction angle and the edge intensity for all the pixels on the input image may be calculated and temporarily stored in the storage device before the trace operation is accepted in step S13. Good.
次に、ステップS19の判定処理手順について、2つの処理例を挙げる。まず、図13は、ステップS19の第1の処理例を示すフローチャートである。
[ステップS31]輪郭検出部114は、顔位置情報121に基づき、図12のステップS18で選択した画素が、顔の右側または左側のどちらに位置するかを判定する。顔の右側に位置する場合、ステップS32の処理が実行され、左側に位置する場合、ステップS33の処理が実行される。
Next, two processing examples will be given for the determination processing procedure in step S19. First, FIG. 13 is a flowchart showing a first processing example of step S19.
[Step S31] Based on the
[ステップS32]輪郭検出部114は、選択した画素の位置でのトレース方向が下向きまたは上向きのどちらであるかを判定する。具体的には、輪郭検出部114は、トレース領域情報122から、選択した画素についてのトレース方向角度を読み出す。輪郭検出部114は、読み出したトレース方向角度の垂直成分(y成分)が下方向を示す場合には、トレース方向が下向きと判定し、上方向を示す場合には、トレース方向が上向きと判定する。
[Step S32] The
トレース方向が下向きの場合、ステップS34の処理が実行され、上向きの場合、ステップS35の処理が実行される。
[ステップS33]輪郭検出部114は、選択した画素の位置でのトレース方向が下向きまたは上向きのどちらであるかを判定する。具体的な処理手順はステップS32と同様である。トレース方向が下向きの場合、ステップS35の処理が実行され、上向きの場合、ステップS34の処理が実行される。
If the trace direction is downward, the process of step S34 is executed. If the trace direction is upward, the process of step S35 is executed.
[Step S33] The
[ステップS34]輪郭検出部114は、肌色領域を調査する調査方向を、選択した画素の周囲画素のうち、選択した画素についてのトレース方向角度に対して左側に位置する画素の方向に設定する。
[Step S <b> 34] The
例えば、輪郭検出部114は、選択した画素についてのトレース方向角度が、図7に示した角度範囲D0〜D7のどれに属するかを判定し、どの角度範囲に属するかによって、周囲画素のうち左側に位置する画素を決定する。ここで、選択した画素の周囲画素を、図8に示した符号(N0〜N7)を用いて示す。
For example, the
輪郭検出部114は、トレース方向角度が角度範囲D0に属する場合、周囲画素のうち画素N6を、左側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D1に属する場合、周囲画素のうち画素N7を、左側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D2に属する場合、周囲画素のうち画素N0を、左側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D3に属する場合、周囲画素のうち画素N1を、左側に位置する画素に決定する。
When the trace direction angle belongs to the angle range D0, the
また、輪郭検出部114は、トレース方向角度が角度範囲D4に属する場合、周囲画素のうち画素N2を、左側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D5に属する場合、周囲画素のうち画素N3を、左側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D6に属する場合、周囲画素のうち画素N4を、左側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D7に属する場合、周囲画素のうち画素N5を、左側に位置する画素に決定する。
In addition, when the trace direction angle belongs to the angle range D4, the
輪郭検出部114は、選択した画素から左側に位置する画素への方向を、肌色領域の調査方向とする。これにより、選択した画素についてのトレース方向角度に対して左向きに概ね90°回転された方向に、肌色領域の調査方向が設定される。この調査方向は、顔の外側に向かう方向となり、これはすなわち、選択した画素が頭部の輪郭線に正しく沿っているのであれば、通常は肌色領域が存在しない方向となる。
The
[ステップS35]輪郭検出部114は、肌色領域を調査する調査方向を、選択した画素の周囲画素のうち、選択した画素についてのトレース方向角度に対して右側に位置する画素の方向に設定する。
[Step S <b> 35] The
例えば、輪郭検出部114は、ステップS34と同様に、選択した画素についてのトレース方向角度が図7の角度範囲D0〜D7のどれに属するかを判定し、どの角度範囲に属するかによって、周囲画素のうち右側に位置する画素を決定する。
For example, as in step S34, the
輪郭検出部114は、トレース方向角度が角度範囲D0に属する場合、周囲画素のうち画素N2を、右側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D1に属する場合、周囲画素のうち画素N3を、右側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D2に属する場合、周囲画素のうち画素N4を、右側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D3に属する場合、周囲画素のうち画素N5を、右側に位置する画素に決定する。
When the trace direction angle belongs to the angle range D0, the
また、輪郭検出部114は、トレース方向角度が角度範囲D4に属する場合、周囲画素のうち画素N6を、右側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D5に属する場合、周囲画素のうち画素N7を、右側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D6に属する場合、周囲画素のうち画素N0を、右側に位置する画素に決定する。また、輪郭検出部114は、トレース方向角度が角度範囲D7に属する場合、周囲画素のうち画素N1を、右側に位置する画素に決定する。
Further, when the trace direction angle belongs to the angle range D4, the
輪郭検出部114は、選択した画素から右側に位置する画素への方向を、肌色領域の調査方向とする。これにより、選択した画素についてのトレース方向角度に対して右向きに概ね90°回転された方向に、肌色領域の調査方向が設定される。この調査方向は、顔の外側に向かう方向となり、これはすなわち、選択した画素が頭部の輪郭線に正しく沿っているのであれば、通常は肌色領域が存在しない方向となる。
The
[ステップS36]輪郭検出部114は、設定された調査方向に位置する最初の画素を、肌色領域かの判定対象とする調査画素に設定する。
[ステップS37]輪郭検出部114は、トレース領域情報122に基づき、現在の調査画素がトレース領域外であるかを判定する。調査画素がトレース領域外である場合、ステップS41の処理が実行され、調査画素がトレース領域内である場合、ステップS38の処理が実行される。
[Step S <b> 36] The
[Step S37] Based on the
[ステップS38]輪郭検出部114は、現在の調査画素が肌色かを判定する。この判定は、例えば、調査画素の色情報の値が所定の範囲に含まれるかによって行われる。調査画像が肌色である場合、ステップS39の処理が実行され、肌色でない場合、ステップS40の処理が実行される。
[Step S38] The
[ステップS39]輪郭検出部114は、あるべきでない方向に肌色領域があり、誤検出が発生したと判定する。すなわち、ステップS19において「Yes」と判定される。
[ステップS40]輪郭検出部114は、調査画素を、設定された調査方向に対して1画素分移動させる。この後、移動後の調査画素についてステップS37の処理が再度実行される。
[Step S39] The
[Step S40] The
[ステップS41]ステップS37で「Yes」と判定される場合とは、調査方向に対して肌色の画素が検出されずに、調査画素がトレース領域外に設定されてしまった場合である。この場合、輪郭検出部114は、あるべきでない方向に肌色領域がないので、ステップS18で選択した画素は頭部の輪郭線に沿って正しく検出されたものであると判定する。すなわち、ステップS19において「No」と判定される。
[Step S <b> 41] The case where “Yes” is determined in Step S <b> 37 is a case where the investigation pixel is set outside the trace area without detecting the skin color pixel in the investigation direction. In this case, the
図14は、第1の処理例における調査方向の設定例を示す図である。なお、以下の説明では、座標(n,m)の画素を「画素(n,m)」と表記する。
図14では例として、画素(12,12)が着目画素に設定されており、この場合のエッジ候補画素の中で、画素(13,13)のエッジ強度が最も大きいと判定されたとする。また、画素(13,13)についてのトレース方向角度が、図7の角度範囲D4に属するものとする。また、顔の中心位置は画素(13,13)の左側方向(−x方向)であるものとする。
FIG. 14 is a diagram illustrating an example of setting the investigation direction in the first processing example. In the following description, a pixel having coordinates (n, m) is referred to as “pixel (n, m)”.
In FIG. 14, as an example, it is assumed that the pixel (12, 12) is set as the pixel of interest, and it is determined that the edge strength of the pixel (13, 13) is the highest among the edge candidate pixels in this case. Further, it is assumed that the trace direction angle for the pixel (13, 13) belongs to the angle range D4 in FIG. The center position of the face is assumed to be in the left direction (−x direction) of the pixels (13, 13).
この場合、輪郭検出部114は、画素(13,13)の左側に位置する画素を画素(14,13)と決定し、画素(13,13)から画素(14,13)に向かう方向(すなわち右方向)を肌色領域の調査方向とする。ここで、トレース領域の右端がx座標「17」の位置にあるものとする。このとき、輪郭検出部114は、調査方向に存在する画素(14,13)、画素(15,13)、画素(16,13)、画素(17,13)を調査画素とし、これらのうち少なくとも1つが肌色であると判定すると、あるべきでない方向に肌色領域があると判定する。
In this case, the
この場合、輪郭検出部114は、画素(13,13)は頭部の輪郭線に沿っていないと判定して、画素(13,13)をエッジ候補画素から除外する。そして、画素(12,12)についてのエッジ候補画素のうち、画素(13,13)の次にエッジ強度が大きい画素を選択して、上記と同様の肌色領域の判定を行う。
In this case, the
以上の第1の処理例によれば、エッジ強度が大きいと判定された画素についてのトレース方向角度に対し、顔の外側方向に対して概ね90°回転した方向に対して、肌色領域が調査される。これにより、本来あるべきでない方向に肌色領域があるかを判定することができる。 According to the first processing example described above, the skin color region is examined in a direction rotated by approximately 90 ° with respect to the outer direction of the face with respect to the trace direction angle for the pixel determined to have a high edge strength. The This makes it possible to determine whether there is a skin color region in a direction that should not be present.
次に、図15は、ステップS19の第2の処理例を示すフローチャートである。第2の処理例は、第1の処理例と比較して、肌色領域の調査方向を、トレース方向角度に応じたより正確な角度に設定可能とするものである。 Next, FIG. 15 is a flowchart showing a second processing example of step S19. In the second processing example, as compared with the first processing example, the skin color region examination direction can be set to a more accurate angle corresponding to the trace direction angle.
なお、図15の処理では、図12のステップS18で選択した画素の座標を(X2,Y2)、所定個数だけ前に設定された着目画素の座標を(X1,Y1)とする。画素(X1,Y1)は、例えば、アイコン画像の幅の1/2(ただし、小数点以下は切り捨て)に相当する個数だけ前に設定された着目画素とすることができる。 In the process of FIG. 15, the coordinates of the pixel selected in step S18 of FIG. 12 are (X2, Y2), and the coordinates of the pixel of interest set a predetermined number before are (X1, Y1). The pixels (X1, Y1) can be, for example, the pixel of interest set by the number corresponding to ½ of the width of the icon image (however, the fractional part is discarded).
[ステップS51]輪郭検出部114は、XD=X2−X1、YD=Y2−Y1を計算する。
[ステップS52]輪郭検出部114は、顔位置情報121に基づき、画素(X2,Y2)が顔の右側または左側のどちらに位置するかを判定する。顔の右側に位置する場合、ステップS53の処理が実行され、左側に位置する場合、ステップS54処理が実行される。
[Step S51] The
[Step S52] Based on the
[ステップS53]輪郭検出部114は、画素(X2,Y2)の位置でのトレース方向が下向きまたは上向きのどちらであるかを判定する。トレース方向が下向きの場合、ステップS55の処理が実行され、上向きの場合、ステップS56の処理が実行される。
[Step S53] The
[ステップS54]輪郭検出部114は、画素(X2,Y2)の位置でのトレース方向が下向きまたは上向きのどちらであるかを判定する。トレース方向が下向きの場合、ステップS56の処理が実行され、上向きの場合、ステップS55の処理が実行される。
[Step S54] The
なお、ステップS53,S54は、図13のステップS32と同様の処理手順により実行できる。
[ステップS55]輪郭検出部114は、肌色領域の調査方向を決定するための座標(XS,YS)を、座標(X1,Y1)から座標(X2,Y2)へ向かう直線の傾きを左方向に90°回転させた方向の位置に設定する。この座標は、XS=X2+YD、YS=Y2−XDと計算される。なお、XS,YSは整数でなくてもよい。
Steps S53 and S54 can be executed by the same processing procedure as step S32 in FIG.
[Step S55] The
[ステップS56]輪郭検出部114は、肌色領域の調査方向を決定するための座標(XS,YS)を、座標(X1,Y1)から座標(X2,Y2)へ向かう直線の傾きを右方向に90°回転させた方向の位置に設定する。この座標は、XS=X2−YD、YS=Y2+XDと計算される。なお、XS,YSは整数でなくてもよい。
[Step S56] The
なお、上記のステップS55,S56では、座標(X1,Y1)から座標(X2,Y2)へ向かう直線の傾きを基準として座標(XS,YS)を決定した。しかし、他の方法として、トレース領域情報122から読み出した、座標(X2,Y2)についてのトレース方向角度を基準として、座標(XS,YS)を決定してもよい。
In steps S55 and S56, the coordinates (XS, YS) are determined based on the slope of the straight line from the coordinates (X1, Y1) to the coordinates (X2, Y2). However, as another method, the coordinates (XS, YS) may be determined on the basis of the trace direction angle for the coordinates (X2, Y2) read from the
[ステップS57]輪郭検出部114は、画素(X2,Y2)から座標(XS,YS)の方向への座標の変化量のx成分およびy成分をそれぞれ示すx増分およびy増分を算出する。この処理では、x増分またはy増分の少なくとも一方の値が1となるように計算が行われる。このステップS57の算出処理については後の図16において詳述する。
[Step S57] The
[ステップS58]輪郭検出部114は、画素(X2,Y2)から、算出されたx増分、y増分の距離だけ離れた位置の画素を、肌色領域の調査画素に設定する。x増分またはy増分の少なくとも一方の値が1であることから、この処理では画素(X2,Y2)に隣接する周囲画素のうちの1つが、調査画素に設定される。
[Step S58] The
[ステップS59]輪郭検出部114は、トレース領域情報122に基づき、現在の調査画素がトレース領域外であるかを判定する。調査画素がトレース領域外である場合、ステップS63の処理が実行され、調査画素がトレース領域内である場合、ステップS60の処理が実行される。
[Step S <b> 59] The
[ステップS60]輪郭検出部114は、現在の調査画素が肌色かを判定する。この判定は、例えば、調査画素の色情報の値が所定の範囲に含まれるかによって行われる。調査画像が肌色である場合、ステップS61の処理が実行され、肌色でない場合、ステップS62の処理が実行される。
[Step S60] The
[ステップS61]輪郭検出部114は、あるべきでない方向に肌色領域があり、誤検出が発生したと判定する。すなわち、ステップS19において「Yes」と判定される。
[ステップS62]輪郭検出部114は、調査画素を、現在の調査画素からx増分およびy増分の距離だけ離れた位置に移動させる。ここで、x増分またはy増分の少なくとも一方の値が1であることから、この処理では現在の調査画素の周囲画素のうちの1つが、新たな調査画素に設定される。この後、移動後の調査画素についてステップS59の処理が再度実行される。
[Step S61] The
[Step S62] The
[ステップS63]ステップS59で「Yes」と判定される場合とは、調査方向に対して肌色の画素が検出されずに、調査画素がトレース領域外に設定されてしまった場合である。この場合、輪郭検出部114は、あるべきでない方向に肌色領域がないので、ステップS18で選択した画素(X2,Y2)は頭部の輪郭線に沿って正しく検出されたものであると判定する。すなわち、ステップS19において「No」と判定される。
[Step S <b> 63] The case where “Yes” is determined in Step S <b> 59 is a case in which the skin pixel is not detected in the survey direction and the survey pixel is set outside the trace area. In this case, the
図16は、図15のステップS57の処理手順の例を示すフローチャートである。
[ステップS71]輪郭検出部114は、x差分=XS−X2、y差分=YS−Y2を計算する。
FIG. 16 is a flowchart showing an example of the processing procedure of step S57 of FIG.
[Step S71] The
[ステップS72]輪郭検出部114は、x差分の絶対値がy差分の絶対値より小さいかを判定する。x差分の絶対値がy差分の絶対値より小さい場合、ステップS73の処理が実行され、x差分の絶対値がy差分の絶対値以上である場合、ステップS77の処理が実行される。
[Step S72] The
[ステップS73]輪郭検出部114は、x差分をy差分の絶対値で除算した値を、x増分として算出する。
[ステップS74]輪郭検出部114は、y差分が0以上であるかを判定する。y差分が0以上である場合、ステップS75の処理が実行され、y差分が0未満である場合、ステップS76の処理が実行される。
[Step S73] The
[Step S74] The
[ステップS75]輪郭検出部114は、y増分を1とする。
[ステップS76]輪郭検出部114は、y増分を−1とする。
上記のステップS73〜S76の処理によって算出されるx増分およびy増分は、座標(X2,Y2)から座標(XS,YS)に向かう方向(すなわち、肌色領域の調査方向)に対する、y方向の1画素単位での変化量のx成分およびy成分を示す。ステップS73〜S76の処理によってx増分およびy増分が算出された場合、図15のステップS58、およびその後のステップS62において調査画素が設定される際には、y座標が1画素ずつ順次シフトされていくことになる。
[Step S75] The
[Step S76] The
The x increment and the y increment calculated by the processes in steps S73 to S76 are 1 in the y direction with respect to the direction from the coordinate (X2, Y2) to the coordinate (XS, YS) (that is, the skin color region survey direction). The x component and y component of the change amount in pixel units are shown. When the x increment and the y increment are calculated by the processes in steps S73 to S76, the y coordinate is sequentially shifted one pixel at a time when the investigation pixel is set in step S58 of FIG. 15 and the subsequent step S62. Will go.
[ステップS77]輪郭検出部114は、y差分をx差分の絶対値で除算した値を、y増分として算出する。
[ステップS78]輪郭検出部114は、x差分が0以上であるかを判定する。x差分が0以上である場合、ステップS79の処理が実行され、x差分が0未満である場合、ステップS80の処理が実行される。
[Step S77] The
[Step S78] The
[ステップS79]輪郭検出部114は、x増分を1とする。
[ステップS80]輪郭検出部114は、x増分を−1とする。
上記のステップS77〜S80の処理によって算出されるx増分およびy増分は、座標(X2,Y2)から座標(XS,YS)に向かう方向(すなわち、肌色領域の調査方向)に対する、x方向の1画素単位での変化量のx成分およびy成分を示す。ステップS77〜S80の処理によってx増分およびy増分が算出された場合、図15のステップS58、およびその後のステップS62において調査画素が設定される際には、x座標が1画素ずつ順次シフトされていくことになる。
[Step S79] The
[Step S80] The
The x increment and the y increment calculated by the processes in steps S77 to S80 are 1 in the x direction with respect to the direction from the coordinate (X2, Y2) to the coordinate (XS, YS) (that is, the skin color region examination direction). The x component and y component of the change amount in pixel units are shown. When the x increment and the y increment are calculated by the processes in steps S77 to S80, when the investigation pixel is set in step S58 in FIG. 15 and the subsequent step S62, the x coordinate is sequentially shifted pixel by pixel. Will go.
図17は、第2の処理例における調査方向の設定例を示す図である。図17では例として、着目画素についてのエッジ候補画素のうち、画素(10,10)(=画素(X2,Y2))が、エッジ強度が大きい画素として選択されたものとする。また、所定個数だけ前に設定された着目画素を、画素(9,7)(=画素(X1,Y1))とする。また、画素(10,10)は顔の右側にあるものとする。 FIG. 17 is a diagram illustrating an example of setting the investigation direction in the second processing example. In FIG. 17, as an example, it is assumed that pixel (10, 10) (= pixel (X2, Y2)) is selected as a pixel having a high edge strength among the edge candidate pixels for the pixel of interest. Further, the pixel of interest set a predetermined number of times before is assumed to be a pixel (9, 7) (= pixel (X1, Y1)). The pixel (10, 10) is assumed to be on the right side of the face.
この場合、図15のステップS53ではトレース方向が下向きと判定される。また、ステップS55では、肌色領域の調査方向Cを決定するための座標(XS,YS)が、座標(9,7)から座標(10,10)へ向かう直線の傾きを左方向に90°回転させた方向に沿った座標(13,9)に設定される。そして、x増分=1、y増分=−(1/3)と算出される。 In this case, in step S53 of FIG. 15, it is determined that the trace direction is downward. Also, in step S55, the coordinates (XS, YS) for determining the skin color region investigation direction C are rotated 90 degrees to the left with respect to the slope of the straight line from the coordinates (9, 7) to the coordinates (10, 10). The coordinate (13, 9) along the direction is set. Then, x increment = 1 and y increment = − (1/3) are calculated.
このとき、輪郭検出部114は、画素(10,10)を起点として、調査方向Cに対してx座標をx増分に相当する1画素分ずつ加算しながら調査画素を選択していく。y座標についても同様にy増分の値ずつ加算していくが、y増分の絶対値が1未満であるので、調査画素のy座標が小数点以下の値を有する場合があり得る。y座標が小数点以下の値を有する場合、例えば、y座標の小数点以下の値を切り捨てたときの画素と切り上げたときの画素の両方が、調査画素に設定される。
At this time, the
例えば図17において、第1回目の調査画素の設定では、画素(11,9)と画素(11,10)とが調査画素に設定され、第2回目の調査画素の設定では、画素(12,9)と画素(12,10)とが調査画素に設定される。第3回目の調査画素の設定では、調査画素のy座標が整数となるので、1つの画素(13,9)が調査画素に設定される。 For example, in FIG. 17, in the first survey pixel setting, the pixel (11, 9) and the pixel (11, 10) are set as the survey pixel, and in the second survey pixel setting, the pixel (12, 9) and the pixel (12, 10) are set as the investigation pixel. In the third survey pixel setting, since the y coordinate of the survey pixel is an integer, one pixel (13, 9) is set as the survey pixel.
なお、調査画素のy座標が小数点以下の値を有する場合、y座標の切り捨てまたは切り上げを行うことで、1つの画素のみが調査画素に設定されるようにしてもよい。
前述した第1の処理例では、起点となる画素から、その画素の周囲に位置する8つの画素のいずれかの方向に、肌色領域の調査方向が設定される。このため、肌色領域の調査方向は45°単位で設定される。これに対して、第2の処理例では、肌色領域の調査方向の角度をより細かく設定することが可能である。これにより、調査が必要な領域を正確に設定できるようになり、本来あるべきでない方向に肌色領域があるかの判定精度を向上させることができる。
If the y coordinate of the survey pixel has a value after the decimal point, only one pixel may be set as the survey pixel by rounding down or rounding up the y coordinate.
In the above-described first processing example, the skin color area examination direction is set in the direction of one of the eight pixels located around the pixel from the starting pixel. For this reason, the investigation direction of the skin color area is set in units of 45 °. On the other hand, in the second processing example, it is possible to set the angle in the investigation direction of the skin color area more finely. As a result, it is possible to accurately set an area that needs to be investigated, and it is possible to improve the accuracy of determining whether the skin color area is in a direction that should not exist.
なお、上記の各実施の形態に示した装置(輪郭検出装置1,100)の処理機能は、コンピュータによって実現することができる。その場合、各装置が有すべき機能の処理内容を記述したプログラムが提供され、そのプログラムをコンピュータで実行することにより、上記処理機能がコンピュータ上で実現される。処理内容を記述したプログラムは、コンピュータで読み取り可能な記録媒体に記録しておくことができる。コンピュータで読み取り可能な記録媒体としては、磁気記憶装置、光ディスク、光磁気記録媒体、半導体メモリなどがある。磁気記憶装置には、ハードディスク装置(HDD)、フレキシブルディスク(FD)、磁気テープなどがある。光ディスクには、DVD、DVD−RAM、CD−ROM、CD−R/RWなどがある。光磁気記録媒体には、MO(Magneto-Optical disk)などがある。
The processing functions of the devices (
プログラムを流通させる場合には、例えば、そのプログラムが記録されたDVD、CD−ROMなどの可搬型記録媒体が販売される。また、プログラムをサーバコンピュータの記憶装置に格納しておき、ネットワークを介して、サーバコンピュータから他のコンピュータにそのプログラムを転送することもできる。 When distributing the program, for example, a portable recording medium such as a DVD or a CD-ROM in which the program is recorded is sold. It is also possible to store the program in a storage device of a server computer and transfer the program from the server computer to another computer via a network.
プログラムを実行するコンピュータは、例えば、可搬型記録媒体に記録されたプログラムまたはサーバコンピュータから転送されたプログラムを、自己の記憶装置に格納する。そして、コンピュータは、自己の記憶装置からプログラムを読み取り、プログラムに従った処理を実行する。なお、コンピュータは、可搬型記録媒体から直接プログラムを読み取り、そのプログラムに従った処理を実行することもできる。また、コンピュータは、ネットワークを介して接続されたサーバコンピュータからプログラムが転送されるごとに、逐次、受け取ったプログラムに従った処理を実行することもできる。 The computer that executes the program stores, for example, the program recorded on the portable recording medium or the program transferred from the server computer in its own storage device. Then, the computer reads the program from its own storage device and executes processing according to the program. The computer can also read the program directly from the portable recording medium and execute processing according to the program. In addition, each time a program is transferred from a server computer connected via a network, the computer can sequentially execute processing according to the received program.
1 輪郭検出装置
2 入力受付手段
3 探索手段
10 探索領域
11 開始領域
12 終了領域
21〜24 画素
31,32 肌色領域
33 領域
A1,A2 延伸方向
B1,B2 エッジ探索範囲
DESCRIPTION OF
Claims (8)
前記探索領域において前記開始領域側から前記終了領域側に向かってエッジを探索する探索手段であって、前記探索領域内の画素のうち、肌色領域と肌色領域とに挟まれた領域に位置すると判定された画素を、エッジと判定する画素から除外する探索手段と、
を有することを特徴とする輪郭検出装置。 In response to an input operation, an input receiving means for setting a search area having a certain width or more extended from the start area toward the end area on the input image;
Search means for searching for an edge in the search area from the start area side toward the end area side, and determined to be located in an area sandwiched between the skin color area and the skin color area among the pixels in the search area Search means for excluding selected pixels from pixels determined as edges;
A contour detection apparatus comprising:
前記探索手段は、前記探索領域内の画素のうち、その画素よりも検出された顔の外側方向に肌色領域が存在する画素を、肌色領域と肌色領域とに挟まれた領域に位置すると判定する、
ことを特徴とする請求項1記載の輪郭検出装置。 Further comprising face detection means for detecting a human face from the input image;
The search means determines that, of the pixels in the search area, a pixel in which a skin color area exists outside the face detected from the pixel is located in an area sandwiched between the skin color area and the skin color area. ,
The contour detection apparatus according to claim 1.
前記探索領域の中から設定した着目画素の周囲画素のうち、当該着目画素の位置での前記探索領域の延伸方向を含む所定範囲に含まれる画素をエッジ候補画素とし、前記エッジ候補画素からエッジである可能性が高い画素を判定して次の着目画素に設定するエッジ探索処理を、着目画素が前記開始領域から前記終了領域に達するまで繰り返し、
前記設定した着目画素の周囲画素のうち、その画素よりも検出された顔の外側方向に肌色領域が存在する画素を、肌色領域と肌色領域とに挟まれた領域に位置すると判定して前記エッジ候補画素から除外する、
ことを特徴とする請求項2記載の輪郭検出装置。 The search means includes
Among the surrounding pixels of the target pixel set from the search region, pixels included in a predetermined range including the extension direction of the search region at the position of the target pixel are set as edge candidate pixels, and the edge candidate pixel to the edge The edge search process for determining a pixel having a high possibility and setting the next target pixel is repeated until the target pixel reaches the end region from the start region,
Among the surrounding pixels of the set pixel of interest, a pixel having a skin color area in the outward direction of the face detected from the pixel is determined to be located in an area sandwiched between the skin color area and the skin color area, and the edge Exclude from candidate pixels,
The contour detection apparatus according to claim 2.
入力操作に応じて、開始領域から終了領域に向かって延伸された、一定以上の幅を有する探索領域を、入力画像上に設定し、
前記探索領域において前記開始領域側から前記終了領域側に向かってエッジを探索する、
処理を含み、
前記エッジを探索する処理では、前記探索領域内の画素のうち、肌色領域と肌色領域とに挟まれた領域に位置すると判定された画素を、エッジと判定する画素から除外する、
ことを特徴とする輪郭検出方法。 Contour detection device
In accordance with the input operation, a search area having a certain width or more extended from the start area to the end area is set on the input image,
In the search area, an edge is searched from the start area side toward the end area side.
Including processing,
In the process of searching for the edge, out of the pixels in the search region, the pixel determined to be located in the region sandwiched between the skin color region and the skin color region is excluded from the pixel determined as the edge.
A contour detection method characterized by the above.
入力操作に応じて、開始領域から終了領域に向かって延伸された、一定以上の幅を有する探索領域を、入力画像上に設定し、
前記探索領域において前記開始領域側から前記終了領域側に向かってエッジを探索する、
処理を実行させ、
前記エッジを探索する処理では、前記探索領域内の画素のうち、肌色領域と肌色領域とに挟まれた領域に位置すると判定された画素を、エッジと判定する画素から除外する、
ことを特徴とする輪郭検出プログラム。 On the computer,
In accordance with the input operation, a search area having a certain width or more extended from the start area to the end area is set on the input image,
In the search area, an edge is searched from the start area side toward the end area side.
Execute the process,
In the process of searching for the edge, out of the pixels in the search region, the pixel determined to be located in the region sandwiched between the skin color region and the skin color region is excluded from the pixel determined as the edge.
A contour detection program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012254804A JP6031962B2 (en) | 2012-11-21 | 2012-11-21 | Contour detection device, contour detection method, and contour detection program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012254804A JP6031962B2 (en) | 2012-11-21 | 2012-11-21 | Contour detection device, contour detection method, and contour detection program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2014102712A true JP2014102712A (en) | 2014-06-05 |
JP6031962B2 JP6031962B2 (en) | 2016-11-24 |
Family
ID=51025159
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012254804A Expired - Fee Related JP6031962B2 (en) | 2012-11-21 | 2012-11-21 | Contour detection device, contour detection method, and contour detection program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6031962B2 (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0877336A (en) * | 1994-09-06 | 1996-03-22 | Fuji Photo Film Co Ltd | Area extracting method |
JP2000339483A (en) * | 1999-05-27 | 2000-12-08 | Canon Inc | Edge tracing method and storage medium |
JP2007257322A (en) * | 2006-03-23 | 2007-10-04 | Nissan Motor Co Ltd | Face portion detecting method and its device |
JP2009087323A (en) * | 2007-09-14 | 2009-04-23 | Canon Inc | Image processing apparatus, and specific region detection method |
JP2012216179A (en) * | 2011-03-31 | 2012-11-08 | Casio Comput Co Ltd | Image processing device, image processing method, and program |
-
2012
- 2012-11-21 JP JP2012254804A patent/JP6031962B2/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0877336A (en) * | 1994-09-06 | 1996-03-22 | Fuji Photo Film Co Ltd | Area extracting method |
JP2000339483A (en) * | 1999-05-27 | 2000-12-08 | Canon Inc | Edge tracing method and storage medium |
JP2007257322A (en) * | 2006-03-23 | 2007-10-04 | Nissan Motor Co Ltd | Face portion detecting method and its device |
JP2009087323A (en) * | 2007-09-14 | 2009-04-23 | Canon Inc | Image processing apparatus, and specific region detection method |
JP2012216179A (en) * | 2011-03-31 | 2012-11-08 | Casio Comput Co Ltd | Image processing device, image processing method, and program |
Also Published As
Publication number | Publication date |
---|---|
JP6031962B2 (en) | 2016-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7573462B2 (en) | Image display apparatus, multi display system, coordinate information output method, and program for implementing the method | |
US8749497B2 (en) | Multi-touch shape drawing | |
US9182854B2 (en) | System and method for multi-touch interactions with a touch sensitive screen | |
ES2663546T3 (en) | Interpretation of ambiguous inputs on a touch screen | |
TWI546711B (en) | Method and computing device for determining angular contact geometry | |
US10318152B2 (en) | Modifying key size on a touch screen based on fingertip location | |
US20110205189A1 (en) | Stereo Optical Sensors for Resolving Multi-Touch in a Touch Detection System | |
US20200133432A1 (en) | Virtual touch screen | |
JP5802247B2 (en) | Information processing device | |
US20120319945A1 (en) | System and method for reporting data in a computer vision system | |
JP2010102395A (en) | Image processing apparatus, image processing method, and program | |
JP2020170297A (en) | Input device | |
US10146424B2 (en) | Display of objects on a touch screen and their selection | |
CN111414124A (en) | Image measuring method, device, equipment and storage medium | |
JP5982956B2 (en) | Information processing apparatus, information processing method, and information processing program | |
JP6031961B2 (en) | Contour detection device, contour detection method, and contour detection program | |
JP2018067298A (en) | Handwritten content editing device and handwritten content editing method | |
JP6031962B2 (en) | Contour detection device, contour detection method, and contour detection program | |
WO2022123929A1 (en) | Information processing device and information processing method | |
JP2017207972A (en) | Image processing device, image processing method, and program | |
KR20190049349A (en) | Method for recognizing user's touch on projection image and apparatus for performing the method | |
US20140201687A1 (en) | Information processing apparatus and method of controlling information processing apparatus | |
JPWO2019171635A1 (en) | Operation input device, operation input method, and program | |
KR102622431B1 (en) | Method, computer program and electric device for generating 3d model based on plane information recognized according to user input | |
US20210000447A1 (en) | Touchscreen method for medically precise measurements in ultrasound images |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20150706 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20160622 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20160705 |
|
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: 20160927 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20161010 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6031962 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |