SparseMat Documentation example bugged (Bug #2310)


Added by Alexander Reimann over 12 years ago. Updated about 12 years ago.


Status:Done Start date:2012-08-26
Priority:Low Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:documentation
Target version:2.4.3
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

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

Revision e365726c
Added by Vadim Pisarevsky over 12 years ago

fixed example of iteration through a SparseMat (bug #2310)

Revision 7a35f459
Added by Roman Donchenko about 11 years ago

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

Also available in: Atom PDF