-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatchtemplate.h
66 lines (57 loc) · 1.55 KB
/
matchtemplate.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
56
57
58
59
60
61
62
63
64
65
66
#ifndef MATCHTEMPLATE_H
#define MATCHTEMPLATE_H
#include <QImage>
#include <QImageReader>
#include <QVector2D>
#include <QPixmap>
#include <QLabel>
#include <QtCore/qmath.h>
#include <iostream>
#include <QColor>
#include <complex>
#include <QByteArray>
#include <QMatrix>
#define MAX_DIFF 65535
#define MIN_DIFF 0
#define SQ_DIFF 0
#define SQ_DIFF_NOR 1
#define CCORR 2
#define CCORR_NOR 3
#define CCOEFF 4
#define CCOEFF_NOR 5
class MatchTemplate
{
public:
MatchTemplate(QImage* srcImage, QImage* dstImage);
~MatchTemplate();
QImage get_src_img();
QImage get_dst_img();
QImage get_result_img();
QVector2D get_result_pos();
bool match(int match_style);
private:
// member function
double sq_diff();
double sq_diff_normed();
double ccorr();
double ccorr_normed();
double ccoeff();
double ccoeff_normed();
void match_with_sq_diff();
void match_with_sq_diff_normed();
void match_with_ccorr();
void match_with_ccorr_normed();
void match_with_ccoeff();
void match_with_ccoeff_normed();
QVector<QVector<double>> remove_avg(QVector<QVector<double>>* image_mat);
QVector<QVector<double>> trans_matrix(QImage *image);
QVector<unsigned long int> image_integral(QImage* image);
void readImage(std::complex<int> data[], const QImage &Image);
// member var
QImage* _src_img;
QImage* _dst_img;
QVector2D _result_pos;
QVector<QVector<double>> _src_mat;
QVector<QVector<double>> _dst_mat;
};
#endif // MATCHTEMPLATE_H