本文整理汇总了C++中IpVec::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ IpVec::clear方法的具体用法?C++ IpVec::clear怎么用?C++ IpVec::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IpVec
的用法示例。
在下文中一共展示了IpVec::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ICGM
//通过最近点计算
bool CGVM::ICGM(Point2f& CG,Point2f& CG1,IpVec& ipts0,IpVec& ipts1,const vector<vector<float> >& table0,const vector<vector<float> >& table1,IpVec& ipts0x,IpVec& ipts1x, IpVec& ipts0y,IpVec& ipts1y,int GoodSetNum,double t1,double t2,double& diff)
{
if(ipts0.size()<=GoodSetNum) return false;
vector<int> TestSet;
vector<bool> GoodPoints;
GoodPoints.resize(ipts0.size());
struct timeval tpstart,tpend;
float timeuse;
gettimeofday(&tpstart,NULL);
vector<DistanceRelation> OrderedQueue0;
for(int i=0;i<ipts0.size();++i) GoodPoints[i]=true;
TestSet.resize(GoodSetNum);
bool GoodSet=false;
int loop=0;
int loopX=0;
double diffSlope=0;
double sc;
int SUM;
srand(tpstart.tv_usec);
CG=Point2f(0,0);
CG1=Point2f(0,0);
sc=0;
vector<Vector2D> vecVec;
ipts0x.clear();
ipts1x.clear();
ipts0y.clear();
ipts1y.clear();
while(!GoodSet)
{
SUM=0;
TestSet[0]=rand()%ipts0.size();
OrderedQueue0.clear();
EstimateQueue(table0, TestSet[0], ipts0, OrderedQueue0);
for(int i=1;i<GoodSetNum;i++)
{
TestSet[i]=OrderedQueue0[i-1].idx;
}
CG=CGVM::GetCG(ipts0[TestSet[0]],ipts0[TestSet[1]]);
CG1=CGVM::GetCG(ipts1[TestSet[0]],ipts1[TestSet[1]]);
Vector2D Testv,Testv1;
double Testx,Testx1;
bool GetGoodSet=true;
sc=0;
diffSlope=0;
for(int i=2;i<GoodSetNum;++i)
{
Testv=CGVM::GetVector(CG,ipts0[TestSet[i]]);
Testx=CGVM::GetLength(Testv);
Testv1=CGVM::GetVector(CG1,ipts1[TestSet[i]]);
Testx1=CGVM::GetLength(Testv1);
sc+=CGVM::VectorCompare(Testv,Testv1);
// cout<<atan(Testv.Slope)-atan(Testv1.Slope)<<endl;
if(i==2) diffSlope=GetAngle(Testv,Testv1);
if(CGVM::VectorCompare(Testv,Testv1)>=0.3||abs(GetAngle(Testv,Testv1)-diffSlope)>=t1)
{
GetGoodSet=false;
break;
}
else
{
CG=CGVM::GetCG(CG,ipts0[TestSet[i]]);
CG1=CGVM::GetCG(CG1,ipts1[TestSet[i]]);
diffSlope=diffSlope*(i-1)+GetAngle(Testv,Testv1);
diffSlope/=i;
// cout<<"diffSlope"<<i<<": "<<diffSlope<<" GetAngle(Testv,Testv1) "<<GetAngle(Testv,Testv1)<<endl;
SUM=i;
}
}
GoodSet=GetGoodSet;
if(++loop>1000)
{
loop=0;
t1+=t1*0.05;
t2=t1;
}
if(++loopX>10000)
{
return false;
}
}
// cout<<"diffSlopex: "<<diffSlope<<endl;
// cout<<"loop "<<loop<<endl;
sc/=(GoodSetNum-1);
// cout<<"SC!!!! "<<sc<<endl;
// cout<<"CG!!!!!!!"<<CG.x<<" "<<CG.y<<" "<<CG1.x<<" "<<CG1.y<<endl;
//.........这里部分代码省略.........
示例2: CGVMcos
bool CGVM::CGVMcos(Point2f& CG,Point2f& CG1,IpVec& ipts0,IpVec& ipts1,IpVec& ipts0x,IpVec& ipts1x, IpVec& ipts0y,IpVec& ipts1y,int loops, int GoodSetNum,double t1,double t2,double& diff)
{
vector<int> TestSet;
vector<bool> GoodPoints;
GoodPoints.resize(ipts0.size());
struct timeval tpstart;
gettimeofday(&tpstart,0);
for(int i=0;i<ipts0.size();++i) GoodPoints[i]=true;
TestSet.resize(100);
bool GoodSet=false;
int SetSize=GoodSetNum-1;
int loop=0;
int loopX=0;
double diffSlope=0;
double sc;
int SUM;
srand(tpstart.tv_usec);
CG=Point2f(0,0);
CG1=Point2f(0,0);
Vector2D Testv,Testv1;
double Testx,Testx1;
bool GetGoodSet=true;
sc=0;
vector<Vector2D> vecVec;
ipts0x.clear();
ipts1x.clear();
ipts0y.clear();
ipts1y.clear();
// for(int i=0;i<ipts0.size();++i)
// {
// Testv=CGVM::GetVector(CG,ipts0[i]);
// Testx=CGVM::GetLength(Testv);
// Testv1=CGVM::GetVector(CG1,ipts1[i]);
// Testx1=CGVM::GetLength(Testv1);
// Vector2D Testk;
// Testk.X=Testv.X-Testv1.X;
// Testk.Y=Testv.Y-Testv1.Y;
// vecVec.push_back(Testk);
// cout<<"x "<<Testk.X<<" y "<<Testv1.Y<<endl;
// }
// CvScalar color_tab[5] =
// { CV_RGB (255, 0, 0), CV_RGB (0, 255, 0), CV_RGB (100, 100, 255), CV_RGB (255, 0, 255), CV_RGB (255, 255, 0) };
// IplImage *img = cvCreateImage (cvSize (5184, 3456), IPL_DEPTH_8U, 3);
// cvZero (img);
// for(int i=0;i<vecVec.size();++i)
// {
// CvPoint ipt;
// ipt.x=vecVec[i].X+2529;
// ipt.y=vecVec[i].Y+1728;
// cvCircle (img, ipt, 5, color_tab[1], CV_FILLED, CV_AA, 0);
// }
// cvSaveImage("z.png",img);
// return false;
while(!GoodSet)
{
SUM=0;
for(int i=0;i<=SetSize;i++)
{
bool noRepeat=false;
while(!noRepeat)
{
TestSet[i]=rand()%ipts0.size();
if(!i) break;
else
{
for(int j=0;j<=SetSize;j++)
{
if(i==j) ;
else if(TestSet[i]==TestSet[j]) break;
else
{
noRepeat=true;
break;
}
}
}
}
//.........这里部分代码省略.........