超轻量级图像中文识别组件 chineseocr_lite 的 DLL 版本,用于 aardio 扩展库,适用于任何支持DLL的语言。

Overview

chineseocr_lite_dll

超轻量级图像中文识别组件 chineseocr_lite 的 DLL 版本,用于 aardio 扩展库,适用于任何支持DLL的语言。

感谢 xuncv/chineseocrlite-aardio 提供的 chineseocrlite-aardio 扩展库,让我了解到了 chineseocr_lite 这个优秀的开源组件。但是我在使用 chineseocrlite-aardio 时遇到一些问题,没有找到 DLL 的源代码,翻了一下 chineseocr_lite 的源码也只有 EXE 的项目,所以花了一点时间改造了一个 DLL 版本并开源,DLL 主要用于我重新实现的 aardio 扩展库:string.ocrLite,当然也可以用于任何支持 DLL 的语言。

此 DLL使用 Unicode 路径加载文件( 可解决中文路径下崩溃的问题 ),并使用内存数据输入输出图像 —— 这样在调用DLL时可以更灵活一些。DLL 工程已经全部配置好,只要使用 VC 2017 就可以直接编译出DLL文件。也可以在 aardio 中运行 import string.ocrLite 即可自动下载安装好我生成好的DLL文件以及 aardio 扩展库源码,DLL 接口用法请参考 aardio 扩展库源码。

string.ocrLite 支持生成绿色、独立的 EXE 文件,带模型生成的EXE打包后仅 十几 MB。下面主要介绍一下在 aaardio 中的用法,详细的用法请查看 string.ocrLite 函数库文档,以下是一个简单的例子:

import win.ui;
/*DSG{{*/
mainForm = win.form(text="string.ocrLite简单演示";right=796;bottom=504)
mainForm.add(
button={cls="button";text="识别剪贴板图像";left=528;top=423;right=712;bottom=477;db=1;dr=1;z=2};
edit={cls="edit";left=497;top=36;right=764;bottom=403;db=1;dr=1;dt=1;edge=1;hscroll=1;multiline=1;vscroll=1;z=3};
plus={cls="plus";left=25;top=36;right=474;bottom=403;db=1;dl=1;dr=1;dt=1;repeat="scale";z=1}
)
/*}}*/

import string.ocrLite;
import string.ocrLite.defaultModels;
import win.clip;

var ocr = string.ocrLite(,true);
mainForm.button.oncommand = function(id,event){
	var hBmp = win.clip.readBitmap()
	if(!hBmp){
		mainForm.edit.print("剪贴板未读取到图像")
		return;
	}
	
	var bmp = gdip.bitmap(hBmp);
	var ocrRet = ocr.detectBitmap(bmp);
	if(ocrRet){
		mainForm.plus.background = ocrRet.resultBitmap;
		
		mainForm.edit.text = ocrRet.text;
		mainForm.edit.text = "";
		
		import web.json;
		for i,block in table.eachIndex(ocrRet.blocks){
			mainForm.edit.print(block.text);
			mainForm.edit.print(web.json.stringify(block.points,false));
		}
	}
}

mainForm.show();

var ocrResult = ocr.detectClient(mainForm.hwnd);
if(ocrResult){  
	
	//在图文识别结果里模糊搜索最接近的文本所在的区块正中点位置的坐标。
	var x,y = ocrResult.findPoint("识别剪贴板图像",0.1);
	if(x && y){  
		import mouse; 
		//无句柄窗口可以直接用 winex.mouse.click() 点击
		mouse.moveToWindow(x,y,mainForm.hwnd);
		mouse.click();
	}
}

win.loopMessage();

运行效果如下: OCR 示例效果

You might also like...
 stackwalkerc - Windows single header stack walker in C (DbgHelp.DLL)
stackwalkerc - Windows single header stack walker in C (DbgHelp.DLL)

stackwalkerc - Windows single header stack walker in C (DbgHelp.DLL) Features Can be used in C or C++ code Super simple API Single header library make

Wrapper DLL for NieR Automata (PC ver.) to disable LODs & fix AO issues

NieRAutomata-LodMod An XInput/DXGI wrapper DLL that hooks into NieR Automata (Steam ver.) and disables object LODs, improving visual quality & fixing

Automatically inject a DLL into the selected process with VAC3 bypass.
Automatically inject a DLL into the selected process with VAC3 bypass.

FTP LOADER Automatically inject a DLL into the selected process with VAC3 bypass. This will only, most likely, work only with source engine games in s

Cobalt Strike Beacon Object File (BOF) that uses handwritten shellcode to return the process Environment strings without touching any DLL's.
Cobalt Strike Beacon Object File (BOF) that uses handwritten shellcode to return the process Environment strings without touching any DLL's.

Cobalt Strike "Where Am I?" Beacon Object File Cobalt Strike Beacon Object File (BOF) that uses handwritten shellcode to return the process Environmen

New lateral movement technique by abusing Windows Perception Simulation Service to achieve DLL hijacking code execution.
New lateral movement technique by abusing Windows Perception Simulation Service to achieve DLL hijacking code execution.

BOF - Lateral movement technique by abusing Windows Perception Simulation Service to achieve DLL hijacking ServiceMove is a POC code for an interestin

Beacon.dll reverse
Beacon.dll reverse

beacon实现 最近闲来无事,正好WBGIII大佬逆向了beacon,我觉得站在巨人的肩膀上干事情比较快,索性就拿着beacon分析了一波,这次patch修源码,让其适配64位还是学到了不少东西的。 具体链接 https://github.com/WBGlIl/Beacon_re 建议先下载一份源

A DLL that serves OutputDebugString content over a TCP connection
A DLL that serves OutputDebugString content over a TCP connection

RemoteDebugView A DLL that serves OutputDebugString content over a TCP connection Usage You will need to compile the DLL and then call the exported fu

A DLL that fixes some stuff on Fortnite OT 6.5. Originally based on Alphaium by Cyuubi
A DLL that fixes some stuff on Fortnite OT 6.5. Originally based on Alphaium by Cyuubi

How to use Compile as x86 because alpha is 32 bit Setup the responses Inject while in the login screen Wait for the console to tell you to login Respo

A simple utility that cold patches dwm (uDWM.dll) in order to disable window rounded corners in Windows 11

Win11DisableRoundedCorners A simple utility that cold patches the Desktop Window Manager (uDWM.dll) in order to disable window rounded corners in Wind

Change applications UI labels by hook SetDlgItemTextW(...) in user32.dll.
Change applications UI labels by hook SetDlgItemTextW(...) in user32.dll.

UI-Injection-Text Change applications UI labels by hook SetDlgItemTextW(...) in user32.dll.

simple C++ dll injector
simple C++ dll injector

Dll-Injector DLL injection is a method of executing arbitrary code in the address space of a separate live process. TECHNICAL DETAILS Open process wit

code for the Proxy DLL example blog post

ProxyDLLExample A simple DLL for Windows that can be used to demonstrate a DLL Proxy Attack. This project uses GCC through MinGW was tested on Ubuntu

DLL Hijack Search Order Enumeration BOF
DLL Hijack Search Order Enumeration BOF

DLL Hijack Search Order BOF What is this? This is a Cobalt Strike BOF file, meant to use two arguments (path to begin, and a DLL filename of interest)

Spotify AdBlocker for Windows, written in C. DLL Injection.
Spotify AdBlocker for Windows, written in C. DLL Injection.

Spotify AdBlock Windows Spotify Ad Block, in C ! Build Open an issue with information related if any error occurs. mingw32-make all Tested gcc: # gcc

DLL Exports Extraction BOF with optional NTFS transactions.
DLL Exports Extraction BOF with optional NTFS transactions.

DLL Exports Extraction BOF What is this? This is a Cobalt Strike BOF file, meant to use two or three arguments (path to DLL, and/or a third argument [

A BOF to parse the imports of a provided PE-file, optionally extracting symbols on a per-dll basis.

PE Import Enumerator BOF What is this? This is a BOF to enumerate DLL files to-be-loaded by a given PE file. Depending on the number of arguments, thi

A MCBE dll mod (mainly for testing) which modifies some piston functions
A MCBE dll mod (mainly for testing) which modifies some piston functions

PistonFuckery A MCBE dll mod (mainly for testing) which modifies some piston functions. The current version modifies PistonBlockActor::_checkAttachedB

This is a PoC for bypassing UAC using DLL hijacking and abusing the
This is a PoC for bypassing UAC using DLL hijacking and abusing the "Trusted Directories" verification.

UAC bypass - DLL hijacking Description This is a PoC for bypassing UAC using DLL hijacking and abusing the "Trusted Directories" verification. Summary

A small DLL that fixes tool's usage of the Halo 3 shader compiler.

h3-shader-compiler-fix A small DLL that fixes tool's usage of the Halo 3 shader compiler. Tool forgot to initialise the compiler before using it, so t

Owner
Jacen He
Jacen He
HP-Socket bindings for aardio

HP-Socket-bindings-for-aardio HP-Socket is a high performance network framework. aardio is an extremely easy-to-use dynamic language, but it is also a

null 9 Jan 3, 2022
Collection of DLL function export forwards for DLL export function proxying

dll-exports Collection of DLL function export forwards for DLL export function proxying. Typical usecase is for backdooring applications for persisten

Magnus Stubman 56 Nov 9, 2022
A method from GH on how to stream a dll without touching disk, TAGS: fortnite cheat fortnite injector dll injector

dll-encryptor People who make pay hacks typically have down syndrome and are incapable of using their brains in any fashion, and yet these bath salt s

Micca 2 Nov 24, 2021
Shared to msvcrt.dll or ucrtbase.dll and optimize the C/C++ application file size.

VC-LTL - An elegant way to compile lighter binaries. 简体中文 I would like to turn into a stone bridge, go through 500 years of wind, 500 years of Sun, ra

Chuyu Team 253 Nov 29, 2022
Simple one file header for hijacking windows version.dll for desired executable to do 3rd party modifying without dll injection.

Version-Hijack Simple one file header for hijacking windows version.dll for desired executable to do 3rd party modifying without dll injection. Usage

sneakyevil 6 Oct 19, 2022
DLL Hooker using DLL Redirection

DLLHooker DLL Hooker using DLL Redirection. Development Environment IDE: Visual Studio 2019 Demonstration References [1] https://www.exploit-db.com/do

Jack Ren 1 Jan 21, 2022
Hijack Printconfig.dll to execute shellcode

printjacker Printjacker is a post-exploitation tool that creates a persistence mechanism by overwriting Printconfig.dll with a shellcode injector. The

Red Section 84 Nov 9, 2022
CrashLogger - A dll injected into process to dump stack when crashing.

CrashLogger A dll injected into process to dump stack when crashing

YQ 22 Nov 3, 2022
A small proxy DLL which enables dev. console in Mass Effect 1, 2 and 3 (Legendary Edition).

LEBinkProxy A small proxy DLL which enables dev. console in Mass Effect 1, 2 and 3 (Legendary Edition). Usage In your game binary directory (Game\ME?\

null 10 Jan 6, 2022
Inject dll to explorer.exe and hide file from process.

Hide-FS Inject dll to explorer.exe and hide file from process. Requierments: Microsoft Detours Library - https://github.com/microsoft/Detours Compile:

null 11 Nov 9, 2022