From: <tom...@us...> - 2010-08-09 03:57:13
|
Revision: 1290 http://panotools.svn.sourceforge.net/panotools/?rev=1290&view=rev Author: tomaszmeger Date: 2010-08-09 03:57:06 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Added first edition of function level testing programs. Tests are already integrated with cmake. Right now only optimization related functions are available. Modified Paths: -------------- branches/libpano_gsoc2010_regtests/tests/gsoc/CMakeLists.txt Added Paths: ----------- branches/libpano_gsoc2010_regtests/tests/gsoc/functions/ branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CMakeLists.txt branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CheckParamsTest.c branches/libpano_gsoc2010_regtests/tests/gsoc/functions/RunLMOptimizerTest.c branches/libpano_gsoc2010_regtests/tests/gsoc/functions/distSquaredTest.c branches/libpano_gsoc2010_regtests/tests/gsoc/functions/erect_albersequalareaconicTest.c branches/libpano_gsoc2010_regtests/tests/gsoc/functions/optimizer.txt Modified: branches/libpano_gsoc2010_regtests/tests/gsoc/CMakeLists.txt =================================================================== --- branches/libpano_gsoc2010_regtests/tests/gsoc/CMakeLists.txt 2010-07-24 21:25:16 UTC (rev 1289) +++ branches/libpano_gsoc2010_regtests/tests/gsoc/CMakeLists.txt 2010-08-09 03:57:06 UTC (rev 1290) @@ -55,3 +55,5 @@ add_subdirectory(f3) endif() +add_subdirectory(functions) + Added: branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CMakeLists.txt =================================================================== --- branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CMakeLists.txt (rev 0) +++ branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CMakeLists.txt 2010-08-09 03:57:06 UTC (rev 1290) @@ -0,0 +1,59 @@ +# This file is part of libpano13, the hugin build environment. +# Licence details can be found in the file gpl.txt. +# +# Copyright (c) 2009 Kornel Benko, <Kor...@be...> +# Modified by Tomasz Meger +# + +project(function_tests) + + +set(commands + erect_albersequalareaconicTest + CheckParamsTest + distSquaredTest + RunLMOptimizerTest + ) + + +# panoinfo needs windows.h + +if(WIN32) + list(APPEND commands panoinfo) +endif() + +include_directories(${TOP_SRC_DIR}) + +foreach(_cmd ${commands}) + add_executable(${_cmd} ${_cmd}.c) + target_link_libraries(${_cmd} ${_pano_target} ${_common_libs}) + install(TARGETS ${_cmd} DESTINATION bin CONFIGURATIONS Release RelWithDebInfo MinSizeRel) +endforeach(_cmd) + +file(GLOB input RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.txt") +set(_depends) +foreach(_i ${input}) + if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_i}") + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_i}" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${_i}" "${CMAKE_CURRENT_BINARY_DIR}/${_i}" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_i}") + SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_i}" GENERATED) + list(APPEND _depends "${CMAKE_CURRENT_BINARY_DIR}/${_i}") + endif() +endforeach(_i) +add_custom_target(function_tests ALL DEPENDS ${_depends}) + + +macro(set_test_f _TestIdentifier _ExecutableName) + ADD_TEST(${_TestIdentifier} ${_ExecutableName}) + SET_TESTS_PROPERTIES(${_TestIdentifier} PROPERTIES TIMEOUT "600") + SET_TESTS_PROPERTIES(${_TestIdentifier} PROPERTIES FAIL_REGULAR_EXPRESSION "Number of tests that failed: [1-9][0-9]*") + SET_TESTS_PROPERTIES(${_TestIdentifier} PROPERTIES PASS_REGULAR_EXPRESSION "Number of tests that failed: 0") +endmacro() + + +set_test_f(function_CheckParams "${CMAKE_CURRENT_BINARY_DIR}/CheckParamsTest") +set_test_f(function_distSquared "${CMAKE_CURRENT_BINARY_DIR}/distSquaredTest") +set_test_f(function_RunLMOptimizer "${CMAKE_CURRENT_BINARY_DIR}/RunLMOptimizerTest") + Added: branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CheckParamsTest.c =================================================================== --- branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CheckParamsTest.c (rev 0) +++ branches/libpano_gsoc2010_regtests/tests/gsoc/functions/CheckParamsTest.c 2010-08-09 03:57:06 UTC (rev 1290) @@ -0,0 +1,266 @@ +/* + * CheckParamsTest.c + * + * Tests CheckParams function. + * + * July 2010 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Tomasz Meger + * + */ + +#include "filter.h" +#include "dump.h" +#include <stdio.h> + +int test1 (AlignInfo ainf); +int test2 (AlignInfo ainf); +int test3 (AlignInfo ainf); +int test4 (AlignInfo ainf); +int test5 (AlignInfo ainf); +int test6 (AlignInfo ainf); +int test7 (AlignInfo ainf); +int test8 (AlignInfo ainf); +int test9 (AlignInfo ainf); +int test10 (AlignInfo ainf); + +int main(int argc, char *argv[]) +{ + AlignInfo ainf; + char* script; + fullPath infile; + int testsFailed = 0; + int result; + + StringtoFullPath( &infile, "optimizer.txt" ); + script = LoadScript( &infile ); + ParseScript( script, &ainf ); + + result += test1(ainf); + result += test2(ainf); + result += test3(ainf); + result += test4(ainf); + result += test5(ainf); + result += test6(ainf); + result += test7(ainf); + result += test8(ainf); + result += test9(ainf); + result += test10(ainf); + + printf("Number of tests that failed: %d\n", testsFailed); + return 0; +} + + +int test1 (AlignInfo ainf) +{ + printf("Test1 \n"); + if (CheckParams( &ainf ) == 0) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test2 (AlignInfo ainf) +{ + int tmp = ainf.im[3].cP.tilt_scale; + ainf.im[3].cP.tilt_scale = 0; + printf("Test2 \n"); + if (CheckParams( &ainf ) == -1) + { + printf("OK\n"); + ainf.im[3].cP.tilt_scale = tmp; + return 0; + } + else + { + printf("NOT OK\n"); + ainf.im[3].cP.tilt_scale = tmp; + return 1; + } +} + +int test3 (AlignInfo ainf) +{ + int tmp = ainf.numParam; + int result; + ainf.numParam = 0; + printf("Test3 \n"); + result = CheckParams( &ainf ); + ainf.numParam = tmp; + if (result == -1) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test4 (AlignInfo ainf) +{ + int tmp = ainf.numIm; + int result; + ainf.numIm = 0; + printf("Test4 \n"); + result = CheckParams( &ainf ); + ainf.numIm = tmp; + if (result == -1) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test5 (AlignInfo ainf) +{ + int tmp = ainf.numPts; + int result; + ainf.numPts = 0; + printf("Test5 \n"); + result = CheckParams( &ainf ); + ainf.numPts = tmp; + if (result == -1) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test6 (AlignInfo ainf) +{ + int tmp = ainf.im[0].width; + int result; + ainf.im[0].width = 0; + printf("Test6 \n"); + result = CheckParams( &ainf ); + ainf.im[0].width = tmp; + if (result == -1) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test7 (AlignInfo ainf) +{ + int tmp = ainf.im[1].height; + int result; + ainf.im[1].height = -500; + printf("Test7 \n"); + result = CheckParams( &ainf ); + ainf.im[1].height = tmp; + if (result == -1) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test8 (AlignInfo ainf) +{ + double tmp = ainf.im[2].hfov; + int result; + ainf.im[2].hfov = -10.0; + printf("Test8 \n"); + result = CheckParams( &ainf ); + ainf.im[2].hfov = tmp; + if (result == -1) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test9 (AlignInfo ainf) +{ + double tmp = ainf.im[2].hfov; + int tmp2 = ainf.im[2].format; + int result; + ainf.im[2].hfov = 180.1; + ainf.im[2].format = _rectilinear; + printf("Test9 \n"); + result = CheckParams( &ainf ); + ainf.im[2].hfov = tmp; + ainf.im[2].format = tmp2; + if (result == -1) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + +int test10 (AlignInfo ainf) +{ + int tmp = ainf.im[2].format; + int result; + ainf.im[2].format = _rectilinear; + printf("Test10 \n"); + result = CheckParams( &ainf ); + ainf.im[2].format = tmp; + if (result == 0) + { + printf("OK\n"); + return 0; + } + else + { + printf("NOT OK\n"); + return 1; + } +} + + Added: branches/libpano_gsoc2010_regtests/tests/gsoc/functions/RunLMOptimizerTest.c =================================================================== --- branches/libpano_gsoc2010_regtests/tests/gsoc/functions/RunLMOptimizerTest.c (rev 0) +++ branches/libpano_gsoc2010_regtests/tests/gsoc/functions/RunLMOptimizerTest.c 2010-08-09 03:57:06 UTC (rev 1290) @@ -0,0 +1,949 @@ +/* + * RunLMOptimizerTest.c + * + * Tests RunLMOptimizer function. + * + * July 2010 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Tomasz Meger + * + */ + +#include "filter.h" +#include <stdio.h> + +static AlignInfo *optInfo; + +int test(char * filename); +int compare(AlignInfo ainf); + +int main(int argc, char *argv[]) +{ + int testsFailed = 0; + + testsFailed += test("optimizer.txt"); + + printf("Number of tests that failed: %d\n", testsFailed); + return 0; +} + +int test(char * filename) +{ + AlignInfo ainf; + char* script; + OptInfo opt; + fullPath infile; + + StringtoFullPath( &infile, filename ); + script = LoadScript( &infile ); + if( script == NULL ) + { + printf("No script loaded, testing failed\n"); + return 1; + } + + if(ParseScript( script, &ainf ) != 0) + { + printf("Parsing script error, testing failed\n"); + free( script ); + return 1; + } + + if( CheckParams( &ainf ) != 0 ) + { + printf("Checking parameters failed, testing failed\n"); + DisposeAlignInfo( &ainf ); + return 1; + } + + ainf.fcn = fcnPano; + + SetGlobalPtr( &ainf ); + + opt.numVars = ainf.numParam; + opt.numData = ainf.numPts; + opt.SetVarsToX = SetLMParams; + opt.SetXToVars = SetAlignParams; + opt.fcn = ainf.fcn; + *opt.message = 0; + + RunLMOptimizer( &opt ); + //ainf.data = opt.message; + printf("%s", opt.message); + + //WriteResults( script, &infile, &ainf, distSquared, 0); + return compare(ainf);; +} + +int compare(AlignInfo ainf) +{ + + int result = 0; + +/* + //just to make life easier - code generating function + int i; + printf("if(ainf.numPts != %d);\n", ainf.numPts); + printf("if(ainf.numParam != %d);\n", ainf.numParam); + for( i=0; i < ainf.numIm; i++ ) + { + printf("if( fabs(ainf.im[%d].yaw - %g) > 1E-3 )\n{\n\tprintf(\"Comparing yaw to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].yaw, i); + printf("if( fabs(ainf.im[%d].pitch - %g) > 1E-3 )\n{\n\tprintf(\"Comparing pitch to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].pitch, i); + printf("if( fabs(ainf.im[%d].roll - %g) > 1E-3 )\n{\n\tprintf(\"Comparing roll to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].roll, i); + printf("if( fabs(ainf.im[%d].hfov - %g) > 1E-3 )\n{\n\tprintf(\"Comparing HFov to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].hfov, i); + printf("if( fabs(ainf.im[%d].cP.radial_params[0][3] - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Polynomial Coefficients (a) to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.radial_params[0][3], i); + printf("if( fabs(ainf.im[%d].cP.radial_params[0][2] - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Polynomial Coefficients (b) to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.radial_params[0][2], i); + printf("if( fabs(ainf.im[%d].cP.radial_params[0][1] - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Polynomial Coefficients (c) to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.radial_params[0][1], i); + printf("if( fabs(ainf.im[%d].cP.horizontal_params[0] - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Horizontal Shift to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.horizontal_params[0], i); + printf("if( fabs(ainf.im[%d].cP.vertical_params[0] - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Vertical Shift to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.vertical_params[0], i); + printf("if( fabs(ainf.im[%d].cP.tilt_x - %f) > 1E-3 )\n{\n\tprintf(\"Comparing TiltX to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.tilt_x, i); + printf("if( fabs(ainf.im[%d].cP.tilt_y - %f) > 1E-3 )\n{\n\tprintf(\"Comparing TiltY to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.tilt_y, i); + printf("if( fabs(ainf.im[%d].cP.tilt_z - %f) > 1E-3 )\n{\n\tprintf(\"Comparing TiltZ to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.tilt_z, i); + printf("if( fabs(ainf.im[%d].cP.tilt_scale - %f) > 1E-3 )\n{\n\tprintf(\"Comparing TiltScale to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.tilt_scale, i); + printf("if( fabs(ainf.im[%d].cP.trans_x - %f) > 1E-3 )\n{\n\tprintf(\"Comparing TransX to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.trans_x, i); + printf("if( fabs(ainf.im[%d].cP.trans_y - %f) > 1E-3 )\n{\n\tprintf(\"Comparing TransY to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.trans_y, i); + printf("if( fabs(ainf.im[%d].cP.trans_z - %f) > 1E-3 )\n{\n\tprintf(\"Comparing TransZ to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.trans_z, i); + printf("if( fabs(ainf.im[%d].cP.test_p0 - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Test P0 to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.test_p0, i); + printf("if( fabs(ainf.im[%d].cP.test_p1 - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Test P1 to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.test_p1, i); + printf("if( fabs(ainf.im[%d].cP.test_p2 - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Test P2 to reference failed in image %d\\n\");\n\tresult++;\n}\n", i, ainf.im[i].cP.test_p2, i); + printf("if( fabs(ainf.im[%d].cP.test_p3 - %f) > 1E-3 )\n{\n\tprintf(\"Comparing Test P3 to reference failed in image %d\\n\");\n\tresult++;\n}\n\n", i, ainf.im[i].cP.test_p3, i); + } +*/ + + if(ainf.numPts != 66) + { + printf("Comparing Number of Control Points failed\n"); + result++; + } + if(ainf.numParam != 26) + { + printf("Comparing Number of parameters to optimize failed\n"); + result++; + } + + + if( fabs(ainf.im[0].yaw - 0) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].pitch - -0.808846) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].roll - 1.2453) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].hfov - 83.2457) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.radial_params[0][3] - -0.027782) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.radial_params[0][2] - 0.054774) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.radial_params[0][1] - -0.073810) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.horizontal_params[0] - -33.435436) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.vertical_params[0] - 1.737751) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 0\n"); + result++; + } + if( fabs(ainf.im[0].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 0\n"); + result++; + } + + if( fabs(ainf.im[1].yaw - 48.6781) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].pitch - -0.806883) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].roll - 0.0266826) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].hfov - 83.0882) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.radial_params[0][3] - 0.000209) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.radial_params[0][2] - -0.028288) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.radial_params[0][1] - -0.003747) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.horizontal_params[0] - -32.402200) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.vertical_params[0] - 0.379041) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 1\n"); + result++; + } + if( fabs(ainf.im[1].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 1\n"); + result++; + } + + if( fabs(ainf.im[2].yaw - 88.6269) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].pitch - -0.06792) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].roll - -0.718207) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].hfov - 83.0882) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.radial_params[0][3] - 0.000209) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.radial_params[0][2] - -0.028288) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.radial_params[0][1] - -0.003747) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.horizontal_params[0] - -32.402200) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.vertical_params[0] - 0.379041) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 2\n"); + result++; + } + if( fabs(ainf.im[2].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 2\n"); + result++; + } + + if( fabs(ainf.im[3].yaw - 138.134) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].pitch - 1.18807) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].roll - -0.660666) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].hfov - 83.0882) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.radial_params[0][3] - 0.000209) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.radial_params[0][2] - -0.028288) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.radial_params[0][1] - -0.003747) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.horizontal_params[0] - -32.402200) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.vertical_params[0] - 0.379041) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 3\n"); + result++; + } + if( fabs(ainf.im[3].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 3\n"); + result++; + } + + if( fabs(ainf.im[4].yaw - 179.178) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].pitch - 1.77503) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].roll - 0.0913396) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].hfov - 83.0882) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.radial_params[0][3] - 0.000209) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.radial_params[0][2] - -0.028288) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.radial_params[0][1] - -0.003747) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.horizontal_params[0] - -32.402200) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.vertical_params[0] - 0.379041) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 4\n"); + result++; + } + if( fabs(ainf.im[4].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 4\n"); + result++; + } + + if( fabs(ainf.im[5].yaw - -130.025) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].pitch - 1.78619) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].roll - 1.26377) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].hfov - 83.0882) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.radial_params[0][3] - 0.000209) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.radial_params[0][2] - -0.028288) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.radial_params[0][1] - -0.003747) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.horizontal_params[0] - -32.402200) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.vertical_params[0] - 0.379041) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 5\n"); + result++; + } + if( fabs(ainf.im[5].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 5\n"); + result++; + } + + if( fabs(ainf.im[6].yaw - -89.2924) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].pitch - 1.11473) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].roll - 1.92667) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].hfov - 83.0882) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.radial_params[0][3] - 0.000209) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.radial_params[0][2] - -0.028288) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.radial_params[0][1] - -0.003747) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.horizontal_params[0] - -32.402200) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.vertical_params[0] - 0.379041) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 6\n"); + result++; + } + if( fabs(ainf.im[6].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 6\n"); + result++; + } + + if( fabs(ainf.im[7].yaw - -42.525) > 1E-3 ) + { + printf("Comparing yaw to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].pitch - -0.0144794) > 1E-3 ) + { + printf("Comparing pitch to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].roll - 1.88377) > 1E-3 ) + { + printf("Comparing roll to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].hfov - 83.0882) > 1E-3 ) + { + printf("Comparing HFov to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.radial_params[0][3] - 0.000209) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (a) to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.radial_params[0][2] - -0.028288) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (b) to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.radial_params[0][1] - -0.003747) > 1E-3 ) + { + printf("Comparing Polynomial Coefficients (c) to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.horizontal_params[0] - -32.402200) > 1E-3 ) + { + printf("Comparing Horizontal Shift to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.vertical_params[0] - 0.379041) > 1E-3 ) + { + printf("Comparing Vertical Shift to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.tilt_x - 0.000000) > 1E-3 ) + { + printf("Comparing TiltX to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.tilt_y - 0.000000) > 1E-3 ) + { + printf("Comparing TiltY to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.tilt_z - 0.000000) > 1E-3 ) + { + printf("Comparing TiltZ to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.tilt_scale - 1.000000) > 1E-3 ) + { + printf("Comparing TiltScale to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.trans_x - 0.000000) > 1E-3 ) + { + printf("Comparing TransX to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.trans_y - 0.000000) > 1E-3 ) + { + printf("Comparing TransY to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.trans_z - 0.000000) > 1E-3 ) + { + printf("Comparing TransZ to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.test_p0 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P0 to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.test_p1 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P1 to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.test_p2 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P2 to reference failed in image 7\n"); + result++; + } + if( fabs(ainf.im[7].cP.test_p3 - 0.000000) > 1E-3 ) + { + printf("Comparing Test P3 to reference failed in image 7\n"); + result++; + } + + return result; +} + Added: branches/libpano_gsoc2010_regtests/tests/gsoc/functions/distSquaredTest.c =================================================================== --- branches/libpano_gsoc2010_regtests/tests/gsoc/functions/distSquaredTest.c (rev 0) +++ branches/libpano_gsoc2010_regtests/tests/gsoc/functions/distSquaredTest.c 2010-08-09 03:57:06 UTC (rev 1290) @@ -0,0 +1,63 @@ +/* + * distSquaredTest.c + * + * Tests distSquared function. + * + * July 2010 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Tomasz Meger + * + */ + +#include "filter.h" +#include <stdio.h> + +static AlignInfo *optInfo; + +int main(int argc, char *argv[]) +{ + AlignInfo ainf; + char* script; + fullPath infile; + int testsFailed = 0; + int result; + + StringtoFullPath( &infile, "optimizer.txt" ); + script = LoadScript( &infile ); + ParseScript( script, &ainf ); + SetGlobalPtr( &ainf ); + + if (fabs(distSquared(0) - 0.85436) < 1E-5) testsFailed++; + if (fabs(distSquared(0) - 0.445436) > 1E-5) testsFailed++; + if (fabs(distSquared(1) - 1.856560) > 1E-5) testsFailed++; + if (fabs(distSquared(3) - 0.720202) > 1E-5) testsFailed++; + if (fabs(distSquared(5) - 0.212486) > 1E-5) testsFailed++; + if (fabs(distSquared(50) - 5.778498) > 1E-5) testsFailed++; + if (fabs(distSquared(2) - 0.180449) > 1E-5) testsFailed++; + if (fabs(distSquared(4) - 0.133583) > 1E-5) testsFailed++; + if (fabs(distSquared(52) - 2.248545) > 1E-5) testsFailed++; + if (fabs(distSquared(12) - 0.091332) > 1E-5) testsFailed++; + if (fabs(distSquared(8) - 1.003247) > 1E-5) testsFailed++; + if (fabs(distSquared(10) - 0.153346) > 1E-5) testsFailed++; + if (fabs(distSquared(15) - 1.318578) > 1E-5) testsFailed++; + if (fabs(distSquared(-5) - 0.000000) > 1E-5) testsFailed++; + + printf("Number of tests that failed: %d\n", testsFailed); + return 0; +} + + Added: branches/libpano_gsoc2010_regtests/tests/gsoc/functions/erect_albersequalareaconicTest.c =================================================================== --- branches/libpano_gsoc2010_regtests/tests/gsoc/functions/erect_albersequalareaconicTest.c (rev 0) +++ branches/libpano_gsoc2010_regtests/tests/gsoc/functions/erect_albersequalareaconicTest.c 2010-08-09 03:57:06 UTC (rev 1290) @@ -0,0 +1,103 @@ +/* + * erect_albersequalareaconicTest.c + * + * Tests erect_albersequalareaconic function. + * + * July 2010 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Tomasz Meger + * + */ + +#include "filter.h" +#include "dump.h" +#include <stdio.h> + + +void setInputImage(Image *im) +{ + im->width = 800; + im->height = 600; + im->bytesPerLine = 0; + im->bitsPerPixel = 24; // Must be 24 or 32 + im->dataSize = 0; +/* pt_int32 dataformat; // rgb, Lab etc + pt_int32 format; // Projection: rectilinear etc + int formatParamCount; // Number of format parameters. + double formatParam[PANO_PROJECTION_MAX_PARMS]; // Parameters for format. + int precomputedCount; // number of values precomputed for a given pano + double precomputedValue[PANO_PROJECTION_PRECOMPUTED_VALUES]; // to speed up pano creation + double hfov; + double yaw; + double pitch; + double roll; + cPrefs cP; // How to correct the image + char name[PANO_PATH_LEN+1]; + PTRect selection; + CropInfo cropInformation; // TO BE DEPRECATED + + pano_ImageMetadata metadata;*/ +} + +void setOutputImage(Image *im) +{ + im->width = 800; + im->height = 600; + im->bytesPerLine = 0; + im->bitsPerPixel = 24; // Must be 24 or 32 + im->dataSize = 0; +/* pt_int32 dataformat; // rgb, Lab etc + pt_int32 format; // Projection: rectilinear etc + int formatParamCount; // Number of format parameters. + double formatParam[PANO_PROJECTION_MAX_PARMS]; // Parameters for format. + int precomputedCount; // number of values precomputed for a given pano + double precomputedValue[PANO_PROJECTION_PRECOMPUTED_VALUES]; // to speed up pano creation + double hfov; + double yaw; + double pitch; + double roll; + cPrefs cP; // How to correct the image + char name[PANO_PATH_LEN+1]; + PTRect selection; + CropInfo cropInformation; // TO BE DEPRECATED + + pano_ImageMetadata metadata;*/ +} + +int main(int argc, char *argv[]) +{ + //aPrefs aP; + struct MakeParams mp; + //fDesc stack[15]; + double x, y; + //SetAdjustDefaults(&aP); + //Pano_Dump_Adjust_Data(&aP, NULL, 0); + Image im1; + Image im2; + fDesc stack[15]; + setInputImage(&im1); + setOutputImage(&im2); + Pano_Dump_Image(&im1, NULL, 0); +// SetMakeParams( stack, &mp, &im1, &im2, 0 ); +// int result = erect_albersequalareaconic(0.0, 0.0, &x, &y, stack->params); +// if (result == 0) +// { +// printf ("Param check failed\n"); +// } + return 0; +} + Added: branches/libpano_gsoc2010_regtests/tests/gsoc/functions/optimizer.txt =================================================================== --- branches/libpano_gsoc2010_regtests/tests/gsoc/functions/optimizer.txt (rev 0) +++ branches/libpano_gsoc2010_regtests/tests/gsoc/functions/optimizer.txt 2010-08-09 03:57:06 UTC (rev 1290) @@ -0,0 +1,93 @@ +# Created by Panotools::Script 0.25 + +p f2 h1500 n"TIFF_m c:NONE" v360 w3000 +m f0 g1 i0 m2 p0.00784314 + +# Image lines +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6440.JPG" p-0.739786 r1.23268 t0 v83.0882 w2336 y0 +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6443.JPG" p-0.772426 r0.0634678 t0 v83.0882 w2336 y48.6043 +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6446.JPG" p-0.067337 r-0.652717 t0 v83.0882 w2336 y88.5627 +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6449.JPG" p1.15348 r-0.632612 t0 v83.0882 w2336 y138.084 +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6452.JPG" p1.73747 r0.0903612 t0 v83.0882 w2336 y179.141 +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6455.JPG" p1.76502 r1.24336 t0 v83.0882 w2336 y-130.051 +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6458.JPG" p1.10837 r1.91459 t0 v83.0882 w2336 y-89.3071 +i TrX0 TrY0 TrZ0 a0.000209152 b-0.0282883 c-0.00374658 d-32.4022 e0.379041 f3 g0 h3504 n"./070322_6461.JPG" p-0.0144794 r1.88377 t0 v83.0882 w2336 y-42.525 + +# Variable lines +v a0 b0 c0 d0 e0 p0 r0 v0 +v X1 Y1 Z1 p1 r1 y1 +v X2 Y2 Z2 p2 r2 y2 +v X3 Y3 Z3 p3 r3 y3 +v X4 Y4 Z4 p4 r4 y4 +v X5 Y5 Z5 p5 r5 y5 +v X6 Y6 Z6 p6 r6 y6 +v + +# Control point lines +c N1 X1297.01 Y3148.65 n0 t0 x2204 y3253 +c N1 X967.357 Y490.873 n0 t0 x1989 y413 +c N2 X155 Y415 n0 t0 x1989.21 y411.99 +c N2 X498.179 Y3194.61 n0 t0 x2203 y3252 +c N2 X497.052 Y3192.78 n1 t0 x1295 y3146 +c N2 X155.096 Y418.234 n1 t0 x974 y490 +c N3 X313.701 Y3328.4 n2 t0 x1210 y3238 +c N3 X12 Y712 n1 t0 x2132 y697 +c N3 X314 Y3327 n1 t0 x1938 y3299 +c N3 X12 Y710 n2 t0 x1184 y771 +c N2 X1796.66 Y3390.12 n3 t0 x960 y3351 +c N2 X1185 Y772 n1 t0 x2131.5 y696.5 +c N2 X1208.5 Y3237.5 n1 t0 x1936.5 y3297.5 +c N4 X84 Y358 n2 t0 x1915 y384 +c N4 X316 Y3452.5 n2 t0 x1797 y3392 +c N4 X316.298 Y3453.41 n3 t0 x961 y3353 +c N4 X131 Y283 n3 t0 x896.5 y377.5 +c N2 X1873 Y313 n3 t0 x895.183 y377.332 +c N4 X1544 Y338.5 n3 t0 x2247.5 y197.5 +c N4 X1379.84 Y3100.81 n3 t0 x2176.5 y3188 +c N5 X340.008 Y3164.55 n4 t0 x1378 y3099 +c N5 X541.5 Y335 n4 t0 x1542.5 y339 +c N5 X1242.66 Y3161.58 n4 t0 x2187 y3265 +c N5 X934.5 Y862 n4 t0 x2186.5 y791 +c N6 X447.037 Y3219.33 n5 t0 x1246 y3163 +c N6 X261.5 Y882.5 n5 t0 x1291.5 y904 +c N6 X1311 Y3023 n5 t0 x2157.5 y3097.5 +c N6 X1216.37 Y678.542 n5 t0 x2140 y596 +c N7 X307.5 Y3086.5 n6 t0 x1310.5 y3023.5 +c N7 X141 Y625.5 n6 t0 x1213.5 y679.5 +c N7 X1012.5 Y275 n6 t0 x1856.5 y199 +c N7 X972 Y3099 n6 t0 x1933 y3143.5 +c N0 X265.5 Y196.5 n7 t0 x1012 y275 +c N0 X137.5 Y3200 n7 t0 x972 y3099 +c N0 X1089 Y988 n7 t0 x2176.5 y928.5 +c N0 X1159.5 Y3106 n7 t0 x2013 y3163.5 +c N1 X195.5 Y3202 n0 t0 x1160.5 y3105.5 +c N1 X68.5 Y1232 n0 t0 x1390 y1246.5 +c N1 X208 Y2037 n0 t0 x1581.84 y2015.84 +c N1 X953 Y1964 n0 t0 x2316 y1959 +c N2 X165.872 Y1941.61 n1 t0 x1297 y1923 +c N2 X1129 Y2041.5 n1 t0 x2242 y2044.5 +c N3 X199 Y1870.5 n2 t0 x1608.51 y1852.44 +c N3 X815 Y1804 n2 t0 x2218 y1788.5 +c N4 X64.0575 Y1886.77 n3 t0 x1224 y1870.5 +c N4 X1130.5 Y1824.5 n3 t0 x2287.05 y1814.06 +c N5 X127.608 Y1827.31 n4 t0 x1572 y1810.5 +c N5 X861 Y1877 n4 t0 x2294.72 y1865.69 +c N6 X148.959 Y1681.98 n5 t0 x1302.5 y1674 +c N6 X1036 Y1975 n5 t0 x2181.78 y1969.91 +c N7 X114.347 Y1777.22 n6 t0 x1438.5 y1762.5 +c N7 X981.561 Y1817.08 n6 t0 x2297 y1802 +c N0 X102.617 Y1767.47 n7 t0 x1305.5 y1755.5 +c N0 X1110 Y1765 n7 t0 x2303.83 y1749.77 +c N5 X540 Y334 n3 t0 x2247.5 y197 +c N5 X340 Y3167 n3 t0 x2175.28 y3188.8 +c N6 X443.5 Y3219 n4 t0 x2187 y3266 +c N6 X28 Y216 n4 t0 x1718.5 y302.5 +c N5 X729 Y336.5 n4 t0 x1720.5 y304 +c N7 X141 Y625.5 n5 t0 x2139.5 y596 +c N7 X311.5 Y3087 n5 t0 x2157 y3098 +c N0 X266 Y194.5 n6 t0 x1856 y196 +c N0 X137 Y3200.5 n6 t0 x1933.5 y3143 +c N1 X197 Y3201 n7 t0 x2012 y3165.5 +c N1 X637 Y1224 n1 t1 x637.5 y2218 +c N5 X832 Y1296 n5 t1 x888.5 y2731.5 + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |