OpenCV
4.1.0
Open Source Computer Vision
|
n-ary multi-dimensional array iterator. More...
#include <opencv2/core/mat.hpp>
Public Member Functions | |
NAryMatIterator () | |
the default constructor | |
NAryMatIterator (const Mat **arrays, uchar **ptrs, int narrays=-1) | |
the full constructor taking arbitrary number of n-dim matrices | |
NAryMatIterator (const Mat **arrays, Mat *planes, int narrays=-1) | |
the full constructor taking arbitrary number of n-dim matrices | |
void | init (const Mat **arrays, Mat *planes, uchar **ptrs, int narrays=-1) |
the separate iterator initialization method | |
NAryMatIterator & | operator++ () |
proceeds to the next plane of every iterated matrix | |
NAryMatIterator | operator++ (int) |
proceeds to the next plane of every iterated matrix (postfix increment operator) | |
Public Attributes | |
const Mat ** | arrays |
the iterated arrays | |
int | narrays |
the number of arrays | |
size_t | nplanes |
the number of hyper-planes that the iterator steps through | |
Mat * | planes |
the current planes | |
uchar ** | ptrs |
data pointers | |
size_t | size |
the size of each segment (in elements) | |
Protected Attributes | |
size_t | idx |
int | iterdepth |
n-ary multi-dimensional array iterator.
Use the class to implement unary, binary, and, generally, n-ary element-wise operations on multi-dimensional arrays. Some of the arguments of an n-ary function may be continuous arrays, some may be not. It is possible to use conventional MatIterator 's for each array but incrementing all of the iterators after each small operations may be a big overhead. In this case consider using NAryMatIterator to iterate through several matrices simultaneously as long as they have the same geometry (dimensionality and all the dimension sizes are the same). On each iteration it.planes[0]
, it.planes[1]
,... will be the slices of the corresponding matrices.
The example below illustrates how you can compute a normalized and threshold 3D color histogram:
cv::NAryMatIterator::NAryMatIterator | ( | ) |
the default constructor
the full constructor taking arbitrary number of n-dim matrices
the full constructor taking arbitrary number of n-dim matrices
void cv::NAryMatIterator::init | ( | const Mat ** | arrays, |
Mat * | planes, | ||
uchar ** | ptrs, | ||
int | narrays = -1 |
||
) |
the separate iterator initialization method
NAryMatIterator& cv::NAryMatIterator::operator++ | ( | ) |
proceeds to the next plane of every iterated matrix
NAryMatIterator cv::NAryMatIterator::operator++ | ( | int | ) |
proceeds to the next plane of every iterated matrix (postfix increment operator)
const Mat** cv::NAryMatIterator::arrays |
the iterated arrays
|
protected |
|
protected |
int cv::NAryMatIterator::narrays |
the number of arrays
size_t cv::NAryMatIterator::nplanes |
the number of hyper-planes that the iterator steps through
Mat* cv::NAryMatIterator::planes |
the current planes
uchar** cv::NAryMatIterator::ptrs |
data pointers
size_t cv::NAryMatIterator::size |
the size of each segment (in elements)