@opencvjs/types 4.10.0-release.1
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/LICENSE +201 -0
- package/README.md +23 -0
- package/lib/index.d.ts +2 -0
- package/lib/opencv/Affine3.d.ts +206 -0
- package/lib/opencv/Algorithm.d.ts +126 -0
- package/lib/opencv/AutoBuffer.d.ts +50 -0
- package/lib/opencv/BFMatcher.d.ts +37 -0
- package/lib/opencv/BOWTrainer.d.ts +43 -0
- package/lib/opencv/CascadeClassifier.d.ts +153 -0
- package/lib/opencv/DescriptorMatcher.d.ts +236 -0
- package/lib/opencv/DynamicBitset.d.ts +68 -0
- package/lib/opencv/Exception.d.ts +54 -0
- package/lib/opencv/Feature2D.d.ts +20 -0
- package/lib/opencv/FlannBasedMatcher.d.ts +57 -0
- package/lib/opencv/HOGDescriptor.d.ts +401 -0
- package/lib/opencv/Logger.d.ts +34 -0
- package/lib/opencv/LshTable.d.ts +81 -0
- package/lib/opencv/Mat.d.ts +1793 -0
- package/lib/opencv/MatExpr.d.ts +107 -0
- package/lib/opencv/MatOp.d.ts +72 -0
- package/lib/opencv/Matx.d.ts +228 -0
- package/lib/opencv/Node.d.ts +33 -0
- package/lib/opencv/ORB.d.ts +23 -0
- package/lib/opencv/PCA.d.ts +198 -0
- package/lib/opencv/RotatedRect.d.ts +73 -0
- package/lib/opencv/Tracker.d.ts +1 -0
- package/lib/opencv/TrackerMIL.d.ts +3 -0
- package/lib/opencv/_types.d.ts +48 -0
- package/lib/opencv/calib3d.d.ts +2937 -0
- package/lib/opencv/core_array.d.ts +3102 -0
- package/lib/opencv/core_cluster.d.ts +80 -0
- package/lib/opencv/core_hal_interface.d.ts +159 -0
- package/lib/opencv/core_utils.d.ts +748 -0
- package/lib/opencv/dnn.d.ts +505 -0
- package/lib/opencv/features2d_draw.d.ts +114 -0
- package/lib/opencv/fisheye.d.ts +26 -0
- package/lib/opencv/helpers.d.ts +274 -0
- package/lib/opencv/imgproc_color_conversions.d.ts +527 -0
- package/lib/opencv/imgproc_draw.d.ts +732 -0
- package/lib/opencv/imgproc_feature.d.ts +681 -0
- package/lib/opencv/imgproc_filter.d.ts +918 -0
- package/lib/opencv/imgproc_hist.d.ts +399 -0
- package/lib/opencv/imgproc_misc.d.ts +616 -0
- package/lib/opencv/imgproc_object.d.ts +58 -0
- package/lib/opencv/imgproc_shape.d.ts +724 -0
- package/lib/opencv/imgproc_transform.d.ts +574 -0
- package/lib/opencv/missing.d.ts +58 -0
- package/lib/opencv/objdetect.d.ts +103 -0
- package/lib/opencv/photo_inpaint.d.ts +39 -0
- package/lib/opencv/softdouble.d.ts +71 -0
- package/lib/opencv/softfloat.d.ts +71 -0
- package/lib/opencv/video_track.d.ts +370 -0
- package/package.json +18 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { double, int, Mat, MatOp, Scalar } from "./_types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* <a name="d1/d10/classcv_1_1MatExpr_1MatrixExpressions"></a>This is a list of implemented matrix
|
|
5
|
+
* operations that can be combined in arbitrary complex expressions (here A, B stand for matrices (
|
|
6
|
+
* [Mat](#d3/d63/classcv_1_1Mat}) ), s for a scalar ( Scalar ), alpha for a real-valued scalar ( double
|
|
7
|
+
* )):
|
|
8
|
+
*
|
|
9
|
+
* Addition, subtraction, negation: `A+B`, `A-B`, `A+s`, `A-s`, `s+A`, `s-A`, `-A`
|
|
10
|
+
* Scaling: `A*alpha`
|
|
11
|
+
* Per-element multiplication and division: `A.mul(B)`, `A/B`, `alpha/A`
|
|
12
|
+
* Matrix multiplication: `A*B`
|
|
13
|
+
* Transposition: `A.t()` (means A)
|
|
14
|
+
* Matrix inversion and pseudo-inversion, solving linear systems and least-squares problems:
|
|
15
|
+
* `A.inv([method]) (~ A<sup>-1</sup>)`, `A.inv([method])*B (~ X: AX=B)`
|
|
16
|
+
* Comparison: `A cmpop B`, `A cmpop alpha`, `alpha cmpop A`, where *cmpop* is one of `>`, `>=`, `==`,
|
|
17
|
+
* `!=`, `<=`, `<`. The result of comparison is an 8-bit single channel mask whose elements are set to
|
|
18
|
+
* 255 (if the particular element or pair of elements satisfy the condition) or 0.
|
|
19
|
+
* Bitwise logical operations: `A logicop B`, `A logicop s`, `s logicop A`, `~A`, where *logicop* is
|
|
20
|
+
* one of `&`, `|`, `^`.
|
|
21
|
+
* Element-wise minimum and maximum: `min(A, B)`, `min(A, alpha)`, `max(A, B)`, `max(A, alpha)`
|
|
22
|
+
* Element-wise absolute value: `abs(A)`
|
|
23
|
+
* Cross-product, dot-product: `A.cross(B)`, `A.dot(B)`
|
|
24
|
+
* Any function of matrix or matrices and scalars that returns a matrix or a scalar, such as norm,
|
|
25
|
+
* mean, sum, countNonZero, trace, determinant, repeat, and others.
|
|
26
|
+
* Matrix initializers ( [Mat::eye()](#d3/d63/classcv_1_1Mat_1a2cf9b9acde7a9852542bbc20ef851ed2}),
|
|
27
|
+
* [Mat::zeros()](#d3/d63/classcv_1_1Mat_1a0b57b6a326c8876d944d188a46e0f556}),
|
|
28
|
+
* [Mat::ones()](#d3/d63/classcv_1_1Mat_1a69ae0402d116fc9c71908d8508dc2f09}) ), matrix comma-separated
|
|
29
|
+
* initializers, matrix constructors and operators that extract sub-matrices (see
|
|
30
|
+
* [Mat](#d3/d63/classcv_1_1Mat}) description).
|
|
31
|
+
* Mat_<destination_type>() constructors to cast the result to the proper type.
|
|
32
|
+
*
|
|
33
|
+
* Comma-separated initializers and probably some other operations may require additional explicit
|
|
34
|
+
* Mat() or Mat_<T>() constructor calls to resolve a possible ambiguity.
|
|
35
|
+
* Here are examples of matrix expressions:
|
|
36
|
+
*
|
|
37
|
+
* ```cpp
|
|
38
|
+
* // compute pseudo-inverse of A, equivalent to A.inv(DECOMP_SVD)
|
|
39
|
+
* SVD svd(A);
|
|
40
|
+
* Mat pinvA = svd.vt.t()*Mat::diag(1./svd.w)*svd.u.t();
|
|
41
|
+
*
|
|
42
|
+
* // compute the new vector of parameters in the Levenberg-Marquardt algorithm
|
|
43
|
+
* x -= (A.t()*A + lambda*Mat::eye(A.cols,A.cols,A.type())).inv(DECOMP_CHOLESKY)*(A.t()*err);
|
|
44
|
+
*
|
|
45
|
+
* // sharpen image using "unsharp mask" algorithm
|
|
46
|
+
* Mat blurred; double sigma = 1, threshold = 5, amount = 1;
|
|
47
|
+
* GaussianBlur(img, blurred, Size(), sigma, sigma);
|
|
48
|
+
* Mat lowContrastMask = abs(img - blurred) < threshold;
|
|
49
|
+
* Mat sharpened = img*(1+amount) + blurred*(-amount);
|
|
50
|
+
* img.copyTo(sharpened, lowContrastMask);
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* Source:
|
|
54
|
+
* [opencv2/core/mat.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/mat.hpp#L3557).
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
export declare class MatExpr extends Mat {
|
|
58
|
+
public a: Mat;
|
|
59
|
+
|
|
60
|
+
public alpha: double;
|
|
61
|
+
|
|
62
|
+
public b: Mat;
|
|
63
|
+
|
|
64
|
+
public beta: double;
|
|
65
|
+
|
|
66
|
+
public c: Mat;
|
|
67
|
+
|
|
68
|
+
public flags: int;
|
|
69
|
+
|
|
70
|
+
public op: MatOp;
|
|
71
|
+
|
|
72
|
+
public s: Scalar;
|
|
73
|
+
|
|
74
|
+
public constructor();
|
|
75
|
+
|
|
76
|
+
public constructor(m: Mat);
|
|
77
|
+
|
|
78
|
+
public constructor(
|
|
79
|
+
_op: MatOp,
|
|
80
|
+
_flags: int,
|
|
81
|
+
_a?: Mat,
|
|
82
|
+
_b?: Mat,
|
|
83
|
+
_c?: Mat,
|
|
84
|
+
_alpha?: double,
|
|
85
|
+
_beta?: double,
|
|
86
|
+
_s?: Scalar,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
public col(x: int): MatExpr;
|
|
90
|
+
|
|
91
|
+
public cross(m: Mat): Mat;
|
|
92
|
+
|
|
93
|
+
public diag(d?: int): MatExpr;
|
|
94
|
+
|
|
95
|
+
public dot(m: Mat): Mat;
|
|
96
|
+
|
|
97
|
+
public inv(method?: int): MatExpr;
|
|
98
|
+
|
|
99
|
+
public mul(e: MatExpr, scale?: double): MatExpr;
|
|
100
|
+
|
|
101
|
+
public mul(m: Mat, scale?: double): MatExpr;
|
|
102
|
+
|
|
103
|
+
public row(y: int): MatExpr;
|
|
104
|
+
public t(): MatExpr;
|
|
105
|
+
|
|
106
|
+
public type(): int;
|
|
107
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Mat, MatExpr } from "./_types";
|
|
2
|
+
import type { double, int } from "./missing";
|
|
3
|
+
import type { Scalar, Size } from "./helpers";
|
|
4
|
+
|
|
5
|
+
export declare class MatOp {
|
|
6
|
+
public constructor();
|
|
7
|
+
|
|
8
|
+
public abs(expr: MatExpr, res: MatExpr): MatExpr;
|
|
9
|
+
|
|
10
|
+
public add(expr1: MatExpr, expr2: MatExpr, res: MatExpr): MatExpr;
|
|
11
|
+
|
|
12
|
+
public add(expr1: MatExpr, s: Scalar, res: MatExpr): MatExpr;
|
|
13
|
+
|
|
14
|
+
public assign(expr: MatExpr, m: Mat, type?: int): MatExpr;
|
|
15
|
+
|
|
16
|
+
public augAssignAdd(expr: MatExpr, m: Mat): MatExpr;
|
|
17
|
+
|
|
18
|
+
public augAssignAnd(expr: MatExpr, m: Mat): MatExpr;
|
|
19
|
+
|
|
20
|
+
public augAssignDivide(expr: MatExpr, m: Mat): MatExpr;
|
|
21
|
+
|
|
22
|
+
public augAssignMultiply(expr: MatExpr, m: Mat): MatExpr;
|
|
23
|
+
|
|
24
|
+
public augAssignOr(expr: MatExpr, m: Mat): MatExpr;
|
|
25
|
+
|
|
26
|
+
public augAssignSubtract(expr: MatExpr, m: Mat): MatExpr;
|
|
27
|
+
|
|
28
|
+
public augAssignXor(expr: MatExpr, m: Mat): MatExpr;
|
|
29
|
+
|
|
30
|
+
public diag(expr: MatExpr, d: int, res: MatExpr): MatExpr;
|
|
31
|
+
|
|
32
|
+
public divide(
|
|
33
|
+
expr1: MatExpr,
|
|
34
|
+
expr2: MatExpr,
|
|
35
|
+
res: MatExpr,
|
|
36
|
+
scale?: double,
|
|
37
|
+
): MatExpr;
|
|
38
|
+
|
|
39
|
+
public divide(s: double, expr: MatExpr, res: MatExpr): MatExpr;
|
|
40
|
+
|
|
41
|
+
public elementWise(expr: MatExpr): MatExpr;
|
|
42
|
+
|
|
43
|
+
public invert(expr: MatExpr, method: int, res: MatExpr): MatExpr;
|
|
44
|
+
|
|
45
|
+
public matmul(expr1: MatExpr, expr2: MatExpr, res: MatExpr): MatExpr;
|
|
46
|
+
|
|
47
|
+
public multiply(
|
|
48
|
+
expr1: MatExpr,
|
|
49
|
+
expr2: MatExpr,
|
|
50
|
+
res: MatExpr,
|
|
51
|
+
scale?: double,
|
|
52
|
+
): MatExpr;
|
|
53
|
+
|
|
54
|
+
public multiply(expr1: MatExpr, s: double, res: MatExpr): MatExpr;
|
|
55
|
+
|
|
56
|
+
public roi(
|
|
57
|
+
expr: MatExpr,
|
|
58
|
+
rowRange: Range,
|
|
59
|
+
colRange: Range,
|
|
60
|
+
res: MatExpr,
|
|
61
|
+
): MatExpr;
|
|
62
|
+
|
|
63
|
+
public size(expr: MatExpr): Size;
|
|
64
|
+
|
|
65
|
+
public subtract(expr1: MatExpr, expr2: MatExpr, res: MatExpr): MatExpr;
|
|
66
|
+
|
|
67
|
+
public subtract(s: Scalar, expr: MatExpr, res: MatExpr): Scalar;
|
|
68
|
+
|
|
69
|
+
public transpose(expr: MatExpr, res: MatExpr): MatExpr;
|
|
70
|
+
|
|
71
|
+
public type(expr: MatExpr): MatExpr;
|
|
72
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
diag_type,
|
|
3
|
+
int,
|
|
4
|
+
Matx_AddOp,
|
|
5
|
+
Matx_DivOp,
|
|
6
|
+
Matx_MatMulOp,
|
|
7
|
+
Matx_MulOp,
|
|
8
|
+
Matx_ScaleOp,
|
|
9
|
+
Matx_SubOp,
|
|
10
|
+
Matx_TOp,
|
|
11
|
+
Vec,
|
|
12
|
+
_T2,
|
|
13
|
+
_Tp,
|
|
14
|
+
} from "./_types";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* If you need a more flexible type, use [Mat](#d3/d63/classcv_1_1Mat}) . The elements of the matrix M
|
|
18
|
+
* are accessible using the M(i,j) notation. Most of the common matrix operations (see also
|
|
19
|
+
* [MatrixExpressions](#d1/d10/classcv_1_1MatExpr_1MatrixExpressions}) ) are available. To do an
|
|
20
|
+
* operation on [Matx](#de/de1/classcv_1_1Matx}) that is not implemented, you can easily convert the
|
|
21
|
+
* matrix to [Mat](#d3/d63/classcv_1_1Mat}) and backwards:
|
|
22
|
+
*
|
|
23
|
+
* ```cpp
|
|
24
|
+
* Matx33f m(1, 2, 3,
|
|
25
|
+
* 4, 5, 6,
|
|
26
|
+
* 7, 8, 9);
|
|
27
|
+
* cout << sum(Mat(m*m.t())) << endl;
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Except of the plain constructor which takes a list of elements, [Matx](#de/de1/classcv_1_1Matx})
|
|
31
|
+
* can be initialized from a C-array:
|
|
32
|
+
*
|
|
33
|
+
* ```cpp
|
|
34
|
+
* float values[] = { 1, 2, 3};
|
|
35
|
+
* Matx31f m(values);
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* In case if C++11 features are available, std::initializer_list can be also used to initialize
|
|
39
|
+
* [Matx](#de/de1/classcv_1_1Matx}):
|
|
40
|
+
*
|
|
41
|
+
* ```cpp
|
|
42
|
+
* Matx31f m = { 1, 2, 3};
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* Source:
|
|
46
|
+
* [opencv2/core/matx.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/matx.hpp#L1185).
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
export declare class Matx {
|
|
50
|
+
public val: _Tp;
|
|
51
|
+
|
|
52
|
+
public constructor();
|
|
53
|
+
|
|
54
|
+
public constructor(v0: _Tp);
|
|
55
|
+
|
|
56
|
+
public constructor(v0: _Tp, v1: _Tp);
|
|
57
|
+
|
|
58
|
+
public constructor(v0: _Tp, v1: _Tp, v2: _Tp);
|
|
59
|
+
|
|
60
|
+
public constructor(v0: _Tp, v1: _Tp, v2: _Tp, v3: _Tp);
|
|
61
|
+
|
|
62
|
+
public constructor(v0: _Tp, v1: _Tp, v2: _Tp, v3: _Tp, v4: _Tp);
|
|
63
|
+
|
|
64
|
+
public constructor(v0: _Tp, v1: _Tp, v2: _Tp, v3: _Tp, v4: _Tp, v5: _Tp);
|
|
65
|
+
|
|
66
|
+
public constructor(
|
|
67
|
+
v0: _Tp,
|
|
68
|
+
v1: _Tp,
|
|
69
|
+
v2: _Tp,
|
|
70
|
+
v3: _Tp,
|
|
71
|
+
v4: _Tp,
|
|
72
|
+
v5: _Tp,
|
|
73
|
+
v6: _Tp,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
public constructor(
|
|
77
|
+
v0: _Tp,
|
|
78
|
+
v1: _Tp,
|
|
79
|
+
v2: _Tp,
|
|
80
|
+
v3: _Tp,
|
|
81
|
+
v4: _Tp,
|
|
82
|
+
v5: _Tp,
|
|
83
|
+
v6: _Tp,
|
|
84
|
+
v7: _Tp,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
public constructor(
|
|
88
|
+
v0: _Tp,
|
|
89
|
+
v1: _Tp,
|
|
90
|
+
v2: _Tp,
|
|
91
|
+
v3: _Tp,
|
|
92
|
+
v4: _Tp,
|
|
93
|
+
v5: _Tp,
|
|
94
|
+
v6: _Tp,
|
|
95
|
+
v7: _Tp,
|
|
96
|
+
v8: _Tp,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
public constructor(
|
|
100
|
+
v0: _Tp,
|
|
101
|
+
v1: _Tp,
|
|
102
|
+
v2: _Tp,
|
|
103
|
+
v3: _Tp,
|
|
104
|
+
v4: _Tp,
|
|
105
|
+
v5: _Tp,
|
|
106
|
+
v6: _Tp,
|
|
107
|
+
v7: _Tp,
|
|
108
|
+
v8: _Tp,
|
|
109
|
+
v9: _Tp,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
public constructor(
|
|
113
|
+
v0: _Tp,
|
|
114
|
+
v1: _Tp,
|
|
115
|
+
v2: _Tp,
|
|
116
|
+
v3: _Tp,
|
|
117
|
+
v4: _Tp,
|
|
118
|
+
v5: _Tp,
|
|
119
|
+
v6: _Tp,
|
|
120
|
+
v7: _Tp,
|
|
121
|
+
v8: _Tp,
|
|
122
|
+
v9: _Tp,
|
|
123
|
+
v10: _Tp,
|
|
124
|
+
v11: _Tp,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
public constructor(
|
|
128
|
+
v0: _Tp,
|
|
129
|
+
v1: _Tp,
|
|
130
|
+
v2: _Tp,
|
|
131
|
+
v3: _Tp,
|
|
132
|
+
v4: _Tp,
|
|
133
|
+
v5: _Tp,
|
|
134
|
+
v6: _Tp,
|
|
135
|
+
v7: _Tp,
|
|
136
|
+
v8: _Tp,
|
|
137
|
+
v9: _Tp,
|
|
138
|
+
v10: _Tp,
|
|
139
|
+
v11: _Tp,
|
|
140
|
+
v12: _Tp,
|
|
141
|
+
v13: _Tp,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
public constructor(
|
|
145
|
+
v0: _Tp,
|
|
146
|
+
v1: _Tp,
|
|
147
|
+
v2: _Tp,
|
|
148
|
+
v3: _Tp,
|
|
149
|
+
v4: _Tp,
|
|
150
|
+
v5: _Tp,
|
|
151
|
+
v6: _Tp,
|
|
152
|
+
v7: _Tp,
|
|
153
|
+
v8: _Tp,
|
|
154
|
+
v9: _Tp,
|
|
155
|
+
v10: _Tp,
|
|
156
|
+
v11: _Tp,
|
|
157
|
+
v12: _Tp,
|
|
158
|
+
v13: _Tp,
|
|
159
|
+
v14: _Tp,
|
|
160
|
+
v15: _Tp,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
public constructor(vals: any);
|
|
164
|
+
|
|
165
|
+
public constructor(arg334: any);
|
|
166
|
+
|
|
167
|
+
public constructor(a: Matx, b: Matx, arg335: Matx_AddOp);
|
|
168
|
+
|
|
169
|
+
public constructor(a: Matx, b: Matx, arg336: Matx_SubOp);
|
|
170
|
+
|
|
171
|
+
public constructor(arg337: any, a: Matx, alpha: _T2, arg338: Matx_ScaleOp);
|
|
172
|
+
|
|
173
|
+
public constructor(a: Matx, b: Matx, arg339: Matx_MulOp);
|
|
174
|
+
|
|
175
|
+
public constructor(a: Matx, b: Matx, arg340: Matx_DivOp);
|
|
176
|
+
|
|
177
|
+
public constructor(l: int, a: Matx, b: Matx, arg341: Matx_MatMulOp);
|
|
178
|
+
|
|
179
|
+
public constructor(a: Matx, arg342: Matx_TOp);
|
|
180
|
+
|
|
181
|
+
public col(i: int): Matx;
|
|
182
|
+
|
|
183
|
+
public ddot(v: Matx): Matx;
|
|
184
|
+
|
|
185
|
+
public diag(): diag_type;
|
|
186
|
+
|
|
187
|
+
public div(a: Matx): Matx;
|
|
188
|
+
|
|
189
|
+
public dot(v: Matx): Matx;
|
|
190
|
+
|
|
191
|
+
public get_minor(m1: int, n1: int, base_row: int, base_col: int): Matx;
|
|
192
|
+
|
|
193
|
+
public inv(method?: int, p_is_ok?: any): Matx;
|
|
194
|
+
|
|
195
|
+
public mul(a: Matx): Matx;
|
|
196
|
+
|
|
197
|
+
public reshape(m1: int, n1: int): Matx;
|
|
198
|
+
|
|
199
|
+
public row(i: int): Matx;
|
|
200
|
+
|
|
201
|
+
public solve(l: int, rhs: Matx, flags?: int): Matx;
|
|
202
|
+
|
|
203
|
+
public solve(rhs: Vec, method: int): Vec;
|
|
204
|
+
|
|
205
|
+
public t(): Matx;
|
|
206
|
+
|
|
207
|
+
public static all(alpha: _Tp): Matx;
|
|
208
|
+
|
|
209
|
+
public static diag(d: diag_type): Matx;
|
|
210
|
+
|
|
211
|
+
public static eye(): Matx;
|
|
212
|
+
|
|
213
|
+
public static ones(): Matx;
|
|
214
|
+
|
|
215
|
+
public static randn(a: _Tp, b: _Tp): Matx;
|
|
216
|
+
|
|
217
|
+
public static randu(a: _Tp, b: _Tp): Matx;
|
|
218
|
+
|
|
219
|
+
public static zeros(): Matx;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export declare const rows: any; // initializer: = m
|
|
223
|
+
|
|
224
|
+
export declare const cols: any; // initializer: = n
|
|
225
|
+
|
|
226
|
+
export declare const channels: any; // initializer: = rows*cols
|
|
227
|
+
|
|
228
|
+
export declare const shortdim: any; // initializer: = (m < n ? m : n)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { double, int } from "./_types";
|
|
2
|
+
|
|
3
|
+
export declare class Node {
|
|
4
|
+
/**
|
|
5
|
+
* Class index normalized to 0..class_count-1 range and assigned to the node. It is used internally
|
|
6
|
+
* in classification trees and tree ensembles.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
public classIdx: int;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Default direction where to go (-1: left or +1: right). It helps in the case of missing values.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
public defaultDir: int;
|
|
16
|
+
|
|
17
|
+
public left: int;
|
|
18
|
+
|
|
19
|
+
public parent: int;
|
|
20
|
+
|
|
21
|
+
public right: int;
|
|
22
|
+
|
|
23
|
+
public split: int;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Value at the node: a class label in case of classification or estimated function value in case of
|
|
27
|
+
* regression.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
public value: double;
|
|
31
|
+
|
|
32
|
+
public constructor();
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Feature2D } from "./_types";
|
|
2
|
+
import type { float, int } from "./missing";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* https://docs.opencv.org/4.10.0/db/d95/classcv_1_1ORB.html
|
|
6
|
+
*/
|
|
7
|
+
export declare class ORB extends Feature2D {
|
|
8
|
+
public constructor(
|
|
9
|
+
nfeatures?: int,
|
|
10
|
+
scaleFactor?: float,
|
|
11
|
+
nlevels?: int,
|
|
12
|
+
edgeThreshold?: int,
|
|
13
|
+
firstLevel?: int,
|
|
14
|
+
WTA_K?: int,
|
|
15
|
+
scoreType?: ORBScoreType,
|
|
16
|
+
patchSize?: int,
|
|
17
|
+
fastThreshold?: int,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type ORBScoreType = int;
|
|
22
|
+
export declare const ORB_HARRIS_SCORE: ORBScoreType;
|
|
23
|
+
export declare const ORB_FAST_SCORE: ORBScoreType;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { InputArray, OutputArray } from "./helpers";
|
|
2
|
+
import type { double, FileNode, FileStorage, int } from "./missing";
|
|
3
|
+
import type { Mat } from "./Mat";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The class is used to calculate a special basis for a set of vectors. The basis will consist of
|
|
7
|
+
* eigenvectors of the covariance matrix calculated from the input set of vectors. The class PCA can
|
|
8
|
+
* also transform vectors to/from the new coordinate space defined by the basis. Usually, in this new
|
|
9
|
+
* coordinate system, each vector from the original set (and any linear combination of such vectors)
|
|
10
|
+
* can be quite accurately approximated by taking its first few components, corresponding to the
|
|
11
|
+
* eigenvectors of the largest eigenvalues of the covariance matrix. Geometrically it means that you
|
|
12
|
+
* calculate a projection of the vector to a subspace formed by a few eigenvectors corresponding to the
|
|
13
|
+
* dominant eigenvalues of the covariance matrix. And usually such a projection is very close to the
|
|
14
|
+
* original vector. So, you can represent the original vector from a high-dimensional space with a much
|
|
15
|
+
* shorter vector consisting of the projected vector's coordinates in the subspace. Such a
|
|
16
|
+
* transformation is also known as Karhunen-Loeve Transform, or KLT. See
|
|
17
|
+
*
|
|
18
|
+
* The sample below is the function that takes two matrices. The first function stores a set of vectors
|
|
19
|
+
* (a row per vector) that is used to calculate [PCA](#d3/d8d/classcv_1_1PCA}). The second function
|
|
20
|
+
* stores another "test" set of vectors (a row per vector). First, these vectors are compressed with
|
|
21
|
+
* [PCA](#d3/d8d/classcv_1_1PCA}), then reconstructed back, and then the reconstruction error norm is
|
|
22
|
+
* computed and printed for each vector. :
|
|
23
|
+
*
|
|
24
|
+
* ```cpp
|
|
25
|
+
* using namespace cv;
|
|
26
|
+
*
|
|
27
|
+
* PCA compressPCA(const Mat& pcaset, int maxComponents,
|
|
28
|
+
* const Mat& testset, Mat& compressed)
|
|
29
|
+
* {
|
|
30
|
+
* PCA pca(pcaset, // pass the data
|
|
31
|
+
* Mat(), // we do not have a pre-computed mean vector,
|
|
32
|
+
* // so let the PCA engine to compute it
|
|
33
|
+
* PCA::DATA_AS_ROW, // indicate that the vectors
|
|
34
|
+
* // are stored as matrix rows
|
|
35
|
+
* // (use PCA::DATA_AS_COL if the vectors are
|
|
36
|
+
* // the matrix columns)
|
|
37
|
+
* maxComponents // specify, how many principal components to retain
|
|
38
|
+
* );
|
|
39
|
+
* // if there is no test data, just return the computed basis, ready-to-use
|
|
40
|
+
* if( !testset.data )
|
|
41
|
+
* return pca;
|
|
42
|
+
* CV_Assert( testset.cols == pcaset.cols );
|
|
43
|
+
*
|
|
44
|
+
* compressed.create(testset.rows, maxComponents, testset.type());
|
|
45
|
+
*
|
|
46
|
+
* Mat reconstructed;
|
|
47
|
+
* for( int i = 0; i < testset.rows; i++ )
|
|
48
|
+
* {
|
|
49
|
+
* Mat vec = testset.row(i), coeffs = compressed.row(i), reconstructed;
|
|
50
|
+
* // compress the vector, the result will be stored
|
|
51
|
+
* // in the i-th row of the output matrix
|
|
52
|
+
* pca.project(vec, coeffs);
|
|
53
|
+
* // and then reconstruct it
|
|
54
|
+
* pca.backProject(coeffs, reconstructed);
|
|
55
|
+
* // and measure the error
|
|
56
|
+
* printf("%d. diff = %g\\n", i, norm(vec, reconstructed, NORM_L2));
|
|
57
|
+
* }
|
|
58
|
+
* return pca;
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* [calcCovarMatrix](#d2/de8/group__core__array_1gae6ffa9354633f984246945d52823165d}),
|
|
63
|
+
* [mulTransposed](#d2/de8/group__core__array_1gadc4e49f8f7a155044e3be1b9e3b270ab}),
|
|
64
|
+
* [SVD](#df/df7/classcv_1_1SVD}),
|
|
65
|
+
* [dft](#d2/de8/group__core__array_1gadd6cf9baf2b8b704a11b5f04aaf4f39d}),
|
|
66
|
+
* [dct](#d2/de8/group__core__array_1ga85aad4d668c01fbd64825f589e3696d4})
|
|
67
|
+
*
|
|
68
|
+
* Source:
|
|
69
|
+
* [opencv2/core.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core.hpp#L2393).
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
export declare class PCA {
|
|
73
|
+
public eigenvalues: Mat;
|
|
74
|
+
|
|
75
|
+
public eigenvectors: Mat;
|
|
76
|
+
|
|
77
|
+
public mean: Mat;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The default constructor initializes an empty PCA structure. The other constructors initialize the
|
|
81
|
+
* structure and call [PCA::operator()()].
|
|
82
|
+
*/
|
|
83
|
+
public constructor();
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* This is an overloaded member function, provided for convenience. It differs from the above
|
|
87
|
+
* function only in what argument(s) it accepts.
|
|
88
|
+
*
|
|
89
|
+
* @param data input samples stored as matrix rows or matrix columns.
|
|
90
|
+
*
|
|
91
|
+
* @param mean optional mean value; if the matrix is empty (noArray()), the mean is computed from the
|
|
92
|
+
* data.
|
|
93
|
+
*
|
|
94
|
+
* @param flags operation flags; currently the parameter is only used to specify the data layout
|
|
95
|
+
* (PCA::Flags)
|
|
96
|
+
*
|
|
97
|
+
* @param maxComponents maximum number of components that PCA should retain; by default, all the
|
|
98
|
+
* components are retained.
|
|
99
|
+
*/
|
|
100
|
+
public constructor(
|
|
101
|
+
data: InputArray,
|
|
102
|
+
mean: InputArray,
|
|
103
|
+
flags: int,
|
|
104
|
+
maxComponents?: int,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* This is an overloaded member function, provided for convenience. It differs from the above
|
|
109
|
+
* function only in what argument(s) it accepts.
|
|
110
|
+
*
|
|
111
|
+
* @param data input samples stored as matrix rows or matrix columns.
|
|
112
|
+
*
|
|
113
|
+
* @param mean optional mean value; if the matrix is empty (noArray()), the mean is computed from the
|
|
114
|
+
* data.
|
|
115
|
+
*
|
|
116
|
+
* @param flags operation flags; currently the parameter is only used to specify the data layout
|
|
117
|
+
* (PCA::Flags)
|
|
118
|
+
*
|
|
119
|
+
* @param retainedVariance Percentage of variance that PCA should retain. Using this parameter will
|
|
120
|
+
* let the PCA decided how many components to retain but it will always keep at least 2.
|
|
121
|
+
*/
|
|
122
|
+
public constructor(
|
|
123
|
+
data: InputArray,
|
|
124
|
+
mean: InputArray,
|
|
125
|
+
flags: int,
|
|
126
|
+
retainedVariance: double,
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The methods are inverse operations to [PCA::project]. They take PC coordinates of projected
|
|
131
|
+
* vectors and reconstruct the original vectors. Unless all the principal components have been
|
|
132
|
+
* retained, the reconstructed vectors are different from the originals. But typically, the difference
|
|
133
|
+
* is small if the number of components is large enough (but still much smaller than the original
|
|
134
|
+
* vector dimensionality). As a result, [PCA] is used.
|
|
135
|
+
*
|
|
136
|
+
* @param vec coordinates of the vectors in the principal component subspace, the layout and size are
|
|
137
|
+
* the same as of PCA::project output vectors.
|
|
138
|
+
*/
|
|
139
|
+
public backProject(vec: InputArray): Mat;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* This is an overloaded member function, provided for convenience. It differs from the above
|
|
143
|
+
* function only in what argument(s) it accepts.
|
|
144
|
+
*
|
|
145
|
+
* @param vec coordinates of the vectors in the principal component subspace, the layout and size are
|
|
146
|
+
* the same as of PCA::project output vectors.
|
|
147
|
+
*
|
|
148
|
+
* @param result reconstructed vectors; the layout and size are the same as of PCA::project input
|
|
149
|
+
* vectors.
|
|
150
|
+
*/
|
|
151
|
+
public backProject(vec: InputArray, result: OutputArray): InputArray;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The methods project one or more vectors to the principal component subspace, where each vector
|
|
155
|
+
* projection is represented by coefficients in the principal component basis. The first form of the
|
|
156
|
+
* method returns the matrix that the second form writes to the result. So the first form can be used
|
|
157
|
+
* as a part of expression while the second form can be more efficient in a processing loop.
|
|
158
|
+
*
|
|
159
|
+
* @param vec input vector(s); must have the same dimensionality and the same layout as the input
|
|
160
|
+
* data used at PCA phase, that is, if DATA_AS_ROW are specified, then vec.cols==data.cols (vector
|
|
161
|
+
* dimensionality) and vec.rows is the number of vectors to project, and the same is true for the
|
|
162
|
+
* PCA::DATA_AS_COL case.
|
|
163
|
+
*/
|
|
164
|
+
public project(vec: InputArray): Mat;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* This is an overloaded member function, provided for convenience. It differs from the above
|
|
168
|
+
* function only in what argument(s) it accepts.
|
|
169
|
+
*
|
|
170
|
+
* @param vec input vector(s); must have the same dimensionality and the same layout as the input
|
|
171
|
+
* data used at PCA phase, that is, if DATA_AS_ROW are specified, then vec.cols==data.cols (vector
|
|
172
|
+
* dimensionality) and vec.rows is the number of vectors to project, and the same is true for the
|
|
173
|
+
* PCA::DATA_AS_COL case.
|
|
174
|
+
*
|
|
175
|
+
* @param result output vectors; in case of PCA::DATA_AS_COL, the output matrix has as many columns
|
|
176
|
+
* as the number of input vectors, this means that result.cols==vec.cols and the number of rows match
|
|
177
|
+
* the number of principal components (for example, maxComponents parameter passed to the constructor).
|
|
178
|
+
*/
|
|
179
|
+
public project(vec: InputArray, result: OutputArray): InputArray;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Loads [eigenvalues] [eigenvectors] and [mean] from specified [FileNode]
|
|
183
|
+
*/
|
|
184
|
+
public read(fn: FileNode): FileNode;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Writes [eigenvalues] [eigenvectors] and [mean] to specified [FileStorage]
|
|
188
|
+
*/
|
|
189
|
+
public write(fs: FileStorage): FileStorage;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export declare const DATA_AS_ROW: Flags; // initializer: = 0
|
|
193
|
+
|
|
194
|
+
export declare const DATA_AS_COL: Flags; // initializer: = 1
|
|
195
|
+
|
|
196
|
+
export declare const USE_AVG: Flags; // initializer: = 2
|
|
197
|
+
|
|
198
|
+
export type Flags = any;
|