@techstark/opencv-js 4.8.0-release.7 → 4.8.0-release.8
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/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +18 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/types/_cv.d.ts +7 -0
- package/dist/src/types/_cv.js +3 -0
- package/dist/src/types/_cv.js.map +1 -0
- package/dist/src/types/emscripten.d.ts +166 -0
- package/dist/src/types/emscripten.js +4 -0
- package/dist/src/types/emscripten.js.map +1 -0
- package/dist/src/types/opencv/Affine3.d.ts +183 -0
- package/dist/src/types/opencv/Affine3.js +3 -0
- package/dist/src/types/opencv/Affine3.js.map +1 -0
- package/dist/src/types/opencv/Algorithm.d.ts +105 -0
- package/dist/src/types/opencv/Algorithm.js +4 -0
- package/dist/src/types/opencv/Algorithm.js.map +1 -0
- package/dist/src/types/opencv/AutoBuffer.d.ts +41 -0
- package/dist/src/types/opencv/AutoBuffer.js +3 -0
- package/dist/src/types/opencv/AutoBuffer.js.map +1 -0
- package/dist/src/types/opencv/BFMatcher.d.ts +33 -0
- package/dist/src/types/opencv/BFMatcher.js +3 -0
- package/dist/src/types/opencv/BFMatcher.js.map +1 -0
- package/dist/src/types/opencv/BOWTrainer.d.ts +36 -0
- package/dist/src/types/opencv/BOWTrainer.js +3 -0
- package/dist/src/types/opencv/BOWTrainer.js.map +1 -0
- package/dist/src/types/opencv/CascadeClassifier.d.ts +100 -0
- package/dist/src/types/opencv/CascadeClassifier.js +4 -0
- package/dist/src/types/opencv/CascadeClassifier.js.map +1 -0
- package/dist/src/types/opencv/DescriptorMatcher.d.ts +172 -0
- package/dist/src/types/opencv/DescriptorMatcher.js +3 -0
- package/dist/src/types/opencv/DescriptorMatcher.js.map +1 -0
- package/dist/src/types/opencv/DynamicBitset.d.ts +57 -0
- package/dist/src/types/opencv/DynamicBitset.js +3 -0
- package/dist/src/types/opencv/DynamicBitset.js.map +1 -0
- package/dist/src/types/opencv/Exception.d.ts +38 -0
- package/dist/src/types/opencv/Exception.js +3 -0
- package/dist/src/types/opencv/Exception.js.map +1 -0
- package/dist/src/types/opencv/Feature2D.d.ts +14 -0
- package/dist/src/types/opencv/Feature2D.js +4 -0
- package/dist/src/types/opencv/Feature2D.js.map +1 -0
- package/dist/src/types/opencv/FlannBasedMatcher.d.ts +41 -0
- package/dist/src/types/opencv/FlannBasedMatcher.js +3 -0
- package/dist/src/types/opencv/FlannBasedMatcher.js.map +1 -0
- package/dist/src/types/opencv/HOGDescriptor.d.ts +265 -0
- package/dist/src/types/opencv/HOGDescriptor.js +3 -0
- package/dist/src/types/opencv/HOGDescriptor.js.map +1 -0
- package/dist/src/types/opencv/Logger.d.ts +27 -0
- package/dist/src/types/opencv/Logger.js +3 -0
- package/dist/src/types/opencv/Logger.js.map +1 -0
- package/dist/src/types/opencv/LshTable.d.ts +67 -0
- package/dist/src/types/opencv/LshTable.js +3 -0
- package/dist/src/types/opencv/LshTable.js.map +1 -0
- package/dist/src/types/opencv/Mat.d.ts +1589 -0
- package/dist/src/types/opencv/Mat.js +3 -0
- package/dist/src/types/opencv/Mat.js.map +1 -0
- package/dist/src/types/opencv/MatExpr.d.ts +78 -0
- package/dist/src/types/opencv/MatExpr.js +4 -0
- package/dist/src/types/opencv/MatExpr.js.map +1 -0
- package/dist/src/types/opencv/MatOp.d.ts +29 -0
- package/dist/src/types/opencv/MatOp.js +3 -0
- package/dist/src/types/opencv/MatOp.js.map +1 -0
- package/dist/src/types/opencv/Matx.d.ts +84 -0
- package/dist/src/types/opencv/Matx.js +3 -0
- package/dist/src/types/opencv/Matx.js.map +1 -0
- package/dist/src/types/opencv/Node.d.ts +25 -0
- package/dist/src/types/opencv/Node.js +3 -0
- package/dist/src/types/opencv/Node.js.map +1 -0
- package/dist/src/types/opencv/ORB.d.ts +11 -0
- package/dist/src/types/opencv/ORB.js +4 -0
- package/dist/src/types/opencv/ORB.js.map +1 -0
- package/dist/src/types/opencv/PCA.d.ts +170 -0
- package/dist/src/types/opencv/PCA.js +3 -0
- package/dist/src/types/opencv/PCA.js.map +1 -0
- package/dist/src/types/opencv/RotatedRect.d.ts +63 -0
- package/dist/src/types/opencv/RotatedRect.js +3 -0
- package/dist/src/types/opencv/RotatedRect.js.map +1 -0
- package/dist/src/types/opencv/_hacks.d.ts +267 -0
- package/dist/src/types/opencv/_hacks.js +15 -0
- package/dist/src/types/opencv/_hacks.js.map +1 -0
- package/dist/src/types/opencv/_types.d.ts +44 -0
- package/dist/src/types/opencv/_types.js +61 -0
- package/dist/src/types/opencv/_types.js.map +1 -0
- package/dist/src/types/opencv/calib3d.d.ts +2180 -0
- package/dist/src/types/opencv/calib3d.js +3 -0
- package/dist/src/types/opencv/calib3d.js.map +1 -0
- package/dist/src/types/opencv/core_array.d.ts +2513 -0
- package/dist/src/types/opencv/core_array.js +3 -0
- package/dist/src/types/opencv/core_array.js.map +1 -0
- package/dist/src/types/opencv/core_cluster.d.ts +54 -0
- package/dist/src/types/opencv/core_cluster.js +3 -0
- package/dist/src/types/opencv/core_cluster.js.map +1 -0
- package/dist/src/types/opencv/core_hal_interface.d.ts +92 -0
- package/dist/src/types/opencv/core_hal_interface.js +3 -0
- package/dist/src/types/opencv/core_hal_interface.js.map +1 -0
- package/dist/src/types/opencv/core_utils.d.ts +510 -0
- package/dist/src/types/opencv/core_utils.js +3 -0
- package/dist/src/types/opencv/core_utils.js.map +1 -0
- package/dist/src/types/opencv/dnn.d.ts +336 -0
- package/dist/src/types/opencv/dnn.js +3 -0
- package/dist/src/types/opencv/dnn.js.map +1 -0
- package/dist/src/types/opencv/features2d_draw.d.ts +75 -0
- package/dist/src/types/opencv/features2d_draw.js +3 -0
- package/dist/src/types/opencv/features2d_draw.js.map +1 -0
- package/dist/src/types/opencv/imgproc_color_conversions.d.ts +299 -0
- package/dist/src/types/opencv/imgproc_color_conversions.js +3 -0
- package/dist/src/types/opencv/imgproc_color_conversions.js.map +1 -0
- package/dist/src/types/opencv/imgproc_draw.d.ts +502 -0
- package/dist/src/types/opencv/imgproc_draw.js +3 -0
- package/dist/src/types/opencv/imgproc_draw.js.map +1 -0
- package/dist/src/types/opencv/imgproc_feature.d.ts +533 -0
- package/dist/src/types/opencv/imgproc_feature.js +3 -0
- package/dist/src/types/opencv/imgproc_feature.js.map +1 -0
- package/dist/src/types/opencv/imgproc_filter.d.ts +689 -0
- package/dist/src/types/opencv/imgproc_filter.js +3 -0
- package/dist/src/types/opencv/imgproc_filter.js.map +1 -0
- package/dist/src/types/opencv/imgproc_hist.d.ts +291 -0
- package/dist/src/types/opencv/imgproc_hist.js +3 -0
- package/dist/src/types/opencv/imgproc_hist.js.map +1 -0
- package/dist/src/types/opencv/imgproc_misc.d.ts +473 -0
- package/dist/src/types/opencv/imgproc_misc.js +3 -0
- package/dist/src/types/opencv/imgproc_misc.js.map +1 -0
- package/dist/src/types/opencv/imgproc_object.d.ts +41 -0
- package/dist/src/types/opencv/imgproc_object.js +3 -0
- package/dist/src/types/opencv/imgproc_object.js.map +1 -0
- package/dist/src/types/opencv/imgproc_shape.d.ts +570 -0
- package/dist/src/types/opencv/imgproc_shape.js +3 -0
- package/dist/src/types/opencv/imgproc_shape.js.map +1 -0
- package/dist/src/types/opencv/imgproc_transform.d.ts +430 -0
- package/dist/src/types/opencv/imgproc_transform.js +3 -0
- package/dist/src/types/opencv/imgproc_transform.js.map +1 -0
- package/dist/src/types/opencv/index.d.ts +4 -0
- package/dist/src/types/opencv/index.js +19 -0
- package/dist/src/types/opencv/index.js.map +1 -0
- package/dist/src/types/opencv/objdetect.d.ts +43 -0
- package/dist/src/types/opencv/objdetect.js +3 -0
- package/dist/src/types/opencv/objdetect.js.map +1 -0
- package/dist/src/types/opencv/photo_inpaint.d.ts +25 -0
- package/dist/src/types/opencv/photo_inpaint.js +3 -0
- package/dist/src/types/opencv/photo_inpaint.js.map +1 -0
- package/dist/src/types/opencv/softdouble.d.ts +38 -0
- package/dist/src/types/opencv/softdouble.js +3 -0
- package/dist/src/types/opencv/softdouble.js.map +1 -0
- package/dist/src/types/opencv/softfloat.d.ts +38 -0
- package/dist/src/types/opencv/softfloat.js +3 -0
- package/dist/src/types/opencv/softfloat.js.map +1 -0
- package/dist/src/types/opencv/video_track.d.ts +276 -0
- package/dist/src/types/opencv/video_track.js +3 -0
- package/dist/src/types/opencv/video_track.js.map +1 -0
- package/package.json +5 -3
- package/src/index.ts +1 -0
- package/src/types/_cv.ts +6 -0
- package/src/types/emscripten.ts +286 -0
- package/src/types/opencv/Affine3.ts +206 -0
- package/src/types/opencv/Algorithm.ts +126 -0
- package/src/types/opencv/AutoBuffer.ts +50 -0
- package/src/types/opencv/BFMatcher.ts +37 -0
- package/src/types/opencv/BOWTrainer.ts +43 -0
- package/src/types/opencv/CascadeClassifier.ts +153 -0
- package/src/types/opencv/DescriptorMatcher.ts +244 -0
- package/src/types/opencv/DynamicBitset.ts +68 -0
- package/src/types/opencv/Exception.ts +54 -0
- package/src/types/opencv/Feature2D.ts +20 -0
- package/src/types/opencv/FlannBasedMatcher.ts +50 -0
- package/src/types/opencv/HOGDescriptor.ts +401 -0
- package/src/types/opencv/Logger.ts +34 -0
- package/src/types/opencv/LshTable.ts +81 -0
- package/src/types/opencv/Mat.ts +1764 -0
- package/src/types/opencv/MatExpr.ts +107 -0
- package/src/types/opencv/MatOp.ts +70 -0
- package/src/types/opencv/Matx.ts +228 -0
- package/src/types/opencv/Node.ts +33 -0
- package/src/types/opencv/ORB.ts +22 -0
- package/src/types/opencv/PCA.ts +204 -0
- package/src/types/opencv/RotatedRect.ts +72 -0
- package/src/types/opencv/_hacks.ts +322 -0
- package/src/types/opencv/_types.ts +44 -0
- package/src/types/opencv/calib3d.ts +2937 -0
- package/src/types/opencv/core_array.ts +3102 -0
- package/src/types/opencv/core_cluster.ts +81 -0
- package/src/types/opencv/core_hal_interface.ts +159 -0
- package/src/types/opencv/core_utils.ts +748 -0
- package/src/types/opencv/dnn.ts +505 -0
- package/src/types/opencv/features2d_draw.ts +114 -0
- package/src/types/opencv/imgproc_color_conversions.ts +527 -0
- package/src/types/opencv/imgproc_draw.ts +733 -0
- package/src/types/opencv/imgproc_feature.ts +681 -0
- package/src/types/opencv/imgproc_filter.ts +918 -0
- package/src/types/opencv/imgproc_hist.ts +399 -0
- package/src/types/opencv/imgproc_misc.ts +616 -0
- package/src/types/opencv/imgproc_object.ts +58 -0
- package/src/types/opencv/imgproc_shape.ts +734 -0
- package/src/types/opencv/imgproc_transform.ts +574 -0
- package/src/types/opencv/index.ts +4 -0
- package/src/types/opencv/objdetect.ts +103 -0
- package/src/types/opencv/photo_inpaint.ts +37 -0
- package/src/types/opencv/softdouble.ts +64 -0
- package/src/types/opencv/softfloat.ts +64 -0
- package/src/types/opencv/video_track.ts +372 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { float_type, int, Mat, Mat3, Mat4, Vec3 } from "./_types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* It represents a 4x4 homogeneous transformation matrix `$T$`
|
|
5
|
+
*
|
|
6
|
+
* `\\[T = \\begin{bmatrix} R & t\\\\ 0 & 1\\\\ \\end{bmatrix} \\]`
|
|
7
|
+
*
|
|
8
|
+
* where `$R$` is a 3x3 rotation matrix and `$t$` is a 3x1 translation vector.
|
|
9
|
+
*
|
|
10
|
+
* You can specify `$R$` either by a 3x3 rotation matrix or by a 3x1 rotation vector, which is
|
|
11
|
+
* converted to a 3x3 rotation matrix by the Rodrigues formula.
|
|
12
|
+
*
|
|
13
|
+
* To construct a matrix `$T$` representing first rotation around the axis `$r$` with rotation angle
|
|
14
|
+
* `$|r|$` in radian (right hand rule) and then translation by the vector `$t$`, you can use
|
|
15
|
+
*
|
|
16
|
+
* ```cpp
|
|
17
|
+
* cv::Vec3f r, t;
|
|
18
|
+
* cv::Affine3f T(r, t);
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* If you already have the rotation matrix `$R$`, then you can use
|
|
22
|
+
*
|
|
23
|
+
* ```cpp
|
|
24
|
+
* cv::Matx33f R;
|
|
25
|
+
* cv::Affine3f T(R, t);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* To extract the rotation matrix `$R$` from `$T$`, use
|
|
29
|
+
*
|
|
30
|
+
* ```cpp
|
|
31
|
+
* cv::Matx33f R = T.rotation();
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* To extract the translation vector `$t$` from `$T$`, use
|
|
35
|
+
*
|
|
36
|
+
* ```cpp
|
|
37
|
+
* cv::Vec3f t = T.translation();
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* To extract the rotation vector `$r$` from `$T$`, use
|
|
41
|
+
*
|
|
42
|
+
* ```cpp
|
|
43
|
+
* cv::Vec3f r = T.rvec();
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Note that since the mapping from rotation vectors to rotation matrices is many to one. The returned
|
|
47
|
+
* rotation vector is not necessarily the one you used before to set the matrix.
|
|
48
|
+
*
|
|
49
|
+
* If you have two transformations `$T = T_1 * T_2$`, use
|
|
50
|
+
*
|
|
51
|
+
* ```cpp
|
|
52
|
+
* cv::Affine3f T, T1, T2;
|
|
53
|
+
* T = T2.concatenate(T1);
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* To get the inverse transform of `$T$`, use
|
|
57
|
+
*
|
|
58
|
+
* ```cpp
|
|
59
|
+
* cv::Affine3f T, T_inv;
|
|
60
|
+
* T_inv = T.inv();
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* Source:
|
|
64
|
+
* [opencv2/core/affine.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/affine.hpp#L129).
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
export declare class Affine3 {
|
|
68
|
+
public matrix: Mat4;
|
|
69
|
+
|
|
70
|
+
public constructor();
|
|
71
|
+
|
|
72
|
+
public constructor(affine: Mat4);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The resulting 4x4 matrix is
|
|
76
|
+
*
|
|
77
|
+
* `\\[ \\begin{bmatrix} R & t\\\\ 0 & 1\\\\ \\end{bmatrix} \\]`
|
|
78
|
+
*
|
|
79
|
+
* @param R 3x3 rotation matrix.
|
|
80
|
+
*
|
|
81
|
+
* @param t 3x1 translation vector.
|
|
82
|
+
*/
|
|
83
|
+
public constructor(R: Mat3, t?: Vec3);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Rodrigues vector.
|
|
87
|
+
*
|
|
88
|
+
* The last row of the current matrix is set to [0,0,0,1].
|
|
89
|
+
*
|
|
90
|
+
* @param rvec 3x1 rotation vector. Its direction indicates the rotation axis and its length
|
|
91
|
+
* indicates the rotation angle in radian (using right hand rule).
|
|
92
|
+
*
|
|
93
|
+
* @param t 3x1 translation vector.
|
|
94
|
+
*/
|
|
95
|
+
public constructor(rvec: Vec3, t?: Vec3);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Combines all constructors above. Supports 4x4, 3x4, 3x3, 1x3, 3x1 sizes of data matrix.
|
|
99
|
+
*
|
|
100
|
+
* The last row of the current matrix is set to [0,0,0,1] when data is not 4x4.
|
|
101
|
+
*
|
|
102
|
+
* @param data 1-channel matrix. when it is 4x4, it is copied to the current matrix and t is not
|
|
103
|
+
* used. When it is 3x4, it is copied to the upper part 3x4 of the current matrix and t is not used.
|
|
104
|
+
* When it is 3x3, it is copied to the upper left 3x3 part of the current matrix. When it is 3x1 or
|
|
105
|
+
* 1x3, it is treated as a rotation vector and the Rodrigues formula is used to compute a 3x3 rotation
|
|
106
|
+
* matrix.
|
|
107
|
+
*
|
|
108
|
+
* @param t 3x1 translation vector. It is used only when data is neither 4x4 nor 3x4.
|
|
109
|
+
*/
|
|
110
|
+
public constructor(data: Mat, t?: Vec3);
|
|
111
|
+
|
|
112
|
+
public constructor(vals: float_type);
|
|
113
|
+
|
|
114
|
+
public cast(arg401: any): Affine3;
|
|
115
|
+
|
|
116
|
+
public concatenate(affine: Affine3): Affine3;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* the inverse of the current matrix.
|
|
120
|
+
*/
|
|
121
|
+
public inv(method?: int): Affine3;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Copy the 3x3 matrix L to the upper left part of the current matrix
|
|
125
|
+
*
|
|
126
|
+
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
|
127
|
+
*
|
|
128
|
+
* @param L 3x3 matrix.
|
|
129
|
+
*/
|
|
130
|
+
public linear(L: Mat3): Mat3;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* the upper left 3x3 part
|
|
134
|
+
*/
|
|
135
|
+
public linear(): Mat3;
|
|
136
|
+
|
|
137
|
+
public rotate(R: Mat3): Affine3;
|
|
138
|
+
|
|
139
|
+
public rotate(rvec: Vec3): Affine3;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Rotation matrix.
|
|
143
|
+
*
|
|
144
|
+
* Copy the rotation matrix to the upper left 3x3 part of the current matrix. The remaining elements
|
|
145
|
+
* of the current matrix are not changed.
|
|
146
|
+
*
|
|
147
|
+
* @param R 3x3 rotation matrix.
|
|
148
|
+
*/
|
|
149
|
+
public rotation(R: Mat3): Mat3;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Rodrigues vector.
|
|
153
|
+
*
|
|
154
|
+
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
|
155
|
+
*
|
|
156
|
+
* @param rvec 3x1 rotation vector. The direction indicates the rotation axis and its length
|
|
157
|
+
* indicates the rotation angle in radian (using the right thumb convention).
|
|
158
|
+
*/
|
|
159
|
+
public rotation(rvec: Vec3): Vec3;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix.
|
|
163
|
+
*
|
|
164
|
+
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
|
165
|
+
*
|
|
166
|
+
* @param data 1-channel matrix. When it is a 3x3 matrix, it sets the upper left 3x3 part of the
|
|
167
|
+
* current matrix. When it is a 1x3 or 3x1 matrix, it is used as a rotation vector. The Rodrigues
|
|
168
|
+
* formula is used to compute the rotation matrix and sets the upper left 3x3 part of the current
|
|
169
|
+
* matrix.
|
|
170
|
+
*/
|
|
171
|
+
public rotation(data: Mat): Mat;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* the upper left 3x3 part
|
|
175
|
+
*/
|
|
176
|
+
public rotation(): Mat3;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Rodrigues vector.
|
|
180
|
+
*
|
|
181
|
+
* a vector representing the upper left 3x3 rotation matrix of the current matrix.
|
|
182
|
+
*
|
|
183
|
+
* Since the mapping between rotation vectors and rotation matrices is many to one, this function
|
|
184
|
+
* returns only one rotation vector that represents the current rotation matrix, which is not
|
|
185
|
+
* necessarily the same one set by `[rotation(const Vec3& rvec)]`.
|
|
186
|
+
*/
|
|
187
|
+
public rvec(): Vec3;
|
|
188
|
+
|
|
189
|
+
public translate(t: Vec3): Affine3;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Copy t to the first three elements of the last column of the current matrix
|
|
193
|
+
*
|
|
194
|
+
* It sets the upper right 3x1 part of the matrix. The remaining part is unaffected.
|
|
195
|
+
*
|
|
196
|
+
* @param t 3x1 translation vector.
|
|
197
|
+
*/
|
|
198
|
+
public translation(t: Vec3): Vec3;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* the upper right 3x1 part
|
|
202
|
+
*/
|
|
203
|
+
public translation(): Vec3;
|
|
204
|
+
|
|
205
|
+
public static Identity(): Affine3;
|
|
206
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bool,
|
|
3
|
+
EmscriptenEmbindInstance,
|
|
4
|
+
FileNode,
|
|
5
|
+
FileStorage,
|
|
6
|
+
Ptr,
|
|
7
|
+
} from "./_types";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* especially for classes of algorithms, for which there can be multiple implementations. The examples
|
|
11
|
+
* are stereo correspondence (for which there are algorithms like block matching, semi-global block
|
|
12
|
+
* matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians
|
|
13
|
+
* models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
|
|
14
|
+
* etc.).
|
|
15
|
+
*
|
|
16
|
+
* Here is example of [SimpleBlobDetector](#d0/d7a/classcv_1_1SimpleBlobDetector}) use in your
|
|
17
|
+
* application via [Algorithm](#d3/d46/classcv_1_1Algorithm}) interface:
|
|
18
|
+
*
|
|
19
|
+
* ```cpp
|
|
20
|
+
* Ptr<Feature2D> sbd = SimpleBlobDetector::create();
|
|
21
|
+
* FileStorage fs_read("SimpleBlobDetector_params.xml", FileStorage::READ);
|
|
22
|
+
*
|
|
23
|
+
* if (fs_read.isOpened()) // if we have file with parameters, read them
|
|
24
|
+
* {
|
|
25
|
+
* sbd->read(fs_read.root());
|
|
26
|
+
* fs_read.release();
|
|
27
|
+
* }
|
|
28
|
+
* else // else modify the parameters and store them; user can later edit the file to use different
|
|
29
|
+
* parameters
|
|
30
|
+
* {
|
|
31
|
+
* fs_read.release();
|
|
32
|
+
* FileStorage fs_write("SimpleBlobDetector_params.xml", FileStorage::WRITE);
|
|
33
|
+
* sbd->write(fs_write);
|
|
34
|
+
* fs_write.release();
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* Mat result, image = imread("../data/detect_blob.png", IMREAD_COLOR);
|
|
38
|
+
* vector<KeyPoint> keypoints;
|
|
39
|
+
* sbd->detect(image, keypoints, Mat());
|
|
40
|
+
*
|
|
41
|
+
* drawKeypoints(image, keypoints, result);
|
|
42
|
+
* for (vector<KeyPoint>::iterator k = keypoints.begin(); k != keypoints.end(); ++k)
|
|
43
|
+
* circle(result, k->pt, (int)k->size, Scalar(0, 0, 255), 2);
|
|
44
|
+
*
|
|
45
|
+
* imshow("result", result);
|
|
46
|
+
* waitKey(0);
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Source:
|
|
50
|
+
* [opencv2/core.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core.hpp#L3077).
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
export declare class Algorithm extends EmscriptenEmbindInstance {
|
|
54
|
+
public constructor();
|
|
55
|
+
|
|
56
|
+
public clear(): void;
|
|
57
|
+
|
|
58
|
+
public empty(): bool;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the algorithm string identifier. This string is used as top level xml/yml node tag when
|
|
62
|
+
* the object is saved to a file or string.
|
|
63
|
+
*/
|
|
64
|
+
public getDefaultName(): String;
|
|
65
|
+
|
|
66
|
+
public read(fn: FileNode): FileNode;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Saves the algorithm to a file. In order to make this method work, the derived class must implement
|
|
70
|
+
* Algorithm::write(FileStorage& fs).
|
|
71
|
+
*/
|
|
72
|
+
public save(filename: String): String;
|
|
73
|
+
|
|
74
|
+
public write(fs: FileStorage): FileStorage;
|
|
75
|
+
|
|
76
|
+
public write(fs: Ptr, name?: String): Ptr;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* This is static template method of [Algorithm]. It's usage is following (in the case of SVM):
|
|
80
|
+
*
|
|
81
|
+
* ```cpp
|
|
82
|
+
* Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml");
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* In order to make this method work, the derived class must overwrite [Algorithm::read](const
|
|
86
|
+
* [FileNode]& fn).
|
|
87
|
+
*
|
|
88
|
+
* @param filename Name of the file to read.
|
|
89
|
+
*
|
|
90
|
+
* @param objname The optional name of the node to read (if empty, the first top-level node will be
|
|
91
|
+
* used)
|
|
92
|
+
*/
|
|
93
|
+
public static load(arg0: any, filename: String, objname?: String): Ptr;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* This is static template method of [Algorithm]. It's usage is following (in the case of SVM):
|
|
97
|
+
*
|
|
98
|
+
* ```cpp
|
|
99
|
+
* Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel);
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @param strModel The string variable containing the model you want to load.
|
|
103
|
+
*
|
|
104
|
+
* @param objname The optional name of the node to read (if empty, the first top-level node will be
|
|
105
|
+
* used)
|
|
106
|
+
*/
|
|
107
|
+
public static loadFromString(
|
|
108
|
+
arg1: any,
|
|
109
|
+
strModel: String,
|
|
110
|
+
objname?: String,
|
|
111
|
+
): Ptr;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* This is static template method of [Algorithm]. It's usage is following (in the case of SVM):
|
|
115
|
+
*
|
|
116
|
+
* ```cpp
|
|
117
|
+
* cv::FileStorage fsRead("example.xml", FileStorage::READ);
|
|
118
|
+
* Ptr<SVM> svm = Algorithm::read<SVM>(fsRead.root());
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* In order to make this method work, the derived class must overwrite [Algorithm::read](const
|
|
122
|
+
* [FileNode]& fn) and also have static create() method without parameters (or with all the optional
|
|
123
|
+
* parameters)
|
|
124
|
+
*/
|
|
125
|
+
public static read(arg2: any, fn: FileNode): Ptr;
|
|
126
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { size_t } from "./_types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The class is used for temporary buffers in functions and methods. If a temporary buffer is usually
|
|
5
|
+
* small (a few K's of memory), but its size depends on the parameters, it makes sense to create a
|
|
6
|
+
* small fixed-size array on stack and use it if it's large enough. If the required buffer size is
|
|
7
|
+
* larger than the fixed size, another buffer of sufficient size is allocated dynamically and released
|
|
8
|
+
* after the processing. Therefore, in typical cases, when the buffer size is small, there is no
|
|
9
|
+
* overhead associated with malloc()/free(). At the same time, there is no limit on the size of
|
|
10
|
+
* processed data.
|
|
11
|
+
*
|
|
12
|
+
* This is what [AutoBuffer](#d8/dd0/classcv_1_1AutoBuffer}) does. The template takes 2 parameters -
|
|
13
|
+
* type of the buffer elements and the number of stack-allocated elements. Here is how the class is
|
|
14
|
+
* used:
|
|
15
|
+
*
|
|
16
|
+
* ```cpp
|
|
17
|
+
* void my_func(const cv::Mat& m)
|
|
18
|
+
* {
|
|
19
|
+
* cv::AutoBuffer<float> buf(1000); // create automatic buffer containing 1000 floats
|
|
20
|
+
*
|
|
21
|
+
* buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
|
|
22
|
+
* // otherwise the buffer of "m.rows" floats will be allocated
|
|
23
|
+
* // dynamically and deallocated in cv::AutoBuffer destructor
|
|
24
|
+
* ...
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Source:
|
|
29
|
+
* [opencv2/core/utility.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/utility.hpp#L128).
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export declare class AutoBuffer {
|
|
33
|
+
public constructor();
|
|
34
|
+
|
|
35
|
+
public constructor(_size: size_t);
|
|
36
|
+
|
|
37
|
+
public constructor(buf: AutoBuffer);
|
|
38
|
+
|
|
39
|
+
public allocate(_size: size_t): void;
|
|
40
|
+
|
|
41
|
+
public data(): any;
|
|
42
|
+
|
|
43
|
+
public data(): any;
|
|
44
|
+
|
|
45
|
+
public deallocate(): void;
|
|
46
|
+
|
|
47
|
+
public resize(_size: size_t): void;
|
|
48
|
+
|
|
49
|
+
public size(): size_t;
|
|
50
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { bool, int, Ptr } from "./_types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* For each descriptor in the first set, this matcher finds the closest descriptor in the second set by
|
|
5
|
+
* trying each one. This descriptor matcher supports masking permissible matches of descriptor sets.
|
|
6
|
+
*
|
|
7
|
+
* Source:
|
|
8
|
+
* [opencv2/features2d.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/features2d.hpp#L1140).
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare class BFMatcher {
|
|
12
|
+
public constructor(normType?: int, crossCheck?: bool);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param emptyTrainData If emptyTrainData is false, the method creates a deep copy of the object,
|
|
16
|
+
* that is, copies both parameters and train data. If emptyTrainData is true, the method creates an
|
|
17
|
+
* object copy with the current parameters but with empty train data.
|
|
18
|
+
*/
|
|
19
|
+
public clone(emptyTrainData?: bool): Ptr;
|
|
20
|
+
|
|
21
|
+
public isMaskSupported(): bool;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
|
|
25
|
+
* preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
|
|
26
|
+
* BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
|
|
27
|
+
* description).
|
|
28
|
+
*
|
|
29
|
+
* @param crossCheck If it is false, this is will be default BFMatcher behaviour when it finds the k
|
|
30
|
+
* nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with
|
|
31
|
+
* k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the
|
|
32
|
+
* matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent
|
|
33
|
+
* pairs. Such technique usually produces best results with minimal number of outliers when there are
|
|
34
|
+
* enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
|
|
35
|
+
*/
|
|
36
|
+
public static create(normType?: int, crossCheck?: bool): Ptr;
|
|
37
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { int, Mat } from "./_types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka,
|
|
5
|
+
* Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :
|
|
6
|
+
*
|
|
7
|
+
* Source:
|
|
8
|
+
* [opencv2/features2d.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/features2d.hpp#L1339).
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare class BOWTrainer {
|
|
12
|
+
public constructor();
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The training set is clustered using clustermethod to construct the vocabulary.
|
|
16
|
+
*
|
|
17
|
+
* @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a
|
|
18
|
+
* descriptor.
|
|
19
|
+
*/
|
|
20
|
+
public add(descriptors: Mat): Mat;
|
|
21
|
+
|
|
22
|
+
public clear(): void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This is an overloaded member function, provided for convenience. It differs from the above
|
|
26
|
+
* function only in what argument(s) it accepts.
|
|
27
|
+
*/
|
|
28
|
+
public cluster(): Mat;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first
|
|
32
|
+
* variant of the method, train descriptors stored in the object are clustered. In the second variant,
|
|
33
|
+
* input descriptors are clustered.
|
|
34
|
+
*
|
|
35
|
+
* @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor.
|
|
36
|
+
* Descriptors are not added to the inner train descriptor set.
|
|
37
|
+
*/
|
|
38
|
+
public cluster(descriptors: Mat): Mat;
|
|
39
|
+
|
|
40
|
+
public descriptorsCount(): int;
|
|
41
|
+
|
|
42
|
+
public getDescriptors(): Mat;
|
|
43
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bool,
|
|
3
|
+
double,
|
|
4
|
+
FileNode,
|
|
5
|
+
InputArray,
|
|
6
|
+
int,
|
|
7
|
+
Mat,
|
|
8
|
+
Ptr,
|
|
9
|
+
Size,
|
|
10
|
+
} from "./_types";
|
|
11
|
+
|
|
12
|
+
export declare class CascadeClassifier extends Mat {
|
|
13
|
+
public cc: Ptr;
|
|
14
|
+
|
|
15
|
+
public constructor();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param filename Name of the file from which the classifier is loaded.
|
|
19
|
+
*/
|
|
20
|
+
public constructor(filename: String);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The function is parallelized with the TBB library.
|
|
24
|
+
*
|
|
25
|
+
* (Python) A face detection example using cascade classifiers can be found at
|
|
26
|
+
* opencv_source_code/samples/python/facedetect.py
|
|
27
|
+
*
|
|
28
|
+
* @param image Matrix of the type CV_8U containing an image where objects are detected.
|
|
29
|
+
*
|
|
30
|
+
* @param objects Vector of rectangles where each rectangle contains the detected object, the
|
|
31
|
+
* rectangles may be partially outside the original image.
|
|
32
|
+
*
|
|
33
|
+
* @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
|
|
34
|
+
*
|
|
35
|
+
* @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
|
|
36
|
+
* to retain it.
|
|
37
|
+
*
|
|
38
|
+
* @param flags Parameter with the same meaning for an old cascade as in the function
|
|
39
|
+
* cvHaarDetectObjects. It is not used for a new cascade.
|
|
40
|
+
*
|
|
41
|
+
* @param minSize Minimum possible object size. Objects smaller than that are ignored.
|
|
42
|
+
*
|
|
43
|
+
* @param maxSize Maximum possible object size. Objects larger than that are ignored. If maxSize ==
|
|
44
|
+
* minSize model is evaluated on single scale.
|
|
45
|
+
*/
|
|
46
|
+
public detectMultiScale(
|
|
47
|
+
image: InputArray,
|
|
48
|
+
objects: any,
|
|
49
|
+
scaleFactor?: double,
|
|
50
|
+
minNeighbors?: int,
|
|
51
|
+
flags?: int,
|
|
52
|
+
minSize?: Size,
|
|
53
|
+
maxSize?: Size,
|
|
54
|
+
): InputArray;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* This is an overloaded member function, provided for convenience. It differs from the above
|
|
58
|
+
* function only in what argument(s) it accepts.
|
|
59
|
+
*
|
|
60
|
+
* @param image Matrix of the type CV_8U containing an image where objects are detected.
|
|
61
|
+
*
|
|
62
|
+
* @param objects Vector of rectangles where each rectangle contains the detected object, the
|
|
63
|
+
* rectangles may be partially outside the original image.
|
|
64
|
+
*
|
|
65
|
+
* @param numDetections Vector of detection numbers for the corresponding objects. An object's number
|
|
66
|
+
* of detections is the number of neighboring positively classified rectangles that were joined
|
|
67
|
+
* together to form the object.
|
|
68
|
+
*
|
|
69
|
+
* @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
|
|
70
|
+
*
|
|
71
|
+
* @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
|
|
72
|
+
* to retain it.
|
|
73
|
+
*
|
|
74
|
+
* @param flags Parameter with the same meaning for an old cascade as in the function
|
|
75
|
+
* cvHaarDetectObjects. It is not used for a new cascade.
|
|
76
|
+
*
|
|
77
|
+
* @param minSize Minimum possible object size. Objects smaller than that are ignored.
|
|
78
|
+
*
|
|
79
|
+
* @param maxSize Maximum possible object size. Objects larger than that are ignored. If maxSize ==
|
|
80
|
+
* minSize model is evaluated on single scale.
|
|
81
|
+
*/
|
|
82
|
+
public detectMultiScale(
|
|
83
|
+
image: InputArray,
|
|
84
|
+
objects: any,
|
|
85
|
+
numDetections: any,
|
|
86
|
+
scaleFactor?: double,
|
|
87
|
+
minNeighbors?: int,
|
|
88
|
+
flags?: int,
|
|
89
|
+
minSize?: Size,
|
|
90
|
+
maxSize?: Size,
|
|
91
|
+
): InputArray;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* This is an overloaded member function, provided for convenience. It differs from the above
|
|
95
|
+
* function only in what argument(s) it accepts. This function allows you to retrieve the final stage
|
|
96
|
+
* decision certainty of classification. For this, one needs to set `outputRejectLevels` on true and
|
|
97
|
+
* provide the `rejectLevels` and `levelWeights` parameter. For each resulting detection,
|
|
98
|
+
* `levelWeights` will then contain the certainty of classification at the final stage. This value can
|
|
99
|
+
* then be used to separate strong from weaker classifications.
|
|
100
|
+
*
|
|
101
|
+
* A code sample on how to use it efficiently can be found below:
|
|
102
|
+
*
|
|
103
|
+
* ```cpp
|
|
104
|
+
* Mat img;
|
|
105
|
+
* vector<double> weights;
|
|
106
|
+
* vector<int> levels;
|
|
107
|
+
* vector<Rect> detections;
|
|
108
|
+
* CascadeClassifier model("/path/to/your/model.xml");
|
|
109
|
+
* model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
|
|
110
|
+
* cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
public detectMultiScale(
|
|
114
|
+
image: InputArray,
|
|
115
|
+
objects: any,
|
|
116
|
+
rejectLevels: any,
|
|
117
|
+
levelWeights: any,
|
|
118
|
+
scaleFactor?: double,
|
|
119
|
+
minNeighbors?: int,
|
|
120
|
+
flags?: int,
|
|
121
|
+
minSize?: Size,
|
|
122
|
+
maxSize?: Size,
|
|
123
|
+
outputRejectLevels?: bool,
|
|
124
|
+
): InputArray;
|
|
125
|
+
|
|
126
|
+
public empty(): bool;
|
|
127
|
+
|
|
128
|
+
public getFeatureType(): int;
|
|
129
|
+
|
|
130
|
+
public getMaskGenerator(): Ptr;
|
|
131
|
+
|
|
132
|
+
public getOldCascade(): any;
|
|
133
|
+
|
|
134
|
+
public getOriginalWindowSize(): Size;
|
|
135
|
+
|
|
136
|
+
public isOldFormatCascade(): bool;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @param filename Name of the file from which the classifier is loaded. The file may contain an old
|
|
140
|
+
* HAAR classifier trained by the haartraining application or a new cascade classifier trained by the
|
|
141
|
+
* traincascade application.
|
|
142
|
+
*/
|
|
143
|
+
public load(filename: String): String;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The file may contain a new cascade classifier (trained traincascade application) only.
|
|
147
|
+
*/
|
|
148
|
+
public read(node: FileNode): FileNode;
|
|
149
|
+
|
|
150
|
+
public setMaskGenerator(maskGenerator: Ptr): Ptr;
|
|
151
|
+
|
|
152
|
+
public static convert(oldcascade: String, newcascade: String): String;
|
|
153
|
+
}
|