segmentation
All Data Structures Namespaces Files Functions Variables Modules Pages
msSys.h
1 /*******************************************************
2 
3  Mean Shift Analysis Library
4  =============================================
5 
6  The mean shift library is a collection of routines
7  that use the mean shift algorithm. Using this algorithm,
8  the necessary output will be generated needed
9  to analyze a given input set of data.
10 
11  Mean Shift System:
12  ==================
13 
14  The Mean Shift System class provides a mechanism for the
15  mean shift library classes to prompt progress and to
16  time its computations. When porting the mean shift library
17  to an application the methods of this class may be changed
18  such that the output of the mean shift class prompts
19  will be given to whatever hardware or software device that
20  is desired.
21 
22  The prototype for the mean shift system class is provided
23  below. Its defition is provided in "msSys.cc".
24 
25 The theory is described in the papers:
26 
27  D. Comaniciu, P. Meer: Mean Shift: A robust approach toward feature
28  space analysis.
29 
30  C. Christoudias, B. Georgescu, P. Meer: Synergism in low level vision.
31 
32 and they are is available at:
33  http://www.caip.rutgers.edu/riul/research/papers/
34 
35 Implemented by Chris M. Christoudias, Bogdan Georgescu
36 ********************************************************/
37 
38 
39 #ifndef MSSYS_H
40 #define MSSYS_H
41 
42 //Include standard mean shift library type definitions
43 #include "tdef.h"
44 
45 //Include standard libraries needed for msSystem prototype
46 #include <time.h>
47 
48 extern void bgLogFile(const char*, ...);
49 
50 //Mean Shify System class prototype
51 class msSystem {
52 
53  public:
54 
55  /*/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
56  /* Class Constructor and Destructor */
57  /*\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/*/
58 
59  msSystem( void ); //Default Constructor
60  ~msSystem( void ); //Class Destructor
61 
62  /*/\/\/\/\/\/\/\*/
63  /* System Timer */
64  /*\/\/\/\/\/\/\/*/
65 
66  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
67  //<--------------------------------------------------->|//
68  //| |//
69  //| Method Name: |//
70  //| ============ |//
71  //| * Start Timer * |//
72  //| |//
73  //<--------------------------------------------------->|//
74  //| |//
75  //| Description: |//
76  //| ============ |//
77  //| |//
78  //| Initializes the system timer. The timer object |//
79  //| synthesized by this class is initialized during |//
80  //| construction of the msSystem class to be the |//
81  //| current time during construction. |//
82  //| |//
83  //<--------------------------------------------------->|//
84  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
85 
86  void StartTimer( void );
87 
88  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
89  //<--------------------------------------------------->|//
90  //| |//
91  //| Method Name: |//
92  //| ============ |//
93  //| * Elapsed Time * |//
94  //| |//
95  //<--------------------------------------------------->|//
96  //| |//
97  //| Description: |//
98  //| ============ |//
99  //| |//
100  //| Returns the amount of time elapsed in seconds |//
101  //| from when StartTimer() was called. If |//
102  //| StartTimer() was not called, the time returned |//
103  //| is the time elapsed from the construction of the |//
104  //| msSystem object. |//
105  //| |//
106  //| In order to create a valid kernel the following |//
107  //| argumens must be provided this method: |//
108  //| |//
109  //<--------------------------------------------------->|//
110  //| |//
111  //| Usage: |//
112  //| ====== |//
113  //| TimeInSeconds = ElapsedTime() |//
114  //| |//
115  //<--------------------------------------------------->|//
116  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
117 
118  double ElapsedTime( void );
119 
120  /*/\/\/\/\/\/\/\/\*/
121  /* System Output */
122  /*\/\/\/\/\/\/\/\/*/
123 
124  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
125  //<--------------------------------------------------->|//
126  //| |//
127  //| Method Name: |//
128  //| ============ |//
129  //| * Prompt * |//
130  //| |//
131  //<--------------------------------------------------->|//
132  //| |//
133  //| Description: |//
134  //| ============ |//
135  //| |//
136  //| Outputs to a device a character message contain- |//
137  //| ing delimeters. These delimeters are replaced by |//
138  //| the variable input parameters passed to prompt. |//
139  //| (Like printf.) |//
140  //| |//
141  //| This method should be altered if a special |//
142  //| device either than stderr is desired to be used |//
143  //| as an output prompt. |//
144  //| |//
145  //| The arguments to this method are: |//
146  //| |//
147  //| <* PromptStr *> |//
148  //| A string possibly containing delimeters that |//
149  //| is to be output to the user. |//
150  //| |//
151  //| <* varArgs *> |//
152  //| A variable set of arguments to be placed into |//
153  //| the prompt string. |//
154  //| |//
155  //<--------------------------------------------------->|//
156  //| |//
157  //| Usage: |//
158  //| ====== |//
159  //| Prompt(PromptStr, varArgs) |//
160  //| |//
161  //<--------------------------------------------------->|//
162  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
163 
164  void Prompt(const char*, ...);
165 
166  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
167  //<--------------------------------------------------->|//
168  //| |//
169  //| Method Name: |//
170  //| ============ |//
171  //| * Progress * |//
172  //| |//
173  //<--------------------------------------------------->|//
174  //| |//
175  //| Description: |//
176  //| ============ |//
177  //| |//
178  //| This method is called by the mean shift library |//
179  //| methods during the application of a specific |//
180  //| algorithm in which the progress of the algorithm |//
181  //| is indicated. Its main use is for a multi-thre- |//
182  //| aded programming envioronment. Namely, it is |//
183  //| called fairly frequently by the mean shift |//
184  //| library methods. It then can be used to grace- |//
185  //| fully halt the algorithm, or to simply update |//
186  //| a progress bar. |//
187  //| |//
188  //| This method depends strongly on the interface |//
189  //| and therefore must be re-implemented to accom- |//
190  //| odate ones needs. |//
191  //| |//
192  //| To facilitate a multi-threaded enviornment |//
193  //| the prompt function returns a value that |//
194  //| indicates to the mean shift method whether |//
195  //| to continue execution. EL_HALT is returned |//
196  //| when the mean shift procedure is to stop |//
197  //| execution and EL_OKAY is returned otherwise. |//
198  //| |//
199  //| The arguments to this method are: |//
200  //| |//
201  //| <* PercentComplete *> |//
202  //| A floating point number that indicates the perc- |//
203  //| ent complete of the algorithm. PercentComplete |//
204  //| takes a value between zero and one. |//
205  //| |//
206  //| <* SystemState *> |//
207  //| Indicates the system state. It is EL_HALT |//
208  //| when the mean shift method is to halt execution |//
209  //| and it is EL_OKAY otherwise. |//
210  //| |//
211  //<--------------------------------------------------->|//
212  //| |//
213  //| Usage: |//
214  //| ====== |//
215  //| SystemState = Progress(PercentComplete) |//
216  //| |//
217  //<--------------------------------------------------->|//
218  //--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//--\\||//
219 
220  ErrorLevel Progress(float);
221 
222  private:
223 
224  //Timer object...
225  time_t currentTime;
226 
227 };
228 
229 #endif