05Robot 3.0

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

Camera_Basler_GigE.h
Go to the documentation of this file.
1
7 #ifndef CAMERA_BASLER_GIGE_H
8 #define CAMERA_BASLER_GIGE_H
9
10 #include "Camera.h"
11 #include <iostream>
12 #include <fstream>
13
14 #ifdef __APPLE__
15 #pragma clang diagnostic push
16 #pragma clang diagnostic ignored "-Wunused-parameter"
17 #pragma clang diagnostic ignored "-Woverloaded-virtual"
18 #include <PylonIncludes.h>
19 #include <gige/BaslerGigECamera.h>
20 #include <gige/BaslerGigEInstantCamera.h>
21 #pragma clang diagnostic pop
22 #else
23 #include <pylon/PylonIncludes.h>
24 #include <pylon/gige/BaslerGigECamera.h>
25 #include <pylon/gige/BaslerGigEInstantCamera.h>
26 #endif
27
28 using namespace Pylon;
29
30 typedef Pylon::CBaslerGigEInstantCamera Camera_t;
31 using namespace Basler_GigECameraParams;
32 using namespace Basler_GigEStreamParams;
33
34 using namespace std;
35
36 // Buffers for grabbing
37 const uint32_t c_nBuffers = 2;
44 class Camera_Basler_GigE: public Camera
45 {
46 Q_OBJECT
50 Q_PROPERTY(int Width READ width WRITE setWidth DESIGNABLE true USER true)
51 Q_CLASSINFO("Width", "minimum=0;maximum=10000;singleStep=1;");
55 Q_PROPERTY(int Height READ height WRITE setHeight DESIGNABLE true USER true)
56 Q_CLASSINFO("Height", "minimum=0;maximum=10000;singleStep=1;");
60 Q_PROPERTY(int OffsetX READ offsetX WRITE setOffsetX DESIGNABLE true USER true)
61 Q_CLASSINFO("OffsetX", "minimum=-1;maximum=10000;singleStep=1;");
65 Q_PROPERTY(int OffsetY READ offsetY WRITE setOffsetY DESIGNABLE true USER true)
66 Q_CLASSINFO("OffsetY", "minimum=-1;maximum=10000;singleStep=1;");
70 Q_PROPERTY(int ExposureTimeRaw READ exposureTimeRaw WRITE setExposureTimeRaw DESIGNABLE true USER true)
71 Q_CLASSINFO("ExposureTimeRaw", "minimum=0;maximum=500000;singleStep=1;");
75 Q_PROPERTY(int BalanceRatioRaw_red READ balanceRatioRaw_red WRITE setBalanceRatioRaw_red DESIGNABLE true USER true)
76 Q_CLASSINFO("BalanceRatioRaw_red", "minimum=0;maximum=500000;singleStep=1;");
80 Q_PROPERTY(int BalanceRatioRaw_green READ balanceRatioRaw_green WRITE setBalanceRatioRaw_green DESIGNABLE true USER true)
81 Q_CLASSINFO("BalanceRatioRaw_green", "minimum=0;maximum=500000;singleStep=1;");
85 Q_PROPERTY(int BalanceRatioRaw_blue READ balanceRatioRaw_blue WRITE setBalanceRatioRaw_blue DESIGNABLE true USER true)
86 Q_CLASSINFO("BalanceRatioRaw_blue", "minimum=0;maximum=500000;singleStep=1;");
87
88 public:
92 Camera_Basler_GigE()
93 {
94 m_width=10000;
95 m_height=10000;
96 m_offsetx=-1;
97 m_offsety=-1;
98 m_exposuretimeraw=3599;
99 m_balanceratioraw_red=108;
100 m_balanceratioraw_green=64;
101 m_balanceratioraw_blue=89;
102 resultBufferYUV=NULL;
103 Camera();
104 }
108 int width() const {return m_width;}
112 void setWidth(const int& width) {m_width = width;}
116 int height() const {return m_height;}
120 void setHeight(const int& height) {m_height = height;}
124 int offsetX() const {return m_offsetx;}
128 void setOffsetX(const int& offsetx) {m_offsetx = offsetx;}
132 int offsetY() const {return m_offsety;}
136 void setOffsetY(const int& offsety) {m_offsety = offsety;}
137
141 int exposureTimeRaw() const {return m_exposuretimeraw;}
145 void setExposureTimeRaw(const int& exposuretimeraw) {
146 m_exposuretimeraw = exposuretimeraw;
147 if (pCamera != NULL) {
148 pCamera->ExposureTimeRaw.SetValue(m_exposuretimeraw);
149 }
150 }
154 int balanceRatioRaw_red() const {return m_balanceratioraw_red;}
158 void setBalanceRatioRaw_red(const int& balanceratioraw_red) {
159 m_balanceratioraw_red = balanceratioraw_red;
160 if (pCamera != NULL) {
161 pCamera->BalanceRatioSelector.SetValue(BalanceRatioSelector_Red);
162 pCamera->BalanceRatioRaw.SetValue(m_balanceratioraw_red);
163 }
164 }
168 int balanceRatioRaw_green() const {return m_balanceratioraw_green;}
172 void setBalanceRatioRaw_green(const int& balanceratioraw_green) {
173 m_balanceratioraw_green = balanceratioraw_green;
174 if (pCamera != NULL) {
175 pCamera->BalanceRatioSelector.SetValue(BalanceRatioSelector_Green);
176 pCamera->BalanceRatioRaw.SetValue(m_balanceratioraw_green);
177 }
178 }
182 int balanceRatioRaw_blue() const {return m_balanceratioraw_blue;}
186 void setBalanceRatioRaw_blue(const int& balanceratioraw_blue) {
187 m_balanceratioraw_blue = balanceratioraw_blue;
188 if (pCamera != NULL) {
189 pCamera->BalanceRatioSelector.SetValue(BalanceRatioSelector_Blue);
190 pCamera->BalanceRatioRaw.SetValue(m_balanceratioraw_blue);
191 }
192 }
193
194 private:
195 int m_width;
196 int m_height;
197 int m_offsetx;
198 int m_offsety;
199 int m_exposuretimeraw;
200 int m_balanceratioraw_red;
201 int m_balanceratioraw_green;
202 int m_balanceratioraw_blue;
203
204 unsigned char* resultBufferYUV;
205
206 private: // statics
207 static Pylon::PylonAutoInitTerm autoInitTerm;
208 static CTlFactory& TlFactory;
209 static ITransportLayer *pTl;
210 static int started;
211
212 private:
213 CDeviceInfo deviceInfo;
214 Camera_t* pCamera = NULL;
215
216 public:
220 static DeviceInfoList_t devices;
224 static void refreshDevices()
225 {
226 pTl->EnumerateDevices(devices);
227 }
228
229
230 public:
238 int connect(int camera_id);
244 int start();
250 int sync();
258 int grab(cv::Mat* output = NULL);
264 int stop();
270 int disconnect();
271 };
273 #endif
Camera_Basler_GigE::offsetY
int offsetY() const
Gets picture vertical offset in pixels.
Definition: Camera_Basler_GigE.h:132
Camera_Basler_GigE::setBalanceRatioRaw_green
void setBalanceRatioRaw_green(const int &balanceratioraw_green)
Sets green color balance ratio.
Definition: Camera_Basler_GigE.h:172
Camera_t
Pylon::CBaslerGigEInstantCamera Camera_t
Definition: Camera_Basler_GigE.h:30
Basler_GigEStreamParams
Camera_Basler_GigE::refreshDevices
static void refreshDevices()
Refreshes connected devices.
Definition: Camera_Basler_GigE.h:224
std
Basler_GigECameraParams
Camera_Basler_GigE::setBalanceRatioRaw_blue
void setBalanceRatioRaw_blue(const int &balanceratioraw_blue)
Sets green color balance ratio.
Definition: Camera_Basler_GigE.h:186
Camera
Base camera interface class.
Definition: Camera.h:49
Camera_Basler_GigE::balanceRatioRaw_red
int balanceRatioRaw_red() const
Gets red color balance ratio.
Definition: Camera_Basler_GigE.h:154
Camera_Basler_GigE::height
int height() const
Gets picture height in pixels.
Definition: Camera_Basler_GigE.h:116
Camera_Basler_GigE::setOffsetY
void setOffsetY(const int &offsety)
Sets picture vertical offset in pixels.
Definition: Camera_Basler_GigE.h:136
Camera_Basler_GigE::setBalanceRatioRaw_red
void setBalanceRatioRaw_red(const int &balanceratioraw_red)
Sets red color balance ratio.
Definition: Camera_Basler_GigE.h:158
Camera_Basler_GigE::setExposureTimeRaw
void setExposureTimeRaw(const int &exposuretimeraw)
Sets raw exposure time.
Definition: Camera_Basler_GigE.h:145
Camera_Basler_GigE::width
int width() const
Gets picture width in pixels.
Definition: Camera_Basler_GigE.h:108
Camera_Basler_GigE::Camera_Basler_GigE
Camera_Basler_GigE()
Initializes default parameters.
Definition: Camera_Basler_GigE.h:92
Camera_Basler_GigE::setWidth
void setWidth(const int &width)
Sets picture width in pixels.
Definition: Camera_Basler_GigE.h:112
Camera_Basler_GigE::balanceRatioRaw_blue
int balanceRatioRaw_blue() const
Gets green color balance ratio.
Definition: Camera_Basler_GigE.h:182
Camera_Basler_GigE::devices
static DeviceInfoList_t devices
Pylon camera list.
Definition: Camera_Basler_GigE.h:220
Camera_Basler_GigE::offsetX
int offsetX() const
Gets picture horizontal offset in pixels.
Definition: Camera_Basler_GigE.h:124
Camera_Basler_GigE::setHeight
void setHeight(const int &height)
Sets picture height in pixels.
Definition: Camera_Basler_GigE.h:120
Pylon
Camera.h
c_nBuffers
const uint32_t c_nBuffers
Definition: Camera_Basler_GigE.h:37
Camera_Basler_GigE::setOffsetX
void setOffsetX(const int &offsetx)
Sets picture horizontal offset in pixels.
Definition: Camera_Basler_GigE.h:128
Camera_Basler_GigE::balanceRatioRaw_green
int balanceRatioRaw_green() const
Gets green color balance ratio.
Definition: Camera_Basler_GigE.h:168
Camera_Basler_GigE
Basler Gigabit Ethernet camera interface class.
Definition: Camera_Basler_GigE.h:44
Camera_Basler_GigE::exposureTimeRaw
int exposureTimeRaw() const
Gets raw exposure time.
Definition: Camera_Basler_GigE.h:141