diff --git a/src/autoCalib.cpp b/src/autoCalib.cpp index 0f070ba76e54cc1d55c322345e93b0a07ccd7b71..e113b6e56899ef6232600f89606495fbd66a2888 100644 --- a/src/autoCalib.cpp +++ b/src/autoCalib.cpp @@ -279,6 +279,7 @@ AutoCalib::autoCalib(bool quadAspectRatio, bool fixCenter, bool tangDist, bool e dist_coeffs, &reproj_errs); + SPDLOG_INFO("{}", ok ? "Calibration succeeded." : "Calibration failed."); SPDLOG_INFO("Intrinsic reprojection error is: {:f}", reproj_errs); @@ -379,10 +380,16 @@ int AutoCalib::runCalibration( camera_matrix.ptr<double>(1)[1] = 1.; } - + cv::Mat dist_coeffs_out; *reproj_errs = calibrateCamera( - object_points, image_points, img_size, camera_matrix, dist_coeffs, rot_vects, trans_vects, flags); + object_points, image_points, img_size, camera_matrix, dist_coeffs_out, rot_vects, trans_vects, flags); + // guarantee the same size by only changing new values; input is a zero-vector + // (some methods generate less coefficients than others/ normal vs. extended model) + for(int i = 0; i < dist_coeffs_out.cols; ++i) + { + dist_coeffs.at<double>(i) = dist_coeffs_out.at<double>(i); + } code = 1; return code; diff --git a/tests/regression_test/data/00_empty.pet b/tests/regression_test/data/00_empty.pet new file mode 100644 index 0000000000000000000000000000000000000000..ec40660a195991ecff6ae7de1015a1078df1da4a --- /dev/null +++ b/tests/regression_test/data/00_empty.pet @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE PETRACK> +<PETRACK VERSION="0.9.3"> + <MAIN SRC="" STATUS_HEIGHT="0"/> + <CONTROL TAB="0"> + <CALIBRATION> + <BRIGHTNESS ENABLED="0" VALUE="0"/> + <CONTRAST ENABLED="0" VALUE="0"/> + <BORDER COLOR="#000000" ENABLED="0" VALUE="0"/> + <SWAP ENABLED="0" HORIZONTALLY="0" VERTICALLY="0"/> + <BG_SUB DELETE="1" DELETE_NUMBER="3" ENABLED="0" FILE="" SHOW="0" UPDATE="0"/> + <PATTERN BOARD_SIZE_X="6" BOARD_SIZE_Y="8" SQUARE_SIZE="4.5999999"/> + <INTRINSIC_PARAMETERS CALIB_FILES="" CX="511.5" CY="383.5" ENABLED="0" EXT_MODEL_ENABLED="0" FIX_CENTER="0" FX="881" FY="881" K4="0" K5="0" K6="0" QUAD_ASPECT_RATIO="0" R2="0" R4="0" R6="0" ReprError="nan" S1="0" S2="0" S3="0" S4="0" TANG_DIST="1" TAUX="0" TAUY="0" TX="0" TY="0"/> + <EXTRINSIC_PARAMETERS ALTITUDE="535" COORD3D_AXIS_LEN="200" COORD3D_SWAP_X="0" COORD3D_SWAP_Y="0" COORD3D_SWAP_Z="0" COORD3D_TRANS_X="0" COORD3D_TRANS_Y="0" COORD3D_TRANS_Z="0" COORD_DIMENSION="0" EXTERNAL_CALIB_FILE="" EXTR_ROT_1="0" EXTR_ROT_2="0" EXTR_ROT_3="0" EXTR_TRANS_1="0" EXTR_TRANS_2="0" EXTR_TRANS_3="-500" FIX="0" ROTATE="0" SCALE="100" SHOW="0" SHOW_CALIB_POINTS="0" TRANS_X="0" TRANS_Y="0" UNIT="100" USE_INTRINSIC_CENTER="0"/> + <ALIGNMENT_GRID FIX="0" GRID3D_RESOLUTION="100" GRID3D_TRANS_X="0" GRID3D_TRANS_Y="0" GRID3D_TRANS_Z="0" GRID_DIMENSION="0" ROTATE="0" SCALE="100" SHOW="0" TRANS_X="0" TRANS_Y="0"/> + </CALIBRATION> + <RECOGNITION> + <PERFORM ENABLED="0" METHOD="5" STEP="1"/> + <REGION_OF_INTEREST FIX="0" HEIGHT="0" SHOW="0" WIDTH="0" X="0" Y="0"/> + <MARKER BRIGHTNESS="50" IGNORE_WITHOUT="1"/> + <SIZE_COLOR AUTO_WB="0" DEFAULT_HEIGHT="180" GREY_LEVEL="50" MAP_NUMBER="0" MODEL="0" SHOW="1" SYMBOL_SIZE="10" X="0" Y="1" Z="255"> + <MAP COLORED="1" FROM_HUE="0" FROM_SAT="0" FROM_VAL="128" HEIGHT="255" INV_HUE="0" MAP_HEIGHT="180" TO_HUE="359" TO_SAT="255" TO_VAL="255" WIDTH="359" X="0" Y="0"/> + </SIZE_COLOR> + <READ_HEIGHTS HEIGHT_FILE=""/> + <READ_MARKER_IDS MARKER_FILE=""/> + </RECOGNITION> + <TRACKING> + <ONLINE_CALCULATION ENABLED="0"/> + <REPEAT_BELOW ENABLED="1" QUALITY="50"/> + <EXTRAPOLATION ENABLED="1"/> + <MERGE ENABLED="0"/> + <ONLY_VISIBLE ENABLED="1"/> + <REGION_OF_INTEREST FIX="0" HEIGHT="0" SHOW="0" WIDTH="0" X="0" Y="0"/> + <SEARCH_MISSING_FRAMES ENABLED="1"/> + <RECALCULATE_MEDIAN_HEIGHT ENABLED="1"/> + <ALLOW_ALTERNATE_HEIGHT ENABLED="0"/> + <EXPORT_ELIMINATE_TRACKPOINT_WITHOUT_HEIGHT ENABLED="0"/> + <EXPORT_ELIMINATE_TRAJECTORY_WITHOUT_HEIGHT ENABLED="0"/> + <EXPORT_SMOOTH ENABLED="1"/> + <EXPORT_VIEWING_DIRECTION ENABLED="0"/> + <EXPORT_ANGLE_OF_VIEW ENABLED="0"/> + <EXPORT_USE_METER ENABLED="0"/> + <EXPORT_COMMENT ENABLED="0"/> + <EXPORT_MARKERID ENABLED="0"/> + <TEST_EQUAL ENABLED="1"/> + <TEST_VELOCITY ENABLED="1"/> + <TEST_INSIDE ENABLED="1"/> + <TEST_LENGTH ENABLED="1"/> + <TRACK_FILE FILENAME=""/> + <SEARCH_REGION ADAPTIVE="0" LEVELS="3" MAX_ERROR="0" SCALE="16" SHOW="0"/> + <PATH AFTER="15" BEFORE="15" COLLECTIVE_COLOR_SIZE="11" COLOR_MARKER_LINE_WIDTH="1" COLOR_MARKER_SIZE="14" CURRENT_POINT_LINE_WIDTH="1" CURRENT_POINT_SIZE="60" FIX="0" GROUND_PATH_SIZE="1" GROUND_POSITION_SIZE="1" HEAD_SIZE="1" NUMBER_BOLD="1" NUMBER_SIZE="14" ONLY_PEOPLE="0" ONLY_PEOPLE_LIST="0" ONLY_PEOPLE_NR="1" ONLY_PEOPLE_NR_LIST="" ONLY_VISIBLE="0" PATH_SIZE="2" POINTS_COLORED="1" POINTS_SIZE="7" SHOW="1" SHOW_COLLECTIVE_COLOR="1" SHOW_COLOR_MARKER="1" SHOW_CURRENT_POINT="1" SHOW_GROUND_PATH="0" SHOW_GROUND_POSITION="0" SHOW_NUMBER="1" SHOW_PATH="1" SHOW_POINTS="0" SHOW_POINTS_LINE_WIDTH="1" TRACK_GROUND_PATH_COLOR="#00ff00" TRACK_PATH_COLOR="#ff0000"/> + </TRACKING> + <ANALYSIS> + <SEARCH_MISSING_FRAMES ENABLED="1"/> + <MARK_ACTUAL ENABLED="0"/> + <CALCULATION ABSOLUTE="0" CONSIDER_X="0" CONSIDER_Y="1" REVERSE="0" SHOW_VORONOI="0" STEP_SIZE="25"/> + </ANALYSIS> + </CONTROL> + <EXTR_CALIBRATION> + <REPROJECTION_ERROR AVG_DH="6.952642160144429e-310" AVG_PH="4.6632137672154514e-310" AVG_PX="4.9406564584124654e-324" MAX_DH="4.6632130749188108e-310" MAX_PH="4.6632130749149077e-310" MAX_PX="4.6632132612882775e-310" SD_DH="4.6632137672154514e-310" SD_PH="6.9526421601088563e-310" SD_PX="6.952642160144429e-310" USED_HEIGHT="4.6632137672154514e-310"/> + </EXTR_CALIBRATION> + <STEREO> + <DISPARITY ALGO="0" COLOR="0" HIDE_INVALID="1" OPACITY="100" SHOW="0"> + <VALUES MAX="100" MIN="0"/> + <MASK EDGE_SIZE="5" SIZE="7" USE_EDGE="0"/> + <USE CALIB_CENTER="1" EXPORT="0" HEIGHT="0" HEIGHT_EVER="1" RECO="0"/> + </DISPARITY> + </STEREO> + <COLOR_MARKER> + <MASK MASK="1" OPACITY="100" SHOW="0"/> + <FROM_COLOR HUE="0" SATURATION="0" VALUE="128"/> + <TO_COLOR HUE="359" SATURATION="255" VALUE="255"/> + <PARAM CLOSE_RADIUS="5" CLOSE_USED="1" INVERS_HUE="0" MAX_AREA="5000" MAX_RATIO="2" MIN_AREA="1000" OPEN_RADIUS="5" OPEN_USED="1"/> + </COLOR_MARKER> + <CODE_MARKER> + <DICTIONARY ID="0"/> + <PARAM ADAPTIVE_THRESH_CONSTANT="7" ADAPTIVE_THRESH_WIN_SIZE_MAX="27" ADAPTIVE_THRESH_WIN_SIZE_MIN="3" ADAPTIVE_THRESH_WIN_SIZE_STEP="10" CORNER_REFINEMENT="0" CORNER_REFINEMENT_MAX_ITERATIONS="30" CORNER_REFINEMENT_MIN_ACCURACY="0.10000000000000001" CORNER_REFINEMENT_WIN_SIZE="5" ERROR_CORRECTION_RATE="0.59999999999999998" MARKER_BORDER_BITS="1" MAX_ERRONEOUS_BITS_IN_BORDER_RATE="0.34999999999999998" MAX_MARKER_PERIMETER="15" MAX_RATIO_ERROR="0.029999999999999999" MIN_CORNER_DISTANCE="0.050000000000000003" MIN_DISTANCE_TO_BORDER="3" MIN_MARKER_DISTANCE="0.050000000000000003" MIN_MARKER_PERIMETER="5" MIN_OTSU_STD_DEV="5" PERSPECTIVE_REMOVE_IGNORED_MARGIN_PER_CELL="0.13" PERSPECTIVE_REMOVE_PIXEL_PER_CELL="4" SHOW_DETECTED_CANDIDATES="0"/> + </CODE_MARKER> + <MULTI_COLOR_MARKER> + <BLACK_DOT IGNORE_WITHOUT="1" RESTRICT_POSITION="0" SIZE="5" USE="1" USE_COLOR="0"/> + <CODE_MARKER USE="0"/> + <AUTO_CORRECT ONLY_EXPORT="0" USE="0"/> + <MASK MASK="1" OPACITY="100" SHOW="0"/> + <PARAM CLOSE_RADIUS="5" CLOSE_USED="1" MAX_AREA="5000" MAX_RATIO="2" MIN_AREA="1000" OPEN_RADIUS="5" OPEN_USED="1" USE_HEAD_SIZE="0"/> + </MULTI_COLOR_MARKER> + <MOCAP COLOR="#ffff37" SHOW="0" SIZE="2"/> + <PLAYER FPS="-1" FRAME="-1" PLAYER_SPEED_FIXED="0" SOURCE_FRAME_IN="-1" SOURCE_FRAME_OUT="-1"/> + <VIEW ANTIALIAS="0" CAMERA="2" HIDE_CONTROLS="0" OPENGL="0" SAVE_TRANSFORMED="0" TRANSFORMATION="250 0 0 0"/> + <AUTO_TRACK BACK_TRACK="1" OPTIMZE_COLOR="0"/> + <MISSING_FRAMES executed="0"/> +</PETRACK> diff --git a/tests/regression_test/data/01_intrinsic.pet b/tests/regression_test/data/01_intrinsic.pet new file mode 100644 index 0000000000000000000000000000000000000000..aed0363810bf22fbff2d742ded189b7d685fcea2 --- /dev/null +++ b/tests/regression_test/data/01_intrinsic.pet @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE PETRACK> +<PETRACK VERSION="0.9.3"> + <MAIN SRC="" STATUS_HEIGHT="0"/> + <CONTROL TAB="0"> + <CALIBRATION> + <BRIGHTNESS ENABLED="0" VALUE="0"/> + <CONTRAST ENABLED="0" VALUE="0"/> + <BORDER COLOR="#000000" ENABLED="0" VALUE="0"/> + <SWAP ENABLED="0" HORIZONTALLY="0" VERTICALLY="0"/> + <BG_SUB DELETE="1" DELETE_NUMBER="3" ENABLED="0" FILE="" SHOW="0" UPDATE="0"/> + <PATTERN BOARD_SIZE_X="6" BOARD_SIZE_Y="8" SQUARE_SIZE="4.5999999"/> + <INTRINSIC_PARAMETERS CALIB_FILES="" CX="952.03999999999996" CY="698.72000000000003" ENABLED="0" EXT_MODEL_ENABLED="0" FIX_CENTER="0" FX="842.57000000000005" FY="842.69000000000005" K4="0" K5="0" K6="0" QUAD_ASPECT_RATIO="0" R2="-0.27662599999999998" R4="0.093287999999999996" R6="-0.01423" ReprError="nan" S1="0" S2="0" S3="0" S4="0" TANG_DIST="1" TAUX="0" TAUY="0" TX="-0.00024699999999999999" TY="5.5000000000000002e-05"/> + <EXTRINSIC_PARAMETERS ALTITUDE="535" COORD3D_AXIS_LEN="200" COORD3D_SWAP_X="0" COORD3D_SWAP_Y="0" COORD3D_SWAP_Z="0" COORD3D_TRANS_X="0" COORD3D_TRANS_Y="0" COORD3D_TRANS_Z="0" COORD_DIMENSION="0" EXTERNAL_CALIB_FILE="" EXTR_ROT_1="0" EXTR_ROT_2="0" EXTR_ROT_3="0" EXTR_TRANS_1="0" EXTR_TRANS_2="0" EXTR_TRANS_3="-500" FIX="0" ROTATE="0" SCALE="100" SHOW="0" SHOW_CALIB_POINTS="0" TRANS_X="0" TRANS_Y="0" UNIT="100" USE_INTRINSIC_CENTER="0"/> + <ALIGNMENT_GRID FIX="0" GRID3D_RESOLUTION="100" GRID3D_TRANS_X="0" GRID3D_TRANS_Y="0" GRID3D_TRANS_Z="0" GRID_DIMENSION="0" ROTATE="0" SCALE="100" SHOW="0" TRANS_X="0" TRANS_Y="0"/> + </CALIBRATION> + <RECOGNITION> + <PERFORM ENABLED="0" METHOD="5" STEP="1"/> + <REGION_OF_INTEREST FIX="0" HEIGHT="0" SHOW="0" WIDTH="0" X="0" Y="0"/> + <MARKER BRIGHTNESS="50" IGNORE_WITHOUT="1"/> + <SIZE_COLOR AUTO_WB="0" DEFAULT_HEIGHT="180" GREY_LEVEL="50" MAP_NUMBER="0" MODEL="0" SHOW="1" SYMBOL_SIZE="10" X="0" Y="1" Z="255"> + <MAP COLORED="1" FROM_HUE="0" FROM_SAT="0" FROM_VAL="128" HEIGHT="255" INV_HUE="0" MAP_HEIGHT="180" TO_HUE="359" TO_SAT="255" TO_VAL="255" WIDTH="359" X="0" Y="0"/> + </SIZE_COLOR> + <READ_HEIGHTS HEIGHT_FILE=""/> + <READ_MARKER_IDS MARKER_FILE=""/> + </RECOGNITION> + <TRACKING> + <ONLINE_CALCULATION ENABLED="0"/> + <REPEAT_BELOW ENABLED="1" QUALITY="50"/> + <EXTRAPOLATION ENABLED="1"/> + <MERGE ENABLED="0"/> + <ONLY_VISIBLE ENABLED="1"/> + <REGION_OF_INTEREST FIX="0" HEIGHT="0" SHOW="0" WIDTH="0" X="0" Y="0"/> + <SEARCH_MISSING_FRAMES ENABLED="1"/> + <RECALCULATE_MEDIAN_HEIGHT ENABLED="1"/> + <ALLOW_ALTERNATE_HEIGHT ENABLED="0"/> + <EXPORT_ELIMINATE_TRACKPOINT_WITHOUT_HEIGHT ENABLED="0"/> + <EXPORT_ELIMINATE_TRAJECTORY_WITHOUT_HEIGHT ENABLED="0"/> + <EXPORT_SMOOTH ENABLED="1"/> + <EXPORT_VIEWING_DIRECTION ENABLED="0"/> + <EXPORT_ANGLE_OF_VIEW ENABLED="0"/> + <EXPORT_USE_METER ENABLED="0"/> + <EXPORT_COMMENT ENABLED="0"/> + <EXPORT_MARKERID ENABLED="0"/> + <TEST_EQUAL ENABLED="1"/> + <TEST_VELOCITY ENABLED="1"/> + <TEST_INSIDE ENABLED="1"/> + <TEST_LENGTH ENABLED="1"/> + <TRACK_FILE FILENAME=""/> + <SEARCH_REGION ADAPTIVE="0" LEVELS="3" MAX_ERROR="0" SCALE="16" SHOW="0"/> + <PATH AFTER="15" BEFORE="15" COLLECTIVE_COLOR_SIZE="11" COLOR_MARKER_LINE_WIDTH="1" COLOR_MARKER_SIZE="14" CURRENT_POINT_LINE_WIDTH="1" CURRENT_POINT_SIZE="60" FIX="0" GROUND_PATH_SIZE="1" GROUND_POSITION_SIZE="1" HEAD_SIZE="1" NUMBER_BOLD="1" NUMBER_SIZE="14" ONLY_PEOPLE="0" ONLY_PEOPLE_LIST="0" ONLY_PEOPLE_NR="1" ONLY_PEOPLE_NR_LIST="" ONLY_VISIBLE="0" PATH_SIZE="2" POINTS_COLORED="1" POINTS_SIZE="7" SHOW="1" SHOW_COLLECTIVE_COLOR="1" SHOW_COLOR_MARKER="1" SHOW_CURRENT_POINT="1" SHOW_GROUND_PATH="0" SHOW_GROUND_POSITION="0" SHOW_NUMBER="1" SHOW_PATH="1" SHOW_POINTS="0" SHOW_POINTS_LINE_WIDTH="1" TRACK_GROUND_PATH_COLOR="#00ff00" TRACK_PATH_COLOR="#ff0000"/> + </TRACKING> + <ANALYSIS> + <SEARCH_MISSING_FRAMES ENABLED="1"/> + <MARK_ACTUAL ENABLED="0"/> + <CALCULATION ABSOLUTE="0" CONSIDER_X="0" CONSIDER_Y="1" REVERSE="0" SHOW_VORONOI="0" STEP_SIZE="25"/> + </ANALYSIS> + </CONTROL> + <EXTR_CALIBRATION> + <REPROJECTION_ERROR AVG_DH="3.5572726500569751e-322" AVG_PH="8.7423532647800221e-318" AVG_PX="2.4703282292062327e-323" MAX_DH="4.6632130749188108e-310" MAX_PH="4.6632130749149077e-310" MAX_PX="4.6632132612882775e-310" SD_DH="4.6632137672154514e-310" SD_PH="6.9526421601088563e-310" SD_PX="6.952642160144429e-310" USED_HEIGHT="4.6632137672154514e-310"/> + </EXTR_CALIBRATION> + <STEREO> + <DISPARITY ALGO="0" COLOR="0" HIDE_INVALID="1" OPACITY="100" SHOW="0"> + <VALUES MAX="100" MIN="0"/> + <MASK EDGE_SIZE="5" SIZE="7" USE_EDGE="0"/> + <USE CALIB_CENTER="1" EXPORT="0" HEIGHT="0" HEIGHT_EVER="1" RECO="0"/> + </DISPARITY> + </STEREO> + <COLOR_MARKER> + <MASK MASK="1" OPACITY="100" SHOW="0"/> + <FROM_COLOR HUE="0" SATURATION="0" VALUE="0"/> + <TO_COLOR HUE="359" SATURATION="255" VALUE="255"/> + <PARAM CLOSE_RADIUS="5" CLOSE_USED="1" INVERS_HUE="0" MAX_AREA="5000" MAX_RATIO="2" MIN_AREA="1000" OPEN_RADIUS="5" OPEN_USED="1"/> + </COLOR_MARKER> + <CODE_MARKER> + <DICTIONARY ID="0"/> + <PARAM ADAPTIVE_THRESH_CONSTANT="7" ADAPTIVE_THRESH_WIN_SIZE_MAX="27" ADAPTIVE_THRESH_WIN_SIZE_MIN="3" ADAPTIVE_THRESH_WIN_SIZE_STEP="10" CORNER_REFINEMENT="0" CORNER_REFINEMENT_MAX_ITERATIONS="30" CORNER_REFINEMENT_MIN_ACCURACY="0.10000000000000001" CORNER_REFINEMENT_WIN_SIZE="5" ERROR_CORRECTION_RATE="0.59999999999999998" MARKER_BORDER_BITS="1" MAX_ERRONEOUS_BITS_IN_BORDER_RATE="0.34999999999999998" MAX_MARKER_PERIMETER="15" MAX_RATIO_ERROR="0.029999999999999999" MIN_CORNER_DISTANCE="0.050000000000000003" MIN_DISTANCE_TO_BORDER="3" MIN_MARKER_DISTANCE="0.050000000000000003" MIN_MARKER_PERIMETER="5" MIN_OTSU_STD_DEV="5" PERSPECTIVE_REMOVE_IGNORED_MARGIN_PER_CELL="0.13" PERSPECTIVE_REMOVE_PIXEL_PER_CELL="4" SHOW_DETECTED_CANDIDATES="0"/> + </CODE_MARKER> + <MULTI_COLOR_MARKER> + <BLACK_DOT IGNORE_WITHOUT="1" RESTRICT_POSITION="0" SIZE="5" USE="1" USE_COLOR="0"/> + <CODE_MARKER USE="0"/> + <AUTO_CORRECT ONLY_EXPORT="0" USE="0"/> + <MASK MASK="1" OPACITY="100" SHOW="0"/> + <PARAM CLOSE_RADIUS="5" CLOSE_USED="1" MAX_AREA="5000" MAX_RATIO="2" MIN_AREA="1000" OPEN_RADIUS="5" OPEN_USED="1" USE_HEAD_SIZE="0"/> + </MULTI_COLOR_MARKER> + <MOCAP COLOR="#ffff37" SHOW="0" SIZE="2"/> + <PLAYER FPS="-1" FRAME="-1" PLAYER_SPEED_FIXED="0" SOURCE_FRAME_IN="0" SOURCE_FRAME_OUT="-1"/> + <VIEW ANTIALIAS="0" CAMERA="2" HIDE_CONTROLS="0" OPENGL="0" SAVE_TRANSFORMED="0" TRANSFORMATION="250 0 0 0"/> + <AUTO_TRACK BACK_TRACK="1" OPTIMZE_COLOR="0"/> + <MISSING_FRAMES executed="0"/> +</PETRACK> diff --git a/tests/regression_test/tests/test_calib.py b/tests/regression_test/tests/test_calib.py index 0747a35f281c6fb4ac923a128fe786c2d772e149..358ba8350bdc1e253db1803b6e204f00f0d2542f 100644 --- a/tests/regression_test/tests/test_calib.py +++ b/tests/regression_test/tests/test_calib.py @@ -87,7 +87,7 @@ def compare_intrinsic_calib(test_pet: ET.ElementTree, truth_pet: ET.ElementTree) assert test_calib_params == approx(truth_calib_params, abs=0.1) -def test_autoCalib(pytestconfig): +def test_autoCalib_default_options(pytestconfig): petrack_path = pytestconfig.getoption("path") project = "../../../demo/00_files/00_empty.pet" real_intrinsic = "../../../demo/01_calibration/01_intrinsic.pet" @@ -114,3 +114,32 @@ def test_autoCalib(pytestconfig): truth_pet = ET.parse(real_intrinsic) compare_intrinsic_calib(test_pet, truth_pet) + + +def test_autoCalib_old_model(pytestconfig): + petrack_path = pytestconfig.getoption("path") + project = "../data/00_empty.pet" + real_intrinsic = "../data/01_intrinsic.pet" + intrinsic_dir = "../../../demo/00_files/calibration/intrinsic" + output = "../data/calibTest.pet" # same for other test, cannot be run concurrently + + # run autocalib on demo project + subprocess.run( + [ + petrack_path, + "-project", + project, + "-autoIntrinsic", + intrinsic_dir, + "-autosave", + output, + "-platform", + "offscreen", + ], + check=True, + ) + + test_pet = ET.parse(output) + truth_pet = ET.parse(real_intrinsic) + + compare_intrinsic_calib(test_pet, truth_pet)