*3.2. Gradient Descent for Shape Control Point Optimization*

The optimization of the transformation is defined as the process of minimizing a metric. If we set the disparity measure as the squared Euclidean distance between the correspondence pair, then

$$d(v\_{s\prime}v\_{s\prime}P) = ||T(P) \circ v\_s - v\_t||^2 \tag{6}$$

$$= \|F(v\_t; P) - v\_t\|^2 \tag{7}$$

$$\dot{\rho}\_t = \left\| \sum\_{i=0}^7 \varphi\_i(v\_s) p\_i - v\_t \right\|^2 \,\prime \tag{8}$$

where *v<sup>s</sup>* ∈ *V<sup>s</sup>* , *v<sup>t</sup>* ∈ *V<sup>t</sup>* , and *v<sup>s</sup>* , *v<sup>t</sup>* is correspondence pair. *Sensors* **2020**, *20*, 5680

Thus, the gradient can be denoted as the sum of the difference vector of the corresponding pair multiplied by the weight of each control point. Therefore, the partial derivative of the disparity measure for a cage control point *p<sup>i</sup>* = (*pix*, *piy*, *piz*) is

$$\frac{\partial}{\partial p\_i}d(v\_s, v\_l, P) = \frac{\partial}{\partial p\_i}||v\_s - v\_t||^2 \tag{9}$$

$$\mathcal{I} = 2||v\_s - v\_t|| \cdot \frac{\partial}{\partial p\_i}|| \sum\_{i=0}^7 \varphi\_i(v\_s)p\_i - v\_t||\tag{10}$$

$$= 2\|\boldsymbol{v}\_{\rm s} - \boldsymbol{v}\_{t}\| \cdot \boldsymbol{\varrho}\_{\rm l}(\boldsymbol{v}\_{\rm s}).\tag{11}$$

The Jacobian matrix for the disparity measure of one correspondence pair is

$$\frac{\partial}{\partial P}d(v\_{\rm s}, v\_{\rm t}, P) = \begin{bmatrix} \frac{\partial}{\partial p\_0}d(v\_{\rm s}, v\_{\rm t}, P) \\ \frac{\partial}{\partial p\_1}d(v\_{\rm s}, v\_{\rm t}, P) \\ \vdots \\ \frac{\partial}{\partial p\_m}d(v\_{\rm s}, v\_{\rm t}, P) \end{bmatrix} = \begin{bmatrix} \partial p\_{0\rm x} & \partial p\_{0\rm y} & \partial p\_{0z} \\ \partial p\_{1\rm x} & \partial p\_{1\rm y} & \partial p\_{1z} \\ & \vdots \\ \partial p\_{mx} & \partial p\_{my} & \partial p\_{mz} \end{bmatrix}.\tag{12}$$

The update of cage control points uses the distribution of the differences of corresponding pairs, which are the vectors from sources to targets generated inside the sub-regions Ω*<sup>r</sup>* . At this time, the robust correspondence selection potentially supports the update of cage control points. To establish the correspondence pair robustly, we constrain the correspondence searching process using orientation filtering, as follows:

$$\{v\_{\sf s}, v\_{\sf t}\} = \begin{cases} \text{Paired}, & \text{if } \theta(\vec{n\_{\sf s}}, \vec{n\_{\sf t}}) < \theta\_{\sf T threshold} \\ \text{Not paid}, & \text{otherwise} \end{cases} \tag{13}$$

where *<sup>θ</sup>*(·, ·) is angle between the two vectors, and *<sup>n</sup>*~*<sup>s</sup>* and *<sup>n</sup>*~*<sup>t</sup>* are the vertex normals of *<sup>v</sup><sup>s</sup>* and *<sup>v</sup><sup>t</sup>* , respectively. We set *θ*Threshold = 30◦ . The Jacobian matrix for the sum of the squared Euclidean distance is:

$$\sum\_{\{v\_s, v\_l\} \in \forall I\_{V\_s}} \frac{\partial}{\partial P} d(v\_{s\cdot} v\_{l\cdot} P) = \begin{bmatrix} \sum \partial p\_0 \\ \sum \partial p\_1 \\ \vdots \\ \sum \partial p\_m \end{bmatrix} \tag{14}$$

where *IV<sup>s</sup>* is the set of correspondence pairs.
