Commit 0ed2ab7c2d14e82e6259a23ac17a4e34e7617de8
1 parent
17a1aa72
remove averagepoints
Showing
1 changed file
with
0 additions
and
43 deletions
openbr/plugins/metadata/averagepoints.cpp deleted
| 1 | -#include <openbr/plugins/openbr_internal.h> | |
| 2 | - | |
| 3 | -namespace br | |
| 4 | -{ | |
| 5 | - | |
| 6 | -/*! | |
| 7 | - * \ingroup transforms | |
| 8 | - * \brief Averages a set of landmarks into a new landmark | |
| 9 | - * \author Brendan Klare \cite bklare | |
| 10 | - */ | |
| 11 | -class AveragePointsTransform : public UntrainableMetadataTransform | |
| 12 | -{ | |
| 13 | - Q_OBJECT | |
| 14 | - Q_PROPERTY(QList<int> indices READ get_indices WRITE set_indices RESET reset_indices STORED false) | |
| 15 | - Q_PROPERTY(QString metaName READ get_metaName WRITE set_metaName RESET reset_metaName STORED true) | |
| 16 | - Q_PROPERTY(bool append READ get_append WRITE set_append RESET reset_append STORED true) | |
| 17 | - BR_PROPERTY(QList<int>, indices, QList<int>()) | |
| 18 | - BR_PROPERTY(QString, metaName, "") | |
| 19 | - BR_PROPERTY(bool, append, false) | |
| 20 | - | |
| 21 | - void projectMetadata(const File &src, File &dst) const | |
| 22 | - { | |
| 23 | - dst = src; | |
| 24 | - float x1 = 0, y1 = 0; | |
| 25 | - | |
| 26 | - for (int i = 0; i < indices.size(); i++) { | |
| 27 | - x1 += src.points()[indices[i]].x(); | |
| 28 | - y1 += src.points()[indices[i]].y(); | |
| 29 | - } | |
| 30 | - | |
| 31 | - QPointF p(x1 / indices.size(), y1 / indices.size()); | |
| 32 | - if (!metaName.isEmpty()) | |
| 33 | - dst.set(metaName, p); | |
| 34 | - if (append) | |
| 35 | - dst.appendPoint(p); | |
| 36 | - } | |
| 37 | -}; | |
| 38 | - | |
| 39 | -BR_REGISTER(Transform, AveragePointsTransform) | |
| 40 | - | |
| 41 | -} // namespace br | |
| 42 | - | |
| 43 | -#include "metadata/averagepoints.moc" |