CppNCorr
C++ ncorr Digital Image Correlation engine
Loading...
Searching...
No Matches
config.cpp
Go to the documentation of this file.
1
10#include "ncorr/config.h"
11#include "ncorr/ini.h"
12
13namespace ncorr {
14
15bool load_config_file(const std::string& config_path, Config& out) {
16 IniFile ini;
17 if (!ini.load(config_path)) {
18 return false; // No file: leave `out` at its incoming/default values.
19 }
20
21 // Pyramid / search
22 out.scalefactor = ini.get_int("scalefactor", out.scalefactor);
23
24 // Subregion
25 out.subregion_type = ini.get("subregion_type", out.subregion_type);
26 out.subregion_radius = ini.get_int("subregion_radius", out.subregion_radius);
27
28 // Interpolation
29 out.interp_type = ini.get("interp_type", out.interp_type);
30
31 // Strain
32 out.strain_subregion_type = ini.get("strain_subregion_type", out.strain_subregion_type);
33 out.strain_radius = ini.get_int("strain_radius", out.strain_radius);
34
35 // DIC behaviour
36 out.dic_config = ini.get("dic_config", out.dic_config);
37 out.num_threads = ini.get_int("num_threads", out.num_threads);
38 out.debug = ini.get_bool("debug", out.debug);
39
40 // Perspective / units
41 out.perspective_interp = ini.get("perspective_interp", out.perspective_interp);
42 out.units = ini.get("units", out.units);
43 out.units_per_pixel = ini.get_double("units_per_pixel", out.units_per_pixel);
44
45 // Output / video
46 out.alpha = ini.get_double("alpha", out.alpha);
47 out.fps = ini.get_double("fps", out.fps);
48
49 return true;
50}
51
52} // namespace ncorr
In-memory representation of a parsed INI file.
Definition ini.h:34
double get_double(const std::string &key, double fallback) const
Definition ini.h:114
bool get_bool(const std::string &key, bool fallback) const
Definition ini.h:127
int get_int(const std::string &key, int fallback) const
Definition ini.h:102
std::string get(const std::string &key, const std::string &fallback="") const
Definition ini.h:96
bool load(const std::string &path)
Parse an INI file from disk.
Definition ini.h:45
Compiled-default DIC parameters and the three-tier override chain.
Tiny, dependency-free INI-style configuration parser (header-only).
bool load_config_file(const std::string &config_path, Config &out)
Load compiled defaults, then overlay values from an INI config file.
Definition config.cpp:15
All tuneable ncorr parameters with their compiled-in defaults.
Definition config.h:28
double units_per_pixel
Physical units per pixel scaling.
Definition config.h:64
int num_threads
Number of worker threads for parallel analysis.
Definition config.h:54
std::string perspective_interp
Interpolation used by the perspective change step.
Definition config.h:60
int subregion_radius
Subregion (correlation window) radius in pixels.
Definition config.h:37
double alpha
Video overlay alpha (0..1).
Definition config.h:68
double fps
Output video frames-per-second.
Definition config.h:70
int strain_radius
Strain window (subregion) radius in pixels.
Definition config.h:48
std::string interp_type
Interpolation/order: NEAREST, LINEAR, CUBIC_KEYS[_PRECOMPUTE], QUINTIC_BSPLINE[_PRECOMPUTE].
Definition config.h:42
int scalefactor
Pyramid scale factor (downsampling level used for the seed search).
Definition config.h:31
std::string subregion_type
Subregion shape: "CIRCLE" or "SQUARE".
Definition config.h:35
bool debug
Enable verbose debug output from the engine.
Definition config.h:56
std::string dic_config
Reference-update policy: NO_UPDATE, KEEP_MOST_POINTS, REMOVE_BAD_POINTS.
Definition config.h:52
std::string units
Physical units label for displacement output.
Definition config.h:62
std::string strain_subregion_type
Strain subregion shape: "CIRCLE" or "SQUARE".
Definition config.h:46