Skip to content

Commit

Permalink
修改优化OCR示例
Browse files Browse the repository at this point in the history
  • Loading branch information
wilinz committed Aug 15, 2022
1 parent 8517479 commit b07aa38
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 5 deletions.
47 changes: 47 additions & 0 deletions app/src/main/assets/sample/7zip/rar解压缩/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"abis": [
"arm64-v8a",
"armeabi-v7a",
"x86",
"x86_64"
],
"assets": [
],
"buildDir": "build",
"build": {
"build_id": null,
"build_number": 0,
"build_time": 0
},
"useFeatures": [],
"icon": null,
"ignoredDirs": [],
"launchConfig": {
"displaySplash": false,
"hideLauncher": false,
"hideLogs": false,
"stableMode": false,
"volumeUpcontrol": false,
"permissions": [],
"serviceDesc": "使脚本自动操作(点击、长按、滑动等)所需,若关闭则只能执行不涉及自动操作的脚本。",
"splashIcon": null,
"splashText": "Powered by 7zip"
},
"libs": [
"libp7zip.so",
"libjackpal-androidterm5.so",
"libjackpal-termexec2.so"
],
"main": "rar解压缩.js",
"name": "rar解压缩",
"outputPath": null,
"packageName": "com.script.p7zip",
"scripts": {},
"signingConfig": {
"alias": null,
"keystore": null
},
"sourcePath": null,
"versionCode": 1,
"versionName": "1.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ window.canvas.on('draw', function (canvas) {
if (result && result.length > 0) {
for (let i = 0; i < result.length; i++) {
let ocrResult = result[i]
log(ocrResult);
log(" | ");
drawRectAndText(ocrResult.words + ' #信心:' + ocrResult.confidence.toFixed(2), ocrResult.bounds, '#00ff00', canvas, paint);
}
}
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
let img = images.read("./0.jpg")
let cpuThreadNum = 4
// 新增:自定义模型路径(必须是完整路径)
// 使用时请将自定义路径 myModelPath 改为拥有读写权限的目录,并在目录里放上三个必需的模型文件: ch_ppocr_mobile_v2.0_cls_opt.nb ch_ppocr_mobile_v2.0_det_opt.nb ch_ppocr_mobile_v2.0_rec_opt.nb,否则可能引起程序崩溃。
let myModelPath = "/sdcard/Android/data/org.autojs.autojs/models/ocr_v2_for_cpu";
// 新增:自定义模型路径(必须是绝对路径), files.path() 将相对路径转为绝对路径
let myModelPath = files.path("./models");
// 如果打包了自定义模型路径,则路径为"models/自定义的ocr模型文件夹名字"
//let myModelPath = "models/my_ocr_models_dir";
let start = new Date()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"abis": [
"arm64-v8a",
"armeabi-v7a",
"x86",
"x86_64"
],
"assets": [
{
"form": "models",
"to": "/models"
}
],
"buildDir": "build",
"build": {
"build_id": null,
"build_number": 0,
"build_time": 0
},
"useFeatures": [],
"icon": null,
"ignoredDirs": [],
"launchConfig": {
"displaySplash": false,
"hideLauncher": false,
"hideLogs": false,
"stableMode": false,
"volumeUpcontrol": false,
"permissions": [],
"serviceDesc": "使脚本自动操作(点击、长按、滑动等)所需,若关闭则只能执行不涉及自动操作的脚本。",
"splashIcon": null,
"splashText": "Powered by paddle ocr"
},
"libs": [
"libc++_shared.so",
"libpaddle_light_api_shared.so",
"libhiai.so",
"libhiai_ir.so",
"libhiai_ir_build.so",
"libNative.so",
"libjackpal-androidterm5.so",
"libjackpal-termexec2.so"
],
"main": "PaddleOCR(自定义模型路径).js",
"name": "PaddleOCR(自定义模型路径)",
"outputPath": null,
"packageName": "com.script.paddleocr.custommodel",
"scripts": {},
"signingConfig": {
"alias": null,
"keystore": null
},
"sourcePath": null,
"versionCode": 1,
"versionName": "1.0.0"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
56 changes: 56 additions & 0 deletions app/src/main/assets/sample/PaddleOCR/PaddleOCR/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"abis": [
"arm64-v8a",
"armeabi-v7a",
"x86",
"x86_64"
],
"assets": [
{
"form": "file:///android_asset/models",
"to": "/models"
}
],
"buildDir": "build",
"build": {
"build_id": null,
"build_number": 0,
"build_time": 0
},
"useFeatures": [],
"icon": null,
"ignoredDirs": [],
"launchConfig": {
"displaySplash": false,
"hideLauncher": false,
"hideLogs": false,
"stableMode": false,
"volumeUpcontrol": false,
"permissions": [],
"serviceDesc": "使脚本自动操作(点击、长按、滑动等)所需,若关闭则只能执行不涉及自动操作的脚本。",
"splashIcon": null,
"splashText": "Powered by paddle ocr"
},
"libs": [
"libc++_shared.so",
"libpaddle_light_api_shared.so",
"libhiai.so",
"libhiai_ir.so",
"libhiai_ir_build.so",
"libNative.so",
"libjackpal-androidterm5.so",
"libjackpal-termexec2.so"
],
"main": "PaddleOCR.js",
"name": "PaddleOCR",
"outputPath": null,
"packageName": "com.script.paddleocr",
"scripts": {},
"signingConfig": {
"alias": null,
"keystore": null
},
"sourcePath": null,
"versionCode": 1,
"versionName": "1.0.0"
}

0 comments on commit b07aa38

Please sign in to comment.