EstervQrCode 2.0.0
Library for qr code manipulation
Loading...
Searching...
No Matches
mat.hpp
1/*M///////////////////////////////////////////////////////////////////////////////////////
2//
3// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4//
5// By downloading, copying, installing or using the software you agree to this license.
6// If you do not agree to this license, do not download, install,
7// copy or use the software.
8//
9//
10// License Agreement
11// For Open Source Computer Vision Library
12//
13// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
16// Third party copyrights are property of their respective owners.
17//
18// Redistribution and use in source and binary forms, with or without modification,
19// are permitted provided that the following conditions are met:
20//
21// * Redistribution's of source code must retain the above copyright notice,
22// this list of conditions and the following disclaimer.
23//
24// * Redistribution's in binary form must reproduce the above copyright notice,
25// this list of conditions and the following disclaimer in the documentation
26// and/or other materials provided with the distribution.
27//
28// * The name of the copyright holders may not be used to endorse or promote products
29// derived from this software without specific prior written permission.
30//
31// This software is provided by the copyright holders and contributors "as is" and
32// any express or implied warranties, including, but not limited to, the implied
33// warranties of merchantability and fitness for a particular purpose are disclaimed.
34// In no event shall the Intel Corporation or contributors be liable for any direct,
35// indirect, incidental, special, exemplary, or consequential damages
36// (including, but not limited to, procurement of substitute goods or services;
37// loss of use, data, or profits; or business interruption) however caused
38// and on any theory of liability, whether in contract, strict liability,
39// or tort (including negligence or otherwise) arising in any way out of
40// the use of this software, even if advised of the possibility of such damage.
41//
42//M*/
43
44#ifndef OPENCV_CORE_MAT_HPP
45#define OPENCV_CORE_MAT_HPP
46
47#ifndef __cplusplus
48# error mat.hpp header must be compiled as C++
49#endif
50
51#include "opencv2/core/matx.hpp"
52#include "opencv2/core/types.hpp"
53
54#include "opencv2/core/bufferpool.hpp"
55
56#include <array>
57#include <type_traits>
58
59namespace cv
60{
61
64
69
71
73
75
160{
161public:
162 enum KindFlag {
163 KIND_SHIFT = 16,
164 FIXED_TYPE = 0x8000 << KIND_SHIFT,
165 FIXED_SIZE = 0x4000 << KIND_SHIFT,
166 KIND_MASK = 31 << KIND_SHIFT,
167
168 NONE = 0 << KIND_SHIFT,
169 MAT = 1 << KIND_SHIFT,
170 MATX = 2 << KIND_SHIFT,
171 STD_VECTOR = 3 << KIND_SHIFT,
172 STD_VECTOR_VECTOR = 4 << KIND_SHIFT,
173 STD_VECTOR_MAT = 5 << KIND_SHIFT,
174#if OPENCV_ABI_COMPATIBILITY < 500
175 EXPR = 6 << KIND_SHIFT,
176#endif
177 OPENGL_BUFFER = 7 << KIND_SHIFT,
178 CUDA_HOST_MEM = 8 << KIND_SHIFT,
179 CUDA_GPU_MAT = 9 << KIND_SHIFT,
180 UMAT =10 << KIND_SHIFT,
181 STD_VECTOR_UMAT =11 << KIND_SHIFT,
182 STD_BOOL_VECTOR =12 << KIND_SHIFT,
183 STD_VECTOR_CUDA_GPU_MAT = 13 << KIND_SHIFT,
184#if OPENCV_ABI_COMPATIBILITY < 500
185 STD_ARRAY =14 << KIND_SHIFT,
186#endif
187 STD_ARRAY_MAT =15 << KIND_SHIFT
188 };
189
191 _InputArray(int _flags, void* _obj);
192 _InputArray(const Mat& m);
193 _InputArray(const MatExpr& expr);
195 template<typename _Tp> _InputArray(const Mat_<_Tp>& m);
196 template<typename _Tp> _InputArray(const std::vector<_Tp>& vec);
198 template<typename _Tp> _InputArray(const std::vector<std::vector<_Tp> >& vec);
199 _InputArray(const std::vector<std::vector<bool> >&) = delete; // not supported
200 template<typename _Tp> _InputArray(const std::vector<Mat_<_Tp> >& vec);
201 template<typename _Tp> _InputArray(const _Tp* vec, int n);
202 template<typename _Tp, int m, int n> _InputArray(const Matx<_Tp, m, n>& matx);
203 _InputArray(const double& val);
207 _InputArray(const cuda::HostMem& cuda_mem);
208 template<typename _Tp> _InputArray(const cudev::GpuMat_<_Tp>& m);
209 _InputArray(const UMat& um);
211
212 template<typename _Tp, std::size_t _Nm> _InputArray(const std::array<_Tp, _Nm>& arr);
213 template<std::size_t _Nm> _InputArray(const std::array<Mat, _Nm>& arr);
214
215 template<typename _Tp> static _InputArray rawIn(const std::vector<_Tp>& vec);
216 template<typename _Tp, std::size_t _Nm> static _InputArray rawIn(const std::array<_Tp, _Nm>& arr);
217
218 Mat getMat(int idx=-1) const;
219 Mat getMat_(int idx=-1) const;
220 UMat getUMat(int idx=-1) const;
226
227 int getFlags() const;
228 void* getObj() const;
229 Size getSz() const;
230
232 int dims(int i=-1) const;
233 int cols(int i=-1) const;
234 int rows(int i=-1) const;
235 Size size(int i=-1) const;
236 int sizend(int* sz, int i=-1) const;
237 bool sameSize(const _InputArray& arr) const;
238 size_t total(int i=-1) const;
239 int type(int i=-1) const;
240 int depth(int i=-1) const;
241 int channels(int i=-1) const;
242 bool isContinuous(int i=-1) const;
243 bool isSubmatrix(int i=-1) const;
244 bool empty() const;
245 void copyTo(const _OutputArray& arr) const;
246 void copyTo(const _OutputArray& arr, const _InputArray & mask) const;
247 size_t offset(int i=-1) const;
248 size_t step(int i=-1) const;
249 bool isMat() const;
250 bool isUMat() const;
251 bool isMatVector() const;
252 bool isUMatVector() const;
253 bool isMatx() const;
254 bool isVector() const;
255 bool isGpuMat() const;
256 bool isGpuMatVector() const;
258
259protected:
260 int flags;
261 void* obj;
263
264 void init(int _flags, const void* _obj);
265 void init(int _flags, const void* _obj, Size _sz);
266};
269
270
296{
297public:
299 {
300 DEPTH_MASK_8U = 1 << CV_8U,
301 DEPTH_MASK_8S = 1 << CV_8S,
302 DEPTH_MASK_16U = 1 << CV_16U,
303 DEPTH_MASK_16S = 1 << CV_16S,
304 DEPTH_MASK_32S = 1 << CV_32S,
305 DEPTH_MASK_32F = 1 << CV_32F,
306 DEPTH_MASK_64F = 1 << CV_64F,
307 DEPTH_MASK_16F = 1 << CV_16F,
308 DEPTH_MASK_ALL = (DEPTH_MASK_64F<<1)-1,
309 DEPTH_MASK_ALL_BUT_8S = DEPTH_MASK_ALL & ~DEPTH_MASK_8S,
310 DEPTH_MASK_ALL_16F = (DEPTH_MASK_16F<<1)-1,
311 DEPTH_MASK_FLT = DEPTH_MASK_32F + DEPTH_MASK_64F
312 };
313
315 _OutputArray(int _flags, void* _obj);
322 template<typename _Tp> _OutputArray(cudev::GpuMat_<_Tp>& m);
323 template<typename _Tp> _OutputArray(std::vector<_Tp>& vec);
324 _OutputArray(std::vector<bool>& vec) = delete; // not supported
325 template<typename _Tp> _OutputArray(std::vector<std::vector<_Tp> >& vec);
326 _OutputArray(std::vector<std::vector<bool> >&) = delete; // not supported
327 template<typename _Tp> _OutputArray(std::vector<Mat_<_Tp> >& vec);
328 template<typename _Tp> _OutputArray(Mat_<_Tp>& m);
329 template<typename _Tp> _OutputArray(_Tp* vec, int n);
330 template<typename _Tp, int m, int n> _OutputArray(Matx<_Tp, m, n>& matx);
333
334 _OutputArray(const Mat& m);
339 _OutputArray(const cuda::HostMem& cuda_mem);
340 template<typename _Tp> _OutputArray(const cudev::GpuMat_<_Tp>& m);
341 template<typename _Tp> _OutputArray(const std::vector<_Tp>& vec);
342 template<typename _Tp> _OutputArray(const std::vector<std::vector<_Tp> >& vec);
343 template<typename _Tp> _OutputArray(const std::vector<Mat_<_Tp> >& vec);
344 template<typename _Tp> _OutputArray(const Mat_<_Tp>& m);
345 template<typename _Tp> _OutputArray(const _Tp* vec, int n);
346 template<typename _Tp, int m, int n> _OutputArray(const Matx<_Tp, m, n>& matx);
349
350 template<typename _Tp, std::size_t _Nm> _OutputArray(std::array<_Tp, _Nm>& arr);
351 template<typename _Tp, std::size_t _Nm> _OutputArray(const std::array<_Tp, _Nm>& arr);
352 template<std::size_t _Nm> _OutputArray(std::array<Mat, _Nm>& arr);
353 template<std::size_t _Nm> _OutputArray(const std::array<Mat, _Nm>& arr);
354
355 template<typename _Tp> static _OutputArray rawOut(std::vector<_Tp>& vec);
356 template<typename _Tp, std::size_t _Nm> static _OutputArray rawOut(std::array<_Tp, _Nm>& arr);
357
358 bool fixedSize() const;
359 bool fixedType() const;
360 bool needed() const;
361 Mat& getMatRef(int i=-1) const;
362 UMat& getUMatRef(int i=-1) const;
367 void create(Size sz, int type, int i=-1, bool allowTransposed=false, _OutputArray::DepthMask fixedDepthMask=static_cast<_OutputArray::DepthMask>(0)) const;
368 void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, _OutputArray::DepthMask fixedDepthMask=static_cast<_OutputArray::DepthMask>(0)) const;
369 void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, _OutputArray::DepthMask fixedDepthMask=static_cast<_OutputArray::DepthMask>(0)) const;
370 void createSameSize(const _InputArray& arr, int mtype) const;
371 void release() const;
372 void clear() const;
373 void setTo(const _InputArray& value, const _InputArray & mask = _InputArray()) const;
374
375 void assign(const UMat& u) const;
376 void assign(const Mat& m) const;
377
378 void assign(const std::vector<UMat>& v) const;
379 void assign(const std::vector<Mat>& v) const;
380
381 void move(UMat& u) const;
382 void move(Mat& m) const;
383};
384
385
387{
388public:
390 _InputOutputArray(int _flags, void* _obj);
396 template<typename _Tp> _InputOutputArray(cudev::GpuMat_<_Tp>& m);
397 template<typename _Tp> _InputOutputArray(std::vector<_Tp>& vec);
398 _InputOutputArray(std::vector<bool>& vec) = delete; // not supported
399 template<typename _Tp> _InputOutputArray(std::vector<std::vector<_Tp> >& vec);
400 template<typename _Tp> _InputOutputArray(std::vector<Mat_<_Tp> >& vec);
401 template<typename _Tp> _InputOutputArray(Mat_<_Tp>& m);
402 template<typename _Tp> _InputOutputArray(_Tp* vec, int n);
403 template<typename _Tp, int m, int n> _InputOutputArray(Matx<_Tp, m, n>& matx);
406
413 template<typename _Tp> _InputOutputArray(const cudev::GpuMat_<_Tp>& m);
414 template<typename _Tp> _InputOutputArray(const std::vector<_Tp>& vec);
415 template<typename _Tp> _InputOutputArray(const std::vector<std::vector<_Tp> >& vec);
416 template<typename _Tp> _InputOutputArray(const std::vector<Mat_<_Tp> >& vec);
417 template<typename _Tp> _InputOutputArray(const Mat_<_Tp>& m);
418 template<typename _Tp> _InputOutputArray(const _Tp* vec, int n);
419 template<typename _Tp, int m, int n> _InputOutputArray(const Matx<_Tp, m, n>& matx);
422
423 template<typename _Tp, std::size_t _Nm> _InputOutputArray(std::array<_Tp, _Nm>& arr);
424 template<typename _Tp, std::size_t _Nm> _InputOutputArray(const std::array<_Tp, _Nm>& arr);
425 template<std::size_t _Nm> _InputOutputArray(std::array<Mat, _Nm>& arr);
426 template<std::size_t _Nm> _InputOutputArray(const std::array<Mat, _Nm>& arr);
427
428 template<typename _Tp> static _InputOutputArray rawInOut(std::vector<_Tp>& vec);
429 template<typename _Tp, std::size_t _Nm> _InputOutputArray rawInOut(std::array<_Tp, _Nm>& arr);
430
431};
432
434template<typename _Tp> static inline _InputArray rawIn(_Tp& v);
436template<typename _Tp> static inline _OutputArray rawOut(_Tp& v);
438template<typename _Tp> static inline _InputOutputArray rawInOut(_Tp& v);
439
441
442typedef const _InputArray& InputArray;
448
450
452
464{
466
467 // buffer allocation policy is platform and usage specific
470 USAGE_ALLOCATE_SHARED_MEMORY = 1 << 2, // It is not equal to: USAGE_ALLOCATE_HOST_MEMORY | USAGE_ALLOCATE_DEVICE_MEMORY
471
472 __UMAT_USAGE_FLAGS_32BIT = 0x7fffffff // Binary compatibility hint
474
476
480{
481public:
483 virtual ~MatAllocator() {}
484
485 // let's comment it off for now to detect and fix all the uses of allocator
486 //virtual void allocate(int dims, const int* sizes, int type, int*& refcount,
487 // uchar*& datastart, uchar*& data, size_t* step) = 0;
488 //virtual void deallocate(int* refcount, uchar* datastart, uchar* data) = 0;
489 virtual UMatData* allocate(int dims, const int* sizes, int type,
490 void* data, size_t* step, AccessFlag flags, UMatUsageFlags usageFlags) const = 0;
491 virtual bool allocate(UMatData* data, AccessFlag accessflags, UMatUsageFlags usageFlags) const = 0;
492 virtual void deallocate(UMatData* data) const = 0;
493 virtual void map(UMatData* data, AccessFlag accessflags) const;
494 virtual void unmap(UMatData* data) const;
495 virtual void download(UMatData* data, void* dst, int dims, const size_t sz[],
496 const size_t srcofs[], const size_t srcstep[],
497 const size_t dststep[]) const;
498 virtual void upload(UMatData* data, const void* src, int dims, const size_t sz[],
499 const size_t dstofs[], const size_t dststep[],
500 const size_t srcstep[]) const;
501 virtual void copy(UMatData* srcdata, UMatData* dstdata, int dims, const size_t sz[],
502 const size_t srcofs[], const size_t srcstep[],
503 const size_t dstofs[], const size_t dststep[], bool sync) const;
504
505 // default implementation returns DummyBufferPoolController
506 virtual BufferPoolController* getBufferPoolController(const char* id = NULL) const;
507};
508
509
511
524template<typename _Tp> class MatCommaInitializer_
525{
526public:
530 template<typename T2> MatCommaInitializer_<_Tp>& operator , (T2 v);
532 operator Mat_<_Tp>() const;
533protected:
535};
536
537
539
540// note that umatdata might be allocated together
541// with the matrix data, not as a separate object.
542// therefore, it does not have constructor or destructor;
543// it should be explicitly initialized using init().
545{
546 enum MemoryFlag { COPY_ON_MAP=1, HOST_COPY_OBSOLETE=2,
547 DEVICE_COPY_OBSOLETE=4, TEMP_UMAT=8, TEMP_COPIED_UMAT=24,
548 USER_ALLOCATED=32, DEVICE_MEM_MAPPED=64,
549 ASYNC_CLEANUP=128
550 };
551 UMatData(const MatAllocator* allocator);
553
554 // provide atomic access to the structure
555 void lock();
556 void unlock();
557
558 bool hostCopyObsolete() const;
559 bool deviceCopyObsolete() const;
560 bool deviceMemMapped() const;
561 bool copyOnMap() const;
562 bool tempUMat() const;
563 bool tempCopiedUMat() const;
564 void markHostCopyObsolete(bool flag);
565 void markDeviceCopyObsolete(bool flag);
566 void markDeviceMemMapped(bool flag);
567
574 size_t size;
575
577 void* handle;
578 void* userdata;
583};
585
586
588{
589 explicit MatSize(int* _p) CV_NOEXCEPT;
590 int dims() const CV_NOEXCEPT;
591 Size operator()() const;
592 const int& operator[](int i) const;
593 int& operator[](int i);
594 operator const int*() const CV_NOEXCEPT; // TODO OpenCV 4.0: drop this
595 bool operator == (const MatSize& sz) const CV_NOEXCEPT;
596 bool operator != (const MatSize& sz) const CV_NOEXCEPT;
597
598 int* p;
599};
600
602{
604 explicit MatStep(size_t s) CV_NOEXCEPT;
605 const size_t& operator[](int i) const CV_NOEXCEPT;
606 size_t& operator[](int i) CV_NOEXCEPT;
607 operator size_t() const;
608 MatStep& operator = (size_t s);
609
610 size_t* p;
611 size_t buf[2];
612protected:
613 MatStep& operator = (const MatStep&);
614};
615
812{
813public:
821
828 Mat(int rows, int cols, int type);
829
837
847 Mat(int rows, int cols, int type, const Scalar& s);
848
858 Mat(Size size, int type, const Scalar& s);
859
866 Mat(int ndims, const int* sizes, int type);
867
873 Mat(const std::vector<int>& sizes, int type);
874
884 Mat(int ndims, const int* sizes, int type, const Scalar& s);
885
894 Mat(const std::vector<int>& sizes, int type, const Scalar& s);
895
896
904 Mat(const Mat& m);
905
920 Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);
921
936 Mat(Size size, int type, void* data, size_t step=AUTO_STEP);
937
951 Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);
952
965 Mat(const std::vector<int>& sizes, int type, void* data, const size_t* steps=0);
966
977 Mat(const Mat& m, const Range& rowRange, const Range& colRange=Range::all());
978
987 Mat(const Mat& m, const Rect& roi);
988
997 Mat(const Mat& m, const Range* ranges);
998
1007 Mat(const Mat& m, const std::vector<Range>& ranges);
1008
1025 template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);
1026
1029 template<typename _Tp, typename = typename std::enable_if<std::is_arithmetic<_Tp>::value>::type>
1030 explicit Mat(const std::initializer_list<_Tp> list);
1031
1034 template<typename _Tp> explicit Mat(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> list);
1035
1038 template<typename _Tp, size_t _Nm> explicit Mat(const std::array<_Tp, _Nm>& arr, bool copyData=false);
1039
1042 template<typename _Tp, int n> explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true);
1043
1046 template<typename _Tp, int m, int n> explicit Mat(const Matx<_Tp, m, n>& mtx, bool copyData=true);
1047
1050 template<typename _Tp> explicit Mat(const Point_<_Tp>& pt, bool copyData=true);
1051
1054 template<typename _Tp> explicit Mat(const Point3_<_Tp>& pt, bool copyData=true);
1055
1058 template<typename _Tp> explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer);
1059
1061 explicit Mat(const cuda::GpuMat& m);
1062
1065
1074 Mat& operator = (const Mat& m);
1075
1083 Mat& operator = (const MatExpr& expr);
1084
1086 UMat getUMat(AccessFlag accessFlags, UMatUsageFlags usageFlags = USAGE_DEFAULT) const;
1087
1121 Mat row(int y) const;
1122
1130 Mat col(int x) const;
1131
1139 Mat rowRange(int startrow, int endrow) const;
1140
1144 Mat rowRange(const Range& r) const;
1145
1153 Mat colRange(int startcol, int endcol) const;
1154
1158 Mat colRange(const Range& r) const;
1159
1194 Mat diag(int d=0) const;
1195
1201 CV_NODISCARD_STD static Mat diag(const Mat& d);
1202
1208 CV_NODISCARD_STD Mat clone() const;
1209
1225 void copyTo( OutputArray m ) const;
1226
1234
1248 void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
1249
1256 void assignTo( Mat& m, int type=-1 ) const;
1257
1261 Mat& operator = (const Scalar& s);
1262
1271
1308 Mat reshape(int cn, int rows=0) const;
1309
1316 Mat reshape(int cn, int newndims, const int* newsz) const;
1317
1323 Mat reshape(int cn, const std::vector<int>& newshape) const;
1324
1335 MatExpr t() const;
1336
1345
1358 MatExpr mul(InputArray m, double scale=1) const;
1359
1367 Mat cross(InputArray m) const;
1368
1377 double dot(InputArray m) const;
1378
1393 CV_NODISCARD_STD static MatExpr zeros(int rows, int cols, int type);
1394
1400
1406 CV_NODISCARD_STD static MatExpr zeros(int ndims, const int* sz, int type);
1407
1424 CV_NODISCARD_STD static MatExpr ones(int rows, int cols, int type);
1425
1431
1437 CV_NODISCARD_STD static MatExpr ones(int ndims, const int* sz, int type);
1438
1453 CV_NODISCARD_STD static MatExpr eye(int rows, int cols, int type);
1454
1460
1494 void create(int rows, int cols, int type);
1495
1500 void create(Size size, int type);
1501
1507 void create(int ndims, const int* sizes, int type);
1508
1513 void create(const std::vector<int>& sizes, int type);
1514
1524 void addref();
1525
1539 void release();
1540
1544 void copySize(const Mat& m);
1545
1553 void reserve(size_t sz);
1554
1561 void reserveBuffer(size_t sz);
1562
1570 void resize(size_t sz);
1571
1576 void resize(size_t sz, const Scalar& s);
1577
1579 void push_back_(const void* elem);
1580
1588 template<typename _Tp> void push_back(const _Tp& elem);
1589
1593 template<typename _Tp> void push_back(const Mat_<_Tp>& elem);
1594
1598 template<typename _Tp> void push_back(const std::vector<_Tp>& elem);
1599
1603 void push_back(const Mat& m);
1604
1611 void pop_back(size_t nelems=1);
1612
1624 void locateROI( Size& wholeSize, Point& ofs ) const;
1625
1653 Mat& adjustROI( int dtop, int dbottom, int dleft, int dright );
1654
1666 Mat operator()( Range rowRange, Range colRange ) const;
1667
1671 Mat operator()( const Rect& roi ) const;
1672
1676 Mat operator()( const Range* ranges ) const;
1677
1681 Mat operator()(const std::vector<Range>& ranges) const;
1682
1683 template<typename _Tp> operator std::vector<_Tp>() const;
1684 template<typename _Tp, int n> operator Vec<_Tp, n>() const;
1685 template<typename _Tp, int m, int n> operator Matx<_Tp, m, n>() const;
1686
1687 template<typename _Tp, std::size_t _Nm> operator std::array<_Tp, _Nm>() const;
1688
1763 bool isContinuous() const;
1764
1766 bool isSubmatrix() const;
1767
1773 size_t elemSize() const;
1774
1780 size_t elemSize1() const;
1781
1787 int type() const;
1788
1802 int depth() const;
1803
1808 int channels() const;
1809
1815 size_t step1(int i=0) const;
1816
1822 bool empty() const;
1823
1829 size_t total() const;
1830
1835 size_t total(int startDim, int endDim=INT_MAX) const;
1836
1858 int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
1859
1866 uchar* ptr(int i0=0);
1868 const uchar* ptr(int i0=0) const;
1869
1874 uchar* ptr(int row, int col);
1879 const uchar* ptr(int row, int col) const;
1880
1882 uchar* ptr(int i0, int i1, int i2);
1884 const uchar* ptr(int i0, int i1, int i2) const;
1885
1887 uchar* ptr(const int* idx);
1889 const uchar* ptr(const int* idx) const;
1891 template<int n> uchar* ptr(const Vec<int, n>& idx);
1893 template<int n> const uchar* ptr(const Vec<int, n>& idx) const;
1894
1896 template<typename _Tp> _Tp* ptr(int i0=0);
1898 template<typename _Tp> const _Tp* ptr(int i0=0) const;
1903 template<typename _Tp> _Tp* ptr(int row, int col);
1908 template<typename _Tp> const _Tp* ptr(int row, int col) const;
1910 template<typename _Tp> _Tp* ptr(int i0, int i1, int i2);
1912 template<typename _Tp> const _Tp* ptr(int i0, int i1, int i2) const;
1914 template<typename _Tp> _Tp* ptr(const int* idx);
1916 template<typename _Tp> const _Tp* ptr(const int* idx) const;
1918 template<typename _Tp, int n> _Tp* ptr(const Vec<int, n>& idx);
1920 template<typename _Tp, int n> const _Tp* ptr(const Vec<int, n>& idx) const;
1921
1952 template<typename _Tp> _Tp& at(int i0=0);
1956 template<typename _Tp> const _Tp& at(int i0=0) const;
1961 template<typename _Tp> _Tp& at(int row, int col);
1966 template<typename _Tp> const _Tp& at(int row, int col) const;
1967
1973 template<typename _Tp> _Tp& at(int i0, int i1, int i2);
1979 template<typename _Tp> const _Tp& at(int i0, int i1, int i2) const;
1980
1984 template<typename _Tp> _Tp& at(const int* idx);
1988 template<typename _Tp> const _Tp& at(const int* idx) const;
1989
1991 template<typename _Tp, int n> _Tp& at(const Vec<int, n>& idx);
1993 template<typename _Tp, int n> const _Tp& at(const Vec<int, n>& idx) const;
1994
1999 template<typename _Tp> _Tp& at(Point pt);
2004 template<typename _Tp> const _Tp& at(Point pt) const;
2005
2042 template<typename _Tp> MatIterator_<_Tp> begin();
2043 template<typename _Tp> MatConstIterator_<_Tp> begin() const;
2044
2047 template<typename _Tp> std::reverse_iterator<MatIterator_<_Tp>> rbegin();
2048 template<typename _Tp> std::reverse_iterator<MatConstIterator_<_Tp>> rbegin() const;
2049
2055 template<typename _Tp> MatIterator_<_Tp> end();
2056 template<typename _Tp> MatConstIterator_<_Tp> end() const;
2057
2060 template<typename _Tp> std::reverse_iterator< MatIterator_<_Tp>> rend();
2061 template<typename _Tp> std::reverse_iterator< MatConstIterator_<_Tp>> rend() const;
2062
2063
2118 template<typename _Tp, typename Functor> void forEach(const Functor& operation);
2120 template<typename _Tp, typename Functor> void forEach(const Functor& operation) const;
2121
2122 Mat(Mat&& m);
2123 Mat& operator = (Mat&& m);
2124
2125 enum { MAGIC_VAL = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG };
2126 enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 };
2127
2136 int dims;
2141
2146
2152 static void setDefaultAllocator(MatAllocator* allocator);
2153
2156
2159
2162
2163protected:
2164 template<typename _Tp, typename Functor> void forEach_impl(const Functor& operation);
2165};
2166
2167
2169
2229template<typename _Tp> class Mat_ : public Mat
2230{
2231public:
2232 typedef _Tp value_type;
2236
2240 Mat_(int _rows, int _cols);
2242 Mat_(int _rows, int _cols, const _Tp& value);
2244 explicit Mat_(Size _size);
2246 Mat_(Size _size, const _Tp& value);
2248 Mat_(int _ndims, const int* _sizes);
2250 Mat_(int _ndims, const int* _sizes, const _Tp& value);
2252 Mat_(const Mat& m);
2254 Mat_(const Mat_& m);
2256 Mat_(int _rows, int _cols, _Tp* _data, size_t _step=AUTO_STEP);
2258 Mat_(int _ndims, const int* _sizes, _Tp* _data, const size_t* _steps=0);
2260 Mat_(const Mat_& m, const Range& rowRange, const Range& colRange=Range::all());
2262 Mat_(const Mat_& m, const Rect& roi);
2264 Mat_(const Mat_& m, const Range* ranges);
2266 Mat_(const Mat_& m, const std::vector<Range>& ranges);
2268 explicit Mat_(const MatExpr& e);
2270 explicit Mat_(const std::vector<_Tp>& vec, bool copyData=false);
2271 template<int n> explicit Mat_(const Vec<typename DataType<_Tp>::channel_type, n>& vec, bool copyData=true);
2272 template<int m, int n> explicit Mat_(const Matx<typename DataType<_Tp>::channel_type, m, n>& mtx, bool copyData=true);
2273 explicit Mat_(const Point_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
2274 explicit Mat_(const Point3_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
2275 explicit Mat_(const MatCommaInitializer_<_Tp>& commaInitializer);
2276
2277 Mat_(std::initializer_list<_Tp> values);
2278 explicit Mat_(const std::initializer_list<int> sizes, const std::initializer_list<_Tp> values);
2279
2280 template <std::size_t _Nm> explicit Mat_(const std::array<_Tp, _Nm>& arr, bool copyData=false);
2281
2282 Mat_& operator = (const Mat& m);
2283 Mat_& operator = (const Mat_& m);
2285 Mat_& operator = (const _Tp& s);
2287 Mat_& operator = (const MatExpr& e);
2288
2294
2295 //reverse iterators
2296 std::reverse_iterator<iterator> rbegin();
2297 std::reverse_iterator<iterator> rend();
2298 std::reverse_iterator<const_iterator> rbegin() const;
2299 std::reverse_iterator<const_iterator> rend() const;
2300
2302 // the operations take care of skipping gaps in the end of rows (if any)
2303 template<typename Functor> void forEach(const Functor& operation);
2304 template<typename Functor> void forEach(const Functor& operation) const;
2305
2307 void create(int _rows, int _cols);
2309 void create(Size _size);
2311 void create(int _ndims, const int* _sizes);
2313 void release();
2315 Mat_ cross(const Mat_& m) const;
2317 template<typename T2> operator Mat_<T2>() const;
2319 Mat_ row(int y) const;
2320 Mat_ col(int x) const;
2321 Mat_ diag(int d=0) const;
2323
2325 size_t elemSize() const;
2326 size_t elemSize1() const;
2327 int type() const;
2328 int depth() const;
2329 int channels() const;
2330 size_t step1(int i=0) const;
2332 size_t stepT(int i=0) const;
2333
2337 CV_NODISCARD_STD static MatExpr zeros(int _ndims, const int* _sizes);
2340 CV_NODISCARD_STD static MatExpr ones(int _ndims, const int* _sizes);
2343
2345 Mat_& adjustROI( int dtop, int dbottom, int dleft, int dright );
2346 Mat_ operator()( const Range& rowRange, const Range& colRange ) const;
2347 Mat_ operator()( const Rect& roi ) const;
2348 Mat_ operator()( const Range* ranges ) const;
2349 Mat_ operator()(const std::vector<Range>& ranges) const;
2350
2352 _Tp* operator [](int y);
2353 const _Tp* operator [](int y) const;
2354
2356 _Tp& operator ()(const int* idx);
2358 const _Tp& operator ()(const int* idx) const;
2359
2361 template<int n> _Tp& operator ()(const Vec<int, n>& idx);
2363 template<int n> const _Tp& operator ()(const Vec<int, n>& idx) const;
2364
2366 _Tp& operator ()(int idx0);
2368 const _Tp& operator ()(int idx0) const;
2370 _Tp& operator ()(int row, int col);
2372 const _Tp& operator ()(int row, int col) const;
2374 _Tp& operator ()(int idx0, int idx1, int idx2);
2376 const _Tp& operator ()(int idx0, int idx1, int idx2) const;
2377
2378 _Tp& operator ()(Point pt);
2379 const _Tp& operator ()(Point pt) const;
2380
2382 operator std::vector<_Tp>() const;
2383
2385 template<std::size_t _Nm> operator std::array<_Tp, _Nm>() const;
2386
2388 template<int n> operator Vec<typename DataType<_Tp>::channel_type, n>() const;
2390 template<int m, int n> operator Matx<typename DataType<_Tp>::channel_type, m, n>() const;
2391
2393 Mat_& operator = (Mat_&& m);
2394
2395 Mat_(Mat&& m);
2396 Mat_& operator = (Mat&& m);
2397
2399};
2400
2405
2406typedef Mat_<short> Mat1s;
2410
2415
2416typedef Mat_<int> Mat1i;
2420
2421typedef Mat_<float> Mat1f;
2425
2426typedef Mat_<double> Mat1d;
2430
2433{
2434public:
2438 // (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
2439 UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
2442 UMat(int rows, int cols, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
2443 UMat(Size size, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
2444
2446 UMat(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
2447 UMat(int ndims, const int* sizes, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
2448
2450 UMat(const UMat& m);
2451
2453 UMat(const UMat& m, const Range& rowRange, const Range& colRange=Range::all());
2454 UMat(const UMat& m, const Rect& roi);
2455 UMat(const UMat& m, const Range* ranges);
2457
2458 // FIXIT copyData=false is not implemented, drop this in favor of cv::Mat (OpenCV 5.0)
2460 template<typename _Tp> explicit UMat(const std::vector<_Tp>& vec, bool copyData=false);
2461
2466
2468
2470 UMat row(int y) const;
2472 UMat col(int x) const;
2474 UMat rowRange(int startrow, int endrow) const;
2475 UMat rowRange(const Range& r) const;
2477 UMat colRange(int startcol, int endcol) const;
2478 UMat colRange(const Range& r) const;
2483 UMat diag(int d=0) const;
2485 CV_NODISCARD_STD static UMat diag(const UMat& d, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2486 CV_NODISCARD_STD static UMat diag(const UMat& d) { return diag(d, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2487
2491 // It calls m.create(this->size(), this->type()).
2492 void copyTo( OutputArray m ) const;
2496 void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
2497
2498 void assignTo( UMat& m, int type=-1 ) const;
2499
2505 // number of channels and/or different number of rows. see cvReshape.
2506 UMat reshape(int cn, int rows=0) const;
2507 UMat reshape(int cn, int newndims, const int* newsz) const;
2508
2510 UMat t() const;
2514 UMat mul(InputArray m, double scale=1) const;
2515
2517 double dot(InputArray m) const;
2518
2520 CV_NODISCARD_STD static UMat zeros(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2521 CV_NODISCARD_STD static UMat zeros(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2522 CV_NODISCARD_STD static UMat zeros(int ndims, const int* sz, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2523 CV_NODISCARD_STD static UMat zeros(int rows, int cols, int type) { return zeros(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2524 CV_NODISCARD_STD static UMat zeros(Size size, int type) { return zeros(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2525 CV_NODISCARD_STD static UMat zeros(int ndims, const int* sz, int type) { return zeros(ndims, sz, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2526 CV_NODISCARD_STD static UMat ones(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2527 CV_NODISCARD_STD static UMat ones(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2528 CV_NODISCARD_STD static UMat ones(int ndims, const int* sz, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2529 CV_NODISCARD_STD static UMat ones(int rows, int cols, int type) { return ones(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2530 CV_NODISCARD_STD static UMat ones(Size size, int type) { return ones(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2531 CV_NODISCARD_STD static UMat ones(int ndims, const int* sz, int type) { return ones(ndims, sz, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2532 CV_NODISCARD_STD static UMat eye(int rows, int cols, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2533 CV_NODISCARD_STD static UMat eye(Size size, int type, UMatUsageFlags usageFlags /*= USAGE_DEFAULT*/);
2534 CV_NODISCARD_STD static UMat eye(int rows, int cols, int type) { return eye(rows, cols, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2535 CV_NODISCARD_STD static UMat eye(Size size, int type) { return eye(size, type, USAGE_DEFAULT); } // OpenCV 5.0: remove abi compatibility overload
2536
2538 // previous data is unreferenced if needed.
2539 void create(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
2541 void create(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
2543
2545 void addref();
2547 // deallocates the data when reference counter reaches 0.
2548 void release();
2549
2553 void copySize(const UMat& m);
2554
2556 void locateROI( Size& wholeSize, Point& ofs ) const;
2558 UMat& adjustROI( int dtop, int dbottom, int dleft, int dright );
2560 // (this is a generalized form of row, rowRange etc.)
2562 UMat operator()( const Rect& roi ) const;
2563 UMat operator()( const Range* ranges ) const;
2565
2567 // (i.e. when there are no gaps between successive rows).
2568 // similar to CV_IS_MAT_CONT(cvmat->type)
2569 bool isContinuous() const;
2570
2572 bool isSubmatrix() const;
2573
2575 // similar to CV_ELEM_SIZE(cvmat->type)
2576 size_t elemSize() const;
2578 size_t elemSize1() const;
2580 int type() const;
2582 int depth() const;
2584 int channels() const;
2586 size_t step1(int i=0) const;
2588 bool empty() const;
2590 size_t total() const;
2591
2593 int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
2594
2597
2602 void* handle(AccessFlag accessFlags) const;
2603 void ndoffset(size_t* ofs) const;
2604
2606 enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 };
2607
2615
2617 int dims;
2618
2620 int rows;
2621
2623 int cols;
2624
2627
2630
2633
2636
2639
2641 size_t offset;
2642
2645
2648
2649protected:
2650};
2651
2652
2654
2735{
2736public:
2739
2740 enum { MAGIC_VAL=0x42FD0000, MAX_DIM=32, HASH_SCALE=0x5bd1e995, HASH_BIT=0x80000000 };
2741
2744 {
2745 Hdr(int _dims, const int* _sizes, int _type);
2746 void clear();
2748 int dims;
2750 size_t nodeSize;
2752 size_t freeList;
2755 int size[MAX_DIM];
2756 };
2757
2760 {
2762 size_t hashval;
2764 size_t next;
2766 int idx[MAX_DIM];
2767 };
2768
2772
2778 SparseMat(int dims, const int* _sizes, int _type);
2779
2785
2790 explicit SparseMat(const Mat& m);
2791
2794
2796 SparseMat& operator = (const SparseMat& m);
2798 SparseMat& operator = (const Mat& m);
2799
2802
2804 void copyTo( SparseMat& m ) const;
2806 void copyTo( Mat& m ) const;
2808 void convertTo( SparseMat& m, int rtype, double alpha=1 ) const;
2810
2819 void convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const;
2820
2821 // not used now
2822 void assignTo( SparseMat& m, int type=-1 ) const;
2823
2825
2830 void create(int dims, const int* _sizes, int _type);
2832 void clear();
2834 void addref();
2835 // decrements the header reference counter. When the counter reaches 0, the header and all the underlying data are deallocated.
2836 void release();
2837
2839 //operator CvSparseMat*() const;
2841 size_t elemSize() const;
2843 size_t elemSize1() const;
2844
2846 int type() const;
2848 int depth() const;
2850 int channels() const;
2851
2853 const int* size() const;
2855 int size(int i) const;
2857 int dims() const;
2859 size_t nzcount() const;
2860
2862 size_t hash(int i0) const;
2864 size_t hash(int i0, int i1) const;
2866 size_t hash(int i0, int i1, int i2) const;
2868 size_t hash(const int* idx) const;
2869
2871
2882 uchar* ptr(int i0, bool createMissing, size_t* hashval=0);
2884 uchar* ptr(int i0, int i1, bool createMissing, size_t* hashval=0);
2886 uchar* ptr(int i0, int i1, int i2, bool createMissing, size_t* hashval=0);
2888 uchar* ptr(const int* idx, bool createMissing, size_t* hashval=0);
2890
2892
2900 template<typename _Tp> _Tp& ref(int i0, size_t* hashval=0);
2902 template<typename _Tp> _Tp& ref(int i0, int i1, size_t* hashval=0);
2904 template<typename _Tp> _Tp& ref(int i0, int i1, int i2, size_t* hashval=0);
2906 template<typename _Tp> _Tp& ref(const int* idx, size_t* hashval=0);
2908
2910
2921 template<typename _Tp> _Tp value(int i0, size_t* hashval=0) const;
2923 template<typename _Tp> _Tp value(int i0, int i1, size_t* hashval=0) const;
2925 template<typename _Tp> _Tp value(int i0, int i1, int i2, size_t* hashval=0) const;
2927 template<typename _Tp> _Tp value(const int* idx, size_t* hashval=0) const;
2929
2931
2939 template<typename _Tp> const _Tp* find(int i0, size_t* hashval=0) const;
2941 template<typename _Tp> const _Tp* find(int i0, int i1, size_t* hashval=0) const;
2943 template<typename _Tp> const _Tp* find(int i0, int i1, int i2, size_t* hashval=0) const;
2945 template<typename _Tp> const _Tp* find(const int* idx, size_t* hashval=0) const;
2947
2949 void erase(int i0, int i1, size_t* hashval=0);
2951 void erase(int i0, int i1, int i2, size_t* hashval=0);
2953 void erase(const int* idx, size_t* hashval=0);
2954
2956
2962 template<typename _Tp> SparseMatIterator_<_Tp> begin();
2966 template<typename _Tp> SparseMatConstIterator_<_Tp> begin() const;
2968
2976 template<typename _Tp> SparseMatIterator_<_Tp> end();
2978 template<typename _Tp> SparseMatConstIterator_<_Tp> end() const;
2979
2981 template<typename _Tp> _Tp& value(Node* n);
2983 template<typename _Tp> const _Tp& value(const Node* n) const;
2984
2986 Node* node(size_t nidx);
2987 const Node* node(size_t nidx) const;
2988
2989 uchar* newNode(const int* idx, size_t hashval);
2990 void removeNode(size_t hidx, size_t nidx, size_t previdx);
2991 void resizeHashTab(size_t newsize);
2992
2995};
2996
2997
2998
3000
3012template<typename _Tp> class SparseMat_ : public SparseMat
3013{
3014public:
3017
3021 SparseMat_(int dims, const int* _sizes);
3027 SparseMat_(const Mat& m);
3029 //SparseMat_(const CvSparseMat* m);
3031 SparseMat_& operator = (const SparseMat& m);
3033 SparseMat_& operator = (const SparseMat_& m);
3035 SparseMat_& operator = (const Mat& m);
3036
3040 void create(int dims, const int* _sizes);
3042 //operator CvSparseMat*() const;
3043
3045 int type() const;
3047 int depth() const;
3049 int channels() const;
3050
3052 _Tp& ref(int i0, size_t* hashval=0);
3054 _Tp& ref(int i0, int i1, size_t* hashval=0);
3056 _Tp& ref(int i0, int i1, int i2, size_t* hashval=0);
3058 _Tp& ref(const int* idx, size_t* hashval=0);
3059
3061 _Tp operator()(int i0, size_t* hashval=0) const;
3063 _Tp operator()(int i0, int i1, size_t* hashval=0) const;
3065 _Tp operator()(int i0, int i1, int i2, size_t* hashval=0) const;
3067 _Tp operator()(const int* idx, size_t* hashval=0) const;
3068
3077};
3078
3079
3080
3082
3084{
3085public:
3087 typedef ptrdiff_t difference_type;
3088 typedef const uchar** pointer;
3090
3092
3098 MatConstIterator(const Mat* _m, int _row, int _col=0);
3100 MatConstIterator(const Mat* _m, Point _pt);
3102 MatConstIterator(const Mat* _m, const int* _idx);
3105
3107 MatConstIterator& operator = (const MatConstIterator& it);
3109 const uchar* operator *() const;
3111 const uchar* operator [](ptrdiff_t i) const;
3112
3114 MatConstIterator& operator += (ptrdiff_t ofs);
3116 MatConstIterator& operator -= (ptrdiff_t ofs);
3118 MatConstIterator& operator --();
3120 MatConstIterator operator --(int);
3122 MatConstIterator& operator ++();
3124 MatConstIterator operator ++(int);
3126 Point pos() const;
3128 void pos(int* _idx) const;
3129
3130 ptrdiff_t lpos() const;
3131 void seek(ptrdiff_t ofs, bool relative = false);
3132 void seek(const int* _idx, bool relative = false);
3133
3134 const Mat* m;
3135 size_t elemSize;
3136 const uchar* ptr;
3139};
3140
3141
3142
3144
3147template<typename _Tp>
3149{
3150public:
3151 typedef _Tp value_type;
3152 typedef ptrdiff_t difference_type;
3153 typedef const _Tp* pointer;
3154 typedef const _Tp& reference;
3155
3157
3163 MatConstIterator_(const Mat_<_Tp>* _m, int _row, int _col=0);
3167 MatConstIterator_(const Mat_<_Tp>* _m, const int* _idx);
3170
3172 MatConstIterator_& operator = (const MatConstIterator_& it);
3174 const _Tp& operator *() const;
3176 const _Tp& operator [](ptrdiff_t i) const;
3177
3179 MatConstIterator_& operator += (ptrdiff_t ofs);
3181 MatConstIterator_& operator -= (ptrdiff_t ofs);
3183 MatConstIterator_& operator --();
3185 MatConstIterator_ operator --(int);
3187 MatConstIterator_& operator ++();
3189 MatConstIterator_ operator ++(int);
3191 Point pos() const;
3192};
3193
3194
3195
3197
3200template<typename _Tp>
3202{
3203public:
3204 typedef _Tp* pointer;
3205 typedef _Tp& reference;
3206
3208
3214 MatIterator_(Mat_<_Tp>* _m, int _row, int _col=0);
3218 MatIterator_(Mat_<_Tp>* _m, const int* _idx);
3222 MatIterator_& operator = (const MatIterator_<_Tp>& it );
3223
3225 _Tp& operator *() const;
3227 _Tp& operator [](ptrdiff_t i) const;
3228
3230 MatIterator_& operator += (ptrdiff_t ofs);
3232 MatIterator_& operator -= (ptrdiff_t ofs);
3234 MatIterator_& operator --();
3236 MatIterator_ operator --(int);
3238 MatIterator_& operator ++();
3240 MatIterator_ operator ++(int);
3241};
3242
3243
3244
3246
3260{
3261public:
3268
3271
3273 template<typename _Tp> const _Tp& value() const;
3275 const SparseMat::Node* node() const;
3276
3280 SparseMatConstIterator operator --(int);
3284 SparseMatConstIterator operator ++(int);
3285
3287 void seekEnd();
3288
3289 const SparseMat* m;
3290 size_t hashidx;
3292};
3293
3294
3295
3297
3304{
3305public:
3314
3316 SparseMatIterator& operator = (const SparseMatIterator& it);
3318 template<typename _Tp> _Tp& value() const;
3321
3323 SparseMatIterator& operator ++();
3325 SparseMatIterator operator ++(int);
3326};
3327
3328
3329
3331
3361
3362
3363
3365
3371template<typename _Tp> class SparseMatIterator_ : public SparseMatConstIterator_<_Tp>
3372{
3373public:
3374
3376
3384
3388 _Tp& operator *() const;
3389
3391 SparseMatIterator_& operator ++();
3393 SparseMatIterator_ operator ++(int);
3394};
3395
3396
3397
3399
3461{
3462public:
3466 NAryMatIterator(const Mat** arrays, uchar** ptrs, int narrays=-1);
3468 NAryMatIterator(const Mat** arrays, Mat* planes, int narrays=-1);
3470 void init(const Mat** arrays, Mat* planes, uchar** ptrs, int narrays=-1);
3471
3473 NAryMatIterator& operator ++();
3475 NAryMatIterator operator ++(int);
3476
3478 const Mat** arrays;
3486 size_t nplanes;
3488 size_t size;
3489protected:
3491 size_t idx;
3492};
3493
3494
3495
3497
3499{
3500public:
3502 virtual ~MatOp();
3503
3504 virtual bool elementWise(const MatExpr& expr) const;
3505 virtual void assign(const MatExpr& expr, Mat& m, int type=-1) const = 0;
3506 virtual void roi(const MatExpr& expr, const Range& rowRange,
3507 const Range& colRange, MatExpr& res) const;
3508 virtual void diag(const MatExpr& expr, int d, MatExpr& res) const;
3509 virtual void augAssignAdd(const MatExpr& expr, Mat& m) const;
3510 virtual void augAssignSubtract(const MatExpr& expr, Mat& m) const;
3511 virtual void augAssignMultiply(const MatExpr& expr, Mat& m) const;
3512 virtual void augAssignDivide(const MatExpr& expr, Mat& m) const;
3513 virtual void augAssignAnd(const MatExpr& expr, Mat& m) const;
3514 virtual void augAssignOr(const MatExpr& expr, Mat& m) const;
3515 virtual void augAssignXor(const MatExpr& expr, Mat& m) const;
3516
3517 virtual void add(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
3518 virtual void add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const;
3519
3520 virtual void subtract(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
3521 virtual void subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const;
3522
3523 virtual void multiply(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const;
3524 virtual void multiply(const MatExpr& expr1, double s, MatExpr& res) const;
3525
3526 virtual void divide(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const;
3527 virtual void divide(double s, const MatExpr& expr, MatExpr& res) const;
3528
3529 virtual void abs(const MatExpr& expr, MatExpr& res) const;
3530
3531 virtual void transpose(const MatExpr& expr, MatExpr& res) const;
3532 virtual void matmul(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
3533 virtual void invert(const MatExpr& expr, int method, MatExpr& res) const;
3534
3535 virtual Size size(const MatExpr& expr) const;
3536 virtual int type(const MatExpr& expr) const;
3537};
3538
3586{
3587public:
3589 explicit MatExpr(const Mat& m);
3590
3591 MatExpr(const MatOp* _op, int _flags, const Mat& _a = Mat(), const Mat& _b = Mat(),
3592 const Mat& _c = Mat(), double _alpha = 1, double _beta = 1, const Scalar& _s = Scalar());
3593
3594 operator Mat() const;
3595 template<typename _Tp> operator Mat_<_Tp>() const;
3596
3597 Size size() const;
3598 int type() const;
3599
3600 MatExpr row(int y) const;
3601 MatExpr col(int x) const;
3602 MatExpr diag(int d = 0) const;
3603 MatExpr operator()( const Range& rowRange, const Range& colRange ) const;
3604 MatExpr operator()( const Rect& roi ) const;
3605
3606 MatExpr t() const;
3607 MatExpr inv(int method = DECOMP_LU) const;
3608 MatExpr mul(const MatExpr& e, double scale=1) const;
3609 MatExpr mul(const Mat& m, double scale=1) const;
3610
3611 Mat cross(const Mat& m) const;
3612 double dot(const Mat& m) const;
3613
3614 void swap(MatExpr& b);
3615
3616 const MatOp* op;
3618
3619 Mat a, b, c;
3620 double alpha, beta;
3622};
3623
3625
3636template<typename _Tp, int m, int n> static inline
3637MatExpr operator + (const Mat& a, const Matx<_Tp, m, n>& b) { return a + Mat(b); }
3638template<typename _Tp, int m, int n> static inline
3639MatExpr operator + (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) + b; }
3640
3649template<typename _Tp, int m, int n> static inline
3650MatExpr operator - (const Mat& a, const Matx<_Tp, m, n>& b) { return a - Mat(b); }
3651template<typename _Tp, int m, int n> static inline
3652MatExpr operator - (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) - b; }
3653
3656
3658CV_EXPORTS MatExpr operator * (const Mat& a, double s);
3659CV_EXPORTS MatExpr operator * (double s, const Mat& a);
3665template<typename _Tp, int m, int n> static inline
3666MatExpr operator * (const Mat& a, const Matx<_Tp, m, n>& b) { return a * Mat(b); }
3667template<typename _Tp, int m, int n> static inline
3668MatExpr operator * (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) * b; }
3669
3671CV_EXPORTS MatExpr operator / (const Mat& a, double s);
3672CV_EXPORTS MatExpr operator / (double s, const Mat& a);
3678template<typename _Tp, int m, int n> static inline
3679MatExpr operator / (const Mat& a, const Matx<_Tp, m, n>& b) { return a / Mat(b); }
3680template<typename _Tp, int m, int n> static inline
3681MatExpr operator / (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) / b; }
3682
3684CV_EXPORTS MatExpr operator < (const Mat& a, double s);
3685CV_EXPORTS MatExpr operator < (double s, const Mat& a);
3686template<typename _Tp, int m, int n> static inline
3687MatExpr operator < (const Mat& a, const Matx<_Tp, m, n>& b) { return a < Mat(b); }
3688template<typename _Tp, int m, int n> static inline
3689MatExpr operator < (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) < b; }
3690
3691CV_EXPORTS MatExpr operator <= (const Mat& a, const Mat& b);
3692CV_EXPORTS MatExpr operator <= (const Mat& a, double s);
3693CV_EXPORTS MatExpr operator <= (double s, const Mat& a);
3694template<typename _Tp, int m, int n> static inline
3695MatExpr operator <= (const Mat& a, const Matx<_Tp, m, n>& b) { return a <= Mat(b); }
3696template<typename _Tp, int m, int n> static inline
3697MatExpr operator <= (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) <= b; }
3698
3702template<typename _Tp, int m, int n> static inline
3703MatExpr operator == (const Mat& a, const Matx<_Tp, m, n>& b) { return a == Mat(b); }
3704template<typename _Tp, int m, int n> static inline
3705MatExpr operator == (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) == b; }
3706
3710template<typename _Tp, int m, int n> static inline
3711MatExpr operator != (const Mat& a, const Matx<_Tp, m, n>& b) { return a != Mat(b); }
3712template<typename _Tp, int m, int n> static inline
3713MatExpr operator != (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) != b; }
3714
3715CV_EXPORTS MatExpr operator >= (const Mat& a, const Mat& b);
3716CV_EXPORTS MatExpr operator >= (const Mat& a, double s);
3717CV_EXPORTS MatExpr operator >= (double s, const Mat& a);
3718template<typename _Tp, int m, int n> static inline
3719MatExpr operator >= (const Mat& a, const Matx<_Tp, m, n>& b) { return a >= Mat(b); }
3720template<typename _Tp, int m, int n> static inline
3721MatExpr operator >= (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) >= b; }
3722
3723CV_EXPORTS MatExpr operator > (const Mat& a, const Mat& b);
3724CV_EXPORTS MatExpr operator > (const Mat& a, double s);
3725CV_EXPORTS MatExpr operator > (double s, const Mat& a);
3726template<typename _Tp, int m, int n> static inline
3727MatExpr operator > (const Mat& a, const Matx<_Tp, m, n>& b) { return a > Mat(b); }
3728template<typename _Tp, int m, int n> static inline
3729MatExpr operator > (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) > b; }
3730
3734template<typename _Tp, int m, int n> static inline
3735MatExpr operator & (const Mat& a, const Matx<_Tp, m, n>& b) { return a & Mat(b); }
3736template<typename _Tp, int m, int n> static inline
3737MatExpr operator & (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) & b; }
3738
3742template<typename _Tp, int m, int n> static inline
3743MatExpr operator | (const Mat& a, const Matx<_Tp, m, n>& b) { return a | Mat(b); }
3744template<typename _Tp, int m, int n> static inline
3745MatExpr operator | (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) | b; }
3746
3750template<typename _Tp, int m, int n> static inline
3751MatExpr operator ^ (const Mat& a, const Matx<_Tp, m, n>& b) { return a ^ Mat(b); }
3752template<typename _Tp, int m, int n> static inline
3753MatExpr operator ^ (const Matx<_Tp, m, n>& a, const Mat& b) { return Mat(a) ^ b; }
3754
3756
3757CV_EXPORTS MatExpr min(const Mat& a, const Mat& b);
3758CV_EXPORTS MatExpr min(const Mat& a, double s);
3759CV_EXPORTS MatExpr min(double s, const Mat& a);
3760template<typename _Tp, int m, int n> static inline
3761MatExpr min (const Mat& a, const Matx<_Tp, m, n>& b) { return min(a, Mat(b)); }
3762template<typename _Tp, int m, int n> static inline
3763MatExpr min (const Matx<_Tp, m, n>& a, const Mat& b) { return min(Mat(a), b); }
3764
3765CV_EXPORTS MatExpr max(const Mat& a, const Mat& b);
3766CV_EXPORTS MatExpr max(const Mat& a, double s);
3767CV_EXPORTS MatExpr max(double s, const Mat& a);
3768template<typename _Tp, int m, int n> static inline
3769MatExpr max (const Mat& a, const Matx<_Tp, m, n>& b) { return max(a, Mat(b)); }
3770template<typename _Tp, int m, int n> static inline
3771MatExpr max (const Matx<_Tp, m, n>& a, const Mat& b) { return max(Mat(a), b); }
3772
3792
3793} // cv
3794
3795#include "opencv2/core/mat.inl.hpp"
3796
3797#endif // OPENCV_CORE_MAT_HPP
Definition bufferpool.hpp:22
Template "trait" class for OpenCV primitive data types.
Definition traits.hpp:113
Custom array allocator.
Definition mat.hpp:480
MatAllocator()
Definition mat.hpp:482
virtual void copy(UMatData *srcdata, UMatData *dstdata, int dims, const size_t sz[], const size_t srcofs[], const size_t srcstep[], const size_t dstofs[], const size_t dststep[], bool sync) const
virtual ~MatAllocator()
Definition mat.hpp:483
virtual void download(UMatData *data, void *dst, int dims, const size_t sz[], const size_t srcofs[], const size_t srcstep[], const size_t dststep[]) const
virtual UMatData * allocate(int dims, const int *sizes, int type, void *data, size_t *step, AccessFlag flags, UMatUsageFlags usageFlags) const =0
virtual void upload(UMatData *data, const void *src, int dims, const size_t sz[], const size_t dstofs[], const size_t dststep[], const size_t srcstep[]) const
virtual void unmap(UMatData *data) const
virtual BufferPoolController * getBufferPoolController(const char *id=NULL) const
virtual bool allocate(UMatData *data, AccessFlag accessflags, UMatUsageFlags usageFlags) const =0
virtual void map(UMatData *data, AccessFlag accessflags) const
virtual void deallocate(UMatData *data) const =0
Comma-separated Matrix Initializer.
Definition mat.hpp:525
MatIterator_< _Tp > it
Definition mat.hpp:534
MatCommaInitializer_(Mat_< _Tp > *_m)
the constructor, created by "matrix << firstValue" operator, where matrix is cv::Mat
MatCommaInitializer_< _Tp > & operator,(T2 v)
the operator that takes the next value and put it to the matrix
Matrix read-only iterator.
Definition mat.hpp:3149
_Tp value_type
Definition mat.hpp:3151
MatConstIterator_()
default constructor
const _Tp * pointer
Definition mat.hpp:3153
const _Tp & reference
Definition mat.hpp:3154
MatConstIterator_(const Mat_< _Tp > *_m, Point _pt)
constructor that sets the iterator to the specified element of the matrix
std::random_access_iterator_tag iterator_category
Definition mat.hpp:3156
MatConstIterator_(const MatConstIterator_ &it)
copy constructor
MatConstIterator_(const Mat_< _Tp > *_m, int _row, int _col=0)
constructor that sets the iterator to the specified element of the matrix
MatConstIterator_(const Mat_< _Tp > *_m, const int *_idx)
constructor that sets the iterator to the specified element of the matrix
Point pos() const
returns the current iterator position
MatConstIterator_(const Mat_< _Tp > *_m)
constructor that sets the iterator to the beginning of the matrix
ptrdiff_t difference_type
Definition mat.hpp:3152
Definition mat.hpp:3084
const uchar * sliceStart
Definition mat.hpp:3137
MatConstIterator(const Mat *_m, const int *_idx)
constructor that sets the iterator to the specified element of the matrix
MatConstIterator()
default constructor
const uchar * sliceEnd
Definition mat.hpp:3138
const Mat * m
Definition mat.hpp:3134
uchar * value_type
Definition mat.hpp:3086
ptrdiff_t lpos() const
const uchar * ptr
Definition mat.hpp:3136
Point pos() const
returns the current iterator position
MatConstIterator(const Mat *_m, Point _pt)
constructor that sets the iterator to the specified element of the matrix
MatConstIterator(const MatConstIterator &it)
copy constructor
void seek(ptrdiff_t ofs, bool relative=false)
void pos(int *_idx) const
returns the current iterator position
size_t elemSize
Definition mat.hpp:3135
const uchar ** pointer
Definition mat.hpp:3088
std::random_access_iterator_tag iterator_category
Definition mat.hpp:3091
MatConstIterator(const Mat *_m, int _row, int _col=0)
constructor that sets the iterator to the specified element of the matrix
void seek(const int *_idx, bool relative=false)
uchar * reference
Definition mat.hpp:3089
MatConstIterator(const Mat *_m)
constructor that sets the iterator to the beginning of the matrix
ptrdiff_t difference_type
Definition mat.hpp:3087
Matrix expression representation This is a list of implemented matrix operations that can be combined...
Definition mat.hpp:3586
CV_EXPORTS MatExpr min(const Mat &a, const Mat &b)
int flags
Definition mat.hpp:3617
MatExpr mul(const MatExpr &e, double scale=1) const
static MatExpr min(const Matx< _Tp, m, n > &a, const Mat &b)
Definition mat.hpp:3763
MatExpr(const Mat &m)
CV_EXPORTS MatExpr abs(const Mat &m)
Calculates an absolute value of each matrix element.
MatExpr diag(int d=0) const
CV_EXPORTS MatExpr max(const Mat &a, const Mat &b)
double dot(const Mat &m) const
MatExpr mul(const Mat &m, double scale=1) const
Scalar s
Definition mat.hpp:3621
CV_EXPORTS MatExpr min(double s, const Mat &a)
int type() const
CV_EXPORTS MatExpr min(const Mat &a, double s)
MatExpr inv(int method=DECOMP_LU) const
MatExpr operator()(const Range &rowRange, const Range &colRange) const
static MatExpr min(const Mat &a, const Matx< _Tp, m, n > &b)
Definition mat.hpp:3761
void swap(MatExpr &b)
Size size() const
Mat cross(const Mat &m) const
static MatExpr max(const Matx< _Tp, m, n > &a, const Mat &b)
Definition mat.hpp:3771
const MatOp * op
Definition mat.hpp:3616
CV_EXPORTS MatExpr max(double s, const Mat &a)
MatExpr row(int y) const
static MatExpr max(const Mat &a, const Matx< _Tp, m, n > &b)
Definition mat.hpp:3769
double alpha
Definition mat.hpp:3620
CV_EXPORTS MatExpr max(const Mat &a, double s)
MatExpr(const MatOp *_op, int _flags, const Mat &_a=Mat(), const Mat &_b=Mat(), const Mat &_c=Mat(), double _alpha=1, double _beta=1, const Scalar &_s=Scalar())
MatExpr operator()(const Rect &roi) const
CV_EXPORTS MatExpr abs(const MatExpr &e)
MatExpr col(int x) const
MatExpr t() const
Mat a
Definition mat.hpp:3619
Matrix read-write iterator.
Definition mat.hpp:3202
MatIterator_(Mat_< _Tp > *_m, int _row, int _col=0)
constructor that sets the iterator to the specified element of the matrix
MatIterator_(Mat_< _Tp > *_m, Point _pt)
constructor that sets the iterator to the specified element of the matrix
MatIterator_()
the default constructor
std::random_access_iterator_tag iterator_category
Definition mat.hpp:3207
MatIterator_(Mat_< _Tp > *_m, const int *_idx)
constructor that sets the iterator to the specified element of the matrix
MatIterator_(const MatIterator_ &it)
copy constructor
_Tp * pointer
Definition mat.hpp:3204
_Tp & reference
Definition mat.hpp:3205
MatIterator_(Mat_< _Tp > *_m)
constructor that sets the iterator to the beginning of the matrix
Definition mat.hpp:3499
virtual void abs(const MatExpr &expr, MatExpr &res) const
virtual void divide(double s, const MatExpr &expr, MatExpr &res) const
virtual void subtract(const Scalar &s, const MatExpr &expr, MatExpr &res) const
virtual void augAssignMultiply(const MatExpr &expr, Mat &m) const
virtual void invert(const MatExpr &expr, int method, MatExpr &res) const
virtual void augAssignAnd(const MatExpr &expr, Mat &m) const
virtual void augAssignSubtract(const MatExpr &expr, Mat &m) const
virtual void diag(const MatExpr &expr, int d, MatExpr &res) const
virtual void roi(const MatExpr &expr, const Range &rowRange, const Range &colRange, MatExpr &res) const
virtual void augAssignXor(const MatExpr &expr, Mat &m) const
virtual void multiply(const MatExpr &expr1, double s, MatExpr &res) const
virtual void assign(const MatExpr &expr, Mat &m, int type=-1) const =0
virtual Size size(const MatExpr &expr) const
virtual void augAssignOr(const MatExpr &expr, Mat &m) const
virtual void divide(const MatExpr &expr1, const MatExpr &expr2, MatExpr &res, double scale=1) const
virtual void multiply(const MatExpr &expr1, const MatExpr &expr2, MatExpr &res, double scale=1) const
virtual int type(const MatExpr &expr) const
virtual ~MatOp()
virtual void add(const MatExpr &expr1, const Scalar &s, MatExpr &res) const
virtual void transpose(const MatExpr &expr, MatExpr &res) const
virtual void subtract(const MatExpr &expr1, const MatExpr &expr2, MatExpr &res) const
virtual bool elementWise(const MatExpr &expr) const
virtual void augAssignDivide(const MatExpr &expr, Mat &m) const
virtual void augAssignAdd(const MatExpr &expr, Mat &m) const
virtual void add(const MatExpr &expr1, const MatExpr &expr2, MatExpr &res) const
virtual void matmul(const MatExpr &expr1, const MatExpr &expr2, MatExpr &res) const
Template matrix class derived from Mat.
Definition mat.hpp:2230
MatConstIterator_< _Tp > const_iterator
Definition mat.hpp:2235
MatIterator_< _Tp > iterator
Definition mat.hpp:2234
_Tp value_type
Definition mat.hpp:2232
size_t elemSize1() const
DataType< _Tp >::channel_type channel_type
Definition mat.hpp:2233
size_t step1(int i=0) const
static CV_NODISCARD_STD MatExpr eye(int rows, int cols)
iterator end()
void forEach(const Functor &operation)
template methods for operation over all matrix elements.
std::reverse_iterator< iterator > rend()
Mat_() CV_NOEXCEPT
default constructor
int type() const
static CV_NODISCARD_STD MatExpr zeros(int rows, int cols)
overridden forms of Mat::zeros() etc. Data type is omitted, of course
Mat_ row(int y) const
overridden forms of Mat::row() etc.
Mat_ col(int x) const
size_t elemSize() const
overridden forms of Mat::elemSize() etc.
iterator begin()
iterators; they are smart enough to skip gaps in the end of rows
int channels() const
Mat_ cross(const Mat_ &m) const
cross-product
void release()
equivalent to Mat::release()
size_t stepT(int i=0) const
returns step()/sizeof(_Tp)
int depth() const
CV_NODISCARD_STD Mat_ clone() const
void create(int _rows, int _cols)
equivalent to Mat::create(_rows, _cols, DataType<_Tp>::type)
static CV_NODISCARD_STD MatExpr ones(int rows, int cols)
std::reverse_iterator< iterator > rbegin()
Mat_ & operator=(const Mat &m)
Mat_ diag(int d=0) const
Mat_ & adjustROI(int dtop, int dbottom, int dleft, int dright)
some more overridden methods
n-dimensional dense array class
Definition mat.hpp:812
MatSize size
Definition mat.hpp:2160
const uchar * datalimit
Definition mat.hpp:2145
UMatData * u
interaction with UMat
Definition mat.hpp:2158
Mat() CV_NOEXCEPT
void updateContinuityFlag()
internal use method: updates the continuity flag
int dims
the matrix dimensionality, >= 2
Definition mat.hpp:2136
static MatAllocator * getDefaultAllocator()
MatAllocator * allocator
custom allocator
Definition mat.hpp:2148
uchar * data
pointer to the data
Definition mat.hpp:2140
static void setDefaultAllocator(MatAllocator *allocator)
@ AUTO_STEP
Definition mat.hpp:2125
@ SUBMATRIX_FLAG
Definition mat.hpp:2125
@ MAGIC_VAL
Definition mat.hpp:2125
@ CONTINUOUS_FLAG
Definition mat.hpp:2125
int cols
Definition mat.hpp:2138
Mat rowRange(int startrow, int endrow) const
Creates a matrix header for the specified row span.
Mat colRange(int startcol, int endcol) const
Creates a matrix header for the specified column span.
MatStep step
Definition mat.hpp:2161
int rows
the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
Definition mat.hpp:2138
@ TYPE_MASK
Definition mat.hpp:2126
@ DEPTH_MASK
Definition mat.hpp:2126
@ MAGIC_MASK
Definition mat.hpp:2126
const uchar * dataend
Definition mat.hpp:2144
static MatAllocator * getStdAllocator()
and the standard allocator
const uchar * datastart
helper fields used in locateROI and adjustROI
Definition mat.hpp:2143
int flags
Definition mat.hpp:2134
Template class for small matrices whose type and size are known at compilation time.
Definition matx.hpp:100
n-ary multi-dimensional array iterator.
Definition mat.hpp:3461
const Mat ** arrays
the iterated arrays
Definition mat.hpp:3478
int iterdepth
Definition mat.hpp:3490
size_t size
the size of each segment (in elements)
Definition mat.hpp:3488
size_t idx
Definition mat.hpp:3491
size_t nplanes
the number of hyper-planes that the iterator steps through
Definition mat.hpp:3486
NAryMatIterator(const Mat **arrays, uchar **ptrs, int narrays=-1)
the full constructor taking arbitrary number of n-dim matrices
uchar ** ptrs
data pointers
Definition mat.hpp:3482
NAryMatIterator(const Mat **arrays, Mat *planes, int narrays=-1)
the full constructor taking arbitrary number of n-dim matrices
void init(const Mat **arrays, Mat *planes, uchar **ptrs, int narrays=-1)
the separate iterator initialization method
Mat * planes
the current planes
Definition mat.hpp:3480
NAryMatIterator()
the default constructor
int narrays
the number of arrays
Definition mat.hpp:3484
Template class for 3D points specified by its coordinates x, y and z.
Definition types.hpp:255
Template class for 2D points specified by its coordinates x and y.
Definition types.hpp:163
Template class specifying a continuous subsequence (slice) of a sequence.
Definition types.hpp:623
static Range all()
Template class for 2D rectangles.
Definition types.hpp:444
Template class for specifying the size of an image or rectangle.
Definition types.hpp:335
Template Read-Only Sparse Matrix Iterator Class.
Definition mat.hpp:3338
SparseMatConstIterator_(const SparseMatConstIterator_ &it)
the copy constructor
std::forward_iterator_tag iterator_category
Definition mat.hpp:3341
SparseMatConstIterator_(const SparseMat_< _Tp > *_m)
the full constructor setting the iterator to the first sparse matrix element
SparseMatConstIterator_(const SparseMat *_m)
SparseMatConstIterator_()
the default constructor
Read-Only Sparse Matrix Iterator.
Definition mat.hpp:3260
uchar * ptr
Definition mat.hpp:3291
size_t hashidx
Definition mat.hpp:3290
const _Tp & value() const
template method returning the current matrix element
SparseMatConstIterator(const SparseMat *_m)
the full constructor setting the iterator to the first sparse matrix element
SparseMatConstIterator(const SparseMatConstIterator &it)
the copy constructor
const SparseMat * m
Definition mat.hpp:3289
const SparseMat::Node * node() const
returns the current node of the sparse matrix. it.node->idx is the current element index
void seekEnd()
moves iterator to the element after the last element
SparseMatConstIterator()
the default constructor
Template Read-Write Sparse Matrix Iterator Class.
Definition mat.hpp:3372
std::forward_iterator_tag iterator_category
Definition mat.hpp:3375
SparseMatIterator_(SparseMat *_m)
SparseMatIterator_()
the default constructor
SparseMatIterator_(const SparseMatIterator_ &it)
the copy constructor
SparseMatIterator_(SparseMat_< _Tp > *_m)
the full constructor setting the iterator to the first sparse matrix element
Read-write Sparse Matrix Iterator.
Definition mat.hpp:3304
SparseMatIterator(SparseMat *_m, const int *idx)
the full constructor setting the iterator to the specified sparse matrix element
SparseMatIterator()
the default constructor
SparseMat::Node * node() const
returns pointer to the current sparse matrix node. it.node->idx is the index of the current element (...
SparseMatIterator(const SparseMatIterator &it)
the copy constructor
SparseMatIterator(SparseMat *_m)
the full constructor setting the iterator to the first sparse matrix element
_Tp & value() const
returns read-write reference to the current sparse matrix element
Template sparse n-dimensional array class derived from SparseMat.
Definition mat.hpp:3013
SparseMat_(const Mat &m)
converts dense matrix to the sparse form
void create(int dims, const int *_sizes)
equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type)
SparseMatIterator_< _Tp > end()
returns sparse matrix iterator pointing to the element following the last sparse matrix element
SparseMat_()
the default constructor
_Tp & ref(int i0, size_t *hashval=0)
equivalent to SparseMat::ref<_Tp>(i0, hashval)
SparseMatConstIterator_< _Tp > const_iterator
Definition mat.hpp:3016
SparseMatIterator_< _Tp > begin()
returns sparse matrix iterator pointing to the first sparse matrix element
SparseMat_(const SparseMat_ &m)
the copy constructor. This is O(1) operation - no data is copied
_Tp operator()(int i0, int i1, size_t *hashval=0) const
equivalent to SparseMat::value<_Tp>(i0, i1, hashval)
_Tp & ref(const int *idx, size_t *hashval=0)
equivalent to SparseMat::ref<_Tp>(idx, hashval)
SparseMatConstIterator_< _Tp > end() const
returns read-only sparse matrix iterator pointing to the element following the last sparse matrix ele...
SparseMatConstIterator_< _Tp > begin() const
returns read-only sparse matrix iterator pointing to the first sparse matrix element
SparseMatIterator_< _Tp > iterator
Definition mat.hpp:3015
SparseMat_(const SparseMat &m)
the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted
_Tp operator()(int i0, int i1, int i2, size_t *hashval=0) const
equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval)
int type() const
converts sparse matrix to the old-style CvSparseMat. All the elements are copied
_Tp & ref(int i0, int i1, int i2, size_t *hashval=0)
equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval)
_Tp operator()(int i0, size_t *hashval=0) const
equivalent to SparseMat::value<_Tp>(i0, hashval)
SparseMat_(int dims, const int *_sizes)
the full constructor equivalent to SparseMat(dims, _sizes, DataType<_Tp>::type)
_Tp & ref(int i0, int i1, size_t *hashval=0)
equivalent to SparseMat::ref<_Tp>(i0, i1, hashval)
int depth() const
returns depth of the matrix elements
_Tp operator()(const int *idx, size_t *hashval=0) const
equivalent to SparseMat::value<_Tp>(idx, hashval)
CV_NODISCARD_STD SparseMat_ clone() const
makes full copy of the matrix. All the elements are duplicated
int channels() const
returns the number of channels in each matrix element
The class SparseMat represents multi-dimensional sparse numerical arrays.
Definition mat.hpp:2735
const _Tp * find(const int *idx, size_t *hashval=0) const
returns pointer to the specified element (nD case)
SparseMatIterator_< _Tp > begin()
returns the sparse matrix iterator at the matrix beginning
SparseMatConstIterator begin() const
returns the read-only sparse matrix iterator at the matrix beginning
const int * size() const
returns the array of sizes, or NULL if the matrix is not allocated
int dims() const
returns the matrix dimensionality
void copyTo(SparseMat &m) const
copies all the data to the destination matrix. All the previous content of m is erased
~SparseMat()
the destructor
void clear()
sets all the sparse matrix elements to 0, which means clearing the hash table.
int type() const
returns type of sparse matrix elements
_Tp value(int i0, int i1, int i2, size_t *hashval=0) const
returns value of the specified element (3D case)
size_t elemSize1() const
returns elemSize()/channels()
Hdr * hdr
Definition mat.hpp:2994
SparseMatConstIterator end() const
returns the read-only sparse matrix iterator at the matrix end
_Tp & ref(const int *idx, size_t *hashval=0)
returns reference to the specified element (nD case)
SparseMatConstIterator const_iterator
Definition mat.hpp:2738
int size(int i) const
returns the size of i-th matrix dimension (or 0)
const _Tp * find(int i0, int i1, int i2, size_t *hashval=0) const
returns pointer to the specified element (3D case)
_Tp value(int i0, int i1, size_t *hashval=0) const
returns value of the specified element (2D case)
_Tp & ref(int i0, int i1, int i2, size_t *hashval=0)
returns reference to the specified element (3D case)
void convertTo(SparseMat &m, int rtype, double alpha=1) const
multiplies all the matrix elements by the specified scale factor alpha and converts the results to th...
uchar * ptr(int i0, int i1, bool createMissing, size_t *hashval=0)
returns pointer to the specified element (2D case)
void removeNode(size_t hidx, size_t nidx, size_t previdx)
size_t hash(const int *idx) const
computes the element hash value (nD case)
SparseMat(int dims, const int *_sizes, int _type)
_Tp value(int i0, size_t *hashval=0) const
returns value of the specified element (1D case)
void convertTo(Mat &m, int rtype, double alpha=1, double beta=0) const
converts sparse matrix to dense n-dim matrix with optional type conversion and scaling.
size_t hash(int i0, int i1, int i2) const
computes the element hash value (3D case)
void copyTo(Mat &m) const
converts sparse matrix to dense matrix.
uchar * ptr(const int *idx, bool createMissing, size_t *hashval=0)
returns pointer to the specified element (nD case)
SparseMatIterator_< _Tp > end()
returns the typed sparse matrix iterator at the matrix end
void erase(const int *idx, size_t *hashval=0)
erases the specified element (nD case)
SparseMatIterator end()
returns the sparse matrix iterator at the matrix end
SparseMat(const SparseMat &m)
Node * node(size_t nidx)
CV_NODISCARD_STD SparseMat clone() const
creates full copy of the matrix
const _Tp & value(const Node *n) const
returns the value stored in the sparse martix node
const Node * node(size_t nidx) const
const _Tp * find(int i0, int i1, size_t *hashval=0) const
returns pointer to the specified element (2D case)
void addref()
manually increments the reference counter to the header.
_Tp & ref(int i0, size_t *hashval=0)
returns reference to the specified element (1D case)
SparseMat()
Various SparseMat constructors.
_Tp & ref(int i0, int i1, size_t *hashval=0)
returns reference to the specified element (2D case)
uchar * newNode(const int *idx, size_t hashval)
SparseMatIterator iterator
Definition mat.hpp:2737
const _Tp * find(int i0, size_t *hashval=0) const
returns pointer to the specified element (1D case)
size_t hash(int i0, int i1) const
computes the element hash value (2D case)
uchar * ptr(int i0, int i1, int i2, bool createMissing, size_t *hashval=0)
returns pointer to the specified element (3D case)
void erase(int i0, int i1, int i2, size_t *hashval=0)
erases the specified element (3D case)
uchar * ptr(int i0, bool createMissing, size_t *hashval=0)
returns pointer to the specified element (1D case)
SparseMatConstIterator_< _Tp > end() const
returns the typed read-only sparse matrix iterator at the matrix end
int channels() const
returns the number of channels
size_t nzcount() const
returns the number of non-zero elements (=the number of hash table nodes)
SparseMatConstIterator_< _Tp > begin() const
returns the read-only sparse matrix iterator at the matrix beginning
SparseMatIterator begin()
returns the sparse matrix iterator at the matrix beginning
void erase(int i0, int i1, size_t *hashval=0)
erases the specified element (2D case)
int flags
Definition mat.hpp:2993
void create(int dims, const int *_sizes, int _type)
reallocates sparse matrix.
void assignTo(SparseMat &m, int type=-1) const
int depth() const
returns the depth of sparse matrix elements
size_t hash(int i0) const
computes the element hash value (1D case)
_Tp value(const int *idx, size_t *hashval=0) const
returns value of the specified element (nD case)
size_t elemSize() const
converts sparse matrix to the old-style representation; all the elements are copied.
void resizeHashTab(size_t newsize)
SparseMat(const Mat &m)
_Tp & value(Node *n)
returns the value stored in the sparse martix node
Definition mat.hpp:2433
static CV_NODISCARD_STD UMat zeros(int ndims, const int *sz, int type, UMatUsageFlags usageFlags)
void updateContinuityFlag()
internal use method: updates the continuity flag
void create(int ndims, const int *sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
UMat operator()(const Range *ranges) const
UMat(const std::vector< _Tp > &vec, bool copyData=false)
builds matrix from std::vector with or without copying the data
static CV_NODISCARD_STD UMat diag(const UMat &d, UMatUsageFlags usageFlags)
constructs a square diagonal matrix which main diagonal is vector "d"
UMat(int rows, int cols, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
constructs 2D matrix and fills it with the specified value _s.
int cols
number of columns in the matrix; -1 when the matrix has more than 2 dimensions
Definition mat.hpp:2623
UMat & setTo(InputArray value, InputArray mask=noArray())
sets some of the matrix elements to s, according to the mask
UMat(Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
void create(const std::vector< int > &sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
MatAllocator * allocator
custom allocator
Definition mat.hpp:2626
static MatAllocator * getStdAllocator()
and the standard allocator
UMat reshape(int cn, int rows=0) const
creates alternative matrix header for the same data, with different
static CV_NODISCARD_STD UMat zeros(int rows, int cols, int type)
Definition mat.hpp:2523
static CV_NODISCARD_STD UMat ones(Size size, int type)
Definition mat.hpp:2530
UMat & adjustROI(int dtop, int dbottom, int dleft, int dright)
moves/resizes the current matrix ROI inside the parent matrix.
static CV_NODISCARD_STD UMat eye(int rows, int cols, int type)
Definition mat.hpp:2534
void copySize(const UMat &m)
internal use function; properly re-allocates _size, _step arrays
size_t elemSize1() const
returns the size of element channel in bytes.
size_t elemSize() const
returns element size in bytes,
Mat getMat(AccessFlag flags) const
int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const
returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number...
static CV_NODISCARD_STD UMat zeros(Size size, int type)
Definition mat.hpp:2524
static CV_NODISCARD_STD UMat ones(Size size, int type, UMatUsageFlags usageFlags)
CV_NODISCARD_STD UMat clone() const
returns deep copy of the matrix, i.e. the data is copied
static CV_NODISCARD_STD UMat ones(int ndims, const int *sz, int type)
Definition mat.hpp:2531
UMat diag(int d=0) const
static CV_NODISCARD_STD UMat ones(int rows, int cols, int type)
Definition mat.hpp:2529
UMat row(int y) const
returns a new matrix header for the specified row
UMat(UMatUsageFlags usageFlags=USAGE_DEFAULT) CV_NOEXCEPT
default constructor
UMat(const UMat &m, const std::vector< Range > &ranges)
int channels() const
returns element type, similar to CV_MAT_CN(cvmat->type)
size_t step1(int i=0) const
returns step/elemSize1()
UMat(int ndims, const int *sizes, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
int type() const
returns element type, similar to CV_MAT_TYPE(cvmat->type)
void locateROI(Size &wholeSize, Point &ofs) const
locates matrix header within a parent matrix. See below
static CV_NODISCARD_STD UMat zeros(Size size, int type, UMatUsageFlags usageFlags)
UMat(const UMat &m)
copy constructor
double dot(InputArray m) const
computes dot-product
void convertTo(OutputArray m, int rtype, double alpha=1, double beta=0) const
converts matrix to another datatype with optional scaling. See cvConvertScale.
MatSize size
dimensional size of the matrix; accessible in various formats
Definition mat.hpp:2644
UMat operator()(const Rect &roi) const
int dims
the matrix dimensionality, >= 2
Definition mat.hpp:2617
static CV_NODISCARD_STD UMat diag(const UMat &d)
Definition mat.hpp:2486
int rows
number of rows in the matrix; -1 when the matrix has more than 2 dimensions
Definition mat.hpp:2620
UMat rowRange(int startrow, int endrow) const
... for the specified row span
UMat operator()(Range rowRange, Range colRange) const
extracts a rectangular sub-matrix
int depth() const
returns element type, similar to CV_MAT_DEPTH(cvmat->type)
void deallocate()
deallocates the matrix data
bool empty() const
returns true if matrix data is NULL
MatStep step
number of bytes each matrix element/row/plane/dimension occupies
Definition mat.hpp:2647
UMat(const UMat &m, const Range *ranges)
static CV_NODISCARD_STD UMat eye(Size size, int type, UMatUsageFlags usageFlags)
void addref()
increases the reference counter; use with care to avoid memleaks
void copyTo(OutputArray m, InputArray mask) const
copies those matrix elements to "m" that are marked with non-zero mask elements.
void * handle(AccessFlag accessFlags) const
UMat(Size size, int type, const Scalar &s, UMatUsageFlags usageFlags=USAGE_DEFAULT)
static CV_NODISCARD_STD UMat eye(Size size, int type)
Definition mat.hpp:2535
UMatUsageFlags usageFlags
usage flags for allocator; recommend do not set directly, instead set during construct/create/getUMat
Definition mat.hpp:2629
static CV_NODISCARD_STD UMat zeros(int rows, int cols, int type, UMatUsageFlags usageFlags)
Matlab-style matrix initialization.
void release()
decreases reference counter;
UMat(const UMat &m, const Rect &roi)
UMat col(int x) const
returns a new matrix header for the specified column
UMat(UMat &&m)
static CV_NODISCARD_STD UMat eye(int rows, int cols, int type, UMatUsageFlags usageFlags)
void copyTo(OutputArray m) const
copies the matrix content to "m".
UMat inv(int method=DECOMP_LU) const
matrix inversion by means of matrix expressions
size_t total() const
returns the total number of matrix elements
void create(Size size, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
UMat reshape(int cn, int newndims, const int *newsz) const
UMat t() const
matrix transposition by means of matrix expressions
~UMat()
destructor - calls release()
UMat rowRange(const Range &r) const
bool isSubmatrix() const
returns true if the matrix is a submatrix of another matrix
UMatData * u
black-box container of UMat data
Definition mat.hpp:2638
int flags
Definition mat.hpp:2614
UMat colRange(int startcol, int endcol) const
... for the specified column span
UMat(int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
constructs 2D matrix of the specified size and type
UMat colRange(const Range &r) const
static CV_NODISCARD_STD UMat ones(int ndims, const int *sz, int type, UMatUsageFlags usageFlags)
static CV_NODISCARD_STD UMat ones(int rows, int cols, int type, UMatUsageFlags usageFlags)
void assignTo(UMat &m, int type=-1) const
size_t offset
offset of the submatrix (or 0)
Definition mat.hpp:2641
UMat(int ndims, const int *sizes, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
constructs n-dimensional matrix
static CV_NODISCARD_STD UMat zeros(int ndims, const int *sz, int type)
Definition mat.hpp:2525
UMat operator()(const std::vector< Range > &ranges) const
UMat mul(InputArray m, double scale=1) const
per-element matrix multiplication by means of matrix expressions
bool isContinuous() const
returns true iff the matrix data is continuous
void ndoffset(size_t *ofs) const
void create(int rows, int cols, int type, UMatUsageFlags usageFlags=USAGE_DEFAULT)
allocates new matrix data unless the matrix already has specified size and type.
UMat(const UMat &m, const Range &rowRange, const Range &colRange=Range::all())
creates a matrix header for a part of the bigger matrix
Template class for short numerical vectors, a partial case of Matx.
Definition matx.hpp:369
This is the proxy class for passing read-only input arrays into OpenCV functions.
Definition mat.hpp:160
void getUMatVector(std::vector< UMat > &umv) const
int getFlags() const
_InputArray(const cuda::GpuMat &d_mat)
Size size(int i=-1) const
void init(int _flags, const void *_obj)
KindFlag
Definition mat.hpp:162
void getMatVector(std::vector< Mat > &mv) const
void copyTo(const _OutputArray &arr, const _InputArray &mask) const
_InputArray(const cudev::GpuMat_< _Tp > &m)
_InputArray(const std::vector< std::vector< bool > > &)=delete
bool isUMatVector() const
cuda::GpuMat getGpuMat() const
void init(int _flags, const void *_obj, Size _sz)
size_t total(int i=-1) const
_InputArray(const Mat &m)
bool isGpuMatVector() const
Size getSz() const
int depth(int i=-1) const
_InputArray(const MatExpr &expr)
_InputArray(const std::array< _Tp, _Nm > &arr)
_InputArray(const std::vector< std::vector< _Tp > > &vec)
static _InputArray rawIn(const std::vector< _Tp > &vec)
int rows(int i=-1) const
_InputArray(const ogl::Buffer &buf)
bool isGpuMat() const
_InputArray(const double &val)
static _InputArray rawIn(const std::array< _Tp, _Nm > &arr)
_InputArray(const Mat_< _Tp > &m)
_InputArray(const cuda::HostMem &cuda_mem)
size_t offset(int i=-1) const
_InputArray(int _flags, void *_obj)
bool isMat() const
Size sz
Definition mat.hpp:262
bool sameSize(const _InputArray &arr) const
bool isSubmatrix(int i=-1) const
_InputArray(const Matx< _Tp, m, n > &matx)
int sizend(int *sz, int i=-1) const
_InputArray(const std::array< Mat, _Nm > &arr)
bool isUMat() const
_InputArray(const std::vector< cuda::GpuMat > &d_mat_array)
int dims(int i=-1) const
void copyTo(const _OutputArray &arr) const
void * getObj() const
Mat getMat(int idx=-1) const
_InputArray(const std::vector< Mat_< _Tp > > &vec)
void * obj
Definition mat.hpp:261
void getGpuMatVector(std::vector< cuda::GpuMat > &gpumv) const
size_t step(int i=-1) const
_InputArray(const std::vector< bool > &vec)
_InputArray::KindFlag kind() const
int type(int i=-1) const
int cols(int i=-1) const
ogl::Buffer getOGlBuffer() const
_InputArray(const std::vector< UMat > &umv)
bool empty() const
Mat getMat_(int idx=-1) const
bool isMatVector() const
bool isVector() const
_InputArray(const std::vector< _Tp > &vec)
_InputArray(const UMat &um)
_InputArray(const std::vector< Mat > &vec)
int channels(int i=-1) const
bool isMatx() const
UMat getUMat(int idx=-1) const
bool isContinuous(int i=-1) const
int flags
Definition mat.hpp:260
_InputArray(const _Tp *vec, int n)
Definition mat.hpp:387
_InputOutputArray(cudev::GpuMat_< _Tp > &m)
_InputOutputArray(const cuda::GpuMat &d_mat)
_InputOutputArray(std::array< _Tp, _Nm > &arr)
_InputOutputArray(const cudev::GpuMat_< _Tp > &m)
_InputOutputArray(const std::vector< std::vector< _Tp > > &vec)
_InputOutputArray(const ogl::Buffer &buf)
_InputOutputArray(const std::vector< Mat > &vec)
_InputOutputArray(cuda::HostMem &cuda_mem)
_InputOutputArray(std::vector< Mat > &vec)
_InputOutputArray(std::vector< std::vector< _Tp > > &vec)
_InputOutputArray(const std::vector< _Tp > &vec)
_InputOutputArray(const std::vector< UMat > &vec)
_InputOutputArray rawInOut(std::array< _Tp, _Nm > &arr)
_InputOutputArray(const cuda::HostMem &cuda_mem)
_InputOutputArray(std::vector< _Tp > &vec)
_InputOutputArray(const std::array< Mat, _Nm > &arr)
_InputOutputArray(cuda::GpuMat &d_mat)
_InputOutputArray(const Mat &m)
_InputOutputArray(Matx< _Tp, m, n > &matx)
_InputOutputArray(const std::vector< cuda::GpuMat > &d_mat)
_InputOutputArray(const Mat_< _Tp > &m)
_InputOutputArray(std::vector< Mat_< _Tp > > &vec)
_InputOutputArray(Mat_< _Tp > &m)
_InputOutputArray(std::array< Mat, _Nm > &arr)
static _InputOutputArray rawInOut(std::vector< _Tp > &vec)
_InputOutputArray(std::vector< UMat > &vec)
_InputOutputArray(const UMat &m)
_InputOutputArray(_Tp *vec, int n)
_InputOutputArray(ogl::Buffer &buf)
_InputOutputArray(const _Tp *vec, int n)
_InputOutputArray(const std::array< _Tp, _Nm > &arr)
_InputOutputArray(int _flags, void *_obj)
_InputOutputArray(const Matx< _Tp, m, n > &matx)
_InputOutputArray(std::vector< bool > &vec)=delete
_InputOutputArray(const std::vector< Mat_< _Tp > > &vec)
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition mat.hpp:296
Mat & getMatRef(int i=-1) const
_OutputArray(std::vector< Mat_< _Tp > > &vec)
_OutputArray(UMat &m)
_OutputArray(ogl::Buffer &buf)
static _OutputArray rawOut(std::array< _Tp, _Nm > &arr)
_OutputArray(std::vector< std::vector< bool > > &)=delete
_OutputArray(Matx< _Tp, m, n > &matx)
_OutputArray(const std::vector< std::vector< _Tp > > &vec)
static _OutputArray rawOut(std::vector< _Tp > &vec)
bool fixedType() const
_OutputArray(std::array< _Tp, _Nm > &arr)
_OutputArray(const std::vector< _Tp > &vec)
bool needed() const
cuda::GpuMat & getGpuMatRef() const
std::vector< cuda::GpuMat > & getGpuMatVecRef() const
_OutputArray(std::vector< UMat > &vec)
_OutputArray(std::vector< cuda::GpuMat > &d_mat)
void create(Size sz, int type, int i=-1, bool allowTransposed=false, _OutputArray::DepthMask fixedDepthMask=static_cast< _OutputArray::DepthMask >(0)) const
void clear() const
_OutputArray(const ogl::Buffer &buf)
_OutputArray(const Mat_< _Tp > &m)
_OutputArray(const Mat &m)
void setTo(const _InputArray &value, const _InputArray &mask=_InputArray()) const
void create(int dims, const int *size, int type, int i=-1, bool allowTransposed=false, _OutputArray::DepthMask fixedDepthMask=static_cast< _OutputArray::DepthMask >(0)) const
_OutputArray(const _Tp *vec, int n)
_OutputArray(cuda::GpuMat &d_mat)
_OutputArray(cudev::GpuMat_< _Tp > &m)
void assign(const UMat &u) const
void assign(const std::vector< UMat > &v) const
_OutputArray(_Tp *vec, int n)
_OutputArray(const std::vector< UMat > &vec)
_OutputArray(const std::vector< Mat > &vec)
_OutputArray(std::vector< std::vector< _Tp > > &vec)
_OutputArray(const std::vector< Mat_< _Tp > > &vec)
void release() const
_OutputArray(Mat_< _Tp > &m)
_OutputArray(const std::array< Mat, _Nm > &arr)
ogl::Buffer & getOGlBufferRef() const
_OutputArray(int _flags, void *_obj)
DepthMask
Definition mat.hpp:299
_OutputArray(cuda::HostMem &cuda_mem)
_OutputArray(const std::vector< cuda::GpuMat > &d_mat)
_OutputArray(std::array< Mat, _Nm > &arr)
_OutputArray(const std::array< _Tp, _Nm > &arr)
_OutputArray(const cuda::HostMem &cuda_mem)
_OutputArray(const UMat &m)
void move(Mat &m) const
void assign(const Mat &m) const
_OutputArray(const cudev::GpuMat_< _Tp > &m)
void move(UMat &u) const
bool fixedSize() const
_OutputArray(std::vector< Mat > &vec)
void assign(const std::vector< Mat > &v) const
void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, _OutputArray::DepthMask fixedDepthMask=static_cast< _OutputArray::DepthMask >(0)) const
_OutputArray(Mat &m)
_OutputArray(const cuda::GpuMat &d_mat)
_OutputArray(std::vector< _Tp > &vec)
cuda::HostMem & getHostMemRef() const
UMat & getUMatRef(int i=-1) const
void createSameSize(const _InputArray &arr, int mtype) const
_OutputArray(std::vector< bool > &vec)=delete
_OutputArray(const Matx< _Tp, m, n > &matx)
Base storage class for GPU memory with reference counting.
Definition cuda.hpp:106
Class with reference counting wrapping special memory type allocation functions from CUDA.
Definition cuda.hpp:790
Smart pointer for OpenGL buffer object with reference counting.
Definition opengl.hpp:80
void CV_EXPORTS_W copyTo(InputArray src, OutputArray dst, InputArray mask)
This is an overloaded member function, provided for convenience (python) Copies the matrix to another...
@ DECOMP_LU
Definition base.hpp:135
static _InputOutputArray rawInOut(_Tp &v)
static _InputArray rawIn(_Tp &v)
static bool operator!=(const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b)
UMatUsageFlags
Usage flags for allocator.
Definition mat.hpp:464
CV_EXPORTS InputOutputArray noArray()
static bool operator==(const Matx< _Tp, m, n > &a, const Matx< _Tp, m, n > &b)
InputArray InputArrayOfArrays
Definition mat.hpp:443
AccessFlag
Definition mat.hpp:65
static _OutputArray rawOut(_Tp &v)
InputOutputArray InputOutputArrayOfArrays
Definition mat.hpp:447
OutputArray OutputArrayOfArrays
Definition mat.hpp:445
const _OutputArray & OutputArray
Definition mat.hpp:444
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition mat.hpp:442
const _InputOutputArray & InputOutputArray
Definition mat.hpp:446
@ USAGE_ALLOCATE_SHARED_MEMORY
Definition mat.hpp:470
@ USAGE_ALLOCATE_HOST_MEMORY
Definition mat.hpp:468
@ __UMAT_USAGE_FLAGS_32BIT
Definition mat.hpp:472
@ USAGE_DEFAULT
Definition mat.hpp:465
@ USAGE_ALLOCATE_DEVICE_MEMORY
Definition mat.hpp:469
@ ACCESS_FAST
Definition mat.hpp:66
@ ACCESS_READ
Definition mat.hpp:65
@ ACCESS_MASK
Definition mat.hpp:66
@ ACCESS_RW
Definition mat.hpp:66
@ ACCESS_WRITE
Definition mat.hpp:65
int rows
Definition core_c.h:257
int CvScalar value
Definition core_c.h:720
int int idx1
Definition core_c.h:654
int int void int total
Definition core_c.h:1689
const CvArr const CvArr const CvArr CvArr int flags
Definition core_c.h:1342
int int channels
Definition core_c.h:100
double double end
Definition core_c.h:1381
const void * elem
Definition core_c.h:1715
CvArr * dst
Definition core_c.h:875
int cols
Definition core_c.h:221
int int int idx2
Definition core_c.h:656
double const CvArr double beta
Definition core_c.h:1094
Cv_iplAllocateImageData Cv_iplDeallocate deallocate
Definition core_c.h:1964
const int * idx
Definition core_c.h:668
CvScalar scale
Definition core_c.h:1088
CvSize size
Definition core_c.h:112
int int type
Definition core_c.h:221
void int step
Definition core_c.h:905
CvArr const CvArr * mask
Definition core_c.h:589
CvArr * arr
Definition core_c.h:1247
int depth
Definition core_c.h:100
void * data
Definition core_c.h:427
const CvArr CvArr * x
Definition core_c.h:1195
double alpha
Definition core_c.h:1093
int dims
Definition core_c.h:464
int idx0
Definition core_c.h:652
const CvArr * y
Definition core_c.h:1187
const int * sizes
Definition core_c.h:440
#define CV_8S
Definition interface.h:74
#define CV_16F
Definition interface.h:80
#define CV_64F
Definition interface.h:79
#define CV_8U
Definition interface.h:73
#define CV_32S
Definition interface.h:77
#define CV_32F
Definition interface.h:78
unsigned char uchar
Definition interface.h:51
#define CV_16S
Definition interface.h:76
unsigned short ushort
Definition interface.h:52
#define CV_16U
Definition interface.h:75
CV_INLINE v_reg< _Tp, n > operator|(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
Bitwise OR.
CV_INLINE v_reg< _Tp, n > operator&(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
Bitwise AND.
CV_INLINE v_reg< _Tp, n > operator/(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
Divide values.
CV_INLINE v_reg< _Tp, n > operator~(const v_reg< _Tp, n > &a)
Bitwise NOT.
CV_INLINE v_reg< _Tp, n > operator^(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
Bitwise XOR.
#define CV_EXPORTS
Definition cvdef.h:435
#define CV_MAT_CONT_FLAG
Definition cvdef.h:499
#define CV_ENUM_FLAGS(EnumType)
Definition cvdef.h:649
#define CV_NODISCARD_STD
Definition cvdef.h:767
#define CV_NOEXCEPT
Definition cvdef.h:800
#define __CV_ENUM_FLAGS_BITWISE_AND(EnumType, Arg1Type, Arg2Type)
Definition cvdef.h:611
#define CV_SUBMAT_FLAG
Definition cvdef.h:503
#define CV__DEBUG_NS_BEGIN
Definition cvdef.h:69
#define CV__DEBUG_NS_END
Definition cvdef.h:70
CvPoint2D32f pt[4]
Definition imgproc_c.h:571
CvRect r
Definition imgproc_c.h:984
float ** ranges
Definition imgproc_c.h:636
const CvArr CvArr int method
Definition imgproc_c.h:384
CvArr CvArr IplConvKernel int operation
Definition imgproc_c.h:330
CV_EXPORTS OutputArray int double double InputArray mask
Definition imgproc.hpp:2132
CV_EXPORTS_W void resize(InputArray src, OutputArray dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR)
Resizes an image.
"black box" representation of the file storage associated with a file on disk.
Definition calib3d.hpp:441
DualQuat< T > inv(const DualQuat< T > &dq, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
Definition dualquaternion.inl.hpp:187
DualQuat< T > operator-(const DualQuat< T > &q, const T a)
Definition dualquaternion.inl.hpp:255
static bool operator<(const FileNodeIterator &it1, const FileNodeIterator &it2)
Definition persistence.hpp:1303
DualQuat< T > operator+(const T a, const DualQuat< T > &q)
Definition dualquaternion.inl.hpp:243
DualQuat< T > operator*(const T a, const DualQuat< T > &q)
Definition dualquaternion.inl.hpp:274
Definition mat.hpp:588
MatSize(int *_p) CV_NOEXCEPT
int dims() const CV_NOEXCEPT
Definition mat.hpp:602
MatStep() CV_NOEXCEPT
the sparse matrix header
Definition mat.hpp:2744
int valueOffset
Definition mat.hpp:2749
size_t nodeSize
Definition mat.hpp:2750
std::vector< uchar > pool
Definition mat.hpp:2753
size_t freeList
Definition mat.hpp:2752
int refcount
Definition mat.hpp:2747
int dims
Definition mat.hpp:2748
std::vector< size_t > hashtab
Definition mat.hpp:2754
Hdr(int _dims, const int *_sizes, int _type)
size_t nodeCount
Definition mat.hpp:2751
sparse matrix node - element of a hash table
Definition mat.hpp:2760
size_t hashval
hash value
Definition mat.hpp:2762
size_t next
index of the next node in the same hash table entry
Definition mat.hpp:2764
Definition mat.hpp:545
std::shared_ptr< void > allocatorContext
Definition mat.hpp:582
void * userdata
Definition mat.hpp:578
uchar * data
Definition mat.hpp:572
int refcount
Definition mat.hpp:571
void markDeviceMemMapped(bool flag)
int allocatorFlags_
Definition mat.hpp:579
MemoryFlag
Definition mat.hpp:546
UMatData * originalUMatData
Definition mat.hpp:581
bool hostCopyObsolete() const
void markHostCopyObsolete(bool flag)
bool deviceCopyObsolete() const
const MatAllocator * currAllocator
Definition mat.hpp:569
bool tempCopiedUMat() const
int mapcount
Definition mat.hpp:580
void markDeviceCopyObsolete(bool flag)
const MatAllocator * prevAllocator
Definition mat.hpp:568
size_t size
Definition mat.hpp:574
void * handle
Definition mat.hpp:577
UMatData::MemoryFlag flags
Definition mat.hpp:576
UMatData(const MatAllocator *allocator)
bool deviceMemMapped() const
bool tempUMat() const
bool copyOnMap() const
uchar * origdata
Definition mat.hpp:573
int urefcount
Definition mat.hpp:570