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