# Automatic Classification of Morphologically Similar Fish Species Using Their Head Contours
## 2 Materials and Methods
### Discrete Transforms and Signal Reconstructions from a Reduced Set of Coefficients
#### 2.1.2 Discrete Fourier Transform  
The discrete Fourier transform (DFT) forward and backward expressions that relate the points \(x_{n}\in\mathbb{R}\) with the transformed coefficients \(X_{k}\in\mathbb{C}\) take the form:  
Figure 1: A presentation of the traditional mixture that is made by fishermen in the Catalan coast: (**a**) red mullets, and (**b**) gurnards. \[X_{k}=\sum_{k=0}^{N-1}x_{n}e^{-j\frac{2\pi}{N}kn},\quad k=0,1,\cdots,N-1, \tag{4}\]  
\[x_{n}=\frac{1}{N}\sum_{k=0}^{N-1}X_{k}e^{j\frac{2\pi}{N}kn},\quad n=0,1,\cdots,N -1. \tag{5}\]  
In the DFT case, \(X_{k}\in\mathbb{C}\). Considering the well-known DFT property \(X_{N-k}=X_{k}^{*}\) (symbol \({}^{*}\) stands for complex conjugated) which holds for \(x_{n}\in\mathbb{R}\), the module and phase notation of \(X_{k}\) as \(X_{k}=\left|X_{k}\right|e^{i\phi_{k}}\), and the Euler formula, the approximation of \(x_{n}\), \(\hat{x}_{n}\), obtained from the first \(L\) (\(L<N\)) coefficients \(X_{k}\), can be written as:  
\[ \begin{split}\tilde{x}_{n}=\frac{X_{0}}{N}+\frac{1}{N}\sum_{k=1} ^{L-1}\left(X_{k}e^{j\frac{2\pi}{N}kn}+X_{k}^{*}e^{-j\frac{2\pi}{N}kn}\right)= \frac{X_{0}}{N}+\frac{2}{N}\sum_{k=1}^{L-1}\left|X_{k}\right|\cos\left(\frac{ 2\pi}{N}kn+\phi_{k}\right);\\ n=0,\cdots,N-1,\end{split}  \tag{6}\]  
showing that \(\tilde{x}_{n}\in\mathbb{R}\). 1.3 A Note on the Implicit Extension of the Sequences Depending on the Discrete Transform Used and the Case of Open Contours  
For a discrete transform, the way in which the sequence remains implicitly defined outside the main range \(n\in[0,\cdots,N-1]\) is known as implicit extension. Any discrete transform has a particular way of extending the sequence. This can be seen from the backward transform expressions in (2) and in (5), for the DCT-II and the DFT, respectively. As the bases in these expressions are defined beyond \(n\in[0,N-1]\), it follows that \(x_{n}\) also remains implicitly defined beyond this range. When the approximation of \(x_{n}\) by \(\tilde{x}_{n}\) is done with few bases (\(L\ll N\)) as in Equations (3) and (6), the samples of \(\tilde{x}_{n}\) near the main sequence extremes (\(n=0\) and \(n=N-1\)) tend to manifest the implicit periodicity of the transform. Depending on how a particular transformation extends the sequences at both extremes, more or less transformed coefficients will be required to have a quality approximation. Let us first consider the DCT-II, which belongs to the family of discrete trigonometric transforms (DTT), and their implicit extension properties [32; 33; 34; 35; 36; 37; 38; 39; 40]. To summarize the DTT sequence extensions, two relevant parameters must be considered--the _symmetry type_ (ST) and the _point of symmetry_ (PoS). When it comes to the ST, the replication can be performed _symmetrically_ (S) or _anti-symmetrically_ (A). Considering that the samples of the sequence are equispaced, the PoS can be positioned either in the middle of the space between the elements, named _half_ (H) sample or _midpoint_, or just at the position of the element, named _whole_ (W) sample or _meslipoint_. Thus, when considering a single point from an edge of a sequence, there are four options to extend the sequence, commonly denoted by two letters--(HS), (HA), (WS), and (WA). Figure 2 represents those four possibilities for the left edge of a main sequence, which is depicted in bold. Then, it follows that since all finite sequence have two edges, there are eight total possible combinations, each one of which is associated with one different formulation corresponding to either the DCT or the DST (discrete sine transform) groups [34; 37; 41; 42]. The DTTs that best approximate open contours with few coefficients are those that have HS or WS implicit extensions on both extremes. That happens for the DCT formulation types -I, -II, -V, and -VI. In those cases, the sequence considered with implicit extensions does not lose continuity. In the particular case of the DCT-II, the continuity in both extremes is defined as \(x_{-1}=x_{0}\) and \(x_{N}=x_{N-1}\).