Add capture readiness quality gate
Browse files- tests/test_assess_capture.py +30 -0
tests/test_assess_capture.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
from PIL import Image
|
| 5 |
+
|
| 6 |
+
from assess_capture import assess_capture
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def test_assess_capture_reports_source_media_diagnostics(tmp_path):
|
| 10 |
+
root = Path(tmp_path) / "capture_quality_fixture"
|
| 11 |
+
root.mkdir(exist_ok=True)
|
| 12 |
+
image_dir = root / "images"
|
| 13 |
+
image_dir.mkdir(exist_ok=True)
|
| 14 |
+
for name, color in (("a.png", (40, 80, 120)), ("b.png", (80, 120, 160))):
|
| 15 |
+
Image.new("RGB", (32, 32), color).save(image_dir / name)
|
| 16 |
+
manifest = {
|
| 17 |
+
"project": "Simam3D",
|
| 18 |
+
"views": [
|
| 19 |
+
{"id": "a", "image": "images/a.png", "split": "train", "intrinsics": [[20, 0, 16], [0, 20, 16], [0, 0, 1]], "extrinsics": [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]},
|
| 20 |
+
{"id": "b", "image": "images/b.png", "split": "held_out", "intrinsics": [[20, 0, 16], [0, 20, 16], [0, 0, 1]], "extrinsics": [[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]},
|
| 21 |
+
],
|
| 22 |
+
}
|
| 23 |
+
path = root / "capture.json"
|
| 24 |
+
path.write_text(json.dumps(manifest), encoding="utf-8")
|
| 25 |
+
report = assess_capture(path)
|
| 26 |
+
assert report["mode"] == "capture_readiness_diagnostic"
|
| 27 |
+
assert report["view_count"] == 2
|
| 28 |
+
assert report["held_out_view_count"] == 1
|
| 29 |
+
assert len(report["views"]) == 2
|
| 30 |
+
assert "interpretation" in report
|