函数: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

注意事项

  • 雷电 9 系统模拟器分辨率为平板版时使用函数:getScreenSize 获取的屏幕宽高相反,获取到的宽度实际为屏幕高度,获取的高度实际为屏幕宽度,其他模拟器获取的屏幕宽高为实际屏幕宽高。
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""