# rameau-fr/mc-calib architecture

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

- Interactive diagram: https://gitdiagram.com/rameau-fr/mc-calib
- Repository: https://github.com/rameau-fr/mc-calib

## Overview

##### Main Components
- Calibration Core: Represented by the C++ library in the “McCalib” folder. This includes header and source files that define classes for boards, cameras, graphs, and 3D objects. Emphasize that the calibration algorithms rely on external libraries such as Ceres, OpenCV, and Boost.
- Applications: There are two main apps:
- “calibrate” (in apps/calibrate): Uses the calibration core to process image sequences and perform calibration.
- “create_charuco_boards” (in apps/create_charuco_boards): Generates Charuco board images.
- Configuration & Data Management:
- “configs” contains YAML configuration files that set up calibration parameters (camera properties, board details, image paths, etc.).
- “data” is used to store calibration images.
- Post-Calibration Analysis: The “python_utils” directory includes Python scripts for analyzing the results (computing errors, visualizing camera/object poses, etc.).
- Testing & Documentation: The “tests” folder includes unit and integration testing, while “docs” contains various documentation resources (Docker, contribution guides, and Doxygen documentation).
- Deployment & Container Support: Docker-related files (.dockerignore, Dockerfile, GitHub workflows) indicate that containerized builds and deployments are supported.

##### Relationships and Data Flow
- Detect calibration boards,
- Compute camera intrinsics & extrinsics,
- Validate correspondence of 2D–3D points.
- Output Flow: The outputs (calibrated cameras, object 3D structure, poses, and reprojection error logs in YAML format) are produced and then optionally passed to Python utilities for post-calibration analysis.
- Build and Deployment: Show the build process using CMake (from CMakeLists.txt at the root and in subdirectories) and Docker container deployment. Represent the CI/CD pipeline node linked from the .github/workflows directory.

##### Architectural Patterns and Design Principles
- Layer Separation: Separate the system into logical layers:
- Application Layer (apps and Python utilities),
- Core Calibration Library (McCalib),
- Data/Configuration Input,
- Testing/Documentation/Deployment.
- Modular Design: The clear separation into directories (core library, dedicated apps, python scripts, tests) signifies a modular architecture. Indicate modularity by grouping related files.

##### Relevant Technologies & Frameworks
- C++17 is used for the main codebase (observed from CMakeLists.txt and code structure).
- External libraries include Ceres (for non-linear optimization), OpenCV (for image processing), and Boost.
- Docker is used for containerized development and production deployment.
- Python utilities use libraries (likely NumPy, OpenCV-Python) for statistical post-analysis.
- GitHub Actions are used for CI based on the workflows described.

##### Essential Elements
- Each component should be clearly labeled (e.g., “Calibration Core,” “Calibrate App,” “Charuco Board Generator,” “Configuration,” “Data,” “Python Analysis,” “CI/CD Pipeline,” “Documentation & Tests”).
- Configuration & Data inputs → Applications → Core Processing → Output Files.
- Output Files → Python Utilities Analysis.
- Build/CI pipeline (from repository and Docker environment) → Deployment.
- Rectangles for applications,
- Clouds for external services (Docker, CI/CD).

- To the main processing module (“Calibration Core”) and then branch out into the dedicated apps (calibrate, board generator).
- Supporting infrastructure (build system, containerization, testing workflows) on a side channel.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Input Layer
    subgraph "Input Layer"
        CONFIG["Configuration Files"]:::input
        DATA["Calibration Image Data"]:::input
    end

    %% Application Layer
    subgraph "Application Layer"
        CALIBRATE["Calibrate Application"]:::app
        BOARDGEN["Charuco Board Generator"]:::app
    end

    %% Core Processing Layer
    subgraph "Core Processing"
        CORE["Calibration Core"]:::core
        EXT["External Libraries (Ceres,OpenCV,Boost)"]:::external
    end

    %% Output & Analysis Layer
    subgraph "Output & Analysis"
        OUTPUT["Calibration Results (YAML,Camera_Params,etc.)"]:::output
        ANALYSIS["Post-Calibration Analysis"]:::util
    end

    %% Supporting Infrastructure
    subgraph "Supporting Infrastructure"
        BUILD["Build System (CMake)"]:::deploy
        CI["CI/CD Pipeline"]:::deploy
        DEPLOY["Deployment & Container Support"]:::deploy
        TESTING["Testing Module"]:::test
        DOCS["Documentation Resources"]:::docs
    end

    %% Data Flow Connections
    CONFIG -->|"feeds"| CALIBRATE
    DATA -->|"supplies"| CALIBRATE
    CONFIG -->|"feeds"| BOARDGEN
    DATA -->|"supplies"| BOARDGEN

    CALIBRATE -->|"calls"| CORE
    BOARDGEN -->|"calls"| CORE

    CORE -->|"utilizes"| EXT
    CORE -->|"produces"| OUTPUT

    OUTPUT -->|"analyzedBy"| ANALYSIS

    %% Supporting Infrastructure Connections
    CORE -->|"builtVia"| BUILD
    CALIBRATE --- TESTING
    BOARDGEN --- TESTING
    BUILD --> CI
    CI --> DEPLOY
    DOCS --- TESTING

    %% Click Events
    click CORE "https://github.com/rameau-fr/mc-calib/tree/master/McCalib/"
    click CALIBRATE "https://github.com/rameau-fr/mc-calib/blob/master/apps/calibrate/src/calibrate.cpp"
    click BOARDGEN "https://github.com/rameau-fr/mc-calib/blob/master/apps/create_charuco_boards/src/create_charuco_boards.cpp"
    click CONFIG "https://github.com/rameau-fr/mc-calib/tree/master/configs/"
    click DATA "https://github.com/rameau-fr/mc-calib/tree/master/data/"
    click ANALYSIS "https://github.com/rameau-fr/mc-calib/tree/master/python_utils/"
    click TESTING "https://github.com/rameau-fr/mc-calib/tree/master/tests/"
    click DOCS "https://github.com/rameau-fr/mc-calib/tree/master/docs/"
    click DEPLOY "https://github.com/rameau-fr/mc-calib/tree/master/Dockerfile"
    click CI "https://github.com/rameau-fr/mc-calib/tree/master/.github/workflows/"

    %% Styles
    classDef input fill:#ffe6cc,stroke:#d35400,stroke-width:2px;
    classDef app fill:#cce5ff,stroke:#445b6e,stroke-width:2px;
    classDef core fill:#a2d9ce,stroke:#1f618d,stroke-width:2px;
    classDef external fill:#d6dbdf,stroke:#566573,stroke-width:2px;
    classDef output fill:#f9e79f,stroke:#b7950b,stroke-width:2px;
    classDef util fill:#d5f5e3,stroke:#196f3d,stroke-width:2px;
    classDef test fill:#f9e79f,stroke:#b7950b,stroke-width:2px;
    classDef docs fill:#f0b27a,stroke:#873600,stroke-width:2px;
    classDef deploy fill:#fdebd0,stroke:#d35400,stroke-width:2px;
```
