Object tracking is the method used to estimate the time and location of one or more moving objects captured by a digital camera. The idea is to keep track of an object from on several consecutive frames, this may become difficult if the object is moving fast in relation to the frame rate of the camera. The initial purpose of the project was to measure the customers interests towards an advertising by using the OpenCV library. But during the development we found other possibles applications for this technique.
The first attempt was to identify objects based on a color pattern, but this approach was limited because we could only could find objects of a single color. Then we tried others techniques based on feature recognition like SURF, SIFT, edge recognition, but this was not efficient in terms of cpu usage. This also didn’t fit our needs because we wanted to track almost all the objects rather than recognize specific patterns.
To accomplish our goal, we not only needed a library for object recognition, we also needed to counting and tracking the objects in a timeline.
We used a technique called background subtraction which consists of identifying an object through a background pattern made of several images in which all the captured frames are then compared to this background pattern in order to create a black image and the object is highlighted in white.
The main limitation of this technique is the sensibility to environmental factors like natural light. In the case where an images is affected by clouds or movement, the image must be readapted in order to detect the object.
For background subtraction there are several algorithms like Kernet, MOG among many others, but we used the CodeBoock algorithm because it is part of the OpenCV library and it was the most efficient on the tests.This algorithm consists of on keeping an specific number of frames in order to create the background pattern to compare them with the incoming frames. The result of this comparison generates a back and white image where the object is well delimited in white color. With this black and white image the object recognition is made. In our case we used cvblob library, this library is used to recognize and identify the objects. This technique is also known as labeling.
Once the recognition of the object is done, the identification and following of each object must be performed, this means, ensure if the object is the same from one frame to the other.
In order to determine this, we need to calculate the ratio of the center of the object regarding the position and the size variation of the object from the following frame.
Finally, we extended the library to determine the objects that cross in front of the camera. This can be configured in the library by defining a line in the capture. So every time that an object crosses this line in any direction, a counter may be increased. Considering the direction of the object regarding the line, a different counter will be increased.
All the configurations of the library are made by xml files, some of these parameters are, the resolution of the capture, the frame rate, the variations of size and movement, minimal size of the objects, etc.
The library may have several uses like capturing the human interaction in an environment and getting statistical information like marketing data, like the capture of customer habits patterns in stores, security and surveillance, traffic control among many other uses.by