Skip to content

Manav361/Ball_tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Task Overview

The goal of this assignment is to create a Computer Vision program to track the movement of balls of different colors across various quadrants in a provided video. The program records events of each ball entering and exiting numbered quadrants, with event data formatted as Time, Quadrant Number, Ball Colour, and Event Type (Entry or Exit). Timestamps are computed based on the video duration, considering the start of the video as 0 seconds.

Code Implementation

The Python script utilizes the OpenCV library for computer vision tasks. It detects squares and circles in the video frames, determines their color, and assigns them to specific quadrants. The resulting event data is recorded in the specified format and saved to a text file.

Dependencies

  • Python
  • OpenCV
  • NumPy

How to Run the Code

  1. Install the required dependencies:

    pip install opencv-python numpy
  2. Replace the video = cv2.VideoCapture('C:\Users\manav\OneDrive\Desktop\AI Assi\AI Assignment video.mp4') line in the code with the path to your downloaded video.

  3. Run the script, and it will process the video, creating a processed video with ball tracking and generating a text file with event records.

Output

Processed Video:

  • The video will display tracked balls with color labels. Entry and exit events are overlaid with a timestamp at the time of occurrence. Text File:

  • The output text file, named output.txt.txt, contains records in the specified format (Time, Quadrant Number, Ball Colour, Event Type).

Notes

  • The program considers the start of the video as time 0 seconds.
  • To use a different video, modify the video = cv2.VideoCapture('path_to_your_video.mp4') line in the code.

Contact

  • If you encounter any issues or have questions, please feel free to reach out for clarification.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages