-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimg_stream.hpp
60 lines (49 loc) · 1.38 KB
/
img_stream.hpp
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
#ifndef IMG_STREAM_HPP
#define IMG_STREAM_HPP
#ifdef WITH_WIC_SDK
#include <wic/calibrationdata.h>
#include <wic/camerafinder.h>
#include <wic/framegrabber.h>
#include <wic/wic.h>
#endif
#include <opencv2/videoio.hpp>
#include <vector>
#include <utility>
#include <string>
// The colors 0-255 in recordings correspond to temperatures 15-120C
#define RECORD_MIN_C 15
#define RECORD_MAX_C 120
// TODO: Split this class to camera dependent and independent parts.
// Ideally we want to support different thermal cameras.
struct img_stream {
public:
img_stream(std::string vid_in_path, std::string license_file);
~img_stream();
std::vector<std::pair<std::string, double>> getCameraComponentTemps();
void get_image(cv::Mat_<uint16_t> &result);
double get_temperature(uint16_t pixel_value);
private:
char tmp; // To make #ifdef in constructor simpler
#ifdef WITH_WIC_SDK
const
#else
static constexpr
#endif
bool is_video = true;
cv::VideoCapture *video = nullptr;
#ifdef WITH_WIC_SDK
wic::LicenseFile license;
wic::WIC *wic = nullptr;
wic::FrameGrabber *grabber = nullptr;
#endif
public:
const uint16_t min_rawtemp; // must be initialized after camera
const uint16_t max_rawtemp;
private:
#ifdef WITH_WIC_SDK
wic::WIC *init_wic();
wic::FrameGrabber *init_grabber();
#endif
uint16_t findRawtempC(double temp);
};
#endif // IMG_STREAM_HPP