1+ # Advanced Camera Processing Routes
2+ # Demonstrates multi-stage processing with different languages
3+
4+ routes :
5+ - name : "advanced_camera_detection"
6+ from : "rtsp://{{CAMERA_USER}}:{{CAMERA_PASS}}@{{CAMERA_IP}}/stream1"
7+
8+ processors :
9+ # Stage 1: Python YOLO object detection
10+ - type : "external"
11+ command : "python scripts/detect_objects.py"
12+ input_format : "json"
13+ output_format : "json"
14+ config :
15+ confidence_threshold : 0.6
16+ model : "yolov8n.pt"
17+ target_objects : ["person" , "car" , "motorcycle" , "bicycle" ]
18+ batch_processing : false
19+
20+ # Stage 2: Go-based risk assessment and zone analysis
21+ - type : "external"
22+ command : "go run scripts/image_processor.go"
23+ input_format : "json"
24+ output_format : "json"
25+ config :
26+ zone_mapping : "entrance:critical,parking:medium,garden:low"
27+ threat_threshold : 0.7
28+ risk_factors : "time_of_day,object_type,zone,confidence"
29+
30+ # Stage 3: C++ performance optimization and NMS
31+ - type : "external"
32+ command : "./bin/cpp_postprocessor"
33+ input_format : "json"
34+ output_format : "json"
35+ config :
36+ algorithm : "fast_nms"
37+ nms_threshold : 0.5
38+ confidence_threshold : 0.7
39+
40+ # Stage 4: Filter only high-risk detections
41+ - type : "filter"
42+ condition : "{{threat_level}} in ['high', 'critical']"
43+
44+ # Stage 5: Node.js business rules engine
45+ - type : "external"
46+ command : "node scripts/business_rules.js"
47+ input_format : "json"
48+ output_format : "json"
49+ config :
50+ rules_file : "security_rules.json"
51+ business_hours : "09:00-17:00"
52+ escalation_time : 300
53+
54+ # Stage 6: Transform to alert format
55+ - type : "transform"
56+ template : |
57+ 🚨 SECURITY ALERT - {{camera_name }}
58+
59+ Threat Level : {{threat_level }} ({{business_priority }})
60+ Time : {{timestamp }}
61+ Location : {{zone }} ({{position }})
62+
63+ Detections :
64+ {{#enhanced_detections}}
65+ • {{object_type }} - Confidence : {{confidence }}% - Risk : {{risk_score }}
66+ Recommended Action : {{recommended_action }}
67+ {{/ enhanced_detections }}
68+
69+ Business Context :
70+ • Business Hours : {{#business_context.is_business_hours}}Yes{{/business_context.is_business_hours}}{{^business_context.is_business_hours}}No{{/business_context.is_business_hours}}
71+ • Zone Risk : {{business_context .zone_risk_level }}
72+ • Immediate Response Required : {{business_context .requires_immediate_response }}
73+
74+ to :
75+ - "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{SECURITY_EMAIL}}"
76+ - "http://{{SECURITY_WEBHOOK}}/critical-alert"
77+ - "mqtt://{{MQTT_BROKER}}:1883/security/alerts/{{CAMERA_NAME}}"
78+ - "log://logs/security_{{CAMERA_NAME}}.log"
79+
80+ - name : "camera_health_monitoring"
81+ from : "timer://2m"
82+
83+ processors :
84+ - type : "external"
85+ command : "python scripts/camera_health_check.py"
86+ config :
87+ camera_endpoints : "{{CAMERA_HEALTH_ENDPOINTS}}"
88+ timeout : 10
89+ expected_fps : 25
90+
91+ - type : "filter"
92+ condition : "{{status}} != 'healthy'"
93+
94+ to : "email://{{SMTP_SERVER}}:{{SMTP_PORT}}?user={{SMTP_USER}}&password={{SMTP_PASS}}&to={{ADMIN_EMAIL}}"
95+
96+ - name : "motion_detection_backup"
97+ from : "rtsp://{{BACKUP_CAMERA_USER}}:{{BACKUP_CAMERA_PASS}}@{{BACKUP_CAMERA_IP}}/stream1"
98+
99+ processors :
100+ - type : "external"
101+ command : "python scripts/motion_detector.py"
102+ config :
103+ sensitivity : 0.3
104+ min_area : 5000
105+ background_subtraction : true
106+
107+ - type : "aggregate"
108+ strategy : "collect"
109+ timeout : "30s"
110+ max_size : 5
111+
112+ - type : "transform"
113+ template : "Motion detected on backup camera: {{count}} events in last 30s"
114+
115+ to : "log://logs/motion_backup.log"
116+
117+ env_vars :
118+ - CAMERA_USER
119+ - CAMERA_PASS
120+ - CAMERA_IP
121+ - CAMERA_NAME
122+ - BACKUP_CAMERA_USER
123+ - BACKUP_CAMERA_PASS
124+ - BACKUP_CAMERA_IP
125+ - SMTP_SERVER
126+ - SMTP_PORT
127+ - SMTP_USER
128+ - SMTP_PASS
129+ - SECURITY_EMAIL
130+ - ADMIN_EMAIL
131+ - SECURITY_WEBHOOK
132+ - MQTT_BROKER
133+ - CAMERA_HEALTH_ENDPOINTS
134+
135+ settings :
136+ max_concurrent_routes : 5
137+ default_timeout : 60
138+ log_level : "info"
139+ metrics_enabled : true
140+ health_check_port : 8080
141+ frame_skip_ratio : 3
142+ max_memory_usage : "2GB"
0 commit comments