Skip to content

Commit 5cb1092

Browse files
committed
remove noise by setting skipped pixels to zero
1 parent b81e081 commit 5cb1092

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/protonect/src/registration.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,13 @@ void Registration::apply(Frame* rgb, Frame* depth, unsigned char* registered)
112112

113113
apply(x,y,z_raw,cx,cy);
114114

115-
// is rounding the right way to go here - no subpixel precision?
116115
c_off = (round(cx) + round(cy) * rgb->width) * rgb->bytes_per_pixel;
117-
if ((c_off < 0) || (c_off > rgb->width*rgb->height*rgb->bytes_per_pixel)) continue;
116+
if ((c_off < 0) || (c_off > rgb->width*rgb->height*rgb->bytes_per_pixel)) {
117+
registered[r_off+0] = 0;
118+
registered[r_off+1] = 0;
119+
registered[r_off+2] = 0;
120+
continue;
121+
}
118122

119123
registered[r_off+0] = rgb->data[c_off+0];
120124
registered[r_off+1] = rgb->data[c_off+1];

0 commit comments

Comments
 (0)