Explorar el Código

chore: remove temporary unit tests

wenhongquan hace 1 semana
padre
commit
10489f6551

+ 0 - 33
calibration_scan_180_360/test_mapping_model.py

@@ -1,33 +0,0 @@
-import numpy as np
-from mapping_model import MappingModel
-
-
-def test_mapping_model_fits_linear_pan_tilt():
-    # 构造 15 个校准点:x_ratio 与 pan 线性递减,y_ratio 与 tilt 线性递减
-    records = []
-    for i, pan in enumerate([340, 300, 260, 220, 180]):
-        for j, tilt in enumerate([45, 5, -35]):
-            x_ratio = (360 - pan) / 180.0  # 0.111 ~ 1.0
-            y_ratio = (tilt + 35) / 80.0   # 0.0 ~ 1.0
-            records.append({
-                'pan': float(pan),
-                'tilt': float(tilt),
-                'x_ratio': x_ratio,
-                'y_ratio': y_ratio,
-                'confidence': 'high',
-            })
-
-    model = MappingModel()
-    model.fit(records)
-
-    pan, tilt = model.transform(1920, 540)  # 中心点
-    # 根据 x_ratio=(360-pan)/180 的线性关系,中心 x=0.5 对应 pan≈270
-    assert 265 <= pan <= 275
-    assert -10 <= tilt <= 15
-
-    # 验证保存/加载格式
-    data = model.to_dict()
-    assert 'pan_lookup' in data
-    assert 'tilt_lookup' in data
-    assert len(data['pan_lookup']) >= 3
-    assert len(data['tilt_lookup']) >= 3

+ 0 - 46
calibration_scan_180_360/test_matchers.py

@@ -1,46 +0,0 @@
-import numpy as np
-from matchers import TemplateMatcher, FeatureMatcher
-
-
-def test_template_matcher_finds_known_location():
-    # 构造全景图 400x200,中间放一块带纹理的红色方块
-    # 注意:纯色 ROI 会让 TM_CCOEFF_NORMED 产生退化(全图相关值相同),
-    # 因此给红色通道附加单调渐变纹理,使模板匹配有唯一峰值。
-    panorama = np.zeros((200, 400, 3), dtype=np.uint8)
-    y, x = np.mgrid[80:120, 180:220]
-    panorama[80:120, 180:220, 0] = ((x - 180) * 6).astype(np.uint8)
-    panorama[80:120, 180:220, 1] = ((y - 80) * 6).astype(np.uint8)
-    panorama[80:120, 180:220, 2] = 255
-
-    # 构造 PTZ 图:只看这块红色方块的中心 ROI
-    ptz = panorama[80:120, 180:220].copy()
-
-    matcher = TemplateMatcher(scales=(0.8, 1.0, 1.2), score_threshold=0.5)
-    result = matcher.match(ptz, panorama)
-
-    assert result is not None
-    x_ratio, y_ratio, score, scale = result
-    # 中心应在 (200, 100) 附近
-    assert 0.45 <= x_ratio <= 0.55
-    assert 0.45 <= y_ratio <= 0.55
-    assert score > 0.8
-
-
-def test_feature_matcher_finds_known_location():
-    # 用真实纹理更丰富的图案,避免弱纹理下 ORB 关键点不足
-    np.random.seed(1)
-    panorama = np.random.randint(0, 255, (200, 400, 3), dtype=np.uint8)
-    # 在中间嵌入一块带纹理的 PTZ 区域
-    patch = np.random.randint(0, 255, (40, 40, 3), dtype=np.uint8)
-    panorama[80:120, 180:220] = patch
-
-    ptz = panorama[80:120, 180:220].copy()
-
-    matcher = FeatureMatcher(lowe_ratio=0.8, min_matches=4, min_inliers=4)
-    result = matcher.match(ptz, panorama)
-
-    assert result is not None
-    x_ratio, y_ratio, inliers, matches = result
-    assert 0.45 <= x_ratio <= 0.55
-    assert 0.45 <= y_ratio <= 0.55
-    assert inliers >= 4