maix.image

maix.image module, image related definition and functions

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

Module

No module

Enum

Format

Image formats

item describe
attention for MaixPy firmware developers, update this enum will also need to update the fmt_size and fmt_names too !!!
values FMT_RGB888: RGBRGB...RGB, R at the lowest address
FMT_BGR888: BGRBGR...BGR, B at the lowest address
FMT_RGBA8888: RGBARGBA...RGBA, R at the lowest address
FMT_BGRA8888: BGRABGRA...BGRA, B at the lowest address
FMT_RGB565:
FMT_BGR565:
FMT_YUV422SP: YYY...UVUVUV...UVUV
FMT_YUV422P: YYY...UUU...VVV
FMT_YVU420SP: YYY...VUVUVU...VUVU, NV21
FMT_YUV420SP: YYY...UVUVUV...UVUV, NV12
FMT_YVU420P: YYY...VVV...UUU
FMT_YUV420P: YYY...UUU...VVV
FMT_GRAYSCALE:
FMT_BGGR6: 6-bit Bayer format with a BGGR pattern.
FMT_GBRG6: 6-bit Bayer format with a GBRG pattern.
FMT_GRBG6: 6-bit Bayer format with a GRBG pattern.
FMT_RGGB6: 6-bit Bayer format with a RGGB pattern.
FMT_BGGR8: 8-bit Bayer format with a BGGR pattern.
FMT_GBRG8: 8-bit Bayer format with a GBRG pattern.
FMT_GRBG8: 8-bit Bayer format with a GRBG pattern.
FMT_RGGB8: 8-bit Bayer format with a RGGB pattern.
FMT_BGGR10: 10-bit Bayer format with a BGGR pattern.
FMT_GBRG10: 10-bit Bayer format with a GBRG pattern.
FMT_GRBG10: 10-bit Bayer format with a GRBG pattern.
FMT_RGGB10: 10-bit Bayer format with a RGGB pattern.
FMT_BGGR12: 12-bit Bayer format with a BGGR pattern.
FMT_GBRG12: 12-bit Bayer format with a GBRG pattern.
FMT_GRBG12: 12-bit Bayer format with a GRBG pattern.
FMT_RGGB12: 12-bit Bayer format with a RGGB pattern.
FMT_UNCOMPRESSED_MAX:
FMT_COMPRESSED_MIN:
FMT_JPEG:
FMT_PNG:
FMT_COMPRESSED_MAX:
FMT_INVALID: format not valid

C++ defination code:

enum Format
    {
        FMT_RGB888 = 0, // RGBRGB...RGB, R at the lowest address
        FMT_BGR888,     // BGRBGR...BGR, B at the lowest address
        FMT_RGBA8888,   // RGBARGBA...RGBA, R at the lowest address
        FMT_BGRA8888,   // BGRABGRA...BGRA, B at the lowest address
        FMT_RGB565,
        FMT_BGR565,
        FMT_YUV422SP, // YYY...UVUVUV...UVUV
        FMT_YUV422P,  // YYY...UUU...VVV
        FMT_YVU420SP, // YYY...VUVUVU...VUVU, NV21
        FMT_YUV420SP, // YYY...UVUVUV...UVUV, NV12
        FMT_YVU420P,  // YYY...VVV...UUU
        FMT_YUV420P,  // YYY...UUU...VVV
        FMT_GRAYSCALE,
        FMT_BGGR6,      // 6-bit Bayer format with a BGGR pattern.
        FMT_GBRG6,      // 6-bit Bayer format with a GBRG pattern.
        FMT_GRBG6,      // 6-bit Bayer format with a GRBG pattern.
        FMT_RGGB6,      // 6-bit Bayer format with a RGGB pattern.
        FMT_BGGR8,      // 8-bit Bayer format with a BGGR pattern.
        FMT_GBRG8,      // 8-bit Bayer format with a GBRG pattern.
        FMT_GRBG8,      // 8-bit Bayer format with a GRBG pattern.
        FMT_RGGB8,      // 8-bit Bayer format with a RGGB pattern.
        FMT_BGGR10,     // 10-bit Bayer format with a BGGR pattern.
        FMT_GBRG10,     // 10-bit Bayer format with a GBRG pattern.
        FMT_GRBG10,     // 10-bit Bayer format with a GRBG pattern.
        FMT_RGGB10,     // 10-bit Bayer format with a RGGB pattern.
        FMT_BGGR12,     // 12-bit Bayer format with a BGGR pattern.
        FMT_GBRG12,     // 12-bit Bayer format with a GBRG pattern.
        FMT_GRBG12,     // 12-bit Bayer format with a GRBG pattern.
        FMT_RGGB12,     // 12-bit Bayer format with a RGGB pattern.
        FMT_UNCOMPRESSED_MAX,

        // compressed format below, not compressed should define upper
        FMT_COMPRESSED_MIN,
        FMT_JPEG,
        FMT_PNG,
        FMT_COMPRESSED_MAX,

        FMT_INVALID = 0xFF  // format not valid
    }

Fit

Object fit method

item describe
values FIT_NONE: no object fit, keep original
FIT_FILL: width to new width, height to new height, may be stretch
FIT_CONTAIN: keep aspect ratio, fill blank area with black color
FIT_COVER: keep aspect ratio, crop image to fit new size
FIT_MAX:

C++ defination code:

enum Fit
    {
        FIT_NONE = -1, // no object fit, keep original
        FIT_FILL = 0,  // width to new width, height to new height, may be stretch
        FIT_CONTAIN,   // keep aspect ratio, fill blank area with black color
        FIT_COVER,     // keep aspect ratio, crop image to fit new size
        FIT_MAX
    }

ResizeMethod

Resize method

item describe
values NEAREST:
BILINEAR:
BICUBIC:
AREA:
LANCZOS:
HAMMING:
RESIZE_METHOD_MAX:

C++ defination code:

enum ResizeMethod
    {
        NEAREST = 0,
        BILINEAR,
        BICUBIC,
        AREA,
        LANCZOS,
        HAMMING,
        RESIZE_METHOD_MAX
    }

ApriltagFamilies

Family of apriltag

item describe
values TAG16H5:
TAG25H7:
TAG25H9:
TAG36H10:
TAG36H11:
ARTOOLKIT:

C++ defination code:

enum ApriltagFamilies
    {
        TAG16H5   = 1,
        TAG25H7   = 2,
        TAG25H9   = 4,
        TAG36H10  = 8,
        TAG36H11  = 16,
        ARTOOLKIT = 32
    }

TemplateMatch

Template match method

item describe
values SEARCH_EX: Exhaustive search
SEARCH_DS: Diamond search

C++ defination code:

enum TemplateMatch
    {
        SEARCH_EX,  // Exhaustive search
        SEARCH_DS,  // Diamond search
    }

CornerDetector

CornerDetector class

item describe
values CORNER_FAST:
CORNER_AGAST:

C++ defination code:

enum CornerDetector
    {
        CORNER_FAST,
        CORNER_AGAST
    }

EdgeDetector

EdgeDetector class

item describe
values EDGE_CANNY:
EDGE_SIMPLE:

C++ defination code:

enum EdgeDetector
    {
        EDGE_CANNY,
        EDGE_SIMPLE,
    }

Variable

fmt_size

Image format size in bytes

item description
attention It's a copy of this variable in MaixPy,
so change it in C++ (e.g. update var in hello function) will not take effect the var inMaixPy.
So we add const for this var to avoid this mistake.
value {
3,
3,
4,
4,
2,
2,
2,
2,
1.5,
1.5,
1.5,
1.5,
1, // grayscale
0.75, // 6-bit Bayer format
0.75, // 6-bit Bayer format
0.75, // 6-bit Bayer format
0.75, // 6-bit Bayer format
1, // 8-bit Bayer format
1, // 8-bit Bayer format
1, // 8-bit Bayer format
1, // 8-bit Bayer format
1.25, // 10-bit Bayer format
1.25, // 10-bit Bayer format
1.25, // 10-bit Bayer format
1.25, // 10-bit Bayer format
1.5, // 12-bit Bayer format
1.5, // 12-bit Bayer format
1.5, // 12-bit Bayer format
1.5, // 12-bit Bayer format
0, // uncompereed_max
0, // compressed_min
1, // jpeg
1, // png
0, // compressed_max
0 // invalid
}
readonly True

C++ defination code:

const std::vector<float> fmt_size = {
        3,
        3,
        4,
        4,
        2,
        2,
        2,
        2,
        1.5,
        1.5,
        1.5,
        1.5,
        1, // grayscale
        0.75,   // 6-bit Bayer format
        0.75,   // 6-bit Bayer format
        0.75,   // 6-bit Bayer format
        0.75,   // 6-bit Bayer format
        1,      // 8-bit Bayer format
        1,      // 8-bit Bayer format
        1,      // 8-bit Bayer format
        1,      // 8-bit Bayer format
        1.25,   // 10-bit Bayer format
        1.25,   // 10-bit Bayer format
        1.25,   // 10-bit Bayer format
        1.25,   // 10-bit Bayer format
        1.5,    // 12-bit Bayer format
        1.5,    // 12-bit Bayer format
        1.5,    // 12-bit Bayer format
        1.5,    // 12-bit Bayer format
        0, // uncompereed_max
        0, // compressed_min
        1, // jpeg
        1, // png
        0, // compressed_max
        0  // invalid
        }

fmt_names

Image format string

item description
value {
"RGB888",
"BGR888",
"RGBA8888",
"BGRA8888",
"RGB565",
"BGR565",
"YUV422SP",
"YUV422P",
"YVU420SP",
"YUV420SP",
"YVU420P",
"YUV420P",
"GRAYSCALE",
"BGGR6",
"GBRG6",
"GRBG6",
"RG6B6",
"BGGR8",
"GBRG8",
"GRBG8",
"RG6B8",
"BGGR10",
"GBRG10",
"GRBG10",
"RG6B10",
"BGGR12",
"GBRG12",
"GRBG12",
"RG6B12",
"UNCOMPRESSED_MAX",
"COMPRESSED_MIN",
"JPEG",
"PNG",
"COMPRESSED_MAX",
"INVALID"
}
readonly True

C++ defination code:

const std::vector<std::string> fmt_names = {
        "RGB888",
        "BGR888",
        "RGBA8888",
        "BGRA8888",
        "RGB565",
        "BGR565",
        "YUV422SP",
        "YUV422P",
        "YVU420SP",
        "YUV420SP",
        "YVU420P",
        "YUV420P",
        "GRAYSCALE",
        "BGGR6",
        "GBRG6",
        "GRBG6",
        "RG6B6",
        "BGGR8",
        "GBRG8",
        "GRBG8",
        "RG6B8",
        "BGGR10",
        "GBRG10",
        "GRBG10",
        "RG6B10",
        "BGGR12",
        "GBRG12",
        "GRBG12",
        "RG6B12",
        "UNCOMPRESSED_MAX",
        "COMPRESSED_MIN",
        "JPEG",
        "PNG",
        "COMPRESSED_MAX",
        "INVALID"
        }

COLOR_WHITE

Predefined color white

item description
value image::Color::from_rgb(255, 255, 255)
readonly True

C++ defination code:

const image::Color COLOR_WHITE = image::Color::from_rgb(255, 255, 255)

COLOR_BLACK

Predefined color black

item description
value image::Color::from_rgb(0, 0, 0)
readonly True

C++ defination code:

const image::Color COLOR_BLACK = image::Color::from_rgb(0, 0, 0)

COLOR_RED

Predefined color red

item description
value image::Color::from_rgb(255, 0, 0)
readonly True

C++ defination code:

const image::Color COLOR_RED = image::Color::from_rgb(255, 0, 0)

COLOR_GREEN

Predefined color green

item description
value image::Color::from_rgb(0, 255, 0)
readonly True

C++ defination code:

const image::Color COLOR_GREEN = image::Color::from_rgb(0, 255, 0)

COLOR_BLUE

Predefined color blue

item description
value image::Color::from_rgb(0, 0, 255)
readonly True

C++ defination code:

const image::Color COLOR_BLUE = image::Color::from_rgb(0, 0, 255)

COLOR_YELLOW

Predefined color yellow

item description
value image::Color::from_rgb(255, 255, 0)
readonly True

C++ defination code:

const image::Color COLOR_YELLOW = image::Color::from_rgb(255, 255, 0)

COLOR_PURPLE

Predefined color purple

item description
value image::Color::from_rgb(143, 0, 255)
readonly True

C++ defination code:

const image::Color COLOR_PURPLE = image::Color::from_rgb(143, 0, 255)

COLOR_ORANGE

Predefined color orange

item description
value image::Color::from_rgb(255, 127, 0)
readonly True

C++ defination code:

const image::Color COLOR_ORANGE = image::Color::from_rgb(255, 127, 0)

COLOR_GRAY

Predefined color gray

item description
value image::Color::from_rgb(127, 127, 127)
readonly True

C++ defination code:

const image::Color COLOR_GRAY = image::Color::from_rgb(127, 127, 127)

Function

resize_map_pos

def resize_map_pos(w_in: int, h_in: int, w_out: int, h_out: int, fit: Fit, x: int, y: int, w: int = -1, h: int = -1) -> list[int]

map point position or rectangle position from one image size to another image size(resize)

item description
param int: h_out target image height
fit: resize method, see maix.image.Fit
x: original point x, or rectagle left-top point's x
y: original point y, or rectagle left-top point's y
w: original rectagle width, can be -1 if not use this arg, default -1.
h: original rectagle height, can be -1 if not use this arg, default -1.
return list type, [x, y] if map point, [x, y, w, h] if resize rectangle.

C++ defination code:

std::vector<int> resize_map_pos(int w_in, int h_in, int w_out, int h_out, image::Fit fit, int x, int y, int w = -1, int h = -1)

resize_map_pos (overload 1)

map point position or rectangle position from this image size to another image size(resize)

item description
param int: h_out target image height
fit: resize method, see maix.image.Fit
x: original point x, or rectagle left-top point's x
y: original point y, or rectagle left-top point's y
w: original rectagle width, can be -1 if not use this arg, default -1.
h: original rectagle height, can be -1 if not use this arg, default -1.
return list type, [x, y] if map point, [x, y, w, h] if resize rectangle.

C++ defination code:

std::vector<int> resize_map_pos(int w_out, int h_out, image::Fit fit, int x, int y, int w = -1, int h = -1)

resize_map_pos_reverse

def resize_map_pos_reverse(w_in: int, h_in: int, w_out: int, h_out: int, fit: Fit, x: int, y: int, w: int = -1, h: int = -1) -> list[int]

reverse resize_map_pos method, when we call image.resize method resiz image 'a' to image 'b', we want to known the original position on 'a' whith a knew point on 'b'

item description
param int: h_out image height after resized
fit: resize method, see maix.image.Fit
x: point on resized image x, or rectagle left-top point's x
y: original point y, or rectagle left-top point's y
w: original rectagle width, can be -1 if not use this arg, default -1.
h: original rectagle height, can be -1 if not use this arg, default -1.
return list type, [x, y] if map point, [x, y, w, h] if resize rectangle.

C++ defination code:

std::vector<int> resize_map_pos_reverse(int w_in, int h_in, int w_out, int h_out, image::Fit fit, int x, int y, int w = -1, int h = -1)

load

def load(path: str, format: Format = ...) -> Image

Load image from file, and convert to Image object

item description
param path: image file path
format: read as this format, if not match, will convert to this format, by default is RGB888
return Image object, if load failed, will return None(nullptr in C++), so you should care about it.

C++ defination code:

image::Image *load(const char *path, image::Format format = image::Format::FMT_RGB888)

from_bytes

def from_bytes(width: int, height: int, format: Format, data: maix.Bytes(bytes), copy: bool = True) -> Image

Create image from bytes

item description
param width: image width
height: image height
format: image format
data: image data, if data is None, will malloc memory for image data
If the image is in jpeg format, data must be filled in.
copy: if true and data is not None, will copy data to new buffer, else will use data directly. default is true to avoid memory leak.
Use it carefully!!!
return Image object

C++ defination code:

image::Image *from_bytes(int width, int height, image::Format format, Bytes *data, bool copy = true)

load_font

def load_font(name: str, path: str, size: int = 16) -> maix.err.Err

Load font from file

item description
param name: font name, used to identify font
path: font file path, support ttf, ttc, otf
size: font size, font height, by default is 16
return error code, err::ERR_NONE is ok, other is error

C++ defination code:

err::Err load_font(const std::string &name, const char *path, int size = 16)

set_default_font

Set default font, if not call this method, default is hershey_plain

item description
param name: font name, supported names can be get by fonts()
return error code, err::ERR_NONE is ok, other is error

C++ defination code:

err::Err set_default_font(const std::string &name)

fonts

def fonts() -> list[str]

Get all loaded fonts

item description
return all loaded fonts, string list type

C++ defination code:

std::vector<std::string> *fonts()

string_size

def string_size(string: str, scale: float = 1, thickness: int = 1, font: str = '') -> Size

Get text rendered width and height

item description
param string: text content
scale: font scale, by default(value is 1)
thickness: text thickness(line width), by default(value is 1)
return text rendered width and height, [width, height]

C++ defination code:

image::Size string_size(std::string string, float scale = 1, int thickness = 1, const std::string &font = "")

cv2image

def cv2image(array: numpy.ndarray[numpy.uint8], bgr: bool = True, copy: bool = True) -> Image

OpenCV Mat(numpy array object) to Image object

item description
param array: numpy array object, must be a 3-dim or 2-dim continuous array with shape hwc or hw
bgr: if set bgr, the return image will be marked as BGR888 or BGRA8888 format, grayscale will ignore this arg.
copy: if true, will alloc new buffer and copy data, else will directly use array's data buffer, default true.
Use this arg carefully, when set to false, ther array MUST keep alive until we don't use the return img of this func, or will cause program crash.
return Image object

C++ defination code:

image::Image *cv2image(py::array_t<uint8_t, py::array::c_style> array, bool bgr = true, bool copy = true)

image2cv

def image2cv(img: Image, ensure_bgr: bool = True, copy: bool = True) -> numpy.ndarray[numpy.uint8]

Image object to OpenCV Mat(numpy array object)

item description
param img: Image object, maix.image.Image type.
ensure_bgr: auto convert to BGR888 or BGRA8888 if img format is not BGR or BGRA, if set to false, will not auto convert and directly use img's data, default true.
copy: Whether alloc new image and copy data or not, if ensure_bgr and img is not bgr or bgra format, always copy,
if not copy, array object will directly use img's data buffer, will faster but change array will affect img's data, default true.
attention take care of ensure_bgr and copy param.
return numpy array object

C++ defination code:

py::array_t<uint8_t, py::array::c_style> image2cv(image::Image *img, bool ensure_bgr = true, bool copy = true)

Class

Size

Image size type

C++ defination code:

class Size

__init__

def __init__(self, width: int = 0, height: int = 0) -> None

Construct a new Size object

item description
type func
param width: image width
height: image height
static False

C++ defination code:

Size(int width = 0, int height = 0)

width

def width(self, width: int = -1) -> int

width of size

item description
type func
param width: set new width, if not set, only return current width
static False

C++ defination code:

int width(int width = -1)

height

def height(self, height: int = -1) -> int

height of size

item description
type func
param height: set new height, if not set, only return current height
static False

C++ defination code:

int height(int height = -1)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: 0 for width, 1 for height
return int& width or height
static False

C++ defination code:

int &operator[](int index)

__str__

def __str__(self) -> str

to string

item description
type func
static False

C++ defination code:

std::string __str__()

Line

Line class

C++ defination code:

class Line

__init__

def __init__(self, x1: int, y1: int, x2: int, y2: int, magnitude: int = 0, theta: int = 0, rho: int = 0) -> None

Line constructor

item description
type func
param x1: coordinate x1 of the straight line
y1: coordinate y1 of the straight line
x2: coordinate x2 of the straight line
y2: coordinate y2 of the straight line
magnitude: magnitude of the straight line after Hough transformation
theta: angle of the straight line after Hough transformation
rho: p-value of the straight line after Hough transformation
static False

C++ defination code:

Line(int x1, int y1, int x2, int y2, int magnitude = 0, int theta = 0, int rho = 0)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] get x1 of line
[1] get y1 of line
[2] get x2 of line
[3] get y2 of line
[4] get length of line
[5] get magnitude of the straight line after Hough transformation
[6] get angle of the straight line after Hough transformation (0-179 degrees)
[7] get p-value of the straight line after Hough transformation
return int&
static False

C++ defination code:

int &__getitem__(int index)

x1

def x1(self) -> int

get x1 of line

item description
type func
return return x1 of the line, type is int
static False

C++ defination code:

int x1()

y1

def y1(self) -> int

get y1 of line

item description
type func
return return y1 of the line, type is int
static False

C++ defination code:

int y1()

x2

def x2(self) -> int

get x2 of line

item description
type func
return return x2 of the line, type is int
static False

C++ defination code:

int x2()

y2

def y2(self) -> int

get y2 of line

item description
type func
return return y2 of the line, type is int
static False

C++ defination code:

int y2()

length

def length(self) -> int

get length of line

item description
type func
return return length of the line, type is int
static False

C++ defination code:

int length()

magnitude

def magnitude(self) -> int

get magnitude of the straight line after Hough transformation

item description
type func
return return magnitude, type is int
static False

C++ defination code:

int magnitude()

theta

def theta(self) -> int

get angle of the straight line after Hough transformation (0-179 degrees)

item description
type func
return return angle, type is int
static False

C++ defination code:

int theta()

rho

def rho(self) -> int

get p-value of the straight line after Hough transformation

item description
type func
return return p-value, type is int
static False

C++ defination code:

int rho()

Rect

Rect class

C++ defination code:

class Rect

__init__

def __init__(self, corners: list[list[int]], x: int, y: int, w: int, h: int, magnitude: int = 0) -> None

Rect constructor

item description
type func
param corners: corners of rect
x: coordinate x of the straight line
y: coordinate y of the straight line
w: coordinate w of the straight line
h: coordinate h of the straight line
magnitude: magnitude of the straight line after Hough transformation
static False

C++ defination code:

Rect(std::vector<std::vector<int>> &corners, int x, int y, int w, int h, int magnitude = 0)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] get x of rect
[1] get y of rect
[2] get w of rect
[3] get h of rect
[4] get magnitude of the straight line after Hough transformation
return int&
static False

C++ defination code:

int &__getitem__(int index)

corners

def corners(self) -> list[list[int]]

get corners of rect

item description
type func
return return the coordinate of the rect.
static False

C++ defination code:

std::vector<std::vector<int>> corners()

rect

def rect(self) -> list[int]

get rectangle of rect

item description
type func
return return the rectangle of the rect. format is {x, y, w, h}, type is std::vector
static False

C++ defination code:

std::vector<int> rect()

x

def x(self) -> int

get x of rect

item description
type func
return return x of the rect, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int

get y of rect

item description
type func
return return y of the rect, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int

get w of rect

item description
type func
return return w of the rect, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int

get h of rect

item description
type func
return return h of the rect, type is int
static False

C++ defination code:

int h()

magnitude

def magnitude(self) -> int

get magnitude of the straight line after Hough transformation

item description
type func
return return magnitude, type is int
static False

C++ defination code:

int magnitude()

Circle

circle class

C++ defination code:

class Circle

__init__

def __init__(self, x: int, y: int, r: int, magnitude: int) -> None

Circle constructor

item description
type func
param x: coordinate x of the circle
y: coordinate y of the circle
r: coordinate r of the circle
magnitude: coordinate y2 of the straight line
static False

C++ defination code:

Circle(int x, int y, int r, int magnitude)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] get x of circle
[1] get y of circle
[2] get r of circle
[3] get magnitude of the circle after Hough transformation
return int&
static False

C++ defination code:

int &__getitem__(int index)

x

def x(self) -> int

get x of circle

item description
type func
return return x of the circle, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int

get y of circle

item description
type func
return return y of the circle, type is int
static False

C++ defination code:

int y()

r

def r(self) -> int

get r of circle

item description
type func
return return r of the circle, type is int
static False

C++ defination code:

int r()

magnitude

def magnitude(self) -> int

get magnitude of the circle after Hough transformation

item description
type func
return return magnitude, type is int
static False

C++ defination code:

int magnitude()

Blob

Blob class

C++ defination code:

class Blob

__init__

def __init__(self, rect: list[int], corners: list[list[int]], mini_corners: list[list[int]], cx: float, cy: float, pixels: int, rotation: float, code: int, count: int, perimeter: int, roundness: float, x_hist_bins: list[int], y_hist_bins: list[int]) -> None

Blob constructor

item description
type func
param rect: blob rect, type is std::vector
corners: blob corners, type is std::vector<std::vector>
mini_corners: blob mini_corners, type is std::vector<std::vector>
cx: blob center x, type is float
cy: blob center y, type is float
pixels: blob pixels, type is int
rotation: blob rotation, type is float
code: blob code, type is int
count: blob count, type is int
perimeter: blob perimeter, type is int
roundness: blob roundness, type is float
x_hist_bins: blob x_hist_bins, type is std::vector
y_hist_bins: blob y_hist_bins, type is std::vector
static False

C++ defination code:

Blob(std::vector<int> &rect, std::vector<std::vector<int>> &corners, std::vector<std::vector<int>> &mini_corners,float cx, float cy, int pixels, float rotation, int code, int count, int perimeter, float roundness, std::vector<int> &x_hist_bins, std::vector<int> &y_hist_bins)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] Returns the blob’s bounding box x coordinate
[1] Returns the blob’s bounding box y coordinate
[2] Returns the blob’s bounding box w coordinate
[3] Returns the blob’s bounding box h coordinate
[4] Returns the number of pixels that are part of this blob
[5] Returns the centroid x position of the blob
[6] Returns the centroid y position of the blob
return int& width or height
static False

C++ defination code:

int &__getitem__(int index)

corners

def corners(self) -> list[list[int]]

get blob corners

item description
type func
return Returns a list of 4 (x,y) tuples of the 4 corners of the object.
(x0, y0)___________(x1, y1)



___________
(x3, y3) (x2, y2)
note: the order of corners may change
static False

C++ defination code:

std::vector<std::vector<int>> corners()

mini_corners

def mini_corners(self) -> list[list[int]]

get blob mini corners

item description
type func
return Returns a list of 4 (x,y) tuples of the 4 corners than bound the min area rectangle of the blob.
(x0, y0)___________(x1, y1)



___________
(x3, y3) (x2, y2)
note: the order of corners may change
static False

C++ defination code:

std::vector<std::vector<int>> mini_corners()

rect

def rect(self) -> list[int]

get blob rect

item description
type func
return Returns the center coordinates and width and height of the rectangle. format is (x, y, w, h)
w
(x, y) ___________

h

___________
static False

C++ defination code:

std::vector<int> rect()

x

def x(self) -> int

get blob x of the upper left coordinate

item description
type func
return Returns the x coordinate of the upper left corner of the rectangle.
static False

C++ defination code:

int x()

y

def y(self) -> int

get blob y of the upper left coordinate

item description
type func
return Returns the y coordinate of the upper left corner of the rectangle.
static False

C++ defination code:

int y()

w

def w(self) -> int

get blob width

item description
type func
return Returns the blob’s bounding box w coordinate
static False

C++ defination code:

int w()

h

def h(self) -> int

get blob height

item description
type func
return Returns the blob’s bounding box h coordinate
static False

C++ defination code:

int h()

pixels

def pixels(self) -> int

get blob pixels

item description
type func
return Returns the number of pixels that are part of this blob.
static False

C++ defination code:

int pixels()

cx

def cx(self) -> int

get blob center x

item description
type func
return Returns the centroid x position of the blob
static False

C++ defination code:

int cx()

cy

def cy(self) -> int

get blob center y

item description
type func
return Returns the centroid y position of the blob
static False

C++ defination code:

int cy()

cxf

def cxf(self) -> float

get blob center x

item description
type func
return Returns the centroid x position of the blob
static False

C++ defination code:

float cxf()

cyf

def cyf(self) -> float

get blob center y

item description
type func
return Returns the centroid y position of the blob
static False

C++ defination code:

float cyf()

rotation

def rotation(self) -> float

get blob rotation

item description
type func
return Returns the rotation of the blob in radians (float). If the blob is like a pencil or pen this value will be unique for 0-180 degrees.
static False

C++ defination code:

float rotation()

rotation_rad

def rotation_rad(self) -> float

get blob rotation_rad

item description
type func
return Returns the rotation of the blob in radians
static False

C++ defination code:

float rotation_rad()

rotation_deg

def rotation_deg(self) -> int

get blob rotation_deg

item description
type func
return Returns the rotation of the blob in degrees.
static False

C++ defination code:

int rotation_deg()

code

def code(self) -> int

get blob code

item description
type func
return Returns a 32-bit binary number with a bit set in it for each color threshold that’s part of this blob
static False

C++ defination code:

int code()

count

def count(self) -> int

get blob count

item description
type func
return Returns the number of blobs merged into this blob.
static False

C++ defination code:

int count()

perimeter

def perimeter(self) -> int

get blob merge_cnt

item description
type func
return Returns the number of pixels on this blob’s perimeter.
static False

C++ defination code:

int perimeter()

roundness

def roundness(self) -> float

get blob roundness

item description
type func
return Returns a value between 0 and 1 representing how round the object is
static False

C++ defination code:

float roundness()

elongation

def elongation(self) -> float

get blob elongation

item description
type func
returnReturns a value between 0 and 1 representing how long (not round) the object is
static False

C++ defination code:

float elongation()

area

def area(self) -> int

get blob area

item description
type func
return Returns the area of the bounding box around the blob
static False

C++ defination code:

int area()

density

def density(self) -> float

get blob density

item description
type func
return Returns the density ratio of the blob
static False

C++ defination code:

float density()

extent

def extent(self) -> float

Alias for blob.density()

item description
type func
return Returns the density ratio of the blob
static False

C++ defination code:

float extent()

compactness

def compactness(self) -> float

get blob compactness

item description
type func
return Returns the compactness ratio of the blob
static False

C++ defination code:

float compactness()

solidity

def solidity(self) -> float

get blob solidity

item description
type func
return Returns the solidity ratio of the blob
static False

C++ defination code:

float solidity()

convexity

def convexity(self) -> float

get blob convexity

item description
type func
return Returns a value between 0 and 1 representing how convex the object is
static False

C++ defination code:

float convexity()

x_hist_bins

def x_hist_bins(self) -> list[int]

get blob x_hist_bins

item description
type func
return Returns the x_hist_bins of the blob
static False

C++ defination code:

std::vector<int> x_hist_bins()

y_hist_bins

def y_hist_bins(self) -> list[int]

get blob y_hist_bins

item description
type func
return Returns the y_hist_bins of the blob
static False

C++ defination code:

std::vector<int> y_hist_bins()

major_axis_line

def major_axis_line(self) -> list[int]

get blob major_axis_line

item description
type func
return Returns a line tuple (x1, y1, x2, y2) of the minor axis of the blob.
static False

C++ defination code:

std::vector<int> major_axis_line()

minor_axis_line

def minor_axis_line(self) -> list[int]

get blob minor_axis_line

item description
type func
return Returns a line tuple (x1, y1, x2, y2) of the minor axis of the blob.
static False

C++ defination code:

std::vector<int> minor_axis_line()

enclosing_circle

def enclosing_circle(self) -> list[int]

get blob enclosing_circle

item description
type func
return Returns a circle tuple (x, y, r) of the circle that encloses the min area rectangle of a blob.
static False

C++ defination code:

std::vector<int> enclosing_circle()

enclosed_ellipse

def enclosed_ellipse(self) -> list[int]

get blob enclosed_ellipse

item description
type func
return Returns an ellipse tuple (x, y, rx, ry, rotation) of the ellipse that fits inside of the min area rectangle of a blob.
static False

C++ defination code:

std::vector<int> enclosed_ellipse()

QRCode

QRCode class

C++ defination code:

class QRCode

__init__

def __init__(self, rect: list[int], corners: list[list[int]], payload: str, version: int, ecc_level: int, mask: int, data_type: int, eci: int) -> None

QRCode constructor

item description
type func
param rect: rect of corners, type is std::vector
corners: corners of QRCode
payload: payload of the QRCode
version: version of the QRCode
ecc_level: ecc_level of the QRCode
mask: mask of the QRCode
data_type: data_type of the QRCode
eci: eci of the QRCode
static False

C++ defination code:

QRCode(std::vector<int> &rect, std::vector<std::vector<int>> &corners, std::string &payload, int version, int ecc_level, int mask, int data_type, int eci)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] Returns the qrcode’s bounding box x coordinate
[1] Returns the qrcode’s bounding box y coordinate
[2] Returns the qrcode’s bounding box w coordinate
[3] Returns the qrcode’s bounding box h coordinate
[4] Not support this index, try to use payload() method
[5] Returns the version of qrcode
[6] Returns the error correction level of qrcode
[7] Returns the mask of qrcode
[8] Returns the datatype of qrcode
[9] Returns the eci of qrcode
return int&
static False

C++ defination code:

int &__getitem__(int index)

corners

def corners(self) -> list[list[int]]

get coordinate of QRCode

item description
type func
return return the coordinate of the QRCode.
static False

C++ defination code:

std::vector<std::vector<int>> corners()

rect

def rect(self) -> list[int]

get rectangle of QRCode

item description
type func
return return the rectangle of the QRCode. format is {x, y, w, h}, type is std::vector
static False

C++ defination code:

std::vector<int> rect()

x

def x(self) -> int

get x of QRCode

item description
type func
return return x of the QRCode, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int

get y of QRCode

item description
type func
return return y of the QRCode, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int

get w of QRCode

item description
type func
return return w of the QRCode, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int

get h of QRCode

item description
type func
return return h of the QRCode, type is int
static False

C++ defination code:

int h()

payload

def payload(self) -> str

get QRCode payload

item description
type func
return return area of the QRCode
static False

C++ defination code:

std::string payload()

version

def version(self) -> int

get QRCode version

item description
type func
return return version of the QRCode
static False

C++ defination code:

int version()

ecc_level

def ecc_level(self) -> int

get QRCode error correction level

item description
type func
return return error correction level of the QRCode
static False

C++ defination code:

int ecc_level()

mask

def mask(self) -> int

get QRCode mask

item description
type func
return return mask of the QRCode
static False

C++ defination code:

int mask()

data_type

def data_type(self) -> int

get QRCode dataType

item description
type func
return return mask of the QRCode
static False

C++ defination code:

int data_type()

eci

def eci(self) -> int

get QRCode eci

item description
type func
return return data of the QRCode
static False

C++ defination code:

int eci()

is_numeric

def is_numeric(self) -> bool

check QRCode is numeric

item description
type func
return return true if the result type of the QRCode is numeric
static False

C++ defination code:

bool is_numeric()

is_alphanumeric

def is_alphanumeric(self) -> bool

check QRCode is alphanumeric

item description
type func
return return true if the result type of the QRCode is alphanumeric
static False

C++ defination code:

bool is_alphanumeric()

is_binary

def is_binary(self) -> bool

check QRCode is binary

item description
type func
return return true if the result type of the QRCode is binary
static False

C++ defination code:

bool is_binary()

is_kanji

def is_kanji(self) -> bool

check QRCode is kanji

item description
type func
return return true if the result type of the QRCode is kanji
static False

C++ defination code:

bool is_kanji()

AprilTag

AprilTag class

C++ defination code:

class AprilTag

__init__

def __init__(self, rect: list[int], corners: list[list[int]], id: int, famliy: int, centroid_x: float, centroid_y: float, rotation: float, decision_margin: float, hamming: int, goodness: float, x_translation: float, y_translation: float, z_translation: float, x_rotation: float, y_rotation: float, z_rotation: float) -> None

AprilTag constructor

item description
type func
param rect: Inlucdes the top-left corner and the width and height of the rectangle. format is {x, y, w, h}, type is std::vector
corners: Includes the four corners of the rectangle. format is {{x0, y0}, {x1, y1}, {x2, y2}, {x3, y3}}, type is std::vector<std::vector>
id: The id of the AprilTag
famliy: The family of the AprilTag
centroid_x: The x coordinate of the center of the AprilTag
centroid_y: The y coordinate of the center of the AprilTag
rotation: The rotation of the AprilTag
decision_margin: The decision_margin of the AprilTag
hamming: The hamming of the AprilTag
goodness: The goodness of the AprilTag
x_translation: The x_translation of the AprilTag
y_translation: The y_translation of the AprilTag
z_translation: The z_translation of the AprilTag
x_rotation: The x_rotation of the AprilTag
y_rotation: The y_rotation of the AprilTag
z_rotation: The z_rotation of the AprilTag
static False

C++ defination code:

AprilTag(std::vector<int> &rect, std::vector<std::vector<int>> &corners, int id, int famliy, float centroid_x, float centroid_y, float rotation, float decision_margin, int hamming, float goodness, float x_translation, float y_translation, float z_translation, float x_rotation, float y_rotation, float z_rotation)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] Returns the apriltag’s bounding box x coordinate
[1] Returns the apriltag’s bounding box y coordinate
[2] Returns the apriltag’s bounding box w coordinate
[3] Returns the apriltag’s bounding box h coordinate
[4] Returns the apriltag’s id
[5] Returns the apriltag’s family
[6] Not support
[7] Not support
[8] Not support
[9] Not support
[10] Returns the apriltag’s hamming
[11] Not support
[12] Not support
[13] Not support
[14] Not support
[15] Not support
[16] Not support
[17] Not support
return int&
static False

C++ defination code:

int &__getitem__(int index)

corners

def corners(self) -> list[list[int]]

get coordinate of AprilTag

item description
type func
return return the coordinate of the AprilTag.
static False

C++ defination code:

std::vector<std::vector<int>> corners()

rect

def rect(self) -> list[int]

get rectangle of AprilTag

item description
type func
return return the rectangle of the AprilTag. format is {x, y, w, h}, type is std::vector
static False

C++ defination code:

std::vector<int> rect()

x

def x(self) -> int

get x of AprilTag

item description
type func
return return x of the AprilTag, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int

get y of AprilTag

item description
type func
return return y of the AprilTag, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int

get w of AprilTag

item description
type func
return return w of the AprilTag, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int

get h of AprilTag

item description
type func
return return h of the AprilTag, type is int
static False

C++ defination code:

int h()

id

def id(self) -> int

get id of AprilTag

item description
type func
return return id of the AprilTag, type is int
static False

C++ defination code:

int id()

family

def family(self) -> int

get family of AprilTag

item description
type func
return return family of the AprilTag, type is int
static False

C++ defination code:

int family()

cx

def cx(self) -> int

get cx of AprilTag

item description
type func
return return cx of the AprilTag, type is int
static False

C++ defination code:

int cx()

cxf

def cxf(self) -> float

get cxf of AprilTag

item description
type func
return return cxf of the AprilTag, type is float
static False

C++ defination code:

float cxf()

cy

def cy(self) -> int

get cy of AprilTag

item description
type func
return return cy of the AprilTag, type is int
static False

C++ defination code:

int cy()

cyf

def cyf(self) -> float

get cyf of AprilTag

item description
type func
return return cyf of the AprilTag, type is float
static False

C++ defination code:

float cyf()

rotation

def rotation(self) -> float

get rotation of AprilTag

item description
type func
return return rotation of the AprilTag, type is float
static False

C++ defination code:

float rotation()

decision_margin

def decision_margin(self) -> float

Get decision_margin of AprilTag

item description
type func
return Returns the quality of the apriltag match (0.0 - 1.0) where 1.0 is the best.
static False

C++ defination code:

float decision_margin()

hamming

def hamming(self) -> int

get hamming of AprilTag

item description
type func
return Returns the number of accepted bit errors for this tag.
return 0, means 0 bit errors will be accepted.
1 is TAG25H7, means up to 1 bit error may be accepted
2 is TAG25H9, means up to 3 bit errors may be accepted
3 is TAG36H10, means up to 3 bit errors may be accepted
4 is TAG36H11, means up to 4 bit errors may be accepted
5 is ARTOOLKIT, means 0 bit errors will be accepted
static False

C++ defination code:

int hamming()

goodness

def goodness(self) -> float

get goodness of AprilTag

item description
type func
return return goodness of the AprilTag, type is float
Note: This value is always 0.0 for now.
static False

C++ defination code:

float goodness()

x_translation

def x_translation(self) -> float

get x_translation of AprilTag

item description
type func
return return x_translation of the AprilTag, type is float
static False

C++ defination code:

float x_translation()

y_translation

def y_translation(self) -> float

get y_translation of AprilTag

item description
type func
return return y_translation of the AprilTag, type is float
static False

C++ defination code:

float y_translation()

z_translation

def z_translation(self) -> float

get z_translation of AprilTag

item description
type func
return return z_translation of the AprilTag, type is float
static False

C++ defination code:

float z_translation()

x_rotation

def x_rotation(self) -> float

get x_rotation of AprilTag

item description
type func
return return x_rotation of the AprilTag, type is float
static False

C++ defination code:

float x_rotation()

y_rotation

def y_rotation(self) -> float

get y_rotation of AprilTag

item description
type func
return return y_rotation of the AprilTag, type is float
static False

C++ defination code:

float y_rotation()

z_rotation

def z_rotation(self) -> float

get z_rotation of AprilTag

item description
type func
return return z_rotation of the AprilTag, type is float
static False

C++ defination code:

float z_rotation()

DataMatrix

DataMatrix class

C++ defination code:

class DataMatrix

__init__

def __init__(self, rect: list[int], corners: list[list[int]], payload: str, rotation: float, rows: int, columns: int, capacity: int, padding: int) -> None

DataMatrix constructor

item description
type func
param rect: Inlucdes the top-left corner and the width and height of the rectangle. format is {x, y, w, h}, type is std::vector
corners: Includes the four corners of the rectangle. format is {{x0, y0}, {x1, y1}, {x2, y2}, {x3, y3}}, type is std::vector<std::vector>
payload: The payload of the DataMatrix
rotation: The rotation of the DataMatrix
rows: The rows of the DataMatrix
columns: The columns of the DataMatrix
capacity: The capacity of the DataMatrix
padding: The padding of the DataMatrix
static False

C++ defination code:

DataMatrix(std::vector<int> &rect, std::vector<std::vector<int>> &corners, std::string &payload, float rotation, int rows, int columns, int capacity, int padding)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] get x of DataMatrix
[1] get y of DataMatrix
[2] get w of DataMatrix
[3] get h of DataMatrix
[4] Not support this index, try to use payload() method
[5] Not support this index, try to use rotation() method
[6] get rows of DataMatrix
[7] get columns of DataMatrix
[8] get capacity of DataMatrix
[9] get padding of DataMatrix
return int&
static False

C++ defination code:

int &__getitem__(int index)

corners

def corners(self) -> list[list[int]]

get coordinate of DataMatrix

item description
type func
return return the coordinate of the DataMatrix.
static False

C++ defination code:

std::vector<std::vector<int>> corners()

rect

def rect(self) -> list[int]

get rectangle of DataMatrix

item description
type func
return return the rectangle of the DataMatrix. format is {x, y, w, h}, type is std::vector
static False

C++ defination code:

std::vector<int> rect()

x

def x(self) -> int

get x of DataMatrix

item description
type func
return return x of the DataMatrix, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int

get y of DataMatrix

item description
type func
return return y of the DataMatrix, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int

get w of DataMatrix

item description
type func
return return w of the DataMatrix, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int

get h of DataMatrix

item description
type func
return return h of the DataMatrix, type is int
static False

C++ defination code:

int h()

payload

def payload(self) -> str

get payload of DataMatrix

item description
type func
return return payload of the DataMatrix, type is std::string
static False

C++ defination code:

std::string payload()

rotation

def rotation(self) -> float

get rotation of DataMatrix

item description
type func
return return rotation of the DataMatrix, type is float
static False

C++ defination code:

float rotation()

rows

def rows(self) -> int

get rows of DataMatrix

item description
type func
return return rows of the DataMatrix, type is int
static False

C++ defination code:

int rows()

columns

def columns(self) -> int

get columns of DataMatrix

item description
type func
return return columns of the DataMatrix, type is int
static False

C++ defination code:

int columns()

capacity

def capacity(self) -> int

get capacity of DataMatrix

item description
type func
return returns how many characters could fit in this data matrix, type is int
static False

C++ defination code:

int capacity()

padding

def padding(self) -> int

get padding of DataMatrix

item description
type func
return returns how many unused characters are in this data matrix, type is int
static False

C++ defination code:

int padding()

BarCode

BarCode class

C++ defination code:

class BarCode

__init__

def __init__(self, rect: list[int], corners: list[list[int]], payload: str, type: int, rotation: float, quality: int) -> None

BarCode constructor

item description
type func
param rect: Inlucdes the top-left corner and the width and height of the rectangle. format is {x, y, w, h}, type is std::vector
corners: Includes the four corners of the rectangle. format is {{x0, y0}, {x1, y1}, {x2, y2}, {x3, y3}}, type is std::vector<std::vector>
payload: The payload of the BarCode
type: The type of the BarCode
rotation: The rotation of the BarCode
quality: The quality of the BarCode
static False

C++ defination code:

BarCode(std::vector<int> &rect, std::vector<std::vector<int>> &corners, std::string &payload, int type, float rotation, int quality)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: [0] get x of BarCode
[1] get y of BarCode
[2] get w of BarCode
[3] get h of BarCode
[4] Not support this index, try to use payload() method
[5] get type of BarCode
[6] Not support this index, try to use rotation() method
[7] get quality of BarCode
return int&
static False

C++ defination code:

int &__getitem__(int index)

corners

def corners(self) -> list[list[int]]

get coordinate of BarCode

item description
type func
return return the coordinate of the BarCode.
static False

C++ defination code:

std::vector<std::vector<int>> corners()

rect

def rect(self) -> list[int]

get rectangle of BarCode

item description
type func
return return the rectangle of the BarCode. format is {x, y, w, h}, type is std::vector
static False

C++ defination code:

std::vector<int> rect()

x

def x(self) -> int

get x of BarCode

item description
type func
return return x of the BarCode, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int

get y of BarCode

item description
type func
return return y of the BarCode, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int

get w of BarCode

item description
type func
return return w of the BarCode, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int

get h of BarCode

item description
type func
return return h of the BarCode, type is int
static False

C++ defination code:

int h()

payload

def payload(self) -> str

get payload of BarCode

item description
type func
return return payload of the BarCode, type is std::string
static False

C++ defination code:

std::string payload()

type

def type(self) -> int

get type of BarCode

item description
type func
return return type of the BarCode, type is int
static False

C++ defination code:

int type()

rotation

def rotation(self) -> float

get rotation of BarCode

item description
type func
return return rotation of the BarCode, type is float. FIXME: always return 0.0
static False

C++ defination code:

float rotation()

quality

def quality(self) -> int

get quality of BarCode

item description
type func
return return quality of the BarCode, type is int
static False

C++ defination code:

int quality()

Statistics

Statistics class

C++ defination code:

class Statistics

__init__

def __init__(self, format: Format, l_statistics: list[int], a_statistics: list[int], b_statistics: list[int]) -> None

Statistics constructor

item description
type func
param format: The statistics source image format
l_statistics: The statistics of the L channel. format is {mean, median, mode, std_dev, min, max, lq, uq}, type is std::vector
a_statistics: The statistics of the A channel. format is {mean, median, mode, std_dev, min, max, lq, uq}, type is std::vector
b_statistics: The statistics of the B channel. format is {mean, median, mode, std_dev, min, max, lq, uq}, type is std::vector
static False

C++ defination code:

Statistics(image::Format format, std::vector<int> &l_statistics, std::vector<int> &a_statistics, std::vector<int> &b_statistics)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: array index
return int&
static False

C++ defination code:

int &__getitem__(int index)

format

def format(self) -> Format

get format of Statistics source image

item description
type func
return return format of the Statistics source image, type is image::Format
static False

C++ defination code:

image::Format format()

l_mean

def l_mean(self) -> int

get L channel mean

item description
type func
return return L channel mean, type is int
static False

C++ defination code:

int l_mean()

l_median

def l_median(self) -> int

get L channel median

item description
type func
return return L channel median, type is int
static False

C++ defination code:

int l_median()

l_mode

def l_mode(self) -> int

get L channel mode

item description
type func
return return L channel mode, type is int
static False

C++ defination code:

int l_mode()

l_std_dev

def l_std_dev(self) -> int

get L channel std_dev

item description
type func
return return L channel std_dev, type is int
static False

C++ defination code:

int l_std_dev()

l_min

def l_min(self) -> int

get L channel min

item description
type func
return return L channel min, type is int
static False

C++ defination code:

int l_min()

l_max

def l_max(self) -> int

get L channel max

item description
type func
return return L channel max, type is int
static False

C++ defination code:

int l_max()

l_lq

def l_lq(self) -> int

get L channel lq

item description
type func
return return L channel lq, type is int
static False

C++ defination code:

int l_lq()

l_uq

def l_uq(self) -> int

get L channel uq

item description
type func
return return L channel uq, type is int
static False

C++ defination code:

int l_uq()

a_mean

def a_mean(self) -> int

get A channel mean

item description
type func
return return A channel mean, type is int
static False

C++ defination code:

int a_mean()

a_median

def a_median(self) -> int

get A channea median

item description
type func
return return A channel median, type is int
static False

C++ defination code:

int a_median()

a_mode

def a_mode(self) -> int

get A channel mode

item description
type func
return return A channel mode, type is int
static False

C++ defination code:

int a_mode()

a_std_dev

def a_std_dev(self) -> int

get A channel std_dev

item description
type func
return return A channel std_dev, type is int
static False

C++ defination code:

int a_std_dev()

a_min

def a_min(self) -> int

get A channel min

item description
type func
return return A channel min, type is int
static False

C++ defination code:

int a_min()

a_max

def a_max(self) -> int

get A channel max

item description
type func
return return A channel max, type is int
static False

C++ defination code:

int a_max()

a_lq

def a_lq(self) -> int

get A channel lq

item description
type func
return return A channel lq, type is int
static False

C++ defination code:

int a_lq()

a_uq

def a_uq(self) -> int

get A channel uq

item description
type func
return return A channel uq, type is int
static False

C++ defination code:

int a_uq()

b_mean

def b_mean(self) -> int

get B channel mean

item description
type func
return return B channel mean, type is int
static False

C++ defination code:

int b_mean()

b_median

def b_median(self) -> int

get B channea median

item description
type func
return return B channel median, type is int
static False

C++ defination code:

int b_median()

b_mode

def b_mode(self) -> int

get B channel mode

item description
type func
return return B channel mode, type is int
static False

C++ defination code:

int b_mode()

b_std_dev

def b_std_dev(self) -> int

get B channel std_dev

item description
type func
return return B channel std_dev, type is int
static False

C++ defination code:

int b_std_dev()

b_min

def b_min(self) -> int

get B channel min

item description
type func
return return B channel min, type is int
static False

C++ defination code:

int b_min()

b_max

def b_max(self) -> int

get B channel max

item description
type func
return return B channel max, type is int
static False

C++ defination code:

int b_max()

b_lq

def b_lq(self) -> int

get B channel lq

item description
type func
return return B channel lq, type is int
static False

C++ defination code:

int b_lq()

b_uq

def b_uq(self) -> int

get B channel uq

item description
type func
return return B channel uq, type is int
static False

C++ defination code:

int b_uq()

Displacement

Displacement class

C++ defination code:

class Displacement

__init__

def __init__(self, x_translation: float, y_translation: float, rotation: float, scale: float, response: float) -> None

Displacement constructor

item description
type func
param x_translation: The x_translation of the Displacement
y_translation: The y_translation of the Displacement
rotation: The rotation of the Displacement
scale: The scale of the Displacement
response: The response of the Displacement
static False

C++ defination code:

Displacement(float x_translation, float y_translation, float rotation, float scale, float response)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
param index: array index
return int&
static False

C++ defination code:

int &__getitem__(int index)

x_translation

def x_translation(self) -> float

get x_translation of Displacement

item description
type func
return return x_translation of the Displacement, type is float
static False

C++ defination code:

float x_translation()

y_translation

def y_translation(self) -> float

get y_translation of Displacement

item description
type func
return return y_translation of the Displacement, type is float
static False

C++ defination code:

float y_translation()

rotation

def rotation(self) -> float

get rotation of Displacement

item description
type func
return return rotation of the Displacement, type is float
static False

C++ defination code:

float rotation()

scale

def scale(self) -> float

get scale of Displacement

item description
type func
return return scale of the Displacement, type is float
static False

C++ defination code:

float scale()

response

def response(self) -> float

get response of Displacement

item description
type func
return return response of the Displacement, type is float
static False

C++ defination code:

float response()

Percentile

Percentile class

C++ defination code:

class Percentile

__init__

def __init__(self, l_value: int, a_value: int = 0, b_value: int = 0) -> None

Percentile constructor

item description
type func
param l_value: for grayscale image, it is grayscale percentile value (between 0 and 255).
for rgb888 image, it is l channel percentile value of lab (between 0 and 100).
a_value: for rgb888 image, it is a channel percentile value of lab format(between -128 and 127).
b_value: for rgb888 image, it is b channel percentile value of lab format(between -128 and 127).
static False

C++ defination code:

Percentile(int l_value, int a_value = 0, int b_value = 0)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
static False

C++ defination code:

int &__getitem__(int index)

value

def value(self) -> int

Return the grayscale percentile value (between 0 and 255).

item description
type func
return returns grayscale percentile value
static False

C++ defination code:

int value()

l_value

def l_value(self) -> int

Return the l channel percentile value of lab format (between 0 and 100).

item description
type func
return returns l channel percentile value
static False

C++ defination code:

int l_value()

a_value

def a_value(self) -> int

Return the a channel percentile value of lab format (between -128 and 127).

item description
type func
return returns a channel percentile value
static False

C++ defination code:

int a_value()

b_value

def b_value(self) -> int

Return the b channel percentile value of lab format (between -128 and 127).

item description
type func
return returns b channel percentile value
static False

C++ defination code:

int b_value()

Threshold

Threshold class

C++ defination code:

class Threshold

__init__

def __init__(self, l_value: int, a_value: int = 0, b_value: int = 0) -> None

Threshold constructor

item description
type func
param l_value: for grayscale image, it is grayscale threshold value (between 0 and 255).
for rgb888 image, it is l channel threshold value of lab (between 0 and 100).
a_value: for rgb888 image, it is a channel threshold value of lab format(between -128 and 127).
b_value: for rgb888 image, it is b channel threshold value of lab format(between -128 and 127).
static False

C++ defination code:

Threshold(int l_value, int a_value = 0, int b_value = 0)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
static False

C++ defination code:

int &__getitem__(int index)

value

def value(self) -> int

Return the grayscale threshold value (between 0 and 255).

item description
type func
return returns grayscale threshold value
static False

C++ defination code:

int value()

l_value

def l_value(self) -> int

Return the l channel threshold value of lab format (between 0 and 100).

item description
type func
return returns l channel percentile value
static False

C++ defination code:

int l_value()

a_value

def a_value(self) -> int

Return the a channel threshold value of lab format (between -128 and 127).

item description
type func
return returns a channel percentile value
static False

C++ defination code:

int a_value()

b_value

def b_value(self) -> int

Return the b channel threshold value of lab format (between -128 and 127).

item description
type func
return returns b channel percentile value
static False

C++ defination code:

int b_value()

Histogram

Histogram class

C++ defination code:

class Histogram

__init__

def __init__(self, l_bin: list[float], a_bin: list[float], b_bin: list[float], format: Format = ...) -> None

Histogram constructor

item description
type func
param l_value: for grayscale image, it is grayscale threshold value list (the range of element values in the list is 0 and 255).
for rgb888 image, it is l channel threshold value list of lab (the range of element values in the list is 0 and 100).
a_value: for rgb888 image, it is a channel threshold value list of lab format(the range of element values in the list is -128 and 127).
b_value: for rgb888 image, it is b channel threshold value list of lab format(the range of element values in the list is -128 and 127).
format: format of the source image
static False

C++ defination code:

Histogram(std::vector<float> l_bin, std::vector<float> a_bin, std::vector<float> b_bin, image::Format format = image::Format::FMT_RGB888)

__getitem__

def __getitem__(self, index: int) -> int

Subscript operator

item description
type func
static False

C++ defination code:

int &__getitem__(int index)

bins

def bins(self) -> list[float]

Returns a list of floats for the grayscale histogram.

item description
type func
static False

C++ defination code:

std::vector<float> bins()

l_bins

def l_bins(self) -> list[float]

Returns a list of floats for the RGB565 histogram LAB L channel.

item description
type func
static False

C++ defination code:

std::vector<float> l_bins()

a_bins

def a_bins(self) -> list[float]

Returns a list of floats for the RGB565 histogram LAB A channel.

item description
type func
static False

C++ defination code:

std::vector<float> a_bins()

b_bins

def b_bins(self) -> list[float]

Returns a list of floats for the RGB565 histogram LAB B channel.

item description
type func
static False

C++ defination code:

std::vector<float> b_bins()

get_percentile

def get_percentile(self, percentile: float) -> Percentile

Computes the CDF of the histogram channels and returns a image::Percentile object

item description
type func
param percentile: the values of the histogram at the passed in percentile (0.0 - 1.0) (float).
So, if you pass in 0.1 this method will tell you (going from left-to-right in the histogram)
what bin when summed into an accumulator caused the accumulator to cross 0.1. This is useful
to determine min (with 0.1) and max (with 0.9) of a color distribution without outlier effects
ruining your results for adaptive color tracking.
return image::Percentile object
static False

C++ defination code:

image::Percentile get_percentile(float percentile)

get_threshold

def get_threshold(self) -> Threshold

Uses Otsu’s Method to compute the optimal threshold values that split the histogram into two halves for each channel of the histogram and returns a image::Threshold object.

item description
type func
return image::Threshold object
static False

C++ defination code:

image::Threshold get_threshold()

get_statistics

def get_statistics(self) -> Statistics

Computes the mean, median, mode, standard deviation, min, max, lower quartile, and upper quartile of each color channel in the histogram and returns a image::Statistics object.

item description
type func
return image::Statistics object
static False

C++ defination code:

image::Statistics get_statistics()

LBPKeyPoint

LBPKeyPoint class

C++ defination code:

class LBPKeyPoint

__init__

def __init__(self, data: list[int]) -> None

LBPKeyPoint constructor

item description
type func
param data: The data of the LBPKeyPoint
static False

C++ defination code:

LBPKeyPoint(std::valarray<uint8_t> &data)

KeyPoint

KeyPoint class

C++ defination code:

class KeyPoint

__init__

def __init__(self, x: int, y: int, score: int, octave: int, angle: int, matched: int, desc: list[int]) -> None

KeyPoint constructor

item description
type func
param x: The x of the KeyPoint
y: The y of the KeyPoint
score: The score of the KeyPoint
octave: The octave of the KeyPoint
angle: The angle of the KeyPoint
matched: The matched of the KeyPoint
desc: The desc of the KeyPoint
static False

C++ defination code:

KeyPoint(uint16_t x, uint16_t y, uint16_t score, uint16_t octave, uint16_t angle, uint16_t matched, std::vector<uint8_t> &desc)

KPTMatch

KPTMatch class

C++ defination code:

class KPTMatch

__init__

def __init__(self, cx: int, cy: int, x: int, y: int, w: int, h: int, score: int, theta: int, match: int) -> None

KPTMatch constructor

item description
type func
param cx: The cx of the KPTMatch
cy: The cy of the KPTMatch
x: The x of the KPTMatch
y: The y of the KPTMatch
w: The w of the KPTMatch
h: The h of the KPTMatch
score: The score of the KPTMatch
theta: The theta of the KPTMatch
match: The match of the KPTMatch
static False

C++ defination code:

KPTMatch(int cx, int cy, int x, int y, int w, int h, int score, int theta, int match)

ORBKeyPoint

ORBKeyPoint class

C++ defination code:

class ORBKeyPoint

__init__

def __init__(self, data: list[KeyPoint], threshold: int, normalized: bool) -> None

ORBKeyPoint constructor

item description
type func
param data: The data of the ORBKeyPoint
threshold: The threshold of the ORBKeyPoint
normalized: The normalized of the ORBKeyPoint
static False

C++ defination code:

ORBKeyPoint(std::vector<image::KeyPoint> &data, int threshold, bool normalized)

get_data

def get_data(self) -> list[KeyPoint]

get data of ORBKeyPoint

item description
type func
return return data of the ORBKeyPoint, type is std::vector
static False

C++ defination code:

std::vector<image::KeyPoint> get_data()

HaarCascade

HaarCascade class

C++ defination code:

class HaarCascade

__init__

def __init__(self) -> None

HaarCascade constructor

item description
type func
param data: The data of the HaarCascade
threshold: The threshold of the HaarCascade
normalized: The normalized of the HaarCascade
static False

C++ defination code:

HaarCascade()

Color

Color class

C++ defination code:

class Color

__init__

def __init__(self, ch1: int, ch2: int = 0, ch3: int = 0, alpha: float = 0, format: Format = ...) -> None

Color constructor

item description
type func
param alpha: alpha channel, value range: 0 ~ 1
static False

C++ defination code:

Color(uint8_t ch1, uint8_t ch2 = 0, uint8_t ch3 = 0, float alpha = 0, image::Format format = image::FMT_GRAYSCALE)

r

Color red channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t r

g

Color green channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t g

b

Color blue channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t b

alpha

Color alpha channel, value from 0.0 to 1.0, float value

item description
type var
static False
readonly False

C++ defination code:

float alpha

gray

Color gray channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t gray

format

Color format

item description
type var
static False
readonly False

C++ defination code:

image::Format format

hex

def hex(self) -> int

Get color's hex value

item description
type func
static False

C++ defination code:

uint32_t hex()

from_rgb

def from_rgb(r: int, g: int, b: int) -> Color

Create Color object from RGB channels

item description
type func
static True

C++ defination code:

static image::Color from_rgb(uint8_t r, uint8_t g, uint8_t b)

from_bgr

def from_bgr(b: int, g: int, r: int) -> Color

Create Color object from BGR channels

item description
type func
static True

C++ defination code:

static image::Color from_bgr(uint8_t b, uint8_t g, uint8_t r)

from_gray

def from_gray(gray: int) -> Color

Create Color object from gray channel

item description
type func
static True

C++ defination code:

static image::Color from_gray(uint8_t gray)

from_rgba

def from_rgba(r: int, g: int, b: int, alpha: float) -> Color

Create Color object from RGBA channels

item description
type func
param alpha: alpha channel, float value, value range: 0 ~ 1
static True

C++ defination code:

static image::Color from_rgba(uint8_t r, uint8_t g, uint8_t b, float alpha)

from_bgra

def from_bgra(b: int, g: int, r: int, alpha: float) -> Color

Create Color object from BGRA channels

item description
type func
param alpha: alpha channel, float value, value range: 0 ~ 1
static True

C++ defination code:

static image::Color from_bgra(uint8_t b, uint8_t g, uint8_t r, float alpha)

from_hex

def from_hex(hex: int, format: Format) -> Color

Create Color object from hex value

item description
type func
param hex: hex value, e.g. 0x0000FF00, lower address if first channel
format: color format, @see image::Format
static True

C++ defination code:

static image::Color from_hex(uint32_t hex, image::Format &format)

to_format

def to_format(self, format: Format) -> None

Convert Color format

item description
type func
param format: format want to convert to, @see image::Format, only support RGB888, BGR888, RGBA8888, BGRA8888, GRAYSCALE.
static False

C++ defination code:

void to_format(const image::Format &format)

to_format2

def to_format2(self, format: Format) -> Color

Convert color format and return a new Color object

item description
type func
param format: format want to convert to, @see image::Format, only support RGB888, BGR888, RGBA8888, BGRA8888, GRAYSCALE.
return new Color object, you need to delete it manually in C++.
static False

C++ defination code:

image::Color *to_format2(const image::Format &format)

Image

Image class

C++ defination code:

class Image

__init__

def __init__(self, width: int, height: int, format: Format = ...) -> None

Image constructor

item description
type func
param width: image width, should > 0
height: image height, should > 0
format: image format @see image::Format
static False

C++ defination code:

Image(int width, int height, image::Format format = image::Format::FMT_RGB888)

format

def format(self) -> Format

Get image's format

item description
type func
see image.Format
static False

C++ defination code:

image::Format format()

size

def size(self) -> Size

Get image's size, [width, height]

item description
type func
static False

C++ defination code:

image::Size size()

data_size

def data_size(self) -> int

Get image's data size

item description
type func
static False

C++ defination code:

int data_size()

width

def width(self) -> int

Get image's width

item description
type func
static False

C++ defination code:

int width()

height

def height(self) -> int

Get image's height

item description
type func
static False

C++ defination code:

int height()

data

def data(self) -> capsule

Get image's data pointer.\nIn MaixPy is capsule object.

item description
type func
static False

C++ defination code:

void *data()

__str__

def __str__(self) -> str

To string method

item description
type func
static False

C++ defination code:

std::string __str__()

to_str

def to_str(self) -> str

To string method

item description
type func
static False

C++ defination code:

std::string to_str()

get_pixel

def get_pixel(self, x: int, y: int, rgbtuple: bool = False) -> list[int]

Get pixel of image

item description
type func
param x: pixel's coordinate x. x must less than image's width
y: pixel's coordinate y. y must less than image's height
rgbtuple: switch return value method. rgbtuple decides whether to split the return or not. default is false.
return pixel value,
According to image format and rgbtuple, return different value:
format is FMT_RGB888, rgbtuple is true, return [R, G, B]; rgbtuple is false, return [RGB]
foramt is FMT_BGR888, rgbtuple is true, return [B, G, R]; rgbtuple is false, return [BGR]
format is FMT_GRAYSCALE, return [GRAY];
static False

C++ defination code:

std::vector<int> get_pixel(int x, int y, bool rgbtuple = false)

set_pixel

def set_pixel(self, x: int, y: int, pixel: list[int]) -> maix.err.Err

Set pixel of image

item description
type func
param x: pixel's coordinate x. x must less than image's width
y: pixel's coordinate y. y must less than image's height
pixel: pixel value, according to image format and size of pixel, has different operation:
format is FMT_RGB888, pixel size must be 1 or 3, if size is 1, will split pixel[0] to [R, G, B]; if size is 3, will use pixel directly
format is FMT_BGR888, pixel size must be 1 or 3, if size is 1, will split pixel[0] to [B, G, R]; if size is 3, will use pixel directly
format is FMT_GRAYSCALE, pixel size must be 1, will use pixel directly
return error code, Err::ERR_NONE is ok, other is error
static False

C++ defination code:

err::Err set_pixel(int x, int y, std::vector<int> pixel)

to_tensor

def to_tensor(self, chw: bool = False, copy: bool = True) -> maix.tensor.Tensor

Convert Image object to tensor::Tensor object

item description
type func
param chw: if true, the shape of tensor is [C, H, W], else [H, W, C]
copy: if true, will alloc memory for tensor data, else will use the memory of Image object
return tensor::Tensor object pointer, an allocated tensor object
static False

C++ defination code:

tensor::Tensor *to_tensor(bool chw = false, bool copy = true)

to_bytes

def to_bytes(*args, **kwargs)

Get image's data and convert to array bytes

item description
type func
param copy: if true, will alloc memory and copy data to new buffer,
else will use the memory of Image object, delete bytes object will not affect Image object,
but delete Image object will make bytes object invalid, it may cause program crash !!!!
So use this param carefully.
return image's data bytes, need be delete by caller in C++.
static False

C++ defination code:

Bytes *to_bytes(bool copy = true)

to_format

def to_format(self, format: Format) -> Image

Convert image to specific format

item description
type func
param format: format want to convert to, @see image::Format, only support RGB888, BGR888, RGBA8888, BGRA8888, GRAYSCALE, JPEG.
return new image object. Need be delete by caller in C++.
throw err.Exception, if two images' format not support, or already the format, will raise exception
static False

C++ defination code:

image::Image *to_format(const image::Format &format)

to_jpeg

def to_jpeg(self, quality: int = 95) -> Image

Convert image to jpeg

item description
type func
param quality: the quality of jpg, default is 95. For MaixCAM supported range is (50, 100], if <= 50 will be fixed to 51.
return new image object. Need be delete by caller in C++.
throw err.Exception, if two images' format not support, or already the format, will raise exception
static False

C++ defination code:

image::Image *to_jpeg(int quality = 95)

draw_image

def draw_image(self, x: int, y: int, img: Image) -> Image

Draw image on this image

item description
type func
param x: left top corner of image point's coordinate x
y: left top corner of image point's coordinate y
img: image object to draw, the caller's channel must <= the args' channel,
e.g. caller is RGB888, args is RGBA8888, will throw exception, but caller is RGBA8888, args is RGB888 or RGBA8888 is ok
return this image object self
static False

C++ defination code:

image::Image *draw_image(int x, int y, image::Image &img)

draw_rect

def draw_rect(self, x: int, y: int, w: int, h: int, color: Color, thickness: int = 1) -> Image

Fill rectangle color to image

item description
type func
param x: left top corner of rectangle point's coordinate x
y: left top corner of rectangle point's coordinate y
w: rectangle width
h: rectangle height
color: rectangle color
thickness: rectangle thickness(line width), by default(value is 1), -1 means fill rectangle
return this image object self
static False

C++ defination code:

image::Image *draw_rect(int x, int y, int w, int h, const image::Color &color, int thickness = 1)

draw_line

def draw_line(self, x1: int, y1: int, x2: int, y2: int, color: Color, thickness: int = 1) -> Image

Draw line on image

item description
type func
param x1: start point's coordinate x
y1: start point's coordinate y
x2: end point's coordinate x
y2: end point's coordinate y
color: line color @see image::Color
thickness: line thickness(line width), by default(value is 1)
return this image object self
static False

C++ defination code:

image::Image *draw_line(int x1, int y1, int x2, int y2, const image::Color &color, int thickness = 1)

draw_circle

def draw_circle(self, x: int, y: int, radius: int, color: Color, thickness: int = 1) -> Image

Draw circle on image

item description
type func
param x: circle center point's coordinate x
y: circle center point's coordinate y
radius: circle radius
color: circle color @see image::Color
thickness: circle thickness(line width), default -1 means fill circle
return this image object self
static False

C++ defination code:

image::Image *draw_circle(int x, int y, int radius, const image::Color &color, int thickness = 1)

draw_ellipse

def draw_ellipse(self, x: int, y: int, a: int, b: int, angle: float, start_angle: float, end_angle: float, color: Color, thickness: int = 1) -> Image

Draw ellipse on image

item description
type func
param x: ellipse center point's coordinate x
y: ellipse center point's coordinate y
a: ellipse major axis length
b: ellipse minor axis length
angle: ellipse rotation angle
start_angle: ellipse start angle
end_angle: ellipse end angle
color: ellipse color @see image::Color
thickness: ellipse thickness(line width), by default(value is 1), -1 means fill ellipse
return this image object self
static False

C++ defination code:

image::Image *draw_ellipse(int x, int y, int a, int b, float angle, float start_angle, float end_angle, const image::Color &color, int thickness = 1)

draw_string

def draw_string(self, x: int, y: int, textstring: str, color: Color = ..., scale: float = 1, thickness: int = -1, wrap: bool = True, wrap_space: int = 4, font: str = '') -> Image

Draw text on image

item description
type func
param x: text left top point's coordinate x
y: text left top point's coordinate y
string: text content
color: text color @see image::Color, default is white
scale: font scale, by default(value is 1)
thickness: text thickness(line width), if negative, the glyph is filled, by default(value is -1)
wrap: if true, will auto wrap text to next line if text width > image width, by default(value is true)
return this image object self
static False

C++ defination code:

image::Image *draw_string(int x, int y, const std::string &textstring, const image::Color &color = image::COLOR_WHITE, float scale = 1, int thickness = -1,
                                bool wrap = true, int wrap_space = 4, const std::string &font = "")

draw_cross

def draw_cross(self, x: int, y: int, color: Color, size: int = 5, thickness: int = 1) -> Image

Draw cross on image

item description
type func
param x: cross center point's coordinate x
y: cross center point's coordinate y
color: cross color @see image::Color
size: how long the lines of the cross extend, by default(value is 5). So the line length is 2 * size + thickness
thickness: cross thickness(line width), by default(value is 1)
static False

C++ defination code:

image::Image *draw_cross(int x, int y, const image::Color &color, int size = 5, int thickness = 1)

draw_arrow

def draw_arrow(self, x0: int, y0: int, x1: int, y1: int, color: Color, thickness: int = 1) -> Image

Draw arrow on image

item description
type func
param x0: start coordinate of the arrow x0
y0: start coordinate of the arrow y0
x1: end coordinate of the arrow x1
y1: end coordinate of the arrow y1
color: cross color @see image::Color
thickness: cross thickness(line width), by default(value is 1)
return this image object self
static False

C++ defination code:

image::Image *draw_arrow(int x0, int y0, int x1, int y1, const image::Color &color, int thickness = 1)

draw_edges

def draw_edges(self, corners: list[list[int]], color: Color, size: int = 0, thickness: int = 1, fill: bool = False) -> Image

Draw edges on image

item description
type func
param corners: edges, [[x0, y0], [x1, y1], [x2, y2], [x3, y3]]
color: edges color @see image::Color
size: the circle of radius size. TODO: support in the feature
thickness: edges thickness(line width), by default(value is 1)
fill: if true, will fill edges, by default(value is false)
return this image object self
static False

C++ defination code:

image::Image *draw_edges(std::vector<std::vector<int>> corners, const image::Color &color, int size = 0, int thickness = 1, bool fill = false)

draw_keypoints

def draw_keypoints(self, keypoints: list[int], color: Color, size: int = 4, thickness: int = -1, line_thickness: int = 0) -> Image

Draw keypoints on image

item description
type func
param keypoints: keypoints, [x1, y1, x2, y2...] or [x, y, rotation_andle_in_degrees, x2, y2, rotation_andle_in_degrees2](TODO: rotation_andle_in_degrees support in the feature)
color: keypoints color @see image::Color
size: size of keypoints(radius)
thickness: keypoints thickness(line width), by default(value is -1 means fill circle)
line_thickness: line thickness, default 0 means not draw lines, > 0 will draw lines connect points.
return this image object self
static False

C++ defination code:

image::Image *draw_keypoints(const std::vector<int> &keypoints, const image::Color &color, int size = 4, int thickness = -1, int line_thickness = 0)

resize

def resize(self, width: int, height: int, object_fit: Fit = ..., method: ResizeMethod = ...) -> Image

Resize image, will create a new resized image object

item description
type func
param width: new width, if value is -1, will use height to calculate aspect ratio
height: new height, if value is -1, will use width to calculate aspect ratio
object_fit: fill, contain, cover, by default is fill
method: resize method, by default is bilinear
return Always return a new resized image object even size not change, So in C++ you should take care of the return value to avoid memory leak.
And it's better to judge whether the size has changed before calling this function to make the program more efficient.
e.g.
if img->width() != width
img->height() != height:
img = img->resize(width, height);
static False

C++ defination code:

image::Image *resize(int width, int height, image::Fit object_fit = image::Fit::FIT_FILL, image::ResizeMethod method = image::ResizeMethod::NEAREST)

affine

def affine(self, src_points: list[int], dst_points: list[int], width: int = -1, height: int = -1, method: ResizeMethod = ...) -> Image

Affine transform image, will create a new transformed image object

item description
type func
param src_points: three source points, [x1, y1, x2, y2, x3, y3]
dst_points: three destination points, [x1, y1, x2, y2, x3, y3]
width: new width, if value is -1, will use height to calculate aspect ratio
height: new height, if value is -1, will use width to calculate aspect ratio
method: resize method, by default is bilinear
return new transformed image object
static False

C++ defination code:

image::Image *affine(std::vector<int> src_points, std::vector<int> dst_points, int width = -1, int height = -1, image::ResizeMethod method = image::ResizeMethod::BILINEAR)

copy

def copy(self) -> Image

Copy image, will create a new copied image object

item description
type func
return new copied image object
static False

C++ defination code:

image::Image *copy()

crop

def crop(self, x: int, y: int, w: int, h: int) -> Image

Crop image, will create a new cropped image object

item description
type func
param x: left top corner of crop rectangle point's coordinate x
y: left top corner of crop rectangle point's coordinate y
w: crop rectangle width
h: crop rectangle height
return new cropped image object
static False

C++ defination code:

image::Image *crop(int x, int y, int w, int h)

rotate

def rotate(self, angle: float, width: int = -1, height: int = -1, method: ResizeMethod = ...) -> Image

Rotate image, will create a new rotated image object

item description
type func
param angle: anti-clock wise rotate angle, if angle is 90 or 270, and width or height is -1, will swap width and height, or will throw exception
width: new width, if value is -1, will use height to calculate aspect ratio
height: new height, if value is -1, will use width to calculate aspect ratio
method: resize method, by default is bilinear
return new rotated image object
static False

C++ defination code:

image::Image *rotate(float angle, int width = -1, int height = -1, image::ResizeMethod method = image::ResizeMethod::BILINEAR)

mean_pool

def mean_pool(self, x_div: int, y_div: int, copy: bool = False) -> Image

Finds the mean of x_div * y_div squares in the image and returns the modified image composed of the mean of each square.

item description
type func
param x_div: The width of the squares.
y_div: The height of the squares.
copy: Select whether to return a new image or modify the original image. default is false.
If true, returns a new image composed of the mean of each square; If false, returns the modified image composed of the mean of each square.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *mean_pool(int x_div, int y_div, bool copy = false)

midpoint_pool

def midpoint_pool(self, x_div: int, y_div: int, bias: float = 0.5, copy: bool = False) -> Image

Finds the midpoint of x_div * y_div squares in the image and returns the modified image composed of the mean of each square.

item description
type func
param x_div: The width of the squares.
y_div: The height of the squares.
bias: The bias of the midpoint. default is 0.5.
midpoint value is equal to (max * bias + min * (1 - bias))
copy: Select whether to return a new image or modify the original image. default is false.
If true, returns a new image composed of the midpoint of each square; If false, returns the modified image composed of the midpoint of each square.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *midpoint_pool(int x_div, int y_div, double bias = 0.5, bool copy = false)

compress

def compress(self, quality: int = 95) -> Image

JPEG compresses the image in place, the same as to_jpeg functioin, it's recommend to use to_jpeg instead.

item description
type func
param quality: The quality of the compressed image. default is 95.
return Returns the compressed JPEG image
static False

C++ defination code:

image::Image *compress(int quality = 95)

clear

def clear(self, mask: Image = None) -> Image

Sets all pixels in the image to zero

item description
type func
param mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *clear(image::Image *mask = nullptr)

mask_rectange

def mask_rectange(self, x: int = -1, y: int = -1, w: int = -1, h: int = -1) -> Image

Zeros a rectangular part of the image. If no arguments are supplied this method zeros the center of the image.

item description
type func
param x: The x coordinate of the top left corner of the rectangle.
y: The y coordinate of the top left corner of the rectangle.
w: The width of the rectangle.
h: The height of the rectangle.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *mask_rectange(int x = -1, int y = -1, int w = -1, int h = -1)

mask_circle

def mask_circle(self, x: int = -1, y: int = -1, radius: int = -1) -> Image

Zeros a circular part of the image. If no arguments are supplied this method zeros the center of the image.

item description
type func
param x: The x coordinate of the center of the circle.
y: The y coordinate of the center of the circle.
radius: The radius of the circle.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *mask_circle(int x = -1, int y = -1, int radius = -1)

mask_ellipse

def mask_ellipse(self, x: int = -1, y: int = -1, radius_x: int = -1, radius_y: int = -1, rotation_angle_in_degrees: float = 0) -> Image

Zeros a ellipse part of the image. If no arguments are supplied this method zeros the center of the image.

item description
type func
param x: The x coordinate of the center of the ellipse.
y: The y coordinate of the center of the ellipse.
radius_x: The radius of the ellipse in the x direction.
radius_y: The radius of the ellipse in the y direction.
rotation_angle_in_degrees: The rotation angle of the ellipse in degrees.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *mask_ellipse(int x = -1, int y = -1, int radius_x = -1, int radius_y = -1, float rotation_angle_in_degrees = 0)

binary

def binary(self, thresholds: list[list[int]] = [], invert: bool = False, zero: bool = False, mask: Image = None, to_bitmap: bool = False, copy: bool = False) -> Image

Sets all pixels in the image to black or white depending on if the pixel is inside of a threshold in the threshold list thresholds or not.

item description
type func
note For GRAYSCALE format, Lmin and Lmax range is [0, 255]. For RGB888 format, Lmin and Lmax range is [0, 100].
param thresholds: You can define multiple thresholds.
For GRAYSCALE format, you can use {{Lmin, Lmax}, ...} to define one or more thresholds.
For RGB888 format, you can use {{Lmin, Lmax, Amin, Amax, Bmin, Bmax}, ...} to define one or more thresholds.
Where the upper case L,A,B represent the L,A,B channels of the LAB image format, and min, max represent the minimum and maximum values of the corresponding channels.
invert: If true, the thresholds will be inverted before the operation. default is false.
zero: If zero is true, the image will be set the pixels within the threshold to 0, other pixels remain unchanged. If zero is false, the image will be set to black or white. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
to_bitmap: If true, the image will be converted to a bitmap image before thresholding. default is false. TODO: support in the feature
copy: Select whether to return a new image or modify the original image. default is false.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *binary(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), bool invert = false, bool zero = false, image::Image *mask = nullptr, bool to_bitmap = false, bool copy = false)

invert

def invert(self) -> Image

Inverts the image in place.

item description
type func
return Returns the image after the operation is completed
static False

C++ defination code:

image::Image *invert()

b_and

def b_and(self, other: Image, mask: Image = None) -> Image

Performs a bitwise and operation between the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *b_and(image::Image *other, image::Image *mask = nullptr)

b_nand

def b_nand(self, other: Image, mask: Image = None) -> Image

Performs a bitwise nand operation between the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *b_nand(image::Image *other, image::Image *mask = nullptr)

b_or

def b_or(self, other: Image, mask: Image = None) -> Image

Performs a bitwise or operation between the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *b_or(image::Image *other, image::Image *mask = nullptr)

b_nor

def b_nor(self, other: Image, mask: Image = None) -> Image

Performs a bitwise nor operation between the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *b_nor(image::Image *other, image::Image *mask = nullptr)

b_xor

def b_xor(self, other: Image, mask: Image = None) -> Image

Performs a bitwise xor operation between the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *b_xor(image::Image *other, image::Image *mask = nullptr)

b_xnor

def b_xnor(self, other: Image, mask: Image = None) -> Image

Performs a bitwise xnor operation between the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *b_xnor(image::Image *other, image::Image *mask = nullptr)

awb

def awb(self, max: bool = False) -> Image

Performs an auto white balance operation on the image. TODO: support in the feature

item description
type func
param max: if True uses the white-patch algorithm instead. default is false.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *awb(bool max = false)

ccm

def ccm(self, matrix: list[float]) -> Image

Multiples the passed (3x3) or (4x3) floating-point color-correction-matrix with the image.\nnote: Grayscale format is not support.

item description
type func
param matrix: The color correction matrix to use. 3x3 or 4x3 matrix.
Weights may either be positive or negative, and the sum of each column in the 3x3 matrix should generally be 1.
example:
{
1, 0, 0,
0, 1, 0,
0, 0, 1,
}
Where the last row of the 4x3 matrix is an offset per color channel. If you add an offset you may wish to make the
weights sum to less than 1 to account for the offset.
example:
{
1, 0, 0,
0, 1, 0,
0, 0, 1,
0, 0, 0,
}
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *ccm(std::vector<float> &matrix)

gamma

def gamma(self, gamma: float = 1.0, contrast: float = 1.0, brightness: float = 0.0) -> Image

Quickly changes the image gamma, contrast, and brightness. Create a array whose size is usually 255,\nand use the parameters gamma, contrast, and brightness to calculate the value of the array, and then map the\nimage pixel value through the value of the array.\nThe calculation method for array is: array[array_idx] = (powf((array_idx / 255.0), (1 / gamma)) * contrast + brightness) * scale,\npowf is a function used to calculate floating point power.\narray is the array used for mapping.\narray_idx is the index of the array, the maximum value is determined according to the image format, usually 255.\nscale is a constant, the value is determined by the image format, usually 255.\nMapping method:\nAssume that a pixel value in the image is 128, then map the pixel value to the value of array[128]\nUsers can adjust the value of the array through the gamma, contrast, and brightness parameters.

item description
type func
param gamma: The contrast gamma greater than 1.0 makes the image darker in a non-linear manner while less than 1.0 makes the image brighter. default is 1.0.
contrast: The contrast value greater than 1.0 makes the image brighter in a linear manner while less than 1.0 makes the image darker. default is 1.0.
brightness: The brightness value greater than 0.0 makes the image brighter in a constant manner while less than 0.0 makes the image darker. default is 0.0.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *gamma(double gamma = 1.0, double contrast = 1.0, double brightness = 0.0)

gamma_corr

def gamma_corr(self, gamma: float, contrast: float = 1.0, brightness: float = 0.0) -> Image

Alias for Image.gamma.

item description
type func
param gamma: The contrast gamma greater than 1.0 makes the image darker in a non-linear manner while less than 1.0 makes the image brighter. default is 1.0.
contrast: The contrast value greater than 1.0 makes the image brighter in a linear manner while less than 1.0 makes the image darker. default is 1.0.
brightness: The brightness value greater than 0.0 makes the image brighter in a constant manner while less than 0.0 makes the image darker. default is 0.0.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *gamma_corr(double gamma, double contrast = 1.0, double brightness = 0.0)

negate

def negate(self) -> Image

Flips (numerically inverts) all pixels values in an image

item description
type func
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *negate()

replace

def replace(self, other: Image = None, hmirror: bool = False, vflip: bool = False, transpose: bool = False, mask: Image = None) -> Image

Replaces all pixels in the image with the corresponding pixels in the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on.
hmirror: If true, the image will be horizontally mirrored before the operation. default is false.
vflip: If true, the image will be vertically flipped before the operation. default is false.
transpose: If true, the image can be used to rotate 90 degrees or 270 degrees.
hmirror = false, vflip = false, transpose = false, the image will not be rotated.
hmirror = false, vflip = true, transpose = true, the image will be rotated 90 degrees.
hmirror = true, vflip = true, transpose = false, the image will be rotated 180 degrees.
hmirror = true, vflip = false, transpose = true, the image will be rotated 270 degrees.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *replace(image::Image *other = nullptr, bool hmirror = false, bool vflip = false, bool transpose = false, image::Image *mask = nullptr)

set

def set(self, other: Image, hmirror: bool = False, vflip: bool = False, transpose: bool = False, mask: Image = None) -> Image

Alias for Image::replace.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on.
hmirror: If true, the image will be horizontally mirrored before the operation. default is false.
vflip: If true, the image will be vertically flipped before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *set(image::Image *other, bool hmirror = false, bool vflip = false, bool transpose = false, image::Image *mask = nullptr)

add

def add(self, other: Image, mask: Image = None) -> Image

Adds the other image to the image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *add(image::Image *other, image::Image *mask = nullptr)

sub

def sub(self, other: Image, reverse: bool = False, mask: Image = None) -> Image

Subtracts the other image from the image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
reverse: If true, the image will be reversed before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *sub(image::Image *other, bool reverse = false, image::Image *mask = nullptr)

mul

def mul(self, other: Image, invert: bool = False, mask: Image = None) -> Image

Multiplies the image by the other image.\nNote: This method is meant for image blending and cannot multiply the pixels in the image by a scalar like 2.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
invert: If true, the image will be change the multiplication operation from ab to 1/((1/a)(1/b)).
In particular, this lightens the image instead of darkening it (e.g. multiply versus burn operations). default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *mul(image::Image *other, bool invert = false, image::Image *mask = nullptr)

div

def div(self, other: Image, invert: bool = False, mod: bool = False, mask: Image = None) -> Image

Divides the image by the other image.\nThis method is meant for image blending and cannot divide the pixels in the image by a scalar like 2.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on. TODO: support path?
invert: If true, the image will be change the division direction from a/b to b/a. default is false.
mod: If true, the image will be change the division operation to the modulus operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *div(image::Image *other, bool invert = false, bool mod = false, image::Image *mask = nullptr)

min

def min(self, other: Image, mask: Image = None) -> Image

Caculate the minimum of each pixel in the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *min(image::Image *other, image::Image *mask = nullptr)

max

def max(self, other: Image, mask: Image = None) -> Image

Caculate the maximum of each pixel in the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *max(image::Image *other, image::Image *mask = nullptr)

difference

def difference(self, other: Image, mask: Image = None) -> Image

Caculate the absolute value of the difference between each pixel in the image and the other image.

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *difference(image::Image *other, image::Image *mask = nullptr)

blend

def blend(self, other: Image, alpha: int = 128, mask: Image = None) -> Image

Blends the image with the other image.\nres = alpha * this_img / 256 + (256 - alpha) * other_img / 256

item description
type func
param other: The other image should be an image and should be the same size as the image being operated on.
alpha: The alpha value of the blend, the value range is [0, 256],default is 128.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *blend(image::Image *other, int alpha = 128, image::Image *mask = nullptr)

histeq

def histeq(self, adaptive: bool = False, clip_limit: int = -1, mask: Image = None) -> Image

Runs the histogram equalization algorithm on the image.

item description
type func
param adaptive: If true, an adaptive histogram equalization method will be run on the image instead which as generally better results than non-adaptive histogram qualization but a longer run time. default is false.
clip_limit: Provides a way to limit the contrast of the adaptive histogram qualization. Use a small value for this, like 10, to produce good histogram equalized contrast limited images. default is -1.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *histeq(bool adaptive = false, int clip_limit = -1, image::Image *mask = nullptr)

mean

def mean(self, size: int, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Standard mean blurring filter using a box filter.\nThe parameters offset and invert are valid when threshold is True.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *mean(int size, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

median

def median(self, size: int, percentile: float = 0.5, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Runs the median filter on the image. The median filter is the best filter for smoothing surfaces while preserving edges but it is very slow.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
percentile: This parameter controls the percentile of the value used in the kernel. You can set this to 0 for a min filter, 0.25 for a lower quartile filter, 0.75 for an upper quartile filter, and 1.0 for a max filter. default is 0.5.
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *median(int size, double percentile = 0.5, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

mode

def mode(self, size: int, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Runs the mode filter on the image by replacing each pixel with the mode of their neighbors.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *mode(int size, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

midpoint

def midpoint(self, size: int, bias: float = 0.5, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Runs the midpoint filter on the image.This filter finds the midpoint (max * bias + min * (1 - bias)) of each pixel neighborhood in the image.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
bias: The bias of the midpoint. default is 0.5.
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *midpoint(int size, double bias = 0.5, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

morph

def morph(self, size: int, kernel: list[int], mul: float = -1, add: float = 0.0, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Convolves the image by a filter kernel. This allows you to do general purpose convolutions on an image.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
kernel: The kernel used for convolution. The kernel should be a list of lists of numbers. The kernel should be the same size as the actual kernel size.
mul: This parameter is used to multiply the convolved pixel results. default is auto.
add: This parameter is the value to be added to each convolution pixel result. default is 0.0.
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *morph(int size, std::vector<int> kernel, float mul = -1, float add = 0.0, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

gaussian

def gaussian(self, size: int, unsharp: bool = False, mul: float = -1, add: float = 0.0, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Convolves the image by a smoothing guassian kernel.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
unsharp: If true, this method will perform an unsharp mask operation instead of gaussian filtering operation, this improves the clarity of image edges. default is false.
mul: This parameter is used to multiply the convolved pixel results. default is auto.
add: This parameter is the value to be added to each convolution pixel result. default is 0.0.
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *gaussian(int size, bool unsharp = false, float mul = -1, float add = 0.0, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

laplacian

def laplacian(self, size: int, sharpen: bool = False, mul: float = -1, add: float = 0.0, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Convolves the image by a edge detecting laplacian kernel.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
sharpen: If True, this method will sharpen the image instead of an unthresholded edge detection image. Then increase the kernel size to improve image clarity. default is false.
mul: This parameter is used to multiply the convolved pixel results. default is auto.
add: This parameter is the value to be added to each convolution pixel result. default is 0.0.
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *laplacian(int size, bool sharpen = false, float mul = -1, float add = 0.0, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

bilateral

def bilateral(self, size: int, color_sigma: float = 0.1, space_sigma: float = 1, threshold: bool = False, offset: int = 0, invert: bool = False, mask: Image = None) -> Image

Convolves the image by a bilateral filter.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
color_sigma: Controls how closely colors are matched using the bilateral filter. default is 0.1.
space_sigma: Controls how closely pixels space-wise are blurred with each other. default is 1.
threshold: If true, which will enable adaptive thresholding of the image which sets pixels to white or black based on a pixel’s brightness in relation to the brightness of the kernel of pixels around them.
default is false.
offset: The larger the offset value, the lower brightness pixels on the original image will be set to white. default is 0.
invert: If true, the image will be inverted before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *bilateral(int size, double color_sigma = 0.1, double space_sigma = 1, bool threshold = false, int offset = 0, bool invert = false, image::Image *mask = nullptr)

linpolar

def linpolar(self, reverse: bool = False) -> Image

Re-project’s and image from cartessian coordinates to linear polar coordinates.

item description
type func
param reverse: If true, the image will be reverse polar transformed. default is false.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *linpolar(bool reverse = false)

logpolar

def logpolar(self, reverse: bool = False) -> Image

Re-project’s and image from cartessian coordinates to log polar coordinates.

item description
type func
param reverse: If true, the image will be reverse polar transformed. default is false.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *logpolar(bool reverse = false)

lens_corr

def lens_corr(self, strength: float = 1.8, zoom: float = 1.0, x_corr: float = 0.0, y_corr: float = 0.0) -> Image

Performs a lens correction operation on the image. TODO: support in the feature

item description
type func
param strength: The strength of the lens correction. default is 1.8.
zoom: The zoom of the lens correction. default is 1.0.
x_corr: The x correction of the lens correction. default is 0.0.
y_corr: The y correction of the lens correction. default is 0.0.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *lens_corr(double strength = 1.8, double zoom = 1.0, double x_corr = 0.0, double y_corr = 0.0)

rotation_corr

def rotation_corr(self, x_rotation: float = 0.0, y_rotation: float = 0.0, z_rotation: float = 0.0, x_translation: float = 0.0, y_translation: float = 0.0, zoom: float = 1.0, fov: float = 60.0, corners: list[float] = []) -> Image

Performs a rotation correction operation on the image. TODO: support in the feature

item description
type func
param x_rotation: The x rotation of the rotation correction. default is 0.0.
y_rotation: The y rotation of the rotation correction. default is 0.0.
z_rotation: The z rotation of the rotation correction. default is 0.0.
x_translation: The x translation of the rotation correction. default is 0.0.
y_translation: The y translation of the rotation correction. default is 0.0.
zoom: The zoom of the rotation correction. default is 1.0.
fov: The fov of the rotation correction. default is 60.0.
corners: The corners of the rotation correction. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *rotation_corr(double x_rotation = 0.0, double y_rotation = 0.0, double z_rotation = 0.0, double x_translation = 0.0, double y_translation = 0.0, double zoom = 1.0, double fov = 60.0, std::vector<float> corners = std::vector<float>())

get_histogram

def get_histogram(self, thresholds: list[list[int]] = [], invert: bool = False, roi: list[int] = [], bins: int = -1, l_bins: int = 100, a_bins: int = 256, b_bins: int = 256, difference: Image = None) -> Histogram

Computes the normalized histogram on all color channels and returns a image::Histogram object.

item description
type func
note For GRAYSCALE format, Lmin and Lmax range is [0, 255]. For RGB888 format, Lmin and Lmax range is [0, 100].
param thresholds: You can define multiple thresholds.
For GRAYSCALE format, you can use {{Lmin, Lmax}, ...} to define one or more thresholds.
For RGB888 format, you can use {{Lmin, Lmax, Amin, Amax, Bmin, Bmax}, ...} to define one or more thresholds.
Where the upper case L,A,B represent the L,A,B channels of the LAB image format, and min, max represent the minimum and maximum values of the corresponding channels.
invert: If true, the thresholds will be inverted before the operation. default is false.
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
bins: The number of bins to use for the histogram.
In GRAYSCALE format, setting range is [2, 256], default is 100.
In RGB888 format, setting range is [2, 100], default is 100.
l_bins: The number of bins to use for the l channel of the histogram. Only valid in RGB888 format.
If an invalid value is set, bins will be used instead. The setting range is [2, 100], default is 100.
a_bins: The number of bins to use for the a channel of the histogram.
Only valid in RGB888 format.The setting range is [2, 256], default is 256.
b_bins: The number of bins to use for the b channel of the histogram.
Only valid in RGB888 format. The setting range is [2, 256], default is 256.
difference: difference may be set to an image object to cause this method to operate on the difference image between the current image and the difference image object.
default is None.
return Returns image::Histogram object
static False

C++ defination code:

image::Histogram get_histogram(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), bool invert = false, std::vector<int> roi = std::vector<int>(), int bins = -1, int l_bins = 100, int a_bins = 256, int b_bins = 256, image::Image *difference = nullptr)

get_statistics

def get_statistics(self, thresholds: list[list[int]] = [], invert: bool = False, roi: list[int] = [], bins: int = -1, l_bins: int = -1, a_bins: int = -1, b_bins: int = -1, difference: Image = None) -> Statistics

Gets the statistics of the image. TODO: support in the feature

item description
type func
note For GRAYSCALE format, Lmin and Lmax range is [0, 255]. For RGB888 format, Lmin and Lmax range is [0, 100].
param thresholds: You can define multiple thresholds.
For GRAYSCALE format, you can use {{Lmin, Lmax}, ...} to define one or more thresholds.
For RGB888 format, you can use {{Lmin, Lmax, Amin, Amax, Bmin, Bmax}, ...} to define one or more thresholds.
Where the upper case L,A,B represent the L,A,B channels of the LAB image format, and min, max represent the minimum and maximum values of the corresponding channels.
invert: If true, the image will be inverted before the operation. default is false.
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
bins: The number of bins to use for the statistics. default is -1.
l_bins: The number of bins to use for the l channel of the statistics. default is -1.
a_bins: The number of bins to use for the a channel of the statistics. default is -1.
b_bins: The number of bins to use for the b channel of the statistics. default is -1.
difference: The difference image to use for the statistics. default is None.
return Returns the statistics of the image
static False

C++ defination code:

image::Statistics get_statistics(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), bool invert = false, std::vector<int> roi = std::vector<int>(), int bins = -1, int l_bins = -1, int a_bins = -1, int b_bins = -1, image::Image *difference = nullptr)

get_regression

def get_regression(self, thresholds: list[list[int]] = [], invert: bool = False, roi: list[int] = [], x_stride: int = 2, y_stride: int = 1, area_threshold: int = 10, pixels_threshold: int = 10, robust: bool = False) -> list[Line]

Gets the regression of the image.

item description
type func
note For GRAYSCALE format, Lmin and Lmax range is [0, 255]. For RGB888 format, Lmin and Lmax range is [0, 100].
param thresholds: You can define multiple thresholds.
For GRAYSCALE format, you can use {{Lmin, Lmax}, ...} to define one or more thresholds.
For RGB888 format, you can use {{Lmin, Lmax, Amin, Amax, Bmin, Bmax}, ...} to define one or more thresholds.
Where the upper case L,A,B represent the L,A,B channels of the LAB image format, and min, max represent the minimum and maximum values of the corresponding channels.
invert: If true, the image will be inverted before the operation. default is false.
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
x_stride: The x stride to use for the regression. default is 2.
y_stride: The y stride to use for the regression. default is 1.
area_threshold: The area threshold to use for the regression. default is 10.
pixels_threshold: The pixels threshold to use for the regression. default is 10.
robust: If true, the regression will be robust. default is false.
return Returns the regression of the image
static False

C++ defination code:

std::vector<image::Line> get_regression(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), bool invert = false, std::vector<int> roi = std::vector<int>(), int x_stride = 2, int y_stride = 1, int area_threshold = 10, int pixels_threshold = 10, bool robust = false)

save

def save(self, path: str, quality: int = 95) -> maix.err.Err

Save image to file

item description
type func
param path: file path
quality: image quality, by default(value is 95), support jpeg and png format
return error code, err::ERR_NONE is ok, other is error
static False

C++ defination code:

err::Err save(const char *path, int quality = 95)

flood_fill

def flood_fill(self, x: int, y: int, seed_threshold: float = 0.05, floating_threshold: float = 0.05, color: Color = ..., invert: bool = False, clear_background: bool = False, mask: Image = None) -> Image

Flood fills a region of the image starting from location x, y.

item description
type func
param x: The x coordinate of the seed point.
y: The y coordinate of the seed point.
seed_threshold: The seed_threshold value controls how different any pixel in the fill area may be from the original starting pixel. default is 0.05.
floating_threshold: The floating_threshold value controls how different any pixel in the fill area may be from any neighbor pixels. default is 0.05.
color: The color to fill the region with. default is white.
invert: If true, the image will be inverted before the operation. default is false.
clear_background: If true, the background will be cleared before the operation. default is false.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None. FIXME: the mask image works abnormally
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *flood_fill(int x, int y, float seed_threshold = 0.05, float floating_threshold = 0.05, image::Color color = image::COLOR_WHITE, bool invert = false, bool clear_background = false, image::Image *mask = nullptr)

erode

def erode(self, size: int, threshold: int = -1, mask: Image = None) -> Image

Erodes the image in place.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: The number of pixels in the kernel that are not 0. If it is less than or equal to the threshold, set the center pixel to black. default is (kernel_size - 1).
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *erode(int size, int threshold = -1, image::Image *mask = nullptr)

dilate

def dilate(self, size: int, threshold: int = 0, mask: Image = None) -> Image

Dilates the image in place.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: The number of pixels in the kernel that are not 0. If it is greater than or equal to the threshold, set the center pixel to white. default is 0.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *dilate(int size, int threshold = 0, image::Image *mask = nullptr)

open

def open(self, size: int, threshold: int = 0, mask: Image = None) -> Image

Performs erosion and dilation on an image in order.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: As the threshold for erosion and dilation, the actual threshold for erosion is (kernel_size - 1 - threshold), the actual threshold for dialation is threshold. default is 0.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *open(int size, int threshold = 0, image::Image *mask = nullptr)

close

def close(self, size: int, threshold: int = 0, mask: Image = None) -> Image

Performs dilation and erosion on an image in order.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: As the threshold for erosion and dilation, the actual threshold for erosion is (kernel_size - 1 - threshold), the actual threshold for dialation is threshold. default is 0.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *close(int size, int threshold = 0, image::Image *mask = nullptr)

top_hat

def top_hat(self, size: int, threshold: int = 0, mask: Image = None) -> Image

Returns the image difference of the image and Image.open()’ed image.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: As the threshold for open method. default is 0.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *top_hat(int size, int threshold = 0, image::Image *mask = nullptr)

black_hat

def black_hat(self, size: int, threshold: int = 0, mask: Image = None) -> Image

Returns the image difference of the image and Image.close()’ed image.

item description
type func
param size: Kernel size. The actual kernel size is ((size * 2) + 1) * ((size * 2) + 1). Use 1(3x3 kernel), 2(5x5 kernel).
threshold: As the threshold for close method. default is 0.
mask: Mask is another image to use as a pixel level mask for the operation. The mask should be an image with just black or white pixels and should be the same size as the image being operated on.
Only pixels set in the mask are modified. default is None.
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *black_hat(int size, int threshold = 0, image::Image *mask = nullptr)

find_blobs

def find_blobs(self, thresholds: list[list[int]] = [], invert: bool = False, roi: list[int] = [], x_stride: int = 2, y_stride: int = 1, area_threshold: int = 10, pixels_threshold: int = 10, merge: bool = False, margin: int = 0, x_hist_bins_max: int = 0, y_hist_bins_max: int = 0) -> list[Blob]

Finds all blobs in the image and returns a list of image.Blob class which describe each Blob.\nPlease see the image.Blob object more more information.

item description
type func
note For GRAYSCALE format, Lmin and Lmax range is [0, 255]. For RGB888 format, Lmin and Lmax range is [0, 100].
param thresholds: You can define multiple thresholds.
For GRAYSCALE format, you can use {{Lmin, Lmax}, ...} to define one or more thresholds.
For RGB888 format, you can use {{Lmin, Lmax, Amin, Amax, Bmin, Bmax}, ...} to define one or more thresholds.
Where the upper case L,A,B represent the L,A,B channels of the LAB image format, and min, max represent the minimum and maximum values of the corresponding channels.
invert: if true, will invert thresholds before find blobs, default is false
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
x_stride: x stride is the number of x pixels to skip when doing the hough transform. default is 2
y_stride: y_stride is the number of y pixels to skip when doing the hough transform. default is 1
area_threshold: area threshold, if the blob area is smaller than area_threshold, the blob is not returned, default is 10
pixels_threshold: pixels threshold, if the blob pixels is smaller than area_threshold, the blob is not returned,, default is 10.
when x_stride and y_stride is equal to 1, pixels_threshold is equivalent to area_threshold
merge: if True merges all not filtered out blobs whos bounding rectangles intersect each other. default is false
margin: margin can be used to increase or decrease the size of the bounding rectangles for blobs during the intersection test.
For example, with a margin of 1 blobs whos bounding rectangles are 1 pixel away from each other will be merged. default is 0
x_hist_bins_max: if set to non-zero populates a histogram buffer in each blob object with an x_histogram projection of all columns in the object. This value then sets the number of bins for that projection.
y_hist_bins_max: if set to non-zero populates a histogram buffer in each blob object with an y_histogram projection of all rows in the object. This value then sets the number of bins for that projection.
return Return the blob when found blobs, format is (blob1, blob2, ...), you can use blob class methods to do more operations.
static False

C++ defination code:

std::vector<image::Blob> find_blobs(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), bool invert = false, std::vector<int> roi = std::vector<int>(), int x_stride = 2, int y_stride = 1, int area_threshold = 10, int pixels_threshold = 10, bool merge = false, int margin = 0, int x_hist_bins_max = 0, int y_hist_bins_max = 0)

find_lines

def find_lines(self, roi: list[int] = [], x_stride: int = 2, y_stride: int = 1, threshold: float = 1000, theta_margin: float = 25, rho_margin: float = 25) -> list[Line]

Find lines in image

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
x_stride: x stride is the number of x pixels to skip when doing the hough transform. default is 2
y_stride: y_stride is the number of y pixels to skip when doing the hough transform. default is 1
threshold: threshold threshold controls what lines are detected from the hough transform. Only lines with a magnitude greater than or equal to threshold are returned.
The right value of threshold for your application is image dependent. default is 1000.
theta_margin: theta_margin controls the merging of detected lines. default is 25.
rho_margin: rho_margin controls the merging of detected lines. default is 25.
return Return the line when found lines, format is (line1, line2, ...), you can use line class methods to do more operations
static False

C++ defination code:

std::vector<image::Line> find_lines(std::vector<int> roi = std::vector<int>(), int x_stride = 2, int y_stride = 1, double threshold = 1000, double theta_margin = 25, double rho_margin = 25)

find_line_segments

def find_line_segments(self, roi: list[int] = [], merge_distance: int = 0, max_theta_difference: int = 15) -> list[Line]

Finds all line segments in the image.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
merge_distance: The maximum distance between two lines to merge them. default is 0.
max_theta_difference: The maximum difference between two lines to merge them. default is 15.
return Return the line when found lines, format is (line1, line2, ...), you can use line class methods to do more operations
static False

C++ defination code:

std::vector<image::Line> find_line_segments(std::vector<int> roi = std::vector<int>(), int merge_distance = 0, int max_theta_difference = 15)

find_circles

def find_circles(self, roi: list[int] = [], x_stride: int = 2, y_stride: int = 1, threshold: int = 2000, x_margin: int = 10, y_margin: int = 10, r_margin: int = 10, r_min: int = 2, r_max: int = -1, r_step: int = 2) -> list[Circle]

Find circles in image

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
x_stride: x stride is the number of x pixels to skip when doing the hough transform. default is 2
y_stride: y_stride is the number of y pixels to skip when doing the hough transform. default is 1
threshold: threshold controls what circles are detected from the hough transform. Only circles with a magnitude greater than or equal to threshold are returned.
The right value of threshold for your application is image dependent.
x_margin: x_margin controls the merging of detected circles. Circles which are x_margin, y_margin, and r_margin pixels apart are merged. default is 10
y_margin: y_margin controls the merging of detected circles. Circles which are x_margin, y_margin, and r_margin pixels apart are merged. default is 10
r_margin: r_margin controls the merging of detected circles. Circles which are x_margin, y_margin, and r_margin pixels apart are merged. default is 10
r_min: r_min controls the minimum circle radius detected. Increase this to speed up the algorithm. default is 2
r_max: r_max controls the maximum circle radius detected. Decrease this to speed up the algorithm. default is min(roi.w / 2, roi.h / 2)
r_step: r_step controls how to step the radius detection by. default is 2.
return Return the circle when found circles, format is (circle1, circle2, ...), you can use circle class methods to do more operations
static False

C++ defination code:

std::vector<image::Circle> find_circles(std::vector<int> roi = std::vector<int>(), int x_stride = 2, int y_stride = 1, int threshold = 2000, int x_margin = 10, int y_margin = 10, int r_margin = 10, int r_min = 2, int r_max = -1, int r_step = 2)

find_rects

def find_rects(self, roi: list[int] = [], threshold: int = 10000) -> list[Rect]

Finds all rects in the image.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
threshold: The threshold to use for the rects. default is 10000.
return Returns the rects of the image
static False

C++ defination code:

std::vector<image::Rect> find_rects(std::vector<int> roi = std::vector<int>(), int threshold = 10000)

find_qrcodes

def find_qrcodes(self, roi: list[int] = []) -> list[QRCode]

Finds all qrcodes in the image.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
return Returns the qrcodes of the image
static False

C++ defination code:

std::vector<image::QRCode> find_qrcodes(std::vector<int> roi = std::vector<int>())

find_apriltags

def find_apriltags(self, roi: list[int] = [], families: ApriltagFamilies = ..., fx: float = -1, fy: float = -1, cx: int = -1, cy: int = -1) -> list[AprilTag]

Finds all apriltags in the image.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
families: The families to use for the apriltags. default is TAG36H11.
fx: The camera X focal length in pixels, default is -1.
fy: The camera Y focal length in pixels, default is -1.
cx: The camera X center in pixels, default is image.width / 2.
cy: The camera Y center in pixels, default is image.height / 2.
return Returns the apriltags of the image
static False

C++ defination code:

std::vector<image::AprilTag> find_apriltags(std::vector<int> roi = std::vector<int>(), image::ApriltagFamilies families = image::ApriltagFamilies::TAG36H11, float fx = -1, float fy = -1, int cx = -1, int cy = -1)

find_datamatrices

def find_datamatrices(self, roi: list[int] = [], effort: int = 200) -> list[DataMatrix]

Finds all datamatrices in the image.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
effort: Controls how much time to spend trying to find data matrix matches. default is 200.
return Returns the datamatrices of the image
static False

C++ defination code:

std::vector<image::DataMatrix> find_datamatrices(std::vector<int> roi = std::vector<int>(), int effort = 200)

find_barcodes

def find_barcodes(self, roi: list[int] = []) -> list[BarCode]

Finds all barcodes in the image.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
return Returns the barcodes of the image
static False

C++ defination code:

std::vector<image::BarCode> find_barcodes(std::vector<int> roi = std::vector<int>())

find_displacement

def find_displacement(self, template_image: Image, roi: list[int] = [], template_roi: list[int] = [], logpolar: bool = False) -> Displacement

Finds the displacement between the image and the template. TODO: support in the feature\nnote: this method must be used on power-of-2 image sizes

item description
type func
param template_image: The template image.
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
template_roi: The region-of-interest rectangle (x, y, w, h) to work in. If not specified, it is equal to the image rectangle.
logpolar: If true, it will instead find rotation and scale changes between the two images. default is false.
return Returns the displacement of the image
static False

C++ defination code:

image::Displacement find_displacement(image::Image &template_image, std::vector<int> roi = std::vector<int>(), std::vector<int> template_roi = std::vector<int>(), bool logpolar = false)

find_template

def find_template(self, template_image: Image, threshold: float, roi: list[int] = [], step: int = 2, search: TemplateMatch = ...) -> list[int]

Finds the template in the image.

item description
type func
param template_image: The template image.
threshold: Threshold is floating point number (0.0-1.0) where a higher threshold prevents false positives while lowering the detection rate while a lower threshold does the opposite.
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image. Only valid in SEARCH_EX mode.
step: The step size to use for the template. default is 2. Only valid in SEARCH_EX mode
search: The search method to use for the template. default is SEARCH_EX.
return Returns a bounding box tuple (x, y, w, h) for the matching location otherwise None.
static False

C++ defination code:

std::vector<int> find_template(image::Image &template_image, float threshold, std::vector<int> roi = std::vector<int>(), int step = 2, image::TemplateMatch search = image::TemplateMatch::SEARCH_EX)

find_features

def find_features(self, cascade: int, threshold: float = 0.5, scale: float = 1.5, roi: list[int] = []) -> list[int]

Finds the features in the image. TODO: support in the feature

item description
type func
param cascade: The cascade to use for the features. default is CASCADE_FRONTALFACE_ALT.
threshold: The threshold to use for the features. default is 0.5.
scale: The scale to use for the features. default is 1.5.
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
return Returns the features of the image
static False

C++ defination code:

std::vector<int> find_features(int cascade, float threshold = 0.5, float scale = 1.5, std::vector<int> roi = std::vector<int>())

find_lbp

def find_lbp(self, roi: list[int] = []) -> LBPKeyPoint

Finds the lbp in the image. TODO: support in the feature.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
return Returns the lbp of the image
static False

C++ defination code:

image::LBPKeyPoint find_lbp(std::vector<int> roi = std::vector<int>())

find_keypoints

def find_keypoints(self, roi: list[int] = [], threshold: int = 20, normalized: bool = False, scale_factor: float = 1.5, max_keypoints: int = 100, corner_detector: CornerDetector = ...) -> ORBKeyPoint

Finds the keypoints in the image. TODO: support in the feature.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
threshold: The threshold to use for the keypoints. default is 20.
normalized: If true, the image will be normalized before the operation. default is false.
scale_factor: The scale factor to use for the keypoints. default is 1.5.
max_keypoints: The maximum number of keypoints to use for the keypoints. default is 100.
corner_detector: The corner detector to use for the keypoints. default is CORNER_AGAST.
return Returns the keypoints of the image
static False

C++ defination code:

image::ORBKeyPoint find_keypoints(std::vector<int> roi = std::vector<int>(), int threshold = 20, bool normalized = false, float scale_factor = 1.5, int max_keypoints = 100, image::CornerDetector corner_detector = image::CornerDetector::CORNER_AGAST)

find_edges

def find_edges(self, edge_type: EdgeDetector, roi: list[int] = [], threshold: list[int] = [100, 200]) -> Image

Finds the edges in the image.

item description
type func
param edge_type: The edge type to use for the edges. default is EDGE_CANNY.
roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
threshold: The threshold to use for the edges. default is 20.
return Returns the edges of the image
static False

C++ defination code:

image::Image* find_edges(image::EdgeDetector edge_type, std::vector<int> roi = std::vector<int>(), std::vector<int> threshold = std::vector<int>({100, 200}))

find_hog

def find_hog(self, roi: list[int] = [], size: int = 8) -> Image

Finds the hog in the image. TODO: support in the feature

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
size: The size to use for the hog. default is 8.
return Returns the hog of the image
static False

C++ defination code:

image::Image* find_hog(std::vector<int> roi = std::vector<int>(), int size = 8)

match_lbp_descriptor

def match_lbp_descriptor(self, desc1: LBPKeyPoint, desc2: LBPKeyPoint) -> int

Matches the lbp descriptor of the image. TODO: support in the feature

item description
type func
param desc1: The descriptor to use for the match.
desc2: The descriptor to use for the match.
return Returns the match of the image
static False

C++ defination code:

int match_lbp_descriptor(image::LBPKeyPoint &desc1, image::LBPKeyPoint &desc2)

match_orb_descriptor

def match_orb_descriptor(self, desc1: ORBKeyPoint, desc2: ORBKeyPoint, threshold: int = 95, filter_outliers: bool = False) -> KPTMatch

Matches the orb descriptor of the image. TODO: support in the feature

item description
type func
param desc1: The descriptor to use for the match.
desc2: The descriptor to use for the match.
threshold: The threshold to use for the match. default is 95.
filter_outliers: If true, the image will be filter_outliers before the operation. default is false.
return Returns the match of the image
static False

C++ defination code:

image::KPTMatch match_orb_descriptor(image::ORBKeyPoint &desc1, image::ORBKeyPoint &desc2, int threshold = 95, bool filter_outliers = false)