stytra.hardware.video.cameras package

Submodules

stytra.hardware.video.cameras.avt module

class stytra.hardware.video.cameras.avt.AvtCamera(**kwargs)[source]

Bases: stytra.hardware.video.cameras.interface.Camera

Class for controlling an AVT camera.

Uses the Vimba interface pymba (module documentation here).

open_camera()[source]
set(param, val)[source]
Parameters
  • param

  • val

read()[source]
release()[source]

stytra.hardware.video.cameras.interface module

class stytra.hardware.video.cameras.interface.Camera(downsampling=1, roi=(-1, -1, -1, -1), **kwargs)[source]

Bases: object

Abstract class for controlling a camera.

Subclasses implement minimal control over the following cameras:

  • Ximea (uses ximea python API xiAPI;

  • AVT (uses pymba, a python wrapper for AVT Vimba package).

Examples

Simple usage of a camera class:

cam = AvtCamera()
cam.open_camera()  # initialize the camera
cam.set('exposure', 10)  # set exposure time in ms
frame = cam.read()  # read frame
cam.release()  # close the camera
cam

camera object (class depends on camera type).

debug

if true, state of the camera is printed.

Type

bool

open_camera()[source]

Initialise the camera.

set(param, val)[source]

Set exposure time or the framerate to the camera.

Parameters
  • param (str) – parameter key (‘exposure’, ‘framerate’));

  • val – value to be set (exposure time in ms, or framerate in Hz);

read()[source]

Grab frame from the camera and returns it as an NxM numpy array.

Returns

the grabbed frame, or None if an error occurred.

Return type

np.array

release()[source]

Close the camera.

stytra.hardware.video.cameras.mikrotron module

class stytra.hardware.video.cameras.mikrotron.MikrotronCLCamera(*args, camera_id='img0', **kwargs)[source]

Bases: stytra.hardware.video.cameras.interface.Camera

open_camera()[source]

Initialise the camera.

set(param, val)[source]

Set exposure time or the framerate to the camera.

Parameters
  • param (str) – parameter key (‘exposure’, ‘framerate’));

  • val – value to be set (exposure time in ms, or framerate in Hz);

read()[source]

Grab frame from the camera and returns it as an NxM numpy array.

Returns

the grabbed frame, or None if an error occurred.

Return type

np.array

release()[source]

Close the camera.

stytra.hardware.video.cameras.opencv module

class stytra.hardware.video.cameras.opencv.OpenCVCamera(cam_idx=0, bw=False, **kwargs)[source]

Bases: stytra.hardware.video.cameras.interface.Camera

Class for simple control of a camera such as a webcam using opencv. Tested only on a simple USB Logitech 720p webcam. Exposure and framerate seem to work. Different cameras might have different problems because of the camera-agnostic opencv control modules. Moreover, it might not work on a macOS because of system-specific problems in the multiprocessing Queues().

open_camera()[source]
set(param, val)[source]

Set exposure time or the framerate to the camera.

Parameters
  • param (str) – parameter key (‘exposure’, ‘framerate’));

  • val – value to be set (exposure time in ms, or framerate in Hz);

read()[source]
release()[source]

stytra.hardware.video.cameras.spinnaker module

class stytra.hardware.video.cameras.spinnaker.SpinnakerCamera(**kwargs)[source]

Bases: stytra.hardware.video.cameras.interface.Camera

Class for simple control of a Point Grey camera.

Uses Spinnaker API. Module documentation here.

Note roi is [x, y, width, height]

open_camera()[source]

Initialise the camera.

set(param, val)[source]
Parameters
  • param (string name) –

  • val (value in appropriate format for parameter) –

  • string (Returns) –

  • -------

read()[source]

Grab frame from the camera and returns it as an NxM numpy array.

Returns

the grabbed frame, or None if an error occurred.

Return type

np.array

release()[source]

Close the camera.

stytra.hardware.video.cameras.ximea module

class stytra.hardware.video.cameras.ximea.XimeaCamera(**kwargs)[source]

Bases: stytra.hardware.video.cameras.interface.Camera

Class for simple control of a Ximea camera.

Uses ximea API. Module documentation here.

open_camera()[source]
set(param, val)[source]
Parameters
  • param

  • val

read()[source]
release()[source]

Module contents