ms-types 0.0.25 → 0.0.27
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/action.d.ts +36 -0
- package/types/appleOcr.d.ts +4 -4
- package/types/paddleOcr.d.ts +2 -2
- package/types/system.d.ts +15 -2
- package/types/tomatoOcr.d.ts +6 -6
- package/types/yolo.d.ts +3 -3
package/package.json
CHANGED
package/types/action.d.ts
CHANGED
|
@@ -55,6 +55,42 @@ declare namespace action {
|
|
|
55
55
|
y2: number,
|
|
56
56
|
duration?: number
|
|
57
57
|
): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 双击
|
|
60
|
+
* @param x 坐标x
|
|
61
|
+
* @param y 坐标y
|
|
62
|
+
* @param duration 持续时间 默认20ms
|
|
63
|
+
* @param interval 双击间隔时间 默认20ms
|
|
64
|
+
* @param jitter 抖动 开启抖动,会在像素范围随机偏移 点击 默认false
|
|
65
|
+
* @returns 双击是否成功
|
|
66
|
+
* @example action.doubleClick(100, 100, 20, 20, true)
|
|
67
|
+
*/
|
|
68
|
+
function doubleClick(
|
|
69
|
+
x: number,
|
|
70
|
+
y: number,
|
|
71
|
+
duration?: number,
|
|
72
|
+
interval?: number,
|
|
73
|
+
jitter?: boolean
|
|
74
|
+
): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* 随机双击
|
|
77
|
+
* @param x1 区域左上角x坐标
|
|
78
|
+
* @param y1 区域左上角y坐标
|
|
79
|
+
* @param x2 区域右下角x坐标
|
|
80
|
+
* @param y2 区域右下角y坐标
|
|
81
|
+
* @param duration 持续时间 默认20ms
|
|
82
|
+
* @param interval 双击间隔时间 默认20ms
|
|
83
|
+
* @returns 随机双击是否成功
|
|
84
|
+
* @example action.doubleClickRandom(100, 100, 200, 200, 20, 20)
|
|
85
|
+
*/
|
|
86
|
+
function doubleClickRandom(
|
|
87
|
+
x1: number,
|
|
88
|
+
y1: number,
|
|
89
|
+
x2: number,
|
|
90
|
+
y2: number,
|
|
91
|
+
duration?: number,
|
|
92
|
+
interval?: number
|
|
93
|
+
): boolean;
|
|
58
94
|
/**
|
|
59
95
|
* 长按滑动
|
|
60
96
|
* @param startX 起始坐标x
|
package/types/appleOcr.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
declare namespace appleOcr {
|
|
5
5
|
/**
|
|
6
6
|
* 执行OCR识别(使用Apple Vision框架)
|
|
7
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen",
|
|
7
|
+
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
8
8
|
* @param x 边界框左上角x坐标
|
|
9
9
|
* @param y 边界框左上角y坐标
|
|
10
10
|
* @param ex 边界框右下角x坐标
|
|
@@ -18,7 +18,7 @@ declare namespace appleOcr {
|
|
|
18
18
|
* })
|
|
19
19
|
*/
|
|
20
20
|
function recognize(
|
|
21
|
-
input: string
|
|
21
|
+
input: string,
|
|
22
22
|
x: number,
|
|
23
23
|
y: number,
|
|
24
24
|
ex: number,
|
|
@@ -28,7 +28,7 @@ declare namespace appleOcr {
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* 执行快速OCR识别(仅返回文本内容)
|
|
31
|
-
* @param input
|
|
31
|
+
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
32
32
|
* @param x 边界框左上角x坐标
|
|
33
33
|
* @param y 边界框左上角y坐标
|
|
34
34
|
* @param ex 边界框右下角x坐标
|
|
@@ -42,7 +42,7 @@ declare namespace appleOcr {
|
|
|
42
42
|
* }
|
|
43
43
|
*/
|
|
44
44
|
function recognizeText(
|
|
45
|
-
input: string
|
|
45
|
+
input: string,
|
|
46
46
|
x: number,
|
|
47
47
|
y: number,
|
|
48
48
|
ex: number,
|
package/types/paddleOcr.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare namespace paddleOcr {
|
|
|
15
15
|
function loadV5(useGpu: boolean): boolean;
|
|
16
16
|
/**
|
|
17
17
|
* 执行OCR识别
|
|
18
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen",
|
|
18
|
+
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
19
19
|
* @param x 边界框左上角x坐标
|
|
20
20
|
* @param y 边界框左上角y坐标
|
|
21
21
|
* @param ex 边界框右下角x坐标
|
|
@@ -28,7 +28,7 @@ declare namespace paddleOcr {
|
|
|
28
28
|
* }
|
|
29
29
|
*/
|
|
30
30
|
function recognize(
|
|
31
|
-
input: string
|
|
31
|
+
input: string,
|
|
32
32
|
x: number,
|
|
33
33
|
y: number,
|
|
34
34
|
ex: number,
|
package/types/system.d.ts
CHANGED
|
@@ -132,15 +132,16 @@ declare namespace system {
|
|
|
132
132
|
function notify(msg: string, title: string, id: string): void;
|
|
133
133
|
/**
|
|
134
134
|
* 获取内存使用信息
|
|
135
|
-
* @returns
|
|
135
|
+
* @returns 内存使用信息,包含已使用内存、可用内存、总内存和使用率(单位:MB)
|
|
136
136
|
* @example
|
|
137
137
|
* const memInfo = system.getMemoryInfo()
|
|
138
|
-
* logger.info(`已使用: ${memInfo.used}MB, 可用: ${memInfo.available}MB, 总计: ${memInfo.total}MB
|
|
138
|
+
* logger.info(`已使用: ${memInfo.used}MB, 可用: ${memInfo.available}MB, 总计: ${memInfo.total}MB, 使用率: ${memInfo.usagePercentage}%`)
|
|
139
139
|
*/
|
|
140
140
|
function getMemoryInfo(): {
|
|
141
141
|
used: number;
|
|
142
142
|
available: number;
|
|
143
143
|
total: number;
|
|
144
|
+
usagePercentage: number;
|
|
144
145
|
};
|
|
145
146
|
/**
|
|
146
147
|
* 获取已使用内存
|
|
@@ -168,4 +169,16 @@ declare namespace system {
|
|
|
168
169
|
* }
|
|
169
170
|
*/
|
|
170
171
|
function startWDA(): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* 获取 WDA 状态
|
|
174
|
+
* @returns WDA 是否正在运行
|
|
175
|
+
* @example
|
|
176
|
+
* const isRunning = system.getWDAStatus()
|
|
177
|
+
* if (isRunning) {
|
|
178
|
+
* logger.info("WDA 服务正在运行")
|
|
179
|
+
* } else {
|
|
180
|
+
* logger.info("WDA 服务未运行")
|
|
181
|
+
* }
|
|
182
|
+
*/
|
|
183
|
+
function getWDAStatus(): boolean;
|
|
171
184
|
}
|
package/types/tomatoOcr.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ declare namespace tomatoOcr {
|
|
|
6
6
|
/**
|
|
7
7
|
* 初始化TomatoOCR并设置基本配置
|
|
8
8
|
* @param mode 运行模式 debug:调试模型;删除或传别的任何值为正式模式
|
|
9
|
-
* @param licenseData
|
|
9
|
+
* @param licenseData 授权码 请传入你在 TomatoOCR 官网申请的授权码
|
|
10
10
|
* @param remark 备注信息(可选)
|
|
11
11
|
* @returns 设置结果
|
|
12
12
|
* @example
|
|
13
13
|
* ```typescript
|
|
14
14
|
* // 不带备注
|
|
15
|
-
* const result1 = tomatoOcr.initializeWithConfig("online", "
|
|
15
|
+
* const result1 = tomatoOcr.initializeWithConfig("online", "授权码");
|
|
16
16
|
* // 带备注
|
|
17
|
-
* const result2 = tomatoOcr.initializeWithConfig("online", "
|
|
17
|
+
* const result2 = tomatoOcr.initializeWithConfig("online", "授权码", "测试环境");
|
|
18
18
|
* logger.info(result1, result2);
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
@@ -140,7 +140,7 @@ declare namespace tomatoOcr {
|
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* 对图像执行 OCR 识别
|
|
143
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen",
|
|
143
|
+
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
144
144
|
* @param type 识别类型 默认3: 检测 + 识别;0: 只检测;1: 方向分类+识别;2: 只识别;3: 检测+识别
|
|
145
145
|
* @param x 边界框左上角x坐标
|
|
146
146
|
* @param y 边界框左上角y坐标
|
|
@@ -150,7 +150,7 @@ declare namespace tomatoOcr {
|
|
|
150
150
|
* @example
|
|
151
151
|
* ```typescript
|
|
152
152
|
* // 识别屏幕
|
|
153
|
-
* const result1 = tomatoOcr.ocrImage(
|
|
153
|
+
* const result1 = tomatoOcr.ocrImage("screen", 0, 0, 0, 0, 0);
|
|
154
154
|
* logger.info(`识别屏幕结果:${result1}`);
|
|
155
155
|
*
|
|
156
156
|
* // 识别文件
|
|
@@ -163,7 +163,7 @@ declare namespace tomatoOcr {
|
|
|
163
163
|
* ```
|
|
164
164
|
*/
|
|
165
165
|
function ocrImage(
|
|
166
|
-
input: string
|
|
166
|
+
input: string,
|
|
167
167
|
type: number,
|
|
168
168
|
x: number,
|
|
169
169
|
y: number,
|
package/types/yolo.d.ts
CHANGED
|
@@ -68,17 +68,17 @@ declare namespace yolo {
|
|
|
68
68
|
/**
|
|
69
69
|
* 目标检测
|
|
70
70
|
* @param modelId 模型ID
|
|
71
|
-
* @param img 图像ID
|
|
71
|
+
* @param img 图像ID,"screen"用当前屏幕检测,可以填入图像ID或者http图片地址或文件地址
|
|
72
72
|
* @param targetSize 图像进入后缩放的检测大小,模型训练一般都用640,因此这里的640一般不要改
|
|
73
73
|
* @param threshold 置信度,默认0.4,小于这个值的会被过滤掉
|
|
74
74
|
* @param nmsThreshold 重叠阈值,一般是0.5不需要更改
|
|
75
75
|
* @returns 检测结果数组
|
|
76
76
|
* @example
|
|
77
|
-
* const results = yolo.detect(modelId,
|
|
77
|
+
* const results = yolo.detect(modelId, "screen", 640, 0.4, 0.5)
|
|
78
78
|
*/
|
|
79
79
|
function detect(
|
|
80
80
|
modelId: string,
|
|
81
|
-
img: string
|
|
81
|
+
img: string,
|
|
82
82
|
targetSize?: number,
|
|
83
83
|
threshold?: number,
|
|
84
84
|
nmsThreshold?: number
|