标签:
//WarpingRBF.h
#ifndef WARPINGRBF_H
#define WARPINGRBF_H
#include<opencv2/opencv.hpp>
#include<QList>
#include<Eigen/Eigen>
#include"line.h"
class WarpingRBF
{
public:
enum GFuncType{
Gaussian_Radio_Function,
Thin_Plate_spline,//r^2log(r)
Gaussian_Radial
};
public:
WarpingRBF();
WarpingRBF(const QList<Line*> & lineList,
const int&N);
public:
void SolveRBF();
void SetImage(const cv::Mat &sourceImage);
void SetGFunc(const GFuncType &gfunctype);
protected:
void InitData();
void InitSourceAndTargetMaritrix(const QList<Line*> &list,
Eigen::MatrixXd &Source_M,
Eigen::MatrixXd &Target_M);
void InitImageMatrix(const cv::Mat &sourceImage,
const int&height,
const int &width,
Eigen::MatrixXd &Image_M);
void CalculateAffineMat(const Eigen::MatrixXd &Source_M,
const Eigen::MatrixXd &Target_M,
const int &N,
cv::Mat &Affine_Mat);
void AffineTranslate(const cv::Mat &srcImage,
const cv::Mat &Affine_Mat,
Eigen::MatrixXd &AfterAffine_M);
void RadioTranslate(const Eigen::MatrixXd &Image_M,
const Eigen::MatrixXd &Source_M,
const Eigen::MatrixXd &Target_M,
const GFuncType &gfunctype,
const cv::Mat &Affine_Mat,
const int &N,
const int &height,
const int &width,
Eigen::MatrixXd &AfterRadio_M);
void RBFTranslate(const Eigen::MatrixXd AfterAffine_M,
const Eigen::MatrixXd AfterRadio_M,
Eigen::MatrixXd Image_M);
void ApplyChangeOnImage(cv::Mat &dstImage,const Eigen::MatrixXd Image_M);
double GetEulaNorm(const Eigen::MatrixXd X_M);//(2*1)--(x,y)^T
private:
cv::Mat srcImage,dstImage,Affine_Mat;
int height,width;
Eigen::MatrixXd Image_M,Source_M,Target_M,AfterAffine_M,AfterRadio_M;
GFuncType gfunctype;
int N;//number of Anchor Points
QList<Line*> lineList;
};
class Line
{
public:
Line();
Line(QPoint start,QPoint end);
void SetStart(QPoint start);
void SetEnd(QPoint End);
QPoint end,start;
private:
};
```
《Image Warping Using Few Anchor Points and Radial Function》论文实现
标签:
原文地址:http://www.cnblogs.com/LingjieLi-vera/p/5941563.html