This snap uses a MobileNet SSD network to detect vehicles in a video stream, and then tracks them using the CSRT tracker algorithm implemented on OpenCV. The distance from the camera to the vehicles is then estimated by a simple formula using the bounding box for the vehicle and the camera's focal distance. The later is hard-coded in the code, so do not expect anything accurate: it is more of an example application.

The program is able to track multiple vehicles while still running the neural network for detections on the stream. Extensive multi-threading is used to accomplish this while at the same time trying to be as real-time as possible. This means that the trackers are fed with the latest available frames and some times older frames are not processed.

Sources can be found at

Get it from the Snap Store

Search for another snap, or go back to the homepage.