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


C++ CvBlobSeq::GetBlob方法代码示例

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


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

示例1: SetBlobHyp

 /* Set new parameters for specified (by index) blob hypothesis
  * (can be called several times for each hypothesis):
  */
 virtual void    SetBlobHyp(int BlobIndex, CvBlob* pBlob)
 {
     if(m_ClearHyp)
     {   /* Clear all hypotheses: */
         int b, bN = m_BlobList.GetBlobNum();
         for(b=0; b<bN; ++b)
         {
             DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(b);
             assert(pBT->pBlobHyp);
             pBT->pBlobHyp->Clear();
         }
         m_ClearHyp = 0;
     }
     {   /* Add hypothesis: */
         DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIndex);
         assert(pBT->pBlobHyp);
         pBT->pBlobHyp->AddBlob(pBlob);
     }
 };
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:22,代码来源:blobtrackingcc.cpp

示例2: UpdateBlob

    virtual void UpdateBlob(int BlobIndex, CvBlob* /*pBlob*/, IplImage* /*pImg*/, IplImage* pImgFG = NULL)
    {
        DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIndex);

        if(pImgFG==NULL || pBT==NULL) return;

        if(!pBT->Collision)
        {
        //pBT->AverFG = pBT->AverFG * (1-m_Alpha) + m_Alpha * CalcAverageMask(pBlob,pImgFG);
        }
    };
开发者ID:09beezahmad,项目名称:opencv,代码行数:11,代码来源:blobtrackingcc.cpp

示例3: SaveAll

    ~CvBlobTrackGenYML() {
        int i;
        SaveAll();

        for (i = m_TrackList.GetBlobNum(); i > 0; --i) {
            DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlob(i - 1);
            /* Delete sequence: */
            delete pTrack->pSeq;
            pTrack->pSeq = NULL;
        }   /* Check next track. */

    }   /* Destructor. */
开发者ID:353,项目名称:viewercv,代码行数:12,代码来源:blobtrackgenyml.cpp

示例4: GetConfidence

    virtual double  GetConfidence(int BlobIndex, CvBlob* pBlob, IplImage* /*pImg*/, IplImage* pImgFG = NULL)
    {
        /* Define coefficients in exp by exp(-XT*K)=VT: */
        static double _KS = -log(0.1)/pow(0.5,2); /* XT = 1, VT = 0.1 - when size is Larger in 2 times Confidence is smoller in 10 times */
        static double _KP = -log(0.1)/pow(m_pImg->width*0.02,2); /* XT = 0.02*ImgWidth, VT = 0.1*/
        DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIndex);
        float   dx,dy,dw,dh;
        float   dp2,ds2;
        double  W = 1;
        CvBlob* pBC = GetNearestBlob(pBlob);
        if(pBC == NULL ) return 0;

        dx = pBC->x-pBlob->x;
        dy = pBC->y-pBlob->y;
        dw = (pBC->w-pBlob->w)/pBC->w;
        dh = (pBC->h-pBlob->h)/pBC->h;

        dp2 = dx*dx+dy*dy;
        ds2 = dw*dw+dh*dh;

        if(!pBT->Collision)
        {   /* Confidence for size by nearest blob: */
            W*=exp(-_KS*ds2);
        }

        if(m_ConfidenceType==0 && !pBT->Collision)
        {   /* Confidence by nearest blob: */
            W*=exp(-_KP*dp2);
        }

        if(m_ConfidenceType==1 && pBT->AverFG>0)
        {   /* Calculate sum of mask: */
            float   Aver = CalcAverageMask(pBlob, pImgFG );
            if(Aver < pBT->AverFG)
            {
                float diff = 1+0.9f*(Aver-pBT->AverFG)/pBT->AverFG;
                if(diff < 0.1f) diff = 0.1f;
                W *= diff;
            }
        }   /* Calculate sum of mask. */

        if(m_ConfidenceType==2)
        {   /* Calculate BCoeff: */
            float   S = 0.2f;
            float   Aver = CalcAverageMask(pBlob, pImgFG );
            double B = sqrt(Aver*pBT->AverFG)+sqrt((1-Aver)*(1-pBT->AverFG));

            W *= exp((B-1)/(2*S));
        }   /* Calculate sum of mask. */

        return W;
    };
开发者ID:09beezahmad,项目名称:opencv,代码行数:52,代码来源:blobtrackingcc.cpp

示例5: AddBlob

    /* return pointer to new added blob */
    virtual CvBlob* AddBlob(CvBlob* pB, IplImage* /*pImg*/, IplImage* pImgFG = NULL )
    {
        assert(pImgFG); /* This tracker uses only foreground mask. */
        DefBlobTracker NewB;
        NewB.blob = pB[0];
//        CV_BLOB_ID(&NewB) = m_LastID;
        NewB.pBlobHyp = new CvBlobSeq;
        NewB.pPredictor = cvCreateModuleBlobTrackPredictKalman(); /* Module for position prediction. */
        NewB.pPredictor->Update(pB);
        NewB.AverFG = pImgFG?CalcAverageMask(pB,pImgFG):0;
        m_BlobList.AddBlob((CvBlob*)&NewB);
        return m_BlobList.GetBlob(m_BlobList.GetBlobNum()-1);
    };
开发者ID:09beezahmad,项目名称:opencv,代码行数:14,代码来源:blobtrackingcc.cpp

示例6: DelBlob

 virtual void    DelBlob(int BlobIndex)
 {
     DefBlobTracker* pBT = (DefBlobTracker*)m_BlobList.GetBlob(BlobIndex);
     if(pBT==NULL) return;
     if(pBT->pPredictor)
     {
         pBT->pPredictor->Release();
     }
     else
     {
         printf("WARNING!!! Invalid Predictor in CC tracker");
     }
     delete pBT->pBlobHyp;
     m_BlobList.DelBlob(BlobIndex);
 };
开发者ID:09beezahmad,项目名称:opencv,代码行数:15,代码来源:blobtrackingcc.cpp

示例7: ProcessBlob

	virtual void ProcessBlob(int BlobIndex, CvBlob* pBlob, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL)
	{/*输入是 已跟踪目标的index 和目标的团块
	 如果不考虑碰撞, 在新前景团块链表总 找最近的,更新
	 考虑碰撞: 团块位置= 预测值
	 */
		//pBlob 是 外界目标Id对应的团块  BlobIndex是他的INdex

		//pB是内部cc类 自己的目标团块
		//pBT是 内部团块的特殊表示
		int             ID = pBlob->ID;
		CvBlob*         pB = m_BlobList.GetBlob(BlobIndex);
		DefBlobTrackerColorTracker* pBT = (DefBlobTrackerColorTracker*)pB;
		//CvBlob*         pBBest = NULL;
		//double          DistBest = -1;
		int             BlobID;

		if (pB == NULL) return;

		BlobID = pB->ID;//看看ID 同不同?

		//对于考虑碰撞的,并且团块发生了碰撞 。 团块位置=团块的预测位置
		if (m_Collision && pBT->Collision)
		{   /* Tracking in collision: */
			pB[0] = pBT->BlobPredict;//将预测的值赋值到团块的位置
			CV_BLOB_ID(pB) = BlobID;
		}   /* Tracking in collision. */
		else
		{   /* Non-collision tracking: */
			CvBlob* pBBest = GetNearestBlob(pB);//用PB和新团块比较 ,获得最近的团块

			if (pBBest)
			{
				float   w = pBlob->w*(1 - m_AlphaSize) + m_AlphaSize*pBBest->w;
				float   h = pBlob->h*(1 - m_AlphaSize) + m_AlphaSize*pBBest->h;
				float   x = pBlob->x*(1 - m_AlphaPos) + m_AlphaPos*pBBest->x;
				float   y = pBlob->y*(1 - m_AlphaPos) + m_AlphaPos*pBBest->y;
				//按比例更新 目标团块的大小和位置
				pB->w = w;
				pB->h = h;
				pB->x = x;
				pB->y = y;
				CV_BLOB_ID(pB) = BlobID;
			}//这种最近邻匹配只能处理没有碰撞的目标跟踪
		}   /* Non-collision tracking. */

		pBlob[0] = pB[0];
		pBlob->ID = ID;
	};
开发者ID:xiawei0000,项目名称:indoorMonitorwithKinectV2,代码行数:48,代码来源:blobtrackingcolorTraker+-+副本.cpp

示例8: Process

    void    Process(IplImage* pImg = NULL, IplImage* /*pFG*/ = NULL) {
        int i;
        m_Size = cvSize(pImg->width, pImg->height);

        for (i = m_TrackList.GetBlobNum(); i > 0; --i) {
            DefBlobTrack* pTrack = (DefBlobTrack*)m_TrackList.GetBlob(i - 1);

            if (pTrack->FrameLast < m_Frame && !pTrack->Saved) {
                /* Save track: */
                SaveAll();
            }   /* Save track. */

        }   /* Check next track. */

        m_Frame++;
    }
开发者ID:353,项目名称:viewercv,代码行数:16,代码来源:blobtrackgenyml.cpp

示例9: DelBlob

	virtual void    DelBlob(int BlobIndex)
	{//删除,先得到指针,删除预测类,再删除自己
		//问题 一直将 DefBlobTracker *和CvBlob* 混用???
		DefBlobTrackerColorTracker* pBT = (DefBlobTrackerColorTracker*)m_BlobList.GetBlob(BlobIndex);
		if (pBT == NULL) return;
		if (pBT->pPredictor)
		{
			pBT->pPredictor->Release();
		}
		else
		{
			printf("WARNING!!! Invalid Predictor in CC tracker");
		}
		delete pBT->pBlobHyp;
		m_BlobList.DelBlob(BlobIndex);
	};
开发者ID:xiawei0000,项目名称:indoorMonitorwithKinectV2,代码行数:16,代码来源:blobtrackingcolorTraker+-+副本.cpp

示例10: AddBlob

 /* Return pointer to new added blob: */
 virtual CvBlob* AddBlob(CvBlob* pB, IplImage* pImg, IplImage* pImgFG = NULL )
 {
     DefBlobTrackerCR NewB;
     NewB.blob = pB[0];
     NewB.pBlobHyp = new CvBlobSeq;
     NewB.pPredictor = cvCreateModuleBlobTrackPredictKalman(); /* module for predict position */
     NewB.pPredictor->SetParam("DataNoisePos",0.001); 
     NewB.pPredictor->ParamUpdate(); 
     NewB.pResolver = NULL;
     if(m_CreateCR)
     {
         NewB.pResolver = m_CreateCR();
         TransferParamsToChild(NewB.pResolver,NULL);
         NewB.pResolver->Init(pB, pImg, pImgFG);
     }
     m_BlobList.AddBlob((CvBlob*)&NewB);
     return m_BlobList.GetBlob(m_BlobList.GetBlobNum()-1);
 };
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:19,代码来源:blobtrackingccwithcr.cpp

示例11: Process

 virtual void    Process(IplImage* pImg, IplImage* pFG)
 {
     int i;
     for(i=m_TrackAnalyserList.GetBlobNum(); i>0; --i)
     {
         DefTrackAnalyser* pF = (DefTrackAnalyser*)m_TrackAnalyserList.GetBlob(i-1);
         if(pF->m_LastFrame == m_Frame)
         {   /* Process: */
             int ID = CV_BLOB_ID(pF);
             pF->state = pF->pFilter->Process(&(pF->blob), pImg, pFG);
             CV_BLOB_ID(pF) = ID;
         }
         else
         {   /* Delete blob filter: */
             pF->pFilter->Release();
             m_TrackAnalyserList.DelBlob(i-1);
         }
     } /* Next blob. */
     m_Frame++;
 };
开发者ID:09beezahmad,项目名称:opencv,代码行数:20,代码来源:blobtrackanalysis.cpp

示例12: Process

    virtual void    Process()
    {
        int i;
        for(i=m_BlobFilterList.GetBlobNum(); i>0; --i)
        {
            DefBlobFilter* pF = (DefBlobFilter*)m_BlobFilterList.GetBlob(i-1);

            if(pF->m_LastFrame == m_Frame)
            {   /* Process: */
                int ID = CV_BLOB_ID(pF);
                pF->blob = *(pF->pFilter->Process(&(pF->blob)));
                CV_BLOB_ID(pF) = ID;
            }
            else
            {   /* Delete blob filter: */
                pF->pFilter->Release();
                m_BlobFilterList.DelBlob(i-1);
            }
        }   /* Next blob. */
        m_Frame++;
    };
开发者ID:colombc,项目名称:Sankore-ThirdParty,代码行数:21,代码来源:blobtrackpostproclist.cpp

示例13: ProcessBlob

    virtual void ProcessBlob(int BlobIndex, CvBlob* pBlob, IplImage* /*pImg*/, IplImage* /*pImgFG*/ = NULL)
    {
        int             ID = pBlob->ID;
        CvBlob*         pB = m_BlobList.GetBlob(BlobIndex);
        DefBlobTracker* pBT = (DefBlobTracker*)pB;
        //CvBlob*         pBBest = NULL;
        //double          DistBest = -1;
        int             BlobID;

        if(pB==NULL) return;

        BlobID = pB->ID;

        if(m_Collision && pBT->Collision)
        {   /* Tracking in collision: */
            pB[0]=pBT->BlobPredict;
            CV_BLOB_ID(pB)=BlobID;
        }   /* Tracking in collision. */
        else
        {   /* Non-collision tracking: */
            CvBlob* pBBest = GetNearestBlob(pB);
            if(pBBest)
            {
                float   w = pBlob->w*(1-m_AlphaSize)+m_AlphaSize*pBBest->w;
                float   h = pBlob->h*(1-m_AlphaSize)+m_AlphaSize*pBBest->h;
                float   x = pBlob->x*(1-m_AlphaPos)+m_AlphaPos*pBBest->x;
                float   y = pBlob->y*(1-m_AlphaPos)+m_AlphaPos*pBBest->y;
                pB->w = w;
                pB->h = h;
                pB->x = x;
                pB->y = y;
                CV_BLOB_ID(pB) = BlobID;
            }
        }   /* Non-collision tracking. */

        pBlob[0] = pB[0];
        pBlob->ID = ID;
    };
开发者ID:09beezahmad,项目名称:opencv,代码行数:38,代码来源:blobtrackingcc.cpp

示例14: SaveState

    virtual void SaveState(CvFileStorage* fs)
    {
        int     b,bN = m_BlobList.GetBlobNum();
        cvWriteInt(fs,"BlobNum",m_BlobList.GetBlobNum());
        cvStartWriteStruct(fs,"BlobList",CV_NODE_SEQ);

        for(b=0; b<bN; ++b)
        {
            DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(b);
            cvStartWriteStruct(fs,NULL,CV_NODE_MAP);
            cvWriteInt(fs,"ID",CV_BLOB_ID(pF));
            cvStartWriteStruct(fs,"Blob",CV_NODE_SEQ|CV_NODE_FLOW);
            cvWriteRawData(fs,&(pF->blob),1,"ffffi");
            cvEndWriteStruct(fs);
            cvStartWriteStruct(fs,"BlobPredict",CV_NODE_SEQ|CV_NODE_FLOW);
            cvWriteRawData(fs,&(pF->BlobPredict),1,"ffffi");
            cvEndWriteStruct(fs);
            cvStartWriteStruct(fs,"BlobPrev",CV_NODE_SEQ|CV_NODE_FLOW);
            cvWriteRawData(fs,&(pF->BlobPrev),1,"ffffi");
            cvEndWriteStruct(fs);
            pF->pBlobHyp->Write(fs,"BlobHyp");
            cvWriteInt(fs,"Collision",pF->Collision);
            
            cvStartWriteStruct(fs,"Predictor",CV_NODE_MAP);
            pF->pPredictor->SaveState(fs);
            cvEndWriteStruct(fs);
            
            cvStartWriteStruct(fs,"Resolver",CV_NODE_MAP);
            pF->pResolver->SaveState(fs);
            cvEndWriteStruct(fs);
            cvEndWriteStruct(fs);
        }

        cvEndWriteStruct(fs);

    }   /* SaveState. */
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:36,代码来源:blobtrackingccwithcr.cpp

示例15: GetBlob

 CvBlob* GetBlob(int index){return m_BlobFilterList.GetBlob(index);};
开发者ID:colombc,项目名称:Sankore-ThirdParty,代码行数:1,代码来源:blobtrackpostproclist.cpp


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