}
In this example, we also slipped in the method node(), which is defined for the iterators. node()
returns a pointer to the internal data node in the sparse matrix that is indicated by the iterator. The returned
object of type cv::SparseMat::Node has the following definition:
struct Node
{
size_t hashval;
size_t next;
int idx[cv::MAX_DIM];
};
This structure contains both the index of the associated element (note that element idx is of type int[]),
as well as the hash value associated with that node (element hashval is the same hash value as can be
used with SparseMat::ptr(), SparseMat::ref(), SparseMat::value(), and
SparseMat::find().)
Functions Unique to Sparse Arrays
As stated earlier, sparse matrices support many of the same operations as dense matrices. In addition, there
are several methods that are unique to sparse matrices. These are listed in Table 3-19, and include the
functions mentioned in the previous sections.
Table 3-19: Additional class member functions of cv::SparseMat