Updated by Vadim Pisarevsky over 12 years ago
There is some stuff missing in the example for the iterators of the sparseMat.
"Sparse matrix iterators. They are similar to MatIterator but different from NAryMatIterator. That is, the iteration loop is familiar to STL users:"
@// prints elements of a sparse floating-point matrix@
@// and the sum of elements.@
@SparseMatConstIterator_<float>@
@ it = sparse_mat.begin<float>(),@
@ it_end = sparse_mat.end<float>();@
@double s = 0;@
@int dims = sparse_mat.dims();@
@for(; it != it_end; ++it)@
@{@
@ // print element indices and the element value@
@ const Node* n = it.node();@
+@ printf("(")@+
@ for(int i = 0; i < dims; i++)@
+@ printf("@+
+@ printf(":@+
@ s += *it;@
@}@
+@printf("Element sum is@+
Page: http://opencv.itseez.com/modules/core/doc/basic_structures.html?highlight=inputarray#sparsemat