跳转至

backend.debug.vars

vars

函数:

名称 描述
img

用于在 result() 函数中嵌入图片。

color

用于在调试结果中嵌入颜色。

to_html

将文本转换为 HTML 代码。

get_current_ide

获取当前IDE类型

result

显示图片结果。

clear_saved

清空本地保存文件夹中的内容。

img

img(image: str | MatLike | Image | None) -> str

用于在 result() 函数中嵌入图片。

参数:

名称 类型 描述 默认

image

str | MatLike | Image | None

图片路径或 OpenCV 图片对象。

必需

返回:

类型 描述
str

图片的 HTML 代码。

color

color(color: str | tuple[int, int, int] | None) -> str

用于在调试结果中嵌入颜色。

to_html

to_html(text: str) -> str

将文本转换为 HTML 代码。

get_current_ide cached

get_current_ide() -> IDEType | None

获取当前IDE类型

result

result(title: str, image: MatLike | list[MatLike], text: str = '')

显示图片结果。

例:

result(
    "image.find",
    image,
    f"template: {img(template)} \n"
    f"matches: {len(matches)} \n"
)

参数:

名称 类型 描述 默认

title

str

标题。建议使用 模块.方法 格式。

必需

image

MatLike | list[MatLike]

图片。

必需

text

str

详细文本。可以是 HTML 代码,空格和换行将会保留。如果需要嵌入图片,使用 img() 函数。

''

clear_saved

clear_saved()

清空本地保存文件夹中的内容。