camera.py

Use Case

camera.py is used to control, set, and output from the onboard AXIBO wide angle camera as well as an external HDMI camera. Functionality includes capturing images to files, viewing the live camera view, setting the AXIBO camera settings, and receiving camera information.

Available Functions

capture_image_to_file(file_name = 'axibo_image.jpg')

Captures the current feed of the AXIBO camera to an external file.

Valid file_name entries:

  • Any string

capture_pil_image()

Captures PIL image of the AXIBO camera.

camera_view()

Shows a live feed of the AXIBO camera.

set_camera(case=2, feed='00', imgWidth=640, imgHeight=480, rotation='0', exposure=0.03, autoExpo=0, hdmiRotation='0')

Sets the camera settings. Default values are provided for resetting the current settings.

Valid case entries:

  • 1:

  • 2:

Valid feed entries:

  • '00': Set AXIBO as the main camera source

  • '11': Set HDMI out as the main camera source

Valid imgWidth and imgHeight entries:

  • 640 x 480

  • 720 x 576

  • 960 x 640

  • 1024 x 512

  • 1024 x 768

  • 1920 x 1080

Valid rotation & hdmiRotation entries:

  • '0': Rotation by 0 degrees

  • '90_CW': Rotation by 90 degrees clockwise

  • '90_CCW': Rotation by 90 degrees counter-clockwise

  • '180': Rotation by 180 degrees

Valid exposure entries:

  • 0 <= exposure <= 0.03

Valid autoExpo entries:

  • 0: Disables AXIBO auto exposure

  • 1: Enables AXIBO auto exposure

set_case(case)

Description here

Valid case entries:

set_feed(feed)

Set the main feed of the AXIBO.

Valid feed entries:

set_resolution(width, height)

Set the resolution of the feed.

Valid width and height entries:

set_rotation(rotation) / set_hdmi_rotation(rotation)

Set the rotation of the AXIBO camera or HDMI output.

Valid rotation entries:

set_exposure(exposure)

Set the exposure of the AXIBO camera.

Valid exposure entries:

enable_auto_exposure(autoExpo)

Enable and disable AXIBO auto exposure.

Valid autoExpo entries:

get_config()

Returns the AXIBOs current configuration.

get_calibration_matrix()

Returns the AXIBOs calibration matrix.

Example

from axibo import Axibo
import time

if __name__ == '__main__':    
    #Change for you AXIBOs IP Address
    x = Axibo("10.0.0.205")

    x.camera.set_resolution(1920,1080)

    time.sleep(1)

    #Uncomment for live view.
    #x.camera.camera_view()

    #uncomment for capture to file
    #x.camera.capture_image_to_file("example.jpg")

Last updated