JP5192315B2 - Indentation detection method for dividing a binary image into regions - Google Patents
Indentation detection method for dividing a binary image into regions Download PDFInfo
- Publication number
- JP5192315B2 JP5192315B2 JP2008209367A JP2008209367A JP5192315B2 JP 5192315 B2 JP5192315 B2 JP 5192315B2 JP 2008209367 A JP2008209367 A JP 2008209367A JP 2008209367 A JP2008209367 A JP 2008209367A JP 5192315 B2 JP5192315 B2 JP 5192315B2
- Authority
- JP
- Japan
- Prior art keywords
- point
- region
- concave point
- run
- line
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000001514 detection method Methods 0.000 title claims description 16
- 238000007373 indentation Methods 0.000 title claims description 13
- 238000000034 method Methods 0.000 claims description 57
- 230000008859 change Effects 0.000 claims description 7
- 230000008569 process Effects 0.000 description 8
- 238000005452 bending Methods 0.000 description 7
- 238000004458 analytical method Methods 0.000 description 6
- 238000007796 conventional method Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 6
- 238000004364 calculation method Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 230000009467 reduction Effects 0.000 description 4
- 238000007781 pre-processing Methods 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000003247 decreasing effect Effects 0.000 description 2
- 238000002360 preparation method Methods 0.000 description 2
- 238000003672 processing method Methods 0.000 description 2
- HCUOEKSZWPGJIM-YBRHCDHNSA-N (e,2e)-2-hydroxyimino-6-methoxy-4-methyl-5-nitrohex-3-enamide Chemical compound COCC([N+]([O-])=O)\C(C)=C\C(=N/O)\C(N)=O HCUOEKSZWPGJIM-YBRHCDHNSA-N 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000000994 depressogenic effect Effects 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000000630 rising effect Effects 0.000 description 1
Images
Landscapes
- Image Analysis (AREA)
Description
本発明はディジタル画像処理技術に係り、特に2値化された領域を複数の素図形に分割する際に必要となる、輪郭線上の凹点を検出する技術に関する。 The present invention relates to a digital image processing technique, and more particularly to a technique for detecting a concave point on a contour line, which is necessary when a binarized region is divided into a plurality of elementary figures.
映像情報機器の進歩により、テレビやビデオの映像を計算機によって処理する技術が広く普及しつつある。例えば映画をビデオ化した映像では、旧来は映像が単に受像機に表示されるのみで、ここから特定の出演者が映されているシーンを抜き出そうとすると、視聴者が目視でシーンを選択する必要があった。これがディジタル映像処理の普及につれて、映像中の1コマ(以下「画像」と表記する)にどんな物体や人物が写っているかを、自動的に抽出できるようになりつつある。 With the advancement of video information equipment, technology for processing television and video images with computers is becoming widespread. For example, in the case of video that has been converted into a movie, traditionally the video is simply displayed on the receiver, and the viewer selects the scene visually when trying to extract a scene showing a specific performer from here. There was a need to do. With the spread of digital video processing, it is becoming possible to automatically extract what kind of object or person appears in one frame (hereinafter referred to as “image”) in the video.
この様な機能は通常、画像中の物体の形状を既知の物体と比較する事、すなわち何らかのマッチング作業を行なう事で実現される。しかしながらマッチング作業では、物体が1つずつ個別に撮影されている事が前提条件となる。従ってマッチング作業の前段階として、複数の物体を個々のものに分割する作業が、しばしば必要となる。典型的な例として、画像に2人の歩行者が映されている場合、両者がすれ違う時に物体が重なりあう。この場合、一人ずつに分割しないと、それが歩行者(人間)である事を検出できなくなる。 Such a function is usually realized by comparing the shape of an object in an image with a known object, that is, by performing some kind of matching operation. However, in the matching work, it is a precondition that objects are individually photographed one by one. Therefore, it is often necessary to divide a plurality of objects into individual objects before the matching operation. As a typical example, when two pedestrians are shown in an image, objects overlap each other when they pass each other. In this case, it is impossible to detect that the person is a pedestrian (human) unless it is divided into one person.
上記の様な分割を自動的に行なうための類似技術として、特許文献1では以下の発明(以下「従来法」と記す)が開示されている。すなわち、人間の手の映像を入力として、まず手の輪郭線(エッジ)を抽出した後、輪郭線の方向が急激に変化する点(特許文献1における「屈曲点」)を検出する、というものである。この結果2本の指の境界が、屈曲点として検出される。これにより、特許文献1には明記されていないが、手の映像から複数の指を分割する、という発明が開示されている。
しかしながら上記の従来法では、輪郭線の方向がどの程度急激に変化すれば「屈曲点」とするべきか、という点が明確に述べられていない。この結果、図2に示すような図形を上手く分離できない。図2は2つの円が重なった図形であり、重なりが(a)は小さく(b)は大きい。両者共に図中の点201〜202を結ぶ線分で切断すれば、図形は2つの円(の一部)に分割される。これに従来法を適用する場合、変化の判定基準をたとえば角度90度に設定したとすると、(a)は分割されるが(b)は分割の対象とならず、円が2つあるという事実を見失う事になる。図2における点201の角度は、円の重なりが大きくなるに従いいくらでも大きくなるので、一般的に適切な判定基準を決定する事は原理的に不可能である。このため、屈曲点の判定基準を応用場面に応じて実験的に設定する必要が生じ、汎用性の低い方法となっていた。 However, in the above conventional method, it is not clearly stated how much the direction of the contour line should be changed to be a “bending point”. As a result, the figure as shown in FIG. 2 cannot be separated well. FIG. 2 shows a figure in which two circles are overlapped, and the overlap (a) is small and (b) is large. If both are cut by a
本発明の目的は上記の課題を解決して、広範囲の画像に対して一般的に適用できる分割方法を提供する事にある。このための核心技術として、経験的な判定基準を用いずに輪郭線上の凹点を検出する方法を提供する。ここで凹点とは文字通り輪郭線上の窪んだ点であり、従来技術における「屈曲点」のうち輪郭線が外側方向に屈曲しているものを意味する。凹点が検出できれば、それに基づいて図形を分割する事は、比較的簡単な作業となるので、本明細書においては凹点を検出する方法に絞って発明を開示する。 An object of the present invention is to solve the above-described problems and provide a dividing method that can be generally applied to a wide range of images. As a core technique for this purpose, a method for detecting a concave point on a contour line without using an empirical criterion is provided. Here, the concave point is literally a depressed point on the contour line, and means a “bent point” in the prior art where the contour line is bent outward. If a concave point can be detected, dividing a figure based on the detected point is a relatively simple task. Therefore, the present invention discloses only the method for detecting the concave point.
上記の課題を解決するためには、角度などの概念を用いずに凹点を定義できれば良い。このために本発明では、下記の幾何学的性質に基づいて、新たな凹点の定義を開示する。 In order to solve the above problem, it is only necessary to be able to define a concave point without using a concept such as an angle. For this reason, the present invention discloses a new definition of the indentation point based on the following geometric property.
まず、凹点を定義するという事は、それと相補的な概念である凸領域を定義する事と等価である。ここで凸領域は、通常の意味での幾何学(ユークリッド幾何学)においては以下の様に定義されている。
「単連結の領域において、領域中の任意の2点を結ぶ線分が、常に当該領域の内部にある場合、当該領域を凸であると言う。」
しかしながらこの定義は、ユークリッド幾何学すなわち点が連続的に存在する事を前提としている。本発明はディジタル画像を対象としたものであり、そこでは点(画素)が離散的にしか存在しない。この場合、領域の内部/外部という概念が曖昧になる。典型例として図3(a)に示す5点からなる領域を考えると、図中の線分301が図形の内部か外部かは明確でない。また図3(b)は2値画像302の中に直角三角形303を描いた例である。画素が2値でかつ離散的に存在する限り、直角三角形をこれ以上正確に描くのは不可能である。しかしながら同図の斜辺は微視的にみるとギザギザの折線であり、直線とは言い難い。しかしながらこの折線は直線を可能な限り忠実に描いたものであるから、これが実は直線であり、従って直角三角形は凸図形である事を示す様な定義が必要である。First, defining a concave point is equivalent to defining a convex region, which is a complementary concept. Here, the convex region is defined as follows in geometry in the ordinary sense (Euclidean geometry).
“In a single connected region, when a line segment connecting any two points in the region is always inside the region, the region is said to be convex.”
However, this definition assumes that Euclidean geometry, that is, the points exist continuously. The present invention is intended for digital images, where there are only discrete points (pixels). In this case, the concept of inside / outside of the area becomes ambiguous. As a typical example, when an area consisting of five points shown in FIG. 3A is considered, it is not clear whether the
そこで本発明では、計算幾何学の概念を用いて上記の定義を変換する。計算幾何学では、「凸包」という概念が知られている。凸包とは図4(a)に示す通り、401−1等の与えられた点の集合を包含する最小の凸図形410の事を言う。これは点が有限個の場合は必然的に凸多角形となる。これを用いれば、上記の凸領域の定義は以下の様に言い換えられる。
「ある領域が、その領域から定められる凸包と一致する場合、その領域は凸である。」
ここで凸包は、領域が有限離散個の点の集合からなる場合、以下の手続きにより作成できる事が知られている。すなわち、図4(b)に示す通り、まず領域の最も右側にある点(図4(b)における点P0)を求める。この結果、領域に属する点は全て図中の線分420の左側に存在する(この性質を以下で「左側ルール」と呼ぶ)。次に、有向線分421を定める。ここで421は、P0を始点として左側ルールが成立ち、かつ420となす角度(左折の大きさ、図中の角度a0)が最小になる様な線分である。この様に421を定めた結果、凸包の次の頂点となる点P1が求まる。以後同様に繰り返して、有向線分422および頂点P2、……、を定めて行く。領域は有限の大きさなので、この繰り返しは有限回で終了し、最後の有向線分の終点は最初の頂点P0となる。以上で得られる多角形P0P1P2……Pn−1が、当該領域の凸包である。Therefore, in the present invention, the above definition is converted using the concept of computational geometry. In computational geometry, the concept of “convex hull” is known. As shown in FIG. 4A, the convex hull means a minimum convex figure 410 including a given set of points such as 401-1. This is necessarily a convex polygon when the number of points is finite. If this is used, the above-mentioned definition of the convex region can be rephrased as follows.
“A region is convex if it matches the convex hull defined from that region.”
Here, it is known that the convex hull can be created by the following procedure when the region is composed of a set of finite discrete points. That is, as shown in FIG. 4B, first, a point on the rightmost side of the region (point P0 in FIG. 4B) is obtained. As a result, all points belonging to the region are present on the left side of the
凸包は多角形の一種であるから、その内部/外部という概念は、点(画素)が離散的にしか存在しない場合でも明確に定義できる。また、凸包の外部には当該領域に属する点は存在しない事は、上記の手続きから明らかである。これらの結果、凸領域の定義を更に言換える事ができる。すなわち、
「ある領域から作成される凸包の内部に、当該領域に属さない点(画素)が含まれない場合、当該領域を凸領域と呼ぶ。」
以上の定義に基づき、凹点が存在する事の判定が可能となる。すなわち、ある領域の全部または一部を取出した場合、その部分が上記の凸領域の定義に合致すれば、凹点は存在しない。たとえば図1に示す通り、(a)の領域101は凸領域であり凹点は存在せず、(b)の領域102は凸領域ではなく図中の点110が凹点となる。この方法によれば、従来法における角度の設定という課題を経る事なく、凹点が検出できる。Since the convex hull is a kind of polygon, the concept of inside / outside can be clearly defined even when points (pixels) exist only discretely. Further, it is clear from the above procedure that there is no point belonging to the region outside the convex hull. As a result, the definition of the convex region can be further rephrased. That is,
“When a point (pixel) that does not belong to the region is not included in a convex hull created from a certain region, the region is called a convex region.”
Based on the above definition, it is possible to determine that a concave point exists. That is, when all or part of a certain area is extracted, if that part matches the definition of the convex area, there is no concave point. For example, as shown in FIG. 1, the
但し上記の定義をそのまま凹点検出に適用するのは効率的でない。
すなわち上記によれば、まず当該領域の凸包を図4に示した手順により求めねばならない。この為には凸包の頂点(「包絡点」と称する文献もある)を求める必要があるが、通常は外形線上のどの点(画素)が頂点となるか自明ではなく、外形線を辿って頂点を探索する必要が生じる。領域の形状が複雑な場合、ある頂点から次の頂点を求めるために、外形線の長さの半分以上を探索する場合もあり、処理に手間がかかる。更に、仮に凸包が求められたとしても、その内部に領域外の点が含まれるか否かを判定する為には、外形線を再度辿る、あるいはそれと等価な何等かの処理を行なう必要があり、処理に重複を生じる。
本発明では以上の状況をも考慮して、凸包を陽に求める事なく、かつ前述した凸領域の定義に則って凹点を検出する方法を開示する。However, it is not efficient to apply the above definition to the indentation detection as it is.
That is, according to the above, first, the convex hull of the region must be obtained by the procedure shown in FIG. For this purpose, it is necessary to find the vertex of the convex hull (there is also a document called “envelope point”), but usually it is not obvious which point (pixel) on the outline is the apex, but tracing the outline It is necessary to search for vertices. When the shape of the region is complicated, in order to obtain the next vertex from one vertex, a search may be made for more than half of the length of the outline, which takes time. Furthermore, even if a convex hull is obtained, it is necessary to trace the outline again or to perform some equivalent process in order to determine whether or not a point outside the region is included inside the convex hull. Yes, processing is duplicated.
In consideration of the above situation, the present invention discloses a method for detecting a concave point without explicitly obtaining the convex hull and following the above-described definition of the convex region.
以上に拠った本発明の特徴は、以下の通りである。すなわち本発明の第1の特徴は、2値画像内の領域に対して、外形線上の凹点を求める方法であって、当該領域が形成する凸包の内部に領域外の点が存在するか否かを判定する事により凹点が存在するか否かを決定する方法において、当該領域の外形線を方向差分符号で表現した後に、上記方向差分符号の系列を、方向が隣接する2つの符号のみからなる部分系列(「2方向系列」と称する)に分割するステップと、得られた2方向系列の集合に対して隣接する2者の方向を比較する事により両者の間に凹点が存在するか否かを決定する隣接凹点判定ステップと、得られた2方向系列の集合に対して個々の2方向系列の内部に凹点が存在するか否かを決定する内部凹点判定ステップと、を備える事にある。 The characteristics of the present invention based on the above are as follows. That is, the first feature of the present invention is a method for obtaining a concave point on an outline for an area in a binary image, and whether there is a point outside the area inside the convex hull formed by the area. In the method of determining whether or not there is a concave point by determining whether or not, after expressing the outline of the region by a direction difference code, the sequence of the direction difference codes is converted into two codes whose directions are adjacent to each other. There is a concave point between the step of dividing into a partial series consisting of only (referred to as “two-way series”) and comparing the directions of two adjacent parties to the set of two-way series obtained An adjacent concave point determining step for determining whether or not to perform, and an internal concave point determining step for determining whether or not there is a concave point within each two-way series for the obtained set of two-way series; , To prepare.
また本発明の第2の特徴は、第1の特徴を有する凹点検出方法において、上記内部凹点判定ステップは、判定対象となる2方向系列をラン表現に変換した後、隣接する2つのラン(「ラン対」と称する)に対して各々のラン長の差を当該ラン対の指標とし、左記指標の変化に基づいて凹点が存在するか否かを決定する事にある。 According to a second feature of the present invention, in the concave point detection method having the first feature, the internal concave point determination step converts the two-direction sequence to be determined into a run expression, and then converts two adjacent runs. The difference between the run lengths (referred to as “run pair”) is used as an index of the run pair, and it is determined whether or not there is a concave point based on the change in the index shown on the left.
また本発明の第3の特徴は、第2の特徴を有する凹点検出方法において、前期指標の変化が高々1のみである区間(「擬直線」と称する)を検出し、当該区間に対しては他の区間と別の凹点判定ステップを適用する事にある。 According to a third feature of the present invention, in the method for detecting a concave point having the second feature, a section (referred to as a “pseudo-straight line”) in which the change in the previous period index is at most 1 is detected, Is to apply a step for determining the indentation that is different from other sections.
また本発明の第4の特徴は、第3の特徴を有する凹点検出方法において、当該擬直線の内側に含まれる画素数を当該擬直線に対応する指標の系列から算出するステップを有し、左記ステップにより算出された画素数を、当該擬直線の始点と終点を斜辺とする直角三角形の面積と比較する事により、前記凸包の内部に領域外の点が存在するか否かを判定する事にある。 According to a fourth feature of the present invention, in the method for detecting a concave point having the third feature, the method includes a step of calculating the number of pixels included inside the pseudo line from a series of indices corresponding to the pseudo line, By comparing the number of pixels calculated in the left step with the area of a right triangle whose hypotenuse is the start point and end point of the pseudo-line, it is determined whether or not there is a point outside the region inside the convex hull. There is a thing.
また本発明の第5の特徴は、第4の特徴を有する凹点検出方法において、底辺の長さがmかつ垂辺の長さがnである直角三角形の面積を、下記の数式
((m+1)×(n+1)−gcd(m、n)−1)÷2+gcd(m、n)+1
但しgcd(m、n)はmとnとの最大公約数を表す
を用いて算出する事にある。
なお上記の数式は、後述の数1と同じものである。According to a fifth feature of the present invention, in the concave point detection method having the fourth feature, the area of a right triangle having a base length of m and a base length of n is represented by the following formula ((m + 1 ) × (n + 1) −gcd (m, n) −1) ÷ 2 + gcd (m, n) +1
However, gcd (m, n) is calculated by using the greatest common divisor of m and n.
The above mathematical formula is the same as
本発明によれば、従来法よりも汎用性の高い領域分割方法を実現する事が可能になり、画像認識技術やその応用装置の更なる高度化・高機能化に資する事ができる。 According to the present invention, it is possible to realize a region dividing method having higher versatility than the conventional method, and it is possible to contribute to further advancement and higher functionality of image recognition technology and its application devices.
本発明は、コンピュータ上で動作するソフトウェアとして実施するのが妥当である。ここで使用するコンピュータは、いわゆる画像処理機能を実行できるものならば何でも良い。以下に実施例として、本発明の特徴を有するコンピュータプログラムの算法を、図面を用いて説明する。 It is appropriate to implement the present invention as software that runs on a computer. The computer used here may be any computer that can execute a so-called image processing function. As an embodiment, a calculation method of a computer program having the features of the present invention will be described with reference to the drawings.
図5は本発明による凹点検出方法のアルゴリズムの全体像を示すフローチャートである。以下、同図面に沿って算法の概要を説明する。 FIG. 5 is a flowchart showing an overall image of the algorithm of the indentation detection method according to the present invention. The outline of the algorithm will be described below with reference to the same drawing.
本発明による凹点検出方法は、ステップ500(以下「S500」等と略記する)以下の処理によって実現される。まず処理対象の2値画像を入力し(S501)、その中の処理対象となる領域に対して、その輪郭線を抽出する(S502)。ここで「領域」とは、2値画像において画素値が「1」の画素の連結集合の事であり、たとえば図6(a)では2つの領域601および602が2値画像600に含まれている。ここで領域を構成する画素の中で、領域外の画素との境界部分にある画素を順次辿ったものを、当該領域の「輪郭線」と呼ぶ事にする。たとえば領域601に対しては、同図(b)の矢印「→」等に沿って境界を辿る事により、輪郭線が得られる。なお本発明では境界を辿る際には、縦横に加えて斜め方向へ進む事も許す(いわゆる「8近傍ルール」)ものとした。 The indentation detection method according to the present invention is realized by the processing in step 500 (hereinafter abbreviated as “S500” or the like). First, a binary image to be processed is input (S501), and a contour line is extracted from the region to be processed (S502). Here, “area” means a connected set of pixels having a pixel value “1” in the binary image. For example, in FIG. 6A, two
次に輪郭線の形状を、以下に述べる「方向差分符号」の系列とした表現に変換する(S503)。方向差分符号とは、2値画像で2つの画素が隣接する場合に、片方がもう一方からみてどの方向にあるかを符号化して表現するものである。輪郭線は隣接する画素の系列であるから、その形状を表現するには画素の位置を示すよりも、画素がどの方向に並ぶかを示した方が便利な場合が多い。そこで図6(b)で用いた8方向の矢印に対して、図7(a)で示す様な8種類の符号〈0〉……〈7〉を定めて、この符号を輪郭線に沿った系列として並べる事により、輪郭線の形状が表現できる。例えば図6(b)に示した矢印の系列は、図7(b)(説明の便宜上拡大して表示した)の701で示すとおり〈0111212232333345556566767777〉と表現できる。ここで用いられる8種類の符号〈0〉……〈7〉を「方向差分符号」と本書では記す。なお本明細書では他の符号や数値との混同を避けるため、方向差分符号を記述する際には山形括弧「〈 〉」で括る事とした。また図6の様に輪郭線が閉じた曲線をなす場合は、符号の開始位置を何処にとるかに任意性が生じるが、これは処理プログラムの都合に従って適宜定めれば良い。なお本発明においては、符号〈0〉が最初に現れる位置(図7(b)における位置710)を開始位置とした。 Next, the shape of the contour line is converted into an expression as a series of “direction difference codes” described below (S503). The direction difference code is an encoded representation of which direction one side is seen from the other when two pixels are adjacent in a binary image. Since the contour line is a series of adjacent pixels, it is often more convenient to indicate in which direction the pixels are arranged than to indicate the position of the pixels in order to express the shape. Therefore, eight types of codes <0>... <7> as shown in FIG. 7A are defined for the eight-direction arrows used in FIG. 6B, and these codes are arranged along the contour line. By arranging them as a series, the shape of the contour line can be expressed. For example, the series of arrows shown in FIG. 6B can be expressed as <01112122232333345555666676777> as shown by 701 in FIG. 7B (enlarged and displayed for convenience of explanation). The eight types of codes <0>... <7> used here are referred to as “direction difference codes”. In this specification, in order to avoid confusion with other codes and numerical values, the direction difference code is described in angle brackets “<>”. In addition, when the contour is a closed curve as shown in FIG. 6, there is arbitraryness depending on where the start position of the code is taken, but this may be appropriately determined according to the convenience of the processing program. In the present invention, the position where the code <0> first appears (
次に本発明においては、輪郭線上の90度を越える屈曲を除去する(S504)。このステップは、90度を越える屈曲が輪郭線上に存在すると後続する諸ステップにおいて煩雑な例外処理が生じるため、予め輪郭線をある程度滑らかにしておく事を目的とする。具体的には図8に示す通り、輪郭線上に±90度(同図(a))、±135度(同図(b))、および180度(同図(c))の屈曲が存在する場合、屈曲の原因となる画素を輪郭線から除去する作業を行なう。この結果、方向差分符号系列で引き続く2つの符号は、同じか差が±1かのいずれかに限られる事になり、その後の処理が簡略化できる。なお本ステップを実現する方法としては、方向差分符号系列を先頭からスキャンして行き、図8に当てはまる箇所を図示の規則により書き換えて行く、という操作を繰返すプログラムを作成すれば良い。 Next, in the present invention, bending over 90 degrees on the contour line is removed (S504). The purpose of this step is to make the contour line smooth to some extent in advance because complicated exception processing occurs in subsequent steps if a bend exceeding 90 degrees exists on the contour line. Specifically, as shown in FIG. 8, there are bends of ± 90 degrees (same figure (a)), ± 135 degrees (same figure (b)), and 180 degrees (same figure (c)) on the contour line. In this case, an operation for removing the pixel causing the bending from the contour line is performed. As a result, the two codes that follow in the direction difference code sequence are limited to either the same or the difference of ± 1, and the subsequent processing can be simplified. As a method for realizing this step, a program that repeats the operation of scanning the direction difference code sequence from the top and rewriting the portion applicable to FIG. 8 according to the illustrated rule may be created.
ここまでに述べた諸ステップはまとめて、本発明による凹点検出方法における前処理段階550となる。これらの諸ステップは、入力画像の諸特性に応じて適宜省略又は簡略化して良く、たとえば入力画像600が既に何らかの平滑化処理を経ている事が確実な場合は、S504を省略または簡略化できる。またこれらの諸ステップはいずれも、画像処理分野で周知の技法であるので、実装に関する詳細な説明(流れ図等)は省略する。 The steps described so far are collectively the
以上の前処理段階550の基に本発明においては、引続くステップとして輪郭線を2方向系列に分割する作業を行なう(S505)。ここで2方向系列とは、本発明の第1の特徴で述べた通り、方向差分符号において方向が隣接する2つの符号値を組にした系列の事を言う。
具体的には、図9(a)に示される領域900に対して図9(b)910の通り方向差分符号の系列が得られるが、これを更に図9(c)の要領で、(01)からなる2方向系列、(12)からなる2方向系列、……、(70)からなる2方向系列、に分割する。In the present invention, based on the
Specifically, a sequence of directional difference codes is obtained as shown in FIG. 9 (b) 910 for the
この様に分割する事で、輪郭線の大局的な方向を表現する事ができる。たとえば円の輪郭線を方向差分符号で表現した場合、図10に模式的に示される様に、円の最上点の近傍では、符号〈1〉がまとまって出現する。同様に最右点、最下点、最左点の近傍で符号〈3〉、〈5〉、〈7〉が各々まとまって出現する。更にこれらから45°傾いた付近で、符号〈0〉、〈2〉、〈4〉、〈6〉が各々まとまって出現する。これらの中間となる区間では2種類の符号が混在して出現する事になり、たとえば符号〈0〉と〈1〉との間は〈01〉からなる2方向系列が形成される。なお2方向系列〈01〉には定義により、前後の〈0〉および〈1〉のみからなる区間も含まれ、従って2方向系列〈01〉と〈12〉とは、〈1〉のみからなる区間を共有する(他の組合せも同様)。ここで各2方向系列の内部においては、微視的には方向が逆順で現れる事がありうる。たとえば図9(a)の例では、図中の点901の所で符号〈1〉の後に符号〈0〉が現れており、微視的に見れば輪郭線が凹型をしている様に見える。しかしながらこれは図3にも示した通り、画素が離散的に存在するため生じる現象であり、これのみからこの点が凹点であるとは断定できない。2方向系列を用いれば、この様な微視的な問題に囚われずに、大局的に凹凸を判定できる。 By dividing in this way, the global direction of the contour line can be expressed. For example, when the outline of a circle is expressed by a direction difference code, as schematically shown in FIG. 10, the code <1> appears together in the vicinity of the top point of the circle. Similarly, symbols <3>, <5>, and <7> appear together in the vicinity of the rightmost point, the lowermost point, and the leftmost point. Further, the symbols <0>, <2>, <4>, and <6> appear together in the vicinity inclined 45 ° from these. In the middle section, two types of codes appear together. For example, a two-way sequence consisting of <01> is formed between the codes <0> and <1>. By definition, the two-way sequence <01> also includes a section consisting only of preceding and following <0> and <1>. Therefore, the two-way sequence <01> and <12> are sections consisting only of <1>. (Other combinations are also the same). Here, within each two-way series, the directions may appear in reverse order microscopically. For example, in the example of FIG. 9A, the sign <0> appears after the sign <1> at the
以上で述べた分割作業を実行するためには、方向差分符号系列を前方からスキャンして行き、3種類目の符号が出現した時点で分割箇所を決定する、という操作を行なうプログラムを作成すれば良い。これらの操作は文字列処理技術において周知の技法であるので、詳細なフローチャートは省略する。 In order to execute the division work described above, if a program that scans the direction difference code sequence from the front and determines the division point when the third type code appears is created, good. Since these operations are well-known techniques in the character string processing technology, detailed flowcharts are omitted.
以上の通り2方向系列への分割が完了したので、これを用いて本発明の特徴である凹点検出を、引き続くS506以降で行なう。この最初の段階としてS506からS508により、2方向系列の境界部分に凹点が存在するか否かを判定する。すなわち、たとえば2方向系列〈01〉に引き続いて〈12〉が出現すれば、当該領域は大局的には凸であると判定し、逆に〈70〉が引き続いて出現すれば、両者の接続部分が非凸図形となっていると判定する。後者の例を図11に示す。この例では同図(a)に示す方向差分符号系列1100が2つの2方向系列1101および1102に分けられ、すなわち2方向系列〈01〉に〈70〉が引き続いて出現している。この輪郭線の形状は同図(b)の通りとなり、局所的な凸包1110の上に領域外の画素1111−1および1111−2が存在するので、凸領域の定義に反している。この様に、次の系列が図10で示した方向(これを「凸方向」と記した)であるか否かの判定を行なって(S507)、否の場合には両者の接続部分を凹点として登録する(S508)、という処理を全ての2方向系列に対して繰り返す(S506)事により、与えられた領域が大局的に凸領域かどうかについて判定が完了する。なおここで登録とは、画像処理装置のメモリに記憶する方法、外部記憶装置に出力する方法、等が考えられるが、凹点の存在情報を以降の処理で利用できればどの様な方法でも良く、本発明ではその詳細は規定しない。また接続部分が多数の画素からなる場合は、たとえば中間点のみで代表させても良い。 As described above, since the division into the two-way series is completed, the detection of the concave point, which is a feature of the present invention, is performed in and after S506. As the first step, it is determined from S506 to S508 whether or not there is a concave point at the boundary part of the two-way sequence. That is, for example, if <12> appears following the two-way sequence <01>, it is determined that the region is generally convex, and conversely if <70> appears subsequently, the connecting portion between the two Is determined to be a non-convex figure. An example of the latter is shown in FIG. In this example, the directional
引き続くステップS509〜では、1つの2方向系列の内部に凹点が存在するか否かを判定する。これらのステップを以下に説明するが、そのための準備としてまず、本発明の特徴である「ラン対」および「擬直線」とは何かを説明する。 In subsequent steps S509 and thereafter, it is determined whether or not there is a concave point in one two-way series. These steps will be described below. In preparation for this, first, what are “run pairs” and “pseudo-straight lines” that are the characteristics of the present invention will be described.
既に説明の通り、本発明は「2方向系列」すなわち方向差分符号において方向が隣接する2つの符号値を組にした系列を、処理の単位としている。この下では、系列に含まれる符号は2種類のみであるから、1つの符号が連続して現れる回数を用いて、系列を表現する事ができる。すなわち図12の例に示す通り、2方向系列1200において符号〈0〉と〈1〉とが各々何回ずつ連続するかを数えると1201の通りとなり、従って1210で示される表現でこの2方向系列を表す事ができる。この様な表現方法は「ラン表現」として知られており、画像処理装置(たとえばFAX装置)で実用されている。なお本明細書では他の符号や数値との混同を避けるため、ラン表現を記述する際には「」で括る事とした。 As already described, in the present invention, a “two-direction sequence”, that is, a sequence in which two code values whose directions are adjacent in a direction difference code is set as a unit of processing. Under this, since there are only two types of codes included in the sequence, the sequence can be expressed using the number of times one code appears successively. That is, as shown in the example of FIG. 12, when the number of consecutive codes <0> and <1> in the two-
「ラン対」とは上記の「ラン表現」において、隣接する2つのランを1組にして考えるものである。すなわち図13に示す通り、符号〈0〉のランと〈1〉のランとを端から2つずつ組にして考える。この様にすると次に述べる様な利点が得られる。まず、処理の対象となる輪郭線は十分に滑らかであって、直線又は直線に近い形状を持っているものとする。図13はこの様な例であり、(a)は図中の点1311と点1312とを結ぶ直線1310を、(b)は図中の点1311と点1322とを結ぶ直線1320を、(c)は十分に滑らかな曲線(楕円の一部)1330を、それぞれ2値画像上で近似的に表現したものである。(a)の場合、直線1310の傾きは13/21であり、この値は2/3よりも小さく1/2よりも大きい。従って直線1310は2値画像上では、傾き2/3の素辺1301と傾き1/2の素辺1302との組み合わせで近似される。この例で代表される様に、一般に傾き1/2以上の直線は、傾きが丁度n/(n+1)となる場合を除いて、傾きn/(n+1)の素辺と傾き(n−1)/nとの組み合わせで近似される。なお以上においてnは適当な正整数を表すものとする。直線の傾きが1/2以下の場合も図13(b)に示す通り、傾き1/nの素辺と傾き1/(n+1)の素辺との組み合わせで近似される。輪郭線が滑らかに曲がる場合は、同図(c)に例示した様に同図の(a)と(b)とが滑らかに接続される場合と考えられる。 The “run pair” refers to a set of two adjacent runs in the above “run expression”. That is, as shown in FIG. 13, a run with a code <0> and a run with <1> are considered in pairs from the end. In this way, the following advantages can be obtained. First, it is assumed that the contour line to be processed is sufficiently smooth and has a straight line or a shape close to a straight line. FIG. 13 shows such an example. (A) shows a
以上の図13における素辺1301、1302等は「ラン対」の一種であるが、同図の様に輪郭線が十分に滑らかな場合は、各素辺は次の性質を持つ事が、同図の例から確認できる。
性質:2つのランのうち少なくとも一方はラン長が1となる。
従って、輪郭線が滑らかである事を前提とすれば、「ラン対」を記憶する際に2つのラン長を両方記憶する必要は無くなり、その代りに両者の差を記憶しておけば良い。すなわち、あるラン対を構成する2つのラン長をm、n(これを「ラン対(m、n)」と記す)とすると、値(m−n)のみを記憶しておけば良い。ここで値(m−n)の事を、当該ラン対の「指標」と以後呼ぶ事にする。図13では(a)(b)(c)各々の例において、1315、1325、1335で示した2方向系列に対して1316、1326、1336で示したラン表現が得られ、これらから更に1317、1327、1337で示した指標の系列が得られる。なお本明細書では他の符号や数値との混同を避けるため、指標を記述する際には[ ]で括る事とした。
Properties: At least one of the two runs has a run length of 1.
Therefore, if it is assumed that the contour line is smooth, it is not necessary to store both of the run lengths when storing the “run pair”, and the difference between the two may be stored instead. That is, if the two run lengths constituting a certain run pair are m and n (denoted as “run pair (m, n)”), only the value (mn) needs to be stored. Here, the value (mn) is hereinafter referred to as the “index” of the run pair. In FIG. 13, in each of the examples (a), (b), and (c), the run representations indicated by 1316, 1326, and 1336 are obtained for the two-way series indicated by 1315, 1325, and 1335, and from these, 1317, A series of indices indicated by 1327 and 1337 is obtained. In this specification, in order to avoid confusion with other codes and numerical values, the index is enclosed in brackets [].
指標を利用すると、図13における素辺の傾きは上記の表1の様に整理できる。また表に示される通り、指標が増減する事は素辺の傾きが増減する事と等価である。これらの性質を用いると、以下の様に凹点を検出する事が可能となる。まず表1に示した通り、指標が増減する事は素辺の傾きが増減する事と等価であり、特に指標が増減しないあるいは減少する場合は、素辺の傾きが一定または領域の内側方向(凸方向)へ変化する事であるから、その部分には凹点は存在しない。また指標が+1だけ増加する場合は、後述する「擬直線」の可能性があり、凹点が存在するとは断定できない。しかしながら指標が+2以上増加する場合は、2つのラン対が接続する部分に凹点が存在する。この様な例を図14に示す。図14の例は黒丸で示した輪郭線について、2方向系列1415を得た後にラン表現1416を経て指標の系列1417を得ている。なお図示は省略したが、図の下方が領域の内側であるとする。ここでは2番目のラン対から3番目へ進む際に、指標が1から3へ+2だけ増加している。この場合、図の線分1400が局所的な凸包となり、その内側(線分上を含む)に矢印で示した画素1410が存在するため、この領域は凸では無いと判定できる。ここで指標が他の値(たとえば2から4へ増加)であっても、線分1400の両端が対称的に移動するのみで、画素1410が線分1400の中点となる、という性質に変化は無い。また、指標の増加量がもっと大きい(たとえば+3)場合は、線分1400の傾きが本図よりも大きくなるので、画素1410は凸包の内部に入る。以上より、指標がどの様な値でも+2以上の増加があれば、その領域は凸では無いと判定できる。本実施例ではこの性質を、図5におけるS514で凹点を検出するために利用する。なおこの判定方法は、ラン対の一方が2方向系列の始端または終端にある場合には図の線分1400が引けなくなるため、これらの場合は除外して適用する。また実際の輪郭線では、ラン対(m、n)におけるmとnとが共に1より大きい場合もありうる。しかしながらこの様なラン対では、2つのランの接続箇所が明白な凸点となるので、この点を境に輪郭線を前後に分割して処理しても凹点を検出するためには支障は生じない。この場合にはラン対(m、n)を、分割の前半においてはラン対(m、1)、後半においてはラン対(1、n)と見なして処理すれば良い。 When the index is used, the slopes of the elementary sides in FIG. 13 can be arranged as shown in Table 1 above. Also, as shown in the table, increasing or decreasing the index is equivalent to increasing or decreasing the slope of the bare edge. Using these properties, it is possible to detect the indentation as follows. First, as shown in Table 1, an increase / decrease in the index is equivalent to an increase / decrease in the edge of the bare edge. Since there is a change in the convex direction), there is no concave point in that part. When the index increases by +1, there is a possibility of a “pseudo line” to be described later, and it cannot be determined that a concave point exists. However, when the index increases by +2 or more, a concave point exists at a portion where two run pairs are connected. Such an example is shown in FIG. In the example of FIG. 14, an
次に「擬直線」について説明する。図13で示した通り、2値画像上では直線は2種類のラン対で表現され、それらの指標は1だけ異なる。そこで逆に、2方向系列をラン対指標で表現した後に、「指標が±1だけ異なる2種類のラン対」が継続する区間を、本発明では「擬直線」と呼ぶことにする。擬直線は、その区間が直線である可能性を示す必要条件となっている。また擬直線でない区間ではラン対指標が2以上変化する事になり、先述の方法により凹点を検出する事が可能である。 Next, the “pseudo line” will be described. As shown in FIG. 13, on the binary image, a straight line is represented by two types of run pairs, and their indices differ by one. Conversely, a section in which “two types of run pairs whose indices differ by ± 1” after the two-way sequence is expressed by a run pair index is referred to as a “pseudo line” in the present invention. The pseudo straight line is a necessary condition indicating the possibility that the section is a straight line. Further, the run pair index changes by 2 or more in a section that is not a quasi-straight line, and it is possible to detect a concave point by the method described above.
以上の様に「ラン対」および「擬直線」という概念が定義できる。これらを用いる事により、S509以降の処理は以下に述べる通りに構成できる。すなわち、S510からS519までの処理を全ての2方向系列に対して適用し(S509)、その結果登録された凹点に基づき分割処理を実施(S520)して、実行を終了(S521)すれば良い。ここでS510からS519までは、以下の通りに構成される。 As described above, the concepts of “run pair” and “pseudo line” can be defined. By using these, the processing after S509 can be configured as described below. That is, if the processing from S510 to S519 is applied to all the two-way sequences (S509), the division processing is performed based on the registered concave points (S520), and the execution is completed (S521). good. Here, S510 to S519 are configured as follows.
まず、当該2方向系列を上述のラン対表現に変換し(S510)、解析開始点をラン対表現の始点とする(S511)。以上の2つのステップは、ラン対表現を利用して凹点を検出するための準備段階となる。なおラン対と同時にその指標も得ておく事にする。この下に、解析開始点から後ろの外形線がどの様な形状を持っているかを、以降のステップで分析する。すなわちまずS512として、解析開始点から始まるラン対が十分に凸となる区間を求める。具体的には引き続くラン対の指標を逐次比較して行き、指標が最初に増加する箇所を区間の終点とする。得られた区間が当該2方向系列の終点まで達したかを判定し(S513)、結果がyesすなわち終点まで達していれば、当該2方向系列にはこれ以上の凹点は存在しない事になるから、S509にループして次の2方向系列の分析を開始する。結果がnoの場合は、凸区間の最後となるラン対と更にその次のラン対とに関して、各々の指標を比較する(S514)。指標が2以上増加している場合は、図14で説明した通り凹点が存在するので、次のラン対との接続部分を凹点として登録する(S515)。以上により次のラン対までの検出処理が完了した事になるので、更なる検出を続けるためには、解析開始点を次のラン対の始点として(S516)、S512以降を再度繰り返せば良い。なお以上の説明において、S515における登録はS508と同様に行えば良い。 First, the two-way sequence is converted into the above-described run pair expression (S510), and the analysis start point is set as the start point of the run pair expression (S511). The above two steps are preparation steps for detecting a concave point using the run pair expression. The index will be obtained at the same time as the run pair. Below this, the shape of the outline behind the analysis start point is analyzed in the following steps. That is, first, in S512, a section where the run pair starting from the analysis start point is sufficiently convex is obtained. Specifically, the indices of subsequent run pairs are sequentially compared, and the point where the index first increases is set as the end point of the section. It is determined whether or not the obtained section has reached the end point of the two-way sequence (S513). If the result is yes, that is, the end point has been reached, there are no more concave points in the two-way sequence. Then, the process loops to S509 to start the analysis of the next two-way series. If the result is no, each index is compared with the last run pair of the convex section and the next run pair (S514). When the index is increased by 2 or more, there is a concave point as described with reference to FIG. 14, and therefore the connection portion with the next run pair is registered as a concave point (S515). Since the detection process up to the next run pair is completed as described above, in order to continue further detection, the analysis start point is set as the start point of the next run pair (S516), and S512 and subsequent steps may be repeated again. In the above description, the registration in S515 may be performed in the same manner as in S508.
一方、S514において指標が+1しか増加していない場合は、この部分が前述の「擬直線」となっている可能性があり、凹点が存在するか否かは簡単に決定できない。そこでこのような場合は、まずS512により求めた区間の最後となるラン対を含む擬直線区間を求め(S517)、その擬直線区間の凹凸を判定する(S518)ものとする。しかる後に、当該擬直線区間が当該2方向系列の終点まで達したかを判定し(S519)、結果がyesすなわち終点まで達していれば、S513と同様にS509にループして次の2方向系列の分析を開始する。結果がnoの場合は更なる検出を続けるために、S515の場合と同様にS516を経てS512以降を再度繰り返す。 On the other hand, if the index has increased by only +1 in S514, this portion may be the above-mentioned “pseudo line”, and it cannot be easily determined whether or not there is a concave point. Therefore, in such a case, first, a pseudo-linear section including the last run pair of the sections obtained in S512 is obtained (S517), and the unevenness of the pseudo-linear section is determined (S518). Thereafter, it is determined whether or not the quasi-linear section has reached the end point of the two-way sequence (S519). If the result is yes, that is, the end point is reached, the same two-way sequence is looped to S509 as in S513. Start analyzing. If the result is no, in order to continue further detection, S512 and subsequent steps are repeated again through S516 in the same manner as in S515.
ここで疑直線に対する処理、すなわちS517およびS518について説明する。まずS517において2方向系列から疑直線を構成する区間を求めるが、既にS510においてラン対表現が作成されてその指標も得られているので、S517では指標の値が現在の値に対して+0または+1となる区間を求めれば良い。たとえば指標の系列が
[−2−1−2−2−1−1−2−2−1−2−3−2−4−4](先頭の−2が解析開始点)
と得られていれば、先頭から−2または−1が引き続く区間を求める事になる。上記例の場合には、−2でも−1でもない指標が最初に現われるのは−3の箇所であるから、その直前までの
[−2−1−2−2−1−1−2−2−1−2]
が、疑直線を構成する区間となる。この処理は数値列の中から特定条件を満たす部分列を抜き出す処理であり、周知の技術で実現できるので詳細は省略する。Here, the process for the suspicious line, that is, S517 and S518 will be described. First, in S517, a section constituting a suspicion line is obtained from the two-way series. Since the run pair expression has already been created in S510 and its index is obtained, the index value is +0 or 0 relative to the current value in S517. What is necessary is just to obtain | require the area which becomes +1. For example, a series of metrics
[-2-1-2-2-2-1-2-2-1-2-3-2-4-4] (the first -2 is the analysis start point)
If it is obtained, a section in which -2 or -1 continues from the head is obtained. In the case of the above example, the index that is neither -2 nor -1 appears first at -3.
[-2-1-2-2-1-1-2-2-1-2]
However, it becomes the section which comprises a suspicion line. This process is a process for extracting a partial sequence satisfying a specific condition from a numerical sequence, and since it can be realized by a known technique, its details are omitted.
次にS518において、上記で求められた区間の凹凸を判定する。
この判定においては、図4に示した方法で凸包を作成しても良いが、先に述べた通り効率的でない。また実用面では、擬直線は実際に直線であるか、又は直線に十分近い形状である事が大半である。そこで本実施例では、擬直線に対して近似的ではあるが高速に凹凸を判定する方法を、図15以降を用いて開示する。Next, in S518, the unevenness of the section obtained above is determined.
In this determination, a convex hull may be created by the method shown in FIG. 4, but it is not efficient as described above. Moreover, in practical use, the pseudo straight line is actually a straight line or a shape sufficiently close to the straight line in most cases. Therefore, in this embodiment, a method for determining irregularities at high speed, although approximate to the quasi-straight line, will be disclosed with reference to FIG.
図15は擬直線の一例を示したもので、対応する2方向系列、ラン表現、指標の系列は各々1515、1516、1517に示した通りである。すなわちこの擬直線は指標が−2および−1となる2種類のラン対から構成されており、その具体的な形状は図示の通りである。ここで同擬直線の最初および最後のラン対に注目すると、両者における画素1501および1502が微視的に輪郭線の頂点となっている。これは両点を結ぶ線分1500が、この輪郭線の局所的な凸包となっている可能性を示唆するものである。そこで線分1500を仮の凸包とみなした場合、この内部(下方を内部とする)に領域外の点が含まれていれば、同擬直線を輪郭線とする部分は凸ではないと結論する。このための十分条件として、線分1500の下方にある画素の数と領域内でかつ図の長方形1505に含まれる画素の数を比較して、後者の方が少なければ凸ではないと結論できる。ここで上記の2種類の画素数は、各々以下の通りの方法により計算できる。 FIG. 15 shows an example of a quasi-straight line. The corresponding two-way series, run expression, and index series are as shown in 1515, 1516, and 1517, respectively. That is, this pseudo straight line is composed of two types of run pairs whose indices are -2 and -1, and the specific shape is as shown in the figure. Here, paying attention to the first and last run pairs of the pseudo-line, the
まず領域内でかつ図の長方形1505に含まれる画素の数については、図16に示す方法により算出できる。すなわち、まず当該擬直線に対する「参照擬直線」を想定する。参照擬直線とは当該擬直線と同一の指標の値を有する擬直線であって、その指標のうち値の大きい方が系列の前半に集中しているものを言う。たとえば図15の擬直線の指標には−1が4回、−2が6回現れるから、これらをこの順に並べた
[−1−1−1−1−2−2−2−2−2−2]
という指標の系列1617を持つ擬直線が参照擬直線となる。これに対応する2方向系列、ラン表現は各々1615、1616の通りである。なお図では、参照擬直線を構成する画素を正方形で示した。ここで参照擬直線の下方の面積は図16(a)に示す通り初等的に計算できる。すなわち、図15における長方形rを、図16(a)の3つの長方形1601、1602、1603に分けて考えると、
1601における下方の面積=(i1+2)×(k1×(k1+1)÷2)
1602における下方の面積=(i2+2)×(k2×(k2−1)÷2)+k2
1603における下方の面積=k1×((i2+2)×(k2−1)+1)
但し i1=指標のうち値の大きい方の絶対値、
k1=指標のうち値の大きい方の出現回数、
i2=指標のうち値の小さい方の絶対値、
k2=指標のうち値の小さい方の出現回数
となるので、これら3つの値を合計すれば良い。しかる後に、この合計値を基に当該擬直線の下方の面積を算出する。このためには図16(b)の原理を利用する。図16(b)は、擬直線において指標の現われる順序が変化した場合に、下方の面積がどのように変化するかを説明したものである。図の例では擬直線の指標が1620に示す[−1−2−2]から1630に示す[−2−1−2]へと変化している。この結果、元の擬直線が通過していた画素1611が直線の上方へ除外され、擬直線は画素1612を通る様になる。それ以外の部分では擬直線の形状は不変なので、結局画素1611による1画素分だけ面積が減少する。この原理を用いれば、当該擬直線における指標のうち値の大きい方が参照擬直線と比べてどれだけ後ろに出現するか、を合算する事により、参照擬直線と比べてどれだけ面積が減少したかを算出する事ができる。たとえば図15および図16に示した例では、
参照擬直線の指標1617:[−1−1−1−1−2−2−2−2−2−2]
当該擬直線の指標1517:[−2−1−2−2−1−1−2−2−1−2]
であるから、
4つ目の[−1]の出現位置:4番目→9番目、面積減少=5画素
3つ目の[−1]の出現位置:3番目→6番目、面積減少=3画素
2つ目の[−1]の出現位置:2番目→5番目、面積減少=3画素
1つ目の[−1]の出現位置:1番目→2番目、面積減少=1画素
となり、これらを合計した12画素だけ面積が減少している事が計算できるので、前述の参照擬直線の下方の面積から12画素を減じれば良い。なお以上の説明においては、指標の値が負またはゼロの場合を例に示したが、値が正またはゼロの場合は図15および図16を90度回転して同様の計算を行えば良い。First, the number of pixels included in a rectangle 1505 in the region can be calculated by the method shown in FIG. That is, first, a “reference pseudoline” for the pseudoline is assumed. The reference pseudo-line is a pseudo-line having the same index value as that of the pseudo-line, and the index having the larger value is concentrated in the first half of the series. For example, since -1 appears 4 times and -2 appears 6 times in the pseudo-line index of FIG. 15, they are arranged in this order. [1-1-1-1-2-2-2-2-2-2 2]
The pseudo line having the
Lower area at 1601 = (i1 + 2) × (k1 × (k1 + 1) ÷ 2)
Lower area at 1602 = (i2 + 2) × (k2 × (k2-1) / 2) + k2
Lower area at 1603 = k1 × ((i2 + 2) × (k2-1) +1)
Where i1 = the absolute value of the index with the larger value,
k1 = number of occurrences of the index with the larger value,
i2 = the absolute value of the index having the smaller value,
Since k2 = the number of appearances with the smaller value of the indices, these three values may be summed. Thereafter, the area below the pseudo line is calculated based on the total value. For this purpose, the principle of FIG. 16B is used. FIG. 16B illustrates how the area below changes when the order in which the indices appear on the pseudo line changes. In the example shown in the figure, the quasi-linear index changes from [-1-2-2] shown in 1620 to [-1-2-1] shown in 1630. As a result, the
Reference pseudo-line index 1617: [-1-1-1-1-2-2-2-2-2-2]
Pseudo-line index 1517: [-2-1-2-2-1-1-2-2-1-2]
Because
4th [-1] appearance position: 4th → 9th, area reduction = 5 pixels 3rd [-1] appearance position: 3rd → 6th, area reduction = 3 pixels 2nd [-1] appearance position: 2nd → 5th, area reduction = 3 pixels First [-1] appearance position: 1st → 2nd, area reduction = 1 pixel, 12 pixels in total Since it can be calculated that the area is reduced, it is sufficient to subtract 12 pixels from the area below the reference pseudo-line. In the above description, the case where the index value is negative or zero has been described as an example. However, when the value is positive or zero, the same calculation may be performed by rotating FIGS. 15 and 16 by 90 degrees.
次に線分1500の下方にある画素の数については、図17に示す方法により算出できる。すなわち、凸包の頂点の候補として2つの画素1701、1702が与えられた時、両者を結ぶ線分1705の下方(線分上を含む)にある画素数を求める。ここで1702は1701から水平方向にm画素、垂直方向にn画素離れているものとする。まずmとnとが互いに素な場合を同図(a)に示す。図には全部で(m+1)×(n+1)個の画素がある。このうち1701、1702の2つを除くと、線分1705の上には画素は存在せず、それらは線分1705により対称的に2分割される。従って、全部の画素数から2画素を除いたものを半分にして、これに2画素を再度加えれば、求める画素数が得られる。以上を式で表せば、
((m+1)×(n+1)−2)÷2+2=(m+1)×(n+1)÷2+1
が求める画素数である。一般にはmとnとが互いに素とは限らないが、この場合でも上記の考え方を拡張して画素数を算出する事ができる。すなわち同図(b)に示す通り、この場合には線分1715上に画素1720−1、1720−2、……、が存在しうるが、これらを除いて考えれば、同図(a)と同様の計算が成り立つ。従って問題は線分1715上に画素が全部で何個存在するかという点に帰着するが、初等整数論による考察により、この個数は
mとnとの最大公約数+1(但し両端の画素1711、1712も含める)
である事が確認できる。従って求める式は、下記の数式1の通りとなる。なお当然の事であるが、同図(a)は同図(b)においてgcd(m,n)=1とした場合に他ならない。
((M + 1) × (n + 1) −2) ÷ 2 + 2 = (m + 1) × (n + 1) ÷ 2 + 1
Is the number of pixels desired. In general, m and n are not necessarily prime, but even in this case, the above idea can be extended to calculate the number of pixels. That is, as shown in FIG. 6B, in this case, the pixels 1720-1, 1720-2,... May exist on the
It can be confirmed that Therefore, the equation to be obtained is as shown in
以上により、S518における近似的ではあるが高速な判定方法として、図18のフローチャートで示す処理が実現できる。すなわち擬直線が指標の系列によって与えられたものとして(S1801)、まず図16で示した方法により当該擬直線の下方の面積を求め(S1802)、引続き図17で示した方法により凸包の候補の内部にある面積を求める(S1803)。両者を比較して(S1804)、前者の方が小さい場合には当該擬直線を凹点として登録し(S1805)、処理を終了する(S1806)。以上においてS1805における登録はS508と同等に行えば良い。なお当該擬直線の区間が長い場合には、その中点をもって凹点を代表させても良い。 As described above, the processing shown in the flowchart of FIG. 18 can be realized as an approximate but fast determination method in S518. That is, assuming that the pseudo-line is given by the index series (S1801), first, the area below the pseudo-line is obtained by the method shown in FIG. 16 (S1802), and then the convex hull candidate is obtained by the method shown in FIG. The area inside is determined (S1803). The two are compared (S1804). If the former is smaller, the pseudo line is registered as a concave point (S1805), and the process is terminated (S1806). In the above, the registration in S1805 may be performed in the same way as in S508. If the section of the quasi-straight line is long, a concave point may be represented by the midpoint.
以上により図5におけるS519までが実施できるので、それらにより求められた凹点を用いて、領域の分割を行う事が可能となる(S520)。この応用方法は様々に考えられるが、たとえば人間の横顔を入力して鼻の隆起点を検出する、などの応用が考えられる。これは、従来は困難とされた映像中から人間の横顔を自動検出する機能が、本発明を利用することにより可能となる事を示している。 As described above, steps up to S519 in FIG. 5 can be performed, so that it is possible to divide the region using the concave points obtained by them (S520). This application method can be considered in various ways. For example, an application of detecting a rising point of the nose by inputting a human profile is conceivable. This indicates that a function for automatically detecting a human profile from an image that has been difficult in the past can be realized by using the present invention.
なおここまでの説明においては、輪郭線が方向差分符号〈0〉および〈1〉で示される場合を主に取り上げて説明したが、座標を適宜回転あるいは鏡像反転させて考える事により、他の方向の場合にも本発明が適用できる事は言うまでもない。 In the description so far, the case where the outline is indicated by the direction difference codes <0> and <1> has been mainly described, but other directions can be obtained by appropriately rotating or mirroring the coordinates. Needless to say, the present invention can also be applied to this case.
以上、領域の輪郭線から凹点を検出する方法を開示した。これらの説明においては、輪郭線が基本的に凸区間からなり、凹点は凸区間の接続部分にのみ存在する、という領域を処理の対象とした。しかしながら一般には、輪郭線が本質的に凹図形を形成する領域も存在する。たとえば「三日月形」は、外側の輪郭線は凸図形であるが、内側の輪郭線は全体が凹図形であり、その中の特定の点のみを凹点とする事は合理性を欠く。この様な図形をどう扱うべきかは本発明の課題から外れるものであり、より上位の画像処理機能に扱いを委ねるものとする。なお輪郭線が凹図形である事は、領域の外側と内側を入換て考える事により、本発明と同様の算法で確認できる。これを利用すれば、たとえば輪郭線上の凹図形の部分をあらかじめ分離しておく、などの処理方法が上位の画像処理機能として考えられる。従って本発明は、凹図形も含めた一般の領域に対しても、応用の可能性を残すものである。 As described above, the method for detecting the concave point from the outline of the region has been disclosed. In these descriptions, the region in which the contour line is basically composed of the convex section and the concave point exists only at the connection portion of the convex section is the processing target. In general, however, there are also areas where the contours essentially form concave figures. For example, in the “crescent shape”, the outer contour line is a convex figure, but the inner contour line is entirely a concave figure, and it is not rational to make only a specific point therein a concave point. How to handle such a figure is out of the subject of the present invention, and it is left to the higher-level image processing function. In addition, it can confirm that a contour line is a concave figure by the same calculation method as this invention by switching the outer side and inner side of an area | region. If this is utilized, for example, a processing method such as separating the concave figure portion on the contour line in advance can be considered as a higher-level image processing function. Therefore, the present invention leaves the possibility of application to general areas including concave figures.
本発明は画像認識技術を応用した各種の映像処理装置で利用可能であり、より具体的には映像監視装置、ビデオ編集装置、ディジタルカメラなどへの応用が期待できる。 The present invention can be used in various video processing apparatuses to which image recognition technology is applied, and more specifically, application to video monitoring apparatuses, video editing apparatuses, digital cameras, and the like can be expected.
550…前処理段階 1201…ラン長 1705,1715…凸包の候補となる線分550 ...
Claims (5)
((m+1)×(n+1)−gcd(m、n)−1)÷2+gcd(m、n)+1
但しgcd(m、n)はmとnとの最大公約数を表す
を用いて算出する事を特徴とする凹点検出方法。5. The concave point detection method according to claim 4, wherein the area of a right triangle having a base length of m and a base length of n is expressed by the following formula ((m + 1) × (n + 1) −gcd (m, n ) -1) ÷ 2 + gcd (m, n) +1
However, the gcd (m, n) is calculated by using the greatest common divisor of m and n.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2008209367A JP5192315B2 (en) | 2008-07-18 | 2008-07-18 | Indentation detection method for dividing a binary image into regions |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2008209367A JP5192315B2 (en) | 2008-07-18 | 2008-07-18 | Indentation detection method for dividing a binary image into regions |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2010027016A JP2010027016A (en) | 2010-02-04 |
| JP5192315B2 true JP5192315B2 (en) | 2013-05-08 |
Family
ID=41732751
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2008209367A Expired - Fee Related JP5192315B2 (en) | 2008-07-18 | 2008-07-18 | Indentation detection method for dividing a binary image into regions |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5192315B2 (en) |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP6136537B2 (en) | 2013-04-26 | 2017-05-31 | オムロン株式会社 | Image processing apparatus, image processing method, image processing control program, and recording medium |
| JP5996496B2 (en) * | 2013-08-21 | 2016-09-21 | 富士通フロンテック株式会社 | Overlapping stamp detection apparatus, method, and program |
| CN107621435A (en) * | 2017-10-16 | 2018-01-23 | 华侨大学 | An aggregate online monitoring device |
| CN112633289B (en) * | 2020-12-30 | 2024-04-26 | 凌云光技术股份有限公司 | Method and system for segmenting sticky characters |
| JP7673437B2 (en) | 2021-03-11 | 2025-05-09 | 株式会社デンソー | OBJECT RECOGNITION DEVICE AND OBJECT RECOGNITION METHOD |
| CN116740104B (en) * | 2023-06-29 | 2024-09-06 | 成都华大九天科技有限公司 | Method for generating smooth contour based on pixel contour unit |
| CN117576414B (en) * | 2023-11-27 | 2024-07-26 | 北京霍里思特科技有限公司 | Method, apparatus and storage medium for pit detection in ore image segmentation |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2739130B2 (en) * | 1988-05-12 | 1998-04-08 | 株式会社鷹山 | Image processing method |
| JPH0594524A (en) * | 1991-10-01 | 1993-04-16 | Nippon Telegr & Teleph Corp <Ntt> | Convex object division description processing method |
-
2008
- 2008-07-18 JP JP2008209367A patent/JP5192315B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2010027016A (en) | 2010-02-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP5192315B2 (en) | Indentation detection method for dividing a binary image into regions | |
| Cao et al. | Geometrically guided exemplar-based inpainting | |
| CN106663322B (en) | Method and apparatus for identifying features in an image | |
| CN103164865B (en) | A kind of method and apparatus that handwriting input is beautified | |
| WO2014187046A1 (en) | Point cloud skeleton extraction method and apparatus | |
| EP4012666A1 (en) | Image processing apparatus, image processing method, and computer program | |
| Parakkat et al. | Peeling the longest: A simple generalized curve reconstruction algorithm | |
| JP5566158B2 (en) | Image processing method, image processing apparatus, and program | |
| US20130294707A1 (en) | Geometric modelization of images and applications | |
| Pedrosa et al. | Anisotropic diffusion for effective shape corner point detection | |
| Masood et al. | Capturing outlines of 2D objects with Bézier cubic approximation | |
| JP5629483B2 (en) | Image processing method, image processing apparatus, and program | |
| JP2007041730A (en) | Wire abnormality detection method, apparatus, and program | |
| JP4791295B2 (en) | Ruled line extraction program, ruled line extraction device, ruled line extraction method | |
| Prasad | Rectification of the chordal axis transform skeleton and criteria for shape decomposition | |
| De et al. | A new approach to detect and classify graphic primitives in engineering drawings | |
| KR101284137B1 (en) | Representation and recording system for depth information of 3d object | |
| JP2005071243A (en) | Image processing apparatus, method, and program | |
| Koochari et al. | Exemplar-based video inpainting with large patches | |
| Ahmadi et al. | Image seam-carving by controlling positional distribution of seams | |
| Abbasi et al. | Rectifying reverse polygonization of digital curves for dominant point detection | |
| KR101528604B1 (en) | Method and Apparatus for Processing Image | |
| Kulkarni et al. | Midcurves generation algorithm for thin polygons | |
| Rand | Where and How Chew's Second Delaunay Refinement Algorithm Works. | |
| JP4151290B2 (en) | Split vector concatenation program and method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20110704 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20120625 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20120710 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20120903 |
|
| 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: 20130115 |
|
| R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160208 |
|
| R154 | Certificate of patent or utility model (reissue) |
Free format text: JAPANESE INTERMEDIATE CODE: R154 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160208 Year of fee payment: 3 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5192315 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| LAPS | Cancellation because of no payment of annual fees |