#include<opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>#include<iostream>#include<opencv2/imgproc.hpp>usingnamespace std;usingnamespace cv;intmain(){//原坐标位置
Point2f src[]={Point2f(0,0),Point2f(200,0),Point2f(0,200)};//经过某仿射变换后的坐标
Point2f dst[]={Point2f(0,0),Point2f(200,0),Point2f(0,200)};//计算仿射矩阵
Mat A =getAffineTransform(src, dst);
cout << A << endl;}
4.1.2Mat
数据类型:CV_32F
#include<opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>#include<iostream>#include<opencv2/imgproc.hpp>usingnamespace std;usingnamespace cv;intmain(){//原坐标位置
Mat src =(Mat_<float>(3,2)<<0,0,200,0,0,200);//经过某仿射变换后的坐标
Mat dst =(Mat_<float>(3,2)<<0,0,100,0,0,100);//计算仿射矩阵
Mat A =getAffineTransform(src, dst);
cout << A << endl;}