宋怀波, 吴頔华, 阴旭强, 姜波, 何东健. 基于Lucas-Kanade稀疏光流算法的奶牛呼吸行为检测[J]. 农业工程学报, 2019, 35(17): 215-224. DOI: 10.11975/j.issn.1002-6819.2019.17.026
    引用本文: 宋怀波, 吴頔华, 阴旭强, 姜波, 何东健. 基于Lucas-Kanade稀疏光流算法的奶牛呼吸行为检测[J]. 农业工程学报, 2019, 35(17): 215-224. DOI: 10.11975/j.issn.1002-6819.2019.17.026
    Song Huaibo, Wu Dihua, Yin Xuqiang, Jiang Bo, He Dongjian. Respiratory behavior detection of cow based on Lucas-Kanade sparse optical flow algorithm[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2019, 35(17): 215-224. DOI: 10.11975/j.issn.1002-6819.2019.17.026
    Citation: Song Huaibo, Wu Dihua, Yin Xuqiang, Jiang Bo, He Dongjian. Respiratory behavior detection of cow based on Lucas-Kanade sparse optical flow algorithm[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2019, 35(17): 215-224. DOI: 10.11975/j.issn.1002-6819.2019.17.026

    基于Lucas-Kanade稀疏光流算法的奶牛呼吸行为检测

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

    • 摘要: 奶牛呼吸行为的智能检测对于奶牛疾病的自动诊断及奶牛精准养殖具有重要意义。该研究基于Lucas-Kanade稀疏光流算法,提出了一种适合于非结构化养殖环境的无接触式单目标奶牛呼吸行为检测方法。通过在HSV颜色空间完成奶牛目标的提取,然后通过Canny算子和掩模操作完成奶牛所有花斑边界的检测,再利用 Lucas-Kanade稀疏光流算法计算提取奶牛花斑边界光流,最后根据视频序列帧中花斑边界平均光流的方向变化规律实现奶牛呼吸行为的检测。为了验证本研究算法的有效性,利用不同环境下获取的105段共计25 200帧数据进行了测试,并与基于整体Lucas-Kanade光流法、整体Horn-Schunck光流法和基于花斑边界的Horn-Schunck光流法进行了对比验证。试验结果表明,该研究算法的帧处理耗时在0.10~0.13 s之间,在试验视频上的平均运行时间为14.14 s。奶牛呼吸行为检测的准确率为83.33%~100%之间,平均准确率为98.58%。平均运行时间较基于整体Lucas-Kanade光流法的呼吸行为检测方法慢1.60 s,较Horn-Schunck整体光流的呼吸行为检测方法快7.30 s,较基于花斑边界的Horn-Schunck光流法快9.07 s。呼吸行为检测的平均准确率分别高于3种方法1.91、2.36、1.26个百分点。研究结果表明,通过Lucas-Kanade光流法检测奶牛花斑边界平均光流方向变化实现奶牛呼吸行为检测是可行的,该研究可为奶牛热应激行为的自动监测及其他与呼吸相关疾病的远程诊断提供参考。

       

      Abstract: 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.07 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.

       

    /

    返回文章
    返回