Coder Social home page Coder Social logo

mikigo / image-center Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 1.0 613 KB

此仓库已经迁移到公司github仓库:https://github.com/linuxdeepin/image-center

Home Page: https://github.com/linuxdeepin/image-center

License: Apache License 2.0

Python 98.87% Shell 1.13%
matchtemplate opencv python3 rpc

image-center's Introduction

image-center

图像识别定位某个元素在当前屏幕中的坐标;

在自动化测试中获取到元素坐标之后,可以传入到键鼠工具,从而实现对目标元素的操作。


Documentation: https://funny-dream.github.io/image-center

Source Code: https://github.com/funny-dream/image-center


安装

pip install image-center

如果想在本机直接使用图像识别,还需要在本机安装OpenCV

sudo apt install python3-opencv

使用说明

截取目标元素图片,将图片保存到某个路径;

from image_center import ImageCenter

ImageCenter.find_image("~/Desktop/test.png")

返回 test.png 在当前屏幕中的位置。

RPC服务

如果不想在本机安装OpenCV,或者你的机器无法安装OpenCV,可以在服务端安装OpenCV(安装方法和上面一样);

服务端启动方法:

from image_center.server import server
from image_center.conf import setting

setting.PORT = 8889  # 默认端口是8889,可以修改为其他端口;

server()

执行这个代码就可以启动服务了;

客户端使用方法和前面一样,唯一需要配置的是服务端的IP和端口。

from image_center import ImageCenter
from image_center.conf import setting

setting.SERCER_IP = "192.168.2.1"  # 服务端IP
setting.PORT = 8889 # 和服务端端口保持一致

ImageCenter.find_image("~/Desktop/test.png") # test.png是你自己截的图,路径也修改成你自己的路径

image-center's People

Contributors

mikigo avatar

Stargazers

 avatar  avatar

Forkers

kun12138

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.