ms-types 0.10.1 → 0.10.3
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 +2 -2
- package/types/appleocr.d.ts +0 -71
- package/types/device.d.ts +0 -15
- package/types/global.d.ts +0 -18
- package/types/image.d.ts +0 -31
- package/types/lua/appleocr.lua +0 -58
- package/types/lua/device.lua +0 -6
- package/types/lua/global.lua +0 -9
- package/types/lua/image.lua +0 -14
- package/types/lua/paddleocr.lua +0 -39
- package/types/lua/yolo.lua +0 -19
- package/types/paddleocr.d.ts +0 -63
- package/types/yolo.d.ts +0 -37
- package/types/zh/PaddleOCR/346/250/241/345/235/227.d.ts +0 -63
- package/types/zh/YOLO/346/250/241/345/235/227.d.ts +0 -38
- package/types/zh//345/205/250/345/261/200/346/250/241/345/235/227.d.ts +0 -18
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +0 -31
- package/types/zh//350/213/271/346/236/234OCR.d.ts +0 -71
- package/types/zh//350/256/276/345/244/207/346/250/241/345/235/227.d.ts +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ms-types",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"vitepress": "^1.6.4",
|
|
20
20
|
"vitepress-theme-teek": "^1.6.2",
|
|
21
|
-
"wrangler": "^4.
|
|
21
|
+
"wrangler": "^4.130.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/types/appleocr.d.ts
CHANGED
|
@@ -28,29 +28,6 @@ declare namespace appleOcr {
|
|
|
28
28
|
centerY: number;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* 执行OCR识别(使用Apple Vision框架)
|
|
33
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
34
|
-
* @param x 边界框左上角x坐标 默认 0
|
|
35
|
-
* @param y 边界框左上角y坐标 默认 0
|
|
36
|
-
* @param ex 边界框右下角x坐标 默认 0
|
|
37
|
-
* @param ey 边界框右下角y坐标 默认 0
|
|
38
|
-
* @param languages 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
39
|
-
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
40
|
-
* @deprecated 请改用 recognizeAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
41
|
-
* @example
|
|
42
|
-
* const results = appleOcr.recognizeAbs("screen", 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
43
|
-
* logi(`识别数量: ${results.length}`)
|
|
44
|
-
*/
|
|
45
|
-
function recognize(
|
|
46
|
-
input: string,
|
|
47
|
-
x?: number,
|
|
48
|
-
y?: number,
|
|
49
|
-
ex?: number,
|
|
50
|
-
ey?: number,
|
|
51
|
-
languages?: string[]
|
|
52
|
-
): OCRResult[];
|
|
53
|
-
|
|
54
31
|
/**
|
|
55
32
|
* 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
|
|
56
33
|
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -75,27 +52,6 @@ declare namespace appleOcr {
|
|
|
75
52
|
languages?: string[]
|
|
76
53
|
): OCRResult[];
|
|
77
54
|
|
|
78
|
-
/**
|
|
79
|
-
* 执行OCR识别(仅识别数字)0-9.,+-
|
|
80
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
81
|
-
* @param x 边界框左上角x坐标
|
|
82
|
-
* @param y 边界框左上角y坐标
|
|
83
|
-
* @param ex 边界框右下角x坐标
|
|
84
|
-
* @param ey 边界框右下角y坐标
|
|
85
|
-
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
86
|
-
* @deprecated 请改用 recognizeNumbersAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
87
|
-
* @example
|
|
88
|
-
* const results = appleOcr.recognizeNumbersAbs("screen", 0, 0, 100, 100)
|
|
89
|
-
* logi(`数字识别数量: ${results.length}`)
|
|
90
|
-
*/
|
|
91
|
-
function recognizeNumbers(
|
|
92
|
-
input: string,
|
|
93
|
-
x?: number,
|
|
94
|
-
y?: number,
|
|
95
|
-
ex?: number,
|
|
96
|
-
ey?: number
|
|
97
|
-
): OCRResult[];
|
|
98
|
-
|
|
99
55
|
/**
|
|
100
56
|
* 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
|
|
101
57
|
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -118,33 +74,6 @@ declare namespace appleOcr {
|
|
|
118
74
|
ey?: number
|
|
119
75
|
): OCRResult[];
|
|
120
76
|
|
|
121
|
-
/**
|
|
122
|
-
* 执行OCR识别,在整段识别文本中查找指定子串
|
|
123
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
124
|
-
* @param texts 要查找的目标文本数组,可匹配识别结果中的子串
|
|
125
|
-
* @param x 边界框左上角x坐标
|
|
126
|
-
* @param y 边界框左上角y坐标
|
|
127
|
-
* @param ex 边界框右下角x坐标
|
|
128
|
-
* @param ey 边界框右下角y坐标
|
|
129
|
-
* @param languages 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
130
|
-
* @param exactMatch 是否完整匹配,默认 false 表示包含匹配;传 true 时要求整条 OCR 识别结果文本等于目标文本
|
|
131
|
-
* @returns 命中子串的识别结果数组,坐标对应目标子串区域
|
|
132
|
-
* @deprecated 请改用 findTextAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
133
|
-
* @example
|
|
134
|
-
* const results = appleOcr.findTextAbs("screen", ["开始"], 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
135
|
-
* logi(`命中数量: ${results.length}`)
|
|
136
|
-
*/
|
|
137
|
-
function findText(
|
|
138
|
-
input: string,
|
|
139
|
-
texts: string[],
|
|
140
|
-
x?: number,
|
|
141
|
-
y?: number,
|
|
142
|
-
ex?: number,
|
|
143
|
-
ey?: number,
|
|
144
|
-
languages?: string[],
|
|
145
|
-
exactMatch?: boolean
|
|
146
|
-
): OCRResult[];
|
|
147
|
-
|
|
148
77
|
/**
|
|
149
78
|
* 查找指定子串,并将子串结果坐标映射为原图/全屏绝对坐标。
|
|
150
79
|
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
package/types/device.d.ts
CHANGED
|
@@ -72,21 +72,6 @@ declare namespace device {
|
|
|
72
72
|
* @example device.getDeviceModel()
|
|
73
73
|
*/
|
|
74
74
|
function getDeviceModel(): string;
|
|
75
|
-
/**
|
|
76
|
-
* 获取屏幕宽高
|
|
77
|
-
* @returns 获取屏幕宽高缩放后的,实际宽高,请使用`getScreenRealSize()`获取未缩放的宽高
|
|
78
|
-
* @example device.getScreenSize()
|
|
79
|
-
*/
|
|
80
|
-
function getScreenSize(): {
|
|
81
|
-
/**
|
|
82
|
-
* 屏幕宽度
|
|
83
|
-
*/
|
|
84
|
-
width: number;
|
|
85
|
-
/**
|
|
86
|
-
* 屏幕高度
|
|
87
|
-
*/
|
|
88
|
-
height: number;
|
|
89
|
-
};
|
|
90
75
|
/**
|
|
91
76
|
* 获取屏幕实际大小
|
|
92
77
|
* @returns 屏幕实际大小
|
package/types/global.d.ts
CHANGED
|
@@ -159,24 +159,6 @@ declare function time(): number;
|
|
|
159
159
|
*/
|
|
160
160
|
declare function takeMeToFront(): boolean;
|
|
161
161
|
|
|
162
|
-
/**
|
|
163
|
-
* 设置 Agent 快速模式(兼容旧接口)
|
|
164
|
-
* @param enabled 是否开启快速模式
|
|
165
|
-
* @returns 实际是否开启快速模式
|
|
166
|
-
* @description 开启对应模式 1,关闭对应模式 0。推荐改用 setAgentTouchMode。设置会持久化
|
|
167
|
-
* @example
|
|
168
|
-
* const enabled = setAgentFastMode(true);
|
|
169
|
-
*/
|
|
170
|
-
declare function setAgentFastMode(enabled: boolean): boolean;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* 获取 Agent 快速模式当前状态(兼容旧接口)
|
|
174
|
-
* @returns 当前是否开启快速模式
|
|
175
|
-
* @example
|
|
176
|
-
* const enabled = getAgentFastMode();
|
|
177
|
-
*/
|
|
178
|
-
declare function getAgentFastMode(): boolean;
|
|
179
|
-
|
|
180
162
|
/**
|
|
181
163
|
* 设置 Agent 触控模式
|
|
182
164
|
* @param mode 0 标准 / 1 快速 / 2 真实点击
|
package/types/image.d.ts
CHANGED
|
@@ -21,37 +21,6 @@ declare namespace image {
|
|
|
21
21
|
ex?: number,
|
|
22
22
|
ey?: number,
|
|
23
23
|
): string | null;
|
|
24
|
-
/**
|
|
25
|
-
* 截图
|
|
26
|
-
* @returns 截图的imageId ,如果截图失败则返回null
|
|
27
|
-
* @deprecated 请改用 captureScreen()。
|
|
28
|
-
* @example
|
|
29
|
-
* const imageId = image.captureScreen()
|
|
30
|
-
* if (imageId) {
|
|
31
|
-
* image.saveTo(imageId, "screen.jpg")
|
|
32
|
-
* }
|
|
33
|
-
*/
|
|
34
|
-
function captureFullScreen(): string | null;
|
|
35
|
-
/**
|
|
36
|
-
* 截图指定区域
|
|
37
|
-
* @param x 截图区域左上角x坐标
|
|
38
|
-
* @param y 截图区域左上角y坐标
|
|
39
|
-
* @param ex 截图区域右下角x坐标
|
|
40
|
-
* @param ey 截图区域右下角y坐标
|
|
41
|
-
* @returns 截图的imageId ,如果截图失败则返回null
|
|
42
|
-
* @deprecated 请改用 captureScreen(x, y, ex, ey)。
|
|
43
|
-
* @example
|
|
44
|
-
* const imageId = image.captureScreen(0, 0, 100, 100)
|
|
45
|
-
* if (imageId) {
|
|
46
|
-
* image.saveTo(imageId, "screen.jpg")
|
|
47
|
-
* }
|
|
48
|
-
*/
|
|
49
|
-
function captureRect(
|
|
50
|
-
x: number,
|
|
51
|
-
y: number,
|
|
52
|
-
ex: number,
|
|
53
|
-
ey: number,
|
|
54
|
-
): string | null;
|
|
55
24
|
/**
|
|
56
25
|
* 保存图片
|
|
57
26
|
* @param imageId 图片id 路径 http地址或者 screen 实时截屏
|
package/types/lua/appleocr.lua
CHANGED
|
@@ -14,25 +14,6 @@ local _AppleOCR = {}
|
|
|
14
14
|
---@field centerX integer 文本区域中心点 x 坐标
|
|
15
15
|
---@field centerY integer 文本区域中心点 y 坐标
|
|
16
16
|
|
|
17
|
-
--- 识别文本(兼容旧接口,请改用 recognizeAbs)
|
|
18
|
-
--- @deprecated 请改用 recognizeAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
19
|
-
--- @param input string 图像ID或路径
|
|
20
|
-
--- @param x integer|nil 区域X,默认0
|
|
21
|
-
--- @param y integer|nil 区域Y,默认0
|
|
22
|
-
--- @param ex integer|nil 区域右下角 X,默认0
|
|
23
|
-
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
24
|
-
--- @param langs string[]|nil 语言数组
|
|
25
|
-
--- @return AppleOCRResult[] 结果数组
|
|
26
|
-
function _AppleOCR.recognize(input, x, y, ex, ey, langs)
|
|
27
|
-
x = x or 0;
|
|
28
|
-
y = y or 0;
|
|
29
|
-
ex = ex or 0;
|
|
30
|
-
ey = ey or 0
|
|
31
|
-
---@type AppleOCRResult[]
|
|
32
|
-
local ret = {}
|
|
33
|
-
return ret
|
|
34
|
-
end
|
|
35
|
-
|
|
36
17
|
--- 识别文本,坐标映射为原图/全屏绝对坐标
|
|
37
18
|
--- @param input string 图像ID或路径
|
|
38
19
|
--- @param x integer|nil 区域X,默认0
|
|
@@ -47,24 +28,6 @@ function _AppleOCR.recognizeAbs(input, x, y, ex, ey, langs)
|
|
|
47
28
|
return ret
|
|
48
29
|
end
|
|
49
30
|
|
|
50
|
-
--- 识别数字(兼容旧接口,请改用 recognizeNumbersAbs)
|
|
51
|
-
--- @deprecated 请改用 recognizeNumbersAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
52
|
-
--- @param input string 图像ID或路径
|
|
53
|
-
--- @param x integer|nil 区域X,默认0
|
|
54
|
-
--- @param y integer|nil 区域Y,默认0
|
|
55
|
-
--- @param ex integer|nil 区域右下角 X,默认0
|
|
56
|
-
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
57
|
-
--- @return AppleOCRResult[] 结果数组
|
|
58
|
-
function _AppleOCR.recognizeNumbers(input, x, y, ex, ey)
|
|
59
|
-
x = x or 0;
|
|
60
|
-
y = y or 0;
|
|
61
|
-
ex = ex or 0;
|
|
62
|
-
ey = ey or 0
|
|
63
|
-
---@type AppleOCRResult[]
|
|
64
|
-
local ret = {}
|
|
65
|
-
return ret
|
|
66
|
-
end
|
|
67
|
-
|
|
68
31
|
--- 识别数字,坐标映射为原图/全屏绝对坐标
|
|
69
32
|
--- @param input string 图像ID或路径
|
|
70
33
|
--- @param x integer|nil 区域X,默认0
|
|
@@ -78,27 +41,6 @@ function _AppleOCR.recognizeNumbersAbs(input, x, y, ex, ey)
|
|
|
78
41
|
return ret
|
|
79
42
|
end
|
|
80
43
|
|
|
81
|
-
--- 查找文本(兼容旧接口,请改用 findTextAbs)
|
|
82
|
-
--- @deprecated 请改用 findTextAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
83
|
-
--- @param input string 图像ID或路径
|
|
84
|
-
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
|
85
|
-
--- @param x integer|nil 区域X,默认0
|
|
86
|
-
--- @param y integer|nil 区域Y,默认0
|
|
87
|
-
--- @param ex integer|nil 区域右下角 X,默认0
|
|
88
|
-
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
89
|
-
--- @param langs string[]|nil 语言数组
|
|
90
|
-
--- @param exactMatch boolean|nil 是否完整匹配,默认 false
|
|
91
|
-
--- @return AppleOCRResult[] 结果数组
|
|
92
|
-
function _AppleOCR.findText(input, targets, x, y, ex, ey, langs, exactMatch)
|
|
93
|
-
x = x or 0;
|
|
94
|
-
y = y or 0;
|
|
95
|
-
ex = ex or 0;
|
|
96
|
-
ey = ey or 0
|
|
97
|
-
---@type AppleOCRResult[]
|
|
98
|
-
local ret = {}
|
|
99
|
-
return ret
|
|
100
|
-
end
|
|
101
|
-
|
|
102
44
|
--- 查找文本,坐标映射为原图/全屏绝对坐标
|
|
103
45
|
--- @param input string 图像ID或路径
|
|
104
46
|
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
package/types/lua/device.lua
CHANGED
|
@@ -51,12 +51,6 @@ function _Device.getDeviceName() return '' end
|
|
|
51
51
|
---@return string
|
|
52
52
|
function _Device.getDeviceModel() return '' end
|
|
53
53
|
|
|
54
|
-
--- 屏幕逻辑尺寸
|
|
55
|
-
---@return ScreenSize
|
|
56
|
-
function _Device.getScreenSize()
|
|
57
|
-
return { width = 0, height = 0 }
|
|
58
|
-
end
|
|
59
|
-
|
|
60
54
|
--- 屏幕实际尺寸
|
|
61
55
|
---@return ScreenSize
|
|
62
56
|
function _Device.getScreenRealSize()
|
package/types/lua/global.lua
CHANGED
|
@@ -80,15 +80,6 @@ function StopThread(threadName) end
|
|
|
80
80
|
---@return boolean
|
|
81
81
|
function ShouldInterruptThread() return false end
|
|
82
82
|
|
|
83
|
-
--- 设置 Agent 快速模式(兼容接口)
|
|
84
|
-
---@param enabled boolean
|
|
85
|
-
---@return boolean
|
|
86
|
-
function SetAgentFastMode(enabled) return false end
|
|
87
|
-
|
|
88
|
-
--- 获取 Agent 快速模式
|
|
89
|
-
---@return boolean
|
|
90
|
-
function GetAgentFastMode() return false end
|
|
91
|
-
|
|
92
83
|
--- 设置 Agent 触控模式:0 标准 / 1 快速 / 2 真实点击
|
|
93
84
|
---@param mode integer
|
|
94
85
|
---@return integer
|
package/types/lua/image.lua
CHANGED
|
@@ -37,20 +37,6 @@ local _Image = {}
|
|
|
37
37
|
--- @return string|nil 图片ID
|
|
38
38
|
function _Image.captureScreen(x, y, ex, ey) return '' end
|
|
39
39
|
|
|
40
|
-
--- 全屏截屏(兼容旧接口,请改用 captureScreen)
|
|
41
|
-
--- @deprecated 请改用 captureScreen()。
|
|
42
|
-
--- @return string|nil 图片ID
|
|
43
|
-
function _Image.captureFullScreen() return '' end
|
|
44
|
-
|
|
45
|
-
--- 区域截屏(兼容旧接口,请改用 captureScreen)
|
|
46
|
-
--- @deprecated 请改用 captureScreen(x, y, ex, ey)。
|
|
47
|
-
--- @param x integer|nil
|
|
48
|
-
--- @param y integer|nil
|
|
49
|
-
--- @param ex integer|nil 右下角x
|
|
50
|
-
--- @param ey integer|nil 右下角y
|
|
51
|
-
--- @return string|nil 图片ID
|
|
52
|
-
function _Image.captureRect(x, y, ex, ey) return '' end
|
|
53
|
-
|
|
54
40
|
--- 读取图片
|
|
55
41
|
--- @param path string 文件路径
|
|
56
42
|
--- @return string 图片ID
|
package/types/lua/paddleocr.lua
CHANGED
|
@@ -16,13 +16,6 @@ local _PaddleOCR = {}
|
|
|
16
16
|
---@field angle number 文本旋转角度 (度)
|
|
17
17
|
---@field orientation integer 文本方向 (0=水平,1=垂直 等)
|
|
18
18
|
|
|
19
|
-
--- 加载 V5 模型(兼容旧接口,请改用 loadModel)
|
|
20
|
-
--- @deprecated 请改用 loadModel("ppocr-v5", useGpu);检测长边请使用 setMaxSideLen 单独设置。
|
|
21
|
-
--- @param maxSideLen integer|nil 目标边长,默认 640
|
|
22
|
-
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
23
|
-
--- @return boolean 成功
|
|
24
|
-
function _PaddleOCR.loadV5(maxSideLen, useGpu) return true end
|
|
25
|
-
|
|
26
19
|
--- 按内置模型 ID 加载
|
|
27
20
|
--- @param modelId string `"ppocr-v6-tiny"` / `"ppocr-v6-small"` / `"ppocr-v5"`
|
|
28
21
|
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
@@ -34,21 +27,6 @@ function _PaddleOCR.loadModel(modelId, useGpu) return true end
|
|
|
34
27
|
--- @return boolean 成功
|
|
35
28
|
function _PaddleOCR.setMaxSideLen(maxSideLen) return true end
|
|
36
29
|
|
|
37
|
-
--- 识别文本(兼容旧接口,请改用 recognizeAbs)
|
|
38
|
-
--- @deprecated 请改用 recognizeAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
39
|
-
--- @param input string 图像ID或路径
|
|
40
|
-
--- @param x integer|nil 默认0
|
|
41
|
-
--- @param y integer|nil 默认0
|
|
42
|
-
--- @param ex integer|nil 默认0
|
|
43
|
-
--- @param ey integer|nil 默认0
|
|
44
|
-
--- @param confidenceThreshold number|nil 置信阈值 默认0.6
|
|
45
|
-
--- @return PaddleOCRResult[] 结果数组
|
|
46
|
-
function _PaddleOCR.recognize(input, x, y, ex, ey, confidenceThreshold)
|
|
47
|
-
---@type PaddleOCRResult[]
|
|
48
|
-
local ret = {}
|
|
49
|
-
return ret
|
|
50
|
-
end
|
|
51
|
-
|
|
52
30
|
--- 识别文本,坐标映射为原图/全屏绝对坐标
|
|
53
31
|
--- @param input string 图像ID或路径
|
|
54
32
|
--- @param x integer|nil 默认0
|
|
@@ -63,23 +41,6 @@ function _PaddleOCR.recognizeAbs(input, x, y, ex, ey, confidenceThreshold)
|
|
|
63
41
|
return ret
|
|
64
42
|
end
|
|
65
43
|
|
|
66
|
-
--- 查找目标文本(兼容旧接口,请改用 findTextAbs)
|
|
67
|
-
--- @deprecated 请改用 findTextAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
68
|
-
--- @param input string 图像ID或路径
|
|
69
|
-
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
|
70
|
-
--- @param x integer|nil 默认0
|
|
71
|
-
--- @param y integer|nil 默认0
|
|
72
|
-
--- @param ex integer|nil 默认0
|
|
73
|
-
--- @param ey integer|nil 默认0
|
|
74
|
-
--- @param confidenceThreshold number|nil 置信阈值 默认0.6
|
|
75
|
-
--- @param exactMatch boolean|nil 是否完整匹配,默认 false
|
|
76
|
-
--- @return PaddleOCRResult[] 结果数组
|
|
77
|
-
function _PaddleOCR.findText(input, targets, x, y, ex, ey, confidenceThreshold, exactMatch)
|
|
78
|
-
---@type PaddleOCRResult[]
|
|
79
|
-
local ret = {}
|
|
80
|
-
return ret
|
|
81
|
-
end
|
|
82
|
-
|
|
83
44
|
--- 查找目标文本,坐标映射为原图/全屏绝对坐标
|
|
84
45
|
--- @param input string 图像ID或路径
|
|
85
46
|
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
package/types/lua/yolo.lua
CHANGED
|
@@ -23,25 +23,6 @@ local _Yolo = {}
|
|
|
23
23
|
--- @return string|nil 模型ID(失败返回 nil)
|
|
24
24
|
function _Yolo.load(paramPath, binPath, nc, version, useGpu) return nil end
|
|
25
25
|
|
|
26
|
-
--- 加载 YOLOv11 模型(兼容旧接口,请改用 load)
|
|
27
|
-
--- @deprecated 请改用 load(paramPath, binPath, nc, 11, useGpu)。
|
|
28
|
-
--- @param paramPath string ncnn param 路径
|
|
29
|
-
--- @param binPath string ncnn bin 路径
|
|
30
|
-
--- @param nc integer|nil 标签数量;传 0 或省略时按模型输出推断
|
|
31
|
-
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
32
|
-
--- @return string|nil 模型ID(失败返回 nil)
|
|
33
|
-
function _Yolo.loadV11(paramPath, binPath, nc, useGpu) return nil end
|
|
34
|
-
|
|
35
|
-
--- 检测(兼容旧接口,请改用 detectAbs)
|
|
36
|
-
--- @deprecated 请改用 detectAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
37
|
-
--- @param id string 模型ID
|
|
38
|
-
--- @param input string 图像ID或路径
|
|
39
|
-
--- @param target integer 目标边长(默认 640)
|
|
40
|
-
--- @param thr number 置信阈值(默认 0.4)
|
|
41
|
-
--- @param nms number NMS 阈值(默认 0.5)
|
|
42
|
-
--- @return YoloResult[] 结果数组
|
|
43
|
-
function _Yolo.detect(id, input, target, thr, nms) return {} end
|
|
44
|
-
|
|
45
26
|
--- 区域检测,坐标映射为原图/全屏绝对坐标
|
|
46
27
|
--- @param id string 模型ID
|
|
47
28
|
--- @param input string 图像ID或路径
|
package/types/paddleocr.d.ts
CHANGED
|
@@ -37,17 +37,6 @@ declare namespace paddleOcr {
|
|
|
37
37
|
orientation: number;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* 手动切换到 PP-OCRv5 模型。PaddleOCR 默认自动加载 PP-OCRv6 small;同一时间只保留一个 active 模型,加载成功后会替换已加载的 PP-OCRv6 模型。
|
|
42
|
-
* @param maxSideLen 最大边长,默认768,可不传
|
|
43
|
-
* @param useGpu 是否使用GPU,默认false,可不传
|
|
44
|
-
* @returns 加载成功或模型已加载返回true
|
|
45
|
-
* @deprecated 请改用 loadModel("ppocr-v5", useGpu);检测长边请使用 setMaxSideLen 单独设置。
|
|
46
|
-
* @example
|
|
47
|
-
* const results = paddleOcr.recognizeAbs("screen", 0, 0, 0, 0)
|
|
48
|
-
* logi(`识别数量: ${results.length}`)
|
|
49
|
-
*/
|
|
50
|
-
function loadV5(maxSideLen?: number, useGpu?: boolean): boolean;
|
|
51
40
|
/**
|
|
52
41
|
* 按模型 ID 手动加载内置 PaddleOCR 模型。识别和查找方法默认自动加载 ppocr-v6-small;同一时间只保留一个 active 模型,加载成功后会替换已加载模型;检测长边请使用 setMaxSideLen 单独设置。
|
|
53
42
|
* @param modelId 模型 ID,必须传入,支持 "ppocr-v6-tiny"、"ppocr-v6-small"、"ppocr-v5"
|
|
@@ -70,30 +59,6 @@ declare namespace paddleOcr {
|
|
|
70
59
|
* const results = paddleOcr.recognizeAbs("screen", 0, 0, 0, 0)
|
|
71
60
|
*/
|
|
72
61
|
function setMaxSideLen(maxSideLen?: number): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* 执行OCR识别
|
|
75
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
76
|
-
* @param x 裁剪区域左上角 x 坐标,全屏传 0,默认 0
|
|
77
|
-
* @param y 裁剪区域左上角 y 坐标,全屏传 0,默认 0
|
|
78
|
-
* @param ex 裁剪区域右下角 x 坐标,全屏传 0,默认 0
|
|
79
|
-
* @param ey 裁剪区域右下角 y 坐标,全屏传 0,默认 0
|
|
80
|
-
* @param confidenceThreshold 置信度阈值,默认 0.6
|
|
81
|
-
* @returns 识别结果数组,坐标相对于裁剪区域
|
|
82
|
-
* @deprecated 请改用 recognizeAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
83
|
-
* @example
|
|
84
|
-
* const results = paddleOcr.recognize("screen", 100, 100, 500, 300)
|
|
85
|
-
* if (results.length > 0) {
|
|
86
|
-
* logi(`区域坐标: ${results[0].centerX}, ${results[0].centerY}`)
|
|
87
|
-
* }
|
|
88
|
-
*/
|
|
89
|
-
function recognize(
|
|
90
|
-
input: string,
|
|
91
|
-
x?: number,
|
|
92
|
-
y?: number,
|
|
93
|
-
ex?: number,
|
|
94
|
-
ey?: number,
|
|
95
|
-
confidenceThreshold?: number,
|
|
96
|
-
): OCRResult[];
|
|
97
62
|
/**
|
|
98
63
|
* 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标
|
|
99
64
|
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -117,34 +82,6 @@ declare namespace paddleOcr {
|
|
|
117
82
|
ey?: number,
|
|
118
83
|
confidenceThreshold?: number,
|
|
119
84
|
): OCRResult[];
|
|
120
|
-
/**
|
|
121
|
-
* 查找目标文本并返回对应子串坐标
|
|
122
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
123
|
-
* @param targetTexts 目标文本数组,例如 ["你好", "确定"]
|
|
124
|
-
* @param x 裁剪区域左上角 x 坐标,全屏传 0,默认 0
|
|
125
|
-
* @param y 裁剪区域左上角 y 坐标,全屏传 0,默认 0
|
|
126
|
-
* @param ex 裁剪区域右下角 x 坐标,全屏传 0,默认 0
|
|
127
|
-
* @param ey 裁剪区域右下角 y 坐标,全屏传 0,默认 0
|
|
128
|
-
* @param confidenceThreshold 置信度阈值,默认 0.6
|
|
129
|
-
* @param exactMatch 是否完整匹配,默认 false 表示包含匹配;传 true 时要求整条 OCR 识别结果文本等于目标文本
|
|
130
|
-
* @returns 匹配到的子串结果数组,坐标相对于裁剪区域
|
|
131
|
-
* @deprecated 请改用 findTextAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
132
|
-
* @example
|
|
133
|
-
* const results = paddleOcr.findText("screen", ["确定"], 100, 100, 500, 300, 0.6)
|
|
134
|
-
* if (results.length > 0) {
|
|
135
|
-
* logi(`命中: ${results[0].text}`)
|
|
136
|
-
* }
|
|
137
|
-
*/
|
|
138
|
-
function findText(
|
|
139
|
-
input: string,
|
|
140
|
-
targetTexts: string[],
|
|
141
|
-
x?: number,
|
|
142
|
-
y?: number,
|
|
143
|
-
ex?: number,
|
|
144
|
-
ey?: number,
|
|
145
|
-
confidenceThreshold?: number,
|
|
146
|
-
exactMatch?: boolean,
|
|
147
|
-
): OCRResult[];
|
|
148
85
|
/**
|
|
149
86
|
* 查找目标文本并返回对应子串的原图/全屏绝对坐标
|
|
150
87
|
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
package/types/yolo.d.ts
CHANGED
|
@@ -65,43 +65,6 @@ declare namespace yolo {
|
|
|
65
65
|
version?: number,
|
|
66
66
|
useGpu?: boolean,
|
|
67
67
|
): string | null;
|
|
68
|
-
/**
|
|
69
|
-
* 加载YOLOv11模型 (兼容 yolov8 模型)
|
|
70
|
-
* @param paramPath ncnn模型的param文件的绝对路径
|
|
71
|
-
* @param binPath ncnn模型的bin文件绝对路径
|
|
72
|
-
* @param nc 模型的标签数量;传 0 或省略时根据模型输出自动推断,显式传入但不匹配时检测返回空数组
|
|
73
|
-
* @param useGpu 是否使用 GPU 加载
|
|
74
|
-
* @returns 加载成功返回模型ID字符串,失败返回null
|
|
75
|
-
* @deprecated 请改用 load(paramPath, binPath, nc, 11, useGpu)。
|
|
76
|
-
* @example
|
|
77
|
-
* const modelId = yolo.load("yolov11n.param", "yolov11n.bin", 0, 11, false)
|
|
78
|
-
*/
|
|
79
|
-
function loadV11(
|
|
80
|
-
paramPath: string,
|
|
81
|
-
binPath: string,
|
|
82
|
-
nc?: number,
|
|
83
|
-
useGpu?: boolean,
|
|
84
|
-
): string | null;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* 目标检测
|
|
88
|
-
* @param modelId 模型ID
|
|
89
|
-
* @param img 图像ID,"screen"用当前屏幕检测,可以填入图像ID或者http图片地址或文件地址
|
|
90
|
-
* @param targetSize 图像进入后缩放的检测大小,模型训练一般都用640,因此这里的640一般不要改
|
|
91
|
-
* @param threshold 置信度,默认0.4,小于这个值的会被过滤掉
|
|
92
|
-
* @param nmsThreshold 重叠阈值,一般是0.5不需要更改
|
|
93
|
-
* @returns 检测结果数组
|
|
94
|
-
* @deprecated 请改用 detectAbs,避免裁剪区域坐标和全屏坐标混用。
|
|
95
|
-
* @example
|
|
96
|
-
* const results = yolo.detectAbs(modelId, "screen", 0, 0, 0, 0, 640, 0.4, 0.5)
|
|
97
|
-
*/
|
|
98
|
-
function detect(
|
|
99
|
-
modelId: string,
|
|
100
|
-
img: string,
|
|
101
|
-
targetSize?: number,
|
|
102
|
-
threshold?: number,
|
|
103
|
-
nmsThreshold?: number,
|
|
104
|
-
): YoloResult[];
|
|
105
68
|
|
|
106
69
|
/**
|
|
107
70
|
* 对指定区域执行目标检测,并将结果坐标映射为原图/全屏绝对坐标
|
|
@@ -38,17 +38,6 @@ declare namespace $PaddleOCR {
|
|
|
38
38
|
orientation: 数字;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
* 手动切换到 PP-OCRv5 模型。PaddleOCR 默认自动加载 PP-OCRv6 small;同一时间只保留一个 active 模型,加载成功后会替换已加载的 PP-OCRv6 模型。
|
|
43
|
-
* @param 最大边长 最大边长,默认768,可不传
|
|
44
|
-
* @param useGpu 是否使用GPU,默认false,可不传
|
|
45
|
-
* @returns 加载成功或模型已加载返回true
|
|
46
|
-
* @deprecated 请改用 加载模型("ppocr-v5", useGpu);检测长边请使用 设置最大边长 单独设置。
|
|
47
|
-
* @example
|
|
48
|
-
* const 识别结果数组 = $PaddleOCR.识别绝对坐标("screen", 0, 0, 0, 0)
|
|
49
|
-
* $打印信息日志(`识别数量: ${识别结果数组.length}`)
|
|
50
|
-
*/
|
|
51
|
-
function 加载V5模型(最大边长?: 数字, useGpu?: 布尔值): 布尔值;
|
|
52
41
|
/**
|
|
53
42
|
* 按模型 ID 手动加载内置 PaddleOCR 模型。识别和查找方法默认自动加载 ppocr-v6-small;同一时间只保留一个 active 模型,加载成功后会替换已加载模型;检测长边请使用 设置最大边长 单独设置。
|
|
54
43
|
* @param 模型ID 模型 ID,必须传入,支持 "ppocr-v6-tiny"、"ppocr-v6-small"、"ppocr-v5"
|
|
@@ -71,30 +60,6 @@ declare namespace $PaddleOCR {
|
|
|
71
60
|
* const 识别结果数组 = $PaddleOCR.识别绝对坐标("screen", 0, 0, 0, 0)
|
|
72
61
|
*/
|
|
73
62
|
function 设置最大边长(最大边长?: 数字): 布尔值;
|
|
74
|
-
/**
|
|
75
|
-
* 执行OCR识别
|
|
76
|
-
* @param 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
77
|
-
* @param 图片边界框左上角x坐标 裁剪区域左上角 x,全屏传 0,默认 0
|
|
78
|
-
* @param 图片边界框左上角y坐标 裁剪区域左上角 y,全屏传 0,默认 0
|
|
79
|
-
* @param 图片边界框右下角x坐标 裁剪区域右下角 x,全屏传 0,默认 0
|
|
80
|
-
* @param 图片边界框右下角y坐标 裁剪区域右下角 y,全屏传 0,默认 0
|
|
81
|
-
* @param 置信度阈值 置信度阈值,默认 0.6
|
|
82
|
-
* @returns 识别结果数组,坐标相对于裁剪区域
|
|
83
|
-
* @deprecated 请改用 识别绝对坐标,避免裁剪区域坐标和全屏坐标混用。
|
|
84
|
-
* @example
|
|
85
|
-
* const 识别结果数组 = $PaddleOCR.识别("screen", 100, 100, 500, 300)
|
|
86
|
-
* if (识别结果数组.length > 0) {
|
|
87
|
-
* $打印信息日志(`区域坐标: ${识别结果数组[0].centerX}, ${识别结果数组[0].centerY}`)
|
|
88
|
-
* }
|
|
89
|
-
*/
|
|
90
|
-
function 识别(
|
|
91
|
-
输入源: 字符串,
|
|
92
|
-
图片边界框左上角x坐标?: 数字,
|
|
93
|
-
图片边界框左上角y坐标?: 数字,
|
|
94
|
-
图片边界框右下角x坐标?: 数字,
|
|
95
|
-
图片边界框右下角y坐标?: 数字,
|
|
96
|
-
置信度阈值?: 数字,
|
|
97
|
-
): 数组<OCR识别结果>;
|
|
98
63
|
/**
|
|
99
64
|
* 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标
|
|
100
65
|
* @param 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -118,34 +83,6 @@ declare namespace $PaddleOCR {
|
|
|
118
83
|
图片边界框右下角y坐标?: 数字,
|
|
119
84
|
置信度阈值?: 数字,
|
|
120
85
|
): 数组<OCR识别结果>;
|
|
121
|
-
/**
|
|
122
|
-
* 查找目标文本并返回对应子串坐标
|
|
123
|
-
* @param 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
124
|
-
* @param 目标文本数组 例如 ["你好", "确定"]
|
|
125
|
-
* @param 图片边界框左上角x坐标 裁剪区域左上角 x,全屏传 0,默认 0
|
|
126
|
-
* @param 图片边界框左上角y坐标 裁剪区域左上角 y,全屏传 0,默认 0
|
|
127
|
-
* @param 图片边界框右下角x坐标 裁剪区域右下角 x,全屏传 0,默认 0
|
|
128
|
-
* @param 图片边界框右下角y坐标 裁剪区域右下角 y,全屏传 0,默认 0
|
|
129
|
-
* @param 置信度阈值 置信度阈值,默认 0.6
|
|
130
|
-
* @param 是否完整匹配 默认 false 表示包含匹配;传 true 时要求整条 OCR 识别结果文本等于目标文本
|
|
131
|
-
* @returns 匹配到的子串结果数组,坐标相对于裁剪区域
|
|
132
|
-
* @deprecated 请改用 查找文本绝对坐标,避免裁剪区域坐标和全屏坐标混用。
|
|
133
|
-
* @example
|
|
134
|
-
* const 结果 = $PaddleOCR.查找文本("screen", ["确定"], 100, 100, 500, 300, 0.6)
|
|
135
|
-
* if (结果.length > 0) {
|
|
136
|
-
* $打印信息日志(`命中: ${结果[0].text}`)
|
|
137
|
-
* }
|
|
138
|
-
*/
|
|
139
|
-
function 查找文本(
|
|
140
|
-
输入源: 字符串,
|
|
141
|
-
目标文本数组: 数组<字符串>,
|
|
142
|
-
图片边界框左上角x坐标?: 数字,
|
|
143
|
-
图片边界框左上角y坐标?: 数字,
|
|
144
|
-
图片边界框右下角x坐标?: 数字,
|
|
145
|
-
图片边界框右下角y坐标?: 数字,
|
|
146
|
-
置信度阈值?: 数字,
|
|
147
|
-
是否完整匹配?: 布尔值,
|
|
148
|
-
): 数组<OCR识别结果>;
|
|
149
86
|
/**
|
|
150
87
|
* 查找目标文本并返回对应子串的原图/全屏绝对坐标
|
|
151
88
|
* @param 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -69,44 +69,6 @@ declare namespace $YOLO {
|
|
|
69
69
|
useGpu?: 布尔值,
|
|
70
70
|
): 字符串 | null;
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* 加载YOLOv11模型 (兼容 yolov8 模型)
|
|
74
|
-
* @param ncnn模型的param文件路径
|
|
75
|
-
* @param ncnn模型的bin文件路径
|
|
76
|
-
* @param 标签数量 模型的标签数量;传 0 或省略时根据模型输出自动推断,显式传入但不匹配时检测返回空数组
|
|
77
|
-
* @param useGpu 是否使用 GPU 加载
|
|
78
|
-
* @returns 加载成功返回模型ID字符串,失败返回null
|
|
79
|
-
* @deprecated 请改用 加载模型(paramPath, binPath, 标签数量, 11, useGpu)。
|
|
80
|
-
* @example
|
|
81
|
-
* const 模型ID = $YOLO.加载模型("yolov11n.param", "yolov11n.bin", 0, 11, false)
|
|
82
|
-
*/
|
|
83
|
-
function 加载YOLOv11模型(
|
|
84
|
-
ncnn模型的param文件路径: 字符串,
|
|
85
|
-
ncnn模型的bin文件路径: 字符串,
|
|
86
|
-
标签数量?: 数字,
|
|
87
|
-
useGpu?: 布尔值,
|
|
88
|
-
): 字符串 | null;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 目标检测
|
|
92
|
-
* @param 模型ID
|
|
93
|
-
* @param 图片ID 图像ID,"screen"用当前屏幕检测,可以填入图像ID或者http图片地址或文件地址
|
|
94
|
-
* @param 目标检测输入大小 图像进入后缩放的检测大小,模型训练一般都用640,因此这里的640一般不要改
|
|
95
|
-
* @param 置信度 置信度,默认0.4,小于这个值的会被过滤掉
|
|
96
|
-
* @param 重叠阈值 一般是0.5不需要更改
|
|
97
|
-
* @returns 检测结果数组
|
|
98
|
-
* @deprecated 请改用 目标检测绝对坐标,避免裁剪区域坐标和全屏坐标混用。
|
|
99
|
-
* @example
|
|
100
|
-
* const 结果数组 = $YOLO.目标检测绝对坐标(模型ID, "screen", 0, 0, 0, 0, 640, 0.4, 0.5)
|
|
101
|
-
*/
|
|
102
|
-
function 目标检测(
|
|
103
|
-
模型ID: 字符串,
|
|
104
|
-
图片ID: 字符串,
|
|
105
|
-
目标检测输入大小?: 数字,
|
|
106
|
-
置信度?: 数字,
|
|
107
|
-
重叠阈值?: 数字,
|
|
108
|
-
): 数组<Yolo检测结果>;
|
|
109
|
-
|
|
110
72
|
/**
|
|
111
73
|
* 对指定区域执行目标检测,并将结果坐标映射为原图/全屏绝对坐标
|
|
112
74
|
* @param 模型ID
|
|
@@ -155,24 +155,6 @@ declare function $获取当前时间戳(): 数字;
|
|
|
155
155
|
*/
|
|
156
156
|
declare function $APP切入前台(): 无返回值;
|
|
157
157
|
|
|
158
|
-
/**
|
|
159
|
-
* 设置 Agent 快速模式(兼容旧接口)
|
|
160
|
-
* @param 是否开启 是否开启快速模式
|
|
161
|
-
* @returns 实际是否开启快速模式
|
|
162
|
-
* @description 开启对应模式 1,关闭对应模式 0。推荐改用 $设置Agent触控模式。设置会持久化
|
|
163
|
-
* @example
|
|
164
|
-
* const 是否开启 = $设置Agent快速模式(true);
|
|
165
|
-
*/
|
|
166
|
-
declare function $设置Agent快速模式(是否开启: 布尔值): 布尔值;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* 获取 Agent 快速模式当前状态(兼容旧接口)
|
|
170
|
-
* @returns 当前是否开启快速模式
|
|
171
|
-
* @example
|
|
172
|
-
* const 是否开启 = $获取Agent快速模式();
|
|
173
|
-
*/
|
|
174
|
-
declare function $获取Agent快速模式(): 布尔值;
|
|
175
|
-
|
|
176
158
|
/**
|
|
177
159
|
* 设置 Agent 触控模式
|
|
178
160
|
* @param 模式 0 标准 / 1 快速 / 2 真实点击
|
|
@@ -22,37 +22,6 @@ declare namespace $图片 {
|
|
|
22
22
|
区域右下角X坐标?: 数字,
|
|
23
23
|
区域右下角Y坐标?: 数字,
|
|
24
24
|
): 字符串 | null;
|
|
25
|
-
/**
|
|
26
|
-
* 截图
|
|
27
|
-
* @returns 截图的imageId ,如果截图失败则返回null
|
|
28
|
-
* @deprecated 请改用 截取屏幕()。
|
|
29
|
-
* @example
|
|
30
|
-
* const 图片ID = $图片.截取屏幕()
|
|
31
|
-
* if (图片ID) {
|
|
32
|
-
* $图片.保存图片(图片ID, "screen.jpg")
|
|
33
|
-
* }
|
|
34
|
-
*/
|
|
35
|
-
function 截取全屏(): 字符串 | null;
|
|
36
|
-
/**
|
|
37
|
-
* 截图指定区域
|
|
38
|
-
* @param 区域左上角X坐标
|
|
39
|
-
* @param 区域左上角Y坐标
|
|
40
|
-
* @param 区域右下角X坐标
|
|
41
|
-
* @param 区域右下角Y坐标
|
|
42
|
-
* @returns 截图的imageId ,如果截图失败则返回null
|
|
43
|
-
* @deprecated 请改用 截取屏幕(区域左上角X坐标, 区域左上角Y坐标, 区域右下角X坐标, 区域右下角Y坐标)。
|
|
44
|
-
* @example
|
|
45
|
-
* const 图片ID = $图片.截取屏幕(0, 0, 100, 100)
|
|
46
|
-
* if (图片ID) {
|
|
47
|
-
* $图片.保存图片(图片ID, "screen.jpg")
|
|
48
|
-
* }
|
|
49
|
-
*/
|
|
50
|
-
function 截取区域(
|
|
51
|
-
区域左上角X坐标: 数字,
|
|
52
|
-
区域左上角Y坐标: 数字,
|
|
53
|
-
区域右下角X坐标: 数字,
|
|
54
|
-
区域右下角Y坐标: 数字,
|
|
55
|
-
): 字符串 | null;
|
|
56
25
|
/**
|
|
57
26
|
* 保存图片
|
|
58
27
|
* @param imageId 图片id 路径 http地址或者 screen 实时截屏
|
|
@@ -30,29 +30,6 @@ declare namespace $苹果OCR {
|
|
|
30
30
|
centerY: 数字;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* 执行OCR识别(使用Apple Vision框架)
|
|
35
|
-
* @param 输入源 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
36
|
-
* @param 图片边界框左上角x坐标 默认 0
|
|
37
|
-
* @param 图片边界框左上角y坐标 默认 0
|
|
38
|
-
* @param 图片边界框右下角x坐标 默认 0
|
|
39
|
-
* @param 图片边界框右下角y坐标 默认 0
|
|
40
|
-
* @param 识别语言数组 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
41
|
-
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
42
|
-
* @deprecated 请改用 识别绝对坐标,避免裁剪区域坐标和全屏坐标混用。
|
|
43
|
-
* @example
|
|
44
|
-
* const 检查结果数组 = $苹果OCR.识别绝对坐标("screen", 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
45
|
-
* $打印信息日志(`识别数量: ${检查结果数组.length}`)
|
|
46
|
-
*/
|
|
47
|
-
function 识别(
|
|
48
|
-
输入源: 字符串,
|
|
49
|
-
图片边界框左上角x坐标?: 数字,
|
|
50
|
-
图片边界框左上角y坐标?: 数字,
|
|
51
|
-
图片边界框右下角x坐标?: 数字,
|
|
52
|
-
图片边界框右下角y坐标?: 数字,
|
|
53
|
-
识别语言数组?: Array<字符串>
|
|
54
|
-
): 数组<OCR识别结果>;
|
|
55
|
-
|
|
56
33
|
/**
|
|
57
34
|
* 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
|
|
58
35
|
* @param 输入源 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -77,27 +54,6 @@ declare namespace $苹果OCR {
|
|
|
77
54
|
识别语言数组?: Array<字符串>
|
|
78
55
|
): 数组<OCR识别结果>;
|
|
79
56
|
|
|
80
|
-
/**
|
|
81
|
-
* 执行OCR识别(仅识别数字)0-9.,+-
|
|
82
|
-
* @param 输入源 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
83
|
-
* @param 图片边界框左上角x坐标 默认 0
|
|
84
|
-
* @param 图片边界框左上角y坐标 默认 0
|
|
85
|
-
* @param 图片边界框右下角x坐标 默认 0
|
|
86
|
-
* @param 图片边界框右下角y坐标 默认 0
|
|
87
|
-
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
88
|
-
* @deprecated 请改用 识别数字绝对坐标,避免裁剪区域坐标和全屏坐标混用。
|
|
89
|
-
* @example
|
|
90
|
-
* const 检查结果数组 = $苹果OCR.识别数字绝对坐标("screen", 0, 0, 100, 100)
|
|
91
|
-
* $打印信息日志(`数字识别数量: ${检查结果数组.length}`)
|
|
92
|
-
*/
|
|
93
|
-
function 识别数字(
|
|
94
|
-
输入源: 字符串,
|
|
95
|
-
图片边界框左上角x坐标?: 数字,
|
|
96
|
-
图片边界框左上角y坐标?: 数字,
|
|
97
|
-
图片边界框右下角x坐标?: 数字,
|
|
98
|
-
图片边界框右下角y坐标?: 数字
|
|
99
|
-
): 数组<OCR识别结果>;
|
|
100
|
-
|
|
101
57
|
/**
|
|
102
58
|
* 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
|
|
103
59
|
* @param 输入源 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -120,33 +76,6 @@ declare namespace $苹果OCR {
|
|
|
120
76
|
图片边界框右下角y坐标?: 数字
|
|
121
77
|
): 数组<OCR识别结果>;
|
|
122
78
|
|
|
123
|
-
/**
|
|
124
|
-
* 执行OCR识别,在整段识别文本中查找指定子串
|
|
125
|
-
* @param 输入源 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
126
|
-
* @param 要查找的文本数组 要查找的目标文本数组,可匹配识别结果中的子串
|
|
127
|
-
* @param 图片边界框左上角x坐标 默认 0
|
|
128
|
-
* @param 图片边界框左上角y坐标 默认 0
|
|
129
|
-
* @param 图片边界框右下角x坐标 默认 0
|
|
130
|
-
* @param 图片边界框右下角y坐标 默认 0
|
|
131
|
-
* @param 识别语言数组 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
132
|
-
* @param 是否完整匹配 默认 false 表示包含匹配;传 true 时要求整条 OCR 识别结果文本等于目标文本
|
|
133
|
-
* @returns 命中子串的识别结果数组,坐标对应目标子串区域
|
|
134
|
-
* @deprecated 请改用 查找文本绝对坐标,避免裁剪区域坐标和全屏坐标混用。
|
|
135
|
-
* @example
|
|
136
|
-
* const 检查结果数组 = $苹果OCR.查找文本绝对坐标("screen", ["开始"], 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
137
|
-
* $打印信息日志(`命中数量: ${检查结果数组.length}`)
|
|
138
|
-
*/
|
|
139
|
-
function 查找文本(
|
|
140
|
-
输入源: 字符串,
|
|
141
|
-
要查找的文本数组: 数组<字符串>,
|
|
142
|
-
图片边界框左上角x坐标?: 数字,
|
|
143
|
-
图片边界框左上角y坐标?: 数字,
|
|
144
|
-
图片边界框右下角x坐标?: 数字,
|
|
145
|
-
图片边界框右下角y坐标?: 数字,
|
|
146
|
-
识别语言数组?: 数组<字符串>,
|
|
147
|
-
是否完整匹配?: 布尔值
|
|
148
|
-
): 数组<OCR识别结果>;
|
|
149
|
-
|
|
150
79
|
/**
|
|
151
80
|
* 查找指定子串,并将子串结果坐标映射为原图/全屏绝对坐标。
|
|
152
81
|
* @param 输入源 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
@@ -73,21 +73,6 @@ declare namespace $设备 {
|
|
|
73
73
|
* @example $设备.获取设备型号()
|
|
74
74
|
*/
|
|
75
75
|
function 获取设备型号(): 字符串;
|
|
76
|
-
/**
|
|
77
|
-
* 获取屏幕宽高
|
|
78
|
-
* @returns 获取屏幕宽高缩放后的,实际宽高,请使用`获取屏幕实际宽高()`获取未缩放的宽高
|
|
79
|
-
* @example $设备.获取屏幕宽高()
|
|
80
|
-
*/
|
|
81
|
-
function 获取屏幕宽高(): {
|
|
82
|
-
/**
|
|
83
|
-
* 屏幕宽度
|
|
84
|
-
*/
|
|
85
|
-
width: 数字;
|
|
86
|
-
/**
|
|
87
|
-
* 屏幕高度
|
|
88
|
-
*/
|
|
89
|
-
height: 数字;
|
|
90
|
-
};
|
|
91
76
|
/**
|
|
92
77
|
* 获取屏幕实际大小
|
|
93
78
|
* @returns 屏幕实际大小
|