ReconstructMe SDK  1.1.739-75658
Real-time 3D reconstruction engine
 All Classes Files Functions Typedefs Enumerations Enumerator Groups Pages
example_reconstructmesdk_one_minute.cpp

Content

This is a one minute example showing basic reconstruction using a single sensor. The reconstruction result is then saved to file. It uses defaults everywhere and omits error handling.

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

#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(example_reconstructmesdk)
BOOST_AUTO_TEST_CASE(one_minute)
{
// Create a new context
// Compile for OpenCL device using defaults
// Create a new volume
// Create a new sensor. Tries multiple backends using default
// sensor configurations, returns the first working one. By default
// each sensor works on the first volume created.
reme_sensor_create(c, "openni;mskinect;file", true, &s);
// 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);
// Perform reconstruction until no more frames are left
int time = 0;
while (time < 200 && REME_SUCCESS(reme_sensor_grab(c, s))) {
// Prepare image and depth data
// Try to determine updated sensor position.
// On succes, update volume, otherwise move to a recovery position
// and wait for the tracking to start again.
if (REME_SUCCESS(reme_sensor_track_position(c, s))) {
// Update volume with depth data from the
// current sensor perspective
}
// Update the viewer
reme_viewer_update(c, viewer);
time += 1;
}
// 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);
// Make sure to release all memory acquired
}
BOOST_AUTO_TEST_SUITE_END()