# Target Image Mask Correction Based on Skeleton Divergence
## 2 Materials and Methods
### Mask Optimization Based on Skeleton Divergence  
Boundary denoising and smoothing operations are performed on the original and mask images. After extracting the skeletons of the source and mask images, the images are optimized using the image constraints near the image skeleton. This study employs the angle-based filtering method in the process of boundary smoothing, using the scale-invariant intrinsic variables of the edge pixel connection as the filtering independent variable [19]. The intrinsic amount of expansion is the reference  
Figure 1: The proposed mask correction algorithm flow. TOPSIS, technique for order of preference by similarity to ideal solution. quantity that represents the spatial movement and expansion of the image edge vector unit, in which the directional corner can reflect the trend and degree of curvature of the global edge vector and can reflect the smoothness of the local plane image. The angle of the edge vectors is subject to bilateral filtering, not only because of the application scenario and method of [20], but also because bilateral filtering considers the spatial distance difference between edge vectors. The influence of the difference in the edge vector angle is determined, and the set of intrinsic amounts of expansion, including the new directional corner parameter, may be obtained, as shown in Figure 2. The scale-invariant intrinsic variables of the discrete curve are expressed as  
\[\Omega{=\{(\tau_{i},\theta_{i})\}_{i=1}^{n-1}}, \tag{1}\]  
and  
\[\left\{ \begin{array}{l}r_{i}=l_{i}/l_{i-1}=\parallel\overline{\overline{ \overline{\overline{\overline{\overline{\overline{\overline{\overline{\overline{ \overline{\overline{\overline{\overline{\overline{\overline{\overline{\overline{\overline{\overline{\overline{\cdot}}}}}}}}}}}}}} }\\ \theta_{i}\in(-\pi,\pi]\end{array} \right., \tag{2}\]  
where \(r_{i}\) is the ratio of the modulus lengths of the two edge vectors \(\overline{\overline{\overline{\overline{\overline{\overline{\overline{\
u}_{i +1\overline{\overline{\
u}_{i},\overline{\overline{\overline{\overline{\
u}_{i -1\overline{\
u_{i}}}}}}}}}}}}}\) which has the common vertex \(v_{i}\), and \(\theta_{i}\) is the directed rotation angle of the two adjacent edge vectors. The counterclockwise direction is positive. Take the vertex \(v_{i}\) as an example and the discrete representation of the angle bilateral filtering is as follows [18]. \[\theta_{i}^{*}=\left\{ \begin{array}{l}\frac{\theta_{1}+c(\overline{\overline {\
u}_{2}}v_{1})(\theta_{2},\theta_{1})\theta_{2}}{1+c(\overline{\
u}_{2}, \overline{\overline{\
u}_{1}})(\theta_{2},\theta_{1})},i=1\\ \frac{c(\overline{\
u}_{1},\overline{\
u}_{2})(\theta_{1},\theta_{1})\theta_{ 1};i+1}{c(\overline{\
u}_{1},\overline{\
u}_{2})(\theta_{1},\theta_{1}) \theta_{1};i+1}{c(\overline{\
u}_{1},\overline{\
u}_{2})(\theta_{1},\theta_{1} )\theta_{1};i}},i=2,3,\ldots\ldots,n-2\\ \frac{c(\overline{\
u}_{2},\overline{\
u}_{2})(\theta_{2},\theta_{1})\theta_{ 2}+2c(\overline{\
u}_{2},\theta_{1})\theta_{2}+2c(\overline{\
u}_{2}, \theta_{1})}{1+c(\overline{\
u}_{2},\overline{\
u}_{2},\overline{\
u}_{2})( \theta_{2},\theta_{1})},i=n-1\end{array} \right., \tag{3}\]  
where \(\theta_{i}^{*}\) is the new directional corner at the vertex \(v_{i}\) of the curve after bilateral filtering. Let \(c\left(v_{j},v_{i}\right)=\textit{exp}\left(-\frac{1}{2}\left(\frac{d\left(v_ {j},v_{i}\right)}{\sigma_{d}}\right)^{2}\right)\) and \(d\left(v_{j},v_{i}\right)\) be the Euclidean distance between the two vertices \(v_{j},v_{i}\), \(s\left(\theta_{j},\theta_{i}\right)=\textit{exp}\left(-\frac{1}{2}\left(\frac{ \left(\theta_{j},\theta_{j}\right)}{\sigma_{r}}\right)^{2}\right)\) and \(s\left(\theta_{j},\theta_{i}\right)=\left|\theta_{j}-\theta_{i}\right|\) is the difference between the directed corners at the two vertices \(v_{j},v_{i}\). The size of the weight factor \(\sigma_{d},\sigma_{r}\) depends on the specific situation. The larger the \(\sigma_{d}\), the greater the effect of the distance size.