Images
图片处理核心接口,提供屏幕截图录取证、图像裁剪、模板匹配、颜色识别等图像处理功能。
该接口封装了一系列图像处理操作,支持从文件或屏幕中进行图像分析, 包括模板匹配、颜色比较、特征点识别等高级功能,适用于自动化测试、图像识别等场景。
所有方法均提供异常处理机制,当参数无效或操作失败时会抛出相应异常, 建议调用时进行适当的异常捕获。
Author
M8Test, contact@m8test.com, https://m8test.com
Functions
Link copied to clipboard
捕获指定屏幕并保存为图像文件。
Link copied to clipboard
abstract fun compareColors(imagePath: String, firstColor: String, x: Int, y: Int, similarity: Int?, config: CompareColorsConfig.() -> Unit): Boolean
比较图像中指定坐标的颜色是否匹配目标颜色。
Link copied to clipboard
abstract fun compareColorsInDisplay(displayId: Int, firstColor: String, x: Int, y: Int, similarity: Int?, config: CompareColorsConfig.() -> Unit): Boolean
比较屏幕中指定坐标的颜色是否匹配目标颜色(自动申请权限)。
Link copied to clipboard
裁剪屏幕指定区域并保存为图像文件(自动申请权限)。
Link copied to clipboard
abstract fun findColors(imagePath: String, firstColor: String, similarity: Int?, limit: Int?, config: FindColorsConfig.() -> Unit): Results<CoordinateResult>
在图像中查找匹配指定颜色的所有点。
Link copied to clipboard
abstract fun findColorsInDisplay(displayId: Int, firstColor: String, similarity: Int?, limit: Int?, config: FindColorsConfig.() -> Unit): Results<CoordinateResult>
在屏幕中查找匹配指定颜色的所有点(自动申请权限)。
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun matchTemplates(srcPath: String, templatePath: String, similarity: Int?, limit: Int?, config: MatchTemplatesConfig.() -> Unit): Results<RegionResult>
在图像中查找匹配的模板(多目标支持)。
Link copied to clipboard
abstract fun matchTemplatesInDisplay(displayId: Int, templatePath: String, similarity: Int?, limit: Int?, config: MatchTemplatesConfig.() -> Unit): Results<RegionResult>
在屏幕中查找匹配的模板(自动申请权限)。