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


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

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


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

示例1: copySURFPts

void copySURFPts(ImageFeatures &dst, const IpVec src, const int length)
{
	int i, j, size;
	Ipoint temp;
	size = src.size();
	//Check if the object has been allocated
	//Deallocate it first
	if(dst.checkAlloc())
			dst.dealloc();
	// Allocated with the correct values
	dst.alloc(length, size);
	for(i = 0; i < size; i++)
	{
		temp = src.at(i);
		float mag = 0;
		//for(j = 0; j < length; j++)
        //    mag += temp.descriptor[j]*temp.descriptor[j];
        //mag = sqrt(mag);
        //for(j = 0; j < length; j++)
        //    temp.descriptor[j] *= mag;
		// Copy each descriptor into the ImageFeature
		dst.copyDescriptorAt(temp.descriptor, i);

	}
}
开发者ID:leblancdavid,项目名称:CraterDetection,代码行数:25,代码来源:bagoffeatures.cpp

示例2: DoExtractKeypointsDescriptor

bool OpenSURFdetector::DoExtractKeypointsDescriptor(IplImage* grayImage)
{
	if(grayImage == NULL)
		return false;
	if(grayImage->nChannels != 1)
		return false;

	this->keypoints.clear();

	IpVec ipts;
	surfDetDes(grayImage, ipts, false, 5, 4, 2, this->threshold);

	Ipoint *ipt;
	windage::OpenSURFpoint point;
	for(unsigned int i = 0; i < ipts.size(); i++) 
	{
		ipt = &ipts.at(i);

		point.SetPoint(windage::Vector3(ipt->x, ipt->y, 1.0));
		point.SetSize(2.5f * ipt->scale);
		point.SetDir(-ipt->orientation);
		
		for(int j=0; j<point.DESCRIPTOR_DIMENSION; j++)
		{
			point.descriptor[j] = ipt->descriptor[j];
		}

		this->keypoints.push_back(point);
	}

	return true;
}
开发者ID:Barbakas,项目名称:windage,代码行数:32,代码来源:OpenSURFdetector.cpp

示例3: init

void init(unsigned char *img,double *refhist,IpVec *refpts,double updt[][9],int w,int h)
{
    double obj[8]={0};
    unsigned char pix[60*80*3]={0,0};
    obj[0]=w/2;obj[1]=h/2;obj[2]=80;obj[3]=60;obj[4]=obj[5]=1;obj[6]=obj[7]=0;
    int x=obj[0],y=obj[1],wt=obj[2],ht=obj[3];
    int p=0,l=0;
    IpVec pt;
    IplImage *im;
    im=cvCreateImage(cvSize(w,h),IPL_DEPTH_8U,3);
    memcpy(im->imageData,img,im->imageSize);
    surfDetDes(im,pt,false,5,4,2,0.00004f);
    p=0;
    for(int k=0;k<pt.size();k++)
    {
        if((pt.at(k).x>=(w/2-wt/2)) && (pt.at(k).x<=(w/2+wt/2)) &&
        (pt.at(k).y>=(h/2-ht/2)) && (pt.at(k).y<=(h/2+ht/2)) )
        {
            Ipoint tmp;
            pt.at(k).x-=(w/2-wt/2);

            pt.at(k).y-=(h/2-ht/2);
            (*refpts).push_back(pt.at(k));
        }
    }
    for(int i=0;i<N;i++)
    {
        updt[i][0]=obj[0]+(rand()%60-30);
        updt[i][1]=obj[1]+(rand()%60-30);
        updt[i][2]=obj[2];
        updt[i][3]=obj[3];
        updt[i][4]=obj[4];
        updt[i][5]=obj[5];
        updt[i][6]=obj[6];
        updt[i][7]=obj[7];
        updt[i][8]=(double)1/N;
        img[3*(int)(w*updt[i][1]+updt[i][0])]=0;img[3*(int)(w*updt[i][1]+updt[i
        ][0])+1]=255;img[3*(int)(w*updt[i][1]+updt[i][0])+1]=0;
    }
}
开发者ID:smajida,项目名称:Object-Tracking-UAV,代码行数:40,代码来源:testApp.c

示例4: KeyPointSet

KeyPointSet * SurfExtractor::getKeyPointSet(FrameInput * fi){

	struct timeval start, end;
	gettimeofday(&start, NULL);

	IpVec ipts;
	surfDetDes(fi->get_rgb_img(), ipts, upright, octaves, intervals, init_sample, thres);
	
	KeyPointSet * keypoints = new KeyPointSet();
	for(int i = 0; i < (int)ipts.size(); i++)
	{
		
		Ipoint p = ipts.at(i);
		int w = int(p.x+0.5f);
		int h = int(p.y+0.5f);
		int ind = h * 640 + w;
		float * desc = new float[64];
		for(int j = 0; j < 64; j++){desc[j] = p.descriptor[j];}
		SurfFeatureDescriptor64 * descriptor = new SurfFeatureDescriptor64(desc, p.laplacian);

		float r,g,b,x,y,z;
		fi->getRGB(r,g,b,w,h);
		fi->getXYZ(x,y,z,w,h);
		
		KeyPoint * kp = new KeyPoint();
		kp->stabilety = p.stab;
		kp->descriptor = descriptor;
		kp->point = new Point(x,y,z,w,h);
		kp->r = r;
		kp->g = g;
		kp->b = b;
		if(z > 0 && !isnan(z)){
			kp->valid = true;
			kp->index_number = keypoints->valid_key_points.size();
			keypoints->valid_key_points.push_back(kp);
			//cvCircle(rgb_img, cvPoint(w, h), 5, cvScalar(0, 255, 0, 0), 2, 8, 0);
		}else{
			kp->valid = false;
			kp->index_number = keypoints->invalid_key_points.size();
			keypoints->invalid_key_points.push_back(kp);
			//cvCircle(rgb_img, cvPoint(w, h), 5, cvScalar(0, 0, 255, 0), 2, 8, 0);
		}
	}
	//printf("pre sort\n");
	sort(keypoints->valid_key_points.begin(),keypoints->valid_key_points.end(),comparison_surf);
	sort(keypoints->invalid_key_points.begin(),keypoints->invalid_key_points.end(),comparison_surf);
	//cvReleaseImage( &rgb_img );

	//cvNamedWindow("surf image", CV_WINDOW_AUTOSIZE );
	//cvShowImage("surf image", rgb_img);
	//cvWaitKey(0);
	//cvReleaseImage( &rgb_img);
	
	gettimeofday(&end, NULL);
	double time = (end.tv_sec*1000000+end.tv_usec-(start.tv_sec*1000000+start.tv_usec))/1000000.0f;
	total_time += time;
	total_frames++;
	//printf("ipts.size(): %i\n",ipts.size());
	total_keypoints+=ipts.size();//keypoints->valid_key_points.size();
	//printf("avg_time: %f avg_keypoints: %f\n",total_time/double(total_frames),double(total_keypoints)/double(total_frames));	
	return keypoints;
}
开发者ID:bigjun,项目名称:aktest,代码行数:62,代码来源:SurfExtractor.cpp


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