OpenCV  2.4.13.2
Open Source Computer Vision
cv::SparseMat_< _Tp > Class Template Reference

#include <core.hpp>

Inheritance diagram for cv::SparseMat_< _Tp >:
cv::SparseMat

Public Types

typedef SparseMatIterator_< _Tp > iterator
 
typedef SparseMatConstIterator_< _Tp > const_iterator
 
- Public Types inherited from cv::SparseMat
enum  { MAGIC_VAL =0x42FD0000, MAX_DIM =CV_MAX_DIM, HASH_SCALE =0x5bd1e995, HASH_BIT =0x80000000 }
 
typedef SparseMatIterator iterator
 
typedef SparseMatConstIterator const_iterator
 

Public Member Functions

 SparseMat_ ()
 the default constructor More...
 
 SparseMat_ (int dims, const int *_sizes)
 the full constructor equivelent to SparseMat(dims, _sizes, DataType<_Tp>::type) More...
 
 SparseMat_ (const SparseMat &m)
 the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted More...
 
 SparseMat_ (const SparseMat_ &m)
 the copy constructor. This is O(1) operation - no data is copied More...
 
 SparseMat_ (const Mat &m)
 converts dense matrix to the sparse form More...
 
 SparseMat_ (const CvSparseMat *m)
 converts the old-style sparse matrix to the C++ class. All the elements are copied More...
 
SparseMat_operator= (const SparseMat &m)
 the assignment operator. If DataType<_Tp>.type != m.type(), the m elements are converted More...
 
SparseMat_operator= (const SparseMat_ &m)
 the assignment operator. This is O(1) operation - no data is copied More...
 
SparseMat_operator= (const Mat &m)
 converts dense matrix to the sparse form More...
 
SparseMat_ clone () const
 makes full copy of the matrix. All the elements are duplicated More...
 
void create (int dims, const int *_sizes)
 equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type) More...
 
 operator CvSparseMat * () const
 converts sparse matrix to the old-style CvSparseMat. All the elements are copied More...
 
int type () const
 returns type of the matrix elements More...
 
int depth () const
 returns depth of the matrix elements More...
 
int channels () const
 returns the number of channels in each matrix element More...
 
_Tp & ref (int i0, size_t *hashval=0)
 equivalent to SparseMat::ref<_Tp>(i0, hashval) More...
 
_Tp & ref (int i0, int i1, size_t *hashval=0)
 equivalent to SparseMat::ref<_Tp>(i0, i1, hashval) More...
 
_Tp & ref (int i0, int i1, int i2, size_t *hashval=0)
 equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval) More...
 
_Tp & ref (const int *idx, size_t *hashval=0)
 equivalent to SparseMat::ref<_Tp>(idx, hashval) More...
 
_Tp operator() (int i0, size_t *hashval=0) const
 equivalent to SparseMat::value<_Tp>(i0, hashval) More...
 
_Tp operator() (int i0, int i1, size_t *hashval=0) const
 equivalent to SparseMat::value<_Tp>(i0, i1, hashval) More...
 
_Tp operator() (int i0, int i1, int i2, size_t *hashval=0) const
 equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval) More...
 
_Tp operator() (const int *idx, size_t *hashval=0) const
 equivalent to SparseMat::value<_Tp>(idx, hashval) More...
 
SparseMatIterator_< _Tp > begin ()
 returns sparse matrix iterator pointing to the first sparse matrix element More...
 
SparseMatConstIterator_< _Tp > begin () const
 returns read-only sparse matrix iterator pointing to the first sparse matrix element More...
 
SparseMatIterator_< _Tp > end ()
 returns sparse matrix iterator pointing to the element following the last sparse matrix element More...
 
SparseMatConstIterator_< _Tp > end () const
 returns read-only sparse matrix iterator pointing to the element following the last sparse matrix element More...
 
- Public Member Functions inherited from cv::SparseMat
 SparseMat ()
 default constructor More...
 
 SparseMat (int dims, const int *_sizes, int _type)
 creates matrix of the specified size and type More...
 
 SparseMat (const SparseMat &m)
 copy constructor More...
 
 SparseMat (const Mat &m)
 converts dense 2d matrix to the sparse form More...
 
 SparseMat (const CvSparseMat *m)
 converts old-style sparse matrix to the new-style. All the data is copied More...
 
 ~SparseMat ()
 the destructor More...
 
SparseMatoperator= (const SparseMat &m)
 assignment operator. This is O(1) operation, i.e. no data is copied More...
 
SparseMatoperator= (const Mat &m)
 equivalent to the corresponding constructor More...
 
SparseMat clone () const
 creates full copy of the matrix More...
 
void copyTo (SparseMat &m) const
 copies all the data to the destination matrix. All the previous content of m is erased More...
 
void copyTo (Mat &m) const
 converts sparse matrix to dense matrix. More...
 
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 More...
 
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. More...
 
void assignTo (SparseMat &m, int type=-1) const
 
void create (int dims, const int *_sizes, int _type)
 reallocates sparse matrix. More...
 
void clear ()
 sets all the sparse matrix elements to 0, which means clearing the hash table. More...
 
void addref ()
 manually increments the reference counter to the header. More...
 
void release ()
 
 operator CvSparseMat * () const
 converts sparse matrix to the old-style representation; all the elements are copied. More...
 
size_t elemSize () const
 returns the size of each element in bytes (not including the overhead - the space occupied by SparseMat::Node elements) More...
 
size_t elemSize1 () const
 returns elemSize()/channels() More...
 
int type () const
 returns type of sparse matrix elements More...
 
int depth () const
 returns the depth of sparse matrix elements More...
 
int channels () const
 returns the number of channels More...
 
const intsize () const
 returns the array of sizes, or NULL if the matrix is not allocated More...
 
int size (int i) const
 returns the size of i-th matrix dimension (or 0) More...
 
int dims () const
 returns the matrix dimensionality More...
 
size_t nzcount () const
 returns the number of non-zero elements (=the number of hash table nodes) More...
 
size_t hash (int i0) const
 computes the element hash value (1D case) More...
 
size_t hash (int i0, int i1) const
 computes the element hash value (2D case) More...
 
size_t hash (int i0, int i1, int i2) const
 computes the element hash value (3D case) More...
 
size_t hash (const int *idx) const
 computes the element hash value (nD case) More...
 
SparseMatIterator end ()
 returns the sparse matrix iterator at the matrix end More...
 
SparseMatConstIterator end () const
 returns the read-only sparse matrix iterator at the matrix end More...
 
template<typename _Tp >
SparseMatIterator_< _Tp > end ()
 returns the typed sparse matrix iterator at the matrix end More...
 
template<typename _Tp >
SparseMatConstIterator_< _Tp > end () const
 returns the typed read-only sparse matrix iterator at the matrix end More...
 
template<typename _Tp >
_Tp & value (Node *n)
 returns the value stored in the sparse martix node More...
 
template<typename _Tp >
const _Tp & value (const Node *n) const
 returns the value stored in the sparse martix node More...
 
Nodenode (size_t nidx)
 
const Nodenode (size_t nidx) const
 
ucharnewNode (const int *idx, size_t hashval)
 
void removeNode (size_t hidx, size_t nidx, size_t previdx)
 
void resizeHashTab (size_t newsize)
 
ucharptr (int i0, bool createMissing, size_t *hashval=0)
 returns pointer to the specified element (1D case) More...
 
ucharptr (int i0, int i1, bool createMissing, size_t *hashval=0)
 returns pointer to the specified element (2D case) More...
 
ucharptr (int i0, int i1, int i2, bool createMissing, size_t *hashval=0)
 returns pointer to the specified element (3D case) More...
 
ucharptr (const int *idx, bool createMissing, size_t *hashval=0)
 returns pointer to the specified element (nD case) More...
 
template<typename _Tp >
_Tp & ref (int i0, size_t *hashval=0)
 returns reference to the specified element (1D case) More...
 
template<typename _Tp >
_Tp & ref (int i0, int i1, size_t *hashval=0)
 returns reference to the specified element (2D case) More...
 
template<typename _Tp >
_Tp & ref (int i0, int i1, int i2, size_t *hashval=0)
 returns reference to the specified element (3D case) More...
 
template<typename _Tp >
_Tp & ref (const int *idx, size_t *hashval=0)
 returns reference to the specified element (nD case) More...
 
template<typename _Tp >
_Tp value (int i0, size_t *hashval=0) const
 returns value of the specified element (1D case) More...
 
template<typename _Tp >
_Tp value (int i0, int i1, size_t *hashval=0) const
 returns value of the specified element (2D case) More...
 
template<typename _Tp >
_Tp value (int i0, int i1, int i2, size_t *hashval=0) const
 returns value of the specified element (3D case) More...
 
template<typename _Tp >
_Tp value (const int *idx, size_t *hashval=0) const
 returns value of the specified element (nD case) More...
 
template<typename _Tp >
const _Tp * find (int i0, size_t *hashval=0) const
 returns pointer to the specified element (1D case) More...
 
template<typename _Tp >
const _Tp * find (int i0, int i1, size_t *hashval=0) const
 returns pointer to the specified element (2D case) More...
 
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) More...
 
template<typename _Tp >
const _Tp * find (const int *idx, size_t *hashval=0) const
 returns pointer to the specified element (nD case) More...
 
void erase (int i0, int i1, size_t *hashval=0)
 erases the specified element (2D case) More...
 
void erase (int i0, int i1, int i2, size_t *hashval=0)
 erases the specified element (3D case) More...
 
void erase (const int *idx, size_t *hashval=0)
 erases the specified element (nD case) More...
 
SparseMatIterator begin ()
 returns the sparse matrix iterator at the matrix beginning More...
 
template<typename _Tp >
SparseMatIterator_< _Tp > begin ()
 returns the sparse matrix iterator at the matrix beginning More...
 
SparseMatConstIterator begin () const
 returns the read-only sparse matrix iterator at the matrix beginning More...
 
template<typename _Tp >
SparseMatConstIterator_< _Tp > begin () const
 returns the read-only sparse matrix iterator at the matrix beginning More...
 

Additional Inherited Members

- Public Attributes inherited from cv::SparseMat
int flags
 
Hdrhdr
 

Detailed Description

template<typename _Tp>
class cv::SparseMat_< _Tp >

The Template Sparse Matrix class derived from cv::SparseMat

The class provides slightly more convenient operations for accessing elements.

...
SparseMat_<int> m_ = (SparseMat_<int>&)m;
m_.ref(1)++; // equivalent to m.ref<int>(1)++;
m_.ref(2) += m_(3); // equivalent to m.ref<int>(2) += m.value<int>(3);

Member Typedef Documentation

§ const_iterator

template<typename _Tp>
typedef SparseMatConstIterator_<_Tp> cv::SparseMat_< _Tp >::const_iterator

§ iterator

template<typename _Tp>
typedef SparseMatIterator_<_Tp> cv::SparseMat_< _Tp >::iterator

Constructor & Destructor Documentation

§ SparseMat_() [1/6]

template<typename _Tp >
cv::SparseMat_< _Tp >::SparseMat_ ( )
inline

the default constructor

§ SparseMat_() [2/6]

template<typename _Tp >
cv::SparseMat_< _Tp >::SparseMat_ ( int  dims,
const int _sizes 
)
inline

the full constructor equivelent to SparseMat(dims, _sizes, DataType<_Tp>::type)

§ SparseMat_() [3/6]

template<typename _Tp >
cv::SparseMat_< _Tp >::SparseMat_ ( const SparseMat m)
inline

the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted

§ SparseMat_() [4/6]

template<typename _Tp >
cv::SparseMat_< _Tp >::SparseMat_ ( const SparseMat_< _Tp > &  m)
inline

the copy constructor. This is O(1) operation - no data is copied

§ SparseMat_() [5/6]

template<typename _Tp >
cv::SparseMat_< _Tp >::SparseMat_ ( const Mat m)
inline

converts dense matrix to the sparse form

§ SparseMat_() [6/6]

template<typename _Tp >
cv::SparseMat_< _Tp >::SparseMat_ ( const CvSparseMat m)
inline

converts the old-style sparse matrix to the C++ class. All the elements are copied

Member Function Documentation

§ begin() [1/2]

template<typename _Tp >
SparseMatIterator_< _Tp > cv::SparseMat_< _Tp >::begin ( )
inline

returns sparse matrix iterator pointing to the first sparse matrix element

§ begin() [2/2]

template<typename _Tp >
SparseMatConstIterator_< _Tp > cv::SparseMat_< _Tp >::begin ( ) const
inline

returns read-only sparse matrix iterator pointing to the first sparse matrix element

§ channels()

template<typename _Tp >
int cv::SparseMat_< _Tp >::channels ( ) const
inline

returns the number of channels in each matrix element

§ clone()

template<typename _Tp >
SparseMat_< _Tp > cv::SparseMat_< _Tp >::clone ( ) const
inline

makes full copy of the matrix. All the elements are duplicated

§ create()

template<typename _Tp >
void cv::SparseMat_< _Tp >::create ( int  dims,
const int _sizes 
)
inline

equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type)

§ depth()

template<typename _Tp >
int cv::SparseMat_< _Tp >::depth ( ) const
inline

returns depth of the matrix elements

§ end() [1/2]

template<typename _Tp >
SparseMatIterator_< _Tp > cv::SparseMat_< _Tp >::end ( )
inline

returns sparse matrix iterator pointing to the element following the last sparse matrix element

§ end() [2/2]

template<typename _Tp >
SparseMatConstIterator_< _Tp > cv::SparseMat_< _Tp >::end ( ) const
inline

returns read-only sparse matrix iterator pointing to the element following the last sparse matrix element

§ operator CvSparseMat *()

template<typename _Tp >
cv::SparseMat_< _Tp >::operator CvSparseMat * ( ) const
inline

converts sparse matrix to the old-style CvSparseMat. All the elements are copied

§ operator()() [1/4]

template<typename _Tp >
_Tp cv::SparseMat_< _Tp >::operator() ( int  i0,
size_t *  hashval = 0 
) const
inline

equivalent to SparseMat::value<_Tp>(i0, hashval)

§ operator()() [2/4]

template<typename _Tp >
_Tp cv::SparseMat_< _Tp >::operator() ( int  i0,
int  i1,
size_t *  hashval = 0 
) const
inline

equivalent to SparseMat::value<_Tp>(i0, i1, hashval)

§ operator()() [3/4]

template<typename _Tp >
_Tp cv::SparseMat_< _Tp >::operator() ( int  i0,
int  i1,
int  i2,
size_t *  hashval = 0 
) const
inline

equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval)

§ operator()() [4/4]

template<typename _Tp >
_Tp cv::SparseMat_< _Tp >::operator() ( const int idx,
size_t *  hashval = 0 
) const
inline

equivalent to SparseMat::value<_Tp>(idx, hashval)

§ operator=() [1/3]

template<typename _Tp >
SparseMat_< _Tp > & cv::SparseMat_< _Tp >::operator= ( const SparseMat m)
inline

the assignment operator. If DataType<_Tp>.type != m.type(), the m elements are converted

§ operator=() [2/3]

template<typename _Tp >
SparseMat_< _Tp > & cv::SparseMat_< _Tp >::operator= ( const SparseMat_< _Tp > &  m)
inline

the assignment operator. This is O(1) operation - no data is copied

§ operator=() [3/3]

template<typename _Tp >
SparseMat_< _Tp > & cv::SparseMat_< _Tp >::operator= ( const Mat m)
inline

converts dense matrix to the sparse form

§ ref() [1/4]

template<typename _Tp >
_Tp & cv::SparseMat_< _Tp >::ref ( int  i0,
size_t *  hashval = 0 
)
inline

equivalent to SparseMat::ref<_Tp>(i0, hashval)

§ ref() [2/4]

template<typename _Tp >
_Tp & cv::SparseMat_< _Tp >::ref ( int  i0,
int  i1,
size_t *  hashval = 0 
)
inline

equivalent to SparseMat::ref<_Tp>(i0, i1, hashval)

§ ref() [3/4]

template<typename _Tp >
_Tp & cv::SparseMat_< _Tp >::ref ( int  i0,
int  i1,
int  i2,
size_t *  hashval = 0 
)
inline

equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval)

§ ref() [4/4]

template<typename _Tp >
_Tp & cv::SparseMat_< _Tp >::ref ( const int idx,
size_t *  hashval = 0 
)
inline

equivalent to SparseMat::ref<_Tp>(idx, hashval)

§ type()

template<typename _Tp >
int cv::SparseMat_< _Tp >::type ( ) const
inline

returns type of the matrix elements


The documentation for this class was generated from the following files: