Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ped-dyn-emp/petrack
1 result
Show changes
Commits on Source (16)
Showing
with 253 additions and 64 deletions
......@@ -151,9 +151,11 @@ set(AUTOGEN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_autogen")
#**********************************************************
# Create library and exectuable *
#**********************************************************
get_git_info()
add_library(petrack_core STATIC)
add_executable(petrack src/main.cpp)
target_link_libraries(petrack PRIVATE petrack_core)
target_link_libraries(petrack PRIVATE petrack_core git-info)
target_compile_definitions(petrack PUBLIC PETRACK_VERSION="${PROJECT_VERSION}")
target_compile_options(petrack_core PRIVATE ${COMMON_COMPILE_OPTIONS})
target_compile_definitions(petrack_core PUBLIC STEREO_DISABLED)
......@@ -235,7 +237,9 @@ if(BUILD_UNIT_TESTS)
find_package(Qt5Test REQUIRED)
add_subdirectory(${CMAKE_SOURCE_DIR}/tests/unit_test)
target_link_libraries(petrack_tests PRIVATE petrack_core)
target_link_libraries(petrack_tests PRIVATE petrack_core git-info)
target_compile_definitions(petrack_tests PUBLIC PETRACK_VERSION="${PROJECT_VERSION}")
target_link_libraries(petrack_tests PRIVATE Catch2::Catch2 Qt5::Test trompeloeil)
target_include_directories(petrack_tests PRIVATE
......@@ -258,6 +262,7 @@ target_sources(petrack_core PRIVATE
include/petrack.h
include/helper.h
include/control.h
include/compilerInformation.h
include/stereoWidget.h
include/colorRangeWidget.h
include/colorMarkerWidget.h
......
......@@ -15,3 +15,71 @@ function(check_prefix_path)
endforeach()
endif()
endfunction()
function(get_git_info)
################################################################################
# VCS info
################################################################################
find_package(Git QUIET)
find_program(GIT_SCM git DOC "Git version control")
mark_as_advanced(GIT_SCM)
find_file(GITDIR NAMES .git PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
if (GIT_SCM AND GITDIR)
# the commit's SHA1, and whether the building workspace was dirty or not
# describe --match=NeVeRmAtCh --always --tags --abbrev=40 --dirty
execute_process(COMMAND
"${GIT_EXECUTABLE}" --no-pager describe --tags --always --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# branch
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# the date of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%ad --date=local
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND
"${GIT_EXECUTABLE}" describe --tags --abbrev=0
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_TAG
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# the subject of the commit
execute_process(COMMAND
"${GIT_EXECUTABLE}" log -1 --format=%s
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_SUBJECT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# remove # from subject
string(REGEX REPLACE "[\#\"]+"
"" GIT_COMMIT_SUBJECT
${GIT_COMMIT_SUBJECT})
else()
message(STATUS "Not in a git repo")
set(GIT_SHA1 "UNKNOWN")
set(GIT_DATE "UNKNOWN")
set(GIT_COMMIT_SUBJECT "UNKNOWN")
set(GIT_BRANCH "UNKNOWN")
set(GIT_TAG "UNKNOWN")
endif()
add_library(git-info INTERFACE)
target_compile_definitions(git-info INTERFACE
GIT_COMMIT_HASH="${GIT_SHA1}"
GIT_COMMIT_DATE="${GIT_DATE}"
GIT_TAG="${GIT_TAG}"
GIT_COMMIT_SUBJECT="${GIT_COMMIT_SUBJECT}"
GIT_BRANCH="${GIT_BRANCH}"
)
endfunction()
/*
* PeTrack - Software for tracking pedestrians movement in videos
* Copyright (C) 2010-2020 Forschungszentrum Jülich GmbH,
* Maik Boltes, Juliane Adrian, Ricardo Martin Brualla, Arne Graf, Paul Häger, Daniel Hillebrand,
* Deniz Kilic, Paul Lieberenz, Daniel Salden, Tobias Schrödter, Ann Katrin Seemann
*
* 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/>.
*/
#ifndef COMPILERINFORMATION_H
#define COMPILERINFORMATION_H
// Taken from:
// https://stackoverflow.com/questions/38530981/output-compiler-version-in-a-c-program#38531037
std::string versionString(int major, int minor, int patch)
{
std::ostringstream ss;
ss << major << '.' << minor << '.' << patch;
return ss.str();
}
// Taken from:
// https://sourceforge.net/p/predef/wiki/Compilers/
constexpr const char * COMPILER_ID{
#ifdef __clang__
"clang++"
#elif defined(__GNUC__)
#if defined(__MINGW32__)
"g++(MinGW)"
#else
"g++"
#endif
#elif defined(_MSC_VER)
"Visual Studio"
#else
"Compiler not identified"
#endif
};
const std::string COMPILER_VERSION =
#ifdef __clang__
versionString(__clang_major__, __clang_minor__, __clang_patchlevel__);
#elif defined(__GNUC__)
#if defined(__MINGW32__)
versionString(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+ "(" +versionString(__MINGW32__, __MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION) + ")";
#else
versionString(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif
#elif defined(_MSC_VER)
versionString(_MSC_VER, _MSC_FULL_VER, _MSC_BUILD);
#else
"";
#endif
const std::string COMPILE_TIMESTAMP = __TIMESTAMP__;
#endif //COMPILERINFORMATION_H
......@@ -62,9 +62,6 @@ inline std::ostream& operator<<(std::ostream& s, const QString& t)
return s;
}
#define VERSION "0.8"
#define COMPILE_TIME __TIME__
#define COMPILE_DATE __DATE__
#ifndef MIN
#define MIN(a, b) ((a)<(b)?(a):(b))
......@@ -280,4 +277,3 @@ inline clock_t getElapsedTime()
}
#endif
......@@ -412,9 +412,9 @@ public:
inline int getImageBorderSize()
{
if (getBorderFilter()->getEnabled())
if (getBorderFilter()->getEnabled())
return (int) getBorderFilter()->getBorderSize()->getValue();
else
else
return 0;
//mImageBorderSize;
}
......@@ -440,6 +440,34 @@ public:
void updateWindowTitle();
/**
* @brief Sets the information about the compiled PeTrack version.
* @param petrackVersion current PeTrack version
*/
void setPeTrackVersion(const std::string& petrackVersion);
/**
* @brief Sets the information about the compiled git commit hash, commit date,
* and commit branch
* @param gitCommitID commit hash of current version
* @param gitCommitDate commit date of current version
* @param gitCommitBranch commit branch of current version
*/
void setGitInformation(
const std::string& gitCommitID,
const std::string& gitCommitDate,
const std::string& gitCommitBranch);
/**
* @brief Sets the information about the used compiler and time stamp
* @param compileTimeStamp time the program was compiled
* @param compilerID name of the used compiler
* @param compilerVersion version of the used compiler
*/
void setCompileInformation(const std::string &compileTimeStamp,
const std::string &compilerID,
const std::string &compilerVersion);
private:
void createActions();
void createMenus();
......@@ -591,6 +619,16 @@ private:
bool mAutoBackTrack;
bool mAutoTrackOptimizeColor;
bool mLoading;
QString mPetrackVersion{"Unknown"}; ///< Version of PeTrack used to compile
QString mGitCommitID{"Unknown"}; ///< Commit hash used to compile
QString mGitCommitDate{"Unknown"}; ///< Commit date used to compile
QString mGitCommitBranch{"Unknown"}; ///< Branch used to compile
QString mCompileDate{"Unknown"}; ///< Compile date
QString mCompilerID{"Unknown"}; ///< Used compiler
QString mCompilerVersion{"Unknown"}; ///< Used compiler version
};
......
......@@ -22,20 +22,19 @@
#include <QtWidgets>
#include <QMessageBox>
#include <QStyleFactory>
#include <csignal>
#include <sstream>
#include <string>
#include "petrack.h"
#include "helper.h"
#include "tracker.h"
using namespace std;
#include "IO.h"
#include "compilerInformation.h"
// Aufrufbeispiel:
// release/petrack.exe -sequence ../../einzelbilder/wert0001.png -autoSave dir|ttt.avi
#include <stdio.h> /* defines FILENAME_MAX */
#include "signal.h"
#include "IO.h"
// musst be done to store fixed order of attributes in XML files
// see: http://stackoverflow.com/questions/27378143/qt-5-produce-random-attribute-order-in-xml
......@@ -51,25 +50,6 @@ void quit(int sig_number)
int main(int argc, char *argv[])
{
//#if CV_MAJOR_VERSION == 2
//// do opencv 2 code
//debout << "OpenCV 2 is used..." << endl;
//#elif CV_MAJOR_VERSION == 3
//// do opencv 3 code
//debout << "OpenCV 3 is used..." << endl;
//#endif
// char cCurrentPath[FILENAME_MAX];
// if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
// {
// debout << "Error: could not detect working directory!" <<endl;
// return 1;
// }
// cCurrentPath[sizeof(cCurrentPath) - 1] = '\0'; /* not really required */
// printf ("The current working directory is +%s+", cCurrentPath);
Q_INIT_RESOURCE(icons);
QApplication app(argc, argv);
......@@ -82,9 +62,8 @@ int main(int argc, char *argv[])
gApp = &app;
signal(SIGINT, quit); // used to catch ctrl-C and get rid of error "QObject::killTimers: timers cannot be stopped from another thread"
//app.addLibraryPath(cCurrentPath); // "./" for file platforms/qwindows.dll, which now could be stored to main prog folder // only for plugin files
//app.setStyle(new QCleanlooksStyle);// QMacStyle, QPlastiqueStyle, QCleanlooksStyle; kann dann nicht mehr mit "-style motif windows oder platinum" beim aufruf gesetzt werden
app.setStyle(QStyleFactory::create("Fusion")); // added for Qt5
// command line arguments ;leerzeichen zwischen option und argument wird benoetigt
// -project *.ptr: um projekt zu laden
// -sequence *.png: um animation zu laden (ueberschreibt projekt)
......@@ -113,7 +92,7 @@ int main(int argc, char *argv[])
{
QTextDocument doc;
doc.setHtml(commandLineOptionsString);
debout << endl << doc.toPlainText() <<endl;
debout << std::endl << doc.toPlainText() << std::endl;
//debout << commandLineOptionsString <<endl;
QMessageBox::about(NULL, QObject::tr("Command line options"), commandLineOptionsString);
//cout << "Help:\n-----" << endl
......@@ -172,14 +151,24 @@ int main(int argc, char *argv[])
{
// hier koennte je nach dateiendung *pet oder *avi oder *png angenommern werden
// aber ueberpruefen, ob variable project oder sequence schon besetzt!!!
cout << "Option ignored (use -? for help): " << arg.at(i) << endl;
std::cout << "Option ignored (use -? for help): " << arg.at(i) << std::endl;
}
}
std::cout << "Starting PeTrack" << std::endl;
std::cout << "Version: " << PETRACK_VERSION << std::endl;
std::cout << "Commit id: " << GIT_COMMIT_HASH << std::endl;
std::cout << "Commit date: " << GIT_COMMIT_DATE << std::endl;
std::cout << "Build from branch: " << GIT_BRANCH << std::endl;
std::cout << "Compile date: " << COMPILE_TIMESTAMP << std::endl;
std::cout << "Build with: " << COMPILER_ID << " (" << COMPILER_VERSION << ")" << std::endl;
Petrack petrack;
petrack.show(); // damit bei reiner Hilfe nicht angezeigt wird, erst hier der aufruf
petrack.setPeTrackVersion(PETRACK_VERSION);
petrack.setGitInformation(GIT_COMMIT_HASH, GIT_COMMIT_DATE, GIT_BRANCH);
petrack.setCompileInformation(COMPILE_TIMESTAMP, COMPILER_ID, COMPILER_VERSION);
debout << "Starting PeTrack Version " << VERSION << " (Build " << COMPILE_DATE << " " << COMPILE_TIME << ", " << argv[0] << ")" <<endl;
petrack.show(); // damit bei reiner Hilfe nicht angezeigt wird, erst hier der aufruf
// erst nachher ausfuehren, damit reihenfolge der command line argumente keine rolle spielt
if (!project.isEmpty())
......@@ -197,7 +186,7 @@ int main(int argc, char *argv[])
petrack.exportTracker(autoSaveDest); // projekt wird geladen und nur Trajektoprien herausgeschrieben (zB wenn sich .pet (altitude) oder .trc aendert (delrec))
else
petrack.saveSequence(true, false, autoSaveDest); // true spielt keine rolle, sondern wird durch dateiendung bestimmt
return 0; // 0 means exit success// Programm beenden nach speichern! // 1?
return EXIT_SUCCESS; // 0 means exit success// Programm beenden nach speichern! // 1?
}
// hat tracker_file bestimmte Dateiendung txt oder trc, dann wird nur genau diese exportiert, sonst beide
if (autoTrack)
......@@ -294,7 +283,7 @@ int main(int argc, char *argv[])
if (autoSave && (autoSaveDest.right(4) == ".pet"))
{
petrack.saveProject(autoSaveDest);
return 0;
return EXIT_SUCCESS;
}
return app.exec();
......
......@@ -646,12 +646,14 @@ void Petrack::openProject(QString fileName, bool openSeq) // default fileName=""
QDomElement root = doc.firstChildElement("PETRACK");
if (root.hasAttribute("VERSION"))
if (root.attribute("VERSION") != VERSION)
{
if (root.attribute("VERSION") != mPetrackVersion)
{
PWarning(this, tr("PeTrack"), tr("Reading %1:\nDifferent version numbers %2 (application) and %3 (file) may cause problems.").arg(fileName, VERSION, root.attribute("VERSION")));
PWarning(this, tr("PeTrack"), tr("Reading %1:\nDifferent version numbers %2 (application) and %3 (file) may cause problems.").arg(fileName, mPetrackVersion, root.attribute("VERSION")));
//tr("Cannot read content from %1\nbecause of different version numbers\n%2 (application) and %3 (file).").arg(fileName).arg(VERSION).arg(root.attribute("VERSION")));
//return;
}
}
openXml(doc, openSeq);
updateWindowTitle();
}
......@@ -662,7 +664,7 @@ void Petrack::saveXml(QDomDocument &doc)
QDomElement elem;
QDomElement root = doc.createElement("PETRACK");
root.setAttribute("VERSION", VERSION);
root.setAttribute("VERSION", mPetrackVersion);
doc.appendChild(root);
// main settings (window size, status hight)
......@@ -921,10 +923,10 @@ void Petrack::updateWindowTitle()
QSize size = mAnimation->getSize();
if (QFileInfo(mProFileName).isDir())
title = tr("PeTrack (v") + VERSION + tr("): ");
title = tr("PeTrack (v") + mPetrackVersion + tr("): ");
else
{
title = tr("PeTrack (v") + VERSION + tr("): ") + QFileInfo(mProFileName).fileName();
title = tr("PeTrack (v") + mPetrackVersion + tr("): ") + QFileInfo(mProFileName).fileName();
if (mAnimation->isVideo() || mAnimation->isImageSequence())
title += "; ";
}
......@@ -1448,13 +1450,19 @@ void Petrack::resetSettings()
void Petrack::about()
{
QString message =
"<p><b>PeTrack</b> - Pedestrian tracking<br>"
"Version: " + mPetrackVersion + "<br>"
"Commit hash: " + mGitCommitID + "<br>"
"Commit date: " + mGitCommitDate + "<br>"
"Commit branch: " + mGitCommitBranch + "<br>"
"Compiler: " + mCompilerID + " (" + mCompilerVersion + ")<br>"
"Compile date: " + mCompileDate + "</p>"
"&copy; Forschungszentrum Juelich GmbH</p>";
//People/Pedestrian/Person tracking
QMessageBox::about(this, tr("About PeTrack"),
tr("<p><b>PeTrack</b> - Pedestrian tracking<br>" //&nbsp;&nbsp;&nbsp;&nbsp;
"Version " VERSION "<br>"
"(Build " COMPILE_DATE " " COMPILE_TIME ")</p>"
"<p>by Maik Boltes, Daniel Salden<br>"
"&copy; Forschungszentrum Juelich GmbH</p>"));
message);
//© &copy; &#169; (c)
// folgender befehl wird erst nach About-Fenster ausgefuehrt und ersetzt Icon im Hauptfenster
//QApplication::activeWindow()->setWindowIcon(QIcon(":/icon"));
......@@ -4205,4 +4213,27 @@ void Petrack::skipToFrameWheel(int delta)
mPlayerWidget->skipToFrame(mPlayerWidget->getPos()+delta);
}
void Petrack::setPeTrackVersion(const std::string& petrackVersion)
{
mPetrackVersion = QString::fromStdString(petrackVersion);
}
void Petrack::setGitInformation(
const std::string& gitCommitID,
const std::string& gitCommitDate,
const std::string& gitCommitBranch)
{
mGitCommitID= QString::fromStdString(gitCommitID);
mGitCommitDate = QString::fromStdString(gitCommitDate);
mGitCommitBranch = QString::fromStdString(gitCommitBranch);
}
void Petrack::setCompileInformation(const std::string &compileTimeStamp, const std::string &compilerID,
const std::string &compilerVersion)
{
mCompileDate = QString::fromStdString(compileTimeStamp);
mCompilerID = QString::fromStdString(compilerID);
mCompilerVersion = QString::fromStdString(compilerVersion);
}
#include "moc_petrack.cpp"
<?xml version="1.0" ?>
<!DOCTYPE PETRACK>
<PETRACK VERSION="0.8">
<PETRACK VERSION="0.8.14">
<MAIN SRC="P:/ped/regressiontest_petrack/acceptedTruth/input/CodeMarkerTests.mp4;codeMarker.mp4" STATUS_HEIGHT="0"/>
<CONTROL TAB="2">
<CALIBRATION>
......
version 3
0
# PeTrack project: codeMarker.pet
# raw trajectory file: codeMarker_test.trc
# framerate: 25 fps
# z: can be 3d position or height of person (alternating or not)
# id frame x/cm y/cm z/cm
<?xml version="1.0" ?>
<!DOCTYPE PETRACK>
<PETRACK VERSION="0.8">
<PETRACK VERSION="0.8.14">
<MAIN SRC="P:/ped/regressiontest_petrack/acceptedTruth/input\markerCasern.avi;markerCasern.avi" STATUS_HEIGHT="180"/>
<CONTROL TAB="0">
<CALIBRATION>
......
<?xml version="1.0" ?>
<!DOCTYPE PETRACK>
<PETRACK VERSION="0.8">
<PETRACK VERSION="0.8.14">
<MAIN SRC="markerJapan/000100000.jpg;P:/ped/regressiontest_petrack/acceptedTruth/input/markerJapan/000100000.jpg" STATUS_HEIGHT="0"/>
<CONTROL TAB="0">
<CALIBRATION>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE PETRACK>
<PETRACK VERSION="0.8">
<PETRACK VERSION="0.8.14">
<MAIN SRC="./multiColorMarkerWithAruco.mp4" STATUS_HEIGHT="0"/>
<CONTROL TAB="1">
<CALIBRATION>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE PETRACK>
<PETRACK VERSION="0.8">
<PETRACK VERSION="0.8.14">
<MAIN SRC="C:/temp/petrack/tests/regression_test/data/multiColorMarkerWithAruco_dictMip36h12.mp4;multiColorMarkerWithAruco_dictMip36h12.mp4" STATUS_HEIGHT="0"/>
<CONTROL TAB="1">
<CALIBRATION>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE PETRACK>
<PETRACK VERSION="0.8">
<PETRACK VERSION="0.8.14">
<MAIN SRC="C:/Users/Deniz/Documents/petrack/tests/regression_test/data/multicolor.mp4;multicolor.mp4" STATUS_HEIGHT="0"/>
<CONTROL TAB="2">
<CALIBRATION>
......