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 MaixCDK

Module

No module

Enum

Variable

Function

send_to_maixvision

item doc
brief 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.
param img: image to send, image.Image object

C++ defination code:

void send_to_maixvision(image::Image &img)

Class

Display

item doc
brief 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
item doc
type func
brief Construct a new Display object
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
item doc
type func
brief Get display width
return width
static False

C++ defination code:

int width()

height

def height(self) -> int
item doc
type func
brief Get display height
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]
item doc
type func
brief Get display size
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
item doc
type func
brief Get display format
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
item doc
type func
brief open display device, if already opened, will return err.ERR_NONE.
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
item doc
type func
brief close display device
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
item doc
type func
brief Add a new channel and return a new Display object, you can use close() to close this channel.
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
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_RGB888, bool open = true)

is_opened

def is_opened(self) -> bool
item doc
type func
brief check display device is opened or not
return opened or not, bool type
static False

C++ defination code:

bool is_opened()

is_closed

def is_closed(self) -> bool
item doc
type func
brief check display device is closed or not
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
item doc
type func
brief show image on display device, and will also send to MaixVision work station if connected.
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
item doc
type func
brief Get display device path
return display device path
static False

C++ defination code:

std::string device()

set_backlight

def set_backlight(self, value: float) -> None
item doc
type func
brief Set display backlight
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
item doc
type func
brief Get display backlight
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
item doc
type func
brief Set display mirror
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
item doc
type func
brief Set display flip
param en: enable/disable flip
static False

C++ defination code:

err::Err set_vflip(bool en)