-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathocvdecoder.h
43 lines (35 loc) · 933 Bytes
/
ocvdecoder.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
#ifndef OCVDECODER_H
#define OCVDECODER_H
#include <QObject>
#include <QtMultimedia/QVideoSink>
#include <QtMultimedia/QVideoFrame>
#include "opencv2/wechat_qrcode.hpp"
#include <qqml.h>
#include <QFuture>
using namespace cv;
class OCVDecoder: public QObject
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QObject* videoSink WRITE setVideoSink)
Q_PROPERTY(bool run READ run WRITE setRun)
public:
OCVDecoder(QObject *parent = nullptr);
~OCVDecoder();
void setVideoSink(QObject *videoSink);
bool isDecoding() {return m_decoding; }
bool run() {return m_run;}
void setRun(bool run);
public slots:
void setFrame(const QVideoFrame &frame);
signals:
void videoSyncChnaged();
void decoded(const QString &qr);
private:
QVideoSink *m_videoSink;
Ptr<wechat_qrcode::WeChatQRCode> m_detector;
QFuture<void> m_processThread;
bool m_decoding;
bool m_run;
};
#endif // OCVDECODER_H