forked from andrew/feedmill-recounter
feat(zones): ship FCP's calibration in the 1280x720 analysis space
This commit is contained in:
1 parent
9cb32e9ec6
commit
957ab0297d
2 files changed
+52
-6
No files matched your search
@@ -298,3 +298,49 @@ def test_build_static_roi_without_count_line_has_no_x_window():
|
||||
)
|
||||
assert roi.line_x_start is None
|
||||
assert roi.line_x_end is None
|
||||
|
||||
|
||||
# ── Shipped preset (FCP's calibration in the 1280x720 analysis space) ──────
|
||||
|
||||
|
||||
def test_shipped_default_preset_matches_fcp_7beb820():
|
||||
"""The shipped zones.json carries FCP's calibration in 1280x720."""
|
||||
zone = {
|
||||
"truck_area": [[400, 257], [406, 717], [936, 719], [921, 229]],
|
||||
"counting_area": [[383, 33], [391, 718], [945, 717], [931, 33]],
|
||||
"palet": [[408, 419], [969, 420], [972, 716], [405, 714]],
|
||||
"count_line": {"x_start": 385, "x_end": 934, "y": 220},
|
||||
"reference_resolution": [1280, 720],
|
||||
}
|
||||
roi = build_static_roi(zone, video_w=1280, video_h=720)
|
||||
assert (roi.x1, roi.y1, roi.x2, roi.y2) == (400, 229, 936, 719)
|
||||
assert roi.line_y == 220
|
||||
assert roi.line_x_start == 385
|
||||
assert roi.line_x_end == 934
|
||||
assert roi.confidence == 1.0
|
||||
assert roi.fixed is True
|
||||
|
||||
|
||||
def test_shipped_default_preset_polygons_are_usable():
|
||||
"""Both shipped polygons are valid and the counting one covers the scene."""
|
||||
zone = {
|
||||
"truck_area": [[400, 257], [406, 717], [936, 719], [921, 229]],
|
||||
"counting_area": [[383, 33], [391, 718], [945, 717], [931, 33]],
|
||||
"reference_resolution": [1280, 720],
|
||||
}
|
||||
counting = build_counting_polygon(zone, 1280, 720)
|
||||
truck = build_truck_polygon(zone, 1280, 720)
|
||||
assert counting is not None and counting.area > 0
|
||||
assert truck is not None and truck.area > 0
|
||||
assert counting.contains(Point(600, 300))
|
||||
|
||||
|
||||
def test_repo_zones_json_ships_the_fcp_calibration():
|
||||
"""Guards the shipped file, not an inline fixture."""
|
||||
repo_zones = os.path.join(os.path.dirname(os.path.dirname(__file__)), "zones.json")
|
||||
cfg = load_zone_config(repo_zones)
|
||||
zone = cfg["presets"]["default"]
|
||||
assert zone["reference_resolution"] == [1280, 720]
|
||||
assert zone["count_line"] == {"x_start": 385, "x_end": 934, "y": 220}
|
||||
assert zone["truck_area"] == [[400, 257], [406, 717], [936, 719], [921, 229]]
|
||||
assert zone["counting_area"] == [[383, 33], [391, 718], [945, 717], [931, 33]]
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"presets": {
|
||||
"default": {
|
||||
"truck_area": [[600, 385], [609, 1076], [1404, 1078], [1381, 343]],
|
||||
"counting_area": [[574, 50], [586, 1077], [1418, 1076], [1397, 50]],
|
||||
"palet": [[612, 628], [1454, 630], [1458, 1074], [608, 1071]],
|
||||
"count_line": {"x_start": 577, "x_end": 1401, "y": 330},
|
||||
"reference_resolution": [1920, 1080],
|
||||
"truck_area": [[400, 257], [406, 717], [936, 719], [921, 229]],
|
||||
"counting_area": [[383, 33], [391, 718], [945, 717], [931, 33]],
|
||||
"palet": [[408, 419], [969, 420], [972, 716], [405, 714]],
|
||||
"count_line": {"x_start": 385, "x_end": 934, "y": 220},
|
||||
"reference_resolution": [1280, 720],
|
||||
"left_limit": 0.27578,
|
||||
"right_limit": 0.72578,
|
||||
"duplicate_circle_radius": 30,
|
||||
@@ -16,7 +16,7 @@
|
||||
"inference_stride": 2,
|
||||
"confirm_delay_sec": 0.5,
|
||||
"exit_confirm_delay_sec": 6.0,
|
||||
"description": "Default zone from karung-counting-feedmill-semarang (1920x1080 native)"
|
||||
"description": "FCP 7beb820 calibration, 1280x720 analysis space"
|
||||
}
|
||||
},
|
||||
"active_preset": "default"
|
||||
|
||||
Reference in new issue
Block a user