From: <dm...@us...> - 2008-12-29 12:07:32
|
Revision: 912 http://panotools.svn.sourceforge.net/panotools/?rev=912&view=rev Author: dmg Date: 2008-12-29 12:07:28 +0000 (Mon, 29 Dec 2008) Log Message: ----------- 2008-12-29 dmg <dm...@uv...> * panorama.h, math.c, adjust.c, queryfeature.c, filter.h, parser.c: Added panini projection. the credit goes to Thomas Sharpless who rediscovered it, and to Bruno Postle, who did the original math. Modified Paths: -------------- trunk/libpano/ChangeLog trunk/libpano/adjust.c trunk/libpano/filter.h trunk/libpano/math.c trunk/libpano/panorama.h trunk/libpano/parser.c trunk/libpano/queryfeature.c Modified: trunk/libpano/ChangeLog =================================================================== --- trunk/libpano/ChangeLog 2008-11-18 23:46:59 UTC (rev 911) +++ trunk/libpano/ChangeLog 2008-12-29 12:07:28 UTC (rev 912) @@ -1,3 +1,11 @@ +2008-12-29 dmg <dm...@uv...> + + * panorama.h, math.c, adjust.c, queryfeature.c, filter.h, + parser.c: Added panini projection. the credit goes to Thomas + Sharpless who rediscovered it, and to Bruno Postle, who did the + original math. + + 2008-08-11 dmg <dm...@uv...> * bootstrap (have_libtool): Added support for 2.2.* version of Modified: trunk/libpano/adjust.c =================================================================== --- trunk/libpano/adjust.c 2008-11-18 23:46:59 UTC (rev 911) +++ trunk/libpano/adjust.c 2008-12-29 12:07:28 UTC (rev 912) @@ -688,6 +688,11 @@ // horizontal pixels per degree mp->distance = ((double) pn->width) / b; break; + case _panini: + tpara = 1; + panini_erect(b/2.0, 0.0, &tx, &ty, & tpara); + mp->distance = pn->width/(2.0*tx); + break; case _lambertazimuthal: tpara = 1; lambertazimuthal_erect(b/2.0, 0.0, &tx, &ty, & tpara); @@ -796,6 +801,10 @@ { SetDesc(stack[i], erect_millercylindrical, &(mp->distance) ); i++; // Convert miller to sphere } + else if(pn->format == _panini) + { + SetDesc(stack[i], erect_panini, &(mp->distance) ); i++; // Convert panini to sphere + } else if(pn->format == _lambert) { SetDesc(stack[i], erect_lambert, &(mp->distance) ); i++; // Convert lambert to sphere @@ -968,6 +977,11 @@ lambertazimuthal_erect(b/2.0, 0.0, &tx, &ty, & tpara); mp->distance = pn->width/(2.0*tx); break; + case _panini: + tpara = 1; + panini_erect(b/2.0, 0.0, &tx, &ty, & tpara); + mp->distance = pn->width/(2.0*tx); + break; case _stereographic: tpara = 1; stereographic_erect(b/2.0, 0.0, &tx, &ty, & tpara); @@ -1139,6 +1153,10 @@ { SetDesc(stack[i], millercylindrical_erect, &(mp->distance) ); i++; // Convert sphere to sphere } + else if(pn->format == _panini) + { + SetDesc(stack[i], panini_erect, &(mp->distance) ); i++; // Convert panini to sphere + } else if(pn->format == _lambert) { SetDesc(stack[i], lambert_erect, &(mp->distance) ); i++; // Convert sphere to lambert Modified: trunk/libpano/filter.h =================================================================== --- trunk/libpano/filter.h 2008-11-18 23:46:59 UTC (rev 911) +++ trunk/libpano/filter.h 2008-12-29 12:07:28 UTC (rev 912) @@ -849,6 +849,8 @@ int albersequalareaconic_distance ( double *x_src, void* params ); int millercylindrical_erect ( double x_dest,double y_dest, double* x_src, double* y_src, void* params ); int erect_millercylindrical ( double x_dest,double y_dest, double* x_src, double* y_src, void* params ); +int panini_erect ( double x_dest,double y_dest, double* x_src, double* y_src, void* params ); +int erect_panini ( double x_dest,double y_dest, double* x_src, double* y_src, void* params ); int mirror_sphere_cp ( double x_dest,double y_dest, double* x_src, double* y_src, void* params ); Modified: trunk/libpano/math.c =================================================================== --- trunk/libpano/math.c 2008-11-18 23:46:59 UTC (rev 911) +++ trunk/libpano/math.c 2008-12-29 12:07:28 UTC (rev 912) @@ -710,6 +710,50 @@ } +/** convert from erect to panini */ +int panini_erect( double x_dest,double y_dest, double* x_src, double* y_src, void* params) +{ + // params: distanceparam + // this is the inverse + + double phi, lambdaHalf; + + phi = y_dest/distanceparam; + lambdaHalf = x_dest/ (distanceparam*2); + + *x_src = distanceparam * 2 * tan (lambdaHalf); + double temp = cos(lambdaHalf); + *y_src = distanceparam * phi / (temp * temp); + + return 1; +} + + +/** convert from panini to erect */ +int erect_panini( double x_dest,double y_dest, double* x_src, double* y_src, void* params) +{ + double y; + double x; + double lambdaHalf; + double temp; + + double phi; + y = y_dest/distanceparam; + x = x_dest/distanceparam; + + temp = cos(x/2); + phi = y * temp * temp; + + *x_src = 2 * atan2(x,2) * distanceparam; + *y_src = phi * distanceparam; + + return 1; +} + + + + + /** convert from erect to lambert */ int lambert_erect( double x_dest,double y_dest, double* x_src, double* y_src, void* params) { Modified: trunk/libpano/panorama.h =================================================================== --- trunk/libpano/panorama.h 2008-11-18 23:46:59 UTC (rev 911) +++ trunk/libpano/panorama.h 2008-12-29 12:07:28 UTC (rev 912) @@ -257,6 +257,7 @@ _lambertazimuthal = 16, _albersequalareaconic = 17, _millercylindrical = 18, + _panini = 19, }; enum @@ -273,9 +274,10 @@ PANO_FORMAT_LAMBERT_AZIMUTHAL = 9, PANO_FORMAT_ALBERS_EQUAL_AREA_CONIC = 10, PANO_FORMAT_MILLER_CYLINDRICAL = 11, + PANO_FORMAT_PANINI = 12, }; -#define PANO_FORMAT_COUNT 12 +#define PANO_FORMAT_COUNT 13 // A large rectangle Modified: trunk/libpano/parser.c =================================================================== --- trunk/libpano/parser.c 2008-11-18 23:46:59 UTC (rev 911) +++ trunk/libpano/parser.c 2008-12-29 12:07:28 UTC (rev 912) @@ -492,6 +492,9 @@ case PANO_FORMAT_MILLER_CYLINDRICAL: gl->pano.format = _millercylindrical; break; + case PANO_FORMAT_PANINI: + gl->pano.format = _panini; + break; default: PrintError( "Unknown panorama projection: %d", gl->pano.format ); return -1; @@ -987,6 +990,9 @@ case 11: p->pano.format = _millercylindrical; break; + case 12: + p->pano.format = _panini; + break; default: PrintError( "Unknown panorama projection: %d", p->pano.format ); return -1; Modified: trunk/libpano/queryfeature.c =================================================================== --- trunk/libpano/queryfeature.c 2008-11-18 23:46:59 UTC (rev 911) +++ trunk/libpano/queryfeature.c 2008-12-29 12:07:28 UTC (rev 912) @@ -69,6 +69,7 @@ {"PanoType9","Lambert Azimuthal Equal Area"}, {"PanoType10","Albers Conical Equal Area"}, {"PanoType11","Miller Cylindrical"}, + {"PanoType12","Panini"}, // Filter Types // fix: Fixed Windowsize // aa: Antialiasing filter with adaptive filter size @@ -363,6 +364,7 @@ break; case PANO_FORMAT_EQUIRECTANGULAR: case PANO_FORMAT_MILLER_CYLINDRICAL: + case PANO_FORMAT_PANINI: break; case PANO_FORMAT_FISHEYE_FF: features->maxVFOV = 360; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |