|
@@ -28,7 +28,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
from config import (
|
|
from config import (
|
|
|
PANORAMA_CAMERA, PTZ_CAMERA, SDK_PATH,
|
|
PANORAMA_CAMERA, PTZ_CAMERA, SDK_PATH,
|
|
|
DETECTION_CONFIG, PTZ_CONFIG, OCR_CONFIG, COORDINATOR_CONFIG,
|
|
DETECTION_CONFIG, PTZ_CONFIG, OCR_CONFIG, COORDINATOR_CONFIG,
|
|
|
- CALIBRATION_CONFIG, LOG_CONFIG
|
|
|
|
|
|
|
+ CALIBRATION_CONFIG, LOG_CONFIG, SYSTEM_CONFIG
|
|
|
)
|
|
)
|
|
|
from dahua_sdk import DahuaSDK
|
|
from dahua_sdk import DahuaSDK
|
|
|
from panorama_camera import PanoramaCamera, ObjectDetector, PersonTracker, DetectedObject
|
|
from panorama_camera import PanoramaCamera, ObjectDetector, PersonTracker, DetectedObject
|
|
@@ -181,8 +181,13 @@ class DualCameraSystem:
|
|
|
|
|
|
|
|
logger.info("系统初始化完成")
|
|
logger.info("系统初始化完成")
|
|
|
|
|
|
|
|
- # 执行自动校准
|
|
|
|
|
- if not skip_calibration:
|
|
|
|
|
|
|
+ # 执行自动校准(受配置开关和参数双重控制)
|
|
|
|
|
+ should_calibrate = SYSTEM_CONFIG.get('enable_calibration', True)
|
|
|
|
|
+ if not should_calibrate:
|
|
|
|
|
+ logger.info("自动校准已禁用 (enable_calibration=False)")
|
|
|
|
|
+ elif skip_calibration:
|
|
|
|
|
+ logger.info("自动校准已跳过 (--skip-calibration)")
|
|
|
|
|
+ else:
|
|
|
if not self._auto_calibrate():
|
|
if not self._auto_calibrate():
|
|
|
logger.error("自动校准失败!")
|
|
logger.error("自动校准失败!")
|
|
|
return False
|
|
return False
|
|
@@ -403,6 +408,10 @@ class DualCameraSystem:
|
|
|
|
|
|
|
|
def _start_periodic_calibration(self):
|
|
def _start_periodic_calibration(self):
|
|
|
"""启动定时校准"""
|
|
"""启动定时校准"""
|
|
|
|
|
+ if not SYSTEM_CONFIG.get('enable_calibration', True):
|
|
|
|
|
+ logger.info("定时校准已禁用 (enable_calibration=False)")
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
if self.calibration_running:
|
|
if self.calibration_running:
|
|
|
return
|
|
return
|
|
|
|
|
|