An accurate inventory of the number of sheep is an important part of the construction of precision animal husbandry and smart farms,which helps farmers accurately grasp the basic situation of the sheep.At present,the methods of counting sheep,such as manual counting and ear tag reading,cannot meet the actual breeding needs.In response to the above problems,this thesis designs and studies a flock counting device based on machine vision,which provides a basis for solving the problem of automatic flock counting.The main contents of this thesis are as follows:1.A test platform based on the OK5718 development board was built,including the selection of cameras and displays.Completed the construction of the cross-compilation environment,the design of the software interface,and the collection of original data.2.Perform video image preprocessing on the noise caused by the environment,lighting,equipment connection,etc.in the video data.By comparing and analyzing the advantages and disadvantages of two image enhancement technologies such as gray transformation and histogram equalization and mean filtering,median filtering,Gaussian filtering and other denoising algorithms,the method of combining histogram enhancement and median filtering is used to achieve the original image pretreatment.3.Comparative analysis of the lack of frame difference method,background difference method,and optical flow method in sheep body contour segmentation,and AbaBoost classifier is used to detect the sheep’s head and realize the segmentation of sheep.The sheep head sample data set was created,and the detection effect of the cascade classifier based on LBP and HAAR features was compared and analyzed,and the cascade classifier for sheep head detection was obtained.4.Useing the KCF target tracking algorithm to track the detected target,and realize the multi-target matching and new target determination in the video sequence by the area cross-comparison method,realized the accurate tracking of multiple targets.5.A statistical method based on the number of sheep in the cross-line style was designed,tested and verified.The test results show that the counting algorithm used in this thesis can reach 95% counting accuracy. |