当前位置: 首页>>代码示例>>C++>>正文


C++ IpVec::push_back方法代码示例

本文整理汇总了C++中IpVec::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ IpVec::push_back方法的具体用法?C++ IpVec::push_back怎么用?C++ IpVec::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IpVec的用法示例。


在下文中一共展示了IpVec::push_back方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: extract_surf_dense

void extract_surf_dense(const char* filename, double scale, int xmin, int xmax, int ymin, int ymax, bool upright, double* descriptors) {
	int width  = xmax-xmin + 1;
	int height = ymax-ymin + 1;
	
	NDArray::CArray<double> _descriptors(descriptors,width,height,64);
	IpVec ipts;
	IplImage *img=cvLoadImage(filename);
	Ipoint ipoint;

	for (int i =xmin; i<=xmax; i++){
		for (int j=ymin; j<=ymax; j++){
			ipoint.x = i;
			ipoint.y = j;
			ipoint.orientation = 0.;
			ipoint.scale = scale;
			ipts.push_back(ipoint);
		}
	}	
	surfDes(img,ipts,upright);
	for (int i =0; i<width; i++) {
		for (int j=0; j<height; j++){
			for (int k = 0; k<64 ; k++) _descriptors(i,j,k) = ipts[i].descriptor[j];
		}
	}
	cvReleaseImage(&img);
}
开发者ID:CloPeMa,项目名称:visual_feedback,代码行数:26,代码来源:surf.cpp

示例2: extract_surf_samples

void extract_surf_samples(const char* filename, int npoints, double* points, bool upright, double* descriptors){
	NDArray::CArray<double> _points(points,npoints,4);
	NDArray::CArray<double> _descriptors(descriptors,npoints,64);
	IpVec ipts;
	IplImage *img=cvLoadImage(filename);
	Ipoint ipoint;

	for (int i =0; i<npoints; i++){
		ipoint.x = _points(i,0);
		ipoint.y = _points(i,1);
		ipoint.orientation = _points(i,2);
		ipoint.scale = _points(i,3);
		ipts.push_back(ipoint);
	}	
	surfDes(img,ipts,upright);
	for (int i =0; i<npoints; i++) {
		for (int j = 0; j<64 ; j++) _descriptors(i,j) = ipts[i].descriptor[j];
		_points(i,0) = ipts[i].x;
		_points(i,1) = ipts[i].y;
		_points(i,2) = ipts[i].orientation;
		_points(i,3) = ipts[i].scale;
	}
	cvReleaseImage(&img);
}
开发者ID:CloPeMa,项目名称:visual_feedback,代码行数:24,代码来源:surf.cpp

示例3: retrieveDescriptors

/*!
    Copy data back from the GPU into an IpVec structure on the host
*/
IpVec* Surf::retrieveDescriptors()
{
    IpVec* ipts = new IpVec();

    if(this->numIpts == 0) 
    {
        return ipts;
    }

    // Copy back the output data

#ifdef OPTIMIZED_TRANSFERS
    // We're using pinned memory for the transfers.  The data is 
    // copied back to pinned memory and then must be mapped before
    // it's usable on the host

    // Copy back Laplacian data
    this->laplacian = (int*)cl_copyAndMapBuffer(this->h_laplacian, 
        this->d_laplacian, this->numIpts * sizeof(int));

    // Copy back scale data
    this->scale = (float*)cl_copyAndMapBuffer(this->h_scale, 
        this->d_scale, this->numIpts * sizeof(float));
    
    // Copy back pixel positions
    this->pixPos = (float2*)cl_copyAndMapBuffer(this->h_pixPos, 
        this->d_pixPos, this->numIpts * sizeof(float2));

    // Copy back descriptors
    this->desc = (float*)cl_copyAndMapBuffer(this->h_desc, 
        this->d_desc, this->numIpts * DESC_SIZE* sizeof(float));

    // Copy back orientation data
    this->orientation = (float*)cl_copyAndMapBuffer(this->h_orientation, 
        this->d_orientation, this->numIpts * sizeof(float));
#else
    // Copy back Laplacian information
    cl_copyBufferToHost(this->laplacian, this->d_laplacian, 
        (this->numIpts) * sizeof(int), CL_FALSE);

    // Copy back scale data
    cl_copyBufferToHost(this->scale, this->d_scale,
        (this->numIpts)*sizeof(float), CL_FALSE);

    // Copy back pixel positions
    cl_copyBufferToHost(this->pixPos, this->d_pixPos, 
        (this->numIpts) * sizeof(float2), CL_FALSE);   

    // Copy back descriptors
    cl_copyBufferToHost(this->desc, this->d_desc, 
        (this->numIpts)*DESC_SIZE*sizeof(float), CL_FALSE);
    
    // Copy back orientation data
    cl_copyBufferToHost(this->orientation, this->d_orientation, 
        (this->numIpts)*sizeof(float), CL_TRUE);
#endif  

    // Parse the data into Ipoint structures
    for(int i= 0;i<(this->numIpts);i++)
    {		
        Ipoint ipt;		
        ipt.x = pixPos[i].x;
        ipt.y = pixPos[i].y;
        ipt.scale = scale[i];
        ipt.laplacian = laplacian[i];
        ipt.orientation = orientation[i];
        memcpy(ipt.descriptor, &desc[i*64], sizeof(float)*64);
        ipts->push_back(ipt);
    }

#ifdef OPTIMIZED_TRANSFERS
    // We're done reading from the buffers, so we unmap
    // them so they can be used again by the device
    cl_unmapBuffer(this->h_laplacian, this->laplacian);
    cl_unmapBuffer(this->h_scale, this->scale);
    cl_unmapBuffer(this->h_pixPos, this->pixPos);
    cl_unmapBuffer(this->h_desc, this->desc);
    cl_unmapBuffer(this->h_orientation, this->orientation);
#endif

    return ipts;
}
开发者ID:oursland,项目名称:clsurf,代码行数:85,代码来源:surf.cpp

示例4: ICGM


//.........这里部分代码省略.........
        {
            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;

    for(int i=0;i<ipts0.size();++i)
    {
        bool NeedTest=true;
        for(int k=0;k<GoodSetNum;k++) if(TestSet[k]==i) NeedTest=false;
        if(!NeedTest) continue;
        Vector2D v,v1;
        double x,x1;
        v=CGVM::GetVector(CG,ipts0[i]);
        x=CGVM::GetLength(v);
        v1=CGVM::GetVector(CG1,ipts1[i]);
        x1=CGVM::GetLength(v1);

        Vector2D Testk;

        Testk.X=v.X-v1.X;

        Testk.Y=v.Y-v1.Y;

        Testk.Slope=Testk.Y/Testk.X;

        vecVec.push_back(Testk);

        CvPoint px0,px1;
        px0.x=CG.x;
        px0.y=CG.y;
        px1.x=ipts0[i].x;
        px1.y=ipts0[i].y;
        //        cvDrawLine(p0,px0,px1,CV_RGB( 255, 0, 0 ));
        //        cout<<"x "<<v.X<<" y "<<v.Y<<" Slope "<<atan(v.Slope)<<" x1 "<<v1.X<<" y1 "<<v1.Y<<" Slope1 "<<atan(v1.Slope)<<"   "<<abs(1-(x/x1))<<endl;

        if(CGVM::VectorCompare(v,v1)>=0.3||abs(GetAngle(v,v1)-diffSlope)>=t2)
            //        if(abs(atan(v.Slope)-atan(v1.Slope))>=0.03)
        {
            GoodPoints[i]=false;
            //            cout<<CGVM::VectorCompare(v,v1)-sc<<" Moved!"<<endl;
        }
        else
        {
            CG=CGVM::GetCG(CG,ipts0[i]);
            CG1=CGVM::GetCG(CG1,ipts1[i]);
            diffSlope=diffSlope*SUM+GetAngle(v,v1);
            diffSlope/=++SUM;


            //            cout<<vecVec.back().X<<" "<<vecVec.back().Y<<endl;
            //            cout<<"CG!!"<<CG.x<<" "<<CG.y<<" "<<CG1.x<<" "<<CG1.y<<"   "<<abs(1-(x/x1))<<endl;
        }
    }

    IpVec ip0,ip1;

    for(int i=0;i<ipts0.size();++i)
    {
        if(GoodPoints[i])
        {
            ip0.push_back(ipts0[i]);
            ip1.push_back(ipts1[i]);
        }
        else
        {
            ipts0y.push_back(ipts0[i]);
            ipts1y.push_back(ipts1[i]);
        }
    }

    ipts0x=ip0;
    ipts1x=ip1;


    diff=diffSlope;

    gettimeofday(&tpend,NULL);
    timeuse=1000000*(tpend.tv_sec-tpstart.tv_sec)+tpend.tv_usec-tpstart.tv_usec;
    timeuse/=1000000;
    cout<<"**********ICGM is Done!**********  "<<timeuse<<"s "<<endl;

    return true;
}
开发者ID:Mizutome,项目名称:Cpp-SIFTICGM,代码行数:101,代码来源:CGVM.cpp

示例5: CGVMcos


//.........这里部分代码省略.........

    //	cout<<"diffSlopex: "<<diffSlope<<endl;

    //    cout<<"loop "<<loop<<endl;

    sc/=(SetSize-2);

    //    cout<<"SC!!!! "<<sc<<endl;

    //    cout<<"CG!!!!!!!"<<CG.x<<" "<<CG.y<<" "<<CG1.x<<" "<<CG1.y<<endl;

    for(int i=0;i<ipts0.size();++i)
    {
        bool NeedTest=true;
        for(int k=0;k<=SetSize;k++) if(TestSet[k]==i) NeedTest=false;
        if(!NeedTest) continue;
        Vector2D v,v1;
        double x,x1;
        v=CGVM::GetVector(CG,ipts0[i]);
        x=CGVM::GetLength(v);
        v1=CGVM::GetVector(CG1,ipts1[i]);
        x1=CGVM::GetLength(v1);

        Vector2D Testk;

        double m;

        Testk.X=v.X-v1.X;

        Testk.Y=v.Y-v1.Y;

        Testk.Slope=Testk.Y/Testk.X;

        vecVec.push_back(Testk);

        //        Vector2D Testkx;

        //        Testkx.Slope=Testk.Slope;

        //        double l=(CGVM::VectorCompare(v,v1)-sc)*1728;

        //        double a=atan(Testkx.Slope);

        //        Testkx.X=l*cos(a)*m;

        //        Testkx.Y=l*sin(a);





        CvPoint px0,px1;
        px0.x=CG.x;
        px0.y=CG.y;
        px1.x=ipts0[i].x;
        px1.y=ipts0[i].y;
        //        cvDrawLine(p0,px0,px1,CV_RGB( 255, 0, 0 ));
        //        cout<<"x "<<v.X<<" y "<<v.Y<<" Slope "<<atan(v.Slope)<<" x1 "<<v1.X<<" y1 "<<v1.Y<<" Slope1 "<<atan(v1.Slope)<<"   "<<abs(1-(x/x1))<<endl;

        if(CGVM::VectorCompare(v,v1)>=0.5||abs(GetAngle(v,v1)-diffSlope)>=t2)
            //        if(abs(atan(v.Slope)-atan(v1.Slope))>=0.03)
        {
            GoodPoints[i]=false;
            //            cout<<CGVM::VectorCompare(v,v1)-sc<<" Moved!"<<endl;
        }
        else
开发者ID:Mizutome,项目名称:Cpp-SIFTICGM,代码行数:67,代码来源:CGVM.cpp


注:本文中的IpVec::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。