You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
#include "Algo.h"
|
|
|
|
|
|
#include "QPolygon"
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
Algo::Algo()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Algo::~Algo()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Algo::translate(QPolygonF srcPos,QPolygonF dstPos)
|
|
|
|
|
|
{
|
|
|
|
|
|
Point2f srcVec[4];
|
|
|
|
|
|
Point2f dstTri[4];
|
|
|
|
|
|
|
|
|
|
|
|
srcVec[0].x = srcPos.at(0).x();
|
|
|
|
|
|
srcVec[0].y = srcPos.at(0).y();
|
|
|
|
|
|
|
|
|
|
|
|
srcVec[1].x = srcPos.at(1).x();
|
|
|
|
|
|
srcVec[1].y = srcPos.at(1).y();
|
|
|
|
|
|
|
|
|
|
|
|
srcVec[2].x = srcPos.at(2).x();
|
|
|
|
|
|
srcVec[2].y = srcPos.at(2).y();
|
|
|
|
|
|
|
|
|
|
|
|
srcVec[3].x = srcPos.at(3).x();
|
|
|
|
|
|
srcVec[3].y = srcPos.at(3).y();
|
|
|
|
|
|
|
|
|
|
|
|
dstTri[0].x = dstPos.at(0).x();
|
|
|
|
|
|
dstTri[0].y = dstPos.at(0).y();
|
|
|
|
|
|
|
|
|
|
|
|
dstTri[1].x = dstPos.at(1).x();
|
|
|
|
|
|
dstTri[1].y = dstPos.at(1).y();
|
|
|
|
|
|
|
|
|
|
|
|
dstTri[2].x = dstPos.at(2).x();
|
|
|
|
|
|
dstTri[2].y = dstPos.at(2).y();
|
|
|
|
|
|
|
|
|
|
|
|
dstTri[3].x = dstPos.at(3).x();
|
|
|
|
|
|
dstTri[3].y = dstPos.at(3).y();
|
|
|
|
|
|
|
|
|
|
|
|
/// <20><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD>任
|
|
|
|
|
|
Mat warp_mat = getAffineTransform(srcVec, dstTri);
|
|
|
|
|
|
int a = 0;
|
|
|
|
|
|
}
|