# Raw Material Flow Rate Measurement on Belt Conveyor System Using Visual Data
## 3 Methodology
### Coke and Limestone Segmentation
However, it's essential to acknowledge that this entire technique relies on specific parameters, including the size of the structuring element and the frequency of applying certain morphological operations. Given the variability in environmental conditions across different videos in our dataset, it's crucial for these parameters to adapt to each unique scenario. For instance, applying the same parameter settings to another example within our dataset could lead to inaccurate results, as illustrated in Figure 11. Therefore, achieving parameter settings that are flexible and adaptable to different scenarios is of utmost importance to ensure the technique's accuracy and reliability across a diverse range of environmental conditions. Figure 11 clearly demonstrates that the algorithm's performance cannot be consistently accurate using fixed thresholds across all data samples. To address this variability, we have developed a voting-based background subtraction technique. This approach focuses on extracting the most confident regions as the foreground. In this technique, we leverage both the frame difference and BackgroundSubtractorCNT methods to extract the image's foreground. By combining these two approaches and employing a voting mechanism, we enhance the accuracy and robustness of the segmentation process, ensuring that only the most reliable regions are classified as the foreground. The BackgroundSubtractorCNT method is advantageous because it retains a history of the image, which allows us to filter out subtle changes that might be considered noise  
Figure 11: Poor segmentation results using the same parameters for different environment. Figure 10: (**a**) Background subtraction using CNT, (**b**) noise removal using open morphology, (**c**) filled shapes using dilation operation, and (**d**) close gaps using dilation operation close. in the image. On the other hand, the frame difference technique is sensitive and captures every minor change between two consecutive frames. Given our knowledge that the raw material will consistently be flowing in a specific region on the conveyor belt, by merging these two methods, we effectively preserve the historical information of the target region while eliminating any subtle changes that could occur in a particular frame. We achieved this by setting the maximum threshold values for the morphological operator so that most of the conveyor belt region would be selected. Then, after both the algorithms select their foreground, we pick only those pixel values detected by both algorithms. These pixels would have the highest confidence of being the foreground as both algorithms detect it. The parameters used to perform morphology are shown in Table 2. Moreover, the structuring element used were rectangle or ellipse, depending upon the condition. A structuring element of size \(5\times 5\) is shown in Figure 9.0  
The complete procedure for voting-based segmentation is shown in Figure 9.1 It shows a single step of the algorithm being performed on an image sequence. The left side of the image shows the output from the frame difference technique. We will call its resulting mask \(M_{fd}\), and the right side shows the output from BackgroundSubtractorCNT, so let its resulting mask be \(M_{cnt}\). After both the algorithms return their resulting masks, we performed the bit-wise AND operation to extract the final output \(M_{k}\). Figure 9.2  
The regions highlighted in red in Figure 14a,b are extracted from the second step of Figure 9.3 This step illustrates a comparison between the frame difference approach and the CNT method. It's evident that the frame difference approach outperforms the CNT method in some frames, while in others, the CNT method excels. To address this variability, we have implemented a fusion technique. This technique retains only those pixels that are consistent between both methods, and we've introduced a voting-based mechanism to ensure the selection of the correct region.