Hotspot.hpp
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include <vector>
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
namespace Cpu {
class Hotspot {
public:
using Contour = std::vector<cv::Point>;
using Surface = std::vector<cv::Point3f>;
const unsigned long timestamp;
const int component;
const Contour contour;
const cv::Mat mask;
const double meanTemperature, maxTemperature;
const int size;
Hotspot(const cv::Mat &temperature, unsigned long timestamp, int component,
const Contour &contour, const Surface &surface);
double perimeter() const;
private:
const Surface surface;
Hotspot(const cv::Mat &temperature, unsigned long timestamp, int component,
const Contour &contour, const Surface &surface,
const cv::Mat &mask);
int calculateSize() const;
double calculateMean(const cv::Mat &temperature) const;
double calculateMax(const cv::Mat &temperature) const;
static cv::Mat createMask(const cv::Size &size, const Contour &contour);
};
class PersistentHotspot {
public:
explicit PersistentHotspot(const Hotspot &initial);
void merge(const Hotspot &other);
int area() const;
cv::Mat mask;
int component;
std::vector<unsigned long> timestamps;
std::vector<double> meanTemperatures;
std::vector<double> maxTemperatures;
private:
void append(const Hotspot &other);
};
} // namespace Cpu