-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfswebcam.h
More file actions
73 lines (54 loc) · 1.73 KB
/
fswebcam.h
File metadata and controls
73 lines (54 loc) · 1.73 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
/**
* This class controls the webcam and provides functionality
* such as listing all available cams or grabbing images.
*/
#ifndef FSWEBCAM_H
#define FSWEBCAM_H
#include <QCamera>
#include <QCameraImageCapture>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <QFutureWatcher>
#include "fsgeometries.h"
#include "staticHeaders.h"
extern FSPoint FSCamPosition;
struct FSWebCamInfo
{
QString portName; //path to the webcam e.g. /dev/video0
QString friendlyName; //name of webcam that is displayed
int sizeX;
int sizeY;
};
class FSWebCam : public QObject
{
Q_OBJECT
public:
FSWebCamInfo info; //the string that identifies the camera, as selected in the menu
QCamera* camera; //new qt5 camera representative
QCameraImageCapture *imageCapture;
void StartX(); //Qt5 camera not fully operational in Windows. We use these two routines to sync cv capture
void StartX2();
cv::VideoCapture imageCaptureCv;
QImageEncoderSettings imageSettings;
cv::Mat frame;
bool frameTaken;
bool endThread;
FSWebCam();
~FSWebCam();
//static QList<FSWebCamInfo> enumerate();
void KillThread();
cv::Mat getFrame(); //grab frame from camera and return as cv::Mat
// FSPoint getPosition(void); //geometric position of hardware webcam inside scanner
void setCamera(const QByteArray &cameraDevice);
signals:
void cameraFrame(QImage frame);
private slots:
void processCapturedImage(int requestId, const QImage& img);
void imageSaved(int id, const QString &fileName);
private:
bool isCapturingImage;
QImage Mat2QImage(const cv::Mat3b &src);
QFutureWatcher<void> watcher;
};
void debug_dialog(char *message);
#endif // FSWEBCAM_H