@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
@@ -0,0 +1,724 @@
1
+ import type { RotatedRect } from "./_types";
2
+ import type {
3
+ Circle,
4
+ InputArray,
5
+ OutputArray,
6
+ OutputArrayOfArrays,
7
+ Point,
8
+ Point2f,
9
+ Rect,
10
+ } from "./helpers";
11
+ import type { bool, double, float, int, Moments } from "./missing";
12
+
13
+ /*
14
+ * # Structural Analysis and Shape Descriptors
15
+ *
16
+ */
17
+ /**
18
+ * The function [cv::approxPolyDP] approximates a curve or a polygon with another curve/polygon with
19
+ * less vertices so that the distance between them is less or equal to the specified precision. It uses
20
+ * the Douglas-Peucker algorithm
21
+ *
22
+ * @param curve Input vector of a 2D point stored in std::vector or Mat
23
+ *
24
+ * @param approxCurve Result of the approximation. The type should match the type of the input curve.
25
+ *
26
+ * @param epsilon Parameter specifying the approximation accuracy. This is the maximum distance between
27
+ * the original curve and its approximation.
28
+ *
29
+ * @param closed If true, the approximated curve is closed (its first and last vertices are connected).
30
+ * Otherwise, it is not closed.
31
+ */
32
+ export declare function approxPolyDP(
33
+ curve: InputArray,
34
+ approxCurve: OutputArray,
35
+ epsilon: double,
36
+ closed: bool,
37
+ ): void;
38
+
39
+ /**
40
+ * The function computes a curve length or a closed contour perimeter.
41
+ *
42
+ * @param curve Input vector of 2D points, stored in std::vector or Mat.
43
+ *
44
+ * @param closed Flag indicating whether the curve is closed or not.
45
+ */
46
+ export declare function arcLength(curve: InputArray, closed: bool): double;
47
+
48
+ /**
49
+ * The function calculates and returns the minimal up-right bounding rectangle for the specified point
50
+ * set or non-zero pixels of gray-scale image.
51
+ *
52
+ * @param array Input gray-scale image or 2D point set, stored in std::vector or Mat.
53
+ */
54
+ export declare function boundingRect(array: InputArray): Rect;
55
+
56
+ /**
57
+ * The function finds the four vertices of a rotated rectangle. This function is useful to draw the
58
+ * rectangle. In C++, instead of using this function, you can directly use [RotatedRect::points]
59
+ * method. Please visit the [tutorial on Creating Bounding rotated boxes and ellipses for contours] for
60
+ * more information.
61
+ *
62
+ * @param box The input rotated rectangle. It may be the output of
63
+ *
64
+ * @param points The output array of four vertices of rectangles.
65
+ */
66
+ export declare function boxPoints(box: RotatedRect, points: OutputArray): void;
67
+
68
+ /**
69
+ * image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
70
+ * represents the background label. ltype specifies the output label image type, an important
71
+ * consideration based on the total number of labels or alternatively the total number of pixels in the
72
+ * source image. ccltype specifies the connected components labeling algorithm to use, currently Grana
73
+ * (BBDT) and Wu's (SAUF) algorithms are supported, see the [ConnectedComponentsAlgorithmsTypes] for
74
+ * details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. This
75
+ * function uses parallel version of both Grana and Wu's algorithms if at least one allowed parallel
76
+ * framework is enabled and if the rows of the image are at least twice the number returned by
77
+ * [getNumberOfCPUs].
78
+ *
79
+ * @param image the 8-bit single-channel image to be labeled
80
+ *
81
+ * @param labels destination labeled image
82
+ *
83
+ * @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
84
+ *
85
+ * @param ltype output image label type. Currently CV_32S and CV_16U are supported.
86
+ *
87
+ * @param ccltype connected components algorithm type (see the ConnectedComponentsAlgorithmsTypes).
88
+ */
89
+ export declare function connectedComponents(
90
+ image: InputArray,
91
+ labels: OutputArray,
92
+ connectivity: int,
93
+ ltype: int,
94
+ ccltype: int,
95
+ ): int;
96
+
97
+ /**
98
+ * This is an overloaded member function, provided for convenience. It differs from the above function
99
+ * only in what argument(s) it accepts.
100
+ *
101
+ * @param image the 8-bit single-channel image to be labeled
102
+ *
103
+ * @param labels destination labeled image
104
+ *
105
+ * @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
106
+ *
107
+ * @param ltype output image label type. Currently CV_32S and CV_16U are supported.
108
+ */
109
+ export declare function connectedComponents(
110
+ image: InputArray,
111
+ labels: OutputArray,
112
+ connectivity?: int,
113
+ ltype?: int,
114
+ ): int;
115
+
116
+ /**
117
+ * image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
118
+ * represents the background label. ltype specifies the output label image type, an important
119
+ * consideration based on the total number of labels or alternatively the total number of pixels in the
120
+ * source image. ccltype specifies the connected components labeling algorithm to use, currently
121
+ * Grana's (BBDT) and Wu's (SAUF) algorithms are supported, see the
122
+ * [ConnectedComponentsAlgorithmsTypes] for details. Note that SAUF algorithm forces a row major
123
+ * ordering of labels while BBDT does not. This function uses parallel version of both Grana and Wu's
124
+ * algorithms (statistics included) if at least one allowed parallel framework is enabled and if the
125
+ * rows of the image are at least twice the number returned by [getNumberOfCPUs].
126
+ *
127
+ * @param image the 8-bit single-channel image to be labeled
128
+ *
129
+ * @param labels destination labeled image
130
+ *
131
+ * @param stats statistics output for each label, including the background label, see below for
132
+ * available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
133
+ * ConnectedComponentsTypes. The data type is CV_32S.
134
+ *
135
+ * @param centroids centroid output for each label, including the background label. Centroids are
136
+ * accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
137
+ *
138
+ * @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
139
+ *
140
+ * @param ltype output image label type. Currently CV_32S and CV_16U are supported.
141
+ *
142
+ * @param ccltype connected components algorithm type (see ConnectedComponentsAlgorithmsTypes).
143
+ */
144
+ export declare function connectedComponentsWithStats(
145
+ image: InputArray,
146
+ labels: OutputArray,
147
+ stats: OutputArray,
148
+ centroids: OutputArray,
149
+ connectivity: int,
150
+ ltype: int,
151
+ ccltype: int,
152
+ ): int;
153
+
154
+ /**
155
+ * This is an overloaded member function, provided for convenience. It differs from the above function
156
+ * only in what argument(s) it accepts.
157
+ *
158
+ * @param image the 8-bit single-channel image to be labeled
159
+ *
160
+ * @param labels destination labeled image
161
+ *
162
+ * @param stats statistics output for each label, including the background label, see below for
163
+ * available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
164
+ * ConnectedComponentsTypes. The data type is CV_32S.
165
+ *
166
+ * @param centroids centroid output for each label, including the background label. Centroids are
167
+ * accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
168
+ *
169
+ * @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
170
+ *
171
+ * @param ltype output image label type. Currently CV_32S and CV_16U are supported.
172
+ */
173
+ export declare function connectedComponentsWithStats(
174
+ image: InputArray,
175
+ labels: OutputArray,
176
+ stats: OutputArray,
177
+ centroids: OutputArray,
178
+ connectivity?: int,
179
+ ltype?: int,
180
+ ): int;
181
+
182
+ /**
183
+ * The function computes a contour area. Similarly to moments , the area is computed using the Green
184
+ * formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using
185
+ * [drawContours] or [fillPoly] , can be different. Also, the function will most certainly give a wrong
186
+ * results for contours with self-intersections.
187
+ *
188
+ * Example:
189
+ *
190
+ * ```cpp
191
+ * vector<Point> contour;
192
+ * contour.push_back(Point2f(0, 0));
193
+ * contour.push_back(Point2f(10, 0));
194
+ * contour.push_back(Point2f(10, 10));
195
+ * contour.push_back(Point2f(5, 4));
196
+ *
197
+ * double area0 = contourArea(contour);
198
+ * vector<Point> approx;
199
+ * approxPolyDP(contour, approx, 5, true);
200
+ * double area1 = contourArea(approx);
201
+ *
202
+ * cout << "area0 =" << area0 << endl <<
203
+ * "area1 =" << area1 << endl <<
204
+ * "approx poly vertices" << approx.size() << endl;
205
+ * ```
206
+ *
207
+ * @param contour Input vector of 2D points (contour vertices), stored in std::vector or Mat.
208
+ *
209
+ * @param oriented Oriented area flag. If it is true, the function returns a signed area value,
210
+ * depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can
211
+ * determine orientation of a contour by taking the sign of an area. By default, the parameter is
212
+ * false, which means that the absolute value is returned.
213
+ */
214
+ export declare function contourArea(
215
+ contour: InputArray,
216
+ oriented?: bool,
217
+ ): double;
218
+
219
+ /**
220
+ * The function [cv::convexHull] finds the convex hull of a 2D point set using the Sklansky's algorithm
221
+ * Sklansky82 that has *O(N logN)* complexity in the current implementation.
222
+ *
223
+ * `points` and `hull` should be different arrays, inplace processing isn't supported.
224
+ * Check [the corresponding tutorial] for more details.
225
+ *
226
+ * useful links:
227
+ *
228
+ * @param points Input 2D point set, stored in std::vector or Mat.
229
+ *
230
+ * @param hull Output convex hull. It is either an integer vector of indices or vector of points. In
231
+ * the first case, the hull elements are 0-based indices of the convex hull points in the original
232
+ * array (since the set of convex hull points is a subset of the original point set). In the second
233
+ * case, hull elements are the convex hull points themselves.
234
+ *
235
+ * @param clockwise Orientation flag. If it is true, the output convex hull is oriented clockwise.
236
+ * Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
237
+ * to the right, and its Y axis pointing upwards.
238
+ *
239
+ * @param returnPoints Operation flag. In case of a matrix, when the flag is true, the function returns
240
+ * convex hull points. Otherwise, it returns indices of the convex hull points. When the output array
241
+ * is std::vector, the flag is ignored, and the output depends on the type of the vector:
242
+ * std::vector<int> implies returnPoints=false, std::vector<Point> implies returnPoints=true.
243
+ */
244
+ export declare function convexHull(
245
+ points: InputArray,
246
+ hull: OutputArray,
247
+ clockwise?: bool,
248
+ returnPoints?: bool,
249
+ ): void;
250
+
251
+ /**
252
+ * The figure below displays convexity defects of a hand contour:
253
+ *
254
+ * @param contour Input contour.
255
+ *
256
+ * @param convexhull Convex hull obtained using convexHull that should contain indices of the contour
257
+ * points that make the hull.
258
+ *
259
+ * @param convexityDefects The output vector of convexity defects. In C++ and the new Python/Java
260
+ * interface each convexity defect is represented as 4-element integer vector (a.k.a. Vec4i):
261
+ * (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the
262
+ * original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is
263
+ * fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour
264
+ * point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.
265
+ */
266
+ export declare function convexityDefects(
267
+ contour: InputArray,
268
+ convexhull: InputArray,
269
+ convexityDefects: OutputArray,
270
+ ): void;
271
+
272
+ export declare function createGeneralizedHoughBallard(): any;
273
+
274
+ export declare function createGeneralizedHoughGuil(): any;
275
+
276
+ /**
277
+ * The function retrieves contours from the binary image using the algorithm Suzuki85 . The contours
278
+ * are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the
279
+ * OpenCV sample directory.
280
+ *
281
+ * Since opencv 3.2 source image is not modified by this function.
282
+ *
283
+ * @param image Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero pixels
284
+ * remain 0's, so the image is treated as binary . You can use compare, inRange, threshold ,
285
+ * adaptiveThreshold, Canny, and others to create a binary image out of a grayscale or color one. If
286
+ * mode equals to RETR_CCOMP or RETR_FLOODFILL, the input can also be a 32-bit integer image of labels
287
+ * (CV_32SC1).
288
+ *
289
+ * @param contours Detected contours. Each contour is stored as a vector of points (e.g.
290
+ * std::vector<std::vector<cv::Point> >).
291
+ *
292
+ * @param hierarchy Optional output vector (e.g. std::vector<cv::Vec4i>), containing information about
293
+ * the image topology. It has as many elements as the number of contours. For each i-th contour
294
+ * contours[i], the elements hierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3]
295
+ * are set to 0-based indices in contours of the next and previous contours at the same hierarchical
296
+ * level, the first child contour and the parent contour, respectively. If for the contour i there are
297
+ * no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be
298
+ * negative.
299
+ *
300
+ * @param mode Contour retrieval mode, see RetrievalModes
301
+ *
302
+ * @param method Contour approximation method, see ContourApproximationModes
303
+ *
304
+ * @param offset Optional offset by which every contour point is shifted. This is useful if the
305
+ * contours are extracted from the image ROI and then they should be analyzed in the whole image
306
+ * context.
307
+ */
308
+ export declare function findContours(
309
+ image: InputArray,
310
+ contours: OutputArrayOfArrays,
311
+ hierarchy: OutputArray,
312
+ mode: int,
313
+ method: int,
314
+ offset?: Point,
315
+ ): void;
316
+
317
+ /**
318
+ * This is an overloaded member function, provided for convenience. It differs from the above function
319
+ * only in what argument(s) it accepts.
320
+ */
321
+ export declare function findContours(
322
+ image: InputArray,
323
+ contours: OutputArrayOfArrays,
324
+ mode: int,
325
+ method: int,
326
+ offset?: Point,
327
+ ): void;
328
+
329
+ /**
330
+ * The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of
331
+ * all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm
332
+ * described by Fitzgibbon95 is used. Developer should keep in mind that it is possible that the
333
+ * returned ellipse/rotatedRect data contains negative indices, due to the data points being close to
334
+ * the border of the containing [Mat] element.
335
+ *
336
+ * @param points Input 2D point set, stored in std::vector<> or Mat
337
+ */
338
+ export declare function fitEllipse(points: InputArray): RotatedRect;
339
+
340
+ /**
341
+ * The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle
342
+ * in which the ellipse is inscribed. The Approximate Mean Square (AMS) proposed by Taubin1991 is used.
343
+ *
344
+ * For an ellipse, this basis set is `$ \\chi= \\left(x^2, x y, y^2, x, y, 1\\right) $`, which is a set
345
+ * of six free coefficients `$
346
+ * A^T=\\left\\{A_{\\text{xx}},A_{\\text{xy}},A_{\\text{yy}},A_x,A_y,A_0\\right\\} $`. However, to
347
+ * specify an ellipse, all that is needed is five numbers; the major and minor axes lengths `$ (a,b)
348
+ * $`, the position `$ (x_0,y_0) $`, and the orientation `$ \\theta $`. This is because the basis set
349
+ * includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as
350
+ * possible fits. If the fit is found to be a parabolic or hyperbolic function then the standard
351
+ * [fitEllipse] method is used. The AMS method restricts the fit to parabolic, hyperbolic and
352
+ * elliptical curves by imposing the condition that `$ A^T ( D_x^T D_x + D_y^T D_y) A = 1 $` where the
353
+ * matrices `$ Dx $` and `$ Dy $` are the partial derivatives of the design matrix `$ D $` with respect
354
+ * to x and y. The matrices are formed row by row applying the following to each of the points in the
355
+ * set: `\\begin{align*} D(i,:)&=\\left\\{x_i^2, x_i y_i, y_i^2, x_i, y_i, 1\\right\\} &
356
+ * D_x(i,:)&=\\left\\{2 x_i,y_i,0,1,0,0\\right\\} & D_y(i,:)&=\\left\\{0,x_i,2 y_i,0,1,0\\right\\}
357
+ * \\end{align*}` The AMS method minimizes the cost function `\\begin{equation*} \\epsilon ^2=\\frac{
358
+ * A^T D^T D A }{ A^T (D_x^T D_x + D_y^T D_y) A^T } \\end{equation*}`
359
+ *
360
+ * The minimum cost is found by solving the generalized eigenvalue problem.
361
+ *
362
+ * `\\begin{equation*} D^T D A = \\lambda \\left( D_x^T D_x + D_y^T D_y\\right) A \\end{equation*}`
363
+ *
364
+ * @param points Input 2D point set, stored in std::vector<> or Mat
365
+ */
366
+ export declare function fitEllipseAMS(points: InputArray): RotatedRect;
367
+
368
+ /**
369
+ * The function calculates the ellipse that fits a set of 2D points. It returns the rotated rectangle
370
+ * in which the ellipse is inscribed. The Direct least square (Direct) method by Fitzgibbon1999 is
371
+ * used.
372
+ *
373
+ * For an ellipse, this basis set is `$ \\chi= \\left(x^2, x y, y^2, x, y, 1\\right) $`, which is a set
374
+ * of six free coefficients `$
375
+ * A^T=\\left\\{A_{\\text{xx}},A_{\\text{xy}},A_{\\text{yy}},A_x,A_y,A_0\\right\\} $`. However, to
376
+ * specify an ellipse, all that is needed is five numbers; the major and minor axes lengths `$ (a,b)
377
+ * $`, the position `$ (x_0,y_0) $`, and the orientation `$ \\theta $`. This is because the basis set
378
+ * includes lines, quadratics, parabolic and hyperbolic functions as well as elliptical functions as
379
+ * possible fits. The Direct method confines the fit to ellipses by ensuring that `$ 4 A_{xx} A_{yy}-
380
+ * A_{xy}^2 > 0 $`. The condition imposed is that `$ 4 A_{xx} A_{yy}- A_{xy}^2=1 $` which satisfies the
381
+ * inequality and as the coefficients can be arbitrarily scaled is not overly restrictive.
382
+ *
383
+ * `\\begin{equation*} \\epsilon ^2= A^T D^T D A \\quad \\text{with} \\quad A^T C A =1 \\quad
384
+ * \\text{and} \\quad C=\\left(\\begin{matrix} 0 & 0 & 2 & 0 & 0 & 0 \\\\ 0 & -1 & 0 & 0 & 0 & 0 \\\\ 2
385
+ * & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 0 & 0
386
+ * \\end{matrix} \\right) \\end{equation*}`
387
+ *
388
+ * The minimum cost is found by solving the generalized eigenvalue problem.
389
+ *
390
+ * `\\begin{equation*} D^T D A = \\lambda \\left( C\\right) A \\end{equation*}`
391
+ *
392
+ * The system produces only one positive eigenvalue `$ \\lambda$` which is chosen as the solution with
393
+ * its eigenvector `$\\mathbf{u}$`. These are used to find the coefficients
394
+ *
395
+ * `\\begin{equation*} A = \\sqrt{\\frac{1}{\\mathbf{u}^T C \\mathbf{u}}} \\mathbf{u} \\end{equation*}`
396
+ * The scaling factor guarantees that `$A^T C A =1$`.
397
+ *
398
+ * @param points Input 2D point set, stored in std::vector<> or Mat
399
+ */
400
+ export declare function fitEllipseDirect(points: InputArray): RotatedRect;
401
+
402
+ /**
403
+ * The function fitLine fits a line to a 2D or 3D point set by minimizing `$\\sum_i \\rho(r_i)$` where
404
+ * `$r_i$` is a distance between the `$i^{th}$` point, the line and `$\\rho(r)$` is a distance
405
+ * function, one of the following:
406
+ *
407
+ * DIST_L2 `\\[\\rho (r) = r^2/2 \\quad \\text{(the simplest and the fastest least-squares method)}\\]`
408
+ * DIST_L1 `\\[\\rho (r) = r\\]`
409
+ * DIST_L12 `\\[\\rho (r) = 2 \\cdot ( \\sqrt{1 + \\frac{r^2}{2}} - 1)\\]`
410
+ * DIST_FAIR `\\[\\rho \\left (r \\right ) = C^2 \\cdot \\left ( \\frac{r}{C} - \\log{\\left(1 +
411
+ * \\frac{r}{C}\\right)} \\right ) \\quad \\text{where} \\quad C=1.3998\\]`
412
+ * DIST_WELSCH `\\[\\rho \\left (r \\right ) = \\frac{C^2}{2} \\cdot \\left ( 1 -
413
+ * \\exp{\\left(-\\left(\\frac{r}{C}\\right)^2\\right)} \\right ) \\quad \\text{where} \\quad
414
+ * C=2.9846\\]`
415
+ * DIST_HUBER `\\[\\rho (r) = \\fork{r^2/2}{if \\(r < C\\)}{C \\cdot (r-C/2)}{otherwise} \\quad
416
+ * \\text{where} \\quad C=1.345\\]`
417
+ *
418
+ * The algorithm is based on the M-estimator ( ) technique that iteratively fits the line using the
419
+ * weighted least-squares algorithm. After each iteration the weights `$w_i$` are adjusted to be
420
+ * inversely proportional to `$\\rho(r_i)$` .
421
+ *
422
+ * @param points Input vector of 2D or 3D points, stored in std::vector<> or Mat.
423
+ *
424
+ * @param line Output line parameters. In case of 2D fitting, it should be a vector of 4 elements (like
425
+ * Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0)
426
+ * is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like Vec6f) -
427
+ * (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0,
428
+ * y0, z0) is a point on the line.
429
+ *
430
+ * @param distType Distance used by the M-estimator, see DistanceTypes
431
+ *
432
+ * @param param Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is
433
+ * chosen.
434
+ *
435
+ * @param reps Sufficient accuracy for the radius (distance between the coordinate origin and the
436
+ * line).
437
+ *
438
+ * @param aeps Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.
439
+ */
440
+ export declare function fitLine(
441
+ points: InputArray,
442
+ line: OutputArray,
443
+ distType: int,
444
+ param: double,
445
+ reps: double,
446
+ aeps: double,
447
+ ): void;
448
+
449
+ /**
450
+ * The function calculates seven Hu invariants (introduced in Hu62; see also ) defined as:
451
+ *
452
+ * `\\[\\begin{array}{l} hu[0]= \\eta _{20}+ \\eta _{02} \\\\ hu[1]=( \\eta _{20}- \\eta _{02})^{2}+4
453
+ * \\eta _{11}^{2} \\\\ hu[2]=( \\eta _{30}-3 \\eta _{12})^{2}+ (3 \\eta _{21}- \\eta _{03})^{2} \\\\
454
+ * hu[3]=( \\eta _{30}+ \\eta _{12})^{2}+ ( \\eta _{21}+ \\eta _{03})^{2} \\\\ hu[4]=( \\eta _{30}-3
455
+ * \\eta _{12})( \\eta _{30}+ \\eta _{12})[( \\eta _{30}+ \\eta _{12})^{2}-3( \\eta _{21}+ \\eta
456
+ * _{03})^{2}]+(3 \\eta _{21}- \\eta _{03})( \\eta _{21}+ \\eta _{03})[3( \\eta _{30}+ \\eta
457
+ * _{12})^{2}-( \\eta _{21}+ \\eta _{03})^{2}] \\\\ hu[5]=( \\eta _{20}- \\eta _{02})[( \\eta _{30}+
458
+ * \\eta _{12})^{2}- ( \\eta _{21}+ \\eta _{03})^{2}]+4 \\eta _{11}( \\eta _{30}+ \\eta _{12})( \\eta
459
+ * _{21}+ \\eta _{03}) \\\\ hu[6]=(3 \\eta _{21}- \\eta _{03})( \\eta _{21}+ \\eta _{03})[3( \\eta
460
+ * _{30}+ \\eta _{12})^{2}-( \\eta _{21}+ \\eta _{03})^{2}]-( \\eta _{30}-3 \\eta _{12})( \\eta _{21}+
461
+ * \\eta _{03})[3( \\eta _{30}+ \\eta _{12})^{2}-( \\eta _{21}+ \\eta _{03})^{2}] \\\\ \\end{array}\\]`
462
+ *
463
+ * where `$\\eta_{ji}$` stands for `$\\texttt{Moments::nu}_{ji}$` .
464
+ *
465
+ * These values are proved to be invariants to the image scale, rotation, and reflection except the
466
+ * seventh one, whose sign is changed by reflection. This invariance is proved with the assumption of
467
+ * infinite image resolution. In case of raster images, the computed Hu invariants for the original and
468
+ * transformed images are a bit different.
469
+ *
470
+ * [matchShapes]
471
+ *
472
+ * @param moments Input moments computed with moments .
473
+ *
474
+ * @param hu Output Hu invariants.
475
+ */
476
+ export declare function HuMoments(moments: any, hu: double): void;
477
+
478
+ /**
479
+ * This is an overloaded member function, provided for convenience. It differs from the above function
480
+ * only in what argument(s) it accepts.
481
+ */
482
+ export declare function HuMoments(m: any, hu: OutputArray): void;
483
+
484
+ export declare function intersectConvexConvex(
485
+ _p1: InputArray,
486
+ _p2: InputArray,
487
+ _p12: OutputArray,
488
+ handleNested?: bool,
489
+ ): float;
490
+
491
+ /**
492
+ * The function tests whether the input contour is convex or not. The contour must be simple, that is,
493
+ * without self-intersections. Otherwise, the function output is undefined.
494
+ *
495
+ * @param contour Input vector of 2D points, stored in std::vector<> or Mat
496
+ */
497
+ export declare function isContourConvex(contour: InputArray): bool;
498
+
499
+ /**
500
+ * The function compares two shapes. All three implemented methods use the Hu invariants (see
501
+ * [HuMoments])
502
+ *
503
+ * @param contour1 First contour or grayscale image.
504
+ *
505
+ * @param contour2 Second contour or grayscale image.
506
+ *
507
+ * @param method Comparison method, see ShapeMatchModes
508
+ *
509
+ * @param parameter Method-specific parameter (not supported now).
510
+ */
511
+ export declare function matchShapes(
512
+ contour1: InputArray,
513
+ contour2: InputArray,
514
+ method: int,
515
+ parameter: double,
516
+ ): double;
517
+
518
+ /**
519
+ * The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a
520
+ * specified point set. Developer should keep in mind that the returned [RotatedRect] can contain
521
+ * negative indices when data is close to the containing [Mat] element boundary.
522
+ *
523
+ * @param points Input vector of 2D points, stored in std::vector<> or Mat
524
+ */
525
+ export declare function minAreaRect(points: InputArray): RotatedRect;
526
+
527
+ /**
528
+ * The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm.
529
+ *
530
+ * @param points Input vector of 2D points, stored in std::vector<> or Mat
531
+ */
532
+ export declare function minEnclosingCircle(points: InputArray): Circle;
533
+
534
+ /**
535
+ * The function finds a triangle of minimum area enclosing the given set of 2D points and returns its
536
+ * area. The output for a given 2D point set is shown in the image below. 2D points are depicted in
537
+ * red* and the enclosing triangle in *yellow*.
538
+ *
539
+ * The implementation of the algorithm is based on O'Rourke's ORourke86 and Klee and Laskowski's
540
+ * KleeLaskowski85 papers. O'Rourke provides a `$\\theta(n)$` algorithm for finding the minimal
541
+ * enclosing triangle of a 2D convex polygon with n vertices. Since the [minEnclosingTriangle] function
542
+ * takes a 2D point set as input an additional preprocessing step of computing the convex hull of the
543
+ * 2D point set is required. The complexity of the [convexHull] function is `$O(n log(n))$` which is
544
+ * higher than `$\\theta(n)$`. Thus the overall complexity of the function is `$O(n log(n))$`.
545
+ *
546
+ * @param points Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector<> or Mat
547
+ *
548
+ * @param triangle Output vector of three 2D points defining the vertices of the triangle. The depth of
549
+ * the OutputArray must be CV_32F.
550
+ */
551
+ export declare function minEnclosingTriangle(
552
+ points: InputArray,
553
+ triangle: OutputArray,
554
+ ): double;
555
+
556
+ /**
557
+ * The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The
558
+ * results are returned in the structure [cv::Moments].
559
+ *
560
+ * moments.
561
+ *
562
+ * Only applicable to contour moments calculations from Python bindings: Note that the numpy type for
563
+ * the input array should be either np.int32 or np.float32.
564
+ *
565
+ * [contourArea], [arcLength]
566
+ *
567
+ * @param array Raster image (single-channel, 8-bit or floating-point 2D array) or an array ( $1 \times
568
+ * N$ or $N \times 1$ ) of 2D points (Point or Point2f ).
569
+ *
570
+ * @param binaryImage If it is true, all non-zero image pixels are treated as 1's. The parameter is
571
+ * used for images only.
572
+ */
573
+ export declare function moments(array: InputArray, binaryImage?: bool): Moments;
574
+
575
+ /**
576
+ * The function determines whether the point is inside a contour, outside, or lies on an edge (or
577
+ * coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge)
578
+ * value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively.
579
+ * Otherwise, the return value is a signed distance between the point and the nearest contour edge.
580
+ *
581
+ * See below a sample output of the function where each image pixel is tested against the contour:
582
+ *
583
+ * @param contour Input contour.
584
+ *
585
+ * @param pt Point tested against the contour.
586
+ *
587
+ * @param measureDist If true, the function estimates the signed distance from the point to the nearest
588
+ * contour edge. Otherwise, the function only checks if the point is inside a contour or not.
589
+ */
590
+ export declare function pointPolygonTest(
591
+ contour: InputArray,
592
+ pt: Point2f,
593
+ measureDist: bool,
594
+ ): double;
595
+
596
+ /**
597
+ * If there is then the vertices of the intersecting region are returned as well.
598
+ *
599
+ * Below are some examples of intersection configurations. The hatched pattern indicates the
600
+ * intersecting region and the red vertices are returned by the function.
601
+ *
602
+ * One of [RectanglesIntersectTypes]
603
+ *
604
+ * @param rect1 First rectangle
605
+ *
606
+ * @param rect2 Second rectangle
607
+ *
608
+ * @param intersectingRegion The output array of the vertices of the intersecting region. It returns at
609
+ * most 8 vertices. Stored as std::vector<cv::Point2f> or cv::Mat as Mx1 of type CV_32FC2.
610
+ */
611
+ export declare function rotatedRectangleIntersection(
612
+ rect1: any,
613
+ rect2: any,
614
+ intersectingRegion: OutputArray,
615
+ ): int;
616
+
617
+ export declare const CCL_WU: ConnectedComponentsAlgorithmsTypes; // initializer: = 0
618
+
619
+ export declare const CCL_DEFAULT: ConnectedComponentsAlgorithmsTypes; // initializer: = -1
620
+
621
+ export declare const CCL_GRANA: ConnectedComponentsAlgorithmsTypes; // initializer: = 1
622
+
623
+ /**
624
+ * The leftmost (x) coordinate which is the inclusive start of the bounding box in the horizontal
625
+ * direction.
626
+ *
627
+ */
628
+ export declare const CC_STAT_LEFT: ConnectedComponentsTypes; // initializer: = 0
629
+
630
+ /**
631
+ * The topmost (y) coordinate which is the inclusive start of the bounding box in the vertical
632
+ * direction.
633
+ *
634
+ */
635
+ export declare const CC_STAT_TOP: ConnectedComponentsTypes; // initializer: = 1
636
+
637
+ export declare const CC_STAT_WIDTH: ConnectedComponentsTypes; // initializer: = 2
638
+
639
+ export declare const CC_STAT_HEIGHT: ConnectedComponentsTypes; // initializer: = 3
640
+
641
+ export declare const CC_STAT_AREA: ConnectedComponentsTypes; // initializer: = 4
642
+
643
+ export declare const CC_STAT_MAX: ConnectedComponentsTypes; // initializer: = 5
644
+
645
+ /**
646
+ * stores absolutely all the contour points. That is, any 2 subsequent points (x1,y1) and (x2,y2) of
647
+ * the contour will be either horizontal, vertical or diagonal neighbors, that is,
648
+ * max(abs(x1-x2),abs(y2-y1))==1.
649
+ *
650
+ */
651
+ export declare const CHAIN_APPROX_NONE: ContourApproximationModes; // initializer: = 1
652
+
653
+ /**
654
+ * compresses horizontal, vertical, and diagonal segments and leaves only their end points. For
655
+ * example, an up-right rectangular contour is encoded with 4 points.
656
+ *
657
+ */
658
+ export declare const CHAIN_APPROX_SIMPLE: ContourApproximationModes; // initializer: = 2
659
+
660
+ /**
661
+ * applies one of the flavors of the Teh-Chin chain approximation algorithm TehChin89
662
+ *
663
+ */
664
+ export declare const CHAIN_APPROX_TC89_L1: ContourApproximationModes; // initializer: = 3
665
+
666
+ /**
667
+ * applies one of the flavors of the Teh-Chin chain approximation algorithm TehChin89
668
+ *
669
+ */
670
+ export declare const CHAIN_APPROX_TC89_KCOS: ContourApproximationModes; // initializer: = 4
671
+
672
+ export declare const INTERSECT_NONE: RectanglesIntersectTypes; // initializer: = 0
673
+
674
+ export declare const INTERSECT_PARTIAL: RectanglesIntersectTypes; // initializer: = 1
675
+
676
+ export declare const INTERSECT_FULL: RectanglesIntersectTypes; // initializer: = 2
677
+
678
+ /**
679
+ * retrieves only the extreme outer contours. It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for all the
680
+ * contours.
681
+ *
682
+ */
683
+ export declare const RETR_EXTERNAL: RetrievalModes; // initializer: = 0
684
+
685
+ /**
686
+ * retrieves all of the contours without establishing any hierarchical relationships.
687
+ *
688
+ */
689
+ export declare const RETR_LIST: RetrievalModes; // initializer: = 1
690
+
691
+ /**
692
+ * retrieves all of the contours and organizes them into a two-level hierarchy. At the top level, there
693
+ * are external boundaries of the components. At the second level, there are boundaries of the holes.
694
+ * If there is another contour inside a hole of a connected component, it is still put at the top
695
+ * level.
696
+ *
697
+ */
698
+ export declare const RETR_CCOMP: RetrievalModes; // initializer: = 2
699
+
700
+ /**
701
+ * retrieves all of the contours and reconstructs a full hierarchy of nested contours.
702
+ *
703
+ */
704
+ export declare const RETR_TREE: RetrievalModes; // initializer: = 3
705
+
706
+ export declare const RETR_FLOODFILL: RetrievalModes; // initializer: = 4
707
+
708
+ export declare const CONTOURS_MATCH_I1: ShapeMatchModes; // initializer: =1
709
+
710
+ export declare const CONTOURS_MATCH_I2: ShapeMatchModes; // initializer: =2
711
+
712
+ export declare const CONTOURS_MATCH_I3: ShapeMatchModes; // initializer: =3
713
+
714
+ export type ConnectedComponentsAlgorithmsTypes = any;
715
+
716
+ export type ConnectedComponentsTypes = any;
717
+
718
+ export type ContourApproximationModes = any;
719
+
720
+ export type RectanglesIntersectTypes = any;
721
+
722
+ export type RetrievalModes = any;
723
+
724
+ export type ShapeMatchModes = any;