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 camera calibration parameters and computing single camera projection based transformations. More...
#include <DICe_Camera.h>
Classes | |
struct | Camera_Info |
helper struct for camera initialization (cleans up of the constructors for camera class so it only needs one) More... | |
Public Types | |
enum | Lens_Distortion_Model { NO_LENS_DISTORTION = 0, OPENCV_LENS_DISTORTION, VIC3D_LENS_DISTORTION, K1R1_K2R2_K3R3, K1R2_K2R4_K3R6, K1R3_K2R5_K3R7, MAX_LENS_DISTORTION_MODEL, NO_SUCH_LENS_DISTORTION_MODEL } |
enum | Cam_Intrinsic_Param { CX = 0, CY, FX, FY, FS, K1, K2, K3, K4, K5, K6, P1, P2, S1, S2, S3, S4, T1, T2, MAX_CAM_INTRINSIC_PARAM, NO_SUCH_CAM_INTRINSIC_PARAM } |
Public Member Functions | |
Camera (const Camera_Info &camera_info) | |
constructor | |
virtual | ~Camera () |
Pure virtual destructor. | |
void | set_id (const std::string &cam_id) |
std::string | id () const |
void | set_lens (const std::string &camera_lens) |
std::string | lens () const |
void | set_comments (const std::string &camera_comments) |
std::string | comments () const |
int_t | image_height () const |
gets the image height returns the height of the image in pixels | |
int_t | image_width () const |
gets the image width returns the width of the image in pixels | |
int_t | pixel_depth () const |
Lens_Distortion_Model | lens_distortion_model () const |
Matrix< scalar_t, 4 > | transformation_matrix () const |
std::vector< scalar_t > | get_facet_params () |
std::vector< scalar_t > * | intrinsics () |
gets the intrinsic camera parameter values | |
scalar_t | tx () const |
get the x extrinsic translation | |
scalar_t | ty () const |
get the y extrinsic translation | |
scalar_t | tz () const |
get the z extrinsic translation | |
const Camera_Info * | camera_info () const |
const Matrix< scalar_t, 3 > * | rotation_matrix () const |
const Matrix< scalar_t, 4 > * | cam_world_trans_matrix () const |
const Matrix< scalar_t, 4 > * | world_cam_trans_matrix () const |
void | initialize () |
prepares the tranfomation matricies | |
void | sensor_to_image (const std::vector< scalar_t > &sen_x, const std::vector< scalar_t > &sen_y, std::vector< scalar_t > &image_x, std::vector< scalar_t > &image_y, const std::vector< std::vector< scalar_t > > &sen_dx, const std::vector< std::vector< scalar_t > > &sen_dy, std::vector< std::vector< scalar_t > > &image_dx, std::vector< std::vector< scalar_t > > &image_dy) |
void | sensor_to_image (const std::vector< scalar_t > &sen_x, const std::vector< scalar_t > &sen_y, std::vector< scalar_t > &image_x, std::vector< scalar_t > &image_y) |
same as above without derivatives | |
void | image_to_sensor (const std::vector< scalar_t > &image_x, const std::vector< scalar_t > &image_y, std::vector< scalar_t > &sen_x, std::vector< scalar_t > &sen_y, const bool integer_locs=true) |
void | image_to_world (const std::vector< scalar_t > &image_x, const std::vector< scalar_t > &image_y, const std::vector< scalar_t > &rigid_body_params, std::vector< scalar_t > &world_x, std::vector< scalar_t > &world_y, std::vector< scalar_t > &world_z) |
void | image_to_world (const std::vector< scalar_t > &image_x, const std::vector< scalar_t > &image_y, std::vector< scalar_t > &world_x, std::vector< scalar_t > &world_y, std::vector< scalar_t > &world_z) |
void | sensor_to_cam (const std::vector< scalar_t > &sen_x, const std::vector< scalar_t > &sen_y, std::vector< scalar_t > &cam_x, std::vector< scalar_t > &cam_y, std::vector< scalar_t > &cam_z, const std::vector< scalar_t > &facet_params, std::vector< std::vector< scalar_t > > &cam_dx, std::vector< std::vector< scalar_t > > &cam_dy, std::vector< std::vector< scalar_t > > &cam_dz) |
void | sensor_to_cam (const std::vector< scalar_t > &sen_x, const std::vector< scalar_t > &sen_y, std::vector< scalar_t > &cam_x, std::vector< scalar_t > &cam_y, std::vector< scalar_t > &cam_z, const std::vector< scalar_t > &facet_params) |
same as above with no derivatives | |
void | cam_to_sensor (const std::vector< scalar_t > &cam_x, const std::vector< scalar_t > &cam_y, const std::vector< scalar_t > &cam_z, std::vector< scalar_t > &sen_x, std::vector< scalar_t > &sen_y, const std::vector< std::vector< scalar_t > > &cam_dx, const std::vector< std::vector< scalar_t > > &cam_dy, const std::vector< std::vector< scalar_t > > &cam_dz, std::vector< std::vector< scalar_t > > &sen_dx, std::vector< std::vector< scalar_t > > &sen_dy) |
void | cam_to_sensor (const std::vector< scalar_t > &cam_x, const std::vector< scalar_t > &cam_y, const std::vector< scalar_t > &cam_z, std::vector< scalar_t > &sen_x, std::vector< scalar_t > &sen_y) |
same as above without derivatives | |
void | cam_to_world (const std::vector< scalar_t > &cam_x, const std::vector< scalar_t > &cam_y, const std::vector< scalar_t > &cam_z, std::vector< scalar_t > &wrld_x, std::vector< scalar_t > &wrld_y, std::vector< scalar_t > &wrld_z, std::vector< std::vector< scalar_t > > &cam_dx, std::vector< std::vector< scalar_t > > &cam_dy, std::vector< std::vector< scalar_t > > &cam_dz, std::vector< std::vector< scalar_t > > &wrld_dx, std::vector< std::vector< scalar_t > > &wrld_dy, std::vector< std::vector< scalar_t > > &wrld_dz) |
void | cam_to_world (const std::vector< scalar_t > &cam_x, const std::vector< scalar_t > &cam_y, const std::vector< scalar_t > &cam_z, std::vector< scalar_t > &wrld_x, std::vector< scalar_t > &wrld_y, std::vector< scalar_t > &wrld_z) |
same as above without derivatives | |
void | world_to_cam (const std::vector< scalar_t > &wrld_x, const std::vector< scalar_t > &wrld_y, const std::vector< scalar_t > &wrld_z, std::vector< scalar_t > &cam_x, std::vector< scalar_t > &cam_y, std::vector< scalar_t > &cam_z, const std::vector< std::vector< scalar_t > > &wrld_dx, const std::vector< std::vector< scalar_t > > &wrld_dy, const std::vector< std::vector< scalar_t > > &wrld_dz, std::vector< std::vector< scalar_t > > &cam_dx, std::vector< std::vector< scalar_t > > &cam_dy, std::vector< std::vector< scalar_t > > &cam_dz) |
void | world_to_cam (const std::vector< scalar_t > &wrld_x, const std::vector< scalar_t > &wrld_y, const std::vector< scalar_t > &wrld_z, std::vector< scalar_t > &cam_x, std::vector< scalar_t > &cam_y, std::vector< scalar_t > &cam_z) |
same as above without derivatives | |
scalar_t | diff (const Camera &rhs) const |
compare the intrinsics and extrinsic values for a camera | |
Static Public Member Functions | |
static std::string | to_string (Lens_Distortion_Model in) |
static Lens_Distortion_Model | string_to_lens_distortion_model (std::string &in) |
static std::string | to_string (Cam_Intrinsic_Param in) |
static Cam_Intrinsic_Param | string_to_cam_intrinsic_param (std::string &in) |
static void | transform_coordinates_in_place (std::vector< scalar_t > &x, std::vector< scalar_t > &y, std::vector< scalar_t > &z, const std::vector< scalar_t > &rigid_body_params) |
static void | transform_coordinates_in_place (std::vector< scalar_t > &x, std::vector< scalar_t > &y, std::vector< scalar_t > &z, const Matrix< scalar_t, 3 > &R, const scalar_t &tx, const scalar_t &ty, const scalar_t &tz) |
rotation matrix and translations version | |
static void | transform_coordinates_in_place (std::vector< scalar_t > &x, std::vector< scalar_t > &y, std::vector< scalar_t > &z, const Matrix< scalar_t, 4 > &T) |
transformation matrix version | |
Private Member Functions | |
void | rot_trans_transform (const Matrix< scalar_t, 4 > &RT_matrix, const std::vector< scalar_t > &in_x, const std::vector< scalar_t > &in_y, const std::vector< scalar_t > &in_z, std::vector< scalar_t > &out_x, std::vector< scalar_t > &out_y, std::vector< scalar_t > &out_z, const std::vector< std::vector< scalar_t > > &in_dx, const std::vector< std::vector< scalar_t > > &in_dy, const std::vector< std::vector< scalar_t > > &in_dz, std::vector< std::vector< scalar_t > > &out_dx, std::vector< std::vector< scalar_t > > &out_dy, std::vector< std::vector< scalar_t > > &out_dz) |
void | rot_trans_transform (const Matrix< scalar_t, 4 > &RT_matrix, const std::vector< scalar_t > &in_x, const std::vector< scalar_t > &in_y, const std::vector< scalar_t > &in_z, std::vector< scalar_t > &out_x, std::vector< scalar_t > &out_y, std::vector< scalar_t > &out_z) |
same as above with no partial derivatives | |
void | prep_lens_distortion () |
creates the image values for the inverse lens distortion | |
void | prep_transforms () |
creates the rotation/translation matricies and inverses | |
Private Attributes | |
Camera_Info | camera_info_ |
struct that holds all the initialization information | |
std::vector< scalar_t > | inv_lens_dis_x_ |
std::vector< scalar_t > | inv_lens_dis_y_ |
Matrix< scalar_t, 4 > | cam_world_trans_ |
Matrix< scalar_t, 4 > | world_cam_trans_ |
scalar_t | zero_ish_ |
Friends | |
DICE_LIB_DLL_EXPORT friend bool | operator== (const Camera &lhs, const Camera &rhs) |
comparison operator | |
DICE_LIB_DLL_EXPORT friend bool | operator!= (const Camera &lhs, const Camera &rhs) |
comparison operator | |
DICE_LIB_DLL_EXPORT friend std::ostream & | operator<< (std::ostream &os, const Camera &camera) |
overaload the ostream operator for a camera class | |
A class for camera calibration parameters and computing single camera projection based transformations.
valid intrinsic parameters index values
valid lens distortion model values
void DICe::Camera::cam_to_sensor | ( | const std::vector< scalar_t > & | cam_x, |
const std::vector< scalar_t > & | cam_y, | ||
const std::vector< scalar_t > & | cam_z, | ||
std::vector< scalar_t > & | sen_x, | ||
std::vector< scalar_t > & | sen_y, | ||
const std::vector< std::vector< scalar_t > > & | cam_dx, | ||
const std::vector< std::vector< scalar_t > > & | cam_dy, | ||
const std::vector< std::vector< scalar_t > > & | cam_dz, | ||
std::vector< std::vector< scalar_t > > & | sen_dx, | ||
std::vector< std::vector< scalar_t > > & | sen_dy | ||
) |
projects camera x,y,z locations back onto the sensor overloaded with input and output first partials
cam_x | x location in cam x,y,z space |
cam_y | y location in cam x,y,z space |
cam_z | z location in cam x,y,z space |
sen_x | projected x sensor location |
sen_y | projected y sensor location |
cam_dx | first partials of the cam locations from previous projections |
cam_dy | first partials of the cam locations from previous projections |
cam_dz | first partials of the cam locations from previous projections |
sen_dx | first partials of the projected x sensor location |
sen_dy | first partials of the projected y sensor location |
|
inline |
converts the camera x,y,z cooldinates to a world x,y,z coordinate system overloaded with first partials
cam_x | x location in cam x,y,z space |
cam_y | y location in cam x,y,z space |
cam_z | z location in cam x,y,z space |
wrld_x | x location in the world x,y,z space |
wrld_y | y location in the world x,y,z space |
wrld_z | z location in the world x,y,z space |
cam_dx | first partials of the x cam locations from previous projections |
cam_dy | first partials of the y cam locations from previous projections |
cam_dz | first partials of the z cam locations from previous projections |
wrld_dx | first partials of the x world locations |
wrld_dy | first partials of the y world locations |
wrld_dz | first partials of the z world locations |
gets the camera to world transformation matrix cam_world_trans 4x4 [R|T] transformation matrix {cam(x,y,z)}=[R|T]{world(x,y,z)}
|
inline |
gets the camera comments returns the camera comments
std::vector<scalar_t> DICe::Camera::get_facet_params | ( | ) |
returns the facet parameters from R and T (if they describe the pose estimation, likely from 2d calibration) in 3d, R and T describe a coordinate transformation, not the pose estimation of the calibration plate so this is only a useful method for 2d calibration
|
inline |
gets the camera identifier returns the camera identifier
void DICe::Camera::image_to_sensor | ( | const std::vector< scalar_t > & | image_x, |
const std::vector< scalar_t > & | image_y, | ||
std::vector< scalar_t > & | sen_x, | ||
std::vector< scalar_t > & | sen_y, | ||
const bool | integer_locs = true |
||
) |
converts image coordinates to sensor coordinates (lens distortion^-1, fx,fy,cx,cy)
image_x | x location after applied lens distortion |
image_y | y location after applied lens distortion |
sen_x | projected x sensor location |
sen_y | projected y sensor location |
integer_locs | if all image points are integers setting this flag avoids interpolation overhead |
void DICe::Camera::image_to_world | ( | const std::vector< scalar_t > & | image_x, |
const std::vector< scalar_t > & | image_y, | ||
const std::vector< scalar_t > & | rigid_body_params, | ||
std::vector< scalar_t > & | world_x, | ||
std::vector< scalar_t > & | world_y, | ||
std::vector< scalar_t > & | world_z | ||
) |
helper function to convert image coordinates to world coordinates
image_x | x location after applied lens distortion |
image_y | y location after applied lens distortion |
rigid_body_params | projection parameters that describe a rotation and traslation in space of a planar facet |
world_x | output world x coordinate |
world_y | output world y coordinate |
world_z | output world z coordinate |
|
inline |
gets the camera lens identifier returns the camera lens description
|
inline |
sets the pixel depth returns the pixel depth
|
private |
generic translation/rotation transform
in_x | input x location |
in_y | input y location |
in_z | input z location |
out_x | transformed x location |
out_y | transformed y location |
out_z | transformed z location |
in_dx | derivitives from previous transformations |
in_dy | derivitives from previous transformations |
in_dz | derivitives from previous transformations |
out_dx | derivitives modifiec by the transform |
out_dy | derivitives modifiec by the transform |
out_dz | derivitives modifiec by the transform |
gets 3x3 rotation matrix [R]
rotation_3x3_matrix | [R] matrix transforming from the world coordinates to the camera coordinates |
void DICe::Camera::sensor_to_cam | ( | const std::vector< scalar_t > & | sen_x, |
const std::vector< scalar_t > & | sen_y, | ||
std::vector< scalar_t > & | cam_x, | ||
std::vector< scalar_t > & | cam_y, | ||
std::vector< scalar_t > & | cam_z, | ||
const std::vector< scalar_t > & | facet_params, | ||
std::vector< std::vector< scalar_t > > & | cam_dx, | ||
std::vector< std::vector< scalar_t > > & | cam_dy, | ||
std::vector< std::vector< scalar_t > > & | cam_dz | ||
) |
projects sensor coordinates onto a plane in space described by zp,theta,phi overloaded for first partials
sen_x | x sensor location |
sen_y | y sensor location |
cam_x | projected x location in cam x,y,z space |
cam_y | projected y location in cam x,y,z space |
cam_z | projected z location in cam x,y,z space |
facet_params | projection parameters describing the plane in space (ZP, THETA, PHI) |
cam_dx | x location derivitives in cam x,y,z space partials wrt (ZP, THETA, PHI) |
cam_dy | y locatoin derivitives in cam x,y,z space partials wrt (ZP, THETA, PHI) |
cam_dz | z location derivitives in cam x,y,z space partials wrt (ZP, THETA, PHI) |
void DICe::Camera::sensor_to_image | ( | const std::vector< scalar_t > & | sen_x, |
const std::vector< scalar_t > & | sen_y, | ||
std::vector< scalar_t > & | image_x, | ||
std::vector< scalar_t > & | image_y, | ||
const std::vector< std::vector< scalar_t > > & | sen_dx, | ||
const std::vector< std::vector< scalar_t > > & | sen_dy, | ||
std::vector< std::vector< scalar_t > > & | image_dx, | ||
std::vector< std::vector< scalar_t > > & | image_dy | ||
) |
convert sensor locations to image locations: applies lens distortion scales for fx,fy and converts to image coordiates with cx, cy with first partials
sen_x | projected x sensor location |
sen_y | projected y sensor location |
image_x | x location after applied lens distortion |
image_y | y location after applied lens distortion |
sen_dx | incoming location partials |
sen_dy | incoming location partials |
image_dx | outgoing location partials lens distortion fixed value |
image_dy | outgoing location partials lens distortion fixed value |
|
inline |
sets the camera comments
camera_comments | comments about the camera |
|
inline |
sets the camera identifier
cam_id | string descripter for the camera |
|
inline |
sets the camera lens identifier
camera_lens | string descripter for the camera lens |
|
static |
transform coordinates according to the rbm parameters and replace input values the rigid_body_paramers should be ordered according to three euler angles and three translations (x,y,z) rigid_body_params version
returns a 4x4 matrix with the upper left block the rotation matrix, the right side column vector as the translations and the lower right entry as 1.0
gets the world to camera transformation matrix cam_world_trans 4x4 [R|T] transformation matrix {world(x,y,z)}=[R|T]{cam(x,y,z)}
|
inline |
converts world x,y,z coordinates to camera x,y,z coordinates overloaded with first partials
wrld_x | x location in the world x,y,z space |
wrld_y | y location in the world x,y,z space |
wrld_z | z location in the world x,y,z space |
cam_x | x location in cam x,y,z space |
cam_y | y location in cam x,y,z space |
cam_z | z location in cam x,y,z space |
wrld_dx | first partials of the x world locations from previous transformations |
wrld_dy | first partials of the x world locations from previous transformations |
wrld_dz | first partials of the x world locations from previous transformations |
cam_dx | first partials of the x cam locations |
cam_dy | first partials of the y cam locations |
cam_dz | first partials of the z cam locations |