pupil_recording_interface.VideoDeviceUVC

class pupil_recording_interface.VideoDeviceUVC(device_uid, resolution, fps, exposure_mode='auto', check_stripes=False, controls=None)

Bases: pupil_recording_interface.device.video.BaseVideoDevice

UVC video device.

__init__(device_uid, resolution, fps, exposure_mode='auto', check_stripes=False, controls=None)

Constructor.

Parameters
  • device_uid (str) – The name of the UVC device. For Pupil cameras, this will be ‘Pupil CamX IDY’.

  • resolution (tuple, len 2) – Desired horizontal and vertical camera resolution.

  • fps (int) – Desired camera refresh rate.

  • exposure_mode (str, default "auto".) – Exposure mode. Can be “manual”, “auto” or “forced_auto”. Note that the “auto” mode only applies to 2nd and 3rd generation Pupil Core cameras. These cameras don’t support auto exposure on the hardware so an exposure time is set by this class based on an average of the last camera frames. You can force this behavior with “forced_auto” but for 1st generation Pupil cameras it will probably result in under-exposed camera images. Instead, it is advised to set hardware auto exposure via controls (see below).

  • controls (dict, optional) – Mapping from UVC control display names to values, e.g. {"Auto Exposure Mode": 1}.

Methods

Config(*args, **kwargs)

Configuration for this class.

__init__(device_uid, resolution, fps[, …])

Constructor.

from_config(config, **kwargs)

Create a device from a StreamConfig.

from_config_list(config_list)

Create a device from a list of StreamConfigs.

get_capture(uid, resolution, fps[, …])

Get a capture instance for a device by name.

get_frame_and_timestamp([mode])

Get a frame and its associated timestamp.

get_timestamp()

Get the current monotonic time from the UVC backend.

get_uvc_frame()

Grab a uvc.Frame from the device.

restart()

Try restarting this device.

run_post_thread_hooks()

Run hook(s) after processing thread(s) finish(es).

run_pre_thread_hooks()

Run hook(s) before dispatching processing thread(s).

start()

Start this device.

stop()

Stop this device.

Attributes

available_controls

Available UVC controls for this device.

available_modes

Available frame modes for this device.

controls

Current UVC controls for this device.

device_type

is_started

Whether this device has been started.

uvc_device_uid

The UID of the UVC device.

classmethod Config(*args, **kwargs)

Configuration for this class.

property available_controls

Available UVC controls for this device.

property available_modes

Available frame modes for this device.

property controls

Current UVC controls for this device.

classmethod from_config(config, **kwargs)

Create a device from a StreamConfig.

classmethod from_config_list(config_list)

Create a device from a list of StreamConfigs.

classmethod get_capture(uid, resolution, fps, user_controls=None)

Get a capture instance for a device by name.

Parameters
  • uid (str) – The name of the UVC device. For Pupil cameras, this will be ‘Pupil CamX IDY’.

  • resolution (tuple, len 2) – Desired horizontal and vertical camera resolution.

  • fps (int) – Desired camera refresh rate.

  • user_controls (dict, optional) – Mapping from UVC control display names to values.

get_frame_and_timestamp(mode='img')

Get a frame and its associated timestamp.

Parameters

mode (str, default 'img') – The type of frame to retrieve from the device. Can be ‘img’, ‘bgr’, ‘gray’ or ‘jpeg_buffer’.

Returns

  • frame (numpy.ndarray) – The retrieved video frame.

  • timestamp (float) – The timestamp of the frame.

classmethod get_timestamp()

Get the current monotonic time from the UVC backend.

get_uvc_frame()

Grab a uvc.Frame from the device.

Returns

The captured frame.

Return type

uvc.Frame

property is_started

Whether this device has been started.

restart()

Try restarting this device.

run_post_thread_hooks()

Run hook(s) after processing thread(s) finish(es).

run_pre_thread_hooks()

Run hook(s) before dispatching processing thread(s).

start()

Start this device.

stop()

Stop this device.

property uvc_device_uid

The UID of the UVC device.