ms-types 0.10.11 → 0.10.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/hotUpdate.d.ts +0 -3
- package/types/image.d.ts +2 -2
- package/types/lua/ai.lua +3 -3
- package/types/lua/appleocr.lua +3 -3
- package/types/lua/cloud.lua +1 -1
- package/types/lua/global.lua +5 -5
- package/types/lua/hotupdate.lua +7 -8
- package/types/lua/http.lua +3 -3
- package/types/lua/image.lua +14 -14
- package/types/lua/ime.lua +9 -9
- package/types/lua/media.lua +9 -9
- package/types/lua/mysql.lua +11 -11
- package/types/lua/netcard.lua +6 -6
- package/types/lua/paddleocr.lua +3 -3
- package/types/lua/system.lua +23 -23
- package/types/lua/tomatoocr.lua +12 -17
- package/types/lua/tts.lua +3 -3
- package/types/lua/ui.lua +5 -5
- package/types/lua/yolo.lua +1 -1
- package/types/lua/yolocls.lua +1 -1
- package/types/mysql.d.ts +0 -2
- package/types/tomatoocr.d.ts +3 -41
- package/types/yolo.d.ts +1 -1
- package/types/yoloCls.d.ts +1 -1
- package/types/zh/MySql/346/250/241/345/235/227.d.ts +1 -3
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +447 -447
- package/types/zh//347/203/255/346/233/264/346/226/260/346/250/241/345/235/227.d.ts +0 -3
package/types/lua/system.lua
CHANGED
|
@@ -19,7 +19,7 @@ local _System = {}
|
|
|
19
19
|
---@return boolean 是否启动成功
|
|
20
20
|
---@example local started = system.startApp("cn.magicnode.script")
|
|
21
21
|
--- if started then
|
|
22
|
-
---
|
|
22
|
+
--- print("启动成功")
|
|
23
23
|
--- end
|
|
24
24
|
function _System.startApp(bundleId) return true end
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ function _System.startApp(bundleId) return true end
|
|
|
28
28
|
---@return boolean 是否关闭成功
|
|
29
29
|
---@example local stopped = system.stopApp("cn.magicnode.script")
|
|
30
30
|
--- if stopped then
|
|
31
|
-
---
|
|
31
|
+
--- print("关闭成功")
|
|
32
32
|
--- end
|
|
33
33
|
function _System.stopApp(bundleId) return true end
|
|
34
34
|
|
|
@@ -37,7 +37,7 @@ function _System.stopApp(bundleId) return true end
|
|
|
37
37
|
---@return boolean 是否激活成功
|
|
38
38
|
---@example local activated = system.activateApp("cn.magicnode.script")
|
|
39
39
|
--- if activated then
|
|
40
|
-
---
|
|
40
|
+
--- print("激活成功")
|
|
41
41
|
--- end
|
|
42
42
|
function _System.activateApp(bundleId) return true end
|
|
43
43
|
|
|
@@ -45,7 +45,7 @@ function _System.activateApp(bundleId) return true end
|
|
|
45
45
|
---@return ActivateAppInfo|nil 当前在前台的应用信息
|
|
46
46
|
---@example local info = system.activateAppInfo()
|
|
47
47
|
--- if info then
|
|
48
|
-
---
|
|
48
|
+
--- print(info.name)
|
|
49
49
|
--- end
|
|
50
50
|
function _System.activateAppInfo()
|
|
51
51
|
---@type ActivateAppInfo
|
|
@@ -67,7 +67,7 @@ function _System.foregroundAppInfos() return {} end
|
|
|
67
67
|
---@return ActivateAppInfo[] 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
|
|
68
68
|
---@example local apps = system.backgroundAppInfos()
|
|
69
69
|
--- if #apps > 0 then
|
|
70
|
-
---
|
|
70
|
+
--- print(apps[1].name)
|
|
71
71
|
--- end
|
|
72
72
|
function _System.backgroundAppInfos() return {} end
|
|
73
73
|
|
|
@@ -75,7 +75,7 @@ function _System.backgroundAppInfos() return {} end
|
|
|
75
75
|
---@return InstalledAppInfo[] 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
|
|
76
76
|
---@example local apps = system.getInstalledAppList()
|
|
77
77
|
--- if #apps > 0 then
|
|
78
|
-
---
|
|
78
|
+
--- print(apps[1].appName)
|
|
79
79
|
--- end
|
|
80
80
|
function _System.getInstalledAppList() return {} end
|
|
81
81
|
|
|
@@ -83,7 +83,7 @@ function _System.getInstalledAppList() return {} end
|
|
|
83
83
|
---@return boolean 是否打开成功
|
|
84
84
|
---@example local opened = system.recent()
|
|
85
85
|
--- if opened then
|
|
86
|
-
---
|
|
86
|
+
--- print("打开成功")
|
|
87
87
|
--- end
|
|
88
88
|
function _System.recent() return true end
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ function _System.recent() return true end
|
|
|
92
92
|
---@return boolean 是否打开成功
|
|
93
93
|
---@example local opened = system.openURL("https://www.baidu.com")
|
|
94
94
|
--- if opened then
|
|
95
|
-
---
|
|
95
|
+
--- print("打开成功")
|
|
96
96
|
--- end
|
|
97
97
|
function _System.openURL(url) return true end
|
|
98
98
|
|
|
@@ -108,7 +108,7 @@ function _System.notify(msg, title, id) end
|
|
|
108
108
|
---@return boolean 是否设置成功
|
|
109
109
|
---@example local set = system.setClipboard("hello")
|
|
110
110
|
--- if set then
|
|
111
|
-
---
|
|
111
|
+
--- print("设置成功")
|
|
112
112
|
--- end
|
|
113
113
|
function _System.setClipboard(s) return true end
|
|
114
114
|
|
|
@@ -116,7 +116,7 @@ function _System.setClipboard(s) return true end
|
|
|
116
116
|
---@return string 剪贴板内容
|
|
117
117
|
---@example local text = system.getClipboard()
|
|
118
118
|
--- if text then
|
|
119
|
-
---
|
|
119
|
+
--- print(text)
|
|
120
120
|
--- end
|
|
121
121
|
function _System.getClipboard() return '' end
|
|
122
122
|
|
|
@@ -124,7 +124,7 @@ function _System.getClipboard() return '' end
|
|
|
124
124
|
---@return boolean 是否锁屏
|
|
125
125
|
---@example local locked = system.isLocked()
|
|
126
126
|
--- if locked then
|
|
127
|
-
---
|
|
127
|
+
--- print("锁屏")
|
|
128
128
|
--- end
|
|
129
129
|
function _System.isLocked() return false end
|
|
130
130
|
|
|
@@ -132,7 +132,7 @@ function _System.isLocked() return false end
|
|
|
132
132
|
---@return boolean 是否锁屏成功
|
|
133
133
|
---@example local locked = system.lock()
|
|
134
134
|
--- if locked then
|
|
135
|
-
---
|
|
135
|
+
--- print("锁屏成功")
|
|
136
136
|
--- end
|
|
137
137
|
function _System.lock() return true end
|
|
138
138
|
|
|
@@ -140,14 +140,14 @@ function _System.lock() return true end
|
|
|
140
140
|
---@return boolean 是否解锁成功
|
|
141
141
|
---@example local unlocked = system.unlock()
|
|
142
142
|
--- if unlocked then
|
|
143
|
-
---
|
|
143
|
+
--- print("解锁成功")
|
|
144
144
|
--- end
|
|
145
145
|
function _System.unlock() return true end
|
|
146
146
|
|
|
147
147
|
--- 获取内存使用信息(MB)
|
|
148
148
|
---@return MemoryInfo 内存使用信息,包含应用占用、系统可用/总量、系统已用和系统占用率(单位:MB)
|
|
149
149
|
---@example local memInfo = system.getMemoryInfo()
|
|
150
|
-
---
|
|
150
|
+
--- print("应用: " .. memInfo.used .. "MB, 系统: " .. memInfo.systemUsed .. "/" .. memInfo.total .. "MB, 占用: " .. memInfo.usagePercentage .. "%")
|
|
151
151
|
function _System.getMemoryInfo()
|
|
152
152
|
---@type MemoryInfo
|
|
153
153
|
local ret
|
|
@@ -157,38 +157,38 @@ end
|
|
|
157
157
|
--- 获取已使用内存(MB)
|
|
158
158
|
---@return integer 已使用内存大小(单位:MB)
|
|
159
159
|
---@example local usedMemory = system.getUsedMemory()
|
|
160
|
-
---
|
|
160
|
+
--- print("已使用内存: " .. usedMemory .. "MB")
|
|
161
161
|
function _System.getUsedMemory() return 0 end
|
|
162
162
|
|
|
163
163
|
--- 获取可用内存(MB)
|
|
164
164
|
---@return integer 可用内存大小(单位:MB)
|
|
165
165
|
---@example local availableMemory = system.getAvailableMemory()
|
|
166
|
-
---
|
|
166
|
+
--- print("可用内存: " .. availableMemory .. "MB")
|
|
167
167
|
function _System.getAvailableMemory() return 0 end
|
|
168
168
|
|
|
169
169
|
--- 获取系统总内存(MB)
|
|
170
170
|
---@return integer 系统总内存大小(单位:MB)
|
|
171
171
|
---@example local totalMemory = system.getTotalMemory()
|
|
172
|
-
---
|
|
172
|
+
--- print("系统总内存: " .. totalMemory .. "MB")
|
|
173
173
|
function _System.getTotalMemory() return 0 end
|
|
174
174
|
|
|
175
175
|
--- 获取系统已用内存(MB)
|
|
176
176
|
---@return number 系统已用内存大小(单位:MB,物理内存总量减去可用内存)
|
|
177
177
|
---@example local systemUsed = system.getSystemUsedMemory()
|
|
178
|
-
---
|
|
178
|
+
--- print("系统已用内存: " .. systemUsed .. "MB")
|
|
179
179
|
function _System.getSystemUsedMemory() return 0 end
|
|
180
180
|
|
|
181
181
|
--- 获取 CPU 使用率
|
|
182
182
|
---@return number 当前应用 CPU 使用率(百分比)
|
|
183
183
|
---@example local cpuUsage = system.getCpuUsage()
|
|
184
|
-
---
|
|
184
|
+
--- print("CPU 使用率: " .. cpuUsage .. "%")
|
|
185
185
|
function _System.getCpuUsage() return 0 end
|
|
186
186
|
|
|
187
187
|
--- 启动 Agent 服务
|
|
188
188
|
---@return boolean 是否启动成功
|
|
189
189
|
---@example local started = system.startAgent()
|
|
190
190
|
--- if started then
|
|
191
|
-
---
|
|
191
|
+
--- print("Agent 启动成功")
|
|
192
192
|
--- end
|
|
193
193
|
function _System.startAgent() return true end
|
|
194
194
|
|
|
@@ -196,9 +196,9 @@ function _System.startAgent() return true end
|
|
|
196
196
|
---@return boolean Agent 是否正在运行
|
|
197
197
|
---@example local isRunning = system.getAgentStatus()
|
|
198
198
|
--- if isRunning then
|
|
199
|
-
---
|
|
199
|
+
--- print("Agent 服务正在运行")
|
|
200
200
|
--- else
|
|
201
|
-
---
|
|
201
|
+
--- print("Agent 服务未运行")
|
|
202
202
|
--- end
|
|
203
203
|
function _System.getAgentStatus() return false end
|
|
204
204
|
|
|
@@ -206,7 +206,7 @@ function _System.getAgentStatus() return false end
|
|
|
206
206
|
---@return boolean 是否关闭成功
|
|
207
207
|
---@example local stopped = system.stopAgent()
|
|
208
208
|
--- if stopped then
|
|
209
|
-
---
|
|
209
|
+
--- print("Agent 服务关闭成功")
|
|
210
210
|
--- end
|
|
211
211
|
function _System.stopAgent() return true end
|
|
212
212
|
|
package/types/lua/tomatoocr.lua
CHANGED
|
@@ -15,11 +15,9 @@ local _TomatoOCR = {}
|
|
|
15
15
|
---@param licenseData string 授权码 请传入你在 TomatoOCR 官网申请的授权码
|
|
16
16
|
---@param remark string|nil 备注信息(可选)
|
|
17
17
|
---@return TomatoInitResult|nil 设置结果
|
|
18
|
-
---@example
|
|
19
|
-
--- local result1 = tomatoocr.initializeWithConfig("online", "授权码")
|
|
20
|
-
--- -- 带备注
|
|
18
|
+
---@example local result1 = tomatoocr.initializeWithConfig("online", "授权码")
|
|
21
19
|
--- local result2 = tomatoocr.initializeWithConfig("online", "授权码", "测试环境")
|
|
22
|
-
---
|
|
20
|
+
--- print(result1, result2)
|
|
23
21
|
function _TomatoOCR.initializeWithConfig(mode, licenseData, remark) return nil end
|
|
24
22
|
|
|
25
23
|
--- 设置HTTP间隔
|
|
@@ -29,8 +27,7 @@ function _TomatoOCR.setHttpIntervalTime(v) end
|
|
|
29
27
|
|
|
30
28
|
--- 设置识别类型
|
|
31
29
|
---@param s string 识别类型 模型类型,默认 ch-3.0,除此之外还有 ch-2.0, ch, cht, japan, korean, number
|
|
32
|
-
---@example
|
|
33
|
-
--- tomatoocr.setRecType("ch-3.0")
|
|
30
|
+
---@example tomatoocr.setRecType("ch-3.0")
|
|
34
31
|
--- -- 普通中英文识别,2.0版模型
|
|
35
32
|
--- tomatoocr.setRecType("ch-2.0")
|
|
36
33
|
--- -- 普通中英文识别,1.0版模型
|
|
@@ -47,8 +44,7 @@ function _TomatoOCR.setRecType(s) end
|
|
|
47
44
|
|
|
48
45
|
--- 设置检测框类型
|
|
49
46
|
---@param s string 检测框类型 默认"rect": 由于手机上截图文本均为矩形文本;"quad":可准确检测倾斜文本
|
|
50
|
-
---@example
|
|
51
|
-
--- tomatoocr.setDetBoxType("rect")
|
|
47
|
+
---@example tomatoocr.setDetBoxType("rect")
|
|
52
48
|
--- -- 倾斜文本
|
|
53
49
|
--- tomatoocr.setDetBoxType("quad")
|
|
54
50
|
function _TomatoOCR.setDetBoxType(s) end
|
|
@@ -98,29 +94,28 @@ function _TomatoOCR.setFilterColor(filterColor, backgroundColor) end
|
|
|
98
94
|
---@param ex integer 边界框右下角x坐标
|
|
99
95
|
---@param ey integer 边界框右下角y坐标
|
|
100
96
|
---@return string OCR识别结果JSON字符串
|
|
101
|
-
---@example
|
|
102
|
-
---
|
|
103
|
-
--- logi("识别屏幕结果:" .. result1)
|
|
97
|
+
---@example local result1 = tomatoocr.ocrImage("screen", 3)
|
|
98
|
+
--- print("识别屏幕结果:" .. result1)
|
|
104
99
|
--- -- 识别文件
|
|
105
|
-
--- local result2 = tomatoocr.ocrImage("/path/to/image.png",
|
|
106
|
-
---
|
|
100
|
+
--- local result2 = tomatoocr.ocrImage("/path/to/image.png", 3)
|
|
101
|
+
--- print("识别文件结果:" .. result2)
|
|
107
102
|
--- -- 识别指定屏幕区域
|
|
108
|
-
--- local result3 = tomatoocr.ocrImage("screen",
|
|
109
|
-
---
|
|
103
|
+
--- local result3 = tomatoocr.ocrImage("screen", 3, 100, 100, 500, 300)
|
|
104
|
+
--- print("识别指定屏幕区域结果:" .. result3)
|
|
110
105
|
function _TomatoOCR.ocrImage(input, type, x, y, ex, ey) return '' end
|
|
111
106
|
|
|
112
107
|
--- 查找点击点
|
|
113
108
|
---@param js string 要找的文字
|
|
114
109
|
---@return string 找“要找的文字”的中心点 没有找到返回空字符串
|
|
115
110
|
---@example local result = tomatoocr.findTapPoint('{"text": "确定"}')
|
|
116
|
-
---
|
|
111
|
+
--- print(result)
|
|
117
112
|
function _TomatoOCR.findTapPoint(js) return '' end
|
|
118
113
|
|
|
119
114
|
--- 查找多个点击点
|
|
120
115
|
---@param js string 要找的文字
|
|
121
116
|
---@return string 找“要找的文字”的所有相匹配的中心点 没有找到返回空字符串
|
|
122
117
|
---@example local result = tomatoocr.findTapPoints('{"texts": ["确定", "取消"]}')
|
|
123
|
-
---
|
|
118
|
+
--- print(result)
|
|
124
119
|
function _TomatoOCR.findTapPoints(js) return '' end
|
|
125
120
|
|
|
126
121
|
--- 释放已加载的 OCR 模型和内部资源
|
package/types/lua/tts.lua
CHANGED
|
@@ -30,7 +30,7 @@ function _TTS.stop() end
|
|
|
30
30
|
--- 是否正在说话
|
|
31
31
|
---@return boolean 是否正在播放
|
|
32
32
|
---@example if tts.isSpeaking() then
|
|
33
|
-
---
|
|
33
|
+
--- print("正在播放")
|
|
34
34
|
--- end
|
|
35
35
|
function _TTS.isSpeaking() return false end
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ function _TTS.isSpeaking() return false end
|
|
|
39
39
|
---@return boolean 是否设置成功
|
|
40
40
|
---@example local success = tts.setVoice("com.apple.ttsbundle.siri_Yu-shu_zh-CN_compact")
|
|
41
41
|
--- if success then
|
|
42
|
-
---
|
|
42
|
+
--- print("语音设置成功")
|
|
43
43
|
--- end
|
|
44
44
|
function _TTS.setVoice(voice) return true end
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ function _TTS.setVoice(voice) return true end
|
|
|
47
47
|
---@return VoiceInfo[] 语音信息数组
|
|
48
48
|
---@example local voices = tts.getAvailableVoices()
|
|
49
49
|
--- for _, voice in ipairs(voices) do
|
|
50
|
-
---
|
|
50
|
+
--- print("语音: " .. voice.name .. ", 语言: " .. voice.language)
|
|
51
51
|
--- end
|
|
52
52
|
function _TTS.getAvailableVoices() return {} end
|
|
53
53
|
|
package/types/lua/ui.lua
CHANGED
|
@@ -22,9 +22,9 @@ function _UI.showToast(message) end
|
|
|
22
22
|
---@return boolean 用户选择结果,确定返回true,取消返回false
|
|
23
23
|
---@example local result = ui.confirm("确认", "是否继续操作?")
|
|
24
24
|
--- if result then
|
|
25
|
-
---
|
|
25
|
+
--- print("用户点击了确定")
|
|
26
26
|
--- else
|
|
27
|
-
---
|
|
27
|
+
--- print("用户点击了取消")
|
|
28
28
|
--- end
|
|
29
29
|
function _UI.confirm(title, message) return false end
|
|
30
30
|
|
|
@@ -34,9 +34,9 @@ function _UI.confirm(title, message) return false end
|
|
|
34
34
|
---@return string 用户输入的内容,取消返回空字符串
|
|
35
35
|
---@example local input = ui.confirmInput("输入", "请输入您的姓名:")
|
|
36
36
|
--- if input then
|
|
37
|
-
---
|
|
37
|
+
--- print("用户输入了:" .. input)
|
|
38
38
|
--- else
|
|
39
|
-
---
|
|
39
|
+
--- print("用户取消了输入")
|
|
40
40
|
--- end
|
|
41
41
|
function _UI.confirmInput(title, message) return '' end
|
|
42
42
|
|
|
@@ -49,7 +49,7 @@ function _UI.alert(title, message) end
|
|
|
49
49
|
--- 事件监听
|
|
50
50
|
---@param callback UIEventCallback 事件回调函数,传入 null 会取消监听
|
|
51
51
|
---@example ui.onEvent(function(event, data)
|
|
52
|
-
---
|
|
52
|
+
--- print("event: " .. event, data)
|
|
53
53
|
--- end)
|
|
54
54
|
function _UI.onEvent(callback) end
|
|
55
55
|
|
package/types/lua/yolo.lua
CHANGED
|
@@ -38,7 +38,7 @@ function _Yolo.load(paramPath, binPath, nc, version, useGpu) return nil end
|
|
|
38
38
|
---@return YoloResult[] 检测结果数组,坐标为原图/全屏绝对坐标
|
|
39
39
|
---@example local results = yolo.detectAbs(modelId, "screen", 100, 100, 500, 400, 640, 0.4, 0.5)
|
|
40
40
|
--- if #results > 0 then
|
|
41
|
-
--- action.click(results[
|
|
41
|
+
--- action.click(results[1].centerX, results[1].centerY)
|
|
42
42
|
--- end
|
|
43
43
|
function _Yolo.detectAbs(id, input, x, y, ex, ey, target, thr, nms) return {} end
|
|
44
44
|
|
package/types/lua/yolocls.lua
CHANGED
|
@@ -26,7 +26,7 @@ function _YoloCls.load(paramPath, binPath, nc, useGpu) return nil end
|
|
|
26
26
|
---@return YoloClsProbs Ultralytics Probs 风格分类概率结果
|
|
27
27
|
---@example local result = yolocls.classify(modelId, "screen", 224)
|
|
28
28
|
--- if result.top1 ~= nil then
|
|
29
|
-
---
|
|
29
|
+
--- print(result.top1 .. ": " .. result.top1conf)
|
|
30
30
|
--- end
|
|
31
31
|
function _YoloCls.classify(modelId, img, targetSize)
|
|
32
32
|
---@type YoloClsProbs
|
package/types/mysql.d.ts
CHANGED
|
@@ -83,7 +83,6 @@ declare namespace mysql {
|
|
|
83
83
|
* @param params 查询参数数组,可选
|
|
84
84
|
* @returns 查询结果对象
|
|
85
85
|
* @example
|
|
86
|
-
* // 简单查询
|
|
87
86
|
* const result = mysql.query("SELECT * FROM users")
|
|
88
87
|
*
|
|
89
88
|
* // 带参数查询
|
|
@@ -107,7 +106,6 @@ declare namespace mysql {
|
|
|
107
106
|
* @param params 参数数组,可选
|
|
108
107
|
* @returns 执行结果对象
|
|
109
108
|
* @example
|
|
110
|
-
* // 插入数据
|
|
111
109
|
* const result = mysql.execute(
|
|
112
110
|
* "INSERT INTO users (name, email) VALUES (?, ?)",
|
|
113
111
|
* ["张三", "zhangsan@example.com"]
|
package/types/tomatoocr.d.ts
CHANGED
|
@@ -9,13 +9,10 @@ declare namespace tomatoOcr {
|
|
|
9
9
|
* @param remark 备注信息(可选)
|
|
10
10
|
* @returns 设置结果
|
|
11
11
|
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* // 不带备注
|
|
14
12
|
* const result1 = tomatoOcr.initializeWithConfig("online", "授权码");
|
|
15
13
|
* // 带备注
|
|
16
14
|
* const result2 = tomatoOcr.initializeWithConfig("online", "授权码", "测试环境");
|
|
17
15
|
* logi(result1, result2);
|
|
18
|
-
* ```
|
|
19
16
|
*/
|
|
20
17
|
function initializeWithConfig(
|
|
21
18
|
mode: string,
|
|
@@ -33,9 +30,7 @@ declare namespace tomatoOcr {
|
|
|
33
30
|
* 设置 HTTP 请求间隔时间
|
|
34
31
|
* @param second 间隔秒数 设置网络请求间隔时间,非必设置。0-86400
|
|
35
32
|
* @example
|
|
36
|
-
* ```typescript
|
|
37
33
|
* tomatoOcr.setHttpIntervalTime(3600);
|
|
38
|
-
* ```
|
|
39
34
|
*/
|
|
40
35
|
function setHttpIntervalTime(second: number): void;
|
|
41
36
|
|
|
@@ -43,8 +38,6 @@ declare namespace tomatoOcr {
|
|
|
43
38
|
* 设置识别类型
|
|
44
39
|
* @param recType 识别类型 模型类型,默认 ch-3.0,除此之外还有 ch-2.0, ch, cht, japan, korean, number
|
|
45
40
|
* @example
|
|
46
|
-
* ```typescript
|
|
47
|
-
* // 普通中英文识别,3.0版模型
|
|
48
41
|
* tomatoOcr.setRecType("ch-3.0");
|
|
49
42
|
* // 普通中英文识别,2.0版模型
|
|
50
43
|
* tomatoOcr.setRecType("ch-2.0");
|
|
@@ -58,7 +51,6 @@ declare namespace tomatoOcr {
|
|
|
58
51
|
* tomatoOcr.setRecType("korean");
|
|
59
52
|
* // 数字模型
|
|
60
53
|
* tomatoOcr.setRecType("number");
|
|
61
|
-
* ```
|
|
62
54
|
*/
|
|
63
55
|
function setRecType(recType: string): void;
|
|
64
56
|
|
|
@@ -66,12 +58,9 @@ declare namespace tomatoOcr {
|
|
|
66
58
|
* 设置检测框类型
|
|
67
59
|
* @param detBoxType 检测框类型 默认"rect": 由于手机上截图文本均为矩形文本;"quad":可准确检测倾斜文本
|
|
68
60
|
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* // 矩形文本
|
|
71
61
|
* tomatoOcr.setDetBoxType("rect");
|
|
72
62
|
* // 倾斜文本
|
|
73
63
|
* tomatoOcr.setDetBoxType("quad");
|
|
74
|
-
* ```
|
|
75
64
|
*/
|
|
76
65
|
function setDetBoxType(detBoxType: string): void;
|
|
77
66
|
|
|
@@ -79,9 +68,7 @@ declare namespace tomatoOcr {
|
|
|
79
68
|
* 设置检测框展开比例
|
|
80
69
|
* @param detUnclipRatio 设置检测模型框选文本范围大小的参数,非必设置,默认为1.9。值范围1.6-2.5之间,值越大框选范围越大,值越小框选范围越小;当框选到了,但识别得分较低,就可以调整该参数改善准确率。
|
|
81
70
|
* @example
|
|
82
|
-
* ```typescript
|
|
83
71
|
* tomatoOcr.setDetUnclipRatio(1.9);
|
|
84
|
-
* ```
|
|
85
72
|
*/
|
|
86
73
|
function setDetUnclipRatio(detUnclipRatio: number): void;
|
|
87
74
|
|
|
@@ -89,9 +76,7 @@ declare namespace tomatoOcr {
|
|
|
89
76
|
* 设置检测框缩放比例
|
|
90
77
|
* @param detScaleRatio 检测框缩放比例
|
|
91
78
|
* @example
|
|
92
|
-
* ```typescript
|
|
93
79
|
* tomatoOcr.setDetScaleRatio(1.2);
|
|
94
|
-
* ```
|
|
95
80
|
*/
|
|
96
81
|
function setDetScaleRatio(detScaleRatio: number): void;
|
|
97
82
|
|
|
@@ -99,9 +84,7 @@ declare namespace tomatoOcr {
|
|
|
99
84
|
* 设置识别分数阈值
|
|
100
85
|
* @param recScoreThreshold 设置识别模型过滤得分的参数,非必设置,默认0.1。由于返回的识别结果数据太多太乱,可以通过设置该参数,过滤一些得分较低不准的数据,使得结果看起来更加简练。
|
|
101
86
|
* @example
|
|
102
|
-
* ```typescript
|
|
103
87
|
* tomatoOcr.setRecScoreThreshold(0.1);
|
|
104
|
-
* ```
|
|
105
88
|
*/
|
|
106
89
|
function setRecScoreThreshold(recScoreThreshold: number): void;
|
|
107
90
|
|
|
@@ -109,9 +92,7 @@ declare namespace tomatoOcr {
|
|
|
109
92
|
* 设置返回类型
|
|
110
93
|
* @param returnType 设置调用插件识别返回格式的参数,非必设置,默认为json。默认"json": 包含得分、坐标和文字;"text":纯文字;"num":纯数字;自定义输入想要返回的文本:".¥1234567890",仅只返回这些内容
|
|
111
94
|
* @example
|
|
112
|
-
* ```typescript
|
|
113
95
|
* tomatoOcr.setReturnType("json");
|
|
114
|
-
* ```
|
|
115
96
|
*/
|
|
116
97
|
function setReturnType(returnType: string): void;
|
|
117
98
|
|
|
@@ -119,9 +100,7 @@ declare namespace tomatoOcr {
|
|
|
119
100
|
* 设置二值化阈值
|
|
120
101
|
* @param binaryThresh 设置图像二值化的参数,非必设置,默认0,不进行二值化。 二值化设定0-255,常规情况下不需要设置,可配合中调试应用使用。
|
|
121
102
|
* @example
|
|
122
|
-
* ```typescript
|
|
123
103
|
* tomatoOcr.setBinaryThresh(0);
|
|
124
|
-
* ```
|
|
125
104
|
*/
|
|
126
105
|
function setBinaryThresh(binaryThresh: number): void;
|
|
127
106
|
|
|
@@ -129,9 +108,7 @@ declare namespace tomatoOcr {
|
|
|
129
108
|
* 设置运行模式
|
|
130
109
|
* @param runMode 运行模式
|
|
131
110
|
* @example
|
|
132
|
-
* ```typescript
|
|
133
111
|
* tomatoOcr.setRunMode("fast");
|
|
134
|
-
* ```
|
|
135
112
|
*/
|
|
136
113
|
function setRunMode(runMode: string): void;
|
|
137
114
|
|
|
@@ -140,10 +117,8 @@ declare namespace tomatoOcr {
|
|
|
140
117
|
* @param filterColor 颜色过滤,通过逗号相互连,第一个是颜色值,第二个是负偏色,第三个是正偏色;不同颜色之间以"|"连接
|
|
141
118
|
* @param backgroundColor 滤色后的背景色,传""或black的时候,背景是黑色,传“white”的时候,背景是白色
|
|
142
119
|
* @example
|
|
143
|
-
* ```typescript
|
|
144
120
|
* tomatoOcr.setFilterColor("#41917A,38,38", "black");
|
|
145
121
|
* tomatoOcr.setFilterColor("#41917A,38,38|#E091A8,50,50", "white");
|
|
146
|
-
* ```
|
|
147
122
|
*/
|
|
148
123
|
function setFilterColor(filterColor: string, backgroundColor: string): void;
|
|
149
124
|
|
|
@@ -157,19 +132,12 @@ declare namespace tomatoOcr {
|
|
|
157
132
|
* @param ey 边界框右下角y坐标
|
|
158
133
|
* @returns OCR识别结果JSON字符串
|
|
159
134
|
* @example
|
|
160
|
-
*
|
|
161
|
-
* // 识别屏幕
|
|
162
|
-
* const result1 = tomatoOcr.ocrImage("screen", 0, 0, 0, 0, 0);
|
|
135
|
+
* const result1 = tomatoOcr.ocrImage("screen", 3);
|
|
163
136
|
* logi(`识别屏幕结果:${result1}`);
|
|
164
|
-
*
|
|
165
|
-
* // 识别文件
|
|
166
|
-
* const result2 = tomatoOcr.ocrImage("/path/to/image.png", 0);
|
|
137
|
+
* const result2 = tomatoOcr.ocrImage("/path/to/image.png", 3);
|
|
167
138
|
* logi(`识别文件结果:${result2}`);
|
|
168
|
-
*
|
|
169
|
-
* // 识别指定屏幕区域
|
|
170
|
-
* const result3 = tomatoOcr.ocrImage("screen", 0);
|
|
139
|
+
* const result3 = tomatoOcr.ocrImage("screen", 3, 100, 100, 500, 300);
|
|
171
140
|
* logi(`识别指定屏幕区域结果:${result3}`);
|
|
172
|
-
* ```
|
|
173
141
|
*/
|
|
174
142
|
function ocrImage(
|
|
175
143
|
input: string,
|
|
@@ -185,11 +153,9 @@ declare namespace tomatoOcr {
|
|
|
185
153
|
* @param data 要找的文字
|
|
186
154
|
* @returns 找“要找的文字”的中心点 没有找到返回空字符串
|
|
187
155
|
* @example
|
|
188
|
-
* ```typescript
|
|
189
156
|
* const result = tomatoOcr.findTapPoint('{"text": "确定"}');
|
|
190
157
|
* const tapPoint = JSON.parse(result);
|
|
191
158
|
* logi(tapPoint);
|
|
192
|
-
* ```
|
|
193
159
|
*/
|
|
194
160
|
function findTapPoint(data: string): string;
|
|
195
161
|
|
|
@@ -198,20 +164,16 @@ declare namespace tomatoOcr {
|
|
|
198
164
|
* @param data 要找的文字
|
|
199
165
|
* @returns 找“要找的文字”的所有相匹配的中心点 没有找到返回空字符串
|
|
200
166
|
* @example
|
|
201
|
-
* ```typescript
|
|
202
167
|
* const result = tomatoOcr.findTapPoints('{"texts": ["确定", "取消"]}');
|
|
203
168
|
* const tapPoints = JSON.parse(result);
|
|
204
169
|
* logi(tapPoints);
|
|
205
|
-
* ```
|
|
206
170
|
*/
|
|
207
171
|
function findTapPoints(data: string): string;
|
|
208
172
|
|
|
209
173
|
/**
|
|
210
174
|
* 释放 TomatoOCR SDK 已加载的 OCR 模型和内部资源
|
|
211
175
|
* @example
|
|
212
|
-
* ```typescript
|
|
213
176
|
* tomatoOcr.release();
|
|
214
|
-
* ```
|
|
215
177
|
*/
|
|
216
178
|
function release(): void;
|
|
217
179
|
}
|
package/types/yolo.d.ts
CHANGED
package/types/yoloCls.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ declare namespace $MySQL数据库 {
|
|
|
73
73
|
* 检查连接状态
|
|
74
74
|
* @returns 是否已连接
|
|
75
75
|
* @example
|
|
76
|
-
* if ($MySQL
|
|
76
|
+
* if ($MySQL数据库.是否已连接()) {
|
|
77
77
|
* $打印信息日志("数据库已连接")
|
|
78
78
|
* }
|
|
79
79
|
*/
|
|
@@ -85,7 +85,6 @@ declare namespace $MySQL数据库 {
|
|
|
85
85
|
* @param 参数 查询参数数组,可选
|
|
86
86
|
* @returns 查询结果对象
|
|
87
87
|
* @example
|
|
88
|
-
* // 简单查询
|
|
89
88
|
* const 查询结果 = $MySQL数据库.查询("SELECT * FROM users")
|
|
90
89
|
*
|
|
91
90
|
* // 带参数查询
|
|
@@ -109,7 +108,6 @@ declare namespace $MySQL数据库 {
|
|
|
109
108
|
* @param 参数 参数数组,可选
|
|
110
109
|
* @returns 执行结果对象
|
|
111
110
|
* @example
|
|
112
|
-
* // 插入数据
|
|
113
111
|
* const 执行结果 = $MySQL数据库.执行(
|
|
114
112
|
* "INSERT INTO users (name, email) VALUES (?, ?)",
|
|
115
113
|
* ["张三", "zhangsan@example.com"]
|