This is the proxy class for passing read-only input arrays into OpenCV functions. More...
#include "mat.hpp"
This is the proxy class for passing read-only input arrays into OpenCV functions.
It is defined as:
where _InputArray is a class that can be constructed from Mat , Mat_<T>, Matx<T, m, n>, std::vector<T>, std::vector<std::vector<T> >, std::vector<Mat>, std::vector<Mat_<T> >, UMat , std::vector<UMat> or double. It can also be constructed from a matrix expression.
Since this is mostly implementation-level class, and its interface may change in future versions, we do not describe it in details. There are a few key things, though, that should be kept in mind:
Mat , Matx , vector<T> etc. (see above the complete list).vector<> etc., but normally it is not needed.Here is how you can use a function that takes InputArray :
That is, we form an STL vector containing points, and apply in-place affine transformation to the vector using the 2x3 matrix created inline as Matx<float, 2, 3> instance.
Here is how such a function can be implemented (for simplicity, we implement a very specific case of it, according to the assertion statement inside) :
There is another related type, InputArrayOfArrays, which is currently defined as a synonym for InputArray:
It denotes function arguments that are either vectors of vectors or vectors of matrices. A separate synonym is needed to generate Python/Java etc. wrappers properly. At the function implementation level their use is similar, but _InputArray::getMat(idx) should be used to get header for the idx-th component of the outer vector and _InputArray::size().area() should be used to find the number of components (vectors/matrices) of the outer vector.
In general, type support is limited to cv::Mat types. Other types are forbidden. But in some cases we need to support passing of custom non-general Mat types, like arrays of cv::KeyPoint, cv::DMatch, etc. This data is not intented to be interpreted as an image data, or processed somehow like regular cv::Mat. To pass such custom type use rawIn() / rawOut() / rawInOut() wrappers. Custom type is wrapped as Mat-compatible CV_8UC<N> values (N = sizeof(T), N <= CV_CN_MAX).
| Enumerator | |
|---|---|
| KIND_SHIFT | |
| FIXED_TYPE | |
| FIXED_SIZE | |
| KIND_MASK | |
| NONE | |
| MAT | |
| MATX | |
| STD_VECTOR | |
| STD_VECTOR_VECTOR | |
| STD_VECTOR_MAT | |
| EXPR | |
| OPENGL_BUFFER | |
| CUDA_HOST_MEM | |
| CUDA_GPU_MAT | |
| UMAT | |
| STD_VECTOR_UMAT | |
| STD_BOOL_VECTOR | |
| STD_VECTOR_CUDA_GPU_MAT | |
| STD_ARRAY | |
| STD_ARRAY_MAT | |
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1 )
const
-1
-1 )
const
-1 )
const
-1 )
const