Commit 0e3fbb3ab6105958190270cf4af7bf527ef3084c
1 parent
d8337ca3
added GroundTruth plugin
Showing
1 changed file
with
28 additions
and
0 deletions
openbr/plugins/misc.cpp
| @@ -288,6 +288,34 @@ BR_REGISTER(Transform, RenameFirstTransform) | @@ -288,6 +288,34 @@ BR_REGISTER(Transform, RenameFirstTransform) | ||
| 288 | 288 | ||
| 289 | /*! | 289 | /*! |
| 290 | * \ingroup transforms | 290 | * \ingroup transforms |
| 291 | + * \brief Add any ground truth to the template using the file's base name. | ||
| 292 | + * \author Josh Klontz \cite jklontz | ||
| 293 | + */ | ||
| 294 | +class GroundTruthTransform : public UntrainableMetaTransform | ||
| 295 | +{ | ||
| 296 | + Q_OBJECT | ||
| 297 | + Q_PROPERTY(QString groundTruth READ get_groundTruth WRITE set_groundTruth RESET reset_groundTruth STORED false) | ||
| 298 | + BR_PROPERTY(QString, groundTruth, "") | ||
| 299 | + | ||
| 300 | + QMap<QString,File> files; | ||
| 301 | + | ||
| 302 | + void init() | ||
| 303 | + { | ||
| 304 | + foreach (const File &file, TemplateList::fromGallery(groundTruth).files()) | ||
| 305 | + files.insert(file.baseName(), file); | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + void project(const Template &src, Template &dst) const | ||
| 309 | + { | ||
| 310 | + dst = src; | ||
| 311 | + dst.file.append(files[dst.file.baseName()].localMetadata()); | ||
| 312 | + } | ||
| 313 | +}; | ||
| 314 | + | ||
| 315 | +BR_REGISTER(Transform, GroundTruthTransform) | ||
| 316 | + | ||
| 317 | +/*! | ||
| 318 | + * \ingroup transforms | ||
| 291 | * \brief Change the br::Template::file extension | 319 | * \brief Change the br::Template::file extension |
| 292 | * \author Josh Klontz \cite jklontz | 320 | * \author Josh Klontz \cite jklontz |
| 293 | */ | 321 | */ |