CPPxDIC
C++ Digital Image Correlation library for fingertip 3D reconstruction
Loading...
Searching...
No Matches
roi_manager.h
Go to the documentation of this file.
1
7#ifndef ROI_MANAGER_H
8#define ROI_MANAGER_H
9
10#include "parameters.h"
11#include <opencv2/opencv.hpp>
12#include <ncorr.h>
13#include <string>
14#include <vector>
15
16namespace cppxdic {
17
23public:
33 static cv::Mat loadOrCreateROI(const BaseParameters& params,
34 const cv::Mat& reference_image);
35
42 static cv::Mat loadROIFromMat(const std::string& roi_file);
43
50 static SeedPoint loadSeedFromMat(const std::string& seed_file);
51
60 static SeedPoint loadOrCreateSeed(const BaseParameters& params,
61 const cv::Mat& roi_mask);
62
71 static std::vector<int> mapPixel2Subset(const std::vector<int>& pixel_coords,
72 int subset_spacing);
73
82 static std::vector<int> mapSubset2Pixel(const std::vector<int>& subset_coords,
83 int subset_spacing);
84
94 static std::vector<int> mapPointCoordinate(const std::vector<int>& point_sw,
95 const cv::Mat& U_mapped,
96 const cv::Mat& V_mapped);
97
109 static bool loadMatchingResults(const std::string& matching_file,
110 cv::Mat& refmask_REF,
111 cv::Mat& refmask_trial,
112 cv::Mat& U_mapped,
113 cv::Mat& V_mapped,
114 int subset_spacing);
115
122 static cv::Mat createFullROI(const cv::Size& image_size);
123
130 static std::vector<int> findROICenter(const cv::Mat& roi_mask);
131
138 static cv::Mat ncorrROIToMat(const ncorr::ROI2D& roi);
139
146 static ncorr::ROI2D matToNcorrROI(const cv::Mat& mask);
147
148private:
152 static cv::Point2f computeROICenterOfMass(const cv::Mat& roi_mask);
153};
154
155} // namespace cppxdic
156
157#endif // ROI_MANAGER_H
ROIManager class Manages ROI masks and seed points for DIC analysis.
Definition roi_manager.h:22
static std::vector< int > mapSubset2Pixel(const std::vector< int > &subset_coords, int subset_spacing)
Map subset coordinates to pixel coordinates Equivalent to map_subset2pixel.m.
static std::vector< int > findROICenter(const cv::Mat &roi_mask)
Find center of ROI mask.
static std::vector< int > mapPointCoordinate(const std::vector< int > &point_sw, const cv::Mat &U_mapped, const cv::Mat &V_mapped)
Map point coordinates using displacement fields Equivalent to map_pointcoordinate....
static SeedPoint loadSeedFromMat(const std::string &seed_file)
Load seed point from MAT file.
static std::vector< int > mapPixel2Subset(const std::vector< int > &pixel_coords, int subset_spacing)
Map pixel coordinates to subset coordinates Equivalent to map_pixel2subset.m.
static cv::Mat loadROIFromMat(const std::string &roi_file)
Load ROI mask from MAT file.
static ncorr::ROI2D matToNcorrROI(const cv::Mat &mask)
Convert OpenCV Mat to ncorr ROI2D.
static SeedPoint loadOrCreateSeed(const BaseParameters &params, const cv::Mat &roi_mask)
Load or create seed point If seed file doesn't exist, creates a default seed point at ROI center.
static bool loadMatchingResults(const std::string &matching_file, cv::Mat &refmask_REF, cv::Mat &refmask_trial, cv::Mat &U_mapped, cv::Mat &V_mapped, int subset_spacing)
Load matching results from MAT file Extracts ROI masks and displacement fields from matching file.
static cv::Mat loadOrCreateROI(const BaseParameters &params, const cv::Mat &reference_image)
Load or create ROI mask If ROI file doesn't exist, creates a full-image ROI Equivalent to checking an...
static cv::Mat createFullROI(const cv::Size &image_size)
Create default ROI mask (full image)
static cv::Mat ncorrROIToMat(const ncorr::ROI2D &roi)
Convert ncorr ROI2D to OpenCV Mat.
DataSerializer - Abstract base class for format-agnostic DIC data I/O.
Base parameters structure Contains fundamental paths and settings for DIC analysis Equivalent to base...
Definition parameters.h:20
Seed point structure Stores seed points in both pixel world (pw) and subset world (sw) coordinates.
Definition parameters.h:108