00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef __OPENCV_VIDEOSURVEILLANCE_H__
00044 #define __OPENCV_VIDEOSURVEILLANCE_H__
00045
00046
00047
00048
00049 #include "opencv2/core/core_c.h"
00050 #include <stdio.h>
00051
00052 #if _MSC_VER >= 1200 || defined __BORLANDC__
00053 #define cv_stricmp stricmp
00054 #define cv_strnicmp strnicmp
00055 #if defined WINCE
00056 #define strdup _strdup
00057 #define stricmp _stricmp
00058 #endif
00059 #elif defined __GNUC__
00060 #define cv_stricmp strcasecmp
00061 #define cv_strnicmp strncasecmp
00062 #else
00063 #error Do not know how to make case-insensitive string comparison on this platform
00064 #endif
00065
00066
00067 struct CvDefParam
00068 {
00069 struct CvDefParam* next;
00070 char* pName;
00071 char* pComment;
00072 double* pDouble;
00073 double Double;
00074 float* pFloat;
00075 float Float;
00076 int* pInt;
00077 int Int;
00078 char** pStr;
00079 char* Str;
00080 };
00081
00082 class CV_EXPORTS CvVSModule
00083 {
00084 private:
00085 CvDefParam* m_pParamList;
00086 char* m_pModuleTypeName;
00087 char* m_pModuleName;
00088 char* m_pNickName;
00089 protected:
00090 int m_Wnd;
00091 public:
00092 CvVSModule();
00093 virtual ~CvVSModule();
00094 private:
00095 void FreeParam(CvDefParam** pp);
00096 CvDefParam* NewParam(const char* name);
00097 CvDefParam* GetParamPtr(int index);
00098 CvDefParam* GetParamPtr(const char* name);
00099 protected:
00100 int IsParam(const char* name);
00101 void AddParam(const char* name, double* pAddr);
00102 void AddParam(const char* name, float* pAddr);
00103 void AddParam(const char* name, int* pAddr);
00104 void AddParam(const char* name, const char** pAddr);
00105 void AddParam(const char* name);
00106 void CommentParam(const char* name, const char* pComment);
00107 void SetTypeName(const char* name);
00108 void SetModuleName(const char* name);
00109 void DelParam(const char* name);
00110
00111 public:
00112 const char* GetParamName(int index);
00113 const char* GetParamComment(const char* name);
00114 double GetParam(const char* name);
00115 const char* GetParamStr(const char* name);
00116 void SetParam(const char* name, double val);
00117 void SetParamStr(const char* name, const char* str);
00118 void TransferParamsFromChild(CvVSModule* pM, const char* prefix = NULL);
00119 void TransferParamsToChild(CvVSModule* pM, char* prefix = NULL);
00120 virtual void ParamUpdate();
00121 const char* GetTypeName();
00122 int IsModuleTypeName(const char* name);
00123 char* GetModuleName();
00124 int IsModuleName(const char* name);
00125 void SetNickName(const char* pStr);
00126 const char* GetNickName();
00127 virtual void SaveState(CvFileStorage*);
00128 virtual void LoadState(CvFileStorage*, CvFileNode*);
00129
00130 virtual void Release() = 0;
00131 };
00132
00133 CV_EXPORTS void cvWriteStruct(CvFileStorage* fs, const char* name, void* addr, const char* desc, int num=1);
00134 CV_EXPORTS void cvReadStructByName(CvFileStorage* fs, CvFileNode* node, const char* name, void* addr, const char* desc);
00135
00136
00137 class CV_EXPORTS CvFGDetector : public CvVSModule
00138 {
00139 public:
00140 CvFGDetector();
00141 virtual IplImage* GetMask() = 0;
00142
00143 virtual void Process(IplImage* pImg) = 0;
00144
00145 virtual void Release() = 0;
00146 };
00147
00148 CV_EXPORTS void cvReleaseFGDetector(CvFGDetector** ppT );
00149 CV_EXPORTS CvFGDetector* cvCreateFGDetectorBase(int type, void *param);
00150
00151
00152
00153 struct CvBlob
00154 {
00155 float x,y;
00156 float w,h;
00157 int ID;
00158 };
00159
00160 inline CvBlob cvBlob(float x,float y, float w, float h)
00161 {
00162 CvBlob B = {x,y,w,h,0};
00163 return B;
00164 }
00165 #define CV_BLOB_MINW 5
00166 #define CV_BLOB_MINH 5
00167 #define CV_BLOB_ID(pB) (((CvBlob*)(pB))->ID)
00168 #define CV_BLOB_CENTER(pB) cvPoint2D32f(((CvBlob*)(pB))->x,((CvBlob*)(pB))->y)
00169 #define CV_BLOB_X(pB) (((CvBlob*)(pB))->x)
00170 #define CV_BLOB_Y(pB) (((CvBlob*)(pB))->y)
00171 #define CV_BLOB_WX(pB) (((CvBlob*)(pB))->w)
00172 #define CV_BLOB_WY(pB) (((CvBlob*)(pB))->h)
00173 #define CV_BLOB_RX(pB) (0.5f*CV_BLOB_WX(pB))
00174 #define CV_BLOB_RY(pB) (0.5f*CV_BLOB_WY(pB))
00175 #define CV_BLOB_RECT(pB) cvRect(cvRound(((CvBlob*)(pB))->x-CV_BLOB_RX(pB)),cvRound(((CvBlob*)(pB))->y-CV_BLOB_RY(pB)),cvRound(CV_BLOB_WX(pB)),cvRound(CV_BLOB_WY(pB)))
00176
00177
00178
00179
00180 class CV_EXPORTS CvBlobSeq
00181 {
00182 public:
00183 CvBlobSeq(int BlobSize = sizeof(CvBlob))
00184 {
00185 m_pMem = cvCreateMemStorage();
00186 m_pSeq = cvCreateSeq(0,sizeof(CvSeq),BlobSize,m_pMem);
00187 strcpy(m_pElemFormat,"ffffi");
00188 }
00189 virtual ~CvBlobSeq()
00190 {
00191 cvReleaseMemStorage(&m_pMem);
00192 };
00193 virtual CvBlob* GetBlob(int BlobIndex)
00194 {
00195 return (CvBlob*)cvGetSeqElem(m_pSeq,BlobIndex);
00196 };
00197 virtual CvBlob* GetBlobByID(int BlobID)
00198 {
00199 int i;
00200 for(i=0; i<m_pSeq->total; ++i)
00201 if(BlobID == CV_BLOB_ID(GetBlob(i)))
00202 return GetBlob(i);
00203 return NULL;
00204 };
00205 virtual void DelBlob(int BlobIndex)
00206 {
00207 cvSeqRemove(m_pSeq,BlobIndex);
00208 };
00209 virtual void DelBlobByID(int BlobID)
00210 {
00211 int i;
00212 for(i=0; i<m_pSeq->total; ++i)
00213 {
00214 if(BlobID == CV_BLOB_ID(GetBlob(i)))
00215 {
00216 DelBlob(i);
00217 return;
00218 }
00219 }
00220 };
00221 virtual void Clear()
00222 {
00223 cvClearSeq(m_pSeq);
00224 };
00225 virtual void AddBlob(CvBlob* pB)
00226 {
00227 cvSeqPush(m_pSeq,pB);
00228 };
00229 virtual int GetBlobNum()
00230 {
00231 return m_pSeq->total;
00232 };
00233 virtual void Write(CvFileStorage* fs, const char* name)
00234 {
00235 const char* attr[] = {"dt",m_pElemFormat,NULL};
00236 if(fs)
00237 {
00238 cvWrite(fs,name,m_pSeq,cvAttrList(attr,NULL));
00239 }
00240 }
00241 virtual void Load(CvFileStorage* fs, CvFileNode* node)
00242 {
00243 if(fs==NULL) return;
00244 CvSeq* pSeq = (CvSeq*)cvRead(fs, node);
00245 if(pSeq)
00246 {
00247 int i;
00248 cvClearSeq(m_pSeq);
00249 for(i=0;i<pSeq->total;++i)
00250 {
00251 void* pB = cvGetSeqElem( pSeq, i );
00252 cvSeqPush( m_pSeq, pB );
00253 }
00254 }
00255 }
00256 void AddFormat(const char* str){strcat(m_pElemFormat,str);}
00257 protected:
00258 CvMemStorage* m_pMem;
00259 CvSeq* m_pSeq;
00260 char m_pElemFormat[1024];
00261 };
00262
00263
00264
00265
00266 struct CvBlobTrack
00267 {
00268 int TrackID;
00269 int StartFrame;
00270 CvBlobSeq* pBlobSeq;
00271 };
00272
00273 class CV_EXPORTS CvBlobTrackSeq
00274 {
00275 public:
00276 CvBlobTrackSeq(int TrackSize = sizeof(CvBlobTrack));
00277 virtual ~CvBlobTrackSeq();
00278 virtual CvBlobTrack* GetBlobTrack(int TrackIndex);
00279 virtual CvBlobTrack* GetBlobTrackByID(int TrackID);
00280 virtual void DelBlobTrack(int TrackIndex);
00281 virtual void DelBlobTrackByID(int TrackID);
00282 virtual void Clear();
00283 virtual void AddBlobTrack(int TrackID, int StartFrame = 0);
00284 virtual int GetBlobTrackNum();
00285 protected:
00286 CvMemStorage* m_pMem;
00287 CvSeq* m_pSeq;
00288 };
00289
00290
00291
00292
00293
00294 class CV_EXPORTS CvBlobDetector: public CvVSModule
00295 {
00296 public:
00297 CvBlobDetector(){SetTypeName("BlobDetector");};
00298
00299
00300
00301
00302 virtual int DetectNewBlob(IplImage* pImg, IplImage* pImgFG, CvBlobSeq* pNewBlobList, CvBlobSeq* pOldBlobList) = 0;
00303
00304 virtual void Release()=0;
00305 };
00306
00307
00308 CV_EXPORTS void cvReleaseBlobDetector(CvBlobDetector** ppBD);
00309
00310
00311 CV_EXPORTS CvBlobDetector* cvCreateBlobDetectorSimple();
00312 CV_EXPORTS CvBlobDetector* cvCreateBlobDetectorCC();
00313
00314 struct CV_EXPORTS CvDetectedBlob : public CvBlob
00315 {
00316 float response;
00317 };
00318
00319 CV_INLINE CvDetectedBlob cvDetectedBlob( float x, float y, float w, float h, int ID = 0, float response = 0.0F )
00320 {
00321 CvDetectedBlob b;
00322 b.x = x; b.y = y; b.w = w; b.h = h; b.ID = ID; b.response = response;
00323 return b;
00324 }
00325
00326
00327 class CV_EXPORTS CvObjectDetector
00328 {
00329 public:
00330 CvObjectDetector( const char* = 0 );
00331 ~CvObjectDetector();
00332
00333
00334
00335
00336
00337
00338 bool Load( const char* = 0 );
00339
00340
00341 CvSize GetMinWindowSize() const;
00342
00343
00344 int GetMaxBorderSize() const;
00345
00346
00347
00348
00349
00350 void Detect( const CvArr* , CvBlobSeq* = 0 );
00351
00352 protected:
00353 class CvObjectDetectorImpl* impl;
00354 };
00355
00356
00357 CV_INLINE CvRect cvRectIntersection( const CvRect r1, const CvRect r2 )
00358 {
00359 CvRect r = cvRect( MAX(r1.x, r2.x), MAX(r1.y, r2.y), 0, 0 );
00360
00361 r.width = MIN(r1.x + r1.width, r2.x + r2.width) - r.x;
00362 r.height = MIN(r1.y + r1.height, r2.y + r2.height) - r.y;
00363
00364 return r;
00365 }
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 struct CvDrawShape
00376 {
00377 enum {RECT, ELLIPSE} shape;
00378 CvScalar color;
00379 };
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391 class CV_EXPORTS CvImageDrawer
00392 {
00393 public:
00394 CvImageDrawer() : m_image(0) {}
00395 ~CvImageDrawer() { cvReleaseImage( &m_image ); }
00396 void SetShapes( const CvDrawShape* shapes, int num );
00397
00398 IplImage* Draw( const CvArr* src, CvBlobSeq* blob_seq = 0, const CvSeq* roi_seq = 0 );
00399 IplImage* GetImage() { return m_image; }
00400 protected:
00401
00402
00403 IplImage* m_image;
00404 CvDrawShape m_shape[16];
00405 };
00406
00407
00408
00409
00410 class CV_EXPORTS CvBlobTrackGen: public CvVSModule
00411 {
00412 public:
00413 CvBlobTrackGen(){SetTypeName("BlobTrackGen");};
00414 virtual void SetFileName(char* pFileName) = 0;
00415 virtual void AddBlob(CvBlob* pBlob) = 0;
00416 virtual void Process(IplImage* pImg = NULL, IplImage* pFG = NULL) = 0;
00417 virtual void Release() = 0;
00418 };
00419
00420 inline void cvReleaseBlobTrackGen(CvBlobTrackGen** pBTGen)
00421 {
00422 if(*pBTGen)(*pBTGen)->Release();
00423 *pBTGen = 0;
00424 }
00425
00426
00427 CV_EXPORTS CvBlobTrackGen* cvCreateModuleBlobTrackGen1();
00428 CV_EXPORTS CvBlobTrackGen* cvCreateModuleBlobTrackGenYML();
00429
00430
00431
00432
00433 class CV_EXPORTS CvBlobTracker: public CvVSModule
00434 {
00435 public:
00436 CvBlobTracker();
00437
00438
00439
00440
00441
00442
00443 virtual CvBlob* AddBlob(CvBlob* pBlob, IplImage* pImg, IplImage* pImgFG = NULL ) = 0;
00444
00445
00446 virtual int GetBlobNum() = 0;
00447
00448
00449 virtual CvBlob* GetBlob(int BlobIndex) = 0;
00450
00451
00452 virtual void DelBlob(int BlobIndex) = 0;
00453
00454
00455 virtual void Process(IplImage* pImg, IplImage* pImgFG = NULL) = 0;
00456
00457
00458 virtual void Release() = 0;
00459
00460
00461
00462 virtual void ProcessBlob(int BlobIndex, CvBlob* pBlob, IplImage* , IplImage* = NULL);
00463
00464
00465 virtual double GetConfidence(int , CvBlob* , IplImage* , IplImage* = NULL);
00466
00467 virtual double GetConfidenceList(CvBlobSeq* pBlobList, IplImage* pImg, IplImage* pImgFG = NULL);
00468
00469 virtual void UpdateBlob(int , CvBlob* , IplImage* , IplImage* = NULL);
00470
00471
00472 virtual void Update(IplImage* pImg, IplImage* pImgFG = NULL);
00473
00474
00475 virtual int GetBlobIndexByID(int BlobID);
00476
00477
00478 virtual CvBlob* GetBlobByID(int BlobID);
00479
00480
00481 virtual void DelBlobByID(int BlobID);
00482
00483
00484 virtual void SetBlob(int , CvBlob* );
00485
00486
00487 virtual void SetBlobByID(int BlobID, CvBlob* pBlob);
00488
00489
00490
00491
00492 virtual int GetBlobHypNum(int );
00493
00494
00495 virtual CvBlob* GetBlobHyp(int BlobIndex, int );
00496
00497
00498
00499
00500 virtual void SetBlobHyp(int , CvBlob* );
00501 };
00502
00503 CV_EXPORTS void cvReleaseBlobTracker(CvBlobTracker**ppT );
00504
00505
00506
00507 class CV_EXPORTS CvBlobTrackerOne : public CvVSModule
00508 {
00509 public:
00510 virtual void Init(CvBlob* pBlobInit, IplImage* pImg, IplImage* pImgFG = NULL) = 0;
00511 virtual CvBlob* Process(CvBlob* pBlobPrev, IplImage* pImg, IplImage* pImgFG = NULL) = 0;
00512 virtual void Release() = 0;
00513
00514
00515 virtual void SkipProcess(CvBlob* , IplImage* , IplImage* = NULL){};
00516 virtual void Update(CvBlob* , IplImage* , IplImage* = NULL){};
00517 virtual void SetCollision(int ){};
00518 virtual double GetConfidence(CvBlob* , IplImage* ,
00519 IplImage* = NULL, IplImage* = NULL)
00520 {
00521 return 1;
00522 };
00523 };
00524 inline void cvReleaseBlobTrackerOne(CvBlobTrackerOne **ppT )
00525 {
00526 ppT[0]->Release();
00527 ppT[0] = 0;
00528 }
00529 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerList(CvBlobTrackerOne* (*create)());
00530
00531
00532
00533
00534
00535 #define PROFILE_EPANECHNIKOV 0
00536 #define PROFILE_DOG 1
00537 struct CvBlobTrackerParamMS
00538 {
00539 int noOfSigBits;
00540 int appearance_profile;
00541 int meanshift_profile;
00542 float sigma;
00543 };
00544
00545 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS1(CvBlobTrackerParamMS* param);
00546 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS2(CvBlobTrackerParamMS* param);
00547 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS1ByList();
00548
00549
00550 struct CvBlobTrackerParamLH
00551 {
00552 int HistType;
00553 int ScaleAfter;
00554 };
00555
00556
00557 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerLHR(CvBlobTrackerParamLH* = NULL);
00558
00559
00560 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerLHRS(CvBlobTrackerParamLH* = NULL);
00561
00562
00563 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerCC();
00564
00565
00566 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerCCMSPF();
00567
00568
00569 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMSFG();
00570 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMSFGS();
00571
00572
00573 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMS();
00574
00575
00576
00577
00578
00579
00580 CV_EXPORTS CvBlobTracker* cvCreateBlobTrackerMSPF();
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 class CV_EXPORTS CvBlobTrackPostProc: public CvVSModule
00598 {
00599 public:
00600 CvBlobTrackPostProc(){SetTypeName("BlobTrackPostProc");};
00601 virtual void AddBlob(CvBlob* pBlob) = 0;
00602 virtual void Process() = 0;
00603 virtual int GetBlobNum() = 0;
00604 virtual CvBlob* GetBlob(int index) = 0;
00605 virtual void Release() = 0;
00606
00607
00608 virtual CvBlob* GetBlobByID(int BlobID)
00609 {
00610 int i;
00611 for(i=GetBlobNum();i>0;i--)
00612 {
00613 CvBlob* pB=GetBlob(i-1);
00614 if(pB->ID==BlobID) return pB;
00615 }
00616 return NULL;
00617 };
00618 };
00619
00620 inline void cvReleaseBlobTrackPostProc(CvBlobTrackPostProc** pBTPP)
00621 {
00622 if(pBTPP == NULL) return;
00623 if(*pBTPP)(*pBTPP)->Release();
00624 *pBTPP = 0;
00625 }
00626
00627
00628 class CV_EXPORTS CvBlobTrackPostProcOne: public CvVSModule
00629 {
00630 public:
00631 CvBlobTrackPostProcOne(){SetTypeName("BlobTrackPostOne");};
00632 virtual CvBlob* Process(CvBlob* pBlob) = 0;
00633 virtual void Release() = 0;
00634 };
00635
00636
00637 CV_EXPORTS CvBlobTrackPostProc* cvCreateBlobTrackPostProcList(CvBlobTrackPostProcOne* (*create)());
00638
00639
00640
00641 CV_EXPORTS CvBlobTrackPostProc* cvCreateModuleBlobTrackPostProcKalman();
00642 CV_EXPORTS CvBlobTrackPostProc* cvCreateModuleBlobTrackPostProcTimeAverRect();
00643 CV_EXPORTS CvBlobTrackPostProc* cvCreateModuleBlobTrackPostProcTimeAverExp();
00644
00645
00646
00647
00648 class CvBlobTrackPredictor: public CvVSModule
00649 {
00650 public:
00651 CvBlobTrackPredictor(){SetTypeName("BlobTrackPredictor");};
00652 virtual CvBlob* Predict() = 0;
00653 virtual void Update(CvBlob* pBlob) = 0;
00654 virtual void Release() = 0;
00655 };
00656 CV_EXPORTS CvBlobTrackPredictor* cvCreateModuleBlobTrackPredictKalman();
00657
00658
00659
00660
00661 class CV_EXPORTS CvBlobTrackAnalysis: public CvVSModule
00662 {
00663 public:
00664 CvBlobTrackAnalysis(){SetTypeName("BlobTrackAnalysis");};
00665 virtual void AddBlob(CvBlob* pBlob) = 0;
00666 virtual void Process(IplImage* pImg, IplImage* pFG) = 0;
00667 virtual float GetState(int BlobID) = 0;
00668
00669
00670 virtual const char* GetStateDesc(int ){return NULL;};
00671 virtual void SetFileName(char* ){};
00672 virtual void Release() = 0;
00673 };
00674
00675
00676 inline void cvReleaseBlobTrackAnalysis(CvBlobTrackAnalysis** pBTPP)
00677 {
00678 if(pBTPP == NULL) return;
00679 if(*pBTPP)(*pBTPP)->Release();
00680 *pBTPP = 0;
00681 }
00682
00683
00684 class CV_EXPORTS CvBlobTrackFVGen : public CvVSModule
00685 {
00686 public:
00687 CvBlobTrackFVGen(){SetTypeName("BlobTrackFVGen");};
00688 virtual void AddBlob(CvBlob* pBlob) = 0;
00689 virtual void Process(IplImage* pImg, IplImage* pFG) = 0;
00690 virtual void Release() = 0;
00691 virtual int GetFVSize() = 0;
00692 virtual int GetFVNum() = 0;
00693 virtual float* GetFV(int index, int* pFVID) = 0;
00694 virtual float* GetFVVar(){return NULL;};
00695 virtual float* GetFVMin() = 0;
00696 virtual float* GetFVMax() = 0;
00697 };
00698
00699
00700
00701 class CV_EXPORTS CvBlobTrackAnalysisOne
00702 {
00703 public:
00704 virtual ~CvBlobTrackAnalysisOne() {};
00705 virtual int Process(CvBlob* pBlob, IplImage* pImg, IplImage* pFG) = 0;
00706
00707
00708 virtual void Release() = 0;
00709 };
00710
00711
00712 CV_EXPORTS CvBlobTrackAnalysis* cvCreateBlobTrackAnalysisList(CvBlobTrackAnalysisOne* (*create)());
00713
00714
00715
00716
00717 CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistP();
00718
00719
00720 CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistPV();
00721
00722
00723 CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistPVS();
00724
00725
00726 CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisHistSS();
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743 CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisTrackDist();
00744
00745
00746
00747
00748
00749 CV_EXPORTS CvBlobTrackAnalysis* cvCreateModuleBlobTrackAnalysisIOR();
00750
00751
00752 class CV_EXPORTS CvBlobTrackAnalysisHeight: public CvBlobTrackAnalysis
00753 {
00754 public:
00755 virtual double GetHeight(CvBlob* pB) = 0;
00756 };
00757
00758
00759
00760
00761
00762 class CV_EXPORTS CvBlobTrackerAuto: public CvVSModule
00763 {
00764 public:
00765 CvBlobTrackerAuto(){SetTypeName("BlobTrackerAuto");};
00766 virtual void Process(IplImage* pImg, IplImage* pMask = NULL) = 0;
00767 virtual CvBlob* GetBlob(int index) = 0;
00768 virtual CvBlob* GetBlobByID(int ID) = 0;
00769 virtual int GetBlobNum() = 0;
00770 virtual IplImage* GetFGMask(){return NULL;};
00771 virtual float GetState(int BlobID) = 0;
00772 virtual const char* GetStateDesc(int BlobID) = 0;
00773
00774
00775 virtual void Release() = 0;
00776 };
00777 inline void cvReleaseBlobTrackerAuto(CvBlobTrackerAuto** ppT)
00778 {
00779 ppT[0]->Release();
00780 ppT[0] = 0;
00781 }
00782
00783
00784
00785
00786
00787
00788 struct CvBlobTrackerAutoParam1
00789 {
00790 int FGTrainFrames;
00791
00792 CvFGDetector* pFG;
00793
00794 CvBlobDetector* pBD;
00795
00796
00797 CvBlobTracker* pBT;
00798
00799
00800 CvBlobTrackGen* pBTGen;
00801
00802
00803 CvBlobTrackPostProc* pBTPP;
00804
00805
00806 int UsePPData;
00807
00808 CvBlobTrackAnalysis* pBTA;
00809
00810 };
00811
00812
00813 CV_EXPORTS CvBlobTrackerAuto* cvCreateBlobTrackerAuto1(CvBlobTrackerAutoParam1* param = NULL);
00814
00815
00816 inline CvBlobTrackerAuto* cvCreateBlobTrackerAuto(int type, void* param)
00817 {
00818 if(type == 0) return cvCreateBlobTrackerAuto1((CvBlobTrackerAutoParam1*)param);
00819 return 0;
00820 }
00821
00822
00823
00824 struct CvTracksTimePos
00825 {
00826 int len1,len2;
00827 int beg1,beg2;
00828 int end1,end2;
00829 int comLen;
00830 int shift1,shift2;
00831 };
00832
00833
00834
00835
00836
00837
00838
00839
00840 CV_EXPORTS void cvCreateTracks_One(CvBlobTrackSeq *TS);
00841 CV_EXPORTS void cvCreateTracks_Same(CvBlobTrackSeq *TS1, CvBlobTrackSeq *TS2);
00842 CV_EXPORTS void cvCreateTracks_AreaErr(CvBlobTrackSeq *TS1, CvBlobTrackSeq *TS2, int addW, int addH);
00843
00844
00845
00846 class CV_EXPORTS CvProb
00847 {
00848 public:
00849 virtual ~CvProb() {};
00850
00851
00852 virtual double Value(int* , int = 0, int = 0){return -1;};
00853
00854
00855
00856
00857 virtual void AddFeature(float W, int* comps, int x =0, int y = 0) = 0;
00858 virtual void Scale(float factor = 0, int x = -1, int y = -1) = 0;
00859 virtual void Release() = 0;
00860 };
00861 inline void cvReleaseProb(CvProb** ppProb){ppProb[0]->Release();ppProb[0]=NULL;}
00862
00863
00864
00865 CV_EXPORTS CvProb* cvCreateProbS(int dim, CvSize size, int sample_num);
00866 CV_EXPORTS CvProb* cvCreateProbMG(int dim, CvSize size, int sample_num);
00867 CV_EXPORTS CvProb* cvCreateProbMG2(int dim, CvSize size, int sample_num);
00868 CV_EXPORTS CvProb* cvCreateProbHist(int dim, CvSize size);
00869
00870 #define CV_BT_HIST_TYPE_S 0
00871 #define CV_BT_HIST_TYPE_MG 1
00872 #define CV_BT_HIST_TYPE_MG2 2
00873 #define CV_BT_HIST_TYPE_H 3
00874 inline CvProb* cvCreateProb(int type, int dim, CvSize size = cvSize(1,1), void* = NULL)
00875 {
00876 if(type == CV_BT_HIST_TYPE_S) return cvCreateProbS(dim, size, -1);
00877 if(type == CV_BT_HIST_TYPE_MG) return cvCreateProbMG(dim, size, -1);
00878 if(type == CV_BT_HIST_TYPE_MG2) return cvCreateProbMG2(dim, size, -1);
00879 if(type == CV_BT_HIST_TYPE_H) return cvCreateProbHist(dim, size);
00880 return NULL;
00881 }
00882
00883
00884
00885
00886 #define CV_NOISE_NONE 0
00887 #define CV_NOISE_GAUSSIAN 1
00888 #define CV_NOISE_UNIFORM 2
00889 #define CV_NOISE_SPECKLE 3
00890 #define CV_NOISE_SALT_AND_PEPPER 4
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905 typedef void CvTestSeq;
00906
00907
00908
00909
00910 CV_EXPORTS CvTestSeq* cvCreateTestSeq(char* pConfigfile, char** videos, int numvideo, float Scale = 1, int noise_type = CV_NOISE_NONE, double noise_ampl = 0);
00911 CV_EXPORTS void cvReleaseTestSeq(CvTestSeq** ppTestSeq);
00912
00913
00914 CV_EXPORTS IplImage* cvTestSeqQueryFrame(CvTestSeq* pTestSeq);
00915
00916
00917 CV_EXPORTS IplImage* cvTestSeqGetFGMask(CvTestSeq* pTestSeq);
00918
00919
00920 CV_EXPORTS IplImage* cvTestSeqGetImage(CvTestSeq* pTestSeq);
00921
00922
00923 CV_EXPORTS CvSize cvTestSeqGetImageSize(CvTestSeq* pTestSeq);
00924
00925
00926 CV_EXPORTS int cvTestSeqFrameNum(CvTestSeq* pTestSeq);
00927
00928
00929
00930
00931
00932 CV_EXPORTS int cvTestSeqGetObjectNum(CvTestSeq* pTestSeq);
00933
00934
00935
00936 CV_EXPORTS int cvTestSeqGetObjectPos(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pPos);
00937 CV_EXPORTS int cvTestSeqGetObjectSize(CvTestSeq* pTestSeq, int ObjIndex, CvPoint2D32f* pSize);
00938
00939
00940 CV_EXPORTS void cvTestSeqAddNoise(CvTestSeq* pTestSeq, int noise_type = CV_NOISE_NONE, double noise_ampl = 0);
00941
00942
00943 CV_EXPORTS void cvTestSeqAddIntensityVariation(CvTestSeq* pTestSeq, float DI_per_frame, float MinI, float MaxI);
00944 CV_EXPORTS void cvTestSeqSetFrame(CvTestSeq* pTestSeq, int n);
00945
00946 #endif
00947
00948