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
|
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 ¶m_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 > > ¶ms) |
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 > > ¶ms) |
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 ¶m_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_System > | camera_system_ |
save off a pointer to the camera system for use in the triangulation | |
A class for computing the triangulation of 3d points from two correlation and a calibration file.
|
inline |
Default constructor.
param_file_name | the name of the file to parse the calibration parameters from |
|
inline |
constructor with no args
at max there are 12 parameters that must be set (for the quadratic)
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)
cx | pointer to the x coordinates from the initial triangulation |
cy | pointer to the y coordinates from the initial triangulation |
cz | pointer to the z coordinates from the intiial triangulation |
sigma | pointer to the sigma field |
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
x_s | x sensor coordinate to correct, modified in place |
y_s | y sensor coordinate to correct, modified in place |
camera_id | either 0 or 1 |
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
a | vector a, must have three components |
b | vector b, must have three components |
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
left_img | pointer to the left image |
right_img | pointer to the right image |
output_projected_image | true if an image should be output using the solution projection parameters |
use_nonlinear_projection | true if an additional 12 nonlinear parameter projection model should be used |
processor_id | the 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 |
|
private |
load the calibration parameters
param_file_name | File name of the cal parameters file |
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
xl | left x sensor coord |
yl | left y sensor coord |
xr | [out] right x sensor coord |
yr | [out] right y sensor coord |
|
inline |
set the projective parameter vector of the triangulation
params | the projective parameters |
|
inline |
set the warp parameter vector of the triangulation
params | the projective parameters |
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
x0 | sensor x coordinate of the point in camera 0 |
y0 | sensor y coordinate of the point in camera 0 |
x1 | sensor x coordinate of the point in camera 1 |
y1 | sensor y coordinate of the point in camera 1 |
xc_out | global x position in camera 0 coords |
yc_out | global y position in camera 0 coords |
zc_out | global z position in camera 0 coords |
xw_out | global x position in world coords |
yw_out | global y position in world coords |
zw_out | global z position in world coords |
correct_lens_distortion | correct for lens distortion |
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
image_x | vector of image x coordinates |
image_y | vector of image y coordinates |
xw_out | vector of global x positions in world coords |
yw_out | vector of global y positions in world coords |
zw_out | vector of global z positions in world coords |
|
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