# Resolving Gas Bubbles Ascending in Liquid Metal from Low-SNR Neutron Radiography Images
## 5 Experimental Validation
### Moving Reference Body
An IW is then defined about the centroid of the remaining body segment and a void region is extracted, which is shown in (b). Note, however, that the IW contains portions of the masked background from (a), which can interfere with the global and local filters. It is therefore necessary to extrapolate the body background about the void into such regions. These regions are detected by inverting the IW luminance map and running histogram-based segmentation with a single threshold of 0.999. The masked regions are then segmented from the IW, as shown in (c). Texture synthesis-based inpainting is then performed with a maximum \(N_{\text{neigh}}=150\) neighboring pixels used for texture comparison and a maximum of \(N_{\text{samp}}=300\) sampling instances for texture fitting [74]. In rather rare cases inpainting introduces pixels with strongly outlying luminance values, which are eliminated as follows. An Otsu threshold \(l_{c}\) is computed for the input image, and then the image is binarized using the \(k_{I}\cdot l_{c}\) threshold, where \(k_{I}\) is the threshold scaling factor. With the right \(k_{I}\) value, this operation segments pixels that differ by more than a certain luminance value from the bulk of the histogram. The segmented pixels are then masked in the input image. We found that \(k_{I}=4\) does not affect the images without significant outliers (ones that strongly affect global and local filter output) while effectively cleaning up severe outliers without modifying the bulk image histogram. An example output of Algorithm 8 is shown in Figure 23d. Afterwards, the resulting repaired void regions are used as input for the global and local filters. The settings for the global and local filters are the same as in the cases with stationary reference bodies. In the cases where neutron flux transmission was along the longer body axis (Figure 22a) it was more difficult to segment the body without the pendulum clamps with Algorithm 8 as outlined above. Therefore, minor adjustments were made:  
* [noitemsep,nolistsep]
* Otsu binarization was used instead of the Chan-Vese process;
* [noitemsep,nolistsep]  
Figure 23: (**a**) Detected reference body segments (red contours) with an IW (white dashed frame) centered about the body position after segment area thresholding; (**b**) original image projected onto the IW; (**c**) image regions designated for inpainting (red borders); (**d**) restored void region. * Morphological opening disk element radius was increased to 50 (Step 6);
* Morphological dilation using disk structural elements with a 5-pixel radius was performed after Step 7;
* Body masks were oriented to minimize the area of masked background in the IW before performing Step 11.  
and other Steps and parameters of Algorithm 8 remained unchanged. This procedure was necessary because clamp removal from the body segments using larger-scale morphological opening resulted in body segments smaller then the body by a considerable margin, which was compensated for by morphological dilation to recover the eroded area. Body reorientation was required because the masked image margins to be filled using texture synthesis often constituted a significant fraction of the IW area, resulting in artefacts. Body orientation was detected by fitting a minimum area oriented bounding box and determining its angle \(\phi\) (definition as in Figure 16a) with respect to the horizontal axis. The masked body image was then rotated by \(-\phi\) radians and the body region was obtained and repaired as usual. In two cases we had to use lower values, \(N_{\mathrm{neigh}}=50\) and \(N_{\mathrm{samp}}=200\), to avoid sampling the void regions and producing high-luminance synthetic background. In addition, filtering is performed for IWs with slightly different sizes and void positions. Therefore, one cannot directly overlay detected void shapes over a reference mask. One also cannot obtain a reference mask by averaging the images from the recorded sequence as with a stationary body.