-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcamera.h
More file actions
79 lines (75 loc) · 2.31 KB
/
camera.h
File metadata and controls
79 lines (75 loc) · 2.31 KB
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
#ifndef CAMERA_H
#define CAMERA_H
#include <QMainWindow>
#include <QString>
#include <opencv2/opencv.hpp>
#include <opencv2/tracking.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/bgsegm.hpp>
#include <EmergentCamera.h>
#include <emergentframe.h>
#include <EmergentAVIFile.h>
#include <camerasettings.h>
#include <gigevisiondeviceinfo.h>
#include <unistd.h>
#include <sys/time.h>
#include <QLabel>
#include <QTimer>
#include <QObject>
#include <opencv2/core/cvstd_wrapper.hpp>
using namespace cv;
using namespace Emergent;
// Contains all the information associated with an emergent camera, including deviceInfo, settings, temporary frame data, and preview OpenCV image data
class Camera : public QObject
{
public slots:
void DisplayPreview();
void RecordVideo();
private:
Q_OBJECT
QTimer *timer;
unsigned int frame_rate_max, frame_rate_min, frame_rate_inc, frame_rate;
unsigned int height_max, width_max;
int deviceInfoIndex = 0;
CEmergentCamera camera;
CEmergentFrame evtFrame[30];
cv::VideoWriter writer;
CEmergentFrame evtFrameRecv, evtFrameConvert;
cv::Mat currFrame, frameGrabFrame;
QString format;
QString name;
QString outputLocation;
int MAX_CAMERAS=6;
int numCameras = 0;
QLabel *previewFrame;
QLabel *backgroundWindow;
QLabel *trackingWindow;
public:
explicit Camera(QObject * parent = nullptr);
void SetupCamera();
void InitRecord(QString recordOptions, int fps);
void ReleaseWriter();
void cleanUpCamera();
bool CheckEmergentCamera(GigEVisionDeviceInfo* deviceInfo);
int GetDeviceInfoIndex();
void SetDeviceInfoIndex(int index);
QString getFormat() const;
QString getCameraName() const;
void setFormat(const QString &value);
void ConfigureEmergentCameraDefaults(CEmergentCamera *camera);
CEmergentCamera* getEmergentCameraPtr();
void ReleaseFrame(int frameIndex);
void setPreviewFrame(QLabel *value);
void StartPreview();
void StartRecord();
void StopCamera();
QString getName() const;
QString getOutputLocation() const;
void setOutputLocation(const QString &value);
void setBackgroundWindow(QLabel *value);
void setTrackingWindow(QLabel *value);
void GrabBackgroundFrame();
};
#endif // CAMERA_H