From 24e343f2fb6e2b17bc2f97cac722eefcaa5d3617 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Tue, 11 Oct 2016 15:37:30 -0600 Subject: [PATCH] use the new rotatePoints function --- openbr/plugins/imgproc/affine.cpp | 16 ++-------------- openbr/plugins/metadata/grid.cpp | 14 ++++---------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/openbr/plugins/imgproc/affine.cpp b/openbr/plugins/imgproc/affine.cpp index bb37295..d501cb3 100644 --- a/openbr/plugins/imgproc/affine.cpp +++ b/openbr/plugins/imgproc/affine.cpp @@ -118,20 +118,8 @@ private: Mat affineTransform = getAffineTransform(srcPoints, dstPoints); warpAffine(src, dst, affineTransform, Size(width, height), method, borderMode); - if (warpPoints) { - QList points = src.file.points(); - QList rotatedPoints; - for (int i=0; i(0,0)+ - points.at(i).y()*affineTransform.at(0,1)+ - affineTransform.at(0,2), - points.at(i).x()*affineTransform.at(1,0)+ - points.at(i).y()*affineTransform.at(1,1)+ - affineTransform.at(1,2))); - } - - dst.file.setPoints(rotatedPoints); - } + if (warpPoints) + dst.file.setPoints(OpenCVUtils::rotatePoints(src.file.points(), affineTransform)); if (storeAffine) { QList affineParams; diff --git a/openbr/plugins/metadata/grid.cpp b/openbr/plugins/metadata/grid.cpp index 1fc7c02..10fdf18 100644 --- a/openbr/plugins/metadata/grid.cpp +++ b/openbr/plugins/metadata/grid.cpp @@ -14,8 +14,9 @@ * limitations under the License. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include +#include +#include using namespace cv; @@ -51,15 +52,8 @@ class GridTransform : public UntrainableTransform landmarks.append(QPointF(x,y)); if (angle > 0) { - Mat rotMatrix = getRotationMatrix2D(Point2f(src.m().rows/2,src.m().cols/2),angle,1.0); - for (int i=0; i(0,0)+ - landmarks.at(i).y()*rotMatrix.at(0,1)+ - rotMatrix.at(0,2), - landmarks.at(i).x()*rotMatrix.at(1,0)+ - landmarks.at(i).y()*rotMatrix.at(1,1)+ - rotMatrix.at(1,2))); - } + const Mat rotMatrix = getRotationMatrix2D(Point2f(src.m().rows/2,src.m().cols/2), angle, 1.0); + landmarks = OpenCVUtils::rotatePoints(landmarks, rotMatrix); } dst = src; -- libgit2 0.21.4