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

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

Added original make3d

File size: 40.9 KB
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3%
4% %designed for the good of the world by Philip Torr based on ideas contained in
5% copyright Philip Torr and Microsoft Corp 2002
6%
7% @inproceedings{Torr93b,
8%         author = "Torr, P. H. S.  and Murray, D. W.",
9%         title  = "Outlier Detection and Motion Segmentation",
10%         booktitle = "Sensor Fusion VI",
11%         editor = "Schenker, P. S.",
12%         publisher = "SPIE volume 2059",
13%         note = "Boston",
14%       pages = {432-443},
15%         year = 1993 }
16%
17%     
18% @phdthesis{Torr:thesis,
19%         author="Torr, P. H. S.",
20%         title="Outlier Detection and Motion Segmentation",
21%         school=" Dept. of  Engineering Science, University of Oxford",
22%         year=1995}
23%
24% @inproceedings{Beardsley96a,
25%          author="Beardsley, P. and Torr, P. H. S. and Zisserman, A.",
26%          title="{3D} Model Aquisition from Extended Image Sequences",
27%          booktitle=eccv4.2,
28%         editor = "Buxton, B. and Cipolla R.",
29%        publisher = "Springer--Verlag",
30%          pages={683--695},
31%          year=1996}
32%
33%
34% @article{Torr97c,
35%         author="Torr, P. H. S.  and Murray, D. W. ",
36%         title="The Development and Comparison of Robust Methods for Estimating the Fundamental Matrix",
37%         journal="IJCV",
38%         volume = 24,
39%         number = 3,
40%         pages = {271--300},
41%         year=1997
42% }
43%
44%
45%
46%
47% @article{Torr99c,
48%         author = "Torr, P. H. S.   and Zisserman, A",
49%         title ="MLESAC: A New Robust Estimator with Application to Estimating Image Geometry ",
50%         journal = "CVIU",
51%         Volume = {78},
52%         number = 1,
53%         pages = {138-156},
54%         year = 2000}
55%
56% %MAPSAC is the Bayesian version of MLESAC, and it is easier to pronounce!
57% it is described in:
58%
59% @article{Torr02d,
60%         author = "Torr, P. H. S.",
61%         title ="Bayesian Model Estimation and  Selection for Epipolar Geometry and
62% Generic Manifold Fitting",
63%         journal = "IJCV",
64%         Volume = {?},
65%         number = ?,
66%         pages = {?},
67%         url = "http://research.microsoft.com/~philtorr/",
68%         year = 2002}
69%
70
71
72
73function varargout = torr_tool(varargin)
74% TORR_TOOL Application M-file for torr_tool.fig
75%    FIG = TORR_TOOL launch torr_tool GUI.
76%    TORR_TOOL('callback_name', ...) invoke the named callback.
77
78% Last Modified by GUIDE v2.0 21-May-2002 17:58:20
79
80
81
82
83if nargin == 0  % LAUNCH GUI
84   
85    fig = openfig(mfilename,'reuse');
86   
87    % Use system color scheme for figure:
88    set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
89   
90    % Generate a structure of handles to pass to callbacks, and store it.
91    handles = guihandles(fig);
92   
93   
94    %phils atuff added, initialization
95    %corner parameters
96    handles.n_corners = 2000; %max no of corners permitted/requested
97   
98    handles.n_corners1 = 0; %the actual number detected
99    handles.n_corners2 = 0;
100   
101    handles.corner_sigma = 1.0;
102    handles.corner_width = 3;
103   
104   
105    %matchin parameters
106    handles.max_disparity = 50;
107    handles.match_half_size = 3;
108   
109   
110    %F parameters:
111    handles.no_samp = 500; % no of samples in the mapsac algorithm
112    handles.f_threshold = 6.0; % f_threshold in the mapsac algorithm
113   
114    %calibration matrix
115    handles.focal_length = 3; %first guess
116    handles.aspect_ratio = 1;
117    handles.ppx =  0;
118    handles.ppy =  0;
119    %work out calibration matrix
120    C = [handles.aspect_ratio 0 handles.ppx; 0 1 handles.ppy; 0 0 1/handles.focal_length];
121    handles.C = C;
122 
123   
124   
125    %informational variables
126    handles.n_matches = 0; %how many matches have we detected.
127   
128   
129    %general parameters
130    %debugt mode
131    handles.debug = 1;
132    handles.m3 = 256; %third homogeous pixel coordinate, chosen as 256 to help conditioning, see my thesis
133    handles.pathname = ['C:\matlabR12\bin\'];
134   
135    if ~handles.debug
136        helpdlg('Phil asks: "how ya diddling", first load some images')
137    end
138   
139   
140    set(handles.save_image1_button, 'Enable', 'off');
141    set(handles.save_image2_button, 'Enable', 'off');
142    set(handles.Save_Images_menu, 'Enable', 'off');
143   
144   
145    %for corners
146    set(handles.detect_corner_button, 'Enable', 'off');
147    set(handles.save_corner_button, 'Enable', 'off');
148    set(handles.load_corner_button, 'Enable', 'on');
149    set(handles.corn_param_button, 'Enable', 'off');
150   
151    %for correlation matches
152    set(handles.match_button, 'Enable', 'off');
153    set(handles.match_param_button, 'Enable', 'on');
154    set(handles.manual_match_button, 'Enable', 'on');
155    set(handles.save_match_button, 'Enable', 'off');   
156    set(handles.load_match_button, 'Enable', 'off');
157   
158    %for F and correlation matches
159    set(handles.mapsac_button, 'Enable', 'off');
160    set(handles.mapsac_parameters_button, 'Enable', 'on');
161    set(handles.save_F_button, 'Enable', 'off');
162    set(handles.display_epipolar_button, 'Enable', 'off');
163    set(handles.display_epipolar_button2, 'Enable', 'off');
164    set(handles.ImproveF_button, 'Enable', 'off');
165   
166    %for SFM
167    set(handles.sfm_button, 'Enable', 'off');
168   
169 
170   
171    guidata(fig, handles);
172   
173    if nargout > 0
174        varargout{1} = fig;
175    end
176   
177elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
178   
179    try
180        [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
181    catch
182        disp(lasterr);
183    end
184   
185end
186
187
188%| ABOUT CALLBACKS:
189%| GUIDE automatically appends subfunction prototypes to this file, and
190%| sets objects' callback properties to call them through the FEVAL
191%| switchyard above. This comment describes that mechanism.
192%|
193%| Each callback subfunction declaration has the following form:
194%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
195%|
196%| The subfunction name is composed using the object's Tag and the
197%| callback type separated by '_', e.g. 'slider2_Callback',
198%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
199%|
200%| H is the callback object's handle (obtained using GCBO).
201%|
202%| EVENTDATA is empty, but reserved for future use.
203%|
204%| HANDLES is a structure containing handles of components in GUI using
205%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
206%| structure is created at GUI startup using GUIHANDLES and stored in
207%| the figure's application data using GUIDATA. A copy of the structure
208%| is passed to each callback.  You can store additional information in
209%| this structure at GUI startup, and you can change the structure
210%| during callbacks.  Call guidata(h, handles) after changing your
211%| copy to replace the stored original so that subsequent callbacks see
212%| the updates. Type "help guihandles" and "help guidata" for more
213%| information.
214%|
215%| VARARGIN contains any extra arguments you have passed to the
216%| callback. Specify the extra arguments by editing the callback
217%| property in the inspector. By default, GUIDE sets the property to:
218%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
219%| Add any extra arguments after the last argument, before the final
220%| closing parenthesis.
221
222
223% --------------------------------------------------------------------
224
225%%get rid f current stuff and do it again!
226function varargout = start_again_button_Callback(h, eventdata, handles, varargin)
227% Stub for Callback of the uicontrol handles.start_again_button.
228clear_button_Callback(h, eventdata, handles, varargin)
229initialize(handles)
230
231
232
233% --------------------------------------------------------------------
234function varargout = frame1_Callback(h, eventdata, handles, varargin)
235% Stub for Callback of the uicontrol handles.frame1.
236disp('frame1 Callback not implemented yet. O great one')
237
238
239%---------------------------------------------------------------------\\\
240
241function menu_OpenImage_Callback(h,eventdata,handles,varargin)
242disp('loading some images your highness')
243
244load_image_button_Callback(h, eventdata, handles, varargin)
245
246%---------------------------------------------------------------------\\\
247
248function menu_SaveImages_Callback(h,eventdata,handles,varargin)
249
250save_image1_button_Callback(h, eventdata, handles, varargin)
251save_image_button2_Callback(h, eventdata, handles, varargin)
252
253%---------------------------------------------------------------------\\\
254
255function menu_display_corners_Callback(h,eventdata,handles,varargin)
256clear_button_Callback(h, eventdata, handles, varargin);
257display_corners_in_figure(handles);
258
259%---------------------------------------------------------------------\\\
260
261function menu_display_c_matches_Callback(h,eventdata,handles,varargin)
262clear_button_Callback(h, eventdata, handles, varargin);
263display_matches(h, eventdata, handles, varargin);
264
265%---------------------------------------------------------------------\\\
266function menu_display_i_matches_Callback(h,eventdata,handles,varargin)
267clear_button_Callback(h, eventdata, handles, varargin);
268display_inliers(h, eventdata, handles, varargin);
269
270%---------------------------------------------------------------------\\\
271function menu_display_io_matches_Callback(h,eventdata,handles,varargin)
272clear_button_Callback(h, eventdata, handles, varargin);
273display_matches(h, eventdata, handles, varargin);
274display_inliers(h, eventdata, handles, varargin);
275%---------------------------------------------------------------------\\\
276
277% --------------------------------------------------------------------
278function display_corners_in_figure(handles)
279
280% extracting the handle of the axes in which to display the image
281ax_handle2 = handles.axes2;
282ax_handle3 = handles.axes3;
283ccr1 = handles.ccr1;
284ccr2 = handles.ccr2;
285
286axes(ax_handle2);
287hold on
288axes(ax_handle3);
289hold on
290%               plot(c_col, c_row, '+');
291plot(ccr1(:,1), ccr1(:,2), 'g+','Parent', ax_handle2);
292plot(ccr2(:,1), ccr2(:,2), 'r+','Parent', ax_handle3);
293
294
295axes(ax_handle2);       
296hold off
297axes(ax_handle3);       
298hold off
299
300
301
302% --------------------------------------------------------------------
303function varargout = detect_corner_button_Callback(h, eventdata, handles, varargin)
304% Stub for Callback of the uicontrol handles.pushbutton3.
305disp('Calculating corners.')
306
307[ccr1] = torr_charris(handles.d1,handles.n_corners,handles.corner_width,handles.corner_sigma);
308[ccr2] = torr_charris(handles.d2,handles.n_corners,handles.corner_width,handles.corner_sigma);
309
310
311%normalize so that the centre of the image is the origin...
312ccr1(:,1) = ccr1(:,1) - handles.image_centrex;
313ccr1(:,2) = ccr1(:,2) - handles.image_centrey;
314ccr2(:,1) = ccr2(:,1) - handles.image_centrex;
315ccr2(:,2) = ccr2(:,2) - handles.image_centrey;
316
317handles.ccr1 = ccr1;
318handles.ccr2 = ccr2;
319handles.n_corners1 = length(ccr1);
320handles.n_corners2 = length(ccr2);
321
322display_corners_in_figure(handles)
323
324set(handles.save_corner_button, 'Enable', 'on');
325set(handles.match_button, 'Enable', 'on');
326set(handles.match_param_button, 'Enable', 'on');
327% set(handles.manual_match_button, 'Enable', 'on');
328
329
330
331guidata(handles.figure1, handles);
332% --------------------------------------------------------------------
333
334
335%here is phil's code to get a file, it uses the warning dialog
336%it has not been properly tested
337function [filename, pathname] = uigetfile_name(filer,message)
338
339[filename, pathname] = uigetfile(filer,message)
340if isequal(filename,0)|isequal(pathname,0)
341    %recurse
342    [filename, pathname] = uigetfile_name(filer,message);
343else
344    disp(['File ', pathname, filename, ' found'])
345end
346
347
348
349% --------------------------------------------------------------------
350function [filename, pathname] = uiputfile_name(filer,message)
351
352[filename, pathname] = uiputfile(filer,message)
353if isequal(filename,0)|isequal(pathname,0)
354    [filename, pathname] = uiputfile_name(filer,message);
355else
356    disp(['File ', pathname, filename, ' has been saved'])
357end
358
359
360
361
362% --------------------------------------------------------------------
363function varargout = load_demo_image_button_Callback(h, eventdata, handles, varargin)
364% Stub for Callback of the uicontrol handles.pushbutton5.
365% [filename, pathname] = uigetfile_name('*.bmp;*.jpg;*.gif','Pick an input image')
366%     [i1,map1] = imread([pathname filename]);
367%     
368%     [filename, pathname] = uigetfile_name('*.bmp;*.jpg;*.gif','Pick a second input image')
369%     [i2,map2] = imread([pathname filename]);
370
371pathname1 = ['.\'];
372pathname2 = ['.\'];
373filename1=['j1.bmp'];
374filename2=['j2.bmp'];
375
376
377load_2images(h, eventdata, handles, varargin, filename1, pathname1,filename2, pathname2);
378
379%---------------------------------------------------------------------\\\
380
381
382function varargout = load_2images(h, eventdata, handles, varargin, ...
383    filename1, pathname1,filename2, pathname2)
384
385
386if pathname1 == pathname2
387    handles.pathname = pathname1;
388else
389    errordlg(['The two images should be in the same directory:' pathname1 pathname2],'not fatal');
390    handles.pathname = pathname1;
391end
392
393
394
395
396[i1,map1] = imread([pathname1 filename1]);
397[i2,map2] = imread([pathname2 filename2]);
398
399
400iii =  size(size(i1));
401if iii(2) == 3
402    g1 = rgb2gray(i1);
403    disp('converting to rgb');
404else
405    g1 = i1;
406end
407
408
409iii =  size(size(i2));
410if iii(2) == 3
411    g2 = rgb2gray(i2);
412else
413    g2 = i2;
414end
415
416
417%if we successfully load:
418set(handles.detect_corner_button, 'Enable', 'on');
419set(handles.load_corner_button, 'Enable', 'on');
420set(handles.corn_param_button, 'Enable', 'on');
421
422set(handles.save_image1_button, 'Enable', 'on');       
423set(handles.save_image2_button, 'Enable', 'on');
424
425set(handles.Save_Images_menu, 'Enable', 'on');
426
427set(handles.manual_match_button, 'Enable', 'on');
428set(handles.load_match_button, 'Enable', 'on');
429
430
431
432
433d1 = double(g1);
434d2 = double(g2);
435
436% extracting the handle of the axes in which to display the image
437ax_handle2 = handles.axes2;
438axes(ax_handle2);
439
440set(get(ax_handle2, 'Title'), 'Visible', 'off');
441set(get(ax_handle2, 'Title'),'String', 'fff');
442
443[m,n] = size(d1);
444[m1,n1] = size(d2);
445if (m ~= m1) | (n ~= n1)
446    error('images must be the same size')
447end
448
449axis equal;
450colormap(map1);
451image(i1, 'Parent', ax_handle2,'XData',-n/2,'YData',-m/2);
452%  imshow(i1, 'Parent', ax_handle2);
453
454ax_handle3 = handles.axes3;
455axes(ax_handle3);
456colormap(map1);
457image(i2, 'Parent', ax_handle3,'XData',-n/2,'YData',-m/2);
458
459handles.image_centrex = n/2;
460handles.image_centrey = m/2;
461
462
463handles.i1 = i1;
464handles.i2 = i2;
465handles.d1 = d1;
466handles.d2 = d2;
467handles.pathname = pathname1;
468
469% saving the GUI data
470guidata(handles.figure1, handles);
471%---------------------------------------------------------------------\\\
472
473
474% --------------------------------------------------------------------
475function varargout = load_image_button_Callback(h, eventdata, handles, varargin)
476% Stub for Callback of the uicontrol handles.pushbutton5.
477[filename1, pathname1] = uigetfile_name('*.bmp;*.jpg;*.gif','Pick an input image')
478
479[filename2, pathname2] = uigetfile_name('*.bmp;*.jpg;*.gif','Pick a second input image')
480
481load_2images(h, eventdata, handles, varargin, filename1, pathname1,filename2, pathname2);
482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
483
484
485
486% --------------------------------------------------------------------
487function varargout = clear_button_Callback(h, eventdata, handles, varargin)
488% Stub for Callback of the uicontrol handles.pushbutton6.
489
490
491% extracting the handle of the axes in which to display the image
492ax_handle2 = handles.axes2;
493axes(ax_handle2);
494
495set(get(ax_handle2, 'Title'), 'Visible', 'off');
496set(get(ax_handle2, 'Title'),'String', 'fff');
497
498hold off
499image(handles.i1, 'Parent', ax_handle2,'XData',-handles.image_centrex,'YData',-handles.image_centrey);
500%  imshow(i1, 'Parent', ax_handle2);
501
502
503
504ax_handle3 = handles.axes3;
505axes(ax_handle3);
506hold off
507image(handles.i2, 'Parent', ax_handle3,'XData',-handles.image_centrex,'YData',-handles.image_centrey);
508
509
510
511
512% --------------------------------------------------------------------
513function varargout = close_button_Callback(h, eventdata, handles, varargin)
514% Stub for Callback of the uicontrol handles.close_button.
515pos_size = get(handles.figure1,'Position');
516user_response = modaldlg([pos_size(1)+pos_size(3)/5 pos_size(2)+pos_size(4)/5]);
517switch user_response
518case {'no','cancel'}
519    % take no action
520case 'yes'
521    % Prepare to close GUI application window
522    %                  .
523    %                  .
524    %                  .
525    delete(handles.figure1)
526end
527
528
529
530% --------------------------------------------------------------------
531function varargout = help_button_Callback(h, eventdata, handles, varargin)
532% Stub for Callback of the uicontrol handles.help_button.
533HelpPath = which('stereo.htm');
534web(HelpPath);
535
536
537% --------------------------------------------------------------------
538function varargout = corn_param_button_Callback(h, eventdata, handles, varargin)
539% Stub for Callback of the uicontrol handles.corn_param_button.
540
541pos_size = get(handles.figure1,'Position');
542dlg_pos = [pos_size(1)+pos_size(3)/5 pos_size(2)+pos_size(4)/5];
543corn_param = torr_c_menu(handles, dlg_pos);
544
545handles.n_corners = corn_param(1);
546handles.corner_sigma = corn_param(2);
547handles.corner_width = corn_param(3);
548corn_param
549% saving the GUI data
550guidata(handles.figure1, handles);
551%---------------------------------------------------------------------\\\
552
553function save_corners_to_file(n_corners1, n_corners2, ccr1, ccr2, FID)
554
555
556fprintf(FID,'%1.0f \n',n_corners1);
557fprintf(FID,'%1.0f \n',n_corners2);
558
559fprintf(FID,'%1.1f %1.1f \n',ccr1');
560fprintf(FID,'%1.1f %1.1f \n',ccr2');
561
562
563% --------------------------------------------------------------------
564function varargout = save_corner_button_Callback(h, eventdata, handles, varargin)
565% Stub for Callback of the uicontrol handles.save_corner_button.
566[fname,pname] = uiputfile_name('*.cor','Put Corner File');
567ccr1 = handles.ccr1;
568ccr2 = handles.ccr2;
569
570%save([pname fname], 'n_corners', 'ccr1', 'ccr2', '-ASCII')
571FID = fopen([pname fname],'w');
572
573n_corners1 = handles.n_corners1;
574n_corners2 = handles.n_corners2;
575
576save_corners_to_file(n_corners1, n_corners2, ccr1, ccr2, FID)
577
578fclose(FID);
579
580% --------------------------------------------------------------------
581
582function [n_corners1, n_corners2, ccr1, ccr2] = load_corners_from_file(FID)
583
584n_corners1 = fscanf(FID,'%f',1);
585n_corners2 = fscanf(FID,'%f',1);
586ccr1  = fscanf(FID,'%f %f',[2 n_corners1]);
587ccr2  = fscanf(FID,'%f %f',[2 n_corners2]);
588
589% --------------------------------------------------------------------
590
591
592function varargout = load_corner_button_Callback(h, eventdata, handles, varargin)
593% Stub for Callback of the uicontrol handles.load_corner_button.
594[fname,pname] = uigetfile_name('*.cor','Load Corner File');
595
596if isempty(fname)
597    return
598end
599
600FID = fopen([pname fname]);
601
602[n_corners1, n_corners2, ccr1, ccr2] = load_corners_from_file(FID);
603handles.n_corners1 = n_corners1;
604handles.n_corners2 = n_corners2;
605handles.ccr1 = ccr1';
606handles.ccr2 = ccr2';
607
608
609
610fclose(FID);
611set(handles.save_corner_button, 'Enable', 'on');
612set(handles.match_button, 'Enable', 'on');
613set(handles.match_param_button, 'Enable', 'on');
614
615%once we have done the matches we can no longer redo corners otherwise things might be inconsistent
616set(handles.detect_corner_button, 'Enable', 'off');
617% saving the GUI data
618guidata(handles.figure1, handles);
619
620clear_button_Callback(h, eventdata, handles, varargin);
621display_corners_in_figure(handles)
622%---------------------------------------------------------------------\\\
623
624
625
626% --------------------------------------------------------------------
627function varargout = match_button_Callback(h, eventdata, handles, varargin)
628% Stub for Callback of the uicontrol handles.match_button.
629
630
631%shift the x,y coordinates so we can access the image directly
632ccr1(:,1) = handles.ccr1(:,1) + handles.image_centrex;
633ccr1(:,2) = handles.ccr1(:,2) + handles.image_centrey;
634ccr2(:,1) = handles.ccr2(:,1) + handles.image_centrex;
635ccr2(:,2) = handles.ccr2(:,2) + handles.image_centrey;
636
637matches12 = torr_corn_matcher(handles.d1, handles.d2, ccr1, ccr2, handles.max_disparity,handles.match_half_size);
638
639disp('Number of matches:')
640length(matches12)
641
642matches12(:,1) = matches12(:,1) - handles.image_centrex;
643matches12(:,2) = matches12(:,2) - handles.image_centrey;
644matches12(:,3) = matches12(:,3) - handles.image_centrex;
645matches12(:,4) = matches12(:,4) - handles.image_centrey;
646
647
648handles.matches12 = matches12;
649handles.n_matches = length(matches12);
650
651
652set(handles.save_match_button, 'Enable', 'on');   
653
654set(handles.mapsac_button, 'Enable', 'on');
655set(handles.mapsac_parameters_button, 'Enable', 'on');
656
657%once we have done the matches we can no longer redo corners otherwise things might be inconsistent
658set(handles.detect_corner_button, 'Enable', 'off');
659
660
661guidata(handles.figure1, handles);
662display_matches(h, eventdata, handles, varargin);
663% --------------------------------------------------------------------
664function varargout = display_matches(h, eventdata, handles, varargin)
665% extracting the handle of the axes in which to display the image
666ax_handle2 = handles.axes2;
667ax_handle3 = handles.axes3;
668
669ccr1 = handles.ccr1;
670ccr2 = handles.ccr2;
671matches= handles.matches12;
672axes(ax_handle2);
673hold on
674axes(ax_handle3);
675hold on
676
677
678
679x1 = matches(:,1);
680y1 = matches(:,2);
681x2 = matches(:,3);
682y2 = matches(:,4);
683
684u1 = x2 - x1;
685v1 = y2 - y1;
686
687
688
689plot (matches(:,1), matches(:,2),'r+');
690hold on
691plot (matches(:,3), matches(:,4),'r+');
692
693display_numbers = 0;
694if display_numbers
695    mat_index1 = 1:length(matches);
696    mat_index1 = mat_index1';
697    mat_index = num2str(mat_index1);
698    text(matches(:,1), matches(:,2),mat_index)
699end
700
701quiver(x1, y1, u1, v1, 0)
702hold off
703
704%
705% plot(ccr1(:,1), ccr1(:,2), 'r.')
706% plot(ccr2(:,1), ccr2(:,2), 'c.')
707%
708% for i = 1:length(mat12)
709%     if mat12(i) ~= 0
710%         a = [ccr1(i,1),ccr2(mat12(i),1)];  %x1 x2
711%         b = [ccr1(i,2),ccr2(mat12(i),2)];     %y1 y2
712%         %x1 y1
713%         %x2 y2
714%         line(a,b);
715%     end
716% end
717
718axes(ax_handle2);       
719hold off
720axes(ax_handle3);       
721hold off
722
723% --------------------------------------------------------------------
724function varargout = match_param_button_Callback(h, eventdata, handles, varargin)
725
726
727pos_size = get(handles.figure1,'Position');
728dlg_pos = [pos_size(1)+pos_size(3)/5 pos_size(2)+pos_size(4)/5];
729match_param = torr_m_menu(handles, dlg_pos);
730
731handles.max_disparity = match_param(1);
732handles.match_half_size = match_param(2);
733% saving the GUI data
734guidata(handles.figure1, handles);
735%---------------------------------------------------------------------
736% --------------------------------------------------------------------
737function varargout = save_image1_button_Callback(h, eventdata, handles, varargin)
738% Stub for Callback of the uicontrol handles.save_image1_button.
739ax_handle2 = handles.axes2;
740%ax_handle3 = handles.axes3;
741% hf1 = figure;
742% %plot(sin(1:10));
743%hf2 = figure;
744%ha = findobj('Parent',hf1);
745% ax_handle2 = handles.axes2;
746% new_axes = axes(ax_handle2);
747% set(new_axes, 'Parent', hf1);
748%
749% [fname,pname] = uiputfile('*.fig');
750% saveas(ax_handle2,[pname fname ]);
751%hgsave(ax_handle2,[pname fname ]);
752
753new_fig = figure;
754new_axes = copyobj(ax_handle2,new_fig)
755%set(new_axes,'Position',[.5 .5 .8 .8],'DataAspectRatioMode','auto','PlotBoxAspectRatioMode','auto');
756
757%get(new_axes)
758axis_position = get(new_axes,'Position');
759set(new_axes,'Position',[10 7  axis_position(3) axis_position(4) ]);
760%keyboard
761
762% fff = handles.figure1;
763% saveas(fff,'bigfig.bmp');
764
765% --------------------------------------------------------------------
766function varargout = save_image2_button_Callback(h, eventdata, handles, varargin)
767% Stub for Callback of the uicontrol handles.save_image2_button.
768ax_handle3 = handles.axes3;
769
770% [fname,pname] = uiputfile('*.fig');
771% saveas(ax_handle3,[pname fname ]);
772%hgsave(ax_handle3,[pname fname ]);
773
774new_fig = figure;
775new_axes = copyobj(ax_handle3,new_fig)
776%set(new_axes,'Position',[.5 .5 .8 .8],'DataAspectRatioMode','auto','PlotBoxAspectRatioMode','auto');
777
778%get(new_axes)
779axis_position = get(new_axes,'Position');
780set(new_axes,'Position',[10 7  axis_position(3) axis_position(4) ]);
781%keyboard
782
783
784% --------------------------------------------------------------------
785function varargout = manual_match_button_Callback(h, eventdata, handles, varargin)
786% Stub for Callback of the uicontrol handles.manual_match_button.
787
788
789set(handles.save_match_button, 'Enable', 'on');   
790set(handles.load_match_button, 'Enable', 'on');
791
792matches12 = torr_add_manual_matches(handles.axes2,handles.axes3);
793
794handles.matches12 = matches12;
795handles.n_matches = length(matches12);
796
797%also store corners
798ccr1(:,1) = matches12(:,1);
799ccr1(:,2) = matches12(:,2);
800ccr2(:,1) = matches12(:,3);
801ccr2(:,2) = matches12(:,4);
802handles.ccr1 = ccr1;
803handles.ccr2 = ccr2;
804
805%once we have done the matches we can no longer redo corners otherwise things might be inconsistent
806set(handles.detect_corner_button, 'Enable', 'off');
807
808
809guidata(handles.figure1, handles);
810display_matches(h, eventdata, handles, varargin);
811
812if handles.n_matches > 7;
813    set(handles.mapsac_button, 'Enable', 'on');
814    set(handles.mapsac_parameters_button, 'Enable', 'on');
815    set(handles.ImproveF_button, 'Enable', 'on');
816end
817
818
819
820% --------------------------------------------------------------------
821function varargout = save_match_button_Callback(h, eventdata, handles, varargin)
822% Stub for Callback of the uicontrol handles.save_corner_button.
823[fname,pname] = uiputfile_name('*.matches','Put Match File');
824
825n_matches = handles.n_matches;
826matches12 = handles.matches12;
827
828%save([pname fname], 'n_corners', 'ccr1', 'ccr2', '-ASCII')
829FID = fopen([pname fname],'w');
830fprintf(FID,'%1.0f \n',n_matches);
831fprintf(FID,'%1.1f %1.1f %1.1f %1.1f  \n',matches12');
832
833%now store original corners for good measure:
834n_corners = handles.n_corners;
835ccr1 = handles.ccr1;
836ccr2 = handles.ccr2;
837n_corners1 = handles.n_corners1;
838n_corners2 = handles.n_corners2;
839save_corners_to_file(n_corners1, n_corners2, ccr1, ccr2, FID);
840fclose(FID);
841
842
843% --------------------------------------------------------------------
844function varargout = load_match_button_Callback(h, eventdata, handles, varargin)
845% Stub for Callback of the uicontrol handles.load_match_button.
846% Stub for Callback of the uicontrol handles.load_corner_button.
847[fname,pname] = uigetfile_name('*.matches','Load Match File');
848
849if isempty(fname)
850    return
851end
852
853FID = fopen([pname fname]);
854n_matches = fscanf(FID,'%f',1)
855handles.n_matches = n_matches;
856matches12  = fscanf(FID,'%f %f %f %f',[4 n_matches]);
857
858[n_corners1, n_corners2, ccr1, ccr2] = load_corners_from_file(FID);
859handles.n_corners1 = n_corners1;
860handles.n_corners2 = n_corners2;
861handles.ccr1 = ccr1';
862handles.ccr2 = ccr2';
863
864fclose(FID);
865
866handles.matches12 = matches12';
867
868set(handles.save_corner_button, 'Enable', 'on');
869set(handles.save_match_button, 'Enable', 'on');
870set(handles.match_button, 'Enable', 'on');
871set(handles.match_param_button, 'Enable', 'on');
872
873% Stub for Callback of the uicontrol handles.pushbutton28.
874set(handles.mapsac_button, 'Enable', 'on');
875set(handles.mapsac_parameters_button, 'Enable', 'on');
876
877
878
879% saving the GUI data
880guidata(handles.figure1, handles);
881clear_button_Callback(h, eventdata, handles, varargin)
882display_matches(h, eventdata, handles, varargin)
883
884
885
886% --------------------------------------------------------------------
887function varargout = display_inliers(h, eventdata, handles, varargin)
888% extracting the handle of the axes in which to display the image
889ax_handle2 = handles.axes2;
890ax_handle3 = handles.axes3;
891
892ccr1 = handles.ccr1;
893ccr2 = handles.ccr2;
894axes(ax_handle2);
895hold on
896axes(ax_handle3);
897hold on
898
899
900matches12 = handles.inlier_matches;
901plot(matches12(:,3),matches12(:,4),'c.');
902
903for i = 1:length(matches12)
904    a = [matches12(i,1),matches12(i,3)];  %x1 x2
905    b = [matches12(i,2),matches12(i,4)];        %y1 y2
906    line(a,b,'Color','g');
907end
908
909axes(ax_handle2);
910hold on
911
912plot(matches12(:,3),matches12(:,4),'c.');
913
914%can i fix this to make this faster??
915for i = 1:length(matches12)
916    a = [matches12(i,1),matches12(i,3)];  %x1 x2
917    b = [matches12(i,2),matches12(i,4)];        %y1 y2
918    line(a,b,'Color','g');
919end
920
921axes(ax_handle2);       
922hold off
923axes(ax_handle3);       
924hold off
925
926%MAPSAC is the Bayesian version of MLESAC, and it is easier to pronounce!
927% --------------------------------------------------------------------
928function varargout = mapsac_button_Callback(h, eventdata, handles, varargin)
929% Stub for Callback of the uicontrol handles.mapsac_button.
930
931
932%run mapsac to get f
933f_optim_parameters = [handles.no_samp, handles.f_threshold];
934[f,f_sq_errors, n_inliers,inlier_index] = torr_estimateF(handles.matches12, handles.m3, f_optim_parameters, 'mapsac');
935disp('goodness of fit before non linear:')
936norm(f_sq_errors)
937
938
939handles.f = f;
940handles.inlier_matches = handles.matches12(inlier_index,:);
941handles.n_inliers  = n_inliers;
942
943%first estimate F
944[f_nl,f_sq_errors] = torr_estimateF(handles.inlier_matches, handles.m3, [], 'non_linear',1,f);
945handles.f = f_nl;
946disp('goodness of fit after non linear:')
947norm(f_sq_errors)
948
949%finally display inliers
950clear_button_Callback(h, eventdata, handles, varargin);
951display_inliers(h, eventdata, handles, varargin);
952
953%we can now save the result
954set(handles.save_F_button, 'Enable', 'on');
955set(handles.detect_corner_button, 'Enable', 'off');
956set(handles.match_button, 'Enable', 'off');
957set(handles.display_epipolar_button, 'Enable', 'on');
958set(handles.display_epipolar_button2, 'Enable', 'on');
959%set(handles.mapsac_plane_button, 'Enable', 'on');
960
961set(handles.ImproveF_button, 'Enable', 'on');
962set(handles.sfm_button, 'Enable', 'on');
963
964
965% saving the GUI data
966guidata(handles.figure1, handles);
967
968% --------------------------------------------------------------------
969function varargout = mapsac_parameters_button_Callback(h, eventdata, handles, varargin)
970
971pos_size = get(handles.figure1,'Position');
972dlg_pos = [pos_size(1)+pos_size(3)/5 pos_size(2)+pos_size(4)/5];
973f_param = torr_f_menu(handles, dlg_pos);
974
975handles.no_samp = f_param(1);
976handles.f_threshold = f_param(2);
977% saving the GUI data
978guidata(handles.figure1, handles);
979%--------------------------------------------------------------
980
981
982%here we save all the stuff in corner file, match file and add some extras....
983% --------------------------------------------------------------------
984function varargout = save_F_button_Callback(h, eventdata, handles, varargin)
985[fname,pname] = uiputfile_name('*.Fmatches','Put F & inlying matches');
986
987
988f = handles.f;
989inlier_matches = handles.inlier_matches;
990n_inliers = handles.n_inliers;
991
992n_matches = handles.n_matches;
993matches12 = handles.matches12;
994f = handles.f;
995f
996
997FID = fopen([pname fname],'w');
998
999%save F stuff
1000fprintf(FID,'%1.0f \n',n_inliers);
1001fprintf(FID,'%12.8f \n', f);
1002fprintf(FID,'%1.1f %1.1f %1.1f %1.1f  \n',inlier_matches');
1003
1004
1005%save correlation matches
1006fprintf(FID,'%1.0f \n',n_matches);
1007fprintf(FID,'%1.1f %1.1f %1.1f %1.1f  \n',matches12');
1008
1009%now store original corners for good measure:
1010n_corners = handles.n_corners;
1011ccr1 = handles.ccr1;
1012ccr2 = handles.ccr2;
1013n_corners1 = handles.n_corners1;
1014n_corners2 = handles.n_corners2;
1015save_corners_to_file(n_corners1, n_corners2, ccr1, ccr2, FID);
1016fclose(FID);
1017
1018
1019% --------------------------------------------------------------------
1020function varargout = load_F_button_Callback(h, eventdata, handles, varargin)
1021% Stub for Callback of the uicontrol handles.pushbutton28.
1022
1023
1024[fname,pname] = uigetfile_name('*.fmatches','Load Match File');
1025if isempty(fname)
1026    return
1027end
1028
1029
1030%set(handles.mapsac_plane_button, 'Enable', 'on');
1031set(handles.mapsac_button, 'Enable', 'on');
1032set(handles.mapsac_parameters_button, 'Enable', 'on');
1033set(handles.save_F_button, 'Enable', 'on');
1034
1035set(handles.ImproveF_button, 'Enable', 'on');
1036
1037set(handles.sfm_button, 'Enable', 'on');
1038
1039
1040FID = fopen([pname fname]);
1041
1042
1043%save F stuff
1044n_inliers = fscanf(FID,'%f',1);
1045f = fscanf(FID,'%f',[1 9]);
1046inlier_matches = fscanf(FID,'%f %f %f %f',[4 n_inliers]);
1047
1048disp('fundamental matrix')
1049handles.f = f
1050handles.inlier_matches = inlier_matches';
1051handles.n_inliers  = n_inliers;
1052
1053
1054
1055n_matches = fscanf(FID,'%f',1);
1056handles.n_matches = n_matches;
1057matches12  = fscanf(FID,'%f %f %f %f',[4 n_matches]);
1058
1059[n_corners1, n_corners2, ccr1, ccr2] = load_corners_from_file(FID);
1060handles.n_corners1 = n_corners1;
1061handles.n_corners2 = n_corners2;
1062handles.ccr1 = ccr1';
1063handles.ccr2 = ccr2';
1064
1065
1066
1067fclose(FID);
1068
1069
1070handles.matches12 = matches12';
1071
1072set(handles.save_corner_button, 'Enable', 'on');
1073set(handles.save_match_button, 'Enable', 'on');
1074set(handles.match_button, 'Enable', 'on');
1075set(handles.match_param_button, 'Enable', 'on');
1076set(handles.detect_corner_button, 'Enable', 'off');
1077set(handles.match_button, 'Enable', 'off');
1078set(handles.display_epipolar_button, 'Enable', 'on');
1079set(handles.display_epipolar_button2, 'Enable', 'on');
1080
1081
1082% Stub for Callback of the uicontrol handles.pushbutton28.
1083set(handles.mapsac_button, 'Enable', 'on');
1084set(handles.mapsac_parameters_button, 'Enable', 'on');
1085%we can now save the result
1086set(handles.save_F_button, 'Enable', 'on');
1087
1088
1089
1090% saving the GUI data
1091guidata(handles.figure1, handles);
1092clear_button_Callback(h, eventdata, handles, varargin)
1093%display_matches(h, eventdata, handles, varargin)
1094
1095%finally display inliers
1096display_inliers(h, eventdata, handles, varargin);
1097%%%----------------------------------------------------------------------------------
1098%%%%this is not 100% checked....
1099function varargout = display_epipolar_button_Callback(h, eventdata, handles, varargin)
1100
1101torr_display_epipolar(handles.f,handles.axes2,handles.axes3,handles.m3);
1102
1103
1104%%%----------------------------------------------------------------------------------
1105
1106function varargout = display_epipolar_button2_Callback(h, eventdata, handles, varargin)
1107f = handles.f;
1108
1109%need to use the transpose of F for image 2--1
1110f = [f(1) f(4) f(7) f(2) f(5) f(8) f(3) f(6) f(9)];
1111torr_display_epipolar(f,handles.axes3,handles.axes2,handles.m3);
1112
1113
1114%%%----------------------------------------------------------------------------------
1115
1116
1117
1118% --------------------------------------------------------------------
1119function varargout = mapsac_plane_button_Callback(h, eventdata, handles, varargin)
1120% Stub for Callback of the uicontrol handles.mapsac_plane_button.
1121% Stub for Callback of the uicontrol handles.mapsac_button.
1122
1123
1124%run mapsac to get f
1125[f,f_sq_errors, n_inliers,inlier_index] = torr_mapsac_H(handles.matches12(:,1),handles.matches12(:,2),handles.matches12(:,3),handles.matches12(:,4), ...
1126    handles.n_matches, handles.m3, handles.no_samp, handles.f_threshold)
1127
1128handles.f = f;
1129handles.inlier_matches = handles.matches12(inlier_index,:);
1130handles.n_inliers  = n_inliers;
1131
1132%finally display inliers
1133clear_button_Callback(h, eventdata, handles, varargin);
1134display_inliers(h, eventdata, handles, varargin);
1135
1136%we can now save the result
1137set(handles.save_F_button, 'Enable', 'on');
1138set(handles.detect_corner_button, 'Enable', 'off');
1139set(handles.match_button, 'Enable', 'off');
1140set(handles.display_epipolar_button, 'Enable', 'on');
1141set(handles.display_epipolar_button2, 'Enable', 'on');
1142
1143
1144% saving the GUI data
1145guidata(handles.figure1, handles);
1146
1147
1148
1149
1150% --------------------------------------------------------------------
1151function varargout = ImproveF_button_Callback(h, eventdata, handles, varargin)
1152% Stub for Callback of the uicontrol handles.ImproveF_button.
1153
1154%this function simply operates on the set of matches with no robustness
1155%to be used with manual input etc...
1156handles.m3 = 256;
1157
1158%first estimate F
1159f = torr_estimateF(handles.matches12, handles.m3, [], 'lin+non_lin');
1160handles.f = f;
1161
1162
1163%we can now save the result
1164set(handles.save_F_button, 'Enable', 'on');
1165set(handles.detect_corner_button, 'Enable', 'off');
1166set(handles.match_button, 'Enable', 'off');
1167set(handles.display_epipolar_button, 'Enable', 'on');
1168set(handles.display_epipolar_button2, 'Enable', 'on');
1169%set(handles.mapsac_plane_button, 'Enable', 'on');
1170
1171set(handles.ImproveF_button, 'Enable', 'on');
1172set(handles.sfm_button, 'Enable', 'on');
1173
1174% saving the GUI data
1175guidata(handles.figure1, handles);
1176
1177
1178% --------------------------------------------------------------------
1179
1180
1181% --------------------------------------------------------------------
1182function varargout = sfm_button_Callback(h, eventdata, handles, varargin)
1183%this function estalishes the frame, self calibrates and estimates X
1184
1185
1186f = handles.f;
1187nF = [[f(1) f(2) f(3)]; [f(4) f(5) f(6)];[f(7) f(8) f(9)]];
1188
1189nx1 = handles.inlier_matches(:,1);
1190ny1 = handles.inlier_matches(:,2);
1191nx2 = handles.inlier_matches(:,3);
1192ny2 = handles.inlier_matches(:,4);
1193no_matches = length(nx1);
1194m3 = handles.m3;
1195
1196%next self calibrate for focal length
1197[focal_length, nE,C] = torr_self_calib_f(nF,handles.C);
1198
1199%
1200disp('initial estimate of focal length')
1201focal_length
1202
1203%now we have an Essential matrix we can establish the camera frame...
1204[P1,P2,R,t,srot_axis,rot_angle,g]  = torr_linear_EtoPX(nE,handles.inlier_matches,C,handles.m3);
1205
1206% %next convert the 6 parameters of g to a fundamental matrix
1207% f2 = torr_g2F(g,C);
1208
1209[g,f] = torr_nonlinG(g ,nx1,ny1,nx2,ny2, length(nx1), handles.m3, C)
1210
1211rot_axis = torr_sphere2unit([g(2) g(3)]);
1212t = torr_sphere2unit([g(5) g(6)]);
1213rot_angle = g(4);
1214
1215disp('non_linear estimate of focal length')
1216focal_length
1217disp('rotation')
1218R
1219rot_axis
1220rot_angle
1221disp('translation')
1222t
1223
1224%next correct the points so that they lie on the fundamental matrix
1225[corrected_matches error2] = torr_correctx4F(f, nx1,ny1,nx2,ny2, no_matches, m3);
1226
1227%corrected matches should have zero error:
1228e2 = torr_errf2(f, corrected_matches(:,1), corrected_matches(:,2), corrected_matches(:,3),corrected_matches(:,4), length(nx1), m3);
1229disp('corrected match error is')
1230norm(e2)
1231
1232%next we need to obtain P1 & P2
1233[P1, P2] = torr_g2FP(g,C);
1234
1235%now use P matrices and corrected matches to get structure:
1236X = torr_triangulate(corrected_matches, m3, P1, P2);
1237
1238%note structure is upside down!
1239
1240%test reprojection error
1241% rx1 = (P1 * X)';
1242%
1243% rx1(:,1) = m3 * rx1(:,1) ./ rx1(:,3);
1244% rx1(:,2) = m3 * rx1(:,2) ./ rx1(:,3);
1245%
1246% rx2 = P2 * X;
1247
1248inlier_index = torr_robust_chieral(X,P1,P2);
1249
1250disp('number of outliers from chierality:')
1251no_matches - length(inlier_index)
1252
1253X = X(:,inlier_index);
1254%flash up a new window and display the structure plus cameras:
1255%invert = 1;
1256
1257% note becuase of row/column coordinate system of the image the X's are upside down so invert them prior
1258% to display.
1259X(2,:) = -X(2,:);
1260torr_display_structure(X, P1, P2);
1261X(2,:) = -X(2,:);
1262
1263
1264handles.P1 = P1;
1265handles.P2 = P2;
1266handles.X = X;
1267handles.inlier_matches = handles.inlier_matches(inlier_index,:);
1268handles.focal_length = focal_length;
1269handles.E = nE;
1270handles.C = C;
1271handles.f = f;
1272handles.n_matches = no_matches;
1273
1274% saving the GUI data
1275guidata(handles.figure1, handles);
1276
1277
1278
1279% --------------------------------------------------------------------
1280function varargout = sfm_parambutton_Callback(h, eventdata, handles, varargin)
1281
1282pos_size = get(handles.figure1,'Position');
1283dlg_pos = [pos_size(1)+pos_size(3)/5 pos_size(2)+pos_size(4)/5];
1284
1285cal_param = torr_cal_menu(handles, dlg_pos);
1286
1287handles.focal_length = cal_param(1);
1288handles.aspect_ratio = cal_param(2);
1289handles.ppx =  cal_param(3);
1290handles.ppy =  cal_param(4);
1291
1292%work out calibration matrix
1293C = [ handles.aspect_ratio 0 handles.ppx; 0 1 handles.ppy; 0 0 1/handles.focal_length];
1294C
1295handles.C = C;
1296% saving the GUI data
1297guidata(handles.figure1, handles);
1298
1299
1300
1301% --------------------------------------------------------------------
1302function varargout = initialize(handles)
1303
1304disp('this function isnt ready yet');
1305%phils atuff added, initialization
1306%corner parameters
1307handles.n_corners = 500; %max no of corners permitted/requested
1308
1309handles.n_corners1 = 0; %the actual number detected
1310handles.n_corners2 = 0;
1311
1312handles.corner_sigma = 1.0;
1313handles.corner_width = 3;
1314
1315
1316%matchin parameters
1317handles.max_disparity = 100;
1318handles.match_half_size = 3;
1319
1320
1321%F parameters:
1322handles.no_samp = 500; % no of samples in the mapsac algorithm
1323handles.f_threshold = 6.0; % f_threshold in the mapsac algorithm
1324
1325%informational variables
1326handles.n_matches = 0; %how many matches have we dectected.
1327
1328
1329%general parameters
1330%debugt mode
1331handles.debug = 1;
1332handles.m3 = 256; %third homogeous pixel coordinate, chosen as 256 to help conditioning, see my thesis
1333handles.pathname = ['C:\matlabR12\bin\'];
1334
1335
1336%calibration matrix
1337handles.focal_length = 3; %first guess, which is in units of m3 i.e
1338                            %focal length in pixels is 3 * m3
1339handles.aspect_ratio = 1;
1340handles.ppx =  0;
1341handles.ppy =  0;
1342%work out calibration matrix
1343C = [a 0 handles.ppx; 0 1 handles.ppy; 0 0 1/handles.focal_length];
1344handles.C = C;
1345
1346if ~handles.debug
1347    helpdlg('Phil asks: "how ya diddling", first load some images')
1348end
1349
1350
1351set(handles.save_image1_button, 'Enable', 'off');
1352set(handles.save_image2_button, 'Enable', 'off');
1353set(handles.Save_Images_menu, 'Enable', 'off');
1354
1355
1356%for corners
1357set(handles.detect_corner_button, 'Enable', 'off');
1358set(handles.save_corner_button, 'Enable', 'off');
1359set(handles.load_corner_button, 'Enable', 'off');
1360set(handles.corn_param_button, 'Enable', 'off');
1361
1362%for correlation matches
1363set(handles.match_button, 'Enable', 'off');
1364set(handles.match_param_button, 'Enable', 'off');
1365set(handles.manual_match_button, 'Enable', 'off');
1366set(handles.save_match_button, 'Enable', 'off');   
1367set(handles.load_match_button, 'Enable', 'off');
1368
1369%for F and correlation matches
1370set(handles.mapsac_button, 'Enable', 'off');
1371set(handles.mapsac_parameters_button, 'Enable', 'off');
1372set(handles.save_F_button, 'Enable', 'off');
1373set(handles.display_epipolar_button, 'Enable', 'off');
1374set(handles.display_epipolar_button2, 'Enable', 'off');
1375
1376%self calibrate
1377set(handles.calibrate_button, 'Enable', 'on');
1378
1379
1380
1381
1382guidata(handles.figure1, handles);
1383
1384
1385
1386
1387
1388% --------------------------------------------------------------------
1389function varargout = epi_button_Callback(h, eventdata, handles, varargin)
1390
1391 torr_disp_epip_geom(handles.f,handles.matches12,handles.axes2,handles.axes3,handles.m3);
1392
1393
1394 f = handles.f;
1395f = [f(1) f(4) f(7) f(2) f(5) f(8) f(3) f(6) f(9)];
1396
1397torr_disp_epip_geom(handles.f,handles.matches12,handles.axes3,handles.axes2,handles.m3);
1398
1399
1400
1401% --------------------------------------------------------------------
1402
1403
1404
1405
1406
1407
1408
Note: See TracBrowser for help on using the repository browser.