# laxnpander/openrealm architecture

> Architecture diagram of the GitHub repository laxnpander/openrealm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/laxnpander/openrealm
- Repository: https://github.com/laxnpander/openrealm

## Overview

##### Project Type and Core Components
The system is a modular C++ framework for real-time aerial mapping with the following main components:

a. Core Modules:
- realm_core: Foundation library with basic data structures and utilities
- realm_densifier: Dense reconstruction module
- realm_io: Input/output operations module
- realm_ortho: Orthographic projection and mapping
- realm_stages: Processing pipeline stages
- realm_vslam: Visual SLAM integration

##### Key Architectural Elements

a. Pipeline Stages (Processing Flow):
**Input -> Pose Estimation -> Dense Reconstruction -> Surface Generation -> Ortho-Rectification -> Mosaicing -> Output**

b. Major Components:
- Visual SLAM System (Multiple implementations: OpenVSLAM, ORB-SLAM)
- Dense Reconstruction Engine (PSL for CUDA-enabled systems)
- Mapping Components (2D/2.5D map generation)
- I/O Systems (EXIF, GDAL, OpenCV)

- Input Layer                                          |
- (Image Data, GNSS, IMU)                                                                |

- ↓

- Core Processing Layer                                     |

- Visual SLAM    |  | Densification  |  | Surface        |  | Ortho-         |         |
- (realm_vslam)  |→ | (realm_densif.)|→ | Generation     |→ | Rectification  |         |

- ↓

- Output Layer                                             |
- (2D Maps, 2.5D Elevation Maps, Multiple UAV Integration)                               |

##### Important Details

a. Component Interactions:
- Parallel processing capabilities
- Optional components (e.g., CUDA-based PSL)

b. External Dependencies:
- OpenCV
- CUDA (optional)
- GDAL
- Eigen3
- ROS (as transport layer)

- Core Components (Blue)
- Optional Features (Yellow)
- External Dependencies (Gray)

##### Implementation Notes

- Modular architecture allowing different SLAM implementations
- Pipeline stage independence
- Optional 2D/2.5D mapping capabilities
- Multi-UAV support
- Real-time processing flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        IS[Input Sources]:::input
    end

    subgraph Core["Core Layer"]
        RC[realm_core]:::core
        click RC "https://github.com/laxnpander/OpenREALM/tree/master/modules/realm_core/"
        
        subgraph CVGridMap["CVGridMap Component"]
            direction TB
            CVGH[cv_grid_map.h]:::file
            click CVGH "https://github.com/laxnpander/OpenREALM/blob/master/modules/realm_core/include/realm_core/cv_grid_map.h"
            CVGC[cv_grid_map.cpp]:::file
            click CVGC "https://github.com/laxnpander/OpenREALM/blob/master/modules/realm_core/src/cv_grid_map.cpp"
            CVGT[cvgridmap_test.cpp]:::test
            click CVGT "https://github.com/laxnpander/OpenREALM/blob/master/modules/realm_core/test/cvgridmap_test.cpp"
            
            subgraph DataLayers["Data Layers"]
                EL[Elevation Layer]:::layer
                OL[Orthophoto Layer]:::layer
                CL[Confidence Layer]:::layer
            end
            
            subgraph Features["Core Features"]
                OCM[OpenCV Matrix Integration]:::feature
                GCM[Grid Cell Management]:::feature
                SRS[Spatial Reference System]:::feature
                TH[Thread Safety]:::feature
                MM[Memory Management]:::feature
                MR[Multi-Resolution Support]:::feature
            end
        end
    end

    subgraph Processing["Processing Layer"]
        RS[realm_stages]:::processing
        click RS "https://github.com/laxnpander/OpenREALM/tree/master/modules/realm_stages/"
        RD[realm_densifier]:::processing
        click RD "https://github.com/laxnpander/OpenREALM/tree/master/modules/realm_densifier/"
        RV[realm_vslam]:::processing
        click RV "https://github.com/laxnpander/OpenREALM/tree/master/modules/realm_vslam/"
        RO[realm_ortho]:::processing
        click RO "https://github.com/laxnpander/OpenREALM/tree/master/modules/realm_ortho/"
    end

    subgraph IO["I/O Layer"]
        RIO[realm_io]:::io
        click RIO "https://github.com/laxnpander/OpenREALM/tree/master/modules/realm_io/"
    end

    subgraph Output
        OP[Output Products]:::output
    end

    IS --> RC
    RC --> RS
    RC --> CVGH
    CVGH --> CVGC
    CVGC --> CVGT
    
    DataLayers --> Features
    Features --> RIO
    
    RS --> RD
    RS --> RV
    RS --> RO
    RD --> RIO
    RV --> RIO
    RO --> RIO
    RIO --> OP

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef processing fill:#2ecc71,stroke:#27ae60,color:white
    classDef io fill:#f1c40f,stroke:#f39c12,color:black
    classDef input fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef output fill:#e74c3c,stroke:#c0392b,color:white
    classDef file fill:#9b59b6,stroke:#8e44ad,color:white
    classDef test fill:#1abc9c,stroke:#16a085,color:white
    classDef layer fill:#e67e22,stroke:#d35400,color:white
    classDef feature fill:#34495e,stroke:#2c3e50,color:white
```
