Transform a point with rotationMatrix2d [closed]

asked 2013-05-26 12:20:43 -0500

yes123 gravatar image

updated 2013-05-27 04:13:39 -0500

I have a rotation matrix and a Point2f(10,20);

Mat M = getRotationMatrix2D(center,angle,1);

Which function should I use to have the transformed point with the matrix M ?

I have wrote my function to do this but I believe it's already implemented in opencv:

Point2f transformPoint(Mat M, Point2f newPoint) {

    return Point2f(<double>(0,0)*newPoint.x+<double>(0,1)*newPoint.y+<double>(0,2),

//> Usage:
Mat M = getRotationMatrix2D(center,angle,1);
Point2f oldPoint = Point2f(10,20);
Point2f myNewPoint = transformPoint(M,oldPoint);

Consider that I am trying to use persepctiveTransform() like this, but it's giving me a strange error:

Mat r = getRotationMatrix2D(Point2f(100,100),30,1);
vector<Point2f> src,dst(1);
src.push_back(Point2f(10,10)); //> Transform this point 10,10 with the matrix r


It says:

OpenCV Error: Assertion failed (mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN
(type0) && ((1 << type0) & fixedDepthMask) != 0)) in unknown function, file C:\s
lave\builds\WinInstallerMegaPack\src\opencv\modules\core\src\matrix.cpp, line 14
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-11 10:56:00.818005