SparseMat Documentation example bugged (Bug #2310)
Description
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
Associated revisions
fixed example of iteration through a SparseMat (bug #2310)
Merge pull request #2310 from SpecLad:merge-2.4
History
Updated by Vadim Pisarevsky over 12 years ago
- Description changed from There is some stuff missing in the example for the iterators of the sparseMa... to There is some stuff missing in the example for the iterators of the sparseMat... More
- Target version deleted ()
Updated by Vadim Pisarevsky over 12 years ago
thanks! fixed in e365726c
- Status changed from Open to Done
- Assignee set to Vadim Pisarevsky
Updated by Andrey Kamaev about 12 years ago
- Target version set to 2.4.3