TLIB documentation
 

tlCameraTSAI Class Reference

Inheritance diagram for tlCameraTSAI:

Inheritance graph
[legend]
Collaboration diagram for tlCameraTSAI:

Collaboration graph
[legend]

List of all members.


Detailed Description

TSAI camera calibration for TLIB.

Public Member Functions

 tlCameraTSAI ()
 tlCameraTSAI (tlSource *source)
 tlCameraTSAI (char *filename)
 tlCameraTSAI (char *filename, tlSource *source)
virtual ~tlCameraTSAI ()
int readConfig (char *filename)
int writeConfig (char *filename)
int calibrate (tlCameraTSAICalibData *data)
int setSource (tlSource *source)
tlSourcegetSource ()
int toWorld (tlPoint *point)
int toImage (tlPoint *point)
virtual int warp (tlPoint *point)
virtual int warp (tlPoint *point, tlPoint *dest)
virtual int dewarp (tlPoint *point)
virtual int dewarp (tlPoint *point, tlPoint *dest)
virtual int warp (tlImage *image)
virtual int warp (tlImage *image, tlImage *dest)
virtual int dewarp (tlImage *image)
virtual int dewarp (tlImage *image, tlImage *dest)
virtual int warp (tlImage *image, tlRect *rect)
virtual int warp (tlImage *image, tlRect *rect, tlImage *dest)
virtual int dewarp (tlImage *image, tlRect *rect)
virtual int dewarp (tlImage *image, tlRect *rect, tlImage *dest)
virtual int grab (tlImage *image)
virtual int grab (tlImage *image, tlRect *rect)
virtual int grabQueued (tlImage *image)
virtual int grabQueued (tlImage *image, tlRect *rect)
int setPosition (int Tx, int Ty, int Tz)
int setOrientation (int Rx, int Ry, int Rz)
bool isCalibrated ()
int getTx ()
int getTy ()
int getTz ()
int getRx ()
int getRy ()
int getRz ()
int getWidth ()
int getHeight ()
int getID ()
tl_format getFormat ()

Constructor & Destructor Documentation

tlCameraTSAI::tlCameraTSAI (  ) 

Default constructor. Uses the defaults file specified in TL_CAMERA_TSAI_FILENAME, or no calibration if file does not exist.

Note:
See error management for details.

tlCameraTSAI::tlCameraTSAI ( tlSource source  ) 

Specify an image source to use with these calibration settings. The source must be valid and ready to provide images via the grab() or grabQueued() methods.

Parameters:
source a valid pointer to an image source.
Note:
See error management for details.

tlCameraTSAI::tlCameraTSAI ( char *  filename  ) 

Specify a calibration configuration file to read from.

Parameters:
filename calibration configuration file
Note:
See error management for details.

tlCameraTSAI::tlCameraTSAI ( char *  filename,
tlSource source 
)

Read calibration data from a given file and specify an image source to use with these calibration settings. The source must be valid and ready to provide images via the grab() or grabQueued() methods.

Parameters:
source a valid pointer to an image source.
filename calibration configuration file.
Note:
See error management for details.

tlCameraTSAI::~tlCameraTSAI ( void   )  [virtual]

Default destructor.

Note:
See error management for details.


Member Function Documentation

int tlCameraTSAI::readConfig ( char *  filename  ) 

Read calibration configuration from a given filename.

Parameters:
filename calibration configuration file.
Returns:
0 on success, -1 otherwise.
See error management for details.
Todo:
make sure the width and height params are consistent between source and calibration data.
Todo:
Detect invalid calibration data.

int tlCameraTSAI::writeConfig ( char *  filename  ) 

Write calibration configuration to a given filename.

Parameters:
filename calibration configuration file.
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlCameraTSAI::calibrate ( tlCameraTSAICalibData *  data  ) 

Perform TSAI calibration given a set of data. See TSAI calibration for more information on how to perform TSAI camera calibration.

Parameters:
data a pointer to the calibration data structure
0 on success, -1 otherwise.
See error management for details.

int tlCameraTSAI::setSource ( tlSource source  ) 

Specify an image source to use with these calibration settings. The source must be valid and ready to provide images via the grab() or grabQueued() methods.

Parameters:
source a valid pointer to an image source.
Returns:
0 on success, -1 otherwise.
See error management for details.
Todo:
make sure the width and height params are consistent between source and calibration data.

tlCameraTSAI::getSource (  )  [inline]

Return a pointer to the image source connected to this camera.

Returns:
A valid pointer to an image source if source is available, NULL otherwise.
See error management for details.

int tlCameraTSAI::toWorld ( tlPoint point  ) 

This routine performs an inverse perspective projection to determine the position of a point in world coordinates that corresponds to a given position in image coordinates. To constrain the inverse projection to a single point the routine requires a Z world coordinate for the point in addition to the X and Y image coordinates.

Parameters:
point the point to apply the transform to. Members x,y and wz are used as input, output is placed in members wx,wy.
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlCameraTSAI::toImage ( tlPoint point  ) 

This routine takes the position of a point in world coordinates [mm] and determines the position of its image in image coordinates [pix].

Parameters:
point the point to apply the transform to. Members wx,wy,wz are used as input, output is placed in members x,y.
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlCameraTSAI::warp ( tlPoint point  )  [virtual]

Warp point for the given camera. That is, return the distorted coordinate for a point in a calibrated image given the calibration settings.

Parameters:
point the point to project
Returns:
0 on success, -1 otherwise.
See error management for details.
Remarks:
the point coordinates are altered by this call. See warp(tlPoint *point, tlPoint *dest) to put the warping result in another tlPoint object.
See also:
warp(tlPoint *point, tlPoint *dest)

int tlCameraTSAI::warp ( tlPoint point,
tlPoint dest 
) [virtual]

Warp point for the given camera. That is, return the distorted coordinate for a point in a calibrated image given the calibration settings. The result is placed in another image.

Parameters:
point the point to project
dest [out] the point that will contain the undistorted coordinates
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
warp(tlPoint *point)

int tlCameraTSAI::dewarp ( tlPoint point  )  [virtual]

Unwarp point for the given camera. That is, return the undistorted coordinate for a point in the image given the calibration settings.

Parameters:
point the point to project
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
dewarp(tlPoint *point)

int tlCameraTSAI::dewarp ( tlPoint point,
tlPoint dest 
) [virtual]

Unwarp point for the given camera. That is, return the undistorted coordinate for a point in the image given the calibration settings. The result is placed in another point.

Parameters:
point the point to project
dest [out] the point that will contain the undistorted coordinates
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
dewarp(tlPoint *point)

int tlCameraTSAI::warp ( tlImage image  )  [virtual]

Warp an image for the given camera. That is, return the distorted image given the calibration settings.

Parameters:
image the image to project
Returns:
0 on success, -1 otherwise.
See error management for details.
Remarks:
the image is altered by this call. See warp(tlImage *image, tlImage *dest) to put the warping result in another tlImage object.
See also:
warp(tlImage *image, tlRect *rect)
warp(tlImage *image, tlImage *dest)
warp(tlImage *image, tlRect *rect, tlImage *dest)

int tlCameraTSAI::warp ( tlImage image,
tlImage dest 
) [virtual]

Warp an image for the given camera. That is, return the distorted image given the calibration settings. The result is placed in another image.

Parameters:
image the image to project
dest [out] projection result
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
warp(tlImage *image)
warp(tlImage *image, tlRect *rect)
warp(tlImage *image, tlRect *rect, tlImage *dest)
Todo:
provide an option to use tl_bspline_interpolate() to retrieve best value for real x,y source pixel in dewarped image.

int tlCameraTSAI::dewarp ( tlImage image  )  [virtual]

Unwarp an image for the given camera. That is, return the undistorted image given the calibration settings.

Parameters:
image the image to project
Returns:
0 on success, -1 otherwise.
See error management for details.
Remarks:
the image is altered by this call. See dewarp(tlImage *image, tlImage *dest) to put the dewarping result in another tlImage object.
See also:
dewarp(tlImage *image, tlRect *rect)
dewarp(tlImage *image, tlImage *dest)
dewarp(tlImage *image, tlRect *rect, tlImage *dest)
Todo:
provide an option to use tl_bspline_interpolate() to retrieve best value for real x,y source pixel in warped image.

int tlCameraTSAI::dewarp ( tlImage image,
tlImage dest 
) [virtual]

Unwarp an image for the given camera. That is, return the undistorted image given the calibration settings. The result is placed in another image.

Parameters:
image the image to project
dest [out] projection result
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
dewarp(tlImage *image)
dewarp(tlImage *image, tlRect *rect)
dewarp(tlImage *image, tlRect *rect, tlImage *dest)
Todo:
provide an option to use tl_bspline_interpolate() to retrieve best value for real x,y source pixel in source warped image.

int tlCameraTSAI::warp ( tlImage image,
tlRect rect 
) [virtual]

Warp a portion of an image for the given camera. That is, return the distorted image given the calibration settings.

Parameters:
image the image to project
rect portion of the image to project
Returns:
0 on success, -1 otherwise.
See error management for details.
Remarks:
the image is altered by this call. See warp(tlImage *image, tlImage *dest) to put the dewarping result in another tlImage object.
See also:
warp(tlImage *image)
warp(tlImage *image, tlImage *dest)
warp(tlImage *image, tlRect *rect, tlImage *dest)
Todo:
provide an option to use tl_bspline_interpolate() to retrieve best value for real x,y source pixel in dewarped image.

int tlCameraTSAI::warp ( tlImage image,
tlRect rect,
tlImage dest 
) [virtual]

Warp a portion of an image for the given camera. That is, return the distorted image given the calibration settings. The result is placed in another image.

Parameters:
image the image to project
rect portion of the image to project
dest [out] projection result
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
warp(tlImage *image)
warp(tlImage *image, tlImage *dest)
warp(tlImage *image, tlImage *dest)
Todo:
provide an option to use tl_bspline_interpolate() to retrieve best value for real x,y source pixel in dewarped image.

int tlCameraTSAI::dewarp ( tlImage image,
tlRect rect 
) [virtual]

Unwarp a portion of an image for the given camera. That is, return the undistorted image given the calibration settings.

Parameters:
image the image to project
rect portion of the image to project
Returns:
0 on success, -1 otherwise.
See error management for details.
Remarks:
the image is altered by this call. See dewarp(tlImage *image, tlImage *dest) to put the dewarping result in another tlImage object.
See also:
dewarp(tlImage *image)
dewarp(tlImage *image, tlImage *dest)
dewarp(tlImage *image, tlRect *rect, tlImage *dest)
Todo:
provide an option to use tl_bspline_interpolate() to retrieve best value for real x,y source pixel in warped image.

int tlCameraTSAI::dewarp ( tlImage image,
tlRect rect,
tlImage dest 
) [virtual]

Unwarp a portion of an image for the given camera. That is, return the undistorted image given the calibration settings. The result is placed in another image.

Parameters:
image the image to project
rect portion of the image to project
dest [out] projection result
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
dewarp(tlImage *image)
dewarp(tlImage *image, tlImage *dest)
dewarp(tlImage *image, tlImage *dest)
Todo:
provide an option to use tl_bspline_interpolate() to retrieve best value for real x,y source pixel in source warped image.

int tlCameraTSAI::grab ( tlImage image  )  [virtual]

This call acquires a full image from an image source. The image will have the size and format the source is currently configured for.

Parameters:
image [out] a valid image pointer that will receive the image.
Returns:
0 on success, -1 otherwise.
See error management for details.

Implements tlCamera.

int tlCameraTSAI::grab ( tlImage image,
tlRect rect 
) [virtual]

This call acquires a portion of an image from an image source. The image will have the size and format the source is currently configured for, but only the portion defined by the rect argument will contain valid pixel values.

Parameters:
image [out] a valid image pointer that will receive the image.
rect a pointer to the portion of the image to acquire.
Returns:
0 on success, -1 otherwise.
See error management for details.

Implements tlCamera.

int tlCameraTSAI::grabQueued ( tlImage image  )  [virtual]

This call acquires a full image from an image source. The image will have the size and format the source is currently configured for.

Parameters:
image [out] a valid image pointer that will receive the image.
Returns:
0 on success, -1 otherwise.
See error management for details.
Note:
This routine is faster than grab() because image acquisition happens in the background. However, since the grab command is sent to the grabber during the previous call to the grabQueued() routine, the image returned can be out-of-date.

Implements tlCamera.

int tlCameraTSAI::grabQueued ( tlImage image,
tlRect rect 
) [virtual]

This call acquires a portion of an image from an image source. The image will have the size and format the source is currently configured for, but only the portion defined by the rect argument will contain valid pixel values.

Parameters:
image [out] a valid image pointer that will receive the image.
rect a pointer to the portion of the image to acquire.
Returns:
0 on success, -1 otherwise.
See error management for details.
Note:
This routine is faster than grab() because image acquisition happens in the background. However, since the grab command is sent to the grabber during the previous call to the grabQueued() routine, the image returned can be out-of-date.

Implements tlCamera.

int tlCamera::setPosition ( int  Tx,
int  Ty,
int  Tz 
) [inherited]

Set the camera position in the workspace.

Parameters:
Tx camera position on the X axis.
Ty camera position on the Y axis.
Tz camera position on the Z axis.
Returns:
0 on success, -1 otherwise.
See error management for details.
Note:
This assumes a right-handed, orthogonal coordonate system.

int tlCamera::setOrientation ( int  Rx,
int  Ry,
int  Rz 
) [inherited]

Set the camera orientation in the workspace.

Parameters:
Rx camera orientation around the X axis.
Ry camera orientation around the Y axis.
Rz camera orientation around the Z axis.
Returns:
0 on success, -1 otherwise.
See error management for details.
Note:
This assumes a right-handed, orthogonal coordonate system.

tlCamera::isCalibrated (  )  [inline, inherited]

Check whether the camera returns calibrated (undistorted) images or not.

Returns:
True if camera is calibrated,
False otherwise.

tlCamera::getTx (  )  [inline, inherited]

Get the position of the camera on the X axis of the workspace.

Returns:
The camera position in X.

tlCamera::getTy (  )  [inline, inherited]

Get the position of the camera on the Y axis of the workspace.

Returns:
The camera position in Y.

tlCamera::getTz (  )  [inline, inherited]

Get the position of the camera on the Z axis of the workspace.

Returns:
The camera position in Z.

tlCamera::getRx (  )  [inline, inherited]

Get the orientation of the camera around the X axis of the workspace.

Returns:
The camera orientation around X.

tlCamera::getRy (  )  [inline, inherited]

Get the orientation of the camera around the X axis of the workspace.

Returns:
The camera orientation around Y.

tlCamera::getRz (  )  [inline, inherited]

Get the orientation of the camera around the X axis of the workspace.

Returns:
The camera orientation around Z.

tlSource::getWidth (  )  [inline, inherited]

Returns the width of the image source. Any image acquired through this tlSource object will have the current width.

Returns:
The width in pixels of the image source.
See error management for details.

tlSource::getHeight (  )  [inline, inherited]

Returns the height of the image source. Any image acquired through this tlSource object will have the current height.

Returns:
The height in pixels of the image source.
See error management for details.

tlSource::getID (  )  [inline, inherited]

Return a unique identifier for this source. Identifiers are allocated dynamically and are only valid during application run-time.

Returns:
A unique numerical identifier on success, -1 otherwise.
See error management for details.

tlSource::getFormat (  )  [inline, inherited]

Returns the format of the image source. Any image acquired through this tlSource object will have the current format.

Returns:
The format of the image source.


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

TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.