From 1acaf2f3629bf287326ae26831e47f38f873130c Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Tue, 14 Oct 2014 16:56:01 -0400 Subject: [PATCH] Revert "Contraining bounding boxes to be a valid size when using roi" --- openbr/plugins/crop.cpp | 26 +++----------------------- openbr/plugins/landmarks.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/openbr/plugins/crop.cpp b/openbr/plugins/crop.cpp index b62dc67..01b5167 100644 --- a/openbr/plugins/crop.cpp +++ b/openbr/plugins/crop.cpp @@ -49,24 +49,6 @@ class CropTransform : public UntrainableTransform BR_REGISTER(Transform, CropTransform) - -static QRectF constrainRect(int height, int width, const QRectF &rect) -{ - QRectF newRect = rect; - - // roi.x + roi.width <= m.cols && roi.y + roi.height <= m.rows - - if (rect.x() < 0) newRect.setX(0); - if (rect.y() < 0) newRect.setY(0); - - if ((newRect.y() + rect.width()) > width) newRect.setWidth(width-newRect.y()); - if ((newRect.x() + rect.height()) > height) newRect.setHeight(height-newRect.x()); - - qDebug() << ((newRect.x() + newRect.width()) <= width) << ((newRect.y() + newRect.height()) <= height); - - return newRect; -} - /*! * \ingroup transforms * \brief Crops the rectangular regions of interest. @@ -81,13 +63,11 @@ class ROITransform : public UntrainableTransform void project(const Template &src, Template &dst) const { if (!propName.isEmpty()) { - QRectF rect = constrainRect(src.m().rows, src.m().cols, src.file.get(propName)); + QRectF rect = src.file.get(propName); dst += src.m()(OpenCVUtils::toRect(rect)); } else if (!src.file.rects().empty()) { - foreach (const QRectF &rect, src.file.rects()) { - QRectF newRect = constrainRect(src.m().rows, src.m().cols, rect); - dst += src.m()(OpenCVUtils::toRect(newRect)); - } + foreach (const QRectF &rect, src.file.rects()) + dst += src.m()(OpenCVUtils::toRect(rect)); } else if (src.file.contains(QStringList() << "X" << "Y" << "Width" << "Height")) { dst += src.m()(Rect(src.file.get("X"), src.file.get("Y"), diff --git a/openbr/plugins/landmarks.cpp b/openbr/plugins/landmarks.cpp index 059e013..716ecd8 100644 --- a/openbr/plugins/landmarks.cpp +++ b/openbr/plugins/landmarks.cpp @@ -372,7 +372,7 @@ BR_REGISTER(Transform, ReadLandmarksTransform) * \brief Name a point/rect * \author Scott Klum \cite sklum */ -class NameLandmarksTransform : public UntrainableMetadataTransform +class NameLandmarkTransform : public UntrainableMetadataTransform { Q_OBJECT Q_PROPERTY(bool point READ get_point WRITE set_point RESET reset_point STORED false) @@ -406,14 +406,14 @@ class NameLandmarksTransform : public UntrainableMetadataTransform } }; -BR_REGISTER(Transform, NameLandmarksTransform) +BR_REGISTER(Transform, NameLandmarkTransform) /*! * \ingroup transforms * \brief Remove a name from a point/rect * \author Scott Klum \cite sklum */ -class AnonymizeLandmarksTransform : public UntrainableMetadataTransform +class AnonymizeLandmarkTransform : public UntrainableMetadataTransform { Q_OBJECT Q_PROPERTY(bool point READ get_point WRITE set_point RESET reset_point STORED false) @@ -435,7 +435,7 @@ class AnonymizeLandmarksTransform : public UntrainableMetadataTransform } }; -BR_REGISTER(Transform, AnonymizeLandmarksTransform) +BR_REGISTER(Transform, AnonymizeLandmarkTransform) class PointsToMatrixTransform : public UntrainableTransform { -- libgit2 0.21.4