Click here to Skip to main content
15,171,053 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need your help,and sorry about my poor English.

I using YOLOv4 to get detection object.
yolov4 can get object like cars, motorcycles, buses, etc.
and I want to using the result to check if car accident happen.

my perspective:
i think can check the all object in image
and try to detect whether two objects overlap.
And start to calculate the time at the same time.
If the two objects overlap for more than a period of time, it is judged as a car accident.

Describe the problem:
does anyone know how to check if the multiple if overlap each other
i try to using that in C#

What I have tried:

for (int i = 0; i < itemRectCar.Count - 1; i++)
  if (itemRectCar[i].IntersectsWith(itemRectCar[i + 1]))
      rectangle3 = Rectangle.Intersect(itemRectCar[i], itemRectCar[i + 1]);
      itemRectCar[i].Intersect(itemRectCar[i + 1]);
      if (!itemRectCar[i].IsEmpty)
          graphics.DrawRectangle(penRed, rectangle3);

but this method only can work in a image can't be work in video
I need someone to inspire me.
thank you read my problem,hope you have a nice day
Gerry Schmitz 27-Jun-21 22:27pm
If a "road space" that usually has "moving" objects comes to a standstill over some threshold duration, you can probably assume an accident / incident, and any object that didn't arrive later and is not now moving is probably involved. Only in "slow" collisions you might find "overlap"; at higher speeds, vehicles can wind up very far apart.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900