How klischa/astra2 works
Purpose and entry points
AstraScanner2 is a Windows C++17 desktop application for RGB-D 3D scanning, point-cloud processing, mesh reconstruction, multi-scan registration, and file export. The executable is assembled by CMake at CMakeLists.txt; application startup is src/main.cpp, which creates the Qt UI shell in src/gui/MainWindow.cpp.
UI orchestration layer
Qt6 UI is intentionally thin: binders assemble tab/menu/status widgets while controllers own user workflows, state transitions, and asynchronous orchestration. src/gui/MainWindow.cpp connects the shell to src/controllers/ProjectUiController.cpp, src/controllers/CaptureSessionController.cpp, and src/controllers/ProcessingController.cpp. src/controllers/ViewerCoordinator.cpp coordinates main and processing visualizations and switches cloud/mesh displays.
Capture and scan-session pipeline
A scan session starts through CaptureSessionController, which manages a worker/thread boundary around src/capture/CaptureWorker.cpp. The worker acquires RGB/depth frames through src/capture/AstraCamera.cpp, using OpenNI2 for an Orbbec Astra Pro when available or synthetic emulation otherwise; depth is converted to point-cloud data via src/capture/DepthCloudConverter.h. src/controllers/ScanWorkflow.cpp and src/controllers/TurntableController.cpp coordinate manual and timed turntable scan flows.
Pose and coverage tracking
Captured frames feed one of two pose-estimation paths. Marker tracking is defined behind src/marker_tracker/IMarkerDetector.h; src/marker_tracker/MarkerTracker.cpp selects CCTag/circular detection and uses src/marker_tracker/MarkerMap.cpp to derive object pose from known markers. Neural tracking uses the bundled ONNX model at models/pose_regressor.onnx, executed by src/tracking/NeuralTracker.cpp and coordinated/validated in src/tracking/NeuralTrackingPipeline.cpp. src/tracking/SurfelCoverageTracker.cpp evaluates scan coverage/quality. Neural inference can use ONNX Runtime CUDA execution, with guard logic in src/tracking/NeuralTrackingGuards.cpp.
Processing and reconstruction services
ProcessingController delegates computational work to services rather than UI code. src/services/CloudFiltersService.cpp performs cloud cleanup; the compatibility/filter facade is src/filters/PointCloudFilters.cpp. CUDA-specific implementations and wrappers are isolated in src/filters/PointCloudFiltersCUDA.cu and src/filters/PointCloudFiltersCUDA_wrapper.cpp, with CPU PCL fallback. src/services/RegistrationService.cpp performs ICP-based scan alignment/merging. src/services/ReconstructionService.cpp produces Poisson meshes, and src/services/MeshProcessingService.cpp handles smoothing, decimation, and hole filling.
Persistence and output boundary
src/project/ProjectManager.cpp owns project lifecycle and durable metadata/cloud state, separating workspace persistence from processing. src/export/ExportManager.cpp is the outward format boundary for PLY, PCD, STL, and OBJ. Application-wide operational settings, including capture/filter/tracking parameters, are centralized in src/settings/SettingsManager.cpp; marker-disk configuration is supplied at data/marker_disk_config.json.
Runtime and infrastructure
The native runtime combines Qt6, PCL, VTK/OpenGL visualization, OpenCV, CCTag, Eigen, and ONNX Runtime, declared and linked via CMakeLists.txt and vcpkg.json. CUDA is optional and targets NVIDIA GPUs; OpenNI2 is optional hardware infrastructure for Astra Pro. Deployment must include Qt plugins, vcpkg/OpenNI2/ONNX DLLs, model assets, and data/, as configured by the build system.
Main entry points: ProcessingController.cpp Processing controller · MainWindow.cpp Qt UI shell · CaptureSessionController.cpp Capture session controller · NeuralTrackingPipeline.cpp Neural tracking pipeline
Components 22
Application
- CMake build · Assembles the executable and declares native dependencies.
CMakeLists.txt - Application startup
src/main.cpp
UI & Workflows
- Qt UI shell · Thin widget, menu, tab, and status binder layer.
src/gui/MainWindow.cpp - Project UI controller
src/controllers/ProjectUiController.cpp - Capture session controller · Owns asynchronous capture-session orchestration.
src/controllers/CaptureSessionController.cpp - Processing controller
src/controllers/ProcessingController.cpp - Viewer coordinator · Coordinates main and processing cloud/mesh displays.
src/controllers/ViewerCoordinator.cpp
Capture & Tracking
- Scan & turntable workflows · Coordinates manual and timed turntable scans.
src/controllers/ScanWorkflow.cpp - Capture worker · Runs acquisition outside the UI thread.
src/capture/CaptureWorker.cpp - Astra camera · Uses OpenNI2 hardware when available or synthetic emulation.
src/capture/AstraCamera.cpp - Depth-to-cloud converter
src/capture/DepthCloudConverter.h - Marker pose tracking · Selects circular/CCTag detection and derives pose from known markers.
src/marker_tracker/MarkerTracker.cpp - Neural tracking pipeline · Coordinates and validates ONNX pose inference.
src/tracking/NeuralTrackingPipeline.cpp - Neural tracker
src/tracking/NeuralTracker.cpp - Surfel coverage tracker
src/tracking/SurfelCoverageTracker.cpp
Processing
- Cloud filtering · Uses CUDA filters when available, with CPU PCL fallback.
src/services/CloudFiltersService.cpp - Registration service · Aligns and merges scans.
src/services/RegistrationService.cpp - Reconstruction service
src/services/ReconstructionService.cpp - Mesh processing · Smooths, decimates, and fills holes.
src/services/MeshProcessingService.cpp
Persistence & Output
- Project manager · Owns project lifecycle and durable metadata/cloud state.
src/project/ProjectManager.cpp - Export manager · Exports PLY, PCD, STL, and OBJ.
src/export/ExportManager.cpp - Settings manager · Centralizes capture, filter, and tracking parameters.
src/settings/SettingsManager.cpp
Connections 27
- CMake build → Application startup: builds
- Application startup → Qt UI shell: creates
- Qt UI shell → Project UI controller: binds
- Qt UI shell → Capture session controller: binds
- Qt UI shell → Processing controller: binds
- Qt UI shell → Viewer coordinator: binds
- Project UI controller → Project manager: manages projects
- Capture session controller → Capture worker: dispatches
- Capture session controller → Scan & turntable workflows: drives
- Capture worker → Astra camera: acquires frames
- Astra camera → Depth-to-cloud converter: supplies depth
- Depth-to-cloud converter → Marker pose tracking: cloud frames
- Depth-to-cloud converter → Neural tracking pipeline: cloud frames
- Neural tracking pipeline → Neural tracker: runs inference
- Marker pose tracking → Surfel coverage tracker: pose updates
- Neural tracking pipeline → Surfel coverage tracker: pose updates
- Capture session controller → Project manager: stores captures
- Processing controller → Cloud filtering: cleans clouds
- Processing controller → Registration service: aligns scans
- Processing controller → Reconstruction service: reconstructs mesh
- Reconstruction service → Mesh processing: produces mesh
- Processing controller → Project manager: reads and persists assets
- Processing controller → Export manager: exports results
- Processing controller → Viewer coordinator: updates displays
- Settings manager → Capture session controller: capture parameters
- Settings manager → Processing controller: processing parameters
- Settings manager → Neural tracking pipeline: tracking parameters