""" 摄像头配置 """ import platform import os LOG_CONFIG = { 'level': 'INFO', 'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s', 'file': None, 'max_bytes': 10 * 1024 * 1024, 'backup_count': 5, } # ============================================================ # 单组摄像头配置(保持向后兼容) # ============================================================ PANORAMA_CAMERA = { 'ip': '192.168.20.196', 'port': 37777, 'rtsp_port': 554, 'username': 'admin', 'password': 'Aa1234567', 'channel': 1, 'rtsp_url': 'rtsp://admin:Aa1234567@192.168.20.196:554/cam/realmonitor?channel=1&subtype=1', } PTZ_CAMERA = { 'ip': '192.168.20.197', 'port': 37777, 'rtsp_port': 554, 'username': 'admin', 'password': 'Aa1234567', 'channel': 0, # PTZ 控制通道号 (SDK 从 0 开始) 'rtsp_url': 'rtsp://admin:Aa1234567@192.168.20.197:554/cam/realmonitor?channel=1&subtype=1', } # ============================================================ # 多组摄像头配置(新架构) # 使用方法:启用需要的组(enabled=True),配置对应的IP地址 # ============================================================ CAMERA_GROUPS = [ { 'group_id': 'group_1', 'name': '第一组', 'enabled': True, 'panorama': { 'ip': '192.168.20.196', 'port': 37777, 'rtsp_port': 554, 'username': 'admin', 'password': 'Aa1234567', 'channel': 1, }, 'ptz': { 'ip': '192.168.20.197', 'port': 37777, 'rtsp_port': 554, 'username': 'admin', 'password': 'Aa1234567', 'channel': 0, 'pan_flip': True, # pan方向翻转 'ceiling_mount': True, # 吸顶安装 }, 'calibration_file': '/home/admin/dsh/calibration_group1.json', 'paired_image_dir': '/home/admin/dsh/paired_images_group1', }, # 第二组配置(示例,按需启用) # { # 'group_id': 'group_2', # 'name': '第二组', # 'enabled': False, # 设为 True 启用 # 'panorama': { # 'ip': '192.168.20.198', # 'port': 37777, # 'rtsp_port': 554, # 'username': 'admin', # 'password': 'Aa1234567', # 'channel': 1, # }, # 'ptz': { # 'ip': '192.168.20.199', # 'port': 37777, # 'rtsp_port': 554, # 'username': 'admin', # 'password': 'Aa1234567', # 'channel': 0, # 'pan_flip': True, # 'ceiling_mount': True, # }, # 'calibration_file': '/home/admin/dsh/calibration_group2.json', # 'paired_image_dir': '/home/admin/dsh/paired_images_group2', # }, ] # SDK 路径配置 _ARCH = platform.machine() if _ARCH == 'aarch64': _SDK_DIR = '/home/admin/dsh/dh/arm/Bin' elif _ARCH == 'x86_64': _SDK_DIR = '/home/wen/dsh/dh/Bin' else: _SDK_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'dh', 'Bin') SDK_PATH = { 'lib_path': _SDK_DIR, 'netsdk': 'libdhnetsdk.so', } def get_enabled_groups() -> list: """获取所有启用的摄像头组配置""" return [g for g in CAMERA_GROUPS if g.get('enabled', False)]