### Get Start Parameter Source: https://wiki.sipeed.com/maixpy/api/maix/app.html Retrieve the parameter string passed to the application when it was started. This is useful for passing configuration or context to an app. ```python def get_start_param() -> str ``` ```cpp const std::string get_start_param() ``` -------------------------------- ### Get Example Name Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Retrieves the name of the Example object. The name can also be accessed directly as a property. ```python def get_name(self) -> str ``` ```cpp std::string get_name() ``` -------------------------------- ### WebRTC start Method Source: https://wiki.sipeed.com/maixpy/api/maix/webrtc.html Starts the WebRTC service. Ensure all necessary configurations are set before calling this method. ```python def start(self) -> maix.err.Err ``` ```cpp err::Err start() ``` -------------------------------- ### C++ FPS Start Method Source: https://wiki.sipeed.com/maixpy/api/maix/time.html C++ equivalent method to manually set the start point for FPS measurement. ```cpp void start() ``` -------------------------------- ### Class: Example Source: https://wiki.sipeed.com/maixpy/api/maix/example.html An example class that will be exported to MaixPy as maix.example.Example. ```APIDOC ## Class: Example ### Description Example class this class will be export to MaixPy as maix.example.Example ### C++ Definition ```cpp class Example ``` ``` -------------------------------- ### Example Constructor Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Defines the constructor for the Example class, including parameters for name, age, and pet. Note the attention required for the 'Kind' parameter's namespace when generating code. ```python def __init__(self, name: str, age: int = 18, pet: Kind = ...) -> None ``` ```cpp Example(std::string &name, int age = 18, example::Kind pet = example::KIND_NONE) ``` -------------------------------- ### Set Example Name Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Sets the name of the Example object. This function takes a string argument for the new name. ```python def set_name(self, name: str) -> None ``` ```cpp void set_name(std::string name) ``` -------------------------------- ### Start Stream Source: https://wiki.sipeed.com/maixpy/api/maix/rtmp.html Starts pushing the RTMP stream. Can push from a bound camera or a specified file. ```APIDOC ## Rtmp.start ### Description Start pushing the RTMP stream. ### Method ```python def start(self, path: str = '') -> maix.err.Err ``` ### Parameters * **path** (str, optional) - Path to a file to stream cyclically. If empty and a camera is bound, streams the camera feed. This parameter is deprecated. ### Note Currently only supports FLV files. ### Return * **maix.err.Err** - An error code. `maix.err.ERR_NONE` indicates success. ``` -------------------------------- ### Get Example Age Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Retrieves the age of the Example object. The age is an integer within the range of [0, 100]. ```python def get_age(self) -> int ``` ```cpp int get_age() ``` -------------------------------- ### start_service Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Starts the LLM/VLM service. This is useful for restarting the background model if it fails to start correctly. ```APIDOC ## start_service ### Description Start the LLM/VLM service. The LLM model runs in the background by default. If an unexpected issue prevents the LLM model from starting properly, this command can be used to run the background model. ### Method ```python def start_service(self) -> maix.err.Err ``` ### Return - **err** (maix.err.Err) - Returns `maix.err.ERR_NONE` if no error occurred. ``` -------------------------------- ### Get Dictionary Example Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Processes an input dictionary with string keys and integer values, returning a new dictionary that includes {"a": 1} merged with the input dictionary. MaixPy handles dictionary inputs and outputs. ```python def get_dict(self, in: dict[str, int]) -> dict[str, int] ``` ```cpp std::map get_dict(std::map &in) ``` -------------------------------- ### Get List Example Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Processes an input list of integers and returns a new list containing elements [1, 2, 3] concatenated with the input list. Memory management for the returned list is handled automatically in MaixPy. ```python def get_list(self, in: list[int]) -> list[int] ``` ```cpp std::vector *get_list(std::vector in) ``` -------------------------------- ### Start JPEG Stream Source: https://wiki.sipeed.com/maixpy/api/maix/http.html Starts the JPEG streaming service. Returns an error code; ERR_NONE indicates success. ```python def start(self) -> maix.err.Err ``` -------------------------------- ### Define Example Class in C++ Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Declares a C++ class named 'Example'. This class is intended to be exported to MaixPy as 'maix.example.Example'. ```cpp class Example ``` -------------------------------- ### Manual FPS Start Source: https://wiki.sipeed.com/maixpy/api/maix/time.html Manually sets the starting point for FPS calculation. Subsequent calls to fps() will calculate the duration between this call and the fps() call. ```APIDOC ## fps_start() ### Description Manually sets the starting point for FPS calculation. Subsequent calls to fps() will calculate the duration between this call and the fps() call. ### Return - None ### C++ Definition ```cpp void fps_start() ``` ``` -------------------------------- ### Manually Start FPS Calculation Source: https://wiki.sipeed.com/maixpy/api/maix/time.html Sets the starting point for FPS calculation. Subsequent calls to `fps()` or `end()` will measure the duration from this point. ```python def start(self) -> None ``` -------------------------------- ### format Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Get the audio sample format. ```APIDOC ## format ### Description Get sample format ### Return returns sample format ``` -------------------------------- ### Start WiFi Access Point (AP) Source: https://wiki.sipeed.com/maixpy/api/maix/network/wifi.html Configure and start the device as a WiFi Access Point. You can specify the SSID, password, network mode, channel, IP address, netmask, and whether to hide the SSID. ```python def start_ap(self, ssid: str, password: str, mode: str = 'g', channel: int = 0, ip: str = '192.168.66.1', netmask: str = '255.255.255.0', hidden: bool = False) -> maix.err.Err ``` ```cpp err::Err start_ap(const std::string &ssid, const std::string &password, std::string mode = "g", int channel = 0, const std::string &ip = "192.168.66.1", const std::string &netmask = "255.255.255.0", bool hidden = false) ``` -------------------------------- ### get_start_param Source: https://wiki.sipeed.com/maixpy/api/maix/app.html Retrieves the start parameter that was passed to the current application when it was launched. ```APIDOC ## get_start_param ### Description Get start param set by caller. ### Return - **param** (str) - The start parameter string. ``` -------------------------------- ### Get Example Pet Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Retrieves the pet type of the Example object. This function is used for getting enum members. ```python def get_pet(self) -> Kind ``` ```cpp example::Kind get_pet() ``` -------------------------------- ### __init__ Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Initializes a new Example object. This constructor is exported to MaixPy as maix.example.Example.__init__. ```APIDOC ## __init__ ### Description Initializes a new Example object with a name, optional age, and optional pet. ### Method __init__ ### Parameters - **name** (str) - Required - The name of the Example. - **age** (int) - Optional - The age of the Example. Defaults to 18. Value range is [0, 100]. - **pet** (Kind) - Optional - The pet of the Example. Note: For auto-generated code, use the full namespace `example::Kind` instead of `Kind`. ### Attention To ensure auto-generated code works correctly, the `Kind` parameter should be specified with its full namespace, e.g., `example::Kind`. The `maix` namespace can be ignored. ### Static False > C++ defination code: > ```cpp > Example(std::string &name, int age = 18, example::Kind pet = example::KIND_NONE) > ``` ``` -------------------------------- ### record_start Source: https://wiki.sipeed.com/maixpy/api/maix/video.html Starts the video recording process. Ensure a camera is bound before calling this function. Binding a display will show the input, binding audio will record audio, and binding an IMU will log IMU data. ```APIDOC ## record_start ### Description Starts the video recording process. This function can optionally bind a display, audio input, or IMU for enhanced recording capabilities. ### Method ```python def record_start(self) -> maix.err.Err ``` ### Parameters None ### Return Value - **maix.err.Err**: An error code indicating the success or failure of the operation. ``` -------------------------------- ### MaixPy UvcServer run Method Source: https://wiki.sipeed.com/maixpy/api/maix/uvc.html Starts the UVC server to begin streaming. ```python def run(self) -> None ``` -------------------------------- ### init Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Initializes the ASR library with a specified audio device type and name. ```APIDOC ## init ### Description Init the ASR library and select the type and name of the audio device. This function initializes the Automatic Speech Recognition (ASR) library and configures the audio input device. ### Parameters #### Path Parameters - **dev_type** (SpeechDevice) - The type of audio device to use. Can be `WAV`, `PCM`, or `MIC`. - **device_name** (str) - Optional. The name of the audio device. This can be a WAV file, a PCM file, or a MIC device name. Defaults to an empty string. ### Throws - **1**. If a model has not been loaded prior to calling `init`, `err::ERR_NOT_IMPL` will be thrown. - **2**. If the specified device is not supported, `err::ERR_NOT_IMPL` will be thrown. ### Return - **maix.err.Err** - An error code indicating the result of the initialization. Returns `err::ERR_NONE` if initialization is successful. ``` -------------------------------- ### Start Rtmp Stream Source: https://wiki.sipeed.com/maixpy/api/maix/rtmp.html Starts pushing the stream. If a file path is provided, the file will be cyclically pushed. If a camera is bound, its image will be pushed. Note: The 'path' parameter is deprecated. ```python def start(self, path: str = '') -> maix.err.Err ``` ```cpp err::Err start(std::string path = std::string()) ``` -------------------------------- ### Initialize Audio Player Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Constructs a new Player object with specified audio parameters. The 'path' parameter determines where the audio file is saved if provided. 'block' controls whether recording is blocking. ```python def __init__(self, path: str = '', sample_rate: int = 48000, format: Format = ..., channel: int = 1, block: bool = True) -> None ``` ```cpp Player(std::string path = std::string(), int sample_rate = 48000, audio::Format format = audio::Format::FMT_S16_LE, int channel = 1, bool block = true) ``` -------------------------------- ### Manually Start FPS Calculation Source: https://wiki.sipeed.com/maixpy/api/maix/time.html Manually sets the start point for FPS calculation. Subsequent calls to fps() will measure the duration between this start point and the fps() call. ```python def fps_start() -> None ``` ```cpp void fps_start() ``` -------------------------------- ### Camera.open Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html Opens the camera device and starts the camera stream with specified parameters. ```APIDOC ## Camera.open ### Description Open camera and run. ### Parameters #### Path Parameters - **width** (int) - Optional - Camera width, default is -1 (auto, maximum supported width). - **height** (int) - Optional - Camera height, default is -1 (auto, maximum supported height). - **format** (maix.image.Format) - Optional - Camera output format, default is the same as the constructor's format argument. - **fps** (float) - Optional - Camera frames per second, default is -1 (auto, maximum supported fps). - **buff_num** (int) - Optional - Camera buffer number, default is 3. More buffers increase read speed but consume more memory. ### Returns - maix.err.Err: Error code. `maix.err.ERR_NONE` indicates success; others indicate failure. ``` -------------------------------- ### Get Circle Radius - C++ Source: https://wiki.sipeed.com/maixpy/api/maix/image.html C++ definition for getting the radius of a circle. ```cpp int r() ``` -------------------------------- ### Get Circle Y-coordinate - C++ Source: https://wiki.sipeed.com/maixpy/api/maix/image.html C++ definition for getting the y-coordinate of a circle. ```cpp int y() ``` -------------------------------- ### get_age Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Retrieves the age of the Example object. ```APIDOC ## get_age ### Description Retrieves the age of the Example object. ### Method get_age ### Return - **age** (int) - The age of the Example. Value range is [0, 100]. ### Static False > C++ defination code: > ```cpp > int get_age() > ``` ``` -------------------------------- ### set_name Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Sets the name of the Example object. ```APIDOC ## set_name ### Description Sets the name of the Example object. ### Method set_name ### Parameters - **name** (str) - Required - The new name for the Example. ### Static False > C++ defination code: > ```cpp > void set_name(std::string name) > ``` ``` -------------------------------- ### Get Circle X-coordinate - C++ Source: https://wiki.sipeed.com/maixpy/api/maix/image.html C++ definition for getting the x-coordinate of a circle. ```cpp int x() ``` -------------------------------- ### Initialize MLX90640Kelvin Object (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/ext_dev/mlx90640.html Constructs a new MLX90640Kelvin object. Use this to configure I2C bus, frame rate, color mapping, temperature ranges, and emissivity. ```cpp MLX90640Kelvin( int i2c_bus_num, ::maix::ext_dev::mlx90640::FPS fps=::maix::ext_dev::mlx90640::FPS::FPS_32, ::maix::ext_dev::cmap::Cmap cmap=::maix::ext_dev::cmap::Cmap::WHITE_HOT, float temp_min=-1, float temp_max=-1, float emissivity=0.95) ``` -------------------------------- ### Get File Size (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/fs.html C++ definition for getting the size of a file. ```cpp int size() ``` -------------------------------- ### Get Sample Format - Python Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Retrieves the current audio sample format. ```python def format(self) -> Format ``` -------------------------------- ### get_pet Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Retrieves the pet of the Example object. This method is related to the Example enum member. ```APIDOC ## get_pet ### Description Retrieves the pet of the Example object. This method is related to the Example enum member. ### Method get_pet ### Return - **pet** (Kind) - The current pet of the Example. ### Static False > C++ defination code: > ```cpp > example::Kind get_pet() > ``` ``` -------------------------------- ### Qwen Model Initialization and Loading Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Provides details on how to initialize and load Qwen models using the Maix NN API. ```APIDOC ## Qwen.__init__ ### Description Initializes the Qwen model. ### Method ```python def __init__(self, model: str) -> None ``` ### Parameters * **model** (str) - The path to the model file. This can be a MUD (model universal describe file) file. If the model path is set, the model will be loaded from the file. Loading failure will raise an err.Exception. ### C++ Definition ```cpp Qwen(const std::string &model) ``` ``` ```APIDOC ## Qwen.load ### Description Loads a model from a specified file path. ### Method ```python def load(self, model: str) -> maix.err.Err ``` ### Parameters * **model** (str) - The path to the model file. The model format can be a MUD (model universal describe file) file. ### Returns * **maix.err.Err** - Error code. Returns err::ERR_NONE if the load is successful. ### C++ Definition ```cpp err::Err load(const std::string &model) ``` ``` -------------------------------- ### set_pet Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Sets the pet of the Example object. This method is related to the Example enum member. ```APIDOC ## set_pet ### Description Sets the pet of the Example object. This method is related to the Example enum member. ### Method set_pet ### Parameters - **pet** (Kind) - Required - The new pet for the Example. ### Static False > C++ defination code: > ```cpp > void set_pet(example::Kind pet) > ``` ``` -------------------------------- ### Initialize MLX90640Kelvin Object (Python) Source: https://wiki.sipeed.com/maixpy/api/maix/ext_dev/mlx90640.html Constructs a new MLX90640Kelvin object. Use this to configure I2C bus, frame rate, color mapping, temperature ranges, and emissivity. ```python def __init__(self, i2c_bus_num: int, fps: FPS = ..., cmap: maix.ext_dev.cmap.Cmap = ..., temp_min: float = -1, temp_max: float = -1, emissivity: float = 0.95) -> None ``` -------------------------------- ### Initialize VideoRecorder (Python) Source: https://wiki.sipeed.com/maixpy/api/maix/video.html Construct a new VideoRecorder object. Optionally, set 'open' to true to automatically call open() after creation. This object integrates recording, video capturing, and display functions. ```python def __init__(self, open: bool = True) -> None ``` -------------------------------- ### Get Loaded Fonts - C++ Source: https://wiki.sipeed.com/maixpy/api/maix/image.html C++ definition to get a list of all loaded fonts. ```cpp std::vector *fonts() ``` -------------------------------- ### Camera.__init__ Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html Constructs a new Camera object, initializing camera parameters. Supports resolutions up to 2560x1440. ```APIDOC ## Camera.__init__ ### Description Construct a new Camera object. Maximum resolution support 2560x1440. ### Parameters #### Path Parameters - **width** (int) - Optional - Camera width, default is -1 (auto, maximum supported width). - **height** (int) - Optional - Camera height, default is -1 (auto, maximum supported height). - **format** (maix.image.Format) - Optional - Camera output format, default is `maix.image.Format.FMT_RGB888`. - **device** (str) - Optional - Camera device path. Defaults to None (the first available device). - **fps** (float) - Optional - Camera frames per second, default is -1 (auto, maximum supported fps). - **buff_num** (int) - Optional - Camera buffer number, default is 3. More buffers increase read speed but consume more memory. - **open** (bool) - Optional - If true, the camera will automatically open after creation. Defaults to True. - **raw** (bool) - Optional - If true, allows capturing raw sensor output using `read_raw()`. ### Returns None ``` -------------------------------- ### Get Request Type Source: https://wiki.sipeed.com/maixpy/api/maix/comm/modbus.html Gets the type of the Modbus request that was successfully received after a call to `receive()`. ```APIDOC ## request_type ### Description Gets the type of the Modbus request that was successfully received. This function can be used to retrieve the type of the request received after a successful call to `receive()`. The return value indicates the type of the Modbus request, allowing the user to understand and process the received request appropriately. ### Returns - RequestType - The type of the Modbus request that has been received. ### See - modbus.RequestType ``` -------------------------------- ### Get Sample Channel - Python Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Retrieves the number of audio channels. ```python def channel(self) -> int ``` -------------------------------- ### Initialize Tracker (Python) Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Initializes the tracker with the first target image and its position. Throws an exception if the image format does not match the model's input format. ```python def init(self, img: maix.image.Image, x: int, y: int, w: int, h: int) -> None ``` -------------------------------- ### Player.__init__ Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Constructs a new Player object with specified audio parameters. ```APIDOC ## Player.__init__ ### Description Construct a new Player object ### Parameters #### Path Parameters - **path** (str) - Optional - Player path. Determines the location where the file is saved. If path is none, the audio module will not save the file. - **sample_rate** (int) - Optional - Player sample rate, default is 48000 (48KHz), meaning 48000 samples per second. - **format** (Format) - Optional - Player sample format, default is audio::Format::FMT_S16_LE, meaning sampling 16 bits at a time and saving as signed 16 bits, little endian. See @audio::Format. - **channel** (int) - Optional - Player sample channel, default is 1, meaning 1 channel sampling at the same time. - **block** (bool) - Optional - Block record, default is true, meaning block record. If false, record will not block. ``` -------------------------------- ### Get Camera Channel Numbers (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html C++ definition for getting the number of channels supported by the camera. ```cpp int get_ch_nums() ``` -------------------------------- ### Get Remaining Frames - C++ Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html C++ definition for getting the number of remaining idle frames for writing. ```cpp int get_remaining_frames() ``` -------------------------------- ### Python Qwen3VL Constructor Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Initializes the Qwen3VL model with a specified model file path. Raises an exception if loading fails. If no model path is provided, the model can be loaded later using the `load` function. ```python def __init__(self, model: str) -> None ``` -------------------------------- ### Set Example Pet Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Sets the pet type for the Example object. This function is used for setting enum members. ```python def set_pet(self, pet: Kind) -> None ``` ```cpp void set_pet(example::Kind pet) ``` -------------------------------- ### Start Video Recording Source: https://wiki.sipeed.com/maixpy/api/maix/video.html Initiates video recording. Ensure the camera is bound before calling this function. Binding a display will show the input image, binding audio will record audio, and binding an IMU will log IMU data. ```python def record_start(self) -> maix.err.Err ``` ```cpp err::Err record_start() ``` -------------------------------- ### MaixPy UvcServer __init__ Method Source: https://wiki.sipeed.com/maixpy/api/maix/uvc.html Constructs a new UvcServer object. An optional callback function can be provided during initialization. ```python def __init__(self, cb: typing.Callable[[capsule, int], int] = None) -> None ``` -------------------------------- ### Get Display Format Source: https://wiki.sipeed.com/maixpy/api/maix/display.html Retrieve the current format of the display. ```python def format(self) -> maix.image.Format ``` ```cpp image::Format format() ``` -------------------------------- ### Protocol.__init__ Source: https://wiki.sipeed.com/maixpy/api/maix/protocol.html Constructs a new Protocol object with specified buffer size and header. ```APIDOC ## Protocol.__init__ ### Description Construct a new Protocol object. ### Parameters - **buff_size** (int) - Data queue buffer size. Defaults to 1024. - **header** (uint32_t) - Header value. Defaults to maix::protocol::HEADER. ``` -------------------------------- ### List Supported Camera Devices (Python) Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html Lists all supported camera devices available on the system. Returns a list of device paths. ```python def list_devices() -> list[str]: pass ``` -------------------------------- ### Example Module Variable: var2 Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Represents a module variable 'var2' within the Example module. The C++ definition is provided for reference. ```cpp std::string var2 = "Example.var2" ``` -------------------------------- ### Initialize Video Object Source: https://wiki.sipeed.com/maixpy/api/maix/video.html Construct a new Video object with specified parameters for path, dimensions, format, time base, framerate, and capture/open flags. Default values are provided for most parameters. ```python def __init__(self, path: str = '', width: int = 2560, height: int = 1440, format: maix.image.Format = ..., time_base: int = 30, framerate: int = 30, capture: bool = False, open: bool = True) -> None ``` ```cpp Video(std::string path = std::string(), int width = 2560, int height = 1440, image::Format format = image::Format::FMT_YVU420SP, int time_base = 30, int framerate = 30, bool capture = false, bool open = true) ``` -------------------------------- ### Initialize Video Context Source: https://wiki.sipeed.com/maixpy/api/maix/video.html Constructs a new Context object for media capture. Ensure media_type is set to enable capture and provide a valid timebase. ```python def __init__(self, media_type: MediaType, timebase: list[int]) -> None ``` ```cpp Context(video::MediaType media_type, std::vector timebase) ``` -------------------------------- ### Get CPU Temperature (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/sys.html C++ function to get CPU temperatures, returning a map of CPU identifiers to their temperatures in degrees. ```cpp std::map cpu_temp() ``` -------------------------------- ### Get Camera Device Name (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html C++ definition for getting the camera device name, usually the sensor's name. ```cpp std::string get_device_name() ``` -------------------------------- ### Set Example Age Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Sets the age of the Example object. This function accepts an integer argument for the new age, which must be between 0 and 100. ```python def set_age(self, age: int) -> None ``` ```cpp void set_age(int age) ``` -------------------------------- ### Say Hello Source: https://wiki.sipeed.com/maixpy/api/maix/example.html A static method that returns a greeting string by concatenating 'Example::hello_str' with the provided name. It takes a string argument and returns a string. ```python def hello(name: str) -> str ``` ```cpp static std::string hello(std::string name) ``` -------------------------------- ### Initialize Display Object Source: https://wiki.sipeed.com/maixpy/api/maix/display.html Construct a new Display object. You can specify width, height, format, and device. If 'open' is true, the display will automatically open after creation. ```python def __init__(self, width: int = -1, height: int = -1, format: maix.image.Format = ..., device: str = '', open: bool = True) -> None ``` ```cpp Display(int width = -1, int height = -1, image::Format format = image::FMT_RGB888, const std::string &device = "", bool open = true) ``` -------------------------------- ### Get Colormap Names - C++ Source: https://wiki.sipeed.com/maixpy/api/maix/image.html C++ definition to get a list of all supported colormap name strings. The 'classify' parameter filters the results. ```cpp std::vector cmap_strs(bool classify = false) ``` -------------------------------- ### Open Camera (Python) Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html Opens the camera device and starts its operation. Allows specifying resolution, format, and FPS. Returns an error code. ```python def open(self, width: int = -1, height: int = -1, format: maix.image.Format = ..., fps: float = -1, buff_num: int = -1) -> maix.err.Err: pass ``` -------------------------------- ### Image Constructor Source: https://wiki.sipeed.com/maixpy/api/maix/image.html Initializes a new Image object with specified width, height, format, and background color. ```APIDOC ## Image Constructor ### Description Initializes a new Image object. ### Parameters - **width** (int) - Required - Image width, must be greater than 0. - **height** (int) - Required - Image height, must be greater than 0. - **format** (Format) - Optional - Image format (default is determined by implementation). - **bg** (Color) - Optional - Background color. Defaults to black. If set to `image.COLOR_INVALID`, the background will not be filled, potentially saving time. ``` -------------------------------- ### Example Module Readonly Variable: var1 Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Represents a readonly module variable 'var1' within the Example module. The C++ definition is provided for reference. ```cpp const std::string var1 = "Example.var1" ``` -------------------------------- ### Get Disk Usage (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/sys.html C++ function to get disk usage information, returning a map with total and used space for a given path. ```cpp std::map disk_usage(const std::string &path = "/") ``` -------------------------------- ### Get Bootup Time in Seconds (float) Source: https://wiki.sipeed.com/maixpy/api/maix/time.html Returns the time in seconds elapsed since the system booted up, as a floating-point number. ```python def ticks_s() -> float ``` ```cpp double ticks_s() ``` -------------------------------- ### Get Camera Sensor Size (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html C++ definition for getting the camera sensor size. Returns a vector of integers representing [width, height]. ```cpp std::vector get_sensor_size() ``` -------------------------------- ### Qwen Model Constructor Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Initializes a Qwen model instance. Requires the path to the model file, which can be in MUD format. Loading can also be done later using the `load` method. ```python def __init__(self, model: str) -> None ``` ```cpp Qwen(const std::string &model) ``` -------------------------------- ### Initialize Protocol Object (Python) Source: https://wiki.sipeed.com/maixpy/api/maix/protocol.html Constructs a new Protocol object with specified buffer size and header. ```python def __init__(self, buff_size: int = 1024, header: int = 3148663466) -> None ``` -------------------------------- ### Get or Set Hold Current Percentage Source: https://wiki.sipeed.com/maixpy/api/maix/ext_dev/tmc2209.html Retrieves or sets the hold current percentage for the TMC2209 driver. Pass -1 to get the current setting. ```python def hold_current_per(self, per: int = -1) -> int ``` ```cpp int hold_current_per(int per=-1) ``` -------------------------------- ### Get All Colormap RGB Colors - C++ Source: https://wiki.sipeed.com/maixpy/api/maix/image.html C++ definition to get all 256 mapped RGB colors for a colormap. The return value is a reference to an internal table. ```cpp const std::vector> &cmap_colors_rgb(image::CMap cmap) ``` -------------------------------- ### Key.open Source: https://wiki.sipeed.com/maixpy/api/maix/peripheral/key.html Opens (initializes) the key device. If the device is already open, it will be closed and then reopened. ```APIDOC ## Method: Key.open() -> maix.err.Err Initializes and opens the key device. If the device is already open, it will be closed first before being reopened. Returns: maix.err.Err: An error code. `maix.err.Err.ERR_NONE` indicates success. ``` -------------------------------- ### Context Initialization Source: https://wiki.sipeed.com/maixpy/api/maix/video.html Constructs a new Context object for media processing. It requires specifying the media type and a time base for accurate time calculations. ```APIDOC ## __init__ Context ### Description Constructs a new Context object. ### Method __init__ ### Parameters #### Path Parameters - **media_type** (MediaType) - Required - Specifies the media type (e.g., video, audio) and enables capture if set to true. - **timebase** (list[int]) - Required - Time base for playback time calculations, in the format [numerator, denominator]. ### Request Example ```python context = Context(MediaType.VIDEO, [1, 30]) ``` ### Response #### Success Response (200) - **Context object** - A new instance of the Context class. ``` -------------------------------- ### Get NPU Frequency (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/sys.html C++ function to get NPU frequencies, returning a map of NPU identifiers to their frequencies. Indicates unsupported platforms with -1. ```cpp std::map npu_freq() ``` -------------------------------- ### Set or Get PWM Frequency Source: https://wiki.sipeed.com/maixpy/api/maix/peripheral/pwm.html Allows setting or getting the PWM frequency in Hz. A non-negative integer sets the frequency, while -1 indicates that the current frequency should be read. ```python def freq(self, freq: int = -1) -> int ``` -------------------------------- ### C++ Qwen3VL Set System Prompt Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Sets the system prompt for the Qwen3VL model in C++. ```cpp void set_system_prompt(const std::string &prompt) ``` -------------------------------- ### Get and Set Audio Channels Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Use the `channels` method to get the current audio channel count or set a new one. A positive value changes the channels. ```python def channels(self, new_channels: int = -1) -> int ``` ```cpp int channels(int new_channels = -1) ``` -------------------------------- ### Video Initialization Source: https://wiki.sipeed.com/maixpy/api/maix/video.html Constructs a new Video object, allowing configuration of video path, dimensions, format, time base, framerate, and capture/open settings. ```APIDOC ## __init__ ### Description Constructs a new Video object. ### Parameters - **path** (str) - Optional - Video path for loading or saving. If none, no file operations are performed. Supports formats like H265 or MP4. - **width** (int) - Optional - Picture width. May be set automatically. Defaults to 2560. - **height** (int) - Optional - Picture height. May be set automatically. Defaults to 1440. - **format** (maix.image.Format) - Optional - Picture pixel format. May be set automatically. Defaults to FMT_YVU420SP. - **time_base** (int) - Optional - Frame time base. Defaults to 30 (1/30 ms). - **framerate** (int) - Optional - Frames per second. Defaults to 30. - **capture** (bool) - Optional - Enable capture. If true, `capture()` can be used to get an image object. Defaults to False. - **open** (bool) - Optional - If true, `open()` is automatically called after creation. Defaults to True. ### Return None ``` -------------------------------- ### Example Class Static Member Variable: hello_str Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Represents the static 'hello_str' member variable of the Example class, with a default value of 'hello '. The C++ definition is provided for reference. ```cpp static std::string hello_str ``` -------------------------------- ### Retinaface.__init__ Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Constructor for the Retinaface class, initializing the object detection model. ```APIDOC ## Retinaface.__init__ ### Description Constructor of Retinaface class. ### Method Signature `def __init__(self, model: str = '', dual_buff: bool = True) -> None` ### Parameters * **model** (str) - Model path. Defaults to empty. The model can also be loaded later using the `load` function. * **dual_buff** (bool) - Enables dual input/output buffers to accelerate forward pass. If set to `False`, it ensures that each forward pass output corresponds to the input of that specific pass. Defaults to `True` for speed. ### Throws * If the `model` argument is not empty and loading fails, an `err::Exception` will be thrown. ``` -------------------------------- ### Example Class Member Variable: age Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Represents the 'age' member variable of the Example class, with a value range constraint of [0, 100]. The C++ definition is provided for reference. ```cpp int age ``` -------------------------------- ### MLX90640Celsius Constructor (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/ext_dev/mlx90640.html Initializes the MLX90640Celsius object. Configure I2C bus, frame rate, color mapping, temperature range, and emissivity. Auto mode for temperature range is enabled if temp_min and temp_max are equal. ```cpp MLX90640Celsius(int i2c_bus_num, ::maix::ext_dev::mlx90640::FPS fps=::maix::ext_dev::mlx90640::FPS::FPS_32, ::maix::ext_dev::cmap::Cmap cmap=::maix::ext_dev::cmap::Cmap::WHITE_HOT, float temp_min=-1, float temp_max=-1, float emissivity=0.95) ``` -------------------------------- ### Get or Set Datetime BM8563 Source: https://wiki.sipeed.com/maixpy/api/maix/ext_dev/bm8563.html Retrieves or sets the date and time on the BM8563. Pass a list representing the time tuple to set it, or call without arguments to get the current time. ```python def datetime(self, timetuple: list[int] = []) -> list[int]: ``` -------------------------------- ### YOLOv5.__init__ Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Constructor for the YOLOv5 class. Initializes the YOLOv5 object, optionally loading a model. ```APIDOC ## YOLOv5.__init__ ### Description Constructor for the YOLOv5 class. You can provide a model path during initialization or load it later using the `load` method. The `dual_buff` parameter can accelerate forward passes by preparing input buffers in advance. ### Method Signature ```python def __init__(self, model: str = '', dual_buff: bool = True) -> None ``` ### Parameters #### Parameters - **model** (str) - Optional - The path to the YOLOv5 model file. Defaults to an empty string. If provided and loading fails, an exception will be thrown. - **dual_buff** (bool) - Optional - If set to `True`, prepares dual input/output buffers to accelerate forward passes by allowing the NPU to process the next input while the current one is being forwarded. If set to `False`, ensures that each forward pass output corresponds to its input. Defaults to `True` for speed. ### Throws - **err::Exception** - If the `model` path is provided and the model fails to load. ``` -------------------------------- ### Set and Get Recorder Volume Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Control the recording volume using the `volume` method. Provide a value between 0 and 100 to set the volume, or call without arguments to get the current volume. ```python def volume(self, value: int = -1) -> int ``` ```cpp int volume(int value = -1) ``` -------------------------------- ### Get Audio Sample Format Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Retrieves the current sample format of the audio. ```python def format(self) -> Format ``` ```cpp audio::Format format() ``` -------------------------------- ### Get Depth Estimation Image (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html C++ method to get depth estimation as a normalized image. Supports image fitting and colormap selection. The returned image requires manual memory management. ```cpp image::Image *get_depth_image(image::Image &img, image::Fit fit = image::FIT_CONTAIN, image::CMap cmap = image::CMap::INFERNO) ``` -------------------------------- ### Key.__init__ Source: https://wiki.sipeed.com/maixpy/api/maix/peripheral/key.html Initializes a Key object. It can optionally set up a callback for key events, open the device automatically, specify a device path, and configure the long press duration. ```APIDOC ## Method: Key.__init__(callback: typing.Callable[[int, int], None] = None, open: bool = True, device: str = '', long_press_time: int = 2000) Constructor for the Key class. - **callback** (Callable[[int, int], None], optional): A function to be called when a key event occurs. It receives the key identifier and its state. If `None`, key states must be read manually using the `read()` method. This callback runs in a separate thread. - **open** (bool, optional): If `True`, the key device is automatically opened upon initialization. Defaults to `True`. - **device** (str, optional): Specifies the input device path (e.g., '/dev/input/eventX'). If empty, all keys are initialized. Defaults to `''`. - **long_press_time** (int, optional): The duration in milliseconds required to trigger a long press event. Defaults to `2000`ms. ``` -------------------------------- ### Set or Get PWM Duty Cycle Source: https://wiki.sipeed.com/maixpy/api/maix/peripheral/pwm.html Allows setting or getting the PWM duty cycle. The duty parameter should be a float between 0 and 100. A value of -1 indicates that only the current duty cycle should be read. ```python def duty(self, duty: float = -1) -> float ``` -------------------------------- ### Initialize Recorder Source: https://wiki.sipeed.com/maixpy/api/maix/audio.html Construct a new Recorder object. Supports PCM and WAV formats. Configure path, sample rate, format, channel, and blocking mode during initialization. ```python def __init__(self, path: str = '', sample_rate: int = 48000, format: Format = ..., channel: int = 1, block: bool = True) -> None ``` ```cpp Recorder(std::string path = std::string(), int sample_rate = 48000, audio::Format format = audio::Format::FMT_S16_LE, int channel = 1, bool block = true) ``` -------------------------------- ### hello Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Generates a greeting string by appending a name to a predefined greeting. This is a static method. ```APIDOC ## hello ### Description Generates a greeting string by appending a name to a predefined greeting. This is a static method. ### Method hello ### Parameters - **name** (str) - Required - The name of the person to greet. ### Return - **str** - A greeting string, formed by concatenating `Example::hello_str` with the provided name. ### Static True > C++ defination code: > ```cpp > static std::string hello(std::string name) > ``` ``` -------------------------------- ### set_age Source: https://wiki.sipeed.com/maixpy/api/maix/example.html Sets the age of the Example object. ```APIDOC ## set_age ### Description Sets the age of the Example object. ### Method set_age ### Parameters - **age** (int) - Required - The new age for the Example. Value range is [0, 100]. ### Static False > C++ defination code: > ```cpp > void set_age(int age) > ``` ``` -------------------------------- ### mkdir Source: https://wiki.sipeed.com/maixpy/api/maix/fs.html Creates a directory, optionally recursively and with an option to ignore if it already exists. ```APIDOC ## mkdir ### Description Creates a directory recursively. ### Parameters #### Path Parameters - **path** (str) - The path of the directory to create. - **exist_ok** (bool, optional) - If True, the function will not raise an error if the directory already exists. Defaults to True. - **recursive** (bool, optional) - If True, parent directories will be created as needed. Defaults to True. ### Returns - maix.err.Err - Returns `maix.err.Err.ERR_NONE` on success, or an error code on failure. ``` -------------------------------- ### init_before_main Source: https://wiki.sipeed.com/maixpy/api/maix/util.html Initializes preparatory operations that need to be executed before the main program runs. ```APIDOC ## init_before_main ### Description Initialize before main. The function is used to add preparatory operations that need to be executed before the main program runs. ### Signature ```python def init_before_main() -> None ``` ### C++ Definition ```cpp void init_before_main() ``` ``` -------------------------------- ### labels Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Gets the labels associated with the model. ```APIDOC ## labels ### Description Get labels. This property returns the list of labels (characters or strings) associated with the model's predictions. ### Type - **list** (string) ``` -------------------------------- ### Initialize before main execution Source: https://wiki.sipeed.com/maixpy/api/maix/util.html Use this function to add preparatory operations that need to be executed before the main program runs. ```python def init_before_main() -> None ``` ```cpp void init_before_main() ``` -------------------------------- ### Image Constructor Source: https://wiki.sipeed.com/maixpy/api/maix/image.html Initializes an Image object with specified width, height, format, and background color. The background can be left as invalid data to save time. ```python def __init__(self, width: int, height: int, format: Format = ..., bg: Color = ...) -> None ``` ```cpp Image(int width, int height, image::Format format = image::Format::FMT_RGB888, const image::Color &bg = image::COLOR_INVALID) ``` -------------------------------- ### scale Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Gets the scale value for the model. ```APIDOC ## scale ### Description Get scale value. This property returns the scale value used by the model, typically as a list of floats. ### Type - **list** (float) ``` -------------------------------- ### Initialize Protocol Object (C++) Source: https://wiki.sipeed.com/maixpy/api/maix/protocol.html C++ constructor for the Protocol class, allowing configuration of buffer size and header. ```cpp Protocol(int buff_size = 1024, uint32_t header=maix::protocol::HEADER) ``` -------------------------------- ### mean Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Gets the mean value for the model. ```APIDOC ## mean ### Description Get mean value. This property returns the mean value used by the model, typically as a list of floats. ### Type - **list** (float) ``` -------------------------------- ### Initialize TouchScreen Object Source: https://wiki.sipeed.com/maixpy/api/maix/touchscreen.html Constructs a new TouchScreen object. Optionally opens the device upon creation. ```python def __init__(self, device: str = '', open: bool = True) -> None ``` -------------------------------- ### input_height Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Get the input height of the model. ```APIDOC ## input_height ### Description Get model input height. ### Method ```python def input_height(self) -> int ``` ### Return - **int**: Model input size of height. ``` -------------------------------- ### AXP2101 Initialization Source: https://wiki.sipeed.com/maixpy/api/maix/ext_dev/axp2101.html Initializes the AXP2101 device. Returns ERR_NONE on success. ```python def init(self) -> maix.err.Err ``` -------------------------------- ### Frame Format Source: https://wiki.sipeed.com/maixpy/api/maix/pipeline.html Get the format of the frame. ```APIDOC ## format ### Description Get the format of the frame. ### Method ```python def format(self) -> maix.image.Format ``` ### Return Returns the format of the frame. ``` -------------------------------- ### Frame Height Source: https://wiki.sipeed.com/maixpy/api/maix/pipeline.html Get the height of the frame. ```APIDOC ## height ### Description Get the height of the frame. ### Method ```python def height(self) -> int ``` ### Return Returns the height of the frame. ``` -------------------------------- ### InternVL.__init__ Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Constructor for the InternVL model. Initializes the model with a specified model file. ```APIDOC ## InternVL.__init__ ### Description InternVL constructor. ### Parameters #### Parameters - **model** (str) - Required - Model file path. Can be a MUD file. If loading fails, an exception is raised. ### Static False ### C++ Definition ```cpp InternVL(const std::string &model) ``` ``` -------------------------------- ### InternVL Constructor Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Initializes the InternVL model by loading a model file. The model path is required. ```python def __init__(self, model: str) -> None ``` ```cpp InternVL(const std::string &model) ``` -------------------------------- ### height Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html Get the current height of the camera. ```APIDOC ## height ### Description Get camera height. ### Method Signature ```python def height(self) -> int ``` ### Return Value * **int** - The height of the camera. ``` -------------------------------- ### Create Directory Source: https://wiki.sipeed.com/maixpy/api/maix/fs.html Creates a directory. Supports recursive creation and handling of existing directories. ```python def mkdir(path: str, exist_ok: bool = True, recursive: bool = True) -> maix.err.Err ``` -------------------------------- ### width Source: https://wiki.sipeed.com/maixpy/api/maix/camera.html Get the current width of the camera. ```APIDOC ## width ### Description Get camera width. ### Method Signature ```python def width(self) -> int ``` ### Return Value * **int** - The width of the camera. ``` -------------------------------- ### __init__ Source: https://wiki.sipeed.com/maixpy/api/maix/nn.html Constructs a new Speech object. It can optionally load a model during initialization. ```APIDOC ## __init__ ### Description Construct a new Speech object. This constructor initializes a Speech object and can optionally load a model file if a path is provided. ### Parameters #### Path Parameters - **model** (str) - Optional. The path to the model file. If provided, the model is loaded upon construction. Defaults to an empty string. ### Throws - If the `model` argument is not empty and the model fails to load, an `err::Exception` will be thrown. ```