maix::image

maix.image module, image related definition and functions

This is maix::image module of MaixCDK.
All of these elements are in namespace maix::image.

For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!

Module

No module

Enum

Format

Image formats

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

C++ defination code:

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

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

        FMT_INVALID = 0xFF  // format not valid
    }

Fit

Object fit method

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

C++ defination code:

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

ResizeMethod

Resize method

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

C++ defination code:

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

ApriltagFamilies

Family of apriltag

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

C++ defination code:

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

TemplateMatch

Template match method

item describe
values SEARCH_EX: Exhaustive search
SEARCH_DS: Diamond search

C++ defination code:

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

CornerDetector

CornerDetector class

item describe
values CORNER_FAST:
CORNER_AGAST:

C++ defination code:

enum CornerDetector
    {
        CORNER_FAST,
        CORNER_AGAST
    }

EdgeDetector

EdgeDetector class

item describe
values EDGE_CANNY:
EDGE_SIMPLE:

C++ defination code:

enum EdgeDetector
    {
        EDGE_CANNY,
        EDGE_SIMPLE,
    }

FlipDir

FlipDir

item describe
values X:
Y:
XY:

C++ defination code:

enum class FlipDir
    {
        X,
        Y,
        XY
    }

QRCodeDecoderType

QRCode decode type class

item describe
values QRCODE_DECODER_TYPE_ZBAR:
QRCODE_DECODER_TYPE_QUIRC:

C++ defination code:

enum class QRCodeDecoderType {
        QRCODE_DECODER_TYPE_ZBAR,
        QRCODE_DECODER_TYPE_QUIRC
    }

LineType

Line type class

item describe
values LINE_NORMAL:
LINE_CROSS:
LINE_T:
LINE_L:

C++ defination code:

enum class LineType {
        LINE_NORMAL,
        LINE_CROSS,
        LINE_T,
        LINE_L,
    }

Variable

fmt_size

Image format size in bytes

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

C++ defination code:

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

fmt_names

Image format string

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

C++ defination code:

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

COLOR_WHITE

Predefined color white

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

C++ defination code:

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

COLOR_BLACK

Predefined color black

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

C++ defination code:

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

COLOR_RED

Predefined color red

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

C++ defination code:

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

COLOR_GREEN

Predefined color green

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

C++ defination code:

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

COLOR_BLUE

Predefined color blue

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

C++ defination code:

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

COLOR_YELLOW

Predefined color yellow

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

C++ defination code:

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

COLOR_PURPLE

Predefined color purple

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

C++ defination code:

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

COLOR_ORANGE

Predefined color orange

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

C++ defination code:

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

COLOR_GRAY

Predefined color gray

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

C++ defination code:

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

Function

resize_map_pos

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

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

C++ defination code:

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

resize_map_pos (overload 1)

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

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

C++ defination code:

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

resize_map_pos_reverse

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

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

C++ defination code:

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

load

Load image from file, and convert to Image object

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

C++ defination code:

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

from_bytes

Create image from bytes

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

C++ defination code:

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

load_font

Load font from file

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

C++ defination code:

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

set_default_font

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

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

C++ defination code:

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

fonts

Get all loaded fonts

item description
return all loaded fonts, string list type

C++ defination code:

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

string_size

Get text rendered width and height

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

C++ defination code:

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

Class

QRCodeDetector

QRCodeDetector class

C++ defination code:

class QRCodeDetector

__init__

QRCodeDetector constructor.\nUse npu to accelerate the speed of QR code scanning, note that this object will occupy npu resources

item description
type func
static False

C++ defination code:

QRCodeDetector()

detect

Finds all qrcodes in the image.

item description
type func
param img: The image to find qrcodes.
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.
decoder_type: Select the QR code decoding method. Choosing QRCODE_DECODER_TYPE_QUIRC allows for retrieving QR code version, ECC level, mask, data type, and other details,
though it may decode slower at lower resolutions. Opting for QRCODE_DECODER_TYPE_ZBAR enables faster decoding at lower resolutions but may slow down at higher resolutions,
providing only the QR code content and position information. default is QRCODE_DECODER_TYPE_ZBAR.
return Returns the qrcodes of the image
static False

C++ defination code:

std::vector<image::QRCode> detect(image::Image *img, std::vector<int> roi = std::vector<int>(), image::QRCodeDecoderType decoder_type = image::QRCodeDecoderType::QRCODE_DECODER_TYPE_ZBAR)

Size

Image size type

C++ defination code:

class Size

__init__

Construct a new Size object

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

C++ defination code:

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

width

width of size

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

C++ defination code:

int width(int width = -1)

height

height of size

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

C++ defination code:

int height(int height = -1)

[]

Subscript operator

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

C++ defination code:

int &operator[](int index)

__str__

to string

item description
type func
static False

C++ defination code:

std::string __str__()

Line

Line class

C++ defination code:

class Line

__init__

Line constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

x1

get x1 of line

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

C++ defination code:

int x1()

y1

get y1 of line

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

C++ defination code:

int y1()

x2

get x2 of line

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

C++ defination code:

int x2()

y2

get y2 of line

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

C++ defination code:

int y2()

length

get length of line

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

C++ defination code:

int length()

magnitude

get magnitude of the straight line after Hough transformation

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

C++ defination code:

int magnitude()

theta

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

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

C++ defination code:

int theta()

rho

get p-value of the straight line after Hough transformation

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

C++ defination code:

int rho()

Rect

Rect class

C++ defination code:

class Rect

__init__

Rect constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

corners

get corners of rect

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

C++ defination code:

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

rect

get rectangle of rect

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

C++ defination code:

std::vector<int> rect()

x

get x of rect

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

C++ defination code:

int x()

y

get y of rect

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

C++ defination code:

int y()

w

get w of rect

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

C++ defination code:

int w()

h

get h of rect

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

C++ defination code:

int h()

magnitude

get magnitude of the straight line after Hough transformation

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

C++ defination code:

int magnitude()

Circle

circle class

C++ defination code:

class Circle

__init__

Circle constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

x

get x of circle

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

C++ defination code:

int x()

y

get y of circle

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

C++ defination code:

int y()

r

get r of circle

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

C++ defination code:

int r()

magnitude

get magnitude of the circle after Hough transformation

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

C++ defination code:

int magnitude()

Blob

Blob class

C++ defination code:

class Blob

__init__

Blob constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

corners

get blob corners

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



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

C++ defination code:

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

mini_corners

get blob mini corners

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



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

C++ defination code:

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

rect

get blob rect

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

h

___________
static False

C++ defination code:

std::vector<int> rect()

x

get blob x of the upper left coordinate

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

C++ defination code:

int x()

y

get blob y of the upper left coordinate

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

C++ defination code:

int y()

w

get blob width

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

C++ defination code:

int w()

h

get blob height

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

C++ defination code:

int h()

pixels

get blob pixels

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

C++ defination code:

int pixels()

cx

get blob center x

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

C++ defination code:

int cx()

cy

get blob center y

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

C++ defination code:

int cy()

cxf

get blob center x

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

C++ defination code:

float cxf()

cyf

get blob center y

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

C++ defination code:

float cyf()

rotation

get blob rotation

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

C++ defination code:

float rotation()

rotation_rad

get blob rotation_rad

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

C++ defination code:

float rotation_rad()

rotation_deg

get blob rotation_deg

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

C++ defination code:

int rotation_deg()

code

get blob code

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

C++ defination code:

int code()

count

get blob count

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

C++ defination code:

int count()

perimeter

get blob merge_cnt

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

C++ defination code:

int perimeter()

roundness

get blob roundness

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

C++ defination code:

float roundness()

elongation

get blob elongation

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

C++ defination code:

float elongation()

area

get blob area

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

C++ defination code:

int area()

density

get blob density

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

C++ defination code:

float density()

extent

Alias for blob.density()

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

C++ defination code:

float extent()

compactness

get blob compactness

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

C++ defination code:

float compactness()

solidity

get blob solidity

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

C++ defination code:

float solidity()

convexity

get blob convexity

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

C++ defination code:

float convexity()

x_hist_bins

get blob x_hist_bins

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

C++ defination code:

std::vector<int> x_hist_bins()

y_hist_bins

get blob y_hist_bins

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

C++ defination code:

std::vector<int> y_hist_bins()

major_axis_line

get blob major_axis_line

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

C++ defination code:

std::vector<int> major_axis_line()

minor_axis_line

get blob minor_axis_line

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

C++ defination code:

std::vector<int> minor_axis_line()

enclosing_circle

get blob enclosing_circle

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

C++ defination code:

std::vector<int> enclosing_circle()

enclosed_ellipse

get blob enclosed_ellipse

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

C++ defination code:

std::vector<int> enclosed_ellipse()

QRCode

QRCode class

C++ defination code:

class QRCode

__init__

QRCode constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

corners

get coordinate of QRCode

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

C++ defination code:

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

rect

get rectangle of QRCode

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

C++ defination code:

std::vector<int> rect()

x

get x of QRCode

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

C++ defination code:

int x()

y

get y of QRCode

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

C++ defination code:

int y()

w

get w of QRCode

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

C++ defination code:

int w()

h

get h of QRCode

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

C++ defination code:

int h()

payload

get QRCode payload

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

C++ defination code:

std::string payload()

version

get QRCode version

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

C++ defination code:

int version()

ecc_level

get QRCode error correction level

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

C++ defination code:

int ecc_level()

mask

get QRCode mask

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

C++ defination code:

int mask()

data_type

get QRCode dataType

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

C++ defination code:

int data_type()

eci

get QRCode eci

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

C++ defination code:

int eci()

is_numeric

check QRCode is numeric

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

C++ defination code:

bool is_numeric()

is_alphanumeric

check QRCode is alphanumeric

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

C++ defination code:

bool is_alphanumeric()

is_binary

check QRCode is binary

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

C++ defination code:

bool is_binary()

is_kanji

check QRCode is kanji

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

C++ defination code:

bool is_kanji()

AprilTag

AprilTag class

C++ defination code:

class AprilTag

__init__

AprilTag constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

corners

get coordinate of AprilTag

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

C++ defination code:

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

rect

get rectangle of AprilTag

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

C++ defination code:

std::vector<int> rect()

x

get x of AprilTag

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

C++ defination code:

int x()

y

get y of AprilTag

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

C++ defination code:

int y()

w

get w of AprilTag

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

C++ defination code:

int w()

h

get h of AprilTag

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

C++ defination code:

int h()

id

get id of AprilTag

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

C++ defination code:

int id()

family

get family of AprilTag

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

C++ defination code:

int family()

cx

get cx of AprilTag

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

C++ defination code:

int cx()

cxf

get cxf of AprilTag

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

C++ defination code:

float cxf()

cy

get cy of AprilTag

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

C++ defination code:

int cy()

cyf

get cyf of AprilTag

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

C++ defination code:

float cyf()

rotation

get rotation of AprilTag

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

C++ defination code:

float rotation()

decision_margin

Get decision_margin of AprilTag

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

C++ defination code:

float decision_margin()

hamming

get hamming of AprilTag

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

C++ defination code:

int hamming()

goodness

get goodness of AprilTag

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

C++ defination code:

float goodness()

x_translation

get x_translation of AprilTag

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

C++ defination code:

float x_translation()

y_translation

get y_translation of AprilTag

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

C++ defination code:

float y_translation()

z_translation

get z_translation of AprilTag

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

C++ defination code:

float z_translation()

x_rotation

get x_rotation of AprilTag

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

C++ defination code:

float x_rotation()

y_rotation

get y_rotation of AprilTag

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

C++ defination code:

float y_rotation()

z_rotation

get z_rotation of AprilTag

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

C++ defination code:

float z_rotation()

DataMatrix

DataMatrix class

C++ defination code:

class DataMatrix

__init__

DataMatrix constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

corners

get coordinate of DataMatrix

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

C++ defination code:

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

rect

get rectangle of DataMatrix

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

C++ defination code:

std::vector<int> rect()

x

get x of DataMatrix

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

C++ defination code:

int x()

y

get y of DataMatrix

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

C++ defination code:

int y()

w

get w of DataMatrix

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

C++ defination code:

int w()

h

get h of DataMatrix

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

C++ defination code:

int h()

payload

get payload of DataMatrix

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

C++ defination code:

std::string payload()

rotation

get rotation of DataMatrix

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

C++ defination code:

float rotation()

rows

get rows of DataMatrix

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

C++ defination code:

int rows()

columns

get columns of DataMatrix

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

C++ defination code:

int columns()

capacity

get capacity of DataMatrix

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

C++ defination code:

int capacity()

padding

get padding of DataMatrix

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

C++ defination code:

int padding()

BarCode

BarCode class

C++ defination code:

class BarCode

__init__

BarCode constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

corners

get coordinate of BarCode

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

C++ defination code:

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

rect

get rectangle of BarCode

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

C++ defination code:

std::vector<int> rect()

x

get x of BarCode

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

C++ defination code:

int x()

y

get y of BarCode

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

C++ defination code:

int y()

w

get w of BarCode

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

C++ defination code:

int w()

h

get h of BarCode

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

C++ defination code:

int h()

payload

get payload of BarCode

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

C++ defination code:

std::string payload()

type

get type of BarCode

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

C++ defination code:

int type()

rotation

get rotation of BarCode

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

C++ defination code:

float rotation()

quality

get quality of BarCode

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

C++ defination code:

int quality()

Statistics

Statistics class

C++ defination code:

class Statistics

__init__

Statistics constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

format

get format of Statistics source image

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

C++ defination code:

image::Format format()

l_mean

get L channel mean

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

C++ defination code:

int l_mean()

l_median

get L channel median

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

C++ defination code:

int l_median()

l_mode

get L channel mode

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

C++ defination code:

int l_mode()

l_std_dev

get L channel std_dev

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

C++ defination code:

int l_std_dev()

l_min

get L channel min

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

C++ defination code:

int l_min()

l_max

get L channel max

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

C++ defination code:

int l_max()

l_lq

get L channel lq

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

C++ defination code:

int l_lq()

l_uq

get L channel uq

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

C++ defination code:

int l_uq()

a_mean

get A channel mean

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

C++ defination code:

int a_mean()

a_median

get A channea median

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

C++ defination code:

int a_median()

a_mode

get A channel mode

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

C++ defination code:

int a_mode()

a_std_dev

get A channel std_dev

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

C++ defination code:

int a_std_dev()

a_min

get A channel min

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

C++ defination code:

int a_min()

a_max

get A channel max

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

C++ defination code:

int a_max()

a_lq

get A channel lq

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

C++ defination code:

int a_lq()

a_uq

get A channel uq

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

C++ defination code:

int a_uq()

b_mean

get B channel mean

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

C++ defination code:

int b_mean()

b_median

get B channea median

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

C++ defination code:

int b_median()

b_mode

get B channel mode

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

C++ defination code:

int b_mode()

b_std_dev

get B channel std_dev

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

C++ defination code:

int b_std_dev()

b_min

get B channel min

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

C++ defination code:

int b_min()

b_max

get B channel max

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

C++ defination code:

int b_max()

b_lq

get B channel lq

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

C++ defination code:

int b_lq()

b_uq

get B channel uq

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

C++ defination code:

int b_uq()

Displacement

Displacement class

C++ defination code:

class Displacement

__init__

Displacement constructor

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

C++ defination code:

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

__getitem__

Subscript operator

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

C++ defination code:

int &__getitem__(int index)

x_translation

get x_translation of Displacement

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

C++ defination code:

float x_translation()

y_translation

get y_translation of Displacement

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

C++ defination code:

float y_translation()

rotation

get rotation of Displacement

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

C++ defination code:

float rotation()

scale

get scale of Displacement

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

C++ defination code:

float scale()

response

get response of Displacement

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

C++ defination code:

float response()

Percentile

Percentile class

C++ defination code:

class Percentile

__init__

Percentile constructor

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

C++ defination code:

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

__getitem__

Subscript operator

item description
type func
static False

C++ defination code:

int &__getitem__(int index)

value

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

item description
type func
return returns grayscale percentile value
static False

C++ defination code:

int value()

l_value

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

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

C++ defination code:

int l_value()

a_value

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

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

C++ defination code:

int a_value()

b_value

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

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

C++ defination code:

int b_value()

Threshold

Threshold class

C++ defination code:

class Threshold

__init__

Threshold constructor

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

C++ defination code:

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

__getitem__

Subscript operator

item description
type func
static False

C++ defination code:

int &__getitem__(int index)

value

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

item description
type func
return returns grayscale threshold value
static False

C++ defination code:

int value()

l_value

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

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

C++ defination code:

int l_value()

a_value

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

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

C++ defination code:

int a_value()

b_value

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

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

C++ defination code:

int b_value()

Histogram

Histogram class

C++ defination code:

class Histogram

__init__

Histogram constructor

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

C++ defination code:

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

__getitem__

Subscript operator

item description
type func
static False

C++ defination code:

int &__getitem__(int index)

bins

Returns a list of floats for the grayscale histogram.

item description
type func
static False

C++ defination code:

std::vector<float> bins()

l_bins

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

item description
type func
static False

C++ defination code:

std::vector<float> l_bins()

a_bins

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

item description
type func
static False

C++ defination code:

std::vector<float> a_bins()

b_bins

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

item description
type func
static False

C++ defination code:

std::vector<float> b_bins()

get_percentile

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

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

C++ defination code:

image::Percentile get_percentile(float percentile)

get_threshold

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

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

C++ defination code:

image::Threshold get_threshold()

get_statistics

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

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

C++ defination code:

image::Statistics get_statistics()

LBPKeyPoint

LBPKeyPoint class

C++ defination code:

class LBPKeyPoint

__init__

LBPKeyPoint constructor

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

C++ defination code:

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

KeyPoint

KeyPoint class

C++ defination code:

class KeyPoint

__init__

KeyPoint constructor

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

C++ defination code:

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

KPTMatch

KPTMatch class

C++ defination code:

class KPTMatch

__init__

KPTMatch constructor

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

C++ defination code:

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

ORBKeyPoint

ORBKeyPoint class

C++ defination code:

class ORBKeyPoint

__init__

ORBKeyPoint constructor

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

C++ defination code:

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

get_data

get data of ORBKeyPoint

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

C++ defination code:

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

HaarCascade

HaarCascade class

C++ defination code:

class HaarCascade

__init__

HaarCascade constructor

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

C++ defination code:

HaarCascade()

__init__ (overload 1)

LineGroup constructor

item description
type func
param id: The id of line
type: The line list type, @see image::LineType
lines: The line list
points: Point sets of line
static False

C++ defination code:

LineGroup(int id, image::LineType type, std::vector<image::Line> lines, std::vector<std::vector<std::vector<int>>> points = std::vector<std::vector<std::vector<int>>>())

LineGroup

LineGroup class

C++ defination code:

class LineGroup

id

Get the line id of group, first id is 0.

item description
type func
return return id
static False

C++ defination code:

int id()

type

Get the line type of group

item description
type func
return returns line type. @see LineType
static False

C++ defination code:

image::LineType type()

lines

Get a list of line

item description
type func
return returns a list composed of Line objects
static False

C++ defination code:

std::vector<image::Line> lines()

points

Get the key points of line

item description
type func
return returns a list composed of (x,y) coordnates.
static False

C++ defination code:

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

Image

Image class

C++ defination code:

class Image

Image

Image constructor

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

C++ defination code:

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

Image (overload 1)

Image constructor

item description
type func
param width: image width, should > 0
height: image height, should > 0
format: image format @see image::Format
data: image data, if data is nullptr, will malloc memory for image data
If the image is in jpeg format, data must be filled in.
data_size: image data size, only for compressed format like jpeg png, data_size must be filled in, or should be -1, default is -1.
copy: if true and data is not nullptr, will copy data to new buffer, else will use data directly. default is true to avoid memory leak.
static False

C++ defination code:

Image(int width, int height, image::Format format, uint8_t *data, int data_size, bool copy)

update

set image

item description
type func
static False

C++ defination code:

err::Err update(int width, int height, image::Format format, uint8_t *data = NULL, int data_size = 0, bool copy = true)

format

Get image's format

item description
type func
see image.Format
static False

C++ defination code:

image::Format format()

size

Get image's size, [width, height]

item description
type func
static False

C++ defination code:

image::Size size()

data_size

Get image's data size

item description
type func
static False

C++ defination code:

int data_size()

width

Get image's width

item description
type func
static False

C++ defination code:

int width()

height

Get image's height

item description
type func
static False

C++ defination code:

int height()

data

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

item description
type func
static False

C++ defination code:

void *data()

__str__

To string method

item description
type func
static False

C++ defination code:

std::string __str__()

to_str

To string method

item description
type func
static False

C++ defination code:

std::string to_str()

get_pixel

Get pixel of image

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

C++ defination code:

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

set_pixel

Set pixel of image

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

C++ defination code:

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

to_tensor

Convert Image object to tensor::Tensor object

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

C++ defination code:

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

to_bytes

Get image's data and convert to array bytes

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

C++ defination code:

Bytes *to_bytes(bool copy = true)

to_format

Convert image to specific format

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

C++ defination code:

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

to_format (overload 1)

Convert image to specific format

item description
type func
param format: format want to convert to, @see image::Format, only support RGB888, BGR888, RGBA8888, BGRA8888, GRAYSCALE, JPEG.
buff: user's buffer, if buff is nullptr, will malloc memory for new image data, else will use buff directly
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, void *buff, size_t buff_size)

to_jpeg

Convert image to jpeg

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

C++ defination code:

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

draw_image

Draw image on this image

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

C++ defination code:

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

draw_rect

Fill rectangle color to image

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

C++ defination code:

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

draw_line

Draw line on image

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

C++ defination code:

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

draw_circle

Draw circle on image

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

C++ defination code:

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

draw_ellipse

Draw ellipse on image

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

C++ defination code:

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

draw_string

Draw text on image

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

C++ defination code:

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

draw_cross

Draw cross on image

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

C++ defination code:

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

draw_arrow

Draw arrow on image

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

C++ defination code:

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

draw_edges

Draw edges on image

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

C++ defination code:

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

draw_keypoints

Draw keypoints on image

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

C++ defination code:

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

resize

Resize image, will create a new resized image object

item description
type func
param width: new width, if value is -1, will use height to calculate aspect ratio
height: new height, if value is -1, will use width to calculate aspect ratio
object_fit: fill, contain, cover, by default is fill
method: resize method, by default is NEAREST
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

Affine transform image, will create a new transformed image object, need 3 points.

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

C++ defination code:

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

affine (overload 1)

Perspective transform image, will create a new transformed image object, need 4 points.

item description
type func
param src_points: three source points, [x1, y1, x2, y2, x3, y3, x4, y4]
dst_points: three destination points, [x1, y1, x2, y2, x3, y3, x4, y4]
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* perspective(std::vector<int> src_points, std::vector<int> dst_points, int width = -1, int height = -1, image::ResizeMethod method = image::ResizeMethod::BILINEAR)

copy

Copy image, will create a new copied image object

item description
type func
return new copied image object
static False

C++ defination code:

image::Image *copy()

crop

Crop image, will create a new cropped image object

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

C++ defination code:

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

rotate

Rotate image, will create a new rotated image object

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

C++ defination code:

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

flip

Vertical flip image, and return a new image.

item description
type func
param dir: flip dir, see image.FlipDir, e.g. image.FlipDir.X is vertical flip.
return new flipped image.
throw When arg error, will throw out err.Err exception.
static False

C++ defination code:

image::Image *flip(const image::FlipDir dir)

mean_pool

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

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

C++ defination code:

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

midpoint_pool

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

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

C++ defination code:

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

compress

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

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

C++ defination code:

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

clear

Sets all pixels in the image to zero

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

C++ defination code:

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

mask_rectange

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

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

C++ defination code:

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

mask_circle

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

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

C++ defination code:

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

mask_ellipse

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

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

C++ defination code:

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

binary

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

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

C++ defination code:

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

invert

Inverts the image in place.

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

C++ defination code:

image::Image *invert()

b_and

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

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

C++ defination code:

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

b_nand

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

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

C++ defination code:

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

b_or

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

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

C++ defination code:

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

b_nor

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

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

C++ defination code:

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

b_xor

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

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

C++ defination code:

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

b_xnor

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

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

C++ defination code:

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

awb

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

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

C++ defination code:

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

ccm

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

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

C++ defination code:

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

gamma

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

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

C++ defination code:

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

gamma_corr

Alias for Image.gamma.

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

C++ defination code:

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

negate

Flips (numerically inverts) all pixels values in an image

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

C++ defination code:

image::Image *negate()

replace

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

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

C++ defination code:

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

set

Alias for Image::replace.

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

C++ defination code:

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

add

Adds the other image to the image.

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

C++ defination code:

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

sub

Subtracts the other image from the image.

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

C++ defination code:

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

mul

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

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

C++ defination code:

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

div

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

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

C++ defination code:

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

min

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

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

C++ defination code:

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

max

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

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

C++ defination code:

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

difference

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

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

C++ defination code:

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

blend

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

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

C++ defination code:

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

histeq

Runs the histogram equalization algorithm on the image.

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

C++ defination code:

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

mean

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

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

C++ defination code:

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

median

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

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

C++ defination code:

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

mode

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

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

C++ defination code:

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

midpoint

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

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

C++ defination code:

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

morph

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

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

C++ defination code:

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

gaussian

Convolves the image by a smoothing guassian kernel.

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

C++ defination code:

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

laplacian

Convolves the image by a edge detecting laplacian kernel.

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

C++ defination code:

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

bilateral

Convolves the image by a bilateral filter.

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

C++ defination code:

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

linpolar

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

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

C++ defination code:

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

logpolar

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

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

C++ defination code:

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

lens_corr

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

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

C++ defination code:

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

rotation_corr

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

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

C++ defination code:

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

get_histogram

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

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

C++ defination code:

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

get_statistics

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

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

C++ defination code:

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

get_regression

Gets the regression of the image.

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

C++ defination code:

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

save

Save image to file

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

C++ defination code:

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

flood_fill

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

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

C++ defination code:

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

erode

Erodes the image in place.

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

C++ defination code:

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

dilate

Dilates the image in place.

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

C++ defination code:

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

open

Performs erosion and dilation on an image in order.

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

C++ defination code:

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

close

Performs dilation and erosion on an image in order.

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

C++ defination code:

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

top_hat

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

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

C++ defination code:

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

black_hat

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

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

C++ defination code:

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

find_blobs

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

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

C++ defination code:

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

find_lines

Find lines in image

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

C++ defination code:

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

find_line_segments

Finds all line segments in the image.

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

C++ defination code:

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

search_line_path

Search the path of line

item description
type func
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.
detect_pixel_size: Before finding the path, the screen is divided into several smaller blocks, each with a width and height of detect_pixel_size. The smaller the detect_pixel_size, the finer the division. the unit is pixels.
point_merge_size: Minimum distance between merged point sets. the unit is pixels.
connection_max_size: Minimum size allowed for connecting points to form a line. the unit is pixels.
connection_max_distance: Minimum distance allowed for point to line. the unit is pixels.
connection_max_angle: Minimum angle allowed for connecting points to form a line.
return Return the line when found lines, format is (groupline1, groupline2, ...), you can use LineGroup class methods to do more operations
static False

C++ defination code:

std::vector<image::LineGroup> search_line_path(std::vector<std::vector<int>> thresholds = std::vector<std::vector<int>>(), int detect_pixel_size = 30, int point_merge_size = 15, int connection_max_size = 51, int connection_max_distance = 20, int connection_max_angle = 20)

find_circles

Find circles in image

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

C++ defination code:

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

find_rects

Finds all rects in the image.

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

C++ defination code:

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

find_qrcodes

Finds all qrcodes in the image.

item description
type func
param roi: The region of interest, input in the format of (x, y, w, h), x and y are the coordinates of the upper left corner, w and h are the width and height of roi.
default is None, means whole image.
decoder_type: Select the QR code decoding method. Choosing QRCODE_DECODER_TYPE_QUIRC allows for retrieving QR code version, ECC level, mask, data type, and other details,
though it may decode slower at lower resolutions. Opting for QRCODE_DECODER_TYPE_ZBAR enables faster decoding at lower resolutions but may slow down at higher resolutions,
providing only the QR code content and position information. default is QRCODE_DECODER_TYPE_ZBAR.
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>(), image::QRCodeDecoderType decoder_type = image::QRCodeDecoderType::QRCODE_DECODER_TYPE_ZBAR)

find_apriltags

Finds all apriltags in the image.

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

C++ defination code:

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

find_datamatrices

Finds all datamatrices in the image.

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

C++ defination code:

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

find_barcodes

Finds all barcodes in the image.

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

C++ defination code:

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

find_displacement

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

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

C++ defination code:

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

find_template

Finds the template in the image.

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

C++ defination code:

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

find_features

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

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

C++ defination code:

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

find_lbp

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

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

C++ defination code:

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

find_keypoints

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

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

C++ defination code:

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

find_edges

Finds the edges in the image.

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

C++ defination code:

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

find_hog

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

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

C++ defination code:

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

match_lbp_descriptor

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

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

C++ defination code:

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

match_orb_descriptor

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

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

C++ defination code:

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

Color

Color class

C++ defination code:

class Color

__init__

Color constructor

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

C++ defination code:

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

r

Color red channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t r

g

Color green channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t g

b

Color blue channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t b

alpha

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

item description
type var
static False
readonly False

C++ defination code:

float alpha

gray

Color gray channel

item description
type var
static False
readonly False

C++ defination code:

uint8_t gray

format

Color format

item description
type var
static False
readonly False

C++ defination code:

image::Format format

hex

Get color's hex value

item description
type func
static False

C++ defination code:

uint32_t hex()

from_rgb

Create Color object from RGB channels

item description
type func
static True

C++ defination code:

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

from_bgr

Create Color object from BGR channels

item description
type func
static True

C++ defination code:

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

from_gray

Create Color object from gray channel

item description
type func
static True

C++ defination code:

static image::Color from_gray(uint8_t gray)

from_rgba

Create Color object from RGBA channels

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

C++ defination code:

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

from_bgra

Create Color object from BGRA channels

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

C++ defination code:

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

from_hex

Create Color object from hex value

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

C++ defination code:

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

to_format

Convert Color format

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

C++ defination code:

void to_format(const image::Format &format)

to_format2

Convert color format and return a new Color object

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

C++ defination code:

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