Find target icon on your picture, and get its position. Painlessly, privately, standardly.
以简单的方式,为不同平台、不同语言提供可靠的图像识别(目标检测)服务。
它可以被用于:
- app资源遍历
- 页面状态检测
- 全端自动化
- ...
从我们的 官方文档 开始吧!
find target icon on your picture, and get its position
Home Page: https://williamfzc.github.io/findit/
License: MIT License
同一图片内,同一模板可能在不同的位置出现多次。
https://answers.opencv.org/question/165740/template-matching-multiple-objects/
事实上 tesseract 提供了获取 box 的API,这使得获取文字所在位置成为可能。
tesserocr也提供了相应的API:
from PIL import Image
import cv2
from tesserocr import PyTessBaseAPI, RIL
IMAGE_PATH = r'tests/pics/screen.png'
image = Image.open(IMAGE_PATH)
cv2_image = cv2.imread(IMAGE_PATH)
with PyTessBaseAPI(lang='eng+chi_sim') as api:
api.SetImage(image)
print(api.AllWordConfidences())
boxes = api.GetComponentImages(RIL.PARA, True)
print('Found {} textline image components.'.format(len(boxes)))
for im, box, *_ in boxes:
api.SetRectangle(box['x'], box['y'], box['w'], box['h'])
ocrResult = api.GetUTF8Text()
print(f'ocr result: {ocrResult}')
print(f'box: {box}')
cv2.rectangle(cv2_image, (box['x'], box['y']), (box['x'] + box['w'], box['y'] + box['h']), (255, 0, 0), 5)
cv2.imshow("Image", cv2_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/lzma/lzma_decoder.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/lzma/lzma_encoder.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/lzma/lzma_encoder_optimum_fast.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/lzma/lzma_encoder_optimum_normal.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/lzma/lzma_encoder_presets.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/rangecoder/price_table.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/arm.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/armthumb.c.o
[ 37%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/ia64.c.o
[ 38%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/powerpc.c.o
[ 38%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/simple_coder.c.o
[ 38%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/simple_decoder.c.o
[ 38%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/simple_encoder.c.o
[ 38%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/sparc.c.o
[ 38%] Building C object Utilities/cmliblzma/CMakeFiles/cmliblzma.dir/liblzma/simple/x86.c.o
[ 38%] Linking C static library libcmliblzma.a
[ 38%] Built target cmliblzma
[ 38%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_acl.c.o
In file included from /data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e/CMake-src/Utilities/cmlibarchive/libarchive/archive_acl.c:40:
In file included from /data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e/CMake-src/Utilities/cmlibarchive/libarchive/archive_acl_private.h:35:
In file included from /data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e/CMake-src/Utilities/cmlibarchive/libarchive/archive_string.h:49:
/data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e/CMake-src/Utilities/cmlibarchive/libarchive/archive.h:101:10: fatal error: 'android_lf.h' file not found
#include "android_lf.h"
^~~~~~~~~~~~~~
1 error generated.
make[5]: *** [Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/build.make:76: Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_acl.c.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:1990: Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/all] Error 2
make[3]: *** [Makefile:166: all] Error 2
make[2]: *** [CMakeFiles/CMakeProject-build.dir/build.make:88: CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:113: CMakeFiles/CMakeProject-build.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
File "/data/data/com.termux/files/usr/tmp/pip-build-env-hqp93sty/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 645, in setup
cmkr.make(make_args, install_target=cmake_install_target, env=env)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-hqp93sty/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 680, in make
self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-hqp93sty/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 704, in make_impl
raise SKBuildError(
--------------------------------------------------------------------------------
-- Trying "Ninja" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Ninja" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "Unix Makefiles" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Unix Makefiles" generator - success
--------------------------------------------------------------------------------
Configuring Project
Working directory:
/data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e/_skbuild/linux-aarch64-3.10/cmake-build
Command:
cmake /data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e/_skbuild/linux-aarch64-3.10/cmake-install/src/cmake/data -DPYTHON_VERSION_STRING:STRING=3.10.4 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/data/data/com.termux/files/usr/tmp/pip-build-env-hqp93sty/overlay/lib/python3.10/site-packages/skbuild/resources/cmake -DPython3_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPython3_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.10 -DPython3_LIBRARY:PATH=/data/data/com.termux/files/usr/lib/libpython3.10.so -DPython_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPython_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.10 -DPython_LIBRARY:PATH=/data/data/com.termux/files/usr/lib/libpython3.10.so -DPYTHON_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPYTHON_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.10 -DPYTHON_LIBRARY:PATH=/data/data/com.termux/files/usr/lib/libpython3.10.so -DCMAKE_BUILD_TYPE:STRING=Release
Traceback (most recent call last):
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cmake:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) If on Linux, with glibc < 2.12, you can set PIP_ONLY_BINARY=cmake in
order to retrieve the last manylinux1 compatible wheel.
3) If on Linux, with glibc < 2.12, you can cap "cmake<3.23" in your
requirements in order to retrieve the last manylinux1 compatible wheel.
4) Open an issue with the debug information that follows at
https://github.com/scikit-build/cmake-python-distributions/issues
Python: 3.10.4
platform: Linux-4.4.22-user-g72fafe4-aarch64-with-libc
machine: aarch64
bits: 64
pip: n/a
setuptools: 65.5.0
scikit-build: 0.15.0
PEP517_BUILD_BACKEND=setuptools.build_meta
=============================DEBUG ASSISTANCE=============================
An error occurred while building with CMake.
Command:
cmake --build . --target install --config Release --
Install target:
install
Source directory:
/data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e
Working directory:
/data/data/com.termux/files/usr/tmp/pip-install-fdcqy4g9/cmake_4c60df2d19bc499ba838b9fb07972e0e/_skbuild/linux-aarch64-3.10/cmake-build
Please check the install target is valid and see CMake's output for more information.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cmake
Failed to build cmake
ERROR: Could not build wheels for cmake, which is required to install pyproject.toml-based projects
WARNING: There was an error checking the latest version of pip.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: There was an error checking the latest version of pip.
做好好高产,非常好的项目
目前所有的引擎会在开始运作前进行两次强校验:
这套检测在 template matching与feature matching上是没问题的,但后续一些引擎并不需要两张图片(例如ocr只需要目标图片)。
运行了你的demo,自己也试了自己的图片,发现:找到并返回结果 这个过程总耗时有点长(我本机电脑试了几次,都在3s+),能改进吗?
Java: https://github.com/williamfzc/findit-java-client
python: https://github.com/williamfzc/findit-client
sync it with python version.
用于评定目标图片与模板图片的相似程度
图片相似性已经部署了吗,想问怎么用
目前处理效率已经开始成为一个需要解决的问题。
在保证准确率的前提下,这种方式能够提升分析效率
针对黑白屏等异常情况的检测引擎
目前特征匹配的效果不佳,显得整个功能有点鸡肋。
local version does not need them at all
sometimes we need OCR
主要跟缩放机制有关
File "/usr/local/lib/python3.7/site-packages/findit/core.py", line 212, in _find_with_template
each_result = each_engine.execute(each_template_object, target_pic_object, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/findit/engine/template.py", line 75, in execute
engine_template_mask_pic_object
File "/usr/local/lib/python3.7/site-packages/findit/engine/template.py", line 143, in _compare_template
loc_val, point_list, shape = sorted(result_list, key=lambda i: i[0][1])[-1]
IndexError: list index out of range
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.