ms-types 0.10.17 → 0.10.19

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 (53) hide show
  1. package/package.json +1 -1
  2. package/types/ai.d.ts +16 -16
  3. package/types/config.d.ts +1 -1
  4. package/types/dotocr.d.ts +2 -2
  5. package/types/file.d.ts +12 -12
  6. package/types/hid.d.ts +1 -1
  7. package/types/hotUpdate.d.ts +2 -2
  8. package/types/http.d.ts +4 -4
  9. package/types/image.d.ts +13 -13
  10. package/types/index.d.ts +4 -0
  11. package/types/jbclear.d.ts +12 -12
  12. package/types/jbdevice.d.ts +25 -25
  13. package/types/jbdraw.d.ts +83 -0
  14. package/types/jbdylib.d.ts +5 -5
  15. package/types/jbpower.d.ts +67 -0
  16. package/types/jbshell.d.ts +2 -2
  17. package/types/jbsystem.d.ts +6 -6
  18. package/types/jbvpn.d.ts +8 -8
  19. package/types/lua/jbdraw.lua +47 -0
  20. package/types/lua/jbpower.lua +51 -0
  21. package/types/lua/netcard.lua +0 -15
  22. package/types/lua/sqlite.lua +87 -0
  23. package/types/lua/zipFile.lua +33 -0
  24. package/types/mysql.d.ts +4 -4
  25. package/types/netCard.d.ts +1 -22
  26. package/types/node.d.ts +4 -4
  27. package/types/opencv.d.ts +135 -135
  28. package/types/plist.d.ts +4 -4
  29. package/types/sqlite.d.ts +119 -0
  30. package/types/system.d.ts +2 -2
  31. package/types/thread.d.ts +2 -2
  32. package/types/tomatoocr.d.ts +1 -1
  33. package/types/yolo.d.ts +2 -2
  34. package/types/yoloCls.d.ts +2 -2
  35. package/types/zh/AI/346/250/241/345/235/227.d.ts +17 -17
  36. package/types/zh/HID/346/250/241/345/235/227.d.ts +2 -2
  37. package/types/zh/HTTP/346/250/241/345/235/227.d.ts +4 -4
  38. package/types/zh/MySql/346/250/241/345/235/227.d.ts +4 -4
  39. package/types/zh/SQLite/346/250/241/345/235/227.d.ts +129 -0
  40. package/types/zh/YOLO/345/210/206/347/261/273/346/250/241/345/235/227.d.ts +2 -2
  41. package/types/zh/YOLO/346/250/241/345/235/227.d.ts +2 -2
  42. package/types/zh/ZIP/346/250/241/345/235/227.d.ts +43 -0
  43. package/types/zh/index.d.ts +2 -0
  44. package/types/zh//345/215/241/345/257/206/346/250/241/345/235/227.d.ts +1 -22
  45. package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +13 -13
  46. package/types/zh//346/226/207/344/273/266/346/250/241/345/235/227.d.ts +12 -12
  47. package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +2 -2
  48. package/types/zh//347/203/255/346/233/264/346/226/260/346/250/241/345/235/227.d.ts +2 -2
  49. package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +3 -3
  50. package/types/zh//347/272/277/347/250/213/346/250/241/345/235/227.d.ts +2 -2
  51. package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +4 -4
  52. package/types/zh//351/205/215/347/275/256/346/250/241/345/235/227.d.ts +1 -1
  53. package/types/zipFile.d.ts +41 -0
package/types/opencv.d.ts CHANGED
@@ -249,7 +249,7 @@ declare namespace cv {
249
249
  y?: number,
250
250
  ex?: number,
251
251
  ey?: number,
252
- ): Mat | null;
252
+ ): Mat | undefined;
253
253
  /**
254
254
  * 读取图片为 Mat 句柄。`cv` 中**唯一**支持路径类输入的加载入口(与 `image.readImage` 同源):
255
255
  * msbundle/res 相对路径、手机绝对路径、`$MS_IMG$_…` imageId、`screen` / `shortcut` /
@@ -257,12 +257,12 @@ declare namespace cv {
257
257
  * 其它算子只接受 Mat 句柄。
258
258
  * @example cv.imread("/path/to/file.png")
259
259
  */
260
- function imread(path: string): Mat | null;
260
+ function imread(path: string): Mat | undefined;
261
261
  /**
262
262
  * 仅解码 base64 / data URI;路径与 imageId 请用 `imread`
263
263
  * @example cv.imdecode("data:image/png;base64,iVBORw0KGgo=")
264
264
  */
265
- function imdecode(data: string): Mat | null;
265
+ function imdecode(data: string): Mat | undefined;
266
266
  /**
267
267
  * 保存 Mat 到本地文件,格式由扩展名决定。
268
268
  * 可用 `png` / `apng` / `jpg` / `jpeg` / `jpe` / `bmp` / `dib` / `webp` /
@@ -275,37 +275,37 @@ declare namespace cv {
275
275
  * 编码为纯 base64;扩展名与通道限制同 `imwrite`,`quality` 取值 1–100(仅 jpg 有效)
276
276
  * @example cv.imencode(".png", cv.capture(), 90)
277
277
  */
278
- function imencode(ext: string, mat: Mat, quality?: number): string | null;
278
+ function imencode(ext: string, mat: Mat, quality?: number): string | undefined;
279
279
  /**
280
280
  * 从 imageId 转为 Mat 句柄
281
281
  * @example cv.fromImageId("screen")
282
282
  */
283
- function fromImageId(imageId: string): Mat | null;
283
+ function fromImageId(imageId: string): Mat | undefined;
284
284
  /**
285
285
  * Mat 句柄转为 imageId
286
286
  * @example cv.toImageId(cv.capture())
287
287
  */
288
- function toImageId(mat: Mat): string | null;
288
+ function toImageId(mat: Mat): string | undefined;
289
289
  /**
290
290
  * 创建 Mat
291
291
  * @example cv.Mat({ rows: 100, cols: 100, type: cv.CV_8UC3, scalar: [0, 0, 0] })
292
292
  */
293
- function Mat(options: { rows: number; cols: number; type?: number; scalar?: number[] }): Mat | null;
293
+ function Mat(options: { rows: number; cols: number; type?: number; scalar?: number[] }): Mat | undefined;
294
294
  /**
295
295
  * 创建全 0 Mat
296
296
  * @example cv.zeros({ rows: 100, cols: 100, type: cv.CV_8UC1 })
297
297
  */
298
- function zeros(options: { rows: number; cols: number; type?: number }): Mat | null;
298
+ function zeros(options: { rows: number; cols: number; type?: number }): Mat | undefined;
299
299
  /**
300
300
  * 创建全 1 Mat
301
301
  * @example cv.ones({ rows: 100, cols: 100, type: cv.CV_8UC1 })
302
302
  */
303
- function ones(options: { rows: number; cols: number; type?: number }): Mat | null;
303
+ function ones(options: { rows: number; cols: number; type?: number }): Mat | undefined;
304
304
  /**
305
305
  * 复制 Mat
306
306
  * @example cv.clone(cv.capture())
307
307
  */
308
- function clone(mat: Mat): Mat | null;
308
+ function clone(mat: Mat): Mat | undefined;
309
309
  /**
310
310
  * 判断 Mat 是否为空
311
311
  * @example cv.empty(cv.capture())
@@ -330,12 +330,12 @@ declare namespace cv {
330
330
  * 获取 Mat 宽高与类型
331
331
  * @example cv.getSize(cv.capture())
332
332
  */
333
- function getSize(mat: Mat): MatInfo | null;
333
+ function getSize(mat: Mat): MatInfo | undefined;
334
334
  /**
335
335
  * 读取指定像素
336
336
  * @example cv.at(cv.capture(), 10, 10)
337
337
  */
338
- function at(mat: Mat, row: number, col: number): number[] | null;
338
+ function at(mat: Mat, row: number, col: number): number[] | undefined;
339
339
  /**
340
340
  * 写入指定像素
341
341
  * @example cv.set(cv.capture(), { row: 10, col: 10, value: [0, 255, 0] })
@@ -345,230 +345,230 @@ declare namespace cv {
345
345
  * 复制为新的 Mat
346
346
  * @example cv.copyTo(cv.capture())
347
347
  */
348
- function copyTo(mat: Mat, mask?: Mat | null): Mat | null;
348
+ function copyTo(mat: Mat, mask?: Mat | null): Mat | undefined;
349
349
 
350
350
  // ---- 颜色 / 运算 ----
351
351
  /**
352
352
  * 源图通道必须和转换码一致,例如 `COLOR_BGR2GRAY` 要 3 通道。
353
353
  * @example cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY)
354
354
  */
355
- function cvtColor(mat: Mat, code: number): Mat | null;
355
+ function cvtColor(mat: Mat, code: number): Mat | undefined;
356
356
  /**
357
357
  * 阈值化
358
358
  * @example cv.threshold(cv.capture(), { thresh: 127, maxval: 255, type: cv.THRESH_BINARY })
359
359
  */
360
- function threshold(mat: Mat, options: ThresholdOptions): Mat | null;
360
+ function threshold(mat: Mat, options: ThresholdOptions): Mat | undefined;
361
361
  /**
362
362
  * 只接受 `CV_8UC1`。
363
363
  * @example cv.adaptiveThreshold(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { maxValue: 255, adaptiveMethod: cv.ADAPTIVE_THRESH_GAUSSIAN_C, thresholdType: cv.THRESH_BINARY, blockSize: 11, C: 2 })
364
364
  */
365
- function adaptiveThreshold(mat: Mat, options: AdaptiveThresholdOptions): Mat | null;
365
+ function adaptiveThreshold(mat: Mat, options: AdaptiveThresholdOptions): Mat | undefined;
366
366
  /**
367
367
  * 按颜色范围生成掩膜
368
368
  * @example cv.inRange(cv.capture(), { lowerb: [0, 0, 0], upperb: [50, 50, 50] })
369
369
  */
370
- function inRange(mat: Mat, options: InRangeOptions): Mat | null;
370
+ function inRange(mat: Mat, options: InRangeOptions): Mat | undefined;
371
371
  /**
372
372
  * 按位与
373
373
  * @example cv.bitwise_and(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
374
374
  */
375
- function bitwise_and(src1: Mat, options: BitwiseOptions): Mat | null;
375
+ function bitwise_and(src1: Mat, options: BitwiseOptions): Mat | undefined;
376
376
  /**
377
377
  * 按位或
378
378
  * @example cv.bitwise_or(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
379
379
  */
380
- function bitwise_or(src1: Mat, options: BitwiseOptions): Mat | null;
380
+ function bitwise_or(src1: Mat, options: BitwiseOptions): Mat | undefined;
381
381
  /**
382
382
  * 按位异或
383
383
  * @example cv.bitwise_xor(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
384
384
  */
385
- function bitwise_xor(src1: Mat, options: BitwiseOptions): Mat | null;
385
+ function bitwise_xor(src1: Mat, options: BitwiseOptions): Mat | undefined;
386
386
  /**
387
387
  * 按位取反
388
388
  * @example cv.bitwise_not(cv.capture())
389
389
  */
390
- function bitwise_not(mat: Mat, options?: { mask?: Mat }): Mat | null;
390
+ function bitwise_not(mat: Mat, options?: { mask?: Mat }): Mat | undefined;
391
391
  /**
392
392
  * 逐像素绝对差
393
393
  * @example cv.absdiff(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
394
394
  */
395
- function absdiff(src1: Mat, options: { src2: Mat }): Mat | null;
395
+ function absdiff(src1: Mat, options: { src2: Mat }): Mat | undefined;
396
396
  /**
397
397
  * 加权叠加
398
398
  * @example cv.addWeighted(cv.capture(), { src2: cv.imread("/path/to/tpl.png"), alpha: 0.5, beta: 0.5, gamma: 0 })
399
399
  */
400
- function addWeighted(src1: Mat, options: { src2: Mat; alpha?: number; beta?: number; gamma?: number }): Mat | null;
400
+ function addWeighted(src1: Mat, options: { src2: Mat; alpha?: number; beta?: number; gamma?: number }): Mat | undefined;
401
401
  /**
402
402
  * 缩放后取绝对值并转为 8 位
403
403
  * @example cv.convertScaleAbs(cv.capture(), { alpha: 1.2, beta: 10 })
404
404
  */
405
- function convertScaleAbs(mat: Mat, options?: { alpha?: number; beta?: number }): Mat | null;
405
+ function convertScaleAbs(mat: Mat, options?: { alpha?: number; beta?: number }): Mat | undefined;
406
406
  /**
407
407
  * 只接受单通道 Mat;多通道返回 `-1`。
408
408
  * @example cv.countNonZero(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY))
409
409
  */
410
410
  function countNonZero(mat: Mat): number;
411
411
  /**
412
- * 只接受单通道 Mat;多通道返回 `null`。可选 `mask` 必须是 `CV_8UC1`。
412
+ * 只接受单通道 Mat;多通道返回 `undefined`。可选 `mask` 必须是 `CV_8UC1`。
413
413
  * @example cv.minMaxLoc(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY))
414
414
  */
415
- function minMaxLoc(mat: Mat, options?: { mask?: Mat }): MinMaxLocResult | null;
415
+ function minMaxLoc(mat: Mat, options?: { mask?: Mat }): MinMaxLocResult | undefined;
416
416
  /**
417
417
  * 计算均值
418
418
  * @example cv.mean(cv.capture())
419
419
  */
420
- function mean(mat: Mat, options?: { mask?: Mat }): number[] | null;
420
+ function mean(mat: Mat, options?: { mask?: Mat }): number[] | undefined;
421
421
  /**
422
422
  * 分离通道
423
423
  * @example cv.split(cv.capture())
424
424
  */
425
- function split(mat: Mat): Mat[] | null;
425
+ function split(mat: Mat): Mat[] | undefined;
426
426
  /**
427
427
  * 合并通道
428
428
  * @example cv.merge(cv.split(cv.capture()))
429
429
  */
430
- function merge(channels: Mat[]): Mat | null;
430
+ function merge(channels: Mat[]): Mat | undefined;
431
431
 
432
432
  // ---- 滤波 / 边缘 ----
433
433
  /**
434
434
  * 高斯模糊
435
435
  * @example cv.GaussianBlur(cv.capture(), { ksize: 5, sigmaX: 1.5 })
436
436
  */
437
- function GaussianBlur(mat: Mat, options: BlurOptions): Mat | null;
437
+ function GaussianBlur(mat: Mat, options: BlurOptions): Mat | undefined;
438
438
  /**
439
439
  * 均值模糊
440
440
  * @example cv.blur(cv.capture(), { ksize: 5 })
441
441
  */
442
- function blur(mat: Mat, options: { ksize: number | [number, number] | Size }): Mat | null;
442
+ function blur(mat: Mat, options: { ksize: number | [number, number] | Size }): Mat | undefined;
443
443
  /**
444
444
  * 中值滤波
445
445
  * @example cv.medianBlur(cv.capture(), { ksize: 5 })
446
446
  */
447
- function medianBlur(mat: Mat, options: { ksize: number }): Mat | null;
447
+ function medianBlur(mat: Mat, options: { ksize: number }): Mat | undefined;
448
448
  /**
449
449
  * 只接受 1 或 3 通道,深度 `CV_8U` 或 `CV_32F`。
450
450
  * @example cv.bilateralFilter(cv.capture(), { d: 9, sigmaColor: 75, sigmaSpace: 75 })
451
451
  */
452
- function bilateralFilter(mat: Mat, options: { d?: number; sigmaColor?: number; sigmaSpace?: number }): Mat | null;
452
+ function bilateralFilter(mat: Mat, options: { d?: number; sigmaColor?: number; sigmaSpace?: number }): Mat | undefined;
453
453
  /**
454
454
  * 只接受 8 位图(`CV_8U`,1/3/4 通道均可)。
455
455
  * @example cv.Canny(cv.capture(), { threshold1: 100, threshold2: 200 })
456
456
  */
457
- function Canny(mat: Mat, options: CannyOptions): Mat | null;
457
+ function Canny(mat: Mat, options: CannyOptions): Mat | undefined;
458
458
  /**
459
459
  * Sobel 边缘
460
460
  * @example cv.Sobel(cv.capture(), { dx: 1, dy: 0, ksize: 3 })
461
461
  */
462
- function Sobel(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; ksize?: number; scale?: number; delta?: number }): Mat | null;
462
+ function Sobel(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; ksize?: number; scale?: number; delta?: number }): Mat | undefined;
463
463
  /**
464
464
  * Laplacian 边缘
465
465
  * @example cv.Laplacian(cv.capture(), { ksize: 3 })
466
466
  */
467
- function Laplacian(mat: Mat, options: { ddepth?: number; ksize?: number; scale?: number; delta?: number }): Mat | null;
467
+ function Laplacian(mat: Mat, options: { ddepth?: number; ksize?: number; scale?: number; delta?: number }): Mat | undefined;
468
468
  /**
469
469
  * 只接受 `CV_8UC1`。
470
470
  * @example cv.equalizeHist(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY))
471
471
  */
472
- function equalizeHist(mat: Mat): Mat | null;
472
+ function equalizeHist(mat: Mat): Mat | undefined;
473
473
 
474
474
  // ---- 几何 / 绘制 ----
475
475
  /**
476
476
  * 缩放
477
477
  * @example cv.resize(cv.capture(), { width: 200, height: 200 })
478
478
  */
479
- function resize(mat: Mat, options: ResizeOptions): Mat | null;
479
+ function resize(mat: Mat, options: ResizeOptions): Mat | undefined;
480
480
  /**
481
481
  * 裁剪
482
482
  * @example cv.crop(cv.capture(), { x: 10, y: 10, ex: 200, ey: 200 })
483
483
  */
484
- function crop(mat: Mat, options: CropOptions): Mat | null;
484
+ function crop(mat: Mat, options: CropOptions): Mat | undefined;
485
485
  /**
486
486
  * 旋转
487
487
  * @example cv.rotate(cv.capture(), cv.ROTATE_90_CLOCKWISE)
488
488
  */
489
- function rotate(mat: Mat, rotateCode: number): Mat | null;
489
+ function rotate(mat: Mat, rotateCode: number): Mat | undefined;
490
490
  /**
491
491
  * 翻转
492
492
  * @example cv.flip(cv.capture(), 1)
493
493
  */
494
- function flip(mat: Mat, flipCode: number): Mat | null;
494
+ function flip(mat: Mat, flipCode: number): Mat | undefined;
495
495
  /**
496
496
  * 扩展边界
497
497
  * @example cv.copyMakeBorder(cv.capture(), { top: 10, bottom: 10, left: 10, right: 10, borderType: cv.BORDER_CONSTANT })
498
498
  */
499
- function copyMakeBorder(mat: Mat, options: { top?: number; bottom?: number; left?: number; right?: number; borderType?: number; value?: number[] }): Mat | null;
499
+ function copyMakeBorder(mat: Mat, options: { top?: number; bottom?: number; left?: number; right?: number; borderType?: number; value?: number[] }): Mat | undefined;
500
500
  /**
501
501
  * 生成 2D 旋转矩阵
502
502
  * @example cv.getRotationMatrix2D({ center: { x: 100, y: 100 }, angle: 45, scale: 1 })
503
503
  */
504
- function getRotationMatrix2D(options: { center: Point | [number, number]; angle?: number; scale?: number }): Mat | null;
504
+ function getRotationMatrix2D(options: { center: Point | [number, number]; angle?: number; scale?: number }): Mat | undefined;
505
505
  /**
506
506
  * 仿射变换
507
507
  * @example cv.warpAffine(cv.capture(), { M: cv.getRotationMatrix2D({ center: { x: 100, y: 100 }, angle: 45, scale: 1 }), width: 200, height: 200 })
508
508
  */
509
- function warpAffine(mat: Mat, options: { M: Mat; width?: number; height?: number; flags?: number }): Mat | null;
509
+ function warpAffine(mat: Mat, options: { M: Mat; width?: number; height?: number; flags?: number }): Mat | undefined;
510
510
  /**
511
511
  * 就地绘制,返回同一句柄
512
512
  * @example cv.rectangle(cv.capture(), { pt1: { x: 10, y: 10 }, pt2: { x: 200, y: 200 }, color: [0, 0, 255], thickness: 2 })
513
513
  */
514
- function rectangle(mat: Mat, options: RectangleOptions): Mat | null;
514
+ function rectangle(mat: Mat, options: RectangleOptions): Mat | undefined;
515
515
  /**
516
516
  * 绘制圆
517
517
  * @example cv.circle(cv.capture(), { center: { x: 100, y: 100 }, radius: 40, color: [0, 0, 255], thickness: 2 })
518
518
  */
519
- function circle(mat: Mat, options: CircleOptions): Mat | null;
519
+ function circle(mat: Mat, options: CircleOptions): Mat | undefined;
520
520
  /**
521
521
  * 绘制直线
522
522
  * @example cv.line(cv.capture(), { pt1: { x: 10, y: 10 }, pt2: { x: 200, y: 200 }, color: [0, 0, 255], thickness: 2 })
523
523
  */
524
- function line(mat: Mat, options: LineOptions): Mat | null;
524
+ function line(mat: Mat, options: LineOptions): Mat | undefined;
525
525
  /**
526
526
  * 绘制文字
527
527
  * @example cv.putText(cv.capture(), { text: "hello", org: { x: 20, y: 40 }, fontScale: 1, color: [0, 0, 255] })
528
528
  */
529
- function putText(mat: Mat, options: PutTextOptions): Mat | null;
529
+ function putText(mat: Mat, options: PutTextOptions): Mat | undefined;
530
530
  /**
531
531
  * 填充多边形
532
532
  * @example cv.fillPoly(cv.capture(), { pts: [[{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }]], color: [0, 0, 255] })
533
533
  */
534
- function fillPoly(mat: Mat, options: { pts: Point[][] | Point[]; color?: number[] | string }): Mat | null;
534
+ function fillPoly(mat: Mat, options: { pts: Point[][] | Point[]; color?: number[] | string }): Mat | undefined;
535
535
  /**
536
536
  * 绘制折线
537
537
  * @example cv.polylines(cv.capture(), { pts: [[{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }]], isClosed: true, color: [0, 0, 255], thickness: 2 })
538
538
  */
539
- function polylines(mat: Mat, options: { pts: Point[][] | Point[]; isClosed?: boolean; color?: number[] | string; thickness?: number }): Mat | null;
539
+ function polylines(mat: Mat, options: { pts: Point[][] | Point[]; isClosed?: boolean; color?: number[] | string; thickness?: number }): Mat | undefined;
540
540
  /**
541
541
  * 绘制轮廓
542
542
  * @example cv.drawContours(cv.capture(), { contours: [[{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }]], color: [0, 0, 255], thickness: 2 })
543
543
  */
544
- function drawContours(mat: Mat, options: { contours: Point[][]; contourIdx?: number; color?: number[] | string; thickness?: number }): Mat | null;
544
+ function drawContours(mat: Mat, options: { contours: Point[][]; contourIdx?: number; color?: number[] | string; thickness?: number }): Mat | undefined;
545
545
 
546
546
  // ---- 匹配 / 轮廓 / 形态学 ----
547
547
  /**
548
548
  * 模板匹配,返回结果图
549
549
  * @example cv.matchTemplate(cv.capture(), cv.imread("/path/to/tpl.png"), { method: cv.TM_CCOEFF_NORMED })
550
550
  */
551
- function matchTemplate(image: Mat, templ: Mat, options?: MatchTemplateOptions): Mat | null;
551
+ function matchTemplate(image: Mat, templ: Mat, options?: MatchTemplateOptions): Mat | undefined;
552
552
  /**
553
553
  * 模板匹配,返回最佳位置
554
554
  * @example cv.matchTemplateLoc(cv.capture(), cv.imread("/path/to/tpl.png"), { method: cv.TM_CCOEFF_NORMED })
555
555
  */
556
- function matchTemplateLoc(image: Mat, templ: Mat, options?: MatchTemplateOptions): MatchLocResult | null;
556
+ function matchTemplateLoc(image: Mat, templ: Mat, options?: MatchTemplateOptions): MatchLocResult | undefined;
557
557
  /**
558
558
  * 查找轮廓
559
559
  * @example cv.findContours(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { mode: cv.RETR_EXTERNAL, method: cv.CHAIN_APPROX_SIMPLE })
560
560
  */
561
- function findContours(mat: Mat, options?: FindContoursOptions): { contours: Point[][]; hierarchy: number[][] } | null;
561
+ function findContours(mat: Mat, options?: FindContoursOptions): { contours: Point[][]; hierarchy: number[][] } | undefined;
562
562
  /**
563
563
  * 外接正矩形
564
564
  * @example cv.boundingRect([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
565
565
  */
566
- function boundingRect(matOrPoints: Mat | Point[]): Rect | null;
566
+ function boundingRect(matOrPoints: Mat | Point[]): Rect | undefined;
567
567
  /**
568
568
  * 最小外接旋转矩形
569
569
  * @example cv.minAreaRect([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
570
570
  */
571
- function minAreaRect(points: Point[]): RotatedRect | null;
571
+ function minAreaRect(points: Point[]): RotatedRect | undefined;
572
572
  /**
573
573
  * 轮廓面积
574
574
  * @example cv.contourArea([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], false)
@@ -583,27 +583,27 @@ declare namespace cv {
583
583
  * 多边形逼近
584
584
  * @example cv.approxPolyDP([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], { epsilon: 2, closed: true })
585
585
  */
586
- function approxPolyDP(points: Point[], options: { epsilon?: number; closed?: boolean }): Point[] | null;
586
+ function approxPolyDP(points: Point[], options: { epsilon?: number; closed?: boolean }): Point[] | undefined;
587
587
  /**
588
588
  * 腐蚀
589
589
  * @example cv.erode(cv.capture(), { kernel: cv.getStructuringElement({ shape: cv.MORPH_RECT, ksize: 3 }), iterations: 1 })
590
590
  */
591
- function erode(mat: Mat, options: MorphOptions): Mat | null;
591
+ function erode(mat: Mat, options: MorphOptions): Mat | undefined;
592
592
  /**
593
593
  * 膨胀
594
594
  * @example cv.dilate(cv.capture(), { kernel: cv.getStructuringElement({ shape: cv.MORPH_RECT, ksize: 3 }), iterations: 1 })
595
595
  */
596
- function dilate(mat: Mat, options: MorphOptions): Mat | null;
596
+ function dilate(mat: Mat, options: MorphOptions): Mat | undefined;
597
597
  /**
598
598
  * 形态学运算
599
599
  * @example cv.morphologyEx(cv.capture(), { op: cv.MORPH_OPEN, kernel: cv.getStructuringElement({ shape: cv.MORPH_RECT, ksize: 3 }) })
600
600
  */
601
- function morphologyEx(mat: Mat, options: MorphologyExOptions): Mat | null;
601
+ function morphologyEx(mat: Mat, options: MorphologyExOptions): Mat | undefined;
602
602
  /**
603
603
  * 生成形态学核
604
604
  * @example cv.getStructuringElement({ shape: cv.MORPH_RECT, ksize: 3 })
605
605
  */
606
- function getStructuringElement(options: StructuringElementOptions): Mat | null;
606
+ function getStructuringElement(options: StructuringElementOptions): Mat | undefined;
607
607
 
608
608
  // ---- 特征点 / 匹配 / 单应 ----
609
609
  interface KeyPoint {
@@ -624,7 +624,7 @@ declare namespace cv {
624
624
 
625
625
  interface FeatureResult {
626
626
  keypoints: KeyPoint[];
627
- /** 描述子 Mat 句柄;失败时可能为 null */
627
+ /** 描述子 Mat 句柄;计算失败时为 null */
628
628
  descriptors: Mat | null;
629
629
  }
630
630
 
@@ -743,9 +743,9 @@ declare namespace cv {
743
743
 
744
744
  interface ConnectedComponentsResult {
745
745
  count: number;
746
- labels: Mat | null;
747
- stats: Mat | null;
748
- centroids: Mat | null;
746
+ labels?: Mat;
747
+ stats?: Mat;
748
+ centroids?: Mat;
749
749
  }
750
750
 
751
751
  const NORM_L1: number;
@@ -776,113 +776,113 @@ declare namespace cv {
776
776
  * @example
777
777
  * const { keypoints, descriptors } = cv.SIFT(src, { nfeatures: 500 })
778
778
  */
779
- function SIFT(mat: Mat, options?: SIFTOptions): FeatureResult | null;
779
+ function SIFT(mat: Mat, options?: SIFTOptions): FeatureResult | undefined;
780
780
  /**
781
781
  * ORB 检测并计算描述子(二进制描述子,匹配常用 NORM_HAMMING)
782
782
  * @example cv.ORB(cv.capture(), { nfeatures: 500 })
783
783
  */
784
- function ORB(mat: Mat, options?: ORBOptions): FeatureResult | null;
784
+ function ORB(mat: Mat, options?: ORBOptions): FeatureResult | undefined;
785
785
  /** FAST 仅返回关键点(无描述子) */
786
786
  /**
787
787
  * 只接受 `CV_8UC1`。
788
788
  * @example cv.FAST(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { threshold: 20 })
789
789
  */
790
- function FAST(mat: Mat, options?: FASTOptions): { keypoints: KeyPoint[] } | null;
790
+ function FAST(mat: Mat, options?: FASTOptions): { keypoints: KeyPoint[] } | undefined;
791
791
 
792
792
  /**
793
793
  * 暴力匹配描述子,返回 DMatch 数组
794
794
  * @example cv.BFMatcher(cv.capture(), cv.imread("/path/to/tpl.png"), { normType: cv.NORM_HAMMING })
795
795
  */
796
- function BFMatcher(queryDescriptors: Mat, trainDescriptors: Mat, options?: MatcherOptions): DMatch[] | null;
796
+ function BFMatcher(queryDescriptors: Mat, trainDescriptors: Mat, options?: MatcherOptions): DMatch[] | undefined;
797
797
  /**
798
798
  * K 近邻匹配;可设 ratio 做 Lowe 筛选
799
799
  * @example cv.knnMatch(cv.capture(), cv.imread("/path/to/tpl.png"), { k: 2, ratio: 0.75 })
800
800
  */
801
- function knnMatch(queryDescriptors: Mat, trainDescriptors: Mat, options?: KnnMatchOptions): DMatch[][] | null;
801
+ function knnMatch(queryDescriptors: Mat, trainDescriptors: Mat, options?: KnnMatchOptions): DMatch[][] | undefined;
802
802
 
803
803
  /**
804
804
  * 绘制关键点,返回新 Mat 句柄
805
805
  * @example cv.drawKeypoints(cv.capture(), { keypoints: [{ x: 100, y: 100, size: 8 }], color: [0, 0, 255] })
806
806
  */
807
- function drawKeypoints(mat: Mat, options: DrawKeypointsOptions): Mat | null;
807
+ function drawKeypoints(mat: Mat, options: DrawKeypointsOptions): Mat | undefined;
808
808
  /**
809
809
  * 绘制匹配连线
810
810
  * @example cv.drawMatches(cv.capture(), { img2: cv.imread("/path/to/tpl.png"), keypoints1: [{ x: 40, y: 40, size: 8 }], keypoints2: [{ x: 80, y: 80, size: 8 }], matches: [{ queryIdx: 0, trainIdx: 0, distance: 0.1 }] })
811
811
  */
812
- function drawMatches(mat: Mat, options: DrawMatchesOptions): Mat | null;
812
+ function drawMatches(mat: Mat, options: DrawMatchesOptions): Mat | undefined;
813
813
 
814
814
  /**
815
815
  * 计算单应矩阵,返回 3x3 Mat 句柄
816
816
  * @example cv.findHomography({ srcPoints: [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], dstPoints: [{ x: 10, y: 10 }, { x: 110, y: 10 }, { x: 60, y: 110 }] })
817
817
  */
818
- function findHomography(options: FindHomographyOptions): Mat | null;
818
+ function findHomography(options: FindHomographyOptions): Mat | undefined;
819
819
  /**
820
820
  * 透视变换图像
821
821
  * @example cv.warpPerspective(cv.capture(), { M: cv.getPerspectiveTransform({ srcPoints: [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], dstPoints: [{ x: 0, y: 0 }, { x: 200, y: 0 }, { x: 100, y: 200 }] }), width: 200, height: 200 })
822
822
  */
823
- function warpPerspective(mat: Mat, options: WarpPerspectiveOptions): Mat | null;
823
+ function warpPerspective(mat: Mat, options: WarpPerspectiveOptions): Mat | undefined;
824
824
  /**
825
825
  * 用单应矩阵变换点集
826
826
  * @example cv.perspectiveTransform([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], { M: cv.getPerspectiveTransform({ srcPoints: [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], dstPoints: [{ x: 0, y: 0 }, { x: 200, y: 0 }, { x: 100, y: 200 }] }) })
827
827
  */
828
- function perspectiveTransform(points: Point[], options: { M: Mat }): Point[] | null;
828
+ function perspectiveTransform(points: Point[], options: { M: Mat }): Point[] | undefined;
829
829
 
830
830
  /**
831
831
  * Shi-Tomasi 角点
832
832
  * @example cv.goodFeaturesToTrack(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { maxCorners: 50, qualityLevel: 0.01, minDistance: 10 })
833
833
  */
834
- function goodFeaturesToTrack(mat: Mat, options: GoodFeaturesOptions): Point[] | null;
834
+ function goodFeaturesToTrack(mat: Mat, options: GoodFeaturesOptions): Point[] | undefined;
835
835
  /**
836
836
  * 概率霍夫直线,返回 {x1,y1,x2,y2}[]
837
837
  * @example cv.HoughLinesP(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { rho: 1, theta: 3.14 / 180, threshold: 50 })
838
838
  */
839
- function HoughLinesP(mat: Mat, options: HoughLinesPOptions): Array<{ x1: number; y1: number; x2: number; y2: number }> | null;
839
+ function HoughLinesP(mat: Mat, options: HoughLinesPOptions): Array<{ x1: number; y1: number; x2: number; y2: number }> | undefined;
840
840
  /**
841
841
  * 霍夫圆,返回 {x,y,radius}[]
842
842
  * @example cv.HoughCircles(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { dp: 1, minDist: 20 })
843
843
  */
844
- function HoughCircles(mat: Mat, options: HoughCirclesOptions): Array<{ x: number; y: number; radius: number }> | null;
844
+ function HoughCircles(mat: Mat, options: HoughCirclesOptions): Array<{ x: number; y: number; radius: number }> | undefined;
845
845
 
846
846
  /**
847
847
  * CLAHE 对比度受限自适应直方图均衡
848
848
  * @example cv.CLAHE(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { clipLimit: 2.0, tileGridSize: [8, 8] })
849
849
  */
850
- function CLAHE(mat: Mat, options?: CLAHEOptions): Mat | null;
850
+ function CLAHE(mat: Mat, options?: CLAHEOptions): Mat | undefined;
851
851
  /**
852
852
  * 高斯金字塔向下采样
853
853
  * @example cv.pyrDown(cv.capture())
854
854
  */
855
- function pyrDown(mat: Mat): Mat | null;
855
+ function pyrDown(mat: Mat): Mat | undefined;
856
856
  /**
857
857
  * 高斯金字塔向上采样
858
858
  * @example cv.pyrUp(cv.capture())
859
859
  */
860
- function pyrUp(mat: Mat): Mat | null;
860
+ function pyrUp(mat: Mat): Mat | undefined;
861
861
  /**
862
862
  * Scharr 导数
863
863
  * @example cv.Scharr(cv.capture(), { dx: 1, dy: 0 })
864
864
  */
865
- function Scharr(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; scale?: number; delta?: number }): Mat | null;
865
+ function Scharr(mat: Mat, options: { ddepth?: number; dx?: number; dy?: number; scale?: number; delta?: number }): Mat | undefined;
866
866
  /**
867
867
  * 方框滤波
868
868
  * @example cv.boxFilter(cv.capture(), { ksize: 5 })
869
869
  */
870
- function boxFilter(mat: Mat, options: { ksize: number | [number, number] | Size; ddepth?: number }): Mat | null;
870
+ function boxFilter(mat: Mat, options: { ksize: number | [number, number] | Size; ddepth?: number }): Mat | undefined;
871
871
  /**
872
872
  * 就地洪水填充,返回填充像素数与外接矩形
873
873
  * @example cv.floodFill(cv.capture(), { seedPoint: { x: 10, y: 10 }, newVal: [0, 0, 255] })
874
874
  */
875
- function floodFill(mat: Mat, options: FloodFillOptions): { filled: number; rect: Rect } | null;
875
+ function floodFill(mat: Mat, options: FloodFillOptions): { filled: number; rect: Rect } | undefined;
876
876
  /**
877
877
  * 凸包
878
878
  * @example cv.convexHull([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
879
879
  */
880
- function convexHull(points: Point[], options?: { clockwise?: boolean }): Point[] | null;
880
+ function convexHull(points: Point[], options?: { clockwise?: boolean }): Point[] | undefined;
881
881
  /**
882
882
  * Mat 输入必须是单通道栅格或 2 通道点集。
883
883
  * @example cv.moments([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
884
884
  */
885
- function moments(matOrPoints: Mat | Point[], options?: { binaryImage?: boolean }): MomentsResult | null;
885
+ function moments(matOrPoints: Mat | Point[], options?: { binaryImage?: boolean }): MomentsResult | undefined;
886
886
  /**
887
887
  * 轮廓形状匹配
888
888
  * @example cv.matchShapes([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
@@ -892,39 +892,39 @@ declare namespace cv {
892
892
  * 连通域及统计
893
893
  * @example cv.connectedComponentsWithStats(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY))
894
894
  */
895
- function connectedComponentsWithStats(mat: Mat): ConnectedComponentsResult | null;
895
+ function connectedComponentsWithStats(mat: Mat): ConnectedComponentsResult | undefined;
896
896
  /**
897
897
  * 距离变换
898
898
  * @example cv.distanceTransform(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY))
899
899
  */
900
- function distanceTransform(mat: Mat, options?: { distanceType?: number; maskSize?: number }): Mat | null;
900
+ function distanceTransform(mat: Mat, options?: { distanceType?: number; maskSize?: number }): Mat | undefined;
901
901
 
902
902
  // ---- 算术 / 归一化 / 拼接 ----
903
903
  /**
904
904
  * 逐像素相加
905
905
  * @example cv.add(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
906
906
  */
907
- function add(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | null;
907
+ function add(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | undefined;
908
908
  /**
909
909
  * 逐像素相减
910
910
  * @example cv.subtract(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
911
911
  */
912
- function subtract(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | null;
912
+ function subtract(src1: Mat, options: { src2: Mat; mask?: Mat }): Mat | undefined;
913
913
  /**
914
914
  * 逐像素相乘
915
915
  * @example cv.multiply(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
916
916
  */
917
- function multiply(src1: Mat, options: { src2: Mat; scale?: number }): Mat | null;
917
+ function multiply(src1: Mat, options: { src2: Mat; scale?: number }): Mat | undefined;
918
918
  /**
919
919
  * 逐像素相除
920
920
  * @example cv.divide(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
921
921
  */
922
- function divide(src1: Mat, options: { src2: Mat; scale?: number }): Mat | null;
922
+ function divide(src1: Mat, options: { src2: Mat; scale?: number }): Mat | undefined;
923
923
  /**
924
924
  * 归一化
925
925
  * @example cv.normalize(cv.capture(), { alpha: 0, beta: 255, normType: cv.NORM_MINMAX })
926
926
  */
927
- function normalize(mat: Mat, options?: { alpha?: number; beta?: number; normType?: number }): Mat | null;
927
+ function normalize(mat: Mat, options?: { alpha?: number; beta?: number; normType?: number }): Mat | undefined;
928
928
  /**
929
929
  * 计算范数
930
930
  * @example cv.norm(cv.capture())
@@ -934,46 +934,46 @@ declare namespace cv {
934
934
  * 均值与标准差
935
935
  * @example cv.meanStdDev(cv.capture())
936
936
  */
937
- function meanStdDev(mat: Mat, options?: { mask?: Mat }): { mean: number[]; stddev: number[] } | null;
937
+ function meanStdDev(mat: Mat, options?: { mask?: Mat }): { mean: number[]; stddev: number[] } | undefined;
938
938
  /**
939
939
  * 非零像素坐标
940
940
  * @example cv.findNonZero(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY))
941
941
  */
942
- function findNonZero(mat: Mat): Point[] | null;
942
+ function findNonZero(mat: Mat): Point[] | undefined;
943
943
  /**
944
944
  * 水平拼接
945
945
  * @example cv.hconcat([cv.capture(), cv.imread("/path/to/tpl.png")])
946
946
  */
947
- function hconcat(mats: Mat[]): Mat | null;
947
+ function hconcat(mats: Mat[]): Mat | undefined;
948
948
  /**
949
949
  * 垂直拼接
950
950
  * @example cv.vconcat([cv.capture(), cv.imread("/path/to/tpl.png")])
951
951
  */
952
- function vconcat(mats: Mat[]): Mat | null;
952
+ function vconcat(mats: Mat[]): Mat | undefined;
953
953
 
954
954
  // ---- 已知点变换矩阵 ----
955
955
  /**
956
956
  * 生成透视变换矩阵
957
957
  * @example cv.getPerspectiveTransform({ srcPoints: [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], dstPoints: [{ x: 0, y: 0 }, { x: 200, y: 0 }, { x: 100, y: 200 }] })
958
958
  */
959
- function getPerspectiveTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | null;
959
+ function getPerspectiveTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | undefined;
960
960
  /**
961
961
  * 生成仿射变换矩阵
962
962
  * @example cv.getAffineTransform({ srcPoints: [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 0, y: 100 }], dstPoints: [{ x: 10, y: 10 }, { x: 110, y: 10 }, { x: 10, y: 110 }] })
963
963
  */
964
- function getAffineTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | null;
964
+ function getAffineTransform(options: { srcPoints: Point[]; dstPoints: Point[] }): Mat | undefined;
965
965
 
966
966
  // ---- Flann(SIFT 推荐,与 image 找图同源)----
967
967
  /**
968
968
  * FLANN 匹配描述子
969
969
  * @example cv.FlannBasedMatcher(cv.capture(), cv.imread("/path/to/tpl.png"))
970
970
  */
971
- function FlannBasedMatcher(queryDescriptors: Mat, trainDescriptors: Mat): DMatch[] | null;
971
+ function FlannBasedMatcher(queryDescriptors: Mat, trainDescriptors: Mat): DMatch[] | undefined;
972
972
  /**
973
973
  * FLANN K 近邻匹配
974
974
  * @example cv.flannKnnMatch(cv.capture(), cv.imread("/path/to/tpl.png"), { k: 2, ratio: 0.75 })
975
975
  */
976
- function flannKnnMatch(queryDescriptors: Mat, trainDescriptors: Mat, options?: { k?: number; ratio?: number }): DMatch[][] | null;
976
+ function flannKnnMatch(queryDescriptors: Mat, trainDescriptors: Mat, options?: { k?: number; ratio?: number }): DMatch[][] | undefined;
977
977
 
978
978
  // ---- 直方图 ----
979
979
  /**
@@ -986,7 +986,7 @@ declare namespace cv {
986
986
  ranges?: number[];
987
987
  mask?: Mat;
988
988
  accumulate?: boolean;
989
- }): Mat | null;
989
+ }): Mat | undefined;
990
990
  /**
991
991
  * 比较直方图
992
992
  * @example cv.compareHist(cv.capture(), cv.imread("/path/to/tpl.png"), { method: cv.HISTCMP_CORREL })
@@ -998,7 +998,7 @@ declare namespace cv {
998
998
  * 旋转矩形的四个顶点
999
999
  * @example cv.boxPoints({ center: { x: 100, y: 100 }, size: { width: 80, height: 40 }, angle: 15 })
1000
1000
  */
1001
- function boxPoints(options: { center: Point; size: Size | [number, number]; angle?: number }): Point[] | null;
1001
+ function boxPoints(options: { center: Point; size: Size | [number, number]; angle?: number }): Point[] | undefined;
1002
1002
  /**
1003
1003
  * 点与轮廓位置关系
1004
1004
  * @example cv.pointPolygonTest([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], { pt: { x: 150, y: 120 }, measureDist: true })
@@ -1008,17 +1008,17 @@ declare namespace cv {
1008
1008
  * 最小外接圆
1009
1009
  * @example cv.minEnclosingCircle([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
1010
1010
  */
1011
- function minEnclosingCircle(points: Point[]): { center: Point; radius: number } | null;
1011
+ function minEnclosingCircle(points: Point[]): { center: Point; radius: number } | undefined;
1012
1012
  /**
1013
1013
  * 椭圆拟合,至少 5 个点;可用于圆形/椭圆控件轮廓
1014
1014
  * @example cv.fitEllipse([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
1015
1015
  */
1016
- function fitEllipse(points: Point[]): RotatedRect | null;
1016
+ function fitEllipse(points: Point[]): RotatedRect | undefined;
1017
1017
  /**
1018
1018
  * 二维卷积
1019
1019
  * @example cv.filter2D(cv.capture(), { kernel: cv.getStructuringElement({ shape: cv.MORPH_RECT, ksize: 3 }) })
1020
1020
  */
1021
- function filter2D(mat: Mat, options: { kernel: Mat; ddepth?: number; delta?: number }): Mat | null;
1021
+ function filter2D(mat: Mat, options: { kernel: Mat; ddepth?: number; delta?: number }): Mat | undefined;
1022
1022
  /**
1023
1023
  * 绘制椭圆
1024
1024
  * @example cv.ellipse(cv.capture(), { center: { x: 100, y: 100 }, axes: { width: 60, height: 40 }, angle: 0, color: [0, 0, 255], thickness: 2 })
@@ -1031,7 +1031,7 @@ declare namespace cv {
1031
1031
  endAngle?: number;
1032
1032
  color?: number[] | string;
1033
1033
  thickness?: number;
1034
- }): Mat | null;
1034
+ }): Mat | undefined;
1035
1035
  /**
1036
1036
  * 计算文字尺寸
1037
1037
  * @example cv.getTextSize({ text: "hello", fontScale: 1, thickness: 2 })
@@ -1041,103 +1041,103 @@ declare namespace cv {
1041
1041
  fontFace?: number;
1042
1042
  fontScale?: number;
1043
1043
  thickness?: number;
1044
- }): { width: number; height: number; baseLine: number } | null;
1044
+ }): { width: number; height: number; baseLine: number } | undefined;
1045
1045
 
1046
1046
  // ---- QR / 条码 ----
1047
1047
  /**
1048
1048
  * 编码二维码为可显示/可识别的 BGR Mat(已放大并加静区,可直接 detectQRCode)
1049
1049
  * @example cv.encodeQRCode("https://example.com")
1050
1050
  */
1051
- function encodeQRCode(text: string): Mat | null;
1051
+ function encodeQRCode(text: string): Mat | undefined;
1052
1052
  /**
1053
1053
  * 检测二维码
1054
1054
  * @example cv.detectQRCode(cv.capture())
1055
1055
  */
1056
- function detectQRCode(mat: Mat): { decoded: string; points: Point[] } | null;
1056
+ function detectQRCode(mat: Mat): { decoded: string; points: Point[] } | undefined;
1057
1057
  /**
1058
1058
  * 检测条码
1059
1059
  * @example cv.detectBarcode(cv.capture())
1060
1060
  */
1061
- function detectBarcode(mat: Mat): { decoded: string[]; types: string[]; points: Point[] } | null;
1061
+ function detectBarcode(mat: Mat): { decoded: string[]; types: string[]; points: Point[] } | undefined;
1062
1062
 
1063
1063
  // ---- Photo ----
1064
1064
  /**
1065
1065
  * 图像修复
1066
1066
  * @example cv.inpaint(cv.capture(), { mask: cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), inpaintRadius: 3 })
1067
1067
  */
1068
- function inpaint(mat: Mat, options: { mask: Mat; inpaintRadius?: number; flags?: number }): Mat | null;
1068
+ function inpaint(mat: Mat, options: { mask: Mat; inpaintRadius?: number; flags?: number }): Mat | undefined;
1069
1069
  /**
1070
1070
  * 非局部均值去噪(灰度)
1071
1071
  * @example cv.fastNlMeansDenoising(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { h: 3 })
1072
1072
  */
1073
1073
  function fastNlMeansDenoising(mat: Mat, options?: {
1074
1074
  h?: number; templateWindowSize?: number; searchWindowSize?: number;
1075
- }): Mat | null;
1075
+ }): Mat | undefined;
1076
1076
  /**
1077
1077
  * 非局部均值去噪(彩色)
1078
1078
  * @example cv.fastNlMeansDenoisingColored(cv.capture(), { h: 3, hColor: 3 })
1079
1079
  */
1080
1080
  function fastNlMeansDenoisingColored(mat: Mat, options?: {
1081
1081
  h?: number; hColor?: number; templateWindowSize?: number; searchWindowSize?: number;
1082
- }): Mat | null;
1082
+ }): Mat | undefined;
1083
1083
 
1084
1084
  // ---- Core 扩展 ----
1085
1085
  /**
1086
1086
  * 查找表映射
1087
1087
  * @example cv.LUT(cv.capture(), { lut: cv.Mat({ rows: 1, cols: 256, type: cv.CV_8UC1 }) })
1088
1088
  */
1089
- function LUT(mat: Mat, options: { lut: Mat }): Mat | null;
1089
+ function LUT(mat: Mat, options: { lut: Mat }): Mat | undefined;
1090
1090
  /**
1091
1091
  * 逐像素比较
1092
1092
  * @example cv.compare(cv.capture(), { src2: cv.imread("/path/to/tpl.png"), cmpop: cv.CMP_EQ })
1093
1093
  */
1094
- function compare(src1: Mat, options: { src2: Mat; cmpop: number }): Mat | null;
1094
+ function compare(src1: Mat, options: { src2: Mat; cmpop: number }): Mat | undefined;
1095
1095
  /**
1096
1096
  * 逐像素取较小值
1097
1097
  * @example cv.min(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
1098
1098
  */
1099
- function min(src1: Mat, options: { src2: Mat }): Mat | null;
1099
+ function min(src1: Mat, options: { src2: Mat }): Mat | undefined;
1100
1100
  /**
1101
1101
  * 逐像素取较大值
1102
1102
  * @example cv.max(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
1103
1103
  */
1104
- function max(src1: Mat, options: { src2: Mat }): Mat | null;
1104
+ function max(src1: Mat, options: { src2: Mat }): Mat | undefined;
1105
1105
  /**
1106
1106
  * 提取指定通道
1107
1107
  * @example cv.extractChannel(cv.capture(), { coi: 0 })
1108
1108
  */
1109
- function extractChannel(mat: Mat, options: { coi: number }): Mat | null;
1109
+ function extractChannel(mat: Mat, options: { coi: number }): Mat | undefined;
1110
1110
  /**
1111
1111
  * 像素求和
1112
1112
  * @example cv.sum(cv.capture())
1113
1113
  */
1114
- function sum(mat: Mat): number[] | null;
1114
+ function sum(mat: Mat): number[] | undefined;
1115
1115
 
1116
1116
  // ---- Imgproc 几何 / 滤波扩展 ----
1117
1117
  /**
1118
1118
  * 反转仿射矩阵
1119
1119
  * @example cv.invertAffineTransform(cv.getAffineTransform({ srcPoints: [{ x: 0, y: 0 }, { x: 100, y: 0 }, { x: 0, y: 100 }], dstPoints: [{ x: 10, y: 10 }, { x: 110, y: 10 }, { x: 10, y: 110 }] }))
1120
1120
  */
1121
- function invertAffineTransform(M: Mat): Mat | null;
1121
+ function invertAffineTransform(M: Mat): Mat | undefined;
1122
1122
  /**
1123
1123
  * 亚像素精度取块
1124
1124
  * @example cv.getRectSubPix(cv.capture(), { patchSize: { width: 32, height: 32 }, center: { x: 100, y: 100 } })
1125
1125
  */
1126
1126
  function getRectSubPix(mat: Mat, options: {
1127
1127
  patchSize: Size | [number, number]; center: Point;
1128
- }): Mat | null;
1128
+ }): Mat | undefined;
1129
1129
  /**
1130
1130
  * 相位相关估计两图位移(如滚动/拖拽前后帧)
1131
1131
  * @example cv.phaseCorrelate(cv.capture(), { src2: cv.imread("/path/to/tpl.png") })
1132
1132
  */
1133
1133
  function phaseCorrelate(src1: Mat, options: { src2: Mat; window?: Mat }): {
1134
1134
  x: number; y: number; response?: number;
1135
- } | null;
1135
+ } | undefined;
1136
1136
  /**
1137
1137
  * Harris 角点
1138
1138
  * @example cv.cornerHarris(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { blockSize: 2, ksize: 3, k: 0.04 })
1139
1139
  */
1140
- function cornerHarris(mat: Mat, options?: { blockSize?: number; ksize?: number; k?: number }): Mat | null;
1140
+ function cornerHarris(mat: Mat, options?: { blockSize?: number; ksize?: number; k?: number }): Mat | undefined;
1141
1141
  /**
1142
1142
  * 角点亚像素精修
1143
1143
  * @example cv.cornerSubPix(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY), { corners: [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], winSize: { width: 5, height: 5 } })
@@ -1147,33 +1147,33 @@ declare namespace cv {
1147
1147
  winSize?: Size | [number, number];
1148
1148
  zeroZone?: Size | [number, number];
1149
1149
  criteria?: { type?: number; maxCount?: number; epsilon?: number };
1150
- }): Point[] | null;
1150
+ }): Point[] | undefined;
1151
1151
  /**
1152
1152
  * 直方图反向投影
1153
1153
  * @example cv.calcBackProject(cv.capture(), { hist: cv.calcHist(cv.capture(), { channels: [0], histSize: [256], ranges: [0, 256] }), channels: [0], ranges: [0, 256] })
1154
1154
  */
1155
1155
  function calcBackProject(mat: Mat, options: {
1156
1156
  hist: Mat; channels?: number[]; ranges?: number[]; scale?: number;
1157
- }): Mat | null;
1157
+ }): Mat | undefined;
1158
1158
  /**
1159
1159
  * Hu 矩
1160
1160
  * @example cv.HuMoments([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
1161
1161
  */
1162
- function HuMoments(contourOrMoments: Point[] | MomentsResult): number[] | null;
1162
+ function HuMoments(contourOrMoments: Point[] | MomentsResult): number[] | undefined;
1163
1163
  /**
1164
1164
  * 连通域标记
1165
1165
  * @example cv.connectedComponents(cv.cvtColor(cv.capture(), cv.COLOR_BGR2GRAY))
1166
1166
  */
1167
1167
  function connectedComponents(mat: Mat, options?: { connectivity?: number }): {
1168
1168
  count: number; labels: Mat;
1169
- } | null;
1169
+ } | undefined;
1170
1170
  /**
1171
1171
  * 凸缺陷
1172
1172
  * @example cv.convexityDefects([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], { hull: cv.convexHull([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }]) })
1173
1173
  */
1174
1174
  function convexityDefects(contour: Point[], options: {
1175
1175
  hull: number[] | Point[];
1176
- }): Array<{ start: number; end: number; farthest: number; depth: number }> | null;
1176
+ }): Array<{ start: number; end: number; farthest: number; depth: number }> | undefined;
1177
1177
  /**
1178
1178
  * 判断轮廓是否凸
1179
1179
  * @example cv.isContourConvex([{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }])
@@ -1185,7 +1185,7 @@ declare namespace cv {
1185
1185
  */
1186
1186
  function fitLine(points: Point[], options?: {
1187
1187
  distType?: number; param?: number; reps?: number; aeps?: number;
1188
- }): [number, number, number, number] | null;
1188
+ }): [number, number, number, number] | undefined;
1189
1189
 
1190
1190
  /**
1191
1191
  * 就地绘制标记点,返回原句柄
@@ -1194,21 +1194,21 @@ declare namespace cv {
1194
1194
  function drawMarker(mat: Mat, options: {
1195
1195
  position: Point; color?: number[] | string;
1196
1196
  markerType?: number; markerSize?: number; thickness?: number;
1197
- }): Mat | null;
1197
+ }): Mat | undefined;
1198
1198
  /**
1199
1199
  * 就地画箭头线,返回原句柄
1200
1200
  * @example cv.arrowedLine(cv.capture(), { pt1: { x: 10, y: 10 }, pt2: { x: 200, y: 200 }, color: [0, 0, 255] })
1201
1201
  */
1202
1202
  function arrowedLine(mat: Mat, options: {
1203
1203
  pt1: Point; pt2: Point; color?: number[] | string; thickness?: number; tipLength?: number;
1204
- }): Mat | null;
1204
+ }): Mat | undefined;
1205
1205
  /**
1206
1206
  * 就地填充凸多边形,返回原句柄
1207
1207
  * @example cv.fillConvexPoly(cv.capture(), { pts: [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], color: [0, 0, 255] })
1208
1208
  */
1209
1209
  function fillConvexPoly(mat: Mat, options: {
1210
1210
  pts: Point[]; color?: number[] | string;
1211
- }): Mat | null;
1211
+ }): Mat | undefined;
1212
1212
 
1213
1213
  // ---- Calib3d ----
1214
1214
  /**
@@ -1217,14 +1217,14 @@ declare namespace cv {
1217
1217
  */
1218
1218
  function estimateAffine2D(options: {
1219
1219
  srcPoints: Point[]; dstPoints: Point[]; method?: number; ransacReprojThreshold?: number;
1220
- }): Mat | null;
1220
+ }): Mat | undefined;
1221
1221
  /**
1222
1222
  * 相似变换(平移+旋转+等比缩放,无剪切),点对齐/跨分辨率匹配常用
1223
1223
  * @example cv.estimateAffinePartial2D({ srcPoints: [{ x: 100, y: 100 }, { x: 200, y: 100 }, { x: 150, y: 200 }], dstPoints: [{ x: 10, y: 10 }, { x: 110, y: 10 }, { x: 60, y: 110 }] })
1224
1224
  */
1225
1225
  function estimateAffinePartial2D(options: {
1226
1226
  srcPoints: Point[]; dstPoints: Point[]; method?: number; ransacReprojThreshold?: number;
1227
- }): Mat | null;
1227
+ }): Mat | undefined;
1228
1228
 
1229
1229
  // ---- Features 扩展 ----
1230
1230