CvBlobTrackerCC():m_BlobList(sizeof(DefBlobTracker)) { // m_LastID = 0; m_ClearHyp = 0; m_pMem = cvCreateMemStorage(); m_Collision = 1; /* if 1 then collistion will be detected and processed */ AddParam("Collision",&m_Collision); CommentParam("Collision", "If 1 then collision cases are processed in special way"); m_AlphaSize = 0.02f; AddParam("AlphaSize",&m_AlphaSize); CommentParam("AlphaSize", "Size update speed (0..1)"); m_AlphaPos = 1.0f; AddParam("AlphaPos",&m_AlphaPos); CommentParam("AlphaPos", "Position update speed (0..1)"); m_Alpha = 0.001f; AddParam("Alpha", &m_Alpha); CommentParam("Alpha","Coefficient for model histogram updating (0 - hist is not updated)"); m_ConfidenceType=0; m_ConfidenceTypeStr = "NearestBlob"; AddParam("ConfidenceType", &m_ConfidenceTypeStr); CommentParam("ConfidenceType","Type of calculated Confidence (NearestBlob, AverFG, BC)"); SetModuleName("CC"); };
CvBlobTrackAnalysisTrackDist(): m_Tracks(sizeof(DefTrackForDist)), m_TrackDataBase(sizeof(DefTrackForDist)) { m_pDebugImg = 0; //m_pDebugAVI = 0; m_Frame = 0; m_pTempData = NULL; m_TempDataSize = 0; m_pDebugAVIName = NULL; AddParam("DebugAVI", &m_pDebugAVIName); CommentParam("DebugAVI", "Name of AVI file to save images from debug window"); m_TraceLen = 50; AddParam("TraceLen", &m_TraceLen); CommentParam("TraceLen", "Length (in frames) of trajectory part that is used for comparison"); m_AbnormalThreshold = 0.02f; AddParam("AbnormalThreshold", &m_AbnormalThreshold); CommentParam("AbnormalThreshold", "If trajectory is equal with less then <AbnormalThreshold*DataBaseTrackNum> tracks then trajectory is abnormal"); m_PosThreshold = 1.25; AddParam("PosThreshold", &m_PosThreshold); CommentParam("PosThreshold", "Minimal allowd distance in blob width that is allowed"); m_VelThreshold = 0.5; AddParam("VelThreshold", &m_VelThreshold); CommentParam("VelThreshold", "Minimal allowed relative difference between blob speed"); SetModuleName("TrackDist"); } /* Constructor. */
/* Constructor for BlobDetector: */ CvBlobDetectorCC::CvBlobDetectorCC() : #ifdef USE_OBJECT_DETECTOR m_split_detector(0), #endif m_detected_blob_seq(sizeof(CvDetectedBlob)), m_roi_seq(0), m_debug_blob_seq(sizeof(CvDetectedBlob)) { /*CvDrawShape shapes[] = { { CvDrawShape::RECT, {{255,255,255}} }, { CvDrawShape::RECT, {{0,0,255}} }, { CvDrawShape::ELLIPSE, {{0,255,0}} } }; int num_shapes = sizeof(shapes) / sizeof(shapes[0]);*/ int i = 0; SEQ_SIZE = 10; AddParam("Latency",&SEQ_SIZE); for(i=0;i<SEQ_SIZE_MAX;++i)m_pBlobLists[i] = NULL; for(i=0;i<SEQ_NUM;++i)m_TrackSeq[i].size = 0; m_TrackNum = 0; m_HMin = 0.02f; m_WMin = 0.01f; AddParam("HMin",&m_HMin); AddParam("WMin",&m_WMin); m_MinDistToBorder = 1.1f; AddParam("MinDistToBorder",&m_MinDistToBorder); CommentParam("MinDistToBorder","Minimal allowed distance from blob center to image border in blob sizes"); m_Clastering=1; AddParam("Clastering",&m_Clastering); CommentParam("Clastering","Minimal allowed distance from blob center to image border in blob sizes"); m_param_split_detector_file_name = 0; #ifdef USE_OBJECT_DETECTOR AddParam("Detector", &m_param_split_detector_file_name); CommentParam("Detector", "Detector file name"); #endif m_param_roi_scale = 1.5F; AddParam("ROIScale", &m_param_roi_scale); CommentParam("ROIScale", "Determines the size of search window around a blob"); m_param_only_roi = 1; AddParam("OnlyROI", &m_param_only_roi); CommentParam("OnlyROI", "Shows the whole debug image (0) or only ROIs where the detector was applied (1)"); m_min_window_size = cvSize(0,0); m_max_border = 0; m_roi_seq = cvCreateSeq( 0, sizeof(*m_roi_seq), sizeof(CvRect), cvCreateMemStorage() ); SetModuleName("CC"); }
CvBlobTrackerColorTracker() :m_BlobList(sizeof(DefBlobTrackerColorTracker)) { m_pMem = cvCreateMemStorage(); m_Collision = 1; /* if 1 then collistion will be detected and processed */ AddParam("Collision", &m_Collision); CommentParam("Collision", "If 1 then collision cases are processed in special way"); };
void CvVSModule::TransferParamsFromChild(CvVSModule* pM, const char* prefix) { char tmp[1024]; const char* FN = NULL; int i; for(i=0;;++i) { const char* N = pM->GetParamName(i); if(N == NULL) break; FN = N; if(prefix) { strcpy(tmp,prefix); strcat(tmp,"_"); FN = strcat(tmp,N); } if(!IsParam(FN)) { if(pM->GetParamStr(N)) { AddParam(FN,(const char**)NULL); } else { AddParam(FN); } } if(pM->GetParamStr(N)) { const char* val = pM->GetParamStr(N); SetParamStr(FN,val); } else { double val = pM->GetParam(N); SetParam(FN,val); } CommentParam(FN, pM->GetParamComment(N)); }/* transfer next param */ }/* Transfer params */
CvBlobTrackerCCCR(CvBlobTrackerOne* (*CreateCR)(), char* CRName):m_BlobList(sizeof(DefBlobTrackerCR)) { m_CreateCR = CreateCR; m_pMem = cvCreateMemStorage(); m_Collision = 1; /* if 1 then collistion will be detected and processed */ m_AlphaSize = 0.05f; AddParam("AlphaSize",&m_AlphaSize); CommentParam("AlphaSize", "Size update speed (0..1)"); strcpy(m_ModuleName, "CC"); if(CRName)strcat(m_ModuleName,CRName); SetModuleName(m_ModuleName); { CvBlobTrackerOne* pM = m_CreateCR(); TransferParamsFromChild(pM,NULL); pM->Release(); } SetParam("SizeVar",0); };