aboutsummaryrefslogtreecommitdiff
path: root/src/pix_opencv_blobtrack.h
blob: 2e0051304f09f2c03e94a80c14601badb3bfb1bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*-----------------------------------------------------------------
LOG
    GEM - Graphics Environment for Multimedia

    Copyright (c) 1997-1999 Mark Danks. mark@danks.org
    Copyright (c) Günther Geiger. geiger@epy.co.at
    Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
    Copyright (c) 2002 James Tittle & Chris Clepper
    For information on usage and redistribution, and for a DISCLAIMER OF ALL
    WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.

-----------------------------------------------------------------*/

#ifndef INCLUDE_PIX_OPENCV_BLOBTRACK_H_
#define INCLUDE_PIX_OPENCV_BLOBTRACK_H_

#ifndef _EiC
#include "opencv2/video/background_segm.hpp"
#include "opencv2/legacy/blobtrack.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/imgproc/imgproc_c.h>
#endif

#include "blobtrack.h"

#include "Base/GemPixObj.h"
#include <stdio.h>
#include <RTE/MessageCallbacks.h>
/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
  pix_opencv_blobtrack
    
	advanced blob tracker
	
KEYWORDS
    pix
    
DESCRIPTION
   
-----------------------------------------------------------------*/
class GEM_EXPORT pix_opencv_blobtrack : public GemPixObj
{
    CPPEXTERN_HEADER(pix_opencv_blobtrack, GemPixObj)

    public:

	    //////////
	    // Constructor
    	pix_opencv_blobtrack();
    	
    protected:
    	
   	//////////
   	// Destructor
   	virtual ~pix_opencv_blobtrack();

   	//////////
   	// Do the processing
   	virtual void 	processRGBAImage(imageStruct &image);
   	virtual void 	processRGBImage(imageStruct &image);
	virtual void 	processYUVImage(imageStruct &image);
   	virtual void 	processGrayImage(imageStruct &image);
   	void RunBlobTrackingAuto( IplImage* img );
   		
   	//////////
   	// Messages handling
   	void 	monitorStageMess(int arg);
    void areaThresholdMess(t_float arg);
    void 	fgTrainFramesMess(int arg);
	void 	printParamsMess(void);
	void 	getParamMess(t_symbol*s, int argc, t_atom*argv); // get available params or param value
	void 	setParamMess(t_symbol*s, int argc, t_atom*argv); // set param
	void 	getModuleMess(t_symbol*s, int argc, t_atom*argv); // list available and currently used modules
	void 	setModuleMess(t_symbol*s, int argc, t_atom*argv); // set selected modules

   	// Members
   	std::string m_fg_name, m_bd_name, m_bt_name, m_btgen_name, m_btpp_name, m_bta_name, m_bt_corr;
   	int m_FGTrainFrames;
   	int m_monitoring_stage; // 0 : input image, 1 : FG 3 : input with trackng info
    t_float m_areaThreshold;
   	int x_size, y_size;

   	
   	CvBlobTrackerAuto* m_tracker;
   	CvBlobTrackerAutoParam1 m_param;
   	
	DefModule_FGDetector*			m_FGModule;
    DefModule_BlobDetector*         m_BDModule;
    DefModule_BlobTracker*          m_BTModule;
    DefModule_BlobTrackPostProc*    m_BTPostProcModule;
    DefModule_BlobTrackGen*         m_BTGenModule;
    DefModule_BlobTrackAnalysis*    m_BTAnalysisModule;
    
	
    private:
    
    void setupModules();
	void createModules();
	void releaseModules(void);
	void print_params(CvVSModule* pM, const char* module); 
    t_outlet *m_dataout; // info outlet
	    
};
#endif	// for header file