Respiratory behavior detection of cow based on Lucas-Kanade sparse optical flow algorithm

Song Huaibo,Wu Dihua,Yin Xuqiang,Jiang Bo,He Dongjian
DOI: https://doi.org/10.11975/j.issn.1002-6819.2019.17.026
2019-01-01
Abstract:Intelligent detection of respiratory behavior of dairy cows was of great significance for automatic diagnosis of diseases and promotion of precise breeding of dairy cows. Based on the characteristics of repeated abdominal movements when the dairy cows breathe and Lucas-Kanade sparse optical flow algorithm, a non-contact detection method for respiratory behavior of single-target dairy cow in unstructured aquaculture environment was proposed. First, test videos were decomposed into sequence frames and video sequence frames were converted from RGB color space to HSV color space. The V in the HSV color space represented the luminance component. The brightness of the boundary of cow's speckle varied greatly and was easy to detect. In this study, the V component was extracted from HSV color space and extended to the normal gray scale. The mask extracted by the target cow was obtained by the Otsu algorithm binarization processing. According to the characteristics of the noise, a disk type structural element with a radius of 5 pixels was selected and the small noise and the connected area caused by feces around the dairy cow’s speckle in the mask were removed by opening operation. After denoising, the mask for target extraction was used to remove the irrelevant background, and then Canny edge detection operator was used to extract the target cow. Target dairy cows were detected by edge detection to get the mask of the speckle boundary. The gray image of the cow's speckle boundary was extracted from the gray image of the frame image using the mask. Then the fine noise was removed by Gaussian filtering and the merging flow direction of the cow's speckle boundary was calculated and extracted by using Lucas-Kanade sparse optical flow algorithm model. Finally, the detection of cow's respiratory behavior was obtained according to the variation rule of the average direction of the speckle edge measurement and the mathematical model of the respiratory behavior test proposed in this study. In order to verify the effectiveness of the proposed algorithm, a total of 25 200 frames of 105 experimental videos captured in different environments and interference factors were tested, and compared with sparse Lucas-Kanade optical flow method based on full video frame, Horn-Schunck optical flow method based on full video frame and speckle boundary optical flow method. The algorithm was evaluated by algorithm running time t and respiratory behavior detection accuracy. The experimental results showed that the frame image processing time of this algorithm was between 0.10 and 0.13 seconds, the maximum running time of the algorithm was 15.13 s and the minimum running time was 12.55 s and the average running time of this algorithm on 105 test videos was 14.14 seconds. The detection accuracy of respiratory behavior of dairy cows ranged from 83.33% to 100%, with an average accuracy of 98.58%. The average running time of this algorithm was 1.60 seconds slower than detecting the entire frame image with the Lucas-Kanade optical flow method, 7.30 seconds faster than detecting the optical flow of entire frame image by using the Horn-Schunck optical flow method and 9.16 seconds faster than detecting the optical flow of cow speckle borders by Horn-Schunck optical flow method. The average accuracy of respiratory behavior detection was 1.91, 2.36 and 1.26 percent point, respectively. The results showed that the Lucas-Kanade optical flow method was feasible to detect the changes of the border photorheology of dairy cow speckle for detecting the respiratory behavior of dairy cows. This study could provide reference for automatic monitoring of thermal stress behavior of dairy cows based on video surveillance and remote diagnosis of other diseases related to respiratory behavior.
What problem does this paper attempt to address?