# projetcomputervision/computervision architecture

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

- Interactive diagram: https://gitdiagram.com/projetcomputervision/computervision
- Repository: https://github.com/projetcomputervision/computervision

## Overview

##### Project type and purpose
- This is a research-oriented computer vision pipeline written in Python for extracting and analyzing object trajectories from video, with steps for camera calibration, homography, distortion evaluation, detection, tracking, and trajectory prediction (including gravitational adjustment).
- Key indicators: file names like Calibration.py, Homographie.py, detection_Videos.py, kalman.py, trajectoire_prediction.py, and sample videos under Videos_Detection.

##### File structure
- Top level scripts:
- AjoutGravite.py – applies gravity correction to computed trajectories
- Calibration.py – performs camera calibration
- Homographie.py – computes homography transform
- EvaluationDisortion.py – measures and evaluates lens distortion
- detection_Videos.py, Videos_Detection_3.py, Videos_Homographie.py – video-based object detection
- kalman.py – implements a Kalman filter for tracking
- trajectoire_prediction.py – predicts future positions
- Trajectoire_v3.py / Trajectoire_v4.py – trajectory computation pipelines
- Data/ folder: stored calibration and homography data (homography_data.npz)
- Videos_Detection/ folder: sample input/output videos showing detection masks and tracking
- Scripts_Secours/: backup scripts for calibration
- README.md and TODO.md: high-level project notes and next steps

##### README
- Contains minimal info (“Computer Vision – Test du git”), so rely on file names to deduce architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Input Data Layer"
        VS["Video Sources"]:::data
        CD["Precomputed Calibration Data (.npz)"]:::data
    end

    %% Preprocessing Stage
    subgraph "Preprocessing Stage"
        CAL["Camera Calibration"]:::preprocessing
        CALB["Calibration Backup"]:::preprocessing
        DIST["Distortion Evaluation"]:::preprocessing
        HOMO["Homography Computation"]:::preprocessing
    end

    %% Detection Stage
    subgraph "Detection & Masking Stage"
        DET["Primary Detection"]:::detection
        DETA["Alternate Detection"]:::detection
        DETH["Homography-based Detection"]:::detection
    end

    %% Tracking Stage
    subgraph "Tracking Stage"
        KAL["Kalman Filter"]:::tracking
    end

    %% Analysis Stage
    subgraph "Trajectory Analysis & Prediction Stage"
        TV3["Trajectory Computation v3"]:::analysis
        TV4["Trajectory Computation v4"]:::analysis
        GRAV["Gravity Adjustment"]:::analysis
        PRED["Future Trajectory Prediction"]:::analysis
    end

    %% Visualization Stage
    subgraph "Visualization / Output Stage"
        OUT["Annotated Output Videos"]:::data
    end

    %% Data Flow
    VS -->|"Raw Video Frames"| CAL
    CD -->|"Calibration Data"| CAL
    CAL -->|"Undistorted Frames"| DIST
    DIST -->|"Distortion Metrics"| HOMO
    HOMO -->|"Bird’s-eye Frames"| DET
    DET -->|"Masks & Coordinates"| KAL
    DETA -->|"Masks & Coordinates"| KAL
    DETH -->|"Masks & Coordinates"| KAL
    KAL -->|"Smoothed Trajectories"| TV3
    KAL -->|"Smoothed Trajectories"| TV4
    TV3 -->|"Computed Trajectories"| GRAV
    TV4 -->|"Computed Trajectories"| GRAV
    GRAV -->|"Gravity-Corrected Trajectories"| PRED
    PRED -->|"Future Trajectory Points"| OUT

    %% Click Events
    click VS "https://github.com/projetcomputervision/computervision/tree/main/Videos_Detection/"
    click CD "https://github.com/projetcomputervision/computervision/blob/main/Data/homography_data.npz"
    click CAL "https://github.com/projetcomputervision/computervision/blob/main/Calibration.py"
    click CALB "https://github.com/projetcomputervision/computervision/blob/main/Scripts_Secours/Calibration_Secours.py"
    click DIST "https://github.com/projetcomputervision/computervision/blob/main/EvaluationDisortion.py"
    click HOMO "https://github.com/projetcomputervision/computervision/blob/main/Homographie.py"
    click DET "https://github.com/projetcomputervision/computervision/blob/main/detection_Videos.py"
    click DETA "https://github.com/projetcomputervision/computervision/blob/main/Videos_Detection_3.py"
    click DETH "https://github.com/projetcomputervision/computervision/blob/main/Videos_Homographie.py"
    click KAL "https://github.com/projetcomputervision/computervision/blob/main/kalman.py"
    click TV3 "https://github.com/projetcomputervision/computervision/blob/main/Trajectoire_v3.py"
    click TV4 "https://github.com/projetcomputervision/computervision/blob/main/Trajectoire_v4.py"
    click GRAV "https://github.com/projetcomputervision/computervision/blob/main/AjoutGravite.py"
    click PRED "https://github.com/projetcomputervision/computervision/blob/main/trajectoire_prediction.py"
    click OUT "https://github.com/projetcomputervision/computervision/tree/main/Videos_Detection/"

    %% Styles
    classDef preprocessing fill:#bbdefb,stroke:#1e88e5,color:#000;
    classDef detection fill:#ffcc80,stroke:#fb8c00,color:#000;
    classDef tracking fill:#c8e6c9,stroke:#43a047,color:#000;
    classDef analysis fill:#e1bee7,stroke:#8e24aa,color:#000;
    classDef data fill:#eeeeee,stroke:#9e9e9e,color:#000;
```
