Speed of the moving object can be calculated from the images taken from it. The most important phase in this is the detection of the repeating object in the subsequent images. Object tracking is done by Lucas-Kanade Algorithm, which is widely used differential method. By combining information from several nearby pixels, the Lucas-Kanade Algorithm can often resolve the ambiguities of the optical flow. The Lucas-Kanade Algorithm is implemented in the using OpenCV, a library of programming functions mainly aimed at real time computer vision. From the tracked object from the subsequent images the pixel difference is calculated. This measurement converted into meter. With the known value of the time interval between the subsequent images the velocity is calculated.
This project can be split into four phases. They are
- Detection of Objects
- Tracking of Objects
- Calculating Speed
- Capturing Object's Picture
Success of this project depends upon the accurate detection of moving object in the video stream. But object detection is a very difficult task. At first, Speed Detection Camera System (SDCS) will segregate video streams into moving and background components. By detecting moving blobs, recognition and analysis of objects in the frame becomes more efficient. In this project, we try to establish a similarity between objects or object parts in consecutive frames. Speed, trajectory and direction of the objects also can be extracted from the frame. By tracking objects, temporal information about objects are extracted and high level behavior analysis is conducted.
By using adaptive background subtraction and three frame difference algorithm moving objects are detected. Here stationary objects when moves, a hole is made in place of original position. Motion Matrix, masked subtraction and Generation of new background Threshold matrix is used to overcome the problems created by holes in background subtraction.
Object segmentation, labeling and Object center extraction are three phases involved in object tracking. In segmentation, we assume that the objects are connected as one part. Labeling of the detected object in the frame from the moment it enters the scene to the moment it leaves constitutes the second part. Next part is finding the center of the object.
By recording the frame number of object entering frame and object leaving frame, we can find the number of frames in between those two. Since we know the duration of each frame, speed of the object can be easily calculated.
Capturing Object's Picture
To capture an object with good resolution in a picture, wait for the object to be at the center of the scene.