source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/BlueCCal/CalTechCal/gorad.m @ 37

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

Added original make3d

File size: 2.0 KB
Line 
1% main script to launch the estimation
2% of the non-linear parameters by using the CalTech
3% calibration toolbox and the output from the Svoboda's
4% Multicamera self-calibration
5%
6% How to create the input data:
7% 1) Run the MultiCamSelfCam
8% 2) Run the MultiCamValidation
9%
10% $Id: gorad.m,v 2.0 2003/06/19 12:06:00 svoboda Exp $
11
12clear all;
13
14addpath ../MultiCamSelfCalib/Cfg
15config = configdata(expname);
16
17% if problem with desactivated images -> some problems with the estimation in general
18desactivated_images = [];
19
20idxcams = config.cal.cams2use;
21selfcalib.goradproblem = 0;
22                                           
23for i = idxcams, 
24  [X_1,x_1] = preparedata(sprintf(config.files.points4cal,i));
25  go_calib_optim_iter
26  if any(isnan(param))
27          % when the iteration fails insert null distortion
28          % it is better than nonsense
29          kc(1:4) = [0,0,0,0];
30          selfcalib.goradproblem=1;
31  else
32          visualize_distortions   
33  end
34 
35  disp(sprintf('***** camera %d **********************************',i))
36  %
37  outputfile = sprintf(config.files.rad,i);
38
39     fprintf(1,'\nExport of intrinsic calibration data to blue-c configuration file\n');
40     % outputfile = input('File basename: ', 's');
41     configfile = outputfile;
42     disp(['Writing ' configfile]);
43     
44     fid = fopen(configfile, 'w');
45     
46     fprintf(fid, 'K11 = %.16f\n', KK(1,1));
47     fprintf(fid, 'K12 = %.16f\n', KK(1,2));
48     fprintf(fid, 'K13 = %.16f\n', KK(1,3));
49     fprintf(fid, 'K21 = %.16f\n', KK(2,1));
50     fprintf(fid, 'K22 = %.16f\n', KK(2,2));
51     fprintf(fid, 'K23 = %.16f\n', KK(2,3));
52     fprintf(fid, 'K31 = %.16f\n', KK(3,1));
53     fprintf(fid, 'K32 = %.16f\n', KK(3,2));
54     fprintf(fid, 'K33 = %.16f\n\n', KK(3,3));
55     
56     fprintf(fid, 'kc1 = %.16f\n', kc(1));
57     fprintf(fid, 'kc2 = %.16f\n', kc(2));
58     fprintf(fid, 'kc3 = %.16f\n', kc(3));
59     fprintf(fid, 'kc4 = %.16f\n', kc(4));
60
61     status = fclose(fid);
62
63disp('Press any key to continue'),  pause
64
65%%%
66% clear already estimated parameters
67clear fc kc alpha_c cc
68end
69                                                                                                                                                                                                                               
70                                                                                                                                                                                                                                                     
Note: See TracBrowser for help on using the repository browser.