Aiming at the slow movement and small displacement of dairy cows in the pasture breeding process, but the target scale changes significantly, a SURF-KCF dairy cow teat tracking algorithm is proposed. The original KCF algorithm needs to locate the target before tracking, and the tracking frame cannot be adaptive with the scale of the target. The SURF feature detection is introduced to provide target features for the KCF algorithm to achieve automatic target matching; and the scale estimation strategy is used to achieve scale adaption of cow teat targets. The experimental results show that the proposed improved algorithm achieves cow teat target matching and localization as well as scale adaption of the target area, and long-term stable tracking. Finally, in the laboratory environment, the improved algorithm is applied to the three-degree-of-freedom robotic arm automatic milking robot to realize the cow teat positioning and tracking experiment. When the cow's teat is detected, the robotic arm can automatically move to the position of the cow's teat. Good results have been obtained after testing, which shows the feasibility and effectiveness of the cow teat positioning system.