OpenCV 4.14.0
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::SparseMatConstIterator Class Reference

Read-Only Sparse Matrix Iterator. More...

#include <opencv2/core/mat.hpp>

Collaboration diagram for cv::SparseMatConstIterator:

Public Member Functions

 SparseMatConstIterator ()
 the default constructor
 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::Node * node () const
 returns the current node of the sparse matrix. it.node->idx is the current element index
SparseMatConstIterator & operator++ ()
 moves iterator to the next element
SparseMatConstIterator operator++ (int)
 moves iterator to the next element
SparseMatConstIterator & operator-- ()
 moves iterator to the previous element
SparseMatConstIterator operator-- (int)
 moves iterator to the previous element
SparseMatConstIterator & operator= (const SparseMatConstIterator &it)
 the assignment operator
void seekEnd ()
 moves iterator to the element after the last element
template<typename _Tp>
const _Tp & value () const
 template method returning the current matrix element

Public Attributes

size_t hashidx
const SparseMat * m
uchar * ptr

Detailed Description

Read-Only Sparse Matrix Iterator.

Here is how to use the iterator to compute the sum of floating-point sparse matrix elements:

SparseMatConstIterator it = m.begin(), it_end = m.end();
double s = 0;
for( ; it != it_end; ++it )
s += it.value<float>();
const _Tp & value() const
template method returning the current matrix element
const SparseMat * m
Definition mat.hpp:3363
SparseMatConstIterator()
the default constructor
int type() const
returns type of sparse matrix elements
SparseMatIterator end()
returns the sparse matrix iterator at the matrix end
SparseMatIterator begin()
returns the sparse matrix iterator at the matrix beginning
#define CV_32F
Definition interface.h:78
#define CV_Assert(expr)
Checks a condition at runtime and throws exception if it fails.
Definition base.hpp:423

Constructor & Destructor Documentation

◆ SparseMatConstIterator() [1/3]

cv::SparseMatConstIterator::SparseMatConstIterator ( )

the default constructor

◆ SparseMatConstIterator() [2/3]

cv::SparseMatConstIterator::SparseMatConstIterator ( const SparseMat * _m)

the full constructor setting the iterator to the first sparse matrix element

◆ SparseMatConstIterator() [3/3]

cv::SparseMatConstIterator::SparseMatConstIterator ( const SparseMatConstIterator & it)

the copy constructor

Here is the call graph for this function:

Member Function Documentation

◆ node()

const SparseMat::Node * cv::SparseMatConstIterator::node ( ) const

returns the current node of the sparse matrix. it.node->idx is the current element index

◆ operator++() [1/2]

SparseMatConstIterator & cv::SparseMatConstIterator::operator++ ( )

moves iterator to the next element

Here is the call graph for this function:

◆ operator++() [2/2]

SparseMatConstIterator cv::SparseMatConstIterator::operator++ ( int )

moves iterator to the next element

Here is the call graph for this function:

◆ operator--() [1/2]

SparseMatConstIterator & cv::SparseMatConstIterator::operator-- ( )

moves iterator to the previous element

Here is the call graph for this function:

◆ operator--() [2/2]

SparseMatConstIterator cv::SparseMatConstIterator::operator-- ( int )

moves iterator to the previous element

Here is the call graph for this function:

◆ operator=()

SparseMatConstIterator & cv::SparseMatConstIterator::operator= ( const SparseMatConstIterator & it)

the assignment operator

Here is the call graph for this function:

◆ seekEnd()

void cv::SparseMatConstIterator::seekEnd ( )

moves iterator to the element after the last element

◆ value()

template<typename _Tp>
const _Tp & cv::SparseMatConstIterator::value ( ) const

template method returning the current matrix element

Member Data Documentation

◆ hashidx

size_t cv::SparseMatConstIterator::hashidx

◆ m

const SparseMat* cv::SparseMatConstIterator::m

◆ ptr

uchar* cv::SparseMatConstIterator::ptr

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