Skip to content

senxor.cam

senxor.cam

RGB camera related utilities.

list_camera()

List all cameras available.

Warning:

This function is deprecated. Use list_camera_info instead.

Returns:

list[str] A list of camera names.

Examples:

list_camera() ['Camera 0', 'Camera 1', 'Camera 2']

You can use cv2.VideoCapture(index) to open a camera.

list_camera_info(backend=0, *, exclude_same_index=True)

List available camera information.

Parameters:

Name Type Description Default
backend int

The backend to use for camera enumeration. If 0, all supported backends are used.

0
exclude_same_index bool

If backend is 0, True means exclude cameras with the same index across backends. Some cameras are available on multiple backends. If you are not interested in this, set it to False.

True

Returns:

Type Description
list of CameraInfo

List of camera information objects. Use cv2.VideoCapture(camera.index, camera.backend) to open a camera.

Examples:

  1. List all cameras available and exclude duplicate indices.
>>> for camera in list_camera_info():
...     print(camera.index, camera.name, camera.backend)
0 GENERAL - VIDEO 700
1 Integrated Camera 700
  1. List all cameras available and include duplicate indices.
>>> for camera in list_camera_info(exclude_same_index=False):
...     print(camera.index, camera.name, camera.backend)
0 GENERAL - VIDEO 700
1 Integrated Camera 700
0 GENERAL - VIDEO 1400
1 Integrated Camera 1400
  1. Connect to a specific camera.
>>> camera = list_camera_info()[0]
>>> cap = cv2.VideoCapture(camera.index, camera.backend)
  1. View the camera information.
>>> cam_info = list_camera_info()[0]
>>> print(cam_info.index)
0
>>> print(cam_info.name)
GENERAL - VIDEO
>>> print(cam_info.backend)
700
>>> print(cam_info.vid)
1234
>>> print(cam_info.pid)
5678
>>> print(cam_info.path)
/dev/video0