跳转至

primitives.visual

visual

类:

名称 描述
Frame

运行时图像数据。

Image

图像类。

ImageSlice
Template

模板图像类。

Frame

运行时图像数据。

Image 不同,Frame 仅表示内存中的图像数据, 适用于截图、裁剪结果、调试图等场景。

属性:

名称 类型 描述
mat

图像像素数据。默认约定为 BGR。

name

图像名称。主要用于日志与调试展示。

source

图像来源。可指向父 Frame、资源 Image 或路径。

rect

若图像由父图像裁剪而来,则表示其在父图像中的区域。

mat instance-attribute

mat = mat

图像像素数据。默认约定为 BGR。

name instance-attribute

name = name

图像名称。主要用于日志与调试展示。

source instance-attribute

source = source

图像来源。可指向父 Frame、资源 Image 或路径。

rect instance-attribute

rect = rect

若图像由父图像裁剪而来,则表示其在父图像中的区域。

Image

图像类。

方法:

名称 描述
__init__

从内存数据或图像文件创建图像类。

binary

Deprecated: return a grayscale copy of the image.

属性:

名称 类型 描述
name str | None

图像名称。

description str | None

图像描述。

file_path str | None

图像的文件路径。

pixels MatLike

图像的像素数据。

path str | None

Deprecated alias for file_path.

data MatLike

Deprecated alias for pixels.

data_with_alpha MatLike

Deprecated: return image including alpha channel when available.

name instance-attribute

name: str | None = name

图像名称。

description instance-attribute

description: str | None = description

图像描述。

file_path instance-attribute

file_path: str | None = file_path

图像的文件路径。

pixels property

pixels: MatLike

图像的像素数据。

path property writable

path: str | None

Deprecated alias for file_path.

data property

data: MatLike

Deprecated alias for pixels.

data_with_alpha property

data_with_alpha: MatLike

Deprecated: return image including alpha channel when available.

__init__

__init__(pixels: MatLike | None = None, file_path: str | None = None, lazy_load: bool = False, name: str | None = None, description: str | None = None)

从内存数据或图像文件创建图像类。

参数:

名称 类型 描述 默认
pixels
MatLike | None

图像数据。格式必须为 BGR。

None
file_path
str | None

图像文件路径。

None
lazy_load
bool

是否延迟加载图像数据。 若为 False,立即载入,否则仅当访问图像数据时才载入。仅当从文件创建图像类时生效。

False
name
str | None

图像名称。

None
description
str | None

图像描述。

None

binary cached

binary() -> Image

Deprecated: return a grayscale copy of the image.

ImageSlice

Bases: Image

方法:

名称 描述
binary

Deprecated: return a grayscale copy of the image.

属性:

名称 类型 描述
slice_rect

图像切片的矩形区域。

name str | None

图像名称。

description str | None

图像描述。

file_path str | None

图像的文件路径。

pixels MatLike

图像的像素数据。

path str | None

Deprecated alias for file_path.

data MatLike

Deprecated alias for pixels.

data_with_alpha MatLike

Deprecated: return image including alpha channel when available.

slice_rect instance-attribute

slice_rect = slice_rect

图像切片的矩形区域。

name instance-attribute

name: str | None = name

图像名称。

description instance-attribute

description: str | None = description

图像描述。

file_path instance-attribute

file_path: str | None = file_path

图像的文件路径。

pixels property

pixels: MatLike

图像的像素数据。

path property writable

path: str | None

Deprecated alias for file_path.

data property

data: MatLike

Deprecated alias for pixels.

data_with_alpha property

data_with_alpha: MatLike

Deprecated: return image including alpha channel when available.

binary cached

binary() -> Image

Deprecated: return a grayscale copy of the image.

Template

Bases: Image

模板图像类。

方法:

名称 描述
__init__

从内存数据或图像文件创建图像类。

binary

Deprecated: return a grayscale copy of the image.

属性:

名称 类型 描述
name str | None

图像名称。

description str | None

图像描述。

file_path str | None

图像的文件路径。

pixels MatLike

图像的像素数据。

path str | None

Deprecated alias for file_path.

data MatLike

Deprecated alias for pixels.

data_with_alpha MatLike

Deprecated: return image including alpha channel when available.

name instance-attribute

name: str | None = name

图像名称。

description instance-attribute

description: str | None = description

图像描述。

file_path instance-attribute

file_path: str | None = file_path

图像的文件路径。

pixels property

pixels: MatLike

图像的像素数据。

path property writable

path: str | None

Deprecated alias for file_path.

data property

data: MatLike

Deprecated alias for pixels.

data_with_alpha property

data_with_alpha: MatLike

Deprecated: return image including alpha channel when available.

__init__

__init__(pixels: MatLike | None = None, file_path: str | None = None, lazy_load: bool = False, name: str | None = None, description: str | None = None)

从内存数据或图像文件创建图像类。

参数:

名称 类型 描述 默认
pixels
MatLike | None

图像数据。格式必须为 BGR。

None
file_path
str | None

图像文件路径。

None
lazy_load
bool

是否延迟加载图像数据。 若为 False,立即载入,否则仅当访问图像数据时才载入。仅当从文件创建图像类时生效。

False
name
str | None

图像名称。

None
description
str | None

图像描述。

None

binary cached

binary() -> Image

Deprecated: return a grayscale copy of the image.