@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,399 @@
1
+ import type {
2
+ bool,
3
+ double,
4
+ float,
5
+ InputArray,
6
+ InputArrayOfArrays,
7
+ int,
8
+ OutputArray,
9
+ Size,
10
+ } from "./_types";
11
+ /*
12
+ * # Histograms
13
+ *
14
+ */
15
+ /**
16
+ * The function [cv::calcBackProject] calculates the back project of the histogram. That is, similarly
17
+ * to [calcHist] , at each location (x, y) the function collects the values from the selected channels
18
+ * in the input images and finds the corresponding histogram bin. But instead of incrementing it, the
19
+ * function reads the bin value, scales it by scale , and stores in backProject(x,y) . In terms of
20
+ * statistics, the function computes probability of each element value in respect with the empirical
21
+ * probability distribution represented by the histogram. See how, for example, you can find and track
22
+ * a bright-colored object in a scene:
23
+ *
24
+ * Before tracking, show the object to the camera so that it covers almost the whole frame. Calculate a
25
+ * hue histogram. The histogram may have strong maximums, corresponding to the dominant colors in the
26
+ * object.
27
+ * When tracking, calculate a back projection of a hue plane of each input video frame using that
28
+ * pre-computed histogram. Threshold the back projection to suppress weak colors. It may also make
29
+ * sense to suppress pixels with non-sufficient color saturation and too dark or too bright pixels.
30
+ * Find connected components in the resulting picture and choose, for example, the largest component.
31
+ *
32
+ * This is an approximate algorithm of the CamShift color object tracker.
33
+ *
34
+ * [calcHist], [compareHist]
35
+ *
36
+ * @param images Source arrays. They all should have the same depth, CV_8U, CV_16U or CV_32F , and the
37
+ * same size. Each of them can have an arbitrary number of channels.
38
+ *
39
+ * @param nimages Number of source images.
40
+ *
41
+ * @param channels The list of channels used to compute the back projection. The number of channels
42
+ * must match the histogram dimensionality. The first array channels are numerated from 0 to
43
+ * images[0].channels()-1 , the second array channels are counted from images[0].channels() to
44
+ * images[0].channels() + images[1].channels()-1, and so on.
45
+ *
46
+ * @param hist Input histogram that can be dense or sparse.
47
+ *
48
+ * @param backProject Destination back projection array that is a single-channel array of the same size
49
+ * and depth as images[0] .
50
+ *
51
+ * @param ranges Array of arrays of the histogram bin boundaries in each dimension. See calcHist .
52
+ *
53
+ * @param scale Optional scale factor for the output back projection.
54
+ *
55
+ * @param uniform Flag indicating whether the histogram is uniform or not (see above).
56
+ */
57
+ export declare function calcBackProject(
58
+ images: any,
59
+ nimages: int,
60
+ channels: any,
61
+ hist: InputArray,
62
+ backProject: OutputArray,
63
+ ranges: any,
64
+ scale?: double,
65
+ uniform?: bool,
66
+ ): void;
67
+
68
+ /**
69
+ * This is an overloaded member function, provided for convenience. It differs from the above function
70
+ * only in what argument(s) it accepts.
71
+ */
72
+ export declare function calcBackProject(
73
+ images: any,
74
+ nimages: int,
75
+ channels: any,
76
+ hist: any,
77
+ backProject: OutputArray,
78
+ ranges: any,
79
+ scale?: double,
80
+ uniform?: bool,
81
+ ): void;
82
+
83
+ /**
84
+ * This is an overloaded member function, provided for convenience. It differs from the above function
85
+ * only in what argument(s) it accepts.
86
+ */
87
+ export declare function calcBackProject(
88
+ images: InputArrayOfArrays,
89
+ channels: any,
90
+ hist: InputArray,
91
+ dst: OutputArray,
92
+ ranges: any,
93
+ scale: double,
94
+ ): void;
95
+
96
+ /**
97
+ * The function [cv::calcHist] calculates the histogram of one or more arrays. The elements of a tuple
98
+ * used to increment a histogram bin are taken from the corresponding input arrays at the same
99
+ * location. The sample below shows how to compute a 2D Hue-Saturation histogram for a color image. :
100
+ *
101
+ * ```cpp
102
+ * #include <opencv2/imgproc.hpp>
103
+ * #include <opencv2/highgui.hpp>
104
+ *
105
+ * using namespace cv;
106
+ *
107
+ * int main( int argc, char** argv )
108
+ * {
109
+ * Mat src, hsv;
110
+ * if( argc != 2 || !(src=imread(argv[1], 1)).data )
111
+ * return -1;
112
+ *
113
+ * cvtColor(src, hsv, COLOR_BGR2HSV);
114
+ *
115
+ * // Quantize the hue to 30 levels
116
+ * // and the saturation to 32 levels
117
+ * int hbins = 30, sbins = 32;
118
+ * int histSize[] = {hbins, sbins};
119
+ * // hue varies from 0 to 179, see cvtColor
120
+ * float hranges[] = { 0, 180 };
121
+ * // saturation varies from 0 (black-gray-white) to
122
+ * // 255 (pure spectrum color)
123
+ * float sranges[] = { 0, 256 };
124
+ * const float* ranges[] = { hranges, sranges };
125
+ * MatND hist;
126
+ * // we compute the histogram from the 0-th and 1-st channels
127
+ * int channels[] = {0, 1};
128
+ *
129
+ * calcHist( &hsv, 1, channels, Mat(), // do not use mask
130
+ * hist, 2, histSize, ranges,
131
+ * true, // the histogram is uniform
132
+ * false );
133
+ * double maxVal=0;
134
+ * minMaxLoc(hist, 0, &maxVal, 0, 0);
135
+ *
136
+ * int scale = 10;
137
+ * Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3);
138
+ *
139
+ * for( int h = 0; h < hbins; h++ )
140
+ * for( int s = 0; s < sbins; s++ )
141
+ * {
142
+ * float binVal = hist.at<float>(h, s);
143
+ * int intensity = cvRound(binVal*255/maxVal);
144
+ * rectangle( histImg, Point(h*scale, s*scale),
145
+ * Point( (h+1)*scale - 1, (s+1)*scale - 1),
146
+ * Scalar::all(intensity),
147
+ * -1 );
148
+ * }
149
+ *
150
+ * namedWindow( "Source", 1 );
151
+ * imshow( "Source", src );
152
+ *
153
+ * namedWindow( "H-S Histogram", 1 );
154
+ * imshow( "H-S Histogram", histImg );
155
+ * waitKey();
156
+ * }
157
+ * ```
158
+ *
159
+ * @param images Source arrays. They all should have the same depth, CV_8U, CV_16U or CV_32F , and the
160
+ * same size. Each of them can have an arbitrary number of channels.
161
+ *
162
+ * @param nimages Number of source images.
163
+ *
164
+ * @param channels List of the dims channels used to compute the histogram. The first array channels
165
+ * are numerated from 0 to images[0].channels()-1 , the second array channels are counted from
166
+ * images[0].channels() to images[0].channels() + images[1].channels()-1, and so on.
167
+ *
168
+ * @param mask Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size as
169
+ * images[i] . The non-zero mask elements mark the array elements counted in the histogram.
170
+ *
171
+ * @param hist Output histogram, which is a dense or sparse dims -dimensional array.
172
+ *
173
+ * @param dims Histogram dimensionality that must be positive and not greater than CV_MAX_DIMS (equal
174
+ * to 32 in the current OpenCV version).
175
+ *
176
+ * @param histSize Array of histogram sizes in each dimension.
177
+ *
178
+ * @param ranges Array of the dims arrays of the histogram bin boundaries in each dimension. When the
179
+ * histogram is uniform ( uniform =true), then for each dimension i it is enough to specify the lower
180
+ * (inclusive) boundary $L_0$ of the 0-th histogram bin and the upper (exclusive) boundary
181
+ * $U_{\texttt{histSize}[i]-1}$ for the last histogram bin histSize[i]-1 . That is, in case of a
182
+ * uniform histogram each of ranges[i] is an array of 2 elements. When the histogram is not uniform (
183
+ * uniform=false ), then each of ranges[i] contains histSize[i]+1 elements: $L_0, U_0=L_1, U_1=L_2,
184
+ * ..., U_{\texttt{histSize[i]}-2}=L_{\texttt{histSize[i]}-1}, U_{\texttt{histSize[i]}-1}$ . The array
185
+ * elements, that are not between $L_0$ and $U_{\texttt{histSize[i]}-1}$ , are not counted in the
186
+ * histogram.
187
+ *
188
+ * @param uniform Flag indicating whether the histogram is uniform or not (see above).
189
+ *
190
+ * @param accumulate Accumulation flag. If it is set, the histogram is not cleared in the beginning
191
+ * when it is allocated. This feature enables you to compute a single histogram from several sets of
192
+ * arrays, or to update the histogram in time.
193
+ */
194
+ export declare function calcHist(
195
+ images: any,
196
+ nimages: int,
197
+ channels: any,
198
+ mask: InputArray,
199
+ hist: OutputArray,
200
+ dims: int,
201
+ histSize: any,
202
+ ranges: any,
203
+ uniform?: bool,
204
+ accumulate?: bool,
205
+ ): void;
206
+
207
+ /**
208
+ * This is an overloaded member function, provided for convenience. It differs from the above function
209
+ * only in what argument(s) it accepts.
210
+ *
211
+ * this variant uses SparseMat for output
212
+ */
213
+ export declare function calcHist(
214
+ images: any,
215
+ nimages: int,
216
+ channels: any,
217
+ mask: InputArray,
218
+ hist: any,
219
+ dims: int,
220
+ histSize: any,
221
+ ranges: any,
222
+ uniform?: bool,
223
+ accumulate?: bool,
224
+ ): void;
225
+
226
+ /**
227
+ * This is an overloaded member function, provided for convenience. It differs from the above function
228
+ * only in what argument(s) it accepts.
229
+ */
230
+ export declare function calcHist(
231
+ images: InputArrayOfArrays,
232
+ channels: any,
233
+ mask: InputArray,
234
+ hist: OutputArray,
235
+ histSize: any,
236
+ ranges: any,
237
+ accumulate?: bool,
238
+ ): void;
239
+
240
+ /**
241
+ * The function [cv::compareHist] compares two dense or two sparse histograms using the specified
242
+ * method.
243
+ *
244
+ * The function returns `$d(H_1, H_2)$` .
245
+ *
246
+ * While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable
247
+ * for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling
248
+ * problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms
249
+ * or more general sparse configurations of weighted points, consider using the [EMD] function.
250
+ *
251
+ * @param H1 First compared histogram.
252
+ *
253
+ * @param H2 Second compared histogram of the same size as H1 .
254
+ *
255
+ * @param method Comparison method, see HistCompMethods
256
+ */
257
+ export declare function compareHist(
258
+ H1: InputArray,
259
+ H2: InputArray,
260
+ method: int,
261
+ ): double;
262
+
263
+ /**
264
+ * This is an overloaded member function, provided for convenience. It differs from the above function
265
+ * only in what argument(s) it accepts.
266
+ */
267
+ export declare function compareHist(H1: any, H2: any, method: int): double;
268
+
269
+ /**
270
+ * @param clipLimit Threshold for contrast limiting.
271
+ *
272
+ * @param tileGridSize Size of grid for histogram equalization. Input image will be divided into
273
+ * equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
274
+ */
275
+ export declare function createCLAHE(
276
+ clipLimit?: double,
277
+ tileGridSize?: Size,
278
+ ): any;
279
+
280
+ /**
281
+ * The function computes the earth mover distance and/or a lower boundary of the distance between the
282
+ * two weighted point configurations. One of the applications described in RubnerSept98, Rubner2000 is
283
+ * multi-dimensional histogram comparison for image retrieval. EMD is a transportation problem that is
284
+ * solved using some modification of a simplex algorithm, thus the complexity is exponential in the
285
+ * worst case, though, on average it is much faster. In the case of a real metric the lower boundary
286
+ * can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly
287
+ * whether the two signatures are far enough so that they cannot relate to the same object.
288
+ *
289
+ * @param signature1 First signature, a $\texttt{size1}\times \texttt{dims}+1$ floating-point matrix.
290
+ * Each row stores the point weight followed by the point coordinates. The matrix is allowed to have a
291
+ * single column (weights only) if the user-defined cost matrix is used. The weights must be
292
+ * non-negative and have at least one non-zero value.
293
+ *
294
+ * @param signature2 Second signature of the same format as signature1 , though the number of rows may
295
+ * be different. The total weights may be different. In this case an extra "dummy" point is added to
296
+ * either signature1 or signature2. The weights must be non-negative and have at least one non-zero
297
+ * value.
298
+ *
299
+ * @param distType Used metric. See DistanceTypes.
300
+ *
301
+ * @param cost User-defined $\texttt{size1}\times \texttt{size2}$ cost matrix. Also, if a cost matrix
302
+ * is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
303
+ *
304
+ * @param lowerBound Optional input/output parameter: lower boundary of a distance between the two
305
+ * signatures that is a distance between mass centers. The lower boundary may not be calculated if the
306
+ * user-defined cost matrix is used, the total weights of point configurations are not equal, or if the
307
+ * signatures consist of weights only (the signature matrices have a single column). You must**
308
+ * initialize *lowerBound . If the calculated distance between mass centers is greater or equal to
309
+ * *lowerBound (it means that the signatures are far enough), the function does not calculate EMD. In
310
+ * any case *lowerBound is set to the calculated distance between mass centers on return. Thus, if you
311
+ * want to calculate both distance between mass centers and EMD, *lowerBound should be set to 0.
312
+ *
313
+ * @param flow Resultant $\texttt{size1} \times \texttt{size2}$ flow matrix: $\texttt{flow}_{i,j}$ is a
314
+ * flow from $i$ -th point of signature1 to $j$ -th point of signature2 .
315
+ */
316
+ export declare function EMD(
317
+ signature1: InputArray,
318
+ signature2: InputArray,
319
+ distType: int,
320
+ cost?: InputArray,
321
+ lowerBound?: any,
322
+ flow?: OutputArray,
323
+ ): float;
324
+
325
+ /**
326
+ * The function equalizes the histogram of the input image using the following algorithm:
327
+ *
328
+ * Calculate the histogram `$H$` for src .
329
+ * Normalize the histogram so that the sum of histogram bins is 255.
330
+ * Compute the integral of the histogram: `\\[H'_i = \\sum _{0 \\le j < i} H(j)\\]`
331
+ * Transform the image using `$H'$` as a look-up table: `$\\texttt{dst}(x,y) = H'(\\texttt{src}(x,y))$`
332
+ *
333
+ * The algorithm normalizes the brightness and increases the contrast of the image.
334
+ *
335
+ * @param src Source 8-bit single channel image.
336
+ *
337
+ * @param dst Destination image of the same size and type as src .
338
+ */
339
+ export declare function equalizeHist(src: InputArray, dst: OutputArray): void;
340
+
341
+ export declare function wrapperEMD(
342
+ signature1: InputArray,
343
+ signature2: InputArray,
344
+ distType: int,
345
+ cost?: InputArray,
346
+ lowerBound?: any,
347
+ flow?: OutputArray,
348
+ ): float;
349
+
350
+ /**
351
+ * Correlation `\\[d(H_1,H_2) = \\frac{\\sum_I (H_1(I) - \\bar{H_1}) (H_2(I) -
352
+ * \\bar{H_2})}{\\sqrt{\\sum_I(H_1(I) - \\bar{H_1})^2 \\sum_I(H_2(I) - \\bar{H_2})^2}}\\]` where
353
+ * `\\[\\bar{H_k} = \\frac{1}{N} \\sum _J H_k(J)\\]` and `$N$` is a total number of histogram bins.
354
+ *
355
+ */
356
+ export declare const HISTCMP_CORREL: HistCompMethods; // initializer: = 0
357
+
358
+ /**
359
+ * Chi-Square `\\[d(H_1,H_2) = \\sum _I \\frac{\\left(H_1(I)-H_2(I)\\right)^2}{H_1(I)}\\]`
360
+ *
361
+ */
362
+ export declare const HISTCMP_CHISQR: HistCompMethods; // initializer: = 1
363
+
364
+ /**
365
+ * Intersection `\\[d(H_1,H_2) = \\sum _I \\min (H_1(I), H_2(I))\\]`
366
+ *
367
+ */
368
+ export declare const HISTCMP_INTERSECT: HistCompMethods; // initializer: = 2
369
+
370
+ /**
371
+ * Bhattacharyya distance (In fact, OpenCV computes Hellinger distance, which is related to
372
+ * Bhattacharyya coefficient.) `\\[d(H_1,H_2) = \\sqrt{1 - \\frac{1}{\\sqrt{\\bar{H_1} \\bar{H_2} N^2}}
373
+ * \\sum_I \\sqrt{H_1(I) \\cdot H_2(I)}}\\]`
374
+ *
375
+ */
376
+ export declare const HISTCMP_BHATTACHARYYA: HistCompMethods; // initializer: = 3
377
+
378
+ export declare const HISTCMP_HELLINGER: HistCompMethods; // initializer: = HISTCMP_BHATTACHARYYA
379
+
380
+ /**
381
+ * Alternative Chi-Square `\\[d(H_1,H_2) = 2 * \\sum _I
382
+ * \\frac{\\left(H_1(I)-H_2(I)\\right)^2}{H_1(I)+H_2(I)}\\]` This alternative formula is regularly used
383
+ * for texture comparison. See e.g. Puzicha1997
384
+ *
385
+ */
386
+ export declare const HISTCMP_CHISQR_ALT: HistCompMethods; // initializer: = 4
387
+
388
+ /**
389
+ * Kullback-Leibler divergence `\\[d(H_1,H_2) = \\sum _I H_1(I) \\log
390
+ * \\left(\\frac{H_1(I)}{H_2(I)}\\right)\\]`
391
+ *
392
+ */
393
+ export declare const HISTCMP_KL_DIV: HistCompMethods; // initializer: = 5
394
+
395
+ /**
396
+ * Histogram comparison methods
397
+ *
398
+ */
399
+ export type HistCompMethods = any;