Hotspot.hpp
1.51 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
61
62
#pragma once
#include <vector>
#include <opencv2/core/mat.hpp>
#include <opencv2/cudaarithm.hpp>
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::cuda::GpuMat mask;
int size;
double meanTemperature, maxTemperature;
Hotspot(const cv::cuda::GpuMat &temperature, unsigned long timestamp,
int component, const Contour &contour, const Surface &surface);
double perimeter() const;
private:
const Surface surface;
Hotspot(const cv::cuda::GpuMat &temperature, unsigned long timestamp,
int component, const Contour &contour, const Surface &surface,
const cv::cuda::GpuMat &mask);
static cv::cuda::GpuMat createMask(const cv::Size &size,
const Contour &contour);
/* Buffors */
cv::cuda::Stream nonZeroStream, sumStream, minMaxStream;
cv::cuda::GpuMat nonZeroDevice{1, 1, CV_32SC1}, sumDevice{1, 1, CV_64FC1},
minMaxDevice{1, 2, CV_32SC1};
cv::Mat nonZeroHost{1, 1, CV_32SC1}, sumHost{1, 1, CV_64FC1},
minMaxHost{1, 2, CV_32SC1};
};
class PersistentHotspot {
public:
explicit PersistentHotspot(const Hotspot &initial);
void merge(const Hotspot &other);
int area() const;
cv::cuda::GpuMat mask;
int component;
std::vector<unsigned long> timestamps;
std::vector<double> meanTemperatures;
std::vector<double> maxTemperatures;
private:
void append(const Hotspot &other);
cv::cuda::Stream stream;
};