Commit 503c3ff5a30fc167abf8d4f424d79059017f9cba
1 parent
83ef9293
Actually add propagate
Showing
1 changed file
with
34 additions
and
0 deletions
openbr/plugins/core/propagate.cpp
| 1 | +#include <openbr/plugins/openbr_internal.h> | |
| 1 | 2 | |
| 3 | +namespace br | |
| 4 | +{ | |
| 5 | + | |
| 6 | +/*! | |
| 7 | + * \ingroup transforms | |
| 8 | + * \brief Ensures that a template will be propogated. | |
| 9 | + * \author Scott Klum \cite sklum | |
| 10 | + */ | |
| 11 | +class PropagateTransform : public Transform | |
| 12 | +{ | |
| 13 | + Q_OBJECT | |
| 14 | + | |
| 15 | + Q_PROPERTY(br::Transform *transform READ get_transform WRITE set_transform RESET reset_transform STORED true) | |
| 16 | + BR_PROPERTY(br::Transform *, transform, NULL) | |
| 17 | + | |
| 18 | + void train(const TemplateList &data) | |
| 19 | + { | |
| 20 | + transform->train(data); | |
| 21 | + } | |
| 22 | + | |
| 23 | + void project(const Template &src, Template &dst) const | |
| 24 | + { | |
| 25 | + transform->project(src,dst); | |
| 26 | + if (dst.isEmpty()) | |
| 27 | + dst = src; | |
| 28 | + } | |
| 29 | +}; | |
| 30 | + | |
| 31 | +BR_REGISTER(Transform, PropagateTransform) | |
| 32 | + | |
| 33 | +} // namespace br | |
| 34 | + | |
| 35 | +#include "core/propagate.moc" | ... | ... |