Skip to content

Commit

Permalink
Merge pull request #86 from WallBreaker2/op-0.4.2
Browse files Browse the repository at this point in the history
Op 0.4.2
  • Loading branch information
WallBreaker2 authored Jul 22, 2023
2 parents bd572aa + f1a405b commit 52a19cc
Show file tree
Hide file tree
Showing 23 changed files with 1,650 additions and 1,464 deletions.
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#
cmake_minimum_required (VERSION 3.0)

if(NOT $ENV{VCPKG_ROOT} STREQUAL "")
set(${CMAKE_TOOLCHAIN_FILE} $ENV{VCPKG_ROOT})
endif()
#if(NOT $ENV{VCPKG_ROOT} STREQUAL "")
# set(${CMAKE_TOOLCHAIN_FILE} $ENV{VCPKG_ROOT})
#endif()

if(NOT $ENV{BLACKBONE_ROOT} STREQUAL "")
set(blackbone_include_path "$ENV{BLACKBONE_ROOT}/src")
Expand Down Expand Up @@ -86,10 +86,6 @@ include_directories(
# 包含子项目。
## libop主项目
add_subdirectory ("libop")
## python测试项目
add_subdirectory("python")
## lua测试项目
add_subdirectory("lua")
## tools项目
add_subdirectory("tools")
## 测试项目
Expand Down
21 changes: 8 additions & 13 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=D:/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
Expand All @@ -16,7 +16,7 @@
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=D:/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows-static",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
Expand All @@ -32,9 +32,9 @@
"type": "BOOL"
},
{
"name": "CMAKE_BUILD_TYPE",
"value": "Release",
"type": "STRING"
"name": "Qt5_DIR",
"value": "D:/workspace/dev/qt/5.12.12/msvc2017",
"type": "PATH"
}
]
},
Expand All @@ -44,18 +44,18 @@
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=D:/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ]
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=D:/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
Expand All @@ -69,11 +69,6 @@
"name": "build_swig_py",
"value": "True",
"type": "BOOL"
},
{
"name": "CMAKE_BUILD_TYPE",
"value": "Release",
"type": "STRING"
}
]
}
Expand Down
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
Overview
===========
OP(operator & open)是一个开源插件(类似大漠插件).主要功能有:Windows消息模拟,后台截图,找图,字符识别(OCR)等。使用c++编写,源代码可编译为32/64位dll.op插件提供了两类接口:1)原生c++接口,可以让c/c++开发者方便调用;2)com接口,支持大多数编译型语言(c++,c#,vb,delphi等 以及脚本语言(python,lua等)的调用

OP插件是为了满足Windows平台下各种自动化操作和图像处理的需求而开发的一个轻量级、高效、易用的工具。它可以帮助开发者和用户实现各种复杂的任务,例如模拟键鼠操作、后台截图、图像识别、文字识别等。它适用于各种场景,例如办公自动化、软件测试、数据采集、图像处理等。
![ava](doc/class_struct.svg)
## 功能特色
1. Windows消息模拟,常见的键盘消息和鼠标消息模拟。
2. 支持常见的截图方式,gdi,dx(包括d3d9,d3d10,d3d11),opengl截图,支持常见模拟器(雷电,夜神)的最小化截图
3. 找色找图,支持偏色,支持模糊识别
4. 字符识别(OCR),最大支持255 X 255 超大点阵,支持偏色,支持模糊识别,支持系统字库
5. 插件有32位和64位版本,支持32/64位绑定
6. 项目完全开源,无后门无病毒,可放心使用
- Windows消息模拟,支持常见的键盘消息和鼠标消息模拟。
- 支持常见的截图方式,gdi,dx(包括d3d9,d3d10,d3d11),opengl截图,支持常见模拟器(雷电,夜神)的最小化截图
- 找色找图,支持偏色,支持模糊识别
- 字符识别(OCR)
>1. 传统识别算法:最大支持255 X 255 超大点阵,支持偏色,支持模糊识别,支持系统字库
>2. 内部接入主流 ocr引擎(例如google的tesseract),无需繁琐配置,一条命令即可完成识别
- 插件有32位和64位版本,支持32/64位程序调用

## Download
包含32位和64位插件,tool工具以及必要的第三方库等文件
下载地址:[https://github.com/WallBreaker2/op/releases](https://github.com/WallBreaker2/op/releases)[gitee](https://gitee.com/wallbreaker2/op/tags)

下载地址:[GitHub](https://github.com/WallBreaker2/op/releases)

## 教程
所有函数说明以及Demo可在以在[wiki](https://github.com/WallBreaker2/op/wiki)[gitlab](https://gitee.com/wallbreaker2/op/wikis)

所有函数说明以及Demo可在以在[wiki](https://github.com/WallBreaker2/op/wiki)中获取

## 编译
### 编译环境
* 操作系统: windows 10 64位
* 编译器: vs2019 MSVC2017 32/64
* 工具: cmake 3.0以上
* 编译器: vs2022 MSVC 32/64
* 工具: cmake 3.24以上
* DirectX SDK: 最新的即可
### 第三方库
* [blackbone](https://github.com/DarthTon/Blackbone.git)(静态编译,链接方式MT)
编译完成后,设置环境变量BLACKBONE_ROOT为源码根目录(例如D:\workspace\Blackbone)
* [tesseract](https://github.com/tesseract-ocr/tesseract)(依赖库较多,推荐vcpkg编译)
* [kiero](https://github.com/Rebzzel/kiero.git)(已在源码内,无需安装)
* [minhook](https://github.com/TsudaKageyu/minhook.git)(已在源码内,无需安装)
* [QT5.12](https://download.qt.io/archive/qt/5.12/5.12.12/)(可选) 安装完成后设置环境变量QT_ROOT为Qt安装目录下的版本目录,例如D:\workspace\QT\5.12.12
Expand All @@ -39,5 +42,5 @@ OP(operator & open)是一个开源插件(类似大漠插件).主要功能有:Win

## 参考
---
[1] TSPLUG源码,TC company
[2] [Kiero](https://github.com/Rebzzel/kiero.git)
[1] [TSPLUG源码,TC company](https://github.com/tcplugins/tsplug)
[2] [Kiero](https://github.com/Rebzzel/kiero.git)
2 changes: 1 addition & 1 deletion include/libop.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class OP_API libop{
void EnablePicCache(long enable, long* ret);
//取上次操作的图色区域,保存为file(24位位图)
void CapturePre(const wchar_t* file_name, long* ret);

//设置屏幕数据模式,0:从上到下(默认),1:从下到上
void SetScreenDataMode(long mode, long* ret);
//---------------------algorithm-------------------------------
//A星算法
Expand Down
14 changes: 10 additions & 4 deletions libop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ SET(SRC_FILES
"./core/opEnv.cpp"


"./imageProc/imageloc.cpp"
"./imageProc/imageproc.cpp"

"./imageProc/imageloc.cpp"
"./imageProc/imageproc.cpp"
"imageProc/tess_ocr.cpp"
"./winapi/injecter.cpp"
"./winapi/memoryEx.cpp"
"./winapi/query_api.cpp"
Expand Down Expand Up @@ -112,7 +112,7 @@ add_custom_command(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_library(${op_com} SHARED ${SRC_FILES} ${COM_SRC_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/./com/op.rc)
add_library(${op_com} SHARED ${SRC_FILES} ${COM_SRC_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/./com/op.rc "imageProc/tess_ocr.cpp")
SET_TARGET_PROPERTIES(${op_com} PROPERTIES LINK_FLAGS "/DEF:\"op.def\" /NODEFAULTLIB:\"mfc110d\"")
# add_custom_command(TARGET ${op_com} PRE_BUILD COMMAND midl ./com/op.idl /iid "./com/op_i.c" /env win32 /h "./com/op_i.h" /W1 /char signed /tlb "./com/op.tlb" /Oicf /target "NT60" /D "NDEBUG" /robust /nologo /proxy "op_p.c" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

Expand All @@ -129,6 +129,12 @@ include_directories(
./core
)

## for tesseract lib
find_package(Tesseract)
include_directories(${Tesseract_INCLUDE_DIRS})
target_link_libraries(${op_com} Tesseract::libtesseract)


# 7.add link library
#TARGET_LINK_LIBRARIES(libop BlackBone.lib)
#TARGET_LINK_LIBRARIES(libop minhook.lib)
Expand Down
14 changes: 14 additions & 0 deletions libop/core/optype.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct rect_t {
int x2, y2;
int width() const { return x2 - x1; }
int height() const { return y2 - y1; }
int area() const { return width() * height(); }
rect_t& shrinkRect(int w, int h) {
x2 -= w;
y2 -= h;
Expand Down Expand Up @@ -91,5 +92,18 @@ struct point_desc_t {
};

using vpoint_desc_t = std::vector<point_desc_t>;
// ocr result
struct ocr_rec_t {
// BBox of the text
point_t left_top;
point_t right_bottom;
// content of the text
wstring text;
// confidence of the text
float confidence;
};

using vocr_rec_t = std::vector<ocr_rec_t>;


#endif
Loading

0 comments on commit 52a19cc

Please sign in to comment.