Examples
All examples are located in the Python_API/examples/ directory of the 3D Instant Meshing installation.
Each example uses file-based datasets — no physical hardware is required.
Basic
Location: examples/Basic/main.py
Demonstrates mesh generation from a single PhoXi device using basic configuration and frame processing.
Key features:
Loads the 3D Instant Meshing library from the path set in environment variables.
Connects to a PhoXi file camera and automatically disconnects on cleanup.
Initializes
InstantMeshingwith Vulkan rasterization engine and device parameters.Registers a message callback to receive log output from the library.
Triggers and captures frames in a loop using
add_scan, monitoring tracking status.Exports the final mesh as
output/mesh.ply.
Dataset: Helmet.pmraw located in API/examples/datasets/helmet/.
cd examples/Basic
python main.py
CoupledMultiDevice
Location: examples/CoupledMultiDevice/main.py
Demonstrates mesh generation from multiple rigidly coupled PhoXi devices with file-based calibration and optional robot pose integration.
Key features:
Connects to multiple PhoXi file cameras simultaneously.
Reads per-device camera-to-robot transformation matrices from calibration text files.
Optionally reads timestamped robot poses and interpolates transformations per scan.
Uses
add_scan_batchto add synchronized scans from all devices as a single unit.Exports a combined mesh as
output/coupled_multi_mesh.ply.
Dataset: Located in API/examples/datasets/coupled_multi/:
CAM-1.pmraw,CAM-2.pmraw– scan dataCAM-1-calibration.txt,CAM-2-calibration.txt– 3×4 camera-to-robot matrices (row-major, 12 space-separated values)robot-poses.txt(optional) – timestamped 3×4 robot-to-mesh matrices (timestamp_ms+ 12 values per line)
cd examples/CoupledMultiDevice
python main.py
Union
Location: examples/Union/main.py
Demonstrates generating a union point cloud by combining virtual scans from multiple viewpoints.
Key features:
Acquires scans and integrates them into the
InstantMeshinginstance.Defines multiple virtual camera views using
CameraParamsPerspectiveorCameraParamsOrthogonal.Calls
get_union_perspective/get_union_orthogonalto produce a unifiedPointCloudfrom all views.Exports the result as a PLY file.
cd examples/Union
python main.py