matchBitmapTemplatesInDisplay

abstract fun matchBitmapTemplatesInDisplay(displayId: Int, template: Bitmap, similarity: Int?, limit: Int?, config: MatchTemplatesConfig.() -> Unit): Results<RegionResult>

在屏幕中查找匹配的模板 Bitmap(自动申请权限)。

直接在指定屏幕中搜索与模板 Bitmap 相似的区域,是 matchTemplatesInDisplay 的内存版本, 避免了模板图像的文件读取,适用于模板图像动态生成或已在内存中的场景。

Return

包含所有匹配区域的 Results 对象,每个结果包含区域坐标和相似度。

Parameters

displayId

屏幕标识符:0 表示物理屏幕镜像,其他值表示虚拟屏幕。

template

模板图像 Bitmap 对象(小图)。

similarity

匹配相似度阈值(0-100),null 使用默认值。

limit

最大返回结果数量,null 表示无限制。

config

配置构建器,用于设置高级匹配参数。

See also

了解更多配置选项。

Throws

当相似度超出范围、屏幕 ID 不存在或 Bitmap 无效时抛出。

当自动申请权限失败时抛出。