cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
svlDefinitions.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Balazs Vagvolgyi
7  Created on: 2010
8 
9  (C) Copyright 2006-2010 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 
20 */
21 
22 #ifndef _svlDefinitions_h
23 #define _svlDefinitions_h
24 
25 
26 #ifndef SETUP_QT_ENVIRONMENT
27  // Do nothing if Qt is not available
28  #define SETUP_QT_ENVIRONMENT(F) \
29  int main(int argc, char** argv) \
30  { \
31  return F(argc, argv); \
32  }
33 #endif // SETUP_QT_ENVIRONMENT
34 
35 
37 // Thread synchronization macros //
39 
40 #define _OnSingleThread(_info) \
41  if((_info)->ID==0)
42 #define _ParallelLoop(_info, _idx, _count) \
43  _idx=(_info)->ID*std::max(1001*(_count)/(_info)->count,1000u)/1000; \
44  for(const unsigned int _end=std::min((_count),((_info)->ID+1)*std::max(1001*(_count)/(_info)->count,1000u)/1000);_idx<_end;_idx++)
45 #define _ParallelInterleavedLoop(_info, _idx, _count) \
46  _idx=(_info)->ID;for(const unsigned int _step=(_info)->count,_end=(_count);_idx<_end;_idx+=_step)
47 #define _GetParallelSubRange(_info, _count, _from, _to) \
48  _to=(_count)/(_info)->count+1;_from=(_info)->ID*_to;_to+=_from;if(_to>(_count)){_to=(_count);}
49 #define _SynchronizeThreads(_info) \
50  if((_info)->count>1){if((_info)->sync->Sync((_info)->ID)!=SVL_SYNC_OK){return SVL_FAIL;}}
51 #define _CriticalSection(_info) \
52  if((_info)->count>1){(_info)->cs->Enter();}for(bool _incs=true;_incs;_incs=false,((_info)->count>1)?(_info)->cs->Leave():void())
53 
54 
56 // Helper macros //
58 
59 #define _SkipIfAlreadyProcessed(input, output) \
60  if(!IsNewSample(input)){syncOutput=output;return SVL_ALREADY_PROCESSED;}
61 
62 #define _SkipIfDisabled() \
63  if(IsDisabled())return SVL_OK;
64 
65 #define STR2FOURCC(fcc_string) (reinterpret_cast<const unsigned int*>(fcc_string)[0])
66 
67 #define MIN3(a, b, c) (((a) <= (b)) ? \
68  (((a) <= (c)) ? (a) : (c)) : \
69  (((b) <= (c)) ? (b) : (c)))
70 
71 #define MAX3(a, b, c) (((a) >= (b)) ? \
72  (((a) >= (c)) ? (a) : (c)) : \
73  (((b) >= (c)) ? (b) : (c)))
74 
75 
77 // GUI events //
79 
80 #define WM_USER_DESTROY 2000
81 #define WM_USER_PAINT 2002
82 #define DEFAULT_WINDOW_POS 0x7FFFFFFF
83 
84 #define winInput_KEY_F1 112
85 #define winInput_KEY_F2 113
86 #define winInput_KEY_F3 114
87 #define winInput_KEY_F4 115
88 #define winInput_KEY_F5 116
89 #define winInput_KEY_F6 117
90 #define winInput_KEY_F7 118
91 #define winInput_KEY_F8 119
92 #define winInput_KEY_F9 120
93 #define winInput_KEY_F10 121
94 #define winInput_KEY_F11 122
95 #define winInput_KEY_F12 123
96 
97 #define winInput_KEY_PAGEUP 33
98 #define winInput_KEY_PAGEDOWN 34
99 #define winInput_KEY_HOME 36
100 #define winInput_KEY_END 35
101 #define winInput_KEY_INSERT 45
102 #define winInput_KEY_DELETE 46
103 
104 #define winInput_KEY_LEFT 37
105 #define winInput_KEY_RIGHT 39
106 #define winInput_KEY_UP 38
107 #define winInput_KEY_DOWN 40
108 
109 #define winInput_MOUSEMOVE 1000
110 #define winInput_LBUTTONDOWN 1001
111 #define winInput_LBUTTONUP 1002
112 #define winInput_RBUTTONDOWN 1003
113 #define winInput_RBUTTONUP 1004
114 
115 
117 // Status and error codes //
119 
120 #define SVL_ALL_CHANNELS 0xFFFFFFFF
121 #define SVL_LEFT 0
122 #define SVL_RIGHT 1
123 #define SVL_OK 0
124 #define SVL_FAIL -1
125 #define SVL_YES 1
126 #define SVL_NO 0
127 
128 #define SVL_EOF -2
129 
130 #define SVL_SYNC_ERROR -1
131 #define SVL_SYNC_OK 0
132 #define SVL_SYNC_TIMEOUT 1
133 
134 #define SVL_STREAM_RUNNING 0
135 #define SVL_STREAM_CREATED 1
136 #define SVL_STREAM_INITIALIZED 2
137 #define SVL_STREAM_STOPPED 3
138 #define SVL_STREAM_RELEASED 4
139 #define SVL_ALREADY_PROCESSED 10
140 #define SVL_STOP_REQUEST 11
141 #define SVL_VID_END_REACHED 12
142 #define SVL_VID_RETRY 13
143 
144 #define SVL_TYPE_MISMATCH -12
145 #define SVL_ALREADY_INITIALIZED -13
146 #define SVL_NOT_INITIALIZED -14
147 #define SVL_ALREADY_RUNNING -15
148 #define SVL_NOT_SOURCE -17
149 #define SVL_NO_SOURCE_IN_LIST -18
150 #define SVL_INVALID_INPUT_TYPE -19
151 #define SVL_INVALID_OUTPUT_TYPE -20
152 #define SVL_NO_INPUT_DATA -21
153 #define SVL_WRONG_CHANNEL -22
154 #define SVL_CONSTRUCTION_FAILED -23
155 #define SVL_ALLOCATION_ERROR -24
156 #define SVL_NOT_IMAGE -25
157 #define SVL_WAIT_TIMEOUT -26
158 
159 #define SVL_VCS_DEVICE_NOT_INITIALIZED -2000
160 #define SVL_VCS_UNABLE_TO_OPEN -2001
161 #define SVL_VCS_UNABLE_TO_START_CAPTURE -2002
162 #define SVL_VCS_UNABLE_TO_SET_INPUT -2003
163 #define SVL_VCS_UNSUPPORTED_COLORSPACE -2004
164 #define SVL_VCS_UNSUPPORTED_SIZE -2005
165 
166 #define SVL_STEREO_INPUT_MISMATCH -5000
167 #define SVL_STEREO_INIT_ERROR -5001
168 
169 #define SVL_DMYSRC_DATA_NOT_INITIALIZED -7000
170 
171 
173 // MAX and MIN values, timeouts, sizes //
175 
176 #define SVL_MAX_CHANNELS 2u
177 #define SVL_VCS_ARRAY_LENGTH 50
178 #define SVL_VCS_STRING_LENGTH 128
179 #define ST_DP_TEMP_BUFF_SIZE 2048
180 #define MAX_DIMENSION 65536
181 #define MAX_UI16_VAL 0xFFFF
182 #define MAX_I32_VAL 0x7FFFFFFF
183 #define BIG_I32_VAL 100000000
184 #define DS_INIT_TIMEOUT_INTV 500
185 #define INITIAL_TOLERANCE_WAIT_LENGTH 100 // [frames]
186 #define SVL_OCV_FONT_SCALE 16.0
187 
188 
190 // Stream type enumerations //
192 
194 {
195  svlTypeInvalid // Default in base class
196  ,svlTypeStreamSource // Capture sources have an input connector of this type
197  ,svlTypeStreamSink // Render filters may have an output connector of this type
198  ,svlTypeImageRGB // Single RGB image
199  ,svlTypeImageRGBA // Single RGBA image
200  ,svlTypeImageRGBStereo // Dual RGB image
201  ,svlTypeImageRGBAStereo // Dual RGBA image
202  ,svlTypeImageMono8 // Single Grayscale image (8bpp)
203  ,svlTypeImageMono8Stereo // Dual Grayscale image (8bpp)
204  ,svlTypeImageMono16 // Single Grayscale image (16bpp)
205  ,svlTypeImageMono16Stereo // Dual Grayscale image (16bpp)
206  ,svlTypeImageMono32 // Single Grayscale image (32bpp)
207  ,svlTypeImageMono32Stereo // Dual Grayscale image (32bpp)
208  ,svlTypeImage3DMap // Three floats per pixel for storing 3D coordinates
209  ,svlTypeCUDAImageRGB // Single RGB image (CUDA)
210  ,svlTypeCUDAImageRGBA // Single RGBA image (CUDA)
211  ,svlTypeCUDAImageRGBStereo // Dual RGB image (CUDA)
212  ,svlTypeCUDAImageRGBAStereo // Dual RGBA image (CUDA)
213  ,svlTypeCUDAImageMono8 // Single Grayscale image (8bpp) (CUDA)
214  ,svlTypeCUDAImageMono8Stereo // Dual Grayscale image (8bpp) (CUDA)
215  ,svlTypeCUDAImageMono16 // Single Grayscale image (16bpp) (CUDA)
216  ,svlTypeCUDAImageMono16Stereo // Dual Grayscale image (16bpp) (CUDA)
217  ,svlTypeCUDAImageMono32 // Single Grayscale image (32bpp) (CUDA)
218  ,svlTypeCUDAImageMono32Stereo // Dual Grayscale image (32bpp) (CUDA)
219  ,svlTypeCUDAImage3DMap // Three floats per pixel for storing 3D coordinates (CUDA)
220  ,svlTypeMatrixInt8 // Matrix of type 'char'
221  ,svlTypeMatrixInt16 // Matrix of type 'short'
222  ,svlTypeMatrixInt32 // Matrix of type 'int'
223  ,svlTypeMatrixInt64 // Matrix of type 'long long int'
224  ,svlTypeMatrixUInt8 // Matrix of type 'unsigned char'
225  ,svlTypeMatrixUInt16 // Matrix of type 'unsigned short'
226  ,svlTypeMatrixUInt32 // Matrix of type 'unsigned int'
227  ,svlTypeMatrixUInt64 // Matrix of type 'unsigned long long int'
228  ,svlTypeMatrixFloat // Matrix of type 'float'
229  ,svlTypeMatrixDouble // Matrix of type 'double'
230  ,svlTypeTransform3D // 3D transformation
231  ,svlTypeTargets // Vector of N dimensional points
232  ,svlTypeText // Textual data
233  ,svlTypeCameraGeometry // Geometry of a single or multiple camera rig
234  ,svlTypeBlobs // Image blobs
235 };
236 
237 
239 // Stereo layout enumerations //
241 
243 {
251 };
252 
253 
255 // Kernel matching metric enumerations //
257 
259 {
266 };
267 
268 
270 // Color space enumerations //
272 
274 {
279 };
280 
281 
283 // Pixel type enumerations //
285 
287 {
296 };
297 
298 #endif // _svlDefinitions_h
299 
Definition: svlDefinitions.h:291
Definition: svlDefinitions.h:196
Definition: svlDefinitions.h:222
Definition: svlDefinitions.h:230
Definition: svlDefinitions.h:210
Definition: svlDefinitions.h:215
Definition: svlDefinitions.h:207
Definition: svlDefinitions.h:264
svlStreamType
Definition: svlDefinitions.h:193
Definition: svlDefinitions.h:214
Definition: svlDefinitions.h:295
Definition: svlDefinitions.h:278
Definition: svlDefinitions.h:275
svlErrorMetric
Definition: svlDefinitions.h:258
Definition: svlDefinitions.h:248
Definition: svlDefinitions.h:260
Definition: svlDefinitions.h:276
Definition: svlDefinitions.h:219
Definition: svlDefinitions.h:225
Definition: svlDefinitions.h:227
Definition: svlDefinitions.h:226
Definition: svlDefinitions.h:213
Definition: svlDefinitions.h:221
Definition: svlDefinitions.h:290
Definition: svlDefinitions.h:250
Definition: svlDefinitions.h:232
Definition: svlDefinitions.h:233
Definition: svlDefinitions.h:246
Definition: svlDefinitions.h:195
Definition: svlDefinitions.h:202
Definition: svlDefinitions.h:245
Definition: svlDefinitions.h:198
Definition: svlDefinitions.h:231
Definition: svlDefinitions.h:234
Definition: svlDefinitions.h:277
Definition: svlDefinitions.h:208
Definition: svlDefinitions.h:244
Definition: svlDefinitions.h:220
Definition: svlDefinitions.h:216
Definition: svlDefinitions.h:263
Definition: svlDefinitions.h:265
Definition: svlDefinitions.h:293
Definition: svlDefinitions.h:261
Definition: svlDefinitions.h:218
Definition: svlDefinitions.h:228
svlColorSpace
Definition: svlDefinitions.h:273
Definition: svlDefinitions.h:201
Definition: svlDefinitions.h:199
Definition: svlDefinitions.h:229
svlStereoLayout
Definition: svlDefinitions.h:242
Definition: svlDefinitions.h:223
Definition: svlDefinitions.h:217
Definition: svlDefinitions.h:262
Definition: svlDefinitions.h:294
Definition: svlDefinitions.h:224
Definition: svlDefinitions.h:288
Definition: svlDefinitions.h:197
Definition: svlDefinitions.h:204
Definition: svlDefinitions.h:289
Definition: svlDefinitions.h:206
Definition: svlDefinitions.h:203
Definition: svlDefinitions.h:292
Definition: svlDefinitions.h:200
Definition: svlDefinitions.h:247
Definition: svlDefinitions.h:249
Definition: svlDefinitions.h:211
Definition: svlDefinitions.h:209
svlPixelType
Definition: svlDefinitions.h:286
Definition: svlDefinitions.h:205
Definition: svlDefinitions.h:212