![]() |
SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
|
Base container encapsulating the MediaPipe graph and common callbacks. More...
#include <container.hpp>
Public Types | |
| typedef container::settings::Settings< TOperationMode, TIntegrationMode > | SettingsType |
Public Member Functions | |
| Container (SettingsType settings) | |
| absl::Status | SetOnStatusChange (const std::function< absl::Status(physiology::StatusValue)> &on_status_change) |
| absl::Status | SetOnStatusCode (const std::function< absl::Status(physiology::StatusValue)> &on_status_code) |
| absl::Status | SetOnEdgeMetricsOutput (const std::function< absl::Status(const physiology::Metrics &, int64_t input_timestamp)> &on_edge_metrics_output) |
| absl::Status | SetOnCoreMetricsOutput (const std::function< absl::Status(const physiology::MetricsBuffer &, int64_t input_timestamp)> &on_core_metrics_output) |
| absl::Status | SetOnVideoOutput (const std::function< absl::Status(cv::Mat &output_frame, int64_t input_timestamp)> &on_video_output) |
| absl::Status | SetOnFrameSentThrough (const std::function< absl::Status(bool frame_sent_through, int64_t input_timestamp)> &on_dropped_frame) |
| absl::Status | SetOnCorePerformanceTelemetry (const std::function< absl::Status(double, double, int64_t)> &on_effective_core_fps_output) |
| virtual absl::Status | Initialize () |
Protected Member Functions | |
| virtual std::string | GetThirdGraphFileSuffix () const |
| virtual std::string | GetGraphFilePrefix () const |
| absl::StatusOr< std::filesystem::path > | GetGraphFilePath (bool binary_graph=true) const |
| absl::Status | ComputeCorePerformanceTelemetry (const physiology::MetricsBuffer &metrics_buffer) |
| void | AddFrameTimestampToBenchmarkingInfo (const mediapipe::Timestamp ×tamp) |
Protected Attributes | |
| SettingsType | settings |
| mediapipe::CalculatorGraph | graph |
| std::function< absl::Status(physiology::StatusValue)> | OnStatusChange |
| std::function< absl::Status(physiology::StatusValue)> | OnStatusCode |
| std::function< absl::Status(const physiology::Metrics &, int64_t input_timestamp)> | OnEdgeMetricsOutput |
| std::function< absl::Status(const physiology::MetricsBuffer &, int64_t input_timestamp)> | OnCoreMetricsOutput |
| std::function< absl::Status(cv::Mat &output_frame, int64_t input_timestamp)> | OnVideoOutput |
| std::function< absl::Status(bool frame_sent_through, int64_t input_timestamp)> | OnFrameSentThrough |
| std::optional< std::function< absl::Status(double fps, double latency_s, int64_t input_timestamp)> > | OnCorePerformanceTelemetry = std::nullopt |
| platform_independence::DeviceContext< TDeviceType > | device_context |
| bool | initialized = false |
| bool | running = false |
| physiology::StatusValue | status |
| bool | recording = false |
| cv::Mat | output_frame_bgr |
| OperationContext< TOperationMode > | operation_context |
Base container encapsulating the MediaPipe graph and common callbacks.
| TDeviceType | Target device type (CPU/OpenGL/etc). |
| TOperationMode | Operation mode (Spot or Continuous). |
| TIntegrationMode | Integration mode (REST or gRPC). |
|
explicit |
Construct a container with the provided settings.
|
protected |
Track the timestamp of each frame added to the graph for benchmarking.
|
protected |
Compute FPS and latency information from a metrics buffer.
Computes effective fps if OnEffectiveCoreFpsOutput has been set. Relies on this->frames_in_graph_timestamps with timestamps of every frame put into the graph (AddFrameTimestampToBenchmarkingInfo should be used in child classes at every frame)
| metrics_buffer | - last output metrics buffer |
|
protected |
Resolve the path to the MediaPipe graph file on disk.
| binary_graph | true to use the binary form of the graph |
|
protectedvirtual |
Prefix used when searching for graph files on disk.
Reimplemented in presage::smartspectra::lab::PreprocessingForegroundContainer< TDeviceType, TOperationMode, TIntegrationMode >, and presage::smartspectra::lab::PreprocessingForegroundContainer< platform_independence::DeviceType::Cpu, TOperationMode, container::settings::IntegrationMode::Rest >.
|
protectedvirtual |
Retrieve the suffix used for the optional third graph file.
Reimplemented in presage::smartspectra::lab::PreprocessingForegroundContainer< TDeviceType, TOperationMode, TIntegrationMode >, and presage::smartspectra::lab::PreprocessingForegroundContainer< platform_independence::DeviceType::Cpu, TOperationMode, container::settings::IntegrationMode::Rest >.
|
virtual |
Initialize the underlying MediaPipe graph and device context.
Reimplemented in presage::smartspectra::container::BackgroundContainer< TDeviceType, TOperationMode, TIntegrationMode >, presage::smartspectra::container::BackgroundContainer< platform_independence::DeviceType::Cpu, settings::OperationMode::Continuous, settings::IntegrationMode::Grpc >, presage::smartspectra::container::BackgroundContainer< platform_independence::DeviceType::Cpu, settings::OperationMode::Spot, settings::IntegrationMode::Rest >, presage::smartspectra::container::BackgroundContainer< platform_independence::DeviceType::OpenGl, settings::OperationMode::Spot, settings::IntegrationMode::Rest >, presage::smartspectra::container::BackgroundContainer< presage::platform_independence::DeviceType::Cpu, smartspectra::container::settings::OperationMode::Continuous, TIntegrationMode >, presage::smartspectra::container::BackgroundContainer< TDeviceType, settings::OperationMode::Spot, settings::IntegrationMode::Rest >, presage::smartspectra::container::ForegroundContainer< TDeviceType, TOperationMode, TIntegrationMode >, presage::smartspectra::container::ForegroundContainer< platform_independence::DeviceType::Cpu, settings::OperationMode::Continuous, settings::IntegrationMode::Grpc >, presage::smartspectra::container::ForegroundContainer< platform_independence::DeviceType::Cpu, settings::OperationMode::Continuous, settings::IntegrationMode::Rest >, presage::smartspectra::container::ForegroundContainer< platform_independence::DeviceType::Cpu, settings::OperationMode::Spot, settings::IntegrationMode::Rest >, presage::smartspectra::container::ForegroundContainer< platform_independence::DeviceType::Cpu, TOperationMode, settings::IntegrationMode::Rest >, and presage::smartspectra::container::ForegroundContainer< TDeviceType, settings::OperationMode::Spot, settings::IntegrationMode::Rest >.
| absl::Status presage::smartspectra::container::Container< TDeviceType, TOperationMode, TIntegrationMode >::SetOnCoreMetricsOutput | ( | const std::function< absl::Status(const physiology::MetricsBuffer &, int64_t input_timestamp)> & | on_core_metrics_output | ) |
Set callback invoked when metrics are produced by the core processing pipeline.
| absl::Status presage::smartspectra::container::Container< TDeviceType, TOperationMode, TIntegrationMode >::SetOnCorePerformanceTelemetry | ( | const std::function< absl::Status(double, double, int64_t)> & | on_effective_core_fps_output | ) |
Set callback for benchmarking effective core FPS and latency.
| absl::Status presage::smartspectra::container::Container< TDeviceType, TOperationMode, TIntegrationMode >::SetOnFrameSentThrough | ( | const std::function< absl::Status(bool frame_sent_through, int64_t input_timestamp)> & | on_dropped_frame | ) |
Set callback used for frame drop diagnostics.
| absl::Status presage::smartspectra::container::Container< TDeviceType, TOperationMode, TIntegrationMode >::SetOnStatusChange | ( | const std::function< absl::Status(physiology::StatusValue)> & | on_status_change | ) |
Set callback invoked whenever the preprocessing status changes.
| absl::Status presage::smartspectra::container::Container< TDeviceType, TOperationMode, TIntegrationMode >::SetOnStatusCode | ( | const std::function< absl::Status(physiology::StatusValue)> & | on_status_code | ) |
Set callback invoked on EVERY status code update (regardless of whether it changed). This is useful for camera tuning which needs to observe all status updates.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |