Skip to main content
Journal of Imaging logoLink to Journal of Imaging
. 2020 Aug 13;6(8):81. doi: 10.3390/jimaging6080081

On Computational Aspects of Krawtchouk Polynomials for High Orders

Basheera M Mahmmod 1,, Alaa M Abdul-Hadi 1,, Sadiq H Abdulhussain 1,*,†,, Aseel Hussien 2,
PMCID: PMC8321075  PMID: 34460696

Abstract

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.

Keywords: Krawtchouk polynomials, Krawtchouk moments, high order polynomials, propagation error, image reconstruction analysis

1. 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.

2. 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]:

𝓚npx=N1xN1np1pn+x×2F1n,xN+1|1p,n=0,1,2,,N1,andx=0,1,2,,N1,N>0;p(0,1), (1)

where 2F1 denotes the hypergeometric series and is defined as:

2F1n,xN+1|1p=k=0(n)k(x)k(N+1)kk!1pk, (2)

where (·)k represents the rising factorial defined as:

(a)k=Γ(a+k)Γ(a). (3)

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).

Figure 1.

Figure 1

The 2D array parameters of DKPCs.

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 x- and n-directions.

The TTRA in the n-direction is given by [11]:

p(nN)𝓚n+1px=A(Np2np+nx)𝓚npxB(1p)𝓚n1px,n=1,2,,N2,andx=0,1,,N1, (4)

where

A=(1p)(n+1)p(Nn)B=(1p)p(n+1)n(Nn)(Nn+1). (5)

In this algorithm, the polynomial coefficients are computed by employing the coefficients at the orders n1 and n2.

The TTRA in the x-direction is given by [12]:

C𝓚npx+1=D𝓚npx+E𝓚npx1,n=1,2,,N1,andx=1,2,,N/22, (6)
C=p(Nx1)(1p)(x+1),D=n+p(Nx1)+x(1p),E=x(1p)p(Nx). (7)

In this algorithm, the DKPCs are computed by considering the values of the coefficients at the indices x1 and x2.

3. 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 𝓚0p0 as the initial values. Figure 2 shows the results of the 𝓚00.5x for different values of polynomial size. From Figure 2, it is clear that when x=0, the values of 𝓚00.5x becomes very small and in several environments considered zero. On the other hand, the value of 𝓚00.5x at x=N/21 always large values.

Figure 2.

Figure 2

Plot of 𝓚00.5x for different values of polynomial size.

The proposed initial value is computed at n=0 and x=N/21. From Equation (1), the initial value can be written as follows:

𝓚00.5N21=414N/2Γ(N)NΓ(N/2)2. (8)

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:

𝓚00.5N21=expln(4)+lnΓ(N)2lnΓ(N/2)ln(N)0.5Nln(4), (9)

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.

Figure 3.

Figure 3

The plot of 𝓚00.5N21 using the proposed formula (Equations (9)) and (8).

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/21 need to be computed. The coefficient of 𝓚10.5N21 is computed as follows:

𝓚10.5N21=1N1𝓚00.5N21. (10)

Figure 4.

Figure 4

The partitions of the DKP plane.

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/21 and x=N/21,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:

𝓚n+10.5x=α1𝓚n0.5x+α2𝓚n10.5x,α1=N12x(N1n)(n+1),α2=n(Nn)(Nn1)(n+1),n=1,2,,N/21,andx=N/21. (11)

To compute the values in the range n=0,1,,N/21 and x=N/2, the following symmetry relation is utilized [13]:

𝓚n0.5N2=(1)n𝓚n0.5N21,n=1,2,,N/21. (12)

Next, the coefficients of the DKP are computed in the range n=0,1,,N/21 and x=N/2,,Nn2 (region K11 in Figure 4) using the proposed reduced form in the x-direction TTRA as follows:

𝓚n0.5x+1=β1βx+1𝓚n0.5xβxβx+1𝓚n0.5x1,β1=(N12n),βx=N(x+1)x+1. (13)

The coefficient in the range n=0,1,,N/21 and x=n,,N/21 (region K12 in Figure 4) is computed using symmetry relation [13] as follows:

𝓚n0.5x=(1)n𝓚n0.5Nx1. (14)

The coefficients in the range x=0,1,,N/21 and n=x+1,x+2,,Nx1 (region K2 in Figure 4) are computed using the following symmetry relation [13]:

𝓚n0.5x=𝓚x0.5n. (15)

The coefficients in the range x=0,1,,N1 and n=Nx1,,N1 (region K3 in Figure 4) are computed using the following symmetry relation [13]:

𝓚n0.5x=(1)Nnx1𝓚Nn10.5Nx1. (16)

The steps of the method are depicted in Figure 5 and can be summarized as follows:

  1. The Initial value 𝓚00.5N/21 is computed using Equation (9).

  2. The value of 𝓚00.5N/2 is computed from 𝓚00.5N/21 using Equation (10).

  3. The first set of initial used for TTRA is computed in the range of n=2,3,,N/21 and x=N/21 using Equation (11).

  4. The first set of initial used for TTRA is computed in the range of n=2,3,,N/21 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/21 and x=N/2,,Nn2. It should be noted that, for each x, when 𝓚n0.5x+1<107 and 𝓚n0.5x<105, 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).

Figure 5.

Figure 5

The steps used to compute DKPCs using the proposed recurrence algorithm.

4. 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.

Figure 6.

Figure 6

Computation time of the proposed and existing methods.

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]:

  1. A test image, I, is used.

  2. The test image is resized to a small size Ns×Ns,

  3. DKP, R, is generated with signal size and order of (Ns×Ns),

  4. The moment, M, is computed using M=R×I×RT,

  5. The test image is then reconstructed back from the moment domain using Ir=RT×M×R,

  6. The normalized mean square error (NMSE) is computed between I and Ir,

  7. If the NMSE<2.5×103, the size of the image and DKP is increased by 2, i.e., Ns=Ns+2 and repeat step 1 to 7.

  8. If the NMSE>2.5×103, 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:

NMSE=x,yI(x,y)Ir(x,y)2x,yI(x,y)2. (17)

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.

Figure 7.

Figure 7

Reconstruction error of the proposed and existing methods.

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]:

I(θ)=a+bsin(ωθϕ). (18)

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,and200. In the experiment, the parameters of the sinusoidal Siemens star are considered as follows a=0, b=255, ϕ=0, and ω=200.

Figure 8.

Figure 8

Sinusoidal Siemens star: (a) ω=50, (b) ω=100, (c) ω=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 Figure 9, Figure 10 and Figure 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.

Figure 9.

Figure 9

Construction analysis for the proposed method using sinusoidal Siemens start with ω=50. (a) NMSE, image reconstructed using number of moment equal to (b) 800, (c) 1600, (d) 2400, (e) 3200, (f) 4000, (g) 4800, (h) 5600, (i) 6400, and (j) 7200.

Figure 10.

Figure 10

Construction analysis for the proposed method using sinusoidal Siemens start with ω=100. (a) NMSE, image reconstructed using number of moment equal to (b) 800, (c) 1600, (d) 2400, (e) 3200, (f) 4000, (g) 4800, (h) 5600, (i) 6400, and (j) 7200.

Figure 11.

Figure 11

Construction analysis for the proposed method using sinusoidal Siemens start with ω=200. (a) NMSE, image reconstructed using number of moment equal to (b) 800, (c) 1600, (d) 2400, (e) 3200, (f) 4000, (g) 4800, (h) 5600, (i) 6400, and (j) 7200.

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.

Figure 12.

Figure 12

Construction analysis for the proposed method using Lena image. (a) NMSE, image reconstructed using number of moment equal to (b) 800, (c) 1600, (d) 2400, (e) 3200, (f) 4000, (g) 4800, (h) 5600, (i) 6400, and (j) 7200.

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.

5. 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.

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

Author Contributions

These authors contributed equally to this work. S.H.A. conceived the ideas for this article; S.H.A., B.M.M., A.M.A.-H., and A.H. had detailed discussions about the contents, structure and organization of the manuscript; S.H.A., B.M.M., and A.M.A.-H. contributed to modifications, improvements commonly, responses to the review comments and manuscript revision. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Conflicts of Interest

The authors declare no conflict of interest.

References

  • 1.Camacho-Bello C., Rivera-Lopez J.S. Some computational aspects of Tchebichef moments for higher orders. Pattern Recognit. Lett. 2018;112:332–339. doi: 10.1016/j.patrec.2018.08.020. [DOI] [Google Scholar]
  • 2.Akhmedova F., Liao S. Face recognition using discrete orthogonal hahn moments. World Acad. Sci. Eng. Technol. Int. J. Comput. Electr. Autom. Control Inf. Eng. 2015;9:1550–1556. [Google Scholar]
  • 3.Abdul-Hadi A.M., Abdulhussain S.H., Mahmmod B.M. On the computational aspects of Charlier polynomials. Cogent Eng. 2020;7:1763553. doi: 10.1080/23311916.2020.1763553. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Mahmmod B.M., bin Ramli A.R., Abdulhussain S.H., Al-Haddad S.A.R., Jassim W.A. Signal compression and enhancement using a new orthogonal-polynomial-based discrete transform. IET Signal Process. 2018;12:129–142. doi: 10.1049/iet-spr.2016.0449. [DOI] [Google Scholar]
  • 5.Idan Z.N., Abdulhussain S.H., Al-Haddad S.A.R. A New separable moments based on Tchebichef– Krawtchouk polynomials. IEEE Access. 2020;8:41013–41025. doi: 10.1109/ACCESS.2020.2977305. [DOI] [Google Scholar]
  • 6.Abdulhussain S.H., Ramli A.R., Mahmmod B.M., Saripan M.I., Al-Haddad S.A.R., Jassim W.A. A new hybrid form of Krawtchouk and Tchebichef polynomials: Design and application. J. Math. Imaging Vis. 2019;61:555–570. doi: 10.1007/s10851-018-0863-4. [DOI] [Google Scholar]
  • 7.Mahmmod B.M., Ramli A.R., Baker T., Al-Obeidat F., Abdulhussain S.H., Jassim W.A. Speech enhancement algorithm based on super-gaussian modeling and orthogonal polynomials. IEEE Access. 2019;7:103485–103504. doi: 10.1109/ACCESS.2019.2929864. [DOI] [Google Scholar]
  • 8.Abdulhussain S.H., Rahman Ramli A., Mahmmod B.M., Iqbal Saripan M., Al-Haddad S., Baker T., Flayyih W.N., Jassim W.A. A fast feature extraction algorithm for image and video processing; Proceedings of the 2019 International Joint Conference on Neural Networks (IJCNN); Budapest, Hungary. 14–19 July 2019; Piscataway, NJ, USA: IEEE; 2019. pp. 1–8. [Google Scholar]
  • 9.Abdulhussain S.H., Al-Haddad S.A.R., Saripan M.I., Mahmmod B.M., Hussien A. Fast temporal video segmentation based on Krawtchouk–Tchebichef moments. IEEE Access. 2020;8:72347–72359. doi: 10.1109/ACCESS.2020.2987870. [DOI] [Google Scholar]
  • 10.Radeaf H.S., Mahmmod B.M., Abdulhussain S.H., Al-Jumaeily D. Proceedings of the International Conference on Information and Communication Technology—CICT ’19. ACM Press; New York, NY, USA: 2019. A steganography based on orthogonal moments; pp. 147–153. [Google Scholar]
  • 11.Yap P.-T., Paramesran R., Ong S.-H. Image analysis by krawtchouk moments. IEEE Trans. Image Process. 2003;12:1367–1377. doi: 10.1109/TIP.2003.818019. [DOI] [PubMed] [Google Scholar]
  • 12.Koekoek R., Lesky P.A., Swarttouw R.F. Hypergeometric Orthogonal Polynomials and Their Q-Analogues. Springer Science & Business Media; Berlin/Heidelberg, Germany: 2010. [Google Scholar]
  • 13.Abdulhussain S.H., Ramli A.R., Al-Haddad S.A.R., Mahmmod B.M., Jassim W.A. Fast recursive computation of Krawtchouk polynomials. J. Math. Imaging Vis. 2018;60:285–303. doi: 10.1007/s10851-017-0758-9. [DOI] [Google Scholar]
  • 14.Zhu H., Liu M., Shu H., Zhang H., Luo L. General form for obtaining discrete orthogonal moments. IET Image Process. 2010;4:335. doi: 10.1049/iet-ipr.2009.0195. [DOI] [Google Scholar]
  • 15.Birch G.C., Griffin J.C. Sinusoidal Siemens star spatial frequency response measurement errors due to misidentified target centers. Opt. Eng. 2015;54:074104. doi: 10.1117/1.OE.54.7.074104. [DOI] [Google Scholar]

Articles from Journal of Imaging are provided here courtesy of Multidisciplinary Digital Publishing Institute (MDPI)

RESOURCES