General Principle

The general principle of how this method works is as follows:
In order to identify (moving) objects in a scene you need to separate the background (the scene) from foreground (the objects) from a given footage.
Basically, if you take a picture of an empty space, you have your background image. But it isn't as simple as that:
1. For that a space has to be empty at a given moment in the first place. And that could turn out to be a hassle.
2. But more importantly, a space could change over time and these chances need to be taken into account. Changes like: lighting or shadows. The smallest changes can affect the rest of the detection algorithm.

So the first step was to program a background adapting algorithm that could identify what the background and could adapt that image if the scene changed over time.
The way I resolved this problem is explained here.

Getting the moving objects out of the frame is then relatively easy, you simply subtract the live feed from the background image, getting the next results:


A frame of the live feed


A frame of the adapting background image


The difference image from the live feed and the background image

The darker the color, the less difference there is with the live feed and the background image. By setting a ‘difference-margin’ you can more clearly show which pixels are different (white) and witch are not (black). Seen here below.


The black and white difference image

As seen in the black and white image above there is still a lot of noise in the image. By writing a noise reduction algorithm I finally got rid of most of the noise in the image. The noise reduction algorithm is explained here.


Noise reduced

If the data is as clean as it gets, it’s time to move forward to the next step: the blob detection. There are several blob detection libraries available for processing and I’ve tested two of them. The blob detection algorithm from JMyron and from V3GA. I ended up with the one of V3GA. I explained why in the process of the project.

With the data from the blob detection library the blobs can be tracked using a tracking algorithm.
The track algorithm loops through each found blob and checks if it suffices with a track it has already identified. If not, it creates a new track starting with that new found blob.
The track has a confirmation level it has to require first before it is fully displayed on the screen. This prohibits noise of becoming a track.


Starting tracks


More tracks later on