-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathocvdecoder.h
More file actions
39 lines (31 loc) · 842 Bytes
/
ocvdecoder.h
File metadata and controls
39 lines (31 loc) · 842 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
38
39
#ifndef OCVDECODER_H
#define OCVDECODER_H
#include <QObject>
#include <QtMultimedia/QVideoSink>
#include <QtMultimedia/QVideoFrame>
#include <QtQml>
#include <QFuture>
#include <opencv2/objdetect.hpp>
class OCVDecoder: public QObject
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QVideoSink *videoSink READ videoSink WRITE setVideoSink NOTIFY videoSinkChanged)
public:
OCVDecoder(QObject *parent = nullptr);
~OCVDecoder();
void setVideoSink(QVideoSink *videoSink);
bool isDecoding() { return m_decoding; }
QVideoSink* videoSink() { return m_videoSink; }
public slots:
void setFrame(const QVideoFrame &frame);
signals:
void videoSinkChanged();
void decoded(const QString &qr);
private:
QVideoSink *m_videoSink;
cv::QRCodeDetector m_qrDecoder;
QFuture<void> m_processThread;
bool m_decoding;
};
#endif // OCVDECODER_H