AN EFFICIENT CORRELATION COMPUTATION METHOD FOR ...

Report 2 Downloads 194 Views
AN EFFICIENT CORRELATION COMPUTATION METHOD FOR BINARY IMAGES BASED ON MATRIX FACTORISATION R.Bogush1, S.Maltsev1, S.Ablameyko2, S.Uchida3, S.Kamata 3

1

Polotsk State University, Blochin str.,29, Novopolotsk, Belarus, 211440 [email protected], [email protected]

2

Institute of Engineering Cybernetics, Surganov str.,6, Minsk, Belarus, 220012 [email protected] 3

Department of Intelligent Systems, Kyushu University,6-10-1 Hakozaki, Higashi-ku, Fukuoka 812-8581, Japan {uchida, kamata}@is.kyushu-u.ac.jp

1. INTRODUCTION

The detection of an object in an image is one of the main problems in pattern recognition and image processing [1]. The simplest object detection is the direct method where object template is moved through images while computing the correlation between the image and the object template. The positions with higher correlation are considered as candidates for object location. Although the direct method is intuitive and widely applicable, it requires numerous computations. In order to reduce computational complexity of the direct method, mainly three strategies have been used. The first strategy is the incorporation of thresholding operation [2,3] where the correlation computation at some position is stopped if expected correlation at the position is smaller than a threshold. The second strategy utilizes two-dimensional Fourier transform. This strategy is based on the fact that the correlation between image and object template is expressed as a simple multiplication of their spectrums in frequency domain [1]. Fast Fourier transform (FFT) algorithm [4] is used to obtain those spectrums efficiently. The third strategy for complexity reduction is the exploitation of image characteristics. For example, when han-

1

dling binary images, one can improve the efficiency of the direct method by using simple logical exclusive-OR operations instead of multiplication and summation operations [5]. Correlation computation for binary images is easier than that for gray-scale ones. Such as binary images often contain many `zeros` the task can be further simplified by using matrix factorisation technique [6,7]. In this paper, we propose an algorithm for computing the correlation between binary images with less complexity and time based on matrix factorisation approach. In the present algorithm, an object template represented as a matrix is first decomposed into several sparse matrixes by a matrix factorisation technique. The factorised matrix of object template is then multiplied to a matrix, which is a fragment of input image (i.e., a submatrix of input image matrix). Finally, by taking the diagonal sum of the resulting matrix, the correlation between the object template and the input image is obtained.

2. CORRELATION COMPUTATION BASED ON DIRECT METHOD

In this section, we review the direct method for computing correlation between binary images. The direct method for computing correlation between a M  N matrix X (input image) and a

n  n matrix A (object template) is as follows: (1) take the first n columns of X as a M  n matrix X sub , (2) multiply XTsub and A , (3) compute the diagonal sum of the resulting matrix T AX sub as correlation, and (4) repeat these steps while taking new X sub by shifting it in X

to one column right. For example, consider two matrixes A and X defined as

1 0 A  00  0 1

1 1 0 0 1 1

1 1 1 1 1 1

0 0 0 0 0 1 1 1 0 1 1 0 0 1 0 0  , X  0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0

0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0

0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0

0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

0 1 1 0 0 1 1 0 0 0 1 0 0 0 0 1

2

0 1 0 0 0 0 1 0 0 0 1 1 0 0 1 1

0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1

0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1

0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1

0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1

0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0

0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0

0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0

0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0

0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0

(1)

Unless otherwise mentioned, we use the symbol 0 as –1 both for notational simplicity and for emphasizing that we deal with binary images. Firstly, taking first six columns of X as X sub . Then, multiplying XTsub and A , we obtain (remember that the symbol 0 means –1)

1 0 T AX sub  0 0 0 1

1 1 0 0 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 0 0 1 1

0 0 0 0 0 1  0 0  0 0  0 0  0 0  0 1 0 0 0 0 0 0

0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0

0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0

0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

T

0 1 1 0 0  -6 1  2 1 0   2  2 0  0  2 1   6 0 0 0 0 1

4 4 0 0 4 4

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

2 2 2 2 2 2

4 4 0 0 4 4

6 2 2 2 2 6

6 2 2 2 2 6

6 2 2 2 2 6

4 4 0 0 4 4

6 2 2 2 2 6

6 2 2 2 2 6

6 2 2 2 2 6

6 2 2 2 2 6

 4  4 . 0 0   4  4

(2)

The sum of elements in the first diagonal (underlined elements in (2)), equal to 6, corresponds to the correlation between A and the matrix consisted of the first 6 strokes of X sub . From this result, the correlation between the object template A and the first 6  6 submatrix of X (indicated by bold font in (1)) is obtained as 6. By taking the sum of each diagonal, we

obtain correlation between A and each 6  6 submatrix of X sub . Repeating the above operations shifting X sub in X to one column right, and then selecting the maximum correlation, the object in the input image is detected.

3. MATRIX FACTORISATION

In this section, it is proved that an arbitrary binary matrix can be represented as multiplication of several sparse block-diagonal submatrixes. For this proof, we use the following lemma. Lemma: Any binary matrix A with size M  N can represented in the form of multiplication: A  DB

(3)

where B is a matrix with size N1  N ( N1  N ) obtained from matrix A after deleting repeated and inverse strings, and D is a matrix with size M  N1 with elements:

3

1, if b j  a i  d ij  0, if b j  ai  in other cases info symbols are absent

(4)

where a i and b i are the i th stroke of A and B , respectively, and ai is the inverse of a i . For example, if a i  [1 1 0] , then ai  [0 0 1] . Proof: It is obvious, because matrix D looks like reordering matrixes combination, which lay out strokes of matrix B either inverse or without in matrix A . It can be easily verified that: 1 1 0 1 1

1 0 1 0 1

1 1  1  1 1 1 1 0   0 1 0 1  1  1  1 1   

(5)

[Q.E.D.] The possibility of the arbitrary binary matrix factorisation without any restrictions for structure and size is based on the following theorem. Theorem: Arbitrary binary matrix A with size M  N can be represented as multiplication of sparse block-diagonal submatrixes with no more then two info symbols in every stroke. Proof: Consider the matrix A with dimensions M  N as set of submatrix A k with size of

M  Nk : A  [A1 | A 2 |  | A k |  | A K ]

(6)

where N k  2 for all k , although if N mod 2  0 , exceptionally N K  1 . Thus number of blocks K is equal to ( N  1) 2 , where the notation x  means the maximum integer which does not exceed x . According to Lemma, A can be represented as:  A1  A   A K   

T

 D1B1     D K B K   

T

B1   .  [D1 |  | D K ]   B K  

(7)

Denoting

B1  , B   B K   the matrix B has two symbols at each column at most.

4

(8)

It

is

obvious

that

by

applying

the

above

procedure

to

the

matrix

D  [D1 |  | DK ] , the matrix D also can be represented as multiplication of two

matrices, one of which has block diagonal structure. The continuation of this procedure leads to factorisation matrix A as row of sparse block-diagonal matrixes. [Q.E.D.]  This proof is constructive in nature, and therefore we can immediately obtain the following algorithm for matrix factorisation.

1. Matrix A is divided into blocks A k that consist of pairs of neighbouring columns. 2.

For every block A k auxiliary matrix B k is formed that is obtained by deleting repeated and inverse strokes. Then, we have the first module of factorisation as a build blockdiagonal matrix B according to (8).

3. Matrix D k is obtained by comparing every stroke of A k with strokes of B k according to equation (4). Then the matrix D can be expressed as

D  [D1 | D2 |  | Dk |  | D K ]

.

4. Let joint the neighbouring block matrixes D k : [D  D 2 | D3  D 4 |  | D K 1  D K ] if K mod 2  0 . D  [D'1 | D' 2 |  | D' K ' ]   1 otherwise [D1  D 2 | D3  D 4 |  | D K ]

It is clear that K '  ( K  1) 2 . 5. By considering D'k as A k , repeat 2-5 until the number of columns of D is not more than 2. For example, the matrix A of equation (1) is factorised as follows: 1 0 0 0 0 1

1 1 0 0 1 1

1 1 1 1 1 1

1 1 1 1 1 1

1 1 0 0 1 1

 1 1 1 1  1 1  0  1  1   0 1  1 1 1    1  0   .  0 1 1 1 1 1   0 1       1 0  1  1 1 0  1   1  1 0  1 1  

5

(9)

4. CORRELATION COMPUTATION BASED ON MATRIX FACTORISATION

Peculiarity of the correlation computation for binary images is the lack of multiplication operations for the direct method of correlation computation such as multiplying to 1 does not change the pixel and multiplying to 0 gives inverse symbol as result. Consequently, the main problem of the image processing computational complexity reducing is the decreasing quantity of the summing up operations. This can be done by using matrix factorisation described in Section 3. Let we have two images: image of object template A with size n  n and image X with size M  N where this object should be detected. The task of detecting this object may be considered as the correlation function computation between two images. Maximal value of correlation function will indicate where the object is situated. Such as we know template image A in advance, we perform its factorisation first. Then, the algorithm of object detection based on correlation computation can be written as the following.

1. Taking the first n columns of X as X sub . Clearly, the size of X sub is M  n . 2. Multiplication of XTsub and factorised matrixes of A . T T 3. Computing diagonal sums of AX sub as correlation. Since AX sub has (M  n  1) diagonals, we obtain (M  n  1) correlation values.

4. Shifting X sub in X to one column right and repeat steps 2 and 3 until all fragments of image X are analysed. 5. Examining correlation values to decide the object existence. Maximal correlation values indicate object position in the image X .

For this algorithm, maximal necessary number of operations of addition/subtraction type is C  M  ( N  n  1) where C is the number of operations for multiplying the (factorised) ob-

ject template to one stroke of X sub .

6

Consider an example of a correlation computation between the object template A and the input image X (1). For the factorised template (9), a number of vector-matrix multiplications is equal to 11 operations of addition/subtraction type. Traditional method of multiplying of vector to the full template image requires 30 operations of addition/subtraction type. For a given example, correlation computation based on the direct method of Section 2 requires 30 16 11  5280 operations of addition/subtraction type. By using matrix factorisation, for the given example, we need only 1116 11  1936 operations, i.e., C  11 . This is because when multiplying the first, second, third, and forth matrix of (9) to one stroke of

X sub , only 0, 3, 3, and 5 operations of addition/subtraction type are required, respectively.

5.COMPARISON AND DISCUSSION

Number of operations for computation of correlation function for various sizes of binary images and several methods [8] is presented in Table 1. These results were obtained in assumption that the complexity of the one operation multiplication is equivalent to three plus/minus operations complexity. The comparison of the results shows that the computational complexity of our approach to the correlation computation is more attractive in comparison with other approaches. In general, image processing for direct correlation function computation utilises the principles and realises all advantages of maximum likelihood method. Another advantage is the absence of the trigonometric and complex multiplications and summing up what is required for various Fourier transformations. This absence allows the use of ordinary microprocessors without floating-point unit and permits to use the standard procedure of creating recursive structure for programming only with main program cycle.

7

8 642 024 -

1 190 912

700 352

1 134 750

2 927 040

-

-

-

72*72

80*80

120*120

128*128

240*240

256*256

3313056 -

5 65 008

-

226 280

241 152

-

-

-

64*64

-

384 500

60*60

-

-

955 342

-

-

-

196 212

-

-

80 832

-

-

48*48

35 828

-

46 336

-

32*32

-

32 016

Polynomial transform algorithm

-

Rader-Brenner Winograd algorithm algorithm

60 260

AgarwalCooley algorithm

30*30

N*N (matrix size)

-

3 844 796

4 739 204

830 140

-

-

-

174 780

-

-

35 516

-

Nussbaumer polynomial algorithm and split-radix FFT

-

948 100

-

-

-

194 820

-

-

35 80

Nussbaumer algorithm

463 667 2 633 142 3 099 852

13 766 400 16 711 680

379 200

126 720

97 459

68 812

2 080 768

1 713 600

505 600

368 064

258 040

56 880

31 795

108 288 212 400

10 240

9450

Our algorithm based on matrix factorisation

31 744

26 100

Direct method

Table 1. Comparison of number of operations for correlation function computation in some

algorithms

6.CONCLUSION

In this paper, we considered a task to reduce complexity in correlation computation of two binary images. It was proposed to use matrix factorisation approach for this task. We showed that any binary image could be factorised. An algorithm for correlation computation of two binary images based on factorised image of object template was proposed. It is shown that it allows reducing number of operations needed for correlation computation in comparison with other algorithms. REFERENCES

1.

L.G. Brown, “A survey of image registration techniques,” ACM Computing Surveys, vol.24, no.4, pp.325-376, 1992.

2.

D.I. Barnea and H.F. Silverman, “A class of algorithms for fast digital image registration,” IEEE Trans. Computers, vol.C-21, no.2, pp.179-186, 1972.

3.

G.J. Vanderbrug and A. Rosenfeld, “Two-stage template matching,” IEEE Trans. Computers, vol.C-26, no.4, pp.384-393, 1977.

4.

H.J. Nussbaumer, Fast Fourier Transform and Convolution Algorithms, Springer-Verlag, 1981.

5.

A.K. Jain, Fundamentals of digital image processing, Prentice Hall, 1989.

6.

A. Varga., “Computation of inner-outer factorization of rational matrices,” IEEE Trans. Autom. Control, vol.43, no.5, pp. 684-688, 1998

7.

W.S. Verwoerd and V. Nolting, “Angle decomposition of matrices, Comput. Phys. Commun,” 218-239, vol.108, no.2-3, 1998

8.

A.M. Krot and H.B. Minervina, Signals and images digital spectrum processing fast algorithms and programs, Nauka i Teknika, Minsk, 1995.

9