From 7dcdb9f98d47d2e7bff777d755eab1c8951fc873 Mon Sep 17 00:00:00 2001 From: schroedtert <t.schroedter@fz-juelich.de> Date: Thu, 2 Dec 2021 14:24:59 +0100 Subject: [PATCH] Add option to export the view via CLI Signed-off-by: schroedtert <t.schroedter@fz-juelich.de> --- src/helper.cpp | 8 ++++++-- src/main.cpp | 28 ++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/helper.cpp b/src/helper.cpp index bf06459f5..56950aea0 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -34,7 +34,9 @@ QString commandLineOptionsString = QObject::tr( "markerIdFile]</code><br>" " <code>[-autoReadHeight|-autoreadheight " "heightFile]</code><br>" - " <code>[-autoPlay|-autoplay trackerFile]</code></p>" + " <code>[-autoPlay|-autoplay trackerFile]</code><br>" + " <code>[-autoExportView|-autoexportview " + "outputFile]</code></p>" "<dl><dt><kbd>-help|-?</kbd></dt><dd>shows help information for command line options</dd>" "<dt><kbd>-project</kbd></dt><dd>optional option to set project file; otherwise the argument without option flag " "is used as project file</dd>" @@ -53,7 +55,9 @@ QString commandLineOptionsString = QObject::tr( "<dt><kbd>-autoReadHeight|-autoreadheight heightFile</kbd></dt><dd> automatically reads the <kbd>trackerFile</kbd> " "including markerID and individual height and applies the heights to the corresponding person</dd>" "<dt><kbd>-autoPlay|-autoplay trackerFile</kbd></dt><dd>plays the video or image sequence and stores the " - "trajectories to <kbd>trackerFile</kbd></dd></dl>" + "trajectories to <kbd>trackerFile</kbd></dd>" + "<dt><kbd>-autoExportView|-autoexportview outputFile</kbd></dt><dd>exports the view, e.g., the undistorted video " + "or the video with trajectories, to <kbd>outputFile</kbd></dd></dl>" "<p>Example:<br>To generate trajectories from a single image sequence starting with <kbd>frame000.jpg</kbd>" "with settings stored in the project file <kbd>project.pet</kbd>, export tracker file <kbd>trackerFile</kbd>" "and exit with saving the project to <kbd>project.pet</kbd> again:</p>" diff --git a/src/main.cpp b/src/main.cpp index 456e0dc93..8571a48db 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,6 @@ static QApplication *gApp = nullptr; void quit(int sig_number) { gApp->quit(); - return; } int main(int argc, char *argv[]) @@ -76,13 +75,14 @@ int main(int argc, char *argv[]) bool autoPlay = false; bool autoIntrinsic = false; QString intrinsicDir; - - QString autoReadHeightFile; - bool autoReadHeight = false; - QString autoReadMarkerFile; - bool autoReadMarkerID = false; - QString autoSaveTrackerFile; - bool autoSaveTracker = false; + QString autoReadHeightFile; + bool autoReadHeight = false; + QString autoReadMarkerFile; + bool autoReadMarkerID = false; + QString autoSaveTrackerFile; + bool autoSaveTracker = false; + bool autoExportView = false; + QString exportViewFile; for(int i = 1; i < arg.size(); ++i) // i=0 ist Programmname { @@ -154,6 +154,11 @@ int main(int argc, char *argv[]) autoIntrinsic = true; intrinsicDir = arg.at(++i); } + else if((arg.at(i) == "-autoExportView") || (arg.at(i) == "-autoexportview")) + { + autoExportView = true; + exportViewFile = arg.at(++i); + } else { // hier koennte je nach dateiendung *pet oder *avi oder *png angenommern werden @@ -226,6 +231,13 @@ int main(int argc, char *argv[]) petrack.getAutoCalib()->autoCalib(); } + if(autoExportView) + { + QFile outputFile{exportViewFile}; + petrack.saveSequence(true, true, outputFile.fileName()); + return EXIT_SUCCESS; + } + // hat tracker_file bestimmte Dateiendung txt oder trc, dann wird nur genau diese exportiert, sonst beide if(autoTrack) { -- GitLab