TC官方合作论坛

标题: 请教:不用插件,通过TC自带功能能否显示出坐标? [打印本页]

作者: 菜鸟阿呆    时间: 2013-3-19 13:01
标题: 请教:不用插件,通过TC自带功能能否显示出坐标?

如上图,我把 0~9 个数字用 AB抓抓做成 0~9 个小图片,然后通过找图方法找出来,再然后通过字符连接 ?
呵呵,不知道是否可行 。

function test()
   
end0,end1,end2,end3,end4,end5,end6,end7,end8,end9,bmpx,bmpy
    help.sleep(500)
    bmp= color.findpic(0,0,650,500,"rc:000.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end0=0
    endif
   
    bmp= color.findpic(0,0,650,500,"rc:001.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=1
    endif
    bmp= color.findpic(0,0,650,500,"rc:002.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=2
    endif
   
    bmp= color.findpic(0,0,650,500,"rc:003.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=3
    endif
   
    bmp= color.findpic(0,0,650,500,"rc:004.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end4=4
    endif
    bmp= color.findpic(0,0,650,500,"rc:005.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end5=5
    endif
   
    bmp= color.findpic(0,0,650,500,"rc:006.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end6=6
    endif
    bmp= color.findpic(0,0,650,500,"rc:007.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end7=7
    endif   
   
    bmp= color.findpic(0,0,650,500,"rc:008.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end8=8
    endif
   
    bmp= color.findpic(0,0,650,500,"rc:009.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end9=9
    endif
out=end0&end1&end2&end3&end4&end5&end6&end7&end8&end9
help.messagebox(out)

endfunction

执行结果:1458

作者: 幼园留级老油条    时间: 2013-3-19 13:02
   做成多点特征  识别呗
作者: 菜鸟阿呆    时间: 2013-3-19 14:00
我通过找图连逗号都能找出来 。

上面天神级别的大人物指点下怎么把找到的东西组成 坐标啊 。不要用啥插件 。
作者: Abin    时间: 2013-3-19 14:02
我记得以前我讲过使用多点找色的方法去做识别字。。 只是那视频是在TC3.X讲的,而且在VIP版块。。还有源代码的。
作者: fanghui0632    时间: 2013-3-19 21:12
方法可以实现,考虑过CPU占用和运行迅速吗。
很多差一点电脑长时间找图会大量占用CPU,可能CPU过热自动关机的.
作者: 菜鸟阿呆    时间: 2013-3-25 16:35

end,end1,end2,end3,bmpx,bmpy

    help.sleep(500)

//查找左边 "方括号" 的X坐标
    bmp= color.findpic(0,0,400,400,"rc:sss.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        help.sleep(500)
    else
        help.messagebox("没找到")
    endif
  dou=bmpx

//查找 [ 右边 X 的第一位坐标

    bmp= color.findpic(dou,0,dou+11,300,"rc:000.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=0
    endif

    bmp= color.findpic(dou,0,dou+11,300,"rc:001.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=1
    endif

    bmp= color.findpic(dou,0,dou+11,300,"rc:002.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=2
    endif   

    bmp= color.findpic(dou,0,dou+11,300,"rc:003.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=3
    endif

    bmp= color.findpic(dou,0,dou+11,300,"rc:004.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=4
    endif

    bmp= color.findpic(dou,0,dou+11,300,"rc:005.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=5
    endif

    bmp= color.findpic(dou,0,dou+11,300,"rc:006.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=6
    endif

    bmp= color.findpic(dou,0,dou+11,300,"rc:007.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=7
    endif   

    bmp= color.findpic(dou,0,dou+11,300,"rc:008.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=8
    endif

    bmp= color.findpic(dou,0,dou+11,300,"rc:009.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end1=9
    endif

//查找 [ 右边 X 的第二位坐标

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:000.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=0
    endif

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:001.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=1
    endif

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:002.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=2
    endif   

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:003.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=3
    endif

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:004.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=4
    endif

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:005.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=5
    endif

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:006.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=6
    endif

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:007.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=7
    endif   

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:008.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=8
    endif

    bmp= color.findpic(dou+10,0,dou+17,300,"rc:009.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end2=9
    endif

    //查找 [ 右边 X 的第三位坐标

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:000.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=0
    endif

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:001.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=1
    endif

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:002.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=2
    endif   

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:003.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=3
    endif

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:004.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=4
    endif

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:005.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=5
    endif

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:006.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=6
    endif

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:007.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=7
    endif   

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:008.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=8
    endif

    bmp= color.findpic(dou+16,0,dou+24,300,"rc:009.bmp",#000000,1.0,0,bmpx,bmpy)
    if(bmp>=0)
        end3=9
    endif

//输出 X 的坐标   
out=end1&end2&end3
help.messagebox(out)

return 0
endfunction







欢迎光临 TC官方合作论坛 (http://bbs.52tc.co/) Powered by Discuz! X3.1