Simple algorithms and architectures for B-spline interpolation - Pattern

metric implementation of cubic convolution while Chen and Defi- gueiredo [4] proposed generalized spline filters based on partial differential equation image ...
552KB taille 24 téléchargements 249 vues
27 1

n= n

Simple Algorithms and Architectures for B-Spline Interpolation P. V. SANKAR

AND

ofh Order

L. A. FERRARI

Abstract-We prove that the Toeplitz binary value matrix inversion associated with mth order E-spline interpolation can be implemented using only 2 ( m + 1) additions. We develop pipelined architectures for real time B-spline interpolation based on simple running average filters. We also show that an ideal interpolating function, which is approximated by a truncated sinc function with M half cycles, can be implemented using B-splines with M + 2 multiplies. With insignificant loss of performance, the coefficients at the knots of the truncated sinc function can be approximated using coefficients which are powers of two. The resulting implementation requires only M + 4m + 6 additions. We believe that the truncated sinc function approximated by zero order B-spline functions actually achieves the best visual performance.

Fig. I . B-splines

Let f ( t k ) 0 5 k 5 N be the samples of the original function. Let g ( t ) be the interpolated function and cp ( r : t k ) be the interpolating function: an rnth order B-spline centered at t k . W e write N- I

Index Terms-B-splines, convolution, interpolation, pipelined architectures, Toeplitz matrix, truncated sinc.

(3) where ck are the B-spline coefficients obtained by solving the following set of N equations

I. INTRODUCTION Many techniques have been proposed recently for efficient interpolation using B-splines. Hou and Andrews [ I ] discuss the use of B-spline functions in interpolation and decimation. Because conventional cubic B-spline interpolation techniques often result in a loss of resolution, many researchers have suggested alternate methods. Keys [2], for example, proposed a cubic convolution technique as an approximation to the cardinal spline (sinc function with three half cycles). Park and Schowengerdt [3] presented a parametric implementation of cubic convolution while Chen and Defigueiredo [4]proposed generalized spline filters based on partial differential equation image models. Parker et al. [5] describe a comparative study of interpolation techniques in medical applications. Generally it is believed that cubic convolution generates an interpolated image with the least blurring effects. In this correspondence we propose a new technique for the most efficient implementation of B-spline interpolation. W e also propose a very efficient technique for implementing a truncated sinc function with M half cycles. In Section I1 we describe the basic theory of discrete B-splines. W e prove that the Toeplitz binary valued matrix representing convolution by B-splines has an exact inverse for any order B-spline. In Section 111 we show how this leads to efficient algorithms and architectures for B-spline interpolation. In Section IV we demonstrate that a truncated sinc function filter can be efficiently implemented using B-splines.

N- I

(4) Equation (4) can be written in matrix form remembering that an 1 rnth order B-spline is obtained by repeated convolution of m rectangles

+

where

and

11. DISCRETEB-SPLINES

Let cpo(t) be the zeroth order B-splines comprised of p 1’s. cpO(t)= [ l L l ] .

(1)

B -

pterms

An rnth order B-spline can be defined using (see Fig. 1) cprn(t) = cp’?I-I(t) * c p O ( t ) .

(2)

1......1 0 1 . . . . . . 1

-

Manuscript received April 15, 1986; revised June 12, 1987. The authors are with the Department of Electrical Engineering, University of California, Imine, CA 92717. IEEE Log Number 8717011.

0162-8828/88/0300-0271$01 .OO 0 1988 IEEE

N + (p-1) (el) col-

and rows

(7)

212

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL

Theorem I : The matrix B can be factored as

IO, NO. 2, MARCH 1988

where

where

I

h

-

L O

. . . .0 . . . .

3 1 0

1 0 . 0 1 0

. . . 0 . . . .

c -

t o . .

.

. 0 1 c . .

N

+

.

\1

1 0 1

. 0 1 @ . .

.

. 0 1

-

(p-1) ( e l ) columns and rows

(12)

N + (p-1) (mtl) columns and rows

and

(9) and

0 D =

N + (p-1) (mtl) columns and rows L . . .

. . . _

(13) Proof: By carrying out the indicated matrix multiplications, we verify that

N + (p-1) (mtl) columns and rows

cc-' = I DD-I

Proof: Equation (8) may be verified by inspection. It may also be noted that the factorization in (8) represents a recursive implementation of the running average filter. Theorem 2:

=

I.

0

Note that C, D , C - ' , and D-'are lower triangular matrices with each diagonal element equal to unity. Theorem 3: cT = (D-lC-1)'"+'fr,

Proof: From ( 5 )

213

IEEE TRANSACTIONS ON PATTERN ANALYSIS A N D MACHINE INTELLIGENCE, VOL. IO. NO. 2, MARCH 1988

However, convolutions are commutative operations and hence matrix inverses and product operations can be interchanged. c~ =

( B - ~ ) ‘ f l + I f ~

titi

Using Theorems 1 and 2 cT

=

TOEPLITZ

-

m + l t h order

DATA

RUNNING

Cif1

MfiTRlX INVERTER

EXPfiNDER ilnaert

2

zeros

i

fiVERAGE FILTER

(D-lc-l)r~~+’fT,

The matrices B and B-’ are convolution operators and can be factored into simpler matrices containing only 0’s and 1’s. This leads immediately to efficient convolution algorithms and architectures using only additions.

Fig. 2. E-spline interpolator.

-

m t l Stages I

\

111. ALGORITHM A N D ARCHITECTURE FOR B-SPLINE

INTERPOLATION Based on Theorm 3 we present the following algorithm for Bspline interpolation.

INVERTER

INVEATER

INVERTER

Fig. 3 . Toeplitz matrix inverter.

m-Spline order. z-Zoom factor for interpolation.

Step 1: I n p u t f ( t ) 0 It < N . Step 2 : Invert Toeplitz matrix (a Toeplitz matrix is defined to be a matrix whose rows are obtained by a cyclic shift of the previous row by one element) to obtain c ( t ) . set c ( t ) = f ( t ) 0 5 t < N begin f o r ( l = O ; / < = m ; / = l + 1) begin p = 3 for ( t = p ; t < N ; t = f + 1)

Fig. 4. Single stage inverter ( p = 3 ) m r l stages \

I

+

c(r) = c(t) c(t - p ) for ( t = I ; t < N ; t = t + 1) c(r) = c(t)

-

c(t

-

1)

Spread = p i l + z i

end

Fig. 5 . ( m

+ 1 )th order running average filter.

end

Step 3: set g ( t )

[e(t )

coarse samples-knots

=

0

fine samples.

+

Step 4: Apply the running average filter m 1 times to g ( t ) . Step 5: Scale g ( t ) = g ( t ) / ( z + 1)’”. In the above algorithm we chose p = 3 so that the discrete Bsplines (even and odd order) have an odd number of terms and hence are centered at the pixel. This algorithm will however work for values o f p 2 2. In Fig. 2 we show the block diagram for our B-spline interpolator. In Fig. 3 we show that the Toeplitz matrix inverter can be implemented by pipelining rn 1 single stage inverters. In Fig. 4 we show that a single stage can be implemented using two adders and two shift registers. Fig. 5 shows the rn 1 single stage running average filter. Each first order running average filter can in turn be implemented using two adders and two shift registers (see Fig. 6). Because discrete B-splines of any order must be defined with respect to a center pixel location, we require that the zoom factor z be even. W e implemented a 2-D B-spline interpolator on girl image Fig. 7 by a one dimensional interpolation along the rows, followed by another one-dimensional interpolation along the columns. See Figs. 8 and 9 for zoom factors 4 and 8, respectively. The bottom left image in both figures, shows the knots on the coarse image.

I

p (I+z)

Fig. 6 . Running average filter.

+

+

IV. TRUNCATED SINCINTERPOLATIONUSING B-SPLINES The ideal interpolating function is the sinc function. Implementation of sinc function interpolation requires extensive computation. Cubic B-spline interpolation, on the other hand, induces blur in the resulting interpolated image, See Fig. IO, for the impulse response and transfer function of the low order B-spline functions.

Fig. 1

Qiti

2 74

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. IO. NO. 2, MARCH 1988

TABLE I Y(t)

runcated sinc inary truncated

0

sinc

y(rT) =

Fig. 8.

.125

0

{ (-lf-'

(2/~t)

lo

t odd

r

5

M

(17)

rT elsewhere.

Since the sinc function decays rapidly, we define a truncate function using only powers of two as coefficients. In this case is defined as

1

y(tT) =

P

L

Fig. 9 order

0

order I order 3 0.2

-

0

68

136

204

272

340

O

.-

;- 2 0 C

2 2

-40

L

E

(-l)'-'

(1/2"'*+'))

t odd

f 5

M

tT elsewhere.

Table I compares the first few terms of (17) and (18). The results indicate a reasonable approximation. The impulse responses and transfer functions for the truncated sinc and the binary valued truncated sinc B-spline filters are shown in Fig. 11 for 3 half cycles and Fig. 12 for 11 half cycles, respectively. We observe that the passband of the ideal low pass filter is preserved using the 11 half cycle truncated sinc for both the standard and binary valued representations. However, in the case of 3 half cycle truncation, we detect a slight drop in the magnitude at the low frequencies. In the stopband, even for the zeroth order B-spline, the attenuation is below 15 dB. The architectures for these techniques are shown in Fig. 13. For the same girl picture in Fig. 7, we applied the truncated sinc B-spline algorithm and binary truncated sinc B-spline algorithm. In Figs. 14 and 16 we show the output of truncated sinc B-spline algorithm (with 11 half cycles) for zoom factors 4 and 8, respectively. In Figs. 15, 17, and 18 we show the output of binary truncated sinc B-spline interpolation (again with 11 half cycles) for zoom factors 4 , 8, and 12, respectively.

-10 .-

Time C

I,

t=O

-60

Y)

-80

I-100

224.0

249.6

275.2

Frequency

Fig. 10.

A practical method of implementing a truncated sinc function places a knot at each local maxima. The sinc function is then approximated using standard B-splines approximation techniques. Let h ( t ) be the truncated sinc function with M half cycles and sampling rate T.

V . CONCLUSIONS Ignoring normalization, (step 5 in algorithm in Section III), the B-spline interpolation algorithm requires only additions. Similarly, the binary truncated sinc algorithm also requires only additions. We compare the computational complexity of these algorithms in Table 11. Based on our studies we arrive at the following conclusions: 1) In the literature B-spline interpolation algorithms are discouraged because of the time consuming matrix inversion process. In this paper we have demonstrated that the Toeplitz matrix inversion for any order B-spline can be implemented using only additions. We have also shown that the Toeplitz matrix inversion process has the same complexity as that of running average filter implementations. 2) We also found that a filter with truncated sinc function impulse response can be implemented with either a small number of multiplies, or with just a small number of additions. 3) We find that the zeroth order binary truncated sinc function seems to achieve the best visual performance (least blurred image) as can be observed by comparing Figs. 7-17.

~

215

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE. VOL. IO, NO. 2 , MARCH 1988

order I order 3

Time

68

0

136

c

-0 6

204

272

0

340

order

0

68

2496

I

I

224 0

275 2

204

272

340

.n

- 20

- 100 2240

136

1

2496

I1

I 275 2

(4

(c)

Fig. 11. Three half cycles. (a) Truncated sinc. (b) Binary truncated sinc. (c) Truncated sinc. (d) Binary truncated sinc. I 0 Y) 0)

5

0 6

a

2

0 2 -02

-10 0

68

0

136

204

272

6 80

136

272

3L 40

(b)

(a)

224 0

204 6

340

1

,

249 6

275 2

I

1

-100 224 0

'

I

249 6

I

I

275 2

(d) Fig. 12. Eleven half cycles. (a) Truncated sinc. (b) Binary truncated sinc. (c) Truncated sinc. (d) Binary truncated sinc.

Coarse input

IYTLAPOLATOR

CONVOLVER

I ( additions

f minimum

(a)

Coarse i n p u t

1

7

1

Interpolated

INTERPOLATOR

I

i o d d l t ions shifts only)

I

1

I additions shifts only)

I

(b)

Fig, 13. B-spline interpolator. (a) Truncated sinc B-spline interpolator. (b) Binary truncated sinc.

Fig. 14.

276

IEEE TRANSACTIONS ON PATTERN ANALYSIS A N D MACHINE INTELLIGENCE. VOL. 10, NO. 2, MARCH 1988

0

L

0

Fig. 15.

Fig. 17

¶.

0

Fig. 16.

Fig. 18.

TABLE I1 COMPUTATIONAL COMPLEXITY OF INTERPOLATION ALGORITHMS n nuber of half cycles in truncated sinc function zcca factor

z m

-splines

4(m+l) additions 6

shifts

order of 8-spline

Truncated sinc Straight convolutlon

Binary Trunc. sinc

multiplications

additim

2(W2)

jZ(II2)

mUltiPliCdtiOIlS 6 2(rrZ)

adds

REFERENCES [ I ] H. S. Hou and H . C . Andrews, “Cubic splines for image interpolation

and digital filtering,” IEEE Trans. Acoust., Speech, Signal Processing, vol. ASSP-26, pp. 508-517, Dec. 1978. [2] R . G. Keys, “Cubic convolution interpolation for digital image processing,” IEEE Trans. Acoust. > Speech, Signal Processing. vol. ASSP29, pp. 1153-1160, Dec. 1981. [3] S. K. Park and R . A. Schowemgerdt, “Image reconstruction by para-

-

8-spline approach Truncated SinC

6

4 W 1 ) adds

L

4(mh1)

shlfts

metric convolution,” Comput. Vision, Graphics, Image Processing, vol. 23, pp. 258-272. 141 T. C. Chen and R . J . P. Defigueiredo, “Two-dimensional interpolation by generalized spline filters based on partial differential equation image models,” IEEE Trans. Acoust. , Speech, Signal Processing, vol. ASSP-33, June 1985. IS] l . A. Parker, R. V . Kenyon, and D. E. Troxel, “Comparison of interpolating methods for image resampling, ” IEEE Trans. Med. Imaging, vol. MI-2, Mar. 1983.