CPPxDIC
C++ Digital Image Correlation library for fingertip 3D reconstruction
Loading...
Searching...
No Matches
single_dic_workflow.h
Go to the documentation of this file.
1
27#ifndef SINGLEDIC_SINGLE_DIC_WORKFLOW_H
28#define SINGLEDIC_SINGLE_DIC_WORKFLOW_H
29
31
32#include <opencv2/opencv.hpp>
33#include <string>
34#include <vector>
35
36namespace singledic {
37
40 int grid_width = 0;
41 int grid_height = 0;
42 std::vector<double> u;
43 std::vector<double> v;
44 std::vector<double> corrcoef;
45 bool valid = false;
46};
47
50 cv::Size image_size;
51 cv::Mat roi_mask;
53 std::vector<int> seed_pw;
54 std::vector<FrameResult> frames;
55 bool ok = false;
56 std::string message;
57};
58
63public:
64 explicit SingleDicWorkflow(const SinglediConfig& config);
65
72
73private:
74 SinglediConfig cfg_;
75
76 // --- pipeline stages (each mirrors a MATLAB step) ----------------------
77
81 bool importFrames(std::vector<cv::Mat>& frames) const;
82
85 std::vector<cv::Mat> saturate(const std::vector<cv::Mat>& frames) const;
86
88 std::vector<cv::Mat> maybeFilter(const std::vector<cv::Mat>& frames,
89 const cv::Mat& roi_mask) const;
90
92 cv::Mat loadOrCreateRoi(const cv::Mat& reference) const;
93
95 std::vector<int> loadOrCreateSeed(const cv::Mat& roi_mask) const;
96
100 bool track(const std::vector<cv::Mat>& frames, const cv::Mat& roi_mask,
101 const std::vector<int>& seed_pw, SingleDicResult& out) const;
102
103 // --- output writers ----------------------------------------------------
104
106 bool writeCsv(const SingleDicResult& res) const;
107
111 bool writeMat(const SingleDicResult& res) const;
112};
113
114} // namespace singledic
115
116#endif // SINGLEDIC_SINGLE_DIC_WORKFLOW_H
Drives the single-camera 2D-DIC step-D pipeline for one trial.
SingleDicResult run()
Run the full pipeline: import, saturate, (filter), ROI/seed, (optional matching), single tracking pas...
Wraps a CPPxDIC Config and adds a single-camera sub-path scheme.
Single-camera (2D, no-stereo) configuration adapter for CPPxDIC.
One tracked frame's reduced-grid DIC result (Lagrangian, pixels).
int grid_height
Displacement grid height (reduced).
bool valid
True if the frame correlated successfully.
std::vector< double > corrcoef
Correlation coefficient, row-major.
int grid_width
Displacement grid width (reduced).
std::vector< double > u
U displacement (px), row-major, NaN outside ROI.
std::vector< double > v
V displacement (px), row-major.
Full single-trial output: one reference + N tracked frames.
std::vector< int > seed_pw
Seed point [x, y] in pixels.
std::string message
Human-readable status.
cv::Size image_size
Reference frame pixel size.
int subset_spacing
Spacing used (grid factor = spacing+1).
cv::Mat roi_mask
ROI used (CV_8U, non-zero = inside).
std::vector< FrameResult > frames
Per-frame DIC results (index 0 = ref vs frame 1...).