Commit 1acaf2f3629bf287326ae26831e47f38f873130c
1 parent
e3bbad25
Revert "Contraining bounding boxes to be a valid size when using roi"
This reverts commit dfc6f1cff693d4f9c025a584a5c90f80babdc8ac.
Showing
2 changed files
with
7 additions
and
27 deletions
openbr/plugins/crop.cpp
| @@ -49,24 +49,6 @@ class CropTransform : public UntrainableTransform | @@ -49,24 +49,6 @@ class CropTransform : public UntrainableTransform | ||
| 49 | 49 | ||
| 50 | BR_REGISTER(Transform, CropTransform) | 50 | BR_REGISTER(Transform, CropTransform) |
| 51 | 51 | ||
| 52 | - | ||
| 53 | -static QRectF constrainRect(int height, int width, const QRectF &rect) | ||
| 54 | -{ | ||
| 55 | - QRectF newRect = rect; | ||
| 56 | - | ||
| 57 | - // roi.x + roi.width <= m.cols && roi.y + roi.height <= m.rows | ||
| 58 | - | ||
| 59 | - if (rect.x() < 0) newRect.setX(0); | ||
| 60 | - if (rect.y() < 0) newRect.setY(0); | ||
| 61 | - | ||
| 62 | - if ((newRect.y() + rect.width()) > width) newRect.setWidth(width-newRect.y()); | ||
| 63 | - if ((newRect.x() + rect.height()) > height) newRect.setHeight(height-newRect.x()); | ||
| 64 | - | ||
| 65 | - qDebug() << ((newRect.x() + newRect.width()) <= width) << ((newRect.y() + newRect.height()) <= height); | ||
| 66 | - | ||
| 67 | - return newRect; | ||
| 68 | -} | ||
| 69 | - | ||
| 70 | /*! | 52 | /*! |
| 71 | * \ingroup transforms | 53 | * \ingroup transforms |
| 72 | * \brief Crops the rectangular regions of interest. | 54 | * \brief Crops the rectangular regions of interest. |
| @@ -81,13 +63,11 @@ class ROITransform : public UntrainableTransform | @@ -81,13 +63,11 @@ class ROITransform : public UntrainableTransform | ||
| 81 | void project(const Template &src, Template &dst) const | 63 | void project(const Template &src, Template &dst) const |
| 82 | { | 64 | { |
| 83 | if (!propName.isEmpty()) { | 65 | if (!propName.isEmpty()) { |
| 84 | - QRectF rect = constrainRect(src.m().rows, src.m().cols, src.file.get<QRectF>(propName)); | 66 | + QRectF rect = src.file.get<QRectF>(propName); |
| 85 | dst += src.m()(OpenCVUtils::toRect(rect)); | 67 | dst += src.m()(OpenCVUtils::toRect(rect)); |
| 86 | } else if (!src.file.rects().empty()) { | 68 | } else if (!src.file.rects().empty()) { |
| 87 | - foreach (const QRectF &rect, src.file.rects()) { | ||
| 88 | - QRectF newRect = constrainRect(src.m().rows, src.m().cols, rect); | ||
| 89 | - dst += src.m()(OpenCVUtils::toRect(newRect)); | ||
| 90 | - } | 69 | + foreach (const QRectF &rect, src.file.rects()) |
| 70 | + dst += src.m()(OpenCVUtils::toRect(rect)); | ||
| 91 | } else if (src.file.contains(QStringList() << "X" << "Y" << "Width" << "Height")) { | 71 | } else if (src.file.contains(QStringList() << "X" << "Y" << "Width" << "Height")) { |
| 92 | dst += src.m()(Rect(src.file.get<int>("X"), | 72 | dst += src.m()(Rect(src.file.get<int>("X"), |
| 93 | src.file.get<int>("Y"), | 73 | src.file.get<int>("Y"), |
openbr/plugins/landmarks.cpp
| @@ -372,7 +372,7 @@ BR_REGISTER(Transform, ReadLandmarksTransform) | @@ -372,7 +372,7 @@ BR_REGISTER(Transform, ReadLandmarksTransform) | ||
| 372 | * \brief Name a point/rect | 372 | * \brief Name a point/rect |
| 373 | * \author Scott Klum \cite sklum | 373 | * \author Scott Klum \cite sklum |
| 374 | */ | 374 | */ |
| 375 | -class NameLandmarksTransform : public UntrainableMetadataTransform | 375 | +class NameLandmarkTransform : public UntrainableMetadataTransform |
| 376 | { | 376 | { |
| 377 | Q_OBJECT | 377 | Q_OBJECT |
| 378 | Q_PROPERTY(bool point READ get_point WRITE set_point RESET reset_point STORED false) | 378 | Q_PROPERTY(bool point READ get_point WRITE set_point RESET reset_point STORED false) |
| @@ -406,14 +406,14 @@ class NameLandmarksTransform : public UntrainableMetadataTransform | @@ -406,14 +406,14 @@ class NameLandmarksTransform : public UntrainableMetadataTransform | ||
| 406 | } | 406 | } |
| 407 | }; | 407 | }; |
| 408 | 408 | ||
| 409 | -BR_REGISTER(Transform, NameLandmarksTransform) | 409 | +BR_REGISTER(Transform, NameLandmarkTransform) |
| 410 | 410 | ||
| 411 | /*! | 411 | /*! |
| 412 | * \ingroup transforms | 412 | * \ingroup transforms |
| 413 | * \brief Remove a name from a point/rect | 413 | * \brief Remove a name from a point/rect |
| 414 | * \author Scott Klum \cite sklum | 414 | * \author Scott Klum \cite sklum |
| 415 | */ | 415 | */ |
| 416 | -class AnonymizeLandmarksTransform : public UntrainableMetadataTransform | 416 | +class AnonymizeLandmarkTransform : public UntrainableMetadataTransform |
| 417 | { | 417 | { |
| 418 | Q_OBJECT | 418 | Q_OBJECT |
| 419 | Q_PROPERTY(bool point READ get_point WRITE set_point RESET reset_point STORED false) | 419 | Q_PROPERTY(bool point READ get_point WRITE set_point RESET reset_point STORED false) |
| @@ -435,7 +435,7 @@ class AnonymizeLandmarksTransform : public UntrainableMetadataTransform | @@ -435,7 +435,7 @@ class AnonymizeLandmarksTransform : public UntrainableMetadataTransform | ||
| 435 | } | 435 | } |
| 436 | }; | 436 | }; |
| 437 | 437 | ||
| 438 | -BR_REGISTER(Transform, AnonymizeLandmarksTransform) | 438 | +BR_REGISTER(Transform, AnonymizeLandmarkTransform) |
| 439 | 439 | ||
| 440 | class PointsToMatrixTransform : public UntrainableTransform | 440 | class PointsToMatrixTransform : public UntrainableTransform |
| 441 | { | 441 | { |