OverloadHotspotDetectionAlgorithm.hpp
1.8 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 <opencv2/cudaarithm.hpp>
#include <opencv2/cudafilters.hpp>
#include "algorithm/Algorithm.hpp"
#include "algorithm/common/PfcSegmenter.hpp"
#include "algorithm/common/SurfaceMap.hpp"
#include "algorithm/gpu/common/ClusterCorrespondence.hpp"
#include "algorithm/gpu/common/ConcurrentCopyExecute.hpp"
#include "algorithm/gpu/hotspot/Hotspot.hpp"
#include "algorithm/gpu/common/ContinuousGpuMat.hpp"
#include "algorithm/gpu/common/ManagedMat.hpp"
class OverloadHotspotDetectionAlgorithm : public Algorithm {
public:
/* Configurable parameters */
std::unique_ptr<cv::cuda::Filter> medianFilter;
std::size_t blobsLimit{5};
std::size_t pixelsThreshold{3};
std::unique_ptr<cv::cuda::Filter> createMedianFilter(int kernel) const;
/* Configurable parameters */
OverloadHotspotDetectionAlgorithm() = default;
void setup(const cv::Size &frameSize, const CVMatLoader &loader) override;
void handleFrame(const cv::Mat &hostFrame,
unsigned long timestamp) override;
std::vector<PersistentHotspot> uniqueHotspots; /* Set of persistent hotspots */
private:
using Contours = std::vector<std::vector<cv::Point>>;
static constexpr int KELVINS{273};
static constexpr int MAX_TEMPERATURE{(1L << 15) - 1};
ConcurrentCopyExecute<4> concurrent;
cv::Size currentFrameSize;
ClusterCorrespondence clusterCorrespondence{.8, 2.};
std::unique_ptr<const SurfaceMap> surfaceMap;
cv::cuda::GpuMat deviceFov, deviceModel, devicePfc;
cv::Mat hostPfcMask;
std::vector<Hotspot> currentHotspots;
void identifyHotspots(unsigned long timestamp);
void matchHotspot(const Hotspot &hotspot);
/* Buffors */
std::unique_ptr<ContinuousGpuMat> medianFilterInput, medianFilterOutput;
std::unique_ptr<ManagedMat> overheating;
cv::cuda::GpuMat deviceFrame, deviceInput, deviceTemperature;
/* Buffors */
};