# A Fire Detection Algorithm Based on Tchebichef Moment Invariants and PSO-SVM
## 3 Feature Extraction Based on TMIs
### Tchebichef Moment Invariants  
Equation (12) shows the correlation between scaled Tchebichef polynomials and the power series, which is helpful in expressing the Tchebichef moments as a linear combination of geometric moments. Substituting Equation (12) into Equation (7), the Tchebichef moments \(T_{pq}\) can be expressed as:  
\[T_{pq}=\sum\limits_{i=0}^{p}\sum\limits_{j=0}^{q}B(i)B(j)m_{ij} \tag{13}\]  
where \(m_{ij}\) is the geometric moment of order \(i+j\), defined as:  
\[m_{ij}=\sum\limits_{x=0}^{N-1}\sum\limits_{y=0}^{N-1}x^{i}y^{j}f(x,y) \tag{14}\]  
Here, the translation, rotation, and scaling invariants of Tchebichef moments can be obtained by using the corresponding invariants of geometric moments. Invariants to translation can be achieved by shifting the coordinate origin to the image centroid. In the case of geometric moments, the central geometric moment \(\mu_{ij}\) of order \(i+j\) is defined as [36]:  
\[\mu_{ij}=\sum\limits_{x=0}^{N-1}\sum\limits_{y=0}^{N-1}{(x-x_{0})^{i}(y-y_{0} )^{j}f(x,y)} \tag{15}\]  
where \((x_{0}\), \(y_{0})\) denotes the image centroid given by:  
\[\begin{array}{l}x_{0}=m_{10}/m_{00}\\ y_{0}=m_{01}/m_{00}\end{array} \tag{16}\]  
Then, rotation invariants are obtained by transforming the Cartesian coordinate system into the inertia principal axes system. According to the geometrical properties of cross-section in the mechanics of materials, the transformational relation is expressed as follows:  
\[\begin{array}{l}x^{\prime}=x\cos\alpha+y\sin\alpha\\ y^{\prime}=y\cos\alpha-x\sin\alpha\end{array} \tag{17}\]  
where \(\alpha\) is the rotation angle of the original image given by:  
\[\alpha=\frac{1}{2}\tan^{-1}\frac{2\mu_{11}}{\mu_{20}-\mu_{02}} \tag{18}\]Here, it can be easily verified that the value of \(\alpha\) given in Equation (18) is limited to \([-45^{\circ},45^{\circ}]\). In this paper, the modified version proposed in Reference [36] is used to obtain the exact angle \(\alpha\) in the range of \(0^{\circ}\) to \(360^{\circ}\).  
Under the transformation given by Equation (17), the central moment of order \(i+j\) is modified as:  
\[\widetilde{\mu}_{ij}=\sum_{x=0}^{N-1}\sum_{y=0}^{N-1}\left((x-x_{0})\cos\alpha +(y-y_{0})\sin\alpha\right)^{i}((y-y_{0})\cos\alpha-(x-x_{0})\sin\alpha)^{j}f (x,y) \tag{19}\]  
which holds invariant to image translation and rotation.  
Furthermore, scaling invariants of \(\widetilde{\mu}_{ij}\) are accomplished by the proper normalization of each moment. In theory, any nonzero moment can be invoked as a normalizing factor. Generally, a proper power of \(\widetilde{\mu}_{00}\) is used to normalize \(\widetilde{\mu}_{ij}\). Hence, the normalized central geometric moment \(v_{ij}\) of order \(i+j\) is defined as:  
\[v_{ij}=\frac{\widetilde{\mu}_{ij}}{\widetilde{\mu}_{00}^{\circ}} \tag{20}\]  
where \(r=(i+j+2)/2\).  
From the above, by replacing the geometric moments \(m_{ij}\) on the right-hand side of Equation (13) with \(v_{ij}\), the translation and rotation invariants of Tchebichef moments \(T_{pq}\) are obtained, as shown in the following expression:  
\[T_{pq}^{\prime}=\sum_{i=0}^{p}\sum_{j=0}^{q}B(i)B(j)v_{ij} \tag{21}\]  
Observe that, when an image is scaled, the coefficients \(B(i)\) and \(B(j)\) are also scaled according to the scaling factor. Hence, it is reasonable to normalize the \(T_{pq}^{\prime}\) using the size of the image. For an \(N\times N\) image, the zero-order of \(T_{pq}^{\prime}\) is obtained by using Equation (21), as follows:  
\[\begin{array}{rl}T_{00}^{\prime}&=\sum\limits_{i=0}^{0}\sum\limits_{j=0}^{0 }B(i)B(j)v_{00}\\ &=\frac{1}{N}\end{array} \tag{22}\]  
From Equation (22), it can be seen that all of the Tchebichef moment invariants will be scaled if they are divided by \(T_{00}^{\prime}\), which is affected by the scaling of an image. Finally, the proposed translation, rotation, and scale invariants of Tchebichef moments are expressed as follows:  
\[\widetilde{T}_{pq}=\frac{T_{pq}^{\prime}}{T_{00}^{\prime}} \tag{23}\]