Skip to content

Commit 6bf7b8e

Browse files
author
Giacomo Dabisias
committed
makes the map for storing the color offset for each depth pixel a function parameter in order to make the user decide the allocation policy
1 parent 12c5b58 commit 6bf7b8e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/libfreenect2/registration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class LIBFREENECT2_API Registration
4747
void apply(int dx, int dy, float dz, float& cx, float &cy) const;
4848

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

5252
// compute point XYZ RGB from undistored and registered frames
5353
void getPointXYZRGB (const Frame* undistorted, const Frame* registered, int r, int c, float& x, float& y, float& z, float& rgb) const;

src/registration.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ void Registration::apply( int dx, int dy, float dz, float& cx, float &cy) const
100100
* @param [out] registered Image color image for the depth data (512x424).
101101
* @param enable_filter Use a depth buffer to remove pixels which are not visible to both cameras.
102102
* @param [out] bigdepth If not \c NULL, mapping of depth onto colors (1920x1082 'float' frame).
103+
* @param [out] bigdepth If not \c NULL, map for storing the color offset for each depth pixel.
103104
* @note The \a bigdepth frame has a blank top and bottom row.
104105
*/
105-
void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth) const
106+
void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth, int *color_depth_map) const
106107
{
107108
// Check if all frames are valid and have the correct size
108109
if (!rgb || !depth || !undistorted || !registered ||
@@ -136,7 +137,7 @@ void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorte
136137
float *p_filter_map = NULL;
137138

138139
// map for storing the color offset for each depth pixel
139-
int *depth_to_c_off = new int[size_depth];
140+
int *depth_to_c_off = color_depth_map ? color_depth_map : new int[size_depth];
140141
int *map_c_off = depth_to_c_off;
141142

142143
// initializing the depth_map with values outside of the Kinect2 range

0 commit comments

Comments
 (0)