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 Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
DICe::Camera_System Class Reference

A class for camera calibration parameters and computing projection transformations notes: there is only one source camera per camera system, this determines how the coordinate systems are organized. All other cameras are target cameras. More...

#include <DICe_CameraSystem.h>

Public Types

enum  System_Type_3D {
  UNKNOWN_SYSTEM = 0, GENERIC_SYSTEM, OPENCV, VIC3D,
  DICE, MAX_SYSTEM_TYPE_3D, NO_SUCH_SYSTEM_TYPE_3D
}
 
enum  Coordinate_Transformation_Param {
  ANGLE_X = 0, ANGLE_Y, ANGLE_Z, TRANSLATION_X,
  TRANSLATION_Y, TRANSLATION_Z
}
 

Public Member Functions

 Camera_System ()
 default constructor
 
 Camera_System (const std::string &param_file_name)
 constructor More...
 
void read_camera_system_file (const std::string &file)
 read the camera system parameters More...
 
void write_camera_system_file (const std::string &file)
 write the camera system parameters to an xml file More...
 
void set_system_type (const System_Type_3D system_type)
 set the system type More...
 
System_Type_3D system_type () const
 get the integer value for the current system type More...
 
scalar_t diff (const Camera_System &rhs) const
 diffs all the cameras that make up a camera system
 
bool extrinsics_relative_camera_to_camera () const
 
size_t get_camera_num_from_id (std::string &cam_id) const
 returns the number of the first camera with a matching identifier More...
 
Teuchos::RCP< Cameracamera (const size_t i) const
 return a pointer to the camera with this vector index
 
size_t num_cameras () const
 return the number of cameras
 
void add_camera (Teuchos::RCP< Camera > camera_ptr)
 add a camera to the set
 
Matrix< scalar_t, 3 > fundamental_matrix (const size_t source_cam_id=0, const size_t target_cam_id=1)
 calculate the fundamental matrix for a set of cameras
 
void camera_to_camera_projection (const size_t source_id, const size_t target_id, const std::vector< scalar_t > &img_source_x, const std::vector< scalar_t > &img_source_y, std::vector< scalar_t > &img_target_x, std::vector< scalar_t > &img_target_y, const std::vector< scalar_t > &facet_params, std::vector< std::vector< scalar_t > > &img_target_dx, std::vector< std::vector< scalar_t > > &img_target_dy, const std::vector< scalar_t > &rigid_body_params=std::vector< scalar_t >())
 3 parameter projection routine from the one camera to another camera More...
 
void camera_to_camera_projection (const size_t source_id, const size_t target_id, const std::vector< scalar_t > &img_source_x, const std::vector< scalar_t > &img_source_y, std::vector< scalar_t > &img_target_x, std::vector< scalar_t > &img_target_y, const std::vector< scalar_t > &facet_params, const std::vector< scalar_t > &rigid_body_params=std::vector< scalar_t >())
 same as above, only do not compute the partials
 
void rot_trans_3D (const std::vector< scalar_t > &source_x, const std::vector< scalar_t > &source_y, const std::vector< scalar_t > &source_z, std::vector< scalar_t > &target_x, std::vector< scalar_t > &target_y, std::vector< scalar_t > &target_z, const std::vector< scalar_t > &rigid_body_params, std::vector< std::vector< scalar_t > > &target_dx, std::vector< std::vector< scalar_t > > &target_dy, std::vector< std::vector< scalar_t > > &target_dz)
 
void rot_trans_3D (const std::vector< scalar_t > &source_x, const std::vector< scalar_t > &source_y, const std::vector< scalar_t > &source_z, std::vector< scalar_t > &target_x, std::vector< scalar_t > &target_y, std::vector< scalar_t > &target_z, const std::vector< scalar_t > &rigid_body_params)
 same as above with no partials
 

Static Public Member Functions

static std::string to_string (System_Type_3D in)
 
static System_Type_3D string_to_system_type_3d (std::string &in)
 

Private Attributes

const size_t max_num_cameras_allowed_
 sets the number of cameras that can be in an input file
 
Matrix< scalar_t, 4 > user_4x4_trans_
 
std::vector< scalar_tuser_6x1_trans_
 8 parameters that define a projective transform (independent from intrinsic and extrinsic parameters)
 
System_Type_3D sys_type_
 defines the camera system type (OPENCV VIC3D...)
 
bool has_6_transform_
 the user defined a 6 parameter transform to modify the world coordinate system
 
bool has_4x4_transform_
 the user defined a 4x transform to another coordinate system to use for the world coordinates
 
bool extrinsics_relative_camera_to_camera_
 
std::vector< Teuchos::RCP< DICe::Camera > > cameras_
 cameras are stored in a vector
 

Friends

DICE_LIB_DLL_EXPORT friend bool operator== (const Camera_System &lhs, const Camera_System &rhs)
 comparison operator
 
DICE_LIB_DLL_EXPORT friend bool operator!= (const Camera_System &lhs, const Camera_System &rhs)
 comparison operator
 
DICE_LIB_DLL_EXPORT friend std::ostream & operator<< (std::ostream &os, const Camera_System &camera_system)
 overaload the ostream operator for a camera system class
 

Detailed Description

A class for camera calibration parameters and computing projection transformations notes: there is only one source camera per camera system, this determines how the coordinate systems are organized. All other cameras are target cameras.

Member Enumeration Documentation

◆ Coordinate_Transformation_Param

rigid body rotation parameter index

◆ System_Type_3D

valid system types

Constructor & Destructor Documentation

◆ Camera_System()

DICe::Camera_System::Camera_System ( const std::string &  param_file_name)

constructor

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

Member Function Documentation

◆ camera_to_camera_projection()

void DICe::Camera_System::camera_to_camera_projection ( const size_t  source_id,
const size_t  target_id,
const std::vector< scalar_t > &  img_source_x,
const std::vector< scalar_t > &  img_source_y,
std::vector< scalar_t > &  img_target_x,
std::vector< scalar_t > &  img_target_y,
const std::vector< scalar_t > &  facet_params,
std::vector< std::vector< scalar_t > > &  img_target_dx,
std::vector< std::vector< scalar_t > > &  img_target_dy,
const std::vector< scalar_t > &  rigid_body_params = std::vector< scalar_t >() 
)

3 parameter projection routine from the one camera to another camera

Parameters
source_idthe number id of the source camera
target_idthe camera id of the target camera.
img_source_xarray of x image location in the source camera
img_source_yarray of y image location in the source camera
img_targe_xarray of projected x image location in the target camera
img_target_yarray of projected y image location in the target camera
facet_paramsarray of ZP, THETA, PHI values that govern the projection
img_target_dxarray of arrays of the partials in the x location wrt (ZP, THETA, PHI)
img_target_dyarray of arrays of the partials in the y location wrt (ZP, THETA, PHI)
rigid_body_params6 rotation/translation parameters to describe the rigid body motion if the rigid_body_params argument is specified points in space are established by projecting them using the 3 parameter projection, they are then transformed in a rigid body manner to a second location which is then projected into the target camera. ZP, THETA and PHI are considered fixed

◆ extrinsics_relative_camera_to_camera()

bool DICe::Camera_System::extrinsics_relative_camera_to_camera ( ) const
inline

returns true if the extrinsic parameters are camera to camera relative rather than from world to camera (if this is the case, the first camera's extrinsics are world to camera 0, the second camera's extrinsics are the camera 0 to camera 1 transformation) This is included for legacy reasons

◆ get_camera_num_from_id()

size_t DICe::Camera_System::get_camera_num_from_id ( std::string &  cam_id) const
inline

returns the number of the first camera with a matching identifier

Parameters
cam_idcamera identifying string

◆ read_camera_system_file()

void DICe::Camera_System::read_camera_system_file ( const std::string &  file)

read the camera system parameters

Parameters
fileFile name of the parameters file

◆ rot_trans_3D()

void DICe::Camera_System::rot_trans_3D ( const std::vector< scalar_t > &  source_x,
const std::vector< scalar_t > &  source_y,
const std::vector< scalar_t > &  source_z,
std::vector< scalar_t > &  target_x,
std::vector< scalar_t > &  target_y,
std::vector< scalar_t > &  target_z,
const std::vector< scalar_t > &  rigid_body_params,
std::vector< std::vector< scalar_t > > &  target_dx,
std::vector< std::vector< scalar_t > > &  target_dy,
std::vector< std::vector< scalar_t > > &  target_dz 
)

rigid body 3D rotation/translation transformation with no incoming partials and outgoing partials wrt params

Parameters
source_xarray of initial x world position of the point
source_yarray of initial y world position of the point
source_zarray of initial z world position of the point
targe_xarray of x world position of the point after the transformation
target_yarray of y world position of the point after the transformation
target_zarray of z world position of the point after the transformation
rigid_body_params6 rotation/translation parameters to describe the rigid body motion (3 angles 3 translations)
target_dxarray of arrays of the partials in the x world location wrt params
target_dyarray of arrays of the partials in the y world location wrt params
target_dyarray of arrays of the partials in the z world location wrt params

◆ set_system_type()

void DICe::Camera_System::set_system_type ( const System_Type_3D  system_type)
inline

set the system type

Parameters
system_typea System_Type_3D enum

◆ system_type()

System_Type_3D DICe::Camera_System::system_type ( ) const
inline

get the integer value for the current system type

Parameters
system_typeinteger system type value

◆ write_camera_system_file()

void DICe::Camera_System::write_camera_system_file ( const std::string &  file)

write the camera system parameters to an xml file

Parameters
fileFile name of the parameters file to write to

Member Data Documentation

◆ extrinsics_relative_camera_to_camera_

bool DICe::Camera_System::extrinsics_relative_camera_to_camera_
private

the standard convention is to have the camera extrinsics be from world to camera when this flag is true, the extrinsics are the transformation from the left camera to the right instead

◆ user_4x4_trans_

Matrix<scalar_t,4> DICe::Camera_System::user_4x4_trans_
private

these are for compatibility with triangulation and only support 2 camera systems 12 parameters that define a user supplied transforamation (independent from intrinsic and extrinsic parameters)