Fawkes API  Fawkes Development Version
firevision::TriclopsStereoProcessor Class Reference

Stereo processing using PGR Triclops SDK. More...

#include <>>

Inheritance diagram for firevision::TriclopsStereoProcessor:

Public Member Functions

 TriclopsStereoProcessor (unsigned int width, unsigned int height, const char *context_file)
 Constructor. More...
 
 TriclopsStereoProcessor (Camera *camera)
 Constructor. More...
 
virtual ~TriclopsStereoProcessor ()
 Destructor. More...
 
virtual unsigned int output_image_width ()
 Get width of ouput images. More...
 
virtual unsigned int output_image_height ()
 Get height of ouput images. More...
 
virtual bool subpixel_interpolation ()
 Check state of subpixel interpolation. More...
 
virtual bool edge_correlation ()
 Check state of edge correlation. More...
 
virtual bool lowpass ()
 Check state of lowpass filtering. More...
 
virtual int disparity_range_min ()
 Get disparity range min value. More...
 
virtual int disparity_range_max ()
 Get disparity range max value. More...
 
virtual unsigned int edge_masksize ()
 Get edge mask size. More...
 
virtual unsigned int stereo_masksize ()
 Get stereo mask size. More...
 
virtual bool surface_validation ()
 Check state of surface validation. More...
 
virtual bool texture_validation ()
 Check state of texture validation. More...
 
virtual unsigned char disparity_mapping_min ()
 Get disparity mapping min value. More...
 
virtual unsigned char disparity_mapping_max ()
 Get disparity mapping max value. More...
 
virtual bool disparity_mapping ()
 Check state of disparity mapping. More...
 
virtual void set_output_image_size (unsigned int width, unsigned int height)
 Set the resolution of the output images. More...
 
virtual void set_subpixel_interpolation (bool enabled)
 Enable or disable subpixel interpolation. More...
 
virtual void set_edge_correlation (bool enabled)
 Enable or disable edge correlation. More...
 
virtual void set_lowpass (bool enabled)
 Enable or disable lowpass filtering before rectification. More...
 
virtual void set_disparity_range (int min, int max)
 Set disparity range. More...
 
virtual void set_edge_masksize (unsigned int mask_size)
 Set edge mask. More...
 
virtual void set_stereo_masksize (unsigned int mask_size)
 Set stereo mask. More...
 
virtual void set_surface_validation (bool enabled)
 Enable or disable surface validation. More...
 
virtual void set_texture_validation (bool enabled)
 Enable or disable texture validation. More...
 
virtual void set_disparity_mapping_range (unsigned char min, unsigned char max)
 Set disparity mapping range. More...
 
virtual void set_disparity_mapping (bool enabled)
 Enable or disable disparity mapping. More...
 
virtual bool get_xyz (unsigned int px, unsigned int py, float *x, float *y, float *z)
 Get camera-relative coordinates of a point. More...
 
virtual bool get_world_xyz (unsigned int px, unsigned int py, float *x, float *y, float *z)
 Get transformed coordinates of a point. More...
 
virtual void set_raw_buffer (unsigned char *raw16_buffer)
 Set raw buffer. More...
 
virtual void preprocess_stereo ()
 Do any pre-processing needed. More...
 
virtual void calculate_disparity (ROI *roi=0)
 Caculate disparity images. More...
 
virtual void calculate_yuv (bool both=false)
 Caculate yuv images. More...
 
virtual unsigned char * disparity_buffer ()
 Get the disparity image buffer. More...
 
virtual size_t disparity_buffer_size () const
 Get disparity buffer size. More...
 
virtual unsigned char * yuv_buffer_right ()
 Get YUV-formatted buffer of reference camera. More...
 
virtual unsigned char * yuv_buffer_left ()
 Get YUV-formatted buffer of left camera. More...
 
void generate_rectification_lut (const char *lut_file)
 Generate rectification LUT. More...
 
bool verify_rectification_lut (const char *lut_file)
 Verify rectification LUT. More...
 
virtual void getall_world_xyz (float ***buffer, int hoff, int voff, int width, int height, float *settings)
 Calculates all three cartesian coordinates of the entire disparity map The values transformed are given by the window (specified by hoff, voff, width and height). More...
 
- Public Member Functions inherited from firevision::StereoProcessor
virtual ~StereoProcessor ()
 Virtual empty destructor. More...
 

Detailed Description

Stereo processing using PGR Triclops SDK.

This class uses the Triclops SDK provided by Point Grey Research along with the Bumblebee2 cameras.

Author
Tim Niemueller

Definition at line 40 of file triclops.h.

Constructor & Destructor Documentation

◆ TriclopsStereoProcessor() [1/2]

firevision::TriclopsStereoProcessor::TriclopsStereoProcessor ( unsigned int  width,
unsigned int  height,
const char *  context_file 
)

Constructor.

With this ctor you can make the triclops wrapper to work on saved images given the expected image size (of a single image) and the path to the Triclops context from the used camera.

Parameters
widthimage width in pixels
heightimage height in pixels
context_fileTriclops context file

Definition at line 124 of file triclops.cpp.

◆ TriclopsStereoProcessor() [2/2]

firevision::TriclopsStereoProcessor::TriclopsStereoProcessor ( Camera camera)

Constructor.

This constructor initializes this triclops wrapper to work on a real camera.

Parameters
cameraMust be of type Bumblebee2Camera

Definition at line 81 of file triclops.cpp.

◆ ~TriclopsStereoProcessor()

firevision::TriclopsStereoProcessor::~TriclopsStereoProcessor ( )
virtual

Destructor.

Definition at line 236 of file triclops.cpp.

Member Function Documentation

◆ calculate_disparity()

void firevision::TriclopsStereoProcessor::calculate_disparity ( ROI roi = 0)
virtual

Caculate disparity images.

Depending on the data the specific stereo processor needs the disparity image is calculated. If a region of interest (ROI) is supplied then only this region is processed.

Parameters
roiregion of interest to process

Implements firevision::StereoProcessor.

Definition at line 583 of file triclops.cpp.

References firevision::ROI::height, firevision::ROI::start, firevision::ROI::width, fawkes::upoint_t::x, and fawkes::upoint_t::y.

◆ calculate_yuv()

void firevision::TriclopsStereoProcessor::calculate_yuv ( bool  both = false)
virtual

Caculate yuv images.

This will calculate YUV images of the cameras. By default only the reference image is converted to YUV, as this is sufficient in most cases. If you need both images specify so as argument. A call to this method is valid only after calling calculate_disparity() as this may rely on data produced there.

Parameters
bothif true, both YUV images are calculated for the left and right camera, if false only the YUV image of the reference camera is calculated (dependant on camera)

Implements firevision::StereoProcessor.

Definition at line 572 of file triclops.cpp.

◆ disparity_buffer()

unsigned char * firevision::TriclopsStereoProcessor::disparity_buffer ( )
virtual

Get the disparity image buffer.

Access method to the disparity image buffer.

Returns
pointer to the internal disparity image buffer

Implements firevision::StereoProcessor.

Definition at line 664 of file triclops.cpp.

◆ disparity_buffer_size()

size_t firevision::TriclopsStereoProcessor::disparity_buffer_size ( ) const
virtual

Get disparity buffer size.

Returns
size in bytes of the disparity image buffer

Implements firevision::StereoProcessor.

Definition at line 675 of file triclops.cpp.

◆ disparity_mapping()

bool firevision::TriclopsStereoProcessor::disparity_mapping ( )
virtual

Check state of disparity mapping.

Returns
true if enabled, false otherwise

Definition at line 549 of file triclops.cpp.

◆ disparity_mapping_max()

unsigned char firevision::TriclopsStereoProcessor::disparity_mapping_max ( )
virtual

Get disparity mapping max value.

Returns
max value for disparity mapping

Definition at line 537 of file triclops.cpp.

◆ disparity_mapping_min()

unsigned char firevision::TriclopsStereoProcessor::disparity_mapping_min ( )
virtual

Get disparity mapping min value.

Returns
min value for disparity mapping

Definition at line 525 of file triclops.cpp.

◆ disparity_range_max()

int firevision::TriclopsStereoProcessor::disparity_range_max ( )
virtual

Get disparity range max value.

Returns
disparity range max value

Definition at line 465 of file triclops.cpp.

◆ disparity_range_min()

int firevision::TriclopsStereoProcessor::disparity_range_min ( )
virtual

Get disparity range min value.

Returns
disparity range min value

Definition at line 453 of file triclops.cpp.

◆ edge_correlation()

bool firevision::TriclopsStereoProcessor::edge_correlation ( )
virtual

Check state of edge correlation.

Returns
true if enabled, false otherwise

Definition at line 429 of file triclops.cpp.

◆ edge_masksize()

unsigned int firevision::TriclopsStereoProcessor::edge_masksize ( )
virtual

Get edge mask size.

Returns
size of the edge mask

Definition at line 477 of file triclops.cpp.

◆ generate_rectification_lut()

void firevision::TriclopsStereoProcessor::generate_rectification_lut ( const char *  lut_file)

Generate rectification LUT.

This will generate a lookup table that can be used for fast rectification of an image. The lut will be of the dimensions of the currently specified image (either given to the offline context file constructor or as defined by the supplied BB2 camera). The file will use RectificationFile to write two RectificationLookupTable entities, one for each image.

Parameters
lut_filename of the file to write to. The file will be created if it does not exist and truncated otherwise. The directory where the file has to be stored has to exist.

Definition at line 859 of file triclops.cpp.

References firevision::RectificationInfoFile::add_rectinfo_block(), firevision::RectificationLutInfoBlock::set_mapping(), and firevision::FireVisionDataFile::write().

◆ get_world_xyz()

bool firevision::TriclopsStereoProcessor::get_world_xyz ( unsigned int  px,
unsigned int  py,
float *  x,
float *  y,
float *  z 
)
virtual

Get transformed coordinates of a point.

Use this method to get the coordinates in the transformed coordinate system of a given point in the image. It may not be possible to provide such a coordinate if no valid disparity information could be calculated for the given point.

Parameters
pxx coordinate in image
pyy coordinate in image
xcontains the x coordinate in the camera-relative coordinate system upon successful return
ycontains the y coordinate in the camera-relative coordinate system upon successful return
zcontains the z coordinate in the camera-relative coordinate system upon successful return
Returns
true, if valid information could be retrieved. In that case (x, y, z) is filled with the coordinates, false otherwise (x, y, and z are not modified).

Implements firevision::StereoProcessor.

Definition at line 799 of file triclops.cpp.

References fawkes::deg2rad().

◆ get_xyz()

bool firevision::TriclopsStereoProcessor::get_xyz ( unsigned int  px,
unsigned int  py,
float *  x,
float *  y,
float *  z 
)
virtual

Get camera-relative coordinates of a point.

Use this method to get the coordinates in the camera coordinate system of a given point in the image. It may not be possible to provide such a coordinate if no valid disparity information could be calculated for the given point.

Parameters
pxx coordinate in image
pyy coordinate in image
xcontains the x coordinate in the camera-relative coordinate system upon successful return
ycontains the y coordinate in the camera-relative coordinate system upon successful return
zcontains the z coordinate in the camera-relative coordinate system upon successful return
Returns
true, if valid information could be retrieved. In that case (x, y, z) is filled with the coordinates, false otherwise (x, y, and z are not modified).

Implements firevision::StereoProcessor.

Definition at line 763 of file triclops.cpp.

◆ getall_world_xyz()

void firevision::TriclopsStereoProcessor::getall_world_xyz ( float ***  buffer,
int  hoff,
int  voff,
int  width,
int  height,
float *  settings 
)
virtual

Calculates all three cartesian coordinates of the entire disparity map The values transformed are given by the window (specified by hoff, voff, width and height).

settings contains all further information needed (in that order): the angle of the camera, the position of the camera relativ to the robot: x, y, z and the maximum distance of points allowed. Points filtered out by distance are marked as NaN in all three coordinates. Unknown Regions are marked the same way with INFINITY.

Parameters
bufferbuffer for the coordinates, 1st index 0: x; 1: y; 2:z, 2nd index denotes the lines, 3rd index denotes the columns
hoffhorizontal offset of the window
voffvertical offset of the window
widthwidth of the window
heightheight of the window
settingsa vector of settings in floating point format (angle,position of camera x, y, z, maximum distance of points)

Definition at line 1012 of file triclops.cpp.

References fawkes::deg2rad().

◆ lowpass()

bool firevision::TriclopsStereoProcessor::lowpass ( )
virtual

Check state of lowpass filtering.

Returns
true if enabled, false otherwise

Definition at line 441 of file triclops.cpp.

◆ output_image_height()

unsigned int firevision::TriclopsStereoProcessor::output_image_height ( )
virtual

Get height of ouput images.

Returns
height of output images

Definition at line 419 of file triclops.cpp.

◆ output_image_width()

unsigned int firevision::TriclopsStereoProcessor::output_image_width ( )
virtual

Get width of ouput images.

Returns
width of output images

Definition at line 409 of file triclops.cpp.

◆ preprocess_stereo()

void firevision::TriclopsStereoProcessor::preprocess_stereo ( )
virtual

Do any pre-processing needed.

Do all the preprocessing needed to calculate the disparity or the YUV images. This has been split out to be able to do only one thing.

Implements firevision::StereoProcessor.

Definition at line 558 of file triclops.cpp.

◆ set_disparity_mapping()

void firevision::TriclopsStereoProcessor::set_disparity_mapping ( bool  enabled)
virtual

Enable or disable disparity mapping.

Parameters
enabledtrue to enable, false to disable

Definition at line 388 of file triclops.cpp.

◆ set_disparity_mapping_range()

void firevision::TriclopsStereoProcessor::set_disparity_mapping_range ( unsigned char  min,
unsigned char  max 
)
virtual

Set disparity mapping range.

Parameters
minminimum disparity
maxmaximum disparity

Definition at line 378 of file triclops.cpp.

◆ set_disparity_range()

void firevision::TriclopsStereoProcessor::set_disparity_range ( int  min,
int  max 
)
virtual

Set disparity range.

Parameters
minminimum disparity
maxmaximum disparity

Definition at line 324 of file triclops.cpp.

◆ set_edge_correlation()

void firevision::TriclopsStereoProcessor::set_edge_correlation ( bool  enabled)
virtual

Enable or disable edge correlation.

Parameters
enabledtrue to enable, false to disable

Definition at line 303 of file triclops.cpp.

◆ set_edge_masksize()

void firevision::TriclopsStereoProcessor::set_edge_masksize ( unsigned int  mask_size)
virtual

Set edge mask.

Size of the kernel used for edge detection. This value must be in the range [3..13].

Parameters
mask_sizemask size

Definition at line 336 of file triclops.cpp.

◆ set_lowpass()

void firevision::TriclopsStereoProcessor::set_lowpass ( bool  enabled)
virtual

Enable or disable lowpass filtering before rectification.

Parameters
enabledtrue to enable, false to disable

Definition at line 313 of file triclops.cpp.

◆ set_output_image_size()

void firevision::TriclopsStereoProcessor::set_output_image_size ( unsigned int  width,
unsigned int  height 
)
virtual

Set the resolution of the output images.

Parameters
widththe width of the output images
heightthe height of the output images

Definition at line 276 of file triclops.cpp.

◆ set_raw_buffer()

void firevision::TriclopsStereoProcessor::set_raw_buffer ( unsigned char *  raw16_buffer)
virtual

Set raw buffer.

Parameters
raw16_bufferbuffer containing the stereo image encoded as BB2 RAW16

Definition at line 265 of file triclops.cpp.

◆ set_stereo_masksize()

void firevision::TriclopsStereoProcessor::set_stereo_masksize ( unsigned int  mask_size)
virtual

Set stereo mask.

Size of the mask used for stereo correlation.

Parameters
mask_sizemask size

Definition at line 347 of file triclops.cpp.

◆ set_subpixel_interpolation()

void firevision::TriclopsStereoProcessor::set_subpixel_interpolation ( bool  enabled)
virtual

Enable or disable subpixel interpolation.

Parameters
enabledtrue to enable, false to disable

Definition at line 292 of file triclops.cpp.

◆ set_surface_validation()

void firevision::TriclopsStereoProcessor::set_surface_validation ( bool  enabled)
virtual

Enable or disable surface validation.

Parameters
enabledtrue to enable, false to disable

Definition at line 357 of file triclops.cpp.

◆ set_texture_validation()

void firevision::TriclopsStereoProcessor::set_texture_validation ( bool  enabled)
virtual

Enable or disable texture validation.

Parameters
enabledtrue to enable, false to disable

Definition at line 367 of file triclops.cpp.

◆ stereo_masksize()

unsigned int firevision::TriclopsStereoProcessor::stereo_masksize ( )
virtual

Get stereo mask size.

Returns
size of the stereo mask

Definition at line 489 of file triclops.cpp.

◆ subpixel_interpolation()

bool firevision::TriclopsStereoProcessor::subpixel_interpolation ( )
virtual

Check state of subpixel interpolation.

Returns
true if enabled, false otherwise

Definition at line 397 of file triclops.cpp.

◆ surface_validation()

bool firevision::TriclopsStereoProcessor::surface_validation ( )
virtual

Check state of surface validation.

Returns
true if enabled, false otherwise

Definition at line 501 of file triclops.cpp.

◆ texture_validation()

bool firevision::TriclopsStereoProcessor::texture_validation ( )
virtual

Check state of texture validation.

Returns
true if enabled, false otherwise

Definition at line 513 of file triclops.cpp.

◆ verify_rectification_lut()

bool firevision::TriclopsStereoProcessor::verify_rectification_lut ( const char *  lut_file)

◆ yuv_buffer_left()

unsigned char * firevision::TriclopsStereoProcessor::yuv_buffer_left ( )
virtual

Get YUV-formatted buffer of left camera.

This will return the YUV buffer of the auxiliary image. This is only available after calling calculate_yuv().

Returns
YUV buffer of the auxiliary image

Implements firevision::StereoProcessor.

Definition at line 686 of file triclops.cpp.

◆ yuv_buffer_right()

unsigned char * firevision::TriclopsStereoProcessor::yuv_buffer_right ( )
virtual

Get YUV-formatted buffer of reference camera.

This will return the YUV buffer of the reference image. This is only available after calling calculate_yuv().

Returns
YUV buffer of the reference image

Implements firevision::StereoProcessor.

Definition at line 693 of file triclops.cpp.


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