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

C++ cvStartReadSeq函数代码示例

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

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



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

示例1: findPairs

//Find all the matched points
void findPairs( const CvSeq* objectKeypoints,
                const CvSeq* objectDescriptors,
                const CvSeq* imageKeypoints,
                const CvSeq* imageDescriptors,
                std::vector<int>& ptpairs )
{
  int i;
  CvSeqReader reader, kreader;
  cvStartReadSeq( objectKeypoints, &kreader );
  cvStartReadSeq( objectDescriptors, &reader );
  ptpairs.clear();

  for( i = 0; i < objectDescriptors->total; i++ )
  {
    const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
    const float* descriptor = (const float*)reader.ptr;
    CV_NEXT_SEQ_ELEM( kreader.seq->elem_size, kreader );
    CV_NEXT_SEQ_ELEM( reader.seq->elem_size, reader );
    int nearest_neighbor = naiveNearestNeighbor( descriptor,
						 kp->laplacian,
						 imageKeypoints,
						 imageDescriptors );
    if( nearest_neighbor >= 0 )
    {
      ptpairs.push_back(i);
      ptpairs.push_back(nearest_neighbor);
    }
  }
}
开发者ID:976717326,项目名称:visp,代码行数:30,代码来源:vpKeyPointSurf.cpp


示例2: findPairs

void
findPairs( const CvSeq* objectKeypoints, const CvSeq* objectDescriptors,
           const CvSeq* imageKeypoints, const CvSeq* imageDescriptors, struct pairList * ptpairs )
{
    CvSeqReader reader, kreader;
    cvStartReadSeq( objectKeypoints, &kreader , 0 );
    cvStartReadSeq( objectDescriptors, &reader , 0 );


    struct pairList * pairs = initializePairList(ptpairs,objectDescriptors->total);
    if (pairs==0) { fprintf(stderr,"Could not allocate enough memory for pointer pairs\n"); return ; }

    int i;
    for( i = 0; i < objectDescriptors->total; i++ )
    {
        const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
        const float* descriptor = (const float*)reader.ptr;
        CV_NEXT_SEQ_ELEM( kreader.seq->elem_size, kreader );
        CV_NEXT_SEQ_ELEM( reader.seq->elem_size, reader );
        int nearest_neighbor = naiveNearestNeighbor( descriptor, kp->laplacian, imageKeypoints, imageDescriptors );
        if( nearest_neighbor >= 0 )
        {
            pairs->item[i].p1 = i;
            pairs->item[i].p2 = nearest_neighbor;
        }
    }

    destroyPairList(&pairs);
}
开发者ID:AmmarkoV,项目名称:AdvancedImageSearch,代码行数:29,代码来源:findObjectsSURF.c


示例3: cvStartReadSeq

void CvFaceElement::Energy()
{
    CvSeqReader reader, reader2;
    cvStartReadSeq( m_seqRects, &reader );
    for (int i = 0; i < m_seqRects->total; i++)
    {
        CvTrackingRect* pRect = (CvTrackingRect*)(reader.ptr);
        // outside and inside rects
        cvStartReadSeq( m_seqRects, &reader2 );
        for (int j = 0; j < m_seqRects->total; j++)
        {
            CvTrackingRect* pRect2 = (CvTrackingRect*)(reader2.ptr);
            if (i != j)
            {
                if (RectInRect(pRect2->r, pRect->r))
                    pRect->nRectsInThis ++;
                else if (pRect2->r.y + pRect2->r.height <= pRect->r.y)
                    pRect->nRectsOnTop ++;
                else if (pRect2->r.y >= pRect->r.y + pRect->r.height)
                    pRect->nRectsOnBottom ++;
                else if (pRect2->r.x + pRect2->r.width <= pRect->r.x)
                    pRect->nRectsOnLeft ++;
                else if (pRect2->r.x >= pRect->r.x + pRect->r.width)
                    pRect->nRectsOnRight ++;
            }
            CV_NEXT_SEQ_ELEM( sizeof(CvTrackingRect), reader2 );
        }
        // energy
        pRect->Energy(m_trPrev);
        CV_NEXT_SEQ_ELEM( sizeof(CvTrackingRect), reader );
    }
}//void CvFaceElement::Energy()
开发者ID:406089450,项目名称:opencv,代码行数:32,代码来源:vecfacetracking.cpp


示例4: naiveNearestNeighbor

int
naiveNearestNeighbor( const float* vec, int laplacian,
                      const CvSeq* model_keypoints,
                      const CvSeq* model_descriptors )
{
    int length = (int)(model_descriptors->elem_size/sizeof(float));
    int i, neighbor = -1;
    double d, dist1 = 1e6, dist2 = 1e6;
    CvSeqReader reader, kreader;
    cvStartReadSeq( model_keypoints, &kreader, 0 );
    cvStartReadSeq( model_descriptors, &reader, 0 );

    for( i = 0; i < model_descriptors->total; i++ )
    {
        const CvSURFPoint* kp = (const CvSURFPoint*)kreader.ptr;
        const float* mvec = (const float*)reader.ptr;
    	CV_NEXT_SEQ_ELEM( kreader.seq->elem_size, kreader );
        CV_NEXT_SEQ_ELEM( reader.seq->elem_size, reader );
        if( laplacian != kp->laplacian )
            continue;
        d = compareSURFDescriptors( vec, mvec, dist2, length );
        if( d < dist1 )
        {
            dist2 = dist1;
            dist1 = d;
            neighbor = i;
        }
        else if ( d < dist2 )
            dist2 = d;
    }
    if ( dist1 < 0.6*dist2 )
        return neighbor;
    return -1;
}
开发者ID:AmmarkoV,项目名称:AdvancedImageSearch,代码行数:34,代码来源:findObjectsSURF.c


示例5: WriteProtocol

/**
 * Write out a Protocol to YAML file, given an initialized CvFileStorage
 */
void WriteProtocol(Protocol* myP, CvFileStorage* fs){
	if (fs==0){
		printf("fs is zero! Could you have specified the wrong directory?\n");
		return;
	}
	/** Write out Protocol **/
	cvStartWriteStruct(fs,"Protocol",CV_NODE_MAP,NULL);
		if (myP->Filename!=NULL) cvWriteString(fs,"Filename",myP->Filename);
		if (myP->Description!=NULL)  cvWriteString(fs,"Description",myP->Description);
		cvStartWriteStruct(fs,"GridSize",CV_NODE_MAP,NULL);
			cvWriteInt(fs,"height",myP->GridSize.height);
			cvWriteInt(fs,"width",myP->GridSize.width);
		cvEndWriteStruct(fs);
		//printf("yo\n");
		/** Write Out Steps **/
		cvStartWriteStruct(fs,"Steps",CV_NODE_SEQ,NULL);
		int j;
		int jtot=myP->Steps->total;


		CvSeqReader StepReader;
		cvStartReadSeq(myP->Steps,&StepReader,0);
		for (j = 0; j < jtot; ++j) {
			//printf("About to write step number %d\n",j);
			CvSeq** CurrentMontagePtr = (CvSeq**) StepReader.ptr;
			CvSeq* CurrentMontage=*CurrentMontagePtr;
			assert(CurrentMontage!=NULL);
		//	printf("ping\n");
		//	printf("CurrentMontage->total=%d",CurrentMontage->total);
			cvStartWriteStruct(fs,NULL,CV_NODE_SEQ,NULL);
			int k;
			int ktot=CurrentMontage->total;
		//	printf("ktot=%d\n",ktot);

			CvSeqReader MontageReader;
			cvStartReadSeq(CurrentMontage,&MontageReader);
			for (k = 0; k < ktot; ++k) {
			//	printf("About to write polygon number %d\n",k);
				WormPolygon** CurrentPolygonPtr= (WormPolygon**) MontageReader.ptr;
				WormPolygon* CurrentPolygon=*CurrentPolygonPtr;

				cvWrite(fs,NULL,CurrentPolygon->Points);

				CV_NEXT_SEQ_ELEM(CurrentMontage->elem_size,MontageReader);
			}
			CurrentMontagePtr=NULL;
			CurrentMontage=NULL;
			cvEndWriteStruct(fs);

			/** Loop to Next Step **/
			CV_NEXT_SEQ_ELEM(myP->Steps->elem_size,StepReader);

		}
		cvEndWriteStruct(fs);
	cvEndWriteStruct(fs);
}
开发者ID:Sophrinix,项目名称:mindcontrol,代码行数:59,代码来源:IllumWormProtocol.c


示例6: VerifyProtocol

int VerifyProtocol(Protocol* p){
	printf("\n\n========== VERIFYING PROTOCOL============\n");
	if (p==NULL){
		printf("Protocol is NULL\n");
		return -1;
	}

	printf("Protocol description: %s\n", p->Description);
	printf("Filename= %s\n",p->Filename);
	printf("Total number of steps: p->Steps->total=%d\n",p->Steps->total);

	CvSeqReader StepReader;
	cvStartReadSeq(p->Steps, &StepReader,0);
	int numsteps=p->Steps->total;
	/** Let's loop through all of the steps **/
		for (int i= 0; i< numsteps; ++i) {
			printf("Step i=%d\n",i);

			CvSeq* CurrMontage= *( (CvSeq**) StepReader.ptr);
			printf("\tCurrMontage has %d polygons\n",CurrMontage->total);
			int numPolygons=CurrMontage->total;
			int j;


			/** Let's loop through the polygons **/

			CvSeqReader MontageReader;
			cvStartReadSeq(CurrMontage, &MontageReader);
			for (j = 0; j < numPolygons; ++j) {
				WormPolygon*  poly= *( (WormPolygon**) MontageReader.ptr );
				int numpts=poly->Points->total;
				printf(" numpts=%d\n",numpts);




				//PrintPointsOfSeq(poly->Points);




				CV_NEXT_SEQ_ELEM( CurrMontage->elem_size,MontageReader);
			}




			/** Progress to the next step **/
			CV_NEXT_SEQ_ELEM( p->Steps->elem_size, StepReader );
		}


	printf("========================================\n");
	return 0;
}
开发者ID:Sophrinix,项目名称:mindcontrol,代码行数:55,代码来源:IllumWormProtocol.c


示例7: matchingORB

void matchingORB(const CvSeq* sd, const CvSeq* id, std::vector<int> &pairs) {

    int i, j, k, d1, d2, jj, dist, i_total, s_total;
    unsigned char *i_ptr, *s_ptr;

    CvSeqReader i_reader;
    CvSeqReader s_reader;

    i_total = id->total;
    s_total = sd->total;

    cvStartReadSeq(sd, &s_reader, 0);
    s_ptr = (unsigned char*) s_reader.ptr;

    for(i=0; i<s_total; i++) {

        d1 = d2 = 0;
        jj = -1;

        cvStartReadSeq(id, &i_reader, 0);
        i_ptr = (unsigned char*) i_reader.ptr;

        for(j=0; j<i_total; j++) {

            dist = 0;

            for(k=0; k<32; k++)
                dist += (s_ptr[k]==i_ptr[k]) ? 1 : 0;

            if(dist>d1) {
                d2 = d1;
                d1 = dist;
                jj = j;
            }
            else if(dist>d2)
                d2 = dist;

            CV_NEXT_SEQ_ELEM(i_reader.seq->elem_size, i_reader);
            i_ptr = (unsigned char*) i_reader.ptr;

        }

        if((jj>=0) && (d2 < 0.7*d1)) {
            pairs.push_back(i);
            pairs.push_back(jj);
        }

        CV_NEXT_SEQ_ELEM(s_reader.seq->elem_size, s_reader);
        s_ptr = (unsigned char*) s_reader.ptr;

    }
}
开发者ID:Modasshir,项目名称:socrob-ros-pkg,代码行数:52,代码来源:matching.cpp


示例8: cvClearSubdivVoronoi2D

CV_IMPL void
cvClearSubdivVoronoi2D( CvSubdiv2D * subdiv )
{
    int elem_size;
    int i, total;
    CvSeqReader reader;

    CV_FUNCNAME( "cvClearVoronoi2D" );

    __BEGIN__;

    if( !subdiv )
        CV_ERROR( CV_StsNullPtr, "" );

    /* clear pointers to voronoi points */
    total = subdiv->edges->total;
    elem_size = subdiv->edges->elem_size;

    cvStartReadSeq( (CvSeq *) (subdiv->edges), &reader, 0 );

    for( i = 0; i < total; i++ )
    {
        CvQuadEdge2D *quadedge = (CvQuadEdge2D *) reader.ptr;

        quadedge->pt[1] = quadedge->pt[3] = 0;
        CV_NEXT_SEQ_ELEM( elem_size, reader );
    }

    /* remove voronoi points */
    total = subdiv->total;
    elem_size = subdiv->elem_size;

    cvStartReadSeq( (CvSeq *) subdiv, &reader, 0 );

    for( i = 0; i < total; i++ )
    {
        CvSubdiv2DPoint *pt = (CvSubdiv2DPoint *) reader.ptr;

        /* check for virtual point. it is also check that the point exists */
        if( pt->flags & CV_SUBDIV2D_VIRTUAL_POINT_FLAG )
        {
            cvSetRemoveByPtr( (CvSet*)subdiv, pt );
        }
        CV_NEXT_SEQ_ELEM( elem_size, reader );
    }

    subdiv->is_geometry_valid = 0;

    
    __END__;
}
开发者ID:cybertk,项目名称:opencv,代码行数:51,代码来源:cvsubdivision2d.cpp


示例9: cvStartReadRawData

CV_IMPL void
cvStartReadRawData( const CvFileStorage* fs, const CvFileNode* src, CvSeqReader* reader )
{
    int node_type;
    CV_CHECK_FILE_STORAGE( fs );

    if( !src || !reader )
        CV_Error( CV_StsNullPtr, "Null pointer to source file node or reader" );

    node_type = CV_NODE_TYPE(src->tag);
    if( node_type == CV_NODE_INT || node_type == CV_NODE_REAL )
    {
        // emulate reading from 1-element sequence
        reader->ptr = (schar*)src;
        reader->block_max = reader->ptr + sizeof(*src)*2;
        reader->block_min = reader->ptr;
        reader->seq = 0;
    }
    else if( node_type == CV_NODE_SEQ )
    {
        cvStartReadSeq( src->data.seq, reader, 0 );
    }
    else if( node_type == CV_NODE_NONE )
    {
        memset( reader, 0, sizeof(*reader) );
    }
    else
        CV_Error( CV_StsBadArg, "The file node should be a numerical scalar or a sequence" );
}
开发者ID:Achraf33,项目名称:opencv,代码行数:29,代码来源:persistence_c.cpp


示例10: cvStartReadChainPoints

CV_IMPL void
cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader )
{
    int i;

    CV_FUNCNAME( "cvStartReadChainPoints" );

    __BEGIN__;

    if( !chain || !reader )
        CV_ERROR( CV_StsNullPtr, "" );

    if( chain->elem_size != 1 || chain->header_size < (int)sizeof(CvChain))
        CV_ERROR_FROM_STATUS( CV_BADSIZE_ERR );

    cvStartReadSeq( (CvSeq *) chain, (CvSeqReader *) reader, 0 );
    CV_CHECK();

    reader->pt = chain->origin;

    for( i = 0; i < 8; i++ )
    {
        reader->deltas[i][0] = (char) icvCodeDeltas[i].x;
        reader->deltas[i][1] = (char) icvCodeDeltas[i].y;
    }

    __END__;
}
开发者ID:DORARA29,项目名称:AtomManipulator,代码行数:28,代码来源:cvcontours.cpp


示例11: drawSquares

// the function draws all the squares in the image 
void drawSquares( IplImage* img, CvSeq* squares ) {  
	CvSeqReader reader; 
	IplImage* cpy = cvCloneImage( img );
	int i;  
	// initialize reader of the sequence 
	cvStartReadSeq( squares, &reader, 0 );
	// read 4 sequence elements at a time (all vertices of a square)  
	for( i = 0; i < squares->total; i += 4 ){  
		CvPoint* rect = pt;
		int count = 4; 
		// read 4 vertices  
		memcpy( pt, reader.ptr, squares->elem_size );
		CV_NEXT_SEQ_ELEM( squares->elem_size, reader ); 
		memcpy( pt + 1, reader.ptr, squares->elem_size );  
		CV_NEXT_SEQ_ELEM( squares->elem_size, reader );
		memcpy( pt + 2, reader.ptr, squares->elem_size );
		CV_NEXT_SEQ_ELEM( squares->elem_size, reader );  
		memcpy( pt + 3, reader.ptr, squares->elem_size ); 
		CV_NEXT_SEQ_ELEM( squares->elem_size, reader ); 
		// draw the square as a closed polyline 
		cvPolyLine( cpy, &rect, &count, 1, 1, CV_RGB(0,255,0), 3, CV_AA, 0 );
		if(i == 0){
			sort_vertex(rect);    //get the four vertex and sort them
			break;
		}
	}  
	// show the resultant image  
	cvShowImage( wndname, cpy );
	cvReleaseImage( &cpy ); 
} 
开发者ID:guoqi1123,项目名称:ProjectionCompensation,代码行数:31,代码来源:rectangle.cpp


示例12: paint_voronoi

void paint_voronoi( CvSubdiv2D* subdiv, IplImage* img )
{
    CvSeqReader  reader;
    int i, total = subdiv->edges->total;
    int elem_size = subdiv->edges->elem_size;

    cvCalcSubdivVoronoi2D( subdiv );

    cvStartReadSeq( (CvSeq*)(subdiv->edges), &reader, 0 );

    for( i = 0; i < total; i++ )
    {
        CvQuadEdge2D* edge = (CvQuadEdge2D*)(reader.ptr);

        if( CV_IS_SET_ELEM( edge ))
        {
            CvSubdiv2DEdge e = (CvSubdiv2DEdge)edge;
            // left
            draw_subdiv_facet( img, cvSubdiv2DRotateEdge( e, 1 ));

            // right
            draw_subdiv_facet( img, cvSubdiv2DRotateEdge( e, 3 ));
        }

        CV_NEXT_SEQ_ELEM( elem_size, reader );
    }
}
开发者ID:Ashwini7,项目名称:smart-python-programs,代码行数:27,代码来源:delaunay.c


示例13: cvStartReadSeq

/** Draws the identified Tetris pieces on the given image.
 */
void Camera::drawTetris( IplImage* img, CvSeq* tetrisPieces )
{
    CvSeqReader reader;
    int i;

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

    // read the pieces sequence elements at a time (all vertices of the piece)
    for( i = 0; i < tetrisPieces->total; i += 6 )
    {
        CvPoint pt[6], *rect = pt;
        int count = 6;

        // read 6 vertices
        CV_READ_SEQ_ELEM( pt[0], reader );
        CV_READ_SEQ_ELEM( pt[1], reader );
        CV_READ_SEQ_ELEM( pt[2], reader );
        CV_READ_SEQ_ELEM( pt[3], reader );
        CV_READ_SEQ_ELEM( pt[4], reader );
        CV_READ_SEQ_ELEM( pt[5], reader );


        // draw the piece as a closed polyline
        cvPolyLine( img, &rect, &count, 1, 1, CV_RGB(255,0,0), 3, CV_AA, 0 );
    }

	return;
}
开发者ID:JackFan-Z,项目名称:MetroVision,代码行数:31,代码来源:camera.cpp


示例14: CV_FUNCNAME

void
Blob::copy_edges(const CvSeq* _edges)
{
  CV_FUNCNAME( "Blob::copy_edges" );
  __BEGIN__;

	cvClearSeq(this->edges_);
  
  //- copy the given sequence
	CvSeqReader seq_reader;
	CvSeqWriter seq_writer;
	CvPoint current_edge;
  int i;

	CV_CALL( cvStartReadSeq( _edges, &seq_reader) );
	CV_CALL( cvStartAppendToSeq( this->edges_, &seq_writer ) );

	for( i = 0; i < _edges->total; i++)
	{
		CV_READ_SEQ_ELEM ( current_edge , seq_reader);
		CV_WRITE_SEQ_ELEM( current_edge , seq_writer );
	}

	CV_CALL( cvEndWriteSeq( &seq_writer ) );


  __END__;
  __ISL_CHECK_ERROR__;
}
开发者ID:srgblnch,项目名称:ISL,代码行数:29,代码来源:Blob.cpp


示例15: icvSeqElemsClearMask

static  void  icvSeqElemsClearMask( CvSeq* seq, int offset, int clear_mask )
{
    CV_FUNCNAME("icvStartScanGraph");

    __BEGIN__;
    
    CvSeqReader reader;
    int i, total, elem_size;

    if( !seq )
        CV_ERROR_FROM_STATUS( CV_NULLPTR_ERR );

    elem_size = seq->elem_size;
    total = seq->total;

    if( (unsigned)offset > (unsigned)elem_size )
        CV_ERROR_FROM_STATUS( CV_BADARG_ERR );

    CV_CALL( cvStartReadSeq( seq, &reader ));

    for( i = 0; i < total; i++ )
    {
        int* flag_ptr = (int*)(reader.ptr + offset);
        *flag_ptr &= ~clear_mask;

        CV_NEXT_SEQ_ELEM( elem_size, reader );
    }

    __END__;
}
开发者ID:mikanradojevic,项目名称:sdkpub,代码行数:30,代码来源:cvgraphex.cpp


示例16: vpTRACE

std::list<int*>* vpKeyPointSurf::matchPoint(std::list<float*> descriptorList, std::list<int> laplacianList)
{
  std::list<int*>* pairPoints = new std::list<int*>;

  if(descriptorList.size() != laplacianList.size()){
    vpTRACE("Error, the two lists have different number of element");
    return pairPoints;
  }

  CvSeqReader reader;
  cvStartReadSeq( ref_descriptors, &reader );

  std::list<float*>::const_iterator descriptorListIter = descriptorList.begin();
  std::list<int>::const_iterator laplacianListIter = laplacianList.begin();
  descriptorList.front();
  int indexList = 0;
  while(descriptorListIter != descriptorList.end()){
    float* descriptor = *descriptorListIter;

    int nearest_neighbor = naiveNearestNeighbor( descriptor, *laplacianListIter, ref_keypoints, ref_descriptors);

    if(nearest_neighbor >= 0){
      int* tab;
      tab = new int[2];
      tab[0] = nearest_neighbor;
      tab[1] = indexList;
      pairPoints->push_back(tab);
    }
    indexList++;
    ++descriptorListIter;
    ++laplacianListIter;
  }

  return pairPoints;
}
开发者ID:976717326,项目名称:visp,代码行数:35,代码来源:vpKeyPointSurf.cpp


示例17: drawSquares

void drawSquares(IplImage* img, CvSeq* squares, PointMatrix &mat)
{
        CvSeqReader reader;
        IplImage* cpy = cvCloneImage(img);

        cvStartReadSeq(squares, &reader, 0);

        for (int i = 0; i < squares->total; i++) {
                CvPoint pt[4], *rect = pt;
                int count = 4;
                CV_READ_SEQ_ELEM(pt[0], reader);
                CV_READ_SEQ_ELEM(pt[1], reader);
                CV_READ_SEQ_ELEM(pt[2], reader);
                CV_READ_SEQ_ELEM(pt[3], reader);

                cvLine(cpy, pt[0], pt[2], CV_RGB(0, 0, 0), 1);
                cvLine(cpy, pt[1], pt[3], CV_RGB(255, 255, 0), 1);

                MyCvPoint myCvPoint( (pt[0].x + pt[2].x) /2, (pt[1].y + pt[2].y)/2, img->width, img->height);

                mat.AddMem(myCvPoint);

                cvPolyLine(cpy, &rect, &count, 1, 1, CV_RGB(0, 255, 255), 1, 8, 0);
        }
       // cvShowImage("After Modify", cpy);
        cvReleaseImage(&cpy);
}
开发者ID:corvofeng,项目名称:cube,代码行数:27,代码来源:Utils.cpp


示例18: operator

    virtual void operator()(const cv::BlockedRange& range) const
    {
#ifdef HAVE_TBB
        tbb::spin_mutex::scoped_lock lock;
#endif
        CvSeqReader reader;
        int begin = range.begin();
        int end = range.end();

        int weak_count = end - begin;
        CvDTree* tree;

        for (int i=0; i<k; ++i)
        {
            float tmp_sum = 0.0f;
            if ((weak[i]) && (weak_count))
            {
                cvStartReadSeq( weak[i], &reader );
                cvSetSeqReaderPos( &reader, begin );
                for (int j=0; j<weak_count; ++j)
                {
                    CV_READ_SEQ_ELEM( tree, reader );
                    tmp_sum += shrinkage*(float)(tree->predict(sample, missing)->value);
                }
            }
#ifdef HAVE_TBB
            lock.acquire(SumMutex);
            sum[i] += tmp_sum;
            lock.release();
#else
            sum[i] += tmp_sum;
#endif
        }
    } // Tree_predictor::operator()
开发者ID:Rocky030,项目名称:opencv,代码行数:34,代码来源:gbt.cpp


示例19: matchPoint

/*!

  \deprecated This method is deprecated, you should use
  matchPoint(std::list<float*> , std::list<int> )
  instead.

  Computes the SURF points given by their descriptor and laplacian and try to match
  them with the points in the reference list. Only the matched points
  are stored. The two lists must have the same number of element while they correspond
  the same unique list of point.

  \warning The list returned contains allocated data (2 int per element). Must be deleted to avoid memory leak.

  \param descriptorList : The list of the descriptor

  \param laplacianList  : The list of laplacian

  \return the list of the pair, the first element contains the index in the reference sequence and the second element contains the index in the list given in parameter.
*/
vp_deprecated vpList<int*>* vpKeyPointSurf::matchPoint(vpList<float*> descriptorList, vpList<int> laplacianList)
{
	vpList<int*>* pairPoints = new vpList<int*>;

	if(descriptorList.nb != laplacianList.nb){
		vpTRACE("Error, the two lists have different number of element");
		return pairPoints;
	}

  CvSeqReader reader;
  cvStartReadSeq( ref_descriptors, &reader );

  descriptorList.front();
  pairPoints->front();
  laplacianList.front();
  int indexList = 0;
  while(!descriptorList.outside()){
  	float* descriptor = descriptorList.value();

  	int nearest_neighbor = naiveNearestNeighbor( descriptor, laplacianList.value(), ref_keypoints, ref_descriptors);

		if(nearest_neighbor >= 0){
			int* tab;
			tab = new int[2];
			tab[0] = nearest_neighbor;
			tab[1] = indexList;
			pairPoints->addRight(tab);
		}
		indexList++;
		descriptorList.next();
		laplacianList.next();
  }

  return pairPoints;
}
开发者ID:ILoveFree2,项目名称:visp-deb,代码行数:54,代码来源:vpKeyPointSurf.cpp


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ cvSub函数代码示例发布时间:2022-05-30
下一篇:
C++ cvSplit函数代码示例发布时间: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