Rose-Hulman Robotics Team

Changeset 501

Show
Ignore:
Timestamp:
05/20/09 23:19:37 (3 years ago)
Author:
mosttw
Message:

More work

Location:
trunk/software/scripts/calib
Files:
1 added
1 removed
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/software/scripts/calib/calibrate.c

    r499 r501  
    3333// The size of the squares on the chessboard, in whatever units 
    3434// you want the calibration to be related to. 
    35 #define SQUARE_SIZE 1.0 
     35#define SQUARE_SIZE 2.4765 
    3636 
    3737// The size of the images from which you are calibrating. 
     
    4545// length of this array must match NUM_INPUTS. 
    4646int CORNER_FLAGS[NUM_INPUTS] = { 
    47   CV_CALIB_CB_FILTER_QUADS, 
    4847  CV_CALIB_CB_ADAPTIVE_THRESH, 
    4948  CV_CALIB_CB_ADAPTIVE_THRESH, 
    50   CV_CALIB_CB_FILTER_QUADS, 
     49  CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_NORMALIZE_IMAGE, 
     50  CV_CALIB_CB_ADAPTIVE_THRESH, 
    5151  CV_CALIB_CB_ADAPTIVE_THRESH, 
    5252  CV_CALIB_CB_ADAPTIVE_THRESH 
     
    8282    char *out_fn = calloc(100, 1); 
    8383    sprintf(in_fn, "input.%d.jpg", i + 1); 
    84     sprintf(out_fn, "corners.%d.jpg", i + 1); 
     84    sprintf(out_fn, "corners.%d.png", i + 1); 
    8585    IplImage* img = cvLoadImage(in_fn, 1); 
    86      
     86    if (!img) { 
     87      fprintf(stderr, "Couldn't open %s\n", in_fn); 
     88      exit(1); 
     89    } 
     90 
    8791    // Attempt to find the chessboard 
    8892    int corner_count = 0; 
     
    96100    //cvFindCornerSubPix(img, my_corners, corner_count, 
    97101    //                   cvSize(5, 5), // window to search 
    98     //                   cvSize(-1, -1), // window to ignore (-1 disables) 
    99     //                   cvTermCriteria(CV_TERMCRIT_ITER, 10, 10.0)); 
     102    //                   cvSize(1, 1), // window to ignore (-1 disables) 
     103    //                   cvTermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 10, 0.1)); 
    100104     
    101105    cvDrawChessboardCorners(img, pattern_size, my_corners, corner_count, pattern_was_found); 
     
    157161                    0.0, 0.0, 1.0}; 
    158162  CvMat K = cvMat(3, 3, CV_32FC1, &K_data); 
    159   printf("original K:\n"); 
    160   print_matrix(&K); 
     163  //printf("original K:\n"); 
     164  //print_matrix(&K); 
    161165 
    162166  CvMat *distortion_coeffs = cvCreateMat(4, 1, CV_32FC1);