1 | % evalreprerror ... computes and plots the final error statistics |
---|
2 | % |
---|
3 | % cam = evalreprerror(cam,config) |
---|
4 | % cam, config ... see the main GOCAL script |
---|
5 | % |
---|
6 | % $Id: evalreprerror.m,v 2.0 2003/06/19 12:07:03 svoboda Exp $ |
---|
7 | |
---|
8 | function cam = evalreprerror(cam,config) |
---|
9 | |
---|
10 | disp('2D reprojection error') |
---|
11 | disp(sprintf('All points: mean %2.2f pixels, std is %2.2f',mean([cam.err2d]), std([cam.err2d])')); |
---|
12 | % disp(sprintf('Inliers: mean %2.2f pixels, std is %2.2f',mean([cam.inerr2d]), std([cam.inerr2d])')); |
---|
13 | if mean([cam.err2d])>1.5 | std([cam.err2d])>1.5 |
---|
14 | disp('***************************************************') |
---|
15 | disp('W A R N I N G: the reprojection error is relatively high !') |
---|
16 | end |
---|
17 | |
---|
18 | %%% |
---|
19 | % evaluate the reprojection error for each camera separately to detect possible problems |
---|
20 | %%% |
---|
21 | for i=1:size(config.cal.cams2use,2), |
---|
22 | cam(i).mean2Derr = mean(cam(i).err2d); |
---|
23 | cam(i).std2Derr = std(cam(i).err2d); |
---|
24 | end |
---|
25 | % sort the values and print them to the 2D graphs |
---|
26 | |
---|
27 | figure(30), |
---|
28 | clf |
---|
29 | plot(config.cal.cams2use,[cam.mean2Derr],'bd'), |
---|
30 | hold on, grid on, |
---|
31 | plot(config.cal.cams2use,[cam.mean2Derr],'b-'), |
---|
32 | plot(config.cal.cams2use,[cam.std2Derr],'rd') |
---|
33 | plot(config.cal.cams2use,[cam.std2Derr],'r-') |
---|
34 | xlabel('Id of the camera') |
---|
35 | title('2D error: mean (blue), std (red)') |
---|
36 | ylabel('pixels') |
---|
37 | |
---|
38 | figure(31) |
---|
39 | clf |
---|
40 | bar(config.cal.cams2use,[cam.mean2Derr;cam.std2Derr]',1.5) |
---|
41 | grid on |
---|
42 | xlabel('Id of the camera') |
---|
43 | title('2D error: mean (blue), std (red)') |
---|
44 | ylabel('pixels') |
---|
45 | |
---|
46 | figure(31), |
---|
47 | eval(['print -depsc ', config.paths.data, 'reprerrors.eps']) |
---|
48 | |
---|
49 | figure(4), |
---|
50 | eval(['print -depsc ', config.paths.data, 'reconstructedsetup.eps']) |
---|
51 | |
---|
52 | Ret = 1; |
---|
53 | return |
---|