ReconstructMe SDK  2.6.43-0
Real-time 3D reconstruction engine
Volume

Access and manipulate the reconstruction volume. More...

Typedefs

typedef int reme_volume_t
 Handle referencing a volume object. More...
 
reme_error_t reme_volume_create (reme_context_t c, reme_volume_t *v)
 Create a new reme_volume_t object. More...
 
reme_error_t reme_volume_destroy (reme_context_t c, reme_volume_t *v)
 Destroy a previously created volume object. More...
 
reme_error_t reme_volume_get_time (reme_context_t c, reme_volume_t v, int *time)
 Get the volume time. More...
 
reme_error_t reme_volume_get_bytes (reme_context_t c, reme_volume_t v, const void **bytes, int *length)
 Returns the content of the volume as an array of bytes. More...
 
reme_error_t reme_volume_color_get_bytes (reme_context_t c, reme_volume_t v, const void **bytes, int *length)
 Returns the content of the color volume as an array of bytes. More...
 
reme_error_t reme_volume_slice_get_bytes (reme_context_t c, reme_volume_t v, const int slice, const void **bytes, int *length)
 Returns the content of a specific slice ("xy-plane") of the volume as an array of bytes. More...
 
reme_error_t reme_volume_color_slice_get_bytes (reme_context_t c, reme_volume_t v, const int slice, const void **bytes, int *length)
 Returns the content of a specific slice ("xy-plane") of the color volume as an array of bytes. More...
 
reme_error_t reme_volume_set_bytes (reme_context_t c, reme_volume_t v, const void *bytes, int length)
 Sets the content of the volume to the given array of bytes. More...
 
reme_error_t reme_volume_color_set_bytes (reme_context_t c, reme_volume_t v, const void *bytes, int length)
 Sets the content of the color volume to the given array of bytes. More...
 
reme_error_t reme_volume_slice_set_bytes (reme_context_t c, reme_volume_t v, const int slice, const void *bytes, int length)
 Sets the content of a slice ("xy-plane") of the volume to the given array of bytes. More...
 
reme_error_t reme_volume_color_slice_set_bytes (reme_context_t c, reme_volume_t v, const int slice, const void *bytes, int length)
 Sets the content of a slice ("xy-plane") of the color volume to the given array of bytes. More...
 
reme_error_t reme_volume_reset (reme_context_t c, reme_volume_t v)
 Reset the volume to empty state. More...
 
reme_error_t reme_volume_reset_selectively (reme_context_t c, reme_volume_t v, bool reset_surface, bool reset_colors)
 Reset the volume to empty state with options. More...
 

Detailed Description

Access and manipulate the reconstruction volume.

The volume defines the space in which reconstruction can take place. The dimensions and the resolution of the volume are currently fixed at compile time. Therefore, to manipulate volume related parameters use reme_context_bind_reconstruction_options before calling reme_context_compile.

The example below illustrates how to work we a default volume. Besides scanning, saving the content of the volume to disk and resuming later is supported.

// Create a new context
// Compile for OpenCL device using defaults
// Create a new volume
// Retrieve num_slices
int num_slices;
reme_options_get_int(c, o, "volume.resolution.z", &num_slices);
// Create a new openni sensor using default intrinsics
reme_sensor_create(c, "openni;mskinect;file", true, &s);
reme_viewer_t viewer;
reme_viewer_create_image(c, "This is ReconstructMeSDK", &viewer);
reme_image_t imgs[2];
reme_image_create(c, &imgs[0]);
reme_image_create(c, &imgs[1]);
reme_viewer_add_image(c, v, imgs[0]);
reme_viewer_add_image(c, v, imgs[1]);
const void *bytes;
int length;
void *load_buffer = 0;
int load_buffer_length = 0;
bool continue_scanning = true;
while (continue_scanning && REME_SUCCESS(reme_sensor_grab(c, s))) {
// Keyboard handling
if (_kbhit()) {
char k = _getch();
switch (k) {
// Key 'r' resets the volume to empty state
case 'r': {
break;
}
// Key 's' saves the volume content to disk
case 's' : {
FILE *f = fopen("volume.bin", "wb");
for (int i = 0; i < num_slices; i++) {
reme_volume_slice_get_bytes(c, v, i, &bytes, &length);
fwrite(&length, sizeof(int), 1, f);
fwrite(bytes, 1, length, f);
}
fclose(f);
break;
}
// Key 'l' loads the volume content from disk
case 'l': {
FILE *f = fopen("volume.bin", "rb");
for (int i = 0; i < num_slices; i++) {
fread(&length, sizeof(int), 1, f);
if (load_buffer_length != length) {
if (load_buffer != 0) {
free(load_buffer);
}
load_buffer = malloc(length);
load_buffer_length = length;
}
fread(load_buffer, 1, length, f);
reme_volume_slice_set_bytes(c , v, i, load_buffer, length);
}
fclose(f);
if (load_buffer != 0) {
free(load_buffer);
load_buffer = 0;
load_buffer_length = 0;
}
break;
}
case 'x': {
continue_scanning = false;
break;
}
} // end switch
} // end if kbhit()
// Prepare image and depth data
// Try to determine updated sensor position by
// matching current data against volume content
// Update volume with depth data from the
// current sensor perspective
}
// Update the viewer
reme_viewer_update(c, viewer);
}

Typedef Documentation

◆ reme_volume_t

typedef int reme_volume_t

Handle referencing a volume object.

A reme_volume_t represents a volume in 3D space. Everything within that volume is potentially reconstructed during processing sensor data.

Function Documentation

◆ reme_volume_create()

◆ reme_volume_destroy()

reme_error_t reme_volume_destroy ( reme_context_t  c,
reme_volume_t v 
)

Destroy a previously created volume object.

Parameters
cA pointer to a valid context object
vA mutable pointer to a valid volume handle to destroy
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_get_time()

reme_error_t reme_volume_get_time ( reme_context_t  c,
reme_volume_t  v,
int *  time 
)

Get the volume time.

The volume time corresponds to the number of updates performed on this volume. Initialize it is set to zero.

Parameters
cA valid context object
vA valid volume object
timeThe volume time
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_get_bytes()

reme_error_t reme_volume_get_bytes ( reme_context_t  c,
reme_volume_t  v,
const void **  bytes,
int *  length 
)

Returns the content of the volume as an array of bytes.

Downloads the current content of the volume to host side. Using in combination with reme_volume_set_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

Parameters
cA valid context object
vA valid volume object
bytesA mutable pointer that will receive the address of the volume content.
lengthA pointer that will receive the size of the returned array in bytes.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_color_get_bytes()

reme_error_t reme_volume_color_get_bytes ( reme_context_t  c,
reme_volume_t  v,
const void **  bytes,
int *  length 
)

Returns the content of the color volume as an array of bytes.

Downloads the current content of the color volume to host side. Using in combination with reme_volume_color_set_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

Parameters
cA valid context object
vA valid volume object
bytesA mutable pointer that will receive the address of the color volume content.
lengthA pointer that will receive the size of the returned array in bytes.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_slice_get_bytes()

reme_error_t reme_volume_slice_get_bytes ( reme_context_t  c,
reme_volume_t  v,
const int  slice,
const void **  bytes,
int *  length 
)

Returns the content of a specific slice ("xy-plane") of the volume as an array of bytes.

Downloads the current content of the slice ("xy-plane") of the volume to host side. Using in combination with reme_volume_slice_set_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

The number of slices equals the number of voxels in the z-dimension.

Parameters
cA valid context object
vA valid volume object
sliceSlize index along z-Dimension
bytesA mutable pointer that will receive the address of the volume content.
lengthA pointer that will receive the size of the returned array in bytes.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure
Examples:
example_reconstructmesdk_volume.cpp.

◆ reme_volume_color_slice_get_bytes()

reme_error_t reme_volume_color_slice_get_bytes ( reme_context_t  c,
reme_volume_t  v,
const int  slice,
const void **  bytes,
int *  length 
)

Returns the content of a specific slice ("xy-plane") of the color volume as an array of bytes.

Downloads the current content of the slice ("xy-plane") of the color volume to host side. Using in combination with reme_volume_color_slice_set_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

The number of slices equals the number of voxels in the z-dimension.

Parameters
cA valid context object
vA valid volume object
sliceslice index along z-Dimension
bytesA mutable pointer that will receive the address of the color volume content.
lengthA pointer that will receive the size of the returned array in bytes.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_set_bytes()

reme_error_t reme_volume_set_bytes ( reme_context_t  c,
reme_volume_t  v,
const void *  bytes,
int  length 
)

Sets the content of the volume to the given array of bytes.

Uploads the given array as volume content to the device side. Using in combination with reme_volume_get_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

Parameters
cA valid context object
vA valid volume object
bytesAn array of bytes
lengthNumber of bytes in the array
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_color_set_bytes()

reme_error_t reme_volume_color_set_bytes ( reme_context_t  c,
reme_volume_t  v,
const void *  bytes,
int  length 
)

Sets the content of the color volume to the given array of bytes.

Uploads the given array as color volume content to the device side. Using in combination with reme_volume_color_get_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

Parameters
cA valid context object
vA valid volume object
bytesAn array of bytes
lengthNumber of bytes in the array
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_slice_set_bytes()

reme_error_t reme_volume_slice_set_bytes ( reme_context_t  c,
reme_volume_t  v,
const int  slice,
const void *  bytes,
int  length 
)

Sets the content of a slice ("xy-plane") of the volume to the given array of bytes.

Uploads the given array as slice ("xy-plane") of the volume content to the device side. Using in combination with reme_volume_slice_get_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

The number of slices equals the number of voxels in the z-dimension.

Parameters
cA valid context object
vA valid volume object
sliceSlice id along z-Dimension.
bytesAn array of bytes
lengthNumber of bytes in the array
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure
Examples:
example_reconstructmesdk_volume.cpp.

◆ reme_volume_color_slice_set_bytes()

reme_error_t reme_volume_color_slice_set_bytes ( reme_context_t  c,
reme_volume_t  v,
const int  slice,
const void *  bytes,
int  length 
)

Sets the content of a slice ("xy-plane") of the color volume to the given array of bytes.

Uploads the given array as slice ("xy-plane") of the color volume content to the device side. Using in combination with reme_volume_color_slice_get_bytes one can resume a previously started reconstruction as long as the volume parameters (dimensions) match.

The number of slices equals the number of voxels in the z-dimension.

Parameters
cA valid context object
vA valid volume object
sliceslice id along z-Dimension.
bytesAn array of bytes
lengthNumber of bytes in the array
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure

◆ reme_volume_reset()

reme_error_t reme_volume_reset ( reme_context_t  c,
reme_volume_t  v 
)

Reset the volume to empty state.

Forces the volume to clear its content.

Parameters
cA valid context object
vA valid volume object
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure
Examples:
example_reconstructmesdk_csg.cpp, example_reconstructmesdk_marker.cpp, example_reconstructmesdk_scan_tilt.cpp, and example_reconstructmesdk_volume.cpp.

◆ reme_volume_reset_selectively()

reme_error_t reme_volume_reset_selectively ( reme_context_t  c,
reme_volume_t  v,
bool  reset_surface,
bool  reset_colors 
)

Reset the volume to empty state with options.

Forces the volume to clear its content.

Parameters
cA valid context object
vA valid volume object
reset_surfaceIf true resets geometric part of the volume.
reset_colorsIf true resets color part of the volume.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure
Examples:
example_reconstructmesdk_bust.cpp, and example_reconstructmesdk_marker.cpp.