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 | Private Member Functions | Private Attributes | List of all members
DICe::Triangulation Class Reference

A class for computing the triangulation of 3d points from two correlation and a calibration file. More...

#include <DICe_Triangulation.h>

Public Member Functions

 Triangulation (const std::string &param_file_name)
 Default constructor. More...
 
 Triangulation ()
 constructor with no args More...
 
virtual ~Triangulation ()
 Pure virtual destructor.
 
std::vector< std::vector< scalar_t > > * cal_intrinsics ()
 returns a pointer to the calibration intrinsics
 
Matrix< scalar_t, 4 > * cam_0_to_cam_1 ()
 returns a pointer to the transform from camera 0 to camera 1
 
Matrix< scalar_t, 4 > * cam_0_to_world ()
 returns a pointer to the camera 0 to world extrinsics
 
scalar_t triangulate (const scalar_t &x0, const scalar_t &y0, const scalar_t &x1, const scalar_t &y1, scalar_t &xc_out, scalar_t &yc_out, scalar_t &zc_out, scalar_t &xw_out, scalar_t &yw_out, scalar_t &zw_out, const bool correct_lens_distortion=false)
 
void triangulate (const std::vector< scalar_t > &image_x, const std::vector< scalar_t > &image_y, std::vector< scalar_t > &xw_out, std::vector< scalar_t > &yw_out, std::vector< scalar_t > &zw_out)
 
void correct_lens_distortion_radial (scalar_t &x_s, scalar_t &y_s, const int_t camera_id)
 
int_t estimate_projective_transform (Teuchos::RCP< Image > left_img, Teuchos::RCP< Image > right_img, const bool output_projected_image=false, const bool use_nonlinear_projection=false, const int_t processor_id=0)
 
void project_left_to_right_sensor_coords (const scalar_t &xl, const scalar_t &yl, scalar_t &xr, scalar_t &yr)
 
void set_warp_params (Teuchos::RCP< std::vector< scalar_t > > &params)
 
Teuchos::RCP< std::vector< scalar_t > > warp_params () const
 return a pointer to the warp parameters
 
void set_projective_params (Teuchos::RCP< std::vector< scalar_t > > &params)
 
Teuchos::RCP< std::vector< scalar_t > > projective_params () const
 return a pointer to the projective parameters
 
void best_fit_plane (Teuchos::RCP< MultiField > &cx, Teuchos::RCP< MultiField > &cy, Teuchos::RCP< MultiField > &cz, Teuchos::RCP< MultiField > &sigma)
 
scalar_t cosine_of_two_vectors (const std::vector< scalar_t > &a, const std::vector< scalar_t > &b)
 
void reset_cam_0_to_world ()
 set the transform to the identity matrix
 

Private Member Functions

void load_calibration_parameters (const std::string &param_file_name)
 load the calibration parameters More...
 

Private Attributes

std::vector< std::vector< scalar_t > > cal_intrinsics_
 
Matrix< scalar_t, 4 > cam_0_to_cam_1_
 transformation from camera 0 to camera 1 coordinates
 
Matrix< scalar_t, 4 > cam_0_to_world_
 transformation from camera 0 to world model/physical coordinates
 
Teuchos::RCP< std::vector< scalar_t > > warp_params_
 12 parameters that define a warping (independent from intrinsic and extrinsic parameters)
 
Teuchos::RCP< std::vector< scalar_t > > projective_params_
 8 parameters that define a projective transform (independent from intrinsic and extrinsic parameters)
 
Teuchos::RCP< Camera_Systemcamera_system_
 save off a pointer to the camera system for use in the triangulation
 

Detailed Description

A class for computing the triangulation of 3d points from two correlation and a calibration file.

Constructor & Destructor Documentation

◆ Triangulation() [1/2]

DICe::Triangulation::Triangulation ( const std::string &  param_file_name)
inline

Default constructor.

Parameters
param_file_namethe name of the file to parse the calibration parameters from

◆ Triangulation() [2/2]

DICe::Triangulation::Triangulation ( )
inline

constructor with no args

at max there are 12 parameters that must be set (for the quadratic)

Member Function Documentation

◆ best_fit_plane()

void DICe::Triangulation::best_fit_plane ( Teuchos::RCP< MultiField > &  cx,
Teuchos::RCP< MultiField > &  cy,
Teuchos::RCP< MultiField > &  cz,
Teuchos::RCP< MultiField > &  sigma 
)

determine the best fit plane to the complete set of X Y Z coordinates (excluding any failed points)

Parameters
cxpointer to the x coordinates from the initial triangulation
cypointer to the y coordinates from the initial triangulation
czpointer to the z coordinates from the intiial triangulation
sigmapointer to the sigma field

◆ correct_lens_distortion_radial()

void DICe::Triangulation::correct_lens_distortion_radial ( scalar_t x_s,
scalar_t y_s,
const int_t  camera_id 
)

correct the lens distortion with a radial model

Parameters
x_sx sensor coordinate to correct, modified in place
y_sy sensor coordinate to correct, modified in place
camera_ideither 0 or 1

◆ cosine_of_two_vectors()

scalar_t DICe::Triangulation::cosine_of_two_vectors ( const std::vector< scalar_t > &  a,
const std::vector< scalar_t > &  b 
)

returns the cosine of the angle between two vectors

Parameters
avector a, must have three components
bvector b, must have three components

◆ estimate_projective_transform()

int_t DICe::Triangulation::estimate_projective_transform ( Teuchos::RCP< Image left_img,
Teuchos::RCP< Image right_img,
const bool  output_projected_image = false,
const bool  use_nonlinear_projection = false,
const int_t  processor_id = 0 
)

estimate the projective transform from the left to right image

Parameters
left_imgpointer to the left image
right_imgpointer to the right image
output_projected_imagetrue if an image should be output using the solution projection parameters
use_nonlinear_projectiontrue if an additional 12 nonlinear parameter projection model should be used
processor_idthe id of the process calling this routine returns 0 if successful -1 if the linear projection failed -2 if the nonlinear projection fails, -3 for other error

◆ load_calibration_parameters()

void DICe::Triangulation::load_calibration_parameters ( const std::string &  param_file_name)
private

load the calibration parameters

Parameters
param_file_nameFile name of the cal parameters file

◆ project_left_to_right_sensor_coords()

void DICe::Triangulation::project_left_to_right_sensor_coords ( const scalar_t xl,
const scalar_t yl,
scalar_t xr,
scalar_t yr 
)

determine the corresponding right sensor coordinates given the left using the projective transform

Parameters
xlleft x sensor coord
ylleft y sensor coord
xr[out] right x sensor coord
yr[out] right y sensor coord

◆ set_projective_params()

void DICe::Triangulation::set_projective_params ( Teuchos::RCP< std::vector< scalar_t > > &  params)
inline

set the projective parameter vector of the triangulation

Parameters
paramsthe projective parameters

◆ set_warp_params()

void DICe::Triangulation::set_warp_params ( Teuchos::RCP< std::vector< scalar_t > > &  params)
inline

set the warp parameter vector of the triangulation

Parameters
paramsthe projective parameters

◆ triangulate() [1/2]

scalar_t DICe::Triangulation::triangulate ( const scalar_t x0,
const scalar_t y0,
const scalar_t x1,
const scalar_t y1,
scalar_t xc_out,
scalar_t yc_out,
scalar_t zc_out,
scalar_t xw_out,
scalar_t yw_out,
scalar_t zw_out,
const bool  correct_lens_distortion = false 
)

triangulate the optimal point in 3D. returns the the max value of the psuedo matrix global coordinates are always defined with camera 0 as the origin unless another transformation is requested by specifying a transformation file

Parameters
x0sensor x coordinate of the point in camera 0
y0sensor y coordinate of the point in camera 0
x1sensor x coordinate of the point in camera 1
y1sensor y coordinate of the point in camera 1
xc_outglobal x position in camera 0 coords
yc_outglobal y position in camera 0 coords
zc_outglobal z position in camera 0 coords
xw_outglobal x position in world coords
yw_outglobal y position in world coords
zw_outglobal z position in world coords
correct_lens_distortioncorrect for lens distortion

◆ triangulate() [2/2]

void DICe::Triangulation::triangulate ( const std::vector< scalar_t > &  image_x,
const std::vector< scalar_t > &  image_y,
std::vector< scalar_t > &  xw_out,
std::vector< scalar_t > &  yw_out,
std::vector< scalar_t > &  zw_out 
)

triangulate the optimal point in 3D (from 2d data with calibration). global coordinates are always defined with camera 0 as the origin unless another transformation is requested by specifying a transformation file

Parameters
image_xvector of image x coordinates
image_yvector of image y coordinates
xw_outvector of global x positions in world coords
yw_outvector of global y positions in world coords
zw_outvector of global z positions in world coords

Member Data Documentation

◆ cal_intrinsics_

std::vector<std::vector<scalar_t> > DICe::Triangulation::cal_intrinsics_
private

vector camera intrinsics vectors, one for camera 0 and one for camera 1 See Camera::Cam_Intrinsic_Param for the ordering of the parameters in the vector