maix.display

maix.display module, control display device and show image on it

You can use maix.display to access this module with MaixPy
This module is generated from MaixPy and MaixCDK

Module

No module

Enum

Variable

Function

send_to_maixvision

def send_to_maixvision(img: maix.image.Image) -> None

Send image to MaixVision work station if connected.\nIf you want to debug your program an don't want to initialize display, use this method.

item description
param img: image to send, image.Image object

C++ defination code:

void send_to_maixvision(image::Image &img)

Class

Display

Display class

C++ defination code:

class Display

__init__

def __init__(self, width: int = -1, height: int = -1, format: maix.image.Format = ..., device: str = None, open: bool = True) -> None

Construct a new Display object

item description
type func
param width: display width, by default(value is -1) means auto detect,
if width > max device supported width, will auto set to max device supported width
height: display height, by default(value is -1) means auto detect,
if height > max device supported height, will auto set to max device supported height
device: display device name, you can get devices by list_devices method, by default(value is NULL(None in MaixPy)) means the first device
open: If true, display will automatically call open() after creation. default is true.
static False

C++ defination code:

Display(int width = -1, int height = -1, image::Format format = image::FMT_RGB888, const char *device = nullptr, bool open = true)

width

def width(self) -> int

Get display width

item description
type func
return width
static False

C++ defination code:

int width()

height

def height(self) -> int

Get display height

item description
type func
param ch: channel to get, by default(value is 0) means the first channel
return height
static False

C++ defination code:

int height()

size

def size(self) -> list[int]

Get display size

item description
type func
param ch: channel to get, by default(value is 0) means the first channel
return size A list type in MaixPy, [width, height]
static False

C++ defination code:

std::vector<int> size()

format

def format(self) -> maix.image.Format

Get display format

item description
type func
return format
static False

C++ defination code:

image::Format format()

open

def open(self, width: int = -1, height: int = -1, format: maix.image.Format = ...) -> maix.err.Err

open display device, if already opened, will return err.ERR_NONE.

item description
type func
param width: display width, default is -1, means auto, mostly means max width of display support
height: display height, default is -1, means auto, mostly means max height of display support
format: display output format, default is RGB888
return error code
static False

C++ defination code:

err::Err open(int width = -1, int height = -1, image::Format format = image::FMT_INVALID)

close

def close(self) -> maix.err.Err

close display device

item description
type func
return error code
static False

C++ defination code:

err::Err close()

add_channel

def add_channel(self, width: int = -1, height: int = -1, format: maix.image.Format = ..., open: bool = True) -> Display

Add a new channel and return a new Display object, you can use close() to close this channel.

item description
type func
attention If a new disp channel is created, it is recommended to set fit=image::FIT_COVER or fit=image::FIT_FILL when running show for the main channel,
otherwise the display of the new disp channel may be abnormal.
param width: display width, default is -1, means auto, mostly means max width of display support. Maximum width must not exceed the main channel.
height: display height, default is -1, means auto, mostly means max height of display support. Maximum height must not exceed the main channel.
format: display output format, default is FMT_BGRA8888
open: If true, display will automatically call open() after creation. default is true.
return new Display object
static False

C++ defination code:

display::Display *add_channel(int width = -1, int height = -1, image::Format format = image::FMT_BGRA8888, bool open = true)

is_opened

def is_opened(self) -> bool

check display device is opened or not

item description
type func
return opened or not, bool type
static False

C++ defination code:

bool is_opened()

is_closed

def is_closed(self) -> bool

check display device is closed or not

item description
type func
return closed or not, bool type
static False

C++ defination code:

bool is_closed()

show

def show(self, img: maix.image.Image, fit: maix.image.Fit = ...) -> maix.err.Err

show image on display device, and will also send to MaixVision work station if connected.

item description
type func
param img: image to show, image.Image object,
if the size of image smaller than display size, will show in the center of display;
if the size of image bigger than display size, will auto resize to display size and keep ratio, fill blank with black color.
fit: image in screen fit mode, by default(value is image.FIT_CONTAIN), @see image.Fit for more details
e.g. image.FIT_CONTAIN means resize image to fit display size and keep ratio, fill blank with black color.
return error code
static False

C++ defination code:

err::Err show(image::Image &img, image::Fit fit = image::FIT_CONTAIN)

device

def device(self) -> str

Get display device path

item description
type func
return display device path
static False

C++ defination code:

std::string device()

set_backlight

def set_backlight(self, value: float) -> None

Set display backlight

item description
type func
param value: backlight value, float type, range is [0, 100]
static False

C++ defination code:

void set_backlight(float value)

get_backlight

def get_backlight(self) -> float

Get display backlight

item description
type func
return value backlight value, float type, range is [0, 100]
static False

C++ defination code:

float get_backlight()

set_hmirror

def set_hmirror(self, en: bool) -> maix.err.Err

Set display mirror

item description
type func
param en: enable/disable mirror
static False

C++ defination code:

err::Err set_hmirror(bool en)

set_vflip

def set_vflip(self, en: bool) -> maix.err.Err

Set display flip

item description
type func
param en: enable/disable flip
static False

C++ defination code:

err::Err set_vflip(bool en)