Skip to content

3 Collision Detection

tasuarez edited this page Jul 18, 2019 · 6 revisions

Now that the tracking system can identify an object over different frames, we can add properties to the detected objects. Our final goal is to detect near misses on a street crossing, so we first need to be able to detect collisions.

Milestones:

· Detection of overlapping ROIs.

· Object trajectory.

· Velocity vector.

· Velocity gradient (acceleration).

· Identify different cases of collisions.

We use a single camera, in order to prevent a false collision detection, and use the area of the ROI. We assume that an object closer to the camera has a bigger ROI. This means that if the ROIs areas are too different in size, there is no collision between the 2 objects.

To add a second verification, we will use the velocity gradient. A collision between 2 objects typically implies a major variation on the trajectory and the velocity of at least one of the objects.

Detection of overlapping ROIs

This is a nice feature to have in order to filter out collisions of objects that are not on the same plane.

Object trajectory

In order to calculate the object trajectory, we first assume the object position as the center of its bounding box. We accumulate positions of previous frames and then find the average in order to filter small detection movements.

Velocity vector

With the average position we calculate the instant speed. Taking into account that our time unit is a frame, we calculate the speed as the difference of position of the object measured in two consecutive frames. We also average that speed in order to get a smooth representation. This is because our main goal is to measure acceleration.

We need to point out that the speed vector measured with the previous method introduced an error due to the perception of the camera. For example, a car that is going a constant speed towards the camera, is going to move more pixels when it is near the camera. This means that the speed is not constantly measured in pixel/frames, and the acceleration is not 0. To correct this we are normalizing the position_y value with the 1/y factor.

Acceleration vector

With the normalized speed we calculate the acceleration as the difference of velocities measured in two consecutive frames.

Collisions

We consider that a vehicle is in a dangerous situation when there is a jump in acceleration. We define this jump as the difference between the current frame acceleration and the average of the previous three. We then determine if this difference is bigger than an arbitrary and empirical defined value and then consider it for a possible collision. Finally, if the ROI of an object marked in a dangerous situation overlaps with any other ROI, we consider it a near-miss. If the other object is also marked, we consider it a collision.

As an example of our analysis we can see the van’s speed and acceleration in the following image and identify the peaks in acceleration. The evolution of the speed matches the behavior of the van. It appears in the scene going downwards at a constant speed before crashing with the other car, then it brakes, slows down, and finally a sudden increase in speed occurs when the crash happens.

graph