Pattern Recognition Letters 7 (1988) 167 171 March 1988 North-Holla nd Compression of chain line sequences codes using digital straight M. LINDENBAUM Department of electrical Engineering, Technion - Isreal Institute of Technology, Hai/a 32000, Israel J. KOPLOWITZ* Department ~tf Electrical and Computer Engineering, Clarkson University, Potsdam, N Y 13676, USA Received 19 August 1987 Abstract: Compression of chain codes is achieved by breaking the sequence into strings of digital straight lines whose representa- tion is stored in a table. It is shown that the number of table entries is (1/4rrZ)N 4 + O(N 3 log N). A computational method is given for an exact determination which shows that the asymptotic approximation is accurate. Key words." Chain codes, compression of line drawings, digital straight lines. 1. Introduction The boundary of a region in a binary image can be represented by a 4 or 8-connected chain code, using two or three bits per link respectively. Sundar Raj and Koplowitz [1] propose a bit reduction method which breaks the chain code into subse- quences of digital straight lines [2 6] of length up to N. A predetermined table, in which the entries con- sist of the possible subsequences arising from this process, is formed. The number of entries in the table, shown to be 0(N4), grows polynomially with N compared with an exponential growth of the number of general chain code sequences. Each chain code subsequence is represented by its posi- tion in the table, yielding a significant reduction in the number of encoding bits required when most subsequences are long, which is the case for high precision digitization. Sundar Raj and Koplowitz determine the size of the table for low values of N, *This work was supported by a Lady Davis Fellowship, while the co-author was at the Technion-Israel Institute of Technology. by an exhaustive search checking for the straight- ness of all binary chain code sequences. In [7] the number of digital straight lines is inves- tigated. Using these results it is shown here, that for 8-connected chain codes the number of table entries is given by E(N) = (1/4rc2)N4 + O(N 3 log N). Fur- thermore, a computational method is given for an exact determination of E(N) which shows that the asymptotic value of (1/4~2)N 4 is quite accurate. From the table the bit reduction can be determined under the assumption that most subsequences are of length close to N. We also suggest an alternative method of constructing the table which simplifies the coding at the cost of increasing the tabel size. 2. Asymptotic and exact results for the table size We consider the 8-directional chain code and as- sume for the present, that the chain sequence con- tains only two types of links, denoted by 0 and 1. To implement the method suggested by Sundar Ray and Koplowitz, it is necessary to prepare a table of chain code sequences of maximum length N. The 0167-8655/88/$3.50 O 1988, Elsevier Science Publishers B.V. (North-Holland) 167