-
Notifications
You must be signed in to change notification settings - Fork 0
/
qcvdetectfilter.h
55 lines (44 loc) · 1.23 KB
/
qcvdetectfilter.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
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef QCVDETECTFILTER_H
#define QCVDETECTFILTER_H
#include <QAbstractVideoFilter>
#include <QDebug>
#include <QTemporaryFile>
#include <QMutex>
#include "opencv2/opencv.hpp"
#include <zbar.h>
using namespace cv;
using namespace std;
using namespace zbar;
typedef struct
{
string type;
string data;
vector <Point> location;
} decodedObject;
class QCvDetectFilter : public QAbstractVideoFilter
{
Q_OBJECT
public:
QVideoFilterRunnable *createFilterRunnable();
signals:
void objectDetected(float x, float y, float w, float h);
void barcodeDetected(const QPoint &topLeft, const QPoint &bottomRight);
public slots:
};
class QCvDetectFilterRunnable : public QVideoFilterRunnable
{
public:
QCvDetectFilterRunnable(QCvDetectFilter *creator) {filter = creator;}
QVideoFrame run(QVideoFrame *input, const QVideoSurfaceFormat &surfaceFormat, RunFlags flags);
private:
void dft(cv::InputArray input, cv::OutputArray output);
QCvDetectFilter *filter;
///
/// \brief decode Find and decode barcodes and QR codes
/// \param im
/// \param decodedObjects
///
void decode(Mat &im, vector<decodedObject>&decodedObjects);
double tinhKhoangCach(cv::Point X, cv::Point Y);
};
#endif // QCVDETECTFILTER_H