JPS6286468A - Polygonal line approximation circuit for line picture - Google Patents

Polygonal line approximation circuit for line picture

Info

Publication number
JPS6286468A
JPS6286468A JP22725985A JP22725985A JPS6286468A JP S6286468 A JPS6286468 A JP S6286468A JP 22725985 A JP22725985 A JP 22725985A JP 22725985 A JP22725985 A JP 22725985A JP S6286468 A JPS6286468 A JP S6286468A
Authority
JP
Japan
Prior art keywords
line
distance
point
approximation
register
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.)
Pending
Application number
JP22725985A
Other languages
Japanese (ja)
Inventor
Takumi Asaina
巧 朝夷名
Kunio Koshiro
小城 邦雄
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sumitomo Electric Industries Ltd
Original Assignee
Sumitomo Electric Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sumitomo Electric Industries Ltd filed Critical Sumitomo Electric Industries Ltd
Priority to JP22725985A priority Critical patent/JPS6286468A/en
Publication of JPS6286468A publication Critical patent/JPS6286468A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To allow the titled circuit to withstand noise by approximating a line picture expressed in a chain code by a polygonal line so as to make the distance between a long line segment and a picture element to a prescribed value or below thereby compressing remarkably the data quantity. CONSTITUTION:In tying a start point A (x0, y0) and an end point B (x1, y1), a line segment AB gives the 0th order approximation of the line picture. Assuming that a distance between an optional i-th picture element constituting the line picture and the line segment AB is di, then the distance di is obtained as to all picture elements, the maximum value is taken as dj and the picture element giving a maximum value as (j), a point C (Xj, Yj) is referred to as the maximum distance point. In giving a distance (l) deciding the degree of approximation in advance and it is referred to as the approximation length (l). The distances dj and (l) are compared and when the distance dj is smaller than the distance (l), the approximation operation is stopped, and when the distance dj is larger than the distance (l), the start point A, the end point B and the maximum distance point C (Xj, Yj) are tied, then the line picture is approximated by two line segments AC, CB. This is the 1st approximation and the procedure above is repeated.

Description

【発明の詳細な説明】 (支)産業上の利用分野 この発明は、空間上に表わされた濃淡画像を線画にする
画像処理装置に関する。特に、線画像から、有効な情報
を損わずにデータを圧縮する折線近似回路に関する。
DETAILED DESCRIPTION OF THE INVENTION Field of the Invention The present invention relates to an image processing apparatus that converts a grayscale image represented in space into a line drawing. In particular, the present invention relates to a polygonal line approximation circuit that compresses data from line images without losing useful information.

(社)従来技術とその問題点 文字や図形、物体などをTVカメラで撮像し、これを画
素に分け、明暗について、ある閾値と比較して二値化し
、細線化処理をすると、輪郭線を現わす線画像が得られ
る。
(Company) Conventional technology and its problems Characters, figures, objects, etc. are imaged with a TV camera, divided into pixels, compared with a certain threshold value for brightness and darkness, binarized, and thinned. A line image is obtained.

細線化処理というのは、連続する細い輪郭線を得るため
に、不要な黒画素を消去する処理である。
The thinning process is a process of erasing unnecessary black pixels in order to obtain a continuous thin outline.

細線化処理の内容については、いくつかの方法があって
、ここでは説明しない。細線化の方法によって、残る黒
画素が異なってくる。線画像というのは連続する黒画素
の集合である。
There are several methods for the thinning process, which will not be explained here. The number of remaining black pixels varies depending on the thinning method. A line image is a collection of continuous black pixels.

線画像には、始点と終点とがある。始点と終点との間は
、画素によって連続的に、接続されている。
A line image has a starting point and an ending point. The starting point and the ending point are continuously connected by pixels.

線画像のデータは、全画素のx%y座標を指定すること
によって完全に記述される。しかし、このようにすると
、データの数が多すぎて、以後の画像処理や、データ記
憶が容易でない。
Line image data is completely described by specifying the x%y coordinates of all pixels. However, in this case, the amount of data is too large, making subsequent image processing and data storage difficult.

そこでデータを圧縮するという事が考えられる。Therefore, it is possible to compress the data.

第1図に線画像の例を示す。FIG. 1 shows an example of a line image.

始点と終点の間が画素によって連続的に接続されておシ
、連続線は1本しかない。したがって、黒画素そのもの
のかわりに、変化の方向、つまシ線の傾きをデータして
採用することができる。
The starting point and the ending point are continuously connected by pixels, and there is only one continuous line. Therefore, instead of the black pixel itself, the direction of change and the slope of the border line can be used as data.

第2図に、ある画素を中心として、8つの変化の方向を
示す。画素から次の画素への変化は、周囲の8つのいず
れかの画素への変化である。これを0〜7の番号を付け
て、チェインコードと呼ぶ。
FIG. 2 shows eight directions of change around a certain pixel. A change from one pixel to the next pixel is a change to any of the eight surrounding pixels. These are numbered from 0 to 7 and called chain codes.

直上への動きが01左上斜めへの動きが1で、以後反時
計廻りにチェインコードが対応づけられている。
Movement directly upwards is 01, movement diagonally to the upper left is 1, and from then on, chain codes are associated in a counterclockwise direction.

チェインコードは3ビツトのデータである。ある画素を
指定するには、XSy座標を与えなければならない。こ
れらがmビット(例えば8ビツト又は16ビツト)であ
るとすれば、2mビットのデータ量が必要である。とこ
ろが、チェインコードは3ビツトであるから、ひとつの
点を指定するためのデータ量は(2m−8)ビット減少
する。
The chain code is 3-bit data. To specify a certain pixel, the XSy coordinates must be given. If these are m bits (for example 8 bits or 16 bits), then a data amount of 2m bits is required. However, since the chain code is 3 bits, the amount of data for specifying one point is reduced by (2m-8) bits.

そこで、線画像を指定するため、始点の座標(xo s
3’o )と、これに続く変化の方向についてチェイン
コードの系列を用いる、という事が一般に行なわれる。
Therefore, in order to specify a line image, the coordinates of the starting point (xo s
3'o) and the subsequent direction of change using a series of chain codes.

第8図は第1図の線画像をチェインコードの系列によっ
て表現したものである。
FIG. 8 shows the line image of FIG. 1 expressed by a series of chain codes.

始点から第2点への変化は右上斜めであるから、チェイ
ンコードは7である。第2点から第3点への変化は真上
方向であるから、チェインコードは0である。第3点か
ら第4点への変化は真上方向であるから、チェインコー
ドはOである。以下同様にして、チェインコードを並べ
てゆき、終点に至る。始点とチェインコード列によシ、
線画像を一意的に指定できる。
Since the change from the starting point to the second point is diagonally to the upper right, the chain code is 7. Since the change from the second point to the third point is directly upward, the chain code is 0. Since the change from the third point to the fourth point is directly upward, the chain code is O. In the same way, the chain codes are arranged until the end point is reached. Depending on the starting point and chaincode column,
Line images can be uniquely specified.

このようにしても、未だ線画像のデータが多すぎるので
、もつとデータを圧縮する事が望まれる。
Even if this is done, there is still too much line image data, so it is desirable to compress the data.

このため、折線近似という事がなされる。For this reason, a broken line approximation is used.

これは、線画像を直線とみなしうる部分毎に分割し、各
部分を線分で近似するものである。
In this method, a line image is divided into parts that can be regarded as straight lines, and each part is approximated by a line segment.

曲線ではなく線分で近似するから、近似後の画像は折線
になる。このため、折線近似と呼んでいる。
Since the approximation is performed using line segments rather than curves, the image after approximation will be a broken line. For this reason, it is called a broken line approximation.

折線近似すると、データは折線の交差点を指定するもの
だけに減少する。従って、データの数は大幅に減少する
事になる。
When the polygonal line approximation is applied, the data is reduced to only those specifying the intersections of the polygonal lines. Therefore, the amount of data will be significantly reduced.

従来の折線近似法は、線画像を始点から追跡し、変化の
方向が変わる点(換向点と呼ぶ)を検出し、換向点の間
を線分で結ぶ方法が主流であった。
In the conventional broken line approximation method, the main method was to trace a line image from a starting point, detect a point where the direction of change changes (referred to as a turning point), and connect the turning points with line segments.

変化方向は8つのチェインコードによって表わされてい
るから、変化方向の変化は、チェインコードの変化をみ
ることによって分る。従って換向点を順次検出するのは
容易である。
Since the direction of change is represented by eight chain codes, changes in the direction of change can be determined by looking at changes in the chain codes. Therefore, it is easy to sequentially detect turning points.

この方法は、いわば微分法であるから、局所的なノイズ
に弱いという難点がある。
Since this method is, so to speak, a differential method, it has the disadvantage of being vulnerable to local noise.

線画像を得るには、対象物に照明を当て、反射光をTV
カメラで撮像し、縦横の画素に分け、画素の明暗を二値
化する処理が必要である。このため、照明の状態によっ
て、ノイズが生ずることもある。また、細線化処理によ
ってノイズが発生することもある。
To obtain a line image, the object is illuminated and the reflected light is transmitted to the TV.
It is necessary to capture an image with a camera, divide it into vertical and horizontal pixels, and then binarize the brightness and darkness of the pixels. Therefore, noise may occur depending on the lighting conditions. Further, noise may be generated by the line thinning process.

従来法は、換向点を全て検出するから、ノイズをそのま
ま含んでしまう。局所的なノイズは落してしまう方がよ
いのである。
Since the conventional method detects all turning points, noise is included as is. It is better to eliminate local noise.

さらに、前記の微分法は、データの圧縮はできるが、線
画像の形状はそのまま残るので、画像的には近似とはい
えない。
Further, although the differential method described above can compress data, the shape of the line image remains unchanged, so it cannot be said to be an approximation in terms of the image.

近似というのは、データを圧縮する事が、大きな目的で
あるが、それだけではなく、ノイズを落す、という事も
あるのである。
The main purpose of approximation is to compress data, but it is also used to reduce noise.

(+7)    目     的 線画像のデータ量を圧縮するために、局所的なノイズに
対して強く、任意の近似度で折線近似できるような線画
像の折線近似回路を与える事が本発明の第1の目的であ
る。
(+7) Purpose In order to compress the amount of data of a line image, the first objective of the present invention is to provide a line image approximation circuit that is strong against local noise and capable of approximating a line image with an arbitrary degree of approximation. This is the purpose of

比較的簡単な回路によって、折れ目となる画素の座標を
高速で見い出すことのできる折線近似回路を与える事が
本発明の第2の目的である。
A second object of the present invention is to provide a broken line approximation circuit that can quickly find the coordinates of pixels forming a fold using a relatively simple circuit.

比較的簡単な素子の組合わせからなる回路であって、容
易にLSI化することのできる折線近似回路を与えるこ
とが本発明の第3の目的である。
A third object of the present invention is to provide a broken line approximation circuit which is a circuit consisting of a combination of relatively simple elements and which can be easily integrated into an LSI.

に)折線近似の原理 従来の微分的な折線近似に対し、本発明者は、いわば積
分的な折線近似法を確立した。これは、チェインコード
で記憶された線画像に対して、極めて有効に使用できる
方法である。
B) Principle of broken line approximation In contrast to the conventional differential broken line approximation, the present inventor has established a so-called integral broken line approximation method. This is a method that can be used extremely effectively for line images stored as chain codes.

まず、本発明者の創意になる折線近似法を説明する。First, a broken line approximation method invented by the inventor will be explained.

まず、始点A(Xolyo)と終点B(xl、yl)と
を結ぶ。線分ABが得られる。線分ABがこの線画像の
第0近似を与える。
First, start point A (Xolyo) and end point B (xl, yl) are connected. Line segment AB is obtained. Line segment AB gives the 0th approximation of this line image.

直線ABは、線分ABを両側へ無限に延長した直線のこ
とである。ある点と直線の距離というのは、その点から
直線に下した垂線の長さの事である。垂線の足が線分の
外にあっても同じように距離を一義的に定義できる。
Straight line AB is a straight line obtained by extending line segment AB infinitely to both sides. The distance between a point and a straight line is the length of the perpendicular line drawn from that point to the straight line. Even if the foot of the perpendicular line is outside the line segment, the distance can be defined uniquely in the same way.

線画像を構成する任意の1番目の画素と、直線ABとの
距離をdiとする。
Let di be the distance between an arbitrary first pixel constituting the line image and straight line AB.

第4図にこれらの関係を示す。Figure 4 shows these relationships.

全ての画素について距離dt f求め、この内の最大値
をdjとする。最大値を与える画素をjとする。
Distances dtf are determined for all pixels, and the maximum value among them is set as dj. Let j be the pixel that gives the maximum value.

これを0点(Xj、Yj)とする。0点を最大距離点と
呼ぶ。
This is set as 0 point (Xj, Yj). The 0 point is called the maximum distance point.

予め近似の度合を決定する距離lを与えておく。A distance l is given in advance to determine the degree of approximation.

これを近似長lと呼ぶ。This is called the approximate length l.

djと4とを比較する。djがlよシ小さければ、近似
操作を打ち切る。djがlよシ大きければ、始点A1終
点Bと、最大距離点C(Xj、Yj)とを結ぶ。
Compare dj and 4. If dj is smaller than l, the approximation operation is aborted. If dj is larger than l, the starting point A1 and ending point B are connected to the maximum distance point C (Xj, Yj).

第5図にこれを示す。線画像は2本の線分AC10Hに
よって近似されている。これが第1近似である。
This is shown in Figure 5. The line image is approximated by two line segments AC10H. This is the first approximation.

次に、直線ACと、端点A、Cで挾まれる全ての画素と
の距離を計算し、その最大値を求める。
Next, the distances between the straight line AC and all the pixels sandwiched by the end points A and C are calculated, and the maximum value thereof is determined.

最大値を与える点も求める。これがD点であるとする。Also find the point that gives the maximum value. Assume that this is point D.

D点と直線ACの距離と近似長lとを比較する。lの方
が長かったとする。この場合、もはや近似を進めない。
The distance between point D and straight line AC and the approximate length l are compared. Suppose l is longer. In this case, we can no longer proceed with the approximation.

つまfi、A、0点とD点とを結ばず、線分ACのまま
にしておく。
Do not connect point fi, A, 0 and point D, leaving the line segment AC as it is.

線分CBについても同様のことをする。The same thing is done for line segment CB.

直線CBと、C,B点で挾まれる線画像1全ての画素と
の距離を求める。距離の最大値をdoとし、最大値を与
える点をEとする。最大距離deと近似長lとを比較す
る。deO方が6.1大きいとする。この場合、端点C
,Bと最大距離点Eとを結ぶ。線分GE、EBに関して
は第2近似である。
The distance between the straight line CB and all pixels of the line image 1 sandwiched by points C and B is determined. Let do be the maximum value of the distance, and let E be the point that gives the maximum value. The maximum distance de and the approximate length l are compared. It is assumed that deO is larger by 6.1. In this case, the end point C
, B and the maximum distance point E. The line segments GE and EB are the second approximation.

さらに、CE間及びEB間について、最大距離をそれぞ
れ求め、これと近似長lとを比較する。
Furthermore, the maximum distance between CE and between EB is determined, and this is compared with the approximate length l.

いずれの最大距離も近似長lよシ短いとする。ここで近
似を打ち切る。第6図にこれを示す。
It is assumed that both maximum distances are shorter than the approximate length l. The approximation is discontinued here. This is shown in Figure 6.

このように、最大距離を与える点を検出し、これが4よ
シ長ければ、この点と両端点とを線分で結合する。新た
な線分はよフ高い近似を与える。
In this way, the point that gives the maximum distance is detected, and if this point is longer than 4, this point and both end points are connected by a line segment. The new line segment gives a better approximation.

この線分を含む直線と、線分の端点て挾まれる全ての画
素との最大距離を求め、これがlよシ長ければ、同じよ
うにして線分を引いて近似を高める。
The maximum distance between the straight line containing this line segment and all the pixels sandwiched by the end points of the line segment is found, and if this distance is longer than l, a line segment is drawn in the same way to improve the approximation.

以下、最大距離が近似長lより短くなるまで、このよう
な操作を繰り返す。
Thereafter, such operations are repeated until the maximum distance becomes shorter than the approximate length l.

最大距離がlよシ短くなれば、近似操作を終了する。When the maximum distance becomes shorter than l, the approximation operation ends.

このようにして、任意の線画像を折線近似する事ができ
る。
In this way, any line image can be approximated by broken lines.

近似長lが長ければ、粗い近似になるが、近似操作に要
する時間は短い。
If the approximation length l is long, the approximation will be rough, but the time required for the approximation operation will be short.

近似長lが短いと、よシ細い近似になるが、近似に要す
る時間は長くなる。また、lがあまシに短いと、ノイズ
が落ちない、という欠点もあられれる。ノイズや必要な
時間、要求される図形などによシ、適当な近似長lを決
定する。
If the approximation length l is short, the approximation will be finer, but the time required for the approximation will be longer. Furthermore, if l is too short, there is a drawback that noise cannot be reduced. An appropriate approximate length l is determined depending on noise, required time, required figure, etc.

団 必要な計算式 次に、画素jと、距離djの算出方法について説明する
Group Necessary Calculation Formulas Next, a method for calculating pixel j and distance dj will be explained.

画素面はxy座標で指定されている。The pixel plane is specified by xy coordinates.

始点(X8% yo )と終点(Xl、yl)を通る直
線をax −1−by 十〇 = Qによって表わす。
A straight line passing through the starting point (X8% yo) and the ending point (Xl, yl) is represented by ax −1−by 〇=Q.

この直線と画素1(xi、yt)との距離diは次式で
与えられる。
The distance di between this straight line and pixel 1 (xi, yt) is given by the following equation.

パラメータa%b、cは、始点終点の座標を上記の直線
の式に入れて求めることができる。
The parameters a%b, c can be determined by entering the coordinates of the starting point and ending point into the above straight line equation.

パラメータの比の値は決まるが、絶対値は決まらない。Although the value of the ratio of the parameters is determined, the absolute value is not.

そこで、簡単・に、 a = yl−yo         (2)b”’ 
 Xo  Xt          (8)C”  X
13’OXO3’l        (4’とする事が
できる。もちろんこれらに定数を乗じたものであっても
よい。
Therefore, simply a = yl-yo (2) b"'
Xo Xt (8)C”
13'OXO3'l (4' can be used. Of course, these can be multiplied by a constant.

dlが最大となる画素jを求める時は、分母d’i  
== l aXi 十byi + CI   (51を
定義し、これが最大となる画素jを求める。
When finding the pixel j with the maximum dl, use the denominator d'i
== l aXi + byi + CI (Define 51 and find the pixel j where this is the maximum.

線画像の任意の連結において、ある画素(xi % y
i )と、直前の画素(xi−1、yi−1)との変化
分がmi。
In any connection of line images, a certain pixel (xi % y
i) and the immediately preceding pixel (xi-1, yi-1) is mi.

niで表わされるとする。ml、niは01+1、−1
のいずれかの値をとシ、チェインコードト一対−の対応
がある。いずれもOであることはない。
Suppose that it is represented by ni. ml, ni is 01+1, -1
There is a one-to-one correspondence between chain codes. None of them are O.

これらの値に関して、 xt  =  Xl−1+mt        (61
yi  =  yi−1−1−ni        (
7)が成り立つ。mはX方向への増分、nはy方向の増
分であるから、第2図で定義されるチェインコードに対
し、次の関係がある。
For these values, xt = Xl-1+mt (61
yi = yi-1-1-ni (
7) holds true. Since m is the increment in the X direction and n is the increment in the Y direction, the following relationship exists for the chain code defined in FIG.

これを第1表に示す。右欄のマルチプレクサ出力につい
ては後に述べる。
This is shown in Table 1. The multiplexer output in the right column will be described later.

第1表 チェインコードとm、 nの値、マルチプレク
サ出力axi−1−byi +c  = aXo+1)
3’o +Cとなる。始点(aoSyo)は直線ax 
+by −t−c = 00上にあるから、(8)式の
右辺第1項は0である。
Table 1 Chain code, m, n values, multiplexer output axi-1-byi +c = aXo+1)
It becomes 3'o +C. The starting point (aoSyo) is the straight line ax
+by −t−c = 00, so the first term on the right side of equation (8) is 0.

従って、dlの値は、 となる。同じ式は、次のようにも表現できる。Therefore, the value of dl is becomes. The same formula can also be expressed as:

Δに= amh  +  bnst       (1
0)Σk = ΣΔh          (11)h
=1 ここで、Σ1−1の絶対値がd’i−iである。
Δ = amh + bnst (1
0) Σk = ΣΔh (11) h
=1 Here, the absolute value of Σ1-1 is d'i-i.

チェインコードによって、2つの整数mk、nkが与え
られ、Δにはこれによって決まる。Δk はm、nを0
1+1として与えられるが、次の8つの値a、 −b、
 −a、  b、  a+b、 −a十す、  a−b
Two integers mk and nk are given by the chain code, and Δ is determined by these. Δk is m, n is 0
It is given as 1+1, but the following eight values a, -b,
-a, b, a+b, -a tensu, a-b
.

−a−b′ff:とる。-a-b'ff: Take.

結局、代数的距離Σiは、前のΣ1−1に、a、−b。After all, the algebraic distance Σi is a, -b in the previous Σ1-1.

−a 、・・などを加える事によって求められる。It can be found by adding -a, etc.

つまシ、チェインコード列を追跡してゆく際、前の値Σ
ilを保持してゆけば、Δにの足し算のみで、Σiを求
めることができる。
When tracing the chain code sequence, the previous value Σ
If il is maintained, Σi can be found just by addition to Δ.

また、この際に、xlyの値を平行に計算し、d’iが
最大になる時の値(Xj S’fj)を保存すると(1
■ とにすれば、簡単な方法で高速にd’tを求め、その画
素の座標が分る。最大距離点の座標が分っていれば、始
点、終点と最大距離点とを結ぶ線分をすぐに確定できる
。次の段階への近似へ迅速に進むことができる。
Also, at this time, if we calculate the value of xly in parallel and save the value (Xj S'fj) when d'i becomes maximum, we get (1
(2) Then, d't can be obtained quickly using a simple method, and the coordinates of that pixel can be found. If the coordinates of the maximum distance point are known, the line segment connecting the starting point, end point, and maximum distance point can be immediately determined. One can quickly proceed to the next stage of approximation.

□□□)発明の構成 本発明は以上に述べた計算を迅速に行なう回路構成に関
するので、第7図によってこれを説明する。
□□□) Configuration of the Invention Since the present invention relates to a circuit configuration for quickly performing the above-mentioned calculation, this will be explained with reference to FIG.

定数レジスタ1〜8は、始点(xo s yo )と、
終点(Xl、’/x )の座標の値から計算されるa、
b。
Constant registers 1 to 8 are the starting point (xos yo),
a calculated from the coordinate values of the end point (Xl,'/x),
b.

−a、 −b、 a−b、−a+b、Ia十す、 −a
−b  (7)値を演算に先立ってあらかじめ格納して
おくレジスタ群である。
-a, -b, a-b, -a+b, Ia tensu, -a
-b (7) A group of registers in which values are stored in advance prior to calculation.

定数レジスタ1〜8の出力は、マルチプレクサ9に入力
される。これは8人力1出力のマルチプレクサであって
、チェインコードが入力され、第1表に従ってチェイン
コードの値に対応する定数レジスタのひとつの内容(a
lbl−al−bl・・・・の内のひとつ)を選択して
出力する。
The outputs of constant registers 1 to 8 are input to multiplexer 9. This is an 8-power, 1-output multiplexer into which a chain code is input and the contents of one of the constant registers (a) corresponding to the chain code value according to Table 1.
lbl-al-bl...) is selected and output.

マルチプレクサ9の出力は、加算器10に入力される。The output of multiplexer 9 is input to adder 10.

マルチプレクサの出力は、前述のΔkに当る値であシ、
これとレジスタ11に保持されている直前の画素までの
代数和Σk−1とが加算されて、Σkが求められる。
The output of the multiplexer should be the value corresponding to the above-mentioned Δk,
This and the algebraic sum Σk-1 up to the immediately preceding pixel held in the register 11 are added to obtain Σk.

この値は、レジスタ11に入力されてここで一時的に保
持される。
This value is input to the register 11 and temporarily held there.

結局、加算器10とレジスタ11は、加算器10に入力
されるΣΔにの値を求めるアキュームレータとなってい
る。つまシ、k番目のチェインコードが入力された後、
Σkの値が加算器の出力に現われる。
In the end, the adder 10 and the register 11 function as an accumulator for obtaining the value of ΣΔ input to the adder 10. After the kth chain code is input,
The value of Σk appears at the output of the adder.

絶対値算出回路12は加算器出力の絶対値Σkを計算す
る回路である。これは距離d’kに等しい。
The absolute value calculation circuit 12 is a circuit that calculates the absolute value Σk of the adder output. This is equal to the distance d'k.

絶対値算出回路12の出力は、レジスタ14と比較器1
5に与えられる。
The output of the absolute value calculation circuit 12 is sent to the register 14 and the comparator 1.
given to 5.

比較器15は5番目の距離d’iが入力された時、レジ
スタ14に保持された値とこれを比較し d/iの方が
大きいか又は等しければ、レジスタ14にd’iをロー
ドする制御信号を出す。レジスタ14にd’tが格納さ
れる。d’tの方が小さい時は制御信号は出ない。レジ
スタ14の内容は不変に保たれる。
When the fifth distance d'i is input, the comparator 15 compares it with the value held in the register 14, and if d/i is greater or equal, loads d'i into the register 14. Issue a control signal. d't is stored in the register 14. When d't is smaller, no control signal is output. The contents of register 14 remain unchanged.

従って、レジスタ14が最初0にセットされていれば、
この中には、i番目までの距離の最大値が常に格納され
ていることになる。つまり、レジスタ14と比較器15
は最大値検出回路として機能しているのである。
Therefore, if register 14 is initially set to 0,
This means that the maximum value of the distance to the i-th distance is always stored. That is, register 14 and comparator 15
functions as a maximum value detection circuit.

カウンタ13はチェインコードの数を数えるカウンタで
あシ、チェインコードが入力されるごとに内容を+1す
る。チェインコード計数カウンタ13の出力が入力され
るレジスタ16は比較器15の制御信号によって、カウ
ンタ13の値をロードする。つまシ、レジスタ16には
、i番目までの画素の内、最大距離を与える画素の番号
が一時的に保持されることになる。
The counter 13 is a counter that counts the number of chain codes, and increments its contents by 1 every time a chain code is input. The register 16 to which the output of the chain code counting counter 13 is input loads the value of the counter 13 in response to the control signal of the comparator 15. The register 16 temporarily stores the number of the pixel that provides the maximum distance among the pixels up to the i-th pixel.

デコーダ17はチェインコードの値(θ〜7)に対して
、x1y方向の変化量m、nを、第1表に従って、出力
する。この内mの値は、X方向カウンタ18に与えられ
る。X方向カウンタ18は、アップダウンカウンタであ
って、mの値を積算する。mはO1+1、−1  であ
るからカウンタで積算できる。
The decoder 17 outputs the amounts of change m and n in the x1y direction for the chain code value (θ to 7) according to Table 1. The value of m is given to the X direction counter 18. The X-direction counter 18 is an up/down counter that adds up the value of m. Since m is O1+1, -1, it can be integrated by a counter.

nの値は、X方向のカウンタ19に与えられる。The value of n is given to the counter 19 in the X direction.

X方向カウンタ19はnの値を積算する。The X-direction counter 19 adds up the value of n.

これらカウンタ18.19はプログラマプ/L/(ブリ
セラタブ/L/)カウンタであって、初期値を設定でき
る。初期値として、始点(xo s 3’o )の座標
Xo s 7oを与える。これ以後、X方向、X方向の
変化mk、nkを順に加えてゆくから、1番目のチェイ
ンコードが入力された時、カウンタ1gハXtO値、カ
ウンタ19はYiO値を保持している事になる。つまシ
、1番目の画素の座標(Xi、 Yi)がこれによって
分る。
These counters 18 and 19 are programmap/L/(brisera tab/L/) counters, and initial values can be set therein. As an initial value, the coordinates Xo s 7o of the starting point (xo s 3'o) are given. After this, changes in the X direction, mk, and nk in the X direction are added in order, so when the first chain code is input, counter 1g holds the XtO value, and counter 19 holds the YiO value. . From this, the coordinates (Xi, Yi) of the first pixel can be found.

X方向レジスタ20、X方向レジスタ21は、比較器1
5が制御信号を発した時に、X方向カウンタ18、X方
向カウンタ19の出力をそれぞれロードする。比較器1
5は、d′iの方が、レジスタ14に保持される値よシ
大きい時に、つまシ、d’1が1番目までで最大値であ
る時に、制御信号を発するから、X方向レジスタ20、
X方向レジスタ21は、最大距離を与える画素のX座標
、Y座標を保持することになる。
The X direction register 20 and the X direction register 21 are the comparator 1
5 issues a control signal, the outputs of the X-direction counter 18 and the X-direction counter 19 are loaded, respectively. Comparator 1
5, when d'i is larger than the value held in the register 14, a control signal is issued when d'1 is the maximum value up to the first, so the X direction register 20,
The X direction register 21 holds the X and Y coordinates of the pixel that provides the maximum distance.

従って、終点まで全てのチェインコードが読み出された
時、X方向レジスタ20、X方向レジスタ21には、d
’1の最大値d/jを与える画素jのX1y座標である
xjlYjが保持されている。jの値は、レジスタ16
に保持されている。d′jの値はレジスタ14に保持さ
れている。
Therefore, when all chain codes are read up to the end point, d
'xjlYj, which is the X1y coordinate of pixel j that gives the maximum value d/j of 1, is held. The value of j is stored in register 16.
is maintained. The value of d'j is held in register 14.

d′jの値から、(1)式に従ってdjを求め、これと
近似長lとを比較する。
From the value of d'j, dj is determined according to equation (1), and this is compared with the approximate length l.

djO方がlよシ大きければ、始点、終点と、最大距離
点(XIYj)とを線分で接続する。djO方がlよシ
小さければ、これで近似操作を打ち切る。
If djO is larger than l, the start point, end point, and maximum distance point (XIYj) are connected by a line segment. If djO is smaller than l, then the approximation operation is terminated.

始点、終点と最大距離点を線分で連結すると、一本の線
分が2本の線分になったわけで、よシ高次の近似になっ
たことになる。
If you connect the starting point, ending point, and maximum distance point with a line segment, one line segment becomes two line segments, which means that you have a higher order approximation.

次に、新しい線分の始点、終点が決まるので、これによ
って、a、bの値を決定する。a、bの値が決まれば、
定数レジスタ1〜8の値も決まるので、前回の保持値、
a% 5%  ’1−b%・・・・のかわシに、新しく
計算された保持値を定数レジスタに入力させる。そして
、同様にチェインコードをマルチプレクサ9、デコーダ
17に入力してユキ、新たに最大値を求める。
Next, since the starting point and ending point of the new line segment are determined, the values of a and b are determined based on this. Once the values of a and b are determined,
Since the values of constant registers 1 to 8 are also determined, the previous held values,
a% 5% '1-b%... Make the controller input the newly calculated holding value into the constant register. Then, similarly, the chain code is input to the multiplexer 9 and the decoder 17 to obtain a new maximum value.

ただし、後半の部分については、(j+1)番目の画素
がチェインコードの1番目になる。5番目の画素が始点
になるからである。
However, in the latter half, the (j+1)th pixel becomes the first pixel in the chain code. This is because the fifth pixel is the starting point.

いずれの回の演算に於ても、演算に先立って、レジスタ
11.14、カウンタ16はクリヤしておき、カウンタ
18.19にはその回の始点の座標Xos’10をロー
ドしておく。
Prior to any calculation, the register 11.14 and counter 16 are cleared, and the counter 18.19 is loaded with the coordinate Xos'10 of the start point of the calculation.

(至) 発明の効果 (1)  チェインコードで表現された線画像を折線で
近似するから、データ量を大幅に圧縮する事ができる。
(To) Effects of the invention (1) Since the line image expressed by the chain code is approximated by a broken line, the amount of data can be significantly compressed.

(2)換向点を見つけるのではなく、長い線分と画素と
の距離が一定値以下になるように折線近似するので、ノ
イズに対して強い。lがノイズのゆらぎよシ大きければ
、ノイズは落ちてしまう。
(2) Rather than finding a turning point, a broken line approximation is performed so that the distance between a long line segment and a pixel is equal to or less than a certain value, so it is robust against noise. If l is larger than the noise fluctuation, the noise will drop.

(3)近似長lがパラメータになっている。これが制御
可能なパラメータであるから、任意の精度で、折線近似
する事ができる。
(3) The approximate length l is a parameter. Since this is a controllable parameter, polygonal line approximation can be performed with any precision.

近似の程度を指定する事ができる。lが近似の程度を表
現すると考えることもできる。
You can specify the degree of approximation. It can also be considered that l expresses the degree of approximation.

(4)比較的簡単な回路で、折れ目となる画素の番号j
と、座標Xj1Yjとが高速で見出される。
(4) In a relatively simple circuit, the pixel number j that forms the crease
and the coordinates Xj1Yj are found at high speed.

(5)簡単な機能の素子を組合わせればこの回路を作る
ととができるので、回路の全体をLSI化する事は容易
である。
(5) Since this circuit can be created by combining elements with simple functions, it is easy to implement the entire circuit as an LSI.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は2次元線画像の一例を示す図。 第2図は画素から次の画素への変化の方向とチェインコ
ードの対応説明図。 第3図は第1図の線画像をチェインコードで表示した例
。 第4図は本発明で用いる折線近似原理の説明図であって
、第O近似を示す線図。 第5図は第1近似を示す線図。 第6図は第2近似以後の最終的な近似線図。 第7図は本発明の折線近似回路構成図。 1〜8・・定数レジスタ 9 ・・・・マルチプレクサ 10・・・・加 算 器 11・・・・レジスタ 12・・・・絶対値算出回路 13・・・・カウンタ 14・・・・レジスタ 15・・・・比 較 器 16・・・・レジスタ 17・・・・デコーダ 18・・・・ X方向カウンタ 19・・・・ X方向カウンタ 20・・・・ n方向レジスタ 21・・・・ y方向レジスタ 発明者   朝夷名  巧 小  城  邦  雄
FIG. 1 is a diagram showing an example of a two-dimensional line image. FIG. 2 is an explanatory diagram of the correspondence between the direction of change from one pixel to the next pixel and the chain code. Figure 3 is an example of displaying the line image in Figure 1 as a chain code. FIG. 4 is an explanatory diagram of the principle of broken line approximation used in the present invention, and is a diagram showing the O-th approximation. FIG. 5 is a diagram showing the first approximation. FIG. 6 is a final approximation diagram after the second approximation. FIG. 7 is a diagram showing the configuration of a broken line approximation circuit according to the present invention. 1 to 8...Constant register 9...Multiplexer 10...Adder 11...Register 12...Absolute value calculation circuit 13...Counter 14...Register 15... ... Comparator 16 ... Register 17 ... Decoder 18 ... X direction counter 19 ... X direction counter 20 ... N direction register 21 ... Y direction register Inventor Asaina Takumijo Kunio

Claims (1)

【特許請求の範囲】[Claims] チェインコードで表現された線画像を直線とみなしうる
部分毎に分割し、各部分を線分で近似するため、線画像
の始点と終点とを線分で結びこれを含む直線と画素との
距離の最大値d_jと最大値を与える画素jと座標X_
j、Y_jとを求め、d_jが予め定められた近似長l
より大きい場合は始点、終点と最大距離点jとを線分で
結んで近似を高め、さらにこれら線分を含む直線と線分
の端点で挾まれる画素との距離の最大値と、最大値を与
える画素とその座標とを求め、最大距離がlより大きけ
れば、該線分の端点と最大距離点とを線分で結び近似を
高める操作を繰り返して、直線と画素の最大距離がl以
下になるまで線画像を折線近似することとし、始点、終
点の座標の差a、bから計算されるところの8つの定数
a、b、−a、−b、a+b、−a−b、−a+b、a
−bを保持する8つの定数レジスタ1〜8と、線画像を
表現するチェインコードを入力する事により前記定数レ
ジスタ1〜8のひとつを選択するマルチプレクサ9と、
前記マルチプレクサ9の出力Δ_kを加算累積するアキ
ュームレータと、アキュームレータの出力Σ_kの絶対
値d_k′を求める絶対値算出回路12と、絶対値算出
回路12の出力の(k−1)番目までの最大値を保持す
るレジスタ14と、絶対値算出回路12の出力d_k′
と、レジスタ14の保持値とを比較しd_k′の方が大
きいか又は等しい時にd_k′の値をレジスタ14にロ
ードする制御信号を発する比較器15と、チェインコー
ドの数を計数するカウンタ13と、比較器15からの制
御信号によつて前記カウンタ13の値をロードするレジ
スタ16と、チェインコードから線画像のx方向の変化
m_kとy方向の変化n_kとを求めるデコーダ17と
、始点の座標x_0、y_0を予め入力しておきこれら
にx方向変化m_k、y方向変化n_kを加算しk番目
の画素の座標X_k、Y_kを求めるx方向カウンタ1
8、y方向カウンタ19と、比較器15からの制御信号
によつてx方向カウンタ18、y方向カウンタ19の値
をロードするx方向レジスタ20、y方向レジスタ21
とよりなる事を特徴とする線画像の折線近似回路。
In order to divide a line image expressed by a chain code into parts that can be considered straight lines and approximate each part with a line segment, we connect the starting point and end point of the line image with a line segment and calculate the distance between the straight line and the pixel. maximum value d_j, pixel j giving the maximum value and coordinate X_
j, Y_j, and d_j is a predetermined approximate length l.
If it is larger, connect the start point, end point, and maximum distance point j with a line segment to improve the approximation, and then calculate the maximum distance between the straight line that includes these line segments and the pixels sandwiched by the end points of the line segment, and the maximum distance. Find the pixel and its coordinates that give The line image is approximated by a broken line until ,a
-b, and a multiplexer 9 that selects one of the constant registers 1 to 8 by inputting a chain code representing a line image;
An accumulator that adds and accumulates the output Δ_k of the multiplexer 9, an absolute value calculation circuit 12 that calculates the absolute value d_k' of the output Σ_k of the accumulator, and the maximum value up to the (k-1)th output of the absolute value calculation circuit 12. The holding register 14 and the output d_k' of the absolute value calculation circuit 12
and the value held in the register 14, and when d_k' is greater or equal, a comparator 15 generates a control signal to load the value of d_k' into the register 14, and a counter 13 counts the number of chain codes. , a register 16 that loads the value of the counter 13 according to a control signal from the comparator 15, a decoder 17 that calculates the change m_k in the x direction and the change n_k in the y direction of the line image from the chain code, and the coordinates of the starting point. x-direction counter 1 which inputs x_0, y_0 in advance and adds x-direction change m_k and y-direction change n_k to these to obtain the coordinates X_k, Y_k of the k-th pixel.
8. A y-direction counter 19, and an x-direction register 20 and a y-direction register 21 that load the values of the x-direction counter 18 and y-direction counter 19 according to the control signal from the comparator 15.
A broken line approximation circuit for line images characterized by the following.
JP22725985A 1985-10-12 1985-10-12 Polygonal line approximation circuit for line picture Pending JPS6286468A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP22725985A JPS6286468A (en) 1985-10-12 1985-10-12 Polygonal line approximation circuit for line picture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP22725985A JPS6286468A (en) 1985-10-12 1985-10-12 Polygonal line approximation circuit for line picture

Publications (1)

Publication Number Publication Date
JPS6286468A true JPS6286468A (en) 1987-04-20

Family

ID=16858016

Family Applications (1)

Application Number Title Priority Date Filing Date
JP22725985A Pending JPS6286468A (en) 1985-10-12 1985-10-12 Polygonal line approximation circuit for line picture

Country Status (1)

Country Link
JP (1) JPS6286468A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01134682A (en) * 1987-11-20 1989-05-26 Hitachi Software Eng Co Ltd Line folding processing system
JPH0210476A (en) * 1988-06-29 1990-01-16 Fujitsu Ltd Polygonal line approximating device for curve

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01134682A (en) * 1987-11-20 1989-05-26 Hitachi Software Eng Co Ltd Line folding processing system
JPH0210476A (en) * 1988-06-29 1990-01-16 Fujitsu Ltd Polygonal line approximating device for curve

Similar Documents

Publication Publication Date Title
Broggi Parallel and local feature extraction: A real-time approach to road boundary detection
CN104103058B (en) Image matching system and method
CN103597514A (en) Object detection frame display device and object detection frame display method
CN107633482A (en) A kind of super resolution ratio reconstruction method based on sequence image
Cladera et al. On-device event filtering with binary neural networks for pedestrian detection using neuromorphic vision sensors
Zhang et al. FPGA implementation of eight-direction Sobel edge detection algorithm based on adaptive threshold
JPS6286468A (en) Polygonal line approximation circuit for line picture
Zhang et al. A hardware-oriented histogram of oriented gradients algorithm and its VLSI implementation
CN112200004B (en) Training method and device for image detection model and terminal equipment
RU2718211C1 (en) Device for combining infrared images
Chang et al. Real-time Hybrid Stereo Vision System for HD Resolution Disparity Map.
JPS6290785A (en) Polygonal line approximation trace circuit for line drawing
WO2023103792A1 (en) Image processing method, apparatus and device
JPS61120002A (en) Method and device for detecting corner point of image
JPH0561975A (en) Signal matching device
Sosa et al. Change-driven data flow image processing architecture for optical flow computation
Putra et al. FPGA implementation of template matching using binary sum of absolute difference
CN101996393A (en) Super-resolution method based on reconstruction
Khai et al. A Road Self-Guided Hardware-Based Demo System
Zhi et al. Applied research of convolution and correlation in digital image processing
CN114419103A (en) Skeleton detection tracking method and device and electronic equipment
JPH0474907A (en) Displacement measuring apparatus
JPS58158761A (en) Pattern position detecting method
Ebraheem et al. Using Digital Images to Perform Measuring Of Material's Amount for Buildings in Civil Engineering Field
JP2835269B2 (en) Image recognition device