How lhanaf/mild works
Project Type and Purpose
• This is a native C++ loop‐closure detection library and command‐line tool (“MILD”) used in visual SLAM. It ingests an image sequence and configuration settings, runs binary‐feature based matching and Bayesian filtering, and outputs loop‐closure hypotheses for downstream evaluation (Octave/MATLAB).
File Structure Analysis
Top‐level:
• CMakeLists.txt – build orchestrator
• main.cpp – CLI entry point (“./mild imagelist.txt settings.yaml”)
• settings.yaml, imagelist.txt – runtime parameters and input list
• data/ – ground‐truth .mat file for evaluation
• evaluation.m, run_scritp.m – post‐hoc accuracy scripts
• frame.cpp/.h, global.h – core data structures and global definitions
• MILD/ – library source
– loop_closure_detector.cpp/.h – orchestrates detection pipeline
– sparse_match.cpp/.h – binary‐feature matcher
– BayesianFilter.hpp – probabilistic scoring
– lightweight_vector.hpp – performance‐optimized containers
– mild.hpp – façade header collecting all submodules
Key Insights from README
• Dependencies: OpenCV 3.1, Eigen3 (matrix ops), optional Octave for evaluation
• Usage: run CLI, then call evaluation(…) to compare lcd_shared_flag.bin vs truthNewCollege.mat
• Output: three binary‐flag and score streams per frame in build/output/...
A. CLI Frontend (“mild”)
• Parses imagelist.txt (list of RGB image paths)
• Parses settings.yaml (feature & filter parameters)
• Hands off to LoopClosureDetector
B. I/O Layer
• Image Loader – reads each image via OpenCV
• Settings Parser – YAML → in‐memory config struct
C. Core Library (MILD/)
• Frame Module – wraps OpenCV Mat + pre‐computed keypoints/descriptors
• SparseMatch – binary feature extraction & approximate nearest‐neighbor matching
• BayesianFilter – fuses match scores over time to produce loop‐closure probability
• LoopClosureDetector – ties Frame, SparseMatch, BayesianFilter into a pipeline
D. Output Layer
• File Writer – writes lcd_shared_flag.bin, lcd_shared_score_mild.bin, relocalization_time_per_frame.bin
E. Post‐Processing (External Script)
• Octave/MATLAB–based evaluation.m/run_scritp.m reads built binaries + ground‐truth .mat and computes accuracy
imagelist.txt → CLI → Settings Parser → Detector
↓ ↘
Image Loader → Frame → SparseMatch → BayesianFilter → Output Writer
↘
loop_closure_detector → binary files → evaluation.m
Architectural Patterns & Design Principles
• Modular pipeline: clear separation between I/O, feature matching, probabilistic filtering, and output
• Facade (mild.hpp) exposes high‐level API, hiding submodule complexity
• Single Responsibility: each class (SparseMatch, BayesianFilter, Frame) has one concern
• Performance‐critical data structures (lightweight_vector.hpp) for real‐time operation
Detail Level
• Interaction between main.cpp (CLI) and the library
• Build artifacts (CMake → executable + library) at the top or side