Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/youssef-saaed/dsai_103_project
This project is designed to analyze football matches using computer vision techniques
https://github.com/youssef-saaed/dsai_103_project
football-analytics opencv
Last synced: 4 days ago
JSON representation
This project is designed to analyze football matches using computer vision techniques
- Host: GitHub
- URL: https://github.com/youssef-saaed/dsai_103_project
- Owner: youssef-saaed
- Created: 2023-05-28T12:20:36.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-06-01T17:34:22.000Z (8 months ago)
- Last Synced: 2024-06-01T21:00:14.062Z (8 months ago)
- Topics: football-analytics, opencv
- Language: Python
- Homepage:
- Size: 100 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Football Analysis Project
This project is designed to analyze football matches using computer vision techniques. The project is divided into three Python files: `funcs.py`, `libs.py`, and `main.py`.
## File Descriptions
1. **funcs.py**: This file contains all the functions used in the project. These functions include:
- `getFrames()`: Extracts frames from a video file and saves them in a specified location.
- `maskPlayers()`: Masks players in a frame based on their jersey color.
- `applyMask()`: Applies a mask to a frame.
- `joinImages()`: Joins two images side by side.
- `getNewBallPosition()`: Determines the new position of the ball.
- `detectBall()`: Detects the ball in the frames.
- `dist()`: Calculates the distance between two points.
- `getFirstFrameCenter()`: Determines the center of the first frame.
- `getRegion()`: Determines the region of the frame.2. **libs.py**: This file imports the required libraries for the project, which include `cv2`, `numpy`, and `os`.
3. **main.py**: This is the main file that uses the functions defined in `funcs.py` to perform the football analysis. It includes the extraction of frames, masking of players, detection of the ball, and region labeling.
## Usage
To use this project, run the `main.py` file. The program will display the frames with the masked players and the detected ball. Press the "q" key to move to the next frame. The program will automatically close the display window once all frames have been processed.
## Requirements
This project requires Python 3 and the following Python libraries installed:
- OpenCV
- NumPy## Note
Please ensure that the video file path and the target location for saving frames are correctly specified in the `getFrames()` function in `main.py`. The initial position of the ball and the ball size should also be accurately provided in the `detectBall()` function.
This project is intended for educational purposes only and is not suitable for real-time football match analysis. The accuracy of the player masking and ball detection may vary depending on the quality of the video and the color of the players' jerseys and the ball.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.