
MANUSCRIPT TO TPAMI. PERSONAL USE OF THESE MATERIALS IS PERMITTED. HOWEVER, PERMISSION TO REPRINT/REPUBLISH THIS MATERIAL FOR ADVERTISING OR PROMOTIONAL PURPOSES OR FOR CREATING NEW COLLECTIVE WORKS FOR RESALE OR REDISTRIBUTION TO SERVERS OR LISTS, OR TO REUSE ANY COPYRIGHTED COMPONENT OF THIS WORK IN OTHER WORKS MUST BE OBTAINED FROM IEEE. 1 Fast Algorithm for Walsh Hadamard Transform on Sliding Windows Wanli Ouyang, W.K. Cham, Senior Member, IEEE Abstract—This paper proposes a fast algorithm for Walsh Hadamard Transform on sliding windows which can be used to implement pattern matching most efficiently. The computational requirement of the proposed algorithm is about 1.5 additions per projection vector per sample which is the lowest among existing fast algorithms for Walsh Hadamard Transform on sliding windows. Index Terms— Fast algorithm, Walsh Hadamard Transform, Pattern Matching, template matching, feature extraction The rest of the paper is organized as follows. Section 2 de- fines terms and symbols used in this paper. Then the WHT 1 INTRODUCTION algorithm in [9] is briefly introduced. In Section 3, we intro- Pattern matching, also named as template matching, is widely duce two examples of the proposed algorithm. Section 4 illus- used in signal processing, computer vision, image and video trates the proposed algorithm for 1-D order-N WHT. The algo- processing. Pattern matching has found application in rithm computes order-N WHT using order-4 and order-N/4 manufacturing for quality control [1], image based rendering WHT. In Section 5, the number of additions required by the [2], image compression [3], object detection [4] and video proposed algorithm is derived. Section 6 gives the experimen- compression. The block matching algorithm used for video tal result of motion estimation in video coding application, compression can be considered as a pattern matching problem which utilizes the proposed algorithm for computing 2-D [5]-[8]. To relieve the burden of high complexity and high WHT on sliding windows. Finally, Section 7 presents conclu- requirement of computational time for pattern matching, a lot sions. of fast algorithms have been proposed [9]-[13]. It has been found that pattern matching can be performed efficiently in Walsh Hadamard Transform (WHT) domain [9]. 2 WALSH HADAMARD TRANSFORM ON SLIDING In pattern matching, signal vectors obtained by a sliding win- WINDOWS dow need to be compared to a sought pattern. Hel-Or and Hel- Or’s algorithm [9] requires 2N-2 additions for obtaining all 2.1 Definitions WHT projection values in each window of size N. Note that Consider K input signal elements xn where n=0, 1, …, K-1, one subtraction is considered to be one addition regarding the which will be divided into overlapping windows of size N computational complexity in this paper. Their algorithm (K>N). Let the jth input window be: r T achieves efficiency by utilizing previously computed values in - X N (j)= [xj, xj+1, …, xj+N 1] for j = 0, 1, …, K-N. (1) the internal vertices of the tree structure in Fig. 1. Recently, A 1-D order-N WHT transforms N numbers into N projection the Gray Code Kernel (GCK) algorithm [10] which utilizes values. Let MN be an order-N WHT matrix and previously computed values in the leaves of the tree structure r r r T M= [ M (0), M (1), …, M (N-1)] , (2) in Fig. 1 was proposed. The GCK algorithm requires similar N N N N where r is the ith WHT basis vector. computation as [9] when all projection values are computed M N (i) Let y (i, j) for i = 0, 1, …N-1; j = 0, 1, …, K-N be the ith and requires less computation when only a small number of N WHT projection value for the jth window and projection vectors are computed. r T r yN(i,j)= M N(i) X N(j). (3) This paper proposes a fast algorithm for WHT on sliding r In [10], M (i) and yN(i, j) are called the ith projection kernel windows. Instead of performing order-N WHT by means of N r order-N/2 WHT and N additions in the tree structure, which is and projection result respectively. Let Y N(j) be the projection the technique adopted in [9], the proposed algorithm computes vector containing all projection values of the jth window and r T r order-N WHT by means of order-N/4 WHT and N+1 additions. Y N(j)=[yN(0, j), yN(1, j), …, yN(N-1, j)] = MN X N(j). (4) In this way, the proposed algorithm can obtain all WHT pro- For example, when N=4, we have: jection values using about 3N/2 additions per window. In the ⎛ y4 (0, j)⎞ ⎡1 1 1 1 ⎤⎛ x j ⎞ ⎜ ⎟ ⎢ ⎥⎜ ⎟ computation of partial projection values for sliding windows, y (1, j) 1 1 −1 −1 x . (5) v ⎜ 4 ⎟ ⎢ ⎥⎜ j+1 ⎟ r the proposed algorithm requires only 1.5 additions per projec- Y4 ( j) = ⎜ ⎟ = ⎜ ⎟ = M 4 X 4(j) y4 (2, j) ⎢1 −1 −1 1 ⎥ x j+2 tion vector for each window. As shown by experimental results ⎜ ⎟ ⎢ ⎥⎜ ⎟ ⎜ ⎟ ⎜ x ⎟ in Section 7, the computational time required by the proposed ⎝ y4 (3, j)⎠ ⎣1 −1 1 −1⎦⎝ j+3 ⎠ algorithm for computing ten or more projection values is about The WHT in (5) is in sequency order. Its basis vectors are 75% of that of the GCK algorithm. ordered according to the number of zero crossings. The relationship among WHTs in sequency order, dyadic order and ———————————————— natural order can be found in [15]. • The authors are with the Department of Electronic Engineering, The Chi- nese University of Hong Kong. E-mail: {wlouyang, wkcham}@ee.cuhk.edu.hk xxxx-xxxx/0x/$xx.00 © 200x IEEE 2 MANUSCRIPT TO TPAMI. PERSONAL USE OF THESE MATERIALS IS PERMITTED. HOWEVER, PERMISSION TO REPRINT/REPUBLISH THIS MATERIAL FOR ADVERTISING OR PROMOTIONAL PURPOSES OR FOR CREATING NEW COLLECTIVE WORKS FOR RESALE OR REDISTRIBUTION TO SERVERS OR LISTS, OR TO REUSE ANY COPYRIGHTED COMPONENT OF THIS WORK IN OTHER WORKS MUST BE OBTAINED FROM IEEE. 2.2 Previous WHT computation methods In [9], Hel-Or and Hel-Or proposed a fast algorithm that r r r computes Y N(j) from Y N/2(j) and Y N/2(j+N/2) using (6). ⎧y ()i / 2 , j + y ()i / 2 , j + N / 2 ,i%4 = 0 or 3 N / 2 ⎣⎦ N / 2 ⎣⎦ yN (i, j) = ⎨ , ⎩ yN / 2 ()⎣⎦i / 2 , j − yN / 2 ()⎣⎦i / 2 , j + N / 2 ,i%4 =1 or 2 (6) where % is the modulo operation; and ⌊ ·⌋ is the floor func- Fig. 2 Signal flow diagram of the Bottom up algorithm for window size tion. equal 4 As shown in Fig. 1, their algorithm first computes WHT projection values for window size N being 2, which are then used to compute WHT projection values for window size be- 3.2 Fast Algorithm for Window Size 8 ing 4 and so on. The computation starts at the root and moves The proposed algorithm and the GCK algorithm [10] for down the tree until the projection values represented by the window size being 8 are described in Table 2. The proposed r leaves are computed using (6). The algorithm in [9] requires 1 algorithm computes Y 8(j+2) for j=0, 1, …K-8, which is the r addition per window along each node of the tree in Fig. 1. The WHT projection vector in window j+2, using Y 8(j)=[y8(0,j), T GCK algorithm [10] utilizes previously computed order-N y8(1,j), …, y8(7,j)] , which is the computed projection vector in projection values for computing the current order-N projection window j. value. When a small number of projection values are com- Define tN/4(i, j) for i = 0, …, N/4-1; j = 0, 1, …, K-5N/4 as: puted, the GCK algorithm requires 2 additions per window for tN/4(i, j) = yN/4(i, j) - yN/4(i, j+N). (9) each projection value while the algorithm in [9] requires For N=8, we have: O(logN) additions. When all projection values are computed, ⎡t2 (0, j)⎤ ⎡y2 (0, j)⎤ ⎡y2 (0, j + 8)⎤ . both the algorithms in [9] and [10] require about 2N additions. ⎢ ⎥ = ⎢ ⎥ − ⎢ ⎥ ⎣t2 (1, j)⎦ ⎣ y2 (1, j)⎦ ⎣ y2 (1, j + 8)⎦ A new fast algorithm, which is more efficient than those re- From (3) and then (7), we have: ported in [9] and [10], is proposed in this paper. It can effi- ⎡t (0, j)⎤ ⎡1 1 ⎤⎡ x j ⎤ ⎡1 1 ⎤⎡x j+8 ⎤ ciently compute order-N WHT on sliding windows, i.e. yN(i, j) 2 = − ⎢ ⎥ ⎢ ⎥⎢x ⎥ ⎢ ⎥⎢x ⎥ for i = 0, …, P-1 (P≤N) and j = 0, 1, 2, …, K-N. ⎣t2 (1, j) ⎦ ⎣1 −1⎦⎣ j+1 ⎦ ⎣1 −1⎦⎣ j+9 ⎦ ⎡1 1 ⎤⎡ x − x ⎤ ⎡ d ( j) ⎤ = j j+8 = M 8 . (10) 3 FAST ALGORITHM FOR WHT ON SLIDING ⎢ ⎥⎢x − x ⎥ 2 ⎢ ⎥ ⎣1 − 1⎦⎣ j+1 j+9 ⎦ ⎣d 8 ( j + 1)⎦ WINDOWS FOR WINDOW SIZES 4 AND 8 As given by (10), t2(i, j) is the ith order-2 WHT projection T This section gives examples of computing order-N WHT on value of [d8(j), d8(j+1)] . According to Table 2 and (10), WHT sliding windows of sizes N=4 and 8 using the proposed algo- projection vector in window j+2 can be computed from those rithm. in window j as well as t2(i, j) as follows: ⎡y (0, j +2)⎤ ⎡ y (0, j) ⎤ ⎡−t (0, j)⎤ 3.1 Fast Algorithm for Window Size 4 8 8 2 ⎢ y (1, j +2)⎥ ⎢− y (2, j)⎥ ⎢ t (0, j) ⎥ The proposed algorithm and the GCK algorithm [10] for ⎢ 8 ⎥ ⎢ 8 ⎥ ⎢ 2 ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ window size being 4 are described in Table 1.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-