## 2 Background
### Bezier Curves  
The Bezier curves have been used to generate smooth trajectories, so they can be considered for the approximation of the points that form the graphite nodules contours, as they have a semi-spherical morphology. Once the coordinates of the pixels (points) that compose the graphite nodules contours have been obtained using image processing, the Bezier curves are obtained. To obtain the curves, the contour is divided into two subsets, one superior (\(S_{\text{sup}}\)) and one inferior (\(S_{\text{inf}}\)), and a Bezier curve is obtained for each subset; once the curves are computed, then they are joined to obtain the curve that represents the contour of the complete nodule.  
When considering that is necessary to generate a Bezier curve (\(\mathbf{C}(t)\)) of degree \(n\) for a subset of points, \(\mathbf{A}=\{a_{0},\,a_{1},\,\ldots,\,a_{k}\}\), which could be \(S_{\text{sup}}\) o \(S_{\text{inf}}\), with a points number of \((k+1)\), it requires to satisfy the following equation for all points:  
\[\mathbf{C}\left(t_{j}\right)=\sum_{i=0}^{n}\mathbf{p}\mathbf{B}\mathbf{z}_{i,n }\left(t_{j}\right)=a_{j}\quad\text{for}\quad j=0,1,2,\ldots,k \tag{1}\]  
where \(\mathbf{B}\mathbf{z}_{i,n}\left(t\right)\) are called the Bernstein polynomials and \(\mathbf{p}\) are the control points. Equation (1) can be rewritten in the next matrix form:  
\[\overbrace{\left(\begin{array}{ccccc}\mathbf{B}\mathbf{z}_{0,n}\left(t_{0} \right)&\mathbf{B}\mathbf{z}_{1,n}\left(t_{0}\right)&\mathbf{B}\mathbf{z}_{2, n}\left(t_{0}\right)&\cdots&\mathbf{B}\mathbf{z}_{n,n}\left(t_{0}\right)\\ \mathbf{B}\mathbf{z}_{0,n}\left(t_{1}\right)&\mathbf{B}\mathbf{z}_{1,n}\left( t_{1}\right)&\mathbf{B}\mathbf{z}_{2,n}\left(t_{1}\right)&\cdots&\mathbf{B} \mathbf{z}_{n,n}\left(t_{1}\right)\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ \mathbf{B}\mathbf{z}_{0,n}\left(t_{k}\right)&\mathbf{B}\mathbf{z}_{1,n}\left(t _{k}\right)&\mathbf{B}\mathbf{z}_{2,n}\left(t_{k}\right)&\cdots&\mathbf{B} \mathbf{z}_{n,n}\left(t_{k}\right)\end{array}\right)}^{\mathbf{C}}\overbrace{ \left(\begin{array}{c}p_{0}\\ p_{1}\\ \vdots\\ p_{n}\end{array}\right)}^{\mathbf{A}}=\overbrace{\left(\begin{array}{c}a_{0} \\ a_{1}\\ \vdots\\ a_{k}\end{array}\right)}^{\mathbf{A}} \tag{2}\]  
Equation (2) can be summarized as \(\mathbf{BC}=\mathbf{A}\), where \(\mathbf{B}\) is the matrix of [PERSON]'s polynomials, \(\mathbf{A}\) is the vector who contains the pixels belonging to the contour of the graphite nodule (they are the points to be approximated by the Bezier curve), and \(\mathbf{C}\) is the vector containing the control points, which are calculated by solving the matrix system in Equation (2). As it can be seen, \(n\) must be equal to \(k\) with the objective to appropriately compute the control points, which basically define the Bezier curve [22].  
In the generation of a Bezier curve, one of the most important parameters to select is the Bezier curve degree (\(n\)), as this parameter defines whether the curve will be more or less smooth. Hence, it is necessary to use an algorithm to optimize the selection of \(n\) according to the particular characteristics of each graphite nodule. In this work, the _CSF_ and the number of points that each subset contains are used as inputs of the optimization algorithm.