senxor.cv_utils
senxor.cv_utils¶
Thread utilities for Senxor devices.
CVCamThread(video_capture, on_data=None, *, raise_on_backlog=False, backlog_threshold=5)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
VideoCapture
|
The video capture to read frames from. |
required |
|
Callable
|
The callback function to call when a frame is read. |
None
|
|
bool
|
Whether to raise an error if the frame buffer backlog exceeds the threshold. |
False
|
|
int
|
The threshold for the frame buffer backlog. |
5
|
read()
¶
Read the frame from the video capture.
Returns:
| Type | Description |
|---|---|
ndarray | None
|
The frame from the video capture. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the thread is not started. |
list_camera_info(backend=0)
¶
List available camera information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
The backend to use for camera enumeration. If 0, all supported backends are used. |
0
|
Returns:
| Type | Description |
|---|---|
list of CameraInfo
|
List of camera information objects. Use |
Examples:
- Print all cameras information available.
>>> for camera in list_camera_info():
... print(camera.index, camera.name, camera.backend)
... print(camera.path, camera.vid, camera.pid)
- Connect to a specific camera.
>>> camera_info = list_camera_info()[0]
>>> cap = cv2.VideoCapture(camera_info.index, camera_info.backend)