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 MaixCDK

Module

No module

Enum

Format

item doc
brief Image formats
attention for developers, update this enum will also need to update the fmt_size in maix_image.cpp
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_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_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

item doc
brief Object fit method
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

item doc
brief Resize method
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

item doc
brief Family of apriltag
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

item doc
brief Template match method
values SEARCH_EX: Exhaustive search
SEARCH_DS: Diamond search

C++ defination code:

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

CornerDetector

item doc
brief CornerDetector class
values CORNER_FAST:
CORNER_AGAST:

C++ defination code:

enum CornerDetector
    {
        CORNER_FAST,
        CORNER_AGAST
    }

EdgeDetector

item doc
brief EdgeDetector class
values EDGE_CANNY:
EDGE_SIMPLE:

C++ defination code:

enum EdgeDetector
    {
        EDGE_CANNY,
        EDGE_SIMPLE,
    }

Variable

fmt_size

item doc
brief Image format size in bytes
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,
0,
0,
0,
0,
0
}
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,
        0,
        0,
        0,
        0,
        0
        }

fmt_names

item doc
brief Image format string
value {
"RGB888",
"BGR888",
"RGBA8888",
"BGRA8888",
"RGB565",
"BGR565",
"YUV422SP",
"YUV422P",
"YVU420SP",
"YUV420SP",
"YVU420P"
"YUV420P",
"GRAYSCALE",
"MAX"}
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",
        "MAX"}

COLOR_WHITE

item doc
brief Predefined color white
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

item doc
brief Predefined color black
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

item doc
brief Predefined color red
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

item doc
brief Predefined color green
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

item doc
brief Predefined color blue
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

item doc
brief Predefined color yellow
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

item doc
brief Predefined color purple
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

item doc
brief Predefined color orange
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

item doc
brief Predefined color gray
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

load

def load(path: str, format: Format = ...) -> Image
item doc
brief Load image from file, and convert to Image object
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

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
item doc
brief Create image from bytes
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
item doc
brief Load font from file
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

item doc
brief Set default font, if not call this method, default is hershey_plain
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]
item doc
brief Get all loaded fonts
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
item doc
brief Get text rendered width and height
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

item doc
brief OpenCV Mat(numpy array object) to Image object
param array: numpy array object, must be a 3-dim or 2-dim continuous array with shape hwc or hw
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, bgr: bool = True, copy: bool = True) -> numpy.ndarray[numpy.uint8]
item doc
brief Image object to OpenCV Mat(numpy array object)
param img: Image object
return numpy array object

C++ defination code:

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

Class

Size

item doc
brief Image size type

C++ defination code:

class Size

__init__

def __init__(self, width: int = 0, height: int = 0) -> None
item doc
type func
brief Construct a new Size object
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
item doc
type func
brief width of size
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
item doc
type func
brief height of size
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
item doc
type func
brief Subscript operator
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
item doc
type func
brief to string
static False

C++ defination code:

std::string __str__()

Line

item doc
brief Line class

C++ defination code:

class Line

__init__

item doc
type func
brief Line constructor
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__

item doc
type func
brief Subscript operator
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

item doc
type func
brief get x1 of line
return return x1 of the line, type is int
static False

C++ defination code:

int x1()

y1

item doc
type func
brief get y1 of line
return return y1 of the line, type is int
static False

C++ defination code:

int y1()

x2

item doc
type func
brief get x2 of line
return return x2 of the line, type is int
static False

C++ defination code:

int x2()

y2

item doc
type func
brief get y2 of line
return return y2 of the line, type is int
static False

C++ defination code:

int y2()

length

item doc
type func
brief get length of line
return return length of the line, type is int
static False

C++ defination code:

int length()

magnitude

item doc
type func
brief get magnitude of the straight line after Hough transformation
return return magnitude, type is int
static False

C++ defination code:

int magnitude()

theta

item doc
type func
brief get angle of the straight line after Hough transformation (0-179 degrees)
return return angle, type is int
static False

C++ defination code:

int theta()

rho

item doc
type func
brief get p-value of the straight line after Hough transformation
return return p-value, type is int
static False

C++ defination code:

int rho()

Rect

item doc
brief 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
item doc
type func
brief Rect constructor
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
item doc
type func
brief Subscript operator
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]]
item doc
type func
brief get corners of rect
return return the coordinate of the rect.
static False

C++ defination code:

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

rect

def rect(self) -> list[int]
item doc
type func
brief get rectangle of rect
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
item doc
type func
brief get x of rect
return return x of the rect, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int
item doc
type func
brief get y of rect
return return y of the rect, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int
item doc
type func
brief get w of rect
return return w of the rect, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int
item doc
type func
brief get h of rect
return return h of the rect, type is int
static False

C++ defination code:

int h()

magnitude

def magnitude(self) -> int
item doc
type func
brief get magnitude of the straight line after Hough transformation
return return magnitude, type is int
static False

C++ defination code:

int magnitude()

Circle

item doc
brief circle class

C++ defination code:

class Circle

__init__

def __init__(self, x: int, y: int, r: int, magnitude: int) -> None
item doc
type func
brief Circle constructor
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
item doc
type func
brief Subscript operator
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
item doc
type func
brief get x of circle
return return x of the circle, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int
item doc
type func
brief get y of circle
return return y of the circle, type is int
static False

C++ defination code:

int y()

r

def r(self) -> int
item doc
type func
brief get r of circle
return return r of the circle, type is int
static False

C++ defination code:

int r()

magnitude

def magnitude(self) -> int
item doc
type func
brief get magnitude of the circle after Hough transformation
return return magnitude, type is int
static False

C++ defination code:

int magnitude()

Blob

item doc
brief Blob class

C++ defination code:

class Blob

__init__

item doc
type func
brief Blob constructor
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__

item doc
type func
brief Subscript operator
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

item doc
type func
brief get blob corners
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

item doc
type func
brief get blob mini corners
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

item doc
type func
brief get blob rect
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

item doc
type func
brief get blob x of the upper left coordinate
return Returns the x coordinate of the upper left corner of the rectangle.
static False

C++ defination code:

int x()

y

item doc
type func
brief get blob y of the upper left coordinate
return Returns the y coordinate of the upper left corner of the rectangle.
static False

C++ defination code:

int y()

w

item doc
type func
brief get blob width
return Returns the blob’s bounding box w coordinate
static False

C++ defination code:

int w()

h

item doc
type func
brief get blob height
return Returns the blob’s bounding box h coordinate
static False

C++ defination code:

int h()

pixels

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

C++ defination code:

int pixels()

cx

item doc
type func
brief get blob center x
return Returns the centroid x position of the blob
static False

C++ defination code:

int cx()

cy

item doc
type func
brief get blob center y
return Returns the centroid y position of the blob
static False

C++ defination code:

int cy()

cxf

item doc
type func
brief get blob center x
return Returns the centroid x position of the blob
static False

C++ defination code:

float cxf()

cyf

item doc
type func
brief get blob center y
return Returns the centroid y position of the blob
static False

C++ defination code:

float cyf()

rotation

item doc
type func
brief get blob rotation
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

item doc
type func
brief get blob rotation_rad
return Returns the rotation of the blob in radians
static False

C++ defination code:

float rotation_rad()

rotation_deg

item doc
type func
brief get blob rotation_deg
return Returns the rotation of the blob in degrees.
static False

C++ defination code:

int rotation_deg()

code

item doc
type func
brief get blob code
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

item doc
type func
brief get blob count
return Returns the number of blobs merged into this blob.
static False

C++ defination code:

int count()

perimeter

item doc
type func
brief get blob merge_cnt
return Returns the number of pixels on this blob’s perimeter.
static False

C++ defination code:

int perimeter()

roundness

item doc
type func
brief get blob roundness
return Returns a value between 0 and 1 representing how round the object is
static False

C++ defination code:

float roundness()

elongation

item doc
type func
brief get blob elongation
returnReturns a value between 0 and 1 representing how long (not round) the object is
static False

C++ defination code:

float elongation()

area

item doc
type func
brief get blob area
return Returns the area of the bounding box around the blob
static False

C++ defination code:

int area()

density

item doc
type func
brief get blob density
return Returns the density ratio of the blob
static False

C++ defination code:

float density()

extent

item doc
type func
brief Alias for blob.density()
return Returns the density ratio of the blob
static False

C++ defination code:

float extent()

compactness

item doc
type func
brief get blob compactness
return Returns the compactness ratio of the blob
static False

C++ defination code:

float compactness()

solidity

item doc
type func
brief get blob solidity
return Returns the solidity ratio of the blob
static False

C++ defination code:

float solidity()

convexity

item doc
type func
brief get blob convexity
return Returns a value between 0 and 1 representing how convex the object is
static False

C++ defination code:

float convexity()

x_hist_bins

item doc
type func
brief get blob x_hist_bins
return Returns the x_hist_bins of the blob
static False

C++ defination code:

std::vector<int> x_hist_bins()

y_hist_bins

item doc
type func
brief get blob y_hist_bins
return Returns the y_hist_bins of the blob
static False

C++ defination code:

std::vector<int> y_hist_bins()

major_axis_line

item doc
type func
brief get blob major_axis_line
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

item doc
type func
brief get blob minor_axis_line
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

item doc
type func
brief get blob enclosing_circle
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

item doc
type func
brief get blob enclosed_ellipse
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

item doc
brief QRCode class

C++ defination code:

class QRCode

__init__

item doc
type func
brief QRCode constructor
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__

item doc
type func
brief Subscript operator
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

item doc
type func
brief get coordinate of QRCode
return return the coordinate of the QRCode.
static False

C++ defination code:

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

rect

item doc
type func
brief get rectangle of QRCode
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

item doc
type func
brief get x of QRCode
return return x of the QRCode, type is int
static False

C++ defination code:

int x()

y

item doc
type func
brief get y of QRCode
return return y of the QRCode, type is int
static False

C++ defination code:

int y()

w

item doc
type func
brief get w of QRCode
return return w of the QRCode, type is int
static False

C++ defination code:

int w()

h

item doc
type func
brief get h of QRCode
return return h of the QRCode, type is int
static False

C++ defination code:

int h()

payload

item doc
type func
brief get QRCode payload
return return area of the QRCode
static False

C++ defination code:

std::string payload()

version

item doc
type func
brief get QRCode version
return return version of the QRCode
static False

C++ defination code:

int version()

ecc_level

item doc
type func
brief get QRCode error correction level
return return error correction level of the QRCode
static False

C++ defination code:

int ecc_level()

mask

item doc
type func
brief get QRCode mask
return return mask of the QRCode
static False

C++ defination code:

int mask()

data_type

item doc
type func
brief get QRCode dataType
return return mask of the QRCode
static False

C++ defination code:

int data_type()

eci

item doc
type func
brief get QRCode eci
return return data of the QRCode
static False

C++ defination code:

int eci()

is_numeric

item doc
type func
brief check QRCode is numeric
return return true if the result type of the QRCode is numeric
static False

C++ defination code:

bool is_numeric()

is_alphanumeric

item doc
type func
brief check QRCode is alphanumeric
return return true if the result type of the QRCode is alphanumeric
static False

C++ defination code:

bool is_alphanumeric()

is_binary

item doc
type func
brief check QRCode is binary
return return true if the result type of the QRCode is binary
static False

C++ defination code:

bool is_binary()

is_kanji

item doc
type func
brief check QRCode is kanji
return return true if the result type of the QRCode is kanji
static False

C++ defination code:

bool is_kanji()

AprilTag

item doc
brief 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
item doc
type func
brief AprilTag constructor
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
item doc
type func
brief Subscript operator
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]]
item doc
type func
brief get coordinate of AprilTag
return return the coordinate of the AprilTag.
static False

C++ defination code:

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

rect

def rect(self) -> list[int]
item doc
type func
brief get rectangle of AprilTag
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
item doc
type func
brief get x of AprilTag
return return x of the AprilTag, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int
item doc
type func
brief get y of AprilTag
return return y of the AprilTag, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int
item doc
type func
brief get w of AprilTag
return return w of the AprilTag, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int
item doc
type func
brief get h of AprilTag
return return h of the AprilTag, type is int
static False

C++ defination code:

int h()

id

def id(self) -> int
item doc
type func
brief get id of AprilTag
return return id of the AprilTag, type is int
static False

C++ defination code:

int id()

family

def family(self) -> int
item doc
type func
brief get family of AprilTag
return return family of the AprilTag, type is int
static False

C++ defination code:

int family()

cx

def cx(self) -> int
item doc
type func
brief get cx of AprilTag
return return cx of the AprilTag, type is int
static False

C++ defination code:

int cx()

cxf

def cxf(self) -> float
item doc
type func
brief get cxf of AprilTag
return return cxf of the AprilTag, type is float
static False

C++ defination code:

float cxf()

cy

def cy(self) -> int
item doc
type func
brief get cy of AprilTag
return return cy of the AprilTag, type is int
static False

C++ defination code:

int cy()

cyf

def cyf(self) -> float
item doc
type func
brief get cyf of AprilTag
return return cyf of the AprilTag, type is float
static False

C++ defination code:

float cyf()

rotation

def rotation(self) -> float
item doc
type func
brief get rotation of AprilTag
return return rotation of the AprilTag, type is float
static False

C++ defination code:

float rotation()

decision_margin

def decision_margin(self) -> float
item doc
type func
brief Get decision_margin of AprilTag
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
item doc
type func
brief get hamming of AprilTag
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
item doc
type func
brief get goodness of AprilTag
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
item doc
type func
brief get x_translation of AprilTag
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
item doc
type func
brief get y_translation of AprilTag
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
item doc
type func
brief get z_translation of AprilTag
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
item doc
type func
brief get x_rotation of AprilTag
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
item doc
type func
brief get y_rotation of AprilTag
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
item doc
type func
brief get z_rotation of AprilTag
return return z_rotation of the AprilTag, type is float
static False

C++ defination code:

float z_rotation()

DataMatrix

item doc
brief DataMatrix class

C++ defination code:

class DataMatrix

__init__

item doc
type func
brief DataMatrix constructor
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__

item doc
type func
brief Subscript operator
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

item doc
type func
brief get coordinate of DataMatrix
return return the coordinate of the DataMatrix.
static False

C++ defination code:

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

rect

item doc
type func
brief get rectangle of DataMatrix
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

item doc
type func
brief get x of DataMatrix
return return x of the DataMatrix, type is int
static False

C++ defination code:

int x()

y

item doc
type func
brief get y of DataMatrix
return return y of the DataMatrix, type is int
static False

C++ defination code:

int y()

w

item doc
type func
brief get w of DataMatrix
return return w of the DataMatrix, type is int
static False

C++ defination code:

int w()

h

item doc
type func
brief get h of DataMatrix
return return h of the DataMatrix, type is int
static False

C++ defination code:

int h()

payload

item doc
type func
brief get payload of DataMatrix
return return payload of the DataMatrix, type is std::string
static False

C++ defination code:

std::string payload()

rotation

item doc
type func
brief get rotation of DataMatrix
return return rotation of the DataMatrix, type is float
static False

C++ defination code:

float rotation()

rows

item doc
type func
brief get rows of DataMatrix
return return rows of the DataMatrix, type is int
static False

C++ defination code:

int rows()

columns

item doc
type func
brief get columns of DataMatrix
return return columns of the DataMatrix, type is int
static False

C++ defination code:

int columns()

capacity

item doc
type func
brief get capacity of DataMatrix
return returns how many characters could fit in this data matrix, type is int
static False

C++ defination code:

int capacity()

padding

item doc
type func
brief get padding of DataMatrix
return returns how many unused characters are in this data matrix, type is int
static False

C++ defination code:

int padding()

BarCode

item doc
brief 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
item doc
type func
brief BarCode constructor
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
item doc
type func
brief Subscript operator
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]]
item doc
type func
brief get coordinate of BarCode
return return the coordinate of the BarCode.
static False

C++ defination code:

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

rect

def rect(self) -> list[int]
item doc
type func
brief get rectangle of BarCode
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
item doc
type func
brief get x of BarCode
return return x of the BarCode, type is int
static False

C++ defination code:

int x()

y

def y(self) -> int
item doc
type func
brief get y of BarCode
return return y of the BarCode, type is int
static False

C++ defination code:

int y()

w

def w(self) -> int
item doc
type func
brief get w of BarCode
return return w of the BarCode, type is int
static False

C++ defination code:

int w()

h

def h(self) -> int
item doc
type func
brief get h of BarCode
return return h of the BarCode, type is int
static False

C++ defination code:

int h()

payload

def payload(self) -> str
item doc
type func
brief get payload of BarCode
return return payload of the BarCode, type is std::string
static False

C++ defination code:

std::string payload()

type

def type(self) -> int
item doc
type func
brief get type of BarCode
return return type of the BarCode, type is int
static False

C++ defination code:

int type()

rotation

def rotation(self) -> float
item doc
type func
brief get rotation of BarCode
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
item doc
type func
brief get quality of BarCode
return return quality of the BarCode, type is int
static False

C++ defination code:

int quality()

Statistics

item doc
brief Statistics class

C++ defination code:

class Statistics

__init__

item doc
type func
brief Statistics constructor
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__

item doc
type func
brief Subscript operator
param index: array index
return int&
static False

C++ defination code:

int &__getitem__(int index)

format

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

C++ defination code:

image::Format format()

l_mean

item doc
type func
brief get L channel mean
return return L channel mean, type is int
static False

C++ defination code:

int l_mean()

l_median

item doc
type func
brief get L channel median
return return L channel median, type is int
static False

C++ defination code:

int l_median()

l_mode

item doc
type func
brief get L channel mode
return return L channel mode, type is int
static False

C++ defination code:

int l_mode()

l_std_dev

item doc
type func
brief get L channel std_dev
return return L channel std_dev, type is int
static False

C++ defination code:

int l_std_dev()

l_min

item doc
type func
brief get L channel min
return return L channel min, type is int
static False

C++ defination code:

int l_min()

l_max

item doc
type func
brief get L channel max
return return L channel max, type is int
static False

C++ defination code:

int l_max()

l_lq

item doc
type func
brief get L channel lq
return return L channel lq, type is int
static False

C++ defination code:

int l_lq()

l_uq

item doc
type func
brief get L channel uq
return return L channel uq, type is int
static False

C++ defination code:

int l_uq()

a_mean

item doc
type func
brief get A channel mean
return return A channel mean, type is int
static False

C++ defination code:

int a_mean()

a_median

item doc
type func
brief get A channea median
return return A channel median, type is int
static False

C++ defination code:

int a_median()

a_mode

item doc
type func
brief get A channel mode
return return A channel mode, type is int
static False

C++ defination code:

int a_mode()

a_std_dev

item doc
type func
brief get A channel std_dev
return return A channel std_dev, type is int
static False

C++ defination code:

int a_std_dev()

a_min

item doc
type func
brief get A channel min
return return A channel min, type is int
static False

C++ defination code:

int a_min()

a_max

item doc
type func
brief get A channel max
return return A channel max, type is int
static False

C++ defination code:

int a_max()

a_lq

item doc
type func
brief get A channel lq
return return A channel lq, type is int
static False

C++ defination code:

int a_lq()

a_uq

item doc
type func
brief get A channel uq
return return A channel uq, type is int
static False

C++ defination code:

int a_uq()

b_mean

item doc
type func
brief get B channel mean
return return B channel mean, type is int
static False

C++ defination code:

int b_mean()

b_median

item doc
type func
brief get B channea median
return return B channel median, type is int
static False

C++ defination code:

int b_median()

b_mode

item doc
type func
brief get B channel mode
return return B channel mode, type is int
static False

C++ defination code:

int b_mode()

b_std_dev

item doc
type func
brief get B channel std_dev
return return B channel std_dev, type is int
static False

C++ defination code:

int b_std_dev()

b_min

item doc
type func
brief get B channel min
return return B channel min, type is int
static False

C++ defination code:

int b_min()

b_max

item doc
type func
brief get B channel max
return return B channel max, type is int
static False

C++ defination code:

int b_max()

b_lq

item doc
type func
brief get B channel lq
return return B channel lq, type is int
static False

C++ defination code:

int b_lq()

b_uq

item doc
type func
brief get B channel uq
return return B channel uq, type is int
static False

C++ defination code:

int b_uq()

Displacement

item doc
brief Displacement class

C++ defination code:

class Displacement

__init__

def __init__(self, x_translation: float, y_translation: float, rotation: float, scale: float, response: float) -> None
item doc
type func
brief Displacement constructor
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
item doc
type func
brief Subscript operator
param index: array index
return int&
static False

C++ defination code:

int &__getitem__(int index)

x_translation

def x_translation(self) -> float
item doc
type func
brief get x_translation of Displacement
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
item doc
type func
brief get y_translation of Displacement
return return y_translation of the Displacement, type is float
static False

C++ defination code:

float y_translation()

rotation

def rotation(self) -> float
item doc
type func
brief get rotation of Displacement
return return rotation of the Displacement, type is float
static False

C++ defination code:

float rotation()

scale

def scale(self) -> float
item doc
type func
brief get scale of Displacement
return return scale of the Displacement, type is float
static False

C++ defination code:

float scale()

response

def response(self) -> float
item doc
type func
brief get response of Displacement
return return response of the Displacement, type is float
static False

C++ defination code:

float response()

LBPKeyPoint

item doc
brief LBPKeyPoint class

C++ defination code:

class LBPKeyPoint

__init__

def __init__(self, data: list[int]) -> None
item doc
type func
brief LBPKeyPoint constructor
param data: The data of the LBPKeyPoint
static False

C++ defination code:

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

KeyPoint

item doc
brief KeyPoint class

C++ defination code:

class KeyPoint

__init__

item doc
type func
brief KeyPoint constructor
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

item doc
brief 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
item doc
type func
brief KPTMatch constructor
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

item doc
brief ORBKeyPoint class

C++ defination code:

class ORBKeyPoint

__init__

def __init__(self, data: list[KeyPoint], threshold: int, normalized: bool) -> None
item doc
type func
brief ORBKeyPoint constructor
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]
item doc
type func
brief get data of ORBKeyPoint
return return data of the ORBKeyPoint, type is std::vector
static False

C++ defination code:

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

HaarCascade

item doc
brief HaarCascade class

C++ defination code:

class HaarCascade

__init__

def __init__(self) -> None
item doc
type func
brief HaarCascade constructor
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

item doc
brief Color class

C++ defination code:

class Color

__init__

item doc
type func
brief Color constructor
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

item doc
type var
brief Color red channel
static False
readonly False

C++ defination code:

uint8_t r

g

item doc
type var
brief Color green channel
static False
readonly False

C++ defination code:

uint8_t g

b

item doc
type var
brief Color blue channel
static False
readonly False

C++ defination code:

uint8_t b

alpha

item doc
type var
brief Color alpha channel, value from 0.0 to 1.0, float value
static False
readonly False

C++ defination code:

float alpha

gray

item doc
type var
brief Color gray channel
static False
readonly False

C++ defination code:

uint8_t gray

format

item doc
type var
brief Color format
static False
readonly False

C++ defination code:

image::Format format

hex

item doc
type func
brief Get color's hex value
static False

C++ defination code:

uint32_t hex()

from_rgb

item doc
type func
brief Create Color object from RGB channels
static True

C++ defination code:

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

from_bgr

item doc
type func
brief Create Color object from BGR channels
static True

C++ defination code:

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

from_gray

item doc
type func
brief Create Color object from gray channel
static True

C++ defination code:

static image::Color from_gray(uint8_t gray)

from_rgba

item doc
type func
brief Create Color object from RGBA channels
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

item doc
type func
brief Create Color object from BGRA channels
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

item doc
type func
brief Create Color object from hex value
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

item doc
type func
brief Convert Color format
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

item doc
type func
brief Convert color format and return a new Color object
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

item doc
brief Image class

C++ defination code:

class Image

__init__

item doc
type func
brief Image constructor
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

item doc
type func
brief Get image's format
see image.Format
static False

C++ defination code:

image::Format format()

size

item doc
type func
brief Get image's size, [width, height]
static False

C++ defination code:

image::Size size()

data_size

item doc
type func
brief Get image's data size
static False

C++ defination code:

int data_size()

width

item doc
type func
brief Get image's width
static False

C++ defination code:

int width()

height

item doc
type func
brief Get image's height
static False

C++ defination code:

int height()

data

item doc
type func
brief Get image's data pointer.\nIn MaixPy is capsule object.
static False

C++ defination code:

void *data()

__str__

item doc
type func
brief To string method
static False

C++ defination code:

std::string __str__()

to_str

item doc
type func
brief To string method
static False

C++ defination code:

std::string to_str()

get_pixel

item doc
type func
brief Get pixel of image
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

item doc
type func
brief Set pixel of image
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

item doc
type func
brief Convert Image object to tensor::Tensor object
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

item doc
type func
brief Get image's data and convert to array bytes
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

item doc
type func
brief Convert image to specific format
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

item doc
type func
brief Convert image to jpeg
param quality: the quality of jpg, default is 95. range is (50, 100].
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

item doc
type func
brief Draw image on this image
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

item doc
type func
brief Fill rectangle color to image
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

item doc
type func
brief Draw line on image
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

item doc
type func
brief Draw circle on image
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), by default(value is 1), -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

item doc
type func
brief Draw ellipse on image
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

item doc
type func
brief Draw text on image
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

item doc
type func
brief Draw cross on image
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

item doc
type func
brief Draw arrow on image
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

item doc
type func
brief Draw edges on image
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

item doc
type func
brief Draw keypoints on image
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
thickness: keypoints thickness(line width), by default(value is -1 means fill circle)
return this image object self
static False

C++ defination code:

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

resize

item doc
type func
brief Resize image, will create a new resized image object
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

item doc
type func
brief Affine transform image, will create a new transformed image object
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

item doc
type func
brief Copy image, will create a new copied image object
return new copied image object
static False

C++ defination code:

image::Image *copy()

crop

item doc
type func
brief Crop image, will create a new cropped image object
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

item doc
type func
brief Rotate image, will create a new rotated image object
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

item doc
type func
brief Finds the mean of x_div * y_div squares in the image and returns the modified image composed of the mean of each square.
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

item doc
type func
brief Finds the midpoint of x_div * y_div squares in the image and returns the modified image composed of the mean of each square.
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

item doc
type func
brief JPEG compresses the image in place, the same as to_jpeg functioin, it's recommend to use to_jpeg instead.
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

item doc
type func
brief Sets all pixels in the image to zero
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

item doc
type func
brief Zeros a rectangular part of the image. If no arguments are supplied this method zeros the center of the image.
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

item doc
type func
brief Zeros a circular part of the image. If no arguments are supplied this method zeros the center of the image.
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

item doc
type func
brief Zeros a ellipse part of the image. If no arguments are supplied this method zeros the center of the image.
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

item doc
type func
brief 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.
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

item doc
type func
brief Inverts the image in place.
return Returns the image after the operation is completed
static False

C++ defination code:

image::Image *invert()

b_and

item doc
type func
brief Performs a bitwise and operation between the image and the other image.
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

item doc
type func
brief Performs a bitwise nand operation between the image and the other image.
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

item doc
type func
brief Performs a bitwise or operation between the image and the other image.
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

item doc
type func
brief Performs a bitwise nor operation between the image and the other image.
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

item doc
type func
brief Performs a bitwise xor operation between the image and the other image.
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

item doc
type func
brief Performs a bitwise xnor operation between the image and the other image.
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

item doc
type func
brief Performs an auto white balance operation on the image. TODO: support in the feature
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

item doc
type func
brief Multiples the passed (3x3) or (4x3) floating-point color-correction-matrix with the image.\nnote: Grayscale format is not support.
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

item doc
type func
brief 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.
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

item doc
type func
brief Alias for Image.gamma.
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

item doc
type func
brief Flips (numerically inverts) all pixels values in an image
return Returns the image after the operation is completed.
static False

C++ defination code:

image::Image *negate()

replace

item doc
type func
brief Replaces all pixels in the image with the corresponding pixels in the other image.
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

item doc
type func
brief Alias for Image::replace.
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

item doc
type func
brief Adds the other image to the image.
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

item doc
type func
brief Subtracts the other image from the image.
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

item doc
type func
brief 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.
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

item doc
type func
brief 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.
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

item doc
type func
brief Caculate the minimum of each pixel in the image and the other image.
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

item doc
type func
brief Caculate the maximum of each pixel in the image and the other image.
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

item doc
type func
brief Caculate the absolute value of the difference between each pixel in the image and the other image.
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

item doc
type func
brief Blends the image with the other image.\nres = alpha * this_img / 256 + (256 - alpha) * other_img / 256
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

item doc
type func
brief Runs the histogram equalization algorithm on the image.
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

item doc
type func
brief Standard mean blurring filter using a box filter.\nThe parameters offset and invert are valid when threshold is True.
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

item doc
type func
brief 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.
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

item doc
type func
brief Runs the mode filter on the image by replacing each pixel with the mode of their neighbors.
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

item doc
type func
brief Runs the midpoint filter on the image.This filter finds the midpoint (max * bias + min * (1 - bias)) of each pixel neighborhood in the image.
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

item doc
type func
brief Convolves the image by a filter kernel. This allows you to do general purpose convolutions on an image.
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

item doc
type func
brief Convolves the image by a smoothing guassian kernel.
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

item doc
type func
brief Convolves the image by a edge detecting laplacian kernel.
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

item doc
type func
brief Convolves the image by a bilateral filter.
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

item doc
type func
brief Re-project’s and image from cartessian coordinates to linear polar coordinates.
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

item doc
type func
brief Re-project’s and image from cartessian coordinates to log polar coordinates.
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

item doc
type func
brief Performs a lens correction operation on the image. TODO: support in the feature
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.5.
y_corr: The y correction of the lens correction. default is 0.5.
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.5, double y_corr = 0.5)

rotation_corr

item doc
type func
brief Performs a rotation correction operation on the image. TODO: support in the feature
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

item doc
type func
brief Gets the histogram of the image.
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 the histogram of the image
static False

C++ defination code:

std::map<std::string, std::vector<float>> 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

item doc
type func
brief Gets the statistics of the image. TODO: support in the feature
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

item doc
type func
brief Gets the regression of the image.
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

item doc
type func
brief Save image to file
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

item doc
type func
brief Flood fills a region of the image starting from location x, y.
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

item doc
type func
brief Erodes the image in place.
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

item doc
type func
brief Dilates the image in place.
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

item doc
type func
brief Performs erosion and dilation on an image in order.
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

item doc
type func
brief Performs dilation and erosion on an image in order.
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

item doc
type func
brief Returns the image difference of the image and Image.open()’ed image.
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

item doc
type func
brief Returns the image difference of the image and Image.close()’ed image.
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

item doc
type func
brief 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.
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

item doc
type func
brief Find lines in image
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

item doc
type func
brief Finds all line segments in the image.
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

item doc
type func
brief Find circles in image
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

item doc
type func
brief Finds all rects in the image.
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

item doc
type func
brief Finds all qrcodes in the image.
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

item doc
type func
brief Finds all apriltags in the image.
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

item doc
type func
brief Finds all datamatrices in the image.
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

item doc
type func
brief Finds all barcodes in the image.
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

item doc
type func
brief 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
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

item doc
type func
brief Finds the template in the image.
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

item doc
type func
brief Finds the features in the image. TODO: support in the feature
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

item doc
type func
brief Finds the lbp in the image. TODO: support in the feature.
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

item doc
type func
brief Finds the keypoints in the image. TODO: support in the feature.
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

item doc
type func
brief Finds the edges in the image.
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

item doc
type func
brief Finds the hog in the image. TODO: support in the feature
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

item doc
type func
brief Matches the lbp descriptor of the image. TODO: support in the feature
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

item doc
type func
brief Matches the orb descriptor of the image. TODO: support in the feature
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)