ReconstructMe SDK  2.0.819-89134
Real-time 3D reconstruction engine
 All Classes Files Functions Typedefs Enumerations Enumerator Groups Pages
example_reconstructmesdk_point_and_shoot_with_colors.cpp

Content

This examples shows how to use the point&shoot mode by making use of global registration. Instead of real-time scanning, images will only be taken at specific locations (user-driver). Additionally color information will be integrated.

Boost is only used to generate examples and is not necessary for working with this SDK.

#include <boost/test/unit_test.hpp>
#include <stdio.h>
#include <conio.h>
BOOST_AUTO_TEST_SUITE(example_reconstructmesdk)
BOOST_AUTO_TEST_CASE(point_and_shoot_colorize)
{
puts("Press any key to trigger the acquisition of a single frame.");
puts("Note that the console window needs to be in the fore-ground.");
puts("Press 'x' to stop reconstruction.");
// Create a new context
// Create a license object
reme_error_t e = reme_license_authenticate(c, l, "license.txt.sgn");
// We adjust a couple of reconstruction settings to gain optimal registration results and colorize.
// Turn on colors
reme_options_set_bool(c, o, "data_integration.use_colors", true);
// Relax verification, as each frame might add a huge areas of unseen area.
reme_options_set_real(c, o, "camera_tracking.verification.maximum_sdf_change_on_track", 2.f);
reme_options_set_real(c, o, "camera_tracking.verification.maximum_sdf_change_no_track", 2.f);
// Allow global search to perform longer, finding a potentially better transform
reme_options_set_real(c, o, "camera_tracking.global_search.minimum_inlier_percentage", 0.1f);
reme_options_set_real(c, o, "camera_tracking.global_search.maximum_seconds", 2.f);
// Use the auto-tuner to setup some parameters automatically
// Compile for OpenCL device
// Create a new volume
// Create a new sensor.
reme_sensor_create(c, "openni;mskinect;file", true, &s);
reme_options_set_bool(c, o, "enable_align_viewpoints", true);
// Use color in rendering volume image
reme_options_set(c, o, "shade_mode", "SHADE_COLORS");
// Always use global tracking
// For debugging purposes open a viewer for tracking the reconstruction process.
reme_viewer_t viewer;
reme_viewer_create_image(c, "This is ReconstructMe SDK", &viewer);
reme_image_t volume, aux;
reme_image_create(c, &volume);
reme_viewer_add_image(c, viewer, aux);
reme_viewer_add_image(c, viewer, volume);
// Main reconstruction loop
bool continue_scanning = true;
while (continue_scanning && REME_SUCCESS(reme_sensor_grab(c, s))) {
// Prepare image and depth data
if (_kbhit()) {
char k = _getch();
if (k == 'x')
continue_scanning = false;
// Track and update
if (REME_SUCCESS(reme_sensor_track_position(c, s))) {
}
}
// Update the viewer
reme_viewer_update(c, viewer);
}
// Close and destroy the sensor, it is not needed anymore
// Create a new surface
reme_surface_save_to_file(c, m, "test.ply");
// Visualize resulting surface
reme_viewer_t viewer_surface;
reme_viewer_create_surface(c, m, "This is ReconstructMeSDK", &viewer_surface);
reme_viewer_wait(c, viewer_surface);
// Print pending errors
// Make sure to release all memory acquired
}
BOOST_AUTO_TEST_SUITE_END()