1 Introduction

The discrete orthogonal moments (DOMs) are widely applied in various fields of signal and image analysis. Applications of DOMs include signal and image reconstruction [8, 9, 50], image classification [3, 16, 20, 39], face recognition [33], image watermarking [24, 41, 44], signal zero-watermarking [10], edge detection [35], image encryption [43], signal compression [11, 2] and image compression [13, 42]. The computation of DOMs involves the computation of kernel discrete orthogonal polynomials (DOPs) such as Tchebichef [27, 28], Krawtchouk [45, 47], Hahn [46, 50], Meixner [12, 21], Charlier [8, 19, 34], dual Hahn [20, 48], Racah [49] and Shmaliy [26] polynomials.

In general, the computation of DOPs is performed recursively either with respect to the polynomial order n or with respect to the discrete variable x. Mukundan et al. discuss in [27] that the recursive computation of high-order Tchebichef polynomials with respect to the order n is unstable because of the propagation of numerical errors. To minimize this problem, Mukundan et al. use the recursive computation of Tchebichef polynomials with respect to the variable x rather than the order n. Similarly, Zhu et al. [50] propose a general form for the recursive computation of Tchebichef, Krawtchouk, Hahn, Meixner and Charlier polynomials with respect to the variable x for minimizing the propagation of numerical errors. Although the recurrence approach with respect to the variable x minimizes the propagation of numerical errors, this approach remains limited because it is unable to generate the polynomial values of high-order polynomials [1, 9]. To overcome this problem for Tchebichef polynomials, Abdulhussain et al. [1] propose a method based on the sequential integration of the traditional recurrence relations with respect to order n and with respect to variable x that were introduced by Mukundan et al. [27]. However, this proposed method is not stable for higher order Tchebichef polynomials due to the problem of numerical errors propagation [5]. To overcome this problem, Camacho-bello et al. [5] propose the computation of higher-order Tchebichef polynomials via the modified Gram-Schmidt orthonormalization process (GSOP). This method succeeded to ensure the numerical stability of higher-order Tchebichef polynomials. More recently, GSOP method is used by Daoui et al. to introduce a numerically stable computation of Hahn [9], Charlier [8] and Meixner [12] polynomials.

Even if the problems of recursive computation of certain high-order polynomials are solved, the computation of high-order Hahn polynomials (HPs) is still limited by the following two major problems: (i) the numerical instability of the initial values, which are defined from gamma and factorial functions. (ii) The propagation of round-off error when computing high-order HPs, which leads to the loss of the orthogonality property of these polynomials. To solve the problem (i), new algorithms for HPs computation are proposed in this work. These algorithms are free from any gamma and factorial functions. To overcome the problem (ii), a new numerical stability method is proposed. This method that is based on appropriate stability conditions, is very low in terms of computational cost compared to the GSOP method that is presented in [9]. As result, the computation of high-order Hahn moments (HMs) becomes stable and fast when reconstructing large-size signals and images. It is worth mentioning that the high-order moments are required for better describe the content of the images [6, 38].

The present work also discusses some computational aspects related to Hahn’s moment invariants (HMIs) computation, with a view to overcoming the encountered problems.

Generally, the derivation process of the orthogonal moment invariants relies on the algebraic relation between the orthogonal moments and the geometric ones, to express the orthogonal moment invariants as a linear combination of geometric moment invariants. [3, 14, 18, 20, 30]. However, this process is limited by two major drawbacks: (i) the numerical instability due to gamma and factorial functions involved in the computation of the orthogonal moment invariants, and (ii) the high computational cost [3]. To overcome these problems when computing Racah moment invariants (RMIs), a fast and accurate computation method is proposed in [3]. This method is based on the use of recursive formulas of certain factors involved in RMIs computation. However, this method and others presented in [3, 17, 20, 39] are not suitable for computing the invariant moments of large-size images (≥1024 × 1024), since these methods involve the use of certain terms depending on gamma and factorial functions when computing the image moment invariants. Motivated by overcoming these problems, a fast and numerically stable computation of large-size image moment invariants is proposed in this paper. For this purpose, significant improvements are made on the conventional computation of HMIs presented in [36]. On one hand, the proposed improvements allow to compute HMIs independently of gamma and factorial functions, which guarantees the numerical stability of the computed moment invariants. On the other hand, HMIs execution time is considerably reduced by using matrix multiplications and recursive formulas. It is important to note that the fast computation of moment invariants is relevant for real-time applications [3].

The rest of this work is organized as follows: in the second section, the conventional and the proposed methods for HPs computation are presented. The third section contains the theoretical background of Hahn moments (HMs) in the 1D and 2D domains. The fourth section presents the conventional and the proposed method for HMIs computation. In the fifth section, the results of simulations and comparisons are presented to validate the efficiency of the proposed algorithms, and the final section includes some conclusions and future works.

2 Conventional and proposed computation of HPs

This section presents the conventional computation methods of HPs and introduces the proposed algorithms for fast and stable HPs computation.

2.1 Conventional computation of HPs

The HPs of order n and discrete variable x are defined as follows [46]:

$$ {h}_n^{\left(\alpha, \beta \right)}\left(x;N\right)=\frac{{\left(-1\right)}^n{\left(\beta +1\right)}_n{\left(N-n\right)}_n}{n!}{{}_3F}_2\left(\begin{array}{c}-n,-x,n+1+\alpha +\beta \\ {}\beta +1,1-N\end{array};1\right) $$
(1)

where n, x = 0, 1, …, N − 1, α >  − 1, β >  − 1, and 3F2(.) is a hyper-geometric function defined as:

$$ {{}_3F}_2\left({a}_1,{a}_2,{a}_3;{b}_1,{b}_2;z\right)=\sum \limits_{k=0}^{\infty}\frac{{\left({a}_1\right)}_{\mathrm{k}}{\left({a}_2\right)}_{\mathrm{k}}{\left({a}_3\right)}_{\mathrm{k}}{z}^k}{{\left({b}_1\right)}_{\mathrm{k}}{\left({b}_2\right)}_{\mathrm{k}}k!};{(a)}_k=a\left(a+1\right)\left(a+2\right).\dots \left(a+k-1\right) $$
(2)

Using Eqs. (1) and (2), HPs can be explicit as follows:

$$ {h}_n^{\left(\alpha, \beta \right)}\left(x;N\right)={A}_n^{\left(\beta \right)}\sum \limits_{k=0}^n{B}_{n,k}^{\left(\alpha, \beta \right)}{\left\langle x\right\rangle}_k $$
(3)

with

$$ {A}_n^{\left(\beta \right)}=\frac{{\left(-1\right)}^n{\left(\beta +1\right)}_n{\left(N-n\right)}_n}{n!} $$
(4)
$$ {B}_{n,k}^{\left(\alpha, \beta \right)}=\frac{{\left(-n\right)}_k{\left(n+\alpha +\beta +1\right)}_k}{{\left(-1\right)}^kk!{\left(\beta +1\right)}_k{\left(1-N\right)}_k} $$
(5)

According to [7], 〈xk is defined as follows:

$$ {\left\langle x\right\rangle}_k={\left(-1\right)}^k{\left(-x\right)}_k=\sum \limits_{i=0}^kS\left(k,i\right){x}^i\ \mathrm{with}\ k\ge 1\ \mathrm{and}\kern0.5em {\left\langle x\right\rangle}_0=1 $$
(6)

withS(k, i) are the Stirling numbers of the first kind, obtained by the following recurrence relation [40]:

$$ {\displaystyle \begin{array}{l}S\left(k,i\right)=S\left(k-1,i-1\right)-\left(k-1\right)S\left(k-1,i\right)\\ {}\mathrm{with}\ S\left(k,0\right)=S\left(0,i\right)=0\kern0.5em \forall k\ge 1\kern0.5em \forall i\ge 1\kern0.5em \mathrm{and}\kern0.75em S\left(0,0\right)=1\end{array}} $$
(7)

HPs satisfies the following orthogonality relation [23]:

$$ \sum \limits_{x=0}^{N-1}{h}_n^{\left(\alpha, \beta \right)}\left(x;N\right){h}_m^{\left(\alpha, \beta \right)}\left(x;N\right)\omega (x)={d}_n^2{\delta}_{nm} $$
(8)

where δnm denotes the delta of Kronecker, ω(x) is the weight function, and \( {d}_n^2 \) represents the square norm function. These functions are defined as follows [29]:

$$ \omega (x)=\frac{\Gamma \left(N+\alpha -x\right)\Gamma \left(\beta +1+x\right)}{\Gamma \left(N-x\right)\Gamma \left(x+1\right)} $$
(9)
$$ {d}_n^2=\frac{\left(\alpha +n\right)!\left(\beta +n\right)!{\left(\alpha +\beta +n+1\right)}_N}{\left(\alpha +\beta +2n+1\right)\left(N-n-1\right)!n!} $$
(10)

When the order n of HPs is high, the computation of these polynomials becomes unstable and expansive in terms of computation time because of gamma and factorial functions that define HPs (Eq. (1)) [9, 27]. To improve the computation speed and the numerical stability of high-order HPs, researchers use the recurrence relations with respect to the order n or with respect to the variable x [46, 50]. In order to derive the recurrence relations of the normalized HPs, the following form is used [46]:

$$ {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)={h}_n^{\left(\alpha, \beta \right)}(x)\sqrt{\frac{\omega (x)}{\rho (n)}} $$
(11)

The following three-term recurrence relation allows the computation of the normalized with respect to the order n [50]:

$$ {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)=\frac{\left(x-B\right)C}{A}{\tilde{h}}_{n-1}^{\left(\alpha, \beta \right)}(x)-\frac{DE}{A}\times {\tilde{h}}_{n-2}^{\left(\alpha, \beta \right)}(x) $$
(12)

Where the coefficients A, B, C, D and E are defined in Table 1.

Table 1 A, B, C, D and E coefficients of \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x) \)

The initial values of HPs with respect to the order n are computed as follows [50]:

$$ {\tilde{h}}_0^{\left(\alpha, \beta \right)}(x)=\sqrt{\frac{\omega (x)}{\rho (0)}} $$
(13)
$$ {\tilde{h}}_1^{\left(\alpha, \beta \right)}(x)=\left[-\left(\beta +1\right)\left(N-1\right)+\left(\alpha +\beta +2\right)x\right]\sqrt{\frac{\omega (x)}{\rho (1)}} $$
(14)

The recursive computation of HPs is also possible with respect to the variable x by using the following three-term recurrence formula [3]:

$$ {\displaystyle \begin{array}{l}{\tilde{h}}_n^{\left(\alpha, \beta \right)}\left(x,N\right)=\frac{1}{\sigma \left(x-1\right)+\tau \left(x-1\right)}\times \left[\begin{array}{l}\left(2\sigma \left(x-1\right)+\tau \left(x-1\right)-{\lambda}_n\right)\sqrt{\frac{\omega (x)}{\omega \left(x-1\right)}}{\tilde{h}}_n^{\left(\alpha, \beta \right)}\left(x-1,N\right)\\ {}-\sigma \left(x-1\right)\sqrt{\frac{\omega (x)}{\omega \left(x-2\right)}}{\tilde{h}}_n^{\left(\alpha, \beta \right)}\left(x-2,N\right)\end{array}\right]\\ {}\\ {}\mathrm{with}\\ {}\\ {}\sigma (x)=x\left(N+\alpha -x\right),\tau (x)=\left(\beta +1\right)\left(N-1\right)-\left(\alpha +\beta +2\right)x\kern0.5em \mathrm{and}\kern0.5em {\lambda}_n=n\left(\alpha +\beta +n+1\right)\end{array}} $$
(15)

The initial values of HPs with respect to the variable x are given by [50]:

$$ {\tilde{h}}_n^{\left(\alpha, \beta \right)}(0)={\left(1-N\right)}_n\left(\begin{array}{c}n+\beta \\ {}n\end{array}\right)\sqrt{\frac{\omega (0)}{\rho (n)}} $$
(16)
$$ {\tilde{h}}_n^{\left(\alpha, \beta \right)}(1)=\frac{\left(n+\beta +1\right)\left(N-n-1\right)-n\left(N+\alpha -1\right)}{\left(\beta +1\right)\left(N-1\right)}\times \sqrt{\frac{\omega (1)}{\omega (0)}}{\tilde{h}}_n^{\left(\alpha, \beta \right)}(0) $$
(17)

The recursive computation method of HPs provided in [46, 50] is limited by the problem of numerical instability of HPs initial values, either with respect to the order n or with respect to the variable x. This problem comes from ω(x) and ρ(n) functions, which are defined from gamma and factorial functions. Noting that Γ(172) = Inf under Matlab, Python, C++, etc. This Overflow problem leads to numerical instabilities of HPs when the values of the order n, the variable x and the parameters α and β become high. Therefore, the analysis of large-size signals and images by HPs is not possible.

To overcome the instability problem of high-order HPs, new algorithms are introduced in the next section.

2.2 Proposed computation of high-order HPs

2.2.1 HPs computation with respect to the order n

To avoid the numerical instability of the initial values \( {\tilde{h}}_0^{\left(\alpha, \beta \right)}(x) \), Eq. (13) is used to develop the following formula:

$$ {\displaystyle \begin{array}{l}{\tilde{h}}_0^{\left(\alpha, \beta \right)}(x)=\left\{\begin{array}{c}\sqrt{\frac{\left(N-x\right)\left(\beta +x\right)}{x\left(N+\alpha -x\right)}}{\tilde{h}}_0^{\left(\alpha, \beta \right)}\left(x-1\right)\kern0.5em ;\kern3.5em x>0\\ {}\sqrt{\frac{\left(\alpha +\beta +1\right)\Gamma \left(\alpha +1+\beta \right)\Gamma \left(N+\alpha \right)}{\Gamma \left(\alpha +1\right)\Gamma \left(N+\alpha +\beta +1\right)}}\kern0.75em ;\kern0.75em x=0\end{array}\right.\\ {}\end{array}} $$
(18)

To eliminate Γ(x) function from the term \( {\tilde{h}}_0^{\left(\alpha, \beta \right)}(0) \) (Eq. (18)), the following recursive formula is used:

$$ {\tilde{h}}_0^{\left(\alpha, \beta \right)}(0)={\tilde{h}}_i^{\left(\alpha, \beta \right)}=\left\{\begin{array}{c}1;\kern0.75em i=1\\ {}\sqrt{\frac{\left(i+\alpha -1\right)}{\left(i+\alpha +\beta \right)}}{\tilde{h}}_{i-1}^{\left(\alpha, \beta \right)};\kern0.5em i=2,3,\dots, N\end{array}\right. $$
(19)

Based on Eqs. (13)–(14), the expression of \( {\tilde{h}}_1^{\left(\alpha, \beta \right)}(x) \) can be expressed as follows:

$$ {\tilde{h}}_1^{\left(\alpha, \beta \right)}(x)=\left[\left(\alpha +\beta +2\right)x-\left(\beta +1\right)\left(N-1\right)\right]\sqrt{\frac{\left(\alpha +\beta +3\right)}{\left(\alpha +1\right)\left(\beta +1\right)\left(N-1\right)\left(N+\alpha +\beta +1\right)}}{\tilde{h}}_0^{\left(\alpha, \beta \right)}(x) $$
(20)

The method thus developed to compute HPs initial values via Eqs. (18)–(20) is numerically stable since it is independent from gamma and factorial functions. Algorithm 1 summarizes the main steps of the proposed method for HPs computation with respect to the order n.

Algorithm 1 Proposed algorithm for HPs computation with respect to the order n.

figure a

The following subsection includes the proposed computation of HPs with respect to the variable x.

2.2.2 HPs computation with respect to the variable x

To ensure the numerical stability of HPs initial values \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(0) \) and \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(1) \), Eqs. (16)–(17) are extended to obtain the formulas below.

$$ {\tilde{h}}_n^{\left(\alpha, \beta \right)}(0)=-\sqrt{\frac{\left(\alpha +\beta +2n+1\right)\left(\alpha +\beta +n\right)\left(N-n\right)\left(n+\beta \right)}{n\left(\alpha +n\right)\left(\alpha +\beta +N+n\right)\left(\alpha +\beta +2n-1\right)}}{\tilde{h}}_{n-1}^{\left(\alpha, \beta \right)}(0) $$
(21)

with \( {\tilde{h}}_0^{\left(\alpha, \beta \right)}(0) \) is given by Eq. (18).

$$ {\tilde{h}}_n^{\left(\alpha, \beta \right)}(1)=\left(\left(n+\beta +1\right)\left(N-n-1\right)-n\left(N+\alpha -1\right)\right)\sqrt{\frac{1}{\left(\beta +1\right)\left(N-1\right)\left(N+\alpha -1\right)}}{\tilde{h}}_n^{\left(\alpha, \beta \right)}(0) $$
(22)

For x > 1, the numerical stability of \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x) \) is achieved by eliminating ω(x)function from Eq. (15) as follows:

$$ {\displaystyle \begin{array}{l}{\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)=A\times {\tilde{h}}_n^{\left(\alpha, \beta \right)}\left(x-1\right)+B\times {\tilde{h}}_n^{\left(\alpha, \beta \right)}\left(x-2\right)\\ {}A=\frac{2\left(x-1\right)\left(N+\alpha -x+1\right)+\left(\beta +1\right)\left(N-1\right)-\left(\alpha +\beta +2\right)\left(x-1\right)-n\left(\alpha +\beta +n+1\right)}{\left(x-1\right)\left(N+\alpha -x+1\right)+\left(\beta +1\right)\left(N-1\right)-\left(\alpha +\beta +2\right)\left(x-1\right)}\sqrt{\frac{\left(\beta +x\right)\left(N-x\right)}{\left(N+\alpha -x\right)x}}\\ {}B=-\frac{\left(x-1\right)\left(N+\alpha -x+1\right)}{\left(x-1\right)\left(N+\alpha -x+1\right)+\left(\beta +1\right)\left(N-1\right)-\left(\alpha +\beta +2\right)\left(x-1\right)}\sqrt{\frac{\left(\beta +x\right)\left(N-x\right)}{\left(N+\alpha -x\right)x}\frac{\left(\beta +x-1\right)\left(N-x+1\right)}{\left(N+\alpha -x+1\right)\left(x-1\right)}}\end{array}} $$
(23)

The fundamental steps used for HPs computation with respect to the variable x are presented in algorithm 2.

Algorithm 2 Proposed algorithm for HPs computation with respect to the variable x.

figure b

It is important to mention that the computation of HPs initial values by Eqs. (20)–(21) presents the Underflow problem for high values of the order n. Indeed, Table 2 illustrates an example of this problem.

Table 2 \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(0) \) values for N = 4000, α = β = 100, n = 0:2559 and x = 0

From Table 2 it can be seen that the values of \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(0) \) become zero (Underflow) when n > 2558. This problem limits the recursive computation of high-order HPs. To overcome this problem, new method is proposed (Fig. 1) for stable computation of high-order HPs with respect to the variable x. The details of this method are described in algorithm 3. Noting the proposed method is inspired from the method presented in [1], which is used for stable computation of high-order Tchebichef polynomials.

Fig. 1
figure 1

Steps of the proposed method for HPs computation with respect to the variable x

Algorithm 3 Proposed Algorithm for HPs computation with respect to the variable x.

figure c

Since the computation of HPs using the proposed algorithms is recursive, this leads to the appearance and propagation of rounding error. This problem is discussed by Camacho-bello et al. in [5] when computing high-order Tchebichef polynomials. To overcome the encountered problem for Tchebichef, Meixner and Hahn polynomials, the modified Gram-Schmidt orthonormalization process (GSOP) is used [5, 8, 9, 12]. However, the correction of numerical instability by GSOP is very time-consuming because GSOP involves a complex calculation process [5, 12]. This problem limits the fast reconstruction of large-size signals and images by high-order HPs. Indeed, Table 3 shows a comparison in terms of execution time in second (s) by using algorithm 1, and GSOP method presented in [9]. The computation of HPs by these methods is performed 100 times, and then the average execution time is computed and illustrated in Table 3. It is worth mentioning that all paper tests are carried out under Matlab R2019a installed on PC of 2.4 GHz processor and 4 GB of RAM.

Table 3 Comparison of HPs execution time for n, x = 0 :512 using Algorithm 1 and GSOP method [9]

The results presented in Table 3 and 4 clearly indicate that the GSOP method significantly increases the computation time of HPs compared to the proposed methods (algorithms 1 and 3). This is why a new numerical stability method is introduced in the following section.

Table 4 The execution time of HPs (with n, x = 0 : 2000 and α = β = 50) by using Algorithm 3 (with the stability condition), and by GSOP method [9]

2.3 Proposed method for ensuring the numerical stability of higher-order HPs

The proposed method is based on a numerical analysis of the polynomial values in HPs matrix. Indeed, Fig. 2 present 2D plot of HPs matrix computed by algorithm 1 for n, x = 0 : 512, α = 5, β = 180. This matrix is displayed in two parts: the first one that is shown in Fig. 2 (a) displays HPs values that are belong to the orthonormalization domain (\( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)\in \left[-1,1\right] \))), while the second part displayed in Fig. 2 (b) shows the unstable values (\( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)\notin \left[-1,1\right] \)), and Fig. 2 (c) shows HPs matrix computed by GSOP method [9].

Fig. 2
figure 2

2D plot of HPs matrix computed by Algorithm 1 with (a) \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)\in \left[-1,1\right] \), (b) \( {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)\notin \left[-1,1\right] \), and (c) HPs matrix computed by GSOP method [9] for n, x = 0 : 512. and α = 5, β = 180

From Fig.1 (b), it is noticeable that the unstable values of HPs appear when n → N (high polynomial order). These values are positioned in the blue colored regions called “instability regions”. After using GSOP method (Fig. 2 (c)), one can observe that the previously observed instable values become extremely low and tend towards zero. Indeed, Fig.3 shows the intervals of HPs values computed by GSOP method when n → N.

Fig. 3
figure 3

The numerical behavior of HPs values computed by GSOP for n, x → 500 and α = 5, β = 180

From Fig. 3, it can be noticed that the values of \( \left|{\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)\right| \) gradually decrease and tend towards zero when n → N. Therefore, it can be concluded that the numerical instability occurs only when HPs values become very low and toward to zero (\( \left|{\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)\right|\le {10}^{-7} \)). According to the conducted numerical analysis, appropriate “stability conditions” are introduced during the recursive computation of HPs to ensure the numerical stability of these polynomials. Indeed, the following stability condition is inserted after the three-term recurrence relation of HPs with respect to the order n.

$$ {\hat{h}}_n^{\left(\alpha, \beta \right)}(x)=\left\{\begin{array}{c}0\kern0.75em if\kern0.75em \left(\left|{{\tilde{h}}_{n-1}}^{\left(\alpha, \beta \right)}(x)\right|<{10}^{-7}\right)\&\left(\left|{{\tilde{h}}_n}^{\left(\alpha, \beta \right)}(x)\right|>\left|{{\tilde{h}}_{n-1}}^{\left(\alpha, \beta \right)}(x)\right|\right)\\ {}{{\tilde{h}}_n}^{\left(\alpha, \beta \right)}(x)\kern0.5em \mathrm{with}\kern0.5em n>{N}_{\mathrm{max}}/8\ \mathrm{and}\ x=0,1,2,\dots, N-1\kern0.75em \end{array}\right. $$
(24)

Note that this condition is activated from the order n = Nmax/8 (lower order) where Nmax is the maximum order of HPs, this ensures that all unstable values are detected and eliminated (replaced by zero).

The following stability condition is implemented after the computation of each HPs value using the three-term recurrence relation with respect to the variable x:

$$ {\hat{h}}_n^{\left(\alpha, \beta \right)}(x)=\left\{\begin{array}{c}0\kern0.75em if\kern0.75em \left(\left|{{\tilde{h}}_n}^{\left(\alpha, \beta \right)}\left(x-1\right)\right|<{10}^{-7}\right)\&\left(\left|{{\tilde{h}}_n}^{\left(\alpha, \beta \right)}(x)\right|>\left|{{\tilde{h}}_n}^{\left(\alpha, \beta \right)}\left(x-1\right)\right|\right)\\ {}{{\tilde{h}}_n}^{\left(\alpha, \beta \right)}(x)\kern0.5em \mathrm{with}\ x>N/8\ \mathrm{and}\ n=0,1,\dots, N-1\kern0.75em \end{array}\right. $$
(25)

To evaluate the performance of the proposed Algorithms that including the stability conditions, HPs are computed by these Algorithms up to the order n = 8000 with x = 0 : 8000 and α = β = 50. Fig. 4 shows 2D plot of HPs matrices computed by Algorithms 1 and 3. The obtained results show that the computed HPs are stable since the polynomial values belong to the orthonormality domain [−1, 1], which justifies the efficiency of the proposed Algorithms for the stable computation of high-order HPs.

Fig. 4
figure 4

(a)-(b) 2D plots of of HPs matrices computed successively by Algorithms 1 and 3 including the stability conditions with n, x = 0 : 8000 and α = β = 50.

The following test presents a comparison in terms of execution time using the proposed method (algorithm 3) and the GSOP method presented in [9]. The execution time improvement ratio (ETIR (%)) defined by ETIR (%) = (1 − T 1/T 2) × 100 [23] is used as a comparison criterion, where T 1 is the execution time consumed by the proposed method, and T 2 represents the execution time consumed by GSOP method [9]. The obtained results which are displayed in Table 4 demonstrate that.

Table 5 The average time for computing HMIs by using the proposed method (algorithm 5), and the conventional one (algorithm 4)

the proposed method (algorithm 3 with the stability condition) is very fast compared to the GSOP method since ETIR ≥ 99%. This is especially true when the polynomial order n is high.

It is worth mentioning that the computation time of HPs is significantly reduced when using the following HPs symmetry relation defined for α = β [29]:

$$ {\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)={\left(-1\right)}^n{\tilde{h}}_n^{\left(\alpha, \beta \right)}\left(\mathrm{N}-1-x\right) $$
(26)

It is also important to note that Krawtchouk (KPs) and Tchebichef (TPs) polynomials are special cases of HPs. Indeed, KPs (\( {\tilde{k_n}}^{(p)}(x) \)) are obtained from HPs when α = pt and β = (1 − p)t with t → ∞ [29]. In the case α = β = 0, HPs are reduced to TPs (\( \tilde{t_n}(x) \)) [22].

In the following sections, HPs will be used as kernel polynomials to define both Hahn moments (HMs) and Hahn moment invariants (HMIs) designed for large-size signal and image analysis.

3 Hahn moments

This section briefly presents the theoretical background of Hahn moments (HMs) in the 1D and 2D domains.

The 1D HMs of order n are defined for a 1D-signal function f(x) by the following relation:

$$ {HM}_n=\sum \limits_{x=0}^{N-1}{\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)f(x)={P}_n^T\times f\kern0.5em \mathrm{with}\kern0.75em \mathrm{with}\kern0.5em {P}_n={\left[{\tilde{h}}_0^{\left(\alpha, \beta \right)}(x),{\tilde{h}}_1^{\left(\alpha, \beta \right)}(x),\dots, {\tilde{h}}_{N-1}^{\left(\alpha, \beta \right)}(x)\right]}^T $$
(27)

The reconstructed signal \( \hat{f}(x) \) is computed from the 1D HMs as follows:

$$ \hat{f}(x)=\sum \limits_{x=0}^{N-1}{H}_n{\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)={P}_n\times {HM}_n $$
(28)

The reconstruction error can be measured by the Mean Square Error (MSE) criterion, which is defined as follows:

$$ MSE=\frac{1}{N}\times \sum \limits_{x=0}^{N-1}{\left(f(x)-\hat{f}(x)\right)}^2 $$
(29)

where f(x) is the original signal, and \( \hat{f}(x) \) represents the reconstructed one.

For a digital image f(x, y) of size N × M, the 2D HMs are defined by [50]:

$$ {HM}_{nm}=\sum \limits_{x=0}^{N-1}\sum \limits_{y=0}^{M-1}f\left(x,y\right){\tilde{h}}_n^{\left(\alpha, \beta \right)}(x){\tilde{h}}_m^{\left(\alpha, \beta \right)}(y) $$
(30)

with n, m = 0, 1, 2, …, N − 1, x ∈ [0…N − 1], and y ∈ [0…M − 1],.

The computation time of HMs is considerably reduced by using the following matrix formula [3]:

$$ {HM}_{nm}={H_n}^T\times {f}_{xy}\times {H}_m $$
(31)

where \( {f}_{xy}={\left\{f\left(x,y\right)\right\}}_{x,y=0}^{x=N-1,y=M-1} \) denotes the image function with \( {H}_n^T \) and Hm are HPs matrices defined by: \( {H}_n^T={\left[{\left\{{\tilde{h}}_n^{\left(\alpha, \beta \right)}(x)\right\}}_{n,x=0}^{x=N-1,y=N-1}\right]}^T \), \( {H}_m={\left\{{\tilde{h}}_m^{\left(\alpha, \beta \right)}(x)\right\}}_{m,y=0}^{m=M-1,y=M-1} \).

The inverse transformation of 2D HMs allows to obtain the reconstructed image via the following formula [3]:

$$ \hat{f}\left(x,y\right)=\sum \limits_{x=0}^{N-1}\sum \limits_{y=0}^{N-1}{\tilde{h}}_n^{\left(\alpha, \beta \right)}(x){\tilde{h}}_m^{\left(\alpha, \beta \right)}(y){HM}_{mn} $$
(32)

The matrix formulation of the inverse 2D HMs is given by:

$$ {\hat{f}}_{xy}={H}_n\times {HM}_{nm}\times {H}_m^T $$
(33)

where \( {\hat{f}}_{xy}={\left\{\hat{f}\left(x,y\right)\right\}}_{x,y=0}^{x=N-1,y=M-1} \) is the reconstructed image of size N × M.

In order to quantify the reconstruction error by HMs, the MSE criterion is used as follows:

$$ MSE=\frac{1}{N\times M}\sum \limits_{x=0}^{N-1}\sum \limits_{y=0}^{M-1}{\left(f\left(x,y\right)-\hat{f}\Big(x,y\Big)\right)}^2\kern0.24em $$
(34)

The Peak Signal-to-Noise Ratio (PSNR) criterion in decibels (dB) is also used to quantify the reconstruction error. This criterion is defined from MSE as:

$$ PSNR=10{\log}_{10}\left(\frac{peak^2}{MSE}\right) $$
(35)

where peak is the maximum value of the 2D image function.

4 Hahn moment invariants

This section presents both the conventional and the proposed method for deriving Hahn moment invariants (HMIs) from geometric moment invariants (GMIs).

4.1 The conventional computation of HMIs

The following relation is used to compute the geometric moments (GMs) of f (x, y) image of size N × M [14]:

$$ {GM}_{nm}=\sum \limits_{n=0}^{N-1}\sum \limits_{m=0}^{M-1}{x}^n{y}^mf\left(x,y\right)\kern0.5em $$
(36)

The central geometric moments denoted μnm are derived from GMs by the following formula [35]:

$$ {\mu}_{nm}=\sum \limits_{n=0}^{N-1}\sum \limits_{m=0}^{M-1}{\left(x-\overline{x}\right)}^n{\left(y-\overline{y}\right)}^mf\left(x,y\right)\kern0.5em \mathrm{with}\kern1em \overline{x}=\frac{GM_{10}}{GM_{00}}\kern0.5em \mathrm{and}\kern0.5em \overline{y}=\frac{GM_{01}}{GM_{00}} $$
(37)

The set of geometric moment invariants (GMIs) of order (n, m), denoted Vnm, which are independent of translation, scaling and rotation are defined by the following relation [35]:

$$ {V}_{nm}={GM_{00}}^{-\gamma}\sum \limits_{i=0}^n\sum \limits_{j=0}^m\sum \limits_{x=0}^{N-1}\sum \limits_{y=0}^{M-1}\left\{\begin{array}{c}{\left[\left(x-\overline{x}\right)\cos \theta +\left(y-\overline{y}\right)\sin \theta \right]}^i\\ {}\times {\left[\left(y-\overline{y}\right)\cos \theta -\left(x-\overline{x}\right)\sin \theta \right]}^j\end{array}\right\}f\left(x,y\right)\kern0.5em $$
(38)

where \( \gamma =\frac{n+m}{2}+1 \) and \( \theta =\frac{1}{2}{\tan}^{-1}\left(\frac{2{\mu}_{11}}{\mu_{20}-{\mu}_{02}}\right) \).

In accordance with Eq. (39), the values of the angle θ are limited to −π/4 ≤ θ ≤ π/4. For angle values in different ranges, the article [40] is recommended.

HMs given by Eq. (31) can be expressed in terms of HPs (Eq. (3)) as follows [36]:

$$ {HM}_{nm}=\frac{A_n^{\left(\alpha, \beta \right)}{A}_m^{\left(\alpha, \beta \right)}}{\sqrt{d_n^2{d}_m^2}}\sum \limits_{x=0}^{N-1}\sum \limits_{y=0}^{M-1}{h}_n^{\left(\alpha, \beta \right)}(x){h}_m^{\left(\alpha, \beta \right)}(y)\tilde{f}\left(x,y\right) $$
(39)

where \( \tilde{f}\left(x,y\right)=\sqrt{\omega (x)\omega (y)}f\left(x,y\right) \) is the normalized image.

Based on Eqs. (3), (30) and (39), HMs can be expressed in terms of GMs as follows [36]:

$$ {HM}_{nm}=\frac{A_n^{\left(\beta \right)}{A}_m^{\left(\beta \right)}}{\sqrt{d_n^2{d}_m^2}}\sum \limits_{j=0}^m\sum \limits_{i=0}^n{B}_{mj}^{\left(\alpha, \beta \right)}{B}_{ni}^{\left(\alpha, \beta \right)}\sum \limits_{l=0}^j\sum \limits_{k=0}^iS\left(j,l\right)S\left(i,k\right){GM}_{kl} $$
(40)

The substitution of GMnm by Vnm allows to derive HMIs as follows [36]:

$$ {HMI}_{nm}=\frac{A_n^{\left(\alpha, \beta \right)}{A}_m^{\left(\alpha, \beta \right)}}{\sqrt{d_n^2{d}_m^2}}\sum \limits_{j=0}^m\sum \limits_{i=0}^n{B}_{mj}^{\left(\alpha, \beta \right)}{B}_{ni}^{\left(\alpha, \beta \right)}\times \sum \limits_{l=0}^j\sum \limits_{k=0}^iS\left(j,l\right)S\left(i,k\right){V}_{kl} $$
(41)

Algorithm 4 summarizes the conventional steps of the HMIs derivation process.

Algorithm 4 The conventional method for HMIs computation [36].

figure d

The conventional computation of HMIs via algorithm 4 is numerically instable because of \( {A}_n^{\left(\beta \right)} \), \( {B}_{nk}^{\left(\alpha, \beta \right)} \), ω(x) and \( {d}_n^2 \) functions as they are defined in terms of gamma and factorial functions. In addition, this conventional computation is time-consuming due to the use of several discrete summations. These problems limit the computation of HMIs especially for large-size images. There is therefore a clear need for a considerable improvement in HMIs computation in terms of rapidity and numerical stability.

4.2 Proposed computation of HMIs

In this section, the proposed method for fast and stable computation of HMIs is presented. This method is mainly based on the use of matrix and recursive formulas.

In order to significantly accelerate the computation of GMs, the following matrix formulation can be used:

\( {GM}_{nm}=X.F.{Y}^T\kern0.5em \mathrm{with}\kern0.75em X={\left\{{x}^n\right\}}_{x,n=0}^{x,n=N-1},\kern0.5em Y={\left\{{y}^m\right\}}_{y,m=0}^{y,m=M-1} \) and \( F={\left\{f\left(x,y\right)\right\}}_{x,y=0}^{x=N-1,y=M-1} \) (42)

The computation time of μnm can also be reduced through the use of the following formula:

$$ {\mu}_{nm}=\overline{X}.F.{\overline{Y}}^T\kern0.75em \mathrm{with}\kern0.5em \overline{X}={\left\{{\left(x-\overline{x}\right)}^n\right\}}_{x=0,n=0}^{x=N-1,n=N-1}\ \mathrm{and}\kern0.75em \overline{Y}={\left\{{\left(y-\overline{y}\right)}^m\right\}}_{y=0,m=0}^{x=M-1,m=M-1} $$
(43)

In a similar way, the computation of Vnm is speed up by using the following formulation:

$$ {V}_{nm}={GM_{00}}^{-\gamma}\sum \limits_{i=0}^n\sum \limits_{j=0}^m\left({A}^i\odot {B}^j\right)\odot F\kern0.5em $$
(44)

with \( A=\left(x-\overline{x}\right)\cos \theta +\left(y-\overline{y}\right)\sin \theta \), \( B=\left(y-\overline{y}\right)\cos \theta -\left(x-\overline{x}\right)\sin \theta \), F = f(x, y),x = 1 : N, y = 1 : M, \( \overline{x}=\frac{GM_{10}}{GM_{00}} \), \( \overline{y}=\frac{GM_{01}}{GM_{00}} \) and the symbol ⊙ denotes the Hadamard product [4].

The following recursive relations are developed to accelerate and stabilize the computation of HMIs. Indeed, ω(x) is computed as follows:

$$ \omega (x)=\left\{\begin{array}{c}\ {e}^{\log \Gamma \left(N+\alpha \right)+\log \Gamma \left(\beta +1\right)-\log \Gamma (N)}\kern4.25em x=0\\ {}\frac{\left(\beta +x\right)\left(N-x\right)}{x\left(N+\alpha -x\right)}\omega \left(x-1\right)\kern4.75em x=1,2,\dots, N-1\end{array}\right. $$
(45)

where logΓ(x) is the logarithmic gamma function [15]. This function is numerically stable for high values of the argument x. For example, logΓ(105) = 1.0513e + 06 under Matlab.

The stable recursive computation of \( {d}_n^2 \) function is given by:

$$ {d}_n^2=\left\{\begin{array}{c}\frac{1}{\left(\alpha +\beta +1\right)}{e}^{\log \Gamma \left(\alpha +1\right)+\log \Gamma \left(\beta +1\right)+\log \Gamma \left(\alpha +\beta +N+1\right)-\log \Gamma (N)-\log \Gamma \left(\alpha +\beta +1\right)}\kern5em n=0\\ {}\frac{\left(\alpha +n\right)\left(\beta +n\right)\left(\alpha +\beta +n+N\right)\left(N-n\right)\left(\alpha +\beta +2n-1\right)}{n\left(\alpha +\beta +2n+1\right)\left(\alpha +\beta +n\right)}{d}_{n-1}^2\kern3.75em n=1,2,\dots, N-1\end{array}\right. $$
(46)

The fast and stable computation of \( {A}_n^{\left(\beta \right)} \) and \( {B}_{nk}^{\left(\alpha, \beta \right)} \) functions is defined as follows

$$ {A}_n^{\left(\beta \right)}=\left\{\begin{array}{c}1\kern11.75em n=0\\ {}-\frac{\left(\beta +n\right)\left(N-n\right)}{n}\ {A}_{n-1}^{\left(\beta \right)}\kern4em n=1,\dots, N-1\end{array}\right. $$
(47)
$$ {B}_{nk}^{\left(\alpha, \beta \right)}=\left\{\begin{array}{c}1\kern14.25em k=0\\ {}-\frac{\left(n+\alpha +\beta +k\right)\left(n-k+1\right)}{\left(\beta +k\right)\left(N-k\right)k}\ {B}_{n\left(k-1\right)}^{\left(\alpha, \beta \right)}\kern1.5em k=1,2,\dots, n\end{array}\right. $$
(48)

The summary of the proposed method for fast and stable computation of HMIs is presented in algorithm 5.

Algorithm 5 The proposed method for fast and stable HMIs computation.

figure e

5 Experimental results and discussion

This section presents the simulation outcomes and the performed comparisons that validate the efficiency of the proposed algorithms in the field of large-size signal and image analysis. Initially, the numerical stability of the proposed algorithms for higher-order HPs computation is demonstrated through the reconstruction of large-size signals and images up to the last moment order. Then, the speed and numerical stability of the proposed method for HMIs computation is proved via the extraction of HMIs from large-size medical images.

5.1 Large-size signal reconstruction by higher-order HMs

In the first test, the efficiency of the proposed computation of high-order HPs with respect to the order n is demonstrated. For this purpose, HPs are computed by algorithm 1 for n, x = 0 : 8000 with α = β = 100. Noting that the parameter values are selected empirically following the study carried out in [9]. This study shows that the parameters selection case α = β allows obtaining a minimal reconstruction error (MSE) in comparison to other cases (α ≠ β). Then, an “ECG” signal of size N = 8000 is selected from the database [25], and reconstructed by HMs up to the last moment order (n = 8000). Figure 5 shows a set of reconstructed “ECG” signals with the corresponding MSE values. On one hand, the obtained results indicate that the MSE values decrease proportionally with the increase in HMs order until the last moment order. On the other hand, it is noted that the lower MSE value is reached at the last HMs order. These results prove the numerical stability of the proposed algorithm 1, and confirm the importance of high-order HMs in terms of precise signal reconstruction.

Fig. 5
figure 5

Set of reconstructed ECG signals by HMs up to the order 8000 with the corresponding MSE values

To further validate the efficiency of algorithm 1, five bio-signals of size N = 8000 (Fig. 6) are reconstructed by HMs (with HPs are computed by algorithm 1 for α = β = 100). For comparison purposes, the test signal are also reconstructed by Tchebichef moments (TMs) [5]. Next, the average PSNR values corresponding to the reconstructed signals by both moment types are displayed in Fig. 7.

Fig. 6
figure 6

Set of bio-signals selected from the database [25] that are used in the test

Fig. 7
figure 7

Average of the PSNR values corresponding to the reconstructed bio-signals by HMs and TMs [5]

The PSNR values shown in Fig. 7 increase up to the last moment order, reflecting the efficiency and numerical stability of both TMs and HMs for the reconstruction of large-size signals. One should mention that the numerical stability of TMs is ensured via GSOP [5]. Whereas HMs numerical stability is provided by using the proposed method (stability condition). This makes HMs significantly faster to compute compared to TMs.

5.2 Large-size image reconstruction by higher-order HMs

In this section, the performance of the proposed method for the computation of high-order HPs with respect to the variable x (algorithm 3) is illustrated. In the first test, the “PIA21906” test image of size 4000 × 4000 is selected from the database [31], and then reconstructed by HMs up to the last order (4000, 4000). Noting that the used HPs parameters values in all reconstruction tests of this section are α = β = 50. Figure 8 shows a set of the reconstructed “PIA21906” images with the corresponding MSE and PSNR values. From this figure, it is noticeable that the visual similarity between the reconstructed image and the original one gradually improves until the last moment order (4000, 4000). It can also be noted that the best quality of the reconstructed image (lower MSE) is obtained at the last moment order. This is a clear indication on the efficiency of the proposed algorithm 3 for the stable reconstruction of large-sized images.

Fig. 8
figure 8

Set of reconstructed “PIA21906” images by HMs up to the order (4000, 4000) with MSE and PSNR values

The second test presents a comparison in terms of reconstruction errors (MSE and PSNR) by using the moments of Tchebichef (TMs) [5], Krawtchouk (KMs) [47], Meixner (MMs) [12], Charlier (CMs) [12] and HMs (based on algorithm 3). Indeed, Fig. 9 shows the reconstructed “Lena” image by the aforementioned moments, and Fig. 11 shows the average MSE and PSNR values corresponding to the reconstructed test images shown in Fig. 10. The achieved results show on one hand that all the used moment types are stable because they allow the reconstruction of the test images until the last moment order (1024, 1024). On the other hand, it is apparent that the quality of the reconstructed images using high-order KMs is better (high PSNR) compared to other moments type, including HMs. However, KMs are unstable when the moment orders exceed (1075, 1075) [8]. For this reason, only images of size 1024 × 1024 are used in this test. Moreover, HMs are more general than TMs and KMs because the latter are special cases of HMs [22].

Fig. 9
figure 9

Set of reconstructed “Lena” image by different moment types of order up to (1024, 1024)

Fig. 10
figure 10

Standard color images of size 1024 × 1024 used in the test

Fig. 11
figure 11

The average of MSE and PSNR corresponding to the five reconstructed color images by different moment types

Fig. 12
figure 12

(a): The original medical image. (b) and (c) the contaminated images by “Salt & pepper” and “Speckle” noise successively (with density of 5%)

Fig. 13
figure 13

PSNR corresponding to the reconstructed «Boxer-fracture “image with and without noise

Fig. 14
figure 14

(a) “Covid 19” test image, (b), (c) and (d): geometrically transformed test image

Fig. 15
figure 15

Relative errors (RE) corresponding to “Covid 19” image transformed by (a): translation, (b): rotation, and (c): scaling

Fig. 16
figure 16

Set of real medical images of size 2048 × 2048 used in the test

Fig. 17
figure 17

Average of the REs corresponding to test images geometrically transformed by (a) rotation, (b) translation and (c) scaling

In the following test, the robustness of HMs against different types of noise is evaluated. For this purpose, a real medical image named “Boxer-fracture” of size 2048 × 2048 is selected from the database [32]. This image is contaminated by two noise types namely “Salt & pepper” and “Speckle” noise with density of 5% (Fig. 12). Then, these images are reconstructed by HMs, and the reconstruction error (PSNR) is displayed in Fig. 13. The achieved results show a slight decrease in the quality of the noisy reconstructed images compared to the quality of the noise-free reconstructed one, which validates the robustness of HMs in noisy conditions.

5.3 Fast and numerically stable computation of HMIs using large-size images

This section is preserved to demonstrate the effectiveness of the proposed method for fast and stable HMIs computation (algorithm 5).

The computation of HMIs via the proposed method depends on HPs local parameters (α and β). Therefore, the optimal selection of these parameters is crucial when computing HMIs. In order to carry out this selection, one can use an empirical method, which is similar to the one described in [3]. Indeed, HMIs of a test image are computed for specific values of α and βparameters, then the test image is geometrically transformed by translation, rotation and scaling. Next, the relative error (RE) (Eq. (49)) is computed for each parameters case. Finally, the values of α and β that allow to obtain the lower RE values are therefore considered as the optimal parameters selection.

The RE criterion is defined as:

$$ RE=\frac{\left\Vert V-V\ast \right\Vert }{\left\Vert V\right\Vert } $$
(49)

where ‖.‖ denotes the Euclidean norm, Vdenotes the invariant moments of the original image, and V∗ represents the invariant moments of the geometrically transformed image.

To test the effectiveness of the empirical parameters selection method, one use a real X-ray medical image named “Covid 19” of size 2048 × 2048 (Fig. 14) that is selected from [32]. The test image is then translated by a vector varies from (−20, −20) to (+20, +20) with a step of (+4, +4), scaled by a factor scaling ranging from 0.5 to 2 with a step of 0.1, and rotated by a rotation angles ranging from 0° to 360° with a step of 10°. Then, HMIs of the original image and the geometrically transformed one are computed up to the order (5, 5) for four cases of α and βparameters: (A) α = 15 and β = 10, (B) α = β = 10, (C) and α = β = 5, and (D) α = β = 0.

The results of the performed test are presented in Fig. 15. From this figure, it can be noted that the cse α = β = 0 leads to lower RE values, therefore this case will be considered as the optimal parameters selection in the rest of this work. However, the use of the empirical method for the optimal parameters selection is limited due to the few number of the studied cases. It is important to note that the optimal selection of local parameters can be made via population-based algorithms such as the Sine Cosine Algorithm (SCA) [10] or by similar algorithms (PSO, ABC, TLBO…).

In the following test, four grayscale medical images of size 2048 × 2048 are used (Fig. 16). These images that are selected from the database [32], are geometrically transformed, and then the corresponding average RE is displayed in Fig. 17. The outcome results indicate on one hand that the proposed computation of HMIs is stable for large-size images. On the other hand, the low RE values (RE ≃ 10−10) indicate that the computed HMIs are highly accurate and robust against different geometrical transformations.

The following test is conducted to prove the fastness of the proposed HMIs computation method compared to the conventional one that is presented in [36]. Initially, the test image “Covid-19” is resized to 60 × 60, then HMIs are computed up to the order (20, 20) by using both methods. Noting that resizing the test image is undertaken since the conventional computation of HMIs is numerically unstable for images of size larger than 61 × 61 due to gamma and factorial functions that define the terms \( {A}_n^{\left(\alpha, \beta \right)} \) and \( {B}_{mk}^{\left(\alpha, \beta \right)} \). The time required to compute HMIs by both methods is computed 20 times, and then the average time is presented in Table 4.

The obtained results in Table 4 clearly demonstrate the considerable rapidity of the proposed method compared to the conventional one, especially for higher HMIs order.

Due to the limited paper length, only the advantages of the proposed method for HMIs computation have been illustrated. In future works, the proposed method (algorithm 5) can be successfully employed in various applications related images moments invariants such as pattern recognition, image classification and image zero – watermarking of large-size images.

It is important to point out that some recent methods for computing the invariant moments [3, 17, 20, 37, 39] are numerically unstable for large-size images (>1024 × 1024).For this reason, no comparison with these works is carried out. In addition, accelerating and stabilizing the computation of the previously mentioned methods might be a potentially interesting direction for further research.

6 Conclusion

In this paper, new algorithms for the computation of high order HMs and HMIs are presented in the field of large-sized signal and image analysis. First, special attention is paid to ensuring the numerical stability and to speed up the computation of HPs with respect to the order n and with respect to the variable x. The proposed algorithms are fully independent from gamma and factorial functions that are the source of numerical instability (Underflow and Overflow). Secondly, a new numerical stability method is proposed to detect and eliminate unstable coefficients during recursive computation of HPs. This method is based on the distribution analysis of HPs values in the polynomial matrix. As a result, the computation of HPs becomes stable and fast for any order n, any value of the variable x and for any value of the local parameters. Also new algorithm is proposed for fast and stable HMIs computation. This algorithm is based on developed recursive relations and matrix formulations. The simulation and comparison result clearly validated the stability and efficiency of the proposed methods for the large-sized signal and image analysis. However, the empirical method used for the selection of HPs parameters is limited due to the few studied cases and therefore needs to be further improved. In perspective and future work, we will focus on other applications of the proposed algorithms such as compression, classification and zero - watermarking of large-size signals and 2D/3D images. In addition, the selection of HPs parameters will be conducted based on metaheuristic algorithms.