MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / _count_dangling

Function _count_dangling

tests/pycolmap/test_roundtrip.py:65–77  ·  view source on GitHub ↗

Count track elements that reference (image_id, point2D_idx) out of range.

(rec: "pycolmap.Reconstruction")

Source from the content-addressed store, hash-verified

63
64
65def _count_dangling(rec: "pycolmap.Reconstruction") -> int:
66 """Count track elements that reference (image_id, point2D_idx) out of range."""
67 dangling = 0
68 image_ids = set(rec.images)
69 for pid, point in rec.points3D.items():
70 for el in point.track.elements:
71 if el.image_id not in image_ids:
72 dangling += 1
73 continue
74 img = rec.images[el.image_id]
75 if el.point2D_idx >= len(img.points2D):
76 dangling += 1
77 return dangling
78
79
80class TestUntransformedRoundtrip:

Calls 1

setFunction · 0.85

Tested by

no test coverage detected