PPocrv5

目前只有 autox app 可用,打包后无法使用,问就是还没做好 -.-

示例代码:

1// >>> 按顺序填好模型路径 <<< 模型文件在 QQ 群文件获取
2ppocrv5.init("/sdcard/脚本/ppocrv5/det_mobile.param", "/sdcard/脚本/ppocrv5/det_mobile.bin", "/sdcard/脚本/ppocrv5/rec_mobile.param", "/sdcard/脚本/ppocrv5/rec_mobile.bin");
3
4images.requestScreenCapture();
5
6let img = images.captureScreen();
7
8// 可适当对图片做些处理
9img = images.grayscale(img);
10
11// let img = images.read("/sdcard/test3.jpg");
12
13let result = ppocrv5.ocr(img);
14//let result = ppocrv5.ocr(img, x, y, width, height);// 裁剪后识别(返回的坐标为相对屏幕左上角的坐标,需要相对坐标可自行计算)
15
16log(result);
17
18const SIZE_320 = 0;
19const SIZE_400 = 1;
20const SIZE_480 = 2;
21const SIZE_560 = 3;
22const SIZE_640 = 4; // 默认
23// ppocrv5.setTargetSize(SIZE_560); // 设置模型分辨率(与精度成正比,速度成反比)
24
25const CPU = 0; // 默认
26const GPU = 1;
27const TURNIP = 2;
28// ppocrv5.setCpuGpu(CPU); // 设置推理方式
29
30// RecResult(
31// ========文本内容==========
32//     text=动态,
33// ========可信度==========
34//     prob=0.9528275,
35// ========文本方向 0:水平 1:垂直==========
36//     ori=0,
37// ========旋转边界矩形==========
38//     rRect=RotatedRect(
39//         center=Point(x=896, y=2318),
40//         size=Size(width=29.25, height=66.74999), angle=90.0
41//     ),
42// ========顶点坐标==========
43//     vertices=Vertices(topLeft=Point(x=863, y=2303), topRight=Point(x=930, y=2303), bottomRight=Point(x=930, y=2332), bottomLeft=Point(x=863, y=2332)),
44// ========边界矩形==========
45//     rect=Rect(left=863, top=2303, right=930, bottom=2332)
46// )