ReconstructMe SDK  1.0.726-75385
Real-time 3D reconstruction engine
 All Classes Files Functions Typedefs Enumerations Enumerator Groups
example_reconstructmesdk_image.cpp

Content

This example shows how to access images generated by sensor objects. Additionally to ReMe it uses OpenCV to display them for the sake of simplicity of this example.

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

#include <boost/test/unit_test.hpp>
#include <opencv2/opencv.hpp>
BOOST_AUTO_TEST_SUITE(example_reconstructmesdk)
BOOST_AUTO_TEST_CASE(image)
{
// Create a new context that has default options applied
// Create a sensor using a saved data stream
reme_sensor_create(c, "openni;mskinect;file", false, &s);
const void *data;
int width, height;
while (REME_SUCCESS(reme_sensor_grab(c, s)))
{
// Update internal state of images
// Once the reme_sensor_retrieve completes, we request a pointer to its data
reme_sensor_get_image(c, s, REME_IMAGE_AUX, &data, &width, &height);
// In C++ we could now feed this to OpenCV for visualization
cv::Mat rgb(height, width, CV_8UC3, (char*)data);
cv::Mat bgr;
cv::cvtColor(rgb, bgr, CV_RGB2BGR);
cv::imshow("RGB", bgr);
cv::waitKey(10);
}
// Make sure to release all memory acquired
}
BOOST_AUTO_TEST_SUITE_END()