-
Notifications
You must be signed in to change notification settings - Fork 4
/
CameraController.h
73 lines (59 loc) · 1.73 KB
/
CameraController.h
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
63
64
65
66
67
68
69
70
71
72
#pragma once
#include <memory>
#include <mutex>
#include <opencv2/core.hpp>
enum{CAMERA_GRAY_A, CAMERA_GRAY_B, CAMERA_COLOR_A, CAMERA_COLOR_B};
class FrameProcessor;
class FramePacket
{
public:
// uchar *buffer;
// uint32_t height, width;
// size_t size = 0;
// size_t stride = 0;
cv::Mat img;
uint32_t framecount = 0;
uint64_t timestamp = 0;
int channIdx;
//CameraController *controller;
void Process();
};
class CameraController
{
public:
//单例类 由主界面的closeEvent调用Delete手动析构
static CameraController* GetInstance();
static bool isConstructed();
static void Delete();
virtual ~CameraController();
friend class FramePacket;
static void NotifyExit();
virtual int PollingDevices(bool printout) = 0;
virtual bool OpenCamerasAndLoadConfiguration() = 0;
virtual void StartGrabbing() = 0;
virtual void StopGrabbing() = 0;
virtual void CloseCameras() = 0;
virtual void SetModeContinue() = 0;
virtual void SetModeSoftTrig() = 0;
virtual void SetModeExtTrig() = 0;
virtual void SoftTrigAll() = 0;
virtual void GetFramePacket(FramePacket &fp) = 0;
virtual int GetCameraOpened() const = 0;
virtual void SetPixelModeGray() = 0;
virtual void SetPixelModeColor() = 0;
virtual void SetAOIenable(bool enable) = 0;
virtual void ResetFrameCount() = 0;
void SetProcessor(std::shared_ptr<FrameProcessor> proc);
FrameProcessor* GetProcessor();
protected:
std::mutex processorLock;
static std::mutex exit_semaphore;
static bool exit_sign;
std::shared_ptr<FrameProcessor> processor;
CameraController();
private:
void Process(FramePacket *fp);
CameraController(const CameraController&); //Not implemented.
void operator =(const CameraController&); //Not implemented.
static CameraController* pInst;
};