Paper
Fast Polar Harmonic Transforms
† †† † Zhuo YANG , Alireza AHRARY (Member), Sei-ichiro KAMATA † Graduate School of Information, Production and Systems, Waseda University †† Department of Informatics, Nagasaki Institute of Applied Science
〈Summary〉 Polar Harmonic Transform (PHT) is termed to represent a set of transforms those kernels are basic waves and harmonic in nature. PHTs consist of Polar Complex Ex- ponential Transform (PCET), Polar Cosine Transform (PCT) and Polar Sine Transform (PST). They are proposed to represent invariant image patterns for two dimensional im- age retrieval and pattern recognition tasks. They are demonstrated to show superiorities comparing with other methods on describing rotation invariant patterns for images. Ker- nel computation of PHTs is also simple and has no numerical stability issue. However in order to increase the computation speed, fast computation method is needed especially for real world applications like limited computing environments, large image databases and realtime systems. This paper presents Fast Polar Harmonic Transforms (FPHTs) includ- ing Fast Polar Complex Exponential Transform (FPCET), Fast Polar Cosine Transform (FPCT) and Fast Polar Sine Transform (FPST) that are deduced based on mathematical properties of trigonometric functions and number theory. The proposed FPHTs are aver- agely over 10 times faster than PHTs that significantly boost computation process. The experimental results on both synthetic and real data are given to illustrate the effectiveness of the proposed fast transforms. Keywords: Fast Polar Harmonic Transform, Fast Polar Complex Exponential Transform, Fast Polar Cosine Transform, Fast Polar Sine Transform, image retrieval, pattern recogni- tion
tation invariant patterns. These methods are used 1. Introduction in many real world applications like character recog- Rotation invariant pattern representation is one of nition6) and multi-spectral texture analysis 7).But the essential challenges in image retrieval and pat- computations of their kernels involve a number of fac- tern recognition arises from the fact that in many real torial terms and suffer from numerical stability. Po- world applications, images should be considered to be lar Complex Exponential Transform (PCET), Polar the same even if they are rotated. There are mainly Cosine Transform (PCT) and Polar Sine Transform two kinds of features to represent rotation invariant (PST) are proposed as a set of Polar Harmonic Trans- patterns. Non-orthogonal rotation invariant features forms (PHTs) to represent two dimensional images like rotational moment 1) and complex moments 2),3) and demonstrated to show superiorities comparing are proposed. But these methods are not orthogo- with other methods 8). With the orthogonal property, nal that means lack of information compactness on PCET, PCT and PST can transform the image func- pattern representation. Orthogonal rotation invari- tion to a set of mutually independent patterns with ant features like Zernike moment 4) and Orthogonal minimum redundancy and maximal discriminant in- Fourier-Mellin moment 5) are proposed to describe ro- formation.
399 The Journal of the IIEEJ vol. 39 no. 4(2010)
PHTs are defined on a unit circle. Unfortunately, bases, PHTs can generate patterns that are used for kernel generation of these transforms involves many rotation invariant representation. Applications like trigonometric functions to compute angular and ra- image retrieval and pattern recognition benefit from dial parts that no fast method has been reported to PHTs. Kernel computation of PHTs has no numer- the best of our knowledge. The high computational ical stability issue but suffers from high computa- complexity is the constraint for real world applica- tion complexity problem. This section introduces the tions such as realtime systems, limited computing background of PCET, PCT and PST. environments and large image databases. Therefore, 2.1 Polar Complex Exponential Transform reduction of the computational complexity for PHTs Given a 2D image function f(x, y), it can be trans- is very significant. formed from cartesian coordinate to polar coordinate This paper proposes fast PHTs. Fast and com- f(r, θ),wherer and θ denote radius and azimuth re- pact methods to compute the kernel coefficients of spectively. The following equations transform from PHTs are proposed by using mathematical proper- cartesian coordinate to polar coordinate, ties of trigonometric functions and number theory. r = x2 + y2, (1) The kernel function of PHTs has symmetry properties and y with respect to the x axis, y axis, y = x line, y = −x θ =arctan . (2) x line and origin that can be used for fast computa- The transform involves points within the largest in- tion. The computational complexity of PHTs can ner circle of the image. After normalization(detail in be reduced by calculating half of the first quadrant. subsection 3.3), it is defined on the unit circle that That is only one eighth of the direct transform. An r ≤ 1, and can be expanded with respect to the basis even more efficient kernel generation method based functions Hnl(r, θ)as on relative prime number theory is proposed to com- ∞ ∞ f(r, θ)= M nlHnl(r, θ), (3) pute PHTs after analyzing the point distribution on n=−∞ l=−∞ two dimensional discrete space. Much more symmet- where the coefficient is 2π 1 1 ∗ ric points are involved to compute simultaneously in M nl = f(r, θ)Hnl(r, θ)rdrdθ. (4) π 0 0 order to significantly accelerate the transform speed. The basis function is given by ilθ These fast transforms are named as Fast Polar Har- Hnl(r, θ)=Rn(r)e , (5) monic Transforms (FPHTs) that consist of Fast Polar where 2 i2πnr Complex Exponential Transform (FPCET), Fast Po- Rn(r)=e , (6) lar Cosine Transform (FPCT) and Fast Polar Sine and satisfying orthogonality condition 1 Transform (FPST). ∗ 1 Rn R (r) n (r)rdr = δnn , (7) The organization of this paper is as follows. The 0 2 and basic theories of PCET,PCT and PST including 2π 1 ∗ mathematics descriptions are provided in Section 2. Hnl(r, θ)Hn l (r, θ)rdrdθ = πδnn δll , 0 0 The proposed method is presented in Section 3 af- (8) ter given the mathematical properties of trigonomet- where δij is Kronecker delta. Rewrite (4) with (5) ric functions and sufficient number theory knowledge. and (6), In Section 4, the performance of FPHTs and PHTs 2π 1 1 2 M nl = f(r, θ)(cos (2πnr + lθ) are compared against both synthetic and real images. π 0 0 . 2 The experimental results illustrate the effectiveness −i sin (2πnr + lθ))rdrdθ of our proposed FPHTs. Finally, Section 5 concludes (9) this study. |Mnl| is rotation invariant. Figure 1 show the real
and imaginary parts of the basis functions Hnl(r, θ) 2. Background under different n,l values. It takes two trigonometric PHTs are a set of transforms that consist of PCET, operations and one inverse trigonometric operation to PCT and PST. Based on set of orthogonal projection generate PCET kernel coefficient for each point.
400 Paper : Fast Polar Harmonic Transforms
Fig. 1 The basis functions Hnl(r, θ) of PCET (Left is real parts and right is imaginary parts)
S 2 2.2 Polar Cosine Transform and Polar Sine Rn(r)=sin(πnr ). (19) Transform Rewrite (17) with (18) and (19), Polar Cosine Transform is given by 2π 1 ∞ ∞ S 2 C C M nl =Ωn f(r, θ)sin(πnr ) f(r, θ)= M nlHnl(r, θ), (10) 0 0 . n=0 l=−∞ (cos (lθ) − i sin (lθ))rdrdθ where the coefficient is (20) 2π 1 C C∗ M =Ωn f(r, θ)H (r, θ)rdrdθ. (11) C nl nl PCT and PST are defined on unit circle. M and 0 0 nl S The basis function is given by Mnl are rotation invariant. PCT and PST need 3 C C ilθ Hnl(r, θ)=Rn (r)e , (12) trigonometric functions to generate kernel coefficient where for each point. C 2 Rn (r)=cos(πnr ), (13) 3. Fast Polar Harmonic Transforms and ⎧ Polar Harmonic Transforms provide orthogonal ⎪ 1 ⎨⎪ π if n =0 bases for representing rotation invariant patterns. Ωn = (14) ⎪ They mainly need trigonometric functions to gener- ⎩⎪ 2 π if n =0 ate the kernel coefficients. Mathematical properties Rewrite (11) with (12)-(14), of trigonometric functions can be employed to accel- 2π 1 erate the computation process. Fast PHTs are in- M C f 2 nl =Ωn (r, θ)cos(πnr ) troduced in subsection 3.1 and 3.2. The proposed 0 0 . (cos (lθ) − i sin (lθ))rdrdθ method is firstly represented on PCT and PST, and (15) then is deduced for PCET. Inspired by number the- Similarly, Polar Sine Transform is given by ory, faster PHTs are given in subsection 3.3 and fi- ∞ ∞ nally named as FPHTs. f(r, θ)= M S HS (r, θ), (16) nl nl 3.1 Fast PCT and PST n=1 l=−∞ From Polar Cosine Transform equation (15), we can where the coefficient is 2π 1 S S∗ find that for the points on the same radius r, the dif- M nl =Ωn f(r, θ)Hnl (r, θ)rdrdθ. (17) 0 0 ferent integrand part for each point is f(r, θ)(cos lθ − The basis function is given by i sin lθ). As Figure 2 shown, point (x, y)isapoint S RS ilθ Hnl(r, θ)= n(r)e , (18) in first quadrant between y = x and x axis, has other where seven symmetric points with respect to x axis, y axis,
401 The Journal of the IIEEJ vol. 39 no. 4(2010)
Similar relationships also exist for cosine function and other l values. For the eight symmetric points on the same radius r, if their PCT coefficients can be calculated simultaneously, then the computation time for trigonometric function can be reduced.
Based on foregoing discussion, fast PCT is given by C 2 2 F astM nl=Ωn cos(πn(x + y )) D , (28) (Gl(x, y) − iHl(x, y))dxdy where
D = {(x, y)|0 ≤ x ≤ 1, 0 ≤ y ≤ x, 0 ≤ x2 + y2 ≤ 1}, Fig. 2 2D space symmetric points (29) Table 1 (r,θ) and its symmetric points Polar Coordinate Cartesian Coordinate and Gl(x, y)andHl(x, y) are given in equation (30) (r,θ) (x,y) and (31). By using this equation, the whole PCT can π (r, 2 − θ )(y,x) be generated by using part of the basic functions. (r, π + θ )(-y,x) 2 Similarly, fast PST is given by (r,π − θ )(-x,y) S 2 2 F astM nl=Ωn sin(πn(x + y )) (r,π + θ )(-x,-y) D . (32) (r, 3π − θ )(-y,-x) 2 (Gl(x, y) − iHl(x, y))dxdy (r, 3π + θ )(y,-x) 2 By directly computing the PCT/PST kernel, it (r,2π − θ )(x,-y) takes 24 trigonometric functions for symmetric eight points. By using fast PCT/PST equation (28) and y = x, y = −x and origin. (32), computational complexity is reduced, only one Their polar and cartesian coordinates are shown in eighth of the trigonometric is computed. Table 1. 3.2 Fast PCET As known sin(θ)andcos(θ) functions are periodic From equation(9) we can find that for the points functions with period 2π. Periods for sin(lθ)and with the same radius r, the different integrand cos(lθ)are2π/l. Derived from the periodic and sym- part for each point is f(r, θ)(cos (2πnr2 + lθ) − metric properties of trigonometric functions that used i sin (2πnr2 + lθ)). Inspired by fast PCT and PST, in fast Fourier transform 9), there are mathematical we want to simultaneously compute symmetric eight relationships for trigonometric functions respect to points of PCET. different l. For example, if l is divided by 4 with By using mathematical property of trigonometric remainder 3 that means mod(l, 4) = 3, following re- functions, we have lationship for sine function can be deduced cos (2πnr2 + lθ)=cos(2πnr2)cos(lθ) , (33) − sin (2πnr2)sin(lθ) π sin l − θ = − cos(lθ), (21) 2 and π sin (2πnr2 + lθ)=sin(2πnr2)cos(lθ) sin l + θ = − cos(lθ), (22) . (34) 2 +cos(2πnr2)sin(lθ) sin(l(π − θ)) = sin(lθ), (23) Fast PCET is given by − 1 2 2 sin(l(π + θ)) = sin(lθ), (24) F astM nl= (cos(2πn(x + y ))Gl(x, y) π 3π − D sin l θ =cos(lθ), (25) 2 2 2 − sin(2πn(x + y ))Hl(x, y)) . 2 2 3π −i(sin(2πn(x + y ))Gl(x, y) sin l + θ =cos(lθ), (26) 2 2 2 +cos(2πn(x + y ))Hl(x, y))dxdy sin(l(2π − θ)) = − sin(lθ). (27) (35)
402 Paper : Fast Polar Harmonic Transforms ⎧ ⎪ ⎪(f(x, y)+f(y, x)+f(−y, x)+f(−x, y) ⎪ ⎪ ⎪ − − − − − − ⎪+f( x, y)+f( y, x)+f(y, x)+f(x, y)) cos(lθ)ifmod(l, 4) = 0 ⎪ ⎪ ⎪(f(x, y) − f(−x, y) − f(−x, −y)+f(x, −y)) cos(lθ) ⎪ ⎨⎪ +(f(y, x) − f(−y, x) − f(−y, −x)+f(y, −x)) sin(lθ)ifmod(l, 4) = 1 Gl(x, y)=⎪ (30) ⎪(f(x, y) − f(y, x) − f(−y, x)+f(−x, y) ⎪ ⎪ ⎪ − − − − − − − − ⎪+f( x, y) f( y, x) f(y, x)+f(x, y)) cos(lθ)ifmod(l, 4) = 2 ⎪ ⎪ ⎪(f(x, y) − f(−x, y) − f(−x, −y)+f(x, −y)) cos(lθ) ⎪ ⎩⎪ −(f(y, x) − f(−y, x) − f(−y, −x)+f(y, −x)) sin(lθ)ifmod(l, 4) = 3
⎧ ⎪ ⎪(f(x, y) − f(y, x)+f(−y, x) − f(−x, y) ⎪ ⎪ ⎪ − − − − − − − − ⎪+f( x, y) f( y, x)+f(y, x) f(x, y)) sin(lθ)ifmod(l, 4) = 0 ⎪ ⎪ ⎪(f(x, y)+f(−x, y) − f(−x, −y) − f(x, −y)) sin(lθ) ⎪ ⎨⎪ +(f(y, x)+f(−y, x) − f(−y, −x) − f(y, −x)) cos(lθ)ifmod(l, 4) = 1 Hl(x, y)=⎪ (31) ⎪(f(x, y)+f(y, x) − f(−y, x) − f(−x, y) ⎪ ⎪ ⎪ − − − − − − − − ⎪+f( x, y)+f( y, x) f(y, x) f(x, y)) sin(lθ)ifmod(l, 4) = 2 ⎪ ⎪ ⎪(f(x, y)+f(−x, y) − f(−x, −y) − f(x, −y)) sin(lθ) ⎪ ⎩⎪ −(f(y, x)+f(−y, x) − f(−y, −x) − f(y, −x)) cos(lθ)ifmod(l, 4) = 3
Direct PCET transform need 16 trigonometric They are defined 10) by functions to generate the kernel coefficients for the a⊥b, if gcd(a, b)=1. (37) eight symmetric points, but by using fast PCET Conventionally 1 is relative prime to any other posi- equation (35) , only four trigonometric functions is 11) tive integer . needed. 1⊥a, if a ∈ N. (38) 3.3 Relative Prime and FPHTs Given an N × N size image, there are two steps Foregoing proposed algorithm significantly boost needed to transform from image conventional carte- the computation speed. Whether it is possible to sian coordinate to PHTs defined normalized unit co- make PHTs much faster is an interesting question. 10) 12) ordinate. First, move the origin from left upper cor- Inspired by number theory ~ , this subsection ner of image to the center. The transform equation presents even faster PHTs that involve much more of a point P (Xp,Yp) from original coordinate to its symmetric points calculated simultaneously, and fi- corresponding centered coordinate (Xc,Yc)isgiven nally named as Fast Polar Harmonic Transforms by (FPHTs). Given two integers a and b, with at least one of CartesianT oCenter(Xp,Yp) N − 1 N − 1 these being nonzero. The largest positive integer that = Xp − , − Yp =(Xc,Yc). 2 2 divides both a,b is termed as the greatest common (39) divisor of a and b. Second, the centered coordinate is normalized to unit. gcd(a, b). (36) The transform equation from centered coordinates to Here are some examples gcd(2, 6) = 2,gcd(3, 5) = 1 normalized is and gcd(3, 8) = 1. 2Xc 2Yc CenterToUnit(Xc,Yc)= , =(x, y), Given two integers a and b, they are said to be N − 1 N − 1 relative prime if their greatest common divisor is 1. (40)
403 The Journal of the IIEEJ vol. 39 no. 4(2010)
Fig. 3 Odd and even number size image mapping in the first quadrant and its reverse transform equation is Table 2 Distribution of Relative Prime Points in Odd Number Size Image UnitToCenter (x, y) (N − 1)x (N − 1)y (41) Radius Number of Relative Prime Points Probability = , =(Xc,Yc). 2 2 1-200 9544 0.614434 For example in 21×21 size image, cartesian coordi- 201-400 28657 0.610321 nates (Xp,Yp)are(12, 9), (14, 8) and (16, 7) . Based 401-600 47746 0.609277 on equation (39), after moving origin to center of im- 601-800 66847 0.608879 age their coordinates (Xc,Yc) equal to (2, 1), (4, 2) 801-1000 85927 0.608544 and (6, 3). Based on equation (40), after normalized 1001-2000 716216 0.608383 to unit their coordinates (x, y)are(0.2, 0.1), (0.4, 0.2) 2001-3000 1193638 0.608184 and (0.6, 0.3). Figure 3 shows the first quadrant of 21 × 21 size image after mapping to unit circle. We Table 3 Distribution of Relative Prime Points in define (x, y) is a⎧ relative prime point if satisfied ⎨ Even Number Size Image Xc⊥Yc, if N is odd rpp(x, y)=⎩ . (42) Radius Number of Relative Prime Points Probability 2Xc⊥2Yc, if N is even 1-199 3186 0.818392 Given a relative prime point (x, y), for odd 201-399 9550 0.813043 number size image, the points set in same angle 401-599 15918 0.811977 can be represented by {(mx, my)|m ∈ N}, for even 601-799 22273 0.811491 number size image, they can be represented by 801-999 28655 0.811412 {((2m − 1)x, (2m − 1)y)|m ∈ N}. The relative prime 1001-1999 238738 0.811066 points distributions of odd number size image and 2001-2999 397882 0.810857 even number size image are different as shown in Fig- ure 3. When generating kernel of PHTs, no need to generate the angular part if a point is not a relative large number of points are not relative prime points, prime point. Table 2 gives a distribution of relative that means their angular part is not needed to com- prime points within a circle with different size radius. puted when generating the PHTs kernel coefficients. Table 3 gives a distribution of relative primes but Based on foregoing discussion, faster PCT is given only for odd numbers. This is useful for even number by size image. K 12) C 2 2 2 There is theoretical proof to show the probabil- F asterM nl=Ωn {cos(πnk (x + y )) k , ity of two randomly given integers A =1 1 6 (Gl(kx, ky) − iHl(kx, ky)}dxdy p(a⊥b)= = ≈ 0.607927102 ≈ 61%, (43) 2 ζ(2) π (44) where ζ(z) refers to the Riemann zeta function. From Table 2, Table 3 and equation (43), we can find that where
404 Paper : Fast Polar Harmonic Transforms
Table 4 Computation Complexity to Generate PHTs Kernel Functions PHTs DM SM RM PCET 16 4 2+2p Trigonometric PCT 24 3 1+2p PST 24 3 1+2p PCET 8 1 p Inverse Trigonometric PCT 8 1 p PST 8 1 p p=probability of relative prime points
coordinates using equation (1) and (2), and trigono- metric function is needed to compute the coefficients of PHTs. We use DM to denote direct transform PHT Fig. 4 symmetric relative prime points method (section 2), SM to denote fast PHT method 1 that using symmetric properties (subsection 3.1 and K = , (45) x2 + y2 3.2). and RM to denote the proposed FPHT method and that use relative prime points (subsection 3.3). As A = {(x, y)|0 ≤ x ≤ 1, 0 ≤ y ≤ x, , (46) a summary , computation complexities in terms of 2 2 0 ≤ x + y ≤ 1,rpp(x, y)} number of trigonometric function and inverse trigono- x is floor function that return integral part of x. metric function needed to generate kernel for sym- Given a point (x, y) that is a relative prime point, metric eight points is given in Table 4.FPHTwhich then by multiplying a factor k all the coordinates is based on RM is the fastest. (kx, ky) that are in the same angle can be obtained. 4. Experimental Results Fig 4 gives an example to compute 24 points together. Faster PST is given by The performance of the proposed fast transforms K for PCET, PCT and PST in computation reduction S 2 2 2 F asterM nl=Ωn {sin(πnk (x + y )) is validated through comparative experiments using A k=1 . various images. DM, SM and RM based transforms (Gl(kx, ky) − iHl(kx, ky))}dxdy are all evaluated. Both synthetic images and real (47) images are used in the experiments. Images with dif- Similarly faster PCET is given by ferent resolutions and contents are tested to illustrate