Fawkes API
Fawkes Development Version
|
Stereo processing using PGR Triclops SDK. More...
#include <>>
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... | |
![]() | |
virtual | ~StereoProcessor () |
Virtual empty destructor. More... | |
Stereo processing using PGR Triclops SDK.
This class uses the Triclops SDK provided by Point Grey Research along with the Bumblebee2 cameras.
Definition at line 40 of file triclops.h.
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.
width | image width in pixels |
height | image height in pixels |
context_file | Triclops context file |
Definition at line 124 of file triclops.cpp.
firevision::TriclopsStereoProcessor::TriclopsStereoProcessor | ( | Camera * | camera | ) |
Constructor.
This constructor initializes this triclops wrapper to work on a real camera.
camera | Must be of type Bumblebee2Camera |
Definition at line 81 of file triclops.cpp.
|
virtual |
Destructor.
Definition at line 236 of file triclops.cpp.
|
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.
roi | region 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.
|
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.
both | if 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.
|
virtual |
Get the disparity image buffer.
Access method to the disparity image buffer.
Implements firevision::StereoProcessor.
Definition at line 664 of file triclops.cpp.
|
virtual |
Get disparity buffer size.
Implements firevision::StereoProcessor.
Definition at line 675 of file triclops.cpp.
|
virtual |
Check state of disparity mapping.
Definition at line 549 of file triclops.cpp.
|
virtual |
Get disparity mapping max value.
Definition at line 537 of file triclops.cpp.
|
virtual |
Get disparity mapping min value.
Definition at line 525 of file triclops.cpp.
|
virtual |
Get disparity range max value.
Definition at line 465 of file triclops.cpp.
|
virtual |
Get disparity range min value.
Definition at line 453 of file triclops.cpp.
|
virtual |
Check state of edge correlation.
Definition at line 429 of file triclops.cpp.
|
virtual |
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.
lut_file | name 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().
|
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.
px | x coordinate in image |
py | y coordinate in image |
x | contains the x coordinate in the camera-relative coordinate system upon successful return |
y | contains the y coordinate in the camera-relative coordinate system upon successful return |
z | contains the z coordinate in the camera-relative coordinate system upon successful return |
Implements firevision::StereoProcessor.
Definition at line 799 of file triclops.cpp.
References fawkes::deg2rad().
|
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.
px | x coordinate in image |
py | y coordinate in image |
x | contains the x coordinate in the camera-relative coordinate system upon successful return |
y | contains the y coordinate in the camera-relative coordinate system upon successful return |
z | contains the z coordinate in the camera-relative coordinate system upon successful return |
Implements firevision::StereoProcessor.
Definition at line 763 of file triclops.cpp.
|
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.
buffer | buffer for the coordinates, 1st index 0: x; 1: y; 2:z, 2nd index denotes the lines, 3rd index denotes the columns |
hoff | horizontal offset of the window |
voff | vertical offset of the window |
width | width of the window |
height | height of the window |
settings | a 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().
|
virtual |
Check state of lowpass filtering.
Definition at line 441 of file triclops.cpp.
|
virtual |
Get height of ouput images.
Definition at line 419 of file triclops.cpp.
|
virtual |
Get width of ouput images.
Definition at line 409 of file triclops.cpp.
|
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.
|
virtual |
Enable or disable disparity mapping.
enabled | true to enable, false to disable |
Definition at line 388 of file triclops.cpp.
|
virtual |
Set disparity mapping range.
min | minimum disparity |
max | maximum disparity |
Definition at line 378 of file triclops.cpp.
|
virtual |
Set disparity range.
min | minimum disparity |
max | maximum disparity |
Definition at line 324 of file triclops.cpp.
|
virtual |
Enable or disable edge correlation.
enabled | true to enable, false to disable |
Definition at line 303 of file triclops.cpp.
|
virtual |
Set edge mask.
Size of the kernel used for edge detection. This value must be in the range [3..13].
mask_size | mask size |
Definition at line 336 of file triclops.cpp.
|
virtual |
Enable or disable lowpass filtering before rectification.
enabled | true to enable, false to disable |
Definition at line 313 of file triclops.cpp.
|
virtual |
Set the resolution of the output images.
width | the width of the output images |
height | the height of the output images |
Definition at line 276 of file triclops.cpp.
|
virtual |
Set raw buffer.
raw16_buffer | buffer containing the stereo image encoded as BB2 RAW16 |
Definition at line 265 of file triclops.cpp.
|
virtual |
Set stereo mask.
Size of the mask used for stereo correlation.
mask_size | mask size |
Definition at line 347 of file triclops.cpp.
|
virtual |
Enable or disable subpixel interpolation.
enabled | true to enable, false to disable |
Definition at line 292 of file triclops.cpp.
|
virtual |
Enable or disable surface validation.
enabled | true to enable, false to disable |
Definition at line 357 of file triclops.cpp.
|
virtual |
Enable or disable texture validation.
enabled | true to enable, false to disable |
Definition at line 367 of file triclops.cpp.
|
virtual |
|
virtual |
Check state of subpixel interpolation.
Definition at line 397 of file triclops.cpp.
|
virtual |
Check state of surface validation.
Definition at line 501 of file triclops.cpp.
|
virtual |
Check state of texture validation.
Definition at line 513 of file triclops.cpp.
bool firevision::TriclopsStereoProcessor::verify_rectification_lut | ( | const char * | lut_file | ) |
Verify rectification LUT.
lut_file | Rectification LUT to verify |
Definition at line 913 of file triclops.cpp.
References firevision::RectificationInfoBlock::camera(), firevision::RectificationInfoFile::guid(), firevision::RectificationLutInfoBlock::mapping(), firevision::FireVisionDataFile::num_blocks(), firevision::RectificationInfoFile::read(), firevision::RectificationInfoFile::rectinfo_blocks(), and firevision::FireVisionDataFileBlock::type().
|
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().
Implements firevision::StereoProcessor.
Definition at line 686 of file triclops.cpp.
|
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().
Implements firevision::StereoProcessor.
Definition at line 693 of file triclops.cpp.