OpenCV
5.0.0alpha
Open Source Computer Vision
|
Template sparse n-dimensional array class derived from SparseMat. More...
#include <opencv2/core/mat.hpp>
Public Types | |
typedef SparseMatConstIterator_< _Tp > | const_iterator |
typedef SparseMatIterator_< _Tp > | iterator |
Public Types inherited from cv::SparseMat | |
enum | { MAGIC_VAL =0x42FD0000 , MAX_DIM =32 , HASH_SCALE =0x5bd1e995 , HASH_BIT =0x80000000 } |
typedef SparseMatConstIterator | const_iterator |
typedef SparseMatIterator | iterator |
Public Member Functions | |
SparseMat_ () | |
the default constructor | |
SparseMat_ (const Mat &m) | |
converts dense matrix to the sparse form | |
SparseMat_ (const SparseMat &m) | |
the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted | |
SparseMat_ (const SparseMat_ &m) | |
the copy constructor. This is O(1) operation - no data is copied | |
SparseMat_ (int dims, const int *_sizes) | |
the full constructor equivalent to SparseMat(dims, _sizes, DataType<_Tp>::type) | |
SparseMatIterator_< _Tp > | begin () |
returns sparse matrix iterator pointing to the first sparse matrix element | |
SparseMatConstIterator_< _Tp > | begin () const |
returns read-only sparse matrix iterator pointing to the first sparse matrix element | |
int | channels () const |
returns the number of channels in each matrix element | |
CV_NODISCARD_STD SparseMat_ | clone () const |
makes full copy of the matrix. All the elements are duplicated | |
void | create (int dims, const int *_sizes) |
equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type) | |
int | depth () const |
returns depth of the matrix elements | |
SparseMatIterator_< _Tp > | end () |
returns sparse matrix iterator pointing to the element following the last sparse matrix element | |
SparseMatConstIterator_< _Tp > | end () const |
returns read-only sparse matrix iterator pointing to the element following the last sparse matrix element | |
_Tp | operator() (const int *idx, size_t *hashval=0) const |
equivalent to SparseMat::value<_Tp>(idx, hashval) | |
_Tp | operator() (int i0, int i1, int i2, size_t *hashval=0) const |
equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval) | |
_Tp | operator() (int i0, int i1, size_t *hashval=0) const |
equivalent to SparseMat::value<_Tp>(i0, i1, hashval) | |
_Tp | operator() (int i0, size_t *hashval=0) const |
equivalent to SparseMat::value<_Tp>(i0, hashval) | |
SparseMat_ & | operator= (const Mat &m) |
converts dense matrix to the sparse form | |
SparseMat_ & | operator= (const SparseMat &m) |
converts the old-style sparse matrix to the C++ class. All the elements are copied | |
SparseMat_ & | operator= (const SparseMat_ &m) |
the assignment operator. This is O(1) operation - no data is copied | |
_Tp & | ref (const int *idx, size_t *hashval=0) |
equivalent to SparseMat::ref<_Tp>(idx, hashval) | |
_Tp & | ref (int i0, int i1, int i2, size_t *hashval=0) |
equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval) | |
_Tp & | ref (int i0, int i1, size_t *hashval=0) |
equivalent to SparseMat::ref<_Tp>(i0, i1, hashval) | |
_Tp & | ref (int i0, size_t *hashval=0) |
equivalent to SparseMat::ref<_Tp>(i0, hashval) | |
int | type () const |
converts sparse matrix to the old-style CvSparseMat. All the elements are copied | |
Public Member Functions inherited from cv::SparseMat | |
SparseMat () | |
Various SparseMat constructors. | |
SparseMat (const Mat &m) | |
SparseMat (const SparseMat &m) | |
SparseMat (int dims, const int *_sizes, int _type) | |
~SparseMat () | |
the destructor | |
void | addref () |
manually increments the reference counter to the header. | |
void | assignTo (SparseMat &m, int type=-1) const |
int | channels () const |
returns the number of channels | |
void | clear () |
sets all the sparse matrix elements to 0, which means clearing the hash table. | |
CV_NODISCARD_STD SparseMat | clone () const |
creates full copy of the matrix | |
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. | |
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 the specified data type | |
void | copyTo (Mat &m) const |
converts sparse matrix to dense matrix. | |
void | copyTo (SparseMat &m) const |
copies all the data to the destination matrix. All the previous content of m is erased | |
void | create (int dims, const int *_sizes, int _type) |
reallocates sparse matrix. | |
int | depth () const |
returns the depth of sparse matrix elements | |
int | dims () const |
returns the matrix dimensionality | |
size_t | elemSize () const |
converts sparse matrix to the old-style representation; all the elements are copied. | |
size_t | elemSize1 () const |
returns elemSize()/channels() | |
SparseMatIterator | end () |
returns the sparse matrix iterator at the matrix end | |
template<typename _Tp > | |
SparseMatIterator_< _Tp > | end () |
returns the typed sparse matrix iterator at the matrix end | |
SparseMatConstIterator | end () const |
returns the read-only sparse matrix iterator at the matrix end | |
template<typename _Tp > | |
SparseMatConstIterator_< _Tp > | end () const |
returns the typed read-only sparse matrix iterator at the matrix end | |
void | erase (const int *idx, size_t *hashval=0) |
erases the specified element (nD case) | |
void | erase (int i0, int i1, int i2, size_t *hashval=0) |
erases the specified element (3D case) | |
void | erase (int i0, int i1, size_t *hashval=0) |
erases the specified element (2D case) | |
size_t | hash (const int *idx) const |
computes the element hash value (nD case) | |
size_t | hash (int i0) const |
computes the element hash value (1D case) | |
size_t | hash (int i0, int i1) const |
computes the element hash value (2D case) | |
size_t | hash (int i0, int i1, int i2) const |
computes the element hash value (3D case) | |
uchar * | newNode (const int *idx, size_t hashval) |
Node * | node (size_t nidx) |
const Node * | node (size_t nidx) const |
size_t | nzcount () const |
returns the number of non-zero elements (=the number of hash table nodes) | |
SparseMat & | operator= (const Mat &m) |
equivalent to the corresponding constructor | |
SparseMat & | operator= (const SparseMat &m) |
assignment operator. This is O(1) operation, i.e. no data is copied | |
void | release () |
void | removeNode (size_t hidx, size_t nidx, size_t previdx) |
void | resizeHashTab (size_t newsize) |
const int * | size () const |
returns the array of sizes, or NULL if the matrix is not allocated | |
int | size (int i) const |
returns the size of i-th matrix dimension (or 0) | |
int | type () const |
returns type of sparse matrix elements | |
template<typename _Tp > | |
const _Tp & | value (const Node *n) const |
returns the value stored in the sparse martix node | |
template<typename _Tp > | |
_Tp & | value (Node *n) |
returns the value stored in the sparse martix node | |
uchar * | ptr (int i0, bool createMissing, size_t *hashval=0) |
returns pointer to the specified element (1D case) | |
uchar * | ptr (int i0, int i1, bool createMissing, size_t *hashval=0) |
returns pointer to the specified element (2D case) | |
uchar * | ptr (int i0, int i1, int i2, bool createMissing, size_t *hashval=0) |
returns pointer to the specified element (3D case) | |
uchar * | ptr (const int *idx, bool createMissing, size_t *hashval=0) |
returns pointer to the specified element (nD case) | |
template<typename _Tp > | |
_Tp & | ref (int i0, size_t *hashval=0) |
returns reference to the specified element (1D case) | |
template<typename _Tp > | |
_Tp & | ref (int i0, int i1, size_t *hashval=0) |
returns reference to the specified element (2D case) | |
template<typename _Tp > | |
_Tp & | ref (int i0, int i1, int i2, size_t *hashval=0) |
returns reference to the specified element (3D case) | |
template<typename _Tp > | |
_Tp & | ref (const int *idx, size_t *hashval=0) |
returns reference to the specified element (nD case) | |
template<typename _Tp > | |
_Tp | value (int i0, size_t *hashval=0) const |
returns value of the specified element (1D case) | |
template<typename _Tp > | |
_Tp | value (int i0, int i1, size_t *hashval=0) const |
returns value of the specified element (2D case) | |
template<typename _Tp > | |
_Tp | value (int i0, int i1, int i2, size_t *hashval=0) const |
returns value of the specified element (3D case) | |
template<typename _Tp > | |
_Tp | value (const int *idx, size_t *hashval=0) const |
returns value of the specified element (nD case) | |
template<typename _Tp > | |
const _Tp * | find (int i0, size_t *hashval=0) const |
returns pointer to the specified element (1D case) | |
template<typename _Tp > | |
const _Tp * | find (int i0, int i1, size_t *hashval=0) const |
returns pointer to the specified element (2D case) | |
template<typename _Tp > | |
const _Tp * | find (int i0, int i1, int i2, size_t *hashval=0) const |
returns pointer to the specified element (3D case) | |
template<typename _Tp > | |
const _Tp * | find (const int *idx, size_t *hashval=0) const |
returns pointer to the specified element (nD case) | |
SparseMatIterator | begin () |
returns the sparse matrix iterator at the matrix beginning | |
template<typename _Tp > | |
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 | |
template<typename _Tp > | |
SparseMatConstIterator_< _Tp > | begin () const |
returns the read-only sparse matrix iterator at the matrix beginning | |
Additional Inherited Members | |
Public Attributes inherited from cv::SparseMat | |
int | flags |
Hdr * | hdr |
Template sparse n-dimensional array class derived from SparseMat.
SparseMat_ is a thin wrapper on top of SparseMat created in the same way as Mat_ . It simplifies notation of some operations:
SparseMatConstIterator_<_Tp> cv::SparseMat_< _Tp >::const_iterator |
SparseMatIterator_<_Tp> cv::SparseMat_< _Tp >::iterator |
cv::SparseMat_< _Tp >::SparseMat_ | ( | ) |
the default constructor
cv::SparseMat_< _Tp >::SparseMat_ | ( | int | dims, |
const int * | _sizes ) |
the full constructor equivalent to SparseMat(dims, _sizes, DataType<_Tp>::type)
cv::SparseMat_< _Tp >::SparseMat_ | ( | const SparseMat & | m | ) |
the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted
cv::SparseMat_< _Tp >::SparseMat_ | ( | const SparseMat_< _Tp > & | m | ) |
the copy constructor. This is O(1) operation - no data is copied
cv::SparseMat_< _Tp >::SparseMat_ | ( | const Mat & | m | ) |
converts dense matrix to the sparse form
SparseMatIterator_< _Tp > cv::SparseMat_< _Tp >::begin | ( | ) |
returns sparse matrix iterator pointing to the first sparse matrix element
SparseMatConstIterator_< _Tp > cv::SparseMat_< _Tp >::begin | ( | ) | const |
returns read-only sparse matrix iterator pointing to the first sparse matrix element
int cv::SparseMat_< _Tp >::channels | ( | ) | const |
returns the number of channels in each matrix element
CV_NODISCARD_STD SparseMat_ cv::SparseMat_< _Tp >::clone | ( | ) | const |
makes full copy of the matrix. All the elements are duplicated
void cv::SparseMat_< _Tp >::create | ( | int | dims, |
const int * | _sizes ) |
equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type)
int cv::SparseMat_< _Tp >::depth | ( | ) | const |
returns depth of the matrix elements
SparseMatIterator_< _Tp > cv::SparseMat_< _Tp >::end | ( | ) |
returns sparse matrix iterator pointing to the element following the last sparse matrix element
SparseMatConstIterator_< _Tp > cv::SparseMat_< _Tp >::end | ( | ) | const |
returns read-only sparse matrix iterator pointing to the element following the last sparse matrix element
_Tp cv::SparseMat_< _Tp >::operator() | ( | const int * | idx, |
size_t * | hashval = 0 ) const |
equivalent to SparseMat::value<_Tp>(idx, hashval)
_Tp cv::SparseMat_< _Tp >::operator() | ( | int | i0, |
int | i1, | ||
int | i2, | ||
size_t * | hashval = 0 ) const |
equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval)
_Tp cv::SparseMat_< _Tp >::operator() | ( | int | i0, |
int | i1, | ||
size_t * | hashval = 0 ) const |
equivalent to SparseMat::value<_Tp>(i0, i1, hashval)
_Tp cv::SparseMat_< _Tp >::operator() | ( | int | i0, |
size_t * | hashval = 0 ) const |
equivalent to SparseMat::value<_Tp>(i0, hashval)
SparseMat_ & cv::SparseMat_< _Tp >::operator= | ( | const Mat & | m | ) |
converts dense matrix to the sparse form
SparseMat_ & cv::SparseMat_< _Tp >::operator= | ( | const SparseMat & | m | ) |
converts the old-style sparse matrix to the C++ class. All the elements are copied
the assignment operator. If DataType<_Tp>.type != m.type(), the m elements are converted
SparseMat_ & cv::SparseMat_< _Tp >::operator= | ( | const SparseMat_< _Tp > & | m | ) |
the assignment operator. This is O(1) operation - no data is copied
_Tp & cv::SparseMat_< _Tp >::ref | ( | const int * | idx, |
size_t * | hashval = 0 ) |
equivalent to SparseMat::ref<_Tp>(idx, hashval)
_Tp & cv::SparseMat_< _Tp >::ref | ( | int | i0, |
int | i1, | ||
int | i2, | ||
size_t * | hashval = 0 ) |
equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval)
_Tp & cv::SparseMat_< _Tp >::ref | ( | int | i0, |
int | i1, | ||
size_t * | hashval = 0 ) |
equivalent to SparseMat::ref<_Tp>(i0, i1, hashval)
_Tp & cv::SparseMat_< _Tp >::ref | ( | int | i0, |
size_t * | hashval = 0 ) |
equivalent to SparseMat::ref<_Tp>(i0, hashval)
int cv::SparseMat_< _Tp >::type | ( | ) | const |
converts sparse matrix to the old-style CvSparseMat. All the elements are copied
returns type of the matrix elements