On Computational Aspects of Krawtchouk Polynomials for High Orders

Discrete Krawtchouk polynomials are widely utilized in different fields for their remarkable characteristics, specifically, the localization property. Discrete orthogonal moments are utilized as a feature descriptor for images and video frames in computer vision applications. In this paper, we present a new method for computing discrete Krawtchouk polynomial coefficients swiftly and efficiently. The presented method proposes a new initial value that does not tend to be zero as the polynomial size increases. In addition, a combination of the existing recurrence relations is presented which are in the n- and x-directions. The utilized recurrence relations are developed to reduce the computational cost. The proposed method computes approximately 12.5% of the polynomial coefficients, and then symmetry relations are employed to compute the rest of the polynomial coefficients. The proposed method is evaluated against existing methods in terms of computational cost and maximum size can be generated. In addition, a reconstruction error analysis for image is performed using the proposed method for large signal sizes. The evaluation shows that the proposed method outperforms other existing methods.


Introduction
Discrete orthogonal moments, simply moments, are utilized as a feature descriptor in several fields such as signal processing and computer vision [1]. Moments, mathematically, are formed from the projection of a signal on the discrete orthogonal polynomial basis to ensure non-redundancy of the feature set [2,3]. Tchebichef, Hahn, Charlier, and Krawtchouk polynomials are types of polynomials that are used to generate discrete moments. Amongst them, Krawtchouk can express an image locally [2]. Beside, discrete Krawtchouk polynomials (DKPs) have been combined with other polynomials to enhance the performance of the resulted polynomial by adding the localization property of the DKP such as discrete Krawtchouk-Tchebichef polynomials [4], Squared Tchebichef-Krawtchouk polynomials [5], and Squared Krawtchouk-Tchebichef polynomials [6]. Krawtchouk polynomials and its hybrid forms have been utilized in different applications such as speech enhancement [7], shot boundary detection [8,9], and information hiding [10]. The DKP has a parameter (p) that controls the shifting direction of the features [11]. The parameter p at 0.5 has a special case because it equally divides the moment plane into four portions and makes the feature extraction more simple than other values of parameter p.
Many efforts have been conducted to compute the DKP coefficients (DKPCs) using three-term recurrence algorithm (TTRA). The TTRA is employed as a replacement to the hypergeometric series and gamma functions because these functions are time-consuming. Yap et al. [11] presented TTRA in the n-direction to compute DKPCs. Koekkoek et al. [12] presented the TTRA in the x-direction to generate DKPCs. However, when the image size becomes large, DKPCs shows instability because of the numerical propagation errors. The method presented in [13] shows that a reduction in the computation of recurrence times is the key to reduce the numerical error. However, the existing methods suffer from the problem of initial value which tends to be zero as the polynomial-size increases [13]. To overcome this problem, this paper proposes a new method to compute the DKPCs efficiently and swiftly. The proposed method investigated a new location to compute the initial value which is then used to compute the rest of the DKPCs. Based on the location of the initial value, a new TTRA is presented to compute the DKPCs with a reduction in the computation of polynomials coefficients.

Preliminaries
In this section, the definitions DKPs are presented as well as the recurrence relation which are employed in the proposed method. The n-th order of the weighted and normalized DKP is defined as follows [12]: . . , N − 1, and where 2 F 1 denotes the hypergeometric series and is defined as: where (·) k represents the rising factorial defined as: DKPs are generally a two-dimensional array with three parameters as shown in Figure 1, which are: (1) the size of the array N × N, (2) the polynomial order parameter (n), and (3) the polynomial index parameter (x).
The computation of the DKPCs using Equation (1) is considered computationally cost due to the usage of hypergeometric and gamma functions. Therefore, the three-term recurrence algorithm (TTRA) is employed for computing the DKPCs [14]. Two types of TTRAs are introduced: TTRAs in the xand n-directions.
The TTRA in the n-direction is given by [11]: where In this algorithm, the polynomial coefficients are computed by employing the coefficients at the orders n − 1 and n − 2. The TTRA in the x-direction is given by [12]: In this algorithm, the DKPCs are computed by considering the values of the coefficients at the indices x − 1 and x − 2.

Proposed Recurrence Algorithm
Computing the initial value is considered important and impacts the values of DKPCs. Previous algorithms failed to compute DKP for high order because the location where initial value computed goes to zero which in turn makes the rest of the values polynomial zero out. Thus, unlike the existing algorithm which considers K p 0 (0) as the initial values. Figure 2 shows the results of the K 0.5 0 (x) for different values of polynomial size. From Figure 2, it is clear that when x = 0, the values of K 0.5 0 (x) becomes very small and in several environments considered zero. On the other hand, the value of K 0.5 0 (x) at x = N/2 − 1 always large values. The proposed initial value is computed at n = 0 and x = N/2 − 1. From Equation (1), the initial value can be written as follows: The problem with Equation (8) is that the gamma function, Γ(·), produces very large numbers and produces infinity in several environments such as MATALB and python. To overcome this problem, natural logarithmic gamma function, lnΓ(·), can be utilized. Thus, Equation (8) can be written as follows: where ln(·) represents the natural logarithmic function lnΓ(·) represents the logarithmic gamma function. The maximum limit of each function is presented in Figure 3 which clearly shows that the proposed formula can compute the initial values for a wide range of polynomial size. The plane of the DKP is partitioned as shown in Figure 4. After finding a computable initial value, the value of the coefficient at n = 1 and x = N/2 − 1 need to be computed. The coefficient of K 0.5 1 N 2 − 1 is computed as follows: It is noteworthy mentioning that the plane of the DKP is partitioned as shown in Figure 4. After computing the four coefficients, the TTRA in the n-direction can be employed to compute the values in the range n = 0, 1, . . . , N/2 − 1 and x = N/2 − 1, N/2. However, a reduced form of the TTRA in the n-direction is presented and used. The reduced form of the TTRA is defined as: , To compute the values in the range n = 0, 1, . . . , N/2 − 1 and x = N/2, the following symmetry relation is utilized [13]: Next, the coefficients of the DKP are computed in the range n = 0, 1, . . . , N/2 − 1 and x = N/2, . . . , N − n − 2 (region K11 in Figure 4) using the proposed reduced form in the x-direction TTRA as follows: The coefficient in the range n = 0, 1, . . . , N/2 − 1 and x = n, . . . , N/2 − 1 (region K12 in Figure 4) is computed using symmetry relation [13] as follows: The coefficients in the range x = 0, 1, . . . , N/2 − 1 and n = x + 1, x + 2, . . . , N − x − 1 (region K2 in Figure 4) are computed using the following symmetry relation [13]: The coefficients in the range x = 0, 1, . . . , N − 1 and n = N − x − 1, . . . , N − 1 (region K3 in Figure 4) are computed using the following symmetry relation [13]: The steps of the method are depicted in Figure 5 and can be summarized as follows: 1. The Initial value K 0.5 0 (N/2 − 1) is computed using Equation (9). 2. The value of K 0.5 0 (N/2) is computed from K 0.5 0 (N/2 − 1) using Equation (10). 3. The first set of initial used for TTRA is computed in the range of n = 2, 3, . . . , N/2 − 1 and x = N/2 − 1 using Equation (11). 4. The first set of initial used for TTRA is computed in the range of n = 2, 3, . . . , N/2 − 1 and x = N/2 using Equation (12). 5. The modified recurrence algorithm, Equation (13), is used to compute the values of the coefficients in the range n = 0, 1, . . . , N/2 − 1 and x = N/2, . . . , N − n − 2. It should be noted that, for each x, when K 0.5 n (x + 1) < 10 −7 and K 0.5 n (x) < 10 −5 , the recurrence relation is terminated and n is increased by 1. 6. The rest of the DKPCs are computed using symmetry relations in Equations (14)-(16).

Performance Evaluation of the Proposed Method
A comparison with the existing methods is performed based on two criteria: computation cost and maximum generated size. A comparison of computation time is performed for different polynomials size. The existing algorithms are the TTRA in the n-direction (TTRAn) [11], TTRA in the x-direction (TTRAx) [12], and symmetry relation-based method (SRBM) [13]. The execution time is carried out using Krawtchouk parameter p = 0.5 and different DKP sizes. Figure 6 shows the execution time required for each algorithm to generate DKPCs with a size of N × N. For each method, average execution time for 10 runs is reported in Figure 6.
From Figure 6, it can be noticed that the execution times TTRAn [11] and TTRAx [12] are approximately identical because both of the algorithms are computing 50% of coefficients using the recurrence algorithm. TTRAn employs Equation (4) and TTRAx employs Equation (6). The rest of the coefficients are computed using similarity relation. For SRBM [13], only 12.5% of the coefficients are computed; thus, it shows less execution time when compared to TTRAn and TTRAx.
Obviously, in the proposed method, the average execution time to generate DKPCs is less than existing methods. This achievement is due to: (1) the proposed method computed only 12.5% of the DKPCs, and (2) a reduced complexity forms of the existing recurrence relations are introduced (Equations (11) and (13)). To affirm the results of the proposed algorithm, the improvement ratio of the execution time is measured. The improvement of the proposed algorithm to SRBM is ∼3.7%; while the improvement ratio over the TTRAn and TTRAx is ∼30%. Accordingly, it can be inferred that the proposed algorithm outperforms the existing methods in terms of the execution time. The proposed method is also evaluated in terms of maximum size can be generated and compared to that of the existing methods. For each method, the maximum size is found using the procedure presented in [13]: The test image is resized to a small size N s × N s , 3. DKP, R, is generated with signal size and order of (N s × N s ), 4. The moment, M, is computed using M = R × I × R T , 5. The test image is then reconstructed back from the moment domain using I r = R T × M × R, 6. The normalized mean square error (NMSE) is computed between I and I r , 7. If the N MSE < 2.5 × 10 −3 , the size of the image and DKP is increased by 2, i.e., N s = N s + 2 and repeat step 1 to 7. 8. If the N MSE > 2.5 × 10 −3 , the maximum size can be generated by the polynomial is reached and reported. 9. The maximum size considered in the experiment is set to 12,288. where the NMSE is computed as follows: Note that, the cameraman image is considered in the experiment as the test image. From the previous experiment, the maximum size of the TTRAn is 1090, TTRAx is 1080, SRBM is 2140, and for the proposed method is 12,288 (12K). The experiment reveals that the proposed method outperforms the existing method and the improvement factor is ∼5.7 times greater than SRBM and ∼11.3 times greater than TTRAn and TTRAx. To confirm the performance of the proposed algorithm, the reconstruction error in terms of the NMSE for all cases presented in Figure 6 are shown in Figure 7. For more clarification regarding the ability of the proposed method, a reconstruction error analysis is performed for the proposed method to test its accuracy. The reconstruction error analysis is performed using a reconstruction error Sinusoidal Siemens star which is utilized to examine the resolution of optical systems and printers. Sinusoidal Siemens star involves of sinusoidal oscillations patterns in a polar coordinate system such that the spatial frequency varies for concentric circles of different sizes. The Sinusoidal Siemens star is defined as [15]: where I represent the intensity represented by a sinusoidal function with an angle θ. In addition, a, b, ω, and φ are the intensity mean, the intensity amplitude, the number of cycles, and the phase offset, respectively. Figure 8 shows Sinusoidal Siemens star with different values of number of cycles ω which are ω = 50, 100, and 200. In the experiment, the parameters of the sinusoidal Siemens star are considered as follows a = 0, b = 255, φ = 0, and ω = 200. The reconstruction analysis using the proposed method is performed for an image with a size of 8000 × 8000. First, the image is transformed into the moment domain of the DKP. Then, the image is reconstructed using a limited number of moments. The number of moments is increased by a step of 800 until the image is fully reconstructed using the total number of moments. The obtained results are shown in Figures 9-11. From the figures, it is clear that the proposed method is able to generate a stable DKP with high order. For instance, the image reconstruction analysis shows that the NMSE closes to zero when the moment order reaches 4000 × 4000, i.e., the DKP can represent the signal using only 50% of the moments; moreover, the spokes of sinusoidal Siemens star are never touched or overlap. This led to the proposed method to compute DKP has remarkable performance and satisfy the orthogonality condition without distortion.   In addition to Sinusoidal Siemens star, the well known image of Lena is utilized for reconstruction analysis. The Lena image is resized to obtain Lena image with a size of 8000 × 8000. The same procedure for Sinusoidal Siemens is performed for Lena image. The result is shown in Figure 12. The result clearly confirm that the proposed method is able to generate a stable DKP with high order. To sum up, the proposed method is able to compute DKP accurately and satisfy the orthogonality condition without distortion for large signal size and order.

Conclusions
This paper presents a new method for efficiently computing the DKPCs. The presented method is based on the combination of the existing recurrence methods as well as a new initial value formula with values not tend to zero. The initial values and the combined recurrence methods are utilized to compute the coefficients of the DKP in a specified portion. Then, the recurrence relations are employed to compute the rest coefficients of the DKP for other portions. The results show that the proposed method has significantly less computational cost when compared to the existing methods. In addition, the proposed method has the ability to minimize the propagation errors which in turn makes it able to generate DKP with high order and size of 12,288.

Acknowledgments:
We would like express our heartfelt thanks to all of the anonymous reviewers for their efforts, valuable comments and suggestions. We would also like to acknowledge University of Baghdad for general support.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: DKP discrete Krawtchouk polynomials DKPC discrete Krawtchouk polynomial Coefficient TTRA three-term recurrence algorithm TTRAn three-term recurrence algorithm in the n-direction TTRAx three-term recurrence algorithm in the x-direction SRBM symmetry relation-based method NMSE normalized mean square error