移动最小二乘图像变形技术

时间:2013-11-21 13:05:16
【文件属性】:

文件名称:移动最小二乘图像变形技术

文件大小:2KB

文件格式:H

更新时间:2013-11-21 13:05:16

图像变形

基于移动最小二乘的图像变形技术 / Warp.h: interface for the CWarp class. // ////////////////////////////////////////////////////////////////////// #include #include #include #include #include struct matrix2 { double c11,c12,c21,c22; }; class CWarp { protected: std::vector m_CtrPs,m_CtrQs; public: CWarp(); virtual CvPoint2D32f Warping(const CvPoint2D32f& point)=0; virtual ~CWarp(); }; class CMLS: public CWarp { protected: void init(const CvPoint2D32f& point, CvPoint2D32f& PStar, CvPoint2D32f& QStar, std::vector& Weight, std::vector& PHat, std::vector& QHat); CvPoint2D32f affine_warp(const CvPoint2D32f& point); CvPoint2D32f similar_warp(const CvPoint2D32f& point); CvPoint2D32f rigid_warp(const CvPoint2D32f& point); public: enum WARP_MODE {AFFINE, SIMILAR, RIGID}; CMLS(); CMLS(const std::vector& CtrPs, const std::vector& CtrQs); virtual CvPoint2D32f Warping(const CvPoint2D32f& point); CvPoint2D32f Warping(const CvPoint2D32f& point, WARP_MODE mode); }; class CTPS: public CWarp { public: CTPS(); CTPS(const std::vector& CtrPs, const std::vector& CtrQs); virtual CvPoint2D32f Warping(const CvPoint2D32f& point); private: std::vector m_TPSCoeffX; std::vector m_TPSCoeffY; }; class CAFFINE: public CWarp { public: CAFFINE(); ~CAFFINE(); CAFFINE(const std::vector& CtrPs, const std::vector& CtrQs); virtual CvPoint2D32f Warping(const CvPoint2D32f& point); const CvMat* GetMat() { return m_pAffine_m2n3; } std::string txt() const { std::ostringstream o; o << "Affine matrix: \n"; for (int i=0; i<2; i++) { for (int j=0; j<3; j++) o << " " << cvmGet(m_pAffine_m2n3, i, j); o << "\n"; } return o.str(); } private: CvMat* m_pAffine_m2n3; };


网友评论

  • 就只有一个头文件,很想给0分、、、、、
  • 就只有一个头文件,很想给0分、、、、、