Public Member Functions | Private Member Functions | Private Attributes
ipa_CameraSensors::CameraSensorToolbox Class Reference

#include <CameraSensorToolbox.h>

List of all members.

Public Member Functions

 CameraSensorToolbox ()
 Constructor.
 CameraSensorToolbox (const CameraSensorToolbox &cameraSensorToolbox)
 Copy constructor.
virtual cv::Mat GetDistortionMapX (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex)
virtual cv::Mat GetDistortionMapY (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex)
virtual cv::Mat GetDistortionParameters (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex)
virtual cv::Mat GetExtrinsicParameters (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex)
virtual cv::Mat GetIntrinsicMatrix (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex)
virtual unsigned long Init (std::string directory, ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, const CvSize imageSize)
virtual unsigned long Init (const std::map< std::string, cv::Mat > *intrinsicMatrices, const std::map< std::string, cv::Mat > *distortionParameters, const std::map< std::string, cv::Mat > *extrinsicMatrices, const std::map< std::string, cv::Mat > *undistortMapsX, const std::map< std::string, cv::Mat > *undistortMapY, const CvSize imageSize)
CameraSensorToolboxoperator= (const CameraSensorToolbox &cameraSensorToolbox)
 Overwritten assignment operator.
virtual unsigned long Release ()
virtual unsigned long RemoveDistortion (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, const cv::Mat &src, cv::Mat &dst)
virtual unsigned long ReprojectXYZ (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, double x, double y, double z, int &u, int &v)
virtual unsigned long SetExtrinsicParameters (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, const cv::Mat &_rotation, const cv::Mat &_translation)
virtual unsigned long SetExtrinsicParameters (std::string key, const cv::Mat &_rotation, const cv::Mat &_translation)
virtual unsigned long SetIntrinsicParameters (ipa_CameraSensors::t_cameraType cameraType, int cameraIndex, const cv::Mat &_intrinsicMatrix, const cv::Mat &_distortion_coeffs)
virtual unsigned long SetIntrinsicParameters (std::string key, const cv::Mat &_intrinsicMatrix, const cv::Mat &_distortion_coeffs)
 ~CameraSensorToolbox ()
 Destructor.

Private Member Functions

virtual unsigned long ConvertCameraTypeToString (ipa_CameraSensors::t_cameraType cameraType, std::string &cameraTypeString)
virtual unsigned long LoadParameters (const char *filename, ipa_CameraSensors::t_cameraType cameraType, int cameraIndex)

Private Attributes

std::map< std::string, cv::Mat > m_distortionCoeffs
 Distortion coefficients [k1, k2, p1=0, p2=0].
std::map< std::string, cv::Mat > m_extrinsicMatrices
CvSize m_ImageSize
 The size of the image that is returned.
bool m_Initialized
 True, when the camera has sucessfully been initialized.
std::map< std::string, cv::Mat > m_intrinsicMatrices
 Intrinsic parameters [fx 0 cx; 0 fy cy; 0 0 1].
std::map< std::string, cv::Mat > m_undistortMapsX
 where R is a 3x3 rotation matrix and T is a 3x1 translation vector.
std::map< std::string, cv::Mat > m_undistortMapsY
 The output array of Y coordinates for the undistortion map.

Detailed Description

A toolbox for common color cameras. Provides generic functions like image undistortion. Holds essential matrices like distortion, intrinsic and extrinsic matrix. For each camera in the system a separate camera toolbox should be initialized.

Definition at line 43 of file CameraSensorToolbox.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 38 of file CameraSensorToolbox.cpp.

Destructor.

Definition at line 43 of file CameraSensorToolbox.cpp.

Copy constructor.

Definition at line 62 of file CameraSensorToolbox.cpp.


Member Function Documentation

unsigned long CameraSensorToolbox::ConvertCameraTypeToString ( ipa_CameraSensors::t_cameraType  cameraType,
std::string &  cameraTypeString 
) [private, virtual]

Converts the camera type enumeration value to a string.

Parameters:
cameraTypeThe camera type as enumeration
cameraTypeStringThe resulting string
Returns:
Retun code

Definition at line 213 of file CameraSensorToolbox.cpp.

cv::Mat CameraSensorToolbox::GetDistortionMapX ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex 
) [virtual]

Returns the distortion map for x components For each x pixel, the undistorted location is specified within the distortion map.

Parameters:
cameraTypeThe camera type, the parameters are optimized with
cameraIndexIndex of the specified camera, the parameters are optimized with
Returns:
The distortion map for x components

Definition at line 456 of file CameraSensorToolbox.cpp.

cv::Mat CameraSensorToolbox::GetDistortionMapY ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex 
) [virtual]

Returns the distortion map for x components For each y pixel, the undistorted location is specified within the distortion map.

Parameters:
cameraTypeThe camera type, the parameters are optimized with
cameraIndexIndex of the specified camera, the parameters are optimized with
Returns:
The distortion map for y components

Definition at line 476 of file CameraSensorToolbox.cpp.

cv::Mat CameraSensorToolbox::GetDistortionParameters ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex 
) [virtual]

Returns the distortion coefficients. The matrix is given by [k1, k2, p1, p2] where k1, k2 are radial distortion coefficients and p1, p2 are tangential distortion coefficients.

Parameters:
cameraTypeThe camera type, the parameters are optimized with
cameraIndexIndex of the specified camera, the parameters are optimized with
Returns:
The OpenCV matrix that refers to the distortion parameters.

Definition at line 436 of file CameraSensorToolbox.cpp.

cv::Mat CameraSensorToolbox::GetExtrinsicParameters ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex 
) [virtual]

Returns a matrix of the camera's extrinsic parameters. The extrinsic matrix is a 4x3 matrix of the format (R|t), where R desribes a 3x3 rotation matrix and t a 3x1 translation vector.

Parameters:
cameraTypeThe camera type
cameraIndexThe camera index
Returns:
The OpenCV matrix that refers to the extrinsic parameters of the camera.

Definition at line 271 of file CameraSensorToolbox.cpp.

cv::Mat CameraSensorToolbox::GetIntrinsicMatrix ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex 
) [virtual]

Returns a matrix of the camera's intrinsic parameters.

Parameters:
cameraTypeThe camera type, the parameters are optimized with
cameraIndexIndex of the specified camera, the parameters are optimized with
Returns:
The OpenCV matrix that should refer to the intrinsic parameters

Definition at line 337 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::Init ( std::string  directory,
ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex,
const CvSize  imageSize 
) [virtual]

Initialize the camera sensor toolbox. The matrices are read from the specified xml configuration file.

Parameters:
directoryThe director where the configuration resides, with ending '/'.
cameraTypeThe camera type
cameraIndexThe camera index
imageSizeThe Size of the image returned by the camera
Returns:
Return code

Definition at line 148 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::Init ( const std::map< std::string, cv::Mat > *  intrinsicMatrices,
const std::map< std::string, cv::Mat > *  distortionParameters,
const std::map< std::string, cv::Mat > *  extrinsicMatrices,
const std::map< std::string, cv::Mat > *  undistortMapsX,
const std::map< std::string, cv::Mat > *  undistortMapY,
const CvSize  imageSize 
) [virtual]

Initialize the camera sensor toolbox.

Parameters:
intrinsicMatricesIntrinsic parameters [fx 0 cx; 0 fy cy; 0 0 1]
distortionParametersDistortion coefficients [k1, k2, p1=0, p2=0]
extrinsicMatrices3x4 matrix of the form (R|t), where R is a 3x3 rotation matrix and t a 3x1 translation vector.
undistortMapsXThe output array of x coordinates for the undistortion map
undistortMapYThe output array of Y coordinates for the undistortion map
imageSizeThe Size of the image returned by the camera
Returns:
Return code

Definition at line 166 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::LoadParameters ( const char *  filename,
ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex 
) [private, virtual]

Parses the XML configuration file, that holds the camera settings

Parameters:
filenameThe file name and path of the configuration file
cameraTypeThe camera type i.e. CAM_AVTPIKE or CAM_IC
cameraIndexThe index of the camera within the configuration file i.e. AvtPikeCam_0 or ICCam_1
Returns:
Return value

Definition at line 569 of file CameraSensorToolbox.cpp.

CameraSensorToolbox & CameraSensorToolbox::operator= ( const CameraSensorToolbox cameraSensorToolbox)

Overwritten assignment operator.

Definition at line 101 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::Release ( ) [virtual]

Release all allocated memory.

Returns:
Return code

Definition at line 48 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::RemoveDistortion ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex,
const cv::Mat &  src,
cv::Mat &  dst 
) [virtual]

Removes distortion from an image. It is necessary to set the distortion coefficients prior to calling this function.

Parameters:
t_cameraTypeThe camera type
cameraIndexIndex of the specified camera, the parameters are optimized with
srcThe distorted image.
dstThe undistorted image.
Returns:
Return code.

Definition at line 496 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::ReprojectXYZ ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex,
double  x,
double  y,
double  z,
int &  u,
int &  v 
) [virtual]

Returns image coordinates (u,v) from (x,y,z) coordinates. (x,y,z) is expressed within the cameras coordinate system.

Parameters:
t_cameraTypeThe camera type
cameraIndexIndex of the specified camera, the parameters are optimized with
uimage coordinate u
vimage coordinate v
xx-coordinates in mm relative to the camera's coodinate system.
yy-coordinates in mm relative to the camera's coodinate system.
zz-coordinates in mm relative to the camera's coodinate system.
Returns:
Return code

Definition at line 522 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::SetExtrinsicParameters ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex,
const cv::Mat &  _rotation,
const cv::Mat &  _translation 
) [virtual]

Sets the camera's extrinsic parameters. The extrinsic matrix is a 4x3 matrix of the format (R|T), where R desribes a 3x3 rotation matrix and T a 3x1 translation vector.

Parameters:
t_cameraTypeThe camera type
cameraIndexThe camera index
_translation3x1 translation vector.
_rotation3x3 rotation matrix.
Returns:
Return code.

Definition at line 291 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::SetExtrinsicParameters ( std::string  key,
const cv::Mat &  _rotation,
const cv::Mat &  _translation 
) [virtual]

Sets the camera's extrinsic parameters. The extrinsic matrix is a 4x3 matrix of the format (R|T), where R desribes a 3x3 rotation matrix and T a 3x1 translation vector.

Parameters:
keyThe key/identifier within the map of extrinsic matrices
_translation3x1 translation vector.
_rotation3x3 rotation matrix.
Returns:
Return code.

Definition at line 303 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::SetIntrinsicParameters ( ipa_CameraSensors::t_cameraType  cameraType,
int  cameraIndex,
const cv::Mat &  _intrinsicMatrix,
const cv::Mat &  _distortion_coeffs 
) [virtual]

Initializes the distortion parameters. The following equations apply: (x,y,z) = R*(X,Y,Z) + t and x' = x/z, y' = y/z and u = fx*x' + cx, v = fy*y' + cy. The model might be extended with distortion coefficients to replace x' and y' with x'' = x'*(1 + k1*r^2 + k2*r^4) + 2*p1*x'*y' + p2(r^2+2*x'^2) y'' = y'*(1 + k1*r^2 + k2*r^4) + p1(r^2+2*y'^2) + 2*p2*x'*y'

Parameters:
cameraTypeThe camera type, the parameters are optimized with
cameraIndexIndex of the specified camera, the parameters are optimized with
_intrinsicMatrixThe cameras intrinsic matrix
_distortion_coeffsradial and tangential distortion coefficient
Returns:
Return code.

Definition at line 357 of file CameraSensorToolbox.cpp.

unsigned long CameraSensorToolbox::SetIntrinsicParameters ( std::string  key,
const cv::Mat &  _intrinsicMatrix,
const cv::Mat &  _distortion_coeffs 
) [virtual]

Initializes the distortion parameters. The following equations apply: (x,y,z) = R*(X,Y,Z) + t and x' = x/z, y' = y/z and u = fx*x' + cx, v = fy*y' + cy. The model might be extended with distortion coefficients to replace x' and y' with x'' = x'*(1 + k1*r^2 + k2*r^4) + 2*p1*x'*y' + p2(r^2+2*x'^2) y'' = y'*(1 + k1*r^2 + k2*r^4) + p1(r^2+2*y'^2) + 2*p2*x'*y'

Parameters:
keyThe key/identifier within the map of extrinsic matrices
_intrinsicMatrixThe cameras intrinsic matrix
_distortion_coeffsradial and tangential distortion coefficient
Returns:
Return code.

Definition at line 369 of file CameraSensorToolbox.cpp.


Member Data Documentation

std::map<std::string, cv::Mat> ipa_CameraSensors::CameraSensorToolbox::m_distortionCoeffs [private]

Distortion coefficients [k1, k2, p1=0, p2=0].

Definition at line 208 of file CameraSensorToolbox.h.

std::map<std::string, cv::Mat> ipa_CameraSensors::CameraSensorToolbox::m_extrinsicMatrices [private]

a map of 3x4 matrix of the form (R|T),

Definition at line 209 of file CameraSensorToolbox.h.

The size of the image that is returned.

Definition at line 215 of file CameraSensorToolbox.h.

True, when the camera has sucessfully been initialized.

Definition at line 205 of file CameraSensorToolbox.h.

std::map<std::string, cv::Mat> ipa_CameraSensors::CameraSensorToolbox::m_intrinsicMatrices [private]

Intrinsic parameters [fx 0 cx; 0 fy cy; 0 0 1].

Definition at line 207 of file CameraSensorToolbox.h.

std::map<std::string, cv::Mat> ipa_CameraSensors::CameraSensorToolbox::m_undistortMapsX [private]

where R is a 3x3 rotation matrix and T is a 3x1 translation vector.

The output array of x coordinates for the undistortion map

Definition at line 212 of file CameraSensorToolbox.h.

std::map<std::string, cv::Mat> ipa_CameraSensors::CameraSensorToolbox::m_undistortMapsY [private]

The output array of Y coordinates for the undistortion map.

Definition at line 213 of file CameraSensorToolbox.h.


The documentation for this class was generated from the following files:


cob_vision_utils
Author(s): Jan Fischer
autogenerated on Fri Mar 15 2019 03:10:16