pupil_recording_interface.CircleDetector

class pupil_recording_interface.CircleDetector(scale=0.5, display=True, **kwargs)

Bases: pupil_recording_interface.process.BaseProcess

Detector for circular calibration markers.

This process detects the circular calibration marker used for calibrating the gaze mapper. Attach this process to the world camera stream.

__init__(scale=0.5, display=True, **kwargs)

Constructor.

Parameters
  • scale (float) – If specified, resize the camera frame by this scale factor before detection. This will increase the speed of detection at the expense of accuracy.

  • display (bool) – If True, add this instance’s display_hook method to the packet returned by process_packet. A VideoDisplay later in the pipeline will pick this up to draw the location of the currently detected calibration marker over the camera image.

Methods

Config(*args, **kwargs)

Configuration for this class.

__init__([scale, display])

Constructor.

batch_run(video_reader[, start, end, …])

Detect reference markers in a world video.

detect_circle(frame, timestamp, color_format)

Detect circle markers.

display_hook(packet)

Add gaze overlay onto frame.

from_config(config, stream_config, device, …)

Create a process from a ProcessConfig.

process(packet, notifications)

Process new data.

process_notifications(notifications)

Process new notifications.

process_packet(packet)

Process a new packet.

start()

Start the process

stop()

Stop the process.

Attributes

process_type

classmethod Config(*args, **kwargs)

Configuration for this class.

batch_run(video_reader, start=None, end=None, return_type='list')

Detect reference markers in a world video.

Parameters
  • video_reader (pri.VideoReader instance) – Video reader for an eye camera recording.

  • start (int or pandas.Timestamp, optional) – If specified, start the detection at this frame index or timestamp.

  • end (int or pandas.Timestamp, optional) – If specified, stop the detection at this frame index or timestamp.

  • return_type (str or None, default "list") – The data type that this method should return. “list” returns o list of dicts with pupil data for each frame. “dataset” returns an xarray Dataset. Can also be None, in that case pupil data is not loaded into memory and this method returns nothing, which is useful when recording detected pupils to disk.

Returns

  • marker_list (list of dict) – List of detected markers if return_type=”list”.

  • ds (xarray.Dataset) – Dataset with marker data if return_type=”dataset”.

detect_circle(frame, timestamp, color_format)

Detect circle markers.

display_hook(packet)

Add gaze overlay onto frame.

classmethod from_config(config, stream_config, device, **kwargs)

Create a process from a ProcessConfig.

process(packet, notifications)

Process new data.

process_notifications(notifications)

Process new notifications.

process_packet(packet)

Process a new packet.

start()

Start the process

stop()

Stop the process.