Computer Vision for detection and tracking of circles

The tracking of objects in a video is a common goal in computer vision. Some methods rely on the search of keypoints, which are then matched with keypoints on the next frames.

In this post we will explain a method based on the identification of simple shaped objects, in particular circles, to track them in a robust manner (i.e. despite the movement or change of size) for all the frames in video where the object appears. In addition, the method allows the tracking of more than one circle simultaneously (multi-tracking).

The case of study is a static scene and a moving camera, but a similar method could be designed for static camera and moving objects. This method is divided in two parts: first the identification of circles and then the tracking.

Circle detection by computer vision

The circles are searched frame by frame, without any knowledge about circles detected in previous images. There can be more than one circular object in the same frame, so the circle detector must be able to return several circles, if that is the case. Therefore, each frame provides a set of candidates of being a circular object in the image.

The frame is first processed so that circular shapes can be easily found. The most important step in pre-processing is to obtain the borders of the objects. From those borders, circles are searched and only the best are returned.

At this point, some circles could not belong to circular objects, so a post-processing is also needed. Circles may be filtered according to our previous knowledge about the objects, for example by setting a bound on accepted radius or positions. We can also check if circles are crossing between them, or whether they are too close or too far one from another.

Computer Vision Based Circle Detection - Gray
Computer Vision Based Circle Detection - Sobel
Computer Vision Based Circle Detection
Grayscale image, edges and circles detected (red). The blue and green circles are the tracks.

For this part, as important is to detect the circles when they appear in image as not detecting when there are no circular objects. Therefore, only the best circles, if any good, are returned for the tracking part.

(Multi) tracking of circles

The goal of multi-tracking is to estimate the position (center) and size (radius) of circles along all the frames where the object is visible, simultaneously for all the objects. This estimation must be computed even if there is no circle detected for one object in one frame (or several consecutive frames).

For those cases when a detection is missing, a dynamical model has been developed for prediction of size and position of circles in consecutive frames, by knowing the movement of the camera (in the case of static scenes).

As long as new circles are detected as object candidates, they are either discarded, linked to a current tracked object or starting their own new track. The tracking has been shown to be robust against wrong circle detections.

Circles are discarded if they are not similar or different enough from tracked objects. A circle is set as a new observation of one object if it is similar enough to the prediction for that object.

Finally, a new object is detected if the detected circle is different enough from any predicted circle for all the current tracks.

After some of the tracked objects have been linked to a detected circle, the state of tracked objects is estimated. This is done frame by frame, combining the information provided by the prediction model and the circle observed, resulting in a smooth and complete knowledge for the object position and size along all the frames.

Conclusions

This method provides an accurate estimation of several circular objects simultaneously, computing an measurement of size and position for all the frames, even if circles are not always detected. It is robust against the change of size and position of the objects, and can be extended to similar methods involving other shapes and scenes.

 

We hope this article has been useful to you. If you have an engineering project in your hands and you think we can help you, here is the link where you can contact us and explain more about it.