#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
Mat tag;
Mat tagdst = Mat::zeros(tag.cols, tag.rows, tag.type());
tag = imread("E://VS-pro//images//flower.bmp");
imshow("原图", tag);
Point2f srcTr[3];
Point2f dstTr[3];
srcTr[0] = Point(tag.cols / 4, tag.cols / 4);
srcTr[1] = Point(tag.cols - 1, 0);
srcTr[2] = Point(0, tag.rows - 1);
dstTr[0] = Point(tag.cols / 4, tag.cols / 4);
dstTr[1] = Point(tag.cols - 1, 0);
dstTr[2] = Point(0, tag.rows / 2);
Mat warpMat = getAffineTransform(srcTr, dstTr);
warpAffine(tag, tagdst, warpMat, tagdst.size());
imshow("变换后", tagdst);
waitKey(0);
return 0;
}
OpenCV-仿射变换
最新推荐文章于 2024-04-26 21:34:12 发布