Repository navigation
perf(singledic): whole-stack matlab-parallel DIC + feat(proxyncorr): .mat ROI/seed & all ncorr modes - #37
Merged
johnaoga merged 1 commit intoJun 26, 2026
Conversation
…mat ROI/seed + all ncorr modes
singledic was ~18x slower than xdic (280s vs 15s per frame) because
SingleDicWorkflow::track() drove the engine through
ncorr::NcorrSession::process_frame() one frame at a time. Each call ran
plain DIC_analysis({ref, def}), which re-ran the full automatic seed
search from scratch on every frame (the computed seed was never passed to
the engine), had no cross-frame parallelism, and was not the MATLAB
segment path. Rewrite track() to mirror StepDWorkflow::runNcorrAnalysis:
build one in-memory image stack (ref + all frames), set update_corrcoef
to disable correlation-based reference updates, pass the user seed, and
run a single matlab_DIC_analysis_parallel/_sequential (or exact_matlab_*)
pass honouring config.parallel_processing and ncorr_use_exact_matlab. No
temp-PNG round trip; semantically equivalent (fixed-reference NO_UPDATE)
but seeded, segment-based, and frame-parallel.
proxyncorr: add the ability to read the ROI and seed as xDIC .mat
sidecars (REF_MASK 'refmask' / REF_SEED 'seed_point'), auto-detected by
extension, for both the file-based and --in-memory paths; default ROI now
prefers <folder>/roi.mat then roi.png. Expose all ncorr DIC modes via
-m/--mode: existing auto/sequential/parallel plus matlab-parallel,
matlab-sequential, exact-matlab-parallel, exact-matlab-sequential (mode
strings normalised). Update help/config docs. CMake: add matio/HDF5
include+link to the proxyncorr target.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses two issues found while running the apps:
.matROI/seed sidecars and exposed only a subset of the engine's DIC modes.1. singledic slowness — fixed
Root cause:
SingleDicWorkflow::track()drove the engine throughncorr::NcorrSession::process_frame()one frame at a time. Each call ran plainDIC_analysis({ref, def}), which:loadOrCreateSeed()was never passed to the engine, only stored in the output;Fix: rewrote
track()to mirrorStepDWorkflow::runNcorrAnalysis(the proven stepD path), but driven from in-memorycv::Matframes (no temp-PNG round trip). It now builds one in-memoryImage2Dstack (ref + all frames), setsupdate_corrcoefto disable correlation-based reference updates, passes the user seed, and runs a singlematlab_DIC_analysis_parallel/_sequential(or theexact_matlab_*variants) pass — honouringconfig.parallel_processingandconfig.ncorr_use_exact_matlab.This brings in all three optimizations the production engine uses: parallel run, segment-based matlab-style, seeded ncorr. Semantically equivalent to the old per-frame loop (each frame still tracked against the fixed reference under
NO_UPDATE), just far faster.2. proxyncorr —
.matROI/seed + all ncorr modes.matROI:--roi/roi=now accepts an image (PNG/BMP/…) or an xDIC.matmask (refmaskvar), auto-detected by extension; default ROI now prefers<folder>/roi.matthenroi.png. The--in-memorypath is.mat-aware too..matseed:--seeds/seeds_file=now accepts a JSON array or aREF_SEED_*.mat(seed_point[x,y]).-m/--mode:auto,sequential,parallel(existing) plusmatlab-parallel,matlab-sequential,exact-matlab-parallel,exact-matlab-sequential(mode strings normalised; help/config docs updated).proxyncorrtarget.Testing
-DBUILD_SINGLEDIC=ON -DBUILD_PROXYNCORR=ONunder-Wall -Wextra(no new warnings from changed code).opencv_dnnfails to load with an ABI mismatch — this breaks every binary equally (the pre-existingcppxdic --helpfails identically). It's a local install skew, unrelated to these changes. Reviewer with a working OpenCV/protobuf should smoke-test:singledicon a single-camera trial (compare wall-clock per frame to before),proxyncorr -m matlab-parallel --roi REF_MASK_*.mat --seeds REF_SEED_*.mat.🤖 Generated with Claude Code