robotpy-cscore 2025.3.2.2__cp313-cp313-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.

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