From 54dfb088b3f0b4de4acc85f4baa6593aa71a3e81 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Thu, 21 Oct 2021 14:27:39 -0600 Subject: [PATCH] Revert "remove namelandmarks" --- openbr/plugins/metadata/namelandmarks.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+), 0 deletions(-) create mode 100644 openbr/plugins/metadata/namelandmarks.cpp diff --git a/openbr/plugins/metadata/namelandmarks.cpp b/openbr/plugins/metadata/namelandmarks.cpp new file mode 100644 index 0000000..3e2e324 --- /dev/null +++ b/openbr/plugins/metadata/namelandmarks.cpp @@ -0,0 +1,67 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright 2012 The MITRE Corporation * + * * + * Licensed under the Apache License, Version 2.0 (the "License"); * + * you may not use this file except in compliance with the License. * + * You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, software * + * distributed under the License is distributed on an "AS IS" BASIS, * + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * + * See the License for the specific language governing permissions and * + * limitations under the License. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +namespace br +{ + +/*! + * \ingroup transforms + * \brief Name a point/rect + * \author Scott Klum \cite sklum + */ +class NameLandmarksTransform : public UntrainableMetadataTransform +{ + Q_OBJECT + Q_PROPERTY(bool point READ get_point WRITE set_point RESET reset_point STORED false) + BR_PROPERTY(bool, point, true) + Q_PROPERTY(QList indices READ get_indices WRITE set_indices RESET reset_indices STORED false) + Q_PROPERTY(QStringList names READ get_names WRITE set_names RESET reset_names STORED false) + BR_PROPERTY(QList, indices, QList()) + BR_PROPERTY(QStringList, names, QStringList()) + + void projectMetadata(const File &src, File &dst) const + { + const bool makeList = indices.size() != names.size(); + + dst = src; + + if (point) { + QList points = src.points(); + + if (makeList) + dst.setList(names.first(),points); + else + for (int i=0; i rects = src.rects(); + + for (int i=0; i