robotpy-cscore 2027.0.0a3__cp314-cp314-macosx_13_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of robotpy-cscore might be problematic. Click here for more details.
- cscore/__init__.py +59 -0
- cscore/__main__.py +152 -0
- cscore/_cscore.cpython-314-darwin.so +0 -0
- cscore/_cscore.pyi +1615 -0
- cscore/_init__cscore.py +6 -0
- cscore/_logging.py +12 -0
- cscore/cscore-casters.pc +8 -0
- cscore/cscore-casters.pybind11.json +1 -0
- cscore/cscore.pc +10 -0
- cscore/cvnp/README.md +11 -0
- cscore/cvnp/cvnp.cpp +242 -0
- cscore/cvnp/cvnp.h +434 -0
- cscore/cvnp/cvnp_synonyms.cpp +70 -0
- cscore/cvnp/cvnp_synonyms.h +25 -0
- cscore/grip.py +41 -0
- cscore/imagewriter.py +146 -0
- cscore/py.typed +0 -0
- cscore/src/main.cpp +19 -0
- cscore/trampolines/cs__AxisCamera.hpp +9 -0
- cscore/trampolines/cs__CvSink.hpp +13 -0
- cscore/trampolines/cs__CvSource.hpp +13 -0
- cscore/trampolines/cs__HttpCamera.hpp +9 -0
- cscore/trampolines/cs__ImageSink.hpp +9 -0
- cscore/trampolines/cs__ImageSource.hpp +9 -0
- cscore/trampolines/cs__MjpegServer.hpp +9 -0
- cscore/trampolines/cs__RawEvent.hpp +9 -0
- cscore/trampolines/cs__UsbCamera.hpp +9 -0
- cscore/trampolines/cs__UsbCameraInfo.hpp +9 -0
- cscore/trampolines/cs__VideoCamera.hpp +9 -0
- cscore/trampolines/cs__VideoEvent.hpp +9 -0
- cscore/trampolines/cs__VideoListener.hpp +9 -0
- cscore/trampolines/cs__VideoMode.hpp +9 -0
- cscore/trampolines/cs__VideoProperty.hpp +9 -0
- cscore/trampolines/cs__VideoSink.hpp +9 -0
- cscore/trampolines/cs__VideoSource.hpp +9 -0
- cscore/trampolines/frc__CameraServer.hpp +12 -0
- cscore/version.py +3 -0
- robotpy_cscore-2027.0.0a3.dist-info/METADATA +11 -0
- robotpy_cscore-2027.0.0a3.dist-info/RECORD +42 -0
- robotpy_cscore-2027.0.0a3.dist-info/WHEEL +4 -0
- robotpy_cscore-2027.0.0a3.dist-info/entry_points.txt +3 -0
- robotpy_cscore-2027.0.0a3.dist-info/licenses/LICENSE +51 -0
cscore/_cscore.pyi
ADDED
|
@@ -0,0 +1,1615 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import collections.abc
|
|
3
|
+
import numpy
|
|
4
|
+
import typing
|
|
5
|
+
import wpiutil
|
|
6
|
+
import wpiutil._wpiutil
|
|
7
|
+
__all__: list[str] = ['AxisCamera', 'CameraServer', 'CvSink', 'CvSource', 'HttpCamera', 'ImageSink', 'ImageSource', 'MjpegServer', 'RawEvent', 'UsbCamera', 'UsbCameraInfo', 'VideoCamera', 'VideoEvent', 'VideoListener', 'VideoMode', 'VideoProperty', 'VideoSink', 'VideoSource', 'runMainRunLoop', 'runMainRunLoopTimeout', 'stopMainRunLoop']
|
|
8
|
+
class AxisCamera(HttpCamera):
|
|
9
|
+
"""
|
|
10
|
+
A source that represents an Axis IP camera.
|
|
11
|
+
|
|
12
|
+
:deprecated: Use HttpCamera instead.
|
|
13
|
+
"""
|
|
14
|
+
@typing.overload
|
|
15
|
+
def __init__(self, name: str, host: str) -> None:
|
|
16
|
+
"""
|
|
17
|
+
Create a source for an Axis IP camera.
|
|
18
|
+
|
|
19
|
+
:param name: Source name (arbitrary unique identifier)
|
|
20
|
+
:param host: Camera host IP or DNS name (e.g. "10.x.y.11")
|
|
21
|
+
"""
|
|
22
|
+
@typing.overload
|
|
23
|
+
def __init__(self, name: str, host: str) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Create a source for an Axis IP camera.
|
|
26
|
+
|
|
27
|
+
:param name: Source name (arbitrary unique identifier)
|
|
28
|
+
:param host: Camera host IP or DNS name (e.g. "10.x.y.11")
|
|
29
|
+
"""
|
|
30
|
+
@typing.overload
|
|
31
|
+
def __init__(self, name: str, host: str) -> None:
|
|
32
|
+
"""
|
|
33
|
+
Create a source for an Axis IP camera.
|
|
34
|
+
|
|
35
|
+
:param name: Source name (arbitrary unique identifier)
|
|
36
|
+
:param host: Camera host IP or DNS name (e.g. "10.x.y.11")
|
|
37
|
+
"""
|
|
38
|
+
@typing.overload
|
|
39
|
+
def __init__(self, name: str, hosts: list[str]) -> None:
|
|
40
|
+
"""
|
|
41
|
+
Create a source for an Axis IP camera.
|
|
42
|
+
|
|
43
|
+
:param name: Source name (arbitrary unique identifier)
|
|
44
|
+
:param hosts: Array of Camera host IPs/DNS names
|
|
45
|
+
"""
|
|
46
|
+
class CameraServer:
|
|
47
|
+
"""
|
|
48
|
+
Singleton class for creating and keeping camera servers.
|
|
49
|
+
|
|
50
|
+
Also publishes camera information to NetworkTables.
|
|
51
|
+
"""
|
|
52
|
+
kBasePort: typing.ClassVar[int] = 1181
|
|
53
|
+
@staticmethod
|
|
54
|
+
def addCamera(camera: VideoSource) -> None:
|
|
55
|
+
"""
|
|
56
|
+
Adds an already created camera.
|
|
57
|
+
|
|
58
|
+
:param camera: Camera
|
|
59
|
+
"""
|
|
60
|
+
@staticmethod
|
|
61
|
+
@typing.overload
|
|
62
|
+
def addServer(name: str) -> MjpegServer:
|
|
63
|
+
"""
|
|
64
|
+
Adds a MJPEG server at the next available port.
|
|
65
|
+
|
|
66
|
+
:param name: Server name
|
|
67
|
+
"""
|
|
68
|
+
@staticmethod
|
|
69
|
+
@typing.overload
|
|
70
|
+
def addServer(name: str, port: typing.SupportsInt) -> MjpegServer:
|
|
71
|
+
"""
|
|
72
|
+
Adds a MJPEG server.
|
|
73
|
+
|
|
74
|
+
:param name: Server name
|
|
75
|
+
:param port: Port number
|
|
76
|
+
"""
|
|
77
|
+
@staticmethod
|
|
78
|
+
@typing.overload
|
|
79
|
+
def addServer(server: VideoSink) -> None:
|
|
80
|
+
"""
|
|
81
|
+
Adds an already created server.
|
|
82
|
+
|
|
83
|
+
:param server: Server
|
|
84
|
+
"""
|
|
85
|
+
@staticmethod
|
|
86
|
+
def addSwitchedCamera(name: str) -> MjpegServer:
|
|
87
|
+
"""
|
|
88
|
+
Adds a virtual camera for switching between two streams. Unlike the
|
|
89
|
+
other addCamera methods, this returns a VideoSink rather than a
|
|
90
|
+
VideoSource. Calling SetSource() on the returned object can be used
|
|
91
|
+
to switch the actual source of the stream.
|
|
92
|
+
"""
|
|
93
|
+
@staticmethod
|
|
94
|
+
def enableLogging(level: typing.SupportsInt | None = None) -> None:
|
|
95
|
+
"""
|
|
96
|
+
Enable cscore logging
|
|
97
|
+
"""
|
|
98
|
+
@staticmethod
|
|
99
|
+
@typing.overload
|
|
100
|
+
def getServer() -> VideoSink:
|
|
101
|
+
"""
|
|
102
|
+
Get server for the primary camera feed.
|
|
103
|
+
|
|
104
|
+
This is only valid to call after a camera feed has been added with
|
|
105
|
+
StartAutomaticCapture() or AddServer().
|
|
106
|
+
"""
|
|
107
|
+
@staticmethod
|
|
108
|
+
@typing.overload
|
|
109
|
+
def getServer(name: str) -> VideoSink:
|
|
110
|
+
"""
|
|
111
|
+
Gets a server by name.
|
|
112
|
+
|
|
113
|
+
:param name: Server name
|
|
114
|
+
"""
|
|
115
|
+
@staticmethod
|
|
116
|
+
@typing.overload
|
|
117
|
+
def getVideo() -> CvSink:
|
|
118
|
+
"""
|
|
119
|
+
Get OpenCV access to the primary camera feed. This allows you to
|
|
120
|
+
get images from the camera for image processing on the roboRIO.
|
|
121
|
+
|
|
122
|
+
This is only valid to call after a camera feed has been added
|
|
123
|
+
with startAutomaticCapture() or addServer().
|
|
124
|
+
"""
|
|
125
|
+
@staticmethod
|
|
126
|
+
@typing.overload
|
|
127
|
+
def getVideo(camera: VideoSource) -> CvSink:
|
|
128
|
+
"""
|
|
129
|
+
Get OpenCV access to the specified camera. This allows you to get
|
|
130
|
+
images from the camera for image processing on the roboRIO.
|
|
131
|
+
|
|
132
|
+
:param camera: Camera (e.g. as returned by startAutomaticCapture).
|
|
133
|
+
"""
|
|
134
|
+
@staticmethod
|
|
135
|
+
@typing.overload
|
|
136
|
+
def getVideo(camera: VideoSource, pixelFormat: VideoMode.PixelFormat) -> CvSink:
|
|
137
|
+
"""
|
|
138
|
+
Get OpenCV access to the specified camera. This allows you to get
|
|
139
|
+
images from the camera for image processing on the roboRIO.
|
|
140
|
+
|
|
141
|
+
:param camera: Camera (e.g. as returned by startAutomaticCapture).
|
|
142
|
+
:param pixelFormat: The desired pixelFormat of captured frames from the
|
|
143
|
+
camera
|
|
144
|
+
"""
|
|
145
|
+
@staticmethod
|
|
146
|
+
@typing.overload
|
|
147
|
+
def getVideo(name: str) -> CvSink:
|
|
148
|
+
"""
|
|
149
|
+
Get OpenCV access to the specified camera. This allows you to get
|
|
150
|
+
images from the camera for image processing on the roboRIO.
|
|
151
|
+
|
|
152
|
+
:param name: Camera name
|
|
153
|
+
"""
|
|
154
|
+
@staticmethod
|
|
155
|
+
@typing.overload
|
|
156
|
+
def getVideo(name: str, pixelFormat: VideoMode.PixelFormat) -> CvSink:
|
|
157
|
+
"""
|
|
158
|
+
Get OpenCV access to the specified camera. This allows you to get
|
|
159
|
+
images from the camera for image processing on the roboRIO.
|
|
160
|
+
|
|
161
|
+
:param name: Camera name
|
|
162
|
+
:param pixelFormat: The desired pixelFormat of captured frames from the
|
|
163
|
+
camera
|
|
164
|
+
"""
|
|
165
|
+
@staticmethod
|
|
166
|
+
def putVideo(name: str, width: typing.SupportsInt, height: typing.SupportsInt) -> CvSource:
|
|
167
|
+
"""
|
|
168
|
+
Create a MJPEG stream with OpenCV input. This can be called to pass custom
|
|
169
|
+
annotated images to the dashboard.
|
|
170
|
+
|
|
171
|
+
:param name: Name to give the stream
|
|
172
|
+
:param width: Width of the image being sent
|
|
173
|
+
:param height: Height of the image being sent
|
|
174
|
+
"""
|
|
175
|
+
@staticmethod
|
|
176
|
+
def removeCamera(name: str) -> None:
|
|
177
|
+
"""
|
|
178
|
+
Removes a camera by name.
|
|
179
|
+
|
|
180
|
+
:param name: Camera name
|
|
181
|
+
"""
|
|
182
|
+
@staticmethod
|
|
183
|
+
def removeServer(name: str) -> None:
|
|
184
|
+
"""
|
|
185
|
+
Removes a server by name.
|
|
186
|
+
|
|
187
|
+
:param name: Server name
|
|
188
|
+
"""
|
|
189
|
+
@staticmethod
|
|
190
|
+
@typing.overload
|
|
191
|
+
def startAutomaticCapture() -> UsbCamera:
|
|
192
|
+
"""
|
|
193
|
+
Start automatically capturing images to send to the dashboard.
|
|
194
|
+
|
|
195
|
+
You should call this method to see a camera feed on the dashboard. If you
|
|
196
|
+
also want to perform vision processing on the roboRIO, use getVideo() to
|
|
197
|
+
get access to the camera images.
|
|
198
|
+
|
|
199
|
+
The first time this overload is called, it calls StartAutomaticCapture()
|
|
200
|
+
with device 0, creating a camera named "USB Camera 0". Subsequent calls
|
|
201
|
+
increment the device number (e.g. 1, 2, etc).
|
|
202
|
+
"""
|
|
203
|
+
@staticmethod
|
|
204
|
+
@typing.overload
|
|
205
|
+
def startAutomaticCapture(dev: typing.SupportsInt) -> UsbCamera:
|
|
206
|
+
"""
|
|
207
|
+
Start automatically capturing images to send to the dashboard.
|
|
208
|
+
|
|
209
|
+
This overload calls StartAutomaticCapture() with a name of "USB Camera
|
|
210
|
+
{dev}".
|
|
211
|
+
|
|
212
|
+
:param dev: The device number of the camera interface
|
|
213
|
+
"""
|
|
214
|
+
@staticmethod
|
|
215
|
+
@typing.overload
|
|
216
|
+
def startAutomaticCapture(name: str, dev: typing.SupportsInt) -> UsbCamera:
|
|
217
|
+
"""
|
|
218
|
+
Start automatically capturing images to send to the dashboard.
|
|
219
|
+
|
|
220
|
+
:param name: The name to give the camera
|
|
221
|
+
:param dev: The device number of the camera interface
|
|
222
|
+
"""
|
|
223
|
+
@staticmethod
|
|
224
|
+
@typing.overload
|
|
225
|
+
def startAutomaticCapture(name: str, path: str) -> UsbCamera:
|
|
226
|
+
"""
|
|
227
|
+
Start automatically capturing images to send to the dashboard.
|
|
228
|
+
|
|
229
|
+
:param name: The name to give the camera
|
|
230
|
+
:param path: The device path (e.g. "/dev/video0") of the camera
|
|
231
|
+
"""
|
|
232
|
+
@staticmethod
|
|
233
|
+
@typing.overload
|
|
234
|
+
def startAutomaticCapture(camera: VideoSource) -> MjpegServer:
|
|
235
|
+
"""
|
|
236
|
+
Start automatically capturing images to send to the dashboard from
|
|
237
|
+
an existing camera.
|
|
238
|
+
|
|
239
|
+
:param camera: Camera
|
|
240
|
+
"""
|
|
241
|
+
@staticmethod
|
|
242
|
+
def waitForever() -> None:
|
|
243
|
+
"""
|
|
244
|
+
Infinitely loops until the process dies
|
|
245
|
+
"""
|
|
246
|
+
class CvSink(ImageSink):
|
|
247
|
+
"""
|
|
248
|
+
A sink for user code to accept video frames as OpenCV images.
|
|
249
|
+
"""
|
|
250
|
+
def __init__(self, name: str, pixelFormat: VideoMode.PixelFormat = ...) -> None:
|
|
251
|
+
"""
|
|
252
|
+
Create a sink for accepting OpenCV images.
|
|
253
|
+
|
|
254
|
+
WaitForFrame() must be called on the created sink to get each new
|
|
255
|
+
image.
|
|
256
|
+
|
|
257
|
+
:param name: Source name (arbitrary unique identifier)
|
|
258
|
+
:param pixelFormat: The pixel format to read
|
|
259
|
+
"""
|
|
260
|
+
def grabFrame(self, image: numpy.ndarray, timeout: typing.SupportsFloat = 0.225) -> tuple[int, numpy.ndarray]:
|
|
261
|
+
"""
|
|
262
|
+
Wait for the next frame and get the image.
|
|
263
|
+
Times out (returning 0) after timeout seconds.
|
|
264
|
+
The provided image will have the pixelFormat this class was constructed
|
|
265
|
+
with.
|
|
266
|
+
|
|
267
|
+
:returns: Frame time, or 0 on error (call GetError() to obtain the error
|
|
268
|
+
message); the frame time is in the same time base as wpi::Now(),
|
|
269
|
+
and is in 1 us increments.
|
|
270
|
+
"""
|
|
271
|
+
def grabFrameDirect(self, image: numpy.ndarray, timeout: typing.SupportsFloat = 0.225) -> int:
|
|
272
|
+
"""
|
|
273
|
+
Wait for the next frame and get the image.
|
|
274
|
+
Times out (returning 0) after timeout seconds.
|
|
275
|
+
The provided image will have the pixelFormat this class was constructed
|
|
276
|
+
with. The data is backed by data in the CvSink. It will be invalidated by
|
|
277
|
+
any grabFrame*() call on the sink.
|
|
278
|
+
|
|
279
|
+
:returns: Frame time, or 0 on error (call GetError() to obtain the error
|
|
280
|
+
message); the frame time is in the same time base as wpi::Now(),
|
|
281
|
+
and is in 1 us increments.
|
|
282
|
+
"""
|
|
283
|
+
def grabFrameDirectLastTime(self, image: numpy.ndarray, lastFrameTime: typing.SupportsInt, timeout: typing.SupportsFloat = 0.225) -> int:
|
|
284
|
+
"""
|
|
285
|
+
Wait for the next frame and get the image.
|
|
286
|
+
Times out (returning 0) after timeout seconds.
|
|
287
|
+
The provided image will have the pixelFormat this class was constructed
|
|
288
|
+
with. The data is backed by data in the CvSink. It will be invalidated by
|
|
289
|
+
any grabFrame*() call on the sink.
|
|
290
|
+
|
|
291
|
+
If lastFrameTime is provided and non-zero, the sink will fill image with
|
|
292
|
+
the first frame from the source that is not equal to lastFrameTime. If
|
|
293
|
+
lastFrameTime is zero, the time of the current frame owned by the CvSource
|
|
294
|
+
is used, and this function will block until the connected CvSource provides
|
|
295
|
+
a new frame.
|
|
296
|
+
|
|
297
|
+
:returns: Frame time, or 0 on error (call GetError() to obtain the error
|
|
298
|
+
message); the frame time is in the same time base as wpi::Now(),
|
|
299
|
+
and is in 1 us increments.
|
|
300
|
+
"""
|
|
301
|
+
def grabFrameNoTimeout(self, image: numpy.ndarray) -> tuple[int, numpy.ndarray]:
|
|
302
|
+
"""
|
|
303
|
+
Wait for the next frame and get the image. May block forever.
|
|
304
|
+
The provided image will have the pixelFormat this class was constructed
|
|
305
|
+
with.
|
|
306
|
+
|
|
307
|
+
:returns: Frame time, or 0 on error (call GetError() to obtain the error
|
|
308
|
+
message); the frame time is in the same time base as wpi::Now(),
|
|
309
|
+
and is in 1 us increments.
|
|
310
|
+
"""
|
|
311
|
+
def grabFrameNoTimeoutDirect(self, image: numpy.ndarray) -> int:
|
|
312
|
+
"""
|
|
313
|
+
Wait for the next frame and get the image. May block forever.
|
|
314
|
+
The provided image will have the pixelFormat this class was constructed
|
|
315
|
+
with. The data is backed by data in the CvSink. It will be invalidated by
|
|
316
|
+
any grabFrame*() call on the sink.
|
|
317
|
+
|
|
318
|
+
:returns: Frame time, or 0 on error (call GetError() to obtain the error
|
|
319
|
+
message); the frame time is in the same time base as wpi::Now(),
|
|
320
|
+
and is in 1 us increments.
|
|
321
|
+
"""
|
|
322
|
+
def lastFrameTime(self) -> int:
|
|
323
|
+
"""
|
|
324
|
+
Get the last time a frame was grabbed. This uses the same time base as
|
|
325
|
+
wpi::Now().
|
|
326
|
+
|
|
327
|
+
:returns: Time in 1 us increments.
|
|
328
|
+
"""
|
|
329
|
+
def lastFrameTimeSource(self) -> wpiutil._wpiutil.TimestampSource:
|
|
330
|
+
"""
|
|
331
|
+
Get the time source for the timestamp the last frame was grabbed at.
|
|
332
|
+
|
|
333
|
+
:returns: Time source
|
|
334
|
+
"""
|
|
335
|
+
class CvSource(ImageSource):
|
|
336
|
+
"""
|
|
337
|
+
A source for user code to provide OpenCV images as video frames.
|
|
338
|
+
"""
|
|
339
|
+
@typing.overload
|
|
340
|
+
def __init__(self, name: str, mode: VideoMode) -> None:
|
|
341
|
+
"""
|
|
342
|
+
Create an OpenCV source.
|
|
343
|
+
|
|
344
|
+
:param name: Source name (arbitrary unique identifier)
|
|
345
|
+
:param mode: Video mode being generated
|
|
346
|
+
"""
|
|
347
|
+
@typing.overload
|
|
348
|
+
def __init__(self, name: str, pixelFormat: VideoMode.PixelFormat, width: typing.SupportsInt, height: typing.SupportsInt, fps: typing.SupportsInt) -> None:
|
|
349
|
+
"""
|
|
350
|
+
Create an OpenCV source.
|
|
351
|
+
|
|
352
|
+
:param name: Source name (arbitrary unique identifier)
|
|
353
|
+
:param pixelFormat: Pixel format
|
|
354
|
+
:param width: width
|
|
355
|
+
:param height: height
|
|
356
|
+
:param fps: fps
|
|
357
|
+
"""
|
|
358
|
+
@typing.overload
|
|
359
|
+
def putFrame(self, image: numpy.ndarray) -> None:
|
|
360
|
+
"""
|
|
361
|
+
Put an OpenCV image and notify sinks
|
|
362
|
+
|
|
363
|
+
The image format is guessed from the number of channels. The channel
|
|
364
|
+
mapping is as follows. 1: kGray 2: kYUYV 3: BGR 4: BGRA Any other channel
|
|
365
|
+
numbers will throw an error. If your image is an in alternate format, use
|
|
366
|
+
the overload that takes a PixelFormat.
|
|
367
|
+
|
|
368
|
+
:param image: OpenCV Image
|
|
369
|
+
"""
|
|
370
|
+
@typing.overload
|
|
371
|
+
def putFrame(self, image: numpy.ndarray, pixelFormat: VideoMode.PixelFormat, skipVerification: bool) -> None:
|
|
372
|
+
"""
|
|
373
|
+
Put an OpenCV image and notify sinks.
|
|
374
|
+
|
|
375
|
+
The format of the Mat must match the PixelFormat. You will corrupt memory
|
|
376
|
+
if they dont. With skipVerification false, we will verify the number of
|
|
377
|
+
channels matches the pixel format. If skipVerification is true, this step
|
|
378
|
+
is skipped and is passed straight through.
|
|
379
|
+
|
|
380
|
+
:param image: OpenCV image
|
|
381
|
+
:param pixelFormat: The pixel format of the image
|
|
382
|
+
:param skipVerification: skip verifying pixel format
|
|
383
|
+
"""
|
|
384
|
+
class HttpCamera(VideoCamera):
|
|
385
|
+
"""
|
|
386
|
+
A source that represents a MJPEG-over-HTTP (IP) camera.
|
|
387
|
+
"""
|
|
388
|
+
class HttpCameraKind:
|
|
389
|
+
"""
|
|
390
|
+
HTTP camera kind.
|
|
391
|
+
|
|
392
|
+
Members:
|
|
393
|
+
|
|
394
|
+
kUnknown : Unknown camera kind.
|
|
395
|
+
|
|
396
|
+
kMJPGStreamer : MJPG Streamer camera.
|
|
397
|
+
|
|
398
|
+
kCSCore : CS Core camera.
|
|
399
|
+
|
|
400
|
+
kAxis : Axis camera.
|
|
401
|
+
"""
|
|
402
|
+
__members__: typing.ClassVar[dict[str, HttpCamera.HttpCameraKind]] # value = {'kUnknown': <HttpCameraKind.kUnknown: 0>, 'kMJPGStreamer': <HttpCameraKind.kMJPGStreamer: 1>, 'kCSCore': <HttpCameraKind.kCSCore: 2>, 'kAxis': <HttpCameraKind.kAxis: 3>}
|
|
403
|
+
kAxis: typing.ClassVar[HttpCamera.HttpCameraKind] # value = <HttpCameraKind.kAxis: 3>
|
|
404
|
+
kCSCore: typing.ClassVar[HttpCamera.HttpCameraKind] # value = <HttpCameraKind.kCSCore: 2>
|
|
405
|
+
kMJPGStreamer: typing.ClassVar[HttpCamera.HttpCameraKind] # value = <HttpCameraKind.kMJPGStreamer: 1>
|
|
406
|
+
kUnknown: typing.ClassVar[HttpCamera.HttpCameraKind] # value = <HttpCameraKind.kUnknown: 0>
|
|
407
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
408
|
+
...
|
|
409
|
+
def __getstate__(self) -> int:
|
|
410
|
+
...
|
|
411
|
+
def __hash__(self) -> int:
|
|
412
|
+
...
|
|
413
|
+
def __index__(self) -> int:
|
|
414
|
+
...
|
|
415
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
416
|
+
...
|
|
417
|
+
def __int__(self) -> int:
|
|
418
|
+
...
|
|
419
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
420
|
+
...
|
|
421
|
+
def __repr__(self) -> str:
|
|
422
|
+
...
|
|
423
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
424
|
+
...
|
|
425
|
+
def __str__(self) -> str:
|
|
426
|
+
...
|
|
427
|
+
@property
|
|
428
|
+
def name(self) -> str:
|
|
429
|
+
...
|
|
430
|
+
@property
|
|
431
|
+
def value(self) -> int:
|
|
432
|
+
...
|
|
433
|
+
@typing.overload
|
|
434
|
+
def __init__(self, name: str, url: str, kind: HttpCamera.HttpCameraKind = ...) -> None:
|
|
435
|
+
"""
|
|
436
|
+
Create a source for a MJPEG-over-HTTP (IP) camera.
|
|
437
|
+
|
|
438
|
+
:param name: Source name (arbitrary unique identifier)
|
|
439
|
+
:param url: Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
|
440
|
+
:param kind: Camera kind (e.g. kAxis)
|
|
441
|
+
"""
|
|
442
|
+
@typing.overload
|
|
443
|
+
def __init__(self, name: str, url: str, kind: HttpCamera.HttpCameraKind = ...) -> None:
|
|
444
|
+
"""
|
|
445
|
+
Create a source for a MJPEG-over-HTTP (IP) camera.
|
|
446
|
+
|
|
447
|
+
:param name: Source name (arbitrary unique identifier)
|
|
448
|
+
:param url: Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
|
449
|
+
:param kind: Camera kind (e.g. kAxis)
|
|
450
|
+
"""
|
|
451
|
+
@typing.overload
|
|
452
|
+
def __init__(self, name: str, url: str, kind: HttpCamera.HttpCameraKind = ...) -> None:
|
|
453
|
+
"""
|
|
454
|
+
Create a source for a MJPEG-over-HTTP (IP) camera.
|
|
455
|
+
|
|
456
|
+
:param name: Source name (arbitrary unique identifier)
|
|
457
|
+
:param url: Camera URL (e.g. "http://10.x.y.11/video/stream.mjpg")
|
|
458
|
+
:param kind: Camera kind (e.g. kAxis)
|
|
459
|
+
"""
|
|
460
|
+
@typing.overload
|
|
461
|
+
def __init__(self, name: str, urls: list[str], kind: HttpCamera.HttpCameraKind = ...) -> None:
|
|
462
|
+
"""
|
|
463
|
+
Create a source for a MJPEG-over-HTTP (IP) camera.
|
|
464
|
+
|
|
465
|
+
:param name: Source name (arbitrary unique identifier)
|
|
466
|
+
:param urls: Array of Camera URLs
|
|
467
|
+
:param kind: Camera kind (e.g. kAxis)
|
|
468
|
+
"""
|
|
469
|
+
def getHttpCameraKind(self) -> HttpCamera.HttpCameraKind:
|
|
470
|
+
"""
|
|
471
|
+
Get the kind of HTTP camera.
|
|
472
|
+
|
|
473
|
+
Autodetection can result in returning a different value than the camera
|
|
474
|
+
was created with.
|
|
475
|
+
"""
|
|
476
|
+
def getUrls(self) -> list[str]:
|
|
477
|
+
"""
|
|
478
|
+
Get the URLs used to connect to the camera.
|
|
479
|
+
"""
|
|
480
|
+
def setUrls(self, urls: list[str]) -> None:
|
|
481
|
+
"""
|
|
482
|
+
Change the URLs used to connect to the camera.
|
|
483
|
+
"""
|
|
484
|
+
class ImageSink(VideoSink):
|
|
485
|
+
"""
|
|
486
|
+
A base class for single image reading sinks.
|
|
487
|
+
"""
|
|
488
|
+
def getError(self) -> str:
|
|
489
|
+
"""
|
|
490
|
+
Get error string. Call this if WaitForFrame() returns 0 to determine
|
|
491
|
+
what the error is.
|
|
492
|
+
"""
|
|
493
|
+
def setDescription(self, description: str) -> None:
|
|
494
|
+
"""
|
|
495
|
+
Set sink description.
|
|
496
|
+
|
|
497
|
+
:param description: Description
|
|
498
|
+
"""
|
|
499
|
+
def setEnabled(self, enabled: bool) -> None:
|
|
500
|
+
"""
|
|
501
|
+
Enable or disable getting new frames.
|
|
502
|
+
|
|
503
|
+
Disabling will cause processFrame (for callback-based CvSinks) to not
|
|
504
|
+
be called and WaitForFrame() to not return. This can be used to save
|
|
505
|
+
processor resources when frames are not needed.
|
|
506
|
+
"""
|
|
507
|
+
class ImageSource(VideoSource):
|
|
508
|
+
"""
|
|
509
|
+
A base class for single image providing sources.
|
|
510
|
+
"""
|
|
511
|
+
def createBooleanProperty(self, name: str, defaultValue: bool, value: bool) -> VideoProperty:
|
|
512
|
+
"""
|
|
513
|
+
Create a boolean property.
|
|
514
|
+
|
|
515
|
+
:param name: Property name
|
|
516
|
+
:param defaultValue: Default value
|
|
517
|
+
:param value: Current value
|
|
518
|
+
|
|
519
|
+
:returns: Property
|
|
520
|
+
"""
|
|
521
|
+
def createIntegerProperty(self, name: str, minimum: typing.SupportsInt, maximum: typing.SupportsInt, step: typing.SupportsInt, defaultValue: typing.SupportsInt, value: typing.SupportsInt) -> VideoProperty:
|
|
522
|
+
"""
|
|
523
|
+
Create an integer property.
|
|
524
|
+
|
|
525
|
+
:param name: Property name
|
|
526
|
+
:param minimum: Minimum value
|
|
527
|
+
:param maximum: Maximum value
|
|
528
|
+
:param step: Step value
|
|
529
|
+
:param defaultValue: Default value
|
|
530
|
+
:param value: Current value
|
|
531
|
+
|
|
532
|
+
:returns: Property
|
|
533
|
+
"""
|
|
534
|
+
def createProperty(self, name: str, kind: VideoProperty.Kind, minimum: typing.SupportsInt, maximum: typing.SupportsInt, step: typing.SupportsInt, defaultValue: typing.SupportsInt, value: typing.SupportsInt) -> VideoProperty:
|
|
535
|
+
"""
|
|
536
|
+
Create a property.
|
|
537
|
+
|
|
538
|
+
:param name: Property name
|
|
539
|
+
:param kind: Property kind
|
|
540
|
+
:param minimum: Minimum value
|
|
541
|
+
:param maximum: Maximum value
|
|
542
|
+
:param step: Step value
|
|
543
|
+
:param defaultValue: Default value
|
|
544
|
+
:param value: Current value
|
|
545
|
+
|
|
546
|
+
:returns: Property
|
|
547
|
+
"""
|
|
548
|
+
def createStringProperty(self, name: str, value: str) -> VideoProperty:
|
|
549
|
+
"""
|
|
550
|
+
Create a string property.
|
|
551
|
+
|
|
552
|
+
:param name: Property name
|
|
553
|
+
:param value: Current value
|
|
554
|
+
|
|
555
|
+
:returns: Property
|
|
556
|
+
"""
|
|
557
|
+
def notifyError(self, msg: str) -> None:
|
|
558
|
+
"""
|
|
559
|
+
Signal sinks that an error has occurred. This should be called instead
|
|
560
|
+
of NotifyFrame when an error occurs.
|
|
561
|
+
|
|
562
|
+
:param msg: Notification message.
|
|
563
|
+
"""
|
|
564
|
+
def setConnected(self, connected: bool) -> None:
|
|
565
|
+
"""
|
|
566
|
+
Set source connection status. Defaults to true.
|
|
567
|
+
|
|
568
|
+
:param connected: True for connected, false for disconnected
|
|
569
|
+
"""
|
|
570
|
+
def setDescription(self, description: str) -> None:
|
|
571
|
+
"""
|
|
572
|
+
Set source description.
|
|
573
|
+
|
|
574
|
+
:param description: Description
|
|
575
|
+
"""
|
|
576
|
+
def setEnumPropertyChoices(self, property: VideoProperty, choices: list[str]) -> None:
|
|
577
|
+
"""
|
|
578
|
+
Configure enum property choices.
|
|
579
|
+
|
|
580
|
+
:param property: Property
|
|
581
|
+
:param choices: Choices
|
|
582
|
+
"""
|
|
583
|
+
class MjpegServer(VideoSink):
|
|
584
|
+
"""
|
|
585
|
+
A sink that acts as a MJPEG-over-HTTP network server.
|
|
586
|
+
"""
|
|
587
|
+
@typing.overload
|
|
588
|
+
def __init__(self) -> None:
|
|
589
|
+
...
|
|
590
|
+
@typing.overload
|
|
591
|
+
def __init__(self, name: str, listenAddress: str, port: typing.SupportsInt) -> None:
|
|
592
|
+
"""
|
|
593
|
+
Create a MJPEG-over-HTTP server sink.
|
|
594
|
+
|
|
595
|
+
:param name: Sink name (arbitrary unique identifier)
|
|
596
|
+
:param listenAddress: TCP listen address (empty string for all addresses)
|
|
597
|
+
:param port: TCP port number
|
|
598
|
+
"""
|
|
599
|
+
@typing.overload
|
|
600
|
+
def __init__(self, name: str, port: typing.SupportsInt) -> None:
|
|
601
|
+
"""
|
|
602
|
+
Create a MJPEG-over-HTTP server sink.
|
|
603
|
+
|
|
604
|
+
:param name: Sink name (arbitrary unique identifier)
|
|
605
|
+
:param port: TCP port number
|
|
606
|
+
"""
|
|
607
|
+
def getListenAddress(self) -> str:
|
|
608
|
+
"""
|
|
609
|
+
Get the listen address of the server.
|
|
610
|
+
"""
|
|
611
|
+
def getPort(self) -> int:
|
|
612
|
+
"""
|
|
613
|
+
Get the port number of the server.
|
|
614
|
+
"""
|
|
615
|
+
def setCompression(self, quality: typing.SupportsInt) -> None:
|
|
616
|
+
"""
|
|
617
|
+
Set the compression for clients that don't specify it.
|
|
618
|
+
|
|
619
|
+
Setting this will result in increased CPU usage for MJPEG source cameras
|
|
620
|
+
as it will decompress and recompress the image instead of using the
|
|
621
|
+
camera's MJPEG image directly.
|
|
622
|
+
|
|
623
|
+
:param quality: JPEG compression quality (0-100), -1 for unspecified
|
|
624
|
+
"""
|
|
625
|
+
def setDefaultCompression(self, quality: typing.SupportsInt) -> None:
|
|
626
|
+
"""
|
|
627
|
+
Set the default compression used for non-MJPEG sources. If not set,
|
|
628
|
+
80 is used. This function has no effect on MJPEG source cameras; use
|
|
629
|
+
SetCompression() instead to force recompression of MJPEG source images.
|
|
630
|
+
|
|
631
|
+
:param quality: JPEG compression quality (0-100)
|
|
632
|
+
"""
|
|
633
|
+
def setFPS(self, fps: typing.SupportsInt) -> None:
|
|
634
|
+
"""
|
|
635
|
+
Set the stream frames per second (FPS) for clients that don't specify it.
|
|
636
|
+
|
|
637
|
+
It is not necessary to set this if it is the same as the source FPS.
|
|
638
|
+
|
|
639
|
+
:param fps: FPS, 0 for unspecified
|
|
640
|
+
"""
|
|
641
|
+
def setResolution(self, width: typing.SupportsInt, height: typing.SupportsInt) -> None:
|
|
642
|
+
"""
|
|
643
|
+
Set the stream resolution for clients that don't specify it.
|
|
644
|
+
|
|
645
|
+
It is not necessary to set this if it is the same as the source
|
|
646
|
+
resolution.
|
|
647
|
+
|
|
648
|
+
Setting this different than the source resolution will result in
|
|
649
|
+
increased CPU usage, particularly for MJPEG source cameras, as it will
|
|
650
|
+
decompress, resize, and recompress the image, instead of using the
|
|
651
|
+
camera's MJPEG image directly.
|
|
652
|
+
|
|
653
|
+
:param width: width, 0 for unspecified
|
|
654
|
+
:param height: height, 0 for unspecified
|
|
655
|
+
"""
|
|
656
|
+
class RawEvent:
|
|
657
|
+
"""
|
|
658
|
+
Listener event
|
|
659
|
+
"""
|
|
660
|
+
class UsbCamera(VideoCamera):
|
|
661
|
+
"""
|
|
662
|
+
A source that represents a USB camera.
|
|
663
|
+
"""
|
|
664
|
+
@staticmethod
|
|
665
|
+
def enumerateUsbCameras() -> list[UsbCameraInfo]:
|
|
666
|
+
"""
|
|
667
|
+
Enumerate USB cameras on the local system.
|
|
668
|
+
|
|
669
|
+
:returns: Vector of USB camera information (one for each camera)
|
|
670
|
+
"""
|
|
671
|
+
@typing.overload
|
|
672
|
+
def __init__(self) -> None:
|
|
673
|
+
...
|
|
674
|
+
@typing.overload
|
|
675
|
+
def __init__(self, name: str, dev: typing.SupportsInt) -> None:
|
|
676
|
+
"""
|
|
677
|
+
Create a source for a USB camera based on device number.
|
|
678
|
+
|
|
679
|
+
:param name: Source name (arbitrary unique identifier)
|
|
680
|
+
:param dev: Device number (e.g. 0 for /dev/video0)
|
|
681
|
+
"""
|
|
682
|
+
@typing.overload
|
|
683
|
+
def __init__(self, name: str, path: str) -> None:
|
|
684
|
+
"""
|
|
685
|
+
Create a source for a USB camera based on device path.
|
|
686
|
+
|
|
687
|
+
:param name: Source name (arbitrary unique identifier)
|
|
688
|
+
:param path: Path to device (e.g. "/dev/video0" on Linux)
|
|
689
|
+
"""
|
|
690
|
+
def getInfo(self) -> UsbCameraInfo:
|
|
691
|
+
"""
|
|
692
|
+
Get the full camera information for the device.
|
|
693
|
+
"""
|
|
694
|
+
def getPath(self) -> str:
|
|
695
|
+
"""
|
|
696
|
+
Get the path to the device.
|
|
697
|
+
"""
|
|
698
|
+
def setConnectVerbose(self, level: typing.SupportsInt) -> None:
|
|
699
|
+
"""
|
|
700
|
+
Set how verbose the camera connection messages are.
|
|
701
|
+
|
|
702
|
+
:param level: 0=don't display Connecting message, 1=do display message
|
|
703
|
+
"""
|
|
704
|
+
def setPath(self, path: str) -> None:
|
|
705
|
+
"""
|
|
706
|
+
Change the path to the device.
|
|
707
|
+
"""
|
|
708
|
+
class UsbCameraInfo:
|
|
709
|
+
"""
|
|
710
|
+
USB camera information
|
|
711
|
+
"""
|
|
712
|
+
def __init__(self) -> None:
|
|
713
|
+
...
|
|
714
|
+
@property
|
|
715
|
+
def dev(self) -> int:
|
|
716
|
+
"""
|
|
717
|
+
Device number (e.g. N in '/dev/videoN' on Linux)
|
|
718
|
+
"""
|
|
719
|
+
@dev.setter
|
|
720
|
+
def dev(self, arg0: typing.SupportsInt) -> None:
|
|
721
|
+
...
|
|
722
|
+
@property
|
|
723
|
+
def name(self) -> str:
|
|
724
|
+
"""
|
|
725
|
+
Vendor/model name of the camera as provided by the USB driver
|
|
726
|
+
"""
|
|
727
|
+
@name.setter
|
|
728
|
+
def name(self, arg0: str) -> None:
|
|
729
|
+
...
|
|
730
|
+
@property
|
|
731
|
+
def otherPaths(self) -> list[str]:
|
|
732
|
+
"""
|
|
733
|
+
Other path aliases to device (e.g. '/dev/v4l/by-id/...' etc on Linux)
|
|
734
|
+
"""
|
|
735
|
+
@otherPaths.setter
|
|
736
|
+
def otherPaths(self, arg0: collections.abc.Sequence[str]) -> None:
|
|
737
|
+
...
|
|
738
|
+
@property
|
|
739
|
+
def path(self) -> str:
|
|
740
|
+
"""
|
|
741
|
+
Path to device if available (e.g. '/dev/video0' on Linux)
|
|
742
|
+
"""
|
|
743
|
+
@path.setter
|
|
744
|
+
def path(self, arg0: str) -> None:
|
|
745
|
+
...
|
|
746
|
+
@property
|
|
747
|
+
def productId(self) -> int:
|
|
748
|
+
"""
|
|
749
|
+
USB Product Id
|
|
750
|
+
"""
|
|
751
|
+
@productId.setter
|
|
752
|
+
def productId(self, arg0: typing.SupportsInt) -> None:
|
|
753
|
+
...
|
|
754
|
+
@property
|
|
755
|
+
def vendorId(self) -> int:
|
|
756
|
+
"""
|
|
757
|
+
USB Vendor Id
|
|
758
|
+
"""
|
|
759
|
+
@vendorId.setter
|
|
760
|
+
def vendorId(self, arg0: typing.SupportsInt) -> None:
|
|
761
|
+
...
|
|
762
|
+
class VideoCamera(VideoSource):
|
|
763
|
+
"""
|
|
764
|
+
A source that represents a video camera.
|
|
765
|
+
"""
|
|
766
|
+
class WhiteBalance:
|
|
767
|
+
"""
|
|
768
|
+
White balance.
|
|
769
|
+
|
|
770
|
+
Members:
|
|
771
|
+
|
|
772
|
+
kFixedIndoor : Fixed indoor white balance.
|
|
773
|
+
|
|
774
|
+
kFixedOutdoor1 : Fixed outdoor white balance 1.
|
|
775
|
+
|
|
776
|
+
kFixedOutdoor2 : Fixed outdoor white balance 2.
|
|
777
|
+
|
|
778
|
+
kFixedFluorescent1 : Fixed fluorescent white balance 1.
|
|
779
|
+
|
|
780
|
+
kFixedFlourescent2 : Fixed fluorescent white balance 2.
|
|
781
|
+
"""
|
|
782
|
+
__members__: typing.ClassVar[dict[str, VideoCamera.WhiteBalance]] # value = {'kFixedIndoor': <WhiteBalance.kFixedIndoor: 3000>, 'kFixedOutdoor1': <WhiteBalance.kFixedOutdoor1: 4000>, 'kFixedOutdoor2': <WhiteBalance.kFixedOutdoor2: 5000>, 'kFixedFluorescent1': <WhiteBalance.kFixedFluorescent1: 5100>, 'kFixedFlourescent2': <WhiteBalance.kFixedFlourescent2: 5200>}
|
|
783
|
+
kFixedFlourescent2: typing.ClassVar[VideoCamera.WhiteBalance] # value = <WhiteBalance.kFixedFlourescent2: 5200>
|
|
784
|
+
kFixedFluorescent1: typing.ClassVar[VideoCamera.WhiteBalance] # value = <WhiteBalance.kFixedFluorescent1: 5100>
|
|
785
|
+
kFixedIndoor: typing.ClassVar[VideoCamera.WhiteBalance] # value = <WhiteBalance.kFixedIndoor: 3000>
|
|
786
|
+
kFixedOutdoor1: typing.ClassVar[VideoCamera.WhiteBalance] # value = <WhiteBalance.kFixedOutdoor1: 4000>
|
|
787
|
+
kFixedOutdoor2: typing.ClassVar[VideoCamera.WhiteBalance] # value = <WhiteBalance.kFixedOutdoor2: 5000>
|
|
788
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
789
|
+
...
|
|
790
|
+
def __getstate__(self) -> int:
|
|
791
|
+
...
|
|
792
|
+
def __hash__(self) -> int:
|
|
793
|
+
...
|
|
794
|
+
def __index__(self) -> int:
|
|
795
|
+
...
|
|
796
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
797
|
+
...
|
|
798
|
+
def __int__(self) -> int:
|
|
799
|
+
...
|
|
800
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
801
|
+
...
|
|
802
|
+
def __repr__(self) -> str:
|
|
803
|
+
...
|
|
804
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
805
|
+
...
|
|
806
|
+
def __str__(self) -> str:
|
|
807
|
+
...
|
|
808
|
+
@property
|
|
809
|
+
def name(self) -> str:
|
|
810
|
+
...
|
|
811
|
+
@property
|
|
812
|
+
def value(self) -> int:
|
|
813
|
+
...
|
|
814
|
+
def __init__(self) -> None:
|
|
815
|
+
...
|
|
816
|
+
def getBrightness(self) -> int:
|
|
817
|
+
"""
|
|
818
|
+
Get the brightness, as a percentage (0-100).
|
|
819
|
+
"""
|
|
820
|
+
def setBrightness(self, brightness: typing.SupportsInt) -> None:
|
|
821
|
+
"""
|
|
822
|
+
Set the brightness, as a percentage (0-100).
|
|
823
|
+
"""
|
|
824
|
+
def setExposureAuto(self) -> None:
|
|
825
|
+
"""
|
|
826
|
+
Set the exposure to auto aperture.
|
|
827
|
+
"""
|
|
828
|
+
def setExposureHoldCurrent(self) -> None:
|
|
829
|
+
"""
|
|
830
|
+
Set the exposure to hold current.
|
|
831
|
+
"""
|
|
832
|
+
def setExposureManual(self, value: typing.SupportsInt) -> None:
|
|
833
|
+
"""
|
|
834
|
+
Set the exposure to manual, as a percentage (0-100).
|
|
835
|
+
"""
|
|
836
|
+
def setWhiteBalanceAuto(self) -> None:
|
|
837
|
+
"""
|
|
838
|
+
Set the white balance to auto.
|
|
839
|
+
"""
|
|
840
|
+
def setWhiteBalanceHoldCurrent(self) -> None:
|
|
841
|
+
"""
|
|
842
|
+
Set the white balance to hold current.
|
|
843
|
+
"""
|
|
844
|
+
def setWhiteBalanceManual(self, value: typing.SupportsInt) -> None:
|
|
845
|
+
"""
|
|
846
|
+
Set the white balance to manual, with specified color temperature.
|
|
847
|
+
"""
|
|
848
|
+
class VideoEvent(RawEvent):
|
|
849
|
+
"""
|
|
850
|
+
An event generated by the library and provided to event listeners.
|
|
851
|
+
"""
|
|
852
|
+
def __init__(self) -> None:
|
|
853
|
+
...
|
|
854
|
+
def getProperty(self) -> VideoProperty:
|
|
855
|
+
"""
|
|
856
|
+
Returns the property associated with the event (if any).
|
|
857
|
+
|
|
858
|
+
:returns: The property associated with the event (if any).
|
|
859
|
+
"""
|
|
860
|
+
def getSink(self) -> VideoSink:
|
|
861
|
+
"""
|
|
862
|
+
Returns the sink associated with the event (if any).
|
|
863
|
+
|
|
864
|
+
:returns: The sink associated with the event (if any).
|
|
865
|
+
"""
|
|
866
|
+
def getSource(self) -> VideoSource:
|
|
867
|
+
"""
|
|
868
|
+
Returns the source associated with the event (if any).
|
|
869
|
+
|
|
870
|
+
:returns: The source associated with the event (if any).
|
|
871
|
+
"""
|
|
872
|
+
class VideoListener:
|
|
873
|
+
"""
|
|
874
|
+
An event listener. This calls back to a designated callback function when
|
|
875
|
+
an event matching the specified mask is generated by the library.
|
|
876
|
+
"""
|
|
877
|
+
@typing.overload
|
|
878
|
+
def __init__(self) -> None:
|
|
879
|
+
...
|
|
880
|
+
@typing.overload
|
|
881
|
+
def __init__(self, callback: collections.abc.Callable[[VideoEvent], None], eventMask: typing.SupportsInt, immediateNotify: bool) -> None:
|
|
882
|
+
"""
|
|
883
|
+
Create an event listener.
|
|
884
|
+
|
|
885
|
+
:param callback: Callback function
|
|
886
|
+
:param eventMask: Bitmask of VideoEvent::Kind values
|
|
887
|
+
:param immediateNotify: Whether callback should be immediately called with
|
|
888
|
+
a representative set of events for the current library state.
|
|
889
|
+
"""
|
|
890
|
+
class VideoMode:
|
|
891
|
+
"""
|
|
892
|
+
Video mode
|
|
893
|
+
"""
|
|
894
|
+
class PixelFormat:
|
|
895
|
+
"""
|
|
896
|
+
Members:
|
|
897
|
+
|
|
898
|
+
kUnknown
|
|
899
|
+
|
|
900
|
+
kMJPEG
|
|
901
|
+
|
|
902
|
+
kYUYV
|
|
903
|
+
|
|
904
|
+
kRGB565
|
|
905
|
+
|
|
906
|
+
kBGR
|
|
907
|
+
|
|
908
|
+
kGray
|
|
909
|
+
|
|
910
|
+
kY16
|
|
911
|
+
|
|
912
|
+
kUYVY
|
|
913
|
+
|
|
914
|
+
kBGRA
|
|
915
|
+
"""
|
|
916
|
+
__members__: typing.ClassVar[dict[str, VideoMode.PixelFormat]] # value = {'kUnknown': <PixelFormat.kUnknown: 0>, 'kMJPEG': <PixelFormat.kMJPEG: 1>, 'kYUYV': <PixelFormat.kYUYV: 2>, 'kRGB565': <PixelFormat.kRGB565: 3>, 'kBGR': <PixelFormat.kBGR: 4>, 'kGray': <PixelFormat.kGray: 5>, 'kY16': <PixelFormat.kY16: 6>, 'kUYVY': <PixelFormat.kUYVY: 7>, 'kBGRA': <PixelFormat.kBGRA: 8>}
|
|
917
|
+
kBGR: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kBGR: 4>
|
|
918
|
+
kBGRA: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kBGRA: 8>
|
|
919
|
+
kGray: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kGray: 5>
|
|
920
|
+
kMJPEG: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kMJPEG: 1>
|
|
921
|
+
kRGB565: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kRGB565: 3>
|
|
922
|
+
kUYVY: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kUYVY: 7>
|
|
923
|
+
kUnknown: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kUnknown: 0>
|
|
924
|
+
kY16: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kY16: 6>
|
|
925
|
+
kYUYV: typing.ClassVar[VideoMode.PixelFormat] # value = <PixelFormat.kYUYV: 2>
|
|
926
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
927
|
+
...
|
|
928
|
+
def __getstate__(self) -> int:
|
|
929
|
+
...
|
|
930
|
+
def __hash__(self) -> int:
|
|
931
|
+
...
|
|
932
|
+
def __index__(self) -> int:
|
|
933
|
+
...
|
|
934
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
935
|
+
...
|
|
936
|
+
def __int__(self) -> int:
|
|
937
|
+
...
|
|
938
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
939
|
+
...
|
|
940
|
+
def __repr__(self) -> str:
|
|
941
|
+
...
|
|
942
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
943
|
+
...
|
|
944
|
+
def __str__(self) -> str:
|
|
945
|
+
...
|
|
946
|
+
@property
|
|
947
|
+
def name(self) -> str:
|
|
948
|
+
...
|
|
949
|
+
@property
|
|
950
|
+
def value(self) -> int:
|
|
951
|
+
...
|
|
952
|
+
__hash__: typing.ClassVar[None] = None
|
|
953
|
+
def __eq__(self, arg0: VideoMode) -> bool:
|
|
954
|
+
...
|
|
955
|
+
@typing.overload
|
|
956
|
+
def __init__(self) -> None:
|
|
957
|
+
...
|
|
958
|
+
@typing.overload
|
|
959
|
+
def __init__(self, pixelFormat_: VideoMode.PixelFormat, width_: typing.SupportsInt, height_: typing.SupportsInt, fps_: typing.SupportsInt) -> None:
|
|
960
|
+
...
|
|
961
|
+
def compareWithoutFps(self, other: VideoMode) -> bool:
|
|
962
|
+
...
|
|
963
|
+
@property
|
|
964
|
+
def fps(self) -> int:
|
|
965
|
+
...
|
|
966
|
+
@fps.setter
|
|
967
|
+
def fps(self, arg0: typing.SupportsInt) -> None:
|
|
968
|
+
...
|
|
969
|
+
@property
|
|
970
|
+
def height(self) -> int:
|
|
971
|
+
...
|
|
972
|
+
@height.setter
|
|
973
|
+
def height(self, arg0: typing.SupportsInt) -> None:
|
|
974
|
+
...
|
|
975
|
+
@property
|
|
976
|
+
def pixelFormat(self) -> int:
|
|
977
|
+
...
|
|
978
|
+
@pixelFormat.setter
|
|
979
|
+
def pixelFormat(self, arg0: typing.SupportsInt) -> None:
|
|
980
|
+
...
|
|
981
|
+
@property
|
|
982
|
+
def width(self) -> int:
|
|
983
|
+
...
|
|
984
|
+
@width.setter
|
|
985
|
+
def width(self, arg0: typing.SupportsInt) -> None:
|
|
986
|
+
...
|
|
987
|
+
class VideoProperty:
|
|
988
|
+
"""
|
|
989
|
+
A source or sink property.
|
|
990
|
+
"""
|
|
991
|
+
class Kind:
|
|
992
|
+
"""
|
|
993
|
+
Members:
|
|
994
|
+
|
|
995
|
+
kNone : No specific property.
|
|
996
|
+
|
|
997
|
+
kBoolean : Boolean property.
|
|
998
|
+
|
|
999
|
+
kInteger : Integer property.
|
|
1000
|
+
|
|
1001
|
+
kString : String property.
|
|
1002
|
+
|
|
1003
|
+
kEnum : Enum property.
|
|
1004
|
+
"""
|
|
1005
|
+
__members__: typing.ClassVar[dict[str, VideoProperty.Kind]] # value = {'kNone': <Kind.kNone: 0>, 'kBoolean': <Kind.kBoolean: 1>, 'kInteger': <Kind.kInteger: 2>, 'kString': <Kind.kString: 4>, 'kEnum': <Kind.kEnum: 8>}
|
|
1006
|
+
kBoolean: typing.ClassVar[VideoProperty.Kind] # value = <Kind.kBoolean: 1>
|
|
1007
|
+
kEnum: typing.ClassVar[VideoProperty.Kind] # value = <Kind.kEnum: 8>
|
|
1008
|
+
kInteger: typing.ClassVar[VideoProperty.Kind] # value = <Kind.kInteger: 2>
|
|
1009
|
+
kNone: typing.ClassVar[VideoProperty.Kind] # value = <Kind.kNone: 0>
|
|
1010
|
+
kString: typing.ClassVar[VideoProperty.Kind] # value = <Kind.kString: 4>
|
|
1011
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1012
|
+
...
|
|
1013
|
+
def __getstate__(self) -> int:
|
|
1014
|
+
...
|
|
1015
|
+
def __hash__(self) -> int:
|
|
1016
|
+
...
|
|
1017
|
+
def __index__(self) -> int:
|
|
1018
|
+
...
|
|
1019
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
1020
|
+
...
|
|
1021
|
+
def __int__(self) -> int:
|
|
1022
|
+
...
|
|
1023
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1024
|
+
...
|
|
1025
|
+
def __repr__(self) -> str:
|
|
1026
|
+
...
|
|
1027
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
1028
|
+
...
|
|
1029
|
+
def __str__(self) -> str:
|
|
1030
|
+
...
|
|
1031
|
+
@property
|
|
1032
|
+
def name(self) -> str:
|
|
1033
|
+
...
|
|
1034
|
+
@property
|
|
1035
|
+
def value(self) -> int:
|
|
1036
|
+
...
|
|
1037
|
+
def __init__(self) -> None:
|
|
1038
|
+
...
|
|
1039
|
+
def get(self) -> int:
|
|
1040
|
+
"""
|
|
1041
|
+
Returns property value.
|
|
1042
|
+
|
|
1043
|
+
:returns: Property value.
|
|
1044
|
+
"""
|
|
1045
|
+
def getChoices(self) -> list[str]:
|
|
1046
|
+
"""
|
|
1047
|
+
Returns the possible values for the enum property value.
|
|
1048
|
+
|
|
1049
|
+
This function is enum-specific.
|
|
1050
|
+
|
|
1051
|
+
:returns: The possible values for the enum property value.
|
|
1052
|
+
"""
|
|
1053
|
+
def getDefault(self) -> int:
|
|
1054
|
+
"""
|
|
1055
|
+
Returns property default value.
|
|
1056
|
+
|
|
1057
|
+
:returns: Property default value.
|
|
1058
|
+
"""
|
|
1059
|
+
def getKind(self) -> VideoProperty.Kind:
|
|
1060
|
+
"""
|
|
1061
|
+
Returns property kind.
|
|
1062
|
+
|
|
1063
|
+
:returns: Property kind.
|
|
1064
|
+
"""
|
|
1065
|
+
def getLastStatus(self) -> int:
|
|
1066
|
+
"""
|
|
1067
|
+
Returns the last status.
|
|
1068
|
+
|
|
1069
|
+
:returns: The last status.
|
|
1070
|
+
"""
|
|
1071
|
+
def getMax(self) -> int:
|
|
1072
|
+
"""
|
|
1073
|
+
Returns property maximum value.
|
|
1074
|
+
|
|
1075
|
+
:returns: Property maximum value.
|
|
1076
|
+
"""
|
|
1077
|
+
def getMin(self) -> int:
|
|
1078
|
+
"""
|
|
1079
|
+
Returns property minimum value.
|
|
1080
|
+
|
|
1081
|
+
:returns: Property minimum value.
|
|
1082
|
+
"""
|
|
1083
|
+
def getName(self) -> str:
|
|
1084
|
+
"""
|
|
1085
|
+
Returns property name.
|
|
1086
|
+
|
|
1087
|
+
:returns: Property name.
|
|
1088
|
+
"""
|
|
1089
|
+
def getStep(self) -> int:
|
|
1090
|
+
"""
|
|
1091
|
+
Returns property step size.
|
|
1092
|
+
|
|
1093
|
+
:returns: Property step size.
|
|
1094
|
+
"""
|
|
1095
|
+
@typing.overload
|
|
1096
|
+
def getString(self) -> str:
|
|
1097
|
+
"""
|
|
1098
|
+
Returns the string property value.
|
|
1099
|
+
|
|
1100
|
+
This function is string-specific.
|
|
1101
|
+
|
|
1102
|
+
:returns: The string property value.
|
|
1103
|
+
"""
|
|
1104
|
+
@typing.overload
|
|
1105
|
+
def getString(self, buf: list[str]) -> str:
|
|
1106
|
+
"""
|
|
1107
|
+
Returns the string property value as a reference to the given buffer.
|
|
1108
|
+
|
|
1109
|
+
This function is string-specific.
|
|
1110
|
+
|
|
1111
|
+
:param buf: The backing storage to which to write the property value.
|
|
1112
|
+
|
|
1113
|
+
:returns: The string property value as a reference to the given buffer.
|
|
1114
|
+
"""
|
|
1115
|
+
def isBoolean(self) -> bool:
|
|
1116
|
+
"""
|
|
1117
|
+
Returns true if property is a boolean.
|
|
1118
|
+
|
|
1119
|
+
:returns: True if property is a boolean.
|
|
1120
|
+
"""
|
|
1121
|
+
def isEnum(self) -> bool:
|
|
1122
|
+
"""
|
|
1123
|
+
Returns true if property is an enum.
|
|
1124
|
+
|
|
1125
|
+
:returns: True if property is an enum.
|
|
1126
|
+
"""
|
|
1127
|
+
def isInteger(self) -> bool:
|
|
1128
|
+
"""
|
|
1129
|
+
Returns true if property is an integer.
|
|
1130
|
+
|
|
1131
|
+
:returns: True if property is an integer.
|
|
1132
|
+
"""
|
|
1133
|
+
def isString(self) -> bool:
|
|
1134
|
+
"""
|
|
1135
|
+
Returns true if property is a string.
|
|
1136
|
+
|
|
1137
|
+
:returns: True if property is a string.
|
|
1138
|
+
"""
|
|
1139
|
+
def set(self, value: typing.SupportsInt) -> None:
|
|
1140
|
+
"""
|
|
1141
|
+
Sets property value.
|
|
1142
|
+
|
|
1143
|
+
:param value: Property value.
|
|
1144
|
+
"""
|
|
1145
|
+
def setString(self, value: str) -> None:
|
|
1146
|
+
"""
|
|
1147
|
+
Sets the string property value.
|
|
1148
|
+
|
|
1149
|
+
This function is string-specific.
|
|
1150
|
+
|
|
1151
|
+
:param value: String property value.
|
|
1152
|
+
"""
|
|
1153
|
+
class VideoSink:
|
|
1154
|
+
"""
|
|
1155
|
+
A sink for video that accepts a sequence of frames.
|
|
1156
|
+
"""
|
|
1157
|
+
class Kind:
|
|
1158
|
+
"""
|
|
1159
|
+
Members:
|
|
1160
|
+
|
|
1161
|
+
kUnknown : Unknown sink type.
|
|
1162
|
+
|
|
1163
|
+
kMjpeg : MJPEG video sink.
|
|
1164
|
+
|
|
1165
|
+
kCv : CV video sink.
|
|
1166
|
+
|
|
1167
|
+
kRaw : Raw video sink.
|
|
1168
|
+
"""
|
|
1169
|
+
__members__: typing.ClassVar[dict[str, VideoSink.Kind]] # value = {'kUnknown': <Kind.kUnknown: 0>, 'kMjpeg': <Kind.kMjpeg: 2>, 'kCv': <Kind.kCv: 4>, 'kRaw': <Kind.kRaw: 8>}
|
|
1170
|
+
kCv: typing.ClassVar[VideoSink.Kind] # value = <Kind.kCv: 4>
|
|
1171
|
+
kMjpeg: typing.ClassVar[VideoSink.Kind] # value = <Kind.kMjpeg: 2>
|
|
1172
|
+
kRaw: typing.ClassVar[VideoSink.Kind] # value = <Kind.kRaw: 8>
|
|
1173
|
+
kUnknown: typing.ClassVar[VideoSink.Kind] # value = <Kind.kUnknown: 0>
|
|
1174
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1175
|
+
...
|
|
1176
|
+
def __getstate__(self) -> int:
|
|
1177
|
+
...
|
|
1178
|
+
def __hash__(self) -> int:
|
|
1179
|
+
...
|
|
1180
|
+
def __index__(self) -> int:
|
|
1181
|
+
...
|
|
1182
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
1183
|
+
...
|
|
1184
|
+
def __int__(self) -> int:
|
|
1185
|
+
...
|
|
1186
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1187
|
+
...
|
|
1188
|
+
def __repr__(self) -> str:
|
|
1189
|
+
...
|
|
1190
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
1191
|
+
...
|
|
1192
|
+
def __str__(self) -> str:
|
|
1193
|
+
...
|
|
1194
|
+
@property
|
|
1195
|
+
def name(self) -> str:
|
|
1196
|
+
...
|
|
1197
|
+
@property
|
|
1198
|
+
def value(self) -> int:
|
|
1199
|
+
...
|
|
1200
|
+
__hash__: typing.ClassVar[None] = None
|
|
1201
|
+
@staticmethod
|
|
1202
|
+
def enumerateSinks() -> list[VideoSink]:
|
|
1203
|
+
"""
|
|
1204
|
+
Enumerate all existing sinks.
|
|
1205
|
+
|
|
1206
|
+
:returns: Vector of sinks.
|
|
1207
|
+
"""
|
|
1208
|
+
def __eq__(self, arg0: VideoSink) -> bool:
|
|
1209
|
+
...
|
|
1210
|
+
def __init__(self) -> None:
|
|
1211
|
+
...
|
|
1212
|
+
def enumerateProperties(self) -> list[VideoProperty]:
|
|
1213
|
+
"""
|
|
1214
|
+
Enumerate all properties of this sink.
|
|
1215
|
+
"""
|
|
1216
|
+
def getConfigJson(self) -> str:
|
|
1217
|
+
"""
|
|
1218
|
+
Get a JSON configuration string.
|
|
1219
|
+
|
|
1220
|
+
:returns: JSON configuration string
|
|
1221
|
+
"""
|
|
1222
|
+
def getConfigJsonObject(self) -> wpiutil.json:
|
|
1223
|
+
"""
|
|
1224
|
+
Get a JSON configuration object.
|
|
1225
|
+
|
|
1226
|
+
:returns: JSON configuration object
|
|
1227
|
+
"""
|
|
1228
|
+
def getDescription(self) -> str:
|
|
1229
|
+
"""
|
|
1230
|
+
Get the sink description. This is sink-kind specific.
|
|
1231
|
+
"""
|
|
1232
|
+
def getHandle(self) -> int:
|
|
1233
|
+
"""
|
|
1234
|
+
Returns the VideoSink handle.
|
|
1235
|
+
|
|
1236
|
+
:returns: The VideoSink handle.
|
|
1237
|
+
"""
|
|
1238
|
+
def getKind(self) -> VideoSink.Kind:
|
|
1239
|
+
"""
|
|
1240
|
+
Get the kind of the sink.
|
|
1241
|
+
"""
|
|
1242
|
+
def getLastStatus(self) -> int:
|
|
1243
|
+
...
|
|
1244
|
+
def getName(self) -> str:
|
|
1245
|
+
"""
|
|
1246
|
+
Get the name of the sink. The name is an arbitrary identifier
|
|
1247
|
+
provided when the sink is created, and should be unique.
|
|
1248
|
+
"""
|
|
1249
|
+
def getProperty(self, name: str) -> VideoProperty:
|
|
1250
|
+
"""
|
|
1251
|
+
Get a property of the sink.
|
|
1252
|
+
|
|
1253
|
+
:param name: Property name
|
|
1254
|
+
|
|
1255
|
+
:returns: Property (kind Property::kNone if no property with
|
|
1256
|
+
the given name exists)
|
|
1257
|
+
"""
|
|
1258
|
+
def getSource(self) -> VideoSource:
|
|
1259
|
+
"""
|
|
1260
|
+
Get the connected source.
|
|
1261
|
+
|
|
1262
|
+
:returns: Connected source (empty if none connected).
|
|
1263
|
+
"""
|
|
1264
|
+
def getSourceProperty(self, name: str) -> VideoProperty:
|
|
1265
|
+
"""
|
|
1266
|
+
Get a property of the associated source.
|
|
1267
|
+
|
|
1268
|
+
:param name: Property name
|
|
1269
|
+
|
|
1270
|
+
:returns: Property (kind Property::kNone if no property with
|
|
1271
|
+
the given name exists or no source connected)
|
|
1272
|
+
"""
|
|
1273
|
+
@typing.overload
|
|
1274
|
+
def setConfigJson(self, config: str) -> bool:
|
|
1275
|
+
"""
|
|
1276
|
+
Set properties from a JSON configuration string.
|
|
1277
|
+
|
|
1278
|
+
The format of the JSON input is:
|
|
1279
|
+
|
|
1280
|
+
::
|
|
1281
|
+
|
|
1282
|
+
{
|
|
1283
|
+
"properties": [
|
|
1284
|
+
{
|
|
1285
|
+
"name": property name
|
|
1286
|
+
"value": property value
|
|
1287
|
+
}
|
|
1288
|
+
]
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
:param config: configuration
|
|
1292
|
+
|
|
1293
|
+
:returns: True if set successfully
|
|
1294
|
+
"""
|
|
1295
|
+
@typing.overload
|
|
1296
|
+
def setConfigJson(self, config: wpiutil.json) -> bool:
|
|
1297
|
+
"""
|
|
1298
|
+
Set properties from a JSON configuration object.
|
|
1299
|
+
|
|
1300
|
+
:param config: configuration
|
|
1301
|
+
|
|
1302
|
+
:returns: True if set successfully
|
|
1303
|
+
"""
|
|
1304
|
+
def setSource(self, source: VideoSource) -> None:
|
|
1305
|
+
"""
|
|
1306
|
+
Configure which source should provide frames to this sink. Each sink
|
|
1307
|
+
can accept frames from only a single source, but a single source can
|
|
1308
|
+
provide frames to multiple clients.
|
|
1309
|
+
|
|
1310
|
+
:param source: Source
|
|
1311
|
+
"""
|
|
1312
|
+
class VideoSource:
|
|
1313
|
+
"""
|
|
1314
|
+
A source for video that provides a sequence of frames.
|
|
1315
|
+
"""
|
|
1316
|
+
class ConnectionStrategy:
|
|
1317
|
+
"""
|
|
1318
|
+
Connection strategy. Used for SetConnectionStrategy().
|
|
1319
|
+
|
|
1320
|
+
Members:
|
|
1321
|
+
|
|
1322
|
+
kConnectionAutoManage : Automatically connect or disconnect based on whether any sinks are
|
|
1323
|
+
connected to this source. This is the default behavior.
|
|
1324
|
+
|
|
1325
|
+
kConnectionKeepOpen : Try to keep the connection open regardless of whether any sinks are
|
|
1326
|
+
connected.
|
|
1327
|
+
|
|
1328
|
+
kConnectionForceClose : Never open the connection. If this is set when the connection is open,
|
|
1329
|
+
close the connection.
|
|
1330
|
+
"""
|
|
1331
|
+
__members__: typing.ClassVar[dict[str, VideoSource.ConnectionStrategy]] # value = {'kConnectionAutoManage': <ConnectionStrategy.kConnectionAutoManage: 0>, 'kConnectionKeepOpen': <ConnectionStrategy.kConnectionKeepOpen: 1>, 'kConnectionForceClose': <ConnectionStrategy.kConnectionForceClose: 2>}
|
|
1332
|
+
kConnectionAutoManage: typing.ClassVar[VideoSource.ConnectionStrategy] # value = <ConnectionStrategy.kConnectionAutoManage: 0>
|
|
1333
|
+
kConnectionForceClose: typing.ClassVar[VideoSource.ConnectionStrategy] # value = <ConnectionStrategy.kConnectionForceClose: 2>
|
|
1334
|
+
kConnectionKeepOpen: typing.ClassVar[VideoSource.ConnectionStrategy] # value = <ConnectionStrategy.kConnectionKeepOpen: 1>
|
|
1335
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1336
|
+
...
|
|
1337
|
+
def __getstate__(self) -> int:
|
|
1338
|
+
...
|
|
1339
|
+
def __hash__(self) -> int:
|
|
1340
|
+
...
|
|
1341
|
+
def __index__(self) -> int:
|
|
1342
|
+
...
|
|
1343
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
1344
|
+
...
|
|
1345
|
+
def __int__(self) -> int:
|
|
1346
|
+
...
|
|
1347
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1348
|
+
...
|
|
1349
|
+
def __repr__(self) -> str:
|
|
1350
|
+
...
|
|
1351
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
1352
|
+
...
|
|
1353
|
+
def __str__(self) -> str:
|
|
1354
|
+
...
|
|
1355
|
+
@property
|
|
1356
|
+
def name(self) -> str:
|
|
1357
|
+
...
|
|
1358
|
+
@property
|
|
1359
|
+
def value(self) -> int:
|
|
1360
|
+
...
|
|
1361
|
+
class Kind:
|
|
1362
|
+
"""
|
|
1363
|
+
Video source kind.
|
|
1364
|
+
|
|
1365
|
+
Members:
|
|
1366
|
+
|
|
1367
|
+
kUnknown : Unknown video source.
|
|
1368
|
+
|
|
1369
|
+
kUsb : USB video source.
|
|
1370
|
+
|
|
1371
|
+
kHttp : HTTP video source.
|
|
1372
|
+
|
|
1373
|
+
kCv : CV video source.
|
|
1374
|
+
|
|
1375
|
+
kRaw : Raw video source.
|
|
1376
|
+
"""
|
|
1377
|
+
__members__: typing.ClassVar[dict[str, VideoSource.Kind]] # value = {'kUnknown': <Kind.kUnknown: 0>, 'kUsb': <Kind.kUsb: 1>, 'kHttp': <Kind.kHttp: 2>, 'kCv': <Kind.kCv: 4>, 'kRaw': <Kind.kRaw: 8>}
|
|
1378
|
+
kCv: typing.ClassVar[VideoSource.Kind] # value = <Kind.kCv: 4>
|
|
1379
|
+
kHttp: typing.ClassVar[VideoSource.Kind] # value = <Kind.kHttp: 2>
|
|
1380
|
+
kRaw: typing.ClassVar[VideoSource.Kind] # value = <Kind.kRaw: 8>
|
|
1381
|
+
kUnknown: typing.ClassVar[VideoSource.Kind] # value = <Kind.kUnknown: 0>
|
|
1382
|
+
kUsb: typing.ClassVar[VideoSource.Kind] # value = <Kind.kUsb: 1>
|
|
1383
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
1384
|
+
...
|
|
1385
|
+
def __getstate__(self) -> int:
|
|
1386
|
+
...
|
|
1387
|
+
def __hash__(self) -> int:
|
|
1388
|
+
...
|
|
1389
|
+
def __index__(self) -> int:
|
|
1390
|
+
...
|
|
1391
|
+
def __init__(self, value: typing.SupportsInt) -> None:
|
|
1392
|
+
...
|
|
1393
|
+
def __int__(self) -> int:
|
|
1394
|
+
...
|
|
1395
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
1396
|
+
...
|
|
1397
|
+
def __repr__(self) -> str:
|
|
1398
|
+
...
|
|
1399
|
+
def __setstate__(self, state: typing.SupportsInt) -> None:
|
|
1400
|
+
...
|
|
1401
|
+
def __str__(self) -> str:
|
|
1402
|
+
...
|
|
1403
|
+
@property
|
|
1404
|
+
def name(self) -> str:
|
|
1405
|
+
...
|
|
1406
|
+
@property
|
|
1407
|
+
def value(self) -> int:
|
|
1408
|
+
...
|
|
1409
|
+
__hash__: typing.ClassVar[None] = None
|
|
1410
|
+
@staticmethod
|
|
1411
|
+
def enumerateSources() -> list[VideoSource]:
|
|
1412
|
+
"""
|
|
1413
|
+
Enumerate all existing sources.
|
|
1414
|
+
|
|
1415
|
+
:returns: Vector of sources.
|
|
1416
|
+
"""
|
|
1417
|
+
def __eq__(self, arg0: VideoSource) -> bool:
|
|
1418
|
+
...
|
|
1419
|
+
def __init__(self) -> None:
|
|
1420
|
+
...
|
|
1421
|
+
def enumerateProperties(self) -> list[VideoProperty]:
|
|
1422
|
+
"""
|
|
1423
|
+
Enumerate all properties of this source.
|
|
1424
|
+
"""
|
|
1425
|
+
def enumerateSinks(self) -> list[VideoSink]:
|
|
1426
|
+
"""
|
|
1427
|
+
Enumerate all sinks connected to this source.
|
|
1428
|
+
|
|
1429
|
+
:returns: Vector of sinks.
|
|
1430
|
+
"""
|
|
1431
|
+
def enumerateVideoModes(self) -> list[VideoMode]:
|
|
1432
|
+
"""
|
|
1433
|
+
Enumerate all known video modes for this source.
|
|
1434
|
+
"""
|
|
1435
|
+
def getActualDataRate(self) -> float:
|
|
1436
|
+
"""
|
|
1437
|
+
Get the data rate (in bytes per second).
|
|
1438
|
+
|
|
1439
|
+
SetTelemetryPeriod() must be called for this to be valid.
|
|
1440
|
+
|
|
1441
|
+
:returns: Data rate averaged over the telemetry period.
|
|
1442
|
+
"""
|
|
1443
|
+
def getActualFPS(self) -> float:
|
|
1444
|
+
"""
|
|
1445
|
+
Get the actual FPS.
|
|
1446
|
+
|
|
1447
|
+
SetTelemetryPeriod() must be called for this to be valid.
|
|
1448
|
+
|
|
1449
|
+
:returns: Actual FPS averaged over the telemetry period.
|
|
1450
|
+
"""
|
|
1451
|
+
def getConfigJson(self) -> str:
|
|
1452
|
+
"""
|
|
1453
|
+
Get a JSON configuration string.
|
|
1454
|
+
|
|
1455
|
+
:returns: JSON configuration string
|
|
1456
|
+
"""
|
|
1457
|
+
def getConfigJsonObject(self) -> wpiutil.json:
|
|
1458
|
+
"""
|
|
1459
|
+
Get a JSON configuration object.
|
|
1460
|
+
|
|
1461
|
+
:returns: JSON configuration object
|
|
1462
|
+
"""
|
|
1463
|
+
def getDescription(self) -> str:
|
|
1464
|
+
"""
|
|
1465
|
+
Get the source description. This is source-kind specific.
|
|
1466
|
+
"""
|
|
1467
|
+
def getHandle(self) -> int:
|
|
1468
|
+
...
|
|
1469
|
+
def getKind(self) -> VideoSource.Kind:
|
|
1470
|
+
"""
|
|
1471
|
+
Get the kind of the source.
|
|
1472
|
+
"""
|
|
1473
|
+
def getLastFrameTime(self) -> int:
|
|
1474
|
+
"""
|
|
1475
|
+
Get the last time a frame was captured.
|
|
1476
|
+
This uses the same time base as wpi::Now().
|
|
1477
|
+
|
|
1478
|
+
:returns: Time in 1 us increments.
|
|
1479
|
+
"""
|
|
1480
|
+
def getLastStatus(self) -> int:
|
|
1481
|
+
...
|
|
1482
|
+
def getName(self) -> str:
|
|
1483
|
+
"""
|
|
1484
|
+
Get the name of the source. The name is an arbitrary identifier
|
|
1485
|
+
provided when the source is created, and should be unique.
|
|
1486
|
+
"""
|
|
1487
|
+
def getProperty(self, name: str) -> VideoProperty:
|
|
1488
|
+
"""
|
|
1489
|
+
Get a property.
|
|
1490
|
+
|
|
1491
|
+
:param name: Property name
|
|
1492
|
+
|
|
1493
|
+
:returns: Property contents (of kind Property::kNone if no property with
|
|
1494
|
+
the given name exists)
|
|
1495
|
+
"""
|
|
1496
|
+
def getVideoMode(self) -> VideoMode:
|
|
1497
|
+
"""
|
|
1498
|
+
Get the current video mode.
|
|
1499
|
+
"""
|
|
1500
|
+
def isConnected(self) -> bool:
|
|
1501
|
+
"""
|
|
1502
|
+
Is the source currently connected to whatever is providing the images?
|
|
1503
|
+
"""
|
|
1504
|
+
def isEnabled(self) -> bool:
|
|
1505
|
+
"""
|
|
1506
|
+
Gets source enable status. This is determined with a combination of
|
|
1507
|
+
connection strategy and the number of sinks connected.
|
|
1508
|
+
|
|
1509
|
+
:returns: True if enabled, false otherwise.
|
|
1510
|
+
"""
|
|
1511
|
+
@typing.overload
|
|
1512
|
+
def setConfigJson(self, config: str) -> bool:
|
|
1513
|
+
"""
|
|
1514
|
+
Set video mode and properties from a JSON configuration string.
|
|
1515
|
+
|
|
1516
|
+
The format of the JSON input is:
|
|
1517
|
+
|
|
1518
|
+
::
|
|
1519
|
+
|
|
1520
|
+
{
|
|
1521
|
+
"pixel format": "MJPEG", "YUYV", etc
|
|
1522
|
+
"width": video mode width
|
|
1523
|
+
"height": video mode height
|
|
1524
|
+
"fps": video mode fps
|
|
1525
|
+
"brightness": percentage brightness
|
|
1526
|
+
"white balance": "auto", "hold", or value
|
|
1527
|
+
"exposure": "auto", "hold", or value
|
|
1528
|
+
"properties": [
|
|
1529
|
+
{
|
|
1530
|
+
"name": property name
|
|
1531
|
+
"value": property value
|
|
1532
|
+
}
|
|
1533
|
+
]
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
:param config: configuration
|
|
1537
|
+
|
|
1538
|
+
:returns: True if set successfully
|
|
1539
|
+
"""
|
|
1540
|
+
@typing.overload
|
|
1541
|
+
def setConfigJson(self, config: wpiutil.json) -> bool:
|
|
1542
|
+
"""
|
|
1543
|
+
Set video mode and properties from a JSON configuration object.
|
|
1544
|
+
|
|
1545
|
+
:param config: configuration
|
|
1546
|
+
|
|
1547
|
+
:returns: True if set successfully
|
|
1548
|
+
"""
|
|
1549
|
+
def setConnectionStrategy(self, strategy: VideoSource.ConnectionStrategy) -> None:
|
|
1550
|
+
"""
|
|
1551
|
+
Sets the connection strategy. By default, the source will automatically
|
|
1552
|
+
connect or disconnect based on whether any sinks are connected.
|
|
1553
|
+
|
|
1554
|
+
This function is non-blocking; look for either a connection open or
|
|
1555
|
+
close event or call IsConnected() to determine the connection state.
|
|
1556
|
+
|
|
1557
|
+
:param strategy: connection strategy (auto, keep open, or force close)
|
|
1558
|
+
"""
|
|
1559
|
+
def setFPS(self, fps: typing.SupportsInt) -> bool:
|
|
1560
|
+
"""
|
|
1561
|
+
Set the frames per second (FPS).
|
|
1562
|
+
|
|
1563
|
+
:param fps: desired FPS
|
|
1564
|
+
|
|
1565
|
+
:returns: True if set successfully
|
|
1566
|
+
"""
|
|
1567
|
+
def setPixelFormat(self, pixelFormat: VideoMode.PixelFormat) -> bool:
|
|
1568
|
+
"""
|
|
1569
|
+
Set the pixel format.
|
|
1570
|
+
|
|
1571
|
+
:param pixelFormat: desired pixel format
|
|
1572
|
+
|
|
1573
|
+
:returns: True if set successfully
|
|
1574
|
+
"""
|
|
1575
|
+
def setResolution(self, width: typing.SupportsInt, height: typing.SupportsInt) -> bool:
|
|
1576
|
+
"""
|
|
1577
|
+
Set the resolution.
|
|
1578
|
+
|
|
1579
|
+
:param width: desired width
|
|
1580
|
+
:param height: desired height
|
|
1581
|
+
|
|
1582
|
+
:returns: True if set successfully
|
|
1583
|
+
"""
|
|
1584
|
+
@typing.overload
|
|
1585
|
+
def setVideoMode(self, mode: VideoMode) -> bool:
|
|
1586
|
+
"""
|
|
1587
|
+
Set the video mode.
|
|
1588
|
+
|
|
1589
|
+
:param mode: Video mode
|
|
1590
|
+
"""
|
|
1591
|
+
@typing.overload
|
|
1592
|
+
def setVideoMode(self, pixelFormat: VideoMode.PixelFormat, width: typing.SupportsInt, height: typing.SupportsInt, fps: typing.SupportsInt) -> bool:
|
|
1593
|
+
"""
|
|
1594
|
+
Set the video mode.
|
|
1595
|
+
|
|
1596
|
+
:param pixelFormat: desired pixel format
|
|
1597
|
+
:param width: desired width
|
|
1598
|
+
:param height: desired height
|
|
1599
|
+
:param fps: desired FPS
|
|
1600
|
+
|
|
1601
|
+
:returns: True if set successfully
|
|
1602
|
+
"""
|
|
1603
|
+
def _setLogger(func: collections.abc.Callable[[typing.SupportsInt, str, typing.SupportsInt, str], None], min_level: typing.SupportsInt) -> None:
|
|
1604
|
+
...
|
|
1605
|
+
def runMainRunLoop() -> None:
|
|
1606
|
+
...
|
|
1607
|
+
def runMainRunLoopTimeout(timeout: typing.SupportsFloat) -> int:
|
|
1608
|
+
"""
|
|
1609
|
+
Runs main run loop with timeout.
|
|
1610
|
+
|
|
1611
|
+
:param timeout: Timeout in seconds.
|
|
1612
|
+
"""
|
|
1613
|
+
def stopMainRunLoop() -> None:
|
|
1614
|
+
...
|
|
1615
|
+
_cleanup: typing.Any # value = <capsule object>
|