ReconstructMe SDK
1.5.795-79862
Real-time 3D reconstruction engine
|
Acquire data from real-world sensors or from file streams. More...
Typedefs | |
typedef int | reme_sensor_t |
Handle referencing a sensor object. | |
typedef enum _reme_sensor_image_t | reme_sensor_image_t |
Image type enumeration. | |
typedef enum _reme_sensor_view_t | reme_sensor_view_t |
Sensor view type. | |
typedef enum _reme_sensor_trackmode_t | reme_sensor_trackmode_t |
Sensor tracking mode. | |
typedef enum _reme_sensor_trackhint_t | reme_sensor_trackhint_t |
Sensor tracking hint. | |
Acquire data from real-world sensors or from file streams.
The sensor is responsible for acquiring real world data and feeding it into the reconstruction volume. The life-time of reme_sensor_t sensor is usually the following
require_can_open
flag.The one-minute example illustrates the basic usage.
typedef int reme_sensor_t |
Handle referencing a sensor object.
A reme_sensor_t represents a RGBD sensor. Associated methods allow to create, open and interact with sensors of various types.
typedef enum _reme_sensor_image_t reme_sensor_image_t |
Image type enumeration.
Each sensor might provide different frame types that are all 2D images. Not all sensors support all frames, or the number of frames supported is configuration dependant.
typedef enum _reme_sensor_view_t reme_sensor_view_t |
Sensor view type.
When dealing with sensor data ReconstructMe offers two types of views. The first view REME_SENSOR_VIEW_RAW corresponds to data passed as raw input to ReconstructMe. The second view type is REME_SENSOR_VIEW_RECONSTRUCTED and corresponds to a synthetic view generated by raytracing the volume from the current sensor to volume position.
The REME_SENSOR_VIEW_RECONSTRUCTED normally is much more smooth and has less holes than REME_SENSOR_VIEW_RAW, but naturally limits data to the size of the reconstruction volume.
typedef enum _reme_sensor_trackmode_t reme_sensor_trackmode_t |
Sensor tracking mode.
Defines the basic tracking strategy to find the sensor position based on current and past sensor data.
typedef enum _reme_sensor_trackhint_t reme_sensor_trackhint_t |
Sensor tracking hint.
Provides optional hints for the sensor tracking module.
enum _reme_sensor_image_t |
Image type enumeration.
Each sensor might provide different frame types that are all 2D images. Not all sensors support all frames, or the number of frames supported is configuration dependant.
enum _reme_sensor_view_t |
Sensor view type.
When dealing with sensor data ReconstructMe offers two types of views. The first view REME_SENSOR_VIEW_RAW corresponds to data passed as raw input to ReconstructMe. The second view type is REME_SENSOR_VIEW_RECONSTRUCTED and corresponds to a synthetic view generated by raytracing the volume from the current sensor to volume position.
The REME_SENSOR_VIEW_RECONSTRUCTED normally is much more smooth and has less holes than REME_SENSOR_VIEW_RAW, but naturally limits data to the size of the reconstruction volume.
Sensor tracking mode.
Defines the basic tracking strategy to find the sensor position based on current and past sensor data.
Sensor tracking hint.
Provides optional hints for the sensor tracking module.
reme_error_t reme_sensor_create | ( | reme_context_t | c, |
const char * | driver, | ||
bool | require_can_open, | ||
reme_sensor_t * | s | ||
) |
Create a new sensor object.
Creates a new sensor. The driver argument specifies which sensor to open. The following sensor drivers are currently available
You might specify a specific driver backend
Alternatively you can specify a list of drivers to test, in which case it will return the first sensor that works.
Or, specify file containing a sensor configuration file (see reme_sensor_bind_camera_options for camera specific options and Accessing and Modifying Options for background information about options)
The drivers will be tested in the given order.
Set require_can_open to true to ensure the created sensor can be created and opened using either the default settings, or if file paths are specifed using the settings specified in the file.
No matter how require_can_open is set the sensor is returned in closed state. Use reme_sensor_open to open it.
c | A valid context object |
driver | The name of sensor driver to instance a sensor from |
require_can_open | Ensures that the returned sensor can be opened using either the default sensor options. |
s | A pointer that will receive the handle of the created sensor |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_destroy | ( | reme_context_t | c, |
reme_sensor_t * | s | ||
) |
Destroy a previously created sensor object.
c | A pointer to a valid context object |
s | A mutable pointer to a valid sensor handle to destroy |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_open | ( | reme_context_t | c, |
reme_sensor_t | s | ||
) |
Open a sensor.
Attempts to opens the specified sensor using the specified sensor options.
c | A valid context object |
s | A valid sensor object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_close | ( | reme_context_t | c, |
reme_sensor_t | s | ||
) |
Close a an open sensor.
Indicates that no more grabbing is done from sensor. Re-opening a sensor is possible.
c | A valid context object |
s | A valid sensor object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_set_volume | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_volume_t | v | ||
) |
Set the working volume.
The sensor will use this volume to keep track of its position and it will also update into this volume. By default the sensor is assigned to the first volume available.
c | A valid context object |
s | A valid sensor object |
v | A valid volume object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_set_trackmode | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_sensor_trackmode_t | t | ||
) |
Set tracking mode.
Sets the overall tracking strategy. By default REME_SENSOR_TRACKMODE_AUTO is used.
c | A valid context object |
s | A valid sensor object |
t | A valid tracking mode |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_set_trackhint | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_sensor_trackhint_t | t | ||
) |
Sets a tracking hint.
The tracking hint is an external user supplied information to support the camera tracking module. Any tracking hint given remains active until the next call to reme_sensor_track_position.
Supplying tracking hints becomes useful when the caller has external knowledge unknown to the tracking module. For example the caller might set REME_SENSOR_TRACKHINT_USE_GLOBAL to indicate that the tracking module is should resort to global tracking in the next iteration.
Tracking hints are automatically cleared after the next call to reme_sensor_track_position.
c | A valid context object |
s | A valid sensor object |
t | A valid tracking hint |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_bind_camera_options | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_options_t | o | ||
) |
Access the sensor specific options that affect how the camera is opened.
For openni sensors (OpenNI 2.x)
For mskinect sensors
For file sensors
For openni sensors (OpenNI 1.x)
Common to all configurations above is the usage of the LibRGBDSensor.videostream
The referenced LibRGBDSensor.intrinsics has the following layout
c | A valid context object |
s | A valid sensor object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_bind_capture_options | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_options_t | o | ||
) |
Access the sensor specific capture options with their current values.
Depending on the sensor chosen on create, different specs are needed, since each sensor supports a different set of parameters.
For openni sensors
For mskinect sensors
For file sensors
Common to all configurations above is the frame_info field. It is mendatory for reconstruction and has the following structure
c | A valid context object |
s | A valid sensor object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_apply_capture_options | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_options_t | o | ||
) |
Apply capture options.
Causes all capture options set to be applied at given sensor. In order to set only specific options, invoke reme_options_clear on the options target before setting the new values. Then invoke reme_sensor_apply_capture_options.
c | A valid context object |
s | A valid sensor object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_get_position | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
float * | coordinates | ||
) |
Get the sensor position with respect to the world coordinate frame.
Initially this is set to identity for all sensors. The position is modified when reme_sensor_track_position succeeds, or reme_sensor_set_position is called.
c | A valid context object |
s | A valid sensor object |
coordinates | A constant pointer to constant Transform data. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_get_recovery_position | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
float * | coordinates | ||
) |
Get the sensor recovery position with respect to the world coordinate frame.
Whenever the sensor cannot find track, it puts itself into recovery pose. It then waits in the recovery pose for tracking to succeed. The recovery pose will be updated during ongoing tracking automatically. I.e when there is sufficient confidence that the last n-frames where tracked successfully, ReconstructMe generates a new recovery pose.
Initially this is set to identity for all sensors. The position is modified when reme_sensor_track_position succeeds several times, or reme_sensor_set_recovery_position is called.
c | A valid context object |
s | A valid sensor object |
coordinates | A constant pointer to constant Transform data. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_get_incremental_position | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
float * | coordinates | ||
) |
Get the incremental movement of the sensor.
When reme_sensor_track_position succeeds this position reflects the movement of the sensor between the last position of the sensor and the current position of the sensor.
c | A valid context object |
s | A valid sensor object |
coordinates | A constant pointer to pre-allocated Transform data. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_set_position | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
const float * | coordinates | ||
) |
Set the sensor position with respect to the world coordinate frame.
Initially this is set to identity for all sensors.
c | A valid context object |
s | A valid sensor object |
coordinates | A pointer to constant Transform data. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_set_incremental_position | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
const float * | coordinates | ||
) |
Set the incremental movement of the sensor.
Updates the world position of the sensor by the incremental position specified.
c | A valid context object |
s | A valid sensor object |
coordinates | A pointer to constant Transform data. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_set_recovery_position | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
const float * | coordinates | ||
) |
Set the sensor recovery position with respect to the world coordinate frame.
Whenever the sensor cannot find track, it puts itself into recovery pose. It then waits in the recovery pose for tracking to succeed. The recovery pose will be updated during ongoing tracking automatically. I.e when there is sufficient confidence that the last n-frames where tracked successfully, ReconstructMe generates a new recovery pose.
Initially this is set to identity for all sensors. The position is modified when reme_sensor_track_position succeeds several times, or reme_sensor_set_recovery_position is called.
c | A valid context object |
s | A valid sensor object |
coordinates | A constant pointer to constant Transform data. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_reset | ( | reme_context_t | c, |
reme_sensor_t | s | ||
) |
Resets the sensor to identity position.
Forces the sensor to loose track.
c | A valid context object |
s | A valid sensor object |
REME_ERROR_SUCCESS | On tracking success or the corresponding volume is empty. |
REME_ERROR_UNSPECIFIED | is returned otherwise. |
reme_error_t reme_sensor_get_image | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_sensor_image_t | it, | ||
reme_image_t | i | ||
) |
Get a specific sensor image.
Each sensor might provide different frame types. Not all sensors support all frames, or the number of frames supported is configuration dependant. See reme_sensor_image_t for a complete enumeration of available image types.
The returned image remains valid until the sensor is destroyed or the dimension of the image changes. The pointer is recycled internally, which means that it will point to different values each time the sensor images are updated.
c | A valid context object |
s | A valid sensor object |
it | Image type to access |
i | A valid image object to receive image data |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_is_image_supported | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_sensor_image_t | it, | ||
bool * | result | ||
) |
Test if a specific image type is available.
Each sensor might provide different frame types. Not all sensors support all frames, or the number of frames supported is configuration dependant. See reme_sensor_image_t for a complete enumeration of available image types.
c | A valid context object |
s | A valid sensor object |
it | Image type to access |
result | Whether image type is supported or not. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_get_points | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_sensor_view_t | v, | ||
const float ** | coordinates, | ||
int * | length | ||
) |
Get points corresponding to the current sensor view.
Depending on the choice of v
(reme_sensor_view_t) this returns
The points are represented as an array of floats where each point consists of 4 coordinates Px Py Pz Pw Px Py Pz Pw ...
. The w
component is always zero. The i-th point starts at index i * 4
of coordinate array returned.
The number of points returned corresponds to the number of pixels of the native sensor. That is, if your sensor has a resolution of 640x480 (cols x rows) the number of returned normals is 640 * 480. The normals are returned in row-wise order. Those points that do not represent a valid data are marked with a sentinel value (NAN) in their x-coordinate. To access the point corresponding to pixel of row i
and column j
use i * cols * 4 + j * 4
where cols
is the number of pixel columns of the native sensor.
c | A valid context object |
s | A valid sensor object |
v | view type specification |
coordinates | A mutable pointer to constant point data. |
length | The number of coordinates returned. To get the number of points divide this value by 4. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_get_point_normals | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
reme_sensor_view_t | v, | ||
const float ** | coordinates, | ||
int * | length | ||
) |
Get point normals corresponding to the current sensor view.
Depending on the choice of v
(reme_sensor_view_t) this returns
The point normals are represented as an array of floats where each point consists of 4 coordinates Px Py Pz Pw Px Py Pz Pw ...
. The w
component is always zero. The i-th normal starts at index i * 4
of coordinate array returned.
The number of normals returned corresponds to the number of pixels of the native sensor. That is, if your sensor has a resolution of 640x480 (cols x rows) the number of returned normals is 640 * 480. The normals are returned in row-wise order. Those normals that do not represent a valid data are marked with a sentinel value (NAN) in their x-coordinate. To access the normal corresponding to pixel of row i
and column j
use i * cols * 4 + j * 4
where cols
is the number of pixel columns of the native sensor.
c | A valid context object |
s | A valid sensor object |
v | view type specification |
coordinates | A mutable pointer to constant normal data. |
length | The number of coordinates returned. To get the number of normals divide this value by 4. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_get_track_time | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
int * | track_time | ||
) |
Get the tracking time.
The tracking time corresponds to the number of frames in which tracking succeeded. In case tracking fails the counter gets negative.
c | A valid context object |
s | A valid sensor object |
track_time | The tracking time |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_grab | ( | reme_context_t | c, |
reme_sensor_t | s | ||
) |
Trigger frame grabbing.
Provides a synchronization point to trigger image generation of all image types. This method is intended to be fast.
In order to synchronize frame grabbing from multiple sensors, call this method in sequence for each sensor before calling reme_sensor_retrieve.
c | A valid context object |
s | A valid sensor object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_FAILED_TO_GRAB | Failed to grab from sensor. This is not necessarily an error, you might re-try. |
REME_ERROR_UNSPECIFIED | Is returned otherwise. |
reme_error_t reme_sensor_prepare_images | ( | reme_context_t | c, |
reme_sensor_t | s | ||
) |
Retrieve image data corresponding to the previous grab command for further processing.
Updates the internal state of all images and prepares the required data structures on the computation device.
c | A valid context object |
s | A valid sensor object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_prepare_image | ( | reme_context_t | c, |
reme_sensor_t | s, | ||
_reme_sensor_image_t | i | ||
) |
Retrieve specific image data for subsequent processing.
In case REME_IMAGE_AUX or REME_IMAGE_DEPTH is passed, this method will fetch the data into internal memory. In case REME_IMAGE_VOLUME is passed, the previously prepared REME_IMAGE_DEPTH will be uploaded to the computation device for subsequent processing (reme_sensor_track_position, reme_sensor_update_volume).
This method is especially useful (when compared to reme_sensor_prepare_images) when only depth and image data is required. For example when recording, there is no need for REME_IMAGE_VOLUME and it should be skipped so no time is wasted waiting for the data to be uploaded to the computation device.
c | A valid context object |
s | A valid sensor object |
i | Image type to prepare |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_sensor_track_position | ( | reme_context_t | c, |
reme_sensor_t | s | ||
) |
Attempts to track the sensor position.
Tries to track the sensor movement by matching the current depth data against the perspective from the last position. Initially the sensor position is the identity position, unless otherwise specified.
The tracking behaviour is affected by the tracking strategy (reme_sensor_set_trackmode) and any external tracking hint (reme_sensor_set_trackhint). Any tracking hint will be cleared after calling this method.
c | A valid context object |
s | A valid sensor object |
REME_ERROR_SUCCESS | On tracking success or the corresponding volume is empty. |
REME_ERROR_TRACK_LOST | When the tracking did not succeed. In this case the sensor is repositioned into latest recovery pose. |
REME_ERROR_UNSPECIFIED | is returned otherwise. |
reme_error_t reme_sensor_update_volume | ( | reme_context_t | c, |
reme_sensor_t | s | ||
) |
Update the bound volume using the current sensor data.
Uses the current sensor position as the perspective to update the volume.
c | A valid context object |
s | A valid sensor object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |