-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathframegrabber.h
65 lines (53 loc) · 1.45 KB
/
framegrabber.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
// FrameGrabber class for Basler USB3.0 camera
// Author: @ZC
// Date: created on 18 Jun 2018
#ifndef FRAMEGRABBER_H
#define FRAMEGRABBER_H
#include <iostream>
#include <unistd.h> // for usleep()
#include <QObject>
#include <QDebug>
#include <QString>
#include <QImage>
// Include files to use the PYLON API.
#include <pylon/PylonIncludes.h>
// Namespace for using pylon objects.
using namespace Pylon;
// Settings for using Basler USB cameras.
#include <pylon/usb/BaslerUsbInstantCamera.h>
typedef Pylon::CBaslerUsbInstantCamera Camera_t;
typedef Camera_t::GrabResultPtr_t GrabResultPtr_t;
using namespace Basler_UsbCameraParams;
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
using namespace std;
class FrameGrabber : public QObject
{
Q_OBJECT
public:
explicit FrameGrabber(QObject *parent = nullptr);
~FrameGrabber();
bool cameraConnected;
bool startGrabbing;
QString scanDevices();
private:
Camera_t *pylonCamera;
char grabMode;
cv::Mat cvFrame;
cv::Mat readFrame();
void initCamera();
void configureCamera();
signals:
void sendCaptureFrame(cv::Mat cvFrameToSend);
void sendFrame(cv::Mat cvFrameToSend);
public slots:
void receiveConnectCamera();
void receiveDisconnectCamera();
void receiveStartCaptureMode();
void receiveStartStreamMode();
void receiveStopGrabbing();
void receiveSendFrame();
};
#endif // FRAMEGRABBER_H