Abstract:Aiming at the practical needs of liquid level detection in fermentation tanks during the production of fermentation liquid, a liquid level detection algorithm based on template matching and roughness texture index is proposed. Firstly, the system collects real-time liquid level images from industrial cameras and performs image preprocessing to improve the quality of the collected images in view of the influence of environmental factors; secondly, perspective transformation is performed on the images to achieve the purpose of rectification; then, template matching is performed on the region of interest in the grayscaled image to search for the location of liquid level in a coarse range; finally, the roughness texture index is calculated to precisely search for the location of the liquid level, so as to obtain accurate liquid level height data, and the data is filtered and outputted. The experimental results show that the liquid level detection algorithm based on template matching and roughness texture index has an accuracy of more than 98.2% in practical applications, and has the advantages of good anti-interference effect and strong real-time performance.