-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathepipolarMatchGUI.m
More file actions
81 lines (59 loc) · 1.27 KB
/
epipolarMatchGUI.m
File metadata and controls
81 lines (59 loc) · 1.27 KB
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
function [coordsIM1, coordsIM2] = epipolarMatchGUI(I1, I2, F)
coordsIM1 = [];
coordsIM2 = [];
[sy,sx]= size(I2);
figure(gcf), clf
h_axes1 = subplot(121);
imshow(I1,[]); hold on
xlabel({'Select a point in this image', '(Right-click when finished)'})
subplot 122
imshow(I2,[]);
xlabel({'Verify that the corresponding point', 'is on the epipolar line in this image'})
while 1
subplot 121
legend('show');
[x y button] = ginput(1);
if (button==3)
break;
end
if(gca~=h_axes1)
subplot 121
title('Please click only in this image')
continue;
else
subplot 121
title('')
end
xc = x;
yc = y;
v(1) = xc;
v(2) = yc;
v(3) = 1;
l = F * v';
s = sqrt(l(1)^2+l(2)^2);
if s==0
error('Zero line vector in displayEpipolar');
end
l = l/s;
if l(1) ~= 0
ye = sy;
ys = 1;
xe = -(l(2) * ye + l(3))/l(1);
xs = -(l(2) * ys + l(3))/l(1);
else
xe = sx;
xs = 1;
ye = -(l(1) * xe + l(3))/l(2);
ys = -(l(1) * xs + l(3))/l(2);
end
plot(x,y, '*', 'MarkerSize', 6, 'LineWidth', 2);
subplot 122
line([xs xe],[ys ye]);
subplot(1,2,2)
hold on;
[x2, y2] = epipolarCorrespondence(I1, I2, F, x, y);
scatter(x2, y2, 10, 'r');
coordsIM1 = [coordsIM1; x,y];
coordsIM2 = [coordsIM2; x2, y2];
end
subplot 121, hold off