ms-vite-plugin 1.5.12 → 1.5.14

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.
Files changed (61) hide show
  1. package/dist/build/luaBundle.js +2 -2
  2. package/dist/build/scriptProtect.js +2 -2
  3. package/docs/api/ai.md +16 -16
  4. package/docs/api/config.md +3 -3
  5. package/docs/api/dotocr.md +2 -2
  6. package/docs/api/file.md +18 -18
  7. package/docs/api/hid.md +2 -2
  8. package/docs/api/hotUpdate.md +2 -2
  9. package/docs/api/http.md +4 -4
  10. package/docs/api/image.md +15 -15
  11. package/docs/api/jbclear.md +12 -12
  12. package/docs/api/jbdevice.md +25 -25
  13. package/docs/api/jbdraw.md +139 -0
  14. package/docs/api/jbdylib.md +6 -6
  15. package/docs/api/jbpower.md +134 -0
  16. package/docs/api/jbshell.md +2 -2
  17. package/docs/api/jbsystem.md +6 -6
  18. package/docs/api/jbvpn.md +7 -7
  19. package/docs/api/mysql.md +4 -4
  20. package/docs/api/netCard.md +4 -73
  21. package/docs/api/node.md +5 -3
  22. package/docs/api/opencv.md +116 -116
  23. package/docs/api/plist.md +2 -2
  24. package/docs/api/sqlite.md +231 -0
  25. package/docs/api/system.md +1 -1
  26. package/docs/api/thread.md +2 -2
  27. package/docs/api/tomatoocr.md +2 -2
  28. package/docs/api/yolo.md +2 -2
  29. package/docs/api/yolocls.md +6 -6
  30. package/docs/api/zipFile.md +113 -0
  31. package/docs/apicn/ai.md +16 -16
  32. package/docs/apicn/config.md +2 -2
  33. package/docs/apicn/dotocr.md +2 -2
  34. package/docs/apicn/file.md +16 -16
  35. package/docs/apicn/hid.md +4 -4
  36. package/docs/apicn/hotUpdate.md +2 -2
  37. package/docs/apicn/http.md +4 -4
  38. package/docs/apicn/image.md +13 -13
  39. package/docs/apicn/mysql.md +4 -4
  40. package/docs/apicn/netCard.md +4 -73
  41. package/docs/apicn/node.md +5 -3
  42. package/docs/apicn/sqlite.md +197 -0
  43. package/docs/apicn/system.md +3 -3
  44. package/docs/apicn/thread.md +2 -2
  45. package/docs/apicn/yolo.md +2 -2
  46. package/docs/apicn/yolocls.md +6 -6
  47. package/docs/apicn/zipFile.md +113 -0
  48. package/docs/apilua/jbdraw.md +141 -0
  49. package/docs/apilua/jbpower.md +136 -0
  50. package/docs/apilua/netCard.md +3 -77
  51. package/docs/apilua/node.md +3 -1
  52. package/docs/apilua/sqlite.md +204 -0
  53. package/docs/apilua/zipFile.md +123 -0
  54. package/docs/apipython/jbdraw.md +147 -0
  55. package/docs/apipython/jbpower.md +133 -0
  56. package/docs/apipython/netCard.md +3 -74
  57. package/docs/apipython/node.md +3 -1
  58. package/docs/apipython/overview.md +1 -1
  59. package/docs/apipython/sqlite.md +181 -0
  60. package/docs/apipython/zipFile.md +117 -0
  61. package/package.json +1 -1
@@ -71,7 +71,7 @@ function capture(
71
71
  y?: number,
72
72
  ex?: number,
73
73
  ey?: number,
74
- ): Mat | null;
74
+ ): Mat | undefined;
75
75
  ```
76
76
 
77
77
  **参数:**
@@ -89,7 +89,7 @@ function capture(
89
89
 
90
90
  | 类型 | 描述 |
91
91
  | --- | --- |
92
- | `string` | Mat 句柄,失败返回 `null` |
92
+ | `string` | Mat 句柄,失败返回 `undefined` |
93
93
 
94
94
  **示例:**
95
95
 
@@ -103,7 +103,7 @@ cv.release(roi);
103
103
  ### imread - 读取图片为 Mat(唯一路径类入口)
104
104
 
105
105
  ```typescript
106
- function imread(path: string): Mat | null;
106
+ function imread(path: string): Mat | undefined;
107
107
  ```
108
108
 
109
109
  **参数:**
@@ -131,7 +131,7 @@ function imread(path: string): Mat | null;
131
131
 
132
132
  | 类型 | 描述 |
133
133
  | --- | --- |
134
- | `string` | Mat 句柄,失败返回 `null` |
134
+ | `string` | Mat 句柄,失败返回 `undefined` |
135
135
 
136
136
  **示例:**
137
137
 
@@ -150,7 +150,7 @@ cv.release(c);
150
150
  ### imdecode - 解码 base64 为 Mat
151
151
 
152
152
  ```typescript
153
- function imdecode(data: string): Mat | null;
153
+ function imdecode(data: string): Mat | undefined;
154
154
  ```
155
155
 
156
156
  **参数:**
@@ -161,7 +161,7 @@ function imdecode(data: string): Mat | null;
161
161
 
162
162
  **说明:** 不解析文件路径 / msbundle / imageId;路径类请用 `imread`。常与 `imencode` 成对使用。
163
163
 
164
- **返回值:** Mat 句柄;失败 `null`。
164
+ **返回值:** Mat 句柄;失败 `undefined`。
165
165
 
166
166
  **示例:**
167
167
 
@@ -201,7 +201,7 @@ cv.release(src);
201
201
  ### imencode - 编码 Mat 为 base64
202
202
 
203
203
  ```typescript
204
- function imencode(ext: string, mat: Mat, quality?: number): string | null;
204
+ function imencode(ext: string, mat: Mat, quality?: number): string | undefined;
205
205
  ```
206
206
 
207
207
  **参数:**
@@ -212,9 +212,9 @@ function imencode(ext: string, mat: Mat, quality?: number): string | null;
212
212
  | `mat` | Mat | 是 | - | Mat 句柄 |
213
213
  | `quality` | number | 否 | 90 | JPEG 质量,取值 1–100(仅 jpg 有效) |
214
214
 
215
- **说明:** 可用扩展名与通道限制同 `imwrite`,不支持的格式返回 `null`。
215
+ **说明:** 可用扩展名与通道限制同 `imwrite`,不支持的格式返回 `undefined`。
216
216
 
217
- **返回值:** 纯 base64 字符串(无 data URI 前缀);失败 `null`。
217
+ **返回值:** 纯 base64 字符串(无 data URI 前缀);失败 `undefined`。
218
218
 
219
219
  **示例:**
220
220
 
@@ -225,8 +225,8 @@ const b64 = cv.imencode(".jpg", mat, 85);
225
225
  ### fromImageId / toImageId - 与 image 互通
226
226
 
227
227
  ```typescript
228
- function fromImageId(imageId: string): Mat | null;
229
- function toImageId(mat: Mat): string | null;
228
+ function fromImageId(imageId: string): Mat | undefined;
229
+ function toImageId(mat: Mat): string | undefined;
230
230
  ```
231
231
 
232
232
  **参数:**
@@ -252,9 +252,9 @@ image.release(outId);
252
252
  ### Mat / zeros / ones - 创建矩阵
253
253
 
254
254
  ```typescript
255
- function Mat(options: { rows: number; cols: number; type?: number; scalar?: number[] }): Mat | null;
256
- function zeros(options: { rows: number; cols: number; type?: number }): Mat | null;
257
- function ones(options: { rows: number; cols: number; type?: number }): Mat | null;
255
+ function Mat(options: { rows: number; cols: number; type?: number; scalar?: number[] }): Mat | undefined;
256
+ function zeros(options: { rows: number; cols: number; type?: number }): Mat | undefined;
257
+ function ones(options: { rows: number; cols: number; type?: number }): Mat | undefined;
258
258
  ```
259
259
 
260
260
  **参数:**
@@ -277,7 +277,7 @@ cv.release(filled);
277
277
  ### clone / empty / isRelease / release / releaseAll
278
278
 
279
279
  ```typescript
280
- function clone(mat: Mat): Mat | null;
280
+ function clone(mat: Mat): Mat | undefined;
281
281
  function empty(mat: Mat): boolean;
282
282
  function isRelease(mat: Mat): boolean;
283
283
  function release(mat: Mat): void;
@@ -304,7 +304,7 @@ cv.release(b);
304
304
  ### getSize / at / set / copyTo
305
305
 
306
306
  ```typescript
307
- function getSize(mat: Mat): MatInfo | null;
307
+ function getSize(mat: Mat): MatInfo | undefined;
308
308
  logi(`${info.width}x${info.height} ch=${info.channels}`);
309
309
  cv.set(mat, { row: 10, col: 10, value: [0, 0, 255] });
310
310
  const px = cv.at(mat, { row: 10, col: 10 });
@@ -319,14 +319,14 @@ cv.release(copy);
319
319
  ### cvtColor - 颜色空间转换
320
320
 
321
321
  ```typescript
322
- function cvtColor(mat: Mat, code: number): Mat | null;
322
+ function cvtColor(mat: Mat, code: number): Mat | undefined;
323
323
  const hsv = cv.cvtColor(src, cv.COLOR_BGR2HSV);
324
324
  ```
325
325
 
326
326
  ### threshold - 固定阈值
327
327
 
328
328
  ```typescript
329
- function threshold(mat: Mat, options: { thresh?: number; maxval?: number; type?: number }): Mat | null;
329
+ function threshold(mat: Mat, options: { thresh?: number; maxval?: number; type?: number }): Mat | undefined;
330
330
  ```
331
331
 
332
332
  **参数:**
@@ -353,7 +353,7 @@ function adaptiveThreshold(mat: Mat, options: {
353
353
  thresholdType?: number;
354
354
  blockSize?: number;
355
355
  C?: number;
356
- }): Mat | null;
356
+ }): Mat | undefined;
357
357
  ```
358
358
 
359
359
  **参数:**
@@ -381,7 +381,7 @@ const bin = cv.adaptiveThreshold(gray, {
381
381
  ### inRange - 范围掩膜
382
382
 
383
383
  ```typescript
384
- function inRange(mat: Mat, options: { lowerb: number[]; upperb: number[] }): Mat | null;
384
+ function inRange(mat: Mat, options: { lowerb: number[]; upperb: number[] }): Mat | undefined;
385
385
  ```
386
386
 
387
387
  **参数:** `lowerb` / `upperb` 为各通道下/上限数组。
@@ -409,7 +409,7 @@ const abs = cv.convertScaleAbs(sobel, { alpha: 1, beta: 0 });
409
409
 
410
410
  ```typescript
411
411
  function countNonZero(mat: Mat): number;
412
- function minMaxLoc(mat: Mat, options?: { mask?: Mat }): MinMaxLocResult | null;
412
+ function minMaxLoc(mat: Mat, options?: { mask?: Mat }): MinMaxLocResult | undefined;
413
413
  ```
414
414
 
415
415
  `minMaxLoc` / `countNonZero` 需要单通道,先转灰度:
@@ -431,11 +431,11 @@ cv.release(merged);
431
431
  ### GaussianBlur / blur / medianBlur / bilateralFilter / boxFilter
432
432
 
433
433
  ```typescript
434
- function GaussianBlur(mat: Mat, options: { ksize: number | [number, number] | Size; sigmaX?: number; sigmaY?: number }): Mat | null;
435
- function blur(mat: Mat, options: { ksize: number | [number, number] | Size }): Mat | null;
436
- function medianBlur(mat: Mat, options: { ksize: number }): Mat | null;
437
- function bilateralFilter(mat: Mat, options: { d?: number; sigmaColor?: number; sigmaSpace?: number }): Mat | null;
438
- function boxFilter(mat: Mat, options: { ksize: number | [number, number] | Size; ddepth?: number }): Mat | null;
434
+ function GaussianBlur(mat: Mat, options: { ksize: number | [number, number] | Size; sigmaX?: number; sigmaY?: number }): Mat | undefined;
435
+ function blur(mat: Mat, options: { ksize: number | [number, number] | Size }): Mat | undefined;
436
+ function medianBlur(mat: Mat, options: { ksize: number }): Mat | undefined;
437
+ function bilateralFilter(mat: Mat, options: { d?: number; sigmaColor?: number; sigmaSpace?: number }): Mat | undefined;
438
+ function boxFilter(mat: Mat, options: { ksize: number | [number, number] | Size; ddepth?: number }): Mat | undefined;
439
439
  ```
440
440
 
441
441
  `ksize` 可为 `5`、`[5,5]` 或 `{ width, height }`。高斯核尺寸需为奇数。
@@ -451,12 +451,12 @@ const b = cv.bilateralFilter(src, { d: 9, sigmaColor: 75, sigmaSpace: 75 });
451
451
  ### Canny / Sobel / Laplacian / Scharr / equalizeHist / CLAHE
452
452
 
453
453
  ```typescript
454
- function Canny(mat: Mat, options: { threshold1?: number; threshold2?: number; apertureSize?: number; L2gradient?: boolean }): Mat | null;
455
- function Sobel(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; ksize?: number; scale?: number; delta?: number }): Mat | null;
456
- function Laplacian(mat: Mat, options: { ddepth?: number; ksize?: number; scale?: number; delta?: number }): Mat | null;
457
- function Scharr(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; scale?: number; delta?: number }): Mat | null;
458
- function equalizeHist(mat: Mat): Mat | null;
459
- function CLAHE(mat: Mat, options?: { clipLimit?: number; tileGridSize?: number | [number, number] | Size }): Mat | null;
454
+ function Canny(mat: Mat, options: { threshold1?: number; threshold2?: number; apertureSize?: number; L2gradient?: boolean }): Mat | undefined;
455
+ function Sobel(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; ksize?: number; scale?: number; delta?: number }): Mat | undefined;
456
+ function Laplacian(mat: Mat, options: { ddepth?: number; ksize?: number; scale?: number; delta?: number }): Mat | undefined;
457
+ function Scharr(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; scale?: number; delta?: number }): Mat | undefined;
458
+ function equalizeHist(mat: Mat): Mat | undefined;
459
+ function CLAHE(mat: Mat, options?: { clipLimit?: number; tileGridSize?: number | [number, number] | Size }): Mat | undefined;
460
460
  ```
461
461
 
462
462
  **Canny 参数:**
@@ -482,8 +482,8 @@ const histEq = cv.equalizeHist(gray);
482
482
  ### pyrDown / pyrUp - 金字塔采样
483
483
 
484
484
  ```typescript
485
- function pyrDown(mat: Mat): Mat | null;
486
- function pyrUp(mat: Mat): Mat | null;
485
+ function pyrDown(mat: Mat): Mat | undefined;
486
+ function pyrUp(mat: Mat): Mat | undefined;
487
487
  ```
488
488
 
489
489
  约缩小 / 放大一倍。大图特征匹配前可先 `pyrDown` 降采样。
@@ -508,7 +508,7 @@ function resize(mat: Mat, options: {
508
508
  fx?: number;
509
509
  fy?: number;
510
510
  interpolation?: number;
511
- }): Mat | null;
511
+ }): Mat | undefined;
512
512
  ```
513
513
 
514
514
  用 `width`/`height` 指定目标尺寸;也可设为 0 并用 `fx`/`fy` 按比例缩放。`interpolation` 如 `cv.INTER_LINEAR`、`cv.INTER_AREA`。
@@ -526,7 +526,7 @@ const half = cv.resize(src, { fx: 0.5, fy: 0.5, interpolation: cv.INTER_AREA });
526
526
  function crop(mat: Mat, options: {
527
527
  x?: number; y?: number;
528
528
  ex?: number; ey?: number;
529
- }): Mat | null;
529
+ }): Mat | undefined;
530
530
  ```
531
531
 
532
532
  参数与 `cv.capture` / `image.captureScreen` 一致,使用左上角与右下角。
@@ -542,7 +542,7 @@ const roi = cv.crop(src, { x: 10, y: 10, ex: 110, ey: 110 });
542
542
  ### rotate / flip / copyMakeBorder
543
543
 
544
544
  ```typescript
545
- function rotate(mat: Mat, rotateCode: number): Mat | null;
545
+ function rotate(mat: Mat, rotateCode: number): Mat | undefined;
546
546
  const f = cv.flip(src, 1);
547
547
  const padded = cv.copyMakeBorder(src, {
548
548
  top: 10, bottom: 10, left: 10, right: 10,
@@ -553,9 +553,9 @@ const padded = cv.copyMakeBorder(src, {
553
553
  ### getRotationMatrix2D / warpAffine / warpPerspective
554
554
 
555
555
  ```typescript
556
- function getRotationMatrix2D(options: { center: Point | [number, number]; angle?: number; scale?: number }): Mat | null;
557
- function warpAffine(mat: Mat, options: { M: Mat; width?: number; height?: number; flags?: number }): Mat | null;
558
- function warpPerspective(mat: Mat, options: { M: Mat; width?: number; height?: number; flags?: number }): Mat | null;
556
+ function getRotationMatrix2D(options: { center: Point | [number, number]; angle?: number; scale?: number }): Mat | undefined;
557
+ function warpAffine(mat: Mat, options: { M: Mat; width?: number; height?: number; flags?: number }): Mat | undefined;
558
+ function warpPerspective(mat: Mat, options: { M: Mat; width?: number; height?: number; flags?: number }): Mat | undefined;
559
559
  ```
560
560
 
561
561
  **示例:**
@@ -575,10 +575,10 @@ cv.release(out);
575
575
  `arrowedLine` / `drawMarker` 只能描边,传 0 或负值按 1 处理。
576
576
 
577
577
  ```typescript
578
- function rectangle(mat: Mat, options: RectangleOptions): Mat | null;
579
- function circle(mat: Mat, options: CircleOptions): Mat | null;
580
- function line(mat: Mat, options: LineOptions): Mat | null;
581
- function putText(mat: Mat, options: PutTextOptions): Mat | null;
578
+ function rectangle(mat: Mat, options: RectangleOptions): Mat | undefined;
579
+ function circle(mat: Mat, options: CircleOptions): Mat | undefined;
580
+ function line(mat: Mat, options: LineOptions): Mat | undefined;
581
+ function putText(mat: Mat, options: PutTextOptions): Mat | undefined;
582
582
  ```
583
583
 
584
584
  **rectangle 参数:** `pt1`+`pt2`,或 `rect`;以及 `color`、`thickness`。
@@ -607,15 +607,15 @@ cv.putText(src, {
607
607
  ### fillPoly / polylines / drawContours
608
608
 
609
609
  ```typescript
610
- function fillPoly(mat: Mat, options: { pts: Point[][] | Point[]; color?: number[] | string }): Mat | null;
611
- function polylines(mat: Mat, options: { pts: Point[][] | Point[]; isClosed?: boolean; color?: number[] | string; thickness?: number }): Mat | null;
610
+ function fillPoly(mat: Mat, options: { pts: Point[][] | Point[]; color?: number[] | string }): Mat | undefined;
611
+ function polylines(mat: Mat, options: { pts: Point[][] | Point[]; isClosed?: boolean; color?: number[] | string; thickness?: number }): Mat | undefined;
612
612
  function drawContours(mat: Mat, options: {
613
613
  contours?: Point[][];
614
614
  pts?: Point[][];
615
615
  contourIdx?: number;
616
616
  color?: number[] | string;
617
617
  thickness?: number;
618
- }): Mat | null;
618
+ }): Mat | undefined;
619
619
  ```
620
620
 
621
621
  就地绘制。`contourIdx` 为 `-1`(默认)表示画全部。
@@ -638,8 +638,8 @@ cv.polylines(src, {
638
638
  ### matchTemplate / matchTemplateLoc
639
639
 
640
640
  ```typescript
641
- function matchTemplate(image: Mat, templ: Mat, methodOrOptions?: number | { method?: number; mask?: Mat }): Mat | null;
642
- function matchTemplateLoc(image: Mat, templ: Mat, methodOrOptions?: number | { method?: number }): MatchLocResult | null;
641
+ function matchTemplate(image: Mat, templ: Mat, methodOrOptions?: number | { method?: number; mask?: Mat }): Mat | undefined;
642
+ function matchTemplateLoc(image: Mat, templ: Mat, methodOrOptions?: number | { method?: number }): MatchLocResult | undefined;
643
643
  ```
644
644
 
645
645
  **参数:**
@@ -668,7 +668,7 @@ cv.rectangle(src, {
668
668
  ### findContours
669
669
 
670
670
  ```typescript
671
- function findContours(mat: Mat, options?: { mode?: number; method?: number }): { contours: Point[][]; hierarchy: number[][] } | null;
671
+ function findContours(mat: Mat, options?: { mode?: number; method?: number }): { contours: Point[][]; hierarchy: number[][] } | undefined;
672
672
  ```
673
673
 
674
674
  **参数:**
@@ -692,12 +692,12 @@ logi(`count=${contours.length} h0=${hierarchy[0]}`);
692
692
  ### boundingRect / minAreaRect / contourArea / arcLength / approxPolyDP / convexHull
693
693
 
694
694
  ```typescript
695
- function boundingRect(matOrPoints: Mat | Point[]): Rect | null;
696
- function minAreaRect(points: Point[]): RotatedRect | null;
695
+ function boundingRect(matOrPoints: Mat | Point[]): Rect | undefined;
696
+ function minAreaRect(points: Point[]): RotatedRect | undefined;
697
697
  function contourArea(matOrPoints: Mat | Point[], orientedOrOptions?: boolean | { oriented?: boolean }): number;
698
698
  function arcLength(points: Point[], closedOrOptions?: boolean | { closed?: boolean; isClosed?: boolean }): number;
699
- function approxPolyDP(points: Point[], options: { epsilon?: number; closed?: boolean }): Point[] | null;
700
- function convexHull(points: Point[], options?: { clockwise?: boolean }): Point[] | null;
699
+ function approxPolyDP(points: Point[], options: { epsilon?: number; closed?: boolean }): Point[] | undefined;
700
+ function convexHull(points: Point[], options?: { clockwise?: boolean }): Point[] | undefined;
701
701
  ```
702
702
 
703
703
  **示例:**
@@ -716,9 +716,9 @@ for (const c of contours) {
716
716
  ### moments / matchShapes
717
717
 
718
718
  ```typescript
719
- function moments(mat: Mat, options?: { binaryImage?: boolean }): MomentsResult | null;
720
- function moments(mat: Mat, binaryImage?: boolean): MomentsResult | null;
721
- function moments(points: Point[]): MomentsResult | null;
719
+ function moments(mat: Mat, options?: { binaryImage?: boolean }): MomentsResult | undefined;
720
+ function moments(mat: Mat, binaryImage?: boolean): MomentsResult | undefined;
721
+ function moments(points: Point[]): MomentsResult | undefined;
722
722
  function matchShapes(contour1: Mat, contour2: Mat, options?: { method?: number; parameter?: number }): number;
723
723
  const cx = m.m10 / m.m00;
724
724
  const cy = m.m01 / m.m00;
@@ -728,7 +728,7 @@ const score = cv.matchShapes(c1, c2, { method: cv.CONTOURS_MATCH_I1 });
728
728
  ### erode / dilate / morphologyEx / getStructuringElement
729
729
 
730
730
  ```typescript
731
- function getStructuringElement(options: { shape?: number; ksize: number | [number, number] | Size }): Mat | null;
731
+ function getStructuringElement(options: { shape?: number; ksize: number | [number, number] | Size }): Mat | undefined;
732
732
  const opened = cv.morphologyEx(bin, { op: cv.MORPH_OPEN, kernel: k });
733
733
  cv.release(k);
734
734
  cv.release(opened);
@@ -739,26 +739,26 @@ cv.release(opened);
739
739
  ```typescript
740
740
  function connectedComponentsWithStats(mat: Mat): {
741
741
  count: number;
742
- labels: Mat | null;
743
- stats: Mat | null;
744
- centroids: Mat | null;
745
- } | null;
742
+ labels?: Mat;
743
+ stats?: Mat;
744
+ centroids?: Mat;
745
+ } | undefined;
746
746
 
747
- function distanceTransform(mat: Mat, options?: { distanceType?: number; maskSize?: number }): Mat | null;
747
+ function distanceTransform(mat: Mat, options?: { distanceType?: number; maskSize?: number }): Mat | undefined;
748
748
 
749
749
  function floodFill(mat: Mat, options: {
750
750
  seedPoint: Point | [number, number];
751
751
  newVal: number[] | string;
752
752
  loDiff?: number[] | string;
753
753
  upDiff?: number[] | string;
754
- }): { filled: number; rect: Rect } | null;
754
+ }): { filled: number; rect: Rect } | undefined;
755
755
 
756
756
  function goodFeaturesToTrack(mat: Mat, options: {
757
757
  maxCorners?: number;
758
758
  qualityLevel?: number;
759
759
  minDistance?: number;
760
760
  mask?: Mat;
761
- }): Point[] | null;
761
+ }): Point[] | undefined;
762
762
  ```
763
763
 
764
764
  **说明:**
@@ -789,13 +789,13 @@ const corners = cv.goodFeaturesToTrack(gray, {
789
789
  function HoughLinesP(mat: Mat, options: {
790
790
  rho?: number; theta?: number; threshold?: number;
791
791
  minLineLength?: number; maxLineGap?: number;
792
- }): Array<{ x1: number; y1: number; x2: number; y2: number }> | null;
792
+ }): Array<{ x1: number; y1: number; x2: number; y2: number }> | undefined;
793
793
 
794
794
  function HoughCircles(mat: Mat, options: {
795
795
  method?: number; dp?: number; minDist?: number;
796
796
  param1?: number; param2?: number;
797
797
  minRadius?: number; maxRadius?: number;
798
- }): Array<{ x: number; y: number; radius: number }> | null;
798
+ }): Array<{ x: number; y: number; radius: number }> | undefined;
799
799
  ```
800
800
 
801
801
  输入一般为边缘图(直线)或灰度图(圆)。`method` 常用 `cv.HOUGH_GRADIENT`。
@@ -832,10 +832,10 @@ const circles = cv.HoughCircles(gray, {
832
832
  ### add / subtract / multiply / divide
833
833
 
834
834
  ```typescript
835
- function add(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | null;
836
- function subtract(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | null;
837
- function multiply(src1: Mat, options: { src2: Mat; scale?: number }): Mat | null;
838
- function divide(src1: Mat, options: { src2: Mat; scale?: number }): Mat | null;
835
+ function add(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | undefined;
836
+ function subtract(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | undefined;
837
+ function multiply(src1: Mat, options: { src2: Mat; scale?: number }): Mat | undefined;
838
+ function divide(src1: Mat, options: { src2: Mat; scale?: number }): Mat | undefined;
839
839
  ```
840
840
 
841
841
  **示例:**
@@ -848,12 +848,12 @@ const scaled = cv.multiply(a, { src2: b, scale: 0.5 });
848
848
  ### normalize / norm / meanStdDev / findNonZero / hconcat / vconcat
849
849
 
850
850
  ```typescript
851
- function normalize(mat: Mat, options?: { alpha?: number; beta?: number; normType?: number }): Mat | null;
851
+ function normalize(mat: Mat, options?: { alpha?: number; beta?: number; normType?: number }): Mat | undefined;
852
852
  function norm(mat: Mat, options?: { normType?: number; mask?: Mat; src2?: Mat }): number;
853
- function meanStdDev(mat: Mat, options?: { mask?: Mat }): { mean: number[]; stddev: number[] } | null;
854
- function findNonZero(mat: Mat): Point[] | null;
855
- function hconcat(mats: Mat[]): Mat | null;
856
- function vconcat(mats: Mat[]): Mat | null;
853
+ function meanStdDev(mat: Mat, options?: { mask?: Mat }): { mean: number[]; stddev: number[] } | undefined;
854
+ function findNonZero(mat: Mat): Point[] | undefined;
855
+ function hconcat(mats: Mat[]): Mat | undefined;
856
+ function vconcat(mats: Mat[]): Mat | undefined;
857
857
  ```
858
858
 
859
859
  **示例:**
@@ -869,8 +869,8 @@ const side = cv.hconcat([left, right]);
869
869
  已知对应点求变换矩阵。透视 ≥4 点,仿射 ≥3 点。
870
870
 
871
871
  ```typescript
872
- function getPerspectiveTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | null;
873
- function getAffineTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | null;
872
+ function getPerspectiveTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | undefined;
873
+ function getAffineTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | undefined;
874
874
  ```
875
875
 
876
876
  **示例:**
@@ -888,8 +888,8 @@ cv.release(warped);
888
888
  ### FlannBasedMatcher / flannKnnMatch
889
889
 
890
890
  ```typescript
891
- function FlannBasedMatcher(queryDescriptors: Mat, trainDescriptors: Mat): DMatch[] | null;
892
- function flannKnnMatch(queryDescriptors: Mat, trainDescriptors: Mat, options?: { k?: number; ratio?: number }): DMatch[][] | null;
891
+ function FlannBasedMatcher(queryDescriptors: Mat, trainDescriptors: Mat): DMatch[] | undefined;
892
+ function flannKnnMatch(queryDescriptors: Mat, trainDescriptors: Mat, options?: { k?: number; ratio?: number }): DMatch[][] | undefined;
893
893
  ```
894
894
 
895
895
  SIFT 等浮点描述子可用 Flann;ORB 建议 `BFMatcher` + `NORM_HAMMING`。
@@ -904,7 +904,7 @@ const good = knn.map((g) => g[0]);
904
904
  ### calcHist / compareHist
905
905
 
906
906
  ```typescript
907
- function calcHist(mat: Mat, options?: { channels?: number[]; histSize?: number[]; ranges?: number[]; mask?: Mat; accumulate?: boolean }): Mat | null;
907
+ function calcHist(mat: Mat, options?: { channels?: number[]; histSize?: number[]; ranges?: number[]; mask?: Mat; accumulate?: boolean }): Mat | undefined;
908
908
  function compareHist(H1: Mat, H2: Mat, options?: { method?: number }): number;
909
909
  ```
910
910
 
@@ -922,9 +922,9 @@ cv.release(h1); cv.release(h2);
922
922
  ### encodeQRCode / detectQRCode / detectBarcode
923
923
 
924
924
  ```typescript
925
- function encodeQRCode(text: string): Mat | null;
926
- function detectQRCode(mat: Mat): { decoded: string; points: Point[] } | null;
927
- function detectBarcode(mat: Mat): { decoded: string[]; types: string[]; points: Point[] } | null;
925
+ function encodeQRCode(text: string): Mat | undefined;
926
+ function detectQRCode(mat: Mat): { decoded: string; points: Point[] } | undefined;
927
+ function detectBarcode(mat: Mat): { decoded: string[]; types: string[]; points: Point[] } | undefined;
928
928
  ```
929
929
 
930
930
  `encodeQRCode` 返回可显示/可识别的 BGR Mat(已放大并加静区),可直接交给 `detectQRCode`。
@@ -943,9 +943,9 @@ cv.release(qrMat);
943
943
  ### filter2D / ellipse / getTextSize
944
944
 
945
945
  ```typescript
946
- function filter2D(mat: Mat, options: { kernel: Mat; ddepth?: number; delta?: number }): Mat | null;
947
- function ellipse(mat: Mat, options: { center: Point; axes: Size | [number, number]; angle?: number; startAngle?: number; endAngle?: number; color?: number[] | string; thickness?: number }): Mat | null;
948
- function getTextSize(options: { text: string; fontFace?: number; fontScale?: number; thickness?: number }): { width: number; height: number; baseLine: number } | null;
946
+ function filter2D(mat: Mat, options: { kernel: Mat; ddepth?: number; delta?: number }): Mat | undefined;
947
+ function ellipse(mat: Mat, options: { center: Point; axes: Size | [number, number]; angle?: number; startAngle?: number; endAngle?: number; color?: number[] | string; thickness?: number }): Mat | undefined;
948
+ function getTextSize(options: { text: string; fontFace?: number; fontScale?: number; thickness?: number }): { width: number; height: number; baseLine: number } | undefined;
949
949
  ```
950
950
 
951
951
  `ellipse` 就地绘制;`thickness: cv.FILLED` 表示填充。
@@ -976,7 +976,7 @@ function getTextSize(options: { text: string; fontFace?: number; fontScale?: num
976
976
  | `distance` | number | 距离(越小越相似) |
977
977
 
978
978
  **FeatureResult:** `{ keypoints: KeyPoint[], descriptors: Mat | null }`
979
- 描述子是 Mat 句柄,用完需 `cv.release(descriptors)`。
979
+ 描述子是 Mat 句柄,用完需 `cv.release(descriptors)`。计算失败时 `descriptors` 为 `null`。
980
980
 
981
981
  ### SIFT
982
982
 
@@ -988,7 +988,7 @@ function SIFT(mat: Mat, options?: {
988
988
  edgeThreshold?: number;
989
989
  sigma?: number;
990
990
  mask?: Mat;
991
- }): FeatureResult | null;
991
+ }): FeatureResult | undefined;
992
992
  ```
993
993
 
994
994
  **参数:**
@@ -1003,7 +1003,7 @@ function SIFT(mat: Mat, options?: {
1003
1003
  | `sigma` | number | 否 | 1.6 | 第 0 层高斯 sigma |
1004
1004
  | `mask` | Mat | 否 | - | 可选 ROI 掩膜 |
1005
1005
 
1006
- **返回值:** `{ keypoints, descriptors }`;失败 `null`。
1006
+ **返回值:** `{ keypoints, descriptors }`;整次失败 `undefined`,描述子失败时 `descriptors` 为 `null`。
1007
1007
 
1008
1008
  **示例:**
1009
1009
 
@@ -1028,7 +1028,7 @@ function ORB(mat: Mat, options?: {
1028
1028
  scaleFactor?: number;
1029
1029
  nlevels?: number;
1030
1030
  mask?: Mat;
1031
- }): FeatureResult | null;
1031
+ }): FeatureResult | undefined;
1032
1032
  ```
1033
1033
 
1034
1034
  **参数:**
@@ -1061,7 +1061,7 @@ cv.release(b.descriptors);
1061
1061
  function BFMatcher(queryDescriptors: Mat, trainDescriptors: Mat, options?: {
1062
1062
  normType?: number;
1063
1063
  crossCheck?: boolean;
1064
- }): DMatch[] | null;
1064
+ }): DMatch[] | undefined;
1065
1065
  matches.sort((a, b) => a.distance - b.distance);
1066
1066
  const top = matches.slice(0, 30);
1067
1067
  ```
@@ -1073,7 +1073,7 @@ function knnMatch(queryDescriptors: Mat, trainDescriptors: Mat, options?: {
1073
1073
  k?: number;
1074
1074
  normType?: number;
1075
1075
  ratio?: number;
1076
- }): DMatch[][] | null;
1076
+ }): DMatch[][] | undefined;
1077
1077
  ```
1078
1078
 
1079
1079
  **参数:**
@@ -1104,13 +1104,13 @@ logi(`good matches=${good.length}`);
1104
1104
  ### drawKeypoints / drawMatches
1105
1105
 
1106
1106
  ```typescript
1107
- function drawKeypoints(mat: Mat, options: { keypoints: KeyPoint[]; color?: number[] | string }): Mat | null;
1107
+ function drawKeypoints(mat: Mat, options: { keypoints: KeyPoint[]; color?: number[] | string }): Mat | undefined;
1108
1108
  function drawMatches(img1: Mat, options: {
1109
1109
  img2: Mat;
1110
1110
  keypoints1: KeyPoint[];
1111
1111
  keypoints2: KeyPoint[];
1112
1112
  matches1to2: DMatch[];
1113
- }): Mat | null;
1113
+ }): Mat | undefined;
1114
1114
  cv.imwrite(`${file.getInternalDir("documents")}/matches.png`, vis);
1115
1115
  cv.release(vis);
1116
1116
  ```
@@ -1123,9 +1123,9 @@ function findHomography(options: {
1123
1123
  dstPoints: Point[];
1124
1124
  method?: number;
1125
1125
  ransacReprojThreshold?: number;
1126
- }): Mat | null;
1126
+ }): Mat | undefined;
1127
1127
 
1128
- function perspectiveTransform(points: Point[], options: { M: Mat }): Point[] | null;
1128
+ function perspectiveTransform(points: Point[], options: { M: Mat }): Point[] | undefined;
1129
1129
  const templ = cv.imread("logo.png");
1130
1130
  const g1 = cv.cvtColor(src, cv.COLOR_BGR2GRAY);
1131
1131
  const g2 = cv.cvtColor(templ, cv.COLOR_BGR2GRAY);
@@ -1183,7 +1183,7 @@ cv.release(f2.descriptors);
1183
1183
  ### inpaint
1184
1184
 
1185
1185
  ```typescript
1186
- function inpaint(mat: Mat, options: { mask: Mat; inpaintRadius?: number; flags?: number }): Mat | null;
1186
+ function inpaint(mat: Mat, options: { mask: Mat; inpaintRadius?: number; flags?: number }): Mat | undefined;
1187
1187
  ```
1188
1188
 
1189
1189
  | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
@@ -1201,10 +1201,10 @@ const out = cv.inpaint(src, { mask, flags: cv.INPAINT_TELEA });
1201
1201
  ```typescript
1202
1202
  function fastNlMeansDenoising(mat: Mat, options?: {
1203
1203
  h?: number; templateWindowSize?: number; searchWindowSize?: number;
1204
- }): Mat | null;
1204
+ }): Mat | undefined;
1205
1205
  function fastNlMeansDenoisingColored(mat: Mat, options?: {
1206
1206
  h?: number; hColor?: number; templateWindowSize?: number; searchWindowSize?: number;
1207
- }): Mat | null;
1207
+ }): Mat | undefined;
1208
1208
  ```
1209
1209
 
1210
1210
  ```javascript
@@ -1217,10 +1217,10 @@ const d2 = cv.fastNlMeansDenoisingColored(src, { h: 3, hColor: 3 });
1217
1217
  ### LUT / compare / min / max
1218
1218
 
1219
1219
  ```typescript
1220
- function LUT(mat: Mat, options: { lut: Mat }): Mat | null;
1221
- function compare(src1: Mat, options: { src2: Mat; cmpop: number }): Mat | null;
1222
- function min(src1: Mat, options: { src2: Mat }): Mat | null;
1223
- function max(src1: Mat, options: { src2: Mat }): Mat | null;
1220
+ function LUT(mat: Mat, options: { lut: Mat }): Mat | undefined;
1221
+ function compare(src1: Mat, options: { src2: Mat; cmpop: number }): Mat | undefined;
1222
+ function min(src1: Mat, options: { src2: Mat }): Mat | undefined;
1223
+ function max(src1: Mat, options: { src2: Mat }): Mat | undefined;
1224
1224
  ```
1225
1225
 
1226
1226
  `cmpop` 使用 `CMP_EQ` / `CMP_GT` / `CMP_GE` / `CMP_LT` / `CMP_LE` / `CMP_NE`。
@@ -1235,14 +1235,14 @@ const lo = cv.min(a, { src2: b });
1235
1235
  ### connectedComponents / convexityDefects / isContourConvex / fitLine / fitEllipse
1236
1236
 
1237
1237
  ```typescript
1238
- function connectedComponents(mat: Mat, options?: { connectivity?: number }): { count: number; labels: Mat } | null;
1238
+ function connectedComponents(mat: Mat, options?: { connectivity?: number }): { count: number; labels: Mat } | undefined;
1239
1239
  function convexityDefects(contour: Point[], options: { hull: number[] | Point[] }):
1240
- Array<{ start: number; end: number; farthest: number; depth: number }> | null;
1240
+ Array<{ start: number; end: number; farthest: number; depth: number }> | undefined;
1241
1241
  function isContourConvex(contour: Point[]): boolean;
1242
1242
  function fitLine(points: Point[], options?: {
1243
1243
  distType?: number; param?: number; reps?: number; aeps?: number;
1244
- }): [number, number, number, number] | null;
1245
- function fitEllipse(points: Point[]): RotatedRect | null;
1244
+ }): [number, number, number, number] | undefined;
1245
+ function fitEllipse(points: Point[]): RotatedRect | undefined;
1246
1246
  ```
1247
1247
 
1248
1248
  `hull` 可为索引数组,或与 `convexHull` 返回格式相同的 Point[]。`fitEllipse` 至少需要 5 个点。
@@ -1261,16 +1261,16 @@ cv.release(cc.labels);
1261
1261
  ```typescript
1262
1262
  function getRectSubPix(mat: Mat, options: {
1263
1263
  patchSize: Size | [number, number]; center: Point;
1264
- }): Mat | null;
1264
+ }): Mat | undefined;
1265
1265
  function phaseCorrelate(src1: Mat, options: { src2: Mat; window?: Mat }): {
1266
1266
  x: number; y: number; response?: number;
1267
- } | null;
1267
+ } | undefined;
1268
1268
  function estimateAffine2D(options: {
1269
1269
  srcPoints: Point[]; dstPoints: Point[]; method?: number; ransacReprojThreshold?: number;
1270
- }): Mat | null;
1270
+ }): Mat | undefined;
1271
1271
  function estimateAffinePartial2D(options: {
1272
1272
  srcPoints: Point[]; dstPoints: Point[]; method?: number; ransacReprojThreshold?: number;
1273
- }): Mat | null;
1273
+ }): Mat | undefined;
1274
1274
  ```
1275
1275
 
1276
1276
  `phaseCorrelate` 估计两帧位移(滚动/拖拽);`estimateAffinePartial2D` 为相似变换(平移+旋转+等比缩放)。
@@ -1286,11 +1286,11 @@ const M = cv.estimateAffinePartial2D({ srcPoints, dstPoints, method: cv.RANSAC }
1286
1286
  function drawMarker(mat: Mat, options: {
1287
1287
  position: Point; color?: number[] | string;
1288
1288
  markerType?: number; markerSize?: number; thickness?: number;
1289
- }): Mat | null;
1289
+ }): Mat | undefined;
1290
1290
  function arrowedLine(mat: Mat, options: {
1291
1291
  pt1: Point; pt2: Point; color?: number[] | string; thickness?: number; tipLength?: number;
1292
- }): Mat | null;
1293
- function fillConvexPoly(mat: Mat, options: { pts: Point[]; color?: number[] | string }): Mat | null;
1292
+ }): Mat | undefined;
1293
+ function fillConvexPoly(mat: Mat, options: { pts: Point[]; color?: number[] | string }): Mat | undefined;
1294
1294
  ```
1295
1295
 
1296
1296
  就地修改输入 Mat,返回同一句柄。适合调试标注匹配点、滑动方向等。
@@ -1337,6 +1337,6 @@ cv.fillConvexPoly(src, { pts: [{ x: 20, y: 20 }, { x: 70, y: 20 }, { x: 45, y: 6
1337
1337
  2. 路径 / msbundle / imageId / `screen` 只走 `imread`;其它 API 只接受 Mat 句柄。
1338
1338
  3. SIFT 描述子优先 `flannKnnMatch`;ORB 用 `BFMatcher` + `NORM_HAMMING`。
1339
1339
  4. 特征匹配前建议转灰度;大图可先 `pyrDown` / `resize`。
1340
- 5. `findHomography` 至少需要 4 对对应点,不足会返回 `null`。
1340
+ 5. `findHomography` 至少需要 4 对对应点,不足会返回 `undefined`。
1341
1341
  6. 绘制类、`floodFill` 会改原图或指定目标句柄;需保留原图请先 `clone`。
1342
1342
  7. 与 `image` 互通时,两边句柄各自 `release`。
package/docs/api/plist.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ### read - 读取整个 plist。
8
8
 
9
9
  ```typescript
10
- function read(path: string): any | null;
10
+ function read(path: string): any | undefined;
11
11
  ```
12
12
 
13
13
  **参数:**
@@ -60,7 +60,7 @@ plist.write(path, { name: "kuaijs" }, "binary");
60
60
  ### get - 按键读取。
61
61
 
62
62
  ```typescript
63
- function get(path: string, key: string | string[]): any | null;
63
+ function get(path: string, key: string | string[]): any | undefined;
64
64
  ```
65
65
 
66
66
  **参数:**