# weidong-whu/3dlineresconstruction architecture

> Architecture diagram of the GitHub repository weidong-whu/3dlineresconstruction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/weidong-whu/3dlineresconstruction
- Repository: https://github.com/weidong-whu/3dlineresconstruction

## Overview

ELSRPP_MULTI reconstructs 3D line segments from multi-view imagery and SfM camera results. The principal workflow starts with either VisualSFM or Pixel4D input, loads image/SfM data, detects 2D lines, matches lines across image pairs, then merges and clusters reconstructed 3D lines; the README highlights adaptive clustering and geometrically consistent triangulation. The graph preserves these documented stages and detector options. Some internal call paths are unsampled, so those relationships are dashed and marked without evidence rather than presented as verified calls.

Main entry points: [`ELSRPP_MULTI/ELSRPP/src/callELSRPP.cpp`](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/callELSRPP.cpp) (ELSRPP workflow), [`ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp`](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp) (Pair matching), [`ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp`](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp) (Image line extraction), [`ELSRPP_MULTI/ELSRPP/src/LineCluster.cpp`](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/LineCluster.cpp) (3D line clustering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and SfM"]
  node_visualsfm["VisualSFM input<br/>[main_visualSFM.cpp]"]
  node_pixel4d["Pixel4D input<br/>[main_pixel4D.cpp]"]
  node_sfm[("SfM data<br/>[SfMManager.cpp]")]
end

subgraph group_matching["Line detection and matching"]
  node_entry["ELSRPP workflow<br/>[callELSRPP.cpp]"]
  node_image["Image line extraction<br/>[SingleImage.cpp]"]
  node_lsd["LSD detector<br/>[LSD.cpp]"]
  node_ag3["Ag3line detector<br/>[ag3line_go.cpp]"]
  node_edlines["EDLines detector<br/>[EDLineDetector.cpp]"]
  node_pairmatch["Pair matching<br/>[PairMatch.cpp]"]
  node_homography["Homography matching<br/>[FindHomography.cpp]"]
  node_matches[("Match manager<br/>[MatchManager.cpp]")]
end

subgraph group_reconstruction["3D reconstruction"]
  node_pairlines["Pairwise line geometry<br/>[PairWiseLines.cpp]"]
  node_sweep["Line sweep merge<br/>[LineSweep.cpp]"]
  node_cluster["3D line clustering<br/>[LineCluster.cpp]"]
  node_math["Geometry utilities<br/>[BasicMath.cpp]"]
end

subgraph group_analysis["Analysis and output"]
  node_analysis["SfM analysis<br/>[sfm_analysis.cpp]"]
end

node_actor(("User"))

node_actor -.->|"selects input"| node_visualsfm
node_actor -.->|"selects input"| node_pixel4d
node_visualsfm -->|"calls workflow"| node_entry
node_pixel4d -->|"calls workflow"| node_entry
node_entry -.->|"uses SfM data"| node_sfm
node_entry -.->|"runs extraction"| node_image
node_image -->|"uses detector"| node_lsd
node_image -->|"uses detector"| node_ag3
node_image -->|"uses detector"| node_edlines
node_entry -.->|"runs matching"| node_pairmatch
node_pairmatch -->|"uses geometry"| node_homography
node_pairmatch -.->|"records matches"| node_matches
node_pairmatch -->|"reads cameras"| node_sfm
node_entry -.->|"runs merging"| node_sweep
node_sweep -.->|"reads matches"| node_matches
node_entry -.->|"runs clustering"| node_cluster
node_cluster -->|"uses sweep data"| node_sweep
node_entry -.->|"runs analysis"| node_analysis
node_pairmatch -->|"uses geometry"| node_math
node_cluster -->|"uses geometry"| node_math

click node_visualsfm "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/visualSFM/main_visualSFM.cpp"
click node_pixel4d "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/pixel4D/main_pixel4D.cpp"
click node_sfm "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/SfMManager.cpp"
click node_entry "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/callELSRPP.cpp"
click node_image "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp"
click node_lsd "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/line_detector/LSD.cpp"
click node_ag3 "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/line_detector/ag3line/ag3line_go.cpp"
click node_edlines "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/line_detector/EDLineDetector.cpp"
click node_pairmatch "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp"
click node_homography "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/FindHomography.cpp"
click node_matches "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/MatchManager.cpp"
click node_pairlines "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/PairWiseLines.cpp"
click node_sweep "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/LineSweep.cpp"
click node_cluster "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/LineCluster.cpp"
click node_math "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/BasicMath.cpp"
click node_analysis "https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/sfm_analysis.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_visualsfm,node_pixel4d,node_sfm,node_actor toneBlue
class node_entry,node_image,node_lsd,node_ag3,node_edlines,node_pairmatch,node_homography,node_matches toneAmber
class node_pairlines,node_sweep,node_cluster,node_math toneMint
class node_analysis toneRose
```

## Components

### Inputs and SfM

- [VisualSFM input](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/visualSFM/main_visualSFM.cpp): `ELSRPP_MULTI/visualSFM/main_visualSFM.cpp`
- [Pixel4D input](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/pixel4D/main_pixel4D.cpp): `ELSRPP_MULTI/pixel4D/main_pixel4D.cpp`
- [SfM data](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/SfMManager.cpp): `ELSRPP_MULTI/ELSRPP/src/SfMManager.cpp`

### Line detection and matching

- [ELSRPP workflow](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/callELSRPP.cpp): `ELSRPP_MULTI/ELSRPP/src/callELSRPP.cpp`
- [Image line extraction](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp): `ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp`
- [LSD detector](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/line_detector/LSD.cpp): `ELSRPP_MULTI/ELSRPP/src/line_detector/LSD.cpp`
- [Ag3line detector](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/line_detector/ag3line/ag3line_go.cpp): `ELSRPP_MULTI/ELSRPP/src/line_detector/ag3line/ag3line_go.cpp`
- [EDLines detector](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/line_detector/EDLineDetector.cpp): `ELSRPP_MULTI/ELSRPP/src/line_detector/EDLineDetector.cpp`
- [Pair matching](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp): `ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp`
- [Homography matching](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/FindHomography.cpp): `ELSRPP_MULTI/ELSRPP/src/FindHomography.cpp`
- [Match manager](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/MatchManager.cpp): `ELSRPP_MULTI/ELSRPP/src/MatchManager.cpp`

### 3D reconstruction

- [Pairwise line geometry](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/PairWiseLines.cpp): `ELSRPP_MULTI/ELSRPP/src/PairWiseLines.cpp`
- [Line sweep merge](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/LineSweep.cpp): `ELSRPP_MULTI/ELSRPP/src/LineSweep.cpp`
- [3D line clustering](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/LineCluster.cpp): `ELSRPP_MULTI/ELSRPP/src/LineCluster.cpp`
- [Geometry utilities](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/BasicMath.cpp): `ELSRPP_MULTI/ELSRPP/src/BasicMath.cpp`

### Analysis and output

- [SfM analysis](https://github.com/weidong-whu/3dlineresconstruction/blob/main/ELSRPP_MULTI/ELSRPP/src/sfm_analysis.cpp): `ELSRPP_MULTI/ELSRPP/src/sfm_analysis.cpp`

### Other components

- **User**

## Connections

- User → VisualSFM input: selects input
- User → Pixel4D input: selects input
- VisualSFM input → ELSRPP workflow: calls workflow (evidence: `ELSRPP_MULTI/visualSFM/main_visualSFM.cpp`)
- Pixel4D input → ELSRPP workflow: calls workflow (evidence: `ELSRPP_MULTI/pixel4D/main_pixel4D.cpp`)
- ELSRPP workflow → SfM data: uses SfM data
- ELSRPP workflow → Image line extraction: runs extraction
- Image line extraction → LSD detector: uses detector (evidence: `ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp`)
- Image line extraction → Ag3line detector: uses detector (evidence: `ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp`)
- Image line extraction → EDLines detector: uses detector (evidence: `ELSRPP_MULTI/ELSRPP/src/SingleImage.cpp`)
- ELSRPP workflow → Pair matching: runs matching
- Pair matching → Homography matching: uses geometry (evidence: `ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp`)
- Pair matching → Match manager: records matches
- Pair matching → SfM data: reads cameras (evidence: `ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp`)
- ELSRPP workflow → Line sweep merge: runs merging
- Line sweep merge → Match manager: reads matches
- ELSRPP workflow → 3D line clustering: runs clustering
- 3D line clustering → Line sweep merge: uses sweep data
- ELSRPP workflow → SfM analysis: runs analysis
- Pair matching → Geometry utilities: uses geometry (evidence: `ELSRPP_MULTI/ELSRPP/src/PairMatch.cpp`)
- 3D line clustering → Geometry utilities: uses geometry (evidence: `ELSRPP_MULTI/ELSRPP/src/LineCluster.cpp`)
