Ejemplo n.º 1
0
        private async Task ProcessDeepStackResponseAsync(CameraConfig camera, DeepStackResponse response,
                                                         Image image, CancellationToken cancellationToken)
        {
            if (response.Success)
            {
                var relevantObjects = GetRelevantObjects(camera, response);
                if (!relevantObjects.IsEmpty)
                {
                    _logger.LogDebug(
                        "Detected relevant objects {objects}",
                        relevantObjects.Map(o => new { o.Label, o.Confidence }));

                    if (camera.TelegramTrigger != null)
                    {
                        await _telegramService.ProcessTriggerAsync(camera.TelegramTrigger, image, cancellationToken);
                    }

                    await _triggerService.ProcessTriggersAsync(camera, image, cancellationToken);
                }
            }
            else
            {
                _logger.LogWarning("DeepStack did not detect any objects");
            }
        }