# Magnetic Levitation Belt Conveyor Control System Based on Multi-Sensor Fusion
## 3 Method  
### Industrial Camera Measurement Algorithm  
The image processing technology is applied to the magnetic suspension clearance measurement to solve some problems of the traditional displacement sensor. The measurement algorithm is based on image preprocessing, edge detection, contour extraction, and calibration. An image processing flowchart is shown in Figure 3.  
In the process of information acquisition, transmission, and terminal processing, the original image is easily affected by noise, light, and other factors, resulting in some degradation of image quality. This degradation affects the processing of subsequent images and makes it difficult to obtain accurate results. To enhance the visual quality of the image and the accuracy of the image processing, it is necessary to preprocess the image before image processing. Image preprocessing includes region of interest (ROI) selection, image filter denoising, binarization processing, and so on. The black-and-white images obtained by the camera are shown in Figure 4a. To reduce the computational load and increase the algorithm operation speed to fulfill the real-time processing requirements, the ROI region in the middle of the suspended air gap in Figure 4a was preferentially selected in this study during image processing, as shown in Figure 4b. The edge features extracted from part of the ROI represent the characteristics of the magnetic levitation air gap in the whole field of vision. Then, the image is smoothed and filtered. In 1998, [PERSON] et al. proposed a nonlinear filtering algorithm, i.e., bilateral filtering [25,26], on the basis of Gaussian filtering and Yaroslavsky neighborhood filtering. The traditional Gaussian filtering method directly convolves the Gaussian weight coefficient with the image information, and it only considers the spatial distance between pixels, resulting in an unclear image. The bilateral filtering algorithm optimizes the Gaussian filtering weight coefficient in the product of the Gaussian function and image brightness information. The optimized weight coefficient is then convolved with the image information  
Figure 4: Image preprocessing results. (**a**) Original image, (**b**) ROI region, (**c**) Bilateral filtering, (**d**) Binarization. Figure 3: Image processing flow chart. to account for the similarity between pixels. Accordingly, the obtained image edges are smoother. The filtering effect is shown in Figure 4c. The template weights of the bilateral filter are formulated as follows:  
\[w(i,j,k,l)=\exp\left[-\frac{(i-k)^{2}+(j-l)^{2}}{2\sigma_{d}^{2}}-\frac{\left\|l (i,j)-I(k,l)\right\|^{2}}{2\sigma_{r}^{2}}\right] \tag{6}\]  
where \(\sigma_{d}\) and \(\sigma_{r}\) are the smoothing parameters, and \(I(i,j)\) and \(I(k,l)\) are the intensities of pixels (\(i\),\(j\)) and (\(k\),\(l\)), respectively. After calculating the weights, they are normalized as follows:  
\[I_{D}(i,j)=\frac{\sum_{k,l}I(k,l)w(i,j,k,l)}{\sum_{k,l}w(i,j,k,l)} \tag{7}\]  
where \(I_{D}\) is the denoising intensity of pixel (\(i\),\(j\)). Image binarization is conducive to highlighting the image contour under testing. The most effective method for binarization is threshold segmentation. The Online Teaching Support Unit (OTSU) is used to binarize the edge and background of the suspended air gap image to obtain a complete edge and background segmentation image, as shown in Figure 4d. Before extracting the contour features of the object, edge detection of the image should be performed to obtain the object boundary, and the features of the boundary region should be extracted to calculate the image contour feature parameters. Common edge detection operators include the [PERSON], Sobel, Prewitt, Laplacian, and Canny operators. The Sobel edge detection algorithm [27; 28] is relatively simple and especially suitable for fields with high real-time requirements. In practical applications, its efficiency is higher than that of Canny edge detection.