From 0e3fbb3ab6105958190270cf4af7bf527ef3084c Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Thu, 10 Apr 2014 15:15:56 -0400 Subject: [PATCH] added GroundTruth plugin --- openbr/plugins/misc.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+), 0 deletions(-) diff --git a/openbr/plugins/misc.cpp b/openbr/plugins/misc.cpp index eee78ca..d17edd1 100644 --- a/openbr/plugins/misc.cpp +++ b/openbr/plugins/misc.cpp @@ -288,6 +288,34 @@ BR_REGISTER(Transform, RenameFirstTransform) /*! * \ingroup transforms + * \brief Add any ground truth to the template using the file's base name. + * \author Josh Klontz \cite jklontz + */ +class GroundTruthTransform : public UntrainableMetaTransform +{ + Q_OBJECT + Q_PROPERTY(QString groundTruth READ get_groundTruth WRITE set_groundTruth RESET reset_groundTruth STORED false) + BR_PROPERTY(QString, groundTruth, "") + + QMap files; + + void init() + { + foreach (const File &file, TemplateList::fromGallery(groundTruth).files()) + files.insert(file.baseName(), file); + } + + void project(const Template &src, Template &dst) const + { + dst = src; + dst.file.append(files[dst.file.baseName()].localMetadata()); + } +}; + +BR_REGISTER(Transform, GroundTruthTransform) + +/*! + * \ingroup transforms * \brief Change the br::Template::file extension * \author Josh Klontz \cite jklontz */ -- libgit2 0.21.4