Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
c35b00a9
Commit
c35b00a9
authored
Jan 23, 2016
by
Amro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code snippet showing how to use SparseMat
generate indices within the size limit (modulo)
parent
1cd3c6f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
mat.hpp
modules/core/include/opencv2/core/mat.hpp
+3
-2
No files found.
modules/core/include/opencv2/core/mat.hpp
View file @
c35b00a9
...
...
@@ -2359,15 +2359,16 @@ Elements can be accessed using the following methods:
SparseMat::find), for example:
@code
const int dims = 5;
int size[] = {10, 10, 10, 10, 10};
int size[
5
] = {10, 10, 10, 10, 10};
SparseMat sparse_mat(dims, size, CV_32F);
for(int i = 0; i < 1000; i++)
{
int idx[dims];
for(int k = 0; k < dims; k++)
idx[k] = rand()
idx[k] = rand()
% size[k];
sparse_mat.ref<float>(idx) += 1.f;
}
cout << "nnz = " << sparse_mat.nzcount() << endl;
@endcode
- Sparse matrix iterators. They are similar to MatIterator but different from NAryMatIterator.
That is, the iteration loop is familiar to STL users:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment