Skip to main content

Image Acquisition Engine

The Image Acquisition Engine (Alert.CA.ImageAcquisition) is the primary application in the solution. It is an Azure Functions v4 app using Durable Functions with the Netherite backend to continuously capture images from hundreds of cameras in parallel through long-running orchestration loops.

Architecture Overviewโ€‹

Tech Stackโ€‹

ComponentTechnology
Runtime.NET 10, Azure Functions v4 (Isolated Worker)
OrchestrationDurable Functions with Netherite backend
Netherite ConfigMax 2000 orchestrators, 4000 activities, 32 partitions
Hub Nameimgacqhub
Image ProcessingEmgu.CV (OpenCV), System.Drawing
Camera ProtocolVAPIX via IVAPIXClient
Real-timeSignalR Client (auto-reconnect with exponential backoff)
MonitoringApplication Insights (custom telemetry)
ConfigAzure App Configuration + Key Vault

Project Structureโ€‹

Alert.CA.ImageAcquisition/
โ”œโ”€โ”€ Program.cs # DI registration + middleware
โ”œโ”€โ”€ host.json # Netherite + function host config
โ”œโ”€โ”€ Functions/
โ”‚ โ”œโ”€โ”€ CameraOrchestratorFunction.cs # Main entry point (Cosmos trigger)
โ”‚ โ”œโ”€โ”€ RefreshPTZForFE.cs # Timer: sync PTZ to frontend entity
โ”‚ โ”œโ”€โ”€ VapixOrchestrations/
โ”‚ โ”‚ โ”œโ”€โ”€ VapixOrchestrator.cs # Orchestration lifecycle manager
โ”‚ โ”‚ โ”œโ”€โ”€ BaseOrchestrationFunction.cs # Eternal loop (~350 lines)
โ”‚ โ”‚ โ”œโ”€โ”€ StandardModeFunctions.cs # SINGLE + PANO capture
โ”‚ โ”‚ โ”œโ”€โ”€ TurboModeFunctions.cs # High-speed wrapper
โ”‚ โ”‚ โ”œโ”€โ”€ LeaseModeFunctions.cs # Manual control mode
โ”‚ โ”‚ โ”œโ”€โ”€ IntervalAcquisitionFunctions.cs # Time-interval base
โ”‚ โ”‚ โ””โ”€โ”€ IO/
โ”‚ โ”‚ โ”œโ”€โ”€ RequestImageFunctions.cs # Single image activity
โ”‚ โ”‚ โ”œโ”€โ”€ RequestPanoImagesFunctions.cs # Panoramic image activity
โ”‚ โ”‚ โ”œโ”€โ”€ CameraMovementFunctions.cs # 7 PTZ activity functions
โ”‚ โ”‚ โ”œโ”€โ”€ CameraControlQueueFunctions.cs # 6 HTTP endpoints for PTZ
โ”‚ โ”‚ โ””โ”€โ”€ SubmitCameraStatusFunctions.cs # ESRI status reporting
โ”‚ โ”œโ”€โ”€ MobotixOrchestrations/
โ”‚ โ”‚ โ””โ”€โ”€ MobotixOrchestrator.cs # Skeleton (future)
โ”‚ โ””โ”€โ”€ OrchestrationManagement/
โ”‚ โ”œโ”€โ”€ GetDurableEntityFunctions.cs # Query entity state
โ”‚ โ”œโ”€โ”€ PurgeAllOrchestrations.cs # Cleanup all
โ”‚ โ”œโ”€โ”€ PurgeSingleOrchestration.cs # Cleanup one
โ”‚ โ”œโ”€โ”€ ResetAllOrchestrations.cs # Reset all
โ”‚ โ””โ”€โ”€ ResetFailedOrchestrations.cs # Reset failed
โ”œโ”€โ”€ Services/
โ”‚ โ”œโ”€โ”€ BaseImageStorageService.cs # Abstract base for image storage
โ”‚ โ”œโ”€โ”€ SingleImageStorageService.cs # Single image + thumbnail
โ”‚ โ”œโ”€โ”€ PanoImageStorageService.cs # Panoramic stitching + storage
โ”‚ โ”œโ”€โ”€ PreStitchedImageStorageService.cs # Pre-stitch ZIP archive
โ”‚ โ”œโ”€โ”€ SignalRConnectionService.cs # Real-time broadcasting
โ”‚ โ””โ”€โ”€ DurableDataStoreService.cs # Entity state โ†’ Table Storage
โ”œโ”€โ”€ Middleware/
โ”‚ โ””โ”€โ”€ CorsMiddleware.cs # Local dev CORS
โ””โ”€โ”€ Utilities/
โ””โ”€โ”€ OrchestrationModeHelper.cs # Mode state transitions

Key Conceptsโ€‹

  • Eternal Orchestration โ€” Each camera runs an infinite orchestration loop using ContinueAsNew(). The loop captures images, checks for commands, sleeps, and repeats forever until explicitly terminated.
  • Durable Entities โ€” Per-camera CameraState entities maintain mode, PTZ position, command queues, and timing data across orchestration restarts.
  • Activity Functions โ€” All I/O (camera communication, image storage, ESRI updates) is isolated in activity functions so failures don't crash the orchestration.
  • Cosmos Change Feed Trigger โ€” The engine reacts to device configuration changes in real-time, starting/stopping orchestrations automatically.

Documentation Sectionsโ€‹