The invention discloses an automatic tracking and dispensing method based on a
production line. The method comprises the following steps: firstly, a sensor or
image acquisition is triggered to capturean image of an incoming material; secondly, the contour and position of the incoming material are shot by at least one
image acquisition device; thirdly, a template and an image coordinate
system areestablished based on images of the incoming material, a product is matched by a
template matching method, an incoming material model is fitted in combination with
morphological analysis, the image coordinate
system is associated with an equipment motion coordinate
system by a five-point calibration method, and coordinates and angles of the incoming material are determined; fourthly, an actual starting point corresponding to a
machining track is determined based on the
machining track and coordinates and angle of the incoming material; fifthly, a dispensing device is displaced to the actual starting point, and the position of the incoming material at any time after
image capture and the running speed of the incoming material are judged by sensing; sixthly, the incoming material enters theactual starting point, and the dispensing device is controlled to move synchronously with the incoming material to perform dispensing; seventhly, the incoming material is glued, and a glue valve is cleaned to wait for the next incoming material.