Skip to content
Snippets Groups Projects
Commit eff19806 authored by d.kilic's avatar d.kilic
Browse files

fix: empty export

It could happen that PeTrack deleted all trajectories on loading a new project,
because it thought the intrinsic calibration changed. Whether that happened or not
depended on the exact options in the .pet file. 
Fixed by accepting the loaded calibration as not new, no matter what the options are.
parent e6619fd1
No related branches found
No related tags found
1 merge request!415Empty export
......@@ -630,6 +630,14 @@ void Petrack::openXml(QDomDocument &doc, bool openSeq)
// reset background and first skip to selected frame
mBackgroundFilter.reset();
}
if(frame == mAnimation.getCurrentFrameNum())
{
// needed such that e.g. the calibration is marked as known
// else, the first updateImage call would be after loading the trajectories
// and they would be immediately deleted, because the intrinsic is new
// skipToFrame only calls it if we are not already there
updateImage();
}
// will call updateImage and update bg
mPlayerWidget->skipToFrame(frame);
}
......@@ -674,6 +682,7 @@ void Petrack::openXml(QDomDocument &doc, bool openSeq)
mPlayerWidget->setPlaybackFPS(playbackFps);
setSequenceFPS(sequenceFps); // set here to override the fps from the default fps of the sequence
}
updateImage(); // needed to undistort, draw border, etc. for first display
setLoading(false);
}
......@@ -1849,9 +1858,6 @@ void Petrack::setCamera()
}
updateImage(mAnimation.getFrameAtIndex(
mAnimation.getCurrentFrameNum())); // wird nur aufgerufen, wenn left / right sich geaendert hat
// mPlayerWidget->updateImage();
// mPlayerWidget->skipToFrame(mPlayerWidget->getPos()); // machtpasue!!
// updateImage(true); // nur dies aufrufen, wenn nicht links rechts gleichzeitig gehalten wird
}
/**
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE PETRACK>
<PETRACK VERSION="0.10.7">
<MAIN SRC="markerJapan/000100000.jpg" STATUS_HEIGHT="0"/>
<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="2" 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="16"/>
<PARAM ADAPTIVE_THRESH_CONSTANT="7" ADAPTIVE_THRESH_WIN_SIZE_MAX="23" 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>
<YOLO_MARKER>
<PARAMS CONF_THRESHOLD="0.5" IMAGE_SIZE="640" MODEL_FILE="" NAMES_FILE="" NMS_THRESHOLD="0.5" SCORE_THRESHOLD="0.5"/>
</YOLO_MARKER>
<CONTROL TAB="0">
<CALIBRATION>
<FILTER_BEFORE IMMUTABLE="0"/>
<BRIGHTNESS ENABLED="0" VALUE="0"/>
<CONTRAST ENABLED="0" VALUE="0"/>
<BORDER COLOR="#000000" ENABLED="1" VALUE="15"/>
<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="" ENABLED="1" EXT_MODEL_ENABLED="0" FIX_CENTER="0" IMMUTABLE="0" QUAD_ASPECT_RATIO="0" TANG_DIST="1">
<OLD_MODEL CX="973" CY="620" FX="1653.49" FY="1673.5599999999999" K4="0" K5="0" K6="0" R2="0.000681" R4="-0.227154" R6="0" ReprError="nan" S1="0" S2="0" S3="0" S4="0" TAUX="0" TAUY="0" TX="0.0042730002" TY="0.00044800001"/>
<EXT_MODEL CX="551.5" CY="383.5" FX="881" FY="881" K4="0" K5="0" K6="0" R2="0" R4="0" R6="0" ReprError="nan" S1="0" S2="0" S3="0" S4="0" TAUX="0" TAUY="0" TX="0" TY="0"/>
</INTRINSIC_PARAMETERS>
<EXTRINSIC_PARAMETERS ALTITUDE="2035" 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="1" 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="1" IMMUTABLE_COORD_BOX="0" IMMUTABLE_EXTRINSIC_BOX="0" ROTATE="3594" SCALE="1000" SHOW="1" SHOW_CALIB_POINTS="0" TRANS_X="14450" TRANS_Y="5468" UNIT="120" USE_INTRINSIC_CENTER="0"/>
<ALIGNMENT_GRID FIX="1" GRID3D_RESOLUTION="100" GRID3D_TRANS_X="0" GRID3D_TRANS_Y="0" GRID3D_TRANS_Z="0" GRID_DIMENSION="1" IMMUTABLE="0" ROTATE="895" SCALE="1001" SHOW="0" TRANS_X="392" TRANS_Y="586"/>
</CALIBRATION>
<RECOGNITION>
<PERFORM ENABLED="0" METHOD="4" MLMETHOD="0" STEP="1"/>
<REGION_OF_INTEREST FIX="1" HEIGHT="351" SHOW="1" WIDTH="777" X="1154" Y="373"/>
<MARKER BRIGHTNESS="50" IGNORE_WITHOUT="1"/>
<SIZE_COLOR AUTO_WB="0" DEFAULT_HEIGHT="173" 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="0" HEIGHT="0" INV_HUE="0" MAP_HEIGHT="180" TO_HUE="0" TO_SAT="0" TO_VAL="0" WIDTH="0" 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="1140" SHOW="0" WIDTH="1980" X="-30" Y="-30"/>
<SEARCH_MISSING_FRAMES ENABLED="0"/>
<RECALCULATE_MEDIAN_HEIGHT ENABLED="0"/>
<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="1"/>
<EXPORT_ANGLE_OF_VIEW ENABLED="0"/>
<EXPORT_USE_METER ENABLED="0"/>
<EXPORT_COMMENT ENABLED="0"/>
<EXPORT_MARKERID ENABLED="0"/>
<TRACK_FILE FILENAME="markerJapan_truth.trc"/>
<SEARCH_REGION ADAPTIVE="0" LEVELS="1" MAX_ERROR="0" SCALE="14" SHOW="1"/>
<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" 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="1" ONLY_VISIBLE="0" PATH_SIZE="1" POINTS_COLORED="1" POINTS_SIZE="4" SHOW="1" SHOW_COLLECTIVE_COLOR="1" SHOW_COLOR_MARKER="1" SHOW_COMPLETE="0" SHOW_CURRENT_POINT="1" SHOW_GROUND_PATH="0" SHOW_GROUND_POSITION="0" SHOW_NUMBER="1" SHOW_PATH="1" SHOW_POINTS="1" 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>
<CORRECTION>
<EQUALITY DISTANCE="0.5" ENABLED="1"/>
<VELOCITY ENABLED="1"/>
<LENGTH ENABLED="1" MIN_LENGTH="10"/>
<INSIDE ENABLED="1" MARGIN="30"/>
</CORRECTION>
</CONTROL>
<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>
<EXTR_CALIBRATION>
<REPROJECTION_ERROR AVG_DH="0" AVG_PH="0" AVG_PX="0" MAX_DH="4.6653580084069812e-310" MAX_PH="4.6653566439403536e-310" MAX_PX="6.9526629706364624e-310" SD_DH="4.6653566439399583e-310" SD_PH="6.9526629706257906e-310" SD_PX="2.033759975024312e-156" USED_HEIGHT="6.9526629706234191e-310"/>
</EXTR_CALIBRATION>
<MOCAP COLOR="#ffff37" SHOW="0" SIZE="2"/>
<PLAYER FRAME="0" PLAYBACK_FPS="25" PLAYER_SPEED_FIXED="0" SEQUENCE_FPS="25" SOURCE_FRAME_IN="-1" SOURCE_FRAME_OUT="2679"/>
<VIEW ANTIALIAS="0" CAMERA="2" HIDE_CONTROLS="0" OPENGL="0" SAVE_TRANSFORMED="0" TRANSFORMATION="229 0 0 0"/>
<AUTO_TRACK BACK_TRACK="0" OPTIMZE_COLOR="0"/>
<MISSING_FRAMES executed="0"/>
</PETRACK>
#
# PeTrack - Software for tracking pedestrians movement in videos
# Copyright (C) 2025 Forschungszentrum Jülich GmbH, IAS-7
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 program. If not, see <https://www.gnu.org/licenses/>.
#
import subprocess
from pathlib import Path
def test_export_nonempty(pytestconfig):
# had problems with empty exports; this is a regression test for the fix
petrack_path = pytestconfig.getoption("path")
ground_truth = "../data/markerJapan_truth.txt"
output = "../data/trc_loading_file.txt"
project = "../data/load_trc_file.pet"
# open and save (only saving would write last opened video as SRC)
subprocess.run(
[
petrack_path,
"-project",
project,
"-autosave",
output,
"-platform",
"offscreen",
],
check=True,
)
assert len(Path(output).read_text().splitlines()) == len(
Path(ground_truth).read_text().splitlines()
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment