Calibration Library 1.0.0
A C++ library for camera calibration and vision-related geometric transformations
Loading...
Searching...
No Matches
pipeline.cpp
Go to the documentation of this file.
2
3// std
4#include <utility>
5
6namespace calib::pipeline {
7
9 intrinsics_config_ = std::move(cfg);
10 has_intrinsics_config_ = true;
11}
12
14 stereo_config_ = std::move(cfg);
15 has_stereo_config_ = true;
16}
17
19 handeye_config_ = std::move(cfg);
20 has_handeye_config_ = true;
21}
22
24 bundle_config_ = std::move(cfg);
25 has_bundle_config_ = true;
26}
27
28void CalibrationPipeline::add_stage(std::unique_ptr<CalibrationStage> stage) {
29 stages_.push_back(std::move(stage));
30}
31
32void CalibrationPipeline::add_decorator(std::shared_ptr<StageDecorator> decorator) {
33 decorators_.push_back(std::move(decorator));
34}
35
38 context.dataset = loader.load();
39
41 report.success = true;
42
43 for (const auto& stage : stages_) {
44 for (const auto& decorator : decorators_) {
45 decorator->before_stage(*stage, context);
46 }
47
48 auto stage_result = stage->run(context);
49 if (stage_result.name.empty()) {
50 stage_result.name = stage->name();
51 }
52
53 for (const auto& decorator : decorators_) {
54 decorator->after_stage(*stage, context, stage_result);
55 }
56
57 report.success = report.success && stage_result.success;
58 report.stages.push_back(std::move(stage_result));
59 }
60
61 return report;
62}
63
65 out_ << "[pipeline] → Starting stage '" << stage.name() << "'" << '\n';
66}
67
69 const PipelineStageResult& result) {
70 out_ << "[pipeline] ← Completed stage '" << stage.name() << "'"
71 << (result.success ? " (success)" : " (failed)") << '\n';
72}
73
74} // namespace calib::pipeline
void add_stage(std::unique_ptr< CalibrationStage > stage)
Definition pipeline.cpp:28
void add_decorator(std::shared_ptr< StageDecorator > decorator)
Definition pipeline.cpp:32
auto execute(DatasetLoader &loader, PipelineContext &context) -> PipelineExecutionReport
Definition pipeline.cpp:36
virtual auto name() const -> std::string=0
void before_stage(const CalibrationStage &stage, PipelineContext &context) override
Definition pipeline.cpp:64
void after_stage(const CalibrationStage &stage, PipelineContext &context, const PipelineStageResult &result) override
Definition pipeline.cpp:68
void set_intrinsics_config(IntrinsicCalibrationConfig cfg)
Definition pipeline.cpp:8
void set_handeye_config(HandEyePipelineConfig cfg)
Definition pipeline.cpp:18
void set_stereo_config(StereoCalibrationConfig cfg)
Definition pipeline.cpp:13
void set_bundle_config(BundlePipelineConfig cfg)
Definition pipeline.cpp:23
std::vector< PipelineStageResult > stages
Definition pipeline.h:28