3D visionHow-to

Capturing a single 3D frame as a PLY or OBJ mesh snapshot

How to grab one depth and color acquisition from a streaming 3D camera, build a point cloud and export it as PLY or OBJ, with verification checks and pitfalls.

LumaSpec Vision7 min read Share on LinkedIn

On this page 10 sections
  1. 01How a single-frame snapshot actually works
  2. 02What you need
  3. 03Step-by-step: capture one frame and export it
  4. 04Converting the depth map to a point cloud
  5. 05Writing PLY versus OBJ
  6. 06Verify the snapshot before you use it
  7. 07Common mistakes
  8. 08Choosing hardware for repeatable snapshots
  9. 09Next step
  10. 10Questions

Depth and structured-light cameras stream; they do not take stills. If you need one 3D snapshot of a part, a face or a fixture as a PLY or OBJ file, you still configure the camera for streaming, capture a single aligned frame set, and convert it yourself. This guide shows the full workflow: stream set-up, one-shot capture, depth-to-point-cloud conversion, mesh export, and the checks that catch a bad snapshot before it reaches your CAD tool. It applies to ToF, projected structured-light and stereo cameras alike, including the models in 3D sensors.

How a single-frame snapshot actually works

Every 3D camera in this class delivers frames continuously once started. A "single frame" is therefore a grab: you start the depth stream (and the color stream if you want texture), wait for one complete frame from each, pair them, stop, and process. Two things must be true at capture time:

  • The depth and color frames are synchronized, or registered to each other. If your camera cannot align them in hardware, read depth and color synchronization before trusting the pairing.
  • The exposure and laser or projector settings are already correct, because there is no second frame to compensate with. Running auto-exposure for a few frames before the grab and then locking it is the reliable pattern.

What you need

  • A 3D camera with an SDK that exposes per-pixel depth and intrinsics. A time-of-flight unit such as the MV-DT01WMU or a projected structured-light camera such as the MV-DPS200P-02 both fit.
3D sensorsHikrobot MV-DPS200P-02 Projected structured-light 3D cameraMV-DPS200P-02
Type
Stereo / structured light
$8,829.00 · quotedView and quote
  • The camera's intrinsic parameters: focal lengths in pixels, principal point, and the depth scale (metres per raw unit). These usually come from the SDK's calibration query.
  • A mesh library or your own writer. PLY is simple enough to write in a few dozen lines; OBJ needs triangulation on top.
  • A viewer to verify the result before you use it.

Step-by-step: capture one frame and export it

  1. Open the camera and enable the depth stream at the resolution you want. Enable the color stream too if the mesh needs texture.
  2. Wait for auto-exposure to settle, then switch exposure, gain and laser power to manual so the grabbed frame cannot drift.
  3. Skip 10 to 30 frames after configuration. This flushes stale settings from the pipeline queue.
  4. Grab one depth frame and, if used, one color frame. Verify their timestamps match within the SDK's stated tolerance.
  5. Copy the pixel buffers out of the SDK's callback or polling structure immediately, so a later frame cannot overwrite them.
  6. Convert the depth map to a point cloud (next section), skipping pixels flagged invalid.
  7. Write the cloud to a binary PLY file, or triangulate and write an OBJ.
  8. Stop the streams and close the camera.
  9. Open the file in a viewer and re-measure a known dimension on the part.

Converting the depth map to a point cloud

Each depth pixel becomes one 3D point using the pinhole model and the camera's calibration. With z the depth in metres, u and v the pixel coordinates, fx and fy the focal lengths in pixels and cx, cy the principal point:

x = (u - cx) × z / fx y = (v - cy) × z / fy z = depth_value × depth_scale

If intrinsics for depth and color differ, convert them first — the details are in camera intrinsic parameter conversion for depth and texture images. For a worked example of mapping a single pixel to a 3D point, see center pixel depth measurement; the same math applied to every valid pixel is your point cloud.

Worked check: a 640 × 480 depth map with 85 percent valid pixels yields about 261,000 points. A binary PLY stores each point as 12 bytes for XYZ plus 3 bytes for RGB, roughly 4 MB — small enough that format choice matters less than getting the valid-pixel mask right.

Writing PLY versus OBJ

Aspect PLY OBJ
Stores Points, per-point color, optional faces Vertices, faces, UVs, materials
Triangulation needed No Yes
Best for Raw snapshot of one frame Mesh for CAD or 3D printing
Effort to write Low Moderate

Export PLY first, always. It is the honest record of what the camera saw, holes included. Triangulate into OBJ only when the downstream tool needs faces: connect each pixel to its right and lower neighbours when all points involved are valid, and skip triangles that span a hole larger than a few pixels, or you will build bridges across missing data. If your inspection stores clouds in a voxel grid instead, the workflow in storing point cloud data in a voxel grid starts exactly from this exported cloud.

3D sensorsHikrobot MV-DT01WMU ToF sensing cameraMV-DT01WMU
Type
Depth / ToF camera
Price on requestView and quote

Verify the snapshot before you use it

  • Re-measure a machined edge or a gauge block in the exported mesh. Expect the dimension to agree with reality within the camera's stated depth accuracy, not pixel-perfectly.
  • Check the hole pattern. Holes should follow dark, glossy or steeply angled regions — scattered random holes mean noise, and averaging 5 to 20 frames of a static part will clean them up.
  • Confirm the color aligns with geometry on a high-contrast edge; fringes of misregistered color point to a synchronization or extrinsics problem, not to the exporter.
  • View the cloud in a second tool. A mesh that looks fine in your own viewer but broken elsewhere usually has a coordinate-order or scale bug in the writer.

Common mistakes

  • Grabbing the first frame after start. Exposure and depth offset are not settled; skip frames.
  • Using color intrinsics on depth pixels. The two streams rarely share a principal point.
  • Ignoring invalid-pixel flags and writing zero-depth spikes.
  • Averaging frames of anything that moves, including a hand-held part.
  • Expecting watertight OBJ output from one viewpoint. A single frame sees one side of the object; occlusion holes are physics, not a bug. Multi-angle capture and registration, as in multi-image capture per trigger, is the fix when you need full coverage.

Choosing hardware for repeatable snapshots

For static parts on a fixture, a projected structured-light camera such as the MV-DPS200P-02 or a laser galvanometer stereo unit like the MV-DLS300P-04 gives the cleanest single-shot geometry. For larger scenes or moving subjects where you grab opportunistically, a ToF camera such as the MV-DT01WMU is easier to run continuously and capture from. The 3D sensor finder filters by type; the system configurator chains the camera with mounting and cabling in one pass.

Next step

Set up the stream, grab one verified frame, and export a binary PLY before attempting any OBJ triangulation. If you are unsure which sensor fits your part size and accuracy target, contact us with the dimensions and the tolerance you need to hold, and we will point you at the right camera.

Questions

Can a 3D camera save a still mesh file directly?

Most depth and structured-light cameras expose data only as streams, not as files. Your software must open the depth (and optionally color) stream, wait for one complete aligned frame pair, then convert and write the mesh itself. Treat the camera as a stream source and do the PLY or OBJ export in your own code or SDK sample.

Which format should I export, PLY or OBJ?

PLY stores per-point color and is the standard for raw point clouds and per-vertex scanned data, so it is the better first export from a depth map. OBJ is a mesh format: it expects faces, so you must triangulate the cloud, typically by connecting neighbouring valid pixels. If you only need to inspect or measure the capture, export PLY first and triangulate later.

Why are there holes in my exported mesh?

Depth dropouts come from surfaces that absorb or scatter the projected pattern, low reflectivity, steep viewing angles and range limits. Any pixel with an invalid depth flag or a zero value must be skipped, leaving holes. Filtering by confidence, averaging a few frames, or adding light on dark surfaces reduces but rarely removes them.

How do I get color onto the points?

Register the color frame to the depth frame using the camera's extrinsics, or capture an already-aligned stream if the camera offers one. Each depth pixel then has a matching RGB value that travels into the PLY file. Check timestamps and alignment before exporting, as covered in depth and color synchronization.

How many frames should I average for a static part?

For a stationary part, averaging 5 to 20 frames suppresses speckle noise noticeably at little cost in time. For a moving part or hand-held scan, average nothing: motion between frames smears edges worse than the noise you remove. Validate the result by re-measuring a known dimension on the exported mesh.