-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsvmgraphicsview.h
145 lines (110 loc) · 3.35 KB
/
svmgraphicsview.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef SVMGRAPHICSVIEW_H
#define SVMGRAPHICSVIEW_H
#include <QGraphicsView>
#include <vector>
#include <Eigen/Dense>
#include <Eigen/Eigenvalues>
#include <Eigen/LU>
#include "patchconfirmdialog.h"
using namespace Eigen;
struct imgPoint {
double x;
double y;
double w;
};
struct imgLine {
imgPoint p0;
imgPoint p1;
};
struct scnPoint {
double x;
double y;
double z;
double w;
};
struct connPoint {
imgPoint imgPt;
scnPoint scnPt;
// double** homoMatrix;
Matrix3d homoMatrixEig3;
};
enum stateSign {_START, _XLines, _YLines, _ZLines, _RPlane, _RHeight, _PtPool, _Polygon};
class SVMGraphicsView : public QGraphicsView
{
public:
SVMGraphicsView(QWidget *parent = 0);
void openAct();
void rescaleAct();
void pickXLines();
void pickYLines();
void pickZLines();
bool isLinesReady();
void pickRefPlane();
void pickRefHeightPoint();
void pickPolygon();
void calXVP();
void calYVP();
void calZVP();
void calHomography_Public();
void calGamma();
void calPatch();
void scnMapToImg();
void make3DPtPool();
void saveModel();
protected:
virtual void wheelEvent(QWheelEvent* event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
private:
bool _pan, _hasimage, _xVP_exist, _yVP_exist, _zVP_exist, _refHomo_exist, _getGammaZ;
int _panStartX, _panStartY, _extraRPt, _method, _textureMethod;
double gap;
stateSign state;
std::vector<imgLine> XLines, YLines, ZLines;
std::vector<connPoint> RPoints;
std::vector<connPoint> RHpoints;
std::vector<connPoint> PtPool;
std::vector<connPoint> PolyPool;
connPoint RHpt_cache;
QGraphicsScene* Scene;
QImage image;
imgPoint* pointCache;
connPoint* poolCache;
imgPoint* xVP;
imgPoint* yVP;
imgPoint* zVP;
Matrix3d refHomoI2S;
Matrix3d refHomoS2I;
Matrix<double, 3, 4> Proj;
double gammaZ;
patchConfirmDialog* patchConfirmDlg;
void pushLines(std::vector<imgLine> &lineContainer, double x, double y);
void pushRefPoints(double x, double y);
bool popRefInDialog(double x, double y);
void popMoveDialog();
void popIfLoadVPDialog();
void pushPtPool(double x, double y);
void pushPolyPool(double x, double y);
void reWindDel(std::vector<imgLine> &lineConatiner);
imgPoint* calVP(std::vector<imgLine> &lineContainer);
imgPoint* crossProduct(imgPoint p1, imgPoint p2);
void normaLize(imgPoint* pt);
void homoFy(imgPoint* pt);
void eigenJacobianTest();
void eigen3Test();
double* luSolver(double** A, double *b, int n);
Vector3d rotate(double x, double y, double z, Vector3d R, double theta);
void calHomography(std::vector<connPoint> &connPtContainer);
void calHomographyEig3(std::vector<connPoint> &connPtContainer);
bool planeCheck(std::vector<connPoint> &connPtContainer);
void makePatch();
Vector3i bilinear(QImage image, double x, double y);
Vector3d imgPointToVector3d(imgPoint imgPt);
Vector3d scnPointToVector3d(scnPoint scnPt);
void drawPoint(double x, double y, int size, const QPen & pen, const QBrush & brush);
void drawScene();
void svmInit();
};
#endif // SVMGRAPHICSVIEW_H