Digital Image Correlation Engine  Version 1.0
A modular, high-performance, image correlation tool used to compute full-field displacements and strains from digital images
Public Member Functions | Protected Attributes | List of all members
DICe::Optical_Flow_Initializer Class Reference

an initializer that uses optical flow to predict the next location of the subset (Lucas-Kanade algorithm). This initializer is only intended for the TRACKING_ROUTINE correlation routine More...

#include <DICe_Initializer.h>

Inheritance diagram for DICe::Optical_Flow_Initializer:
DICe::Initializer

Public Member Functions

 Optical_Flow_Initializer (Schema *schema, Teuchos::RCP< Subset > subset)
 
virtual ~Optical_Flow_Initializer ()
 virtual destructor
 
virtual void pre_execution_tasks ()
 see base class description
 
virtual Status_Flag initial_guess (const int_t subset_gid, Teuchos::RCP< Local_Shape_Function > shape_function)
 see base class description
 
size_t neighbor (const int_t pixel_id, const int_t neighbor_index) const
 
Status_Flag set_locations (const int_t subset_gid)
 
int_t best_optical_flow_point (scalar_t &best_grad, Teuchos::ArrayRCP< int_t > &def_x, Teuchos::ArrayRCP< int_t > &def_y, Teuchos::ArrayRCP< scalar_t > &gx, Teuchos::ArrayRCP< scalar_t > &gy, std::set< std::pair< int_t, int_t > > &subset_pixels, Teuchos::RCP< std::vector< int_t > > existing_points=Teuchos::null, const bool allow_close_points=false)
 
bool is_near_deactivated (const int_t pixel_id)
 
- Public Member Functions inherited from DICe::Initializer
 Initializer (Schema *schema)
 base class constructor
 
virtual ~Initializer ()
 virtual destructor
 

Protected Attributes

Teuchos::RCP< Subsetsubset_
 pointer to the subset being initialized
 
size_t num_neighbors_
 k-closest neighbors for each point in the set of triads
 
int_t window_size_
 size of the window
 
int_t half_window_size_
 half the size of the window
 
std::vector< size_t > neighbors_
 a strided array of neighbor ids
 
Teuchos::RCP< kd_tree_2d_t > kd_tree_
 pointer to the kd-tree used for searching
 
Teuchos::RCP< Point_Cloud_2D< scalar_t > > point_cloud_
 pointer to the point cloud used for the neighbor searching
 
scalar_t window_coeffs_ [13][13]
 Gauss filter coefficients.
 
int_t ref_pt1_x_
 x coord of reference position for optical flow 1
 
int_t ref_pt1_y_
 y coord of reference position for optical flow 1
 
int_t ref_pt2_x_
 x coord of reference position for optical flow 2
 
int_t ref_pt2_y_
 y coord of reference position for optical flow 2
 
scalar_t current_pt1_x_
 x coord of current position for optical flow 1
 
scalar_t current_pt1_y_
 y coord of current position for optical flow 1
 
scalar_t current_pt2_x_
 x coord of current position for optical flow 2
 
scalar_t current_pt2_y_
 y coord of current position for optical flow 2
 
bool reset_locations_
 flag to reset the optical flow positions
 
scalar_t delta_1c_x_
 x comp of vector from optical flow position 1 to the centroid
 
scalar_t delta_1c_y_
 y comp of vector from optical flow position 1 to the centroid
 
scalar_t delta_12_x_
 x comp of vector from optical flow position 1 to position 2
 
scalar_t delta_12_y_
 y comp vector from optical flow position 1 to position 2
 
scalar_t mag_ref_
 magnitude of the vector between positions 1 and 2 in the reference frame
 
scalar_t ref_cx_
 reference centroid x
 
scalar_t ref_cy_
 reference centroid y
 
scalar_t initial_u_
 initial displacement for this sequence
 
scalar_t initial_v_
 initial displacement for this sequence
 
scalar_t initial_t_
 initial rotation for this sequence
 
int_t ids_ [2]
 pixel ids of the optical flow points
 
- Protected Attributes inherited from DICe::Initializer
Schemaschema_
 pointer to the schema that created this initializer, used for field access
 

Detailed Description

an initializer that uses optical flow to predict the next location of the subset (Lucas-Kanade algorithm). This initializer is only intended for the TRACKING_ROUTINE correlation routine

Initially, two pixels are selected as the locations for doing optical flow based the gradient values for each pixel. If one of the pixels become obstructed the locations need to be reset. The word reference in this class is used to denote the first frame after the positions have been reset. The displacements and rotations are cumulative starting with the reference frame. If the positions need to be reset due to obstructions, the optical flow routine restarts from the new location, which is now the reference frame.

Constructor & Destructor Documentation

◆ Optical_Flow_Initializer()

DICe::Optical_Flow_Initializer::Optical_Flow_Initializer ( Schema schema,
Teuchos::RCP< Subset subset 
)

constructor

Parameters
schemathe parent schema
subsetpointer to the subset for this initializer

Member Function Documentation

◆ best_optical_flow_point()

int_t DICe::Optical_Flow_Initializer::best_optical_flow_point ( scalar_t best_grad,
Teuchos::ArrayRCP< int_t > &  def_x,
Teuchos::ArrayRCP< int_t > &  def_y,
Teuchos::ArrayRCP< scalar_t > &  gx,
Teuchos::ArrayRCP< scalar_t > &  gy,
std::set< std::pair< int_t, int_t > > &  subset_pixels,
Teuchos::RCP< std::vector< int_t > >  existing_points = Teuchos::null,
const bool  allow_close_points = false 
)

returns the pixel id of the best location for optical flow

Parameters
best_grad[out] the gradient metric at the best location for an optical flow point
existing_pointsthe set of global ids for points that are already OF points
def_xarray of the deformed x coordinates for the pixels
def_yarray of the deformed y coordinates for the pixels
gxthe array of x gradient values from the deformed location
gythe array of y gradient values from the deformed location
subset_pixelsthe current pixels occupied by the subset in the deformed configuration
existing_pointsvector of the existing optical flow points
allow_close_pointsenable the point locations to be near each other (usually leads to more error)

◆ is_near_deactivated()

bool DICe::Optical_Flow_Initializer::is_near_deactivated ( const int_t  pixel_id)

returns true if the point is deactivated or neighbors a deactivated pixel

Parameters
pixel_idthe index of the pixel to test

◆ neighbor()

size_t DICe::Optical_Flow_Initializer::neighbor ( const int_t  pixel_id,
const int_t  neighbor_index 
) const
inline

returns the id of the neighbor pixel

Parameters
pixel_idthe id of the pixel to gather a neighbor for
neighbor_indexthe index of the neighbor

◆ set_locations()

Status_Flag DICe::Optical_Flow_Initializer::set_locations ( const int_t  subset_gid)

determine the best locations in the subset to do optical flow based on the gradients

Parameters
subset_gidthe global id of the subset using this initializer