cv2DRotationMatrix函数介绍

来源:互联网 发布:印尼酒店网络怎么样 编辑:程序博客网 时间:2024/06/06 09:26

   cv2DRotationMatrix()函数返回一个指向2X3矩阵的指针。具体函数如下:

public:static IntPtr cv2DRotationMatrix(PointF center, double angle, double scale, IntPtr mapMatrix)

PointF center:源图像的旋转中心。

double angle:源图像旋转的角度,正值表示逆时针旋转(坐标原点假设在图像左上角)。

double scale:等向比例因子。

IntPer mapMatrix:用于返回的2X3矩阵。 

//逆时针旋转图像degree角度(原尺寸)  void rotateImage(IplImage* img, IplImage *img_rotate,int degree)  {      //旋转中心为图像中心      CvPoint2D32f center;        center.x=float (img->width/2.0+0.5);      center.y=float (img->height/2.0+0.5);      //计算二维旋转的仿射变换矩阵      float m[6];                  CvMat M = cvMat( 2, 3, CV_32F, m );      cv2DRotationMatrix( center, degree,1, &M);      //变换图像,并用黑色填充其余值   cvWarpAffine(img,img_rotate, &M,CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS,cvScalarAll(0) );  }

上述代码来至:http://blog.csdn.net/xiaowei_cqu/article/details/7616044#t3

原创粉丝点击