@@ -130,9 +130,10 @@ void RegistrationImpl::apply( int dx, int dy, float dz, float& cx, float &cy) co
130130 * @param [out] registered Image color image for the depth data (512x424).
131131 * @param enable_filter Use a depth buffer to remove pixels which are not visible to both cameras.
132132 * @param [out] bigdepth If not \c NULL, mapping of depth onto colors (1920x1082 'float' frame).
133+ * @param [out] color_depth_map If not \c NULL, map (512x424) for storing the color offset for each depth pixel.
133134 * @note The \a bigdepth frame has a blank top and bottom row.
134135 */
135- void Registration::apply (const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth) const
136+ void Registration::apply (const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth, int *color_depth_map ) const
136137{
137138 impl_->apply (rgb, depth, undistorted, registered, enable_filter, bigdepth);
138139}
@@ -171,7 +172,7 @@ void RegistrationImpl::apply(const Frame *rgb, const Frame *depth, Frame *undist
171172 float *p_filter_map = NULL ;
172173
173174 // map for storing the color offset for each depth pixel
174- int *depth_to_c_off = new int [size_depth];
175+ int *depth_to_c_off = color_depth_map ? color_depth_map : new int [size_depth];
175176 int *map_c_off = depth_to_c_off;
176177
177178 // initializing the depth_map with values outside of the Kinect2 range
@@ -282,7 +283,7 @@ void RegistrationImpl::apply(const Frame *rgb, const Frame *depth, Frame *undist
282283 *registered_data = c_off < 0 ? 0 : *(rgb_data + c_off);
283284 }
284285 }
285- delete[] depth_to_c_off;
286+ if (!color_depth_map) delete[] depth_to_c_off;
286287}
287288
288289/* *
0 commit comments