OpenCV453
|
This is the proxy class for passing read-only input arrays into OpenCV functions. [詳解]
#include <mat.hpp>
cv::_OutputArrayに継承されています。
公開型 | |
enum | KindFlag { KIND_SHIFT = 16 , FIXED_TYPE = 0x8000 << KIND_SHIFT , FIXED_SIZE = 0x4000 << KIND_SHIFT , KIND_MASK = 31 << KIND_SHIFT , NONE = 0 << KIND_SHIFT , MAT = 1 << KIND_SHIFT , MATX = 2 << KIND_SHIFT , STD_VECTOR = 3 << KIND_SHIFT , STD_VECTOR_VECTOR = 4 << KIND_SHIFT , STD_VECTOR_MAT = 5 << KIND_SHIFT , EXPR = 6 << KIND_SHIFT , OPENGL_BUFFER = 7 << KIND_SHIFT , CUDA_HOST_MEM = 8 << KIND_SHIFT , CUDA_GPU_MAT = 9 << KIND_SHIFT , UMAT =10 << KIND_SHIFT , STD_VECTOR_UMAT =11 << KIND_SHIFT , STD_BOOL_VECTOR =12 << KIND_SHIFT , STD_VECTOR_CUDA_GPU_MAT = 13 << KIND_SHIFT , STD_ARRAY =14 << KIND_SHIFT , STD_ARRAY_MAT =15 << KIND_SHIFT } |
公開メンバ関数 | |
_InputArray (int _flags, void *_obj) | |
_InputArray (const Mat &m) | |
_InputArray (const MatExpr &expr) | |
_InputArray (const std::vector< Mat > &vec) | |
template<typename _Tp > | |
_InputArray (const Mat_< _Tp > &m) | |
template<typename _Tp > | |
_InputArray (const std::vector< _Tp > &vec) | |
_InputArray (const std::vector< bool > &vec) | |
template<typename _Tp > | |
_InputArray (const std::vector< std::vector< _Tp > > &vec) | |
_InputArray (const std::vector< std::vector< bool > > &)=delete | |
template<typename _Tp > | |
_InputArray (const std::vector< Mat_< _Tp > > &vec) | |
template<typename _Tp > | |
_InputArray (const _Tp *vec, int n) | |
template<typename _Tp , int m, int n> | |
_InputArray (const Matx< _Tp, m, n > &matx) | |
_InputArray (const double &val) | |
_InputArray (const cuda::GpuMat &d_mat) | |
_InputArray (const std::vector< cuda::GpuMat > &d_mat_array) | |
_InputArray (const ogl::Buffer &buf) | |
_InputArray (const cuda::HostMem &cuda_mem) | |
template<typename _Tp > | |
_InputArray (const cudev::GpuMat_< _Tp > &m) | |
_InputArray (const UMat &um) | |
_InputArray (const std::vector< UMat > &umv) | |
template<typename _Tp , std::size_t _Nm> | |
_InputArray (const std::array< _Tp, _Nm > &arr) | |
template<std::size_t _Nm> | |
_InputArray (const std::array< Mat, _Nm > &arr) | |
Mat | getMat (int idx=-1) const |
Mat | getMat_ (int idx=-1) const |
UMat | getUMat (int idx=-1) const |
void | getMatVector (std::vector< Mat > &mv) const |
void | getUMatVector (std::vector< UMat > &umv) const |
void | getGpuMatVector (std::vector< cuda::GpuMat > &gpumv) const |
cuda::GpuMat | getGpuMat () const |
ogl::Buffer | getOGlBuffer () const |
int | getFlags () const |
void * | getObj () const |
Size | getSz () const |
_InputArray::KindFlag | kind () const |
int | dims (int i=-1) const |
int | cols (int i=-1) const |
int | rows (int i=-1) const |
Size | size (int i=-1) const |
int | sizend (int *sz, int i=-1) const |
bool | sameSize (const _InputArray &arr) const |
size_t | total (int i=-1) const |
int | type (int i=-1) const |
int | depth (int i=-1) const |
int | channels (int i=-1) const |
bool | isContinuous (int i=-1) const |
bool | isSubmatrix (int i=-1) const |
bool | empty () const |
void | copyTo (const _OutputArray &arr) const |
void | copyTo (const _OutputArray &arr, const _InputArray &mask) const |
size_t | offset (int i=-1) const |
size_t | step (int i=-1) const |
bool | isMat () const |
bool | isUMat () const |
bool | isMatVector () const |
bool | isUMatVector () const |
bool | isMatx () const |
bool | isVector () const |
bool | isGpuMat () const |
bool | isGpuMatVector () const |
静的公開メンバ関数 | |
template<typename _Tp > | |
static _InputArray | rawIn (const std::vector< _Tp > &vec) |
template<typename _Tp , std::size_t _Nm> | |
static _InputArray | rawIn (const std::array< _Tp, _Nm > &arr) |
限定公開メンバ関数 | |
void | init (int _flags, const void *_obj) |
void | init (int _flags, const void *_obj, Size _sz) |
限定公開変数類 | |
int | flags |
void * | obj |
Size | sz |
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 intended 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).