Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/libfreenect2/registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LIBFREENECT2_API Registration
void apply(int dx, int dy, float dz, float& cx, float &cy) const;

// undistort/register a whole image
void apply(const Frame* rgb, const Frame* depth, Frame* undistorted, Frame* registered, const bool enable_filter = true, Frame* bigdepth = 0) const;
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;

// compute point XYZ RGB from undistored and registered frames
void getPointXYZRGB (const Frame* undistorted, const Frame* registered, int r, int c, float& x, float& y, float& z, float& rgb) const;
Expand Down
7 changes: 4 additions & 3 deletions src/registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ void Registration::apply( int dx, int dy, float dz, float& cx, float &cy) const
* @param [out] registered Image color image for the depth data (512x424).
* @param enable_filter Use a depth buffer to remove pixels which are not visible to both cameras.
* @param [out] bigdepth If not \c NULL, mapping of depth onto colors (1920x1082 'float' frame).
* @param [out] color_depth_map If not \c NULL, map (512x424) for storing the color offset for each depth pixel.
* @note The \a bigdepth frame has a blank top and bottom row.
*/
void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth) const
void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth, int *color_depth_map) const
{
// Check if all frames are valid and have the correct size
if (!rgb || !depth || !undistorted || !registered ||
Expand Down Expand Up @@ -136,7 +137,7 @@ void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorte
float *p_filter_map = NULL;

// map for storing the color offset for each depth pixel
int *depth_to_c_off = new int[size_depth];
int *depth_to_c_off = color_depth_map ? color_depth_map : new int[size_depth];
int *map_c_off = depth_to_c_off;

// initializing the depth_map with values outside of the Kinect2 range
Expand Down Expand Up @@ -247,7 +248,7 @@ void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorte
*registered_data = c_off < 0 ? 0 : *(rgb_data + c_off);
}
}
delete[] depth_to_c_off;
if (!color_depth_map) delete[] depth_to_c_off;
}

/**
Expand Down