@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.
Files changed (54) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/lib/index.d.ts +2 -0
  4. package/lib/opencv/Affine3.d.ts +206 -0
  5. package/lib/opencv/Algorithm.d.ts +126 -0
  6. package/lib/opencv/AutoBuffer.d.ts +50 -0
  7. package/lib/opencv/BFMatcher.d.ts +37 -0
  8. package/lib/opencv/BOWTrainer.d.ts +43 -0
  9. package/lib/opencv/CascadeClassifier.d.ts +153 -0
  10. package/lib/opencv/DescriptorMatcher.d.ts +236 -0
  11. package/lib/opencv/DynamicBitset.d.ts +68 -0
  12. package/lib/opencv/Exception.d.ts +54 -0
  13. package/lib/opencv/Feature2D.d.ts +20 -0
  14. package/lib/opencv/FlannBasedMatcher.d.ts +57 -0
  15. package/lib/opencv/HOGDescriptor.d.ts +401 -0
  16. package/lib/opencv/Logger.d.ts +34 -0
  17. package/lib/opencv/LshTable.d.ts +81 -0
  18. package/lib/opencv/Mat.d.ts +1793 -0
  19. package/lib/opencv/MatExpr.d.ts +107 -0
  20. package/lib/opencv/MatOp.d.ts +72 -0
  21. package/lib/opencv/Matx.d.ts +228 -0
  22. package/lib/opencv/Node.d.ts +33 -0
  23. package/lib/opencv/ORB.d.ts +23 -0
  24. package/lib/opencv/PCA.d.ts +198 -0
  25. package/lib/opencv/RotatedRect.d.ts +73 -0
  26. package/lib/opencv/Tracker.d.ts +1 -0
  27. package/lib/opencv/TrackerMIL.d.ts +3 -0
  28. package/lib/opencv/_types.d.ts +48 -0
  29. package/lib/opencv/calib3d.d.ts +2937 -0
  30. package/lib/opencv/core_array.d.ts +3102 -0
  31. package/lib/opencv/core_cluster.d.ts +80 -0
  32. package/lib/opencv/core_hal_interface.d.ts +159 -0
  33. package/lib/opencv/core_utils.d.ts +748 -0
  34. package/lib/opencv/dnn.d.ts +505 -0
  35. package/lib/opencv/features2d_draw.d.ts +114 -0
  36. package/lib/opencv/fisheye.d.ts +26 -0
  37. package/lib/opencv/helpers.d.ts +274 -0
  38. package/lib/opencv/imgproc_color_conversions.d.ts +527 -0
  39. package/lib/opencv/imgproc_draw.d.ts +732 -0
  40. package/lib/opencv/imgproc_feature.d.ts +681 -0
  41. package/lib/opencv/imgproc_filter.d.ts +918 -0
  42. package/lib/opencv/imgproc_hist.d.ts +399 -0
  43. package/lib/opencv/imgproc_misc.d.ts +616 -0
  44. package/lib/opencv/imgproc_object.d.ts +58 -0
  45. package/lib/opencv/imgproc_shape.d.ts +724 -0
  46. package/lib/opencv/imgproc_transform.d.ts +574 -0
  47. package/lib/opencv/missing.d.ts +58 -0
  48. package/lib/opencv/objdetect.d.ts +103 -0
  49. package/lib/opencv/photo_inpaint.d.ts +39 -0
  50. package/lib/opencv/softdouble.d.ts +71 -0
  51. package/lib/opencv/softfloat.d.ts +71 -0
  52. package/lib/opencv/video_track.d.ts +370 -0
  53. package/package.json +18 -0
  54. package/tsconfig.json +15 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @opencvjs/types
2
+
3
+ This package contains the TypeScript definitions for the [OpenCV.js](https://docs.opencv.org/4.x/d0/d84/tutorial_js_usage.html) library.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @opencvjs/types
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import type { OpenCV } from "@opencvjs/types";
15
+ ```
16
+
17
+ ## Credits
18
+
19
+ The definitions are based on the [@techstark/opencv-js](https://github.com/TechStark/opencv-js) and [mirada](https://github.com/cancerberoSgx/mirada) projects.
20
+
21
+ ## License
22
+
23
+ Apache-2.0
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type * as OpenCV from "./opencv/_types";
2
+ export type { OpenCV };
@@ -0,0 +1,206 @@
1
+ import type { 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 type {
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 type { 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 type { bool, DescriptorMatcher, 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 extends DescriptorMatcher {
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
+ }