I am using the ZED 2i camera, then use zed.retrieveMeasure to obtain the point cloud and store it in a PCD file. Compared to the point cloud obtained by ZED Depth Viewer, the point cloud obtained by zed.retrieveMeasure contains many invalid points. The RuntimeParameters of both methods are consistent. Why does this happen? Also, the invalid points contain “nan” and “0”. What is the difference between these two and two ineffective points?
Hi @gsbnn,
A few points explain what you’re seeing:
-
retrieveMeasure returns an organized point cloud — one entry per pixel, in image order. Pixels where depth can’t be computed (occlusion, low texture/confidence) are kept as placeholders, not removed. So a raw dump always contains invalid entries.
Convention: NaN = unknown/occluded, +Inf = too far, -Inf = too close. -
NaN vs 0: the SDK only ever uses NaN/±Inf for invalid points — never 0. We verified this on our side across several depth modes: zero exact-0 and zero (0,0,0) points in both the point cloud and depth map. So the 0s in your file are introduced by
your PCD writing/conversion step (zero-initialized buffer or a NaN→0 substitution), not by retrieveMeasure. Worth checking your write loop. -
More invalid points than Depth Viewer: matching RuntimeParameters isn’t enough — the big drivers are elsewhere:
- depth_mode (in InitParameters, not Runtime). Depth Viewer typically uses NEURAL/NEURAL+; if your app uses PERFORMANCE you’ll get far more holes. Most likely cause.
- enable_fill_mode (RuntimeParameters). It returns a dense, hole-free map by interpolating missing pixels; if Depth Viewer had it on and your app didn’t, that alone explains the gap. (Note: filled points are estimates, less accurate — fine for
visualization, not for measurement.) - Export format: Depth Viewer can save a dense cloud with invalid points already stripped, while your dump keeps the full grid.
To confirm on your side, could you share:
- Your InitParameters + RuntimeParameters (especially depth_mode and enable_fill_mode) and the grab → retrieveMeasure → PCD write snippet.
- The Depth Viewer settings and which save option you used for the reference cloud.
- SDK version + OS.