ReconstructMe SDK
2.6.43-0
Real-time 3D reconstruction engine
|
Compute a 3D triangle mesh from content of the reconstruction volume. More...
Compute a 3D triangle mesh from content of the reconstruction volume.
This modules provides methods to generate triangle meshes from reconstruction volumes. Besides basic surface extraction, hole closing and decimation functionality is provided.
The example below illustrates the functionality.
typedef int reme_surface_t |
Handle referencing a surface object.
A reme_surface_t represents a 3D mesh surface extracted from a volume. Its associated methods allow to influence the generation process, access mesh data and save volumes using our exporters.
reme_error_t reme_surface_create | ( | reme_context_t | c, |
reme_surface_t * | s | ||
) |
Create a new surface object.
c | A valid context object |
s | A pointer that will receive the handle of the created surface |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_destroy | ( | reme_context_t | c, |
reme_surface_t * | s | ||
) |
Destroy a previously created surface object.
c | A pointer to a valid context object |
s | A mutable pointer to a valid surface handle to destroy |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_bind_generation_options | ( | reme_context_t | c, |
reme_surface_t | s, | ||
reme_options_t | o | ||
) |
Access the surface generation options.
c | A valid context object |
s | A valid surface object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_bind_poisson_options | ( | reme_context_t | c, |
reme_surface_t | s, | ||
reme_options_t | o | ||
) |
Access the poisson reconstruction options.
c | A valid context object |
s | A valid surface object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_bind_decimation_options | ( | reme_context_t | c, |
reme_surface_t | s, | ||
reme_options_t | o | ||
) |
Access the surface decimation options.
c | A valid context object |
s | A valid surface object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_bind_remesh_options | ( | reme_context_t | c, |
reme_surface_t | s, | ||
reme_options_t | o | ||
) |
Access the surface remeshing options.
c | A valid context object |
s | A valid surface object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_bind_cleanup_options | ( | reme_context_t | c, |
reme_surface_t | s, | ||
reme_options_t | o | ||
) |
Access the surface cleanup options.
c | A valid context object |
s | A valid surface object |
o | A valid options binding object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_generate | ( | reme_context_t | c, |
reme_surface_t | s, | ||
reme_volume_t | v | ||
) |
Extract the iso-surface from the given volume.
The surface is generated with respect to the world coordinate system.
In case you are using an unlicensed version of ReconstructMe SDK, this function blocks for at least 15 seconds. Without this limitation the mesh is usually generated in under a second.
c | A valid context object |
s | A valid surface object |
v | A valid volume object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_poisson | ( | reme_context_t | c, |
reme_surface_t | s | ||
) |
Perform poisson reconstruction on the extracted surface.
Use reme_surface_bind_poisson_options to control the decimation process.
c | A valid context object |
s | A valid surface object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_decimate | ( | reme_context_t | c, |
reme_surface_t | s | ||
) |
Decimate the extracted surface.
Use reme_surface_bind_decimation_options to control the decimation process. If the input mesh has vertex colors those will be respected in the remesh process.
Note that after the decimation vertex colors will be incorrect. You should generate them again using reme_surface_colorize_vertices and reme_surface_inpaint_vertices.
In contrast to reme_surface_remesh this function only reduces the number of faces and does not generate an isotropic surface.
c | A valid context object |
s | A valid surface object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_remesh | ( | reme_context_t | c, |
reme_surface_t | s | ||
) |
Remesh the extracted surface.
Attempts to create an isotropic surface. Isotropic remeshing of surfaces tries to resample the surface to obtain a triangle tesselation, where the shape of each triangle is not biased in a particular direction (isotropy).
Use reme_surface_bind_remesh_options to control the remeshing process. If the input mesh has vertex colors those will be respected in the remesh process.
c | A valid context object |
s | A valid surface object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_cleanup | ( | reme_context_t | c, |
reme_surface_t | s | ||
) |
Cleanup the extracted surface.
Removes small unconnected components from the given surface. See reme_surface_bind_cleanup_options for usable parameters.
c | A valid context object |
s | A valid surface object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_transform | ( | reme_context_t | c, |
reme_surface_t | s, | ||
const float * | coordinates | ||
) |
Transform the surface.
This will transform the points and normals of the surface.
c | A valid context object |
s | A valid surface object |
coordinates | A pointer to constant Transform data. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_colorize_vertices | ( | reme_context_t | c, |
reme_surface_t | s, | ||
reme_volume_t | v | ||
) |
Colorize surface vertices using the color information stored in the reconstruction volume.
Colorizes all vertices of the given surface. Before calling this method you need to at least generate a surface using reme_surface_generate. It's possible to use a modified version of the surface. E.g you can even pass a poisson-reconstructed surface.
Vertices with missing color information receive a unique color which is currently green (in RGBA: 0/255/0/0). Use the reme_surface_inpaint_vertices to generate missing vertex colors.
c | A valid context object |
s | A valid surface object |
v | A valid volume object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_NO_COLOR_SUPPORT | Setup does not support colors. |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_inpaint_vertices | ( | reme_context_t | c, |
reme_surface_t | s | ||
) |
Paint missing vertex colors.
Vertices without a valid vertex color will be painted by an algorithm that tries to use surrounding color information. A vertex is said to have no color or an invalid color if the color is exactly green (in RGBA: 0/255/0/0).
c | A valid context object |
s | A valid surface object |
REME_ERROR_SUCCESS | On success |
REME_ERROR_NO_COLOR_SUPPORT | Setup does not support colors. |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_get_points | ( | reme_context_t | c, |
reme_surface_t | s, | ||
const float ** | coordinates, | ||
int * | length | ||
) |
Get points of a surface.
The surface 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.
Note the i-th point starts at index i * 4
of coordinate array returned.
The returned coordinates pointer remains valid until the mesh changes.
c | A valid context object |
s | A valid surface object |
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_surface_get_normals | ( | reme_context_t | c, |
reme_surface_t | s, | ||
const float ** | coordinates, | ||
int * | length | ||
) |
Get point normals of a surface.
The surface 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.
Note the i-th point normal starts at index i * 4
of coordinate array returned.
The returned coordinates pointer remains valid until the mesh changes.
c | A valid context object |
s | A valid surface object |
coordinates | A mutable pointer to constant point normal data. |
length | The number of coordinates returned. To get the number of point normals divide this value by 4. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_get_vertex_colors | ( | reme_context_t | c, |
reme_surface_t | s, | ||
const float ** | coordinates, | ||
int * | length | ||
) |
Get colors of surface vertices.
The surface vertex colors are represented as an array of floats where each color consists of 4 coordinates R G B A R G B A ...
. The A component is always zero. The range of each channel is between zero and one.
Note the i-th color starts at index i * 4
of coordinate array returned. The returned array might be empty if no colors are have been generated through reme_surface_colorize_vertices or colors are not supported by the current setup. Vertices that don't have a valid color will carry an invalid color represented as 0 1 0 0
.
The returned coordinates pointer remains valid until the mesh changes.
c | A valid context object |
s | A valid surface object |
coordinates | A mutable pointer to constant color data. |
length | The number of coordinates returned. To get the number of colors divide this value by 4. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_get_triangles | ( | reme_context_t | c, |
reme_surface_t | s, | ||
const size_t ** | indices, | ||
int * | length | ||
) |
Get triangle faces of a surface.
The triangle faces are represented as an array of unsigned integers (point indices) where each triangle consists of 3 indices that represent that points that make up each face P0 P1 P2 P0 P1 P2 ...
.
Note the i-th triangle starts at index i * 3
of index array returned.
The returned indices pointer remains valid until the mesh changes.
c | A valid context object |
s | A valid surface object |
indices | A mutable pointer to constant triangle index data. |
length | The number of indices returned. To get the number of triangles divide this value by 3. |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_save_to_file | ( | reme_context_t | c, |
reme_surface_t | s, | ||
const char * | filename | ||
) |
Export the surface to file.
The exporter is chosen based on the file extension. Currently supported are
When exporting a vertex-colored mesh in .OBJ file format, the method will currently automatically bake vertex colors to a texture and save the textured mesh. This feature is considered beta and there is currently no way of configuring individual steps in this pipeline or retrieve texture related results in memory.
c | A valid context object |
s | A valid surface object |
filename | Filename to save mesh as |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |
reme_error_t reme_surface_load_from_file | ( | reme_context_t | c, |
reme_surface_t | s, | ||
const char * | filename | ||
) |
Import surface from file.
The importer is chosen based on the file extension. Currently supported are
c | A valid context object |
s | A valid surface object |
filename | Filename to load mesh from |
REME_ERROR_SUCCESS | On success |
REME_ERROR_UNSPECIFIED | On failure |