# me-sarvar/opencv architecture

> Architecture diagram of the GitHub repository me-sarvar/opencv, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/me-sarvar/opencv
- Repository: https://github.com/me-sarvar/opencv

## Overview

##### Project type and purpose
- This is a local, Python-based gesture‐recognition application. It uses OpenCV and MediaPipe to capture hand landmarks, collects gesture data, trains an LSTM model with TensorFlow/Keras, and then runs a real-time inference loop to recognize one of five predefined gestures via webcam.

##### File structure
- Top-level files
- .gitignore – ignore rules
- README.md – project overview
- requirements.txt – Python dependencies
- `python/` directory: contains the three main scripts
- data_collect.py – data‐acquisition component
- model_train.py – model‐training pipeline
- main.py / new_main.py – real‐time inference loop
- Implicit output directories (created at runtime):
- data_set/ – raw gesture feature sequences
- models/   – saved LSTM model artifacts

##### README for additional insights
- Describes five target words (`words` array) mapped to hand gestures
- Outlines three phases: data collection, model training, and real-time recognition
- Highlights ability to customize model architecture and gestures

##### Detail
- Include:
- Exact script names and paths
- Data formats (e.g., hand‐landmark CSV or NumPy arrays)
- Model file format (e.g., .h5)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Hardware
    Webcam["Webcam"]:::hardware

    %% Data Collection Phase
    subgraph "Data Collection Phase"
        DataCollector["Data Collection Module\ndata_collect.py"]:::process
        DataSet["data_set/\nRaw Landmark Sequences"]:::storage
    end

    %% Model Training Phase
    subgraph "Model Training Phase"
        ModelTrainer["Model Training Module\nmodel_train.py"]:::process
        ModelStore["models/\nSaved LSTM Model (.h5)"]:::storage
    end

    %% Inference Phase
    subgraph "Inference Phase"
        InferenceEngine["Inference Module\n(main.py / new_main.py)"]:::process
        UI["OpenCV Display Window"]:::ui
    end

    %% Config and Docs
    Requirements["requirements.txt"]:::config
    README["README.md"]:::config
    Gitignore[".gitignore"]:::config

    %% Data Flow
    Webcam --> DataCollector
    DataCollector --> DataSet
    DataSet --> ModelTrainer
    ModelTrainer --> ModelStore
    Webcam --> InferenceEngine
    ModelStore --> InferenceEngine
    InferenceEngine --> UI

    %% Dependencies
    Requirements -.-> DataCollector
    Requirements -.-> ModelTrainer
    Requirements -.-> InferenceEngine
    README -.-> DataCollector
    README -.-> ModelTrainer
    README -.-> InferenceEngine
    Gitignore -.-> Requirements

    %% Click Events
    click DataCollector "https://github.com/me-sarvar/opencv/blob/main/python/data_collect.py"
    click ModelTrainer "https://github.com/me-sarvar/opencv/blob/main/python/model_train.py"
    click InferenceEngine "https://github.com/me-sarvar/opencv/blob/main/python/main.py"
    click InferenceEngine "https://github.com/me-sarvar/opencv/blob/main/python/new_main.py"
    click Requirements "https://github.com/me-sarvar/opencv/blob/main/requirements.txt"
    click README "https://github.com/me-sarvar/opencv/blob/main/README.md"
    click Gitignore "https://github.com/me-sarvar/opencv/blob/main/.gitignore"

    %% Styles
    classDef hardware fill:#ADD8E6,stroke:#000
    classDef process fill:#98FB98,stroke:#000
    classDef storage fill:#FFFF99,stroke:#000
    classDef ui fill:#FFA500,stroke:#000
    classDef config fill:#D3D3D3,stroke:#000
```
