Giter Site home page Giter Site logo

Comments (5)

wnight9527 avatar wnight9527 commented on July 28, 2024

大佬有没有什么想法。难道必须不同分辨率用不同的截图去识别么

from robothelper.

Jinnrry avatar Jinnrry commented on July 28, 2024

😂😂有,以前我考虑过这个问题,但是一直没有去实现。

首先,截取到的图片需要做等比例缩放,缩放到你目标图片的分辨率去

其次,找点函数的返回需要改成比例位置,比如使用(0.5,0.5)这种方式去表示图片中心

from robothelper.

wnight9527 avatar wnight9527 commented on July 28, 2024

😂😂有,以前我考虑过这个问题,但是一直没有去实现。

首先,截取到的图片需要做等比例缩放,缩放到你目标图片的分辨率去

其次,找点函数的返回需要改成比例位置,比如使用(0.5,0.5)这种方式去表示图片中心

我试试看

from robothelper.

zx900930 avatar zx900930 commented on July 28, 2024

个人用的笨办法:
自已定义一个开发机的分辨率 比如1280*720

然后你的所有会受分辨率影响的操作全带上比例封装一下
例如点击

private void rtap(int x, int y) {
        float wscale=MainActivity.w/1280;
        float hscale=MainActivity.h/720;
        x = (int) ((x + new Random().randomInt(-3,3))*wscale);
        y = (int) ((y + new Random().randomInt(-3,3))*hscale);
        Robot.tap(x,y);
    }

滑动(向右)

private void rswipe(int x, int y) {
        float wscale=MainActivity.w/1280;
        float hscale=MainActivity.h/720;
        x = (int) ((x + new Random().randomInt(-3,3))*wscale);
        int x1 = (int) ((x-448)*wscale);
        y = (int) ((y + new Random().randomInt(-3,3))*hscale);
        int y1 = (int) (y*hscale);
        int t = new Random().randomInt(1000,1500);
        swipe(x,y,x1,y1,t);
    }

还有取色判断之类内置的功能也加上分辨率封装一下

肯定有更好的办法,我这就是凑合着用

from robothelper.

TinyZzh avatar TinyZzh commented on July 28, 2024

airtest的很多图片匹配识别算法可以参考下。有好几种算法实现。建议添加python脚本支持。

from robothelper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.