CPPxDIC
C++ Digital Image Correlation library for fingertip 3D reconstruction
Loading...
Searching...
No Matches
xdic::mirrored Namespace Reference

Classes

struct  ViewInfo
 Logical view = (physical camera id, which half of that camera's frame). More...
 
struct  ViewPair
 A mirrored stereopair: the two logical views to correlate against each other. More...
 

Enumerations

enum class  MaskHalf { Left = 1 , Right = 2 }
 Half-width mask region used to extract a single mirror view from a frame. More...
 

Functions

ViewPair resolveViewPair (int stereopair, const std::vector< int > &cam_order)
 Resolve the two views that form a given mirrored stereopair.
 
cv::Mat extractViewFromFrame (const cv::Mat &frame, MaskHalf half)
 Extract a single mirror view (full frame) from a decoded camera frame.
 
bool importRawViewMirrored (const Config &config, int trial, const ViewInfo &view, int frameStart, int frameEnd, int frameJump, std::vector< std::string > &out_frames)
 Decode a physical-camera video and write per-view masked frames to disk.
 
bool run (const Config &config, const std::vector< int > &trials={})
 Run the mirrored-camera 2D DIC pipeline.
 

Enumeration Type Documentation

◆ MaskHalf

enum class xdic::mirrored::MaskHalf
strong

Half-width mask region used to extract a single mirror view from a frame.

Mirrors the MATLAB im_mask_width cell array in camera_info_from_view.m: half 1 -> columns [0, W/2) (MATLAB 1:W/2) half 2 -> columns [W/2, W) (MATLAB W/2+1:W)

Enumerator
Left 
Right 

Definition at line 42 of file mirrored_mode.h.

Function Documentation

◆ extractViewFromFrame()

cv::Mat xdic::mirrored::extractViewFromFrame ( const cv::Mat &  frame,
MaskHalf  half 
)

Extract a single mirror view (full frame) from a decoded camera frame.

Applies the half-width mask (Left/Right) and returns the cropped region as a stand-alone full-frame image, matching MATLAB temp(:, stereo_param.mask_nbr_X, :).

Parameters
frameDecoded single-channel (or BGR) source frame.
halfWhich half to keep.
Returns
The extracted view as a single-channel cv::Mat.

Definition at line 189 of file mirrored_mode.cpp.

◆ importRawViewMirrored()

bool xdic::mirrored::importRawViewMirrored ( const Config &  config,
int  trial,
const ViewInfo &  view,
int  frameStart,
int  frameEnd,
int  frameJump,
std::vector< std::string > &  out_frames 
)

Decode a physical-camera video and write per-view masked frames to disk.

This is the missing C++ counterpart of import_raw_vid_MNG.m: it reads ONE camera video, slices each requested frame with the half mask, and writes the extracted view as a PNG sequence (the same on-disk representation the CppNCorr DIC engine consumes).

Parameters
configResolved configuration (paths, subject, material, frames).
trialTrial number (integer).
viewWhich logical view to extract.
frameStart1-based first frame (MATLAB convention).
frameEnd1-based last frame (<=0 means "to end").
frameJumpFrame stride (<=0 treated as 1).
out_framesOutput: paths of the written per-view PNG frames, in order.
Returns
true if at least one frame was extracted.

Definition at line 200 of file mirrored_mode.cpp.

◆ resolveViewPair()

ViewPair xdic::mirrored::resolveViewPair ( int  stereopair,
const std::vector< int > &  cam_order 
)

Resolve the two views that form a given mirrored stereopair.

Direct port of get_cam_view_stereopair_param.m + camera_info_from_view.m.

Parameters
stereopair1-based stereopair number (1..7 for the default 4-camera rig).
cam_orderPhysical-camera ordering (MATLAB theGlobalSettings_MNG.cam_order, default {2,1,4,3}). 1-based camera ids.
Returns
The resolved ViewPair.

Definition at line 130 of file mirrored_mode.cpp.

◆ run()

bool xdic::mirrored::run ( const Config &  config,
const std::vector< int > &  trials = {} 
)

Run the mirrored-camera 2D DIC pipeline.

For each stereopair (config.mirrored_num_pair, geometry from config.mirrored_cam_order): resolve its two views, extract them as masked full frames, saturate + filter_like_ben (when config.im_filter_mode), then run standard 2D DIC exactly like the camerapairs StepDWorkflow – matching view1->view2 at the reference frame, mapping the ROI/seed through the matching field (StepDWorkflow::updateMaskAndSeedFromOutput), temporal tracking of each view, and finally step2_dic_finish formatting (StepDWorkflow::formatDic2DPairResults) into myDIC2DpairResults_C_{v1}_C_{v2}. Results are written under <dic_path>/<subject>/<material>/<trial>/<phase>/mirrored_pair<N>.

Parameters
configFully-resolved configuration.
trialsTrials to process (–trial/–trials selection). Empty = the reference trial only (config.ref_trial_id), as in the MATLAB single-trial script.
Returns
true when every (trial, stereopair) succeeded.

Definition at line 576 of file mirrored_mode.cpp.