SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
opencv_trace_plotter.hpp
1
2// opencv_plotter.hpp
3// Created by Greg on 12/13/24.
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// === standard library includes (if any) ===
22#include <thread>
23// === third-party includes (if any) ===
24#include <absl/status/status.h>
25#include <opencv2/core.hpp>
26#include <physiology/modules/messages/metrics.pb.h>
27// === local includes (if any) ===
28
29#pragma once
30
31namespace presage::smartspectra::gui {
32
33class OpenCvTracePlotter {
34public:
35 OpenCvTracePlotter(int x, int y, int width, int height, int max_points = 300);
36
37 ~OpenCvTracePlotter() = default;
38
39 void UpdateTraceWithSampleRange(const google::protobuf::RepeatedPtrField<physiology::Measurement>& new_values);
40 void UpdateTraceWithSample(const physiology::Measurement& new_value);
41
42 absl::Status Render(
43 cv::Mat& image,
44 const cv::Scalar& color = cv::Scalar(0, 255, 0)
45 );
46
47private:
48 cv::Rect2i plot_area;
49 google::protobuf::RepeatedPtrField<physiology::Measurement> buffer;
50
51 const int max_points;
52
53 int last_overlap_area_start = 0;
54};
55
56} // presage::smartspectra::gui
void UpdateTraceWithSampleRange(const google::protobuf::RepeatedPtrField< physiology::Measurement > &new_values)
Definition opencv_trace_plotter.cpp:88
void UpdateTraceWithSample(const physiology::Measurement &new_value)
Definition opencv_trace_plotter.cpp:105