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.
CV Point Cloud Nearest Distance
- points
- reference
- distance
- near_mask
- median_distance
- matched_fraction
◄threshold0.25►
◄checks32►
◄trees4►
Categoryimage/CV/points
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| points | NPARRAY | Nx3 cloud to measure (the query points). | |
| reference | NPARRAY | Mx3 cloud to measure AGAINST. Empty reference -> infinite distances and an all-zero mask, not an error. | |
| threshold | FLOAT | 0.25 | Distance (same unit as the cloud, metres for a calibrated stereo reconstruction) below which a point counts as confirmed by the reference cloud. |
| checksopt | INT | 321–4096 | FLANN search effort: leaves visited per query. Higher is more exact and slower. |
| treesopt | INT | 41–16 | Randomized k-d trees in the index. More = more accurate approximate search, slower build. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| distance | NPARRAY | Nx1 float32 distance to the nearest reference point. |
| near_mask | NPARRAY | Nx1 uint8 mask, 255 where distance <= threshold. |
| median_distance | FLOAT | Median nearest distance - the registration quality number to watch (lower = better aligned). |
| matched_fraction | FLOAT | Fraction of points within the threshold (0..1). |