# Target Image Mask Correction Based on Skeleton Divergence
## 2 Materials and Methods
### Discrete Pixel Edge Similarity-Guided Merging  
Assuming that each single-channel amplitude or intensity format image of an RGB image, subject to a fully developed speckle pattern, can be represented by the following multiplicative noise model [21]. \[I(x,y)=\varepsilon(x,y)\xi(x,y),n\in\mathbb{Z}^{2}, \tag{10}\]  
Figure 2: The scale-invariant intrinsic variables representation of discrete curves. where \(I(x,y)\) represents the single-channel information modeling of the image, \(n=(x,y)\) representing the pixel coordinates, \(\varepsilon(x,y)\) is the reflection coefficient of the real scene, and \(\xi(x,y)\) is the multiplicative coherence coefficient. We treat the image separately under each channel. When the edge vector and skeleton of the source and mask images are extracted, the pixels in the edge and neighborhood of the skeleton are preferentially optimized, and discrete pixel regions are merged into a larger pixel region to achieve high efficiency and precision. In terms of discrete pixel arrangement optimization, this study introduces a common boundary length penalty region-merging technique for regional merging of motion-compensated fragmented regions, to achieve discrete pixel mask correction. First, the region similarity function is constructed using the first-order statistic of the edge information of the discrete pixel region. The region adjacency graph (RAG) and nearest neighbor graph (NNG) are then used to represent the regional relationship before and after the region-merging process. Finally, the NNG of the region is used to rapidly search for the local adjacent region with the least cost, merge the regions, update the RAG and NNG, and iteratively continue the process until the minimum merge cost is less than a preset merge cost error threshold. The preset merge cost error threshold is the same as the setting in [21], and is set to 1.2. The minimum merge cost of discrete RGB pixels is the sum of three single-channel minimized merge costs. Take the red channel image as an example, the minimized merge cost function for discrete pixel merging is as follows [21]. \[E(I_{P_{1}^{r}}(x,y),I_{P_{2}^{r}}(x,y))=E_{S}(I_{P_{1}^{r}}(x,y),I_{P_{2}^{r} }(x,y))+\eta\Gamma_{S}(P_{1}^{r},P_{2}^{r}), \tag{11}\]  
where \(P_{1},P_{2}\) represent discrete RGB pixel regions. \(P_{1}^{r},P_{2}^{r},P_{1}^{s},P_{2}^{s},P_{1}^{b},P_{2}^{b}\) represent their respective discrete single-channel pixel regions. \(\text{E}\Big{(}I_{P_{1}^{r}}(x,y),I_{P_{2}^{r}}(x,y)\Big{)}\) is the single-channel merge cost function and \(\text{E}_{S}\Big{(}I_{P_{1}^{r}}(x,y),I_{P_{2}^{r}}(x,y)\Big{)}\) is the single-channel statistical similarity cost, which describes the statistical similarity between the combined result and the image data. \(\Gamma_{S}\Big{(}P_{1}^{r},P_{2}^{r}\Big{)}\) is the single-channel skeleton and boundary deformation cost, which is the deformation cost of the combined results on the skeleton and the boundary. As discrete pixel regions merge, the statistical cost increases, and the deformation costs of the skeleton and boundary gradually decreases. \(\eta\) is the normalization parameter, empirically set to 1.8. Starting from an initial state, the designed region-merging strategy is used to combine the adjacent sub-regions with the strongest edge similarity, until the optimization termination condition is satisfied and the final result is output. The single-channel statistical similarity cost is characterized by the statistical similarity measure (SSM).