1 /*M///////////////////////////////////////////////////////////////////////////////////////
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
10 // Intel License Agreement
12 // Copyright (C) 2000, Intel Corporation, all rights reserved.
13 // Third party copyrights are property of their respective owners.
15 // Redistribution and use in source and binary forms, with or without modification,
16 // are permitted provided that the following conditions are met:
18 // * Redistribution's of source code must retain the above copyright notice,
19 // this list of conditions and the following disclaimer.
21 // * Redistribution's in binary form must reproduce the above copyright notice,
22 // this list of conditions and the following disclaimer in the documentation
23 // and/or other materials provided with the distribution.
25 // * The name of Intel Corporation may not be used to endorse or promote products
26 // derived from this software without specific prior written permission.
28 // This software is provided by the copyright holders and contributors "as is" and
29 // any express or implied warranties, including, but not limited to, the implied
30 // warranties of merchantability and fitness for a particular purpose are disclaimed.
31 // In no event shall the Intel Corporation or contributors be liable for any direct,
32 // indirect, incidental, special, exemplary, or consequential damages
33 // (including, but not limited to, procurement of substitute goods or services;
34 // loss of use, data, or profits; or business interruption) however caused
35 // and on any theory of liability, whether in contract, strict liability,
36 // or tort (including negligence or otherwise) arising in any way out of
37 // the use of this software, even if advised of the possibility of such damage.
43 /*======================= FILTER LIST SHELL =====================*/
44 typedef struct DefBlobFilter
47 CvBlobTrackPostProcOne* pFilter;
51 class CvBlobTrackPostProcList : public CvBlobTrackPostProc
54 CvBlobTrackPostProcOne* (*m_CreatePostProc)();
55 CvBlobSeq m_BlobFilterList;
59 CvBlobTrackPostProcList(CvBlobTrackPostProcOne* (*create)()):m_BlobFilterList(sizeof(DefBlobFilter))
62 m_CreatePostProc = create;
63 CvBlobTrackPostProcOne* pM = create();
64 TransferParamsFromChild(pM,NULL);
68 ~CvBlobTrackPostProcList()
71 for(i=m_BlobFilterList.GetBlobNum();i>0;--i)
73 DefBlobFilter* pF = (DefBlobFilter*)m_BlobFilterList.GetBlob(i-1);
74 pF->pFilter->Release();
78 virtual void AddBlob(CvBlob* pBlob)
80 DefBlobFilter* pF = (DefBlobFilter*)m_BlobFilterList.GetBlobByID(CV_BLOB_ID(pBlob));
82 { /* Create new filter: */
85 F.m_LastFrame = m_Frame;
86 F.pFilter = m_CreatePostProc();
87 TransferParamsToChild(F.pFilter,NULL);
88 m_BlobFilterList.AddBlob((CvBlob*)&F);
89 pF = (DefBlobFilter*)m_BlobFilterList.GetBlobByID(CV_BLOB_ID(pBlob));
94 pF->m_LastFrame = m_Frame;
97 virtual void Process()
100 for(i=m_BlobFilterList.GetBlobNum(); i>0; --i)
102 DefBlobFilter* pF = (DefBlobFilter*)m_BlobFilterList.GetBlob(i-1);
104 if(pF->m_LastFrame == m_Frame)
106 int ID = CV_BLOB_ID(pF);
107 pF->blob = *(pF->pFilter->Process(&(pF->blob)));
111 { /* Delete blob filter: */
112 pF->pFilter->Release();
113 m_BlobFilterList.DelBlob(i-1);
119 int GetBlobNum(){return m_BlobFilterList.GetBlobNum();};
120 CvBlob* GetBlob(int index){return m_BlobFilterList.GetBlob(index);};
121 void Release(){delete this;};
123 /* Additional functionality: */
124 CvBlob* GetBlobByID(int BlobID){return m_BlobFilterList.GetBlobByID(BlobID);}
126 }; /* CvBlobTrackPostProcList */
128 CvBlobTrackPostProc* cvCreateBlobTrackPostProcList(CvBlobTrackPostProcOne* (*create)())
130 return (CvBlobTrackPostProc*) new CvBlobTrackPostProcList(create);
132 /*======================= FILTER LIST SHELL =====================*/