source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_matcher_script.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.8 KB
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3%torr_matcher_script
4%% to test the Harris corner detector and matcher
5
6clear all
7n_corners = 500;
8
9    i1 = imread('j1.bmp','bmp');
10    i2 = imread('j2.bmp','bmp');
11
12    g1 = rgb2gray(i1);
13    g2 = rgb2gray(i2);
14
15
16
17d1 = double(g1);
18d2 = double(g2);
19
20
21disp('detecting corners');
22[ccr1] = torr_charris(d1,n_corners);
23[ccr2] = torr_charris(d2,n_corners);
24
25
26
27%imshow(c1);
28%figure;
29%imshow(g1);
30%display corners
31%hold on
32%               plot(c_col, c_row, '+');
33%               plot(ccr1(:,1), ccr1(:,2), 'g+');
34%               plot(ccr2(:,1), ccr2(:,2), 'r+');
35%hold off
36
37
38%imshow(c1);
39f1 = figure;
40imshow(g2);
41title('Second Image')
42%display corners
43hold on
44%               plot(c_col, c_row, '+');
45                plot(ccr1(:,1), ccr1(:,2), 'g+');
46                plot(ccr2(:,1), ccr2(:,2), 'r+');
47hold off
48%[matches12,A12] = corn_matcher(c_patches1, c_patches2, ccr1, ccr2);
49max_disparity = 20;
50half_size = 2;
51
52disp('detecting matches')
53[matches12,minc12,mat12] = torr_corn_matcher(d1, d2, ccr1, ccr2,max_disparity,half_size);
54
55max_corn_d = 0; %maximum corner motion
56n_matches = length(matches12);
57
58med_minc = median(minc12);
59
60
61disp('the maximum corner disparity is used for edge matching')
62max_corn_d
63
64
65display_numbers = 0;
66torr_display_matches(matches12,display_numbers,f1);
67
68
69
70
71
72%
73%
74%
75%
76%
77% %displaying stuff
78%
79%
80% figure
81% %take minimum of matches; minc provides match scores
82% imshow(g1);
83% title('First Image: plus matches')
84% hold on
85% plot(ccr1(:,1), ccr1(:,2), 'bs')
86% plot(ccr2(:,1), ccr2(:,2), 'rs')
87%
88% for i = 1:length(mat12)
89%     if mat12(i) ~= 0
90%         a = [ccr1(i,1),ccr2(mat12(i),1)];  %x1 x2
91%         b = [ccr1(i,2),ccr2(mat12(i),2)];     %y1 y2
92%         %x1 y1
93%         %x2 y2
94%         line(a,b);
95%     end
96% end
97% hold off
98%
99% %matches = mat12;
100%
101%
102% hold off
103% save corners
Note: See TracBrowser for help on using the repository browser.