Inspiration

We were inspired by "Video Assisted Referee" systems in soccer games . We wanted to see if we could make an automatic system that finds the rightmost defender in the field to make checking for offsides more convenient.

What it does

Our program takes in an input video and displays an output video showing a clear line where the offside would happen

How we built it

Using OpenCV and Python, we first projected the field to a top-down view. Then we isolated the players from the field by using a color mask and utilized the findContours method to retrieve the player locations in that mask. After finding the location the rightmost player was standing, we drew a vertical line on the top-down projection, and found the corresponding line on the original image.

Challenges we ran into

We initially had the problem of not being able to find the rightmost player, so to solve this we made a transformation matrix projecting the field to a top-down view, and found the rightmost player in that transformed video. However getting the line passing through the rightmost player on the original video was fairly tricky to get right. After many iterations of random-looking lines, we were able to get a clean line that was parallel to the field.

Accomplishments that we're proud of

We are proud of the way the video output looks, as well as how good the player detection is given the simple algorithm we are using to do so.

What we learned

Over the course of this project we learned a lot about applications of matrix transformations and projections, as well as general OpenCV knowledge.

What's next

Ideally we want to be able to run this program with more dynamic camera angles as currently the transform only works from a certain perspective. It also might be better to use an AI based approach to find the player locations rather than a pure color mask as players with green jerseys may not be able to be properly detected. Another thing we would like to do is make this a website where you can upload videos to have them analyzed rather than just a shell command.

Built With

Share this project:

Updates