cozmo.oled_face

Cozmo’s OLED screen that displays his face - related functions and values.

Functions

convert_image_to_screen_data(image[, …]) Convert an image into the correct format to display on Cozmo’s face.
convert_pixels_to_screen_data(pixel_data, …) Convert a sequence of pixel data to the correct format to display on Cozmo’s face.
dimensions() Return the dimension (width, height) of the oled screen.
cozmo.oled_face.dimensions()

Return the dimension (width, height) of the oled screen.

Note: The screen is displayed interlaced, with only every other line displayed This alternates every time the image is changed (no longer than 30 seconds) to prevent screen burn-in. Therefore to ensure the image looks correct on either scan-line offset we use half the vertical resolution

Returns:A tuple of ints (width, height)
cozmo.oled_face.convert_pixels_to_screen_data(pixel_data, image_width, image_height)

Convert a sequence of pixel data to the correct format to display on Cozmo’s face.

Parameters:
  • pixel_data (bytes) – sequence of pixel values, should be in binary (1s or 0s)
  • image_width (int) – width of the image defined by the pixel_data
  • image_height (int) – height of the image defined by the pixel_data
Returns:

A bytearray object representing all of the pixels (8 pixels packed per byte)

Raises:
cozmo.oled_face.convert_image_to_screen_data(image, invert_image=False, pixel_threshold=127)

Convert an image into the correct format to display on Cozmo’s face.

Parameters:
  • image (Image) – The image to display on Cozmo’s face
  • invert_image (bool) – If true then pixels darker than the threshold are set on
  • pixel_threshold (int) – The grayscale threshold for what to consider on or off (0..255)
Returns:

A bytearray object representing all of the pixels (8 pixels packed per byte)