# transportation-inspection/visual_odometry architecture

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

- Interactive diagram: https://gitdiagram.com/transportation-inspection/visual_odometry
- Repository: https://github.com/transportation-inspection/visual_odometry

## Overview

##### Main Components

a) Input Layer:
- Image Sequence Input
- Camera Parameters Input (from CameraParams.txt)
- Optional GPS Data Input
- Optional Ground Truth Data Input

b) Core Processing Components:
- Feature Detection Module (supports SIFT, FAST, SURF, SHI-TOMASI)
- Optical Flow Processing Module
- Motion Estimation Pipeline
- Camera Position Tracking System

c) Output Layer:
- Trajectory Generation
- Visualization System
- Results Storage

**[Input Layer]**
- ↓
**[Processing Layer]**
- ↓
**[Output Layer]**

##### Detailed Component Breakdown

- Rectangles: Processing modules (py_MVO.py, py_MVO_OptFlow.py)
- Parallelograms: Input/Output data
- Diamonds: Decision points

##### Key Relationships to Highlight

- CameraParams_Parser.py → Main Processing Pipeline
- Image Sequence → Feature Detection → Optical Flow
- GPS_VO.py ←→ Main Processing Pipeline (optional integration)
- Ground_Truth.py → Trajectory comparison

##### Specific Implementation Details

a) The modular nature of the feature detection system
b) The parallel processing capabilities between VO and GPS data
c) The comparison mechanism between estimated and ground truth trajectories
d) The visualization pipeline for trajectory display

##### Additional Elements

- File formats supported
- Optional vs. required components
- Data flow direction conventions
- Integration points with external systems (OpenCV, GPS)

##### Technical Notes

Annotations for:
- Required Python version (2.7)
- OpenCV version requirements (3.1.0-dev)
- Key dependencies (numpy, matplotlib, etc.)
- Input/output file formats

##### System Requirements Section

- Dependencies
- Environmental requirements
- Hardware recommendations
- Performance considerations

Remember to include error handling and data validation flows, especially for the camera parameters and image sequence inputs, as these are critical for the system's proper functioning.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        IMG["Image Sequence Input"]:::input
        CAM["Camera Parameters Input"]:::input
        GPS["GPS Data Input"]:::optional
        GTD["Ground Truth Data"]:::optional
    end

    subgraph Processing
        MAIN["Main Processing Pipeline"]:::core
        MVO["Core MVO Processing"]:::core
        FLOW["Optical Flow Processing"]:::core
        FEAT["Feature Detection Module"]:::core
        COMMON["Common Utilities"]:::util
    end

    subgraph Output
        TRAJ["Trajectory Generation"]:::output
        VIS["Visualization System"]:::output
        RES["Results Storage"]:::output
    end

    %% Input Layer Connections
    IMG --> MAIN
    CAM --> MAIN
    GPS --> MAIN
    GTD --> MAIN

    %% Processing Layer Connections
    MAIN --> MVO
    MAIN --> FLOW
    MVO --> FEAT
    FLOW --> FEAT
    COMMON --> MVO
    COMMON --> FLOW

    %% Output Layer Connections
    MVO --> TRAJ
    FLOW --> TRAJ
    TRAJ --> VIS
    TRAJ --> RES

    %% Click Events
    click IMG "https://github.com/Transportation-Inspection/visual_odometry/tree/master/src/KITTI_sample/images/"
    click CAM "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/CameraParams.txt"
    click GPS "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/GPS_VO.py"
    click GTD "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/Ground_Truth.py"
    click MAIN "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/MAIN.py"
    click MVO "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/py_MVO.py"
    click FLOW "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/py_MVO_OptFlow.py"
    click COMMON "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/Common_Modules.py"
    click TRAJ "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/Trajectory_Tools.py"
    click RES "https://github.com/Transportation-Inspection/visual_odometry/blob/master/src/KITTI_sample/images/py-MVO_Poses.txt"

    %% Styling
    classDef input fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef output fill:#FFA500,stroke:#333,stroke-width:2px
    classDef optional fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef util fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Core Processing"]:::core
        L3["Output Components"]:::output
        L4["Optional Components"]:::optional
        L5["Utility Modules"]:::util
    end
```
