-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMat.rtf
590 lines (539 loc) · 24.3 KB
/
Mat.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww19620\viewh18640\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b\fs24 \cf0 Constructors
\b0 \
\
(1) Mat::Mat(); \
(2) Mat::Mat(int rows, int cols, int type); \
(3) Mat::Mat(Size size, int type); \
(4) Mat::Mat(int rows, int cols, int type, const Scalar& s); \
(5) Mat::Mat(Size size, int type, const Scalar& s); \
(6) Mat::Mat(const Mat& m); \
(7) Mat::Mat(int rows, int cols, int type, void* data, size_t step=AUTO STEP); \
(8) Mat::Mat(Size size, int type, void* data, size_t step=AUTO STEP); \
(9) Mat::Mat(const Mat& m, const Range& rowRange, const Range& colRange); \
(10) Mat::Mat(const Mat& m, const Rect& roi); \
(11) Mat::Mat(const CvMat* m, bool copyData=false); \
(12) Mat::Mat(const IplImage* img, bool copyData=false); \
(13) template<typename T, int n> explicit Mat::Mat(const Vec<T, n>& vec, bool copyData=true); \
(14) template<typename T, int m, int n> explicit Mat::Mat(const Matx<T, m, n>& vec, bool copyData=true); \
(15) template<typename T> explicit Mat::Mat(const vector<T>& vec, bool copyData=false); \
(16) Mat::Mat(const MatExpr& expr); \
(17) Mat::Mat(int ndims, const int* sizes, int type); \
(18) Mat::Mat(int ndims, const int* sizes, int type, const Scalar& s); \
(19) Mat::Mat(int ndims, const int* sizes, int type, void* data, const size t* steps=0); \
(20) Mat::Mat(const Mat& m, const Range* ranges);\
\
\i Parameters\
\i0 \
\b ndims
\b0 The array dimensionality\
\b rows
\b0 The number of rows in 2D array\
\b cols
\b0 The number of columns in 2D array\
\b size
\b0 The 2D array size: Size(cols, rows). Note that in the Size() constructor the number of rows and the number of columns go in the reverse order.\
\b type
\b0 The array type, use CV_8UC1, ..., CV 64FC4 to create 1-4 channel matrices, or CV 8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV MAX CN channels) matrices\
\b data
\b0 Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, i.e. no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically deallocated, user should take care of it.\
\b step
\b0 The data buddy. This optional parameter specifies the number of bytes that each matrix \
row occupies. The value should include the padding bytes in the end of each row, if any. \
If the parameter is missing (set to cv::AUTO STEP), no padding is assumed and the actual \
step is calculated as cols*elemSize(), see Mat::elemSize ().\
\b steps
\b0 The array of ndims-1 steps in the case of multi-dimensional array (the last step is always \
set to the element size). If not specified, the matrix is assumed to be continuous.\
\b m
\b0 The array that (in whole, a partly) is assigned to the constructed matrix. No data is copied by these constructors. Instead, the header pointing to m data, or its sub-array, is constructed and the associated with it reference counter, if any, is incremented. That is, when you modify the matrix formed using such a constructor, you will also modify the corresponding elements of m. If you want to have an independent copy of the sub-array, use Mat::clone().\
\b img
\b0 Pointer to the old-style IplImage image structure. By default, the data is shared between \
the original image and the new matrix, but when copyData is set, the full copy of the image data is created.\
\b vec
\b0 STL vector, which elements will form the matrix. The matrix will have a single column and the number of rows equal to the number of vector elements. Type of the matrix will match the type of vector elements. The constructor can handle arbitrary types, for which there is properly declared DataType , i.e. the vector elements must be primitive numbers or uni-type numerical tuples of numbers. Mixed-type structures are not supported, of course. Note that the corresponding constructor is explicit, \
meaning that STL vectors are not automatically converted to Mat instances, you should write Mat(vec) explicitly. Another obvious note: unless you copied the data into the matrix (copyData=true), no new elements should be added to the vector, because it can potentially yield vector data reallocation, and thus the matrix data pointer will become invalid.\
\b copyData
\b0 Specifies, whether the underlying data of the STL vector, or the old-style CvMat or IplImage should be copied to (true) or shared with (false) the newly constructed matrix. When the data is copied, the allocated buffer will be managed using Mat\'92s reference counting mechanism. While when the data is shared, the reference counter will be NULL, and you should not deallocate the data until the matrix is not destructed.\
\b rowRange
\b0 The range of the m\'92s rows to take. As usual, the range start is inclusive and the range end is exclusive. Use Range::all() to take all the rows.\
\b colRange
\b0 The range of the m\'92s columns to take. Use Range::all() to take all the columns. \
\b ranges
\b0 The array of selected ranges of m along each dimensionality . \
\b expr
\b0 Matrix expression. See Matrix Expressions .\
\
\
\
\
\
\b Mat& operator = (const Mat& m);\
Mat& operator = (const MatExpr& expr);\
Mat& operator = (const Scalar& s);
\b0 \
\
m The assigned, right-hand-side matrix. Matrix assignment is O(1) operation, \
that is, no data is copied. Instead, the data is shared and the reference counter, \
if any, is incremented. Before assigning new data, the old data is dereferenced via Mat::release .\
expr The assigned matrix expression object. As opposite to the first form of assignment operation, \
the second form can reuse already allocated matrix if it has the right size and type to fit the \
matrix expression result. It is automatically handled by the real function that the matrix \
expressions is expanded to. For example, C=A+B is expanded to cv::add(A, B, C), and cv::add \
will take care of automatic C reallocation.\
s The scalar, assigned to each matrix element. The matrix size or type is not changed.\
\
\
\
\
\b Mat operator()( Range rowRange, Range colRange ) const;\
Mat operator()( const Rect& roi ) const;
\b0 \
\
rowRange The start and the end row of the extracted submatrix. The upper boundary is not included. \
To select all the rows, use Range::all()\
colRange The start and the end column of the extracted submatrix. The upper boundary is not included. \
To select all the columns, use Range::all()\
roi The extracted submatrix specified as a rectangle \
ranges The array of selected ranges along each array dimension\
\
The operators make a new header for the specified sub-array of *this. They are the most generalized \
forms of cv::Mat::row, cv::Mat::col, cv::Mat::rowRange and cv::Mat::colRange. For example, \
\
A(Range(0, 10), Range::all()) \
\
is equivalent to \
\
A.rowRange(0, 10). \
\
Similarly to all of the above, the operators are O(1) operations, i.e. no matrix data is copied.\
\
\
\
\b Mat row(int y) const;\
Mat col(int x) const;
\b0 \
\
The method makes a new header for the specified matrix row or col and returns it. The underlying data\
of the new matrix will be shared with the original matrix.\
\
\
Mat rowRange(int start, int end) const;\
Mat rowRange(const Range& r) const;\
Mat colRange(int start, int end) const;\
Mat colRange(const Range& r) const;\
\
The method makes a new header for the specified column or row span of the matrix.\
\
start the 0-based start index of the row/column span \
end the 0-based ending index of the row/column span \
r The cv::Range structure containing both the start and the end indices\
\
\
\b Mat diag(int d=0) const;
\b0 \
\
Extracts diagonal from a matrix, or creates a diagonal matrix.\
The method makes a new header for the specified matrix diagonal. The new matrix will be represented as a \
single-column matrix. Similarly to cv::Mat::row and cv::Mat::col, this is O(1) operation.\
d index of the diagonal, with the following meaning: \
d=0 the main diagonal\
d>0 a diagonal from the lower half, e.g. d=1 means the diagonal immediately below the main one\
d<0 a diagonal from the upper half, e.g. d=1 means the diagonal immediately above the main one\
matD single-column matrix that will form the diagonal matrix.\
\
\
\b Mat clone() const;
\b0 \
\
returns deep copy of the matrix, i.e. the data is copied\
The method creates full copy of the array. The original step[] are not taken into the account. \
That is, the array copy will be a continuous array occupying total()*elemSize() bytes.\
\
\
\
\b void pl( Mat& m ) const;\
void copyTo( Mat& m, const Mat& mask ) const;
\b0 \
\
The method copies the matrix data to another matrix. Before copying the data, the method invokes \
m.create(this->size(), this->type); so that the destination matrix is reallocated if needed. \
While m.copyTo(m); will work as expected, i.e. will have no effect, the function does not handle \
the case of a partial overlap between the source and the destination matrices.\
When the operation mask is specified, and the Mat::create call shown above reallocated the matrix, \
the newly allocated matrix is initialized with all 0\'92s before copying the data.\
\
m The destination matrix. If it does not have a proper size or type before the operation, it will be\
reallocated\
mask The operation mask. Its non-zero elements indicate, which matrix elements need to be copied\
\
\
\
\b void convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const;
\b0 \
\
The method converts source pixel values to the target datatype. saturate cast<> is applied in the end \
to avoid possible overflows:\
\
m The destination matrix. If it does not have a proper size or type before the operation, \
it will be reallocated\
rtype The desired destination matrix type, or rather, the depth (since the number of channels \
will be the same with the source one). If rtype is negative, the destination matrix will \
have the same type as the source.\
\
alpha The optional scale factor beta The optional delta, added to the scaled values.\
\
\
\
\
\b Mat& setTo(const Scalar& s, const Mat& mask=Mat());
\b0 \
\
This is the advanced variant of Mat::operator=(const Scalar& s) operator.\
\
s Assigned scalar, which is converted to the actual array type \
mask The operation mask of the same size as *this\
\
\
\
\
\b Mat reshape(int _cn, int _rows=0) const;
\b0 \
\
Changes the 2D matrix\'92s shape and/or the number of channels without copying the data.\
\
cn The new number of channels. If the parameter is 0, the number of channels remains the same. \
rows The new number of rows. If the parameter is 0, the number of rows remains the same.\
\
The method makes a new matrix header for *this elements. The new matrix may have\
different size and/or different number of channels. Any combination is possible, as long as: \
\
1. No extra elements is included into the new matrix and no elements are excluded. Conse-\
quently, the product rows*cols*channels() must stay the same after the transformation.\
\
2. No data is copied, i.e. this is O(1) operation. Consequently, if you change the number of rows, \
or the operation changes elements\'92 row indices in some other way, the matrix must be continuous. \
See cv::Mat::isContinuous.\
\
\
\
\b MatExpr inv(int method=DECOMP_LU) const;
\b0 \
\
The method performs matrix inversion by means of matrix expressions, i.e. a temporary \'94matrix inversion\'94 \
object is returned by the method, and can further be used as a part of more complex matrix expression or \
be assigned to a matrix.\
\
method The matrix inversion method, one of \
DECOMP_LU LU decomposition. The matrix must be non-singular\
DECOMP_CHOLESKY Cholesky LLT decomposition, for symmetrical positively defined matri- ces only. \
About twice faster than LU on big matrices.\
DECOMP_SVD SVD decomposition. The matrix can be a singular or even non-square, \
then the pseudo-inverse is computed\
\
\
\
\
\b MatExpr mul(const Mat& m, double scale=1) const;\
MatExpr mul(const MatExpr& m, double scale=1) const;
\b0 \
\
The method returns a temporary object encoding per-element array multiplication, with optional scale. \
Note that this is not a matrix multiplication, which corresponds to a simpler \'94*\'94 operator.\
\
m Another matrix, of the same type and the same size as *this, or a matrix expression \
scale The optional scale factor\
\
Mat C = A.mul(5/B); equivalent to divide(A, B, C, 5)\
\
\
\b Mat cross(const Mat& m) const;
\b0 \
\
m Another cross-product operand\
\
The method computes cross-product of the two 3-element vectors. The vectors must be 3-elements \
floating-point vectors of the same shape and the same size. The result will be another 3-element \
vector of the same shape and the same type as operands.\
\
\
\
\b double dot(const Mat& m) const;
\b0 \
\
m Another dot-product operand.\
\
The method computes dot-product of the two matrices. If the matrices are not single-column \
or single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them \
as 1D vectors. The vectors must have the same size and the same type. If the matrices have \
more than one channel, the dot products from all the channels are summed together.\
\
\
\
\
\b static MatExpr zeros(int rows, int cols, int type);\
static MatExpr zeros(Size size, int type);\
static MatExpr ones(int rows, int cols, int type);\
static MatExpr ones(Size size, int type);\
static MatExpr eye(int rows, int cols, int type);\
static MatExpr eye(Size size, int type);
\b0 \
\
ndims The array dimensionality \
rows The number of rows \
cols The number of columns \
size Alternative matrix size specification: Size(cols, rows) \
type The created matrix type\
\
The method returns Matlab-style zero array initializer. It can be used to quickly form a constant\
array and use it as a function parameter, as a part of matrix expression, or as a matrix initializer.\
\
Mat A;\
A = Mat::zeros(3, 3, CV_32F);\
\
Note that in the above sample a new matrix will be allocated only if A is not 3x3 floating-point matrix, \
otherwise the existing matrix A will be filled with 0\'92s.\
\
\
\
\
\b void create(int _rows, int _cols, int _type);\
void create(Size _size, int _type);
\b0 \
\
rows The new number of rows \
cols The new number of columns \
size Alternative new matrix size specification: Size(cols, rows) \
type The new matrix type \
CV_8UC1 8-bit single-channel array <---- for a grayscale image, usually this\
CV_8UC3 8-bit 3-channel array <---- for an RGB image, it will usually be this\
CV_8UC4 8-bit 4-channel array <---- for RGBA image\
CV_32FC2 2-channel floating- point array)\
\
allocates new matrix data unless the matrix already has specified size and type. \
previous data is unreferenced if needed.\
\
This is one of the key Mat methods. Most new-style OpenCV functions and methods that \
produce arrays call this method for each output array. The method uses the following algorithm:\
\
1. if the current array shape and the type match the new ones, return immediately. \
2. otherwise, dereference the previous data by calling cv::Mat::release \
3. initialize the new header \
4. allocate the new data of total()*elemSize() bytes\
5. allocate the new, associated with the data, reference counter and set it to 1.\
\
Such a scheme makes the memory management robust and efficient at the same time, and also \
saves quite a bit of typing for the user, i.e. usually there is no need to explicitly \
allocate output arrays. That is, instead of writing:\
\
Mat color;\
Mat gray(color.rows, color.cols, color.depth());\
cvtColor(color, gray, CV_BGR2GRAY);\
\
you can simply write:\
\
Mat color;\
Mat gray;\
cvtColor(color, gray, CV_BGR2GRAY);\
\
because cvtColor, as well as most of OpenCV functions, calls Mat::create() for the output array internally.\
\
\
\
\
\b void addref();\
\b0 \
The method increments the reference counter, associated with the matrix data. \
If the matrix header points to an external data (see cv::Mat::Mat), the reference counter is \
NULL, and the method has no effect in this case. Normally, the method should not be called \
explicitly, to avoid memory leaks. It is called implicitly by the matrix assignment operator. \
The reference counter increment is the atomic operation on the platforms that support it, \
thus it is safe to operate on the same matrices asynchronously in different threads.\
\
\
\b void release();
\b0 \
\
decreases reference counter;\
deallocate the data when reference counter reaches 0.\
\
The method decrements the reference counter, associated with the matrix data. When the \
reference counter reaches 0, the matrix data is deallocated and the data and the reference \
counter pointers are set to NULL\'92s. If the matrix header points to an external data (see cv::Mat::Mat), \
the reference counter is NULL, and the method has no effect in this case.\
This method can be called manually to force the matrix data deallocation. But since this method is \
automatically called in the destructor, or by any other method that changes the data pointer, it is \
usually not needed. The reference counter decrement and check for 0 is the atomic operation on the \
platforms that support it, thus it is safe to operate on the same matrices asynchronously in different threads.\
\
\
\b Mat& adjustROI( int dtop, int dbottom, int dleft, int dright );\
\b0 \
Adjust submatrix size and position within the parent matrix\
\
dtop The shift of the top submatrix boundary upwards \
dbottom The shift of the bottom submatrix boundary downwards \
dleft The shift of the left submatrix boundary to the left \
dright The shift of the right submatrix boundary to the right\
\
The method is complimentary to the cv::Mat::locateROI. Indeed, the typical use of these \
func- tions is to determine the submatrix position within the parent matrix and then shift \
the position somehow. Typically it can be needed for filtering operations, when pixels outside \
of the ROI should be taken into account. When all the method\'92s parameters are positive, it means \
that the ROI needs to grow in all directions by the specified amount, i.e.\
\
A.adjustROI(2, 2, 2, 2);\
\
increases the matrix size by 4 elements in each direction and shifts it by 2 elements to the left \
and 2 elements up, which brings in all the necessary pixels for the filtering with 5x5 kernel.\
\
It\'92s user responsibility to make sure that adjustROI does not cross the parent matrix boundary. \
If it does, the function will signal an error.\
\
The function is used internally by the OpenCV filtering functions, like cv::filter2D, morphologi- cal operations etc.\
\
\
\
\
\b void locateROI( Size& wholeSize, Point& ofs ) const;
\b0 \
\
Locates matrix header within a parent matrix\
\
wholeSize The output parameter that will contain size of the whole matrix, which *this is a part of. \
ofs The output parameter that will contain offset of *this inside the whole matrix\
\
After you extracted a submatrix from a matrix using cv::Mat::row, cv::Mat::col, cv::Mat::rowRange, \
cv::Mat::colRange etc., the result submatrix will point just to the part of the original big matrix. \
However, each submatrix contains some information (represented by datastart and dataend fields), \
using which it is possible to reconstruct the original matrix size and the position of the extracted \
submatrix within the original matrix. The method locateROI does exactly that.\
\
\
operator CvMat() const; ! converts header to CvMat; no data is copied\
operator IplImage() const; ! converts header to IplImage; no data is copied\
\
These operators makes CvMat of IplImage header for the matrix without copying the underlying data. \
The reference counter is not taken into account by this operation, thus you should make sure than \
the original matrix is not deallocated while the CvMat header is used. \
\
The operator is useful for intermixing the new and the old OpenCV API\'92s, e.g:\
\
Mat img(Size(320, 240), CV_8UC3);\
CvMat cvimg = img;\
mycvOldFunc( &cvimg, ...);\
\
where mycvOldFunc is some function written to work with OpenCV 1.x data structures.\
\
\
\
\b bool isContinuous() const;
\b0 \
\
similar to CV_IS_MAT_CONT(cvmat->type)\
\
The method returns true if the matrix elements are stored continuously, i.e. without gaps \
in the end of each row, and false otherwise. Obviously, 1x1 or 1xN matrices are always continuous. \
Matrices created with cv::Mat::create are always continuous, but if you extract a part of the \
matrix using cv::Mat::col, cv::Mat::diag etc. or constructed a matrix header for externally allocated data, \
such matrices may no longer have this property.\
\
The continuity flag is stored as a bit in Mat::flags field, and is computed automatically when you \
construct a matrix header, thus the continuity check is very fast operation, though it could be, \
in theory, done as following:\
\
bool myCheckMatContinuity(const Mat& m)\
\{\
return (m.flags & Mat::CONTINUOUS_FLAG) != 0;\
return m.rows == 1 || m.step == m.cols*m.elemSize();\
\}\
\
The method is used in a quite a few of OpenCV functions, and you are welcome to use it as well. \
The point is that element-wise operations (such as arithmetic and logical operations, math functions, \
alpha blending, color space transformations etc.) do not depend on the image geometry, and thus, \
if all the input and all the output arrays are continuous, the functions can process them as very \
long single-row vectors.\
\
\
\
\
\
\b size_t elemSize() const;
\b0 \
\
similar to CV_ELEM_SIZE(cvmat->type)\
\
The method returns the matrix element size in bytes. \
For example, if the matrix type is CV_16SC3, the method will return 3*sizeof(short) or 6.\
\
\
\
\
\b size_t elemSize1() const;
\b0 \
\
The method returns the matrix element channel size in bytes, that is, it ignores the \
number of channels. For example, if the matrix type is CV_16SC3, the method will return sizeof(short) or 2.\
\
\
\
\b int type() const;
\b0 \
\
similar to CV_MAT_TYPE(cvmat->type)\
\
The method returns the matrix element type, an id, compatible with the CvMat type system, \
like CV_16SC3 or 16-bit signed 3-channel array etc.\
\
NOTE: type() represents the type of one full element (ie, a single "pixel"), where \
depth represents the depth of a single chanel (ie: the precision of the "red" channel)\
\
\
\
\b int depth() const;
\b0 \
\
similar to CV_MAT_DEPTH(cvmat->type)\
The method returns the matrix element depth id, i.e. the type of each individual channel. \
For example, for 16-bit signed 3-channel array the method will return CV_16S. \
\
The complete list of matrix types:\
\'95 CV_8U - 8-bit unsigned integers (0..255) \
\'95 CV_8S - 8-bit signed integers (-128..127) \
\'95 CV_16U - 16-bit unsigned integers (0..65535) \
\'95 CV_16S - 16-bit signed integers (-32768..32767) \
\'95 CV_32S - 32-bit signed integers (-2147483648..2147483647)\
\'95 CV_32F - 32-bit floating-point numbers (-FLT MAX..FLT MAX, INF, NAN)\
\'95 CV_64F - 64-bit floating-point numbers (-DBL MAX..DBL MAX, INF, NAN)\
\
\
\
\
\b size t Mat::total() const;
\b0 The method returns the number of array elements (e.g. number of pixels if the array represents an image).\
\b int channels() const;
\b0 returns element number of channels. (ie: Grayscale=1, RGB=3, RGBA=4)\
\b size_t step1() const;
\b0 returns step/elemSize1(), ie: normalized step\
\b Size size() const;
\b0 The method returns the matrix size: Size(cols, rows).\
\b bool empty() const;
\b0 returns true if matrix data is NULL\
\b uchar* ptr(int y=0);
\b0 The methods return uchar* or typed pointer to the specified matrix row. \
\
\
\
int flags; includes several bit-fields: the magic signature, continuity flag, depth, number of channels\
int rows, cols;\
size_t step; a distance between successive rows in bytes; includes the gap if any\
uchar* data; ! pointer to the data\
int* refcount; ! pointer to the reference counter. when matrix points to user-allocated data, the pointer is NULL\
! helper fields used in locateROI and adjustROI\
uchar* datastart;\
uchar* dataend;\
}