-
Notifications
You must be signed in to change notification settings - Fork 0
/
basilecontrol.h
136 lines (64 loc) · 2.25 KB
/
basilecontrol.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef BASILECONTROL_H
#define BASILECONTROL_H
#include <QObject>
#include <pylon/PylonIncludes.h>
#include <QImage>
#include <QTimer>
#define DOUBLE_MAX 100000
#define DOUBLE_MIN 0
using namespace std;
using namespace Pylon;
using namespace GenApi;
class SBaslerCameraControl : public QObject
{
Q_OBJECT
public:
explicit SBaslerCameraControl(QObject *parent = 0);
~SBaslerCameraControl();
enum SBaslerCameraControl_Type{
Type_Basler_Freerun, //设置相机的内触发
Type_Basler_Line1, //设置相机的外触发
Type_Basler_ExposureTimeAbs, //设置相机的曝光时间
Type_Basler_GainRaw, //设置相机的增益
Type_Basler_AcquisitionFrameRateAbs, //设置相机的频率
Type_Basler_Width, //图片的宽度
Type_Basler_Height, //图片的高度
Type_Basler_LineSource, //灯的触发信号
};
void initSome();
void deleteAll();
QStringList cameras();
int OpenCamera(QString cameraSN);
int CloseCamera();
void setExposureTime(double time); // 设置曝光时间
int getExposureTime(); // 获取曝光时间
int getExposureTimeMin(); // 最小曝光时间
int getExposureTimeMax(); // 最大曝光时间
void setFeatureTriggerSourceType(QString type); // 设置种类
QString getFeatureTriggerSourceType(); // 获取种类:软触发、外触发等等
void setFeatureTriggerModeType(bool on); // 设置模式触发
bool getFeatureTriggerModeType(); // 获取模式触发
void SetCamera(SBaslerCameraControl::SBaslerCameraControl_Type index, double tmpValue = 0.0); // 设置各种参数
double GetCamera(SBaslerCameraControl::SBaslerCameraControl_Type index); // 获取各种参数
long GrabImage(QImage& image,int timeout = 2000);
long StartAcquire(); // 开始采集
long StopAcquire(); // 结束采集
signals:
void sigCameraUpdate(QStringList list);
void sigSizeChange(QSize size);
void sigCameraCount(int count);
void sigCurrentImage(QImage img);
private:
void UpdateCameraList();
void CopyToImage(CGrabResultPtr pInBuffer, QImage &OutImage);
private slots:
void onTimerGrabImage();
private:
CInstantCamera m_basler;
QStringList m_cameralist;
QString m_currentMode;
bool m_isOpenAcquire = false; // 是否开始采集
bool m_isOpen = false; // 是否打开摄像头
QSize m_size;
};
#endif // SBASLERCAMERACONTROL_H