image-center
图像识别定位某个元素在当前屏幕中的坐标;
在自动化测试中获取到元素坐标之后,可以传入到键鼠工具,从而实现对目标元素的操作。
Documentation: https://linuxdeepin.github.io/image-center
Source Code: https://github.com/linuxdeepin/image-center
安装
pip install image-center
如果想在本机直接使用图像识别,还需要在本机安装OpenCV
sudo apt install python3-opencv
使用说明
截取目标元素图片,将图片保存到某个路径,
图片格式:默认使用PNG格式,支持JPG和JPEG格式;
from image_center import ImageCenter
# Linux and MacOS
ImageCenter.find_image("~/Desktop/test.png")
# Windows
ImageCenter.find_image("D:\\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 # 和服务端端口保持一致
# Linux and MacOS
ImageCenter.find_image("~/Desktop/test.png") # test.png是你自己截的图,路径也修改成你自己的路径
# Windows
ImageCenter.find_image("D:\\test.png")
Metadata
Release files for image-center 2024.6.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| image_center-2024.6.5.tar.gz | 13.8 kB | Without provenance | Details for image_center-2024.6.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| image_center-2024.6.5-py3-none-any.whl | Python 3 | none | any | Details for image_center-2024.6.5-py3-none-any.whl |
Total release size: 28.5 kB
Release files / image_center-2024.6.5.tar.gz
| Download URL | image_center-2024.6.5.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6282e41e884f79e16f89259b24b090f9c068098da2f8ce95209251117ea270b
|
|
BLAKE2b-256 checksum How to use checksums |
7f321c57e1e8dbd9e89595f42cfe4ed5616a77becd0c2762247bb310172c04bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|
Release files / image_center-2024.6.5-py3-none-any.whl
| Download URL | image_center-2024.6.5-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
191606000bfedfea4b567d67440932039d2a0e9deaaeb8173f468f3c277934e6
|
|
BLAKE2b-256 checksum How to use checksums |
6b6dc3ef10faf8e538f8fb2920aebff7c9fbaf9a5a82851ea8b433e253deda07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|
Security for image-center 2024.6.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.