From 904f4bb4d8cf7083fd6587cc9b4851a81765d77f Mon Sep 17 00:00:00 2001 From: Mathieu Labbe Date: Sat, 21 May 2016 14:56:25 -0400 Subject: [PATCH] Features2d: updated computeROI() to be more precise --- corelib/src/Features2d.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/corelib/src/Features2d.cpp b/corelib/src/Features2d.cpp index e7c9a153..813aa4db 100644 --- a/corelib/src/Features2d.cpp +++ b/corelib/src/Features2d.cpp @@ -308,10 +308,9 @@ cv::Rect Feature2D::computeRoi(const cv::Mat & image, const std::vector & } //right roi - roi.width = width - roi.x; if(roiRatios[1] > 0 && roiRatios[1] < 1 - roiRatios[0]) { - roi.width -= width * roiRatios[1]; + roi.width -= width * roiRatios[1] + width * roiRatios[0]; } //top roi @@ -321,10 +320,9 @@ cv::Rect Feature2D::computeRoi(const cv::Mat & image, const std::vector & } //bottom roi - roi.height = height - roi.y; if(roiRatios[3] > 0 && roiRatios[3] < 1 - roiRatios[2]) { - roi.height -= height * roiRatios[3]; + roi.height -= height * roiRatios[3] + height * roiRatios[2]; } UDEBUG("roi = %d, %d, %d, %d", roi.x, roi.y, roi.width, roi.height);