-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebcam.h
More file actions
37 lines (31 loc) · 885 Bytes
/
webcam.h
File metadata and controls
37 lines (31 loc) · 885 Bytes
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
#ifndef WEBCAM_H
#define WEBCAM_H
#include <QObject>
#include <QCamera>
#include <QVideoFrame>
#include <QImage>
#include <QString>
QT_FORWARD_DECLARE_CLASS(QCameraImageCapture)
class WebCam : public QObject {
Q_OBJECT
public:
explicit WebCam(QObject *parent = nullptr);
~WebCam();
void start();
void stop();
bool capture();
signals:
void cameraImageReady(const QImage& image);
void cameraReadyChanged(bool ready);
private:
QCamera *camera;
QCameraImageCapture *imageCapture;
private slots:
void onCameraImageAvail(int id, const QVideoFrame &frame);
void onCameraImageCaptured(int id, const QImage &preview);
void onCameraErrorDetected(QCamera::Error value);
void onCameraImageSaved(int id, const QString &fileName);
void onCameraStatusChanged(QCamera::Status status);
void onCameraReadyForCaptureChanged(bool ready);
};
#endif // WEBCAM_H