Skip to content

Commit be35d02

Browse files
floefran6co
authored andcommitted
clear rgb pixels without depth data for map_rgb_to_depth
1 parent a55cd43 commit be35d02

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/registration.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,17 @@ void freenect_map_rgb_to_depth(freenect_device* dev, uint16_t* depth_mm, uint8_t
341341
uint32_t cx,cy,cindex;
342342

343343
int wz = depth_mm[index];
344-
//if (wz == 0) continue;
345344

346-
// coordinates in rgb image corresponding to x,y
345+
// pixels without depth data are black
346+
if (wz == 0) {
347+
index = index*3;
348+
rgb_registered[index+0] = 0;
349+
rgb_registered[index+1] = 0;
350+
rgb_registered[index+2] = 0;
351+
continue;
352+
}
353+
354+
// coordinates in rgb image corresponding to x,y in depth image
347355
cx = (dev->registration.registration_table[index][0] + dev->registration.depth_to_rgb_shift[wz]) / REG_X_VAL_SCALE;
348356
cy = dev->registration.registration_table[index][1];
349357

0 commit comments

Comments
 (0)