8
IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2, MARCH 1986 Correspondence Encoding of Line Drawings with a Multiple Grid Chain Code TOSHI MINAMI AND KATSUYUKI SHINOHARA Abstract-The multiple grid(MG) chain code which uses four differ- ent square grids is proposed to encode line drawings. The main pro- cesses adopted in the code are: 1) a grid selection algorithm which al- locates quantization points only to the vicinity of the course of a line drawing, 2) labeling rule on quantization points which makes the fre- quency of some codes larger than that of other codes, and 3) quanti- zation points allocation-not to the corners, but to the sides of a square which makes the straight line segments larger without increasing quan- tization error. A performance comparison of various chain codes is made from the viewpoints of the encoding efficiency, naturalness of the encoded lines, and the rate distortion measure. Also, the superiority of the MG chain code to other codes is shown. At last, application of the MG chain code to the electronic blackboard system is explained. Index Terms-Computer graphics, electronic blackboard, geometric probability, line drawing encoding, multiple grid chain code, quanti- zation error, rate distortion theory. I. INTRODUCTION To encode line drawings such as contour maps, computer graph- ics, engineering drawings, etc., Freeman's chain code and many other derived chain codes have been proposed [1]- [12]. A newly developed coding method described here is quite dif- ferent from these chain codes and is shown to be excellent in cod- ing efficiency and naturalness of regenerated line drawings [13]. In the conventional chain code, a certain grid is prepared and a line drawing is superimposed on it, and the nearest nodes of the grid to the line drawing are selected as quantization points. In these meth- ods, tracking of line drawings is limited by the grid. On the contrary, in the multiple grid chain code or MG chain code described here, four different grids are prepared for quanti- zation, and by selecting the most appropriate grid for each quanti- zation, quite efficient encoding can be realized. That is to say, by this selection, direction of a line drawing is predicted and the next quantization points are placed in the vicinity of the course of the line drawing. In general, high coding efficiency can be achieved by approximating high curvature parts of line draw- ings with shorter straight line segments and low curvature parts of line drawings with longer straight line segments. In Freeman's chain code with fineness 2T, only two straight line units with the length of 2T and 2 2T are used independently of curvatures. In the MG chain code, quantization points are taken on the sides of a unit square and lengths of straight line units are quite diversi- fied: V2T, 2T, -/T, 4T, 3,12T, and 2v[T, under the condition that the maximum error of the regenerated line drawings is the same as the error of the regenerated line drawings by Freeman's chain code with a fineness of 2T. The variety of the straight line units in the MG chain code is one reason for the high encoding efficiency of this code. In this code, quantization points are allocated not to the corners, but to the sides of a square. By this allocation, the side length of a Manuscript received October 10, 1984; revised July 15, 1985. Recom- mended for acceptance by Y. T. Chien. The authors are with the Department of Electronic Engineering, Koga- kuin University, Tokyo, 160, Japan. IEEE Log Number 8405365. square can be doubled compared to that of Freeman's chain code without changing the maximum quantization error. This makes longer chain segments available for encoding line drawings. Furthermore, a specific labeling rule of quantization points is adopted. As a result of this labeling, some codes occur more fre- quently than other remainder codes and Huffman coding can be applied to reduce the encoding bits. In this correspondence, the coding algorithm of the MG chain code is first described and then its performance is investigated by the encoding results of straight lines, circles, and contour maps. It is proved that the coding efficiency of the MG chain code is about 60-70 percent better than that of the standard chain code. And it is also found that the subjective quality of the regenerated line draw- ings by this algorithm is excellent. Finally, simulation results on the application of this coding algorithm to the electronic blackboard are described. Here again, the superiority of the MG chain code to other chain codes is proved. II. THE ENCODING ALGORITHM In the algorithm to be described here, four different grids of hor- izontal and vertical lines Go, GI, G2, and G3, whose centers are separated from each other by ±2T, are used for quantization of line drawings. The side length of a unit square (fineness) of each grid is 4T. The four square grids are represented by line vectors as follows: Grid Cordinates of the origin x=0 y=O x = 2T y = O x=0 y=2T x = 2T y = 2T Line vector (0, 0) (1, 0) (0, 1) (1, 1). Each side of a square is divided into two equal length segments and centers of the segments are used as positions for quantization points. A line drawing crossing the square is approximated by a straight line connecting two quantization points. The quantization point on a segment where the line drawing enters to the square is labeled as "0." The center of the next segment on the same side is labeled as "1" and other centers are labeled from 2 to 7 in due order as shown in Fig. 1. To encode a line drawing, a square grid Go is superimposed on it and one of unit squares, on which the line drawing is crossing, is selected as the square for quantization of the line drawing. By the x and y coordinates of quantization points corresponding to the entrance of a line to the square, the starting point of the encoded line is determined. Then, by the label of the segment where the line drawing exits from the unit square, the first chain code is ob- tained. And again, by this label, a square which is used for the next quantization is selected, as shown in Fig. 2. The second square is selected in a way to make the next link as long as possible. The selecting rule is tabulated as follows. 1) Case of the quantization point "0" on a vertical line Label of the exit quantization point 0 1 2 3 4 Present Grid (i,j]) (i, j) (i, j) (i, j) (i, j) + Modification = Next Grid + + + + ± (0, 0) (0, 1) (0, 0) (1, 0) (0, 1) (i, j)2 (i,j + 1) (i, j) (i + 1,j) (i,j + 1) 'i, j = I or O. 2Addition is based on the modulo 2. 0162-8828/86/0300-0269$01.00 © 1986 IEEE 269

04767780

Embed Size (px)

DESCRIPTION

kkjjj

Citation preview

Page 1: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2, MARCH 1986

Correspondence

Encoding of Line Drawings with a Multiple GridChain Code

TOSHI MINAMI AND KATSUYUKI SHINOHARA

Abstract-The multiple grid(MG) chain code which uses four differ-ent square grids is proposed to encode line drawings. The main pro-cesses adopted in the code are: 1) a grid selection algorithm which al-locates quantization points only to the vicinity of the course of a linedrawing, 2) labeling rule on quantization points which makes the fre-quency of some codes larger than that of other codes, and 3) quanti-zation points allocation-not to the corners, but to the sides of a squarewhich makes the straight line segments larger without increasing quan-tization error. A performance comparison of various chain codes ismade from the viewpoints of the encoding efficiency, naturalness of theencoded lines, and the rate distortion measure. Also, the superiority ofthe MG chain code to other codes is shown. At last, application of theMG chain code to the electronic blackboard system is explained.

Index Terms-Computer graphics, electronic blackboard, geometricprobability, line drawing encoding, multiple grid chain code, quanti-zation error, rate distortion theory.

I. INTRODUCTIONTo encode line drawings such as contour maps, computer graph-

ics, engineering drawings, etc., Freeman's chain code and manyother derived chain codes have been proposed [1]- [12].A newly developed coding method described here is quite dif-

ferent from these chain codes and is shown to be excellent in cod-ing efficiency and naturalness of regenerated line drawings [13]. Inthe conventional chain code, a certain grid is prepared and a linedrawing is superimposed on it, and the nearest nodes of the grid tothe line drawing are selected as quantization points. In these meth-ods, tracking of line drawings is limited by the grid.On the contrary, in the multiple grid chain code or MG chain

code described here, four different grids are prepared for quanti-zation, and by selecting the most appropriate grid for each quanti-zation, quite efficient encoding can be realized.

That is to say, by this selection, direction of a line drawing ispredicted and the next quantization points are placed in the vicinityof the course of the line drawing. In general, high coding efficiencycan be achieved by approximating high curvature parts of line draw-ings with shorter straight line segments and low curvature parts ofline drawings with longer straight line segments. In Freeman's chaincode with fineness 2T, only two straight line units with the lengthof 2T and 2 2T are used independently of curvatures.

In the MG chain code, quantization points are taken on the sidesof a unit square and lengths of straight line units are quite diversi-fied: V2T, 2T, -/T, 4T, 3,12T, and 2v[T, under the conditionthat the maximum error of the regenerated line drawings is the sameas the error of the regenerated line drawings by Freeman's chaincode with a fineness of 2T. The variety of the straight line units inthe MG chain code is one reason for the high encoding efficiencyof this code.

In this code, quantization points are allocated not to the corners,but to the sides of a square. By this allocation, the side length of a

Manuscript received October 10, 1984; revised July 15, 1985. Recom-mended for acceptance by Y. T. Chien.

The authors are with the Department of Electronic Engineering, Koga-kuin University, Tokyo, 160, Japan.

IEEE Log Number 8405365.

square can be doubled compared to that of Freeman's chain codewithout changing the maximum quantization error. This makeslonger chain segments available for encoding line drawings.

Furthermore, a specific labeling rule of quantization points isadopted. As a result of this labeling, some codes occur more fre-quently than other remainder codes and Huffman coding can beapplied to reduce the encoding bits.

In this correspondence, the coding algorithm of the MG chaincode is first described and then its performance is investigated bythe encoding results of straight lines, circles, and contour maps. Itis proved that the coding efficiency of the MG chain code is about60-70 percent better than that of the standard chain code. And it isalso found that the subjective quality of the regenerated line draw-ings by this algorithm is excellent. Finally, simulation results on theapplication of this coding algorithm to the electronic blackboard aredescribed. Here again, the superiority of the MG chain code toother chain codes is proved.

II. THE ENCODING ALGORITHM

In the algorithm to be described here, four different grids of hor-izontal and vertical lines Go, GI, G2, and G3, whose centers areseparated from each other by ±2T, are used for quantization ofline drawings. The side length of a unit square (fineness) of eachgrid is 4T. The four square grids are represented by line vectors asfollows:

Grid Cordinates of theorigin

x=0 y=Ox = 2T y = Ox=0 y=2Tx = 2T y = 2T

Line vector

(0, 0)(1, 0)(0, 1)(1, 1).

Each side of a square is divided into two equal length segmentsand centers of the segments are used as positions for quantizationpoints. A line drawing crossing the square is approximated by astraight line connecting two quantization points. The quantizationpoint on a segment where the line drawing enters to the square islabeled as "0." The center of the next segment on the same side islabeled as "1" and other centers are labeled from 2 to 7 in dueorder as shown in Fig. 1.

To encode a line drawing, a square grid Go is superimposed onit and one of unit squares, on which the line drawing is crossing,is selected as the square for quantization of the line drawing. Bythe x and y coordinates of quantization points corresponding to theentrance of a line to the square, the starting point of the encodedline is determined. Then, by the label of the segment where theline drawing exits from the unit square, the first chain code is ob-tained. And again, by this label, a square which is used for the nextquantization is selected, as shown in Fig. 2. The second square isselected in a way to make the next link as long as possible. Theselecting rule is tabulated as follows.

1) Case of the quantization point "0" on a vertical line

Label of the exitquantization point

01234

PresentGrid

(i,j])(i, j)(i,j)(i,j)(i, j)

+ Modification = Next Grid++++±

(0, 0)(0, 1)(0, 0)(1, 0)(0, 1)

(i, j)2(i,j + 1)(i, j)(i + 1,j)(i,j + 1)

'i, j = I orO.2Addition is based on the modulo 2.

0162-8828/86/0300-0269$01.00 © 1986 IEEE

269

Page 2: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8. NO. 2, MARCH 1986

76

4

5

2 T | 44T

4

2 3

Fig. 1. Quantization points on a unit square.

7 6 7 6 7 6 7 6

6 775°5 0 5 577234 24

5 4 54

(a) (b) (c) (d)

MG Chain Code;

7443563344345633

Fig. 3. Example of MG chain coding.

Internal Cover External Cover

-4-,_--7 6 7 6 5 4 5 4 6 7 7 6

-i 1 4 77. s2 7 O/ 1 24 iI 4

232 3 3 2 2 34 4

2 3 2 3

(e) (f) (g) (h)

Fig. 2. Selection of a square for the next quantization.

5 (i, j) + (0, 0) (i, j)6 (i,j) + (1, 0) =(i + vj)7 (i,j) + (0,0) (i,j)

2) Case of the quantization point "0" on a horizontal lineLabel of the exit

quantizationpoint Present Grid + Modification = Next Grid0 (i,j) + (0,0) =(i,j)I (i,j) + (1,0) =(i+ 1,j)2 (i,j) + (0,0) (i,j)3 (i,j) + (0, 1) =(i + 1,j)4 (i,j) + (0,1) -(i+ 1,j)5 (i,j) + (0,0) - (i,j)6 (i,j) + (0, 1) (i,i+ 1)7 (i,J) + (0,0) =(i,j)

An example of a line drawing and the corresponding encodedline is shown in Fig. 3. A numeral in a small circle indicates thegrid number.

The maximum error between the actual crossing point and thequantization point is T, and this value corresponds to the error inthe encoded line by Freeman's chain code with a square of a sidelength 2T. The length of a unit in a horizontal or vertical straightline generated in Freeman's chain code is 2T and that of a diagonalline is 2V2T. On the other hand, the lengths of units in straightlines connecting two quantization points in the MG chain code are12T, 2T, Vi76T, 47T, 3 liT, and 25Tas shown in Fig. 1. The dif-ference between the average length of straight line generated by theMG chain code and Freeman's chain code is one reason for the factthat the number of required bits per unit curve length of the MGchain code is smaller than those of Freeman's chain code.

In the MG chain code, codes 3, 4, and 5 are generated morefrequently than codes 0, 1, 2, 6, and 7 and Huffman coding can beapplied to reduce the redundancy effectively. The probability of eachcode occurrence is investigated theoretically and experimentally.To calculate the probability, the geometric probability theory is used[15]. According to the geometric probability theory, the probabilityor the measure of straight lines crossing areas A and B in Fig. 4 isobtained by the difference between the internal cover and external

Fig. 4. Measure of straight lines crossing the area A and B.

Fig. 5. Difference between the internal cover and external cover of dX andA.

cover of convex areas A and B. This theory can be applied to cal-culate the measure dM of straight lines crossing the segment A,segment B, and the infinitesimal division dx in Fig. 5 as follows.

dM = dx (cos 01 - COS 02)

8T-x 6T-x1(8T - x)2 + (6T)2 1(6T -X)2 + (6)2-

(1)

By moving the division dx from 0 to 2T and integrating eachmeasure, the total measure of straight lines crossing the segmentsSO, S13, and S23 in Fig. 6 is obtained.

M 2TM = J(COS 01 - cos 02) dx0

2T (- 8T7- x

CI(8T-x)2 + (6T)2= 0.2405.

6Tx )

1(67' -X)2 + (6T)2d

(2)

Now, let us define M's, pij, and P as follows.

Mi: Measure of straight lines crossing segments S0 and S,i.Mij: Measure of straight lines crossing segments So, 5Sl, and

2j]-Pi1: Probability of a straight line crossing segment S2J under the

270

Page 3: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2, MARCH 1986

So Sii

S25

S24

S22 S23

Fig. 6. Straight lines crossing SO, S13, and S23. Fig. 7. The Shannon diagram corresponding to the experimental result inTable I.

condition of the straight line crossing segment So andSli = MiI/Mi.

P: Transition probability matrix

PNo POI .. P07

= Plo

P70..

P77

(4)

For all the combination of segments, Mi1's, pij's, and P are cal-culated by (1)-(4). Along with this theoretical investigation, by en-

coding the map of the northern island of Japan with the use of MGchain code, the probability of each code occurrence is obtained ex-

perimentally. Both results are shown in Table I. In the theoreticalinvestigation, it is assumed that line drawings are nearly straightwithin two unit squares. This is a main cause for the slight differ-ence between the theoretical result and the experimental result.A state transition diagram corresponding to the experimental re-

sult in Table I is shown in Fig. 7. In the figure, each state showsthe quantized position of line drawings encoded by the MG chaincode, and the diagram is a simple Markov process representationof the quantized line drawing. The stationary probability P of eachstate in Fig. 7 or the occurring probability of each code is obtainedby the following equations:

p (5)

UO Ul *-- U7

P-Uo Ul U7

UO Ul ... U7

7

E Uj = 1i =l

(6)

TABLE ITRANSITION PROBABILITY MATRIX P

J 0 1 2 3 4 5 6 7

0 0 0 0 0.222 0 0.111 0.222 0.444

1 0 0.250 0.250 0 0 0.375 0.125 0

2 0.013 0.013 0.160 0.240 0.293 0.133 0.067 0.080

3 0.020 0.010 0.214 0.316 0.306 0.051 0.031 0.051

4 0.015 0.008 0.115 0.231 0.362 0.192 0.054 0.023

5 0.011 0 0.032 0.053 0.191 0.489 0.106 0.117

6 0.062 0.062 0.406 0.125 0.156 0.031 0.094 0.062

7 0.065 0.032 0.258 0.258 0.258 0.097 0.032 0

(a)'j 0 1 2 3 4 5 6 7

0 0 0 0 0 0 0 0 0

1 0 0 0 0 0 0 0 0

2 0 0 0.749 0.251 0 0 0 0

3 0 0 0.195 0.524 0.281 0 0 0

4 0 0 0 0.181 0.502 0.317 0 0

5 0 0 0 0 0.239 0.522 0.083 0.1566 0 0 0 0.251 0.529 0.220 0 07 0 0 0.304 0.315 0.254 0.126 0 0

(b)(a) Experimental probability(b) Theoretical probability

(7)

where ui is the stationary probability of state i.By substituting pij's in (5) and solving (6) and (7), ui's are cal-

culated as follows:

uo = 0.017

ul = 0.017

U2 = 0.157

U3 = 0.196

U4 = 0.286

U5 = 0.199

U6 = 0.067

TABLE IIHUFFMAN CODE

MG Chain Code Huffman Code

4 10

5 01

3 00

2 110

6 1110

7 11111

1 111101

0 111100

271

U7 = 0.064. (8)

Page 4: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2, MARCH 1986

X S >- 2L

(a)

41

MG Chain Codinglul/45-1OO=35.6b 17/45%100=37.8-

2

(b)

2 C

20/45 1 0=44.- 28/60X1OO= 46.7'

3121

2 1 D X33

Freeman's Chain Coding

8Y2+3= 19bit

(c)2 1 9/54i 00=35.2%

MG Chain Coding

1 8-3=54bi t I

I o 6TF1-I ol gLj!a

oo aQLO!t1 I}I121F-I

(d)

Freeman's Chain CodingFig. 8. Encoded straight lines with different slopes by Freeman's chain

coding and by MG chain coding.

Finally, the Huffman code corresponding to the ui's in (8) is ob-tained as shown in Table II.

III. PERFORMANCE OF THE MG CHAIN CODE

To evaluate performance of the MG chain code, efficiency anderror or distortions generated in the encoding process with the MGchain code, Freeman's chain code, and the generalized chain codesare compared to each other.

Furthermore, performance of various chain codes is comparedby the rate distortion measure and the results are shown in SectionIII-C.

A. Comparison of the MG Chain Code to Freeman 's Chain Code[1], [21

Performance of the MG chain code and Freeman's chain code iscompared by encoding straight lines with different slopes. Repro-duced straight lines are shown in Fig. 8.

The number of bits required to encode the straight lines by theMG chain code is 35.2-46.7 percent of the required bits by Free-man's chain code. Furthermore, the number of bending points inthe approximated lines by Freeman's algorithm is larger than thatof the approximated lines by the MG chain code. Fig. 9 illustratescoded circles by these two algorithms. Here again, the number ofbits required to encode the circles by the MG chain code are fewerthan the required bits by Freeman's chain code, and the shape of

the regenerated circles by the MG chain code is better than theshape of the regenerated circles by Freeman's chain code.

The coded approximation of the northern island of Japan, Hok-kaido, is shown in Fig. 10. It is seen that the coastline is deviatedregularly in the map drawn by Freeman's chain code, but there isno such deviation in the map drawn by the MG chain code. In ad-dition to this merit, the MG chain code reserves the details of theoriginal map.

The number of bits required to encode the map by Freeman'schain code is 2406 and the number of bits by the MG chain code is738, and 69 percent bit reduction is achieved.

B. Comparison of the MG Chain Code to the Generalized ChainCodes [3]-[61

The generalized chain coding scheme is one of the most excellentalgorithms for encoding line drawings with respect to coding effi-ciency and precision of regenerated line drawings.

To compare performance of the MG chain code to the general-ized chain codes, a contour is encoded with those chain codes.Quantized curves are shown in Fig. 11 and bit requirements for thedifferent chains are shown in Table III. As is shown in Table III andFig. 11, the efficiency of the MG chain code is highest among allchain codes, and the quality of the reproduced curve with the MGchain code is good compared to other curves.The excellent quality of the MG chain code stems from various

processes described in Section II, and among those processes, the

2)72

Page 5: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2, MARCH 1986

Radius 31 mm

Fineness 8 mm

Starting point

End

point

End

Fineness 4 mr,.

SI.

25 links 60 bits

(a)

Fineness 16 mm

43 links 129 bits

(b)

Fineness 8 nun

I I -I I -l I

12 links 34 bits

MG Chain Coding

22 links 66 bits

Freeman's Chain Coding(c) (d)

Fig. 9. Encoded circles by Freeman's chain coding and MG chain coding.

MG Chain Code

475 links738 bits

(b)Fig. 10. The northern island of Japan, Hokkaido.

Freeman's Chain Code

802 links2406 bits

(c)

start

Original map

(a)

I Iz I v*N,

I I -

INI I I

II II

N I.

-

273

?MM

I II I

Page 6: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2. MARCH 1986

01

(a) (b) (c)

(d) (e) (f)11 18 10 17 9 5 4

19 1 6 6 3

1208

1 3 21 14 2 2 1 5o 1

(g) (h)Fig. 11. Comparison of original contour (a) with different chain types: (b)MG chain, (c) 8 point, (d) 16 point, (e) 24 point, (f) 32 point chain, (g)24 point coding system, (h) MG chain coding system.

TABLE IIIBIT REQUIREMENTS FOR THE DIFFERENT CHAINS OF FIG. 11

Code System Number of Bits per Total No.Links Link of Bits

Generalized 8 points 87 3 261Chain Code 16 44 4 176

24 48 5 240

32 38 5 190I.

MG ChainCode

with HuffmanCoding

50

50

150

130

3

2.6

(a) ---t-1N 810 ..0

co o XoS

9 6 3 0 2

14 7 112 . . 0 413 8

(c) > a e \,\15/ ,,10

c

1213 11

21 014 9

14 10

18(e) 0 / t18

213 01818

21 ~ 8

714

2 4 8 12 9 6 3 0

I

10

0 14 441 5/ 1

8 (b)

1 0 10

(d)

(f)

Fig. 12. Quantization scheme for the improved version of the generalizedchain (24 point) code: (a)-(c) labels for quantization points, (d) example,(e) generalized chain (24 point) code, (f) improved version of the gen-eralized chain code.

TABLE IVBIT REQUIREMENTS FOR GENERALIZED CHAIN (24 POINT) CODE AND

IMPROVED VERSION OF THE GENERALIZED CHAIN CODE

Code System Number of Bits per Total No.Links Link of Bits

Generalized Chain Code 48 5 240

Improved Version ofGeneralized Chain Code 48 4 192

with Huffmancodinig 48 2.9 139

line direction predicting technique and specific labeling rule ofquantization points can be applied to the generalized chain codes.An example of the application to the generalized chain (24-point)code is explained in Fig. 12 and Table IV. As is shown in Fig. 12,about half of the original quantization points are used and theirpositions are determined by the direction of the previous straightline segment. The labeling order of each quantization point is de-termined according to the frequency of each code in order to applythe Huffman coding algorithm.

Although the detailed analysis of this technique has not yet beenmade, bit requirements are reduced about 40 percent withoutchanging the shape of the reproduced curve practically.

Through this experiment, the effectiveness of the technique isclarified.

C. Comparison of the Performance of Varions Chain Codes bythe Rate Distortion Measure [8], [14]

One other criterion to compare the performance of encoding al-gorithms is the rate distortion measure, namely, the product of max-imum encoding error E between the actual curve and the quantizedcurve, and the requirement in bits b per unit curve length. Thesmaller the product bE, the better the performance.

The investigation results are shown in Table V. The MG chaincode is better than any other chain codes from the viewpoint of thiscriterion.

VI. APPLICATION TO THE ELECTRONIC BLACKBOARD [7], [9],[10], [161

One of the application fields of the chain code is a signal trans-mission in the electronic blackboard system. The simulation of the

..4

274

Page 7: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2, MARCH 1986

7J K 2%' )Y L

(a)

The Freeeman co

is illustrated

Fig. 3(b)

Fig. 13. Texts and circuit diagram.

1 6 0.199

19.9T 16T'1 '.4i

0 .

( nF kn )

(c)

TABLE VCOMPARISON BY bE

Freeman's Chain coding 1.35 - 1.44

Hexagonal Grid Chain coding 1.22 - 1.19

MG Chain coding 0.53 - 0.56

b = requirement in bits per unitcurve length

E = maximum encoding error

TABLE VISIMULATION RESULTS

Japanese English Circuit

Freeman's Chain Code 10242 bits 6567 bits 8547 bits

MG Chain Code (Huffman) 2663(0.26) 1707(0.26) 2452(0.29)

Difference Window Chain 3672(0.36) 2218(0.34) 2626(0.31)Code [10]Level Code [12] 5602(0.55) 3965(0.66) 4685(0.55)

New Segment Chain Code[tl] 6410(0.63) 5231(0.80) 4336(0.51)

Modified DPCM [9],[16] 5720(0.56) 5000(0.76) 6176(0.72)

( ) indicates compression ratio to

electronic blackboard signal transmission by chain codes was car-ried out with Japanese and English text, and a circuit diagram isshown in Fig. 13. The Japanese text consists of 91 strokes with 3414black pels, the English text consists of 2188 black pels, and thecircuit diagram 2849 black pels. The simulation results are shownin Table VI. The numerals indicate the necessary number of bits toencode Japanese text, English text, and the circuit diagram. In thelevel code [12] and new segment chain code [11], the original textsand circuit diagrams are encoded by Freeman's algorithm first, thenthe redundancies are removed, and final codes are obtained. Nu-merals in the parentheses indicate the compression ratio of eachcode relative to the chain code. Among these codes, the MG chaincode is extraordinarily good in coding efficiency.

V. CONCLUSIONThe multiple grid chain code, which uses four different square

grids having quantization points on each side of a unit square, isproposed to encode line drawings. It is shown that the coding ef-ficiency of the MG chain code is significantly better than other chaincodes because of quantization points allocation to the vicinity of aline drawing, availability of longer chain segments, and adoption ofthe Huffman coding algorithm. As regards Huffman coding, theprobability of each code occurrence is investigated theoretically andexperimentally.

In addition to the coding efficiency, naturalness of the repro-duced line drawings by MG chain coding is quite good on accountof the high density of straight line segments for quantization,namely, smaller angles between straight line segments.

Freeman's Chain Code

The performance of the MG chain code is investigated by en-coding straight lines, circles, and contour maps and the superiorityof the MG chain code to other chain codes is ascertained. At last,the possibility of applying the MG chain code to the electronicblackboard is examined by simulation, and it is proved that the cod-ing efficiency of the MG chain code is better than the efficiency ofany other codes.

REFERENCES

[1] H. Freeman, "On the encoding of arbitrary geometric configura-tions," IRE Trans. Electron. Comput., vol. EC-10, June 1961.

[2] -, "Computer processing of line-drawing data," Comput. Surv., vol.6, Mar. 1974.

[3] -, "Application of the generalized chain coding scheme to map dataprocessing," in Proc. IEEE Comput. Soc. Conf Pattern RecognitionMap Data Processing, Chicago, IL, May 31-June 2, 1978.

[4] J. A. Saghri and H. Freeman, "Analysis of the precision of general-ized chain codes for the representation of planer curves," IEEE Trans.Pattern Anal. Machine Intell., vol. PAMI-3, Sept. 1981.

[5] A. Rosenfeld, Image Modeling. New York: Academic, 1981.[6] H. Freeman and J. A. Saghri, "Comparative analysis of line-drawing

modelling schemes," Comput. Graph. Image Processing, vol. 12,1980.

[7] A. Kegel and J. H. Bons, "On the digital processing and transmissionof handwriting and sketching," in Proc. Commun. IEEE Eurocon '77,1977, p. 2.4.6.

[8] D. K. Scholten and S. G. Wilson, "Chain coding with a hexagonallattice," IEEE Trans. Pattern Anal. Machine Intell., vol. PAMI-5,Sept. 1983.

275

Page 8: 04767780

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. PAMI-8, NO. 2, MARCH 1986

19] T. Kishimoto and Y. Sato, "Simultaneous transmission of voices andhandwriting signals: Sketchphone.' IEEE Trans. Commun., vol.COM-29, Dec. 1981.

[101 K. Kondo et al., 'Chain encoding of telewriting signals using linearinterpolation" (in Japanese), IECE Japan Tech. Rep. IE 83-107, 1983.

I l] T. Kaneko and M. Okuhara, "An efficient data compression for chain-coded line drawings" (in Japanese), IECE Japan. Tech. Rep. IE83-82, Nov. 1983.

[12] K. Shinohara and T. Minami. "Data compression for chain-codedline drawings by level code" (in Japanese), in Proc. 1984 IIEE JapanNat. Conf. Rec., no. 12-24, June 1984.

113] T. Minami and K. Shinohara, "Multiple grid chain coding," pre-sented at the 1984 Picture Coding Symp.. no. 6-1, Cession-Sevigne,France, July 1984.

[14] J. Koplowitz, "On the performance of chain codes for quantizationof line drawings," IEEE Trans. Pattern Anal. Machine Intell., vol.PAMI-3. Mar. 1981.

[15] L. A. Santalo, "Geometry and geometric probability," in Encycio-pedia of Matheniatics and Its Applications, vol. 1. Reading, MA:Addison-Wesley, 1976, pp. 27-34.

[16] Y. Sato et al., "Telewriting system' (iii Japanese), Electric. Comm.Lab. Tech. J., vol. 32, Mar. 1983.

Best Linear Unbiased Estimators for Properties ofDigitized Straight Lines

LEO DORST AND ARNOLD W. M. SMEULDERS

Abstract-This paper considers the problem of measuring propertiesof digitized straight lines from the viewpoint of measurement meth-odology. The measurement and estimation process is described in de-tail, revealing the importance of a step called "characterization" whichwas not recognized explicitly before. Using this new concept, BLUE(Best Linear Unbiased) estimators are found. These are calculated forvarious properties of digitized straight lines, and are briefly comparedto previous work.

Index Terms-BLUE estimators, chain-code string, digitization er-ror, digitized straight lines, length measurement, measurement accu-racy, quantization.

I. INTRO)DUCIION

This paper aims at finding optimal estimators for properties ofdigitized straight lines in an image. To find these, we first need aprecise understanding of the measurement process since this willreveal how improvement over existing methods can be achieved.This knowledge can then be used to arrive at "optimal" esti-mators, in some specified sense.

The measurement situation is the following. Before digitization,there is a line in the continuous world with specific properties (suchas slope, length, intercept, etc.) If one wishes to measure a prop-erty, a digitization of the continuous line is performed, leading toa chain-code string. This digitization reduces the information in anessential way since it maps a set of continuous lines into a set ofdiscrete strings. Therefore, exact measurement is impossible; thebest one can do is estimate the continuous property from the string.We will discriminate two steps in this estimation procedure

(Section II): a characterization in which the information present inthe actual chain-code string is reduced to some characterizing pa-

Manuscript received August 6, 1984; revised July 15, 1985.L. Dorst is with the Department of Applied Physics, Delft University

of Technology, 2628 CJ Delft, The Netherlands.A.W.M. Smeulders is with the Department of Pathology and Medical

Informatics, Free University, Amsterdam, The Netherlands.IEEE Log Number 8407172.

rameters, and a calculation in which these parameters are used ina formula for an estimator of the property. The results by otherinvestigators on measuring line length [1]-[4] may also be ex-pressed in these two terms (Section III).

The importance of this unraveling of the estimation procedure(recognized here for the first time) follows from the fact that giventhe digitization, one can optimize estimators in two independentways: by improving the characterization step, and by improvingthe calculation, i.e., the formula used as an estimator. Both areconsidered in Section IV. It is shown that to every characterizationthere corresponds a "BLUE" estimator, which is the optimal es-timator for that particular characterization (optimal in the sense ofminimal MSE, linearity, and being unbiased). The search for op-timal estimators therefore becomes a search for an optimal char-acterization. It is shown that a so-called "faithful characteriza-tion," in which no information is lost, results in optimal BLUEestimators.

In Section V, this basic result is applied to the measurement ofthe length per chain-code of a digital straight line.

II. A FORMAL DESCRIPTION OF THE MEASUREMENT PROCESSIn this section, the digitization and measurement process is de-

scribed in detail. This is necessary to arrive at a precise formulationof the optimal measurement methods.

All continuous straight lines form a set S12. An element I of thisset can be characterized by intercept e and slope et in a Cartesiangrid (1: v = ax + e). A property.f can be associated with each 1.For instance, f(e, a) a represents the slope of 1.

Properties of the continuous line I are to be measured after dig-itization symbolized by the operator D. Digitization results in astring c where c = Dl. Digitization of all lines in £ results in theset of all straight chain-code strings C.

Given a string c? there is an equivalence class of continuouslines, all having the same string c as its digitization. This equiva-lence class is called the domain OD(c) of c corresponding to thedigitization D.

Formal definition:

DD(C) {l.12tlDl c}. (I)Thus, the set of domains indicates the finest distinction of the orig-inal continuous lines that is still possible after digitization.

The digitized line c can be represented in various ways, for in-stance, as a string of (x, v) coordinates, a series of run codes, orthe Freeman directional code [1]. Furthermore, one can digitize indifferent ways, such as grid intersection quantization (GIQ) or ob-ject boundary quantization (OBQ) [2]. The difference between thesemethods is not essential to the basic idea of the present paper. Spe-cific results will be given for OBQ, 8-connected Freemanchain codes. For this case, the domains have been given in a pre-vious paper [5]. In Fig. 1, they are depicted for all lines having achain code consisting of 6 codes 0 or 1. The representation is in apart of the parameter space (e, a) where each point (e, a) repre-sents a continuous line l:y = ax + e.

The estimation of the original continuous propertyf is to be basedon the discrete string resulting from the digitization. This is doneby characterization and calculation. The characterization K re-duces the chain-code string c to a tuple t of parameters (where t =Kc) characterizing the string. For instance, one might characterizea string by the number of odd and even Freeman codes in the string.Characterizing all strings of eC leads to the set of all tuples 3. Atuple can be used in an estimator g which attributes a value g (t) tothe tuple t. This value g (t) = g (Kc) = g (KDI) is used as an esti-mate of the original continuous property f(l), based on the digiti-zation Dl. The recognition of the characterization K is essential inoptimizing the estimator g of the property f.

In the same way as domains are the equivalence classes intowhich the set of lines is divided by digitization, we have equiva-

0162-8828/86/0300-0276$01.00 © 1986 IEEE

276