![]() |
OpenCV 4.12.0
开源计算机视觉
|
这是一个用于将只读输入数组传递给OpenCV函数的代理类。更多...
#include <opencv2/core/mat.hpp>
公共类型 | |
| 枚举 | 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 () | |
| template<typename _Tp > | |
| _InputArray (const _Tp *vec, int n) | |
| _InputArray (const cuda::GpuMat &d_mat) | |
| _InputArray (const cuda::HostMem &cuda_mem) | |
| template<typename _Tp > | |
| _InputArray (const cudev::GpuMat_< _Tp > &m) | |
| _InputArray (const double &val) | |
| _InputArray (const Mat &m) | |
| template<typename _Tp > | |
| _InputArray (const Mat_< _Tp > &m) | |
| _InputArray (const MatExpr &expr) | |
| template<typename _Tp , int m, int n> | |
| _InputArray (const Matx< _Tp, m, n > &matx) | |
| _InputArray (const ogl::Buffer &buf) | |
| 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) | |
| template<typename _Tp > | |
| _InputArray (const std::vector< _Tp > &vec) | |
| _InputArray (const std::vector< bool > &vec) | |
| _InputArray (const std::vector< cuda::GpuMat > &d_mat_array) | |
| _InputArray (const std::vector< Mat > &vec) | |
| template<typename _Tp > | |
| _InputArray (const std::vector< Mat_< _Tp > > &vec) | |
| template<typename _Tp > | |
| _InputArray (const std::vector< std::vector< _Tp > > &vec) | |
| _InputArray (const std::vector< std::vector< bool > > &)=delete | |
| _InputArray (const std::vector< UMat > &umv) | |
| _InputArray (const UMat &um) | |
| _InputArray (int _flags, void *_obj) | |
| ~_InputArray () | |
| int | channels (int i=-1) const |
| int | cols (int i=-1) const |
| void | copyTo (const _OutputArray &arr) const |
| void | copyTo (const _OutputArray &arr, const _InputArray &mask) const |
| int | depth (int i=-1) const |
| int | dims (int i=-1) const |
| bool | empty () const |
| int | getFlags () const |
| cuda::GpuMat | getGpuMat () const |
| void | getGpuMatVector (std::vector< cuda::GpuMat > &gpumv) const |
| Mat | getMat (int idx=-1) const |
| Mat | getMat_ (int idx=-1) const |
| void | getMatVector (std::vector< Mat > &mv) const |
| void * | getObj () const |
| ogl::Buffer | getOGlBuffer () const |
| Size | getSz () const |
| UMat | getUMat (int idx=-1) const |
| void | getUMatVector (std::vector< UMat > &umv) const |
| bool | isContinuous (int i=-1) const |
| bool | isGpuMat () const |
| bool | isGpuMatVector () const |
| bool | isMat () const |
| bool | isMatVector () const |
| bool | isMatx () const |
| bool | isSubmatrix (int i=-1) const |
| bool | isUMat () const |
| bool | isUMatVector () const |
| bool | isVector () const |
| _InputArray::KindFlag | kind () const |
| size_t | offset (int i=-1) const |
| int | rows (int i=-1) const |
| bool | sameSize (const _InputArray &arr) const |
| Size | size (int i=-1) const |
| int | sizend (int *sz, int i=-1) const |
| size_t | step (int i=-1) const |
| size_t | total (int i=-1) const |
| int | type (int i=-1) const |
静态公共成员函数 | |
| template<typename _Tp , std::size_t _Nm> | |
| static _InputArray | rawIn (const std::array< _Tp, _Nm > &arr) |
| template<typename _Tp > | |
| static _InputArray | rawIn (const std::vector< _Tp > &vec) |
保护成员函数 | |
| void | init (int _flags, const void *_obj) |
| void | init (int _flags, const void *_obj, Size _sz) |
保护属性 | |
| int | flags |
| void * | obj |
| Size | sz |
这是一个用于将只读输入数组传递给OpenCV函数的代理类。
它定义为
其中 cv::_InputArray 是一个类,可以由 cv::Mat、cv::Mat_<T>、cv::Matx<T, m, n>、std::vector<T>、std::vector<std::vector<T>>、std::vector<Mat>、std::vector<Mat_<T>>、cv::UMat、std::vector<UMat> 或 double 构造。它也可以从矩阵表达式构造。
由于这主要是一个实现级别的类,并且其接口在未来版本中可能会发生变化,因此我们不详细描述它。不过,有几件关键的事情需要牢记:
Mat、Matx、vector<T> 等(参阅上方完整列表)。vector<> 等,但通常不需要。下面是如何使用接受 InputArray 的函数:
也就是说,我们形成一个包含点的STL向量,并使用内联创建的2x3矩阵(Matx<float, 2, 3> 实例)对该向量应用就地仿射变换。
下面是此类函数的一种实现方式(为简化起见,我们根据内部的断言语句实现了一个非常特定的案例):
还有另一个相关类型 InputArrayOfArrays,它目前被定义为 InputArray 的同义词
它表示作为向量的向量或矩阵向量的函数参数。需要一个单独的同义词来正确生成 Python/Java 等包装器。在函数实现层面,它们的用法相似,但应使用 _InputArray::getMat(idx) 来获取外部向量的第 idx 个组件的头部,并使用 _InputArray::size().area() 来查找外部向量的组件(向量/矩阵)数量。
通常,类型支持仅限于 cv::Mat 类型。其他类型是被禁止的。但在某些情况下,我们需要支持传递自定义的非通用 Mat 类型,例如 cv::KeyPoint、cv::DMatch 等数组。此数据不打算被解释为图像数据,也不像常规 cv::Mat 那样进行处理。要传递此类自定义类型,请使用 rawIn() / rawOut() / rawInOut() 包装器。自定义类型被包装为 Mat 兼容的 CV_8UC<N> 值(N = sizeof(T), N <= CV_CN_MAX)。
| cv::_InputArray::_InputArray | ( | ) |
| cv::_InputArray::_InputArray | ( | int | _flags, |
| void * | ◆ _OutputArray() [1/38] |
| cv::_InputArray::_InputArray | ( | const Mat & | m | ) |
| cv::_InputArray::_InputArray | ( | const MatExpr & | expr | ) |
| cv::_InputArray::_InputArray | ( | const std::vector< Mat > & | vec | ) |
| cv::_InputArray::_InputArray | ( | const std::vector< bool > & | vec | ) |
| cv::_InputArray::_InputArray | ( | const std::vector< std::vector< _Tp > > & | vec | ) |
|
delete |
| cv::_InputArray::_InputArray | ( | const Matx< _Tp, m, n > & | ◆ _OutputArray() [16/38] | ) |
| cv::_InputArray::_InputArray | ( | const double & | val | ) |
| cv::_InputArray::_InputArray | ( | const cuda::GpuMat & | ◆ _OutputArray() [4/38] | ) |
| cv::_InputArray::_InputArray | ( | const std::vector< cuda::GpuMat > & | d_mat_array | ) |
| cv::_InputArray::_InputArray | ( | const ogl::Buffer & | buf | ) |
| cv::_InputArray::_InputArray | ( | const cuda::HostMem & | ogl::Buffer | ) |
| cv::_InputArray::_InputArray | ( | const cudev::GpuMat_< _Tp > & | m | ) |
| cv::_InputArray::_InputArray | ( | const UMat & | um | ) |
| cv::_InputArray::_InputArray | ( | const std::vector< UMat > & | umv | ) |
| cv::_InputArray::_InputArray | ( | const std::array< _Tp, _Nm > & | arr | ) |
| cv::_InputArray::_InputArray | ( | const std::array< Mat, _Nm > & | arr | ) |
| cv::_InputArray::~_InputArray | ( | ) |
| int cv::_InputArray::channels | ( | int | i = -1 | ) | const |
| int cv::_InputArray::cols | ( | int | i = -1 | ) | const |
| void cv::_InputArray::copyTo | ( | const _OutputArray & | arr | ) | const |
| void cv::_InputArray::copyTo | ( | const _OutputArray & | arr, |
| const _InputArray & | mask ) const |
| int cv::_InputArray::depth | ( | int | i = -1 | ) | const |
| int cv::_InputArray::dims | ( | int | i = -1 | ) | const |
| bool cv::_InputArray::empty | ( | ) | const |
| int cv::_InputArray::getFlags | ( | ) | const |
| cuda::GpuMat cv::_InputArray::getGpuMat | ( | ) | const |
| void cv::_InputArray::getGpuMatVector | ( | std::vector< cuda::GpuMat > & | gpumv | ) | const |
| Mat cv::_InputArray::getMat | ( | int | idx = -1 | ) | const |
| Mat cv::_InputArray::getMat_ | ( | int | idx = -1 | ) | const |
| void cv::_InputArray::getMatVector | ( | std::vector< Mat > & | mv | ) | const |
| void * cv::_InputArray::getObj | ( | ) | const |
| ogl::Buffer cv::_InputArray::getOGlBuffer | ( | ) | const |
| Size cv::_InputArray::getSz | ( | ) | const |
| UMat cv::_InputArray::getUMat | ( | int | idx = -1 | ) | const |
| void cv::_InputArray::getUMatVector | ( | std::vector< UMat > & | umv | ) | const |
|
保护 |
|
保护 |
| bool cv::_InputArray::isContinuous | ( | int | i = -1 | ) | const |
| bool cv::_InputArray::isGpuMat | ( | ) | const |
| bool cv::_InputArray::isGpuMatVector | ( | ) | const |
| bool cv::_InputArray::isMat | ( | ) | const |
| bool cv::_InputArray::isMatVector | ( | ) | const |
| bool cv::_InputArray::isMatx | ( | ) | const |
| bool cv::_InputArray::isSubmatrix | ( | int | i = -1 | ) | const |
| bool cv::_InputArray::isUMat | ( | ) | const |
| bool cv::_InputArray::isUMatVector | ( | ) | const |
| bool cv::_InputArray::isVector | ( | ) | const |
| _InputArray::KindFlag cv::_InputArray::kind | ( | ) | const |
| size_t cv::_InputArray::offset | ( | int | i = -1 | ) | const |
|
static |
|
static |
| int cv::_InputArray::rows | ( | int | i = -1 | ) | const |
| bool cv::_InputArray::sameSize | ( | const _InputArray & | arr | ) | const |
| Size cv::_InputArray::size | ( | int | i = -1 | ) | const |
| int cv::_InputArray::sizend | ( | int * | sz, |
| int | i = -1 ) const |
| size_t cv::_InputArray::step | ( | int | i = -1 | ) | const |
| size_t cv::_InputArray::total | ( | int | i = -1 | ) | const |
| int cv::_InputArray::type | ( | int | i = -1 | ) | const |
|
保护 |
|
保护 |
|
保护 |