Commit 1eaac303ac80e4e80d0eb404bfcc51acf9d89528
1 parent
a50d515a
remove randomtemplates
Showing
1 changed file
with
0 additions
and
34 deletions
openbr/plugins/metadata/randomtemplates.cpp deleted
| 1 | -#include <openbr/plugins/openbr_internal.h> | ||
| 2 | - | ||
| 3 | -namespace br | ||
| 4 | -{ | ||
| 5 | - | ||
| 6 | -/*! | ||
| 7 | - * \ingroup transforms | ||
| 8 | - * \author Brendan Klare \cite bklare | ||
| 9 | - * \brief Randomly sample templates from a gallery | ||
| 10 | - */ | ||
| 11 | -class RandomTemplatesTransform : public UntrainableMetaTransform | ||
| 12 | -{ | ||
| 13 | - Q_OBJECT | ||
| 14 | - Q_PROPERTY(float percent READ get_percent WRITE set_percent RESET reset_percent) | ||
| 15 | - BR_PROPERTY(float, percent, .01) | ||
| 16 | - | ||
| 17 | - void project(const Template &, Template &) const { | ||
| 18 | - qFatal("Not supported in RandomTemplates."); | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - void project(const TemplateList &src, TemplateList &dst) const { | ||
| 22 | - for (int i = 0; i < src.size(); i++) { | ||
| 23 | - const float r = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); | ||
| 24 | - if (r <= percent) | ||
| 25 | - dst.append(src[i]); | ||
| 26 | - } | ||
| 27 | - } | ||
| 28 | -}; | ||
| 29 | -BR_REGISTER(Transform, RandomTemplatesTransform) | ||
| 30 | - | ||
| 31 | -} // namespace br | ||
| 32 | - | ||
| 33 | -#include "imgproc/randomtemplates.moc" | ||
| 34 | - |