# Quaternion Processing Techniques for Color Synthesized NDT Thermography
## 3 Proposed Approach
### Description of the Quaternion Processing
Two-sided DQFT:  
\[F_{L-R}(u,v)=\frac{1}{\sqrt{MN}}\sum_{x=0}^{M-1}\sum_{y=0}^{N-1}e^{-\mu 2\pi \frac{m}{M}}f(x,y)e^{-\mu 2\pi\frac{v}{N}} \tag{9}\]  
Left-sided DQFT:  
\[F_{L}(u,v)=\frac{1}{\sqrt{MN}}\sum_{x=0}^{M-1}\sum_{y=0}^{N-1}e^{-\mu 2\pi \left(\frac{m}{M}+\frac{v}{N}\right)}f(x,y) \tag{10}\]  
Right-sided DQFT:  
\[\mathbb{H}=\{q=q_{0}\mathbf{1}+q_{1}\mathbf{i}+q_{2}\mathbf{j}+q_{3}\mathbf{k }\quad\text{with}\quad q_{0},q_{1},q_{2},q_{3}\in\mathbb{R}\}\]0  
where \(f\) is a quaternionic function defined on a set of spatial coordinates \((x,y)\in\mathbb{R}^{2}\), \(F\) is the DQFT defined over a set of frequency coordinates \((u,v)\in\mathbb{R}^{2}\), and \(\mu\) is a pure unit quaternion that determines a direction in space. It is common in color image processing to choose the direction coinciding with the luminance axis or gray axis. (\(r=g=b\)). The results produced by each of the definitions of the DQFT are different. However, for practical NDT visualization and detection purposes, the results of the different transformations are qualitatively similar. In this study, the definition of the left-sided DQFT has been used without loss of generality in the final results. Quaternion Principal Components Analysis (QPCA)  
Quaternion extensions of various classical techniques have been developed, such as principal component analysis, which provide methods for the processing of color images taking into account their particular characteristics through quaternion analysis [33]. There are two different types of eigenvalue problem associated with quaternions due to the non-commutativity of the quaternion product. Given a quaternion matrix \(M\in\mathbb{H}^{N\times N}\) the left eigenvalues \(\lambda_{l}\) and the right eigenvalues \(\lambda_{r}\) can be determined. This study has been limited to the problem of right eigenvalues due to theoretical limitations related to left eigenvalues, which do not seem to be fully resolved [34]. Any quaternion matrix \(M\in\mathbb{H}^{N\times N}\) can be decomposed as  
\[\mathbb{H}=\{q=q_{0}\mathbf{1}+q_{1}\mathbf{i}+q_{2}\mathbf{j}+q_{3}\mathbf{k }\quad\text{with}\quad q_{0},q_{1},q_{2},q_{3}\in\mathbb{R}\}\]1  
where \(W\in\mathbb{H}^{N\times N}\) is a unitary matrix, i.e., \(W^{*}W=WW^{*}=1\), containing the eigenvectors of \(M\), and \(D\in\mathbb{C}^{N\times N}\) is an upper triangular matrix with the diagonal containing the eigenvalues. \(W^{*}\) is the quaternion conjugate of \(W\), where given a quaternion \(q=q_{0}\mathbf{1}+q_{1}\mathbf{i}+q_{2}\mathbf{j}+q_{3}\mathbf{k}\) its quaternion conjugate is \(q^{*}=q_{0}\mathbf{1}-q_{1}\mathbf{i}-q_{2}\mathbf{j}-q_{3}\mathbf{k}\). If \(M\) is a Hermitian matrix, i.e., \(M=M^{*}\), then its eigenvalues are real (\(D\in\mathbb{R}^{N\times N}\)). Every \(N\times N\) quaternion matrix has exactly \(N\) complex right eigenvalues with non-negative imaginary part, but can have infinite eigenvalues since \(q^{-1}\lambda q\) is also eigenvalue. Given a color image of size \(N\times M\), represented by a matrix \(Q\in\mathbb{H}^{N\times M}\), the quaternion principal component analysis consists of decomposing the mean covariance matrix of a color image \(C\) as  
\[\mathbb{H}=\{q=q_{0}\mathbf{1}+q_{1}\mathbf{i}+q_{2}\mathbf{j}+q_{3}\mathbf{k }\quad\text{with}\quad q_{0},q_{1},q_{2},q_{3}\in\mathbb{R}\}\]2The mean covariance matrix is obtained by the mean value of the covariance matrices calculated for each column \(q_{i}\) in the input matrix \(Q\), which is considered the maximum likelihood estimator of the covariance matrices for quaternionic matrices. It can be verified that the matrix \(C\) is quaternionic Hermitian and, therefore, the coefficients on the diagonal of \(D\) are real values.