# Adaptive Multi-View Image Mosaic Method for Conveyor Belt Surface Fault Online Detection
## 3 Materials and Methods
### Grayscale-Based Overlapping Region Registration
#### 3.1.2 Overlapping Region Registration  
Because the range of overlapping region obtained by the overlapping region estimation model is a rough estimation, it is necessary to carry out overlapping region registration. We used the grayscale-based method with gray correlation analysis to measure the correlation between the reference pixel and the comparison pixel in the local area of the image. We can find the position with a higher gray correlation degree in the estimated overlapping region and realize the overlapping region registration. There are 2 adjacent \(m\times n\) size images--the gray value of the left image pixel is \(f_{1}(u,v)\), and the gray value of the right image pixel is \(f_{2}(u,v)\), where \(u\) is the row coordinate, \(u\)\(\in\)[1,\(m\)], \(v\) is the column coordinate, \(v\)\(\in\)[1,\(n\)]. The overlapping region range of the left and right images estimated is [\(v_{1}\),\(n\)] and [1,\(v_{2}\)]. Registration of overlapping regions can be divided into the following steps:  
**Step 1:** Select the region image whose column coordinates are \(v\)\(\in\)[\(v_{1}\)\(-\)\(L\),\(n\)] in the left image, and select the region image whose column coordinates are \(v\)\(\in\)[1,\(v_{2}\)\(+\)\(L\)] in the right image, where \(L\) is the deviation value. **Step 2:** Calculate the mean of pixels of each column for the 2 regional images obtained. The Equation is as follows:  
\[\left\{ \begin{array}{l}img_{1}(v)=\sum\limits_{u=1}^{m}f_{1}(u,v)/m\\ img_{2}(v)=\sum\limits_{u=1}^{m}f_{2}(u,v)/m\end{array} \right. \tag{5}\]  
where \(img_{1}(v)\) and \(img_{2}(v)\) are the mean of pixels in column \(v\). **Step 3:** Affected by uneven illumination, weak imaging dark regions can appear at the edge of the image. To overcome its influence on stitching, for the left image, starting from \(v\) = \(n\), one must look for the first one that satisfies \(img_{1}(v)\geq T_{d}\) column by column in a descending manner and denote it as \(d_{1}\), \(d_{1}\geq v_{1}\). For the right image, starting from \(v\) = 1, one must look for the first column that satisfies \(img_{2}[v]\geq T_{d}\) column by column in an increasing manner and denote it \(d_{2}\), \(d_{2}\leq v_{2}\); \(T_{d}\) is the threshold. For the columns of the left image \(v\)\(\in\)[\(d_{1}\)\(+\)1,\(n\)] and the right image \(v\)\(\in\)[1,\(d_{2}\)\(-\)1], the gray correlation degree calculation is not performed, and the corresponding gray correlation degree \(\epsilon_{l}\) or \(\epsilon_{r}\) is assigned the value of zero. **Step 8:** Calculation of gray correlation degree \(\varepsilon_{l}\) and \(\varepsilon_{r}\). \[\left\{ \begin{array}{l}\varepsilon_{l}=\frac{1}{k}\sum\limits_{i=1}^{k}\delta_ {l}(i)\\ \varepsilon_{r}=\frac{1}{k}\sum\limits_{i=1}^{k}\delta_{r}(i)\end{array} \right. \tag{13}\]  
**Step 9:**\(p=p+1\). If \(p\) satisfies the range of \(p\)\(\in\)[\(v_{1}\)\(-\)\(L\),\(v_{1}\)\(+\)\(L\)], continue to calculate the gray correlation degree \(\varepsilon_{l}\) with \(img_{1}\)(\(p\)) as the current pixel according to step (4). \(q=q+1\). If \(q\) satisfies the range of \(q\)\(\in\)[\(v_{2}\)\(-\)\(L\),\(v_{2}\)\(+\)\(L\)], continue to calculate the gray correlation degree \(\varepsilon_{r}\) with \(img_{2}\)(\(q\)) as the current pixel according to step (4). **Step 10:** Calculate the \(p\) value corresponding to the maximum value of \(\varepsilon_{l}\) and record it as \(p_{0}\). Calculate the \(q\) value corresponding to the maximum value of \(\varepsilon_{r}\) and record it as \(q_{0}\). Then, the range of overlapping region of the left image is determined as \(u\)\(\in\)[1,\(m\)], \(v\)\(\in\)[\(p_{0}\),\(d_{1}\)], and the range of overlapping region of the right image is determined as \(u\)\(\in\)[1,\(m\)], \(v\)\(\in\)[\(d_{2}\),\(d_{0}\)], and the overlapping region registration is completed. As shown in Figure 5, regions \(R_{12}\) and \(R_{22}\) are the overlapping regions after registration, regions \(R_{11}\) and \(R_{21}\) are the non-overlapping regions, and regions \(R_{13}\) and \(R_{23}\) are the dark regions.