pupil_recording_interface.CamParamEstimator

class pupil_recording_interface.CamParamEstimator(streams, folder, grid_shape=(4, 11), grid_scale=0.02, num_patterns=10, distortion_model='radial', extrinsics=False, display=True, **kwargs)

Bases: pupil_recording_interface.process.BaseProcess

Camera parameter estimator.

This process estimates camera parameters (intrinsic and extrinsic) for one or multiple cameras based on the locations of calibration patterns detected e.g. by the CircleGridDetector. You only need to attach one to one of the video streams, even when estimating extrinsics between multiple cameras.

__init__(streams, folder, grid_shape=(4, 11), grid_scale=0.02, num_patterns=10, distortion_model='radial', extrinsics=False, display=True, **kwargs)

Constructor.

Parameters
  • streams (Iterable[str]) – Names of video streams for which to perform estimation.

  • folder (os.PathLike) – Folder for saving estimation results.

  • grid_shape (tuple) – Number of rows and columns of the grid.

  • grid_scale (float) – Distance between grid positions in meters. Can be calculated by measuring the distance between the centers of the outermost circles in the first row (the longer on) on the printed calibration target. Divide this distance by the number of horizontal grid positions (default 11) to obtain the scale.

  • num_patterns (int) – Number of patterns to capture before performing estimation.

  • distortion_model (str) – Distortion model to use for estimation. Can be “radial” or “fisheye”.

  • extrinsics (bool) – If True, perform extrinsics estimation (rotation and translation) between cameras. Requires at least two streams or one fisheye stream. This will not save the intrinsics because the calibration data will most likely be poorer than when estimatingintrinsics for each stream individually.

  • 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 extent of the all previously detected grids over the camera image.

Methods

Config(*args, **kwargs)

Configuration for this class.

__init__(streams, folder[, grid_shape, …])

Constructor.

display_hook(packet)

Add circle grid 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.

display_hook(packet)

Add circle grid 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.