函数:findMultiColorInRegionFuzzyByTable 区域点阵找色
函数名称:点阵找色
函数功能:利用 table 进行多点找色,这种方法将会保留原始的颜色点阵数据(保留抓色器取的点及对应的颜色值)
函数方法
x,y = findMultiColorInRegionFuzzyByTable(tmp,degree,x1,y1,x2,y2,tab)
必填
参数 | 类型 | 说明 |
---|---|---|
tmp | table | 颜色点阵 |
degree | number | 精度,范围:0 ~ 100,当是 100 时为完全匹配 |
选填
参数 | 类型 | 说明 |
---|---|---|
x1 | number | 缺省默认值 0,区域左上角横坐标 |
y1 | number | 缺省默认值 0,区域左上角纵坐标 |
x2 | number | 缺省默认值 0,区域右下角横坐标 |
y2 | number | 缺省默认值 0,区域右下角纵坐标 |
tab | number | 仅 TSLib v1.2.8 及其以上版本支持 高阶用法详见 findMultiColorInRegionFuzzy 函数 |
返回值
返回值 | 类型 | 说明 |
---|---|---|
x,y | number | 返回符合条件的基准点的坐标,如未找到则返回 -1,-1 |
函数用例
require "TSLib"
local a={{185,687,0xcbcbcb},
{200,683,0x000000},
{200,700,0x000000},
{226,675,0x000000},
{251,706,0x000000},
}
local x,y=findMultiColorInRegionFuzzyByTable(a,90,166,626,440,890,{orient =1})
if x ~= -1 and y ~= -1 then
dialog("找到".."\r\n"..x..","..y,5)
else
dialog("未找到".."\r\n"..x..","..y,5)
end
函数用例
dialog 函数仅支持安卓,其他注意事项详见函数:dialog 提示框(仅支持 Android)。
触动智控已内置 TSLib 库,无需下载。