MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / RegistrationImpl

Method RegistrationImpl

src/registration.cpp:370–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370RegistrationImpl::RegistrationImpl(Freenect2Device::IrCameraParams depth_p, Freenect2Device::ColorCameraParams rgb_p):
371 depth(depth_p), color(rgb_p), filter_width_half(2), filter_height_half(1), filter_tolerance(0.01f)
372{
373 float mx, my;
374 int ix, iy, index;
375 float rx, ry;
376 int *map_dist = distort_map;
377 float *map_x = depth_to_color_map_x;
378 float *map_y = depth_to_color_map_y;
379 int *map_yi = depth_to_color_map_yi;
380
381 for (int y = 0; y < 424; y++) {
382 for (int x = 0; x < 512; x++) {
383 // compute the dirstored coordinate for current pixel
384 distort(x,y,mx,my);
385 // rounding the values and check if the pixel is inside the image
386 ix = (int)(mx + 0.5f);
387 iy = (int)(my + 0.5f);
388 if(ix < 0 || ix >= 512 || iy < 0 || iy >= 424)
389 index = -1;
390 else
391 // computing the index from the coordianted for faster access to the data
392 index = iy * 512 + ix;
393 *map_dist++ = index;
394
395 // compute the depth to color mapping entries for the current pixel
396 depth_to_color(x,y,rx,ry);
397 *map_x++ = rx;
398 *map_y++ = ry;
399 // compute the y offset to minimize later computations
400 *map_yi++ = (int)(ry + 0.5f);
401 }
402 }
403}
404
405} /* namespace libfreenect2 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected