Camlytics use case: measure vehicle speed
Such powerful video events sources, as Lines and Zones allow a lot of custom data manipulations. Every single analytical event that comes from any video source - IP camera, webcam, NVR, video file or video folder, has a lot of properties - source ID, timestamp, video file time, object ID, origin, channel ID, type and others. This data can be used to find links between different scene events. For instance, you can detect speed based on two lines in your scene.
Step 1 - Add 2 lines
Add any video source where you want to detect speed. Make sure you calibrate it properly so that all moving objects are detected correctly and in time. Place two lines one after another so that they cover the full vehicle travel distance. The bigger the distance the better. Make sure that moving vehicles are always detected and both lines generate events on each vehicle.
See how it looks in action, you'll be able to detect the speed for two vehicles in the following video:
Step 2 - Measure distance between the lines
Measure the real distance between those lines. The bigger the distance the more precise the speed calculation will be. The distance is 18 meters in our case.
Step 3 - Calculate speed
As vehicles travel through two lines, every vehicle will have the same object ID for both events generated by those lines. That is how they can be matched. In our example there are two events with object ID = 1 and the timestamps are 5.024s and 6.458s. The timestamp delta = 6.458 - 5.024 = 1.434s. Knowing the delta and the distance between lines we can calculate the speed = distance / timestamp delta = 18 / 1.434 ~ 12.55 m/s = 45.18 km/h
Therefore, the vehicle traveled with the speed of approximately 45 km/h. The whole speed detection process can be automated by collecting all Line crossed events, exporting them into .csv file and then using our calculator below. Make sure that you have 2 or more lines configured in your scene.
You can find the same calculator on a separate page for your convenience.
If you have a pre-recorded video footage or you have a regular traffic IP camera and you need speed detection ASAP, Camlytics is a very simple and a very budget solution. You can even use cameras with broken perspective to detect vehicle speed, all you need to know is the distance between your lines (see the sample below).