From: <tks...@us...> - 2009-08-11 21:17:29
|
Revision: 4197 http://hugin.svn.sourceforge.net/hugin/?rev=4197&view=rev Author: tksharpless Date: 2009-08-11 21:17:19 +0000 (Tue, 11 Aug 2009) Log Message: ----------- Improved stdout experience -- nothing serious Modified Paths: -------------- hugin/branches/gsoc2009_lenscalibration/src/foreign/levmar/lm_core.c hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Globals.cpp hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Main.cpp hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/MapPoints.cpp hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/ProcessImage.cpp hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.cpp hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.h Modified: hugin/branches/gsoc2009_lenscalibration/src/foreign/levmar/lm_core.c =================================================================== --- hugin/branches/gsoc2009_lenscalibration/src/foreign/levmar/lm_core.c 2009-08-11 18:00:14 UTC (rev 4196) +++ hugin/branches/gsoc2009_lenscalibration/src/foreign/levmar/lm_core.c 2009-08-11 21:17:19 UTC (rev 4197) @@ -607,7 +607,7 @@ break; } } -#if 1 +#if 0 if(!(k%10)){ printf("Iter: %d, estimate: ", k); for(i=0; i<m; ++i) Modified: hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Globals.cpp =================================================================== --- hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Globals.cpp 2009-08-11 18:00:14 UTC (rev 4196) +++ hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Globals.cpp 2009-08-11 21:17:19 UTC (rev 4197) @@ -40,7 +40,11 @@ double pixel_density = 4000; double focal_length_pixels = 0; double cropFactor = 0; -std::string path = ("output/"); +#ifdef _WIN32 + std::string path = ("output\\"); +#else + std::string path = ("output/"); +#endif //std::string path = (""); std::string format = (".jpg"); double sizefactor = 1; Modified: hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Main.cpp =================================================================== --- hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Main.cpp 2009-08-11 18:00:14 UTC (rev 4196) +++ hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/Main.cpp 2009-08-11 21:17:19 UTC (rev 4197) @@ -369,13 +369,15 @@ focal_length_pixels = fl; cout << "Found focal length (pixels):\t" << fl << endl; }else if(sscanf(ch, "# Lens type: %d", <) == 1){ - cout << "Found lens type:\t\t"; + cout << "Found lens type "<<lt<<":\t\t"; if (lt == 2){ cout << "Equal-area fisheye"; }else if(lt == 3){ cout << "Equal-angle fisheye"; + }else if(lt == 1){ + cout << "Rectilinear"; }else{ - cout << "Rectilinear"; + cout << "Other"; } cout << endl; lens_type = lt; @@ -403,9 +405,11 @@ pixel_density = focal_length_pixels / focal_length; is.close(); cout << endl; +/* for (int i = 0; i < lines.size(); i++){ cout << "Found line " << i+1 << ". Pixels:\t\t" << lines[i].size() << endl; } +*/ cout << endl; return true; } @@ -525,15 +529,13 @@ i++; } - +/* /* if(!fileexists(path)){ cout << "Output path " << path << " doesn't exist. Using working directory." << endl << endl; path = (""); } - */ - - if (gap_limit < 2) gap_limit = 2; + */ if (gap_limit < 2) gap_limit = 2; // Set output .pto filename if not given if (pto_file != ("")){ Modified: hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/MapPoints.cpp =================================================================== --- hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/MapPoints.cpp 2009-08-11 18:00:14 UTC (rev 4196) +++ hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/MapPoints.cpp 2009-08-11 21:17:19 UTC (rev 4197) @@ -550,6 +550,15 @@ #if 1 // using lensFunc void map_points(){ + static char * LMreason[] = { + " 1 - stopped by small gradient J^T e ", + " 2 - stopped by small Dp ", + " 3 - stopped by itmax ", + " 4 - singular matrix. Restart from current p with increased mu ", + " 5 - no further error reduction is possible. Restart with increased mu ", + " 6 - stopped by small ||e||_2 ", + " 7 - stopped by user " + }; /* create a lensFunc with default initial parameters */ lensFunc LF( lensFunc::digicam, @@ -591,8 +600,10 @@ int ret; ret = dlevmar_dif(&Mapto3d, &visf, p, x, m, n, iterations, NULL, info, NULL, NULL, (void *)&LF); - printf("\nLevenberg-Marquardt returned in %g iterations, reason %g\n", info[5], info[6]); - + printf("\nLevenberg-Marquardt returned in %g iterations\n reason %s\n", + info[5], LMreason[int(info[6])-1]); + printf("Camera %s, lens %s FL %.1f mm (%.1f pixels)\n", + LF.camDesc(), LF.lensDesc(), LF.getFL_mm(), LF.avgFL_pix() ); printf("Fitted parameters...\n"); double a,b,c,d,e,f; // PT-style names double p0, p1; // no PT equivalent Modified: hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/ProcessImage.cpp =================================================================== --- hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/ProcessImage.cpp 2009-08-11 18:00:14 UTC (rev 4196) +++ hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/ProcessImage.cpp 2009-08-11 21:17:19 UTC (rev 4197) @@ -1694,9 +1694,9 @@ int nsegs = edgeMap2linePts( image, saveimages ); cout<<nsegs<<" segments"<<endl; - cout<<" linePts2lineList(lmin "<<lmin<<" flpix "<<flpix<<") : "; + cout<<" linePts2lineList(lmin "<<lmin<<" flpix "<<flpix<<") "<<endl; int nlines = linePts2lineList( image, lmin, flpix, lines ); - cout<<nlines<<" lines"<<endl; + cout<<" "<<nlines<<" lines"<<endl; if (nlines == 0){ cout << "No lines found!" << endl << endl; Modified: hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.cpp =================================================================== --- hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.cpp 2009-08-11 18:00:14 UTC (rev 4196) +++ hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.cpp 2009-08-11 21:17:19 UTC (rev 4197) @@ -457,3 +457,34 @@ double lensFunc::rofR( double R ){ return R*(radC[0]+R*(radC[1]+R*(radC[2]+R*(radC[3]+R*radC[4])))); } + +/* Printable descriptions of current model +*/ +const char * lensFunc::camDesc(){ + static char * cd[] = { + "no camera", + "digicam", + "slit cam", + "film scanner" + }; + int c = int(camera); + if( c < 0 || c > sizeof( cd ) / sizeof(char *) ) c = 0; + return cd[c]; +} + +const char * lensFunc::lensDesc(){ + static char * ld[] = { + "no lens", + "rectilinear", + "equal_angle", + "equal_area", + "stereographic", + "tangent_model", + "sine_model", + "tan_sin_model" + }; + int c = int(lens); + if( c < 0 || c > sizeof( ld ) / sizeof(char *) ) c = 0; + return ld[c]; +} + Modified: hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.h =================================================================== --- hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.h 2009-08-11 18:00:14 UTC (rev 4196) +++ hugin/branches/gsoc2009_lenscalibration/src/lens_calibrate/lensFunc.h 2009-08-11 21:17:19 UTC (rev 4197) @@ -106,7 +106,8 @@ typedef enum{ no_cam = 0, digicam, - slitcam + slitcam, + scanner } camera_kind; typedef enum{ @@ -169,6 +170,12 @@ lens_kind l_type, double FLmm, double maxFOVdeg ); + // inquiry functions + double getFL_mm(){ return FL_mm; } + double avgFL_pix(){ return 0.5 * (hFLpix + vFLpix); } + const char * camDesc(); + const char * lensDesc(); + // set primary and working parameter values bool set_f_scale( double h_scl, double v_scl ); bool set_c_shift( double h_shfmm, double y_shfmm ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |