CppNCorr
C++ ncorr Digital Image Correlation engine
Loading...
Searching...
No Matches
ncorr::NcorrSession Class Reference

Drives an in-memory Digital Image Correlation session. More...

#include <session.h>

Classes

struct  Impl
 

Public Member Functions

 NcorrSession (const SessionConfig &config=SessionConfig())
 Construct a session with the given configuration.
 
 ~NcorrSession ()
 Destructor (defined in session.cpp because of the PIMPL).
 
 NcorrSession (NcorrSession &&) noexcept
 
NcorrSessionoperator= (NcorrSession &&) noexcept
 
 NcorrSession (const NcorrSession &)=delete
 
NcorrSessionoperator= (const NcorrSession &)=delete
 
void set_reference (const ImageBuffer &ref)
 Set the reference (undeformed) frame.
 
void set_roi (const ImageBuffer &roi_mask)
 Optionally supply a region-of-interest mask.
 
DICResult process_frame (const ImageBuffer &def)
 Push a deformed frame and run DIC against the reference.
 
bool has_reference () const
 

Detailed Description

Drives an in-memory Digital Image Correlation session.

Typical lifecycle:

ncorr::NcorrSession session(cfg);
session.set_reference(ref_buffer); // once
auto r1 = session.process_frame(def1); // per deformed frame
auto r2 = session.process_frame(def2);
Drives an in-memory Digital Image Correlation session.
Definition session.h:138

The session owns a private implementation (PIMPL) so that this header stays free of heavy internal ncorr includes.

Each call to process_frame runs a full DIC_analysis on {reference, deformed} and returns the native Lagrangian pixel displacements (and correlation coefficient) on the reduced analysis grid.

Definition at line 138 of file session.h.

Constructor & Destructor Documentation

◆ NcorrSession() [1/3]

ncorr::NcorrSession::NcorrSession ( const SessionConfig config = SessionConfig())
explicit

Construct a session with the given configuration.

Parameters
configTuneable DIC parameters (defaults match Config).

Definition at line 61 of file session.cpp.

◆ ~NcorrSession()

ncorr::NcorrSession::~NcorrSession ( )
default

Destructor (defined in session.cpp because of the PIMPL).

◆ NcorrSession() [2/3]

ncorr::NcorrSession::NcorrSession ( NcorrSession &&  )
defaultnoexcept

◆ NcorrSession() [3/3]

ncorr::NcorrSession::NcorrSession ( const NcorrSession )
delete

Member Function Documentation

◆ has_reference()

bool ncorr::NcorrSession::has_reference ( ) const
Returns
true once a valid reference frame has been set.

Definition at line 175 of file session.cpp.

◆ operator=() [1/2]

NcorrSession & ncorr::NcorrSession::operator= ( const NcorrSession )
delete

◆ operator=() [2/2]

NcorrSession & ncorr::NcorrSession::operator= ( NcorrSession &&  )
defaultnoexcept

◆ process_frame()

DICResult ncorr::NcorrSession::process_frame ( const ImageBuffer def)

Push a deformed frame and run DIC against the reference.

Parameters
defDeformed image buffer (same geometry as the reference).
Returns
A DICResult; on failure valid is false and message explains why.
Exceptions
std::logic_errorif no reference has been set.

Definition at line 97 of file session.cpp.

◆ set_reference()

void ncorr::NcorrSession::set_reference ( const ImageBuffer ref)

Set the reference (undeformed) frame.

Call once before processing.

The pixel data is copied into the session, so ref need not outlive the call. Calling again replaces the reference and invalidates prior state.

Parameters
refReference image buffer.
Exceptions
std::invalid_argumentif ref is not valid().

Definition at line 68 of file session.cpp.

◆ set_roi()

void ncorr::NcorrSession::set_roi ( const ImageBuffer roi_mask)

Optionally supply a region-of-interest mask.

The mask must match the reference geometry; any pixel whose grayscale value exceeds 0.5 marks a point to analyse. If never called, the whole frame is analysed. Setting a new reference clears any prior ROI.

Parameters
roi_maskROI mask buffer (same width/height as the reference).
Exceptions
std::invalid_argumentif the mask is invalid or, when a reference is set, its geometry does not match the reference.

Definition at line 82 of file session.cpp.


The documentation for this class was generated from the following files: