Camera api

class kervi.vision.camera.CameraBase(camera_id, name, **kwargs)
property fps

Frames to capture per second

framerate_changed(framerate)

abstract method

property height

Height of images to capture

input_changed(changed_input)

Abstract method that is called by when one of the controller inputs change.

You can implement this method if your controller logic needs to respond changes in multiple inputs.

Parameters

changed_input (KerviValue) – Input that has changed. You can read the value of the changed input via the inputs value property.

Links this camera to a dashboard section or to the background of a dashboard.

Parameters
  • dashboard_id – id of the dashboard to link to.

  • section_id (str) – id of the section.

  • **kwargs – Use the kwargs below to override default values set in ui_parameters

Keyword Arguments
  • ui_size (int) – Size of the component in dashboard unit size.

    In order to make the sections and components align correct a dashboard unit is defined. Default the dashboard unit is a square that is 150 x 150 pixels. The width of the camera picture is ui_size * dashboard unit size.

  • show_buttons (bool) – Add this component to header of section.

  • show_pan_tilt (bool) – Add this component to header of section.

pan_changed(pan_value)

abstract method

property source

How to connect to this camera

tilt_changed(tilt_value)

abstract method

property width

Width of images to capture

class kervi.vision.camera.CameraStreamer(camera_id, name, camera_source=None, **kwargs)

Camera controller that streams video to the ui.

Parameters
  • camera_id (str) – Id of the camera. The id is used to reference the camera in other parts of the kervi application.

  • name (str) – Name of the camera used in ui.

  • camera_source (The name of the camera source to use.) – A frame driver that is used to capture frames from a camera.

  • **kwargs – See below

Keyword Arguments
  • height (int) –

    Height of video frame. Default value is 480.

  • width (int) –

    Width of video frame. Default value is 640.

  • fps (int) –

    Frames per second.

frame_captured(image)

Abstract method that is called when a new frame is ready from the camera. You can use this method to post process images before they are streamed.

get_font(name='Fanwood', size=16)

Returns a font that can be used by pil image functions. This default font is “Fanwood” that is available on all platforms.

class kervi.vision.camera.FrameCameraDeviceDriver

Base class for camera drivers that grap frames from a camera and streams them via the FrameCamera class. Could be used with the Raspberry PI camera. Fill in the abstract method capture_frames with functionality that graps frames from the camera and feeds them to the streamer. Frames must be pil images.

capture_frames()

Abstract method use it like the run method in a thread. capture frames from camera until the flag self.terminate is True. captured frames should be passed to the method frame_ready.

frame_ready(frame)

Call this method when a frame is ready

start_record(file_name)

Abstract method that should initiate a recording and save it to file_name

stop_record()

Abstract method that should stop active recording

wait_next_frame()

Waits for next frame.

class kervi.vision.camera.IPCamera(camera_id, name, dashboards, source)
class kervi.vision.camera.USBCamera(camera_id, name, dashboards, source)