|
|
@@ -23,7 +23,7 @@ def lonlat_to_enu(lon, lat, center_lon, center_lat):
|
|
|
y = EARTH_RADIUS * delta_lat
|
|
|
return np.array([x, y, 0])
|
|
|
|
|
|
-def compute_hfov_by_zoom(hfov_max, zoom, camera_type="dahua"):
|
|
|
+def compute_hfov_by_zoom(hfov_max, zoom, camera_type="dahua", hfov_min=None):
|
|
|
"""
|
|
|
将缩放等级(zoom)映射为水平视场角(hfov)。
|
|
|
规则:
|
|
|
@@ -44,8 +44,15 @@ def compute_hfov_by_zoom(hfov_max, zoom, camera_type="dahua"):
|
|
|
z = min_zoom
|
|
|
elif z > max_zoom:
|
|
|
z = max_zoom
|
|
|
-
|
|
|
+ if hfov_min is None:
|
|
|
+ hfov_min = 1.5
|
|
|
# assume hfov scales inversely with zoom
|
|
|
+ if hfov_min is not None:
|
|
|
+ span = max_zoom - min_zoom
|
|
|
+ if span <= 1e-9:
|
|
|
+ return float(hfov_min)
|
|
|
+ t = (z - min_zoom) / span
|
|
|
+ return float(hfov_max) + (float(hfov_min) - float(hfov_max)) * t
|
|
|
return hfov_max * (min_zoom / z)
|
|
|
|
|
|
def project_lonlat_to_pixel(target_lon, target_lat, resolution_w, resolution_h,
|
|
|
@@ -170,7 +177,8 @@ def process_geojson_for_frontend(geojson_data, camera_params, calibrated_params)
|
|
|
hfov = compute_hfov_by_zoom(
|
|
|
hfov_max=hfov_max,
|
|
|
zoom=zoom_value,
|
|
|
- camera_type=camera_params.get('camera_type', 'dahua')
|
|
|
+ camera_type=camera_params.get('camera_type', 'dahua'),
|
|
|
+ hfov_min=camera_params.get('hfov_min')
|
|
|
)
|
|
|
# 1. Batch convert all geographic points to pixel points
|
|
|
for lon, lat in geo_coords:
|