Class cv::SparseMat_#

Template sparse n-dimensional array class derived from SparseMat. View details

Collaboration diagram for cv::SparseMat_:

Public Types#

Public Types inherited from cv::SparseMat

Public Member Functions#

Public Member Functions inherited from cv::SparseMat

Return

Name

Description

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 )

int

channels()

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()

creates full copy of the matrix

void

convertTo(
    Mat & m,
    int rtype,
    double alpha = 1,
    double beta = 0 )

converts sparse matrix to dense n-dim matrix with optional type conversion and scaling.

void

convertTo(
    SparseMat & m,
    int rtype,
    double alpha = 1 )

multiplies all the matrix elements by the specified scale factor alpha and converts the results to the specified data type

void

copyTo(Mat & m)

converts sparse matrix to dense matrix.

void

copyTo(SparseMat & m)

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()

returns the depth of sparse matrix elements

int

dims()

returns the matrix dimensionality

size_t

elemSize()

converts sparse matrix to the old-style representation; all the elements are copied.

size_t

elemSize1()

returns elemSize()/channels()

SparseMatIterator

end()

returns the sparse matrix iterator at the matrix end

SparseMatIterator_< _Tp >

end()

returns the typed sparse matrix iterator at the matrix end

SparseMatConstIterator

end()

returns the read-only sparse matrix iterator at the matrix end

SparseMatConstIterator_< _Tp >

end()

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)

computes the element hash value (nD case)

size_t

hash(int i0)

computes the element hash value (1D case)

size_t

hash(
    int i0,
    int i1 )

computes the element hash value (2D case)

size_t

hash(
    int i0,
    int i1,
    int i2 )

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)

size_t

nzcount()

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()

returns the array of sizes, or NULL if the matrix is not allocated

int

size(int i)

returns the size of i-th matrix dimension (or 0)

int

type()

returns type of sparse matrix elements

const _Tp &

value(const Node * n)

returns the value stored in the sparse martix node

_Tp &

value(Node * n)

returns the value stored in the sparse martix node

Public Attributes#

Public Attributes inherited from cv::SparseMat

Return

Name

Description

int

flags

Hdr *

hdr

Detailed Description#

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:

int sz[] = {10, 20, 30};
SparseMat_<double> M(3, sz);
...
M.ref(1, 2, 3) = M(4, 5, 6) + M(7, 8, 9);

Member Typedef Documentation#

const_iterator#

typedef SparseMatConstIterator_< Tp > cv::SparseMat::const_iterator

iterator#

typedef SparseMatIterator_< Tp > cv::SparseMat::iterator

Constructor & Destructor Documentation#

SparseMat_()#

cv::SparseMat_::SparseMat_()

the default constructor

SparseMat_()#

cv::SparseMat_::SparseMat_(const Mat & m)

converts dense matrix to the sparse form

SparseMat_()#

cv::SparseMat_::SparseMat_(const SparseMat & m)

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

SparseMat_()#

cv::SparseMat_::SparseMat_(const SparseMat_ & m)

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

SparseMat_()#

cv::SparseMat_::SparseMat_(
int dims,
const int * _sizes )

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

Member Function Documentation#

begin()#

SparseMatIterator_< Tp > cv::SparseMat::begin()

returns sparse matrix iterator pointing to the first sparse matrix element

begin()#

SparseMatConstIterator_< Tp > cv::SparseMat::begin()

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

channels()#

int cv::SparseMat_::channels()

returns the number of channels in each matrix element

clone()#

CV_NODISCARD_STD SparseMat_ cv::SparseMat_::clone()

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

create()#

void cv::SparseMat_::create(
int dims,
const int * _sizes )

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

depth()#

int cv::SparseMat_::depth()

returns depth of the matrix elements

end()#

SparseMatIterator_< Tp > cv::SparseMat::end()

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

end()#

SparseMatConstIterator_< Tp > cv::SparseMat::end()

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

operator()()#

Tp cv::SparseMat::operator()(
const int * idx,
size_t * hashval = 0 )

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

operator()()#

Tp cv::SparseMat::operator()(
int i0,
int i1,
int i2,
size_t * hashval = 0 )

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

operator()()#

Tp cv::SparseMat::operator()(
int i0,
int i1,
size_t * hashval = 0 )

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

operator()()#

Tp cv::SparseMat::operator()(
int i0,
size_t * hashval = 0 )

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

operator=()#

SparseMat_ & cv::SparseMat_::operator=(const Mat & m)

converts dense matrix to the sparse form

operator=()#

SparseMat_ & cv::SparseMat_::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

operator=()#

SparseMat_ & cv::SparseMat_::operator=(const SparseMat_ & m)

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

ref()#

Tp & cv::SparseMat::ref(
const int * idx,
size_t * hashval = 0 )

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

ref()#

Tp & cv::SparseMat::ref(
int i0,
int i1,
int i2,
size_t * hashval = 0 )

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

ref()#

Tp & cv::SparseMat::ref(
int i0,
int i1,
size_t * hashval = 0 )

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

ref()#

Tp & cv::SparseMat::ref(
int i0,
size_t * hashval = 0 )

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

type()#

int cv::SparseMat_::type()

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

returns type of the matrix elements

Source file#

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