-
Notifications
You must be signed in to change notification settings - Fork 0
/
main1.cpp
131 lines (114 loc) · 1.93 KB
/
main1.cpp
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
#include<iostream>
#include<Eigen/Dense>
#include<opencv2/core/core.hpp>
#include<opencv.hpp>
#include<opencv2/core/eigen.hpp>
#define MATRIX1 A1 <<\
273, 639, 1,\
253, 549, 1,\
263, 449, 1,\
343, 459, 1,\
353, 589, 1,\
363, 719, 1,\
303, 459, 1,\
323, 279, 1,\
323, 279, 1,\
323, 199, 1,\
233, 319, 1,\
183, 339, 1,\
263, 279, 1,\
373, 289, 1,\
423, 379, 1,\
413, 409, 1;
#define MATRIX2 A2 <<\
273, 639, 1,\
253, 549, 1,\
263, 449, 1,\
343, 459, 1,\
353, 589, 1,\
363, 719, 1,\
303, 459, 1,\
323, 279, 1,\
323, 279, 1,\
323, 199, 1,\
233, 319, 1,\
183, 339, 1,\
263, 279, 1,\
373, 289, 1,\
423, 379, 1,\
413, 409, 1;
#define VECTOR1 B1 <<\
259,\
240,\
249,\
326,\
345,\
345,\
288,\
288,\
288,\
288,\
192,\
192,\
211,\
345,\
383,\
354;
#define VECTOR2 B2 <<\
754,\
640,\
516,\
516,\
631,\
754,\
516,\
336,\
307,\
241,\
459,\
412,\
336,\
336,\
421,\
440;
using namespace std;
using namespace Eigen;
using namespace cv;
int main()
{
MatrixXd A1(16,3);
MatrixXd A2(16,3);
VectorXd B1(16);
VectorXd B2(16);
MATRIX1;
VECTOR1;
//cout << A1 << endl;
//cout << B1 << endl;
MATRIX2;
VECTOR2;
MatrixXd x_colPivHouseholderQr;
x_colPivHouseholderQr = (A1.colPivHouseholderQr().solve(B1));
std::cout << "The solution X is:\n"
<< x_colPivHouseholderQr << std::endl;
MatrixXd y_colPivHouseholderQr;
y_colPivHouseholderQr = (A2.colPivHouseholderQr().solve(B2));
std::cout << "The solution Y is:\n"
<< y_colPivHouseholderQr << std::endl;
Mat input;
Mat output;
MatrixXd map(2,3);
map <<
0.867, 0.062, -10,
-0.325, 1.037, 147.562;
Mat map2;
eigen2cv(map, map2);
//cout << map2;
input=imread("A.png");
cv::Size src_sz = input.size();
cv::Size dst_sz(src_sz.height, src_sz.width);
//cout << dst_sz << endl;
warpAffine(input, output, map2, dst_sz);
imshow("haha", output);
waitKey();
system("pause");
}