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 InstantMeshing with 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_batch to 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 data

  • CAM-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:

cd examples/Union
python main.py