@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,1793 @@
1
+ import type {
2
+ EmscriptenEmbindInstance,
3
+ InputArray,
4
+ MatSize,
5
+ OutputArray,
6
+ Point,
7
+ Rect,
8
+ Scalar,
9
+ Size,
10
+ } from "./helpers";
11
+ import type { MatExpr } from "./MatExpr";
12
+ import { Matx } from "./Matx";
13
+ import type {
14
+ AccessFlag,
15
+ bool,
16
+ double,
17
+ int,
18
+ MatAllocator,
19
+ MatCommaInitializer_,
20
+ MatConstIterator_,
21
+ MatIterator_,
22
+ MatStep,
23
+ Point3_,
24
+ Point_,
25
+ size_t,
26
+ typename,
27
+ uchar,
28
+ UMat,
29
+ UMatData,
30
+ UMatUsageFlags,
31
+ Vec,
32
+ } from "./missing";
33
+
34
+ /**
35
+ * <a name="d3/d63/classcv_1_1Mat_1CVMat_Details"></a> The class [Mat](#d3/d63/classcv_1_1Mat})
36
+ * represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to
37
+ * store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector
38
+ * fields, point clouds, tensors, histograms (though, very high-dimensional histograms may be better
39
+ * stored in a [SparseMat](#dd/da9/classcv_1_1SparseMat}) ). The data layout of the array `M` is
40
+ * defined by the array `M.step[]`, so that the address of element `$(i_0,...,i_{M.dims-1})$`, where
41
+ * `$0\\leq i_k<M.size[k]$`, is computed as: `\\[addr(M_{i_0,...,i_{M.dims-1}}) = M.data +
42
+ * M.step[0]*i_0 + M.step[1]*i_1 + ... + M.step[M.dims-1]*i_{M.dims-1}\\]` In case of a 2-dimensional
43
+ * array, the above formula is reduced to: `\\[addr(M_{i,j}) = M.data + M.step[0]*i + M.step[1]*j\\]`
44
+ * Note that `M.step[i] >= M.step[i+1]` (in fact, `M.step[i] >= M.step[i+1]*M.size[i+1]` ). This means
45
+ * that 2-dimensional matrices are stored row-by-row, 3-dimensional matrices are stored plane-by-plane,
46
+ * and so on. M.step[M.dims-1] is minimal and always equal to the element size M.elemSize() .
47
+ *
48
+ * So, the data layout in [Mat](#d3/d63/classcv_1_1Mat}) is compatible with the majority of dense array
49
+ * types from the standard toolkits and SDKs, such as Numpy (ndarray), Win32 (independent device
50
+ * bitmaps), and others, that is, with any array that uses *steps* (or *strides*) to compute the
51
+ * position of a pixel. Due to this compatibility, it is possible to make a
52
+ * [Mat](#d3/d63/classcv_1_1Mat}) header for user-allocated data and process it in-place using OpenCV
53
+ * functions.
54
+ *
55
+ * There are many different ways to create a [Mat](#d3/d63/classcv_1_1Mat}) object. The most popular
56
+ * options are listed below:
57
+ *
58
+ * Use the create(nrows, ncols, type) method or the similar Mat(nrows, ncols, type[, fillValue])
59
+ * constructor. A new array of the specified size and type is allocated. type has the same meaning as
60
+ * in the cvCreateMat method. For example, CV_8UC1 means a 8-bit single-channel array, CV_32FC2 means a
61
+ * 2-channel (complex) floating-point array, and so on.
62
+ *
63
+ * ```cpp
64
+ * // make a 7x7 complex matrix filled with 1+3j.
65
+ * Mat M(7,7,CV_32FC2,Scalar(1,3));
66
+ * // and now turn M to a 100x60 15-channel 8-bit matrix.
67
+ * // The old content will be deallocated
68
+ * M.create(100,60,CV_8UC(15));
69
+ * ```
70
+ *
71
+ * As noted in the introduction to this chapter,
72
+ * [create()](#d3/d63/classcv_1_1Mat_1a55ced2c8d844d683ea9a725c60037ad0}) allocates only a new array
73
+ * when the shape or type of the current array are different from the specified ones.
74
+ * Create a multi-dimensional array:
75
+ *
76
+ * ```cpp
77
+ * // create a 100x100x100 8-bit array
78
+ * int sz[] = {100, 100, 100};
79
+ * Mat bigCube(3, sz, CV_8U, Scalar::all(0));
80
+ * ```
81
+ *
82
+ * It passes the number of dimensions =1 to the [Mat](#d3/d63/classcv_1_1Mat}) constructor but the
83
+ * created array will be 2-dimensional with the number of columns set to 1. So,
84
+ * [Mat::dims](#d3/d63/classcv_1_1Mat_1a39cf614aa52567e9a945cd2609bd767b}) is always >= 2 (can also be
85
+ * 0 when the array is empty).
86
+ * Use a copy constructor or assignment operator where there can be an array or expression on the right
87
+ * side (see below). As noted in the introduction, the array assignment is an O(1) operation because it
88
+ * only copies the header and increases the reference counter. The
89
+ * [Mat::clone()](#d3/d63/classcv_1_1Mat_1adff2ea98da45eae0833e73582dd4a660}) method can be used to get
90
+ * a full (deep) copy of the array when you need it.
91
+ * Construct a header for a part of another array. It can be a single row, single column, several rows,
92
+ * several columns, rectangular region in the array (called a *minor* in algebra) or a diagonal. Such
93
+ * operations are also O(1) because the new header references the same data. You can actually modify a
94
+ * part of the array using this feature, for example:
95
+ *
96
+ * ```cpp
97
+ * // add the 5-th row, multiplied by 3 to the 3rd row
98
+ * M.row(3) = M.row(3) + M.row(5)*3;
99
+ * // now copy the 7-th column to the 1-st column
100
+ * // M.col(1) = M.col(7); // this will not work
101
+ * Mat M1 = M.col(1);
102
+ * M.col(7).copyTo(M1);
103
+ * // create a new 320x240 image
104
+ * Mat img(Size(320,240),CV_8UC3);
105
+ * // select a ROI
106
+ * Mat roi(img, Rect(10,10,100,100));
107
+ * // fill the ROI with (0,255,0) (which is green in RGB space);
108
+ * // the original 320x240 image will be modified
109
+ * roi = Scalar(0,255,0);
110
+ * ```
111
+ *
112
+ * Due to the additional datastart and dataend members, it is possible to compute a relative sub-array
113
+ * position in the main *container* array using
114
+ * [locateROI()](#d3/d63/classcv_1_1Mat_1a40b5b3371a9c2a4b2b8ce0c8068d7c96}):
115
+ *
116
+ * ```cpp
117
+ * Mat A = Mat::eye(10, 10, CV_32S);
118
+ * // extracts A columns, 1 (inclusive) to 3 (exclusive).
119
+ * Mat B = A(Range::all(), Range(1, 3));
120
+ * // extracts B rows, 5 (inclusive) to 9 (exclusive).
121
+ * // that is, C \\~ A(Range(5, 9), Range(1, 3))
122
+ * Mat C = B(Range(5, 9), Range::all());
123
+ * Size size; Point ofs;
124
+ * C.locateROI(size, ofs);
125
+ * // size will be (width=10,height=10) and the ofs will be (x=1, y=5)
126
+ * ```
127
+ *
128
+ * As in case of whole matrices, if you need a deep copy, use the
129
+ * `[clone()](#d3/d63/classcv_1_1Mat_1adff2ea98da45eae0833e73582dd4a660})` method of the extracted
130
+ * sub-matrices.
131
+ * Make a header for user-allocated data. It can be useful to do the following:
132
+ *
133
+ * Process "foreign" data using OpenCV (for example, when you implement a DirectShow* filter or a
134
+ * processing module for gstreamer, and so on). For example:
135
+ *
136
+ * ```cpp
137
+ * void process_video_frame(const unsigned char* pixels,
138
+ * int width, int height, int step)
139
+ * {
140
+ * Mat img(height, width, CV_8UC3, pixels, step);
141
+ * GaussianBlur(img, img, Size(7,7), 1.5, 1.5);
142
+ * }
143
+ * ```
144
+ *
145
+ * Quickly initialize small matrices and/or get a super-fast element access.
146
+ *
147
+ * ```cpp
148
+ * double m[3][3] = {{a, b, c}, {d, e, f}, {g, h, i}};
149
+ * Mat M = Mat(3, 3, CV_64F, m).inv();
150
+ * ```
151
+ *
152
+ * Use MATLAB-style array initializers,
153
+ * [zeros()](#d3/d63/classcv_1_1Mat_1a0b57b6a326c8876d944d188a46e0f556}),
154
+ * [ones()](#d3/d63/classcv_1_1Mat_1a69ae0402d116fc9c71908d8508dc2f09}),
155
+ * [eye()](#d3/d63/classcv_1_1Mat_1a2cf9b9acde7a9852542bbc20ef851ed2}), for example:
156
+ *
157
+ * ```cpp
158
+ * // create a double-precision identity matrix and add it to M.
159
+ * M += Mat::eye(M.rows, M.cols, CV_64F);
160
+ * ```
161
+ *
162
+ * Use a comma-separated initializer:
163
+ *
164
+ * ```cpp
165
+ * // create a 3x3 double-precision identity matrix
166
+ * Mat M = (Mat_<double>(3,3) << 1, 0, 0, 0, 1, 0, 0, 0, 1);
167
+ * ```
168
+ *
169
+ * With this approach, you first call a constructor of the [Mat](#d3/d63/classcv_1_1Mat}) class with
170
+ * the proper parameters, and then you just put `<< operator` followed by comma-separated values that
171
+ * can be constants, variables, expressions, and so on. Also, note the extra parentheses required to
172
+ * avoid compilation errors.
173
+ *
174
+ * Once the array is created, it is automatically managed via a reference-counting mechanism. If the
175
+ * array header is built on top of user-allocated data, you should handle the data by yourself. The
176
+ * array data is deallocated when no one points to it. If you want to release the data pointed by a
177
+ * array header before the array destructor is called, use
178
+ * [Mat::release()](#d3/d63/classcv_1_1Mat_1ae48d4913285518e2c21a3457017e716e}).
179
+ *
180
+ * The next important thing to learn about the array class is element access. This manual already
181
+ * described how to compute an address of each array element. Normally, you are not required to use the
182
+ * formula directly in the code. If you know the array element type (which can be retrieved using the
183
+ * method [Mat::type()](#d3/d63/classcv_1_1Mat_1af2d2652e552d7de635988f18a84b53e5}) ), you can access
184
+ * the element `$M_{ij}$` of a 2-dimensional array as:
185
+ *
186
+ * ```cpp
187
+ * M.at<double>(i,j) += 1.f;
188
+ * ```
189
+ *
190
+ * assuming that `M` is a double-precision floating-point array. There are several variants of the
191
+ * method at for a different number of dimensions.
192
+ *
193
+ * If you need to process a whole row of a 2D array, the most efficient way is to get the pointer to
194
+ * the row first, and then just use the plain C operator [] :
195
+ *
196
+ * ```cpp
197
+ * // compute sum of positive matrix elements
198
+ * // (assuming that M is a double-precision matrix)
199
+ * double sum=0;
200
+ * for(int i = 0; i < M.rows; i++)
201
+ * {
202
+ * const double* Mi = M.ptr<double>(i);
203
+ * for(int j = 0; j < M.cols; j++)
204
+ * sum += std::max(Mi[j], 0.);
205
+ * }
206
+ * ```
207
+ *
208
+ * Some operations, like the one above, do not actually depend on the array shape. They just process
209
+ * elements of an array one by one (or elements from multiple arrays that have the same coordinates,
210
+ * for example, array addition). Such operations are called *element-wise*. It makes sense to check
211
+ * whether all the input/output arrays are continuous, namely, have no gaps at the end of each row. If
212
+ * yes, process them as a long single row:
213
+ *
214
+ * ```cpp
215
+ * // compute the sum of positive matrix elements, optimized variant
216
+ * double sum=0;
217
+ * int cols = M.cols, rows = M.rows;
218
+ * if(M.isContinuous())
219
+ * {
220
+ * cols *= rows;
221
+ * rows = 1;
222
+ * }
223
+ * for(int i = 0; i < rows; i++)
224
+ * {
225
+ * const double* Mi = M.ptr<double>(i);
226
+ * for(int j = 0; j < cols; j++)
227
+ * sum += std::max(Mi[j], 0.);
228
+ * }
229
+ * ```
230
+ *
231
+ * In case of the continuous matrix, the outer loop body is executed just once. So, the overhead is
232
+ * smaller, which is especially noticeable in case of small matrices.
233
+ *
234
+ * Finally, there are STL-style iterators that are smart enough to skip gaps between successive rows:
235
+ *
236
+ * ```cpp
237
+ * // compute sum of positive matrix elements, iterator-based variant
238
+ * double sum=0;
239
+ * MatConstIterator_<double> it = M.begin<double>(), it_end = M.end<double>();
240
+ * for(; it != it_end; ++it)
241
+ * sum += std::max(*it, 0.);
242
+ * ```
243
+ *
244
+ * The matrix iterators are random-access iterators, so they can be passed to any STL algorithm,
245
+ * including [std::sort()](#d2/de8/group__core__array_1ga45dd56da289494ce874be2324856898f}).
246
+ *
247
+ * Matrix Expressions and arithmetic see [MatExpr](#d1/d10/classcv_1_1MatExpr})
248
+ *
249
+ * Source:
250
+ * [opencv2/core/mat.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/mat.hpp#L2073).
251
+ *
252
+ */
253
+ export declare class Mat extends EmscriptenEmbindInstance {
254
+ public allocator: MatAllocator;
255
+
256
+ public cols: int;
257
+
258
+ public data: Uint8Array;
259
+ public data8S: Int8Array;
260
+ public data8U: Uint8Array;
261
+ public data16U: Uint16Array;
262
+ public data16S: Int16Array;
263
+ public data32U: Uint32Array;
264
+ public data32S: Int32Array;
265
+ public data32F: Float32Array;
266
+ public data64F: Float64Array;
267
+
268
+ public dataend: uchar;
269
+
270
+ public datalimit: uchar;
271
+
272
+ public datastart: uchar;
273
+
274
+ public dims: int;
275
+
276
+ /**
277
+ * includes several bit-fields:
278
+ *
279
+ * the magic signature
280
+ * continuity flag
281
+ * depth
282
+ * number of channels
283
+ *
284
+ */
285
+ public flags: int;
286
+
287
+ public rows: int;
288
+
289
+ public size: MatSize;
290
+
291
+ public step: MatStep;
292
+
293
+ public u: UMatData;
294
+
295
+ /**
296
+ * These are various constructors that form a matrix. As noted in the AutomaticAllocation, often the
297
+ * default constructor is enough, and the proper matrix will be allocated by an OpenCV function. The
298
+ * constructed matrix can further be assigned to another matrix or matrix expression or can be
299
+ * allocated with [Mat::create] . In the former case, the old content is de-referenced.
300
+ */
301
+ public constructor();
302
+
303
+ /**
304
+ * This is an overloaded member function, provided for convenience. It differs from the above
305
+ * function only in what argument(s) it accepts.
306
+ *
307
+ * @param rows Number of rows in a 2D array.
308
+ *
309
+ * @param cols Number of columns in a 2D array.
310
+ *
311
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
312
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
313
+ */
314
+ public constructor(rows: int, cols: int, type: int);
315
+
316
+ /**
317
+ * This is an overloaded member function, provided for convenience. It differs from the above
318
+ * function only in what argument(s) it accepts.
319
+ *
320
+ * @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and
321
+ * the number of columns go in the reverse order.
322
+ *
323
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
324
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
325
+ */
326
+ public constructor(size: Size, type: int);
327
+
328
+ /**
329
+ * This is an overloaded member function, provided for convenience. It differs from the above
330
+ * function only in what argument(s) it accepts.
331
+ *
332
+ * @param rows Number of rows in a 2D array.
333
+ *
334
+ * @param cols Number of columns in a 2D array.
335
+ *
336
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
337
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
338
+ *
339
+ * @param s An optional value to initialize each matrix element with. To set all the matrix elements
340
+ * to the particular value after the construction, use the assignment operator Mat::operator=(const
341
+ * Scalar& value) .
342
+ */
343
+ public constructor(rows: int, cols: int, type: int, s: Scalar);
344
+
345
+ /**
346
+ * This is an overloaded member function, provided for convenience. It differs from the above
347
+ * function only in what argument(s) it accepts.
348
+ *
349
+ * @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and
350
+ * the number of columns go in the reverse order.
351
+ *
352
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
353
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
354
+ *
355
+ * @param s An optional value to initialize each matrix element with. To set all the matrix elements
356
+ * to the particular value after the construction, use the assignment operator Mat::operator=(const
357
+ * Scalar& value) .
358
+ */
359
+ public constructor(size: Size, type: int, s: Scalar);
360
+
361
+ /**
362
+ * This is an overloaded member function, provided for convenience. It differs from the above
363
+ * function only in what argument(s) it accepts.
364
+ *
365
+ * @param ndims Array dimensionality.
366
+ *
367
+ * @param sizes Array of integers specifying an n-dimensional array shape.
368
+ *
369
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
370
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
371
+ */
372
+ public constructor(ndims: int, sizes: any, type: int);
373
+
374
+ /**
375
+ * This is an overloaded member function, provided for convenience. It differs from the above
376
+ * function only in what argument(s) it accepts.
377
+ *
378
+ * @param sizes Array of integers specifying an n-dimensional array shape.
379
+ *
380
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
381
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
382
+ */
383
+ public constructor(sizes: any, type: int);
384
+
385
+ /**
386
+ * This is an overloaded member function, provided for convenience. It differs from the above
387
+ * function only in what argument(s) it accepts.
388
+ *
389
+ * @param ndims Array dimensionality.
390
+ *
391
+ * @param sizes Array of integers specifying an n-dimensional array shape.
392
+ *
393
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
394
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
395
+ *
396
+ * @param s An optional value to initialize each matrix element with. To set all the matrix elements
397
+ * to the particular value after the construction, use the assignment operator Mat::operator=(const
398
+ * Scalar& value) .
399
+ */
400
+ public constructor(ndims: int, sizes: any, type: int, s: Scalar);
401
+
402
+ /**
403
+ * This is an overloaded member function, provided for convenience. It differs from the above
404
+ * function only in what argument(s) it accepts.
405
+ *
406
+ * @param sizes Array of integers specifying an n-dimensional array shape.
407
+ *
408
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
409
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
410
+ *
411
+ * @param s An optional value to initialize each matrix element with. To set all the matrix elements
412
+ * to the particular value after the construction, use the assignment operator Mat::operator=(const
413
+ * Scalar& value) .
414
+ */
415
+ public constructor(sizes: any, type: int, s: Scalar);
416
+
417
+ /**
418
+ * This is an overloaded member function, provided for convenience. It differs from the above
419
+ * function only in what argument(s) it accepts.
420
+ *
421
+ * @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is
422
+ * copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed
423
+ * and associated with it. The reference counter, if any, is incremented. So, when you modify the
424
+ * matrix formed using such a constructor, you also modify the corresponding elements of m . If you
425
+ * want to have an independent copy of the sub-array, use Mat::clone() .
426
+ */
427
+ public constructor(m: Mat);
428
+
429
+ /**
430
+ * This is an overloaded member function, provided for convenience. It differs from the above
431
+ * function only in what argument(s) it accepts.
432
+ *
433
+ * @param rows Number of rows in a 2D array.
434
+ *
435
+ * @param cols Number of columns in a 2D array.
436
+ *
437
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
438
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
439
+ *
440
+ * @param data Pointer to the user data. Matrix constructors that take data and step parameters do
441
+ * not allocate matrix data. Instead, they just initialize the matrix header that points to the
442
+ * specified data, which means that no data is copied. This operation is very efficient and can be used
443
+ * to process external data using OpenCV functions. The external data is not automatically deallocated,
444
+ * so you should take care of it.
445
+ *
446
+ * @param step Number of bytes each matrix row occupies. The value should include the padding bytes
447
+ * at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is
448
+ * assumed and the actual step is calculated as cols*elemSize(). See Mat::elemSize.
449
+ */
450
+ public constructor(rows: int, cols: int, type: int, data: any, step?: size_t);
451
+
452
+ /**
453
+ * This is an overloaded member function, provided for convenience. It differs from the above
454
+ * function only in what argument(s) it accepts.
455
+ *
456
+ * @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and
457
+ * the number of columns go in the reverse order.
458
+ *
459
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
460
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
461
+ *
462
+ * @param data Pointer to the user data. Matrix constructors that take data and step parameters do
463
+ * not allocate matrix data. Instead, they just initialize the matrix header that points to the
464
+ * specified data, which means that no data is copied. This operation is very efficient and can be used
465
+ * to process external data using OpenCV functions. The external data is not automatically deallocated,
466
+ * so you should take care of it.
467
+ *
468
+ * @param step Number of bytes each matrix row occupies. The value should include the padding bytes
469
+ * at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is
470
+ * assumed and the actual step is calculated as cols*elemSize(). See Mat::elemSize.
471
+ */
472
+ public constructor(size: Size, type: int, data: any, step?: size_t);
473
+
474
+ /**
475
+ * This is an overloaded member function, provided for convenience. It differs from the above
476
+ * function only in what argument(s) it accepts.
477
+ *
478
+ * @param ndims Array dimensionality.
479
+ *
480
+ * @param sizes Array of integers specifying an n-dimensional array shape.
481
+ *
482
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
483
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
484
+ *
485
+ * @param data Pointer to the user data. Matrix constructors that take data and step parameters do
486
+ * not allocate matrix data. Instead, they just initialize the matrix header that points to the
487
+ * specified data, which means that no data is copied. This operation is very efficient and can be used
488
+ * to process external data using OpenCV functions. The external data is not automatically deallocated,
489
+ * so you should take care of it.
490
+ *
491
+ * @param steps Array of ndims-1 steps in case of a multi-dimensional array (the last step is always
492
+ * set to the element size). If not specified, the matrix is assumed to be continuous.
493
+ */
494
+ public constructor(ndims: int, sizes: any, type: int, data: any, steps?: any);
495
+
496
+ /**
497
+ * This is an overloaded member function, provided for convenience. It differs from the above
498
+ * function only in what argument(s) it accepts.
499
+ *
500
+ * @param sizes Array of integers specifying an n-dimensional array shape.
501
+ *
502
+ * @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n),
503
+ * ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
504
+ *
505
+ * @param data Pointer to the user data. Matrix constructors that take data and step parameters do
506
+ * not allocate matrix data. Instead, they just initialize the matrix header that points to the
507
+ * specified data, which means that no data is copied. This operation is very efficient and can be used
508
+ * to process external data using OpenCV functions. The external data is not automatically deallocated,
509
+ * so you should take care of it.
510
+ *
511
+ * @param steps Array of ndims-1 steps in case of a multi-dimensional array (the last step is always
512
+ * set to the element size). If not specified, the matrix is assumed to be continuous.
513
+ */
514
+ public constructor(sizes: any, type: int, data: any, steps?: any);
515
+
516
+ /**
517
+ * This is an overloaded member function, provided for convenience. It differs from the above
518
+ * function only in what argument(s) it accepts.
519
+ *
520
+ * @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is
521
+ * copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed
522
+ * and associated with it. The reference counter, if any, is incremented. So, when you modify the
523
+ * matrix formed using such a constructor, you also modify the corresponding elements of m . If you
524
+ * want to have an independent copy of the sub-array, use Mat::clone() .
525
+ *
526
+ * @param rowRange Range of the m rows to take. As usual, the range start is inclusive and the range
527
+ * end is exclusive. Use Range::all() to take all the rows.
528
+ *
529
+ * @param colRange Range of the m columns to take. Use Range::all() to take all the columns.
530
+ */
531
+ public constructor(m: Mat, rowRange: Range, colRange?: Range);
532
+
533
+ /**
534
+ * This is an overloaded member function, provided for convenience. It differs from the above
535
+ * function only in what argument(s) it accepts.
536
+ *
537
+ * @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is
538
+ * copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed
539
+ * and associated with it. The reference counter, if any, is incremented. So, when you modify the
540
+ * matrix formed using such a constructor, you also modify the corresponding elements of m . If you
541
+ * want to have an independent copy of the sub-array, use Mat::clone() .
542
+ *
543
+ * @param roi Region of interest.
544
+ */
545
+ public constructor(m: Mat, roi: Rect);
546
+
547
+ /**
548
+ * This is an overloaded member function, provided for convenience. It differs from the above
549
+ * function only in what argument(s) it accepts.
550
+ *
551
+ * @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is
552
+ * copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed
553
+ * and associated with it. The reference counter, if any, is incremented. So, when you modify the
554
+ * matrix formed using such a constructor, you also modify the corresponding elements of m . If you
555
+ * want to have an independent copy of the sub-array, use Mat::clone() .
556
+ *
557
+ * @param ranges Array of selected ranges of m along each dimensionality.
558
+ */
559
+ public constructor(m: Mat, ranges: Range);
560
+
561
+ /**
562
+ * This is an overloaded member function, provided for convenience. It differs from the above
563
+ * function only in what argument(s) it accepts.
564
+ *
565
+ * @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is
566
+ * copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed
567
+ * and associated with it. The reference counter, if any, is incremented. So, when you modify the
568
+ * matrix formed using such a constructor, you also modify the corresponding elements of m . If you
569
+ * want to have an independent copy of the sub-array, use Mat::clone() .
570
+ *
571
+ * @param ranges Array of selected ranges of m along each dimensionality.
572
+ */
573
+ public constructor(m: Mat, ranges: Range);
574
+
575
+ /**
576
+ * This is an overloaded member function, provided for convenience. It differs from the above
577
+ * function only in what argument(s) it accepts.
578
+ *
579
+ * @param vec STL vector whose elements form the matrix. The matrix has a single column and the
580
+ * number of rows equal to the number of vector elements. Type of the matrix matches the type of vector
581
+ * elements. The constructor can handle arbitrary types, for which there is a properly declared
582
+ * DataType . This means that the vector elements must be primitive numbers or uni-type numerical
583
+ * tuples of numbers. Mixed-type structures are not supported. The corresponding constructor is
584
+ * explicit. Since STL vectors are not automatically converted to Mat instances, you should write
585
+ * Mat(vec) explicitly. Unless you copy the data into the matrix ( copyData=true ), no new elements
586
+ * will be added to the vector because it can potentially yield vector data reallocation, and, thus,
587
+ * the matrix data pointer will be invalid.
588
+ *
589
+ * @param copyData Flag to specify whether the underlying data of the STL vector should be copied to
590
+ * (true) or shared with (false) the newly constructed matrix. When the data is copied, the allocated
591
+ * buffer is managed using Mat reference counting mechanism. While the data is shared, the reference
592
+ * counter is NULL, and you should not deallocate the data until the matrix is not destructed.
593
+ */
594
+ public constructor(arg3: any, vec: any, copyData?: bool);
595
+
596
+ /**
597
+ * This is an overloaded member function, provided for convenience. It differs from the above
598
+ * function only in what argument(s) it accepts.
599
+ */
600
+ public constructor(arg4: any, arg5?: typename, list?: any);
601
+
602
+ /**
603
+ * This is an overloaded member function, provided for convenience. It differs from the above
604
+ * function only in what argument(s) it accepts.
605
+ */
606
+ public constructor(arg6: any, sizes: any, list: any);
607
+
608
+ /**
609
+ * This is an overloaded member function, provided for convenience. It differs from the above
610
+ * function only in what argument(s) it accepts.
611
+ */
612
+ public constructor(arg7: any, _Nm: size_t, arr: any, copyData?: bool);
613
+
614
+ /**
615
+ * This is an overloaded member function, provided for convenience. It differs from the above
616
+ * function only in what argument(s) it accepts.
617
+ */
618
+ public constructor(arg8: any, n: int, vec: Vec, copyData?: bool);
619
+
620
+ /**
621
+ * This is an overloaded member function, provided for convenience. It differs from the above
622
+ * function only in what argument(s) it accepts.
623
+ */
624
+ public constructor(arg9: any, m: int, n: int, mtx: Matx, copyData?: bool);
625
+
626
+ /**
627
+ * This is an overloaded member function, provided for convenience. It differs from the above
628
+ * function only in what argument(s) it accepts.
629
+ */
630
+ public constructor(arg10: any, pt: Point_, copyData?: bool);
631
+
632
+ /**
633
+ * This is an overloaded member function, provided for convenience. It differs from the above
634
+ * function only in what argument(s) it accepts.
635
+ */
636
+ public constructor(arg11: any, pt: Point3_, copyData?: bool);
637
+
638
+ /**
639
+ * This is an overloaded member function, provided for convenience. It differs from the above
640
+ * function only in what argument(s) it accepts.
641
+ */
642
+ public constructor(arg12: any, commaInitializer: MatCommaInitializer_);
643
+
644
+ public constructor(m: any);
645
+
646
+ public constructor(m: Mat);
647
+
648
+ /**
649
+ * The method increments the reference counter associated with the matrix data. If the matrix header
650
+ * points to an external data set (see [Mat::Mat] ), the reference counter is NULL, and the method has
651
+ * no effect in this case. Normally, to avoid memory leaks, the method should not be called explicitly.
652
+ * It is called implicitly by the matrix assignment operator. The reference counter increment is an
653
+ * atomic operation on the platforms that support it. Thus, it is safe to operate on the same matrices
654
+ * asynchronously in different threads.
655
+ */
656
+ public addref(): void;
657
+
658
+ /**
659
+ * The method is complimentary to [Mat::locateROI] . The typical use of these functions is to
660
+ * determine the submatrix position within the parent matrix and then shift the position somehow.
661
+ * Typically, it can be required for filtering operations when pixels outside of the ROI should be
662
+ * taken into account. When all the method parameters are positive, the ROI needs to grow in all
663
+ * directions by the specified amount, for example:
664
+ *
665
+ * ```cpp
666
+ * A.adjustROI(2, 2, 2, 2);
667
+ * ```
668
+ *
669
+ * In this example, the matrix size is increased by 4 elements in each direction. The matrix is
670
+ * shifted by 2 elements to the left and 2 elements up, which brings in all the necessary pixels for
671
+ * the filtering with the 5x5 kernel.
672
+ *
673
+ * adjustROI forces the adjusted ROI to be inside of the parent matrix that is boundaries of the
674
+ * adjusted ROI are constrained by boundaries of the parent matrix. For example, if the submatrix A is
675
+ * located in the first row of a parent matrix and you called A.adjustROI(2, 2, 2, 2) then A will not
676
+ * be increased in the upward direction.
677
+ *
678
+ * The function is used internally by the OpenCV filtering functions, like filter2D , morphological
679
+ * operations, and so on.
680
+ *
681
+ * [copyMakeBorder]
682
+ *
683
+ * @param dtop Shift of the top submatrix boundary upwards.
684
+ *
685
+ * @param dbottom Shift of the bottom submatrix boundary downwards.
686
+ *
687
+ * @param dleft Shift of the left submatrix boundary to the left.
688
+ *
689
+ * @param dright Shift of the right submatrix boundary to the right.
690
+ */
691
+ public adjustROI(dtop: int, dbottom: int, dleft: int, dright: int): Mat;
692
+ /**
693
+ * The methods return the matrix read-only or read-write iterators. The use of matrix iterators is
694
+ * very similar to the use of bi-directional STL iterators. In the example below, the alpha blending
695
+ * function is rewritten using the matrix iterators:
696
+ *
697
+ * ```cpp
698
+ * template<typename T>
699
+ * void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
700
+ * {
701
+ * typedef Vec<T, 4> VT;
702
+ *
703
+ * const float alpha_scale = (float)std::numeric_limits<T>::max(),
704
+ * inv_scale = 1.f/alpha_scale;
705
+ *
706
+ * CV_Assert( src1.type() == src2.type() &&
707
+ * src1.type() == traits::Type<VT>::value &&
708
+ * src1.size() == src2.size());
709
+ * Size size = src1.size();
710
+ * dst.create(size, src1.type());
711
+ *
712
+ * MatConstIterator_<VT> it1 = src1.begin<VT>(), it1_end = src1.end<VT>();
713
+ * MatConstIterator_<VT> it2 = src2.begin<VT>();
714
+ * MatIterator_<VT> dst_it = dst.begin<VT>();
715
+ *
716
+ * for( ; it1 != it1_end; ++it1, ++it2, ++dst_it )
717
+ * {
718
+ * VT pix1 = *it1, pix2 = *it2;
719
+ * float alpha = pix1[3]*inv_scale, beta = pix2[3]*inv_scale;
720
+ * dst_it = VT(saturate_cast<T>(pix1[0]*alpha + pix2[0]*beta),
721
+ * saturate_cast<T>(pix1[1]*alpha + pix2[1]*beta),
722
+ * saturate_cast<T>(pix1[2]*alpha + pix2[2]*beta),
723
+ * saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale));
724
+ * }
725
+ * }
726
+ * ```
727
+ */
728
+ public begin(arg25: any): MatIterator_;
729
+
730
+ public begin(arg26: any): MatConstIterator_;
731
+
732
+ /**
733
+ * The method returns the number of matrix channels.
734
+ */
735
+ public channels(): int;
736
+
737
+ /**
738
+ * -1 if the requirement is not satisfied. Otherwise, it returns the number of elements in the
739
+ * matrix. Note that an element may have multiple channels.
740
+ * The following code demonstrates its usage for a 2-d matrix:
741
+ *
742
+ * ```cpp
743
+ * cv::Mat mat(20, 1, CV_32FC2);
744
+ * int n = mat.checkVector(2);
745
+ * CV_Assert(n == 20); // mat has 20 elements
746
+ *
747
+ * mat.create(20, 2, CV_32FC1);
748
+ * n = mat.checkVector(1);
749
+ * CV_Assert(n == -1); // mat is neither a column nor a row vector
750
+ *
751
+ * n = mat.checkVector(2);
752
+ * CV_Assert(n == 20); // the 2 columns are considered as 1 element
753
+ * ```
754
+ *
755
+ * The following code demonstrates its usage for a 3-d matrix:
756
+ *
757
+ * ```cpp
758
+ * int dims[] = {1, 3, 5}; // 1 plane, every plane has 3 rows and 5 columns
759
+ * mat.create(3, dims, CV_32FC1); // for 3-d mat, it MUST have only 1 channel
760
+ * n = mat.checkVector(5); // the 5 columns are considered as 1 element
761
+ * CV_Assert(n == 3);
762
+ *
763
+ * int dims2[] = {3, 1, 5}; // 3 planes, every plane has 1 row and 5 columns
764
+ * mat.create(3, dims2, CV_32FC1);
765
+ * n = mat.checkVector(5); // the 5 columns are considered as 1 element
766
+ * CV_Assert(n == 3);
767
+ * ```
768
+ *
769
+ * @param elemChannels Number of channels or number of columns the matrix should have. For a 2-D
770
+ * matrix, when the matrix has only 1 column, then it should have elemChannels channels; When the
771
+ * matrix has only 1 channel, then it should have elemChannels columns. For a 3-D matrix, it should
772
+ * have only one channel. Furthermore, if the number of planes is not one, then the number of rows
773
+ * within every plane has to be 1; if the number of rows within every plane is not 1, then the number
774
+ * of planes has to be 1.
775
+ *
776
+ * @param depth The depth the matrix should have. Set it to -1 when any depth is fine.
777
+ *
778
+ * @param requireContinuous Set it to true to require the matrix to be continuous
779
+ */
780
+ public checkVector(
781
+ elemChannels: int,
782
+ depth?: int,
783
+ requireContinuous?: bool,
784
+ ): int;
785
+
786
+ /**
787
+ * The method creates a full copy of the array. The original step[] is not taken into account. So,
788
+ * the array copy is a continuous array occupying [total()]*elemSize() bytes.
789
+ */
790
+ public clone(): Mat;
791
+
792
+ /**
793
+ * The method makes a new header for the specified matrix column and returns it. This is an O(1)
794
+ * operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
795
+ * original matrix. See also the [Mat::row] description.
796
+ *
797
+ * @param x A 0-based column index.
798
+ */
799
+ public col(x: int): Mat;
800
+
801
+ /**
802
+ * The method makes a new header for the specified column span of the matrix. Similarly to [Mat::row]
803
+ * and [Mat::col] , this is an O(1) operation.
804
+ *
805
+ * @param startcol An inclusive 0-based start index of the column span.
806
+ *
807
+ * @param endcol An exclusive 0-based ending index of the column span.
808
+ */
809
+ public colRange(startcol: int, endcol: int): Mat;
810
+
811
+ /**
812
+ * This is an overloaded member function, provided for convenience. It differs from the above
813
+ * function only in what argument(s) it accepts.
814
+ *
815
+ * @param r Range structure containing both the start and the end indices.
816
+ */
817
+ public colRange(r: Range): Mat;
818
+
819
+ /**
820
+ * The method converts source pixel values to the target data type. saturate_cast<> is applied at the
821
+ * end to avoid possible overflows:
822
+ *
823
+ * `\\[m(x,y) = saturate \\_ cast<rType>( \\alpha (*this)(x,y) + \\beta )\\]`
824
+ *
825
+ * @param m output matrix; if it does not have a proper size or type before the operation, it is
826
+ * reallocated.
827
+ *
828
+ * @param rtype desired output matrix type or, rather, the depth since the number of channels are the
829
+ * same as the input has; if rtype is negative, the output matrix will have the same type as the input.
830
+ *
831
+ * @param alpha optional scale factor.
832
+ *
833
+ * @param beta optional delta added to the scaled values.
834
+ */
835
+ public convertTo(
836
+ m: OutputArray,
837
+ rtype: int,
838
+ alpha?: double,
839
+ beta?: double,
840
+ ): OutputArray;
841
+
842
+ public copySize(m: Mat): Mat;
843
+
844
+ /**
845
+ * The method copies the matrix data to another matrix. Before copying the data, the method invokes :
846
+ *
847
+ *
848
+ * ```cpp
849
+ * m.create(this->size(), this->type());
850
+ * ```
851
+ *
852
+ * so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the
853
+ * function does not handle the case of a partial overlap between the source and the destination
854
+ * matrices.
855
+ *
856
+ * When the operation mask is specified, if the [Mat::create] call shown above reallocates the
857
+ * matrix, the newly allocated matrix is initialized with all zeros before copying the data.
858
+ *
859
+ * @param m Destination matrix. If it does not have a proper size or type before the operation, it is
860
+ * reallocated.
861
+ */
862
+ public copyTo(m: OutputArray): OutputArray;
863
+
864
+ /**
865
+ * This is an overloaded member function, provided for convenience. It differs from the above
866
+ * function only in what argument(s) it accepts.
867
+ *
868
+ * @param m Destination matrix. If it does not have a proper size or type before the operation, it is
869
+ * reallocated.
870
+ *
871
+ * @param mask Operation mask of the same size as *this. Its non-zero elements indicate which matrix
872
+ * elements need to be copied. The mask has to be of type CV_8U and can have 1 or multiple channels.
873
+ */
874
+ public copyTo(m: OutputArray, mask: InputArray): OutputArray;
875
+
876
+ /**
877
+ * This is one of the key [Mat] methods. Most new-style OpenCV functions and methods that produce
878
+ * arrays call this method for each output array. The method uses the following algorithm:
879
+ *
880
+ * If the current array shape and the type match the new ones, return immediately. Otherwise,
881
+ * de-reference the previous data by calling [Mat::release].
882
+ * Initialize the new header.
883
+ * Allocate the new data of [total()]*elemSize() bytes.
884
+ * Allocate the new, associated with the data, reference counter and set it to 1.
885
+ *
886
+ * Such a scheme makes the memory management robust and efficient at the same time and helps avoid
887
+ * extra typing for you. This means that usually there is no need to explicitly allocate output arrays.
888
+ * That is, instead of writing:
889
+ *
890
+ * ```cpp
891
+ * Mat color;
892
+ * ...
893
+ * Mat gray(color.rows, color.cols, color.depth());
894
+ * cvtColor(color, gray, COLOR_BGR2GRAY);
895
+ * ```
896
+ *
897
+ * you can simply write:
898
+ *
899
+ * ```cpp
900
+ * Mat color;
901
+ * ...
902
+ * Mat gray;
903
+ * cvtColor(color, gray, COLOR_BGR2GRAY);
904
+ * ```
905
+ *
906
+ * because cvtColor, as well as the most of OpenCV functions, calls [Mat::create()] for the output
907
+ * array internally.
908
+ *
909
+ * @param rows New number of rows.
910
+ *
911
+ * @param cols New number of columns.
912
+ *
913
+ * @param type New matrix type.
914
+ */
915
+ public create(rows: int, cols: int, type: int): void;
916
+
917
+ /**
918
+ * This is an overloaded member function, provided for convenience. It differs from the above
919
+ * function only in what argument(s) it accepts.
920
+ *
921
+ * @param size Alternative new matrix size specification: Size(cols, rows)
922
+ *
923
+ * @param type New matrix type.
924
+ */
925
+ public create(size: Size, type: int): Size;
926
+
927
+ /**
928
+ * This is an overloaded member function, provided for convenience. It differs from the above
929
+ * function only in what argument(s) it accepts.
930
+ *
931
+ * @param ndims New array dimensionality.
932
+ *
933
+ * @param sizes Array of integers specifying a new array shape.
934
+ *
935
+ * @param type New matrix type.
936
+ */
937
+ public create(ndims: int, sizes: any, type: int): void;
938
+
939
+ /**
940
+ * This is an overloaded member function, provided for convenience. It differs from the above
941
+ * function only in what argument(s) it accepts.
942
+ *
943
+ * @param sizes Array of integers specifying a new array shape.
944
+ *
945
+ * @param type New matrix type.
946
+ */
947
+ public create(sizes: any, type: int): void;
948
+
949
+ /**
950
+ * The method computes a cross-product of two 3-element vectors. The vectors must be 3-element
951
+ * floating-point vectors of the same shape and size. The result is another 3-element vector of the
952
+ * same shape and type as operands.
953
+ *
954
+ * @param m Another cross-product operand.
955
+ */
956
+ public cross(m: InputArray): Mat;
957
+
958
+ public deallocate(): void;
959
+
960
+ /**
961
+ * The method returns the identifier of the matrix element depth (the type of each individual
962
+ * channel). For example, for a 16-bit signed element array, the method returns CV_16S . A complete
963
+ * list of matrix types contains the following values:
964
+ *
965
+ * CV_8U - 8-bit unsigned integers ( 0..255 )
966
+ * CV_8S - 8-bit signed integers ( -128..127 )
967
+ * CV_16U - 16-bit unsigned integers ( 0..65535 )
968
+ * CV_16S - 16-bit signed integers ( -32768..32767 )
969
+ * CV_32S - 32-bit signed integers ( -2147483648..2147483647 )
970
+ * CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )
971
+ * CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )
972
+ */
973
+ public depth(): int;
974
+
975
+ /**
976
+ * The method makes a new header for the specified matrix diagonal. The new matrix is represented as
977
+ * a single-column matrix. Similarly to [Mat::row] and [Mat::col], this is an O(1) operation.
978
+ *
979
+ * @param d index of the diagonal, with the following values:
980
+ * d=0 is the main diagonal.d<0 is a diagonal from the lower half. For example, d=-1 means the
981
+ * diagonal is set immediately below the main one.d>0 is a diagonal from the upper half. For example,
982
+ * d=1 means the diagonal is set immediately above the main one. For example: Matm=(Mat_<int>(3,3)<<
983
+ * 1,2,3,
984
+ * 4,5,6,
985
+ * 7,8,9);
986
+ * Matd0=m.diag(0);
987
+ * Matd1=m.diag(1);
988
+ * Matd_1=m.diag(-1);
989
+ * The resulting matrices are d0=
990
+ * [1;
991
+ * 5;
992
+ * 9]
993
+ * d1=
994
+ * [2;
995
+ * 6]
996
+ * d_1=
997
+ * [4;
998
+ * 8]
999
+ */
1000
+ public diag(d?: int): Mat;
1001
+
1002
+ /**
1003
+ * The method computes a dot-product of two matrices. If the matrices are not single-column or
1004
+ * single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them as 1D
1005
+ * vectors. The vectors must have the same size and type. If the matrices have more than one channel,
1006
+ * the dot products from all the channels are summed together.
1007
+ *
1008
+ * @param m another dot-product operand.
1009
+ */
1010
+ public dot(m: InputArray): InputArray;
1011
+
1012
+ /**
1013
+ * The method returns the matrix element size in bytes. For example, if the matrix type is CV_16SC3 ,
1014
+ * the method returns 3*sizeof(short) or 6.
1015
+ */
1016
+ public elemSize(): size_t;
1017
+
1018
+ /**
1019
+ * The method returns the matrix element channel size in bytes, that is, it ignores the number of
1020
+ * channels. For example, if the matrix type is CV_16SC3 , the method returns sizeof(short) or 2.
1021
+ */
1022
+ public elemSize1(): size_t;
1023
+
1024
+ /**
1025
+ * The method returns true if [Mat::total()] is 0 or if [Mat::data] is NULL. Because of [pop_back()]
1026
+ * and [resize()] methods `[M.total()] == 0` does not imply that `M.data == NULL`.
1027
+ */
1028
+ public empty(): bool;
1029
+
1030
+ /**
1031
+ * The methods return the matrix read-only or read-write iterators, set to the point following the
1032
+ * last matrix element.
1033
+ */
1034
+ public end(arg27: any): MatIterator_;
1035
+
1036
+ public end(arg28: any): MatConstIterator_;
1037
+
1038
+ /**
1039
+ * The operation passed as argument has to be a function pointer, a function object or a
1040
+ * lambda(C++11).
1041
+ *
1042
+ * Example 1. All of the operations below put 0xFF the first channel of all matrix elements:
1043
+ *
1044
+ * ```cpp
1045
+ * Mat image(1920, 1080, CV_8UC3);
1046
+ * typedef cv::Point3_<uint8_t> Pixel;
1047
+ *
1048
+ * // first. raw pointer access.
1049
+ * for (int r = 0; r < image.rows; ++r) {
1050
+ * Pixel* ptr = image.ptr<Pixel>(r, 0);
1051
+ * const Pixel* ptr_end = ptr + image.cols;
1052
+ * for (; ptr != ptr_end; ++ptr) {
1053
+ * ptr->x = 255;
1054
+ * }
1055
+ * }
1056
+ *
1057
+ * // Using MatIterator. (Simple but there are a Iterator's overhead)
1058
+ * for (Pixel &p : cv::Mat_<Pixel>(image)) {
1059
+ * p.x = 255;
1060
+ * }
1061
+ *
1062
+ * // Parallel execution with function object.
1063
+ * struct Operator {
1064
+ * void operator ()(Pixel &pixel, const int * position) {
1065
+ * pixel.x = 255;
1066
+ * }
1067
+ * };
1068
+ * image.forEach<Pixel>(Operator());
1069
+ *
1070
+ * // Parallel execution using C++11 lambda.
1071
+ * image.forEach<Pixel>([](Pixel &p, const int * position) -> void {
1072
+ * p.x = 255;
1073
+ * });
1074
+ * ```
1075
+ *
1076
+ * Example 2. Using the pixel's position:
1077
+ *
1078
+ * ```cpp
1079
+ * // Creating 3D matrix (255 x 255 x 255) typed uint8_t
1080
+ * // and initialize all elements by the value which equals elements position.
1081
+ * // i.e. pixels (x,y,z) = (1,2,3) is (b,g,r) = (1,2,3).
1082
+ *
1083
+ * int sizes[] = { 255, 255, 255 };
1084
+ * typedef cv::Point3_<uint8_t> Pixel;
1085
+ *
1086
+ * Mat_<Pixel> image = Mat::zeros(3, sizes, CV_8UC3);
1087
+ *
1088
+ * image.forEach<Pixel>([&](Pixel& pixel, const int position[]) -> void {
1089
+ * pixel.x = position[0];
1090
+ * pixel.y = position[1];
1091
+ * pixel.z = position[2];
1092
+ * });
1093
+ * ```
1094
+ */
1095
+ public forEach(arg29: any, arg30: any, operation: any): any;
1096
+
1097
+ /**
1098
+ * This is an overloaded member function, provided for convenience. It differs from the above
1099
+ * function only in what argument(s) it accepts.
1100
+ */
1101
+ public forEach(arg31: any, arg32: any, operation: any): any;
1102
+
1103
+ public getUMat(accessFlags: AccessFlag, usageFlags?: UMatUsageFlags): UMat;
1104
+
1105
+ /**
1106
+ * The method performs a matrix inversion by means of matrix expressions. This means that a temporary
1107
+ * matrix inversion object is returned by the method and can be used further as a part of more complex
1108
+ * matrix expressions or can be assigned to a matrix.
1109
+ *
1110
+ * @param method Matrix inversion method. One of cv::DecompTypes
1111
+ */
1112
+ public inv(method?: int): MatExpr;
1113
+
1114
+ /**
1115
+ * The method returns true if the matrix elements are stored continuously without gaps at the end of
1116
+ * each row. Otherwise, it returns false. Obviously, 1x1 or 1xN matrices are always continuous.
1117
+ * Matrices created with [Mat::create] are always continuous. But if you extract a part of the matrix
1118
+ * using [Mat::col], [Mat::diag], and so on, or constructed a matrix header for externally allocated
1119
+ * data, such matrices may no longer have this property.
1120
+ *
1121
+ * The continuity flag is stored as a bit in the [Mat::flags] field and is computed automatically
1122
+ * when you construct a matrix header. Thus, the continuity check is a very fast operation, though
1123
+ * theoretically it could be done as follows:
1124
+ *
1125
+ * ```cpp
1126
+ * // alternative implementation of Mat::isContinuous()
1127
+ * bool myCheckMatContinuity(const Mat& m)
1128
+ * {
1129
+ * //return (m.flags & Mat::CONTINUOUS_FLAG) != 0;
1130
+ * return m.rows == 1 || m.step == m.cols*m.elemSize();
1131
+ * }
1132
+ * ```
1133
+ *
1134
+ * The method is used in quite a few of OpenCV functions. The point is that element-wise operations
1135
+ * (such as arithmetic and logical operations, math functions, alpha blending, color space
1136
+ * transformations, and others) do not depend on the image geometry. Thus, if all the input and output
1137
+ * arrays are continuous, the functions can process them as very long single-row vectors. The example
1138
+ * below illustrates how an alpha-blending function can be implemented:
1139
+ *
1140
+ * ```cpp
1141
+ * template<typename T>
1142
+ * void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
1143
+ * {
1144
+ * const float alpha_scale = (float)std::numeric_limits<T>::max(),
1145
+ * inv_scale = 1.f/alpha_scale;
1146
+ *
1147
+ * CV_Assert( src1.type() == src2.type() &&
1148
+ * src1.type() == CV_MAKETYPE(traits::Depth<T>::value, 4) &&
1149
+ * src1.size() == src2.size());
1150
+ * Size size = src1.size();
1151
+ * dst.create(size, src1.type());
1152
+ *
1153
+ * // here is the idiom: check the arrays for continuity and,
1154
+ * // if this is the case,
1155
+ * // treat the arrays as 1D vectors
1156
+ * if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() )
1157
+ * {
1158
+ * size.width *= size.height;
1159
+ * size.height = 1;
1160
+ * }
1161
+ * size.width *= 4;
1162
+ *
1163
+ * for( int i = 0; i < size.height; i++ )
1164
+ * {
1165
+ * // when the arrays are continuous,
1166
+ * // the outer loop is executed only once
1167
+ * const T* ptr1 = src1.ptr<T>(i);
1168
+ * const T* ptr2 = src2.ptr<T>(i);
1169
+ * T* dptr = dst.ptr<T>(i);
1170
+ *
1171
+ * for( int j = 0; j < size.width; j += 4 )
1172
+ * {
1173
+ * float alpha = ptr1[j+3]*inv_scale, beta = ptr2[j+3]*inv_scale;
1174
+ * dptr[j] = saturate_cast<T>(ptr1[j]*alpha + ptr2[j]*beta);
1175
+ * dptr[j+1] = saturate_cast<T>(ptr1[j+1]*alpha + ptr2[j+1]*beta);
1176
+ * dptr[j+2] = saturate_cast<T>(ptr1[j+2]*alpha + ptr2[j+2]*beta);
1177
+ * dptr[j+3] = saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale);
1178
+ * }
1179
+ * }
1180
+ * }
1181
+ * ```
1182
+ *
1183
+ * This approach, while being very simple, can boost the performance of a simple element-operation
1184
+ * by 10-20 percents, especially if the image is rather small and the operation is quite simple.
1185
+ *
1186
+ * Another OpenCV idiom in this function, a call of [Mat::create] for the destination array, that
1187
+ * allocates the destination array unless it already has the proper size and type. And while the newly
1188
+ * allocated arrays are always continuous, you still need to check the destination array because
1189
+ * [Mat::create] does not always allocate a new matrix.
1190
+ */
1191
+ public isContinuous(): bool;
1192
+ /**
1193
+ * After you extracted a submatrix from a matrix using [Mat::row], [Mat::col], [Mat::rowRange],
1194
+ * [Mat::colRange], and others, the resultant submatrix points just to the part of the original big
1195
+ * matrix. However, each submatrix contains information (represented by datastart and dataend fields)
1196
+ * that helps reconstruct the original matrix size and the position of the extracted submatrix within
1197
+ * the original matrix. The method locateROI does exactly that.
1198
+ *
1199
+ * @param wholeSize Output parameter that contains the size of the whole matrix containing this as a
1200
+ * part.
1201
+ *
1202
+ * @param ofs Output parameter that contains an offset of this inside the whole matrix.
1203
+ */
1204
+ public locateROI(wholeSize: Size, ofs: Point): Size;
1205
+
1206
+ /**
1207
+ * The method returns a temporary object encoding per-element array multiplication, with optional
1208
+ * scale. Note that this is not a matrix multiplication that corresponds to a simpler "\\*" operator.
1209
+ *
1210
+ * Example:
1211
+ *
1212
+ * ```cpp
1213
+ * Mat C = A.mul(5/B); // equivalent to divide(A, B, C, 5)
1214
+ * ```
1215
+ *
1216
+ * @param m Another array of the same type and the same size as *this, or a matrix expression.
1217
+ *
1218
+ * @param scale Optional scale factor.
1219
+ */
1220
+ public mul(m: InputArray, scale?: double): MatExpr;
1221
+
1222
+ /**
1223
+ * The method removes one or more rows from the bottom of the matrix.
1224
+ *
1225
+ * @param nelems Number of removed rows. If it is greater than the total number of rows, an exception
1226
+ * is thrown.
1227
+ */
1228
+ public pop_back(nelems?: size_t): void;
1229
+
1230
+ /**
1231
+ * The methods return `uchar*` or typed pointer to the specified matrix row. See the sample in
1232
+ * [Mat::isContinuous] to know how to use these methods.
1233
+ *
1234
+ * @param i0 A 0-based row index.
1235
+ */
1236
+ public ptr(i0?: int): uchar;
1237
+
1238
+ /**
1239
+ * This is an overloaded member function, provided for convenience. It differs from the above
1240
+ * function only in what argument(s) it accepts.
1241
+ */
1242
+ public ptr(i0?: int): uchar;
1243
+
1244
+ /**
1245
+ * This is an overloaded member function, provided for convenience. It differs from the above
1246
+ * function only in what argument(s) it accepts.
1247
+ *
1248
+ * @param row Index along the dimension 0
1249
+ *
1250
+ * @param col Index along the dimension 1
1251
+ */
1252
+ public ptr(row: int, col: int): uchar;
1253
+
1254
+ /**
1255
+ * This is an overloaded member function, provided for convenience. It differs from the above
1256
+ * function only in what argument(s) it accepts.
1257
+ *
1258
+ * @param row Index along the dimension 0
1259
+ *
1260
+ * @param col Index along the dimension 1
1261
+ */
1262
+ public ptr(row: int, col: int): uchar;
1263
+
1264
+ /**
1265
+ * This is an overloaded member function, provided for convenience. It differs from the above
1266
+ * function only in what argument(s) it accepts.
1267
+ */
1268
+ public ptr(i0: int, i1: int, i2: int): uchar;
1269
+
1270
+ /**
1271
+ * This is an overloaded member function, provided for convenience. It differs from the above
1272
+ * function only in what argument(s) it accepts.
1273
+ */
1274
+ public ptr(i0: int, i1: int, i2: int): uchar;
1275
+
1276
+ /**
1277
+ * This is an overloaded member function, provided for convenience. It differs from the above
1278
+ * function only in what argument(s) it accepts.
1279
+ */
1280
+ public ptr(idx: any): uchar;
1281
+
1282
+ /**
1283
+ * This is an overloaded member function, provided for convenience. It differs from the above
1284
+ * function only in what argument(s) it accepts.
1285
+ */
1286
+ public ptr(idx: any): uchar;
1287
+
1288
+ /**
1289
+ * This is an overloaded member function, provided for convenience. It differs from the above
1290
+ * function only in what argument(s) it accepts.
1291
+ */
1292
+ public ptr(n: int, idx: Vec): uchar;
1293
+
1294
+ /**
1295
+ * This is an overloaded member function, provided for convenience. It differs from the above
1296
+ * function only in what argument(s) it accepts.
1297
+ */
1298
+ public ptr(n: int, idx: Vec): uchar;
1299
+
1300
+ /**
1301
+ * This is an overloaded member function, provided for convenience. It differs from the above
1302
+ * function only in what argument(s) it accepts.
1303
+ */
1304
+ public ptr(arg37: any, i0?: int): any;
1305
+
1306
+ /**
1307
+ * This is an overloaded member function, provided for convenience. It differs from the above
1308
+ * function only in what argument(s) it accepts.
1309
+ */
1310
+ public ptr(arg38: any, i0?: int): any;
1311
+
1312
+ /**
1313
+ * This is an overloaded member function, provided for convenience. It differs from the above
1314
+ * function only in what argument(s) it accepts.
1315
+ *
1316
+ * @param row Index along the dimension 0
1317
+ *
1318
+ * @param col Index along the dimension 1
1319
+ */
1320
+ public ptr(arg39: any, row: int, col: int): any;
1321
+
1322
+ /**
1323
+ * This is an overloaded member function, provided for convenience. It differs from the above
1324
+ * function only in what argument(s) it accepts.
1325
+ *
1326
+ * @param row Index along the dimension 0
1327
+ *
1328
+ * @param col Index along the dimension 1
1329
+ */
1330
+ public ptr(arg40: any, row: int, col: int): any;
1331
+
1332
+ /**
1333
+ * This is an overloaded member function, provided for convenience. It differs from the above
1334
+ * function only in what argument(s) it accepts.
1335
+ */
1336
+ public ptr(arg41: any, i0: int, i1: int, i2: int): any;
1337
+
1338
+ /**
1339
+ * This is an overloaded member function, provided for convenience. It differs from the above
1340
+ * function only in what argument(s) it accepts.
1341
+ */
1342
+ public ptr(arg42: any, i0: int, i1: int, i2: int): any;
1343
+
1344
+ /**
1345
+ * This is an overloaded member function, provided for convenience. It differs from the above
1346
+ * function only in what argument(s) it accepts.
1347
+ */
1348
+ public ptr(arg43: any, idx: any): any;
1349
+
1350
+ /**
1351
+ * This is an overloaded member function, provided for convenience. It differs from the above
1352
+ * function only in what argument(s) it accepts.
1353
+ */
1354
+ public ptr(arg44: any, idx: any): any;
1355
+
1356
+ /**
1357
+ * This is an overloaded member function, provided for convenience. It differs from the above
1358
+ * function only in what argument(s) it accepts.
1359
+ */
1360
+ public ptr(arg45: any, n: int, idx: Vec): Vec;
1361
+
1362
+ /**
1363
+ * This is an overloaded member function, provided for convenience. It differs from the above
1364
+ * function only in what argument(s) it accepts.
1365
+ */
1366
+ public ptr(arg46: any, n: int, idx: Vec): Vec;
1367
+
1368
+ /**
1369
+ * The methods add one or more elements to the bottom of the matrix. They emulate the corresponding
1370
+ * method of the STL vector class. When elem is [Mat] , its type and the number of columns must be the
1371
+ * same as in the container matrix.
1372
+ *
1373
+ * @param elem Added element(s).
1374
+ */
1375
+ public push_back(arg47: any, elem: any): any;
1376
+
1377
+ /**
1378
+ * This is an overloaded member function, provided for convenience. It differs from the above
1379
+ * function only in what argument(s) it accepts.
1380
+ *
1381
+ * @param elem Added element(s).
1382
+ */
1383
+ public push_back(arg48: any, elem: Mat): Mat;
1384
+
1385
+ /**
1386
+ * This is an overloaded member function, provided for convenience. It differs from the above
1387
+ * function only in what argument(s) it accepts.
1388
+ *
1389
+ * @param elem Added element(s).
1390
+ */
1391
+ public push_back(arg49: any, elem: any): any;
1392
+
1393
+ /**
1394
+ * This is an overloaded member function, provided for convenience. It differs from the above
1395
+ * function only in what argument(s) it accepts.
1396
+ *
1397
+ * @param m Added line(s).
1398
+ */
1399
+ public push_back(m: Mat): Mat;
1400
+
1401
+ public push_back_(elem: any): void;
1402
+
1403
+ /**
1404
+ * The method decrements the reference counter associated with the matrix data. When the reference
1405
+ * counter reaches 0, the matrix data is deallocated and the data and the reference counter pointers
1406
+ * are set to NULL's. If the matrix header points to an external data set (see [Mat::Mat] ), the
1407
+ * reference counter is NULL, and the method has no effect in this case.
1408
+ *
1409
+ * This method can be called manually to force the matrix data deallocation. But since this method is
1410
+ * automatically called in the destructor, or by any other method that changes the data pointer, it is
1411
+ * usually not needed. The reference counter decrement and check for 0 is an atomic operation on the
1412
+ * platforms that support it. Thus, it is safe to operate on the same matrices asynchronously in
1413
+ * different threads.
1414
+ */
1415
+ public release(): void;
1416
+
1417
+ /**
1418
+ * The method reserves space for sz rows. If the matrix already has enough space to store sz rows,
1419
+ * nothing happens. If the matrix is reallocated, the first [Mat::rows] rows are preserved. The method
1420
+ * emulates the corresponding method of the STL vector class.
1421
+ *
1422
+ * @param sz Number of rows.
1423
+ */
1424
+ public reserve(sz: size_t): void;
1425
+
1426
+ /**
1427
+ * The method reserves space for sz bytes. If the matrix already has enough space to store sz bytes,
1428
+ * nothing happens. If matrix has to be reallocated its previous content could be lost.
1429
+ *
1430
+ * @param sz Number of bytes.
1431
+ */
1432
+ public reserveBuffer(sz: size_t): void;
1433
+
1434
+ /**
1435
+ * The method makes a new matrix header for *this elements. The new matrix may have a different size
1436
+ * and/or different number of channels. Any combination is possible if:
1437
+ *
1438
+ * No extra elements are included into the new matrix and no elements are excluded. Consequently, the
1439
+ * product rows*cols*channels() must stay the same after the transformation.
1440
+ * No data is copied. That is, this is an O(1) operation. Consequently, if you change the number of
1441
+ * rows, or the operation changes the indices of elements row in some other way, the matrix must be
1442
+ * continuous. See [Mat::isContinuous] .
1443
+ *
1444
+ * For example, if there is a set of 3D points stored as an STL vector, and you want to represent the
1445
+ * points as a 3xN matrix, do the following:
1446
+ *
1447
+ * ```cpp
1448
+ * std::vector<Point3f> vec;
1449
+ * ...
1450
+ * Mat pointMat = Mat(vec). // convert vector to Mat, O(1) operation
1451
+ * reshape(1). // make Nx3 1-channel matrix out of Nx1 3-channel.
1452
+ * // Also, an O(1) operation
1453
+ * t(); // finally, transpose the Nx3 matrix.
1454
+ * // This involves copying all the elements
1455
+ * ```
1456
+ *
1457
+ * @param cn New number of channels. If the parameter is 0, the number of channels remains the same.
1458
+ *
1459
+ * @param rows New number of rows. If the parameter is 0, the number of rows remains the same.
1460
+ */
1461
+ public reshape(cn: int, rows?: int): Mat;
1462
+
1463
+ /**
1464
+ * This is an overloaded member function, provided for convenience. It differs from the above
1465
+ * function only in what argument(s) it accepts.
1466
+ */
1467
+ public reshape(cn: int, newndims: int, newsz: any): Mat;
1468
+
1469
+ /**
1470
+ * This is an overloaded member function, provided for convenience. It differs from the above
1471
+ * function only in what argument(s) it accepts.
1472
+ */
1473
+ public reshape(cn: int, newshape: any): Mat;
1474
+
1475
+ /**
1476
+ * The methods change the number of matrix rows. If the matrix is reallocated, the first
1477
+ * min(Mat::rows, sz) rows are preserved. The methods emulate the corresponding methods of the STL
1478
+ * vector class.
1479
+ *
1480
+ * @param sz New number of rows.
1481
+ */
1482
+ public resize(sz: size_t): void;
1483
+
1484
+ /**
1485
+ * This is an overloaded member function, provided for convenience. It differs from the above
1486
+ * function only in what argument(s) it accepts.
1487
+ *
1488
+ * @param sz New number of rows.
1489
+ *
1490
+ * @param s Value assigned to the newly added elements.
1491
+ */
1492
+ public resize(sz: size_t, s: Scalar): Scalar;
1493
+
1494
+ /**
1495
+ * The method makes a new header for the specified matrix row and returns it. This is an O(1)
1496
+ * operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
1497
+ * original matrix. Here is the example of one of the classical basic matrix processing operations,
1498
+ * axpy, used by LU and many other algorithms:
1499
+ *
1500
+ * ```cpp
1501
+ * inline void matrix_axpy(Mat& A, int i, int j, double alpha)
1502
+ * {
1503
+ * A.row(i) += A.row(j)*alpha;
1504
+ * }
1505
+ * ```
1506
+ *
1507
+ * In the current implementation, the following code does not work as expected:
1508
+ *
1509
+ * ```cpp
1510
+ * Mat A;
1511
+ * ...
1512
+ * A.row(i) = A.row(j); // will not work
1513
+ * ```
1514
+ *
1515
+ * This happens because A.row(i) forms a temporary header that is further assigned to another
1516
+ * header. Remember that each of these operations is O(1), that is, no data is copied. Thus, the above
1517
+ * assignment is not true if you may have expected the j-th row to be copied to the i-th row. To
1518
+ * achieve that, you should either turn this simple assignment into an expression or use the
1519
+ * [Mat::copyTo] method:
1520
+ *
1521
+ * ```cpp
1522
+ * Mat A;
1523
+ * ...
1524
+ * // works, but looks a bit obscure.
1525
+ * A.row(i) = A.row(j) + 0;
1526
+ * // this is a bit longer, but the recommended method.
1527
+ * A.row(j).copyTo(A.row(i));
1528
+ * ```
1529
+ *
1530
+ * @param y A 0-based row index.
1531
+ */
1532
+ public row(y: int): Mat;
1533
+
1534
+ /**
1535
+ * The method makes a new header for the specified row span of the matrix. Similarly to [Mat::row]
1536
+ * and [Mat::col] , this is an O(1) operation.
1537
+ *
1538
+ * @param startrow An inclusive 0-based start index of the row span.
1539
+ *
1540
+ * @param endrow An exclusive 0-based ending index of the row span.
1541
+ */
1542
+ public rowRange(startrow: int, endrow: int): Mat;
1543
+
1544
+ /**
1545
+ * This is an overloaded member function, provided for convenience. It differs from the above
1546
+ * function only in what argument(s) it accepts.
1547
+ *
1548
+ * @param r Range structure containing both the start and the end indices.
1549
+ */
1550
+ public rowRange(r: Range): Mat;
1551
+
1552
+ /**
1553
+ * This is an advanced variant of the [Mat::operator=(const Scalar& s)] operator.
1554
+ *
1555
+ * @param value Assigned scalar converted to the actual array type.
1556
+ *
1557
+ * @param mask Operation mask of the same size as *this. Its non-zero elements indicate which matrix
1558
+ * elements need to be copied. The mask has to be of type CV_8U and can have 1 or multiple channels
1559
+ */
1560
+ public setTo(value: InputArray | Scalar, mask?: InputArray): Mat;
1561
+
1562
+ /**
1563
+ * The method returns a matrix step divided by [Mat::elemSize1()] . It can be useful to quickly
1564
+ * access an arbitrary matrix element.
1565
+ */
1566
+ public step1(i?: int): size_t;
1567
+
1568
+ /**
1569
+ * The method performs matrix transposition by means of matrix expressions. It does not perform the
1570
+ * actual transposition but returns a temporary matrix transposition object that can be further used as
1571
+ * a part of more complex matrix expressions or can be assigned to a matrix:
1572
+ *
1573
+ * ```cpp
1574
+ * Mat A1 = A + Mat::eye(A.size(), A.type())*lambda;
1575
+ * Mat C = A1.t()*A1; // compute (A + lambda*I)^t * (A + lamda*I)
1576
+ * ```
1577
+ */
1578
+ public t(): MatExpr;
1579
+
1580
+ /**
1581
+ * The method returns the number of array elements (a number of pixels if the array represents an
1582
+ * image).
1583
+ */
1584
+ public total(): size_t;
1585
+
1586
+ /**
1587
+ * The method returns the number of elements within a certain sub-array slice with startDim <= dim <
1588
+ * endDim
1589
+ */
1590
+ public total(startDim: int, endDim?: int): size_t;
1591
+
1592
+ /**
1593
+ * The method returns a matrix element type. This is an identifier compatible with the CvMat type
1594
+ * system, like CV_16SC3 or 16-bit signed 3-channel array, and so on.
1595
+ */
1596
+ public type(): int;
1597
+
1598
+ public updateContinuityFlag(): void;
1599
+
1600
+ public ucharPtr(i: any, j: any): any;
1601
+ public charPtr(i: any, j: any): any;
1602
+ public shortPtr(i: any, j: any): any;
1603
+ public ushortPtr(i: any, j: any): any;
1604
+ public intPtr(i: any, j: any): any;
1605
+ public floatPtr(i: any, j: any): any;
1606
+ public doublePtr(i: any, j: any): any;
1607
+ public intPtr(i: any, j: any): any;
1608
+
1609
+ public charAt(i0: number): number;
1610
+ public charAt(i0: number, i1: number): number;
1611
+ public charAt(i0: number, i1: number, i2: number): number;
1612
+
1613
+ public ucharAt(i0: number): number;
1614
+ public ucharAt(i0: number, i1: number): number;
1615
+ public ucharAt(i0: number, i1: number, i2: number): number;
1616
+
1617
+ public shortAt(i0: number): number;
1618
+ public shortAt(i0: number, i1: number): number;
1619
+ public shortAt(i0: number, i1: number, i2: number): number;
1620
+
1621
+ public ushortAt(i0: number): number;
1622
+ public ushortAt(i0: number, i1: number): number;
1623
+ public ushortAt(i0: number, i1: number, i2: number): number;
1624
+
1625
+ public intAt(i0: number): number;
1626
+ public intAt(i0: number, i1: number): number;
1627
+ public intAt(i0: number, i1: number, i2: number): number;
1628
+
1629
+ public floatAt(i0: number): number;
1630
+ public floatAt(i0: number, i1: number): number;
1631
+ public floatAt(i0: number, i1: number, i2: number): number;
1632
+
1633
+ public doubleAt(i0: number): number;
1634
+ public doubleAt(i0: number, i1: number): number;
1635
+ public doubleAt(i0: number, i1: number, i2: number): number;
1636
+
1637
+ public setTo(value: Mat | Scalar, mask?: Mat): Mat;
1638
+ /**
1639
+ * Sometimes, you will have to play with certain region of images.
1640
+ * For eye detection in images, first face detection is done all
1641
+ * over the image and when face is obtained, we select the face region alone and search for eyes inside it instead of searching whole image.
1642
+ * It improves accuracy (because eyes are always on faces) and performance (because we search for a small area).
1643
+ *
1644
+ * Heads up : in JS seems only one argument is expected.
1645
+ */
1646
+ public roi(expr: Rect | Mat): Mat;
1647
+
1648
+ /**
1649
+ * The method creates a square diagonal matrix from specified main diagonal.
1650
+ *
1651
+ * @param d One-dimensional matrix that represents the main diagonal.
1652
+ */
1653
+ public static diag(d: Mat): Mat;
1654
+
1655
+ /**
1656
+ * The method returns a Matlab-style identity matrix initializer, similarly to [Mat::zeros].
1657
+ * Similarly to [Mat::ones], you can use a scale operation to create a scaled identity matrix
1658
+ * efficiently:
1659
+ *
1660
+ * ```cpp
1661
+ * // make a 4x4 diagonal matrix with 0.1's on the diagonal.
1662
+ * Mat A = Mat::eye(4, 4, CV_32F)*0.1;
1663
+ * ```
1664
+ *
1665
+ * In case of multi-channels type, identity matrix will be initialized only for the first channel,
1666
+ * the others will be set to 0's
1667
+ *
1668
+ * @param rows Number of rows.
1669
+ *
1670
+ * @param cols Number of columns.
1671
+ *
1672
+ * @param type Created matrix type.
1673
+ */
1674
+ public static eye(rows: int, cols: int, type: int): MatExpr;
1675
+
1676
+ /**
1677
+ * This is an overloaded member function, provided for convenience. It differs from the above
1678
+ * function only in what argument(s) it accepts.
1679
+ *
1680
+ * @param size Alternative matrix size specification as Size(cols, rows) .
1681
+ *
1682
+ * @param type Created matrix type.
1683
+ */
1684
+ public static eye(size: Size, type: int): MatExpr;
1685
+
1686
+ public static getDefaultAllocator(): MatAllocator;
1687
+
1688
+ public static getStdAllocator(): MatAllocator;
1689
+
1690
+ /**
1691
+ * The method returns a Matlab-style 1's array initializer, similarly to [Mat::zeros]. Note that
1692
+ * using this method you can initialize an array with an arbitrary value, using the following Matlab
1693
+ * idiom:
1694
+ *
1695
+ * ```cpp
1696
+ * Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.
1697
+ * ```
1698
+ *
1699
+ * The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it
1700
+ * just remembers the scale factor (3 in this case) and use it when actually invoking the matrix
1701
+ * initializer.
1702
+ *
1703
+ * In case of multi-channels type, only the first channel will be initialized with 1's, the others
1704
+ * will be set to 0's.
1705
+ *
1706
+ * @param rows Number of rows.
1707
+ *
1708
+ * @param cols Number of columns.
1709
+ *
1710
+ * @param type Created matrix type.
1711
+ */
1712
+ public static ones(rows: int, cols: int, type: int): MatExpr;
1713
+
1714
+ /**
1715
+ * This is an overloaded member function, provided for convenience. It differs from the above
1716
+ * function only in what argument(s) it accepts.
1717
+ *
1718
+ * @param size Alternative to the matrix size specification Size(cols, rows) .
1719
+ *
1720
+ * @param type Created matrix type.
1721
+ */
1722
+ public static ones(size: Size, type: int): MatExpr;
1723
+
1724
+ /**
1725
+ * This is an overloaded member function, provided for convenience. It differs from the above
1726
+ * function only in what argument(s) it accepts.
1727
+ *
1728
+ * @param ndims Array dimensionality.
1729
+ *
1730
+ * @param sz Array of integers specifying the array shape.
1731
+ *
1732
+ * @param type Created matrix type.
1733
+ */
1734
+ public static ones(ndims: int, sz: any, type: int): MatExpr;
1735
+
1736
+ public static setDefaultAllocator(allocator: MatAllocator): MatAllocator;
1737
+
1738
+ /**
1739
+ * The method returns a Matlab-style zero array initializer. It can be used to quickly form a
1740
+ * constant array as a function parameter, part of a matrix expression, or as a matrix initializer:
1741
+ *
1742
+ * ```cpp
1743
+ * Mat A;
1744
+ * A = Mat::zeros(3, 3, CV_32F);
1745
+ * ```
1746
+ *
1747
+ * In the example above, a new matrix is allocated only if A is not a 3x3 floating-point matrix.
1748
+ * Otherwise, the existing matrix A is filled with zeros.
1749
+ *
1750
+ * @param rows Number of rows.
1751
+ *
1752
+ * @param cols Number of columns.
1753
+ *
1754
+ * @param type Created matrix type.
1755
+ */
1756
+ public static zeros(rows: int, cols: int, type: int): MatExpr;
1757
+
1758
+ /**
1759
+ * This is an overloaded member function, provided for convenience. It differs from the above
1760
+ * function only in what argument(s) it accepts.
1761
+ *
1762
+ * @param size Alternative to the matrix size specification Size(cols, rows) .
1763
+ *
1764
+ * @param type Created matrix type.
1765
+ */
1766
+ public static zeros(size: Size, type: int): MatExpr;
1767
+
1768
+ /**
1769
+ * This is an overloaded member function, provided for convenience. It differs from the above
1770
+ * function only in what argument(s) it accepts.
1771
+ *
1772
+ * @param ndims Array dimensionality.
1773
+ *
1774
+ * @param sz Array of integers specifying the array shape.
1775
+ *
1776
+ * @param type Created matrix type.
1777
+ */
1778
+ public static zeros(ndims: int, sz: any, type: int): MatExpr;
1779
+ }
1780
+
1781
+ export declare const MAGIC_VAL: any; // initializer: = 0x42FF0000
1782
+
1783
+ export declare const AUTO_STEP: any; // initializer: = 0
1784
+
1785
+ export declare const CONTINUOUS_FLAG: any; // initializer: = CV_MAT_CONT_FLAG
1786
+
1787
+ export declare const SUBMATRIX_FLAG: any; // initializer: = CV_SUBMAT_FLAG
1788
+
1789
+ export declare const MAGIC_MASK: any; // initializer: = 0xFFFF0000
1790
+
1791
+ export declare const TYPE_MASK: any; // initializer: = 0x00000FFF
1792
+
1793
+ export declare const DEPTH_MASK: any; // initializer: = 7