libfreenect2  0.2
Public Member Functions | List of all members
Registration Class Reference

Combine frames of depth and color camera. More...

#include <libfreenect2/registration.h>

Public Member Functions

 Registration (Freenect2Device::IrCameraParams depth_p, Freenect2Device::ColorCameraParams rgb_p)
 
 ~Registration ()
 
void apply (int dx, int dy, float dz, float &cx, float &cy) const
 Undistort and register a single depth point to color camera. More...
 
void apply (const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter=true, Frame *bigdepth=0, int *color_depth_map=0) const
 Map color images onto depth images. More...
 
void undistortDepth (const Frame *depth, Frame *undistorted) const
 Undistort depth. More...
 
void getPointXYZRGB (const Frame *undistorted, const Frame *registered, int r, int c, float &x, float &y, float &z, float &rgb) const
 Construct a 3-D point with color in a point cloud. More...
 
void getPointXYZ (const Frame *undistorted, int r, int c, float &x, float &y, float &z) const
 Construct a 3-D point in a point cloud. More...
 

Detailed Description

Combine frames of depth and color camera.

Right now this class uses a reverse engineered formula that uses factory preset extrinsic parameters. We do not have a clear understanding of these particular extrinsic parameters and do not know how to calibrate them by hand.

If you want to perform registration with standard camera extrinsic matrix, you probably need something else.

Constructor & Destructor Documentation

Parameters
depth_pDepth camera parameters. You can use the factory values, or use your own.
rgb_pColor camera parameters. Probably use the factory values for now.

Member Function Documentation

void apply ( int  dx,
int  dy,
float  dz,
float &  cx,
float &  cy 
) const

Undistort and register a single depth point to color camera.

Parameters
dxDistorted depth coordinate x (pixel)
dyDistorted depth coordinate y (pixel)
dzDepth value (millimeter)
[out]cxUndistorted color coordinate x (normalized)
[out]cyUndistorted color coordinate y (normalized)
void apply ( const Frame rgb,
const Frame depth,
Frame undistorted,
Frame registered,
const bool  enable_filter = true,
Frame bigdepth = 0,
int *  color_depth_map = 0 
) const

Map color images onto depth images.

Parameters
rgbColor image (1920x1080 BGRX)
depthDepth image (512x424 float)
[out]undistortedUndistorted depth image
[out]registeredColor image for the depth image (512x424)
enable_filterFilter out pixels not visible to both cameras.
[out]bigdepthIf not NULL, return mapping of depth onto colors (1920x1082 float). 1082 not 1080, with a blank top and bottom row.
[out]color_depth_mapIndex of mapped color pixel for each depth pixel (512x424).
void undistortDepth ( const Frame depth,
Frame undistorted 
) const

Undistort depth.

Parameters
depthDepth image (512x424 float)
[out]undistortedUndistorted depth image
void getPointXYZRGB ( const Frame undistorted,
const Frame registered,
int  r,
int  c,
float &  x,
float &  y,
float &  z,
float &  rgb 
) const

Construct a 3-D point with color in a point cloud.

Parameters
undistortedUndistorted depth frame from apply().
registeredRegistered color frame from apply().
rRow (y) index in depth image.
cColumn (x) index in depth image.
[out]xX coordinate of the 3-D point (meter).
[out]yY coordinate of the 3-D point (meter).
[out]zZ coordinate of the 3-D point (meter).
[out]rgbColor of the 3-D point (BGRX). To unpack the data, use
const uint8_t *p = reinterpret_cast<uint8_t*>(&rgb);
uint8_t b = p[0];
uint8_t g = p[1];
uint8_t r = p[2];
void getPointXYZ ( const Frame undistorted,
int  r,
int  c,
float &  x,
float &  y,
float &  z 
) const

Construct a 3-D point in a point cloud.

Parameters
undistortedUndistorted depth frame from apply().
rRow (y) index in depth image.
cColumn (x) index in depth image.
[out]xX coordinate of the 3-D point (meter).
[out]yY coordinate of the 3-D point (meter).
[out]zZ coordinate of the 3-D point (meter).