The Traffic Camera Distracted Driver Detection (TCD3) uses several Computer Vision techniques to detect cars that are on the road.
The first step of the process is to convert video into individual frames, allowing Computer Vision methods to be used on the footage. An image is a stack of matrices; one for each of the three colors, red, green, and blue, RGB.
The first method to separate the cars from the background is to utilize Background Subtraction. To do this, multiple algorithms are used to develop an accurate model of the background. A median model is used to develop a background image by scanning 150 images. Multiple Gaussian and Gaussian Mixture Models are used, with different numbers of mixtures, to develop a model that is able to accurately represent the background. A Probability Density Function is used to analyze multiple pixels to also get a background model, albeit with a longer training period than the other methods.
Background subtraction is then performed, and run through multiple methods to clean the sensor readings to remove noise. The method, known as the Sliding Window Neighbor Detector, is a recursive algorithm that analyzes the density of sensor values to determine if an object is present. This method is significantly more accurate than running morphological operators in removing noise.
A second method to detect cars was devised to increase the accuracy of detect. Optical Flow Analysis was performed to quantify the movements in a frame. Analysis is then performed to find the areas of frames that are moving, therefore allowing the system to detect cars, which are usually the biggest moving objects in a frame. This system leverages the background subtraction based system by taking an entirely unique approach to detecting cars, thereby allowing the system to pickup cars who would otherwise have looked exactly like the background.
The objects that are then detected are run through a Canny Contour detector to get the center point of each car that is not on the border of the image and is fully visible. Thresholding is then performed to ensure that only objects large enought to be cars are detected.
The Computer Vision algorithms are multi-threaded for full system utilization of CPU.
These points are then transferred to the Tracking & Machine Learning portion of the system for anomaly detection.