/*----------------------------------------------------------------------------*/ int main(int argc, char ** argv) { printf("INFO parameters use: \nlength_threshold sampling_factor <input1.pgm> [input2.pgm...] <polyout_filename> \n"); printf("=======================\n \n"); /* Detect the lines from the input images. Push the data into DistortedLines */ int idx_begin = 3, idx_end = argc-2; int w, h; DistortedLines<double> distLines; read_images(distLines, w, h, argc, argv, idx_begin, idx_end); /* Distortion correction: calcualte the polynomial parameters */ printf("\n Incremental LMA for distortion polynomial... \n"); double xp = (double)w/2+0.2, yp = (double)h/2+0.2; /* +0.2 - to avoid integers */ const int order = 11; const int inc = 2; /* increment; only odd orders will be taken */ vector<double> poly_params = incLMA <double> (distLines, order, inc, xp, yp); printf("\n Incremental LMA done. The polynomial was obtained. \n"); /* Get an inverse polynomial */ printf("\n Distortion correction polynomial... "); fflush(stdout); vector<double> poly_params_inv = polyInv<double>(poly_params, order, order, w, h, xp, yp); printf("done. \n"); /* Save the correction polynomial to output file */ printf("\n Saving polynomial to file... "); fflush(stdout); save_poly(argv[argc-1], poly_params_inv, order, order); printf("done. \n"); return EXIT_SUCCESS; }
static void save_cur_shape(void) /* Save one end of the tween to a .ply file */ { char *path; Poly *p; char sbuf[50]; if ((p = query_end(TRUE)) == NULL) return; if ((path = vset_get_filename(stack_string("save_shape", sbuf), ".PLY",save_str,POLY_PATH,NULL,TRUE)) != NULL) { if(overwrite_old(path)) save_poly(path, p); } }