• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cvSeqPush函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cvSeqPush函数的典型用法代码示例。如果您正苦于以下问题:C++ cvSeqPush函数的具体用法?C++ cvSeqPush怎么用?C++ cvSeqPush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: assert

void FaceDetection::AddContours2Rect(CvSeq *seq, int color, int iLayer)
{
    assert(m_mstgRects != NULL);
    assert(m_seqRects != NULL);

    CvContourRect cr;
    for (CvSeq* external = seq; external; external = external->h_next)
    {
        cr.r = cvContourBoundingRect(external, 1 );
        cr.pCenter.x = cr.r.x + cr.r.width / 2;
        cr.pCenter.y = cr.r.y + cr.r.height / 2;
        cr.iNumber = iLayer;
        cr.iType = 6;
        cr.iFlags = 0;
        cr.seqContour = external;
        cr.iContourLength = external->total;
        cr.iColor = color;
        cvSeqPush(m_seqRects, &cr);
        for (CvSeq* internal = external->v_next; internal; internal = internal->h_next)
        {
            cr.r = cvContourBoundingRect(internal, 0);    
            cr.pCenter.x = cr.r.x + cr.r.width / 2;
            cr.pCenter.y = cr.r.y + cr.r.height / 2;
            cr.iNumber = iLayer;
            cr.iType = 12;
            cr.iFlags = 0;
            cr.seqContour = internal;
            cr.iContourLength = internal->total;
            cr.iColor = color;
            cvSeqPush(m_seqRects, &cr);
        }
    }
}// void FaceDetection::AddContours2Rect(CvSeq *seq, int color, int iLayer)
开发者ID:Ashwini7,项目名称:smart-python-programs,代码行数:33,代码来源:facedetection.cpp


示例2: drawSquares

// the function draws all the squares in the image
void drawSquares(IplImage* imgSrc, CvSeq* squares)
{
	CvSeqReader reader;
	IplImage* imgCopy = cvCloneImage(imgSrc);
	int i;

	// initialize reader of the sequence
	cvStartReadSeq(squares, &reader, 0);

	// read 4 sequence elements at a time (all vertices of a square)
	printf("Found %d rectangles in image\n", squares->total / 4);

	for (i = 0; i < squares->total; i += 4)
	{
		CvPoint* pntRect = gPnt;
		int pntCount = 4;
		CvSeq* seqRect = cvCreateSeq(CV_32SC2, sizeof(CvSeq), sizeof(CvPoint), gStorage);

		// read 4 vertices
		memcpy(gPnt, reader.ptr, squares->elem_size);
		CV_NEXT_SEQ_ELEM(squares->elem_size, reader);
		cvSeqPush(seqRect, &pntRect[0]);

		memcpy(gPnt + 1, reader.ptr, squares->elem_size);
		CV_NEXT_SEQ_ELEM(squares->elem_size, reader);
		cvSeqPush(seqRect, &pntRect[1]);

		memcpy(gPnt + 2, reader.ptr, squares->elem_size);
		CV_NEXT_SEQ_ELEM(squares->elem_size, reader);
		cvSeqPush(seqRect, &pntRect[2]);

		memcpy(gPnt + 3, reader.ptr, squares->elem_size);
		CV_NEXT_SEQ_ELEM(squares->elem_size, reader);
		cvSeqPush(seqRect, &pntRect[3]);

		// draw the square as a closed polyline
		cvPolyLine(imgCopy, &pntRect, &pntCount, 1, 1, CV_RGB(0, 255, 0), 1, CV_AA, 0);

		// draw the min outter rect
		CvBox2D box = cvMinAreaRect2(seqRect, NULL);
	    CvPoint2D32f ptBox[4];
	    cvBoxPoints(box, ptBox);
	    for(int i = 0; i < 4; ++i) {
	        cvLine(imgCopy, cvPointFrom32f(ptBox[i]), cvPointFrom32f(ptBox[((i+1)%4)?(i+1):0]), CV_RGB(255,0,0));
	    }

	}

	// show the resultant image
	cvShowImage(wndname, imgCopy);
	cvReleaseImage(&imgCopy);
}
开发者ID:agentlink,项目名称:MyOpenProjects,代码行数:53,代码来源:DetectRectangle.cpp


示例3: cvSeqPush

void FaceDetection::CreateResults(CvSeq * lpSeq)
{
    
    Face * tmp;
    
    double Max  = 0;
    double CurStat = 0;
    
    FaceData tmpData;
    if (m_bBoosting)
    {
        tmp = m_pFaceList->GetData();
        tmp->CreateFace(&tmpData);

        CvFace tmpFace;
        tmpFace.MouthRect = tmpData.MouthRect;
        tmpFace.LeftEyeRect = tmpData.LeftEyeRect;
        tmpFace.RightEyeRect = tmpData.RightEyeRect;

        cvSeqPush(lpSeq,&tmpFace);

    }else
    {
        while ( (tmp = m_pFaceList->GetData()) != 0 )
        {
            CurStat = tmp->GetWeight();
            if (CurStat > Max)
                Max = CurStat;
        }
        
        while ( (tmp = m_pFaceList->GetData()) != 0 )
        {
            tmp->CreateFace(&tmpData);
            CurStat = tmp->GetWeight();
            
            if (CurStat == Max)
            {
                CvFace tmpFace;
                tmpFace.MouthRect = tmpData.MouthRect;
                tmpFace.LeftEyeRect = tmpData.LeftEyeRect;
                tmpFace.RightEyeRect = tmpData.RightEyeRect;
                cvSeqPush(lpSeq,&tmpFace);

                
            }
        }
    }
}// void FaceDetection::DrawResult(IplImage* img)
开发者ID:Ashwini7,项目名称:smart-python-programs,代码行数:48,代码来源:facedetection.cpp


示例4: CalcFourierDescriptorCoeff

void CalcFourierDescriptorCoeff(CvSeq* seq_pts, int n_fourier,CvSeq* seq_fourier)
{
	int count = seq_pts->total;
	double *coeff_cos, *coeff_sin;
	coeff_cos = (double*)malloc(count*sizeof(double));
	coeff_sin = (double*)malloc(count*sizeof(double));
	int i;
	for(i = 0; i < count; i++)
	{
		coeff_sin[i] = sin(2*i*CV_PI/count);
		coeff_cos[i] = cos(2*i*CV_PI/count);
	}

	cvClearSeq(seq_fourier);
	for(int u = 0; u < n_fourier; u++)
	{
		CvPoint2D32f point_coeff = cvPoint2D32f(0, 0);
		for(i = 0; i < count; i+=4)
		{
			CvPoint* pt = (CvPoint*)cvGetSeqElem(seq_pts, i);
			point_coeff.x += (float)(pt->x*coeff_cos[(i*u)%count] + pt->y*coeff_sin[(i*u)%count]);
			point_coeff.y += (float)(pt->y*coeff_cos[(i*u)%count] - pt->x*coeff_sin[(i*u)%count]);
		}
		//point_coeff.x/=count;
		//point_coeff.y/=count;
		cvSeqPush(seq_fourier, &point_coeff);
	} 
	free(coeff_cos);
	free(coeff_sin);
}
开发者ID:landys,项目名称:image-features,代码行数:30,代码来源:test.cpp


示例5: CalcBoundary

void CalcBoundary(CvSeq* seq_fourier, int n_Pts, CvSeq* seq_pts)
{
	int count = seq_fourier->total;
	double *coeff_cos, *coeff_sin;
	coeff_cos = (double*)malloc(n_Pts*sizeof(double));
	coeff_sin = (double*)malloc(n_Pts*sizeof(double));
	int i;
	for(i = 0; i < n_Pts; i++)
	{
		coeff_sin[i] = sin(2*i*CV_PI/n_Pts);
		coeff_cos[i] = cos(2*i*CV_PI/n_Pts);
	}
	cvClearSeq(seq_pts);
	for(i = 0; i < n_Pts; i++)
	{
		CvPoint pt = cvPoint(0, 0);
		double sumx = 0, sumy = 0;
		for(int u = 0; u < count; u++)
		{
			CvPoint2D32f* point_coeff = (CvPoint2D32f*)cvGetSeqElem(seq_fourier, u);
			sumx += point_coeff->x*coeff_cos[(i*u)%n_Pts] - point_coeff->y*coeff_sin[(i*u)%n_Pts];
			sumy += point_coeff->y*coeff_cos[(i*u)%n_Pts] + point_coeff->x*coeff_sin[(i*u)%n_Pts];
		}
		pt.x = cvRound(sumx/count);
		pt.y = cvRound(sumy/count);
		cvSeqPush(seq_pts, &pt);
	}
	free(coeff_cos);
	free(coeff_sin);
}
开发者ID:landys,项目名称:image-features,代码行数:30,代码来源:test.cpp


示例6: rb_seq_push

VALUE
rb_seq_push(VALUE self, VALUE args, int flag)
{
  CvSeq *seq = CVSEQ(self);
  VALUE klass = seqblock_class(seq), object;
  void *buffer = NULL;
  for (int i = 0; i < RARRAY_LEN(args); i++) {
    object = RARRAY_PTR(args)[i];
    if (CLASS_OF(object) == klass) {
      if (flag == CV_FRONT)
	cvSeqPushFront(seq, DATA_PTR(object));
      else
	cvSeqPush(seq, DATA_PTR(object));
    }
    else if (rb_obj_is_kind_of(object, rb_klass) && CLASS_OF(rb_first(object)) == klass) { // object is CvSeq
      buffer = cvCvtSeqToArray(CVSEQ(object), cvAlloc(CVSEQ(object)->total * CVSEQ(object)->elem_size));
      cvSeqPushMulti(seq, buffer, CVSEQ(object)->total, flag);
      cvFree(&buffer);
    }
    else {
      rb_raise(rb_eTypeError, "arguments should be %s or %s which includes %s.",
	       rb_class2name(klass), rb_class2name(rb_klass), rb_class2name(klass));
    }
  }
  return self;
}
开发者ID:MattNguyen,项目名称:ruby-opencv,代码行数:26,代码来源:cvseq.cpp


示例7: cvAvgSdv

CvSeq *reghand::filthull2(CvSeq *filted_elimhull)
{
    //CvSeq *filtedhullseq=cvCloneSeq(filted_elimhull);
    float maxdis=0;CvPoint **fingpt;CvScalar mean,std=cvScalarAll(0);
    CvMat *dismat=cvCreateMat(1,filted_elimhull->total,CV_32FC1);
    CvPoint2D32f center=minrect.center;
    for (int i=0;i<filted_elimhull->total;i++)
    {
        CvPoint **data=CV_GET_SEQ_ELEM(CvPoint*,filted_elimhull,i);
        CvPoint pt=**data;
        float dis=sqrt(pow(pt.x-center.x,2)+pow(pt.y-center.y,2));
        dismat->data.fl[i]=dis;
        if(dis>maxdis){maxdis=dis;fingpt=data;}
    }
    cvAvgSdv(dismat,&mean,&std);
    if(filted_elimhull->total==1&&maxdis>fingerTh*0.5) return filted_elimhull;
    if(filted_elimhull->total==2&&maxdis>fingerTh*0.5&&std.val[0]<10)
    {
        CvPoint startpt=**CV_GET_SEQ_ELEM(CvPoint*,filted_elimhull,0);
        CvPoint endpt=**CV_GET_SEQ_ELEM(CvPoint*,filted_elimhull,1);;
        double bfang=atan(double(startpt.y-handcenter.y)/(startpt.x-handcenter.x))*180/PI;
        if(bfang<0)bfang+=180;
        double afang=atan(double(endpt.y-handcenter.y)/(endpt.x-handcenter.x))*180/PI;
        if(afang<0)afang+=180;
        if(fabs(bfang-afang)>60)
        {cvClearSeq(filted_elimhull);cvSeqPush(filted_elimhull,fingpt);return filted_elimhull;}
        else	return filted_elimhull;
    }
开发者ID:qinghuizhao,项目名称:GestureControl,代码行数:28,代码来源:reghand.cpp


示例8: cvGetSize

bool CybCamCalibration::generateDataToCalibration(IplImage *rgb_image) {

    IplImage *view_gray;
    int found = 0, count = 0;

    img_size = cvGetSize(rgb_image);

    found = cvFindChessboardCorners( rgb_image, board_size,
                                     image_points_buf, &count, CV_CALIB_CB_ADAPTIVE_THRESH );

    // improve the found corners' coordinate accuracy
    view_gray = cvCreateImage( cvGetSize(rgb_image), 8, 1 );
    cvCvtColor( rgb_image, view_gray, CV_BGR2GRAY );

    cvFindCornerSubPix( view_gray, image_points_buf, count, cvSize(11,11),
                        cvSize(-1,-1), cvTermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 ));

    cvReleaseImage( &view_gray );

    if( found )
    {
        cvSeqPush( image_points_seq, image_points_buf );

        sprintf( imagename, "image%03d.png", image_points_seq->total - 1 );
        cvSaveImage( imagename, rgb_image );
    }

    cvDrawChessboardCorners( rgb_image, board_size, image_points_buf, count, found );

    return ((unsigned)image_points_seq->total >= (unsigned)image_count);
}
开发者ID:naneaa,项目名称:Cybermed-4.0,代码行数:31,代码来源:cybCamCalibration.cpp


示例9: cvSeqPush

void  EdgeDetection::getEdge(CvSeq *seq)
{
	
	int nWidth	= pImage->width;
	int nHeight = pImage->height;
	int widthStep=pImage->widthStep;

	//计算直方图
	int histab[256];
	for(int i=0;i<256;i++)
		histab[i]=0;

	for(int j=1;j<nHeight-1;j++)
	{
		for(int i=1;i<nWidth-1;i++)
		{
			double temp=(pImage->imageData+nWidth*j)[i];
			if(temp<0)
				temp+=256;

			histab[(int)temp]++;
		}
	}
	for(int i=0;i<256;i++)
		probability[i]=(float)(histab[i]/((nHeight-2)*(nWidth-2)*1.0));
	double edgethreadhold=moment_shresh_sel1(probability);//计算边缘二值化的分割阈值
	for(int j=0;j<nHeight;j++)//将sobel检测出来的边缘进行二值化,滤去值过小的边缘点
	{
		for(int i=0;i<nWidth;i++)
		{
			if(i<1||j<1||j==nHeight-1||i==nWidth-1)
			{
				(pImage->imageData+nWidth*j)[i]=0;
			}
			else
			{
				double temp=(pImage->imageData+nWidth*j)[i];
				if(temp<0)
					temp+=256;

				if(temp>edgethreadhold)
				{
					(pImage->imageData+nWidth*j)[i]=255;
					
					CvPoint2D32f sample;
					sample.x=j;
					sample.y=i;
					cvSeqPush(seq,&sample);

				}
				else
					(pImage->imageData+nWidth*j)[i]=0;
			}
		}
	}

	cvNamedWindow( "Segment2_边缘图", 1 );//创建窗口
	cvShowImage( "Segment2_边缘图", pImage );//显示图像
	
}
开发者ID:ChanceMi,项目名称:EdgeDetect,代码行数:60,代码来源:EdgeDetection.cpp


示例10: cvCreateMemStorage

void bContourFinder::findConvexHulls(){
  CvMemStorage *stor = cvCreateMemStorage(); 
  CvSeq * ptseq = cvCreateSeq( CV_SEQ_KIND_CURVE|CV_32SC2,
                                    sizeof(CvContour),
                                    sizeof(CvPoint),
                                    stor );
  CvSeq * hull; 
  CvPoint pt; 
  this->convexBlobs.clear();
  for(int i = 0 ; i < this->blobs.size(); i++){
    this->convexBlobs.push_back(ofxCvBlob());
    this->convexBlobs[i] = this->blobs[i];
    this->convexBlobs[i].pts.clear(); 
    // get blob i
    for(int j = 0; j < this->blobs[i].pts.size(); j++){
      // fill in blob points 
      pt.x = this->blobs[i].pts[j].x; 
      pt.y = this->blobs[i].pts[j].y; 
      cvSeqPush( ptseq, &pt); 
    }
  
    hull = cvConvexHull2(ptseq, 0, CV_CLOCKWISE, 0); 
   
    // get the points for the blob:
    CvPoint           pt  = **CV_GET_SEQ_ELEM( CvPoint*, hull, hull->total - 1 );
    for( int j=0; j < hull->total; j++ ) {
      pt = **CV_GET_SEQ_ELEM( CvPoint*, hull, j );
      convexBlobs[i].pts.push_back( ofPoint((float)pt.x, (float)pt.y) );
    }
    convexBlobs[i].nPts = convexBlobs[i].pts.size();
  }
  cvClearMemStorage( stor ); 
}
开发者ID:dopuskh3,项目名称:ofx-projects,代码行数:33,代码来源:bContourFinder.cpp


示例11: main

int
main (int argc, char **argv)
{
    CvMemStorage *storage = cvCreateMemStorage( 0 );
    CvSeq *points = cvCreateSeq( CV_SEQ_ELTYPE_POINT, sizeof( CvSeq ), sizeof( CvPoint ), storage );
    cvSeqPush( points, &cvPoint( 100, 50 ) );
    cvSeqPush( points, &cvPoint( 50, 100 ) );
    cvSeqPush( points, &cvPoint( 50, 150 ) );
    cvSeqPush( points, &cvPoint( 150, 50 ) );

    CvRect rect = cvBoundingRect( points );
    cvPrintRect( rect );

    cvReleaseMemStorage( &storage );
    return 0;
}
开发者ID:andrey1227,项目名称:opencvx,代码行数:16,代码来源:cvboundingrect.cpp


示例12: cvSegmentMotion

CV_IMPL CvSeq*
cvSegmentMotion( const CvArr* mhimg, CvArr* segmaskimg, CvMemStorage* storage,
                 double timestamp, double segThresh )
{
    cv::Mat mhi = cv::cvarrToMat(mhimg);
    const cv::Mat segmask = cv::cvarrToMat(segmaskimg);
    std::vector<cv::Rect> brs;
    cv::segmentMotion(mhi, segmask, brs, timestamp, segThresh);
    CvSeq* seq = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvConnectedComp), storage);

    CvConnectedComp comp;
    memset(&comp, 0, sizeof(comp));
    for( size_t i = 0; i < brs.size(); i++ )
    {
        cv::Rect roi = brs[i];
        float compLabel = (float)(i+1);
        int x, y, area = 0;

        cv::Mat part = segmask(roi);
        for( y = 0; y < roi.height; y++ )
        {
            const float* partptr = part.ptr<float>(y);
            for( x = 0; x < roi.width; x++ )
                area += partptr[x] == compLabel;
        }

        comp.value = cv::Scalar(compLabel);
        comp.rect = roi;
        comp.area = area;
        cvSeqPush(seq, &comp);
    }

    return seq;
}
开发者ID:kassemitani,项目名称:opencv,代码行数:34,代码来源:compat_video.cpp


示例13: scale_space_extrema

/*
Detects features at extrema in DoG scale space.  Bad features are discarded
based on contrast and ratio of principal curvatures.

@param dog_pyr DoG scale space pyramid
@param octvs octaves of scale space represented by dog_pyr
@param intvls intervals per octave
@param contr_thr low threshold on feature contrast
@param curv_thr high threshold on feature ratio of principal curvatures
@param storage memory storage in which to store detected features

@return Returns an array of detected features whose scales, orientations,
	and descriptors are yet to be determined.
*/
CvSeq* scale_space_extrema( IplImage*** dog_pyr, int octvs, int intvls,
			   double contr_thr, int curv_thr, CvMemStorage* storage ) {
	CvSeq* features;
	double prelim_contr_thr = 0.5 * contr_thr / intvls;
	struct feature* feat;
	struct detection_data* ddata;
	int o, i, r, c;

	features = cvCreateSeq( 0, sizeof(CvSeq), sizeof(struct feature), storage );
	for( o = 0; o < octvs; o++ )
		for( i = 1; i <= intvls; i++ )
			for(r = SIFT_IMG_BORDER; r < dog_pyr[o][0]->height-SIFT_IMG_BORDER; r++)
				for(c = SIFT_IMG_BORDER; c < dog_pyr[o][0]->width-SIFT_IMG_BORDER; c++)
					/* perform preliminary check on contrast */
					if( ABS( pixval32f( dog_pyr[o][i], r, c ) ) > prelim_contr_thr )
						if( is_extremum( dog_pyr, o, i, r, c ) ) {
							feat = interp_extremum(dog_pyr, o, i, r, c, intvls, contr_thr);
							if( feat ) {
								ddata = feat_detection_data( feat );
								if( ! is_too_edge_like( dog_pyr[ddata->octv][ddata->intvl],
									ddata->r, ddata->c, curv_thr ) ) {
									cvSeqPush( features, feat );
								}
								else
									free( ddata );
								free( feat );
							}
						}

	return features;
}
开发者ID:joa-quim,项目名称:mirone,代码行数:45,代码来源:sift.c


示例14: read_num_class_data

// This function reads data and responses from the file <filename>
static int
read_num_class_data( const char* filename, int var_count,
                     CvMat** data, CvMat** responses )
{
    const int M = 1024;
    FILE* f = fopen( filename, "rt" );
    CvMemStorage* storage;
    CvSeq* seq;
    char buf[M+2];
    float* el_ptr;
    CvSeqReader reader;
    int i, j;

    if( !f )
        return 0;

    el_ptr = new float[var_count+1];
    storage = cvCreateMemStorage();
    seq = cvCreateSeq( 0, sizeof(*seq), (var_count+1)*sizeof(float), storage );

    for(;;)
    {
        char* ptr;
        if( !fgets( buf, M, f ) || !strchr( buf, ',' ) )
            break;
        el_ptr[0] = buf[0];
        ptr = buf+2;
        for( i = 1; i <= var_count; i++ )
        {
            int n = 0;
            sscanf( ptr, "%f%n", el_ptr + i, &n );
            ptr += n + 1;
        }
        if( i <= var_count )
            break;
        cvSeqPush( seq, el_ptr );
    }
    fclose(f);

    *data = cvCreateMat( seq->total, var_count, CV_32F );
    *responses = cvCreateMat( seq->total, 1, CV_32F );

    cvStartReadSeq( seq, &reader );

    for( i = 0; i < seq->total; i++ )
    {
        const float* sdata = (float*)reader.ptr + 1;
        float* ddata = data[0]->data.fl + var_count*i;
        float* dr = responses[0]->data.fl + i;

        for( j = 0; j < var_count; j++ )
            ddata[j] = sdata[j];
        *dr = sdata[-1];
        CV_NEXT_SEQ_ELEM( seq->elem_size, reader );
    }

    cvReleaseMemStorage( &storage );
    delete[] el_ptr;
    return 1;
}
开发者ID:Ashwini7,项目名称:smart-python-programs,代码行数:61,代码来源:letter_recog.cpp


示例15: plot_scan_image

void plot_scan_image(IplImage* image, Two_dimensional_vector* scan_image)
{
    CvSeq *points;
    CvPoint pt;
    CvMemStorage *storage = cvCreateMemStorage (0);

    points = cvCreateSeq (CV_SEQ_ELTYPE_POINT, sizeof (CvSeq), sizeof (CvPoint), storage);

    for (int i = 0; i < (int)scan_image->x.size(); i++) {
        if(0 > scan_image->x[i] || scan_image->x[i] > 639) {
            continue;
        }
        if(0 > scan_image->y[i] || scan_image->y[i] > 479) {
            continue;
        }
        pt.x = scan_image->x[i];
        pt.y = scan_image->y[i];

        cvSeqPush (points, &pt);
        cvCircle(image, pt, 2, CV_RGB (0, 255, 0), CV_FILLED, 8, 0);
    }

    cvClearSeq(points);
    cvReleaseMemStorage(&storage);
}
开发者ID:yukkysaito,项目名称:Autoware,代码行数:25,代码来源:scan_window.cpp


示例16: add_good_ori_features

/*
Adds features to an array for every orientation in a histogram greater than a specified threshold.
@param features new features are added to the end of this array
@param hist orientation histogram
@param n number of bins in hist
@param mag_thr new features are added for entries in hist greater than this
@param feat new features are clones of this with different orientations
*/
static void add_good_ori_features( CvSeq* features, double* hist, int n,
								   double mag_thr, struct feature* feat )
{
	struct feature* new_feat;
	double bin, PI2 = CV_PI * 2.0;
	int l, r, i;

    //遍历直方图
	for( i = 0; i < n; i++ )
	{
        l = ( i == 0 )? n - 1 : i-1;//前一个(左边的)bin的下标
        r = ( i + 1 ) % n;//后一个(右边的)bin的下标

        //若当前的bin是局部极值(比前一个和后一个bin都大),并且值大于给定的幅值阈值,则新生成一个特征点并添加到特征点序列末尾
		if( hist[i] > hist[l]  &&  hist[i] > hist[r]  &&  hist[i] >= mag_thr )
		{
            //根据左、中、右三个bin的值对当前bin进行直方图插值
			bin = i + interp_hist_peak( hist[l], hist[i], hist[r] );
            bin = ( bin < 0 )? n + bin : ( bin >= n )? bin - n : bin;//将插值结果规范到[0,n]内
            new_feat = clone_feature( feat );//克隆当前特征点为新特征点
            new_feat->ori = ( ( PI2 * bin ) / n ) - CV_PI;//新特征点的方向
            cvSeqPush( features, new_feat );//插入到特征点序列末尾
			free( new_feat );
		}
	}
}
开发者ID:githubcjl,项目名称:uVision_cjl,代码行数:34,代码来源:sift.c


示例17: cvSeqPush

void CvBlobTrackSeq::AddBlobTrack(int TrackID, int StartFrame)
{
    CvBlobTrack N;
    N.TrackID = TrackID;
    N.StartFrame = StartFrame;
    N.pBlobSeq = new CvBlobSeq;
    cvSeqPush(m_pSeq,&N);
}
开发者ID:93sam,项目名称:opencv,代码行数:8,代码来源:blobtrack.cpp


示例18: GenerateSimpleIllumMontage

/*
 * This function generates an illumination montage containing a square in worm space
 * at a location specified.
 *
 * This function is most useful when it takes input from a slider bar.
 *
 * In that manner the user can specify a rectangular (in worm space) region of illumination
 * at run time.
 *
 */
int GenerateSimpleIllumMontage(CvSeq* montage, CvPoint origin, CvSize radius, CvSize gridSize){
	/** If the square has no length or width, then  there is nothing to do **/
	if (radius.width == 0 || radius.height ==  0) return 0;

	/** If the y value extends off the worm, we need to crop it.. (otherwise it wraps... weird!)**/



	cvClearSeq(montage);

	WormPolygon* polygon=CreateWormPolygon(montage->storage,gridSize);


	CvPoint curr;

	/** Lower Left **/
	curr=cvPoint(origin.x-radius.width, CropNumber(1,gridSize.height-1,origin.y-radius.height));
	cvSeqPush(polygon->Points,&curr);

	/** Lower Right **/
	curr=cvPoint(origin.x+radius.width, CropNumber(1,gridSize.height-1,origin.y-radius.height));
	cvSeqPush(polygon->Points,&curr);

	/** Upper Right **/
	curr=cvPoint(origin.x+radius.width, CropNumber(1,gridSize.height-1,origin.y+radius.height));
	cvSeqPush(polygon->Points,&curr);


	/** Upper Left **/
	curr=cvPoint(origin.x-radius.width, CropNumber(1,gridSize.height-1,origin.y+radius.height));
	cvSeqPush(polygon->Points,&curr);


	/** Push this sparse polygon onto the temp montage **/
	CvSeq* tempMontage= CreateIlluminationMontage(montage->storage);
	cvSeqPush(tempMontage,&polygon);

	/** Convert the sparse polygon into a contour-polygon **/
	CvtPolyMontage2ContourMontage(tempMontage,montage);
	cvClearSeq(tempMontage);

	return 1;


}
开发者ID:Sophrinix,项目名称:mindcontrol,代码行数:55,代码来源:IllumWormProtocol.c


示例19: cvCreateMemStorage

/*!
    \fn CvBinGabAdaFeatureSelect::loadweaks(const char* filename)
 */
void CvBinGabAdaFeatureSelect::loadweaks(const char* filename)
{
  //clear();
  {
    delete new_pool;
    weaks.clear();
  }
  CvMemStorage* fstorage = cvCreateMemStorage( 0 );
  CvFileStorage *fs;
  fs = cvOpenFileStorage( filename, fstorage, CV_STORAGE_READ );
  CvFileNode *root = cvGetRootFileNode( fs, 0);
  char *weakname = new char[20];
  int i = 0;
  
  CvMemStorage* storage = cvCreateMemStorage(0);
  CvSeq* seq = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvGaborTree), storage );
  while(1)
  {
    sprintf( weakname, "weak_%d", i);
    CvFileNode *weaknode = cvGetFileNodeByName( fs, root, weakname);
    if (!weaknode) break;
    CvGaborTree tree;
    weaknode2tree(weaknode, fs, &tree);
    cvSeqPush( seq, &tree );
    i++;	
  }
  
    /* from squence to vector weaks*/
  new_pool = new CvGaborFeaturePool;
  for (int i = 0; i <seq->total; i++)
  {
    CvGaborTree *atree = (CvGaborTree*)cvGetSeqElem(seq, i);
    CvWeakLearner *weak = new CvWeakLearner;
    weak->setType( weaklearner_type );
    weak->setthreshold(atree->threshold);
    weak->setparity(atree->parity);
    weaks.push_back(*weak);
    CvGaborFeature *feature = new CvGaborFeature(atree->x, atree->y, atree->Mu, atree->Nu);
    new_pool->add(feature);
    alphas.push_back(atree->alpha);
    delete weak;
    delete feature;
  } 
  
  cvReleaseMemStorage( &storage );
  cvReleaseFileStorage(&fs);
  cvReleaseMemStorage( &fstorage );
  delete [] weakname;
  
    /* set member variables */
  current = new_pool->getSize();
  falsepositive = 0.0;
  nexpfeatures = new_pool->getSize();
  nselecfeatures = new_pool->getSize();
  printf(" %d weak classifiers have been loaded!\n", nselecfeatures);
}
开发者ID:Slipperboy,项目名称:gaborboosting,代码行数:59,代码来源:cvbingabadafeatureselect.cpp


示例20: _cvTreatExeptionalCase

CvLCMNode* _cvTreatExeptionalCase(CvLCM* pLCM,
                                  CvLCMData* pLCMInputData)
{
    CvVoronoiEdge2D* pEdge = pLCMInputData->pedge;
    CvVoronoiSite2D* pSite = pLCMInputData->psite;
    CvVoronoiNode2D* pNode = CV_VORONOIEDGE2D_BEGINNODE(pEdge,pSite);
    CvLCMNode* pLCMNode = _cvCreateLCMNode(pLCM);
    cvSeqPush((CvSeq*)pLCMNode->contour,&pNode->pt);
    return pLCMNode;
}//end of _cvConstructLCMEdge
开发者ID:caomw,项目名称:tactical-visual-servoing,代码行数:10,代码来源:cvlcm.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cvSetCaptureProperty函数代码示例发布时间:2022-05-30
下一篇:
C++ cvScalarAll函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap