CPPxDIC
C++ Digital Image Correlation library for fingertip 3D reconstruction
Loading...
Searching...
No Matches
mirrored_mode.cpp File Reference

Implementation of the mirrored-camera xDIC mode ("MNG" variant). More...

#include "xdic/mirrored/mirrored_mode.h"
#include "config.h"
#include "parameters.h"
#include "utils.h"
#include "image_processor.h"
#include "roi_manager.h"
#include "step_d_workflow.h"
#include "mat_writer.h"
#include "logging.h"
#include <ncorr.h>
#include <opencv2/opencv.hpp>
#include <algorithm>
#include <cmath>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <regex>
#include <sstream>
#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  xdic
 
namespace  xdic::mirrored
 

Functions

ViewPair xdic::mirrored::resolveViewPair (int stereopair, const std::vector< int > &cam_order)
 Resolve the two views that form a given mirrored stereopair.
 
cv::Mat xdic::mirrored::extractViewFromFrame (const cv::Mat &frame, MaskHalf half)
 Extract a single mirror view (full frame) from a decoded camera frame.
 
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.
 
bool xdic::mirrored::run (const Config &config, const std::vector< int > &trials={})
 Run the mirrored-camera 2D DIC pipeline.
 

Detailed Description

Implementation of the mirrored-camera xDIC mode ("MNG" variant).

Compiled into cppxdic only when configured with -DXDIC_MODE=mirrored (which defines XDIC_MODE_MIRRORED). See include/xdic/mirrored/mirrored_mode.h.

Pipeline (mirror of stepD_2DDIC_MNG.m):

  1. For each stereopair, resolve its two logical views via the MNG geometry (get_cam_view_stereopair_param.m + camera_info_from_view.m).
  2. Mask-extract each view as a stand-alone full frame from the single physical-camera video (import_raw_vid_MNG.m: temp(:, mask_nbr, :)). This is the missing C++ part.
  3. Saturate (satur.m), bandpass-filter (filter_like_ben.m, when im_filter_mode) and run standard 2D DIC on the extracted views, reusing the CppNCorr engine, ROIManager and StepDWorkflow helpers exactly as the camerapairs path does:
    • view1 -> view2 matching at the reference frame (step1_2),
    • map the view1 ROI/seed through the matching field to seed view2,
    • temporal tracking of view1 (step1) and view2 (step2).
  4. Persist the per-view ncorr outputs (.bin) and format them into myDIC2DpairResults (step2_dic_finish.m) under the per-trial/per-pair output dir.

Definition in file mirrored_mode.cpp.