home *** CD-ROM | disk | FTP | other *** search
/ vis-ftp.cs.umass.edu / vis-ftp.cs.umass.edu.tar / vis-ftp.cs.umass.edu / pub / CMU / cmu_files / cal / test.c < prev    next >
C/C++ Source or Header  |  1990-12-11  |  1KB  |  39 lines

  1. /* Program to read FIDO calibration files and transform image coordinates
  2.  * to ideal coordinates.  This was used to check the ideal coordinates
  3.  * in the "info.save1" and "info.save2" files that were generated with the
  4.  * wrong calibration data.  I hope to recover by retransforming the image
  5.  * coordinates with the correct calibration data.
  6.  */
  7.  
  8. #include <strings.h>
  9. #include "test.h"
  10.  
  11. int maxrow = 479, maxcol = 511;
  12.  
  13. main ()
  14. {
  15. char calfile[100], datafile[100];
  16. double x, y, z;
  17. int lc, rc;
  18. double lx, ly, rx, ry, baseline, getdouble();
  19.  
  20. if (!coordsetup (NUMDISTORTIONPOLYS))
  21.     quit (1, "Can't set up coord package\n");
  22.  
  23. getstr ("Calibration file? ", "aug2", calfile);
  24. getcalibration (calfile);
  25. baseline = getdouble ("Stereo baseline? ", 0.1, 5.0, 0.25);
  26. printf ("baseline %f\n", baseline);
  27. for (;;) {
  28.     lc = getint ("Left col? ", 0, maxcol, 0);
  29.     rc = getint ("Right col? ", 0, maxcol, 0);
  30.     RCI (240, lc, lx, ly, LEFT);
  31.     RCI (240, rc, rx, ry, RIGHT);
  32.     z = baseline / (lx - rx);
  33.     x = lx * z;
  34.     y = ly * z;
  35.     printf ("lx %f rx %f\n", lx, rx);
  36.     printf ("x %f y %f z %f\n", x, y, z);
  37. }
  38. }
  39.