Nodes/comfyui_cv/CV Point Cloud Nearest Distance
ComfyUI Node

CV Point Cloud Nearest Distance

For every point, the distance to the nearest point of a reference cloud (cv2.flann k-d tree). Two uses: as a cross-view AGREEMENT test - after registering a second stereo cloud, points the first view confirms have a tiny nearest distance while stereo blunders sit alone - and as the honest QUALITY METRIC of a registration (median distance drops as the alignment improves; an ICP residual does not measure this). Outputs data only: combine 'near_mask' with 'CV Filter Points 3D By Mask' to keep confirmed points, or invert it to keep only the new coverage. Both clouds must be in the same frame.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Point Cloud Nearest Distance
  • points
  • reference
  • distance
  • near_mask
  • median_distance
  • matched_fraction
threshold0.25
checks32
trees4
Categoryimage/CV/points

Inputs (5)

NameTypeDefaultDescription
pointsNPARRAYNx3 cloud to measure (the query points).
referenceNPARRAYMx3 cloud to measure AGAINST. Empty reference -> infinite distances and an all-zero mask, not an error.
thresholdFLOAT0.25Distance (same unit as the cloud, metres for a calibrated stereo reconstruction) below which a point counts as confirmed by the reference cloud.
checksoptINT321–4096FLANN search effort: leaves visited per query. Higher is more exact and slower.
treesoptINT41–16Randomized k-d trees in the index. More = more accurate approximate search, slower build.

Outputs (4)

NameTypeDescription
distanceNPARRAYNx1 float32 distance to the nearest reference point.
near_maskNPARRAYNx1 uint8 mask, 255 where distance <= threshold.
median_distanceFLOATMedian nearest distance - the registration quality number to watch (lower = better aligned).
matched_fractionFLOATFraction of points within the threshold (0..1).