robotpy-cscore 2023.4.3.0__cp38-cp38-win_amd64.whl → 2024.0.0b2.post1__cp38-cp38-win_amd64.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.

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