-
Notifications
You must be signed in to change notification settings - Fork 93
/
trans_eval.m
87 lines (78 loc) · 2.77 KB
/
trans_eval.m
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
c_h = 1;
%im_h = 512;
%im_w = 1024;
cor_a_x = cor_id(2,1) - im_w/2;
cor_a_y = (im_h - cor_id(2,2))-im_h/2;
cor_a_y_ = (im_h - cor_id(1,2))-im_h/2;
theta_x = 2*pi*cor_a_x/im_w;
theta_y = pi*cor_a_y/im_h;
theta_y_ = pi*cor_a_y_/im_h;
r = abs(cot(theta_y))*c_h;
cor_a_X = r*cos(-theta_x+pi/2);% *ch
cor_a_Z = r*sin(-theta_x+pi/2);% *ch
cor_a_Y_ = r*tan(theta_y_)+c_h;
cor_b_x = cor_id(4,1) - im_w/2;
cor_b_y = (im_h - cor_id(4,2))-im_h/2;
cor_b_y_ = (im_h - cor_id(3,2))-im_h/2;
theta_x = 2*pi*cor_b_x/im_w;
theta_y = pi*cor_b_y/im_h;
theta_y_ = pi*cor_b_y_/im_h;
r = abs(cot(theta_y))*c_h;
cor_b_X = r*cos(-theta_x+pi/2);% *ch
cor_b_Z = r*sin(-theta_x+pi/2);% *ch
cor_b_Y_ = r*tan(theta_y_) +c_h;
cor_c_x = cor_id(6,1) - im_w/2;
cor_c_y = (im_h - cor_id(6,2))-im_h/2;
cor_c_y_ = (im_h - cor_id(5,2))-im_h/2;
theta_x = 2*pi*cor_c_x/im_w;
theta_y = pi*cor_c_y/im_h;
theta_y_ = pi*cor_c_y_/im_h;
r = abs(cot(theta_y))*c_h;
cor_c_X = r*cos(-theta_x+pi/2);% *ch
cor_c_Z = r*sin(-theta_x+pi/2);% *ch
cor_c_Y_ = r*tan(theta_y_) +c_h;
cor_d_x = cor_id(8,1) - im_w/2;
cor_d_y = (im_h - cor_id(8,2))-im_h/2;
cor_d_y_ = (im_h - cor_id(7,2))-im_h/2;
theta_x = 2*pi*cor_d_x/im_w;
theta_y = pi*cor_d_y/im_h;
theta_y_ = pi*cor_d_y_/im_h;
r = abs(cot(theta_y))*c_h;
cor_d_X = r*cos(-theta_x+pi/2);% *ch
cor_d_Z = r*sin(-theta_x+pi/2);% *ch
cor_d_Y_ = r*tan(theta_y_) +c_h;
if 0
cor_e_x = cor_id(10,1) - im_w/2;
cor_e_y = (im_h - cor_id(10,2))-im_h/2;
cor_e_y_ = (im_h - cor_id(9,2))-im_h/2;
theta_x = 2*pi*cor_e_x/im_w;
theta_y = pi*cor_e_y/im_h;
theta_y_ = pi*cor_e_y_/im_h;
r = abs(cot(theta_y))*c_h;
cor_e_X = r*cos(-theta_x+pi/2);% *ch
cor_e_Z = r*sin(-theta_x+pi/2);% *ch
cor_e_Y_ = r*tan(theta_y_) +c_h;
cor_f_x = cor_id(12,1) - im_w/2;
cor_f_y = (im_h - cor_id(12,2))-im_h/2;
cor_f_y_ = (im_h - cor_id(11,2))-im_h/2;
theta_x = 2*pi*cor_f_x/im_w;
theta_y = pi*cor_f_y/im_h;
theta_y_ = pi*cor_f_y_/im_h;
r = abs(cot(theta_y))*c_h;
cor_f_X = r*cos(-theta_x+pi/2);% *ch
cor_f_Z = r*sin(-theta_x+pi/2);% *ch
cor_f_Y_ = r*tan(theta_y_) +c_h;
end
cor_a = [cor_a_X, 0, cor_a_Z];
cor_b = [cor_b_X, 0, cor_b_Z];
cor_c = [cor_c_X, 0, cor_c_Z];
cor_d = [cor_d_X, 0, cor_d_Z];
%cor_e = [cor_e_X, 0, cor_e_Z];
%cor_f = [cor_f_X, 0, cor_f_Z];
box_h = mean([cor_a_Y_, cor_b_Y_, cor_c_Y_, cor_d_Y_]);%, cor_e_Y_, cor_f_Y_]);
cor_a_h = [cor_a_X, box_h, cor_a_Z];
cor_b_h = [cor_b_X, box_h, cor_b_Z];
cor_c_h = [cor_c_X, box_h, cor_c_Z];
cor_d_h = [cor_d_X, box_h, cor_d_Z];
%cor_e_h = [cor_e_X, box_h, cor_e_Z];
%cor_f_h = [cor_f_X, box_h, cor_f_Z];