# i-pranjalmishra/drs_system-python architecture

> Architecture diagram of the GitHub repository i-pranjalmishra/drs_system-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/i-pranjalmishra/drs_system-python
- Repository: https://github.com/i-pranjalmishra/drs_system-python

## Overview

##### Project type and purpose
- This is a standalone Python desktop application that simulates the cricket Decision Review System (DRS).
- It provides a GUI for loading and playing back cricket video clips, capturing frames, running computer‐vision routines on those frames, and letting the user “challenge” umpire decisions.

##### File structure
- Top-level:
- main.py – the single Python entrypoint.
- README.md – project overview.
- Images/video.mp4 – sample video resource.
- No submodules or multiple services; the entire app lives in main.py and uses external libraries (tkinter, cv2, imutils, threading).

##### Extract key functionality from the README
- GUI controls for: loading video clips, adjusting playback speed, frame capture.
- Computer-vision processing on captured frames.
- Threaded playback vs. UI event loop to keep the interface responsive.

##### Main components
a. GUI Layer (tkinter)
– Video control panel: load, play, pause, speed controls
– Frame display canvas
– Decision buttons (Out / Not Out)
b. Video Input & Playback Module
– File loader (opens video.mp4 or user‐selected clips)
– Playback controller (seeks frames at different speeds)
c. Frame Capture & Storage
– Grabs and stores specific frames on user command
d. CV & Image-Processing Module
– Uses cv2 + imutils for frame analysis (e.g., edge detection, ball tracking)
e. Decision Logic Module
– Applies processed data to decide “Out” or “Not Out”
f. Threading Manager
– Runs video playback in a background thread to avoid blocking the tkinter mainloop

##### Relationships and data flow
- The GUI Layer sends user actions to the Video Input & Playback Module.
- Playback Module requests frames from the video resource and feeds them to the Frame Display Canvas.
- When the user captures a frame, that frame is handed off to the CV & Image-Processing Module.
- Processed results flow into the Decision Logic Module, which updates the GUI (e.g., shows “Out”).
- The Threading Manager underlies the Playback Module and CV Module to keep long-running tasks off the main GUI thread.

##### Architectural patterns and design principles
- MVC-style separation:
– Model: video frames + processed data
– View: tkinter GUI components
– Controller: user events, playback controls
- Asynchronous processing: all CV/IO in background threads
- Single-entry script with clear module boundaries within main.py

##### Technologies & libraries
- Python 3.x
- tkinter for UI
- OpenCV (cv2) + imutils for image processing
- threading module for concurrency
- time for playback timing

## Diagram (Mermaid)

```mermaid
flowchart TD
    GUI["GUI Layer\n(tkinter)"]:::ui
    VideoLoader["Video Input & Playback Module"]:::processing
    FrameBuffer["Frame Capture & Storage Module"]:::storage
    CV["CV & Image-Processing Module"]:::processing
    Decision["Decision Logic Module"]:::processing
    Threading["Threading Manager"]:::concurrency
    VideoFile["Sample Video Resource\n(video.mp4)"]:::external
    README["Project Overview\nDocumentation"]:::external

    GUI -->|"load/play commands"| VideoLoader
    VideoLoader -->|"read frames"| FrameBuffer
    FrameBuffer -->|"captured frame"| CV
    CV -->|"processed data"| Decision
    Decision -->|"update result"| GUI
    VideoFile -->|"video input"| VideoLoader

    Threading -.-> VideoLoader
    Threading -.-> CV

    README

    click GUI "https://github.com/i-pranjalmishra/drs_system-python/blob/master/main.py"
    click VideoLoader "https://github.com/i-pranjalmishra/drs_system-python/blob/master/main.py"
    click FrameBuffer "https://github.com/i-pranjalmishra/drs_system-python/blob/master/main.py"
    click CV "https://github.com/i-pranjalmishra/drs_system-python/blob/master/main.py"
    click Decision "https://github.com/i-pranjalmishra/drs_system-python/blob/master/main.py"
    click Threading "https://github.com/i-pranjalmishra/drs_system-python/blob/master/main.py"
    click VideoFile "https://github.com/i-pranjalmishra/drs_system-python/blob/master/Images/video.mp4"
    click README "https://github.com/i-pranjalmishra/drs_system-python/blob/master/README.md"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef processing fill:#90EE90,stroke:#000,stroke-width:1px
    classDef concurrency fill:#FFA500,stroke:#000,stroke-width:1px
    classDef storage fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
```
