* The core integrity check pycolmap implicitly performs: for every points3D * track element (image_id, point2D_idx), the referenced image must exist and * have at least `point2D_idx + 1` entries in its points2D array.
(images: Map<number, Image>, points3D: Map<bigint, Point3D>)
| 70 | * have at least `point2D_idx + 1` entries in its points2D array. |
| 71 | */ |
| 72 | function assertIntegrity(images: Map<number, Image>, points3D: Map<bigint, Point3D>): void { |
| 73 | for (const [pointId, point] of points3D) { |
| 74 | for (const elem of point.track) { |
| 75 | const img = images.get(elem.imageId); |
| 76 | if (!img) { |
| 77 | throw new Error(`point3D ${pointId}: track references missing image_id=${elem.imageId}`); |
| 78 | } |
| 79 | if (elem.point2DIdx >= img.points2D.length) { |
| 80 | throw new Error( |
| 81 | `point3D ${pointId}: track element image_id=${elem.imageId} point2D_idx=${elem.point2DIdx} ` + |
| 82 | `out of range (image has ${img.points2D.length} points2D)`, |
| 83 | ); |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | const missingFixture = !hasSparseBinaryFixture(BIN) || !existsSync(WASM_JS) || !existsSync(WASM_BIN); |
| 90 |