12#include <opencv2/opencv.hpp>
48 const cv::Mat& ref_img,
49 const cv::Mat& cur_img,
50 const cv::Mat& ref_roi,
51 const cv::Mat& cur_roi,
52 const ncorr::DIC_analysis_output& dic_output,
53 const std::map<std::string, double>& dispinfo);
69 const cv::Mat& ref_img,
70 const cv::Mat& cur_img,
71 const cv::Mat& ref_roi,
72 const cv::Mat& cur_roi,
73 const ncorr::DIC_analysis_output& dic_lagrangian,
74 const ncorr::DIC_analysis_output& dic_eulerian,
75 const std::map<std::string, double>& dispinfo);
114 const std::vector<int>& frame_indices);
132 const cv::Mat& ref_img,
133 const std::vector<cv::Mat>& cur_imgs,
134 const cv::Mat& ref_roi,
135 const std::vector<cv::Mat>& cur_rois,
136 const std::vector<ncorr::DIC_analysis_output>& dic_outputs,
137 const std::map<std::string, double>& dispinfo,
138 const std::string& type_str =
"load",
139 const std::string& ref_name =
"reference");
154 const ncorr::DIC_analysis_input& dic_input,
155 const ncorr::DIC_analysis_output& dic_output);
167 const std::string& mat_path,
168 const ncorr::DIC_analysis_input& dic_input);
191 const std::string& struct_name =
"DIC3Dcombined");
205 const std::string& struct_name,
206 const std::vector<std::string>& extra_fields = {});
229 const std::string& group_name,
249 const std::vector<std::vector<Eigen::Vector3d>>& disp_vec,
250 const std::vector<std::vector<double>>& disp_mgn,
264 const std::vector<std::vector<Eigen::Vector3d>>& face_centroids,
265 const std::vector<std::vector<double>>& face_corr_comb,
266 const std::vector<std::vector<double>>& face_iso_ind,
303 static matvar_t*
buildDIC2DinfoVar(
const std::vector<DIC2DPairResults>& dic2d_info);
312 static mat_t* createMatFileHDF5(
const std::string& filename);
320 static mat_t* createMatFileV5(
const std::string& filename);
330 static bool writeMatVariable(mat_t* matfp,
331 const std::string& varname,
344 static bool writeArrayVariable(mat_t* matfp,
345 const std::string& varname,
347 const std::vector<size_t>& dims,
348 matio_types data_type,
349 matio_classes class_type);
359 static bool writeStringVariable(mat_t* matfp,
360 const std::string& varname,
361 const std::string& str);
371 static bool writeScalarVariable(mat_t* matfp,
372 const std::string& varname,
382 static matvar_t* createStructVariable(
const std::string& struct_name,
383 const std::vector<std::string>& field_names);
394 static bool addFieldToStruct(matvar_t* struct_var,
395 const std::string& field_name,
407 static void convertDispToArrays(
const ncorr::Disp2D& disp,
408 std::vector<double>& u_array,
409 std::vector<double>& v_array,
419 static matvar_t* formatDispInfo(
const std::map<std::string, double>& params);
428 static matvar_t* formatDisplacements(
const ncorr::DIC_analysis_output& dic_output);
438 static matvar_t* formatDisplacements(
const ncorr::DIC_analysis_output& dic_lagrangian,
439 const ncorr::DIC_analysis_output& dic_eulerian);
447 static ncorr::ROI2D convertMatToROI2D(
const cv::Mat& mask);
455 static cv::Mat convertROI2DToMat(
const ncorr::ROI2D& roi);
471 static bool writeDicNcorrFile(
const std::string& filename,
472 const cv::Mat& ref_img,
473 const cv::Mat& cur_img,
474 const cv::Mat& ref_roi,
475 const cv::Mat& cur_roi,
476 matvar_t* dispinfo_var,
477 matvar_t* displacements_var,
478 const ncorr::DIC_analysis_output& dic_output);
488 static matvar_t* createCellArrayFromScalars(
489 const std::string& name,
490 const std::vector<std::vector<double>>& data,
501 static matvar_t* createCellArrayFromVectors(
502 const std::string& name,
503 const std::vector<std::vector<Eigen::Vector3d>>& data,
514 static matvar_t* createCellArrayFromMatrices(
515 const std::string& name,
516 const std::vector<std::vector<Eigen::Matrix3d>>& data,
528 static matvar_t* createCellArray2DFromStrings(
529 const std::string& name,
530 const std::vector<std::vector<std::string>>& data,
543 static matvar_t* createCellArray2DFromVectors(
544 const std::string& name,
545 const std::vector<std::vector<std::vector<double>>>& data,
MatWriter class Provides utilities for writing MAT files with proper xDIC structure.
static matvar_t * buildAllPairsResultsVar(const std::vector< DIC3DpairResults > &all_pairs)
Build the AllPairsResults cell array (full DIC3DpairResults structs) purely in memory — the caller at...
static bool writeDistortionGroup(mat_t *matfp, const DistortionData &distortion)
Write distortion group (distortionModel, distortionPath)
static bool writeCalibrationGroup(mat_t *matfp, const CalibrationData &calibration)
Write calibration group (DLTparameters, DLTpath)
static bool writeMultiFrameNcorrFile(const std::string &filename, const cv::Mat &ref_img, const std::vector< cv::Mat > &cur_imgs, const cv::Mat &ref_roi, const std::vector< cv::Mat > &cur_rois, const std::vector< ncorr::DIC_analysis_output > &dic_outputs, const std::map< std::string, double > &dispinfo, const std::string &type_str="load", const std::string &ref_name="reference")
Write multi-frame ncorr files (ncorr1.mat, ncorr2.mat, etc.) For tracking DIC with multiple current f...
static bool writeSeedFile(const std::string &filename, int seed_x, int seed_y)
Write REF_SEED_xxx_phase_pairX.mat file Simple structure: seed_point (uint16 1D array [x,...
static bool writeDIC2DPairResults(const std::string &filename, const DIC2DPairResults &results)
Write myDIC2DpairResults_C_X_C_Y.mat file Contains processed 2D DIC results with triangulation.
static bool write3DCombinedResults(const std::string &filename, const DIC3Dcombined &combined, const std::string &struct_name="DIC3Dcombined")
Write DIC3Dcombined_XPairs_stitched.mat file Contains 3D reconstruction results.
static bool writeTrialInfoFile(const std::string &filename, double fps, const std::vector< int > &frame_indices)
Write dic_info_data_target_pairX.mat file Structure:
static bool write3DPPresults(const std::string &filename, const DIC3DPPresults &ppresults)
Write DIC3DPPresults_XPairs_Y_v1.mat file Contains deformation and strain analysis results.
static matvar_t * buildDeformationStruct(const std::string &group_name, const FrameDeformationResult &deform_data)
Build deformation struct as matvar_t* for embedding in parent struct Does NOT write to file.
static bool writeDisplacementGroup(mat_t *matfp, const std::vector< std::vector< Eigen::Vector3d > > &disp_vec, const std::vector< std::vector< double > > &disp_mgn, size_t n_frames)
Write displacement group (DispVec, DispMgn)
static bool writeMatchingFile(const std::string &filename, const cv::Mat &ref_img, const cv::Mat &cur_img, const cv::Mat &ref_roi, const cv::Mat &cur_roi, const ncorr::DIC_analysis_output &dic_output, const std::map< std::string, double > &dispinfo)
Write MATCHING2xxx_pair.mat file Structure:
static bool writeROIMaskFile(const std::string &filename, const cv::Mat &mask)
Write REF_MASK_xxx_phase_pairX.mat file Simple structure: refmask (uint8 2D array)
static matvar_t * buildCombinedStructFields(mat_t *matfp, const DIC3Dcombined &combined, const std::string &struct_name, const std::vector< std::string > &extra_fields={})
Build combined struct fields as a matvar_t* (for embedding in parent struct) Does NOT write to file.
static matvar_t * buildDIC2DinfoVar(const std::vector< DIC2DPairResults > &dic2d_info)
Build the DIC2Dinfo cell array of DIC2DPairResults purely in memory — the caller attaches it to a str...
static bool writeDICResultFile(const std::string &filename, const ncorr::DIC_analysis_input &dic_input, const ncorr::DIC_analysis_output &dic_output)
Write ncorr1.mat / ncorr2.mat / ncorr12.mat files Full DIC results with dispinfo and displacements St...
static bool writeDeformationGroup(mat_t *matfp, const std::string &group_name, const FrameDeformationResult &deform_data)
Write deformation fields to HDF5 group Writes all 36 deformation measures as cell arrays.
static bool convertBinToMat(const std::string &bin_path, const std::string &mat_path, const ncorr::DIC_analysis_input &dic_input)
Convert ncorr .bin output to .mat format Wrapper to load .bin and save as MATLAB-compatible ....
static bool writeFaceArrays(mat_t *matfp, const std::vector< std::vector< Eigen::Vector3d > > &face_centroids, const std::vector< std::vector< double > > &face_corr_comb, const std::vector< std::vector< double > > &face_iso_ind, size_t n_frames)
Write face-based cell arrays (FaceCentroids, FaceCorrComb, FaceIsoInd)
DataSerializer - Abstract base class for format-agnostic DIC data I/O.
DIC 2D Pair Results Equivalent to MATLAB's DIC2DpairResults.
DIC 3D Post-Processing Results Equivalent to MATLAB's DIC3DPPresults.
DIC 3D Combined Results Equivalent to MATLAB's DIC3Dcombined This represents stitched results from mu...