00001
00020 #ifndef _PROJRANSAC_H
00021 #define _PROJRANSAC_H
00022
00023 #include "fv.h"
00027 class PCT : public vector<float>{
00028 private :
00029
00030 void set( double a11, double a12, double b1,
00031 double a21, double a22, double b2,
00032 double c1, double c2 ) ;
00033 public :
00034 PCT( );
00035 PCT( Matches &, int, int );
00036
00037 float a11() { return (*this)[0]; }
00038 float a12() { return (*this)[1]; }
00039 float b1() { return (*this)[2]; }
00040
00041 float a21() { return (*this)[3]; }
00042 float a22() { return (*this)[4]; }
00043 float b2() { return (*this)[5]; }
00044
00045 float c1() { return (*this)[6]; }
00046 float c2() { return (*this)[7]; }
00047
00048 void print() {
00049 PCT::iterator it = begin();
00050 while( it != end() ) {
00051 cerr<<*it++<<" ";
00052 }
00053 cerr<<endl;
00054 }
00055
00056 void PCT::operator!();
00057 Coords project( Coords &p, int W, int H ) {
00058 double denom = c1()*p.y()/(float)H + c2()*p.x()/(float)W + 1 ;
00059 double newY = a11()*p.y()/(float)H + a12()*p.x()/(float)W + b1() ;
00060 double newX = a21()*p.y()/(float)H + a22()*p.x()/(float)W + b2() ;
00061 return Coords( newX/denom*(double)W, newY/denom*(double)H );
00062 }
00063
00064 float norm() {
00065 return (a11()-1.0)*(a11()-1.0) + a12()*a12() + a21()*a21() +
00066 (a22()-1.0)*(a22()-1.0) + b1()*b1() + b2()*b2() +
00067 c1()*c1() + c2()*c2() ;
00068 }
00069
00070 };
00071 #endif
00072