SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
foreground_container.hpp
1
2// foreground_container.h
3// Created by Greg on 4/29/2024.
4// Copyright (C) 2024 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#pragma once
22// === configuration header ===
23#include <physiology/modules/configuration.h>
24// === standard library includes (if any) ===
25// === third-party includes (if any) ===
26#ifdef WITH_VIDEO_OUTPUT
27#include <mediapipe/framework/port/opencv_video_inc.h>
28#endif
29// === local includes (if any) ===
30#include "container.hpp"
31#include "output_stream_poller_wrapper.hpp"
32#include <smartspectra/video_source/video_source.hpp>
33#include <smartspectra/video_source/camera_tuner.hpp>
34
36
37template<
38 platform_independence::DeviceType TDeviceType,
39 settings::OperationMode TOperationMode,
40 settings::IntegrationMode TIntegrationMode
41>
46class ForegroundContainer : public Container<TDeviceType, TOperationMode, TIntegrationMode> {
47public:
51 explicit ForegroundContainer(SettingsType settings);
52
54 absl::Status Initialize() override;
56 virtual absl::Status Run();
57
58protected:
59
62
64 virtual absl::Status InitializeOutputDataPollers();
66 virtual absl::Status HandleOutputData(int64_t frame_timestamp);
67
68 // state
69 bool keep_grabbing_frames;
70 std::shared_ptr<video_source::VideoSource> video_source = nullptr;
71 std::unique_ptr<video_source::CameraTuner> camera_tuner = nullptr;
72 bool tuning_enabled = false;
73#ifdef WITH_VIDEO_OUTPUT
74 cv::VideoWriter stream_writer;
75#endif
76
77 // settings
78 const bool load_video;
79private:
81 void ScrollPastTimeOffset();
82 static std::string GenerateGuiWindowName();
83 static const std::string kWindowName;
84
85
86};
87
90template<settings::OperationMode TOperationMode>
92
94#ifdef WITH_OPENGL
96#endif
97template<platform_independence::DeviceType TDeviceType>
99} // namespace presage::smartspectra::container
Container(SettingsType settings)
Definition container_impl.hpp:52
Convenience container with a built-in video source and optional GUI.
Definition foreground_container.hpp:46
virtual absl::Status InitializeOutputDataPollers()
Definition foreground_container_impl.hpp:138
ForegroundContainer(SettingsType settings)
Definition foreground_container_impl.hpp:53
virtual absl::Status Run()
Definition foreground_container_impl.hpp:226
virtual absl::Status HandleOutputData(int64_t frame_timestamp)
Definition foreground_container_impl.hpp:82
absl::Status Initialize() override
Definition foreground_container_impl.hpp:148
Definition background_container.cpp:10