SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
preprocessing_foreground_container.hpp
1
2// preprocessing_foreground_container.hpp
3// Created by greg on 1/13/25.
4// Copyright (C) 2025 Presage Security, Inc.
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 3 of the License, or (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this program; if not, write to the Free Software Foundation,
18// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21// === standard library includes (if any) ===
22// === third-party includes (if any) ===
23#include <nlohmann/json.hpp>
24// === local includes (if any) ===
25#include <smartspectra/container/foreground_container.hpp>
26#include <smartspectra/container/settings.hpp>
27#include <mediapipe/framework/port/opencv_core_inc.h>
28
29
30#pragma once
31namespace presage::smartspectra::lab {
32
33template<
34 platform_independence::DeviceType TDeviceType,
35 container::settings::OperationMode TOperationMode,
36 container::settings::IntegrationMode TIntegrationMode
37>
38class PreprocessingForegroundContainer : public container::ForegroundContainer<TDeviceType, TOperationMode, TIntegrationMode> {
39public:
42 explicit PreprocessingForegroundContainer(SettingsType settings);
43
44 std::function<absl::Status(const nlohmann::json&, int64_t input_timestamp)> OnPreprocessedDataOutput =
45 [](const nlohmann::json&, int64_t input_timestamp){ return absl::OkStatus(); };
46 // Draw pose landmarks and starter-point regions overlay on the latest output frame.
47 absl::Status DrawDebugOverlays(cv::Mat& output_frame_bgr);
48protected:
49 [[nodiscard]] std::string GetThirdGraphFileSuffix() const override;
50 [[nodiscard]] std::string GetGraphFilePrefix() const override;
51 absl::Status InitializeOutputDataPollers() override;
52 absl::Status HandleOutputData(int64_t frame_timestamp) override;
53private:
54 // hide OnMetrics hook, as it's no longer usable
55 using container::ForegroundContainer<TDeviceType, TOperationMode, TIntegrationMode>::OnCoreMetricsOutput;
57 // Debug pollers
63 std::optional<cv::Size> transformed_size;
64};
65
66template<container::settings::OperationMode TOperationMode>
67using CpuRestPreprocessingForegroundContainer =
69 platform_independence::DeviceType::Cpu,
70 TOperationMode,
71 container::settings::IntegrationMode::Rest
72 >;
73
74} // namespace presage::smartspectra::lab
Convenience container with a built-in video source and optional GUI.
Definition foreground_container.hpp:46
Definition preprocessing_foreground_container.hpp:38
absl::Status HandleOutputData(int64_t frame_timestamp) override
Definition preprocessing_foreground_container_impl.hpp:76
std::string GetGraphFilePrefix() const override
Definition preprocessing_foreground_container_impl.hpp:114
std::string GetThirdGraphFileSuffix() const override
Definition preprocessing_foreground_container_impl.hpp:104
absl::Status InitializeOutputDataPollers() override
Definition preprocessing_foreground_container_impl.hpp:51