forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkMILVideoSource.h
277 lines (231 loc) · 9.15 KB
/
vtkMILVideoSource.h
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*=========================================================================
Program: Visualization Toolkit
Module: vtkMILVideoSource.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkMILVideoSource - Matrox Imaging Library frame grabbers
// .SECTION Description
// vtkMILVideoSource provides an interface to Matrox Meteor, MeteorII
// and Corona video digitizers through the Matrox Imaging Library
// interface. In order to use this class, you must link VTK with mil.lib,
// MIL version 5.0 or higher is required.
// .SECTION Caveats
// With some capture cards, if this class is leaked and ReleaseSystemResources
// is not called, you may have to reboot before you can capture again.
// vtkVideoSource used to keep a global list and delete the video sources
// if your program leaked, due to exit crashes that was removed.
// .SECTION See Also
// vtkWin32VideoSource vtkVideoSource
#ifndef __vtkMILVideoSource_h
#define __vtkMILVideoSource_h
#include "vtkIOVideoModule.h" // For export macro
#include "vtkVideoSource.h"
// digitizer hardware
#define VTK_MIL_DEFAULT 0
#define VTK_MIL_METEOR "M_SYSTEM_METEOR"
#define VTK_MIL_METEOR_II "M_SYSTEM_METEOR_II"
#define VTK_MIL_METEOR_II_DIG "M_SYSTEM_METEOR_II_DIG"
#define VTK_MIL_METEOR_II_CL "M_SYSTEM_METEOR_II_CL"
#define VTK_MIL_METEOR_II_1394 "M_SYSTEM_METEOR_II_1394"
#define VTK_MIL_CORONA "M_SYSTEM_CORONA"
#define VTK_MIL_CORONA_II "M_SYSTEM_CORONA_II"
#define VTK_MIL_PULSAR "M_SYSTEM_PULSAR"
#define VTK_MIL_GENESIS "M_SYSTEM_GENESIS"
#define VTK_MIL_GENESIS_PLUS "M_SYSTEM_GENESIS_PLUS"
#define VTK_MIL_ORION "M_SYSTEM_ORION"
#define VTK_MIL_CRONOS "M_SYSTEM_CRONOS"
#define VTK_MIL_ODYSSEY "M_SYSTEM_ODYSSEY"
// video inputs:
#define VTK_MIL_MONO 0
#define VTK_MIL_COMPOSITE 1
#define VTK_MIL_YC 2
#define VTK_MIL_RGB 3
#define VTK_MIL_DIGITAL 4
// video formats:
#define VTK_MIL_RS170 0
#define VTK_MIL_NTSC 1
#define VTK_MIL_CCIR 2
#define VTK_MIL_PAL 3
#define VTK_MIL_SECAM 4
#define VTK_MIL_NONSTANDARD 5
class VTKIOVIDEO_EXPORT vtkMILVideoSource : public vtkVideoSource
{
public:
static vtkMILVideoSource *New();
vtkTypeMacro(vtkMILVideoSource,vtkVideoSource);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Standard VCR functionality: Record incoming video.
void Record();
// Description:
// Standard VCR functionality: Play recorded video.
void Play();
// Description:
// Standard VCR functionality: Stop recording or playing.
void Stop();
// Description:
// Grab a single video frame.
void Grab();
// Description:
// Request a particular frame size (set the third value to 1).
void SetFrameSize(int x, int y, int z);
// Description:
// Request a particular output format (default: VTK_RGB).
void SetOutputFormat(int format);
// Description:
// Set/Get the video channel
virtual void SetVideoChannel(int channel);
vtkGetMacro(VideoChannel, int);
// Description:
// Set/Get the video format
virtual void SetVideoFormat(int format);
void SetVideoFormatToNTSC() { this->SetVideoFormat(VTK_MIL_NTSC); };
void SetVideoFormatToPAL() { this->SetVideoFormat(VTK_MIL_PAL); };
void SetVideoFormatToSECAM() { this->SetVideoFormat(VTK_MIL_SECAM); };
void SetVideoFormatToRS170() { this->SetVideoFormat(VTK_MIL_RS170); };
void SetVideoFormatToCCIR() { this->SetVideoFormat(VTK_MIL_CCIR); };
void SetVideoFormatToNonStandard() {
this->SetVideoFormat(VTK_MIL_NONSTANDARD); };
vtkGetMacro(VideoFormat,int);
// Description:
// Set/Get the video input
virtual void SetVideoInput(int input);
void SetVideoInputToMono() { this->SetVideoInput(VTK_MIL_MONO); };
void SetVideoInputToComposite() {this->SetVideoInput(VTK_MIL_COMPOSITE);};
void SetVideoInputToYC() { this->SetVideoInput(VTK_MIL_YC); };
void SetVideoInputToRGB() { this->SetVideoInput(VTK_MIL_RGB); };
void SetVideoInputToDigital() { this->SetVideoInput(VTK_MIL_DIGITAL); };
vtkGetMacro(VideoInput,int);
// Description:
// Set/Get the video levels for composite/SVideo: the valid ranges are:
// Contrast [0.0,2.0]
// Brighness [0.0,255.0]
// Hue [-0.5,0.5]
// Saturation [0.0,2.0]
virtual void SetContrastLevel(float contrast);
vtkGetMacro(ContrastLevel,float);
virtual void SetBrightnessLevel(float brightness);
vtkGetMacro(BrightnessLevel,float);
virtual void SetHueLevel(float hue);
vtkGetMacro(HueLevel,float);
virtual void SetSaturationLevel(float saturation);
vtkGetMacro(SaturationLevel,float);
// Description:
// Set/Get the video levels for monochrome/RGB: valid values are
// between 0.0 and 255.0.
virtual void SetBlackLevel(float value);
virtual float GetBlackLevel() {
return this->BlackLevel; };
virtual void SetWhiteLevel(float value);
virtual float GetWhiteLevel() {
return this->WhiteLevel; };
// Description:
// Set the system which you want use. If you don't specify a system,
// then your primary digitizer will be autodetected.
vtkSetStringMacro(MILSystemType);
vtkGetStringMacro(MILSystemType);
void SetMILSystemTypeToMeteor() { this->SetMILSystemType(VTK_MIL_METEOR); };
void SetMILSystemTypeToMeteorII() { this->SetMILSystemType(VTK_MIL_METEOR_II); };
void SetMILSystemTypeToMeteorIIDig() { this->SetMILSystemType(VTK_MIL_METEOR_II_DIG); };
void SetMILSystemTypeToMeteorIICL() { this->SetMILSystemType(VTK_MIL_METEOR_II_CL); };
void SetMILSystemTypeToMeteorII1394() { this->SetMILSystemType(VTK_MIL_METEOR_II_1394); };
void SetMILSystemTypeToCorona() { this->SetMILSystemType(VTK_MIL_CORONA); };
void SetMILSystemTypeToCoronaII() { this->SetMILSystemType(VTK_MIL_CORONA_II); };
void SetMILSystemTypeToPulsar() { this->SetMILSystemType(VTK_MIL_PULSAR); };
void SetMILSystemTypeToGenesis() { this->SetMILSystemType(VTK_MIL_GENESIS); };
void SetMILSystemTypeToGenesisPlus() { this->SetMILSystemType(VTK_MIL_GENESIS_PLUS); };
void SetMILSystemTypeToOrion() { this->SetMILSystemType(VTK_MIL_ORION); };
void SetMILSystemTypeToCronos() { this->SetMILSystemType(VTK_MIL_CRONOS); };
void SetMILSystemTypeToOdyssey() { this->SetMILSystemType(VTK_MIL_ODYSSEY); };
// Description:
// Set the system number if you have multiple systems of the same type
vtkSetMacro(MILSystemNumber,int);
vtkGetMacro(MILSystemNumber,int);
// Description:
// Set the DCF filename for non-standard video formats
vtkSetStringMacro(MILDigitizerDCF);
vtkGetStringMacro(MILDigitizerDCF);
// Description:
// Set the digitizer number for systems with multiple digitizers
vtkSetMacro(MILDigitizerNumber,int);
vtkGetMacro(MILDigitizerNumber,int);
// Description:
// Set whether to display MIL error messages (default on)
virtual void SetMILErrorMessages(int yesno);
vtkBooleanMacro(MILErrorMessages,int);
vtkGetMacro(MILErrorMessages,int);
// Description:
// Allows fine-grained control
vtkSetMacro(MILAppID,long);
vtkGetMacro(MILAppID,long);
vtkSetMacro(MILSysID,long);
vtkGetMacro(MILSysID,long);
vtkGetMacro(MILDigID,long);
vtkGetMacro(MILBufID,long);
// Description:
// Initialize the driver (this is called automatically when the
// first grab is done).
void Initialize();
// Description:
// Free the driver (this is called automatically inside the
// destructor).
void ReleaseSystemResources();
// Description:
// For internal use only
void *OldHookFunction;
void *OldUserDataPtr;
int FrameCounter;
int ForceGrab;
void InternalGrab();
protected:
vtkMILVideoSource();
~vtkMILVideoSource();
virtual void AllocateMILDigitizer();
virtual void AllocateMILBuffer();
virtual char *MILInterpreterForSystem(const char *system);
char *MILInterpreterDLL;
int VideoChannel;
int VideoInput;
int VideoInputForColor;
int VideoFormat;
float ContrastLevel;
float BrightnessLevel;
float HueLevel;
float SaturationLevel;
float BlackLevel;
float WhiteLevel;
int FrameMaxSize[2];
long MILAppID;
long MILSysID;
long MILDigID;
long MILBufID;
// long MILDispBufID;
// long MILDispID;
char *MILSystemType;
int MILSystemNumber;
int MILDigitizerNumber;
char *MILDigitizerDCF;
int MILErrorMessages;
int MILAppInternallyAllocated;
int MILSysInternallyAllocated;
int FatalMILError;
// Description:
// Method for updating the virtual clock that accurately times the
// arrival of each frame, more accurately than is possible with
// the system clock alone because the virtual clock averages out the
// jitter.
double CreateTimeStampForFrame(unsigned long frame);
double LastTimeStamp;
unsigned long LastFrameCount;
double EstimatedFramePeriod;
double NextFramePeriod;
private:
vtkMILVideoSource(const vtkMILVideoSource&); // Not implemented.
void operator=(const vtkMILVideoSource&); // Not implemented.
};
#endif