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
7f64f31f
Commit
7f64f31f
authored
Jul 17, 2016
by
catree
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NAryMatIterator code example.
parent
69c4e84d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
mat.hpp
modules/core/include/opencv2/core/mat.hpp
+17
-9
No files found.
modules/core/include/opencv2/core/mat.hpp
View file @
7f64f31f
...
...
@@ -3146,21 +3146,29 @@ The example below illustrates how you can compute a normalized and threshold 3D
}
minProb *= image.rows*image.cols;
Mat plane;
NAryMatIterator it(&hist, &plane, 1);
// initialize iterator (the style is different from STL).
// after initialization the iterator will contain
// the number of slices or planes the iterator will go through.
// it simultaneously increments iterators for several matrices
// supplied as a null terminated list of pointers
const Mat* arrays[] = {&hist, 0};
Mat planes[1];
NAryMatIterator itNAry(arrays, planes, 1);
double s = 0;
// iterate through the matrix. on each iteration
// it.planes[*] (of type Mat) will be set to the current plane.
for(int p = 0; p < it.nplanes; p++, ++it)
// itNAry.planes[i] (of type Mat) will be set to the current plane
// of the i-th n-dim matrix passed to the iterator constructor.
for(int p = 0; p < itNAry.nplanes; p++, ++itNAry)
{
threshold(it
.planes[0], it
.planes[0], minProb, 0, THRESH_TOZERO);
s += sum(it.planes[0])[0];
threshold(it
NAry.planes[0], itNAry
.planes[0], minProb, 0, THRESH_TOZERO);
s += sum(it
NAry
.planes[0])[0];
}
s = 1./s;
it
= NAryMatIterator(&hist, &plane
, 1);
for(int p = 0; p < it
.nplanes; p++, ++it
)
it.planes[0] *= s;
it
NAry = NAryMatIterator(arrays, planes
, 1);
for(int p = 0; p < it
NAry.nplanes; p++, ++itNAry
)
it
NAry
.planes[0] *= s;
}
@endcode
*/
...
...
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